Skip to main content

protocol_droid/application/jsonrpc/
mod.rs

1//! Routing a decoded JSON-RPC message to a method, without naming one.
2//!
3//! # The seam
4//!
5//! [`MethodTable`] is the boundary between "this is a well-formed JSON-RPC
6//! message naming `tools/call`" and "run the tool handler". The first half is
7//! finished here, for every protocol at once, because it is the same work
8//! whatever the method is. The second half belongs to a protocol module and is
9//! T12's.
10//!
11//! Nothing in this module names an MCP method. A2A and ACP register their own
12//! tables under `adapters` the same way MCP does, which is the property the
13//! project's protocol-neutral rule asks for and the reason a later task can add
14//! a protocol without a refactor.
15//!
16//! # Two ports, and why they are not one
17//!
18//! [`FrameSource`] is the inbound edge — a stream of whole frames — and it is
19//! declared here because the loop that reads a frame and routes it is this
20//! module's consumer. The outbound edge is
21//! [`FrameSink`](crate::application::session::FrameSink), which sits with the
22//! session engine that consumes it instead. Same direction of travel, different
23//! consumer, different module: a trait that both read and wrote would make every
24//! implementor answer for both, and a replay source only reads at all.
25
26pub mod batch;
27pub mod document;
28pub mod frame_source;
29pub mod router;
30
31pub use batch::{AllowBatching, BatchPolicy, DenyBatching, ProfileBatching};
32pub use document::{RequestError, notification_document, reply_result, request_document};
33pub use frame_source::{DynFrameSource, FrameSource, SourceError};
34pub use router::{
35    MethodTable, ReplyPayload, RouteError, Routed, RoutedFrame, RoutedMessage, route_frame,
36    route_one,
37};