async fn handle_connection(stream: NamedPipeServer, ctx: Arc<ServerCtx>)Expand description
Drive one connection: read newline-delimited JSON Commands,
write back JSON Events. First message MUST be Register.
Phase B.3: every Command goes through reducer::update. The
reducer is sync; we hold the state mutex only while it runs.
Events come back from the reducer as Vec
Phase B.8 — events from the reducer flow through the broadcast
bus (ctx.events_tx); a per-connection fanout task subscribes
and writes events to this connection’s pipe. Per-connection
direct writes are reserved for “response-to-this-client-only”
errors (parse failure, register-first violation). (codex P1
PR #605.)