@copilotkit/react-core
Version:
<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />
1,379 lines (1,378 loc) • 95.7 kB
text/typescript
import * as react from "react";
import React$1, { ComponentType, ReactNode } from "react";
import { CopilotKitCore, CopilotKitCoreConfig, CopilotKitCoreErrorCode, CopilotKitCoreSubscriber, CopilotKitCoreSubscription, DynamicSuggestionsConfig, FrontendTool, StaticSuggestionsConfig, Suggestion, ToolCallStatus } from "@copilotkit/core";
import { AbstractAgent } from "@ag-ui/client";
import { Action, Attachment, Attachment as Attachment$1, AttachmentModality, AttachmentsConfig, AttachmentsConfig as AttachmentsConfig$1, CopilotCloudConfig, CopilotErrorHandler, CopilotKitError, DebugConfig, FunctionCallHandler, InferSchemaOutput, InputContentSource, MappedParameterTypes, Parameter, StandardSchemaV1 } from "@copilotkit/shared";
import * as react_jsx_runtime0 from "react/jsx-runtime";
import { Streamdown } from "streamdown";
import { z } from "zod";
import { Theme } from "@copilotkit/a2ui-renderer";
import { ActionInputAvailability, Agent, ExtensionsInput, ForwardedParametersInput, LangGraphInterruptEvent } from "@copilotkit/runtime-client-gql";
import { Anchor, Anchor as InspectorAnchor } from "@copilotkit/web-inspector";
import { ActivityMessage, AgentCapabilities, AssistantMessage, Message as Message$2, ReasoningMessage, ToolCall, ToolMessage, UserMessage } from "@ag-ui/core";
//#region src/types/frontend-action.d.ts
interface InProgressState<T extends Parameter[] | [] = []> {
status: "inProgress";
args: Partial<MappedParameterTypes<T>>;
result: undefined;
}
interface ExecutingState<T extends Parameter[] | [] = []> {
status: "executing";
args: MappedParameterTypes<T>;
result: undefined;
}
interface CompleteState<T extends Parameter[] | [] = []> {
status: "complete";
args: MappedParameterTypes<T>;
result: any;
}
interface InProgressStateNoArgs<T extends Parameter[] | [] = []> {
status: "inProgress";
args: Partial<MappedParameterTypes<T>>;
result: undefined;
}
interface ExecutingStateNoArgs<T extends Parameter[] | [] = []> {
status: "executing";
args: MappedParameterTypes<T>;
result: undefined;
}
interface CompleteStateNoArgs<T extends Parameter[] | [] = []> {
status: "complete";
args: MappedParameterTypes<T>;
result: any;
}
interface InProgressStateWait<T extends Parameter[] | [] = []> {
status: "inProgress";
args: Partial<MappedParameterTypes<T>>;
/** @deprecated use respond instead */
handler: undefined;
respond: undefined;
result: undefined;
}
interface ExecutingStateWait<T extends Parameter[] | [] = []> {
status: "executing";
args: MappedParameterTypes<T>;
/** @deprecated use respond instead */
handler: (result: any) => void;
respond: (result: any) => void;
result: undefined;
}
interface CompleteStateWait<T extends Parameter[] | [] = []> {
status: "complete";
args: MappedParameterTypes<T>;
/** @deprecated use respond instead */
handler: undefined;
respond: undefined;
result: any;
}
interface InProgressStateNoArgsWait<T extends Parameter[] | [] = []> {
status: "inProgress";
args: Partial<MappedParameterTypes<T>>;
/** @deprecated use respond instead */
handler: undefined;
respond: undefined;
result: undefined;
}
interface ExecutingStateNoArgsWait<T extends Parameter[] | [] = []> {
status: "executing";
args: MappedParameterTypes<T>;
/** @deprecated use respond instead */
handler: (result: any) => void;
respond: (result: any) => void;
result: undefined;
}
interface CompleteStateNoArgsWait<T extends Parameter[] | [] = []> {
status: "complete";
args: MappedParameterTypes<T>;
/** @deprecated use respond instead */
handler: undefined;
respond: undefined;
}
type ActionRenderProps<T extends Parameter[] | [] = []> = CompleteState<T> | ExecutingState<T> | InProgressState<T>;
type ActionRenderPropsNoArgs<T extends Parameter[] | [] = []> = CompleteStateNoArgs<T> | ExecutingStateNoArgs<T> | InProgressStateNoArgs<T>;
type ActionRenderPropsWait<T extends Parameter[] | [] = []> = CompleteStateWait<T> | ExecutingStateWait<T> | InProgressStateWait<T>;
type ActionRenderPropsNoArgsWait<T extends Parameter[] | [] = []> = CompleteStateNoArgsWait<T> | ExecutingStateNoArgsWait<T> | InProgressStateNoArgsWait<T>;
type CatchAllActionRenderProps<T extends Parameter[] | [] = []> = (CompleteState<T> & {
name: string;
}) | (ExecutingState<T> & {
name: string;
}) | (InProgressState<T> & {
name: string;
});
type FrontendActionAvailability = "disabled" | "enabled" | "remote" | "frontend";
type FrontendAction<T extends Parameter[] | [] = [], N extends string = string> = Action<T> & {
name: Exclude<N, "*">;
/**
* @deprecated Use `available` instead.
*/
disabled?: boolean;
available?: FrontendActionAvailability;
pairedAction?: string;
followUp?: boolean;
} & ({
render?: string | (T extends [] ? (props: ActionRenderPropsNoArgs<T>) => string | React$1.ReactElement : (props: ActionRenderProps<T>) => string | React$1.ReactElement); /** @deprecated use renderAndWaitForResponse instead */
renderAndWait?: never;
renderAndWaitForResponse?: never;
} | {
render?: never; /** @deprecated use renderAndWaitForResponse instead */
renderAndWait?: T extends [] ? (props: ActionRenderPropsNoArgsWait<T>) => React$1.ReactElement : (props: ActionRenderPropsWait<T>) => React$1.ReactElement;
renderAndWaitForResponse?: T extends [] ? (props: ActionRenderPropsNoArgsWait<T>) => React$1.ReactElement : (props: ActionRenderPropsWait<T>) => React$1.ReactElement;
handler?: never;
});
type CatchAllFrontendAction = {
name: "*";
render: (props: CatchAllActionRenderProps<any>) => React$1.ReactElement;
};
type RenderFunctionStatus = ActionRenderProps<any>["status"];
//#endregion
//#region src/hooks/use-tree.d.ts
type TreeNodeId = string;
interface TreeNode {
id: TreeNodeId;
value: string;
children: TreeNode[];
parentId?: TreeNodeId;
categories: Set<string>;
}
type Tree = TreeNode[];
//#endregion
//#region src/types/document-pointer.d.ts
interface DocumentPointer {
id: string;
name: string;
sourceApplication: string;
iconImageUri: string;
getContents: () => string;
}
//#endregion
//#region src/types/system-message.d.ts
type SystemMessageFunction = (contextString: string, additionalInstructions?: string) => string;
//#endregion
//#region src/types/chat-suggestion-configuration.d.ts
interface CopilotChatSuggestionConfiguration {
/**
* A prompt or instructions for the GPT to generate suggestions.
*/
instructions: string;
/**
* The minimum number of suggestions to generate. Defaults to `1`.
* @default 1
*/
minSuggestions?: number;
/**
* The maximum number of suggestions to generate. Defaults to `3`.
* @default 1
*/
maxSuggestions?: number;
/**
* An optional class name to apply to the suggestions.
*/
className?: string;
}
//#endregion
//#region src/types/crew.d.ts
/**
* Status of a response or action that requires user input
*/
type CrewsResponseStatus = "inProgress" | "complete" | "executing";
/**
* Response data structure for the ResponseRenderer
*/
interface CrewsResponse {
/**
* Unique identifier for the response
*/
id: string;
/**
* The content of the response to display
*/
content: string;
/**
* Optional metadata for the response
*/
metadata?: Record<string, any>;
}
/**
* Base state item interface for agent state items
*/
interface CrewsStateItem {
/**
* Unique identifier for the item
*/
id: string;
/**
* Timestamp when the item was created
*/
timestamp: string;
}
/**
* Tool execution state item
*/
interface CrewsToolStateItem extends CrewsStateItem {
/**
* Name of the tool that was executed
*/
tool: string;
/**
* Optional thought process for the tool execution
*/
thought?: string;
/**
* Result of the tool execution
*/
result?: any;
}
/**
* Task state item
*/
interface CrewsTaskStateItem extends CrewsStateItem {
/**
* Name of the task
*/
name: string;
/**
* Description of the task
*/
description?: string;
}
/**
* AgentState containing information about steps and tasks
*/
interface CrewsAgentState {
/**
* Array of tool execution steps
*/
steps?: CrewsToolStateItem[];
/**
* Array of tasks
*/
tasks?: CrewsTaskStateItem[];
}
//#endregion
//#region src/types/interrupt-action.d.ts
interface LangGraphInterruptRenderHandlerProps<TEventValue = any> {
event: LangGraphInterruptEvent<TEventValue>;
resolve: (resolution: string) => void;
}
interface LangGraphInterruptRenderProps<TEventValue = any> {
result: unknown;
event: LangGraphInterruptEvent<TEventValue>;
resolve: (resolution: string) => void;
}
interface LangGraphInterruptRender<TEventValue = any> {
id: string;
/**
* The handler function to handle the event.
*/
handler?: (props: LangGraphInterruptRenderHandlerProps<TEventValue>) => any | Promise<any>;
/**
* The render function to handle the event.
*/
render?: (props: LangGraphInterruptRenderProps<TEventValue>) => 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;
/**
* Optional agent ID to scope this interrupt to a specific agent.
* Defaults to the agent configured in the CopilotKit chat configuration.
*/
agentId?: string;
}
type LangGraphInterruptAction = LangGraphInterruptRender & {
event?: LangGraphInterruptEvent;
};
type LangGraphInterruptActionSetterArgs = Partial<LangGraphInterruptRender> | null;
type LangGraphInterruptActionSetter = (action: LangGraphInterruptActionSetterArgs) => void;
interface QueuedInterruptEvent {
eventId: string;
threadId: string;
event: LangGraphInterruptEvent;
}
//#endregion
//#region src/types/coagent-action.d.ts
type CoAgentStateRenderProps<T> = {
state: T;
nodeName: string;
status: "inProgress" | "complete";
};
type CoAgentStateRenderHandlerArguments<T> = {
nodeName: string;
state: T;
};
interface CoAgentStateRender<T = any> {
/**
* The name of the coagent.
*/
name: string;
/**
* The node name of the coagent.
*/
nodeName?: string;
/**
* The handler function to handle the state of the agent.
*/
handler?: (props: CoAgentStateRenderHandlerArguments<T>) => void | Promise<void>;
/**
* The render function to handle the state of the agent.
*/
render?: ((props: CoAgentStateRenderProps<T>) => string | React.ReactElement | undefined | null) | string;
}
//#endregion
//#region src/types/coagent-state.d.ts
interface CoagentState {
name: string;
state: any;
running: boolean;
active: boolean;
threadId?: string;
config?: {
configurable?: Record<string, any>;
[key: string]: any;
};
nodeName?: string;
runId?: string;
}
//#endregion
//#region src/context/copilot-context.d.ts
/**
* Interface for the configuration of the Copilot API.
*/
interface CopilotApiConfig {
/**
* The public API key for Copilot Cloud.
*/
publicApiKey?: string;
/**
* The configuration for Copilot Cloud.
*/
cloud?: CopilotCloudConfig;
/**
* The endpoint for the chat API.
*/
chatApiEndpoint: string;
/**
* The endpoint for the Copilot transcribe audio service.
*/
transcribeAudioUrl?: string;
/**
* The endpoint for the Copilot text to speech service.
*/
textToSpeechUrl?: string;
/**
* additional headers to be sent with the request
* @default {}
* @example
* ```
* {
* 'Authorization': 'Bearer your_token_here'
* }
* ```
*/
headers: Record<string, string>;
/**
* Custom properties to be sent with the request
* @default {}
* @example
* ```
* {
* 'user_id': 'user_id'
* }
* ```
*/
properties?: Record<string, any>;
/**
* 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 CopilotKitProps and used internally.
* @experimental
*/
mcpServers?: Array<{
endpoint: string;
apiKey?: string;
}>;
}
type InChatRenderFunction<TProps = ActionRenderProps<any> | CatchAllActionRenderProps<any>> = (props: TProps) => string | React$1.JSX.Element;
type CoagentInChatRenderFunction = (props: CoAgentStateRenderProps<any>) => string | React$1.JSX.Element | undefined | null;
interface ChatComponentsCache {
actions: Record<string, InChatRenderFunction | string>;
coAgentStateRenders: Record<string, CoagentInChatRenderFunction | string>;
}
interface AgentSession {
agentName: string;
threadId?: string;
nodeName?: string;
}
interface AuthState {
status: "authenticated" | "unauthenticated";
authHeaders: Record<string, string>;
userId?: string;
metadata?: Record<string, any>;
}
type ActionName = string;
interface CopilotContextParams {
actions: Record<string, FrontendAction<any>>;
setAction: (id: string, action: FrontendAction<any>) => void;
removeAction: (id: string) => void;
setRegisteredActions: (actionConfig: any) => string;
removeRegisteredAction: (actionKey: string) => void;
chatComponentsCache: React$1.RefObject<ChatComponentsCache>;
getFunctionCallHandler: (customEntryPoints?: Record<string, FrontendAction<any>>) => 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<React$1.SetStateAction<boolean>>;
chatSuggestionConfiguration: {
[key: string]: CopilotChatSuggestionConfiguration;
};
addChatSuggestionConfiguration: (id: string, suggestion: CopilotChatSuggestionConfiguration) => void;
removeChatSuggestionConfiguration: (id: string) => void;
chatInstructions: string;
setChatInstructions: React$1.Dispatch<React$1.SetStateAction<string>>;
additionalInstructions?: string[];
setAdditionalInstructions: React$1.Dispatch<React$1.SetStateAction<string[]>>;
copilotApiConfig: CopilotApiConfig;
showDevConsole: boolean;
coagentStates: Record<string, CoagentState>;
setCoagentStates: React$1.Dispatch<React$1.SetStateAction<Record<string, CoagentState>>>;
coagentStatesRef: React$1.RefObject<Record<string, CoagentState>>;
setCoagentStatesWithRef: (value: Record<string, CoagentState> | ((prev: Record<string, CoagentState>) => Record<string, CoagentState>)) => void;
agentSession: AgentSession | null;
setAgentSession: React$1.Dispatch<React$1.SetStateAction<AgentSession | null>>;
agentLock: string | null;
threadId: string;
setThreadId: React$1.Dispatch<React$1.SetStateAction<string>>;
runId: string | null;
setRunId: React$1.Dispatch<React$1.SetStateAction<string | null>>;
chatAbortControllerRef: React$1.MutableRefObject<AbortController | null>;
/**
* The forwarded parameters to use for the task.
*/
forwardedParameters?: Partial<Pick<ForwardedParametersInput, "temperature">>;
availableAgents: Agent[];
/**
* The auth states for the CopilotKit.
*/
authStates_c?: Record<ActionName, AuthState>;
setAuthStates_c?: React$1.Dispatch<React$1.SetStateAction<Record<ActionName, AuthState>>>;
/**
* The auth config for the CopilotKit.
*/
authConfig_c?: {
SignInComponent: React$1.ComponentType<{
onSignInComplete: (authState: AuthState) => void;
}>;
};
extensions: ExtensionsInput;
setExtensions: React$1.Dispatch<React$1.SetStateAction<ExtensionsInput>>;
interruptActions: Record<string, LangGraphInterruptRender>;
setInterruptAction: LangGraphInterruptActionSetter;
removeInterruptAction: (actionId: string) => void;
interruptEventQueue: Record<string, QueuedInterruptEvent[]>;
addInterruptEvent: (queuedEvent: QueuedInterruptEvent) => void;
resolveInterruptEvent: (threadId: string, eventId: string, response: string) => void;
/**
* Optional trace handler for comprehensive debugging and observability.
*/
onError: CopilotErrorHandler;
bannerError: CopilotKitError | null;
setBannerError: React$1.Dispatch<React$1.SetStateAction<CopilotKitError | null>>;
internalErrorHandlers: Record<string, CopilotErrorHandler>;
setInternalErrorHandler: (handler: Record<string, CopilotErrorHandler>) => void;
removeInternalErrorHandler: (id: string) => void;
}
declare const CopilotContext: React$1.Context<CopilotContextParams>;
declare function useCopilotContext(): CopilotContextParams;
//#endregion
//#region src/v2/components/chat/CopilotChatAudioRecorder.d.ts
/** Finite-state machine for every recorder implementation */
type AudioRecorderState = "idle" | "recording" | "processing";
/** Error subclass so callers can `instanceof`-guard recorder failures */
declare class AudioRecorderError extends Error {
constructor(message: string);
}
interface AudioRecorderRef {
state: AudioRecorderState;
start: () => Promise<void>;
stop: () => Promise<Blob>;
dispose: () => void;
}
declare const CopilotChatAudioRecorder: react.ForwardRefExoticComponent<react.HTMLAttributes<HTMLDivElement> & react.RefAttributes<AudioRecorderRef>>;
//#endregion
//#region src/v2/providers/CopilotChatConfigurationProvider.d.ts
declare const CopilotChatDefaultLabels: {
chatInputPlaceholder: string;
chatInputToolbarStartTranscribeButtonLabel: string;
chatInputToolbarCancelTranscribeButtonLabel: string;
chatInputToolbarFinishTranscribeButtonLabel: string;
chatInputToolbarAddButtonLabel: string;
chatInputToolbarToolsButtonLabel: string;
assistantMessageToolbarCopyCodeLabel: string;
assistantMessageToolbarCopyCodeCopiedLabel: string;
assistantMessageToolbarCopyMessageLabel: string;
assistantMessageToolbarThumbsUpLabel: string;
assistantMessageToolbarThumbsDownLabel: string;
assistantMessageToolbarReadAloudLabel: string;
assistantMessageToolbarRegenerateLabel: string;
userMessageToolbarCopyMessageLabel: string;
userMessageToolbarEditMessageLabel: string;
chatDisclaimerText: string;
chatToggleOpenLabel: string;
chatToggleCloseLabel: string;
modalHeaderTitle: string;
welcomeMessageText: string;
};
type CopilotChatLabels = typeof CopilotChatDefaultLabels;
interface CopilotChatConfigurationValue {
labels: CopilotChatLabels;
agentId: string;
threadId: string;
isModalOpen: boolean;
setModalOpen: (open: boolean) => void;
hasExplicitThreadId: boolean;
}
interface CopilotChatConfigurationProviderProps {
children: ReactNode;
labels?: Partial<CopilotChatLabels>;
agentId?: string;
threadId?: string;
hasExplicitThreadId?: boolean;
isModalDefaultOpen?: boolean;
}
declare const CopilotChatConfigurationProvider: React$1.FC<CopilotChatConfigurationProviderProps>;
declare const useCopilotChatConfiguration: () => CopilotChatConfigurationValue | null;
//#endregion
//#region src/v2/lib/slots.d.ts
/** Existing union (unchanged) */
type SlotValue<C extends React$1.ComponentType<any>> = C | string | Partial<React$1.ComponentProps<C>>;
/** Utility: concrete React elements for every slot */
type SlotElements<S> = { [K in keyof S]: React$1.ReactElement };
type WithSlots<S extends Record<string, React$1.ComponentType<any>>, Rest = {}> = { [K in keyof S]?: SlotValue<S[K]> } & {
children?: (props: SlotElements<S> & Rest) => React$1.ReactNode;
} & Omit<Rest, "children">;
//#endregion
//#region src/v2/components/chat/CopilotChatInput.d.ts
type CopilotChatInputMode = "input" | "transcribe" | "processing";
type ToolsMenuItem = {
label: string;
} & ({
action: () => void;
items?: never;
} | {
action?: never;
items: (ToolsMenuItem | "-")[];
});
type CopilotChatInputSlots = {
textArea: typeof CopilotChatInput.TextArea;
sendButton: typeof CopilotChatInput.SendButton;
startTranscribeButton: typeof CopilotChatInput.StartTranscribeButton;
cancelTranscribeButton: typeof CopilotChatInput.CancelTranscribeButton;
finishTranscribeButton: typeof CopilotChatInput.FinishTranscribeButton;
addMenuButton: typeof CopilotChatInput.AddMenuButton;
audioRecorder: typeof CopilotChatAudioRecorder;
disclaimer: typeof CopilotChatInput.Disclaimer;
};
type CopilotChatInputRestProps = {
mode?: CopilotChatInputMode;
toolsMenu?: (ToolsMenuItem | "-")[];
autoFocus?: boolean;
onSubmitMessage?: (value: string) => void;
onStop?: () => void;
isRunning?: boolean;
onStartTranscribe?: () => void;
onCancelTranscribe?: () => void;
onFinishTranscribe?: () => void;
onFinishTranscribeWithAudio?: (audioBlob: Blob) => Promise<void>;
onAddFile?: () => void;
value?: string;
onChange?: (value: string) => void; /** Positioning mode for the input container. Default: 'static' */
positioning?: "static" | "absolute"; /** Keyboard height in pixels for mobile keyboard handling */
keyboardHeight?: number; /** Ref for the outer positioning container */
containerRef?: React$1.Ref<HTMLDivElement>; /** Whether to show the disclaimer. Default: true for absolute positioning, false for static */
showDisclaimer?: boolean;
/**
* Set to `true` when the input sits at the bottom of its container as a
* flex-last-child (visible position is driven by layout, not CSS
* positioning). Triggers reservation of bottom space for the fixed
* CopilotKit license banner via the
* `--copilotkit-license-banner-offset` CSS var so the two don't overlap.
*
* Not needed when `positioning === "absolute"`; that mode already pins the
* input to the bottom and picks up the same reservation automatically.
* Leave unset (default `false`) for inputs rendered mid-layout such as the
* welcome screen, where the banner offset would push the input off-center.
*/
bottomAnchored?: boolean;
} & Omit<React$1.HTMLAttributes<HTMLDivElement>, "onChange">;
type CopilotChatInputBaseProps = WithSlots<CopilotChatInputSlots, CopilotChatInputRestProps>;
type CopilotChatInputChildrenArgs = CopilotChatInputBaseProps extends {
children?: infer C;
} ? C extends ((props: infer P) => React$1.ReactNode) ? P : never : never;
type CopilotChatInputProps = Omit<CopilotChatInputBaseProps, "children"> & {
children?: (props: CopilotChatInputChildrenArgs) => React$1.ReactNode;
};
declare function CopilotChatInput({
mode,
onSubmitMessage,
onStop,
isRunning,
onStartTranscribe,
onCancelTranscribe,
onFinishTranscribe,
onFinishTranscribeWithAudio,
onAddFile,
onChange,
value,
toolsMenu,
autoFocus,
positioning,
keyboardHeight,
containerRef,
showDisclaimer,
bottomAnchored,
textArea,
sendButton,
startTranscribeButton,
cancelTranscribeButton,
finishTranscribeButton,
addMenuButton,
audioRecorder,
disclaimer,
children,
className,
...props
}: CopilotChatInputProps): react_jsx_runtime0.JSX.Element;
declare namespace CopilotChatInput {
const SendButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
const ToolbarButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement> & {
icon: React$1.ReactNode;
labelKey: keyof CopilotChatLabels;
defaultClassName?: string;
}>;
const StartTranscribeButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
const CancelTranscribeButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
const FinishTranscribeButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
const AddMenuButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement> & {
toolsMenu?: (ToolsMenuItem | "-")[];
onAddFile?: () => void;
}>;
type TextAreaProps = React$1.TextareaHTMLAttributes<HTMLTextAreaElement>;
const TextArea: React$1.ForwardRefExoticComponent<TextAreaProps & React$1.RefAttributes<HTMLTextAreaElement>>;
const AudioRecorder: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<AudioRecorderRef>>;
const Disclaimer: React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>;
}
//#endregion
//#region src/v2/components/chat/CopilotChatToolCallsView.d.ts
type CopilotChatToolCallsViewProps = {
message: AssistantMessage;
messages?: Message$2[];
};
declare function CopilotChatToolCallsView({
message,
messages
}: CopilotChatToolCallsViewProps): react_jsx_runtime0.JSX.Element | null;
//#endregion
//#region src/v2/components/chat/CopilotChatAssistantMessage.d.ts
type CopilotChatAssistantMessageProps = WithSlots<{
markdownRenderer: typeof CopilotChatAssistantMessage.MarkdownRenderer;
toolbar: typeof CopilotChatAssistantMessage.Toolbar;
copyButton: typeof CopilotChatAssistantMessage.CopyButton;
thumbsUpButton: typeof CopilotChatAssistantMessage.ThumbsUpButton;
thumbsDownButton: typeof CopilotChatAssistantMessage.ThumbsDownButton;
readAloudButton: typeof CopilotChatAssistantMessage.ReadAloudButton;
regenerateButton: typeof CopilotChatAssistantMessage.RegenerateButton;
toolCallsView: typeof CopilotChatToolCallsView;
}, {
onThumbsUp?: (message: AssistantMessage) => void;
onThumbsDown?: (message: AssistantMessage) => void;
onReadAloud?: (message: AssistantMessage) => void;
onRegenerate?: (message: AssistantMessage) => void;
message: AssistantMessage;
messages?: Message$2[];
isRunning?: boolean;
additionalToolbarItems?: React.ReactNode;
toolbarVisible?: boolean;
} & React.HTMLAttributes<HTMLDivElement>>;
declare function CopilotChatAssistantMessage({
message,
messages,
isRunning,
onThumbsUp,
onThumbsDown,
onReadAloud,
onRegenerate,
additionalToolbarItems,
toolbarVisible,
markdownRenderer,
toolbar,
copyButton,
thumbsUpButton,
thumbsDownButton,
readAloudButton,
regenerateButton,
toolCallsView,
children,
className,
...props
}: CopilotChatAssistantMessageProps): react_jsx_runtime0.JSX.Element;
declare namespace CopilotChatAssistantMessage {
const MarkdownRenderer: React.FC<Omit<React.ComponentProps<typeof Streamdown>, "children"> & {
content: string;
}>;
const Toolbar: React.FC<React.HTMLAttributes<HTMLDivElement>>;
const ToolbarButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & {
title: string;
children: React.ReactNode;
}>;
const CopyButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
const ThumbsUpButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
const ThumbsDownButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
const ReadAloudButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
const RegenerateButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
}
//#endregion
//#region src/v2/components/chat/CopilotChatUserMessage.d.ts
interface CopilotChatUserMessageOnEditMessageProps {
message: UserMessage;
}
interface CopilotChatUserMessageOnSwitchToBranchProps {
message: UserMessage;
branchIndex: number;
numberOfBranches: number;
}
type CopilotChatUserMessageProps = WithSlots<{
messageRenderer: typeof CopilotChatUserMessage.MessageRenderer;
toolbar: typeof CopilotChatUserMessage.Toolbar;
copyButton: typeof CopilotChatUserMessage.CopyButton;
editButton: typeof CopilotChatUserMessage.EditButton;
branchNavigation: typeof CopilotChatUserMessage.BranchNavigation;
}, {
onEditMessage?: (props: CopilotChatUserMessageOnEditMessageProps) => void;
onSwitchToBranch?: (props: CopilotChatUserMessageOnSwitchToBranchProps) => void;
message: UserMessage;
branchIndex?: number;
numberOfBranches?: number;
additionalToolbarItems?: React.ReactNode;
} & React.HTMLAttributes<HTMLDivElement>>;
declare function CopilotChatUserMessage({
message,
onEditMessage,
branchIndex,
numberOfBranches,
onSwitchToBranch,
additionalToolbarItems,
messageRenderer,
toolbar,
copyButton,
editButton,
branchNavigation,
children,
className,
...props
}: CopilotChatUserMessageProps): react_jsx_runtime0.JSX.Element;
declare namespace CopilotChatUserMessage {
const Container: React.FC<React.PropsWithChildren<React.HTMLAttributes<HTMLDivElement>>>;
const MessageRenderer: React.FC<{
content: string;
className?: string;
}>;
const Toolbar: React.FC<React.HTMLAttributes<HTMLDivElement>>;
const ToolbarButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & {
title: string;
children: React.ReactNode;
}>;
const CopyButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & {
copied?: boolean;
}>;
const EditButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
const BranchNavigation: React.FC<React.HTMLAttributes<HTMLDivElement> & {
currentBranch?: number;
numberOfBranches?: number;
onSwitchToBranch?: (props: CopilotChatUserMessageOnSwitchToBranchProps) => void;
message: UserMessage;
}>;
}
//#endregion
//#region src/v2/components/chat/CopilotChatReasoningMessage.d.ts
type CopilotChatReasoningMessageProps = WithSlots<{
header: typeof CopilotChatReasoningMessage.Header;
contentView: typeof CopilotChatReasoningMessage.Content;
toggle: typeof CopilotChatReasoningMessage.Toggle;
}, {
message: ReasoningMessage;
messages?: Message$2[];
isRunning?: boolean;
} & React.HTMLAttributes<HTMLDivElement>>;
declare function CopilotChatReasoningMessage({
message,
messages,
isRunning,
header,
contentView,
toggle,
children,
className,
...props
}: CopilotChatReasoningMessageProps): react_jsx_runtime0.JSX.Element;
declare namespace CopilotChatReasoningMessage {
const Header: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & {
isOpen?: boolean;
label?: string;
hasContent?: boolean;
isStreaming?: boolean;
}>;
const Content: React.FC<React.HTMLAttributes<HTMLDivElement> & {
isStreaming?: boolean;
hasContent?: boolean;
}>;
const Toggle: React.FC<React.HTMLAttributes<HTMLDivElement> & {
isOpen?: boolean;
}>;
}
//#endregion
//#region src/v2/components/chat/CopilotChatSuggestionPill.d.ts
interface CopilotChatSuggestionPillProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
/** Optional icon to render on the left side when not loading. */
icon?: React$1.ReactNode;
/** Whether the pill should display a loading spinner. */
isLoading?: boolean;
}
declare const CopilotChatSuggestionPill: React$1.ForwardRefExoticComponent<CopilotChatSuggestionPillProps & React$1.RefAttributes<HTMLButtonElement>>;
//#endregion
//#region src/v2/components/chat/CopilotChatSuggestionView.d.ts
declare const DefaultContainer: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
type CopilotChatSuggestionViewProps = WithSlots<{
container: typeof DefaultContainer;
suggestion: typeof CopilotChatSuggestionPill;
}, {
suggestions: Suggestion[];
onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
loadingIndexes?: ReadonlyArray<number>;
} & React$1.HTMLAttributes<HTMLDivElement>>;
declare const CopilotChatSuggestionView: React$1.ForwardRefExoticComponent<{
container?: SlotValue<React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>> | undefined;
suggestion?: SlotValue<React$1.ForwardRefExoticComponent<CopilotChatSuggestionPillProps & React$1.RefAttributes<HTMLButtonElement>>> | undefined;
} & {
children?: ((props: {
container: React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
suggestion: React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
} & {
suggestions: Suggestion[];
onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
loadingIndexes?: ReadonlyArray<number>;
} & React$1.HTMLAttributes<HTMLDivElement>) => React$1.ReactNode) | undefined;
} & Omit<{
suggestions: Suggestion[];
onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
loadingIndexes?: ReadonlyArray<number>;
} & React$1.HTMLAttributes<HTMLDivElement>, "children"> & React$1.RefAttributes<HTMLDivElement>>;
//#endregion
//#region src/v2/components/chat/CopilotChatMessageView.d.ts
type CopilotChatMessageViewProps = Omit<WithSlots<{
assistantMessage: typeof CopilotChatAssistantMessage;
userMessage: typeof CopilotChatUserMessage;
reasoningMessage: typeof CopilotChatReasoningMessage;
cursor: typeof CopilotChatMessageView.Cursor;
}, {
isRunning?: boolean;
messages?: Message$2[];
} & React$1.HTMLAttributes<HTMLDivElement>>, "children"> & {
children?: (props: {
isRunning: boolean;
messages: Message$2[];
messageElements: React$1.ReactElement[];
interruptElement: React$1.ReactElement | null;
}) => React$1.ReactElement;
};
declare function CopilotChatMessageView({
messages,
assistantMessage,
userMessage,
reasoningMessage,
cursor,
isRunning,
children,
className,
...props
}: CopilotChatMessageViewProps): react_jsx_runtime0.JSX.Element;
declare namespace CopilotChatMessageView {
var Cursor: ({
className,
...props
}: React$1.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime0.JSX.Element;
}
//#endregion
//#region src/v2/components/chat/normalize-auto-scroll.d.ts
type AutoScrollMode = "pin-to-bottom" | "pin-to-send" | "none";
//#endregion
//#region src/v2/components/chat/CopilotChatView.d.ts
type WelcomeScreenProps = WithSlots<{
welcomeMessage: React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>;
}, {
input: React$1.ReactElement;
suggestionView: React$1.ReactElement;
} & React$1.HTMLAttributes<HTMLDivElement>>;
type CopilotChatViewProps = WithSlots<{
messageView: typeof CopilotChatMessageView;
scrollView: typeof CopilotChatView.ScrollView;
input: typeof CopilotChatInput;
suggestionView: typeof CopilotChatSuggestionView;
}, {
messages?: Message$2[];
autoScroll?: AutoScrollMode | boolean;
isRunning?: boolean;
suggestions?: Suggestion[];
suggestionLoadingIndexes?: ReadonlyArray<number>;
onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
welcomeScreen?: SlotValue<React$1.FC<WelcomeScreenProps>> | boolean;
onSubmitMessage?: (value: string) => void;
onStop?: () => void;
inputMode?: CopilotChatInputMode;
inputValue?: string;
onInputChange?: (value: string) => void;
onStartTranscribe?: () => void;
onCancelTranscribe?: () => void;
onFinishTranscribe?: () => void;
onFinishTranscribeWithAudio?: (audioBlob: Blob) => Promise<void>;
attachments?: Attachment[];
onRemoveAttachment?: (id: string) => void;
onAddFile?: () => void;
dragOver?: boolean;
onDragOver?: (e: React$1.DragEvent) => void;
onDragLeave?: (e: React$1.DragEvent) => void;
onDrop?: (e: React$1.DragEvent) => void;
/**
* When `true`, suppresses the welcome screen while a thread's initial
* connect is in flight. Prevents the "How can I help you today?" flash
* that would otherwise appear between mounting an empty agent instance
* and the bootstrap messages arriving from /connect.
*/
isConnecting?: boolean;
/**
* When `true`, the caller has explicitly picked a thread (via `threadId`
* prop or `CopilotChatConfigurationProvider`). Suppresses the welcome
* screen unconditionally — a caller-managed thread targets a specific
* conversation and should render its messages (or an empty panel during
* connect) rather than a generic "start a new chat" greeting.
*/
hasExplicitThreadId?: boolean;
/**
* @deprecated Use the `input` slot's `disclaimer` prop instead:
* ```tsx
* <CopilotChat input={{ disclaimer: MyDisclaimer }} />
* ```
*/
disclaimer?: SlotValue<React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>>;
} & React$1.HTMLAttributes<HTMLDivElement>>;
declare function CopilotChatView({
messageView,
input,
scrollView,
suggestionView,
welcomeScreen,
messages,
autoScroll,
isRunning,
suggestions,
suggestionLoadingIndexes,
onSelectSuggestion,
onSubmitMessage,
onStop,
inputMode,
inputValue,
onInputChange,
onStartTranscribe,
onCancelTranscribe,
onFinishTranscribe,
onFinishTranscribeWithAudio,
attachments,
onRemoveAttachment,
onAddFile,
dragOver,
onDragOver,
onDragLeave,
onDrop,
isConnecting,
hasExplicitThreadId,
disclaimer,
children,
className,
...props
}: CopilotChatViewProps): react_jsx_runtime0.JSX.Element;
declare namespace CopilotChatView {
const ScrollView: React$1.FC<React$1.HTMLAttributes<HTMLDivElement> & {
autoScroll?: AutoScrollMode | boolean;
scrollToBottomButton?: SlotValue<React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>>;
feather?: SlotValue<React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>>;
inputContainerHeight?: number;
isResizing?: boolean;
}>;
const ScrollToBottomButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
const Feather: React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>;
const WelcomeMessage: React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>;
const WelcomeScreen: React$1.FC<WelcomeScreenProps>;
}
//#endregion
//#region src/v2/components/chat/CopilotChat.d.ts
type CopilotChatProps = Omit<CopilotChatViewProps, "messages" | "isRunning" | "suggestions" | "suggestionLoadingIndexes" | "onSelectSuggestion" | "attachments" | "onRemoveAttachment" | "onAddFile" | "dragOver" | "onDragOver" | "onDragLeave" | "onDrop"> & {
agentId?: string;
threadId?: string;
labels?: Partial<CopilotChatLabels>;
chatView?: SlotValue<typeof CopilotChatView>;
isModalDefaultOpen?: boolean; /** Enable multimodal file attachments (images, audio, video, documents). */
attachments?: AttachmentsConfig;
/**
* Error handler scoped to this chat's agent. Fires in addition to the
* provider-level onError (does not suppress it). Receives only errors
* whose context.agentId matches this chat's agent.
*/
onError?: (event: {
error: Error;
code: CopilotKitCoreErrorCode;
context: Record<string, any>;
}) => void | Promise<void>;
/**
* Throttle interval (in milliseconds) for re-renders triggered by message
* change notifications. Overrides the provider-level `defaultThrottleMs`
* for this chat instance. Forwarded to the internal `useAgent()` hook,
* which resolves the effective throttle value.
*
* @default undefined — inherits from provider `defaultThrottleMs`;
* if that is also unset, re-renders are unthrottled. Note: passing
* `throttleMs={0}` explicitly disables throttling for this instance
* even when the provider specifies a non-zero `defaultThrottleMs`.
*/
throttleMs?: number;
};
declare function CopilotChat({
agentId,
threadId,
labels,
chatView,
isModalDefaultOpen,
attachments: attachmentsConfig,
onError,
throttleMs,
...props
}: CopilotChatProps): react_jsx_runtime0.JSX.Element;
declare namespace CopilotChat {
const View: typeof CopilotChatView;
}
//#endregion
//#region src/v2/components/chat/CopilotChatToggleButton.d.ts
declare const DefaultOpenIcon: React$1.FC<React$1.SVGProps<SVGSVGElement>>;
declare const DefaultCloseIcon: React$1.FC<React$1.SVGProps<SVGSVGElement>>;
interface CopilotChatToggleButtonProps extends Omit<React$1.ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
/** Optional slot override for the chat (closed) icon. */
openIcon?: SlotValue<typeof DefaultOpenIcon>;
/** Optional slot override for the close icon. */
closeIcon?: SlotValue<typeof DefaultCloseIcon>;
}
declare const CopilotChatToggleButton: React$1.ForwardRefExoticComponent<CopilotChatToggleButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
//#endregion
//#region src/v2/components/chat/CopilotModalHeader.d.ts
type HeaderSlots = {
titleContent: typeof CopilotModalHeader.Title;
closeButton: typeof CopilotModalHeader.CloseButton;
};
type HeaderRestProps = {
title?: string;
} & Omit<React$1.HTMLAttributes<HTMLDivElement>, "children">;
type CopilotModalHeaderProps = WithSlots<HeaderSlots, HeaderRestProps>;
declare function CopilotModalHeader({
title,
titleContent,
closeButton,
children,
className,
...rest
}: CopilotModalHeaderProps): string | number | bigint | boolean | react_jsx_runtime0.JSX.Element | Iterable<React$1.ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<React$1.ReactNode> | null | undefined> | null | undefined;
declare namespace CopilotModalHeader {
var displayName: string;
}
declare namespace CopilotModalHeader {
const Title: React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>;
const CloseButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
}
//#endregion
//#region src/v2/components/chat/CopilotSidebarView.d.ts
type CopilotSidebarViewProps = CopilotChatViewProps & {
header?: SlotValue<typeof CopilotModalHeader>;
toggleButton?: SlotValue<typeof CopilotChatToggleButton>;
width?: number | string;
defaultOpen?: boolean;
position?: "left" | "right";
};
declare function CopilotSidebarView({
header,
toggleButton,
width,
defaultOpen,
position,
...props
}: CopilotSidebarViewProps): react_jsx_runtime0.JSX.Element;
declare namespace CopilotSidebarView {
var displayName: string;
}
declare namespace CopilotSidebarView {
/**
* Sidebar-specific welcome screen layout:
* - Suggestions at the top
* - Welcome message in the middle
* - Input fixed at the bottom (like normal chat)
*/
const WelcomeScreen: React$1.FC<WelcomeScreenProps>;
}
//#endregion
//#region src/v2/components/chat/CopilotPopupView.d.ts
type CopilotPopupViewProps = CopilotChatViewProps & {
header?: SlotValue<typeof CopilotModalHeader>;
toggleButton?: SlotValue<typeof CopilotChatToggleButton>;
width?: number | string;
height?: number | string;
clickOutsideToClose?: boolean;
defaultOpen?: boolean;
};
declare function CopilotPopupView({
header,
toggleButton,
width,
height,
clickOutsideToClose,
defaultOpen,
className,
...restProps
}: CopilotPopupViewProps): react_jsx_runtime0.JSX.Element;
declare namespace CopilotPopupView {
var displayName: string;
}
declare namespace CopilotPopupView {
/**
* Popup-specific welcome screen layout:
* - Welcome message centered vertically
* - Suggestions just above input
* - Input fixed at the bottom
*/
const WelcomeScreen: React$1.FC<WelcomeScreenProps>;
}
//#endregion
//#region src/v2/components/chat/CopilotSidebar.d.ts
type CopilotSidebarProps = Omit<CopilotChatProps, "chatView"> & {
header?: CopilotSidebarViewProps["header"];
toggleButton?: CopilotSidebarViewProps["toggleButton"];
defaultOpen?: boolean;
width?: number | string;
position?: CopilotSidebarViewProps["position"];
};
declare function CopilotSidebar({
header,
toggleButton,
defaultOpen,
width,
position,
...chatProps
}: CopilotSidebarProps): react_jsx_runtime0.JSX.Element;
declare namespace CopilotSidebar {
var displayName: string;
}
//#endregion
//#region src/v2/components/chat/CopilotPopup.d.ts
type CopilotPopupProps = Omit<CopilotChatProps, "chatView"> & {
header?: CopilotPopupViewProps["header"];
toggleButton?: CopilotPopupViewProps["toggleButton"];
defaultOpen?: boolean;
width?: CopilotPopupViewProps["width"];
height?: CopilotPopupViewProps["height"];
clickOutsideToClose?: CopilotPopupViewProps["clickOutsideToClose"];
};
declare function CopilotPopup({
header,
toggleButton,
defaultOpen,
width,
height,
clickOutsideToClose,
...chatProps
}: CopilotPopupProps): react_jsx_runtime0.JSX.Element;
declare namespace CopilotPopup {
var displayName: string;
}
//#endregion
//#region src/v2/components/chat/CopilotChatAttachmentQueue.d.ts
interface CopilotChatAttachmentQueueProps {
attachments: Attachment[];
onRemoveAttachment: (id: string) => void;
className?: string;
}
declare const CopilotChatAttachmentQueue: React$1.FC<CopilotChatAttachmentQueueProps>;
//#endregion
//#region src/v2/components/chat/CopilotChatAttachmentRenderer.d.ts
interface CopilotChatAttachmentRendererProps {
type: "image" | "audio" | "video" | "document";
source: InputContentSource;
filename?: string;
className?: string;
}
declare const CopilotChatAttachmentRenderer: React$1.FC<CopilotChatAttachmentRendererProps>;
//#endregion
//#region src/v2/components/WildcardToolCallRender.d.ts
declare const WildcardToolCallRender: ReactToolCallRenderer<any>;
//#endregion
//#region src/v2/components/CopilotKitInspector.d.ts
type CopilotKitInspectorBaseProps = {
core?: CopilotKitCore | null;
defaultAnchor?: Anchor;
[key: string]: unknown;
};
interface CopilotKitInspectorProps extends CopilotKitInspectorBaseProps {}
declare const CopilotKitInspector: react.FC<CopilotKitInspectorProps>;
//#endregion
//#region src/v2/components/MCPAppsActivityRenderer.d.ts
/**
* Activity type for MCP Apps events - must match the middleware's MCPAppsActivityType
*/
declare const MCPAppsActivityType = "mcp-apps";
declare const MCPAppsActivityContentSchema: z.ZodObject<{
result: z.ZodObject<{
content: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
structuredContent: z.ZodOptional<z.ZodAny>;
isError: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
content?: any[] | undefined;
structuredContent?: any;
isError?: boolean | undefined;
}, {
content?: any[] | undefined;
structuredContent?: any;
isError?: boolean | undefined;
}>;
resourceUri: z.ZodString;
serverHash: z.ZodString;
serverId: z.ZodOptional<z.ZodString>;
toolInput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, "strip", z.ZodTypeAny, {
result: {
content?: any[] | undefined;
structuredContent?: any;
isError?: boolean | undefined;
};
resourceUri: string;
serverHash: string;
serverId?: string | undefined;
toolInput?: Record<string, unknown> | undefined;
}, {
result: {
content?: any[] | undefined;
structuredContent?: any;
isError?: boolean | undefined;
};
resourceUri: string;
serverHash: string;
serverId?: string | undefined;
toolInput?: Record<string, unknown> | undefined;
}>;
type MCPAppsActivityContent = z.infer<typeof MCPAppsActivityContentSchema>;
/**
* Props for the activity renderer component
*/
interface MCPAppsActivityRendererProps {
activityType: string;
content: MCPAppsActivityContent;
message: unknown;
agent: AbstractAgent | undefined;
}
/**
* MCP Apps Extension Activity Renderer
*
* Renders MCP Apps UI in a sandboxed iframe with full protocol support.
* Fetches resource content on-demand via proxied MCP requests.
*/
declare const MCPAppsActivityRenderer: React$1.FC<MCPAppsActivityRendererProps>;
//#endregion
//#region src/v2/components/intelligence-indicator/IntelligenceIndicator.d.ts
interface IntelligenceIndicatorProps {
/** The message this indicator is attached to. */
message: Message$2;
/**
* Agent id whose run state the indicator tracks. Pass through from
* the surrounding chat configuration; mounting from
* `CopilotChatMessageView` resolves this automatically.
*/
agentId: string;
/**
* Optional override for the visible label. Defaults to "Using
* CopilotKit Intelligence".
*/
label?: string;
}
/**
* The "Using CopilotKit Intelligence" pill. Auto-mounted by
* `CopilotChatMessageView` for every message slot when
* `copilotkit.intelligence` is configured — callers do not register
* this themselves. Self-gates so only the canonical message renders a
* pill.
*
* Render gates (all must hold):
* 1. `copilotkit.intelligence !== undefined`
* 2. The message is an assistant message with at least one tool call
* whose name matches {@link DEFAULT_TOOL_PATTERNS}
* 3. The message is the *latest* such matching-assistant message in
* `agent.messages` — tool-result messages and prose-only assistant
* messages don't invalidate the slot, so the pill stays
* continuously through a multi-step tool chain.
* 4. The phase machine is past `idle` (the pending-grace timer fired)
* and not yet `hidden`.
*
* Phase machine (per-instance, all timers local):
* - Starts in `idle` — nothing rendered.
* - `idle → spinner` once a matching tool call has been pending
* (no `tool`-role result with a matching `toolCallId`) for
* {@link PENDING_THRESHOLD_MS}. Replay flashes (tool call + result
* in the same tick) never cross this threshold.
* - `spinner → check` as soon as EITHER `agent.isRunning` flips
* false OR a non-tool-call-like message appears later in
* `agent.messages` (i.e. the agent has produced a "real"
* follow-up — prose answer or a new user turn).
* - `check → fading` after {@link CHECK_HOLD_MS}.
* - `fading → hidden` after {@link FADE_OUT_ANIMATION_MS}.
*
* Once `hidden`, the phase is sticky — a finished pill never re-spawns
* on the same message. New runs mount fresh indicator instances on
* their own assistant messages.
*
* The "exactly one pill at a time" guarantee is structural: only one
* message satisfies the latest-matching-assistant gate at any moment.
*/
declare function IntelligenceIndicator(props: IntelligenceIndicatorProps): React$1.ReactElement | null;
//#endregion
//#region src/v2/hooks/use-render-tool-call.d.ts
interface UseRenderToolCallProps {
toolCall: ToolCall;
toolMessage?: ToolMessage;
}
/**
* Hook that returns a function to render tool calls based on the render functions
* defined in CopilotKitProvider.
*
* @returns A function that takes a tool call and optional tool message and returns the rendered component
*/
declare function useRenderToolCall(): ({
toolCall,
toolMessage
}: UseRenderToolCallProps) => React$1.ReactElement | null;
//#endregion
//#region src/v2/types/react-custom-message-renderer.d.ts
type ReactCustomMessa