import { type ActionEvent, type Library, type ParseResult } from '@openuidev/react-lang'; import { z } from 'zod/v4'; import { type AIUIComponent } from '../AIComponents/GenerativeUI/AIUIComponent'; import type { AIUIComponentDefinition } from '../AIComponents/GenerativeUI/AIUIComponentDefinition'; import { type AIUIDocument } from '../AIComponents/GenerativeUI/AIUIDocument'; import type { AIUIClientToolDefinition } from '../AIComponents/GenerativeUI/AIUITools'; import type { OpenUIEngine } from './OpenUIRenderer'; /** A library of OpenUI components, as `createLibrary` of `@openuidev/react-lang` makes one. */ export type OpenUILibrary = Library; /** The OpenUI type of one of the app's components, named as the library names its own. */ export declare const openUITypeName: (name: string) => string; /** * What an app's component is for, as the agent reads it: what it shows, what each parameter * holds, since OpenUI passes them by position and its signatures name only their types, and * what its events do, since it reports them itself. As StreamChatOpenUI describes it. */ export declare const openUIDescriptionOf: ({ description, events, parameters, }: AIUIComponentDefinition) => string; /** An app's component's parameters as the props of an OpenUI component, in their order. */ export declare const openUIPropsOf: ({ parameters }: AIUIComponentDefinition) => z.ZodObject<{ [x: string]: z.ZodType>; }, z.core.$strip>; /** The library a conversation's replies are written with: the renderer's, with the app's components. */ export declare const libraryOf: (engine: OpenUIEngine) => Library; /** * The instructions that teach a model to write OpenUI with `library` and `components`, call * the app's `tools`, and heed the app's own `instructions`, which come first. */ export declare const instructionsFor: (components: AIUIComponent[], { instructions, library, tools, }?: { instructions?: string; library?: Library; tools?: AIUIClientToolDefinition[]; }) => string; /** The fields of a reply's program the person types secrets in, such as a password. */ export type OpenUISecrets = { /** The names of its password inputs. */ fields: Set; /** The `$variables` they are bound to. */ variables: Set; }; /** The password inputs of a program as OpenUI read it, and what they are bound to. */ export declare const secretsOf: (parsed: ParseResult | null) => OpenUISecrets; /** * A program's state or a form's values without what the person typed in its secret fields, * such as a password, which neither reaches the agent nor is kept: the fields are left out, and * their values are taken out of anything else that holds them. */ export declare const withoutSecrets: (state: Record, secrets: OpenUISecrets) => Record; type Pressed = { at: number; words: string; }; /** What the person pressed, from a click on the reply's UI, or nothing for what isn't a control. */ export declare const pressedOf: (target: EventTarget | null) => Pressed | undefined; /** * What the person did, as the action that tells the agent, in StreamChatOpenUI's shape: a * button or follow-up continues the conversation with the words of the control they pressed as * the label, as they saw them, and carries the step's message for the agent, its `context`, any * other params, and the values of the form it belongs to, never what they typed in a secret * field. A link opens the way the host allows instead, and an action the library defines but * OpenUI doesn't is left out and reported, as the agent has nothing to do with it. */ export declare const actOn: (engine: OpenUIEngine, messageId: string, event: ActionEvent, { pressed, secrets, state, }?: { pressed?: Pressed; secrets?: OpenUISecrets; /** * The program's whole state, as OpenUI last gave it. A form's own values leave out the * `$variables` its fields are bound to, such as a password's, which can still be in the * action's context or message. */ state?: Record; }) => void; /** * How long after the person presses a control in a reply's UI the tools it runs count as theirs: * as long as a browser's activation lasts, so a Mutation the press runs after another still can. */ export declare const TOOL_PRESS_MS = 5000; /** * The host's tools as a program's Query() and Mutation() run them: one that changes something * runs only while `isActing`, just after the person pressed a control in this reply's UI, and * the same question asked again within a few seconds, as a Query refreshing on its own does, * gets the answer it got. A press elsewhere on the page, such as sending a message, doesn't * count, as the browser's own activation would. */ export declare const hostToolProvider: (engine: OpenUIEngine, isActing?: () => boolean) => { [k: string]: (args: Record) => Promise; }; /** A reply's UI, following its program as the agent writes it. */ export declare const OpenUIReplyContent: ({ document, engine, messageId, }: { document: AIUIDocument; engine: OpenUIEngine; messageId: string; }) => import("react/jsx-runtime").JSX.Element; /** What the renderer's entry reaches once the runtime loads. */ export type OpenUIRuntime = { instructionsFor: typeof instructionsFor; OpenUIReplyContent: typeof OpenUIReplyContent; }; export {}; //# sourceMappingURL=runtime.d.ts.map