Lynx

Home > @lynx-js/genui-a2ui

genui-a2ui package

Classes

Functions

Function

Description

Button(props)

Card(props)

CheckBox(props)

ChoicePicker(props)

Column(props)

createFallbackMessagesFromPlainText(text)

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(options)

createTextCardMessages(text)

Build a Card-wrapped Text fallback message stream from a plain string. Used when the agent emits text payloads with kind: 'text'.

DateTimeInput(props)

defineCatalog(inputs)

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(impl, manifest)

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).

Divider(props)

executeFunctionCall(processor, fn, surfaceId, dataContextPath, options)

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.

Icon(props)

Image_2(props)

LineChart(props)

List(props)

mergeCatalogs(catalogs)

Merge multiple catalogs. Last write wins on duplicate names — useful when a page-level catalog overrides a brand-level one which overrides built-ins.

Modal(props)

normalizePayloadToMessages(payload)

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.

PieChart(props)

prepareMessagesForProcessing(rawMessages, messageId, activeSurfaceIds)

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.

RadioGroup(props)

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(catalog)

Build a name → component lookup map from a catalog. The renderer uses this to resolve { component: 'Text', ... } from the protocol stream.

resolveDynamicValue(processor, value, surfaceId, dataContextPath, options)

Row(props)

serializeCatalog(catalog)

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.

Slider(props)

Tabs(props)

Text_2(props)

TextField(props)

useAction(props)

useChecks(options)

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(dynamicValue, surface, dataContextPath, fallbackValue)

useResolvedProps(properties, surface, dataContextPath, processor, functions)

Interfaces

Interface

Description

A2UIProps

ActionProps

Catalog

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

GenericComponentProps

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:

  1. Stores them in arrival order. 2. Notifies subscribers when new ones land. 3. Hands the current snapshot back via getSnapshot() (referentially stable between mutations — required by useSyncExternalStore).

Protocol-aware processing — surfaces, signals, resources, action dispatch — is the responsibility of <A2UI> (the renderer component). Developers who don't want to learn the protocol should use <A2UI>; developers who do can run their own MessageProcessor against the snapshot directly.

MessageStoreOptions

ResolvedCatalogEntry

A resolved catalog entry. Internal representation; consumers don't usually construct these directly — they pass CatalogInputs to defineCatalog.

ResolveFunctionOptions

ResourceInfo

SerializedCatalog

The serialized payload sent to the agent during channel handshake.

Surface

UserActionPayload

Variables

Variable

Description

A2UI

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

NodeRenderer

Type Aliases

Type Alias

Description

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

除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。