gglib_core/normalize/
mod.rs

1//! Universal local-LLM consistency layer.
2//!
3//! This module rewrites model-specific output dialects into the strict
4//! OpenAI-shaped [`crate::domain::agent::LlmStreamEvent`] sequence that the
5//! rest of the codebase expects.  Adapters wrap the LLM stream once at the
6//! port boundary; every downstream surface (Axum, CLI, Tauri, proxy)
7//! consumes the canonical form.
8//!
9//! ## Module map
10//!
11//! - [`tags`] — `format:*` constants used to pick a parser.
12//! - [`error`] — non-fatal [`error::NormalizationError`] surfaced from parsers.
13//! - [`parser`] — the [`parser::ToolCallParser`] trait + [`parser::ParserOutput`].
14//! - [`parsers`] — concrete parser implementations, one file per dialect.
15//! - [`registry`] — the single dispatch site that maps tags to parsers.
16//!
17//! ## Adding a new dialect
18//!
19//! 1. Add a `pub const FORMAT_*` to [`tags`].
20//! 2. Drop a new file under [`parsers`].
21//! 3. Add **one** match arm to [`registry::get_parser`].
22//!
23//! The registry is the only place that knows the full set of parsers, by
24//! design — see the module docs there.
25
26pub mod error;
27pub mod history;
28pub mod parser;
29pub mod parsers;
30pub mod registry;
31pub mod stream;
32pub mod tags;
33
34pub use error::{NormalizationError, NormalizationErrorKind};
35pub use history::strip_thinking_debt;
36pub use parser::{ParserOutput, ToolCallParser};
37pub use registry::get_parser;
38pub use stream::NormalizingStream;