import type { MemoExoticComponent, ReactNode } from '@lynx-js/react'; import type { UnsupportedInfo } from './A2UIRenderer.jsx'; import type { CatalogInput } from '../catalog/defineCatalog.js'; import type { MessageStore } from '../store/MessageStore.js'; import type { RendererToAgentMessage, UserActionPayload } from '../store/types.js'; /** * Props for the all-in-one A2UI ReactLynx renderer. */ export interface A2UIProps { /** * The raw-message buffer the developer pushes protocol messages into. * `` subscribes via `useSyncExternalStore` and processes new * messages incrementally. * * Pass `null` to render nothing and end the current rendering session, * without calling `renderEmpty`. Passing a store afterward starts a new * session and processes all messages already in that store. * * The internal `MessageProcessor` (surfaces, signals, resources) is * retained while `messageStore` stays non-null and is **not reset** if * replaced directly with a different instance. Pass a `key` prop derived * from the store's identity if you want a fresh session, e.g. * ``. * * @example * */ messageStore: MessageStore | null; /** * Components the renderer is allowed to instantiate. Each item is either * a bare component (name read from `displayName ?? name`) or a tuple * `[component, manifest]` where the manifest is the JSON the extractor * emits at `dist/catalog//catalog.json`. */ catalogs: readonly CatalogInput[]; /** * Called when a user action fires inside the rendered tree (button * tap, etc.). Forward to your agent and push the response messages * back into the same `messageStore` to update the UI. Fire-and-forget; * the renderer never awaits this. */ onAction?: (action: UserActionPayload) => void; /** Exact protocol catalog id; defaults to the built-in Lynx catalog id. */ catalogId?: string; /** Forward v1.0 wire events and metadata; push responses into messageStore. */ onMessage?: (message: RendererToAgentMessage, metadata: Record) => void | Promise; /** * Optional class name applied to the top-level `surface-${surfaceId}` * view for the active surface. Use this when theme switching is * expressed as surface-level classes. */ className?: string; /** * Wrap each top-level surface so consumers can apply an outer theme * shell, wrapper className, or additional styles. */ wrapSurface?: (children: ReactNode, ctx: { surfaceId: string; }) => ReactNode; /** Render when a non-null messageStore has no surface ready yet. */ renderEmpty?: () => ReactNode; /** Render while the active resource is pending. */ renderFallback?: () => ReactNode; /** Render when the active resource fails. */ renderError?: (err: unknown) => ReactNode; /** Render when unsupported data syntax or an unsupported component is encountered. */ renderUnsupported?: (info: UnsupportedInfo) => ReactNode; } /** Render A2UI protocol messages using the supplied catalogs. */ export declare const A2UI: MemoExoticComponent<(props: A2UIProps) => ReactNode>;