Documentation
¶
Overview ¶
Package agentrunner centralizes spawning `infer agent` as a subprocess and streaming its stdout. It is the single implementation shared by the channel manager, scheduler, heartbeat, and the Agent tool (local subagents), so the spawn/scan/approval-IPC loop lives in exactly one place.
It is a leaf package (imports only domain + stdlib) so callers in the services, services/scheduler, and services/heartbeat packages can all depend on it without an import cycle.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecFunc ¶
ExecFunc matches exec.CommandContext. It is a type alias (not a defined type) so callers' own named exec-override types stay assignable without conversion.
type Options ¶
type Options struct {
// BinaryPath is the infer binary to spawn; defaults to os.Args[0] when empty.
BinaryPath string
// Exec overrides command construction (tests); defaults to exec.CommandContext.
Exec ExecFunc
SessionID string
Prompt string
Model string
Files []string
RequireApproval bool
Remote bool
Heartbeat bool
// ResultFile, when set, passes --result-file so the agent writes its final
// assistant message to a JSON file on exit (used by detached/tmux runs).
ResultFile string
// ExtraEnv is appended to os.Environ() for the subprocess (e.g. depth guard).
ExtraEnv []string
// OnLine is called for each non-empty raw stdout line. Approval-request
// lines handled internally (see Approval) are not passed to OnLine.
OnLine func(line []byte)
// Approval, when set and RequireApproval is true, resolves a tool approval
// request into a response that is written back to the agent's stdin. It
// blocks until the decision is made.
Approval func(domain.ApprovalRequest) domain.ApprovalResponse
}
Options configures a single `infer agent` subprocess run.
type Result ¶
type Result struct {
// FinalAssistant is the last non-empty assistant message content seen on
// stdout - the harvested "answer" of the run.
FinalAssistant string
// Stderr is the full captured standard error (also mirrored live to os.Stderr).
Stderr string
}
Result is the outcome of a subprocess run.