Expand description
The protocol-neutral JSON-RPC layer.
§What belongs here
JSON-RPC 2.0 has no knowledge of MCP, and neither does anything in this module. The envelope, the id, the error codes, and the decode step are the same for an MCP session, an A2A session, and an ACP session — which is the property that lets a later task add a protocol as a feature-gated module rather than a fork of the transport layer.
The converse boundary is enforced by the module layout rather than by
discipline: the method table that says tools/call exists lives in
crate::application::jsonrpc as a trait, and its MCP implementation lives
under adapters. Nothing here names a method.
§The two views of a message
| Owned | Borrowed | |
|---|---|---|
| module | crate::domain::ir | this one |
| holds | crate::domain::ir::IrMessage | Frame |
| costs | an allocation per string id | none |
| used when | a message has to be stored, logged, or replayed | a message is being routed |
They are not two versions of the same thing and neither replaces the other. The borrowed view is what the hot path uses, because routing a frame should not allocate; the owned view is what the session engine and the transports use, because those keep messages past the life of the read buffer.
Re-exports§
pub use envelope::DecodeError;pub use envelope::Envelope;pub use envelope::Frame;pub use envelope::MessageKind;pub use envelope::Method;pub use envelope::Outcome;pub use envelope::WireError;pub use envelope::WireId;pub use envelope::WireIdError;pub use envelope::decode;pub use crate::domain::RequestId;pub use crate::domain::ir::IrErrorCode;