Skip to main content

Module jsonrpc

Module jsonrpc 

Source
Expand description

JSON-RPC message types for the Codex app-server protocol.

Based on the codex-rs jsonrpc_lite implementation. Note: the Codex app-server does NOT include the "jsonrpc": "2.0" field in messages, despite following the JSON-RPC 2.0 pattern.

§Wire format

Messages are newline-delimited JSON objects. Each message is one of:

  • Request — has id + method (+ optional params)
  • Response — has id + result
  • Error — has id + error (with code, message, optional data)
  • Notification — has method (+ optional params), no id

Use JsonRpcMessage to deserialize any incoming line, then match on the variant.

§Example

use codex_codes::JsonRpcMessage;

let line = r#"{"id":1,"result":{"threadId":"th_abc"}}"#;
let msg: JsonRpcMessage = serde_json::from_str(line).unwrap();
assert!(matches!(msg, JsonRpcMessage::Response(_)));

Structs§

JsonRpcError
A JSON-RPC error response.
JsonRpcErrorData
The error payload within a JSON-RPC error response.
JsonRpcNotification
A JSON-RPC notification (no response expected).
JsonRpcRequest
A JSON-RPC request (client-to-server or server-to-client).
JsonRpcResponse
A JSON-RPC success response.

Enums§

JsonRpcMessage
Any JSON-RPC message on the wire.
RequestId
A JSON-RPC request/response identifier.