Pixir.Renderer (pixir v0.1.0)

Copy Markdown View Source

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_deltas 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 runs the receive loop, performing the writes until a terminal status ("done" / "error") arrives.

Summary

Functions

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

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

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

Functions

consume_until_done(opts \\ [])

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

render(arg1)

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

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

write(arg)

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

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