Expand description
The protocol’s half of the session engine: what a message means, and what it was agreed on.
§Why the trait has two methods
classify and resolve are the
only two questions the engine ever asks a protocol, and they are asked
together for a reason: a protocol that answered “this method is permitted”
with one rule and “this method opens the handshake” with another could
disagree, and the disagreement would show up as a session whose phase is
wrong while every individual answer looks reasonable. One method that
classifies, and one that reads a declaration, cannot be split apart without
the engine having to reconcile two sources of truth.
§The two associated types, and why the engine cannot look inside them
Profile is MCP’s FeatureProfile, a u128 bitset, and would be A2A’s
Major.Minor pair. Version is a date for MCP and something else
entirely for A2A. The engine stores both opaquely and never inspects
either: it passes a Profile back to the lifecycle whenever it needs a
decision, and renders a Version into a string for the event log. That is
what keeps this module free of MCP types, and it is the same property T09’s
MethodTable has — a protocol drops in as an implementation rather than as
a fork.
§Implementing it for a protocol with no handshake
A2A has none: every request carries an A2A-Version header and there is
nothing to initialise. The sketch below is the whole of it, and it is a
doc-test rather than a stub in the tree so that nobody has to keep a
half-implemented protocol compiling. Note what it does not need: a
version list, a capability set, a transport, or any of the machinery MCP
requires, because none of those concepts are referenced here.
Structs§
- Meta
View - The reserved metadata a request carried.
- Resolution
- What a protocol answered to a declaration.
Enums§
- Classification
- What a message naming a method means for a session in a given state.
- Declaration
- What a peer declared about itself, in this crate’s vocabulary.
- Declaration
Error - Why a session could not be established.
Traits§
- Lifecycle
- The vocabulary one protocol brings to the session engine.