import type { 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 { 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. * * The internal `MessageProcessor` (surfaces, signals, resources) is * created once per mount and is **not reset** if `messageStore` is * later replaced with a different instance. Pass a `key` prop derived * from the store's identity if you want a fresh session, e.g. * ``. */ messageStore: MessageStore; /** * 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; /** * 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 before the first `beginRendering` arrives from the buffer. */ 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; } /** * The all-in-one A2UI component. Owns a `MessageProcessor` internally, * processes raw messages from the buffer on each render, and renders * the most recent `beginRendering` surface tree. * * @example * const store = createMessageStore(); * * // Developer's IO module pushes raw messages into the store. * async function streamFromAgent(input: string) { * for await (const msg of myAgent.stream(input)) store.push(msg); * } * * { void streamFromAgent(serializeAction(action)); }} * wrapSurface={(c) => {c}} * /> */ declare function A2UIImpl(props: A2UIProps): import('@lynx-js/react').ReactNode; export declare const A2UI: import("react").MemoExoticComponent; export {};