Skip to main content

gproxy_protocol/transform/generate/claude_responses/stream/
mod.rs

1//! Direct incremental Claude Messages ↔ OpenAI Responses streams.
2//!
3//! Both native source and target collectors validate the lifecycle. Live text,
4//! reasoning and function arguments come from actual source fragments. Final
5//! source conversion checks the full target and supplies terminal metadata;
6//! it never replays already emitted text. JSON argument spelling may differ,
7//! but the streamed object must equal the actual native source tool input.
8//!
9//! Claude-to-Responses uses factual creation time and original/effective request
10//! controls. Each Claude block retains its own output item, and call IDs remain
11//! distinct from function item IDs. A late global Claude refusal keeps emitted
12//! output text and becomes incomplete/content_filter. It cannot retract that
13//! text into another channel. Annotation coordinates/resource bindings require
14//! explicit facts bound to the exact source citation occurrence.
15//!
16//! Responses-to-Claude preserves every text/refusal part and actual tool input.
17//! Earlier messages gate later items until their part list is complete; known
18//! function items can stream concurrently. Optional item IDs may arrive late,
19//! while native call IDs determine the target tool identity. Per-part refusal
20//! text is retained; Claude's single stop_reason preserves explicit tool
21//! continuation when both coexist, with a separate representation diagnostic.
22//!
23//! A Claude target start requires real usage. Missing start facts wait in a
24//! bounded queue; initial counters never replace missing final usage. Initial
25//! host input/cache facts must agree with final native counters. Late effective
26//! service tier cannot rewrite message_start and is reported separately.
27//! Signed thinking restores only from validated original model/origin/field
28//! state. MCP receipts retain native MCP shapes without executing tools.
29//!
30//! Every failed push poisons the converter. Source terminal events and finish
31//! are mandatory. Input/output bytes/events and retained payloads are bounded,
32//! and each target event is charged once before native validation/retention.
33
34mod claude_blocks;
35mod claude_to_responses;
36mod common;
37mod context;
38mod response_events;
39mod response_items;
40mod response_projection;
41mod responses_to_claude;
42mod usage;
43
44pub use claude_to_responses::{ClaudeToResponsesContext, ClaudeToResponsesStream};
45pub use common::{StreamEnd, StreamLimits};
46pub use context::BoundResponseAnnotation;
47pub use responses_to_claude::{ResponsesToClaudeContext, ResponsesToClaudeStream};