feat(daemon): zot-rpc spawn driver + binary-aware autospawn args (#143) #157

Merged
clawdie merged 1 commit from zot-rpc-spawn-driver into main 2026-06-24 00:36:15 +02:00

1 commit

Author SHA1 Message Date
0e9b16456b feat(daemon): zot-rpc spawn driver + binary-aware autospawn args (colibri#143)
Some checks failed
CI / rust (pull_request) Has been cancelled
CI / markdown (pull_request) Has been cancelled
CI / port (pull_request) Has been cancelled
CI / agent-jail-pkgs (pull_request) Has been cancelled
The spawner spawned every agent with stdin(Stdio::null()) and read stdout
only, so it could only host self-driving emitters (pi --mode json). zot's
only structured persistent mode is `zot rpc`, which is a request/response
peer that blocks on stdin — so it could never autospawn. Worse, 0.12.0
defaulted COLIBRI_AUTOSPAWN_BINARY=zot while args defaulted to --mode json,
which is not a zot flag, so the OOTB image would spawn a broken/no agent.

Add a stdin RPC driver:
- AgentSpawnConfig.rpc_stdin: when set, the spawner pipes stdin and keeps the
  writer; otherwise stdin stays null (unchanged path for pi).
- cmd_spawn_agent auto-detects rpc mode from argv (`rpc`/`--rpc`).
- AgentHandle gains a cloneable RpcSender (Arc-backed) so prompts can be sent
  without holding the agent-registry lock across the async write.
  build_rpc_prompt emits zot's wire format: {"id","type":"prompt","message"}.
- Autospawn picks default argv per harness: zot -> `rpc`, pi -> `--mode json`
  (corrects the invalid --mode-json-for-zot default), and optionally sends a
  one-time bootstrap prompt when COLIBRI_AUTOSPAWN_RPC_PROMPT is set (default
  boot spends no tokens). Log strings de-pi-fied (autospawn-pi -> autospawn).

Tests: build_rpc_prompt framing + escaping, rpc_stdin default, sender presence
by mode. Full workspace: 250 tests, 0 failures. Live zot rpc smoke pending
(wire format matches docs/ZOT-RPC-TRANSCRIPT.md real-key capture).

Stacks on the 0.12.0 compile/lock fix (PR #156).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 17:45:18 +02:00