Skip to main content

Module stream

Module stream 

Source
Expand description

Streaming primitives: the SSE decoder, a tolerant streaming-JSON parser, the fine-grained AssistantMessageEvent protocol, and the AssistantStream type that providers return.

Structs§

ServerSentEvent
A raw Server-Sent Event decoded from the HTTP response body.
SseDecoder
Incremental line-buffered SSE decoder (mirrors pi’s iterateSseMessages).

Enums§

AssistantMessageEvent
Fine-grained events emitted while streaming a model response. Mirrors pi’s AssistantMessageEvent.

Functions§

channel_stream
Build an AssistantStream from a channel pair. The provider pushes events through the sender from a spawned task.
parse_streaming_json
Parse possibly-truncated streaming JSON (e.g. tool-call input_json_delta fragments). Mirrors pi’s parseStreamingJson: returns the best-effort parsed value, repairing truncated input so the agent always gets usable arguments to execute.

Type Aliases§

AssistantStream
A boxed, pinned async stream of assistant events.