import { AiCloudConfig, FunctionCallHandler, AiErrorHandler, AiSDKError } from '@vn-sdk/shared'; import { ActionRenderProps, CatchAllActionRenderProps, FrontendAction } from './types/frontend-action.js'; import React$1 from 'react'; import { Tree, TreeNodeId } from './hooks/use-tree.js'; import { DocumentPointer } from './types/document-pointer.js'; import { AiChatSuggestionConfiguration } from './types/chat-suggestion-configuration.js'; import { AiAgentStateRenderProps, AiAgentStateRender } from './types/ai-agent-action.js'; import { AiAgentState } from './types/ai-agent-state.js'; import { LangGraphInterruptEvent, AiRuntimeClient, ForwardedParametersInput, Agent, ExtensionsInput } from '@vn-sdk/runtime-client-gql'; interface LangGraphInterruptRenderHandlerProps { event: LangGraphInterruptEvent; resolve: (resolution: string) => void; } interface LangGraphInterruptRenderProps { result: unknown; event: LangGraphInterruptEvent; resolve: (resolution: string) => void; } interface LangGraphInterruptRender { id: string; /** * The handler function to handle the event. */ handler?: (props: LangGraphInterruptRenderHandlerProps) => any | Promise; /** * The render function to handle the event. */ render?: (props: LangGraphInterruptRenderProps) => string | React.ReactElement; /** * Method that returns a boolean, indicating if the interrupt action should run * Useful when using multiple interrupts */ enabled?: (args: { eventValue: TEventValue; agentMetadata: AgentSession; }) => boolean; } type LangGraphInterruptAction = LangGraphInterruptRender & { event?: LangGraphInterruptEvent; }; type LangGraphInterruptActionSetterArgs = (Partial & { event?: Partial; }) | null; type LangGraphInterruptActionSetter = (threadId: string, action: LangGraphInterruptActionSetterArgs) => void; /** * Interface for the configuration of the AI API. */ interface AiApiConfig { /** * The public API key for VN Cloud. */ publicApiKey?: string; /** * The configuration for VN Cloud. */ cloud?: AiCloudConfig; /** * The endpoint for the chat API. */ chatApiEndpoint: string; /** * The endpoint for the AI transcribe audio service. */ transcribeAudioUrl?: string; /** * The endpoint for the AI text to speech service. */ textToSpeechUrl?: string; /** * additional headers to be sent with the request * @default {} * @example * ``` * { * 'Authorization': 'Bearer your_token_here' * } * ``` */ headers: Record; /** * Custom properties to be sent with the request * @default {} * @example * ``` * { * 'user_id': 'user_id' * } * ``` */ properties?: Record; /** * Indicates whether the user agent should send or receive cookies from the other domain * in the case of cross-origin requests. */ credentials?: RequestCredentials; /** * Optional configuration for connecting to Model Context Protocol (MCP) servers. * This is typically derived from the AiProps and used internally. * @experimental */ mcpServers?: Array<{ endpoint: string; apiKey?: string; }>; } type InChatRenderFunction | CatchAllActionRenderProps> = (props: TProps) => string | JSX.Element; type AiAgentInChatRenderFunction = (props: AiAgentStateRenderProps) => string | JSX.Element | undefined | null; interface ChatComponentsCache { actions: Record; aiAgentStateRenders: Record; } interface AgentSession { agentName: string; threadId?: string; nodeName?: string; } interface AuthState { status: "authenticated" | "unauthenticated"; authHeaders: Record; userId?: string; metadata?: Record; } type ActionName = string; type ContextTree = Tree; interface AiContextParams { actions: Record>; setAction: (id: string, action: FrontendAction) => void; removeAction: (id: string) => void; aiAgentStateRenders: Record>; setAiAgentStateRender: (id: string, stateRender: AiAgentStateRender) => void; removeAiAgentStateRender: (id: string) => void; chatComponentsCache: React$1.RefObject; getFunctionCallHandler: (customEntryPoints?: Record>) => FunctionCallHandler; addContext: (context: string, parentId?: string, categories?: string[]) => TreeNodeId; removeContext: (id: TreeNodeId) => void; getAllContext: () => Tree; getContextString: (documents: DocumentPointer[], categories: string[]) => string; addDocumentContext: (documentPointer: DocumentPointer, categories?: string[]) => TreeNodeId; removeDocumentContext: (documentId: string) => void; getDocumentsContext: (categories: string[]) => DocumentPointer[]; isLoading: boolean; setIsLoading: React$1.Dispatch>; chatSuggestionConfiguration: { [key: string]: AiChatSuggestionConfiguration; }; addChatSuggestionConfiguration: (id: string, suggestion: AiChatSuggestionConfiguration) => void; removeChatSuggestionConfiguration: (id: string) => void; chatInstructions: string; setChatInstructions: React$1.Dispatch>; additionalInstructions?: string[]; setAdditionalInstructions: React$1.Dispatch>; aiApiConfig: AiApiConfig; showDevConsole: boolean; aiAgentStates: Record; setAiAgentStates: React$1.Dispatch>>; aiAgentStatesRef: React$1.RefObject>; setAiAgentStatesWithRef: (value: Record | ((prev: Record) => Record)) => void; agentSession: AgentSession | null; setAgentSession: React$1.Dispatch>; agentLock: string | null; threadId: string; setThreadId: React$1.Dispatch>; runId: string | null; setRunId: React$1.Dispatch>; chatAbortControllerRef: React$1.MutableRefObject; runtimeClient: AiRuntimeClient; /** * The forwarded parameters to use for the task. */ forwardedParameters?: Partial>; availableAgents: Agent[]; /** * The auth states for the VN SDK. */ authStates_c?: Record; setAuthStates_c?: React$1.Dispatch>>; /** * The auth config for the VN SDK. */ authConfig_c?: { SignInComponent: React$1.ComponentType<{ onSignInComplete: (authState: AuthState) => void; }>; }; extensions: ExtensionsInput; setExtensions: React$1.Dispatch>; langGraphInterruptAction: LangGraphInterruptAction | null; setLangGraphInterruptAction: LangGraphInterruptActionSetter; removeLangGraphInterruptAction: (threadId: string) => void; /** * Optional trace handler for comprehensive debugging and observability. */ onError: AiErrorHandler; bannerError: AiSDKError | null; setBannerError: React$1.Dispatch>; internalErrorHandlers: Record; setInternalErrorHandler: (handler: Record) => void; removeInternalErrorHandler: (id: string) => void; } declare const AiContext: React$1.Context; declare function useAiContext(): AiContextParams; export { AiContext as A, ChatComponentsCache as C, InChatRenderFunction as I, LangGraphInterruptAction as L, AiContextParams as a, AiAgentInChatRenderFunction as b, AiApiConfig as c, AgentSession as d, LangGraphInterruptActionSetter as e, LangGraphInterruptRender as f, AuthState as g, LangGraphInterruptRenderHandlerProps as h, LangGraphInterruptRenderProps as i, LangGraphInterruptActionSetterArgs as j, ActionName as k, ContextTree as l, useAiContext as u };