Documentation
¶
Index ¶
- Constants
- type Event
- type Registry
- func (r *Registry) Close()
- func (r *Registry) Counts() (running, total int)
- func (r *Registry) Done() <-chan struct{}
- func (r *Registry) Events() <-chan Event
- func (r *Registry) Get(id string) *Task
- func (r *Registry) Launch(description, agentType string, ...) (*Task, error)
- func (r *Registry) List() []*Task
- func (r *Registry) Publish(ev Event)
- func (r *Registry) Relaunch(t *Task, run func(ctx context.Context, t *Task) (string, error)) error
- func (r *Registry) Stop(id string) error
- type Status
- type Task
- func (t *Task) Activity() string
- func (t *Task) Elapsed() time.Duration
- func (t *Task) PeekMessages() []agent.Message
- func (t *Task) Result() string
- func (t *Task) Resume(prompt string) error
- func (t *Task) Seq() int
- func (t *Task) SetActivity(text string)
- func (t *Task) SetPeek(fn func() []agent.Message)
- func (t *Task) SetResume(fn func(prompt string) error)
- func (t *Task) Status() Status
Constants ¶
const ( MaxConcurrent = 4 MaxPerSession = 50 // MaxRunDuration bounds one background run so a hung model stream cannot // occupy a concurrency slot forever. MaxRunDuration = 30 * time.Minute )
const KindCommand = "command"
KindCommand marks events published for backgrounded shell commands rather than subagent runs; those have no Task in the registry.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
Task *Task
ID string
Kind string
Description string
AgentType string
Seq int
Status Status
Result string
Elapsed time.Duration
}
Event is an immutable snapshot of one finished run, taken before the task can be resumed — delivery must never read the live task, which a relaunch may already have reset.
func (Event) Label ¶ added in v0.11.6
Label names the event source for status lines and notifications.
func (Event) Notification ¶
Notification renders the model-facing completion block delivered as hidden context by every UI surface.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry tracks the background subagents of one session. Completed tasks stay listed for task_output until the session ends; completion events are buffered so a consumer that attaches late still receives them.
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) Close ¶
func (r *Registry) Close()
Close cancels all running tasks and stops event delivery.
func (*Registry) Done ¶
func (r *Registry) Done() <-chan struct{}
Done is closed when the registry shuts down, so event consumers can exit.
func (*Registry) Launch ¶
func (r *Registry) Launch(description, agentType string, run func(ctx context.Context, t *Task) (string, error)) (*Task, error)
Launch starts run in a goroutine detached from the launching tool call; it is canceled only by Stop or Close. The returned error reports cap or shutdown rejections, never run failures — those surface via the task. run receives the task so it can publish activity and a transcript peek.
func (*Registry) Publish ¶ added in v0.11.6
Publish delivers an external background event (e.g. an exec_command exit) through the session's notification channel alongside subagent completions.
type Task ¶
type Task struct {
ID string
Description string
AgentType string
Started time.Time
// contains filtered or unexported fields
}
func (*Task) PeekMessages ¶
func (*Task) Seq ¶
Seq counts the task's runs: 1 for the initial launch, +1 per resume. It distinguishes the completion notifications of successive runs.
func (*Task) SetActivity ¶
SetActivity records what the agent is currently doing (e.g. its running tool call) for live status displays.
func (*Task) SetPeek ¶
SetPeek installs a snapshot function for the agent's transcript so UIs can watch a running task and re-read a finished one.