genui / a2ui
#a2ui
#索引
#类
| Class | 描述 |
|---|---|
| FunctionRegistry | Lookup table that routes protocol FunctionCall.call names to local JavaScript implementations. |
| MessageProcessor | Stateful A2UI protocol processor that turns raw v0.9 messages into renderable surfaces, resources, data-model signals, and user-action events. |
#接口
| Interface | 描述 |
|---|---|
| A2UIProps | Props for the all-in-one A2UI ReactLynx renderer. |
| ActionProps | Identifies the component and surface that emitted an A2UI action. |
| Catalog | Runtime catalog consumed by the renderer and serialized for the agent handshake. |
| CatalogFunctionEntry | A function entry — pair an impl with its name, plus an optional manifest so the handshake can announce the schema to the agent. |
| CheckLike | A 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. |
| FunctionCallContext | Runtime 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. |
| FunctionEntry | Registered client-side function and its optional handshake definition. |
| GenericComponentProps | Common runtime props passed to every catalog component by the renderer. |
| MessageStore | A 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: |
| MessageStoreOptions | Options used when creating a raw A2UI message buffer. |
| ResolvedCatalogEntry | A resolved catalog entry. Internal representation; consumers don't usually construct these directly — they pass CatalogInputs to defineCatalog. |
| ResolveFunctionOptions | Options controlling how function calls are resolved against a catalog. |
| ResourceInfo | Payload carried by renderer resources when a surface or component changes. |
| SerializedCatalog | The serialized payload sent to the agent during channel handshake. |
| Surface | In-memory state for a single protocol surface. |
| UserActionPayload | Normalized user action forwarded from rendered catalog components to the host application. |
#类型别名
| Type alias | 描 述 |
|---|---|
| A2UIClientEventMessage | - |
| CatalogComponent | Loose component type — entries receive runtime-shaped props from the protocol stream, so we don't enforce per-component prop typing here. |
| CatalogFunctionDefinition | The 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. |
| CatalogInput | What the developer passes into defineCatalog. Components and function entries can be intermixed. |
| CatalogManifest | The 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. |
| CatalogSchema | JSON 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 | - |
| FunctionImpl | Function 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 | - |
#变量
| Variable | 描述 |
|---|---|
| basicFunctions | The 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 | - |
#函数
| Function | 描述 |
|---|---|
| A2UI | - |
| createFallbackMessagesFromPlainText | Build 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. |
| createMessageStore | Create an append-only raw-message buffer suitable for useSyncExternalStore. |
| createTextCardMessages | Build a Card-wrapped Text fallback message stream from a plain string. Used when the agent emits text payloads with kind: 'text'. |
| defineCatalog | Build 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. |
| defineFunction | Build 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). |
| executeFunctionCall | Resolve 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. |
| mergeCatalogs | Merge multiple catalogs. Last write wins on duplicate names — useful when a page-level catalog overrides a brand-level one which overrides built-ins. |
| NodeRenderer | - |
| normalizePayloadToMessages | Normalize 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. |
| prepareMessagesForProcessing | Tag 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. |
| registerBasicFunctions | Manual 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. |
| resolveCatalog | Build a name → component lookup map from a catalog. The renderer uses this to resolve { component: 'Text', ... } from the protocol stream. |
| resolveDynamicValue | Resolve literals, data bindings, and function calls into concrete runtime values for component props or action payloads. |
| serializeCatalog | Produce 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. |
| useAction | Create a sendAction callback that resolves dynamic action payload values and dispatches user events or function calls through the current processor. |
| useChecks | Evaluate 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. |
| useDataBinding | Subscribe to a data-model binding and return the current value at that path. |
| useResolvedProps | Resolve a component's dynamic props and keep the result in sync with signal-backed data model changes. |