Skip to main content

Module handler

Module handler 

Source
Expand description

WebSocket connection handler — bidirectional JSON-RPC.

Tool callback flow:

  1. Client submits proposal via proposal.submit
  2. Runtime encounters a ToolCall action
  3. WsToolExecutor sends tools.execute request to client via shared write half
  4. WsToolExecutor awaits response on a oneshot channel
  5. Client executes tool locally, sends JSON-RPC response back
  6. Handler receives the response, resolves the oneshot
  7. Runtime continues execution with the tool result

Structs§

JsonRpcError
JsonRpcMessage
JsonRpcResponse

Functions§

handle_connection
Convenience wrapper for the standalone car-server binary: accepts the WebSocket handshake on a raw TcpStream then delegates to run_dispatch. Embedders that already have a handshake-completed WebSocketStream skip this and call run_dispatch directly.
handle_connection_unix
Convenience wrapper for the daemon-as-default Unix-socket listener. Same shape as handle_connection but accepts a UnixStream — used by the per-user UDS listener in car-server::main (default transport for FFI thin clients, since UDS is faster + permission-scoped vs localhost TCP).
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 of WsChannel).