Documentation
¶
Overview ¶
Package runtime defines the execution seam (backlog AO-014, spec §6.2).
core depends only on these interfaces; the concrete executors live in the exec module (exec/native spawns real CLIs, exec/fake powers unit tests) and are wired in by cmd/fort. This is the only path from core to execution.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventType ¶
type EventType string
EventType enumerates normalized run events streamed from any runtime.
const ( EventStarted EventType = "started" // process spawned EventStdout EventType = "stdout" // raw stdout line EventStderr EventType = "stderr" // raw stderr line EventMessage EventType = "message" // normalized assistant/output message EventExited EventType = "exited" // process exited (Code set) EventError EventType = "error" // runtime-level error (Data set) )
type Run ¶
type Run interface {
ID() string
// Stream returns the event channel; it is closed when the run terminates.
Stream() <-chan RunEvent
// Signal injects input into a running interactive task (HITL).
Signal(input string) error
// Cancel terminates the run.
Cancel() error
// Status returns the current status.
Status() Status
// Wait blocks until the run terminates and returns the terminal status.
Wait() Status
}
Run is a handle to a dispatched invocation: stream (events), status, and signal (stdin injection for human-in-the-loop) + cancel.
type RunEvent ¶
type RunEvent struct {
RunID string `json:"run_id"`
Type EventType `json:"type"`
Time time.Time `json:"time"`
Data string `json:"data,omitempty"`
Code int `json:"code,omitempty"` // exit code for EventExited
}
RunEvent is one normalized event in a run's stream.
type RunSpec ¶
type RunSpec struct {
RunID string // caller-assigned id, echoed back on the Run
Agent string // provider key: claude | codex | openclaw | hermes
Prompt string // the task body handed to the CLI
Workdir string // scoped working directory
Env []string // additional KEY=VALUE pairs
// Machine is the resolved target host (spec 022). Empty means "here": the
// local runtime handles it. A non-local name routes the spec to that
// machine's runtime (exec/cluster). Providers ignore this field.
Machine string
}
RunSpec describes one agent invocation.
type Runtime ¶
type Runtime interface {
// Dispatch launches spec and returns a Run handle. The returned Run begins
// streaming immediately; the caller drains Stream() and/or calls Wait().
Dispatch(ctx context.Context, spec RunSpec) (Run, error)
// Name identifies the runtime implementation (for diagnostics).
Name() string
}
Runtime spawns agent invocations. Implementations must be safe for concurrent Dispatch calls.