Documentation
¶
Overview ¶
Package taskflow owns deterministic task synchronization and execution coordination. It does not create a second scheduler or lend provider tokens to models, browsers, or mesh peers.
Index ¶
- Variables
- type Action
- type AutomationOptions
- type AuxiliaryModel
- type ConnectOptions
- type ConnectResult
- type Connection
- type DraftConsent
- type FilePublication
- type Policy
- type ProjectBinding
- type RequestedExecution
- type ResearchBrief
- type RunSummary
- type Service
- func (s *Service) ApproveAction(ctx context.Context, id, fingerprint string) error
- func (s *Service) Bindings(ctx context.Context, connection, space string) ([]ProjectBinding, error)
- func (s *Service) ConfigureExecution(c *core.Core, opts AutomationOptions)
- func (s *Service) Connect(ctx context.Context, opts ConnectOptions) (ConnectResult, error)
- func (s *Service) CreateTask(ctx context.Context, connection, space string, input taskproviders.Snapshot, ...) (taskproviders.Snapshot, error)
- func (s *Service) DecideDelivery(ctx context.Context, id string, revision uint64, decision, reason string) error
- func (s *Service) Disconnect(ctx context.Context, id string) error
- func (s *Service) FinishConnect(ctx context.Context, id string) (Connection, error)
- func (s *Service) Get(ctx context.Context, id string) (Connection, error)
- func (s *Service) List(ctx context.Context) ([]Connection, error)
- func (s *Service) LookupPolicy(ctx context.Context, connection, space string) (Policy, bool, error)
- func (s *Service) Members(ctx context.Context, id, space string) ([]taskproviders.Member, error)
- func (s *Service) PatchTask(ctx context.Context, connection string, key taskproviders.Key, revision string, ...) (taskproviders.Snapshot, error)
- func (s *Service) PauseWork(ctx context.Context, request string) error
- func (s *Service) Policy(ctx context.Context, connection, space string) (Policy, error)
- func (s *Service) RejectAction(ctx context.Context, id, fingerprint string) error
- func (s *Service) RequestExecution(ctx context.Context, connection string, key taskproviders.Key, ...) (RequestedExecution, error)
- func (s *Service) RequestFirstDraft(ctx context.Context, connection string, key taskproviders.Key, ...) (RequestedExecution, error)
- func (s *Service) RequestSync(ctx context.Context, id string) error
- func (s *Service) Research(ctx context.Context, connection, key string) ([]ResearchBrief, error)
- func (s *Service) Run(ctx context.Context) error
- func (s *Service) Runs(ctx context.Context, connection, key string) ([]RunSummary, error)
- func (s *Service) SetBinding(ctx context.Context, connection, space string, b ProjectBinding) error
- func (s *Service) SetPolicy(ctx context.Context, connection, space string, p Policy) error
- func (s *Service) Start(ctx context.Context) error
- func (s *Service) SyncNow(ctx context.Context, id string) error
- func (s *Service) Wait(ctx context.Context) error
- func (s *Service) Work(ctx context.Context, request string) (WorkRun, error)
- type SyncStatus
- type WorkDelivery
- type WorkRun
Constants ¶
This section is empty.
Variables ¶
var ErrBudget = errors.New("automation token budget exhausted")
var ErrConcurrency = errors.New("local execution concurrency limit reached")
ErrConcurrency is a normal per-connection wait, not a failure of discovery for other accounts or connections. Foreground requests still report it.
var ErrEmptyPreparation = errors.New("automation preparation returned no content")
var ErrRuntimeHeld = errors.New("task synchronization runtime is owned by another process")
var ErrStale = errors.New("task connection changed during synchronization")
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
ID string `json:"actionId"`
RequestID string `json:"requestId"`
DeliveryID string `json:"deliveryId"`
Revision uint64 `json:"deliveryRevision"`
Fingerprint string `json:"fingerprint"`
Intent finalaction.FileIntent `json:"intent"`
State string `json:"state"`
Proof tsync.SignedProof `json:"-"`
Receipt *finalaction.Receipt `json:"receipt,omitempty"`
// contains filtered or unexported fields
}
type AutomationOptions ¶
type AutomationOptions struct {
Model func() AuxiliaryModel
PrivateMemory func() ([]string, error)
ProjectMemory func(string) ([]string, error)
}
AutomationOptions is installed only by the process owning the core. Model access is tool-free and uses the user's live configuration and credentials.
type AuxiliaryModel ¶
type ConnectOptions ¶
type ConnectResult ¶
type ConnectResult struct {
Connection Connection `json:"connection"`
Authorization tsync.Authorization `json:"authorization"`
}
type Connection ¶
type Connection struct {
ID string `json:"connectionId"`
Provider string `json:"provider"`
Root string `json:"rootUrl"`
AccountID string `json:"accountId"`
InstanceID string `json:"instanceId"`
DeviceID string `json:"deviceId"`
AuthEpoch string `json:"authEpoch"`
State string `json:"state"`
FeedEpoch string `json:"feedEpoch"`
Capabilities taskproviders.Capabilities `json:"capabilities"`
Spaces []taskproviders.Space `json:"spaces"`
Scopes []string `json:"scopes"`
LastError string `json:"lastError"`
SyncedAt int64 `json:"syncedAt"`
NextSyncAt int64 `json:"nextSyncAt"`
RequestedAt int64 `json:"requestedAt"`
Failures int `json:"failures"`
Generation int64 `json:"-"`
// contains filtered or unexported fields
}
Connection is safe for the local UI. The credential reference and generation are internal bookkeeping; tokens and signing material never enter SQLite.
type DraftConsent ¶
type DraftConsent struct {
AccountID string `json:"accountId"`
AuthEpoch string `json:"authEpoch"`
TaskRevision string `json:"taskRevision"`
}
DraftConsent binds a new draft-only policy to the task and account on screen.
type FilePublication ¶
type FilePublication struct {
Directory string `json:"directory"`
DirectoryIdentity string `json:"directoryIdentity,omitempty"`
Filename string `json:"filename"`
FullGoal bool `json:"fullGoal"`
}
FilePublication is explicit local authorization. The model cannot choose a directory or filename. FullGoal is a separate human assertion of coverage; it defaults to false, keeping a published draft from completing the task.
type Policy ¶
type Policy struct {
Research bool `json:"research"`
Execute bool `json:"execute"`
FinalAction bool `json:"finalAction"`
Mode taskproviders.ApprovalMode `json:"mode"`
ExpiresAt int64 `json:"expiresAt"`
MaxConcurrent int `json:"maxConcurrent"`
DailyTokens int `json:"dailyTokens"`
PreparationTokens int `json:"preparationTokens"`
TaskIDs []string `json:"taskIds"`
ProjectID string `json:"projectId"`
Capabilities []string `json:"capabilities"`
Publication *FilePublication `json:"publication,omitempty"`
}
Policy is local, account/space scoped operation authorization. A remote task cannot edit it. Connecting a provider creates no policy and grants only sync. Capabilities are enforced by concrete adapters; draft has no tools or network access beyond the configured model transport.
type ProjectBinding ¶
type ProjectBinding struct {
RemoteProject string `json:"remoteProjectId"`
LocalProject string `json:"localProject"`
}
ProjectBinding is an explicit account-scoped mapping. An empty RemoteProject binds a space; an empty LocalProject in SetBinding removes that mapping. Directory and execution permissions remain the local project's own settings.
type RequestedExecution ¶
type ResearchBrief ¶
type RunSummary ¶
type RunSummary struct {
RequestID string `json:"requestId"`
ConnectionID string `json:"connectionId"`
TaskKey string `json:"taskKey"`
Title string `json:"title"`
State string `json:"state"`
Error string `json:"error"`
Mode taskproviders.ApprovalMode `json:"mode"`
UpdatedAt int64 `json:"updatedAt"`
// contains filtered or unexported fields
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) ApproveAction ¶
ApproveAction is the local user's specific final-submit consent. A changed fingerprint or delivery revision cannot reuse it. Mode after_execution uses the same immutable consent binding under explicit local preauthorization.
func (*Service) ConfigureExecution ¶
func (s *Service) ConfigureExecution(c *core.Core, opts AutomationOptions)
ConfigureExecution must precede queue startup. The core also fails closed when this owner or a fresh cloud lease is unavailable.
func (*Service) Connect ¶
func (s *Service) Connect(ctx context.Context, opts ConnectOptions) (ConnectResult, error)
func (*Service) CreateTask ¶
func (s *Service) CreateTask(ctx context.Context, connection, space string, input taskproviders.Snapshot, command string) (taskproviders.Snapshot, error)
func (*Service) DecideDelivery ¶
func (s *Service) DecideDelivery(ctx context.Context, id string, revision uint64, decision, reason string) error
DecideDelivery records one immutable, revision-bound human decision. Repeating it reuses its original proof and event; a contrary decision requires a new delivery revision. Returning work never claims to undo a physical action.
func (*Service) FinishConnect ¶
func (*Service) LookupPolicy ¶
LookupPolicy distinguishes an explicitly disabled policy from a new space.
func (*Service) Members ¶
Members reads only the directory for the current authorized subject. A revoked or replaced connection cannot expose a previous account's cache.
func (*Service) PatchTask ¶
func (s *Service) PatchTask(ctx context.Context, connection string, key taskproviders.Key, revision string, patch json.RawMessage, command string) (taskproviders.Snapshot, error)
func (*Service) RejectAction ¶
func (*Service) RequestExecution ¶
func (s *Service) RequestExecution(ctx context.Context, connection string, key taskproviders.Key, requestID string) (RequestedExecution, error)
RequestExecution requests the current canonical generation. Explicit reruns are human TaskSync operations; device requests cannot create a new generation or bypass local policy. The owning runtime later claims the cloud slot.
func (*Service) RequestFirstDraft ¶
func (s *Service) RequestFirstDraft(ctx context.Context, connection string, key taskproviders.Key, requestID string, consent DraftConsent) (RequestedExecution, error)
func (*Service) Research ¶
Research remains private and is hidden immediately after assignment, policy expiry, scope loss, input changes or account replacement.
func (*Service) Run ¶
Run belongs to the node owner, not to a browser request or borrowed front end. Closing any page leaves this duty running; cancelling ownership stops requests and joins the lease heartbeat before returning.
func (*Service) SetBinding ¶
func (*Service) Start ¶
Start waits for the ownership/recovery barrier; only then may the caller start the core scheduler. Run remains available for sync-only owners.
func (*Service) SyncNow ¶
SyncNow is a bounded one-shot owner for a CLI with no daemon. When a persistent owner exists, callers leave RequestSync queued for that owner.
type SyncStatus ¶
type SyncStatus struct {
EventID string `json:"eventId"`
Kind string `json:"kind"`
State string `json:"state"`
Error string `json:"error"`
Attempts int `json:"attempts"`
NextAt int64 `json:"nextAt"`
}
SyncStatus intentionally contains no signed proof, request body or credential.
type WorkDelivery ¶
type WorkRun ¶
type WorkRun struct {
RequestID string `json:"requestId"`
TaskKey string `json:"taskKey"`
State string `json:"state"`
Error string `json:"error"`
Prepared string `json:"prepared"`
Deliveries []WorkDelivery `json:"deliveries"`
Actions []Action `json:"actions"`
ConnectionID string `json:"connectionId"`
Title string `json:"title"`
Mode taskproviders.ApprovalMode `json:"mode"`
Sync []SyncStatus `json:"sync"`
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package finalaction provides concrete, enforceable side effect adapters.
|
Package finalaction provides concrete, enforceable side effect adapters. |