Documentation
¶
Index ¶
- Constants
- func BuildChildPrompt(project *config.ProjectConfig, target string, prompt string, skill string) ([]byte, error)
- func Cancel(request CancelRequest) error
- func Continue(opts ContinueOptions) error
- func RunWorker(root string, runID string, gate io.Reader) error
- func Start(opts StartOptions) error
- func Wait(request WaitRequest) error
- func WriteOptions(req OptionsRequest) error
- type AgentOption
- type CancelRequest
- type CapabilityOption
- type CommandFactory
- type ContinueOptions
- type ExitError
- type FieldOption
- type OptionsRequest
- type OptionsResponse
- type RunRecord
- type Session
- type StartOptions
- type WaitRequest
Constants ¶
const ( // AntigravityPromptMaxBytes retains headroom below common ARG_MAX limits // because Antigravity accepts print-mode prompts only as an argument. AntigravityPromptMaxBytes = 100 * 1024 // AntigravityPrintTimeout keeps a headless dispatch alive long enough for // a normal agent turn while the runner remains responsible for cancellation. AntigravityPrintTimeout = "24h" )
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 rejected by start: every conversation names its exact agent. 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 MaxStdinPromptBytes = 10 * 1024 * 1024
MaxStdinPromptBytes caps prompt sources (--prompt text and --prompt-file contents) 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 Cancel ¶ added in v0.14.0
func Cancel(request CancelRequest) error
Cancel terminates only the exact Agent Layer-owned process group.
func Continue ¶ added in v0.14.0
func Continue(opts ContinueOptions) error
Continue starts the next invocation in an existing terminal conversation.
func RunWorker ¶ added in v0.14.0
RunWorker executes one prepared invocation after its parent authorizes it.
func Start ¶ added in v0.14.0
func Start(opts StartOptions) error
Start creates a durable conversation and returns as soon as its worker is authorized to begin. The worker cannot contact the provider before the complete handle response has been written.
func Wait ¶ added in v0.14.0
func Wait(request WaitRequest) error
Wait blocks until the current invocation for one conversation is terminal.
func WriteOptions ¶
func WriteOptions(req OptionsRequest) error
WriteOptions renders the discovery contract as one JSON object.
Types ¶
type AgentOption ¶ added in v0.14.0
type AgentOption struct {
Agent string `json:"agent"`
Available bool `json:"available"`
Model FieldOption `json:"model"`
ReasoningEffort FieldOption `json:"reasoning_effort"`
}
AgentOption describes one selectable provider and its optional overrides.
type CancelRequest ¶ added in v0.14.0
CancelRequest identifies one active invocation by handle or run UUID.
type CapabilityOption ¶ added in v0.14.0
CapabilityOption is an internal provider-availability result.
type CommandFactory ¶
CommandFactory creates a command for a target adapter.
type ContinueOptions ¶ added in v0.14.0
type ContinueOptions struct {
Root string
WorkDir string
Handle string
Prompt string
PromptFile string
Stdout io.Writer
Stderr io.Writer
Env []string
LookPath func(string) (string, error)
VersionLookup func(path string, agent string) (string, error)
// contains filtered or unexported fields
}
ContinueOptions configures one asynchronous continuation of a conversation.
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:"supported"`
Configured string `json:"configured"`
Suggestions []string `json:"suggestions"`
AllowCustom bool `json:"allow_custom"`
}
FieldOption describes an optional start override.
type OptionsRequest ¶
type OptionsRequest struct {
Root string
Env []string
Stdout io.Writer
LookPath func(string) (string, error)
VersionLookup func(path string, agent string) (string, error)
}
OptionsRequest configures an Agent Dispatch options response.
type OptionsResponse ¶
type OptionsResponse struct {
Agents []AgentOption `json:"agents"`
}
OptionsResponse describes the agents that may be selected by dispatch start.
func BuildOptions ¶
func BuildOptions(req OptionsRequest) (*OptionsResponse, error)
BuildOptions loads strict project config and reports valid start selections.
type RunRecord ¶ added in v0.14.0
type RunRecord struct {
ID string `json:"id"`
Name string `json:"name"`
Agent string `json:"agent"`
ProviderVersion string `json:"provider_version"`
Model string `json:"model,omitempty"`
ReasoningEffort string `json:"reasoning_effort,omitempty"`
Skill string `json:"skill,omitempty"`
Mode string `json:"mode"`
State string `json:"state"`
RecoveryState string `json:"recovery_state"`
Revision uint64 `json:"revision"`
Attempt int `json:"attempt"`
PID int `json:"pid,omitempty"`
ProcessGroupID int `json:"process_group_id,omitempty"`
ProcessStartIdentity string `json:"process_start_identity,omitempty"`
SupervisorPID int `json:"supervisor_pid,omitempty"`
SupervisorStartIdentity string `json:"supervisor_start_identity,omitempty"`
LauncherPID int `json:"launcher_pid,omitempty"`
LauncherStartIdentity string `json:"launcher_start_identity,omitempty"`
StartedAt time.Time `json:"started_at"`
UpdatedAt time.Time `json:"updated_at"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
ProviderSessionID string `json:"provider_session_id,omitempty"`
PreviousRunID string `json:"previous_run_id,omitempty"`
ParentRunID string `json:"parent_run_id,omitempty"`
NotResumable bool `json:"not_resumable,omitempty"`
TerminalReason string `json:"terminal_reason,omitempty"`
TerminalExitCode int `json:"terminal_exit_code,omitempty"`
LastOutputAt *time.Time `json:"last_output_at,omitempty"`
LastActivityAt *time.Time `json:"last_activity_at,omitempty"`
AnswerPath string `json:"answer_path"`
StdoutPath string `json:"stdout_path"`
StderrPath string `json:"stderr_path"`
EventsPath string `json:"events_path,omitempty"`
LineagePath string `json:"lineage_path,omitempty"`
ProviderLogPath string `json:"provider_log_path,omitempty"`
}
RunRecord is private, recoverable dispatch evidence. It never contains the caller prompt or a provider transcript.
type Session ¶ added in v0.14.0
type Session struct {
Name string `json:"name"`
Agent string `json:"agent"`
Model string `json:"model,omitempty"`
ReasoningEffort string `json:"reasoning_effort,omitempty"`
TargetPinned bool `json:"target_pinned,omitempty"`
ProviderSessionID string `json:"provider_session_id,omitempty"`
CreatedAt time.Time `json:"created_at"`
LastUsedAt time.Time `json:"last_used_at"`
State string `json:"state,omitempty"`
RunID string `json:"run_id,omitempty"`
ActiveRunID string `json:"active_run_id,omitempty"`
ActiveClaimKnown bool `json:"active_claim_known,omitempty"`
}
Session is the durable, name-keyed mapping owned by Agent Layer. Provider transcripts remain provider-owned; this record contains only the alias needed for explicit continuation.
type StartOptions ¶ added in v0.14.0
type StartOptions struct {
Root string
WorkDir string
Agent string
Model string
ReasoningEffort string
Skill string
Prompt string
PromptFile string
Stdout io.Writer
Stderr io.Writer
Env []string
LookPath func(string) (string, error)
VersionLookup func(path string, agent string) (string, error)
// contains filtered or unexported fields
}
StartOptions configures the first asynchronous invocation of a conversation.