pub mod bridge;
mod capability;
#[cfg(feature = "a2a")]
pub mod a2a;
#[cfg(feature = "acp-experimental")]
pub mod acp;
pub mod feature;
pub mod idempotency;
pub mod ir;
pub mod jsonrpc;
pub mod mcp;
mod negotiation;
#[cfg(feature = "oauth")]
pub mod oauth;
mod protocol_version;
pub mod registry;
mod release_date;
mod request_id;
pub mod session;
mod stream;
mod supported_versions;
mod transport;
pub use bridge::{Agreement, Leg, RefusedBy, Withheld, agree};
pub use capability::{
CAPABILITY_TABLE, CLIENT_CAPABILITY_WIRE, Capability, CapabilitySet, SERVER_CAPABILITY_WIRE,
Side, defined_in,
};
pub use feature::{
DegradePolicy, FEATURES, Feature, FeatureProfile, FeatureSpec, Negotiation, resolve,
};
pub use idempotency::{
Claim, ClaimToken, CompletedResults, IdempotencyError, IdempotencyKey, StaleClaim,
};
pub use mcp::{
AuthorizationModel, BearerMethod, ClientRegistration, MCP_METHOD_HEADER, MCP_NAME_HEADER,
McpSessionId, McpSessionIdError, ResourceMetadata, ResourceUri, ResourceUriError,
RoutingHeaderError, RoutingHeaders, RoutingName, RoutingTarget, VISIBLE_ASCII_RANGE,
WELL_KNOWN, authorization_model, client_method_defined_in,
};
pub use negotiation::{
NegotiatedSession, NegotiationError, PeerInfo, ServerDecision, StatelessRequest,
assumed_version, assumed_version_without_signal, check_protocol_header, discover_defined_in,
handshake_defined_in, is_reserved_meta_key, negotiate_client, negotiate_server,
negotiate_stateless, stateless_meta_keys,
};
pub use protocol_version::{ParseProtocolVersionError, ProtocolVersion, UnknownVersionError};
pub use release_date::{ParseReleaseDateError, ReleaseDate};
pub use request_id::RequestId;
pub use stream::{
EventId, EventName, EventNameError, EventRing, RECOMMENDED_CAPACITY, RecommendedCapacity,
Replay, StreamEvent, names,
};
pub use supported_versions::{SupportedVersions, SupportedVersionsError};
pub use transport::{
FrameDecoder, FramingError, MaxFrameSize, MaxFrameSizeError, MessageEndpoint,
MessageEndpointError, RateLimit, SpecError, TransportKind, TransportSpec, Verdict,
check_rate_limit, encode_frame, transport_allowed,
};
#[cfg(test)]
mod tests {
use crate::domain::{ProtocolVersion, ReleaseDate, TransportKind, transport_allowed};
#[test]
fn the_three_orderings_tell_the_same_story() {
for version in ProtocolVersion::KNOWN {
let date = version.date();
for other in ProtocolVersion::KNOWN {
assert_eq!(
version < other,
date < other.date(),
"{version} and {other} order differently by version than by date"
);
}
}
assert!(ProtocolVersion::KNOWN.is_sorted());
assert!(ReleaseDate::V2024_11_05 < ReleaseDate::V2026_07_28);
let introduced_by = [
TransportKind::Stdio,
TransportKind::LegacySse,
TransportKind::StreamableHttp,
TransportKind::StatelessHttp,
];
for (transport, first) in introduced_by.iter().zip([
ProtocolVersion::V2024_11_05,
ProtocolVersion::V2024_11_05,
ProtocolVersion::V2025_03_26,
ProtocolVersion::V2026_07_28,
]) {
assert!(
transport_allowed(first, *transport),
"{transport} claims to start at {first} but is not allowed there"
);
for earlier in ProtocolVersion::KNOWN
.into_iter()
.take_while(|v| *v < first)
{
assert!(
!transport_allowed(earlier, *transport),
"{transport} is allowed on {earlier}, which predates {first}"
);
}
}
}
}