import React, { PropsWithChildren } from "react"; import { AdditionalContext, ContextHelperFn, ContextHelpers } from "../context-helpers/index.js"; export interface TamboContextHelpersProviderProps { /** * A dictionary of context helper functions. * The key becomes the AdditionalContext.name and the function returns the value. * Return null/undefined to skip including that context. */ contextHelpers?: ContextHelpers; } export interface TamboContextHelpersContextProps { /** Get all additional context by running all helper functions */ getAdditionalContext: () => Promise; /** Get the current context helpers map */ getContextHelpers: () => ContextHelpers; /** Add or update a context helper by name */ addContextHelper: (name: string, helper: ContextHelperFn) => void; /** Remove a context helper by name */ removeContextHelper: (name: string) => void; } /** * Provider for managing additional context helpers. * Accepts a map of { key: () => any | null | undefined | Promise }. * Returning null/undefined skips inclusion; returned values are wrapped as { name: key, context: value }. * @param props - The props for the TamboContextHelpersProvider. * @param props.contextHelpers - A dictionary of context helper functions keyed by context name. * @param props.children - The children to render. * @returns The provider that exposes context helper APIs via useTamboContextHelpers. */ export declare const TamboContextHelpersProvider: React.FC>; /** * Hook to access context helpers functionality. * * Behavior without a provider: this hook does NOT throw immediately. If it is * called outside of a `TamboContextHelpersProvider`, it returns a fallback * object whose methods will throw when invoked. This "lazy-throw" pattern is * intentional so the error surfaces at the actual point of use. * @returns The context helpers API when a provider is present; otherwise, a * fallback object whose methods throw if called. */ export declare const useTamboContextHelpers: () => TamboContextHelpersContextProps; //# sourceMappingURL=tambo-context-helpers-provider.d.ts.map