Skip to main content

Crate agent86_ui

Crate agent86_ui 

Source
Expand description

agent86UI’s protocol layer: Google’s A2UI 1.0 for Rust.

A2UI lets an agent describe UI as declarative JSON that a renderer draws with its own widgets, from a catalog of components and functions it trusts. This crate is the agent’s side of it, with no dependency on the rest of agent86:

  • Catalog: a catalog loaded and checked against the specification’s rules, and Catalog::basic, the specification’s basic catalog;
  • AgentMessage and RendererMessage: the messages, typed;
  • Validator: checks what an agent’s model wrote, batch by batch, against the schemas and the rules they cannot express (surfaces, root, child references, composition, function boundaries), with the specification’s error codes and paths, so the problems can go back to the model;
  • runtime: the headless surface runtime a renderer builds on: surfaces’ components and data models, every binding, call, template, and check resolved for drawing (runtime::Runtime::tree), user input written back, and actions dispatched, with the basic catalog’s functions (formatting in en-US, the regex dialect and its safety rules) implemented;
  • SchemaSet: the envelope schemas compiled against a catalog, for the schema half of validation alone;
  • is_identifier: the specification’s naming rule.

The JSON Schemas and the basic catalog are vendored from the specification (spec/, Apache-2.0, upstream commit recorded in spec/UPSTREAM.md) and served from memory: nothing is ever fetched. The tests replay the specification’s schema cases and its shared conformance suites for the runtime (conformance/core/ upstream).

agent86UI is agent86’s implementation of A2UI; A2UI is Google’s protocol, and this crate is not affiliated with or endorsed by Google.

Modules§

runtime
The headless surface runtime: what a renderer does, without drawing.

Structs§

Action
action: a user interaction with a component whose action is an event.
AgentMessage
A message from the agent to the renderer.
CallAgentFunction
callAgentFunction.
CallRendererFunction
callRendererFunction.
Catalog
A loaded, checked catalog.
CheckRule
One @checks rule: a condition (a binding or a function call) and the message to show when it fails.
CompileError
Why a schema could not be compiled: a catalog that refers outside the documents served, or that is not a valid schema.
Component
One component on a surface. id and component are the protocol’s; the @-prefixed fields are its envelope mixins; everything else is the catalog’s, kept as JSON in Component::properties.
ComponentDef
What validation needs to know about one component type.
CreateSurface
createSurface.
DeleteSurface
deleteSurface.
ErrorBody
A function response’s error.
FunctionCall
A call to a catalog function, as it appears in bindings, checks, actions, and the function-call messages.
FunctionDef
What validation needs to know about one function.
FunctionResponse
agentFunctionResponse and rendererFunctionResponse: a value or an error.
Problem
One problem found in a batch.
RendererError
A renderer’s error message.
RendererMessage
A message from the renderer to the agent.
Report
What Validator::check found.
Rules
How strictly a surface’s component tree must be complete once a batch is applied: the reference SDKs’ ValidationConfig, without its version and message filters.
SchemaError
One failure from a schema check: where in the checked value, and why.
SchemaSet
The message schemas compiled against one catalog.
UpdateComponents
updateComponents.
UpdateDataModel
updateDataModel.
Validator
The agent’s view of a renderer: the catalogs it supports and the surfaces sent to it so far.

Enums§

AgentMessageKind
The kinds of agent-to-renderer message.
Callers
Who may call a function (allowedCallers).
CatalogError
Why a catalog was refused when loaded.
ChildRef
How a component property refers to other components, read from its schema’s $ref, which is how the specification says validators find structural links (“Validator compliance when defining catalogs”).
Code
The specification’s error codes that agent-side validation reports.
RendererMessageKind
The kinds of renderer-to-agent message.

Constants§

ALLOWED_EXTERNAL_REF_TARGETS
The schemas in common_types.json a catalog’s external $ref may target (the specification’s catalog schema rule 3, “Restricted $ref Targets”).
BASIC_CATALOG_ID
The basic catalog’s id, as the specification publishes it.
MAX_CALL_DEPTH
How deep function calls may nest, as in the reference SDKs.
MAX_DEPTH
How deep values may nest in a message, and components below root, as in the reference SDKs.
PROTOCOL_VERSION
The A2UI protocol version this crate implements, as messages carry it in their version field.
SPEC_BASE
The base URI the 1.0 schemas’ $ids share.

Functions§

check_agent_capabilities
Check an agent capabilities object ({"1.0": {...}}).
check_catalog_definition
Check a catalog document against catalog_definition.json.
check_renderer_capabilities
Check a renderer capabilities object ({"1.0": {"supportedCatalogIds": [...]}}).
check_renderer_data_model
Check a renderer data model message ({"version": "1.0", "surfaces": {...}}).
is_identifier
Whether name is a UAX #31 identifier as A2UI defines one: an XID_Start character or _, then XID_Continue characters, with no Pattern_Syntax or Pattern_White_Space character other than _. (XID_Continue already excludes both; the second check keeps the rule explicit, as the specification states it.) A leading digit is refused because digits are not XID_Start.