WireServeBoot extension

fa wire-serve boot (issue #1103): heads the agent stack WITHOUT any REPL/TUI and hands a pure WireServeServer to the transport loop in serve (NDJSON-stdio or loopback WebSocket — both live in bin/).

Boot mirrors run's session machinery (lease, presence, subagent rehydrate, job watcher) minus everything interactive; teardown mirrors _teardownAfterRepl so the session JSONL persists exactly as a REPL session would and stays resumable via fa --session. Host-interaction surfaces (approval prompt, ask, request_secret) are re-wired onto the wire protocol: the silent CliIO is non-interactive, so the constructor's null callbacks are REPLACED here — a host that cannot answer must never silently deny a critical-pattern call.

on

Methods

runWireServe({required Future<void> serve(WireServeServer server), void onDiagnostic(String line)?, void onReady()?}) → Future<int>

Available on AgentCli, provided by the WireServeBoot extension

Runs the wire-serve loop until serve completes (stdin EOF, SIGTERM handling, or a fatal transport error — the transport decides). An in-flight run is aborted and given a bounded settle window first; the transcript persists, then normal teardown runs. Returns the process exit code (0; 3 when an ownership lease blocks the boot). onReady fires after the boot (and its lease gate) succeeded but before the transport starts — the WS host prints its one stdout startup line there, so a parent never reads a startup line for a serve that refuses to boot. Decomposed into one-decision helpers — each stays at cyclomatic 3 or under, the CRAP ratchet floor for code CI cannot cover (the CRAP lcov excludes integration tests, and only an integration run can drive this boot).