Documentation
¶
Index ¶
- Constants
- func BuildChildPrompt(project *config.ProjectConfig, target string, prompt string, skill string) ([]byte, error)
- func ResolvePrompt(args []string, stdin io.Reader, readStdin bool) (string, error)
- func Run(opts RunOptions) error
- func WriteOptions(req OptionsRequest) error
- type CallerInfo
- type CommandFactory
- type ExitError
- type FieldOption
- type OptionsRequest
- type OptionsResponse
- type RandomChooser
- type RandomInfo
- type RunOptions
- type StreamingOption
- type TargetOption
Constants ¶
const ( // AgentCodex is the Codex dispatch target and caller marker value. AgentCodex = "codex" // AgentClaude is the Claude dispatch target and caller marker value. AgentClaude = "claude" // AgentAntigravity is the Antigravity dispatch target and caller marker value. AgentAntigravity = "antigravity" // AgentRandom is the resolver value that selects an eligible target at random. AgentRandom = "random" )
const ( // ExitUsage is the stable dispatch usage/resolution failure exit code. ExitUsage = 64 // ExitConfig is the stable dispatch configuration/state failure exit code. ExitConfig = 65 ExitUnavailable = 69 // ExitTargetFailure is the stable dispatch target/adapter failure exit code. ExitTargetFailure = 70 // ExitNested is the stable dispatch nested-call failure exit code. ExitNested = 75 // ExitSigint is the stable dispatch SIGINT exit code. ExitSigint = 130 // ExitSigterm is the stable dispatch SIGTERM exit code. ExitSigterm = 143 )
const AntigravityPrintTimeout = "24h"
AntigravityPrintTimeout is the print-mode timeout used for dispatch. The value and required space-separated flag form come from the 2026-05-22 local `agy --help` and print-mode probe recorded in .agent-layer/tmp/agent-dispatch-design.md.
const AntigravityPromptMaxBytes = 100 * 1024
AntigravityPromptMaxBytes caps the prompt size for the Antigravity adapter. agy --print accepts the prompt only as an argv element (no stdin/file path exists today), which is subject to the OS ARG_MAX limit (~128 KB Linux / ~256 KB macOS). 100 KB is well below both caps and leaves headroom for the other argv elements; oversize prompts fail fast with ExitUsage rather than surfacing as an opaque execve failure.
const MaxStdinPromptBytes = 10 * 1024 * 1024
MaxStdinPromptBytes caps stdin reads when resolving the dispatch prompt so a runaway producer cannot exhaust process memory. 10 MiB is well above any realistic agent prompt and below typical container memory budgets.
Variables ¶
This section is empty.
Functions ¶
func BuildChildPrompt ¶
func BuildChildPrompt(project *config.ProjectConfig, target string, prompt string, skill string) ([]byte, error)
BuildChildPrompt validates the optional skill and returns exact target-native prompt bytes for the selected target.
func ResolvePrompt ¶
ResolvePrompt returns the caller prompt. Positional args win over piped stdin.
func Run ¶
func Run(opts RunOptions) error
Run executes one Agent Dispatch target according to the v1 dispatch contract.
func WriteOptions ¶
func WriteOptions(req OptionsRequest) error
WriteOptions renders options as JSON or human-readable text.
Types ¶
type CallerInfo ¶
CallerInfo describes env-only dispatch caller detection.
type CommandFactory ¶
CommandFactory creates a command for a target adapter.
type ExitError ¶
ExitError carries a dispatch-owned exit category and the message already written or intended for stderr by the CLI wrapper.
type FieldOption ¶
type FieldOption struct {
OverrideSupported bool `json:"override_supported"`
Configured string `json:"configured"`
Suggestions []string `json:"suggestions"`
AllowCustom bool `json:"allow_custom"`
}
FieldOption describes dispatch override metadata for one target field.
type OptionsRequest ¶
type OptionsRequest struct {
Root string
Env []string
Stdout io.Writer
JSON bool
LookPath func(string) (string, error)
}
OptionsRequest configures an Agent Dispatch options response.
type OptionsResponse ¶
type OptionsResponse struct {
Caller CallerInfo `json:"caller"`
Random RandomInfo `json:"random"`
Targets []TargetOption `json:"targets"`
}
OptionsResponse is the stable v1 machine-readable Agent Dispatch options shape.
func BuildOptions ¶
func BuildOptions(req OptionsRequest) (*OptionsResponse, error)
BuildOptions loads strict project config and builds the v1 options response.
type RandomChooser ¶
RandomChooser selects one target from an already-built random pool.
type RandomInfo ¶
type RandomInfo struct {
Pool []string `json:"pool"`
ExcludesCaller bool `json:"excludes_caller"`
Empty bool `json:"empty"`
}
RandomInfo describes the current random-selection pool.
type RunOptions ¶
type RunOptions struct {
Root string
Agent string
Model string
ReasoningEffort string
Skill string
PromptArgs []string
Stdin io.Reader
ReadStdin bool
Stdout io.Writer
Stderr io.Writer
Env []string
Quiet bool
LookPath func(string) (string, error)
NewCommand CommandFactory
ChooseRandom RandomChooser
}
RunOptions configures a single dispatch run.
type StreamingOption ¶
type StreamingOption struct {
AnswerText string `json:"answer_text"`
Progress string `json:"progress"`
}
StreamingOption describes target output streaming capability.
type TargetOption ¶
type TargetOption struct {
Agent string `json:"agent"`
Enabled bool `json:"enabled"`
Installed bool `json:"installed"`
DispatchCapable bool `json:"dispatch_capable"`
RandomEligible bool `json:"random_eligible"`
RandomExclusionReason *string `json:"random_exclusion_reason"`
Streaming StreamingOption `json:"streaming"`
Model FieldOption `json:"model"`
ReasoningEffort FieldOption `json:"reasoning_effort"`
}
TargetOption describes one dispatch target in the options response.