Expand description
WebSocket connection handler — bidirectional JSON-RPC.
Tool callback flow:
- Client submits proposal via proposal.submit
- Runtime encounters a ToolCall action
- WsToolExecutor sends tools.execute request to client via shared write half
- WsToolExecutor awaits response on a oneshot channel
- Client executes tool locally, sends JSON-RPC response back
- Handler receives the response, resolves the oneshot
- Runtime continues execution with the tool result
Structs§
Functions§
- broadcast_
upgrade_ nudge - Push a
models.upgrade_availablenotification to all subscribed UI clients, returning how many it reached. Targets the same subscriber set the macOS host already uses for pushed events (a2ui_subscribers) — the UI-push channel — rather than standing up a parallel subscription. Mirrors [broadcast_a2ui_event]. - handle_
connection - Convenience wrapper for the standalone
car-serverbinary: accepts the WebSocket handshake on a rawTcpStreamthen delegates torun_dispatch. Embedders that already have a handshake-completedWebSocketStreamskip this and callrun_dispatchdirectly. - handle_
connection_ unix - Convenience wrapper for the daemon-as-default Unix-socket
listener. Same shape as
handle_connectionbut accepts aUnixStream— used by the per-user UDS listener incar-server::main(default transport for FFI thin clients, since UDS is faster + permission-scoped vs localhost TCP). - recover_
workflow_ checkpoints - Re-arm workflow runs orphaned by a crash between an approval
claimand itscomplete. Call once at daemon startup, before serving connections, so a restart mid-approval doesn’t bury paused runs. Best-effort: logs and returns on any error rather than failing boot. - run_
dispatch - Transport-neutral entry point: drives the JSON-RPC dispatch loop
against an already-handshake-completed split WebSocket. Generic
over the read half (any
Stream<Item = Result<Message, WsError>>) and the write half (a [WsSink] — type-erased so this function doesn’t templatize every downstream consumer ofWsChannel). - run_
upgrade_ nudge_ check - Run one proactive upgrade check and push a
models.upgrade_availablenudge to subscribers if warranted. Stampslast_nudge_secsafter sending so the per-day throttle holds across ticks. The daemon calls this on a periodic timer; the nudge logic itself decides whether to actually surface anything (policy/throttle/dismissals).