Raxol.AgentClientProtocol.Rpc (Raxol Agent Client Protocol v0.1.0)

Copy Markdown View Source

JSON-RPC 2.0 primitives for the Agent Client Protocol.

This is the envelope layer: Request, Response, Notification structs, the RequestId correlation type, and Message (the "jsonrpc": "2.0" wire wrapper). All from_json/1 decoders in this namespace are TOTAL — malformed input never raises, it returns {:error, reason}.

The request id is null | integer | string. Its concrete wire type MUST be preserved byte-for-byte on echo-back: a request sent with a string id must be answered with that same string, not a coerced integer, or the sender's pending-request table silently misses the reply. A null id is a real, meaningful value (used for server-initiated errors that could not be correlated to a request, e.g. a parse error before any id was readable) — it is never treated as "absent".

Ported from the MIT f1729/agent_client_protocol (c) 2025 f1729; see NOTICE.md.