Day-1 JSON-RPC 2.0 Server over TCP, Unix Domain Socket, and stdio (REQ-RPC-01..REQ-RPC-05, REQ-PBT-07).
Exposes the complete SuperPi.Durable and SuperPi.Conversation.Machine harness to external
clients (VS Code extensions, Neovim plugins, desktop apps, web frontends, and CLI wrappers).
Supported JSON-RPC 2.0 Methods
session.open— Creates or opens a durable conversation (%{conversation_id: id, seq: seq}).session.submit— Submits user input withmode("queue","steer","write").session.fork— Forks a conversation atat_entry_idwithasOfdocument rewind.session.compact— Runs context compaction ("manual","threshold","overflow").session.context— Derives the active LLM context via the 10 normative rules.session.watch— Subscribes the client connection tosession.eventnotifications with boundedK = 2in-flight backpressure (REQ-RPC-03).session.ack— Acknowledges receipt of asession.eventbatch (batch_id), advancing the client'sK = 2flow-control window and flushing coalesced pending deltas (REQ-RPC-04).ui.respond— Delivers the user's answer to a server-initiatedui.requestprompt (REQ-RPC-05).
Summary
Functions
Processes a client session.ack for batch_id (REQ-RPC-04, REQ-PBT-07).
Removes batch_id from in_flight; if coalesced_queue is non-empty and map_size(in_flight) < 2,
flushes all coalesced events in a single consolidated session.event batch.
Returns a specification to start this module under a supervisor.
Enqueues a server-to-client session.event notification under the K = 2 ack-clocked backpressure
contract (REQ-RPC-03, REQ-RPC-04, REQ-PBT-07)
Processes a single raw JSON-RPC 2.0 line and returns {reply_map | nil, updated_client_state, outbound_notifications}.
Pure state-transition function that is also used directly by ExUnitProperties (REQ-PBT-07).
Serves one client on standard input and output until stdin closes. One JSON-RPC message per line in each direction.
Functions
Processes a client session.ack for batch_id (REQ-RPC-04, REQ-PBT-07).
Removes batch_id from in_flight; if coalesced_queue is non-empty and map_size(in_flight) < 2,
flushes all coalesced events in a single consolidated session.event batch.
Returns a specification to start this module under a supervisor.
See Supervisor.
Enqueues a server-to-client session.event notification under the K = 2 ack-clocked backpressure
contract (REQ-RPC-03, REQ-RPC-04, REQ-PBT-07):
- If
map_size(client_state.in_flight) < 2, immediately emits asession.eventJSON-RPC notification with a freshbatch_idand recordsbatch_idinin_flight. - If
map_size(client_state.in_flight) >= 2, coalescesevent_payloadintoclient_state.coalesced_queuewithout emitting any wire frame until the client callssession.ack.
Processes a single raw JSON-RPC 2.0 line and returns {reply_map | nil, updated_client_state, outbound_notifications}.
Pure state-transition function that is also used directly by ExUnitProperties (REQ-PBT-07).
Serves one client on standard input and output until stdin closes. One JSON-RPC message per line in each direction.
stdout carries only protocol lines, so route logs to stderr first (bin/super-pi rpc --stdio
does this with SUPER_PI_LOG_STDERR=1).