Documentation
¶
Overview ¶
Package runner defines the handler interface and the structured result every handler returns (RFC 6.3, 7.5, R-RUN-2).
Index ¶
Constants ¶
const ResultSchema = `{"type":"object","additionalProperties":false,"required":["status","summary"],"properties":{` +
`"status":{"type":"string","enum":["done","needs_human","failed"]},` +
`"summary":{"type":"string","maxLength":280},` +
`"reply":{"type":"string","maxLength":32768},` +
`"reply_data":{"type":"object"},` +
`"artifacts":{"type":"array","items":{"type":"object","required":["path"],"properties":{"path":{"type":"string"},"description":{"type":"string"}}}},` +
`"human_question":{"type":"string"},` +
`"followups":{"type":"array","items":{"type":"object","required":["to","kind","intent","subject"],"properties":{` +
`"to":{"type":"string"},"kind":{"type":"string","enum":["tell","ask","event"]},"intent":{"type":"string"},` +
`"subject":{"type":"string"},"body":{"type":"string"},"priority":{"type":"string","enum":["low","normal","high","urgent"]}}}}}}`
ResultSchema is the JSON Schema passed to --json-schema.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Artifact ¶
type Artifact struct {
Path string `json:"path"`
Description string `json:"description,omitempty"`
}
Artifact is a file the handler produced, relative to its workspace.
type Failure ¶
type Failure string
Failure classifies why a run did not produce a result.
const ( FailNone Failure = "" FailTimeout Failure = "timeout" FailOutput Failure = "output_exceeded" FailExit Failure = "exit" FailInvalid Failure = "invalid_result" FailOverload Failure = "overload" FailContext Failure = "context_length" FailCancelled Failure = "cancelled" FailHandlerFailed Failure = "handler_failed" // result status failed FailMaxTurns Failure = "max_turns" FailBudget Failure = "run_budget" FailSessionLost Failure = "session_lost" // --resume id no longer exists )
Failure kinds.
type Followup ¶
type Followup struct {
To string `json:"to"`
Kind string `json:"kind"`
Intent string `json:"intent"`
Subject string `json:"subject"`
Body string `json:"body,omitempty"`
Priority string `json:"priority,omitempty"`
Data json.RawMessage `json:"data,omitempty"`
}
Followup is a message the daemon sends after the run on the worker's behalf.
type Outcome ¶
type Outcome struct {
Result *Result
Failure Failure
Error string
SessionID string
CostUSD float64
InputTokens int64
OutputTokens int64
UsageJSON string
Stderr string
NumTurns int
Repaired bool
}
Outcome is what a runner returns.
type Request ¶
type Request struct {
Agent *config.Agent
Message *envelope.Envelope
Attempt int
RunID string
RunToken string
Profile config.Profile
Workspace string // cwd
BlobDir string // per-run read-only attachment copies
Attachment map[string]string // attachment name -> read-only path
SessionID string // worker session to resume ("" = new)
// ForkSession resumes SessionID as a new session (--fork-session): a
// worker that answers with an interactive session's context (ADR-0013).
ForkSession bool
Memory string // memory.md contents for the policy prompt
Transcript string // where to write the raw stream
Command []string // command handler argv
Timeout int // command handler timeout in seconds
// OnStart reports the process ids; OnSession reports the session id.
OnStart func(pid, pgid int)
OnSession func(id string)
}
Request is what the daemon hands a runner.
type Result ¶
type Result struct {
Status string `json:"status"`
Summary string `json:"summary"`
Reply string `json:"reply,omitempty"`
ReplyData json.RawMessage `json:"reply_data,omitempty"`
Artifacts []Artifact `json:"artifacts,omitempty"`
HumanQuestion string `json:"human_question,omitempty"`
Followups []Followup `json:"followups,omitempty"`
}
Result is the validated handler result.
func ParseResult ¶
ParseResult decodes and validates a result object.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package claude runs Claude Code workers headless (RFC 6.3).
|
Package claude runs Claude Code workers headless (RFC 6.3). |
|
Package command runs deterministic command handlers (RFC 7.5): the envelope on stdin, one JSON result object on stdout, no LLM.
|
Package command runs deterministic command handlers (RFC 7.5): the envelope on stdin, one JSON result object on stdout, no LLM. |