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
//! Canonical AI wire types and per-protocol codecs, 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.
//!
//! 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.
//!
//! Copyright (c) systemprompt.io — Business Source License 1.1.
//! See <https://systemprompt.io> for licensing details.
/// The bridge proxy and the gateway body reader must agree on this ceiling: a
/// body the bridge accepts and forwards must not be rejected by the gateway.
pub const BUFFERED_BODY_LIMIT_BYTES: usize = 8 * 1024 * 1024;