# a2ui

> Compose, validate, persist, and render A2UI v0.9.1 surfaces for Harness sessions in chat and on an injectable Console page.

| field | value |
|-------|-------|
| version | 0.1.2 |
| type | binary |
| license | Apache-2.0 |
| repo | https://github.com/iii-hq/workers |
| supported_targets | x86_64-apple-darwin, aarch64-apple-darwin, i686-pc-windows-msvc, x86_64-pc-windows-msvc, aarch64-pc-windows-msvc, x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-unknown-linux-musl, armv7-unknown-linux-gnueabihf |
| author | iii |

## installation

```sh
iii trigger compose::add worker=a2ui@0.1.2
```

## dependencies

- `state` @ `0.x`
- `configuration` @ `0.x`
- `llm-router` @ `^1.4.12`
- `harness` @ `^1.0.0`
- `shell` @ `0.x`

## 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

```bash
iii worker add a2ui
```

## Quickstart

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:

```json
{
  "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": "#/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:

```json
{
  "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/<surface>-r<revision>` 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:

```yaml
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::send
```

The 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": "Console-only: persist an A2UI component action and forward it as a structured message to the originating Harness session.",
      "metadata": {},
      "name": "a2ui::action",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "properties": {
          "action_id": {
            "description": "Stable client-generated id reused when Harness delivery is retried.",
            "type": "string"
          },
          "context": {
            "default": null
          },
          "data_model": {
            "default": null,
            "description": "Full client-side model when createSurface.sendDataModel requested it."
          },
          "expected_revision": {
            "description": "Reject a gesture rendered from stale surface state.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "source_component_id": {
            "type": "string"
          },
          "surface_id": {
            "type": "string"
          }
        },
        "required": [
          "action_id",
          "expected_revision",
          "name",
          "source_component_id",
          "surface_id"
        ],
        "title": "ActionRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "accepted": {
            "type": "boolean"
          },
          "forward_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "forwarded": {
            "type": "boolean"
          },
          "revision": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "session_id": {
            "type": "string"
          },
          "surface_id": {
            "type": "string"
          },
          "turn_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "accepted",
          "forwarded",
          "revision",
          "session_id",
          "surface_id"
        ],
        "title": "ActionResponse",
        "type": "object"
      }
    },
    {
      "description": "Console-only: persist a value delivered by a declared A2UI live binding.",
      "metadata": {},
      "name": "a2ui::binding::apply",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "properties": {
          "binding_id": {
            "type": "string"
          },
          "surface_id": {
            "description": "Surface receiving the event value.",
            "type": "string"
          },
          "value": true
        },
        "required": [
          "binding_id",
          "surface_id",
          "value"
        ],
        "title": "BindingApplyRequest",
        "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"
      }
    },
    {
      "description": "Remove a declarative live event binding from an A2UI surface.",
      "metadata": {},
      "name": "a2ui::binding::delete",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "properties": {
          "binding_id": {
            "type": "string"
          },
          "surface_id": {
            "description": "Surface that owns the binding.",
            "type": "string"
          }
        },
        "required": [
          "binding_id",
          "surface_id"
        ],
        "title": "BindingDeleteRequest",
        "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"
      }
    },
    {
      "description": "Attach an allowlisted live state, stream, or shell event binding to a surface.",
      "metadata": {},
      "name": "a2ui::binding::set",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "definitions": {
          "LiveBinding": {
            "additionalProperties": false,
            "properties": {
              "config": true,
              "event_path": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "target_path": {
                "type": "string"
              },
              "trigger_type": {
                "type": "string"
              }
            },
            "required": [
              "config",
              "id",
              "target_path",
              "trigger_type"
            ],
            "type": "object"
          }
        },
        "properties": {
          "binding": {
            "$ref": "#/definitions/LiveBinding"
          },
          "surface_id": {
            "description": "Surface that should receive live values.",
            "type": "string"
          }
        },
        "required": [
          "binding",
          "surface_id"
        ],
        "title": "BindingSetRequest",
        "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"
      }
    },
    {
      "description": "Generate a safe A2UI v0.9.1 Console surface from a short description and optional data; returns a compact receipt while the UI renders in chat and on the A2UI page.",
      "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"
      }
    },
    {
      "description": "Internal: reload the A2UI worker from authoritative configuration after an update.",
      "metadata": {},
      "name": "a2ui::on-config-change",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "id": {
            "default": null,
            "description": "Advisory id only. The handler always re-fetches authoritative state.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "title": "OnConfigChangeEvent",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "ok": {
            "type": "boolean"
          }
        },
        "required": [
          "ok"
        ],
        "title": "OnConfigChangeResponse",
        "type": "object"
      }
    },
    {
      "description": "Internal: stamp the authoritative Harness session onto A2UI calls before dispatch.",
      "metadata": {},
      "name": "a2ui::stamp-session",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "StampCall": {
            "properties": {
              "arguments": {
                "default": null
              }
            },
            "type": "object"
          }
        },
        "description": "Trusted pre-trigger envelope supplied by the Harness hook runner.",
        "properties": {
          "call": {
            "anyOf": [
              {
                "$ref": "#/definitions/StampCall"
              },
              {
                "type": "null"
              }
            ]
          },
          "session_id": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          }
        },
        "title": "StampSessionEvent",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "anyOf": [
          {
            "$ref": "#/definitions/StampSessionResponse"
          },
          {
            "type": "null"
          }
        ],
        "definitions": {
          "HookMutations": {
            "properties": {
              "arguments": true
            },
            "required": [
              "arguments"
            ],
            "type": "object"
          },
          "StampSessionResponse": {
            "properties": {
              "decision": {
                "type": "string"
              },
              "mutations": {
                "$ref": "#/definitions/HookMutations"
              }
            },
            "required": [
              "decision",
              "mutations"
            ],
            "type": "object"
          }
        },
        "title": "Nullable_StampSessionResponse"
      }
    },
    {
      "description": "Validate and atomically apply a batch of A2UI v0.9.1 protocol messages to the current Harness session's durable surface state.",
      "metadata": {},
      "name": "a2ui::surface::apply",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "definitions": {
          "Component": {
            "additionalProperties": true,
            "properties": {
              "component": {
                "description": "Component name from the negotiated catalog.",
                "type": "string"
              },
              "id": {
                "description": "Unique component id within the surface. `root` is the render root.",
                "type": "string"
              }
            },
            "required": [
              "component",
              "id"
            ],
            "type": "object"
          },
          "CreateSurface": {
            "additionalProperties": false,
            "properties": {
              "catalogId": {
                "type": "string"
              },
              "sendDataModel": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "surfaceId": {
                "type": "string"
              },
              "theme": true
            },
            "required": [
              "catalogId",
              "surfaceId"
            ],
            "type": "object"
          },
          "CreateSurfaceMessage": {
            "additionalProperties": false,
            "properties": {
              "createSurface": {
                "$ref": "#/definitions/CreateSurface"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "createSurface",
              "version"
            ],
            "type": "object"
          },
          "DeleteSurface": {
            "additionalProperties": false,
            "properties": {
              "surfaceId": {
                "type": "string"
              }
            },
            "required": [
              "surfaceId"
            ],
            "type": "object"
          },
          "DeleteSurfaceMessage": {
            "additionalProperties": false,
            "properties": {
              "deleteSurface": {
                "$ref": "#/definitions/DeleteSurface"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "deleteSurface",
              "version"
            ],
            "type": "object"
          },
          "ServerMessage": {
            "anyOf": [
              {
                "$ref": "#/definitions/CreateSurfaceMessage"
              },
              {
                "$ref": "#/definitions/UpdateComponentsMessage"
              },
              {
                "$ref": "#/definitions/UpdateDataModelMessage"
              },
              {
                "$ref": "#/definitions/DeleteSurfaceMessage"
              }
            ],
            "description": "Exactly one of the four A2UI v0.9.1 server-to-client envelope messages."
          },
          "UpdateComponents": {
            "additionalProperties": false,
            "properties": {
              "components": {
                "items": {
                  "$ref": "#/definitions/Component"
                },
                "type": "array"
              },
              "surfaceId": {
                "type": "string"
              }
            },
            "required": [
              "components",
              "surfaceId"
            ],
            "type": "object"
          },
          "UpdateComponentsMessage": {
            "additionalProperties": false,
            "properties": {
              "updateComponents": {
                "$ref": "#/definitions/UpdateComponents"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "updateComponents",
              "version"
            ],
            "type": "object"
          },
          "UpdateDataModel": {
            "additionalProperties": false,
            "properties": {
              "path": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "surfaceId": {
                "type": "string"
              },
              "value": {
                "description": "Omit or set null to remove the path. At `/` this replaces the whole data model, matching A2UI v0.9.1 root-update semantics."
              }
            },
            "required": [
              "surfaceId"
            ],
            "type": "object"
          },
          "UpdateDataModelMessage": {
            "additionalProperties": false,
            "properties": {
              "updateDataModel": {
                "$ref": "#/definitions/UpdateDataModel"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "updateDataModel",
              "version"
            ],
            "type": "object"
          }
        },
        "properties": {
          "messages": {
            "description": "Ordered A2UI v0.9.1 envelopes. One batch targets one surface and is persisted atomically after the complete batch validates.",
            "items": {
              "$ref": "#/definitions/ServerMessage"
            },
            "type": "array"
          },
          "title": {
            "default": null,
            "description": "Optional Console title used when this batch creates a surface.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "messages"
        ],
        "title": "ApplyRequest",
        "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"
      }
    },
    {
      "description": "Delete one A2UI surface from the current Harness session and publish the change to subscribed Console pages.",
      "metadata": {},
      "name": "a2ui::surface::delete",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "Remove one surface from the current Harness session.",
        "properties": {
          "surface_id": {
            "description": "Stable surface id returned by generate, apply, or list.",
            "type": "string"
          }
        },
        "required": [
          "surface_id"
        ],
        "title": "DeleteRequest",
        "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"
      }
    },
    {
      "description": "Duplicate an A2UI surface inside the current Harness session under a new stable id.",
      "metadata": {},
      "name": "a2ui::surface::duplicate",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "properties": {
          "new_surface_id": {
            "type": "string"
          },
          "surface_id": {
            "description": "Existing surface to copy.",
            "type": "string"
          },
          "title": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "new_surface_id",
          "surface_id"
        ],
        "title": "DuplicateRequest",
        "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"
      }
    },
    {
      "description": "Export one A2UI surface as a portable, replayable JSON package without Harness session metadata.",
      "metadata": {},
      "name": "a2ui::surface::export",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "properties": {
          "surface_id": {
            "description": "Stable id of the surface to export.",
            "type": "string"
          }
        },
        "required": [
          "surface_id"
        ],
        "title": "ExportRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "Component": {
            "additionalProperties": true,
            "properties": {
              "component": {
                "description": "Component name from the negotiated catalog.",
                "type": "string"
              },
              "id": {
                "description": "Unique component id within the surface. `root` is the render root.",
                "type": "string"
              }
            },
            "required": [
              "component",
              "id"
            ],
            "type": "object"
          },
          "CreateSurface": {
            "additionalProperties": false,
            "properties": {
              "catalogId": {
                "type": "string"
              },
              "sendDataModel": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "surfaceId": {
                "type": "string"
              },
              "theme": true
            },
            "required": [
              "catalogId",
              "surfaceId"
            ],
            "type": "object"
          },
          "CreateSurfaceMessage": {
            "additionalProperties": false,
            "properties": {
              "createSurface": {
                "$ref": "#/definitions/CreateSurface"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "createSurface",
              "version"
            ],
            "type": "object"
          },
          "DeleteSurface": {
            "additionalProperties": false,
            "properties": {
              "surfaceId": {
                "type": "string"
              }
            },
            "required": [
              "surfaceId"
            ],
            "type": "object"
          },
          "DeleteSurfaceMessage": {
            "additionalProperties": false,
            "properties": {
              "deleteSurface": {
                "$ref": "#/definitions/DeleteSurface"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "deleteSurface",
              "version"
            ],
            "type": "object"
          },
          "ServerMessage": {
            "anyOf": [
              {
                "$ref": "#/definitions/CreateSurfaceMessage"
              },
              {
                "$ref": "#/definitions/UpdateComponentsMessage"
              },
              {
                "$ref": "#/definitions/UpdateDataModelMessage"
              },
              {
                "$ref": "#/definitions/DeleteSurfaceMessage"
              }
            ],
            "description": "Exactly one of the four A2UI v0.9.1 server-to-client envelope messages."
          },
          "UpdateComponents": {
            "additionalProperties": false,
            "properties": {
              "components": {
                "items": {
                  "$ref": "#/definitions/Component"
                },
                "type": "array"
              },
              "surfaceId": {
                "type": "string"
              }
            },
            "required": [
              "components",
              "surfaceId"
            ],
            "type": "object"
          },
          "UpdateComponentsMessage": {
            "additionalProperties": false,
            "properties": {
              "updateComponents": {
                "$ref": "#/definitions/UpdateComponents"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "updateComponents",
              "version"
            ],
            "type": "object"
          },
          "UpdateDataModel": {
            "additionalProperties": false,
            "properties": {
              "path": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "surfaceId": {
                "type": "string"
              },
              "value": {
                "description": "Omit or set null to remove the path. At `/` this replaces the whole data model, matching A2UI v0.9.1 root-update semantics."
              }
            },
            "required": [
              "surfaceId"
            ],
            "type": "object"
          },
          "UpdateDataModelMessage": {
            "additionalProperties": false,
            "properties": {
              "updateDataModel": {
                "$ref": "#/definitions/UpdateDataModel"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "updateDataModel",
              "version"
            ],
            "type": "object"
          }
        },
        "properties": {
          "catalog_id": {
            "type": "string"
          },
          "format": {
            "type": "string"
          },
          "format_version": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "messages": {
            "items": {
              "$ref": "#/definitions/ServerMessage"
            },
            "type": "array"
          },
          "protocol_version": {
            "type": "string"
          },
          "surface_id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "catalog_id",
          "format",
          "format_version",
          "messages",
          "protocol_version",
          "surface_id",
          "title"
        ],
        "title": "SurfaceExport",
        "type": "object"
      }
    },
    {
      "description": "Export a generated interface as a runnable React app or a data-serving iii worker template.",
      "metadata": {},
      "name": "a2ui::surface::export-code",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "definitions": {
          "CodeTarget": {
            "enum": [
              "react",
              "worker"
            ],
            "type": "string"
          }
        },
        "properties": {
          "surface_id": {
            "description": "Surface to turn into source files.",
            "type": "string"
          },
          "target": {
            "$ref": "#/definitions/CodeTarget"
          }
        },
        "required": [
          "surface_id",
          "target"
        ],
        "title": "ExportCodeRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "CodeFile": {
            "properties": {
              "content": {
                "type": "string"
              },
              "path": {
                "type": "string"
              }
            },
            "required": [
              "content",
              "path"
            ],
            "type": "object"
          }
        },
        "properties": {
          "files": {
            "items": {
              "$ref": "#/definitions/CodeFile"
            },
            "type": "array"
          },
          "format": {
            "type": "string"
          },
          "surface_id": {
            "type": "string"
          }
        },
        "required": [
          "files",
          "format",
          "surface_id"
        ],
        "title": "CodeExport",
        "type": "object"
      }
    },
    {
      "description": "Read one durable A2UI surface, including its flat component graph and data model, from the current Harness session.",
      "metadata": {},
      "name": "a2ui::surface::get",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "Select one surface in the current Harness session.",
        "properties": {
          "surface_id": {
            "description": "Stable surface id returned by generate, apply, or list.",
            "type": "string"
          }
        },
        "required": [
          "surface_id"
        ],
        "title": "GetRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "ActionRecord": {
            "properties": {
              "action_id": {
                "default": "",
                "type": "string"
              },
              "context": true,
              "data_model": true,
              "name": {
                "type": "string"
              },
              "source_component_id": {
                "type": "string"
              },
              "timestamp_ms": {
                "format": "int64",
                "type": "integer"
              }
            },
            "required": [
              "context",
              "name",
              "source_component_id",
              "timestamp_ms"
            ],
            "type": "object"
          },
          "Component": {
            "additionalProperties": true,
            "properties": {
              "component": {
                "description": "Component name from the negotiated catalog.",
                "type": "string"
              },
              "id": {
                "description": "Unique component id within the surface. `root` is the render root.",
                "type": "string"
              }
            },
            "required": [
              "component",
              "id"
            ],
            "type": "object"
          },
          "LiveBinding": {
            "additionalProperties": false,
            "properties": {
              "config": true,
              "event_path": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "target_path": {
                "type": "string"
              },
              "trigger_type": {
                "type": "string"
              }
            },
            "required": [
              "config",
              "id",
              "target_path",
              "trigger_type"
            ],
            "type": "object"
          },
          "SurfaceRevision": {
            "properties": {
              "components": {
                "items": {
                  "$ref": "#/definitions/Component"
                },
                "type": "array"
              },
              "data_model": true,
              "last_action": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/ActionRecord"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "reason": {
                "type": "string"
              },
              "revision": {
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "send_data_model": {
                "type": "boolean"
              },
              "theme": true,
              "title": {
                "type": "string"
              },
              "updated_at_ms": {
                "format": "int64",
                "type": "integer"
              }
            },
            "required": [
              "components",
              "data_model",
              "reason",
              "revision",
              "send_data_model",
              "title",
              "updated_at_ms"
            ],
            "type": "object"
          }
        },
        "properties": {
          "bindings": {
            "default": [],
            "items": {
              "$ref": "#/definitions/LiveBinding"
            },
            "type": "array"
          },
          "catalog_id": {
            "type": "string"
          },
          "components": {
            "items": {
              "$ref": "#/definitions/Component"
            },
            "type": "array"
          },
          "created_at_ms": {
            "format": "int64",
            "type": "integer"
          },
          "data_model": true,
          "history": {
            "default": [],
            "items": {
              "$ref": "#/definitions/SurfaceRevision"
            },
            "type": "array"
          },
          "last_action": {
            "anyOf": [
              {
                "$ref": "#/definitions/ActionRecord"
              },
              {
                "type": "null"
              }
            ]
          },
          "pinned": {
            "default": false,
            "type": "boolean"
          },
          "protocol_version": {
            "type": "string"
          },
          "revision": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "send_data_model": {
            "type": "boolean"
          },
          "session_id": {
            "description": "Authoritative Harness session stamped by the pre-trigger hook.",
            "type": "string"
          },
          "surface_id": {
            "description": "Globally unique inside the session.",
            "type": "string"
          },
          "theme": true,
          "title": {
            "type": "string"
          },
          "updated_at_ms": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "catalog_id",
          "components",
          "created_at_ms",
          "data_model",
          "protocol_version",
          "revision",
          "send_data_model",
          "session_id",
          "surface_id",
          "title",
          "updated_at_ms"
        ],
        "title": "SurfaceRecord",
        "type": "object"
      }
    },
    {
      "description": "List the bounded, restorable revision snapshots for one A2UI surface.",
      "metadata": {},
      "name": "a2ui::surface::history",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "properties": {
          "surface_id": {
            "description": "Surface whose restorable snapshots should be listed.",
            "type": "string"
          }
        },
        "required": [
          "surface_id"
        ],
        "title": "HistoryRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "ActionRecord": {
            "properties": {
              "action_id": {
                "default": "",
                "type": "string"
              },
              "context": true,
              "data_model": true,
              "name": {
                "type": "string"
              },
              "source_component_id": {
                "type": "string"
              },
              "timestamp_ms": {
                "format": "int64",
                "type": "integer"
              }
            },
            "required": [
              "context",
              "name",
              "source_component_id",
              "timestamp_ms"
            ],
            "type": "object"
          },
          "Component": {
            "additionalProperties": true,
            "properties": {
              "component": {
                "description": "Component name from the negotiated catalog.",
                "type": "string"
              },
              "id": {
                "description": "Unique component id within the surface. `root` is the render root.",
                "type": "string"
              }
            },
            "required": [
              "component",
              "id"
            ],
            "type": "object"
          },
          "SurfaceRevision": {
            "properties": {
              "components": {
                "items": {
                  "$ref": "#/definitions/Component"
                },
                "type": "array"
              },
              "data_model": true,
              "last_action": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/ActionRecord"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "reason": {
                "type": "string"
              },
              "revision": {
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "send_data_model": {
                "type": "boolean"
              },
              "theme": true,
              "title": {
                "type": "string"
              },
              "updated_at_ms": {
                "format": "int64",
                "type": "integer"
              }
            },
            "required": [
              "components",
              "data_model",
              "reason",
              "revision",
              "send_data_model",
              "title",
              "updated_at_ms"
            ],
            "type": "object"
          }
        },
        "items": {
          "$ref": "#/definitions/SurfaceRevision"
        },
        "title": "Array_of_SurfaceRevision",
        "type": "array"
      }
    },
    {
      "description": "Import a portable A2UI surface package into the current Harness session.",
      "metadata": {},
      "name": "a2ui::surface::import",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "definitions": {
          "Component": {
            "additionalProperties": true,
            "properties": {
              "component": {
                "description": "Component name from the negotiated catalog.",
                "type": "string"
              },
              "id": {
                "description": "Unique component id within the surface. `root` is the render root.",
                "type": "string"
              }
            },
            "required": [
              "component",
              "id"
            ],
            "type": "object"
          },
          "CreateSurface": {
            "additionalProperties": false,
            "properties": {
              "catalogId": {
                "type": "string"
              },
              "sendDataModel": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "surfaceId": {
                "type": "string"
              },
              "theme": true
            },
            "required": [
              "catalogId",
              "surfaceId"
            ],
            "type": "object"
          },
          "CreateSurfaceMessage": {
            "additionalProperties": false,
            "properties": {
              "createSurface": {
                "$ref": "#/definitions/CreateSurface"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "createSurface",
              "version"
            ],
            "type": "object"
          },
          "DeleteSurface": {
            "additionalProperties": false,
            "properties": {
              "surfaceId": {
                "type": "string"
              }
            },
            "required": [
              "surfaceId"
            ],
            "type": "object"
          },
          "DeleteSurfaceMessage": {
            "additionalProperties": false,
            "properties": {
              "deleteSurface": {
                "$ref": "#/definitions/DeleteSurface"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "deleteSurface",
              "version"
            ],
            "type": "object"
          },
          "ServerMessage": {
            "anyOf": [
              {
                "$ref": "#/definitions/CreateSurfaceMessage"
              },
              {
                "$ref": "#/definitions/UpdateComponentsMessage"
              },
              {
                "$ref": "#/definitions/UpdateDataModelMessage"
              },
              {
                "$ref": "#/definitions/DeleteSurfaceMessage"
              }
            ],
            "description": "Exactly one of the four A2UI v0.9.1 server-to-client envelope messages."
          },
          "SurfaceExport": {
            "properties": {
              "catalog_id": {
                "type": "string"
              },
              "format": {
                "type": "string"
              },
              "format_version": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "messages": {
                "items": {
                  "$ref": "#/definitions/ServerMessage"
                },
                "type": "array"
              },
              "protocol_version": {
                "type": "string"
              },
              "surface_id": {
                "type": "string"
              },
              "title": {
                "type": "string"
              }
            },
            "required": [
              "catalog_id",
              "format",
              "format_version",
              "messages",
              "protocol_version",
              "surface_id",
              "title"
            ],
            "type": "object"
          },
          "UpdateComponents": {
            "additionalProperties": false,
            "properties": {
              "components": {
                "items": {
                  "$ref": "#/definitions/Component"
                },
                "type": "array"
              },
              "surfaceId": {
                "type": "string"
              }
            },
            "required": [
              "components",
              "surfaceId"
            ],
            "type": "object"
          },
          "UpdateComponentsMessage": {
            "additionalProperties": false,
            "properties": {
              "updateComponents": {
                "$ref": "#/definitions/UpdateComponents"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "updateComponents",
              "version"
            ],
            "type": "object"
          },
          "UpdateDataModel": {
            "additionalProperties": false,
            "properties": {
              "path": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "surfaceId": {
                "type": "string"
              },
              "value": {
                "description": "Omit or set null to remove the path. At `/` this replaces the whole data model, matching A2UI v0.9.1 root-update semantics."
              }
            },
            "required": [
              "surfaceId"
            ],
            "type": "object"
          },
          "UpdateDataModelMessage": {
            "additionalProperties": false,
            "properties": {
              "updateDataModel": {
                "$ref": "#/definitions/UpdateDataModel"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "updateDataModel",
              "version"
            ],
            "type": "object"
          }
        },
        "properties": {
          "package": {
            "allOf": [
              {
                "$ref": "#/definitions/SurfaceExport"
              }
            ],
            "description": "Portable A2UI JSON package created by surface export."
          },
          "surface_id": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "package"
        ],
        "title": "ImportRequest",
        "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"
      }
    },
    {
      "description": "List compact summaries of the durable A2UI surfaces owned by the current Harness session, newest first.",
      "metadata": {},
      "name": "a2ui::surface::list",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "List the surfaces belonging to the current Harness session. List generated surfaces in the authoritative Harness session.",
        "title": "ListRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "SurfaceSummary": {
            "properties": {
              "binding_count": {
                "format": "uint",
                "minimum": 0,
                "type": "integer"
              },
              "catalog_id": {
                "type": "string"
              },
              "component_count": {
                "format": "uint",
                "minimum": 0,
                "type": "integer"
              },
              "pinned": {
                "type": "boolean"
              },
              "protocol_version": {
                "type": "string"
              },
              "revision": {
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "surface_id": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "updated_at_ms": {
                "format": "int64",
                "type": "integer"
              }
            },
            "required": [
              "binding_count",
              "catalog_id",
              "component_count",
              "pinned",
              "protocol_version",
              "revision",
              "surface_id",
              "title",
              "updated_at_ms"
            ],
            "type": "object"
          }
        },
        "properties": {
          "count": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "session_id": {
            "type": "string"
          },
          "surfaces": {
            "items": {
              "$ref": "#/definitions/SurfaceSummary"
            },
            "type": "array"
          }
        },
        "required": [
          "count",
          "session_id",
          "surfaces"
        ],
        "title": "ListResponse",
        "type": "object"
      }
    },
    {
      "description": "Update an existing A2UI surface from a plain-language instruction while preserving unspecified content and rejecting stale revisions.",
      "metadata": {},
      "name": "a2ui::surface::patch",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "properties": {
          "data": {
            "default": null,
            "description": "Optional data to merge or use while composing the replacement."
          },
          "expected_revision": {
            "default": null,
            "description": "Reject the update unless the surface is still at this revision.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "instruction": {
            "description": "Plain-language change to make while preserving unspecified content.",
            "type": "string"
          },
          "surface_id": {
            "description": "Stable id of the surface to update.",
            "type": "string"
          },
          "title": {
            "default": null,
            "description": "Optional replacement title.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "instruction",
          "surface_id"
        ],
        "title": "PatchRequest",
        "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"
      }
    },
    {
      "description": "Pin or unpin an A2UI surface so important interfaces remain first in the library.",
      "metadata": {},
      "name": "a2ui::surface::pin",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "properties": {
          "pinned": {
            "type": "boolean"
          },
          "surface_id": {
            "description": "Surface whose library priority should change.",
            "type": "string"
          }
        },
        "required": [
          "pinned",
          "surface_id"
        ],
        "title": "PinRequest",
        "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"
      }
    },
    {
      "description": "Restore an A2UI surface from a prior revision while creating a new monotonic revision.",
      "metadata": {},
      "name": "a2ui::surface::undo",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "properties": {
          "surface_id": {
            "description": "Surface to restore.",
            "type": "string"
          },
          "to_revision": {
            "default": null,
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "surface_id"
        ],
        "title": "UndoRequest",
        "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"
      }
    },
    {
      "description": "Create a new A2UI surface from a reusable template in the current Harness session.",
      "metadata": {},
      "name": "a2ui::template::apply",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "properties": {
          "surface_id": {
            "type": "string"
          },
          "template_id": {
            "description": "Template to instantiate.",
            "type": "string"
          },
          "title": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "surface_id",
          "template_id"
        ],
        "title": "TemplateApplyRequest",
        "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"
      }
    },
    {
      "description": "Delete one reusable A2UI template from the current Harness session.",
      "metadata": {},
      "name": "a2ui::template::delete",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "properties": {
          "template_id": {
            "description": "Reusable template identifier.",
            "type": "string"
          }
        },
        "required": [
          "template_id"
        ],
        "title": "TemplateSelectRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "title": "Boolean",
        "type": "boolean"
      }
    },
    {
      "description": "Read one reusable A2UI template from the current Harness session.",
      "metadata": {},
      "name": "a2ui::template::get",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "properties": {
          "template_id": {
            "description": "Reusable template identifier.",
            "type": "string"
          }
        },
        "required": [
          "template_id"
        ],
        "title": "TemplateSelectRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "Component": {
            "additionalProperties": true,
            "properties": {
              "component": {
                "description": "Component name from the negotiated catalog.",
                "type": "string"
              },
              "id": {
                "description": "Unique component id within the surface. `root` is the render root.",
                "type": "string"
              }
            },
            "required": [
              "component",
              "id"
            ],
            "type": "object"
          }
        },
        "properties": {
          "catalog_id": {
            "type": "string"
          },
          "components": {
            "items": {
              "$ref": "#/definitions/Component"
            },
            "type": "array"
          },
          "created_at_ms": {
            "format": "int64",
            "type": "integer"
          },
          "data_model": true,
          "description": {
            "type": "string"
          },
          "protocol_version": {
            "type": "string"
          },
          "send_data_model": {
            "type": "boolean"
          },
          "template_id": {
            "type": "string"
          },
          "theme": true,
          "title": {
            "type": "string"
          },
          "updated_at_ms": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "catalog_id",
          "components",
          "created_at_ms",
          "data_model",
          "description",
          "protocol_version",
          "send_data_model",
          "template_id",
          "title",
          "updated_at_ms"
        ],
        "title": "SurfaceTemplate",
        "type": "object"
      }
    },
    {
      "description": "List reusable A2UI templates stored for the current Harness session.",
      "metadata": {},
      "name": "a2ui::template::list",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "List reusable templates in the authoritative Harness session.",
        "title": "TemplateListRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "Component": {
            "additionalProperties": true,
            "properties": {
              "component": {
                "description": "Component name from the negotiated catalog.",
                "type": "string"
              },
              "id": {
                "description": "Unique component id within the surface. `root` is the render root.",
                "type": "string"
              }
            },
            "required": [
              "component",
              "id"
            ],
            "type": "object"
          },
          "SurfaceTemplate": {
            "properties": {
              "catalog_id": {
                "type": "string"
              },
              "components": {
                "items": {
                  "$ref": "#/definitions/Component"
                },
                "type": "array"
              },
              "created_at_ms": {
                "format": "int64",
                "type": "integer"
              },
              "data_model": true,
              "description": {
                "type": "string"
              },
              "protocol_version": {
                "type": "string"
              },
              "send_data_model": {
                "type": "boolean"
              },
              "template_id": {
                "type": "string"
              },
              "theme": true,
              "title": {
                "type": "string"
              },
              "updated_at_ms": {
                "format": "int64",
                "type": "integer"
              }
            },
            "required": [
              "catalog_id",
              "components",
              "created_at_ms",
              "data_model",
              "description",
              "protocol_version",
              "send_data_model",
              "template_id",
              "title",
              "updated_at_ms"
            ],
            "type": "object"
          }
        },
        "properties": {
          "count": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "templates": {
            "items": {
              "$ref": "#/definitions/SurfaceTemplate"
            },
            "type": "array"
          }
        },
        "required": [
          "count",
          "templates"
        ],
        "title": "TemplateListResponse",
        "type": "object"
      }
    },
    {
      "description": "Save an A2UI surface as a reusable template in the current Harness session.",
      "metadata": {},
      "name": "a2ui::template::save",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "properties": {
          "description": {
            "default": "",
            "type": "string"
          },
          "surface_id": {
            "description": "Surface to capture as a reusable template.",
            "type": "string"
          },
          "template_id": {
            "type": "string"
          },
          "title": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "surface_id",
          "template_id"
        ],
        "title": "TemplateSaveRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "Component": {
            "additionalProperties": true,
            "properties": {
              "component": {
                "description": "Component name from the negotiated catalog.",
                "type": "string"
              },
              "id": {
                "description": "Unique component id within the surface. `root` is the render root.",
                "type": "string"
              }
            },
            "required": [
              "component",
              "id"
            ],
            "type": "object"
          }
        },
        "properties": {
          "catalog_id": {
            "type": "string"
          },
          "components": {
            "items": {
              "$ref": "#/definitions/Component"
            },
            "type": "array"
          },
          "created_at_ms": {
            "format": "int64",
            "type": "integer"
          },
          "data_model": true,
          "description": {
            "type": "string"
          },
          "protocol_version": {
            "type": "string"
          },
          "send_data_model": {
            "type": "boolean"
          },
          "template_id": {
            "type": "string"
          },
          "theme": true,
          "title": {
            "type": "string"
          },
          "updated_at_ms": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "catalog_id",
          "components",
          "created_at_ms",
          "data_model",
          "description",
          "protocol_version",
          "send_data_model",
          "template_id",
          "title",
          "updated_at_ms"
        ],
        "title": "SurfaceTemplate",
        "type": "object"
      }
    },
    {
      "description": "Serve the a2ui worker's injected console UI assets (content function for its console:script / console:style triggers).",
      "metadata": {
        "internal": true
      },
      "name": "a2ui::ui-content",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "Input of the content function: the console asks for one asset by path.",
        "properties": {
          "path": {
            "description": "The asset path from the trigger config (e.g. `state/page.js`).",
            "type": "string"
          }
        },
        "required": [
          "path"
        ],
        "title": "UiContentInput",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "Output of the content function.",
        "properties": {
          "content": {
            "description": "The asset source, verbatim.",
            "type": "string"
          },
          "content_type": {
            "description": "MIME type the console should serve the asset with.",
            "type": "string"
          }
        },
        "required": [
          "content",
          "content_type"
        ],
        "title": "UiContentResult",
        "type": "object"
      }
    }
  ],
  "triggers": []
}
```
