a2ui
v0.1.16Compose, validate, persist, and render A2UI v0.9.1 surfaces for Harness sessions in chat and on an injectable Console page.
- macOS: arm64
- Linux: arm64 · armv7 · x64
- Windows: arm64 · x64
exact versions are immutable; binary and bundle artifacts are digest-pinned.
full markdown
/workers/a2ui.md?version=0.1.16. paste it into an llm prompt or pipe it through curl from a worker.install
dependencies
readme
a2ui
The A2UI worker turns compact agent intent into validated A2UI v0.9.1 surfaces, stores them under the originating Harness conversation, renders them inline in chat and on an injectable Console page, and sends user actions back to the same conversation.
Install
iii trigger compose::add worker=a2uiQuickstart
Call a2ui::generate from a Harness turn. The Harness hook supplies the authoritative session, and the worker reads that turn's routed model, so the agent only sends intent and data:
{
"description": "A deployment approval card with service, version, risk, and approve or reject actions.",
"data": {
"service": "payments-api",
"version": "2026.08.20",
"risk": "medium"
},
"surface_id": "deployment-approval"
}The call returns a compact receipt such as { "surface_id": "deployment-approval", "revision": 3, "component_count": 11, "page": "a2ui" }. page is the console page id: an agent opens it with console::workspace::open { screen: "ext:a2ui" }. The Console keeps that receipt visible in the chat feed and expands it into the full surface on selection, while the A2UI page keeps every surface in the active conversation live through an exact-session state subscription.
Patch an existing surface with another natural-language request. Supplying expected_revision prevents an older composition from overwriting a newer edit:
{
"surface_id": "deployment-approval",
"instruction": "Add an owner field and make the risk more prominent.",
"expected_revision": 3
}Interactive surfaces automatically submit their complete bound data model with button actions, so form values are persisted and forwarded to the originating Harness turn. The page also supports bounded revision history and undo, pinning, duplication, JSON import/export, and a per-session template library.
a2ui::binding::set can bind an exact state, stream, or shell::changed event to a JSON Pointer in the surface data model. Browser events are deliberately excluded because Console-side registration would bypass Browser approval boundaries. Bindings are declarative and cannot invoke arbitrary functions.
The A2UI page does not replace or embed itself in Shell or Browser. Its workspace action materializes a complete runnable React project under generated/a2ui/ in the active Harness working directory. Shell then shows the real source files and Git diffs for editing. Run the generated Vite app in Shell and open its local URL in the Browser worker for preview. The same runnable project is available as a React app ZIP through a2ui::surface::export-code; JSON exports remain portable through a2ui::surface::import.
Configuration
The configuration worker stores this worker's live settings. An optional --config YAML file seeds them on first boot:
composer_model: null # inherit the Harness turn's model
composer_provider: null # inherit its routed provider
max_output_tokens: 8192 # one composition or repair call
max_composer_input_bytes: 786432
repair_attempts: 1 # bounded validation correction
max_surfaces_per_session: 16
max_history_per_surface: 64
max_templates_per_session: 32
max_components_per_surface: 160
max_description_bytes: 32768
max_data_bytes: 524288
max_surface_bytes: 2097152 # current surface plus bounded history
max_session_bytes: 16777216 # surfaces, histories, and templates
forward_actions: true # send Console actions to harness::sendThe worker implements the stable A2UI v0.9.1 envelope with the safe urn:iii:a2ui:console:v0.1 catalog. The catalog maps declarative components onto the running Console's shared React components and design tokens; it never executes model-provided HTML, JavaScript, or CSS.
api reference (json)
{
"functions": [
{
"description": "Generate a user interface from a short description and optional data. Renders a safe A2UI v0.9.1 surface in chat and on the A2UI page, returning a compact receipt.",
"metadata": {},
"name": "a2ui::generate",
"request_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"data": {
"default": null,
"description": "Optional application data. The composer should bind components to this data instead of repeating it in the component graph."
},
"description": {
"description": "Plain-language description of the interface to compose.",
"type": "string"
},
"replace": {
"default": true,
"description": "Replace a surface with the same id. Defaults to true.",
"type": "boolean"
},
"surface_id": {
"default": null,
"description": "Stable id to use for the generated surface. Omit for a generated id.",
"type": [
"string",
"null"
]
},
"title": {
"default": null,
"description": "Human-readable title shown in the Console sidebar.",
"type": [
"string",
"null"
]
}
},
"required": [
"description"
],
"title": "GenerateRequest",
"type": "object"
},
"response_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"SurfaceStatus": {
"enum": [
"active",
"deleted"
],
"type": "string"
}
},
"properties": {
"catalog_id": {
"type": "string"
},
"component_count": {
"format": "uint",
"minimum": 0,
"type": "integer"
},
"page": {
"type": "string"
},
"protocol_version": {
"type": "string"
},
"revision": {
"format": "uint64",
"minimum": 0,
"type": "integer"
},
"session_id": {
"type": "string"
},
"status": {
"$ref": "#/definitions/SurfaceStatus"
},
"surface_id": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"catalog_id",
"component_count",
"page",
"protocol_version",
"revision",
"session_id",
"status",
"surface_id",
"title"
],
"title": "SurfaceReceipt",
"type": "object"
}
}
],
"triggers": []
}