Documentation
¶
Index ¶
- Constants
- func BuildFinalResult(events []streamjson.Event, stderrOutput string, processExitCode int, ...) tools.Result
- func FormatList(result LoadResult) string
- func FormatMarkdown(manifest Manifest) string
- func FormatPaths(paths Paths) string
- func FormatShow(manifest Manifest) string
- func ParseStream(reader io.Reader) ([]streamjson.Event, error)
- func ResolveTools(selection []string) ([]string, error)
- func SplitToolList(value string) []string
- func Validate(manifest *Manifest) error
- func WrapResumePrompt(prompt string) string
- func WrapSystemPrompt(name string, systemPrompt string, prompt string, description string) string
- type BackgroundManagerFunc
- type BuildArgsInput
- type BuildArgsResult
- type BuildResumeArgsInput
- type ChildRunResult
- type CreateInput
- type DeleteInput
- type ExecResult
- type Executor
- func (executor Executor) BuildArgs(input BuildArgsInput) (BuildArgsResult, error)
- func (executor Executor) BuildResumeArgs(input BuildResumeArgsInput) (BuildArgsResult, error)
- func (executor Executor) IsReadOnlySpecialist(name string) bool
- func (executor Executor) Run(ctx context.Context, params TaskParameters, options TaskRunOptions) (ExecResult, error)
- type GenerateTool
- type LaunchBackgroundFunc
- type LoadFunc
- type LoadOptions
- type LoadResult
- type Location
- type Manifest
- type Metadata
- type NewSessionIDFunc
- type OutputTool
- type Paths
- type RunChildFunc
- type Runtime
- type RuntimeOptions
- type StopTool
- type Storage
- type StreamResult
- type StreamUsage
- type Summary
- type TaskParameters
- type TaskRunOptions
- type TaskTool
- func (tool *TaskTool) Description() string
- func (tool *TaskTool) Name() string
- func (tool *TaskTool) Parameters() tools.Schema
- func (tool *TaskTool) PermissionForArgs(args map[string]any) tools.Permission
- func (tool *TaskTool) Run(ctx context.Context, args map[string]any) tools.Result
- func (tool *TaskTool) RunWithOptions(ctx context.Context, args map[string]any, options tools.RunOptions) tools.Result
- func (tool *TaskTool) Safety() tools.Safety
- type WritePromptFileFunc
Constants ¶
View Source
const SessionTagSpecialist = sessionTagSpecialist
View Source
const TaskToolName = "Task"
Variables ¶
This section is empty.
Functions ¶
func BuildFinalResult ¶
func FormatList ¶
func FormatList(result LoadResult) string
func FormatMarkdown ¶
func FormatPaths ¶
func FormatShow ¶
func ParseStream ¶
func ParseStream(reader io.Reader) ([]streamjson.Event, error)
func ResolveTools ¶
func SplitToolList ¶
SplitToolList parses comma- or whitespace-separated specialist tool selections.
func WrapResumePrompt ¶
Types ¶
type BackgroundManagerFunc ¶
type BackgroundManagerFunc func() (*background.Manager, error)
type BuildArgsInput ¶
type BuildArgsInput struct {
Manifest Manifest
Prompt string
ParentSessionID string
ParentToolUseID string
ParentModel string
ParentReasoningEffort string
CurrentDepth int
Description string
Cwd string
// PermissionMode is the parent's resolved permission mode. Only an explicit
// unsafe mode runs the child at "--auto high"; empty or any other value is
// fail-safe "low", so a caller that forgets to wire it never escalates the
// child to unsafe. Authority is therefore never widened beyond the parent.
PermissionMode string
// MemberAutonomy marks a headless swarm member: when set and the parent is
// non-unsafe, the child runs at "--auto member" (PermissionModeMemberAuto) so
// it can write/edit + run sandboxed shell IN the workspace, instead of the
// read-only "--auto low". Off by default, so the Task tool's specialists are
// unchanged. The sandbox still confines writes to the workspace root.
MemberAutonomy bool
}
type BuildArgsResult ¶
type BuildResumeArgsInput ¶
type ChildRunResult ¶
type ChildRunResult struct {
Events []streamjson.Event
Stderr string
ExitCode int
// Signal is a human-readable description (e.g. "signal: killed") when the child
// was terminated by a signal rather than exiting normally; empty otherwise. It
// turns an opaque exit -1 into an actionable reason (SIGKILL ~ out of memory).
Signal string
Started bool
}
type CreateInput ¶
type DeleteInput ¶
type ExecResult ¶
type Executor ¶
type Executor struct {
NewSessionID NewSessionIDFunc
WritePromptFile WritePromptFileFunc
PromptFileMaxSize int
Load LoadFunc
RunChild RunChildFunc
LaunchBackground LaunchBackgroundFunc
BinaryPath string
Paths Paths
SessionStore *sessions.Store
BackgroundManager *background.Manager
BackgroundManagerFunc BackgroundManagerFunc
BackgroundRuntime *Runtime
}
func (Executor) BuildArgs ¶
func (executor Executor) BuildArgs(input BuildArgsInput) (BuildArgsResult, error)
func (Executor) BuildResumeArgs ¶
func (executor Executor) BuildResumeArgs(input BuildResumeArgsInput) (BuildArgsResult, error)
func (Executor) IsReadOnlySpecialist ¶
IsReadOnlySpecialist reports whether the named specialist resolves to a read-only tool set. Unknown names and load errors return false, so a caller (the Task tool's permission gate) stays on the safe prompt path when in doubt.
func (Executor) Run ¶
func (executor Executor) Run(ctx context.Context, params TaskParameters, options TaskRunOptions) (ExecResult, error)
type GenerateTool ¶
type GenerateTool struct {
// contains filtered or unexported fields
}
func NewGenerateTool ¶
func NewGenerateTool(storage *Storage) *GenerateTool
func (*GenerateTool) Description ¶
func (tool *GenerateTool) Description() string
func (*GenerateTool) Name ¶
func (tool *GenerateTool) Name() string
func (*GenerateTool) Parameters ¶
func (tool *GenerateTool) Parameters() tools.Schema
func (*GenerateTool) Safety ¶
func (tool *GenerateTool) Safety() tools.Safety
type LaunchBackgroundFunc ¶
type LoadFunc ¶
type LoadFunc func(LoadOptions) (LoadResult, error)
type LoadOptions ¶
type LoadOptions struct {
Paths Paths
}
type LoadResult ¶
type LoadResult struct {
Paths Paths `json:"paths"`
Specialists []Manifest `json:"specialists"`
Warnings []string `json:"warnings,omitempty"`
}
func Load ¶
func Load(options LoadOptions) (LoadResult, error)
type Manifest ¶
type Manifest struct {
Metadata Metadata `json:"metadata"`
SystemPrompt string `json:"systemPrompt"`
ResolvedTools []string `json:"resolvedTools,omitempty"`
Location Location `json:"location"`
FilePath string `json:"filePath"`
LastModified time.Time `json:"lastModified,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}
func ParseMarkdown ¶
type NewSessionIDFunc ¶
type OutputTool ¶
type OutputTool struct {
SessionStore *sessions.Store
PollInterval time.Duration
DefaultTimeout time.Duration
MaxTimeout time.Duration
// contains filtered or unexported fields
}
func NewOutputTool ¶
func NewOutputTool(manager *background.Manager) *OutputTool
func (*OutputTool) Description ¶
func (tool *OutputTool) Description() string
func (*OutputTool) Name ¶
func (tool *OutputTool) Name() string
func (*OutputTool) Parameters ¶
func (tool *OutputTool) Parameters() tools.Schema
func (*OutputTool) Safety ¶
func (tool *OutputTool) Safety() tools.Safety
type Paths ¶
type Paths struct {
UserDir string `json:"userDir"`
ProjectDir string `json:"projectDir,omitempty"`
}
func DefaultPaths ¶
type RunChildFunc ¶
type RunChildFunc func(ctx context.Context, binaryPath string, args []string, progress func(streamjson.Event)) (ChildRunResult, error)
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func NewRuntime ¶
func NewRuntime(options RuntimeOptions) *Runtime
func RegisterTools ¶
func (*Runtime) TrackPromptFile ¶
func (*Runtime) UntrackPromptFile ¶
type RuntimeOptions ¶
type RuntimeOptions struct {
Manager *background.Manager
ManagerFunc BackgroundManagerFunc
}
type StopTool ¶
type StopTool struct {
// contains filtered or unexported fields
}
func NewStopTool ¶
func NewStopTool(manager *background.Manager) *StopTool
func (*StopTool) Description ¶
func (*StopTool) Parameters ¶
type StreamResult ¶
type StreamResult struct {
Events []streamjson.Event
RunID string
SessionID string
Text string
Tools []string
Errors []string
Status string
ExitCode int
Usage StreamUsage
}
func SummarizeStream ¶
func SummarizeStream(events []streamjson.Event, processExitCode int) StreamResult
type StreamUsage ¶
func (StreamUsage) EffectiveTotalTokens ¶
func (usage StreamUsage) EffectiveTotalTokens() int
func (StreamUsage) HasUsage ¶
func (usage StreamUsage) HasUsage() bool
type Summary ¶
type Summary struct {
Name string `json:"name"`
Description string `json:"description"`
Extends string `json:"extends,omitempty"`
Model string `json:"model,omitempty"`
ReasoningEffort string `json:"reasoningEffort,omitempty"`
Tools []string `json:"tools,omitempty"`
ResolvedTools []string `json:"resolvedTools,omitempty"`
Location Location `json:"location"`
FilePath string `json:"filePath"`
Warnings []string `json:"warnings,omitempty"`
}
type TaskParameters ¶
type TaskParameters struct {
Name string
Prompt string
Description string
RunInBackground bool
Resume string
// Manifest, when non-nil, supplies the specialist definition inline instead
// of resolving Name against the specialist registry. It is validated before
// use. The swarm launcher sets this so a swarm member can run from its own
// agent definition (e.g. "subagent"/"teammate"), which is not a registered
// specialist and would otherwise fail the name lookup.
Manifest *Manifest
}
type TaskRunOptions ¶
type TaskRunOptions struct {
ToolCallID string
ParentSessionID string
ParentModel string
ParentReasoningEffort string
CurrentDepth int
Cwd string
// PermissionMode propagates the parent's resolved permission mode to the
// child. Only an explicit unsafe mode runs the child unsafe; empty or any
// other value is fail-safe "low", so the child never gains more authority
// than the parent.
PermissionMode string
// MemberAutonomy marks a headless swarm member so it can write/edit + run
// sandboxed shell in the workspace (see BuildArgsInput.MemberAutonomy). Off
// for Task-tool specialists.
MemberAutonomy bool
// Progress, when set, is called with each stream-json event emitted by the
// child process while it runs. nil is a no-op.
Progress func(streamjson.Event)
}
type TaskTool ¶
type TaskTool struct {
// contains filtered or unexported fields
}
func NewTaskTool ¶
func (*TaskTool) Description ¶
func (*TaskTool) Parameters ¶
func (*TaskTool) PermissionForArgs ¶
func (tool *TaskTool) PermissionForArgs(args map[string]any) tools.Permission
PermissionForArgs auto-approves delegating to a READ-ONLY specialist — it can only read the workspace, so spawning it is harmless — while keeping the static prompt for write-capable specialists (e.g. worker) and for resume. This lets the orchestrator delegate exploration/review off a normal prompt without an approval wall. Implements tools.ArgsPermissioner.
func (*TaskTool) RunWithOptions ¶
type WritePromptFileFunc ¶
Click to show internal directories.
Click to hide internal directories.