@lynx-js/genui/a2ui
English | 简体中文
@lynx-js/genui/a2ui is the ReactLynx client runtime for A2UI v0.9. It
consumes validated A2UI server-to-client JSON messages and renders trusted
ReactLynx components in your app.
Use this package when you already have, or plan to build, an Agent service that returns A2UI messages. The package does not host an Agent, call an LLM, own a backend route, or provide a chat shell. Your app owns the transport layer and pushes messages into the renderer.
If you have never used A2UI before, think of it this way:
- In React, your code chooses components and passes props.
- In A2UI, an Agent chooses from a component catalog that your app publishes.
- The client still renders real ReactLynx components. The model only sends data that says which approved component to render and what props to use.
The result is not arbitrary generated code. It is a ReactLynx UI tree assembled from a trusted catalog.
Install
Install the published GenUI package in a ReactLynx app:
Import the optional default theme tokens once if you want to use the built-in light/dark CSS variables:
Quick Start
Create a MessageStore, register the components that generated UI is allowed
to render, and forward generated actions back to your Agent service.
MessageStore stores raw protocol messages in arrival order. <A2UI>
subscribes to it, processes new messages, renders the active surface, and emits
generated UI actions through onAction.
What You Own
First Things To Know
- Pass only the components you want generated UI to use through
catalogs. - Include
...basicFunctionswhen messages may use A2UI function calls such asformatString,formatDate,required,email, orand. - Pair components with their
catalog.jsonmanifests when you needserializeCatalog(...)to send JSON schemas to an Agent. - There is intentionally no
@lynx-js/genui/a2ui/catalog/allexport. Compose the exact catalog you want at the integration site so bundle cost is visible. - For a new turn or session, mount
<A2UI>with a differentkey; the component owns itsMessageProcessorfor the lifetime of the mount.

