Incremental, bounded WHATWG event-stream framing for the portable Open Responses HTTP/SSE profile.
This module owns framing only. Pixir.Provider owns JSON reduction, strict
event:/body-type agreement, and terminal interpretation. The decoder never
includes payload bytes in errors or diagnostics. It is deliberately selected only
for open_responses; the accepted ChatGPT/Codex compatibility reducer remains
separate.
Summary
Types
A framed data payload. event is nil when no event field was supplied.
Opaque incremental decoder state.
Functions
Feed one arbitrary transport chunk and return zero or more ordered frames.
Finish framing, discarding any pending non-dispatched event per WHATWG.
Maximum accepted bytes in one undecoded event, including framing.
Create an empty strict decoder.
Types
@type frame() :: %{event: String.t() | nil, data: binary(), ordinal: pos_integer()}
A framed data payload. event is nil when no event field was supplied.
@opaque t()
Opaque incremental decoder state.
Functions
@spec feed(t(), binary()) :: {:ok, t(), [frame() | :done]} | {:error, t(), [frame() | :done], map()}
Feed one arbitrary transport chunk and return zero or more ordered frames.
Finish framing, discarding any pending non-dispatched event per WHATWG.
@spec max_event_bytes() :: pos_integer()
Maximum accepted bytes in one undecoded event, including framing.
@spec new() :: t()
Create an empty strict decoder.