A2uiHost

class A2uiHost(val renderer: A2uiRenderer, var translation: A2uiTranslation = A2uiTranslation.Default, var toolNames: Set<String> = setOf(AguiA2ui.RENDER_TOOL_NAME), var onWarning: (String) -> Unit = {})

The A2UI surfaces of one transcript, kept in an A2uiRenderer and drawn where the transcript's parts are.

Holds the A2uiSurfaces bookkeeping and applies each step to renderer as it comes. The slot table slots is what the drawing side reads: withA2ui looks up the carrier a part maps to, and draws the surfaces, the lifecycle, or nothing, as the reconciler decided.

A batch the renderer throws on -- a data-model path that is not a JSON Pointer, say -- is reported through onWarning, recorded as refused so it is not retried until its payload changes, and shown in its slot as the message the renderer gave. The other carriers' surfaces stand.

One host per transcript, and one renderer per host: A2uiSurfaces assumes it is the only thing creating surfaces in the renderer it plans for, and a second host sharing the renderer would delete the first one's surfaces as strangers. Which is why the three settings are vars and not construction-time: a host rebuilt for a new translation would start with empty books against a renderer that still holds every surface, and its first step would try to create what exists. Change the setting instead and accept again; the reconciler sees the payloads that changed and redraws those.

Parameters

renderer

where the surfaces live. Its catalogs decide which catalog ids resolve.

translation

how upstream's envelopes become v1.0; the default remaps the basic catalog.

toolNames

the tools whose arguments are surfaces.

onWarning

where a rejected batch is reported. Nothing is thrown at a composition.

Constructors

Link copied to clipboard
constructor(renderer: A2uiRenderer, translation: A2uiTranslation = A2uiTranslation.Default, toolNames: Set<String> = setOf(AguiA2ui.RENDER_TOOL_NAME), onWarning: (String) -> Unit = {})

Properties

Link copied to clipboard
Link copied to clipboard

The batches the renderer refused, by carrier, with what it said.

Link copied to clipboard
val renderer: A2uiRenderer
Link copied to clipboard

What to draw for each carrier, as of the last accept. Reading it subscribes to changes.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun accept(transcript: UiTranscript)

Brings renderer up to transcript. Idempotent: the same transcript twice is no work.

Link copied to clipboard
fun slot(carrier: A2uiCarrier): A2uiSlot?

The slot for carrier, or null when the transcript holds no such carrier.