import type { AIUIComponent } from '../AIComponents/GenerativeUI/AIUIComponent'; 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 type { AIUIClientToolDefinition } from '../AIComponents/GenerativeUI/AIUITools'; import { AIUIRuntimeLoader } from '../AIComponents/GenerativeUI/AIUIRuntimeLoader'; import type { OpenUILibrary, OpenUIRuntime } from './runtime'; /** The fence an agent writes an OpenUI program in, which the agents router reads. */ export declare const OPENUI_FENCE = "openui-lang"; /** What went wrong in a reply's OpenUI program, as OpenUI reports it to an agent. */ export type OpenUIError = { /** A code such as `unknown-component` or `missing-required`. */ code: string; message: string; /** The component it is about, when it is about one. */ component?: string; /** The statement it is about, such as `root`. */ statementId?: string; }; export type OpenUIRendererOptions = { /** * Whether OpenUI's own inspector shows in development, as `@openuidev/react-lang` mounts it * on every page that loads it, with its offers. Off by default: the app's page is the app's. */ devtools?: boolean; /** * What the app tells the agent's model about writing its UI, such as when to answer with UI, * ahead of OpenUI's own instructions in `capabilities`. */ instructions?: string; /** * The library the agent writes with, before the app's components join it: OpenUI's chat * library (`openuiChatLibrary` of `@openuidev/react-ui/genui-lib`) by default. Give one made * with `createLibrary` of `@openuidev/react-lang` to use components of your own. */ library?: OpenUILibrary; /** * What an image 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 program, such as a component the library * 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 * library or a runtime that couldn't load, comes without an id. Logged by default. */ onError?: (error: OpenUIError, messageId?: string) => void; /** * Runs the tools a program's `Query()` and `Mutation()` call. By default they are the host's * client tools, run in the page: one that isn't read-only only just after the person pressed a * control in the reply's UI, such as a button, and a Query asking the same again within 5 s * gets the answer it got. */ toolProvider?: Record) => Promise>; }; /** * Shows the OpenUI of one conversation. Each reply's form values are kept in the host, so * they survive scrolling. */ export declare class OpenUIEngine implements AIUIEngine { readonly host: AIUIHost; /** Loads the runtime, the OpenUI packages, when a reply first shows OpenUI. */ readonly loader: AIUIRuntimeLoader; /** What an image the agent links to loads. */ readonly mediaURL: AIUIMediaURL; readonly options: OpenUIRendererOptions; /** What has been said about each reply's program, so each error is said once. */ readonly reported: Map>; private readonly drawsNothing; constructor(host: AIUIHost, options: OpenUIRendererOptions); /** Notes that a finished reply's program draws nothing, such as words that aren't OpenUI. */ drewNothing(messageId: string, program: string): void; remove(messageId: string): void; /** * Tells the app what went wrong, after the current render: the library is made as a reply * first shows, and an app may set state when told. */ report(error: OpenUIError, messageId?: string): void; view(document: AIUIDocument, messageId: string): import("react/jsx-runtime").JSX.Element | null; } /** * The instructions that teach an agent's model to write OpenUI with the library and the app's * `components`, call the app's `tools`, and heed the app's own `instructions`, which come * first, from OpenUI's own prompt generator. Give them to the agent's backend, as the part of * its instructions about UI. It loads the OpenUI packages. */ export declare const openUIInstructions: (components: AIUIComponent[], options?: Pick & { tools?: AIUIClientToolDefinition[]; }) => Promise; /** * The renderer of [OpenUI](https://openui.com) for `AIUIHost`, on the official OpenUI packages * (`@openuidev/react-lang` and `@openuidev/react-ui`, which the app installs). The app's * components join its library, so the agent places them like the library's own. The * counterpart of `OpenUIRenderer` in StreamChatOpenUI. */ export declare const createOpenUIRenderer: (options?: OpenUIRendererOptions) => AIUIRenderer; //# sourceMappingURL=OpenUIRenderer.d.ts.map