/** * TamboProvider - Main Provider * * Composes the necessary providers for the SDK: * - TamboClientProvider: API client and authentication * - TamboRegistryProvider: Component and tool registration * - TamboContextHelpersProvider: Context helper functions * - TamboMcpTokenProvider: MCP access token management * - TamboMcpProvider: MCP server connections and tool discovery * - TamboContextAttachmentProvider: Single-message context attachments * - TamboInteractableProvider: Interactive component tracking * - TamboStreamProvider: Streaming state management * * This provider should wrap your entire application or the portion * that needs access to Tambo functionality. */ import React, { type PropsWithChildren } from "react"; import { type TamboClientProviderProps } from "../../providers/tambo-client-provider"; import { type TamboRegistryProviderProps } from "../../providers/tambo-registry-provider"; import type { ContextHelpers } from "../../context-helpers"; import type { McpServerInfo } from "@tambo-ai/client"; import type { ListResourceItem, ResourceSource } from "../../model/resource-info"; import type { InitialInputMessage } from "../types/message"; /** * Configuration values for the SDK. * These are static values that don't change during the session. */ export interface TamboConfig { /** User key for thread ownership and scoping */ userKey?: string; /** Whether to automatically generate thread names after a threshold of messages. Defaults to true. */ autoGenerateThreadName?: boolean; /** The message count threshold at which the thread name will be auto-generated. Defaults to 3. */ autoGenerateNameThreshold?: number; /** * Initial messages to seed new threads with. * These are displayed in the UI immediately and sent to the API on first message. */ initialMessages?: InitialInputMessage[]; } /** * Context for SDK configuration. * @internal */ export declare const TamboConfigContext: React.Context; /** * Hook to access SDK configuration. * @returns Configuration values including userKey * @throws {Error} If used outside TamboProvider */ export declare function useTamboConfig(): TamboConfig; /** * Props for TamboProvider */ export interface TamboProviderProps extends Pick { /** * Components to register with the registry. * These will be available for the AI to use in responses. */ components?: TamboRegistryProviderProps["components"]; /** * Tools to register with the registry. * These will be executed client-side when requested by the AI. */ tools?: TamboRegistryProviderProps["tools"]; /** * MCP servers to register with the registry. * These provide additional tools and resources from MCP-compatible servers. */ mcpServers?: (McpServerInfo | string)[]; /** * Callback function called when an unregistered tool is called. * If not provided, an error will be thrown for unknown tools. */ onCallUnregisteredTool?: TamboRegistryProviderProps["onCallUnregisteredTool"]; /** * Static resources to register with the registry. * These will be available for the AI to access. */ resources?: ListResourceItem[]; /** * Dynamic resource search function. * Must be paired with getResource. * Called when searching for resources dynamically. */ listResources?: ResourceSource["listResources"]; /** * Dynamic resource fetch function. * Must be paired with listResources. * Called when fetching a specific resource by URI. */ getResource?: ResourceSource["getResource"]; /** * Configuration for context helpers. * A dictionary of functions that provide additional context to the AI. * Each key becomes the context name, and the function returns the value. */ contextHelpers?: ContextHelpers; /** * User key for thread ownership and scoping. * * **Required**: You must provide either `userKey` OR `userToken` (which contains a userKey). * All thread operations (create, list, fetch) only return threads owned by this userKey. * * - Use `userKey` for server-side or trusted environments where you control the user identity * - Use `userToken` (OAuth bearer token) for client-side apps where the token contains the userKey */ userKey?: string; /** * Whether to automatically generate thread names after a threshold of messages. * Defaults to true. */ autoGenerateThreadName?: boolean; /** * The message count threshold at which the thread name will be auto-generated. * Defaults to 3. */ autoGenerateNameThreshold?: number; /** * Initial messages to seed new threads with. * These are displayed in the UI immediately (before the first API call) * and sent to the API when the first message is sent to create the thread. */ initialMessages?: InitialInputMessage[]; /** * Children components */ children: React.ReactNode; } /** * Main provider for the Tambo SDK. * * Composes TamboClientProvider, TamboRegistryProvider, and TamboStreamProvider * to provide a complete context for building AI-powered applications. * * Threads are managed dynamically through useTambo() hook functions: * - startNewThread() - Begin a new conversation * - switchThread(threadId) - Switch to an existing thread * - initThread(threadId) - Initialize a thread for receiving events * @param props - Provider configuration * @param props.apiKey - Tambo API key for authentication * @param props.tamboUrl - Optional custom Tambo API URL * @param props.environment - Optional environment configuration * @param props.userToken - Optional OAuth token for user authentication * @param props.components - Components to register with the AI * @param props.tools - Tools to register for client-side execution * @param props.mcpServers - MCP servers to register for additional tools/resources * @param props.onCallUnregisteredTool - Callback for handling unknown tool calls * @param props.resources - Static resources to register with the AI * @param props.listResources - Dynamic resource search function (must be paired with getResource) * @param props.getResource - Dynamic resource fetch function (must be paired with listResources) * @param props.contextHelpers - Configuration for context helper functions * @param props.userKey - User key for thread ownership (required if not using userToken) * @param props.autoGenerateThreadName - Whether to automatically generate thread names. Defaults to true. * @param props.autoGenerateNameThreshold - The message count threshold at which the thread name will be auto-generated. Defaults to 3. * @param props.initialMessages - Optional initial messages to prepend to the first thread. * @param props.children - Child components * @returns Provider component tree * @example * ```tsx * import { TamboProvider } from '@tambo-ai/react'; * * function App() { * return ( * * * * ); * } * ``` */ export declare function TamboProvider({ apiKey, tamboUrl, environment, userToken, components, tools, mcpServers, onCallUnregisteredTool, resources, listResources, getResource, contextHelpers, userKey, autoGenerateThreadName, autoGenerateNameThreshold, initialMessages, children, }: PropsWithChildren): React.JSX.Element; //# sourceMappingURL=tambo-v1-provider.d.ts.map