tokn_headers/lib.rs
1//! Foundational header primitives for the LLM router workspace.
2//!
3//! This crate provides:
4//!
5//! * [`HeaderName`] — a case- and order-preserving header name backed by [`SmolStr`].
6//! * [`HeaderValue`] — a header value stored as `Cow<'static, str>` for zero-cost
7//! static defaults.
8//! * [`HeaderMap`] — a `Vec`-backed map that preserves insertion order and original
9//! case while supporting case-insensitive lookup and duplicate names.
10//! * [`keys`] — a catalogue of static [`HeaderName`] constants for popular headers.
11//! * [`TemplateVars`] — per-request correlation metadata extracted from inbound
12//! headers, shared between header rendering and provider header construction.
13//! * [`HeaderSchema`] — a trait implemented by typed (provider, client) header
14//! structs to round-trip between their typed form and a [`HeaderMap`].
15//! * [`HeaderNormalizer`] — a trait for rebuilding client-derived headers into
16//! a provider-owned wire shape.
17//! * [`schemas`] — concrete client/overlay structs implementing [`HeaderSchema`].
18//! * [`agent`] — agent-specific outbound header builders.
19//! * [`registry`] — runtime lookup of (`AgentKind`, `OverlayKind`) for a given
20//! `(provider_id, agent_id)` pair.
21//!
22//! Phase 1 is purely additive: nothing in the workspace depends on this crate
23//! yet. Phase 2 will swap [`HeaderMap`] in for `reqwest::header::HeaderMap`
24//! workspace-wide; Phase 3 will route provider header construction through the
25//! schema registry.
26
27pub mod agent;
28pub mod agent_id;
29pub mod error;
30pub mod inbound;
31pub mod keys;
32pub mod map;
33pub mod name;
34pub mod normalizer;
35pub mod registry;
36pub mod reqwest_compat;
37pub mod schema;
38pub mod schemas;
39pub mod value;
40pub mod vars;
41
42pub use agent_id::AgentId;
43pub use error::Error;
44pub use map::HeaderMap;
45pub use name::HeaderName;
46pub use normalizer::{HeaderNormalizeCtx, HeaderNormalizer};
47pub use schema::HeaderSchema;
48pub use value::HeaderValue;
49pub use vars::TemplateVars;