Documentation
¶
Overview ¶
Package taskmgr coordinates task execution, pending prompts, attachments, and ordered runtime history import.
It sits between the HTTP adapter (internal/server) and task execution (internal/task/taskrun). Manager owns the registry of running tasks and repository checkouts; Lifecycle performs operations for one task.
Two contexts coexist here. Methods accept a request-scoped ctx that is honored for synchronous work (state checks, logging). Background goroutines that must outlive any single request use serverCtx instead — it tracks the lifetime of the Manager itself.
A task incarnation publishes one terminal result through Entry.Finish, and a purge is final for that incarnation: the runtime instance is gone, so a stop that publishes afterwards cannot replace the purged snapshot. Lifecycle operations that publish terminal results, meaning Stop, Revive, and the purge completion, hold operationMu so the result order follows the state order.
Index ¶
- Variables
- type BotPendingTask
- type Code
- type Config
- type CreateParams
- type CreateRepo
- type Entry
- func (e *Entry) Cleanup(fn func())
- func (e *Entry) Done() <-chan struct{}
- func (e *Entry) Finish(r *task.Result)
- func (e *Entry) LoadedTask() *taskhistory.LoadedTask
- func (e *Entry) MonitorBranch() string
- func (e *Entry) PendingInput() *PendingInput
- func (e *Entry) PendingInputImage(id ksid.ID, index int) (v3.ImageData, bool)
- func (e *Entry) RecordHost(ctx context.Context, m agent.Message) error
- func (e *Entry) RecordRepositorySummary(ctx context.Context, read *repo.GitSnapshot) (bool, error)
- func (e *Entry) Reset()
- func (e *Entry) Result() *task.Result
- func (e *Entry) SetLoadedTask(lt *taskhistory.LoadedTask)
- func (e *Entry) SetMonitorBranch(b string)
- func (e *Entry) Task() *taskrun.Task
- type Error
- type ErrorKind
- type ForkParams
- type ForkRepo
- type ImportError
- type Lifecycle
- func (r *Lifecycle) Cancel()
- func (r *Lifecycle) CancelQueuedInput(id ksid.ID) error
- func (r *Lifecycle) ClearContext() error
- func (r *Lifecycle) Close() error
- func (r *Lifecycle) Compact(ctx context.Context, instructions string) error
- func (r *Lifecycle) Fork(ctx context.Context, p *ForkParams) (ksid.ID, error)
- func (r *Lifecycle) ForkDelegated(ctx context.Context, p *ForkParams) (ksid.ID, error)
- func (r *Lifecycle) ForkDelegatedFor(ctx context.Context, parentTaskID ksid.ID, p *ForkParams) (ksid.ID, error)
- func (r *Lifecycle) Purge(ctx context.Context, delay time.Duration) error
- func (r *Lifecycle) QueueInput(ctx context.Context, prompt agent.Prompt) (bool, error)
- func (r *Lifecycle) Restart(ctx context.Context, prompt agent.Prompt) error
- func (r *Lifecycle) Revive() error
- func (r *Lifecycle) SendInput(ctx context.Context, prompt agent.Prompt) error
- func (r *Lifecycle) Start(ctx context.Context, resolvedGitHubToken string) error
- func (r *Lifecycle) Stop(ctx context.Context) error
- func (r *Lifecycle) Sync(ctx context.Context, target SyncTarget, force bool) (*SyncResult, error)
- type Manager
- func (m *Manager) BranchAssociated(repoName, branch string) bool
- func (m *Manager) Cancel()
- func (m *Manager) ChangeSnapshot() (version uint64, changed <-chan struct{})
- func (m *Manager) Changed() <-chan struct{}
- func (m *Manager) Close() error
- func (m *Manager) CompleteRestoration(err error)
- func (m *Manager) Create(ctx context.Context, p CreateParams) (ksid.ID, error)
- func (m *Manager) EffectiveBaseBranch(t *taskrun.Task) string
- func (m *Manager) Entries() iter.Seq2[ksid.ID, *Entry]
- func (m *Manager) FindTasksByPR(owner, repoName string, prNumber int) []*Entry
- func (m *Manager) FindTasksMatchingBranch(owner, repoName, branch string) []*Entry
- func (m *Manager) FindTasksMonitoringBranch(owner, repoName string) []*Entry
- func (m *Manager) GetEntry(taskID ksid.ID) (*Entry, bool)
- func (m *Manager) HistorySource(entry *Entry) (*taskhistory.LoadedTask, error)
- func (m *Manager) ImportInstances(ctx context.Context, instances []runtime.Instance, ...) ([]*Entry, error)
- func (m *Manager) Insert(id ksid.ID, entry *Entry)
- func (m *Manager) LastAgentMessage(ctx context.Context, entry *Entry) (agent.Message, error)
- func (m *Manager) Len() int
- func (m *Manager) ListPendingBotTasks() []BotPendingTask
- func (m *Manager) LoadPurgedTasks(purged []*taskhistory.LoadedTask) error
- func (m *Manager) LoadUnsettledTasks(plain []*taskhistory.LoadedTask) error
- func (m *Manager) NewEntry(t *taskrun.Task, lt *taskhistory.LoadedTask) *Entry
- func (m *Manager) NotifyTaskChange()
- func (m *Manager) Range(fn func(id ksid.ID, e *Entry) bool)
- func (m *Manager) RegisteredLogPaths() map[string]struct{}
- func (m *Manager) RestorationStatus() (loading bool, err string)
- func (m *Manager) SetTaskMonitorBranch(entry *Entry, branch string)
- func (m *Manager) Start(scoper TaskMCPScoper) error
- func (m *Manager) SudoPassword(ctx context.Context, t *taskrun.Task) string
- func (m *Manager) TaskListComplete() bool
- func (m *Manager) TaskMCPAvailable() bool
- func (m *Manager) ToolInput(ctx context.Context, entry *Entry, query *ToolInputQuery) (*agent.ToolUseMessage, error)
- func (m *Manager) WaitForRuntimeImport(ctx context.Context) error
- func (m *Manager) WatchTaskCompletion(ctx context.Context, taskID ksid.ID) (state, result string, err error)
- type NoSessionError
- type PendingInput
- type SyncResult
- type SyncTarget
- type TaskMCPScoper
- type ToolInputQuery
Constants ¶
This section is empty.
Variables ¶
var ( // ErrToolUseAmbiguous reports a provider tool-use ID recorded by more than // one source, which a query without a source cannot resolve. ErrToolUseAmbiguous = errors.New("tool use ID is ambiguous; specify its source") // ErrToolUseNotFound reports a tool-use ID absent from the task's history. ErrToolUseNotFound = errors.New("tool use not found") )
var ErrNoSession = errors.New("no active session")
ErrNoSession is a sentinel reported by Manager.SendInput when the task has no active agent session to forward input to.
The returned *NoSessionError wraps the underlying task.SendInput diagnostic and, when recovery was attempted, the reconnect failure.
Functions ¶
This section is empty.
Types ¶
type BotPendingTask ¶
BotPendingTask is returned by ListPendingBotTasks.
type Code ¶ added in v0.12.0
type Code string
Code identifies a specific task-manager error within its broader ErrorKind.
const ( // CodeUnknownHarness reports a coding agent harness that is unavailable. CodeUnknownHarness Code = "UNKNOWN_HARNESS" // CodeUnknownRepository reports a repository that is not registered with caic. CodeUnknownRepository Code = "UNKNOWN_REPOSITORY" // CodeUnsupportedModel reports a model unavailable from the selected harness. CodeUnsupportedModel Code = "UNSUPPORTED_MODEL" // CodeUnknownRuntime reports a runtime that is unavailable. CodeUnknownRuntime Code = "UNKNOWN_RUNTIME" )
type Config ¶
type Config struct {
// ServerCtx tracks the Manager's own lifetime. Used as the parent for
// background goroutines that must survive individual requests.
ServerCtx context.Context
Log *slog.Logger
// LogStore is the task-log directory the Manager appends task logs to. It
// must be non-nil.
LogStore *taskhistory.Store
// Runtimes validates runtime selection and dispatches task runtime operations.
Runtimes *runtime.Router
Backends agent.Backends
HarnessEnv map[string][]string
RuntimeMetadata runtime.Metadata
RuntimeStartTimeout time.Duration
EnsureSessionTimeout time.Duration
Provider genai.Provider // nil-safe
// Pricer resolves per-model token pricing for cost reporting. When nil,
// a default quota-provider pricer is used.
Pricer quotausage.ModelPricer
// Rollup consumes task messages for the cross-task usage rollup. Required.
Rollup task.RollupSink
Checkouts *repo.Registry
}
Config holds the dependencies Manager needs at construction.
type CreateParams ¶
type CreateParams struct {
OwnerID string // empty in no-auth mode
Prompt agent.Prompt
Repos []CreateRepo // first entry is primary; empty = no-repo
Harness harness.Name
ResumeSessionID string // opaque harness-native session ID; empty starts a fresh session
Model string // "" = harness default
Effort string // thinking effort; empty = default
Tailscale bool
USB bool
Display bool
Sudo bool
GitHubToken bool // inject GitHub token into the runtime environment
RuntimeName runtime.Name // selected runtime backend; empty means backend default
BaseImage string // resolved base image
ContainerPlatform string // resolved container platform; empty means use host default
MaxCPUs int // max CPU cores; 0 means use the default
CacheMounts []runtime.CacheMount // resolved build cache mounts
Mounts []runtime.Mount // resolved runtime bind mounts
CaicMCP bool // grant this task its task-scoped CAIC MCP capability
// ResolvedGitHubToken is the actual token string, resolved by the caller in
// the request ctx; passed to checkout.Start. The caller resolves it (preferring
// the logged-in user's OAuth token) because the Manager's serverCtx carries
// no user identity.
ResolvedGitHubToken string
// Bot-task fields. The HTTP path leaves these zero (no-op); the bot sets them
// so ListPendingBotTasks and commenter resolution work. When ForgeOwner is
// non-empty, Create calls t.SetPR(ForgeOwner, ForgeRepo, 0).
ForgeIssue int
ForgeOwner string
ForgeRepo string
}
CreateParams bundles the HTTP path's task-creation parameters. The caller (Server) reads docker image, GitHub token access, and per-repo prefs from the user's preferences store before calling Create.
type CreateRepo ¶
type CreateRepo struct {
Name string // relative path
BaseBranch string // empty = checkout default
}
CreateRepo describes a repo to mount in the new task.
type Entry ¶
type Entry struct {
// Immutable.
Lifecycle *Lifecycle
// LogPath owns the current physical log path for this entry lifecycle.
LogPath taskslog.Path
// contains filtered or unexported fields
}
Entry is a single registered task plus its mutable lifecycle state.
Concurrency: task, lifecycle, and historyInMemory are immutable after registration. LogPath manages its own synchronization. The terminal state is an immutable snapshot published through term; see entryTerminal. pendingInput, loadedTask, monitorBranch, and cleanupOnce are guarded by mu and must only be accessed through methods. historyMemo is guarded by historyGate.
func (*Entry) Cleanup ¶
func (e *Entry) Cleanup(fn func())
Cleanup runs fn exactly once per incarnation. Used to guard checkout.Cleanup against racing Stop/Purge calls.
func (*Entry) Done ¶
func (e *Entry) Done() <-chan struct{}
Done returns the channel that closes when the task reaches a terminal state. Revival or clearing a result after reconnect returns a fresh channel; goroutines that captured the previous channel will see a stale (already-closed) reference.
func (*Entry) Finish ¶
Finish records the completion result and closes the done channel in one step: the snapshot is stored before done closes, so any goroutine that observes Done() closed is guaranteed to also observe Result(). Concurrent callers race and the last store wins, except that a purged result is final: the purge removes the runtime instance, and the stop it superseded can publish its older snapshot afterwards. If the task is already terminal, Finish only refreshes the result.
func (*Entry) LoadedTask ¶
func (e *Entry) LoadedTask() *taskhistory.LoadedTask
LoadedTask returns the on-disk log handle, or nil before a task log has been validated for stored-history reads.
func (*Entry) MonitorBranch ¶
MonitorBranch returns the branch being monitored for CI, or "".
func (*Entry) PendingInput ¶ added in v0.15.0
func (e *Entry) PendingInput() *PendingInput
PendingInput returns this task's immutable pending prompt, or nil.
func (*Entry) PendingInputImage ¶ added in v0.15.0
PendingInputImage returns an original attachment only if the pending identity matches.
func (*Entry) RecordHost ¶ added in v0.15.0
RecordHost commits a backend control through the entry's journal owner.
func (*Entry) RecordRepositorySummary ¶ added in v0.15.0
RecordRepositorySummary commits a fresh repository observation before publishing it.
func (*Entry) Reset ¶
func (e *Entry) Reset()
Reset prepares the entry for Revive: a fresh terminal snapshot with an open done channel and no result, plus a new cleanupOnce. Only safe when the task is in a terminal state and no goroutine is concurrently touching the entry's mutable fields.
func (*Entry) Result ¶
Result returns the completion result of the current incarnation, or nil if the task hasn't completed.
func (*Entry) SetLoadedTask ¶ added in v0.11.5
func (e *Entry) SetLoadedTask(lt *taskhistory.LoadedTask)
SetLoadedTask records a freshly validated on-disk log handle for stored-history reads.
func (*Entry) SetMonitorBranch ¶
SetMonitorBranch records the branch to monitor for CI.
type Error ¶
type Error struct {
Kind ErrorKind
Code Code
Msg string
Err error // wrapped underlying error, if any
}
Error is a typed error returned by Manager lifecycle methods. Kind classifies the failure; the HTTP layer maps it to a status code. An optional wrapped error is preserved for errors.Is/errors.As.
type ErrorKind ¶
type ErrorKind int
ErrorKind classifies a taskmgr.Error so the HTTP layer can map it to a status code without inspecting the message string.
const ( // KindInternal is an unexpected or infrastructure failure (HTTP 500). KindInternal ErrorKind = iota // KindNotFound is a missing task or resource (HTTP 404). KindNotFound // KindConflict is a state/precondition violation (HTTP 409). KindConflict // KindBadRequest is invalid input (HTTP 400). KindBadRequest )
type ForkParams ¶
type ForkParams struct {
OwnerID string
Prompt agent.Prompt
Harness harness.Name // empty = use source's harness
Model string // empty = use source's model
Effort string
ExtraRepos []ForkRepo
GitHubToken bool // resolved override (handler derefs *bool, defaults to source)
Tailscale bool // resolved override (handler derefs *bool, defaults to source)
USB bool // resolved override
Display bool // resolved override
Sudo bool // resolved override
// ResolvedGitHubToken is the actual token string, resolved by the caller in
// the request ctx; passed to checkout.ForkTask. The caller resolves it
// (preferring the logged-in user's OAuth token) because the Manager's
// serverCtx carries no user identity.
ResolvedGitHubToken string
// contains filtered or unexported fields
}
ForkParams bundles fork task creation parameters.
The GitHubToken, Tailscale, USB, Display, and Sudo fields are resolved booleans: the HTTP handler dereferences the request's *bool overrides (falling back to the source task's value when nil) before calling Fork.
type ImportError ¶ added in v0.14.0
ImportError reports how many runtime instances failed task restoration. Instances skipped because they do not belong to caic are not failures.
func (*ImportError) Error ¶ added in v0.14.0
func (e *ImportError) Error() string
Error returns the underlying restoration diagnostics.
func (*ImportError) Unwrap ¶ added in v0.14.0
func (e *ImportError) Unwrap() error
Unwrap exposes the underlying restoration errors.
type Lifecycle ¶ added in v0.11.5
type Lifecycle struct {
// contains filtered or unexported fields
}
Lifecycle coordinates state transitions, session watching, and user operations for one entry. Manager owns the entry registry and shared state.
func (*Lifecycle) Cancel ¶ added in v0.15.0
func (r *Lifecycle) Cancel()
Cancel rejects new execution and interrupts local producers without sealing the journal.
func (*Lifecycle) CancelQueuedInput ¶ added in v0.15.0
CancelQueuedInput removes a prompt only if it still belongs to this task's queue.
func (*Lifecycle) ClearContext ¶ added in v0.11.5
ClearContext starts a fresh idle agent session.
func (*Lifecycle) Close ¶ added in v0.11.5
Close stops local producers and waits for lifecycle-owned recording and background work.
func (*Lifecycle) Compact ¶ added in v0.11.5
Compact asks the active agent session to compact its context.
func (*Lifecycle) Fork ¶ added in v0.11.5
Fork initializes and publishes a new task with readable history, then forks this task's retained runtime instance asynchronously.
p must be non-nil.
func (*Lifecycle) ForkDelegated ¶ added in v0.12.0
ForkDelegated creates a child from this task's server-owned runtime snapshot. The source task is recorded as the child's parent; callers cannot choose it.
func (*Lifecycle) ForkDelegatedFor ¶ added in v0.13.0
func (r *Lifecycle) ForkDelegatedFor(ctx context.Context, parentTaskID ksid.ID, p *ForkParams) (ksid.ID, error)
ForkDelegatedFor creates a child from this task's runtime snapshot for a server-authorized delegating task.
func (*Lifecycle) Purge ¶ added in v0.11.5
Purge removes a stopped task immediately. Active tasks are stopped first and retain their runtime resources for delay so they can be revived.
func (*Lifecycle) QueueInput ¶ added in v0.15.0
QueueInput appends to a pending prompt, or sends immediately when waiting. Otherwise it persists a new pending prompt. It reports whether the prompt was queued rather than sent.
func (*Lifecycle) SendInput ¶ added in v0.11.5
SendInput forwards prompt to the agent session, reconnecting when needed.
func (*Lifecycle) Start ¶ added in v0.11.5
Start starts the runtime and agent session for a newly registered task.
func (*Lifecycle) Stop ¶ added in v0.11.5
Stop transitions the task to stopping and stops its runtime without purging it. Failed and crashed tasks can retain a running instance after partial startup.
func (*Lifecycle) Sync ¶ added in v0.11.5
func (r *Lifecycle) Sync(ctx context.Context, target SyncTarget, force bool) (*SyncResult, error)
Sync pushes task commits to each repository's task or default branch and publishes refreshed diff statistics and repository state after a successful push.
type Manager ¶
type Manager struct {
// Immutable.
agent.Backends
Runtimes *runtime.Router
QuotaTracker *quotausage.Tracker
Checkouts *repo.Registry
// contains filtered or unexported fields
}
Manager owns task lifecycle state, durable prompt queues, runtime import, session watching, and stats streaming.
func (*Manager) BranchAssociated ¶ added in v0.12.0
BranchAssociated reports whether a nonterminal task has claimed branch for repoName.
func (*Manager) Cancel ¶ added in v0.15.0
func (m *Manager) Cancel()
Cancel stops admission and signals local producers without closing their journals. App calls Cancel before joining automation; Close then joins all producers and seals the accepted task tails. Repeated cancellation is safe.
func (*Manager) ChangeSnapshot ¶ added in v0.13.0
ChangeSnapshot returns the current task-change version and its notification channel. Callers that re-arm a change subscription must retain the version: it lets them install the replacement channel before handling the update that woke them, preventing another mutation in that handling window from being missed.
func (*Manager) Changed ¶
func (m *Manager) Changed() <-chan struct{}
Changed returns a channel that is closed on task mutation.
func (*Manager) Close ¶ added in v0.11.2
Close stops background work and waits for task lifecycles and all Manager watchers to finish.
func (*Manager) CompleteRestoration ¶ added in v0.14.0
CompleteRestoration records the outcome after runtime and history restoration. A non-nil error leaves the registered partial subset usable, but prevents a task-list snapshot from certifying absence. Callers include errors from each restoration stage; a successful subsequent pass clears the previous error.
func (*Manager) Create ¶
Create initializes branch identity and history before publishing a task, then starts its runtime asynchronously. Preparation failures return without registering a task.
func (*Manager) EffectiveBaseBranch ¶
EffectiveBaseBranch returns the branch the task was forked from.
func (*Manager) Entries ¶ added in v0.12.0
Entries returns a point-in-time sequence of registered task entries.
The iteration order is unspecified. The sequence owns a shallow snapshot, so callers do not hold the manager lock while yielding entries.
func (*Manager) FindTasksByPR ¶
FindTasksByPR returns all entries matching the given forge owner/repo and PR number.
func (*Manager) FindTasksMatchingBranch ¶
FindTasksMatchingBranch returns all entries for a forge owner/repo where the primary repo branch matches the given branch.
func (*Manager) FindTasksMonitoringBranch ¶
FindTasksMonitoringBranch returns all entries that match the given forge owner/repo and have a monitor branch set.
func (*Manager) HistorySource ¶ added in v0.11.5
func (m *Manager) HistorySource(entry *Entry) (*taskhistory.LoadedTask, error)
HistorySource opens a header-only raw-log reader for stopped or terminal history. It is the cold-history path: live readers should use the Task timeline rather than repeatedly reparsing its growing log.
func (*Manager) ImportInstances ¶ added in v0.11.5
func (m *Manager) ImportInstances(ctx context.Context, instances []runtime.Instance, allLogs []*taskhistory.LoadedTask) ([]*Entry, error)
ImportInstances registers preexisting runtime instances as tasks. Failures return an ImportError counting affected instances alongside successful entries.
func (*Manager) Insert ¶
Insert registers a pre-built entry. Production task creation goes through Create/Fork; Insert is retained for tests (in internal/tasks and internal/server) that seed the registry without a real checkout.
func (*Manager) LastAgentMessage ¶ added in v0.15.0
LastAgentMessage returns the newest text, question, or result message the task's agent produced outside a child source, or nil when it produced none.
Live and adopted tasks read their in-memory timeline. Restored cold tasks decode their log once and retain the answer until the log changes, because a whole-log decode costs seconds on a large task.
func (*Manager) ListPendingBotTasks ¶
func (m *Manager) ListPendingBotTasks() []BotPendingTask
ListPendingBotTasks returns non-terminal tasks that have a ForgeIssue set.
func (*Manager) LoadPurgedTasks ¶
func (m *Manager) LoadPurgedTasks(purged []*taskhistory.LoadedTask) error
LoadPurgedTasks registers settled task logs selected by the taskslog settled scan, which already caps entries per repo before a full decode.
func (*Manager) LoadUnsettledTasks ¶ added in v0.11.6
func (m *Manager) LoadUnsettledTasks(plain []*taskhistory.LoadedTask) error
LoadUnsettledTasks loads plain (uncompressed) task logs into the registry without any per-repo cap. Plain logs are the working set: live tasks, terminal logs not yet compressed, and abandoned logs. The caller scans with the retention cutoff, so only recent logs arrive here.
func (*Manager) NewEntry ¶ added in v0.11.5
func (m *Manager) NewEntry(t *taskrun.Task, lt *taskhistory.LoadedTask) *Entry
NewEntry creates an unregistered entry with its immutable lifecycle.
func (*Manager) NotifyTaskChange ¶
func (m *Manager) NotifyTaskChange()
NotifyTaskChange signals that task data may have changed.
func (*Manager) Range ¶
Range iterates over every registered entry. It snapshots the registry under m.mu and invokes fn unlocked, so fn may safely call back into the Manager (e.g. Checkout). The entry set is a point-in-time snapshot; Entry pointers are stable and carry their own locking. Stops iteration if fn returns false.
func (*Manager) RegisteredLogPaths ¶ added in v0.11.6
RegisteredLogPaths returns the set of cleaned log paths currently owned by registered entries. Maintenance passes use it to exclude logs owned by entries so they yield to the per-task terminal compression path.
func (*Manager) RestorationStatus ¶ added in v0.14.0
RestorationStatus reports the background task-restoration state atomically: loading is true until CompleteRestoration runs, and error is non-empty only after a failed pass. Both fields are read under one lock so a concurrent CompleteRestoration cannot interleave between two separate reads.
func (*Manager) SetTaskMonitorBranch ¶
SetTaskMonitorBranch sets the CI monitor branch on a task entry. Equivalent to entry.SetMonitorBranch; kept for backend.Backend interface symmetry.
func (*Manager) Start ¶
func (m *Manager) Start(scoper TaskMCPScoper) error
Start activates m with its task-scoped MCP authority and starts its runtime event and stats watchers. It subscribes to events before startup inventory is listed, and ImportInstances applies any buffered events after registration.
func (*Manager) SudoPassword ¶
SudoPassword returns the cached sudo password for a task, fetching it from the instance on first access.
Returns "" when the task does not use sudo or has no instance yet. The fetched password is cached on the task so subsequent calls avoid the SSH round-trip. A lookup failure is logged and returns "".
func (*Manager) TaskListComplete ¶ added in v0.14.0
TaskListComplete reports whether task-list absence is authoritative. Runtime import must have released its startup fence and all restoration stages must have completed successfully. Read before assembling the task-list snapshot.
func (*Manager) TaskMCPAvailable ¶ added in v0.12.0
TaskMCPAvailable reports whether new tasks can receive the bounded MCP capability.
func (*Manager) ToolInput ¶ added in v0.15.0
func (m *Manager) ToolInput(ctx context.Context, entry *Entry, query *ToolInputQuery) (*agent.ToolUseMessage, error)
ToolInput resolves the recorded input of one tool invocation. A zero query source accepts any owner but reports ErrToolUseAmbiguous instead of guessing, and a cold task retains a bounded number of answers so revisiting a tool does not decode its whole log again.
func (*Manager) WaitForRuntimeImport ¶ added in v0.14.0
WaitForRuntimeImport waits until startup restores live task ownership. It returns immediately before Start or after import completion. Callers remain cancellation-aware while creation or an unresolved lookup is fenced.
type NoSessionError ¶
type NoSessionError struct {
Err error // underlying task.SendInput diagnostic error
ReconnectErr error // reconnect failure, if recovery was attempted
}
NoSessionError wraps the underlying task.SendInput error when there is no active agent session.
func (*NoSessionError) Error ¶
func (e *NoSessionError) Error() string
Error returns the diagnostic message, including reconnect failure if present.
func (*NoSessionError) Is ¶
func (e *NoSessionError) Is(target error) bool
Is reports a match against the ErrNoSession sentinel.
func (*NoSessionError) Unwrap ¶
func (e *NoSessionError) Unwrap() []error
Unwrap returns the underlying errors for errors.Is/errors.As traversal.
type PendingInput ¶ added in v0.15.0
type PendingInput struct {
ID ksid.ID
Prompt agent.Prompt
Delivering bool
Error string
Delivered bool
}
PendingInput is an immutable pending prompt and its delivery state.
Callers must not modify its fields or Prompt.Images. State changes publish a new value so a retained pointer remains safe to read.
type SyncResult ¶
type SyncResult struct {
Status string // "synced", "empty", "blocked"
Branch string
DiffStat v3.DiffStat
SafetyIssues []repo.SafetyIssue
}
SyncResult holds the outcome of a Sync operation.
type SyncTarget ¶
type SyncTarget string
SyncTarget specifies where to push changes.
const ( // SyncTargetOrigin pushes to the task's own branch on origin. SyncTargetOrigin SyncTarget = "origin" // SyncTargetDefault pushes to the repo's default branch. SyncTargetDefault SyncTarget = "default" )
type TaskMCPScoper ¶ added in v0.12.0
TaskMCPScoper derives a server-authorized MCP registry for a task.
The task manager supplies only its trusted task ID. The server owns the authorization policy that turns that ID into an MCP capability.
type ToolInputQuery ¶ added in v0.15.0
type ToolInputQuery struct {
// ToolUseID is the provider-reported tool ID.
ToolUseID string
// Source scopes the ID to one provider origin. Its zero value accepts any
// origin and reports ErrToolUseAmbiguous instead of guessing.
Source agent.MessageSource
}
ToolInputQuery selects one recorded tool invocation.