import React from "react"; import type { ToolAnnotations } from "../model/component-metadata"; import { SupportedSchema } from "../schema"; export interface InteractableConfig, State = Record> { /** * The name of the component, used for identification in Tambo. */ componentName: string; /** * A brief description of the component's purpose and functionality. LLM will * use this to understand how to interact with it. */ description: string; /** * Optional schema for component props. If provided, prop updates will be * validated against this schema. */ propsSchema?: SupportedSchema; /** * Optional schema for component state. If provided, state updates will be * validated against this schema. */ stateSchema?: SupportedSchema; /** * Optional annotations for the interactable component's auto-registered tools * (props update and state update). By default, `tamboStreamableHint` is `true` * so props/state updates stream in real-time. Set `{ tamboStreamableHint: false }` * to disable streaming for this component's tools. */ annotations?: ToolAnnotations; } /** * Props injected by withTamboInteractable HOC. These can be passed to the wrapped * component to customize interactable behavior. */ export interface WithTamboInteractableProps { /** * Optional ID to use for this interactable component instance. * If not provided, a unique ID will be generated automatically. */ interactableId?: string; /** * Callback fired when the component has been registered as interactable. * @param id - The assigned interactable component ID */ onInteractableReady?: (id: string) => void; /** * Callback fired when the component's serializable props are updated by Tambo * through a tool call. Note: Only serializable props are tracked. * @param newProps - The updated serializable props */ onPropsUpdate?: (newProps: Record) => void; } /** * Higher-Order Component that makes any component interactable by tambo. * @param WrappedComponent - The component to make interactable * @param config - Configuration for the interactable component * @returns A new component that is automatically registered as interactable * @example * ```tsx * const MyNote: React.FC<{ title: string; content: string }> = ({ title, content }) => { * const [isPinned, setIsPinned] = useTamboComponentState("isPinned", false); * return ( *
*

{title}

*

{content}

*
* ); * }; * * const MyInteractableNote = withTamboInteractable(MyNote, { * componentName: "MyNote", * description: "A note component", * propsSchema: z.object({ * title: z.string(), * content: z.string(), * }), * stateSchema: z.object({ * isPinned: z.boolean(), * }), * }); * * // Usage * * ``` */ export declare function withTamboInteractable(WrappedComponent: React.ComponentType, config: InteractableConfig): React.FC; //# sourceMappingURL=with-tambo-interactable.d.ts.map