# `Jidoka.Stream`
[🔗](https://github.com/agentjido/jidoka/blob/v0.9.0/lib/jidoka/stream.ex#L1)

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.

# `t`

```elixir
@type t() :: %Jidoka.Stream{events: Enumerable.t(), request: Jidoka.Chat.Request.t()}
```

# `await`

```elixir
@spec await(
  t(),
  keyword()
) :: term()
```

Waits for the final normalized result for a stream wrapper.

# `emit`

```elixir
@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.

# `events`

```elixir
@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.

# `message_tag`

```elixir
@spec message_tag() :: atom()
```

Returns the mailbox tag used for streamed turn events.

# `new`

```elixir
@spec new(
  Jidoka.Chat.Request.t(),
  keyword()
) :: t()
```

Builds a stream wrapper for an async chat request.

# `terminal?`

```elixir
@spec terminal?(Jidoka.Event.t()) :: boolean()
```

Returns true when an event terminates a turn stream.

# `text_delta`

```elixir
@spec text_delta(Jidoka.Event.t()) :: String.t() | nil
```

Extracts a content delta from an `:llm_delta` event.

# `thinking_delta`

```elixir
@spec thinking_delta(Jidoka.Event.t()) :: String.t() | nil
```

Extracts a thinking/reasoning delta from an `:llm_delta` event.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
