import { type ComponentType } from 'react'; import type { AIUIComponentDefinition } from './AIUIComponentDefinition'; import type { AIUIHost } from './AIUIHost'; /** Where an app's component is shown, and how it tells the agent what the person did. */ export type AIUIComponentContext = { /** * Tells the agent about one of the component's events, as the person's next message. * `label` is what the person did, in their words, such as "Tell me more about St. Naum". */ emit: (event: string, label: string, payload?: Record) => void; /** The conversation's host, for running the app's tools and opening links. */ host: AIUIHost; /** Whether the agent is still writing the reply's UI, so the arguments may still change. */ isStreaming: boolean; /** The reply the component is in. */ messageId: string; }; export type AIUIComponentProps = { /** What the agent filled in: keys in camelCase, dates as `Date`s. */ args: Arguments; context: AIUIComponentContext; }; /** * One of the app's views that the agent can place in a reply's UI, in whichever format it * writes, such as a map or a card over the app's own data. The counterpart of `AIUIComponent` * in StreamChatAI. */ export type AIUIComponent = { Component: ComponentType>; /** Its description, the same on every platform and for the agent. */ definition: AIUIComponentDefinition; }; /** * One of the app's components, with what its view reads from the agent's arguments. The view * gets them only once they fit the definition's parameters, so it can rely on their types. */ export declare const defineAIUIComponent: (definition: AIUIComponentDefinition, Component: ComponentType>) => AIUIComponent; /** * An app's component for the arguments the agent wrote, coming in as it shows, or nothing * while they don't fit its parameters, such as while they are still streaming in. Renderers * place the app's components with it. One that throws leaves only itself out of the reply's * UI, is tried again when its arguments change, and is reported once the reply is written. */ export declare const AIUIComponentView: ({ args, component, context, }: { args: Record; component: AIUIComponent; context: AIUIComponentContext; }) => import("react/jsx-runtime").JSX.Element | null; //# sourceMappingURL=AIUIComponent.d.ts.map