Skip to main content

gproxy_protocol/
lib.rs

1//! GPROXY v4 protocol.
2//!
3//! Two jobs, and nothing else:
4//!
5//! 1. **Model the connection.** What a request and a response are on an
6//!    HTTP link — five request elements, three response elements, and buffered
7//!    or streaming bodies. An established WebSocket is a separate duplex link.
8//! 2. **Describe host capabilities for protocol adaptation.** A host supplies
9//!    upstream calls, resource access, and scoped state. Bounded codecs and
10//!    identity mapping support adapters that compose these capabilities for
11//!    one or more calls without depending on a full core.
12//!
13//! Beside them, [`usage`] reads per-call metering out of an operation's
14//! standard response, because only the standard shapes are known here.
15//!
16//! What is deliberately absent:
17//!
18//! - **URL path matching.** Which URL serves an operation is an HTTP
19//!   convention. The ingress layer owns it; an SDK caller names the operation
20//!   and never sees a path.
21//! - **Any notion of a channel.** A channel is a vendor integration with
22//!   credentials and auth; this crate only knows dialects.
23//! - **A unified IR.** Conversion is N-by-N pairwise on purpose. Upstream specs
24//!   churn faster than any pivot format tracks, and conversion fidelity is the
25//!   product. See `design/transform.md`.
26//!
27//! Everything here derives from `upstream_docs/`, which is the source of truth
28//! for field names, semantics and examples.
29
30extern crate self as gproxy_protocol;
31
32pub mod adapt;
33pub mod capability;
34pub mod codec;
35pub mod connection;
36pub mod operation;
37pub mod spec;
38pub mod transform;
39pub mod usage;
40pub mod wire;
41
42pub use wire::{claude, gemini, openai};
43
44pub use connection::{HttpBody, WebSocket, WireRequest, WireResponse};
45pub use operation::{Dialect, Operation, OperationKey, WireFamily};
46
47/// Unknown fields preserved when a wire object is read and written unchanged.
48pub type Rest = serde_json::Map<String, serde_json::Value>;