import * as _finalyst_react_core_dist_types_coagent_state from '@finalyst/react-core/dist/types/coagent-state'; import * as _finalyst_react_core_dist_hooks_use_tree from '@finalyst/react-core/dist/hooks/use-tree'; import * as _finalyst_shared from '@finalyst/shared'; import { Message, CopilotErrorHandler, CopilotKitError } from '@finalyst/shared'; import * as _finalyst_react_core_dist_copilot_context_2cccffb7 from '@finalyst/react-core/dist/copilot-context-2cccffb7'; import * as _finalyst_react_core_dist_types_coagent_action from '@finalyst/react-core/dist/types/coagent-action'; import * as _finalyst_react_core from '@finalyst/react-core'; import { SuggestionItem, SystemMessageFunction, HintFunction } from '@finalyst/react-core'; import * as _finalyst_runtime_client_gql from '@finalyst/runtime-client-gql'; import * as react_jsx_runtime from 'react/jsx-runtime'; import { CopilotChatIcons, CopilotChatLabels } from './ChatContext.js'; import React__default from 'react'; import { ComponentsMap, AssistantMessageProps, UserMessageProps, ErrorMessageProps, MessagesProps, RenderMessageProps, RenderSuggestionsListProps, InputProps, ImageRendererProps, CopilotObservabilityHooks } from './props.js'; import '../../types/suggestions.js'; /** * The type of suggestions to use in the chat. * * `auto` - Suggestions are generated automatically. * `manual` - Suggestions are controlled programmatically. * `SuggestionItem[]` - Static suggestions array. */ type ChatSuggestions = "auto" | "manual" | SuggestionItem[]; /** * Props for CopilotChat component. */ interface CopilotChatProps { /** * Custom instructions to be added to the system message. Use this property to * provide additional context or guidance to the language model, influencing * its responses. These instructions can include specific directions, * preferences, or criteria that the model should consider when generating * its output, thereby tailoring the conversation more precisely to the * user's needs or the application's requirements. */ instructions?: string; /** * Controls the behavior of suggestions in the chat interface. * * `auto` (default) - Suggestions are generated automatically: * - When the chat is first opened (empty state) * - After each message exchange completes * - Uses configuration from `useCopilotChatSuggestions` hooks * * `manual` - Suggestions are controlled programmatically: * - Use `setSuggestions()` to set custom suggestions * - Use `generateSuggestions()` to trigger AI generation * - Access via `useCopilotChat` hook * * `SuggestionItem[]` - Static suggestions array: * - Always shows the same suggestions * - No AI generation involved */ suggestions?: ChatSuggestions; /** * A callback that gets called when the in progress state changes. */ onInProgress?: (inProgress: boolean) => void; /** * A callback that gets called when a new message it submitted. */ onSubmitMessage?: (message: string) => void | Promise; /** * A custom stop generation function. */ onStopGeneration?: OnStopGeneration; /** * A custom reload messages function. */ onReloadMessages?: OnReloadMessages; /** * A callback function to regenerate the assistant's response */ onRegenerate?: (messageId: string) => void; /** * A callback function when the message is copied */ onCopy?: (message: string) => void; /** * A callback function for thumbs up feedback */ onThumbsUp?: (message: Message) => void; /** * A callback function for thumbs down feedback */ onThumbsDown?: (message: Message) => void; /** * A list of markdown components to render in assistant message. * Useful when you want to render custom elements in the message (e.g a reference tag element) */ markdownTagRenderers?: ComponentsMap; /** * Icons can be used to set custom icons for the chat window. */ icons?: CopilotChatIcons; /** * Labels can be used to set custom labels for the chat window. */ labels?: CopilotChatLabels; /** * Enable image upload button (image inputs only supported on some models) */ imageUploadsEnabled?: boolean; /** * The 'accept' attribute for the file input used for image uploads. * Defaults to "image/*". */ inputFileAccept?: string; /** * A function that takes in context string and instructions and returns * the system message to include in the chat request. * Use this to completely override the system message, when providing * instructions is not enough. */ makeSystemMessage?: SystemMessageFunction; /** * Disables inclusion of CopilotKit’s default system message. When true, no system message is sent (this also suppresses any custom message from makeSystemMessage). */ disableSystemMessage?: boolean; /** * A custom assistant message component to use instead of the default. */ AssistantMessage?: React__default.ComponentType; /** * A custom user message component to use instead of the default. */ UserMessage?: React__default.ComponentType; /** * A custom error message component to use instead of the default. */ ErrorMessage?: React__default.ComponentType; /** * A custom Messages component to use instead of the default. */ Messages?: React__default.ComponentType; /** * @deprecated - use RenderMessage instead */ RenderTextMessage?: React__default.ComponentType; /** * @deprecated - use RenderMessage instead */ RenderActionExecutionMessage?: React__default.ComponentType; /** * @deprecated - use RenderMessage instead */ RenderAgentStateMessage?: React__default.ComponentType; /** * @deprecated - use RenderMessage instead */ RenderResultMessage?: React__default.ComponentType; /** * @deprecated - use RenderMessage instead */ RenderImageMessage?: React__default.ComponentType; /** * A custom RenderMessage component to use instead of the default. * * **Warning**: This is a break-glass solution to allow for custom * rendering of messages. You are most likely looking to swap out * the AssistantMessage and UserMessage components instead which * are also props. */ RenderMessage?: React__default.ComponentType; /** * A custom suggestions list component to use instead of the default. */ RenderSuggestionsList?: React__default.ComponentType; /** * A custom Input component to use instead of the default. */ Input?: React__default.ComponentType; /** * A custom image rendering component to use instead of the default. */ ImageRenderer?: React__default.ComponentType; /** * A class name to apply to the root element. */ className?: string; /** * Children to render. */ children?: React__default.ReactNode; hideStopButton?: boolean; /** * Event hooks for CopilotKit chat events. * These hooks only work when publicApiKey is provided. */ observabilityHooks?: CopilotObservabilityHooks; /** * Custom error renderer for chat-specific errors. * When provided, errors will be displayed inline within the chat interface. */ renderError?: (error: { message: string; operation?: string; timestamp: number; onDismiss: () => void; onRetry?: () => void; }) => React__default.ReactNode; /** * Optional handler for comprehensive debugging and observability. */ onError?: CopilotErrorHandler; } interface OnStopGenerationArguments { /** * The name of the currently executing agent. */ currentAgentName: string | undefined; /** * The messages in the chat. */ messages: Message[]; /** * Set the messages in the chat. */ setMessages: (messages: Message[]) => void; /** * Stop chat generation. */ stopGeneration: () => void; /** * Restart the currently executing agent. */ restartCurrentAgent: () => void; /** * Stop the currently executing agent. */ stopCurrentAgent: () => void; /** * Run the currently executing agent. */ runCurrentAgent: (hint?: HintFunction) => Promise; /** * Set the state of the currently executing agent. */ setCurrentAgentState: (state: any) => void; } type OnReloadMessagesArguments = OnStopGenerationArguments & { /** * The message on which "regenerate" was pressed */ messageId: string; }; type OnStopGeneration = (args: OnStopGenerationArguments) => void; type OnReloadMessages = (args: OnReloadMessagesArguments) => void; type ImageUpload = { contentType: string; bytes: string; }; declare function CopilotChat({ instructions, suggestions, onSubmitMessage, makeSystemMessage, disableSystemMessage, onInProgress, onStopGeneration, onReloadMessages, onRegenerate, onCopy, onThumbsUp, onThumbsDown, markdownTagRenderers, Messages, RenderMessage, RenderSuggestionsList, Input, className, icons, labels, AssistantMessage, UserMessage, ImageRenderer, ErrorMessage, imageUploadsEnabled, inputFileAccept, hideStopButton, observabilityHooks, renderError, onError, RenderTextMessage, RenderActionExecutionMessage, RenderAgentStateMessage, RenderResultMessage, RenderImageMessage, }: CopilotChatProps): react_jsx_runtime.JSX.Element; declare function WrappedCopilotChat({ children, icons, labels, className, }: { children: React__default.ReactNode; icons?: CopilotChatIcons; labels?: CopilotChatLabels; className?: string; }): react_jsx_runtime.JSX.Element; declare const useCopilotChatLogic: (chatSuggestions: ChatSuggestions, makeSystemMessage?: SystemMessageFunction, disableSystemMessage?: boolean, onInProgress?: (isLoading: boolean) => void, onSubmitMessage?: (messageContent: string) => Promise | void, onStopGeneration?: OnStopGeneration, onReloadMessages?: OnReloadMessages) => { messages: Message[]; isLoading: boolean; suggestions: SuggestionItem[]; sendMessage: (messageContent: string, imagesToUse?: Array<{ contentType: string; bytes: string; }>) => Promise; stopGeneration: () => void; reloadMessages: (messageId: string) => void; resetSuggestions: () => void; context: { messages: _finalyst_runtime_client_gql.Message[]; setMessages: React__default.Dispatch>; suggestions: SuggestionItem[]; setSuggestions: React__default.Dispatch>; actions: Record>; setAction: (id: string, action: _finalyst_react_core.FrontendAction) => void; removeAction: (id: string) => void; coAgentStateRenders: Record>; setCoAgentStateRender: (id: string, stateRender: _finalyst_react_core_dist_types_coagent_action.CoAgentStateRender) => void; removeCoAgentStateRender: (id: string) => void; chatComponentsCache: React__default.RefObject<_finalyst_react_core_dist_copilot_context_2cccffb7.j>; getFunctionCallHandler: (customEntryPoints?: Record>) => _finalyst_shared.FunctionCallHandler; addContext: (context: string, parentId?: string, categories?: string[]) => _finalyst_react_core_dist_hooks_use_tree.TreeNodeId; removeContext: (id: _finalyst_react_core_dist_hooks_use_tree.TreeNodeId) => void; getAllContext: () => _finalyst_react_core.Tree; getContextString: (documents: _finalyst_react_core.DocumentPointer[], categories: string[]) => string; addDocumentContext: (documentPointer: _finalyst_react_core.DocumentPointer, categories?: string[]) => _finalyst_react_core_dist_hooks_use_tree.TreeNodeId; removeDocumentContext: (documentId: string) => void; getDocumentsContext: (categories: string[]) => _finalyst_react_core.DocumentPointer[]; isLoading: boolean; setIsLoading: React__default.Dispatch>; chatSuggestionConfiguration: { [key: string]: _finalyst_react_core.CopilotChatSuggestionConfiguration; }; addChatSuggestionConfiguration: (id: string, suggestion: _finalyst_react_core.CopilotChatSuggestionConfiguration) => void; removeChatSuggestionConfiguration: (id: string) => void; chatInstructions: string; setChatInstructions: React__default.Dispatch>; additionalInstructions?: string[]; setAdditionalInstructions: React__default.Dispatch>; copilotApiConfig: _finalyst_react_core.CopilotApiConfig; showDevConsole: boolean; coagentStates: Record; setCoagentStates: React__default.Dispatch>>; coagentStatesRef: React__default.RefObject>; setCoagentStatesWithRef: (value: Record | ((prev: Record) => Record)) => void; agentSession: _finalyst_react_core_dist_copilot_context_2cccffb7.A | null; setAgentSession: React__default.Dispatch>; agentLock: string | null; threadId: string; setThreadId: React__default.Dispatch>; runId: string | null; setRunId: React__default.Dispatch>; chatAbortControllerRef: React__default.MutableRefObject; runtimeClient: _finalyst_runtime_client_gql.CopilotRuntimeClient; forwardedParameters?: Partial>; availableAgents: _finalyst_runtime_client_gql.Agent[]; authStates_c?: Record<_finalyst_react_core_dist_copilot_context_2cccffb7.k, _finalyst_react_core_dist_copilot_context_2cccffb7.f>; setAuthStates_c?: React__default.Dispatch>>; authConfig_c?: { SignInComponent: React__default.ComponentType<{ onSignInComplete: (authState: _finalyst_react_core_dist_copilot_context_2cccffb7.f) => void; }>; }; extensions: _finalyst_runtime_client_gql.ExtensionsInput; setExtensions: React__default.Dispatch>; langGraphInterruptAction: _finalyst_react_core_dist_copilot_context_2cccffb7.L | null; setLangGraphInterruptAction: _finalyst_react_core_dist_copilot_context_2cccffb7.d; removeLangGraphInterruptAction: (threadId: string) => void; onError: CopilotErrorHandler; bannerError: CopilotKitError | null; setBannerError: React__default.Dispatch>; internalErrorHandlers: Record; setInternalErrorHandler: (handler: Record) => void; removeInternalErrorHandler: (id: string) => void; }; actions: Record>; }; export { ChatSuggestions, CopilotChat, CopilotChatProps, ImageUpload, OnReloadMessages, OnReloadMessagesArguments, OnStopGeneration, WrappedCopilotChat, useCopilotChatLogic };