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§
Constants§
- HOST_
MANAGEMENT_ METHODS - JSON-RPC methods whose daemon handlers require host-management authority.
Functions§
- broadcast_
concierge_ suggestion - Push a
models.suggestion_availablenotification to subscribed UI clients, returning how many it reached. Targets the samea2ui_subscribersUI-push channel asbroadcast_upgrade_nudge. - 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). - reap_
orphaned_ sandboxes_ at_ boot - Reap CAR Docker sandbox containers orphaned by a prior daemon crash/SIGKILL
(Parslee-ai/car#479).
SandboxExecutor’sDrophandles normal teardown, but a hard kill leaves thesleep infinitycontainer running forever. Sandboxes are created persession.bindSandbox(never at boot), so any container carrying the CAR ownership label is by definition orphaned. Best-effort: a host without Docker is a silent no-op. - reconcile_
os_ schedules_ at_ boot - Reap orphaned OS-level schedules at daemon boot — best-effort, mirrors
recover_workflow_checkpoints. A schedule whose task was deleted while the daemon was down keeps firing a no-op command until this runs. - 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_
concierge_ check - Run one proactive concierge check and push a
models.suggestion_availablenotification per unserved lane to subscribers. Stampslast_concierge_secsafter sending so the throttle holds across ticks. Mirrorsrun_upgrade_nudge_checkbut on the concierge’s independent cadence and throttle field, so the two never starve each other. - 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 (aWsSink— type-erased so this function doesn’t templatize every downstream consumer ofWsChannel). - run_
idle_ backend_ eviction - One pass of idle model-backend eviction. A long-running daemon under
the default 24 GB cache budget pins loaded model weights resident
forever — capacity eviction never fires below the cap — so RSS climbs
to a model’s working set and never drops at idle (car-releases#67).
This sweeps backends untouched for
CAR_INFERENCE_MODEL_IDLE_SECS(default 300) out of the caches and releases isolated-worker residents at the same age; their RAM is reclaimed once outstanding handles drop or the worker’s confirmed process exit completes. - 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). - seed_
memgine_ config - Acquire (or lazy-create + load from disk) the daemon-owned
persistent memgine for
agent_id. First call per id reads~/.car/memory/agents/<id>.jsonif it exists; subsequent calls share the in-memory engine across sessions. Caller stores the returnedArconClientSession.bound_memgineso memory.* handlers route through it viaClientSession::effective_memgine. Resolve thecar_memgine::MemgineConfigthe daemon seeds its engines with: discover the.car/project from the project anchor and apply itsconfig.tomloverrides (e.g. utility-aware retrieval). The anchor is$CAR_PROJECT_DIRwhen set, else the process cwd. - seed_
trusted_ skill_ signers - Read the operator’s trusted skill-signer keyring from the
.car/project’sconfig.toml(trusted_skill_signers), discovered from the same anchor asseed_memgine_config:$CAR_PROJECT_DIRwhen set, else the process cwd. Absent key, absent file, or no project → an empty keyring. - session_
principal_ for_ peers - The authenticated principal for this connection, stamped into approval
audit records server-side so the “who decided” field can’t be forged by
the caller (neo review #5c). Prefers the bound agent identity, else the
connection id.
Public wrapper over [
session_principal] for the peer-messaging module.