Lynx

genui / a2ui

a2ui

Index

Classes

ClassDescription
FunctionRegistryLookup table that routes protocol FunctionCall.call names to local JavaScript implementations.
MessageProcessorStateful A2UI protocol processor that turns raw v0.9 messages into renderable surfaces, resources, data-model signals, and user-action events.

Interfaces

InterfaceDescription
A2UIPropsProps for the all-in-one A2UI ReactLynx renderer.
ActionPropsIdentifies the component and surface that emitted an A2UI action.
CatalogRuntime catalog consumed by the renderer and serialized for the agent handshake.
CatalogFunctionEntryA function entry — pair an impl with its name, plus an optional manifest so the handshake can announce the schema to the agent.
CheckLikeA v0.9 CheckRule is { condition, message } where condition is a boolean, a DataBinding, or a FunctionCall. We accept the loose unknown shape so component props don't have to import the v0_9 types just to pass them through.
FunctionCallContextRuntime context passed to client-side function implementations. It mirrors the small DataContext subset used by upstream A2UI basic functions while staying tied to this renderer's MessageProcessor + SignalStore.
FunctionEntryRegistered client-side function and its optional handshake definition.
GenericComponentPropsCommon runtime props passed to every catalog component by the renderer.
MessageStoreA pure append-only buffer of raw protocol messages produced by the developer's IO module. The store knows nothing about the v0.9 protocol — it does not parse, process, or interpret messages. It only:
MessageStoreOptionsOptions used when creating a raw A2UI message buffer.
ResolvedCatalogEntryA resolved catalog entry. Internal representation; consumers don't usually construct these directly — they pass CatalogInputs to defineCatalog.
ResolveFunctionOptionsOptions controlling how function calls are resolved against a catalog.
ResourceInfoPayload carried by renderer resources when a surface or component changes.
SerializedCatalogThe serialized payload sent to the agent during channel handshake.
SurfaceIn-memory state for a single protocol surface.
UserActionPayloadNormalized user action forwarded from rendered catalog components to the host application.

Type Aliases

Type aliasDescription
A2UIClientEventMessage-
CatalogComponentLoose component type — entries receive runtime-shaped props from the protocol stream, so we don't enforce per-component prop typing here.
CatalogFunctionDefinitionThe structured function definition that flows from the extractor (or the upstream basic-catalog manifests) into the catalog and out to the agent during the handshake. Aliased onto the store's FunctionDefinition so functionRegistry.register({ definition }) accepts catalog entries directly without re-shaping.
CatalogInputWhat the developer passes into defineCatalog. Components and function entries can be intermixed.
CatalogManifestThe shape produced by the extractor as dist/catalog/<Name>/catalog.json. The single top-level key is the component's protocol name; the value is its schema. Importing the JSON gives you both, in one declaration.
CatalogSchemaJSON Schema fragment describing a component's props. Produced at build time by @lynx-js/genui/a2ui-catalog-extractor from the component's TypeScript interface marked with @a2uiCatalog <Name>. Optional at runtime — entries that ship without a schema serialize to just { name }.
ComponentInstance-
FunctionImplFunction implementations live on the client; the agent only references functions by name. The registry is the bridge from the wire-level FunctionCall.call string to the actual code that runs locally.
FunctionManifest-
Resource-
ServerToClientMessage-
SurfaceId-

Variables

VariableDescription
basicFunctionsThe A2UI 0.9 basic-catalog function implementations packaged as CatalogFunctionEntrys, ready to spread into <A2UI catalogs={[...]}>. The impls themselves come from @a2ui/web_core so we stay aligned with the upstream spec for free.
functionRegistry-

Functions

FunctionDescription
A2UI-
createFallbackMessagesFromPlainTextBuild a single-Text fallback message stream from a plain string. Used by transports / Session.ingest callers that receive free-form text from the agent instead of structured protocol messages.
createMessageStoreCreate an append-only raw-message buffer suitable for useSyncExternalStore.
createTextCardMessagesBuild a Card-wrapped Text fallback message stream from a plain string. Used when the agent emits text payloads with kind: 'text'.
defineCatalogBuild a catalog from a list of components, [component, manifest] pairs, and/or function entries. Duplicate names within the same kind are rejected. Function entries register their impls into functionRegistry immediately, so any executeFunctionCall after defineCatalog can route to them.
defineFunctionBuild a function entry for defineCatalog. Either pair the impl with the extracted manifest, or pass just the impl (the registry still routes calls; the agent just won't see the parameter schema).
executeFunctionCallResolve arguments, look the function up in the registry, and invoke it. When no impl is registered, log once and return undefined so callers (checks, dynamic-property bindings) can degrade gracefully.
mergeCatalogsMerge multiple catalogs. Last write wins on duplicate names — useful when a page-level catalog overrides a brand-level one which overrides built-ins.
NodeRenderer-
normalizePayloadToMessagesNormalize an arbitrary payload (string, array, object) into a flat list of ServerToClientMessage records. Pass-through for already-structured messages; falls back to wrapping plain text in a Text/Card surface.
prepareMessagesForProcessingTag messages with the given messageId and report whether any of them carries a non-empty updateComponents. Also dedupes createSurface messages against the set of currently-active surfaces.
registerBasicFunctionsManual escape hatch for consumers who build their own renderer and don't go through defineCatalog. Registers every adapted basic-catalog impl into the shared functionRegistry. Calling more than once is harmless — later registrations override earlier ones, which is the intended override path.
resolveCatalogBuild a name → component lookup map from a catalog. The renderer uses this to resolve { component: 'Text', ... } from the protocol stream.
resolveDynamicValueResolve literals, data bindings, and function calls into concrete runtime values for component props or action payloads.
serializeCatalogProduce the JSON manifest the client should announce to the agent during channel handshake. Component entries without an attached schema serialize to { name } only — useful for letting the agent at least know what's renderable. Function entries serialize with their parameter schema when available.
useActionCreate a sendAction callback that resolves dynamic action payload values and dispatches user events or function calls through the current processor.
useChecksEvaluate an input component's checks array reactively. Returns the current outcome plus the first failure message (handy for inline error rendering). When an enclosing <FormContext.Provider> exists, the input is also registered with it so Buttons in the same form can react to isValid.
useDataBindingSubscribe to a data-model binding and return the current value at that path.
useResolvedPropsResolve a component's dynamic props and keep the result in sync with signal-backed data model changes.
Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.