# `Pixir.Renderer`
[🔗](https://github.com/Ranvier-Technologies/pixir/blob/main/lib/pixir/renderer.ex#L1)

The first thin front-end over the event bus (ADR 0004, decision D-05): a stdout
subscriber that pattern-matches on `event.type`. It validates the seam — the core
needs no changes for a new front-end.

Channel discipline (ADR 0005):

  * **stdout** — the model's answer: streamed `text_delta`s and the final newline.
  * **stderr** — activity and diagnostics: tool calls/results, reasoning, status.

`render/1` is the pure mapping from an Event to writes (`[{:stdout | :stderr, io}]`),
so it is unit-testable. `consume_until_done/1` owns one canonical Session epoch,
performing writes until that Session emits terminal `status` (`"done"` / `"error"`).
The Session may be explicit in `:session_id` or safely derived from the first
canonical Event; foreign-Session Events never contaminate the epoch.

# `consume_until_done`

```elixir
@spec consume_until_done(keyword()) :: :ok | :timeout
```

Receive and render Events for the calling (already-subscribed) process until a
terminal status. Returns `:ok` or `:timeout` after `:idle_timeout` ms of silence.

# `output_truncation_suppression`

```elixir
@spec output_truncation_suppression(non_neg_integer(), non_neg_integer()) :: iodata()
```

Render the terminal summary when a Presenter suppressed warnings over its cap.

# `output_truncation_warning`

```elixir
@spec output_truncation_warning(map()) :: iodata()
```

Render one Provider-output truncation warning without changing model text.

# `render`

```elixir
@spec render(map()) :: [{:stdout | :stderr, iodata()}]
```

Map an Event to a list of `{:stdout | :stderr, iodata}` writes.

# `write`

```elixir
@spec write({:stdout | :stderr, iodata()}) :: :ok
```

Perform a single `{:stdout | :stderr, iodata}` write (used by front-ends).

---

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