PromptRunner.Rendering.Renderer behaviour (PromptRunnerSDK v0.12.1)

Copy Markdown View Source

Behaviour for rendering prompt-runner canonical event maps into human-readable output.

Summary

Callbacks

Applies live view settings to a renderer's state, mid-stream.

Types

opts()

@type opts() :: keyword()

state()

@type state() :: term()

Callbacks

finish(state)

@callback finish(state()) :: {:ok, iodata(), state()}

init(opts)

@callback init(opts()) :: {:ok, state()} | {:error, term()}

render_event(event, state)

@callback render_event(event :: map(), state()) :: {:ok, iodata(), state()}

set_view(view, state)

(optional)
@callback set_view(view :: map(), state()) :: {:ok, state()}

Applies live view settings to a renderer's state, mid-stream.

Called at an event boundary when a control-plane consumer changes tool_output or diff. A renderer that carries neither can leave this unimplemented; PromptRunner.Rendering treats its absence as "this renderer has nothing to change" rather than as an error, so a view change is never fatal to a run.