1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! Canonical AI wire types and per-protocol codecs for systemprompt.io,
//! shared by the gateway and the agent provider clients.
//!
//! The gateway speaks one provider-neutral model internally. Inbound adapters
//! parse a client wire request into a [`canonical::CanonicalRequest`]; outbound
//! adapters render that request to an upstream provider, parse the upstream
//! reply into a [`canonical::CanonicalResponse`], and map upstream SSE bytes to
//! [`canonical::CanonicalEvent`]s.
//!
//! - [`canonical`] holds those provider-neutral request/response/event types.
//! - The per-protocol modules ([`anthropic`], [`openai_chat`],
//! [`openai_responses`], [`gemini`]) hold the codec for one wire dialect:
//! request build, response parse, stop-reason + usage mapping, SSE-to-event
//! translation, and auth-header construction.
//!
//! - [`protocol`] names the wire dialect a provider speaks ([`WireProtocol`]),
//! [`hosting`] the platform in front of it ([`Hosting`]), and [`limits`] the
//! per-model token ceilings a codec clamps to ([`ModelLimits`]).
//! - [`schema`] holds the per-provider JSON-Schema capability matrices and the
//! tool-schema sanitiser the codecs apply before sending.
//!
//! These types are defined ONCE here and re-exported by the gateway and the
//! agent provider clients so both layers share a single wire vocabulary. The
//! crate depends only on `systemprompt-identifiers` among the workspace
//! crates.
//!
//! Copyright (c) systemprompt.io — Business Source License 1.1.
//! See <https://systemprompt.io> for licensing details.
pub use Hosting;
pub use ModelLimits;
pub use WireProtocol;