Skip to main content

Module stream

Module stream 

Source
Expand description

Normalize caliban TurnEvent NDJSON frames into Prospero EventKinds.

Caliban’s agent worker writes [caliban_agent_core::stream::TurnEvent] records to its stream, each tagged by a PascalCase "type" field (#[serde(tag = "type")]): TurnStart, AssistantTextDelta, AssistantThinkingDelta, ToolCallStart, ToolCallInputDelta, ToolCallEnd, TurnEnd, RunEnd. That enum is the wire contract (ADR-0003) — this module is the only place that knows its shape.

We parse each line into a serde_json::Value (rather than depending on caliban’s crate) so that unknown frame types are skipped, not fatal — forward compatibility with caliban. The trade-off is that a renamed or new variant silently becomes Normalized::Unknown (counted via the unknown_frames metric); recognizes_every_known_turnevent_type below is the guard that fails loudly when the known set drifts.

Structs§

NormalizeOptions
Options controlling normalization.

Enums§

Normalized
Outcome of normalizing one frame.

Functions§

normalize_frame
Normalize a single parsed caliban TurnEvent frame.