import { type ComponentPropsWithoutRef, type ComponentType } from 'react'; import type { AIUIDocument } from '../AIComponents/GenerativeUI/AIUIDocument'; import type { AIUIHost } from '../AIComponents/GenerativeUI/AIUIHost'; import { type AIUIMediaURL } from '../AIComponents/GenerativeUI/AIUIMedia'; import type { AIUIEngine, AIUIRenderer } from '../AIComponents/GenerativeUI/AIUIRenderer'; import { AIUIRuntimeLoader } from '../AIComponents/GenerativeUI/AIUIRuntimeLoader'; import { A2UI_DEFAULT_CATALOG_ID, A2UI_LEGACY_CATALOG_ID } from './catalogDocument'; import type { ReactA2uiComponentProps } from '@a2ui/react'; import type { A2UIReplyState, A2UIRuntime } from './runtime'; export { A2UI_DEFAULT_CATALOG_ID, A2UI_LEGACY_CATALOG_ID }; /** What went wrong in a reply's A2UI, as the A2UI specification reports it to an agent. */ export type A2UIError = { /** A code such as `VALIDATION_FAILED` or `EXPRESSION_ERROR`. */ code: string; message: string; /** Where in the message it went wrong, as a JSON pointer. */ path?: string; surfaceId?: string; }; /** The components of A2UI's basic catalog, each of which an app can draw its own way or leave out. */ export type A2UIBasicComponentName = 'AudioPlayer' | 'Button' | 'Card' | 'CheckBox' | 'ChoicePicker' | 'Column' | 'DateTimeInput' | 'Divider' | 'Icon' | 'Image' | 'List' | 'Modal' | 'Row' | 'Slider' | 'Tabs' | 'Text' | 'TextField' | 'Video'; /** * An app's view of one of the basic catalog's components, as `@a2ui/react` places it: with * `props` worked out from what the agent wrote, `buildChild` to place its children by id, and * the component's `context`. */ export type A2UIBasicComponent = ComponentType>>; export type A2UIRendererOptions = { /** * The basic catalog's components to draw the app's way, by name, or `null` to leave one out * of the catalog and the agent's instructions, such as `{ Video: null }`. */ basicComponents?: Partial>; /** * The id the agent names the catalog with the app's components by. A surface naming the * basic catalog shows them too, and a surface naming none is made with this one. */ catalogId?: string; /** * The icon font the page loads, such as `'Material Symbols Outlined'`, for the icons of A2UI's * Icon that neither `icons` nor Stream draws. Without one, such an icon shows nothing. */ iconFont?: string; /** * The app's icons for the names A2UI's Icon takes, such as `shoppingCart`, over Stream's. * Stream draws about 30 of the 60 names. */ icons?: Partial>>>; /** * What the app tells the agent's model about writing its UI, such as when to answer with UI, * ahead of A2UI's own instructions in `capabilities`. */ instructions?: string; /** * What an image, video or sound the agent links to loads: the URL, another, or `null` not to * load it. Public web links and the page's own site load by default (`aiUIPublicMediaURL`). */ mediaUrl?: AIUIMediaURL; /** * Tells the app what went wrong in a reply's A2UI, such as a message that isn't JSON or a * component the catalog doesn't have, with the reply's id. The rest of the reply's UI still * shows. What is wrong with the renderer rather than a reply, such as an app's component that * can't join the catalog or a runtime that couldn't load, comes without an id. Logged by * default. */ onError?: (error: A2UIError, messageId?: string) => void; }; /** * Shows the A2UI of one conversation. Each reply's surfaces are its own, kept for as long as * the host keeps the engine, so what the person entered survives scrolling. */ export declare class A2UIEngine implements AIUIEngine { readonly catalogId: string; readonly basicComponents: NonNullable; readonly host: AIUIHost; readonly iconFont?: string; readonly icons?: A2UIRendererOptions['icons']; /** What an image, video or sound the agent links to loads. */ readonly mediaURL: AIUIMediaURL; /** Loads the runtime, the A2UI packages, when a reply first shows A2UI. */ readonly loader: AIUIRuntimeLoader; /** Each reply's surfaces, by the reply's id. */ readonly replies: Map; private readonly options; constructor(host: AIUIHost, options: A2UIRendererOptions); /** * Tells the app what went wrong, after the current render: a reply's messages are applied * as it first shows, and an app may set state when told. */ report(error: A2UIError, messageId?: string): void; remove(messageId: string): void; view(document: AIUIDocument, messageId: string): import("react/jsx-runtime").JSX.Element | null; } /** * The renderer of [A2UI](https://a2ui.org) 1.0 for `AIUIHost`, on the official A2UI packages * (`@a2ui/web_core` and `@a2ui/react`, which the app installs). The app's components join its * catalog, so the agent places them like the basic catalog's own. The counterpart of * `A2UIRenderer` in StreamChatA2UI. */ export declare const createA2UIRenderer: (options?: A2UIRendererOptions) => AIUIRenderer; //# sourceMappingURL=A2UIRenderer.d.ts.map