Documentation
¶
Index ¶
- func DelegateDefinition(presets *PresetRegistry) tools.Definition
- type DelegateConfig
- type DelegateFinished
- type DelegatePreset
- type DelegateStarted
- type DelegateTool
- type ManagedSessionRequest
- type ManagedSessionResult
- type PresetRegistry
- type PresetRoot
- type SessionRunRequest
- type SessionRunResult
- type SessionRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DelegateDefinition ¶
func DelegateDefinition(presets *PresetRegistry) tools.Definition
DelegateDefinition returns the tool definition without requiring a live config. presets is optional — when provided, the preset enum is included in the schema.
Types ¶
type DelegateConfig ¶
type DelegateConfig struct {
Stream providers.StreamFunc
Registry *tools.Registry
Model ai.Model
System string
Emit func(agent.LoopEvent) // optional event emitter for observability
Presets *PresetRegistry // loaded delegate presets (nil = no presets)
// ToolMeta declares the generated tools, so a preset's tools: list can name
// a family. Nil means exact-name matching only.
ToolMeta *toolmeta.Registry
Hooks *hooks.HookSet // inherited by delegates (nil = no hooks)
ToolLifecycle *agent.ToolLifecycle
SessionRunner SessionRunner // runs delegate work through persistent agent sessions
// Configurable limits (zero = use defaults).
MaxConcurrency int // max parallel delegate goroutines
DefaultTimeout time.Duration // default delegate wall-clock timeout (0 = 15m)
}
DelegateConfig holds the dependencies needed to spawn delegate loops.
type DelegateFinished ¶
type DelegateFinished struct {
TaskID string `json:"taskId"`
Duration time.Duration `json:"duration"`
Error string `json:"error,omitempty"`
}
DelegateFinished is emitted when a delegate task completes.
func (DelegateFinished) Kind ¶
func (DelegateFinished) Kind() string
type DelegatePreset ¶
type DelegatePreset struct {
Name string // unique identifier
Description string // human-readable description
System string // markdown body = system prompt for the delegate
Tools []string // nil = all tools; empty slice = no tools
HasTools bool // true when tools is explicitly set (even if empty)
Timeout time.Duration // wall-clock timeout override; 0 = use global default
Model string // empty = inherit parent model
Source string // "project", "agent", "user", or "builtin"
}
DelegatePreset defines a reusable delegate configuration loaded from a markdown file.
func LoadDelegatePresets ¶
func LoadDelegatePresets(files pkgsandbox.FileAccess, roots []PresetRoot) []DelegatePreset
LoadDelegatePresets loads embedded release presets, then discovers overrides through the active Session filesystem in increasing priority order.
type DelegateStarted ¶
type DelegateStarted struct {
TaskID string `json:"taskId"`
Preset string `json:"preset,omitempty"`
}
DelegateStarted is emitted when a delegate task begins execution.
func (DelegateStarted) Kind ¶
func (DelegateStarted) Kind() string
type DelegateTool ¶
type DelegateTool struct {
// contains filtered or unexported fields
}
DelegateTool spawns child loops for bounded subtasks.
func NewDelegateTool ¶
func NewDelegateTool(cfg DelegateConfig) *DelegateTool
NewDelegateTool creates a delegate tool with the given configuration.
func (*DelegateTool) Definition ¶
func (t *DelegateTool) Definition() tools.Definition
func (*DelegateTool) RunManagedSession ¶ added in v0.63.3
func (t *DelegateTool) RunManagedSession(ctx context.Context, req ManagedSessionRequest) (ManagedSessionResult, error)
RunManagedSession executes one Session-tool create or send through the existing delegate path. Keeping this as a single-task adapter avoids a second preset or timeout implementation that could drift from delegate.
type ManagedSessionRequest ¶ added in v0.63.3
ManagedSessionRequest is one synchronous managed Session turn. It is shared with the Session tool so that it resolves presets, timeout, system override, and tool exclusions through the same path as delegate.
type ManagedSessionResult ¶ added in v0.63.3
type ManagedSessionResult struct {
SessionID string
Output string
OutputTruncated bool
Complete bool
}
ManagedSessionResult is the bounded caller-facing result of a managed Session turn. Output is bounded by the Session tool, not this delegate layer.
type PresetRegistry ¶
type PresetRegistry struct {
// contains filtered or unexported fields
}
PresetRegistry holds loaded delegate presets with O(1) lookup.
func NewPresetRegistry ¶
func NewPresetRegistry(presets []DelegatePreset) *PresetRegistry
NewPresetRegistry creates a registry from a slice of presets.
func (*PresetRegistry) All ¶
func (r *PresetRegistry) All() []DelegatePreset
All returns all loaded presets.
func (*PresetRegistry) Lookup ¶
func (r *PresetRegistry) Lookup(name string) (DelegatePreset, bool)
Lookup returns a preset by name and whether it exists.
func (*PresetRegistry) Names ¶
func (r *PresetRegistry) Names() []string
Names returns all available preset names in load order.
type PresetRoot ¶ added in v0.64.0
PresetRoot is one process-visible delegate search tier.
type SessionRunRequest ¶
type SessionRunRequest struct {
SessionID string
Task string
Model string
System string
ExcludedTools []string
Timeout time.Duration
ProjectID string
}
SessionRunRequest describes a single persisted delegate turn.
type SessionRunResult ¶
SessionRunResult is the output from a persisted delegate session.
type SessionRunner ¶
type SessionRunner interface {
RunDelegateSession(context.Context, SessionRunRequest) (SessionRunResult, error)
}
SessionRunner runs delegate work through the owning agent pool so child transcripts are persisted and resumable like normal sessions.