Request-scoped stream helpers for Jidoka turn events.
The runtime remains terminal-result oriented, but callers that pass
stream_to: pid or on_event: fun can observe Jidoka.Event values as the
turn runs. This mirrors the request-owned streaming shape from Jidoka v1
without depending on Jido.AI's internal event structs.
Summary
Functions
Waits for the final normalized result for a stream wrapper.
Emits one event to the stream sinks configured for a running turn.
Builds a mailbox-backed enumerable for a request id.
Returns the mailbox tag used for streamed turn events.
Builds a stream wrapper for an async chat request.
Returns true when an event terminates a turn stream.
Extracts a content delta from an :llm_delta event.
Extracts a thinking/reasoning delta from an :llm_delta event.
Types
@type t() :: %Jidoka.Stream{events: Enumerable.t(), request: Jidoka.Chat.Request.t()}
Functions
Waits for the final normalized result for a stream wrapper.
@spec emit( Jidoka.Event.t(), keyword() ) :: :ok
Emits one event to the stream sinks configured for a running turn.
Custom capabilities can call this when they want to surface incremental
provider output, for example :llm_delta events from a streaming model.
@spec events( String.t(), keyword() ) :: Enumerable.t()
Builds a mailbox-backed enumerable for a request id.
This is intentionally small: it consumes already-emitted Jidoka events from the caller mailbox and halts on a terminal event or timeout.
@spec message_tag() :: atom()
Returns the mailbox tag used for streamed turn events.
@spec new( Jidoka.Chat.Request.t(), keyword() ) :: t()
Builds a stream wrapper for an async chat request.
@spec terminal?(Jidoka.Event.t()) :: boolean()
Returns true when an event terminates a turn stream.
@spec text_delta(Jidoka.Event.t()) :: String.t() | nil
Extracts a content delta from an :llm_delta event.
@spec thinking_delta(Jidoka.Event.t()) :: String.t() | nil
Extracts a thinking/reasoning delta from an :llm_delta event.