Documentation
¶
Overview ¶
Package peerhttp implements a remote runner that forwards a job to a peer gofer over HTTP (plan §11.1, P7).
Model: the host bridge does NOT resolve the agent/command/cwd locally for a peer-http job. It re-submits the ORIGINAL request (carried in runner.Request.Forward) to the peer's /v1/jobs with runner="local" (or the configured peer runner); the peer resolves and executes it using its OWN config. The host then consumes the peer's SSE stream to MIRROR the peer's log output into the local job's stdout.log / stderr.log (so the local /logs, /stream and list stay transparently usable for the proxied job) and to learn the authoritative terminal exit code / status. Host-side cancel/timeout flows through ctx and is forwarded to the peer.
The SSE stream also carries the peer's running-job interactions (P9): an `interaction` event with action "open" is bridged onto the HOST job via req.Interactions (an InteractionSink) so the host's HTTP/Web/MCP surface the prompt; when the user answers on the host, the runner POSTs that answer back to the peer's answer endpoint so the peer job resumes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner forwards jobs to a peer bridge identified by a base URL + token.
func New ¶
New builds a peer-http runner named name targeting baseURL with token (empty token => no Authorization header; the peer must allow empty-token auth).
func (*Runner) Run ¶
Run forwards req.Forward to the peer, mirrors the peer's logs into req.Stdout/Stderr and returns the peer's authoritative terminal result.
- req.Forward must be set (the job service populates it for remote runners); a nil Forward is a programming error and yields ExitCode -1.
- The host context (req's ctx) carries cancel/timeout: when it ends, the peer job is cancelled best-effort. The job service classifies the resulting status from ctx + Result, so this runner does not itself decide cancelled vs timeout.