Skip to main content

Module rpc_stdio

Module rpc_stdio 

Source
Expand description

JSON-RPC 2.0 line-delimited stdio mode for the red binary.

See PLAN_DRIVERS.md for the protocol spec. This module is the sole server-side implementation of the protocol — drivers in every language target this contract.

Loop:

  1. Read a line from stdin (UTF-8, terminated by \n).
  2. Parse it as a JSON-RPC 2.0 request envelope.
  3. Dispatch on method to the runtime.
  4. Serialize the response as a single line on stdout, flush.
  5. Repeat until EOF or close method received.

Errors do not crash the loop. Panics inside a method handler are caught and reported as INTERNAL_ERROR so a buggy query cannot kill the daemon.

Modules§

error_code
Stable error codes. Drivers map these to idiomatic exceptions.

Constants§

PROTOCOL_VERSION
Protocol version reported by the version method.

Functions§

run
Run the stdio JSON-RPC loop against a local in-process runtime.
run_remote
Run the stdio JSON-RPC loop as a proxy to a remote gRPC server.
run_with_io
Same as run but takes explicit I/O handles. Used by tests.