Expand description
Daemon lifecycle: boot → wait-for-ready → bind listener → accept → dispatch → shutdown.
The M1 lifecycle wires:
lock— single-instance lock at startup (THREAT_MODEL F-2).router— backend selection (no-op v0.1 — picks the only one).endpoint— listener bound only afterrouter.all_ready()(THREAT_MODEL F-13).queue— admission gate (SubmitError::QueueFull→ wirecode: queue_full).inferd-proto— frame parsing and serialisation.
Cancellation: dropping a connection drops the in-flight TokenStream,
which closes the engine’s tx and stops the spawned generation task.
Per ADR 0007 the daemon emits no terminal frame on cancel — the EOF
is the signal.
Structs§
- Accept
Context - Per-accept context that the lifecycle hands to every spawned connection task.
- Ready
Timeout - Returned when
wait_for_readyexhausts its budget without seeing readiness across every backend.
Functions§
- handle_
connection - Handle one accepted client connection: read framed
Requests and write framedResponses until EOF or fatal error. - serve_
tcp - Serve a TCP listener: accept loop, spawn one task per connection.
- serve_
uds - Serve a Unix domain socket listener (Unix only).
- wait_
for_ ready - Wait until every backend in
routerreports ready, polling at 50ms intervals up totimeout. Returns the duration spent waiting.