Skip to main content

Module wire

Module wire 

Source
Expand description

Decode-then-validate classification for JSON stream wire frames.

Each streaming wire family classifies every frame through exactly one of the functions below before acting on it, so the parse policy is stated once per family instead of being re-derived from serde failure modes at each call site. The classification is a hand-written tag dispatch, never an untagged serde fallback: a trailing #[serde(untagged)] variant on an internally-tagged enum swallows a known tag with an invalid payload (rig-2257-code-review-findings-34ee8ba5.md P2), which would silently demote a data-level defect to an ignorable unknown event.

Enums§

TypedEvent
Triage of one already-deserialized event from a typed-transport wire (an aws-sdk event stream, a prost/tonic gRPC stream, an in-process generation channel), for classify_typed_event.
WireEvent
One classified wire frame.

Functions§

classify_chat_completions_frame
Classify one chat-completions SSE frame (OpenAI-compatible chat wire).
classify_marker_keyed_frame
Classify one frame of an untagged JSON wire recognized by payload keys (Gemini streamGenerateContent).
classify_tagged_frame
Classify one frame of a tag-discriminated JSON wire (OpenAI Responses SSE, Cohere SSE, and Anthropic use type; Gemini Interactions uses event_type).
classify_typed_event
Classify one event of a typed-transport wire (bedrock’s Converse event stream, gemini-grpc, candle’s in-process generation).
classify_untyped_line
Classify one line of an undiscriminated NDJSON wire (Ollama).
classify_with_repair
Classify a frame with a one-shot salvage step for Corrupt results.