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/intelligence-indicator/IntelligenceIndicatorView.d.ts
/** Lifecycle state the brain hands the face. */
type IntelligenceIndicatorStatus = "in-progress" | "finished";
interface IntelligenceIndicatorViewProps extends React$1.HTMLAttributes<HTMLSpanElement> {
  /** The assistant message this indicator is attached to. */
  message: Message$2;
  /**
   * Whether the intelligence work is still running (`in-progress`) or
   * has settled (`finished`). Drives the icon morph and chrome
   * fade-out via the `data-status` attribute on the wrapper.
   */
  status: IntelligenceIndicatorStatus;
  /** The visible label, e.g. "Using CopilotKit Intelligence". */
  label: string;
}
/**
 * The presentational "CopilotKit Intelligence" face — the default
 * rendered by the {@link IntelligenceIndicator} brain and the default
 * value for the `intelligenceIndicator` slot.
 *
 * Single-element three-stage design:
 *  1. **In-progress.** Glassmorphism pill chrome around a 270° arc icon
 *     and the label. The arc has a single continuous visible stroke
 *     (one `stroke-dasharray` dash + one gap, summing to the path
 *     length) and the whole SVG rotates — so the viewer sees one
 *     C-shaped arc spinning around the visual center.
 *  2. **Icon morph (~250 ms).** On status flip the single icon path
 *     interpolates from the arc to a checkmark via CSS `d:` while the
 *     dashed stroke transitions to solid (filling in the gap that was
 *     the spinner's open portion). The SVG rotation animation is
 *     removed; the snap back to identity is masked by the simultaneous
 *     shape change. Chrome and text stay at full opacity throughout.
 *  3. **Settle (~400 ms, starts at +250 ms).** Chrome (background,
 *     border, shadow, backdrop-blur) fades to zero opacity. The label
 *     and icon stroke color transitions from saturated purple to a
 *     true-neutral gray at 0.8 alpha — no hue cast, reads as "settled
 *     history metadata." The label simultaneously skews to ~10° (a
 *     transform-based italic feel that interpolates smoothly with the
 *     color, rather than the discrete `font-style: italic` snap that
 *     would cause a layout pop). The label text stays put — only its
 *     color and slant change — so there is no "bump" where the brand
 *     text disappears and reappears.
 *
 * Hard sequence: stage 3 has a 250 ms transition-delay so it waits
 * for stage 2 to finish. Total settle time ~650 ms in production.
 *
 * Both shapes are 3-segment cubic Bézier paths with matched command
 * structure (one `M` plus three `C`s), which is what makes the d
 * morph interpolate as a continuous shape change rather than snapping.
 *
 * The label is identical in both states (default "CopilotKit
 * Intelligence"). The static check icon carries the "done" semantic;
 * the color + slant transition does the "settle" work without needing
 * any wording change.
 *
 * Customize via the `intelligenceIndicator` slot on `CopilotChat`:
 * a className string restyles the wrapper, a props object tweaks
 * the default (`{ label }`), and a component replaces it entirely
 * with full control over visuals and timing.
 */
declare function IntelligenceIndicatorView({
  message,
  status,
  label,
  className,
  ...rest
}: IntelligenceIndicatorViewProps): React$1.ReactElement;
//#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
   * "CopilotKit Intelligence".
   */
  label?: string;
  /**
   * Slot override for the presentational face. A className string, a
   * props object, or a full replacement component — see
   * {@link IntelligenceIndicatorView}. Forwarded from the
   * `intelligenceIndicator` slot on `CopilotChat`.
   */
  intelligenceIndicator?: SlotValue<typeof IntelligenceIndicatorView>;
}
/**
 * Stable turn id for the messages that precede the first user message (a turn
 * with no opening user message of its own). Used as the React key so the
 * indicator for that turn never collides with a real user-message id.
 */
declare const INTELLIGENCE_TURN_HEAD = "__cpk_turn_head__";
/**
 * Map each Intelligence-using turn to its anchor message — the FIRST bash-using
 * assistant message of the turn — and a stable turn id (the id of the user
 * message that opened the turn, or {@link INTELLIGENCE_TURN_HEAD} for the
 * pre-first-user turn). Returns `Map<anchorMessageId, turnId>`.
 *
 * Anchoring to the FIRST (not last) bash-using message keeps the indicator
 * fixed in place for the whole turn: later bash steps don't reposition it, so
 * the spinner never abruptly jumps mid-turn (bug 1). `CopilotChatMessageView`
 * emits exactly one `IntelligenceIndicator` per entry, keyed by the turn id and
 * positioned at the anchor; the per-turn key also lets every past turn keep its
 * own indicator in scroll-back.
 */
declare function getIntelligenceTurnAnchors(messages: readonly Message$2[]): Map<string, string>;
/**
 * The "Using CopilotKit Intelligence" indicator brain. Auto-mounted by
 * `CopilotChatMessageView` — once per Intelligence-using turn, at that
 * turn's anchor message and keyed by the turn id (see
 * {@link getIntelligenceTurnAnchors}). Callers do not register this
 * themselves. It owns the run subscription and the phase machine and
 * renders its swappable face via the `intelligenceIndicator` slot.
 *
 * Placement (which message anchors the turn) is decided by the view, so
 * this component does not self-gate its own placement; it only derives
 * in-progress/finished for the turn it was mounted on.
 *
 * Render gates (all must hold):
 *   1. `copilotkit.intelligence !== undefined`
 *   2. The (anchor) message is an assistant message with at least one
 *      tool call whose name matches {@link DEFAULT_TOOL_PATTERNS}.
 *   3. The phase machine is past `hidden`.
 *
 * Because the view keys each indicator by its turn id, the instance moves
 * with the anchor across a hand-off (no remount, no spinner restart), and
 * every prior Intelligence-using turn keeps its own persistent indicator
 * in chat history.
 *
 * Phase machine (per-instance, all timers local):
 *   - Starts in `hidden`, unless the message mounts onto an
 *     already-completed turn (no pending work, agent stopped or a
 *     real follow-up already present), in which case the lazy
 *     `useState` initializer starts directly in `finished`. This is
 *     what avoids a "hidden flash" on history replay.
 *   - `hidden → 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.
 *   - `hidden → finished` if after the grace window the turn is
 *     already complete (no pending work AND
 *     `sawRealFollowup || !agent.isRunning`). Handles very fast tools
 *     whose result lands within the grace window.
 *   - `spinner → finished` as soon as EITHER `agent.isRunning` flips
 *     false OR a non-tool-call-like message appears later in
 *     `agent.messages` (i.e. the agent produced a "real" follow-up —
 *     prose answer or a new user turn).
 *   - `finished` is terminal: the indicator settles into its
 *     persistent tag form and stays mounted.
 */
declare function IntelligenceIndicator(props: IntelligenceIndicatorProps): React$1.ReactElement | null;
//#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;
  intelligenceIndicator: typeof IntelligenceIndicatorView;
}, {
  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,
  intelligenceIndicator,
  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>>>;
  /**
   * Slot for the "Using CopilotKit Intelligence" indicator. Pass-through
   * to `CopilotChatMessageView`'s `intelligenceIndicator` slot — accepts a
   * className string, a props object, or a replacement component.
   */
  intelligenceIndicator?: SlotValue<typeof IntelligenceIndicatorView>;
} & 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,
  intelligenceIndicator,
  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/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 ReactCustomMessageRendererPosition = "before" | "after";
interface ReactCustomMessageRenderer {
  agentId?: string;
  render: React.ComponentType<{
    message: Message$2;
    position: ReactCustomMessageRendererPosition;
    runId: string;
    messageIndex: number;
    messageIndexInRun: number;
    numberOfMessagesInRun: number;
    agentId: string;
    stateSnapshot: any;
  }> | null;
}
//#endregion
//#region src/v2/hooks/use-render-custom-messages.d.ts
interface UseRenderCustomMessagesParams {
  message: Message$2;
  position: ReactCustomMessageRendererPosition;
}
declare function useRenderCustomMessages(): ((params: UseRenderCustomMessagesParams) => react_jsx_runtime0.JSX.Element | null) | null;
//#endregion
//#region src/v2/types/react-tool-call-renderer.d.ts
interface ReactToolCallRenderer<T = unknown> {
  name: string;
  args: StandardSchemaV1<any, T>;
  /**
   * Optional agent ID to constrain this tool renderer to a specific agent.
   * If specified, this renderer will only be used for the specified agent.
   */
  agentId?: string;
  render: React.ComponentType<{
    name: string;
    toolCallId: string;
    args: Partial<T>;
    status: ToolCallStatus.InProgress;
    result: undefined;
  } | {
    name: string;
    toolCallId: string;
    args: T;
    status: ToolCallStatus.Executing;
    result: undefined;
  } | {
    name: string;
    toolCallId: string;
    args: T;
    status: ToolCallStatus.Complete;
    result: string;
  }>;
}
//#endregion
//#region src/v2/types/react-activity-message-renderer.d.ts
interface ReactActivityMessageRenderer<TActivityContent> {
  /**
   * Activity type to match when rendering. Use "*" as a wildcard renderer.
   */
  activityType: string;
  /**
   * Optional agent ID to scope the renderer to a particular agent.
   */
  agentId?: string;
  /**
   * Schema describing the activity content payload.
   */
  content: StandardSchemaV1<any, TActivityContent>;
  /**
   * React component invoked to render the activity message.
   */
  render: React.ComponentType<{
    activityType: string;
    content: TActivityContent;
    message: ActivityMessage;
    agent: AbstractAgent | undefined;
  }>;
}
//#endregion
//#region src/v2/types/frontend-tool.d.ts
type ReactFrontendTool<T extends Record<string, unknown> = Record<string, unknown>> = FrontendTool<T> & {
  render?: ReactToolCallRenderer<T>["render"];
};
//#endregion
//#region src/v2/types/human-in-the-loop.d.ts
type ReactHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>> = Omit<FrontendTool<T>, "handler"> & {
  render: React$1.ComponentType<{
    name: string;
    description: string;
    args: Partial<T>;
    status: ToolCallStatus.InProgress;
    result: undefined;
    respond: undefined;
  } | {
    name: string;
    description: string;
    args: T;
    status: ToolCallStatus.Executing;
    result: undefined;
    respond: (result: unknown) => Promise<void>;
  } | {
    name: string;
    description: string;
    args: T;
    status: ToolCallStatus.Complete;
    result: string;
    respond: undefined;
  }>;
};
//#endregion
//#region src/v2/types/defineToolCallRenderer.d.ts
/**
 * Helper to define a type-safe tool call renderer entry.
 * - Accepts a single object whose keys match ReactToolCallRenderer's fields: { name, args, render, agentId? }.
 * - Derives `args` type from the provided schema (any Standard Schema V1 compatible library).
 * - Ensures the render function param type exactly matches ReactToolCallRenderer<T>["render"]'s param.
 * - For wildcard tools (name: "*"), args is optional and defaults to z.any()
 */
type RenderProps<T> = {
  name: string;
  toolCallId: string;
  args: Partial<T>;
  status: ToolCallStatus.InProgress;
  result: undefined;
} | {
  name: string;
  toolCallId: string;
  args: T;
  status: ToolCallStatus.Executing;
  result: undefined;
} | {
  name: string;
  toolCallId: string;
  args: T;
  status: ToolCallStatus.Complete;
  result: string;
};
declare function defineToolCallRenderer(def: {
  name: "*";
  render: (props: RenderProps<any>) => React$1.ReactElement;
  agentId?: string;
}): ReactToolCallRenderer<any>;
declare function defineToolCallRenderer<S extends StandardSchemaV1>(def: {
  name: string;
  args: S;
  render: (props: RenderProps<InferSchemaOutput<S>>) => React$1.ReactElement;
  agentId?: string;
}): ReactToolCallRenderer<InferSchemaOutput<S>>;
//#endregion
//#region src/v2/types/interrupt.d.ts
interface InterruptEvent<TValue = unknown> {
  name: string;
  value: TValue;
}
interface InterruptHandlerProps<TValue = unknown> {
  event: InterruptEvent<TValue>;
  resolve: (response: unknown) => void;
}
interface InterruptRenderProps<TValue = unknown, TResult = unknown> {
  event: InterruptEvent<TValue>;
  result: TResult;
  resolve: (response: unknown) => void;
}
//#endregion
//#region src/v2/types/sandbox-function.d.ts
type SandboxFunction<TParams extends StandardSchemaV1 = StandardSchemaV1> = {
  name: string;
  description: string;
  parameters: TParams;
  handler: (args: any) => Promise<unknown>;
};
//#endregion
//#region src/v2/hooks/use-render-activity-message.d.ts
declare function useRenderActivityMessage(): {
  renderActivityMessage: (message: ActivityMessage) => React.ReactElement | null;
  findRenderer: (activityType: string) => ReactActivityMessageRenderer<unknown> | null;
};
//#endregion
//#region src/v2/hooks/use-frontend-tool.d.ts
declare function useFrontendTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactFrontendTool<T>, deps?: ReadonlyArray<unknown>): void;
//#endregion
//#region src/v2/hooks/use-component.d.ts
type InferRenderProps<T> = T extends StandardSchemaV1 ? InferSchemaOutput<T> : any;
/**
 * Registers a React component as a frontend tool renderer in chat.
 *
 * This hook is a convenience wrapper around `useFrontendTool` that:
 * - builds a model-facing tool description,
 * - forwards optional schema parameters (any Standard Schema V1 compatible library),
 * - renders your component with tool call parameters.
 *
 * Use this when you want to display a typed visual component for a tool call
 * without manually wiring a full frontend tool object.
 *
 * When `parameters` is provided, render props are inferred from the schema.
 * When omitted, the render component may accept any props.
 *
 * @typeParam TSchema - Schema describing tool parameters, or `undefined` when no schema is given.
 * @param config - Tool registration config.
 * @param deps - Optional dependencies to refresh registration (same semantics as `useEffect`).
 *
 * @example
 * ```tsx
 * // Without parameters — render accepts any props
 * useComponent({
 *   name: "showGreeting",
 *   render: ({ message }: { message: string }) => <div>{message}</div>,
 * });
 * ```
 *
 * @example
 * ```tsx
 * // With parameters — render props inferred from schema
 * useComponent({
 *   name: "showWeatherCard",
 *   parameters: z.object({ city: z.string() }),
 *   render: ({ city }) => <div>{city}</div>,
 * });
 * ```
 *
 * @example
 * ```tsx
 * useComponent(
 *   {
 *     name: "renderProfile",
 *     parameters: z.object({ userId: z.string() }),
 *     render: ProfileCard,
 *     agentId: "support-agent",
 *   },
 *   [selectedAgentId],
 * );
 * ```
 */
declare function useComponent<TSchema extends StandardSchemaV1 | undefined = undefined>(config: {
  name: string;
  description?: string;
  parameters?: TSchema;
  render: ComponentType<NoInfer<InferRenderProps<TSchema>>>;
  agentId?: string;
  followUp?: boolean;
}, deps?: ReadonlyArray<unknown>): void;
//#endregion
//#region src/v2/hooks/use-render-tool.d.ts
interface RenderToolInProgressProps<S extends StandardSchemaV1> {
  name: string;
  toolCallId: string;
  parameters: Partial<InferSchemaOutput<S>>;
  status: "inProgress";
  result: undefined;
}
interface RenderToolExecutingProps<S extends StandardSchemaV1> {
  name: string;
  toolCallId: string;
  parameters: InferSchemaOutput<S>;
  status: "executing";
  result: undefined;
}
interface RenderToolCompleteProps<S extends StandardSchemaV1> {
  name: string;
  toolCallId: string;
  parameters: InferSchemaOutput<S>;
  status: "complete";
  result: string;
}
type RenderToolProps<S extends StandardSchemaV1> = RenderToolInProgressProps<S> | RenderToolExecutingProps<S> | RenderToolCompleteProps<S>;
/**
 * Registers a wildcard (`"*"`) renderer for tool calls.
 *
 * The wildcard renderer is used as a fallback when no exact name-matched
 * renderer is registered for a tool call.
 *
 * @param config - Wildcard renderer configuration.
 * @param deps - Optional dependencies to refresh registration.
 *
 * @example
 * ```tsx
 * useRenderTool(
 *   {
 *     name: "*",
 *     render: ({ name, status }) => (
 *       <div>
 *         {status === "complete" ? "✓" : "⏳"} {name}
 *       </div>
 *     ),
 *   },
 *   [],
 * );
 * ```
 */
declare function useRenderTool(config: {
  name: "*";
  render: (props: any) => React.ReactElement;
  agentId?: string;
}, deps?: ReadonlyArray<unknown>): void;
/**
 * Registers a name-scoped renderer for tool calls.
 *
 * The provided `parameters` schema defines the typed shape of `props.parameters`
 * in `render` for `executing` and `complete` states. Accepts any Standard Schema V1
 * compatible library (Zod, Valibot, ArkType, etc.).
 *
 * @typeParam S - Schema type describing tool call parameters.
 * @param config - Named renderer configuration.
 * @param deps - Optional dependencies to refresh registration.
 *
 * @example
 * ```tsx
 * useRenderTool(
 *   {
 *     name: "searchDocs",
 *     parameters: z.object({ query: z.string() }),
 *     render: ({ status, parameters, result }) => {
 *       if (status === "inProgress") return <div>Preparing...</div>;
 *       if (status === "executing") return <div>Searching {parameters.query}</div>;
 *       return <div>{result}</div>;
 *     },
 *   },
 *   [],
 * );
 * ```
 */
declare function useRenderTool<S extends StandardSchemaV1>(config: {
  name: string;
  parameters: S;
  render: (props: RenderToolProps<S>) => React.ReactElement;
  agentId?: string;
}, deps?: ReadonlyArray<unknown>): void;
//#endregion
//#region src/v2/hooks/use-default-render-tool.d.ts
type DefaultRenderProps = {
  /** The name of the tool being called. */name: string; /** The id of the tool call being rendered. */
  toolCallId: string; /** The parsed parameters passed to the tool call. */
  parameters: unknown; /** Current execution status of the tool call. */
  status: "inProgress" | "executing" | "complete"; /** The tool call result string, available only when `status` is `"complete"`. */
  result: string | undefined;
};
/**
 * Registers a wildcard (`"*"`) tool-call renderer via `useRenderTool`.
 *
 * - Call with no config to use CopilotKit's built-in default tool-call card.
 * - Pass `config.render` to replace the default UI with your own fallback renderer.
 *
 * This is useful when you want a generic renderer for tools that do not have a
 * dedicated `useRenderTool({ name: "..." })` registration.
 *
 * @param config - Optional custom wildcard render function.
 * @param deps - Optional dependencies to refresh registration.
 *
 * @example
 * ```tsx
 * useDefaultRenderTool();
 * ```
 *
 * @example
 * ```tsx
 * useDefaultRenderTool({
 *   render: ({ name, status }) => <div>{name}: {status}</div>,
 * });
 * ```
 *
 * @example
 * ```tsx
 * useDefaultRenderTool(
 *   {
 *     render: ({ name, result }) => (
 *       <ToolEventRow title={name} payload={result} compact={compactMode} />
 *     ),
 *   },
 *   [compactMode],
 * );
 * ```
 */
declare function useDefaultRenderTool(config?: {
  render?: (props: DefaultRenderProps) => React$1.ReactElement;
}, deps?: ReadonlyArray<unknown>): void;
//#endregion
//#region src/v2/hooks/use-human-in-the-loop.d.ts
declare function useHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactHumanInTheLoop<T>, deps?: ReadonlyArray<unknown>): void;
//#endregion
//#region src/v2/hooks/use-agent.d.ts
declare enum UseAgentUpdate {
  OnMessagesChanged = "OnMessagesChanged",
  OnStateChanged = "OnStateChanged",
  OnRunStatusChanged = "OnRunStatusChanged"
}
interface UseAgentProps {
  agentId?: string;
  updates?: UseAgentUpdate[];
  /**
   * Throttle interval (in milliseconds) for re-renders triggered by
   * `onMessagesChanged` and `onStateChanged` notifications. Useful to reduce
   * re-render frequency during high-frequency streaming updates.
   *
   * Uses a leading+trailing pattern with a shared window — first update
   * fires immediately, subsequent updates within the window are coalesced,
   * and a trailing timer ensures the most recent update fires after the
   * window expires. See `CopilotKitCore.subscribeToAgentWithOptions` in `@copilotkit/core`
   * for details.
   *
   * Resolved as: `throttleMs ?? provider defaultThrottleMs ?? 0`.
   * Passing `throttleMs={0}` explicitly disables throttling even when the
   * provider specifies a non-zero `defaultThrottleMs`.
   *
   * Run lifecycle callbacks (`onRunInitialized`, `onRunFinalized`,
   * `onRunFailed`, `onRunErrorEvent`) always fire immediately.
   *
   * @default undefined
   * When unset, inherits from the provider's `defaultThrottleMs`;
   * if that is also unset, the effective value is `0` (no throttle).
   */
  throttleMs?: number;
}
declare function useAgent({
  agentId,
  updates,
  throttleMs
}?: UseAgentProps): {
  agent: AbstractAgent;
};
//#endregion
//#region src/v2/hooks/use-capabilities.d.ts
/**
 * Returns the capabilities declared by the given agent (or the default agent).
 * Capabilities are populated from the runtime `/info` response at connection
 * time. The hook reads them synchronously from the agent instance — there is
 * no separate loading state, but the value will be `undefined` until the
 * runtime handshake completes.
 *
 * @param agentId - Optional agent ID. If omitted, uses the default agent.
 * @returns The agent's capabilities, or `undefined` if the agent doesn't
 *          declare capabilities.
 */
declare function useCapabilities(agentId?: string): AgentCapabilities | undefined;
//#endregion
//#region src/v2/hooks/use-agent-context.d.ts
/**
 * Represents any value that can be serialized to JSON.
 */
type JsonSerializable = string | number | boolean | null | JsonSerializable[] | {
  [key: string]: JsonSerializable;
};
/**
 * Context configuration for useAgentContext.
 * Accepts any JSON-serializable value which will be converted to a string.
 */
interface AgentContextInput {
  /** A human-readable description of what this context represents */
  description: string;
  /** The context value - will be converted to a JSON string if not already a string */
  value: JsonSerializable;
}
declare function useAgentContext(context: AgentContextInput): void;
//#endregion
//#region src/v2/hooks/use-suggestions.d.ts
interface UseSuggestionsOptions {
  agentId?: string;
}
interface UseSuggestionsResult {
  suggestions: Suggestion[];
  reloadSuggestions: () => void;
  clearSuggestions: () => void;
  isLoading: boolean;
}
declare function useSuggestions({
  agentId
}?: UseSuggestionsOptions): UseSuggestionsResult;
//#endregion
//#region src/v2/hooks/use-configure-suggestions.d.ts
type StaticSuggestionInput = Omit<Suggestion, "isLoading"> & Partial<Pick<Suggestion, "isLoading">>;
type StaticSuggestionsConfigInput = Omit<StaticSuggestionsConfig, "suggestions"> & {
  suggestions: StaticSuggestionInput[];
};
type SuggestionsConfigInput = DynamicSuggestionsConfig | StaticSuggestionsConfigInput;
declare function useConfigureSuggestions(config: SuggestionsConfigInput | null | undefined, deps?: ReadonlyArray<unknown>): void;
//#endregion
//#region src/v2/hooks/use-interrupt.d.ts
type InterruptHandlerFn<TValue, TResult> = (props: InterruptHandlerProps<TValue>) => TResult | PromiseLike<TResult>;
type InterruptResultFromHandler<THandler> = THandler extends ((...args: never[]) => infer TResult) ? TResult extends PromiseLike<infer TResolved> ? TResolved | null : TResult | null : null;
type InterruptResult<TValue, TResult> = InterruptResultFromHandler<InterruptHandlerFn<TValue, TResult>>;
type InterruptRenderInChat = boolean | undefined;
type UseInterruptReturn<TRenderInChat extends InterruptRenderInChat> = TRenderInChat extends false ? React$1.ReactElement | null : TRenderInChat extends true | undefined ? void : React$1.ReactElement | null | void;
/**
 * Configuration options for `useInterrupt`.
 */
interface UseInterruptConfigBase<TValue = unknown, TResult = never> {
  /**
   * Render function for the interrupt UI.
   *
   * This is called once an interrupt is finalized and accepted by `enabled` (if provided).
   * Use `resolve` from render props to resume the agent run with user input.
   */
  render: (props: InterruptRenderProps<TValue, InterruptResult<TValue, TResult>>) => React$1.ReactElement;
  /**
   * Optional pre-render handler invoked when an interrupt is received.
   *
   * Return either a sync value or an async value to pass into `render` as `result`.
   * Rejecting/throwing falls back to `result = null`.
   */
  handler?: InterruptHandlerFn<TValue, TResult>;
  /**
   * Optional predicate to filter which interrupts should be handled by this hook.
   * Return `false` to ignore an interrupt.
   */
  enabled?: (event: InterruptEvent<TValue>) => boolean;
  /** Optional agent id. Defaults to the current configured chat agent. */
  agentId?: string;
}
type UseInterruptConfig<TValue = unknown, TResult = never, TRenderInChat extends InterruptRenderInChat = undefined> = UseInterruptConfigBase<TValue, TResult> & {
  /** When true (default), the interrupt UI renders inside `<CopilotChat>` automatically. Set to false to render it yourself. */renderInChat?: TRenderInChat;
};
/**
 * Handles agent interrupts (`on_interrupt`) with optional filtering, preprocessing, and resume behavior.
 *
 * The hook listens to custom events on the active agent, stores interrupt payloads per run,
 * and surfaces a render callback once the run finalizes. Call `resolve` from your UI to resume
 * execution with user-provided data.
 *
 * - `renderInChat: true` (default): the element is published into `<CopilotChat>` and this hook returns `void`.
 * - `renderInChat: false`: the hook returns the interrupt element so you can place it anywhere in your component tree.
 *
 * `event.value` is typed as `any` since the interrupt payload shape depends on your agent.
 * Type-narrow it in your callbacks (e.g. `handler`, `enabled`, `render`) as needed.
 *
 * @typeParam TResult - Inferred from `handler` return type. Exposed as `result` in `render`.
 * @param config - Interrupt configuration (renderer, optional handler/filter, and render mode).
 * @returns When `renderInChat` is `false`, returns the interrupt element (or `null` when idle).
 * Otherwise returns `void` and publishes the element into chat. In `render`, `result` is always
 * either the handler's resolved return value or `null` (including when no handler is provided,
 * when filtering skips the interrupt, or when handler execution fails).
 *
 * @example
 * ```tsx
 * import { useInterrupt } from "@copilotkit/react-core/v2";
 *
 * function InterruptUI() {
 *   useInterrupt({
 *     render: ({ event, resolve }) => (
 *       <div>
 *         <p>{event.value.question}</p>
 *         <button onClick={() => resolve({ approved: true })}>Approve</button>
 *         <button onClick={() => resolve({ approved: false })}>Reject</button>
 *       </div>
 *     ),
 *   });
 *
 *   return null;
 * }
 * ```
 *
 * @example
 * ```tsx
 * import { useInterrupt } from "@copilotkit/react-core/v2";
 *
 * function CustomPanel() {
 *   const interruptElement = useInterrupt({
 *     renderInChat: false,
 *     enabled: (event) => event.value.startsWith("approval:"),
 *     handler: async ({ event }) => ({ label: event.value.toUpperCase() }),
 *     render: ({ event, result, resolve }) => (
 *       <aside>
 *         <strong>{result?.label ?? ""}</strong>
 *         <button onClick={() => resolve({ value: event.value })}>Continue</button>
 *       </aside>
 *     ),
 *   });
 *
 *   return <>{interruptElement}</>;
 * }
 * ```
 */
declare function useInterrupt<TResult = never, TRenderInChat extends InterruptRenderInChat = undefined>(config: UseInterruptConfig<any, TResult, TRenderInChat>): UseInterruptReturn<TRenderInChat>;
//#endregion
//#region src/v2/hooks/use-threads.d.ts
/**
 * A conversation thread managed by the Intelligence platform.
 *
 * Each thread has a unique `id`, an optional human-readable `name`, and
 * timestamp fields tracking creation and update times.
 */
interface Thread {
  id: string;
  agentId: string;
  name: string | null;
  archived: boolean;
  createdAt: string;
  updatedAt: string;
  /**
   * ISO-8601 timestamp of the most recent agent run on this thread. Absent
   * when the thread has never been run. Prefer this over `updatedAt` for
   * user-facing "last activity" displays — it is not bumped by metadata-only
   * actions like rename or archive.
   */
  lastRunAt?: string;
}
/**
 * Configuration for the {@link useThreads} hook.
 *
 * Thread operations are scoped to the runtime-authenticated user and the
 * provided agent on the Intelligence platform.
 */
interface UseThreadsInput {
  /** The ID of the agent whose threads to list and manage. */
  agentId: string;
  /** When `true`, archived threads are included in the list. Defaults to `false`. */
  includeArchived?: boolean;
  /** Maximum number of threads to fetch per page. When set, enables cursor-based pagination. */
  limit?: number;
}
/**
 * Return value of the {@link useThreads} hook.
 *
 * The `threads` array is kept in sync with the platform via a realtime
 * WebSocket subscription (when available) and is sorted most-recently-updated
 * first. Mutations reject with an `Error` if the platform request fails.
 */
interface UseThreadsResult {
  /**
   * Threads for the current user/agent pair, sorted by most recently
   * updated first. Updated in realtime when the platform pushes metadata
   * events. Includes archived threads only when `includeArchived` is set.
   */
  threads: Thread[];
  /**
   * `true` while the initial thread list is being fetched from the platform.
   * Subsequent realtime updates do not re-enter the loading state.
   */
  isLoading: boolean;
  /**
   * The most recent error from fetching threads or executing a mutation,
   * or `null` when there is no error. Reset to `null` on the next
   * successful fetch.
   */
  error: Error | null;
  /**
   * `true` when there are more threads available to fetch via
   * {@link fetchMoreThreads}. Only meaningful when `limit` is set.
   */
  hasMoreThreads: boolean;
  /**
   * `true` while a subsequent page of threads is being fetched.
   */
  isFetchingMoreThreads: boolean;
  /**
   * Fetch the next page of threads. No-op when {@link hasMoreThreads} is
   * `false` or a fetch is already in progress.
   */
  fetchMoreThreads: () => void;
  /**
   * Rename a thread on the platform.
   * Resolves when the server confirms the update; rejects on failure.
   */
  renameThread: (threadId: string, name: string) => Promise<void>;
  /**
   * Archive a thread on the platform.
   * Archived threads are excluded from subsequent list results.
   * Resolves when the server confirms the update; rejects on failure.
   */
  archiveThread: (threadId: string) => Promise<void>;
  /**
   * Permanently delete a thread from the platform.
   * This is irreversible. Resolves when the server confirms deletion;
   * rejects on failure.
   */
  deleteThread: (threadId: string) => Promise<void>;
}
/**
 * React hook for listing and managing Intelligence platform threads.
 *
 * On mount the hook fetches the thread list for the runtime-authenticated user
 * and the given `agentId`. When the Intelligence platform exposes a WebSocket
 * URL, it also opens a realtime subscription so the `threads` array stays
 * current without polling — thread creates, renames, archives, and deletes
 * from any client are reflected immediately.
 *
 * Mutation methods (`renameThread`, `archiveThread`, `deleteThread`) return
 * promises that resolve once the platform confirms the operation and reject
 * with an `Error` on failure.
 *
 * @param input - Agent identifier and optional list controls.
 * @returns Thread list state and stable mutation callbacks.
 *
 * @example
 * ```tsx
 * import { useThreads } from "@copilotkit/react-core";
 *
 * function ThreadList() {
 *   const { threads, isLoading, renameThread, deleteThread } = useThreads({
 *     agentId: "agent-1",
 *   });
 *
 *   if (isLoading) return <p>Loading…</p>;
 *
 *   return (
 *     <ul>
 *       {threads.map((t) => (
 *         <li key={t.id}>
 *           {t.name ?? "Untitled"}
 *           <button onClick={() => renameThread(t.id, "New name")}>Rename</button>
 *           <button onClick={() => deleteThread(t.id)}>Delete</button>
 *         </li>
 *       ))}
 *     </ul>
 *   );
 * }
 * ```
 */
declare function useThreads({
  agentId,
  includeArchived,
  limit
}: UseThreadsInput): UseThreadsResult;
//#endregion
//#region src/v2/hooks/use-learn-from-user-action.d.ts
/**
 * Input to {@link UseLearnFromUserActionRecorder}, the function returned
 * by {@link useLearnFromUserAction}. Captures a single UI interaction that
 * the Intelligence platform's auto-curated knowledge base loop will distill
 * into the team's `/project` notes.
 */
interface LearnFromUserActionInput {
  /** Thread the action is associated with. May be unknown to the platform. */
  threadId: string;
  /** Short, agent-readable summary of what the user did. Optional. */
  title?: string | null;
  /** Optional longer explanation. */
  description?: string | null;
  /** Free-form, JSON-serializable snapshot describing the action. Optional. */
  data?: unknown;
  /** ISO-8601 client-asserted timestamp. Defaults to server NOW() when absent. */
  occurredAt?: string;
  /**
   * Caller-supplied idempotency key. When omitted, `recordAnnotation` generates a
   * fresh UUID per call so retries collapse to the original row at the
   * platform. Supply your own to keep a single semantic event idempotent
   * across calls (e.g. a React re-render or a manual retry button).
   */
  clientEventId?: string;
}
/** Outcome returned by the recorder function. */
interface LearnFromUserActionResult {
  /** Platform-assigned id of the user-action row. */
  id: string;
  /** True when the platform recognized this `clientEventId` as a retry. */
  duplicate: boolean;
}
/** Recorder function returned by {@link useLearnFromUserAction}. */
type UseLearnFromUserActionRecorder = (input: LearnFromUserActionInput) => Promise<LearnFromUserActionResult>;
/**
 * Record a user UI interaction in the Intelligence platform's user-actions
 * stream. The platform's auto-curated knowledge base agent reads these
 * (alongside finished agent runs) and writes free-form Obsidian-flavored
 * markdown to `/project`, where any agent in the same project can later
 * read it via the `copilotkit_knowledge_base_shell` MCP tool.
 *
 * The hook returns a stable function. Calling it issues a request to the
 * customer's CopilotKit runtime (`POST ${runtimeUrl}/annotate`), which
 * resolves the Intel user from the BFF's auth and forwards to the
 * platform — the Intel API key never reaches the browser.
 *
 * If `clientEventId` is omitted `recordAnnotation` generates a UUID per call,
 * so a naive double-call (e.g. React 18 strict-mode double-mount, or a retry
 * after a network blip on a fresh Promise) is naturally safe. Supply your
 * own key when a single semantic event must remain idempotent across
 * multiple `learnFromUserAction(...)` calls.
 *
 * @example
 * ```tsx
 * import { useLearnFromUserAction } from "@copilotkit/react-core";
 *
 * function SettingsPage({ threadId }) {
 *   const learnFromUserAction = useLearnFromUserAction();
 *
 *   const onRename = (oldName: string, newName: string) => {
 *     void learnFromUserAction({
 *       threadId,
 *       title: "Renamed project",
 *       data: { previous: { name: oldName }, next: { name: newName } },
 *     });
 *   };
 * }
 * ```
 */
declare function useLearnFromUserAction(): UseLearnFromUserActionRecorder;
//#endregion
//#region src/v2/hooks/use-learn-from-user-action-in-current-thread.d.ts
/**
 * Input to {@link UseLearnFromUserActionInCurrentThreadRecorder} — same as
 * {@link LearnFromUserActionInput} minus `threadId`, which is sourced from
 * the surrounding `<CopilotChatConfigurationProvider>` at call time.
 */
type LearnFromUserActionInCurrentThreadInput = Omit<LearnFromUserActionInput, "threadId">;
/** Recorder function returned by {@link useLearnFromUserActionInCurrentThread}. */
type UseLearnFromUserActionInCurrentThreadRecorder = (input: LearnFromUserActionInCurrentThreadInput) => Promise<LearnFromUserActionResult>;
/**
 * Record a user UI interaction against the **current chat's** thread. The
 * `threadId` is sourced from the surrounding
 * `<CopilotChatConfigurationProvider>` (the same provider `<CopilotChat>`,
 * `<CopilotSidebar>`, and friends set up), so callers in a chat-aware
 * subtree don't need to thread an id through manually.
 *
 * Throws on **call** (not on mount) when there is no chat-config provider
 * in scope — matches the "throw on call when runtimeUrl is missing"
 * behavior of {@link useLearnFromUserAction}. Mounting the hook in a branch
 * that never fires is harmless.
 *
 * The recorder does NOT accept a `threadId` override. If you need to
 * record against an explicit thread, use {@link useLearnFromUserAction}
 * directly — two hooks, two crisp contracts, no mode confusion.
 *
 * This hook always uses `config.threadId`, regardless of whether the
 * surrounding chat config minted it internally or received one from
 * the caller. Auto-minted threads simply mean the action lands under
 * a thread the platform never saw — the writer agent still distills
 * user-action-only threads (it does not require the thread to exist
 * in `cpki.threads`), so the loop keeps learning.
 *
 * @example
 * ```tsx
 * import { useLearnFromUserActionInCurrentThread } from "@copilotkit/react-core";
 *
 * function SettingsPanel() {
 *   const learnFromUserAction = useLearnFromUserActionInCurrentThread();
 *
 *   const onRename = (oldName: string, newName: string) => {
 *     void learnFromUserAction({
 *       title: "Renamed project",
 *       data: { previous: { name: oldName }, next: { name: newName } },
 *     });
 *   };
 *
 *   // ...
 * }
 * ```
 */
declare function useLearnFromUserActionInCurrentThread(): UseLearnFromUserActionInCurrentThreadRecorder;
//#endregion
//#region src/v2/hooks/use-attachments.d.ts
interface UseAttachmentsProps {
  config?: AttachmentsConfig;
}
interface UseAttachmentsReturn {
  /** Currently selected attachments (uploading + ready). */
  attachments: Attachment[];
  /** Whether attachments are enabled. */
  enabled: boolean;
  /** Whether the user is dragging a file over the drop zone. */
  dragOver: boolean;
  /** Ref for the hidden file input element. */
  fileInputRef: React$1.RefObject<HTMLInputElement | null>;
  /** Ref for the container element (used for scoped paste handling). */
  containerRef: React$1.RefObject<HTMLDivElement | null>;
  /** Process an array of files (validate, upload, add to state). */
  processFiles: (files: File[]) => Promise<void>;
  /** Handler for `<input type="file" onChange>`. */
  handleFileUpload: (e: React$1.ChangeEvent<HTMLInputElement>) => Promise<void>;
  /** Handler for `onDragOver` on the drop zone. */
  handleDragOver: (e: React$1.DragEvent) => void;
  /** Handler for `onDragLeave` on the drop zone. */
  handleDragLeave: (e: React$1.DragEvent) => void;
  /** Handler for `onDrop` on the drop zone. */
  handleDrop: (e: React$1.DragEvent) => Promise<void>;
  /** Remove an attachment by ID. */
  removeAttachment: (id: string) => void;
  /**
   * Consume ready attachments and clear the queue.
   * Returns the attachments that were ready; resets the file input.
   * No-ops if the queue is already empty (no state update triggered).
   */
  consumeAttachments: () => Attachment[];
}
/**
 * Hook that manages file attachment state — uploads, drag-and-drop, paste,
 * and lifecycle. All returned callbacks are referentially stable across
 * renders (via useCallback) to avoid destabilizing downstream memoization.
 */
declare function useAttachments({
  config
}: UseAttachmentsProps): UseAttachmentsReturn;
//#endregion
//#region src/v2/hooks/use-learning-containers.d.ts
/**
 * Arguments for {@link useLearningContainers}.
 */
interface UseLearningContainersArgs {
  /** Thread to apply the learning-container selection to. */
  threadId: string;
  /**
   * The ordered list of learning container identifiers to activate for this
   * thread. Defaults to `["project"]` on the backend when absent.
   */
  learningContainers: readonly string[];
}
/**
 * Declaratively keeps a thread's learning containers in sync by emitting
 * `set_learning_containers` annotations via the CopilotKit runtime annotate
 * endpoint (`POST ${runtimeUrl}/annotate`).
 *
 * **Emit rules:**
 * - On mount with `["project"]` (the backend default) → does NOT emit.
 *   Absence of an annotation equals the default, so the round-trip is skipped.
 * - On mount with any other value → emits immediately.
 * - On any subsequent content change (including a switch back to
 *   `["project"]`) → emits (a deliberate switch is always recorded).
 * - On unmount or threadId change → emits a reset to `["project"]`
 *   so the backend is left in a clean state for the next consumer.
 *   Changing `learningContainers` within the same thread does NOT reset the
 *   thread; only the new value is emitted.
 *
 * Content-equality is evaluated via `JSON.stringify` so a fresh array literal
 * with the same items does NOT trigger a redundant emit.
 *
 * If `runtimeUrl` is absent, all emits are silently skipped.
 *
 * @example
 * ```tsx
 * function ThreadPane({ threadId, userScope }: Props) {
 *   useLearningContainers({
 *     threadId,
 *     learningContainers: [userScope],
 *   });
 *   // ...
 * }
 * ```
 */
declare function useLearningContainers({
  threadId,
  learningContainers
}: UseLearningContainersArgs): void;
//#endregion
//#region src/v2/hooks/use-learning-containers-in-current-thread.d.ts
/**
 * Arguments for {@link useLearningContainersInCurrentThread}.
 * Same as {@link UseLearningContainersArgs} minus `threadId`, which is
 * sourced from the surrounding `<CopilotChatConfigurationProvider>` at
 * render time.
 */
type UseLearningContainersInCurrentThreadArgs = Omit<UseLearningContainersArgs, "threadId">;
/**
 * Declaratively keeps the **current chat thread's** learning containers in
 * sync. The `threadId` is sourced from the surrounding
 * `<CopilotChatConfigurationProvider>` (the same provider `<CopilotChat>`,
 * `<CopilotSidebar>`, and friends set up), so callers in a chat-aware
 * subtree don't need to thread an id through manually.
 *
 * **Throws on render** when there is no chat-config provider in scope or
 * when the provider does not yet have an active `threadId`. Mount the hook
 * inside a subtree that is guaranteed to have a thread context.
 *
 * If you need to manage an explicit thread, use {@link useLearningContainers}
 * directly — two hooks, two crisp contracts, no mode confusion.
 *
 * @throws When no `CopilotChatConfigurationProvider` is in scope or when the
 *         active `threadId` is absent/empty.
 *
 * @example
 * ```tsx
 * function ThreadPanel({ scope }: Props) {
 *   useLearningContainersInCurrentThread({
 *     learningContainers: [scope],
 *   });
 *   // ...
 * }
 * ```
 */
declare function useLearningContainersInCurrentThread({
  learningContainers
}: UseLearningContainersInCurrentThreadArgs): void;
//#endregion
//#region src/v2/lib/react-core.d.ts
interface CopilotKitCoreReactConfig extends CopilotKitCoreConfig {
  renderToolCalls?: ReactToolCallRenderer<any>[];
  renderActivityMessages?: ReactActivityMessageRenderer<any>[];
  renderCustomMessages?: ReactCustomMessageRenderer[];
}
interface CopilotKitCoreReactSubscriber extends CopilotKitCoreSubscriber {
  onRenderToolCallsChanged?: (event: {
    copilotkit: CopilotKitCore;
    renderToolCalls: ReactToolCallRenderer<any>[];
  }) => void | Promise<void>;
  onInterruptElementChanged?: (event: {
    copilotkit: CopilotKitCore;
    interruptElement: React$1.ReactElement | null;
  }) => void | Promise<void>;
}
declare class CopilotKitCoreReact extends CopilotKitCore {
  private _renderToolCalls;
  private _hookRenderToolCalls;
  private _cachedMergedRenderToolCalls;
  private _renderCustomMessages;
  private _renderActivityMessages;
  private _interruptElement;
  constructor(config: CopilotKitCoreReactConfig);
  get renderCustomMessages(): Readonly<ReactCustomMessageRenderer[]>;
  get renderActivityMessages(): Readonly<ReactActivityMessageRenderer<any>>[];
  get renderToolCalls(): Readonly<ReactToolCallRenderer<any>>[];
  setRenderActivityMessages(renderers: ReactActivityMessageRenderer<any>[]): void;
  setRenderCustomMessages(renderers: ReactCustomMessageRenderer[]): void;
  setRenderToolCalls(renderToolCalls: ReactToolCallRenderer<any>[]): void;
  addHookRenderToolCall(entry: ReactToolCallRenderer<any>): void;
  removeHookRenderToolCall(name: string, agentId?: string): void;
  private _notifyRenderToolCallsChanged;
  get interruptElement(): React$1.ReactElement | null;
  setInterruptElement(element: React$1.ReactElement | null): void;
  subscribe(subscriber: CopilotKitCoreReactSubscriber): CopilotKitCoreSubscription;
  /**
   * Wait for pending React state updates before the follow-up agent run.
   *
   * When a frontend tool handler calls setState(), React 18 batches the update
   * and schedules a commit via its internal scheduler (MessageChannel). The
   * useAgentContext hook registers context via useLayoutEffect, which runs
   * synchronously after React commits that batch.
   *
   * Awaiting a zero-delay timeout yields to the macrotask queue. React's
   * MessageChannel task runs first, committing the pending state and running
   * useLayoutEffect (which updates the context store). The follow-up runAgent
   * call then reads fresh context.
   */
  waitForPendingFrameworkUpdates(): Promise<void>;
}
//#endregion
//#region src/v2/context.d.ts
interface CopilotKitContextValue {
  copilotkit: CopilotKitCoreReact;
  /**
   * Set of tool call IDs currently being executed.
   * This is tracked at the provider level to ensure tool execution events
   * are captured even before child components mount.
   */
  executingToolCallIds: ReadonlySet<string>;
}
declare const useCopilotKit: () => CopilotKitContextValue;
//#endregion
//#region src/v2/a2ui/A2UIRecoveryStates.d.ts
/**
 * Shared pre-paint lifecycle states for the A2UI surface renderer (OSS-162).
 *
 * The A2UI middleware drives the WHOLE generative-UI lifecycle on a single
 * `a2ui-surface` activity (one stable messageId, `replace: true`), so the states
 * below swap IN PLACE and the painted surface ultimately replaces them:
 *
 *   building  → animated skeleton + "Building interface" (+ optional ~N tokens)
 *   retrying  → same skeleton; once perceptible, the sub-label becomes
 *               "Retrying generation… (N/M attempts)" (threshold-gated so a fast
 *               transient retry never flashes), with debug detail per debugExposure
 *   failed    → a clean hard-failure card (replacing the skeleton), developer
 *               detail tucked into an expander gated by debugExposure
 *   painted   → the surface renderer owns the UI (these states render nothing)
 *
 * Timing (`showAfterMs` / `showAfterAttempts`) and how much debug detail to surface
 * (`debugExposure`) are client concerns; the server can override `debugExposure`
 * by stamping it onto the activity content (it wins over the client option).
 */
type A2UIRecoveryRendererOptions = {
  /** Delay (ms) before the "Retrying…" sub-label becomes visible. Default 2000. */showAfterMs?: number; /** Show the "Retrying…" sub-label immediately once `attempt` reaches this. Default 2. */
  showAfterAttempts?: number; /** How much retry/debug detail to surface. Default "collapsed". */
  debugExposure?: "hidden" | "collapsed" | "verbose";
};
//#endregion
//#region src/v2/providers/CopilotKitProvider.d.ts
interface CopilotKitProviderProps {
  children: ReactNode;
  runtimeUrl?: string;
  headers?: Record<string, string> | (() => Record<string, string>);
  /**
   * Credentials mode for fetch requests (e.g., "include" for HTTP-only cookies in cross-origin requests).
   */
  credentials?: RequestCredentials;
  /**
   * The Copilot Cloud public API key.
   */
  publicApiKey?: string;
  /**
   * Alias for `publicApiKey`
   **/
  publicLicenseKey?: string;
  /**
   * Signed license token for offline verification of premium features.
   * Obtain from https://cloud.copilotkit.ai.
   */
  licenseToken?: string;
  properties?: Record<string, unknown>;
  useSingleEndpoint?: boolean;
  agents__unsafe_dev_only?: Record<string, AbstractAgent>;
  selfManagedAgents?: Record<string, AbstractAgent>;
  renderToolCalls?: ReactToolCallRenderer<any>[];
  renderActivityMessages?: ReactActivityMessageRenderer<any>[];
  renderCustomMessages?: ReactCustomMessageRenderer[];
  frontendTools?: ReactFrontendTool[];
  humanInTheLoop?: ReactHumanInTheLoop[];
  /**
   * Configuration for OpenGenerativeUI — sandboxed UI generated by the LLM.
   *
   * @example
   * ```tsx
   * <CopilotKit
   *   runtimeUrl="/api/copilotkit"
   *   openGenerativeUI={{
   *     sandboxFunctions: [{ name: "addToCart", description: "…", parameters: schema, handler: fn }],
   *   }}
   * >
   * ```
   */
  openGenerativeUI?: {
    /**
     * Functions made available inside sandboxed iframes.
     * Each function is described to the LLM via agent context and exposed
     * via websandbox's `localApi`.
     *
     * Inside the iframe, call them with:
     * ```js
     * await Websandbox.connection.remote.<functionName>(args)
     * ```
     */
    sandboxFunctions?: SandboxFunction[];
    /**
     * Design guidelines injected as agent context for the `generateSandboxedUi` tool.
     * Override this to control the visual style of generated UIs.
     *
     * A sensible default is provided if omitted.
     */
    designSkill?: string;
  };
  showDevConsole?: boolean | "auto";
  /**
   * Error handler called when CopilotKit encounters an error.
   * Fires for all error types (runtime connection failures, agent errors, tool errors).
   */
  onError?: (event: {
    error: Error;
    code: CopilotKitCoreErrorCode;
    context: Record<string, any>;
  }) => void | Promise<void>;
  /**
   * Configuration for the A2UI (Agent-to-UI) renderer.
   * The built-in A2UI renderer is activated automatically when the runtime reports
   * that `a2ui` is configured in `CopilotRuntime`. This prop is optional and only
   * needed if you want to override the default theme.
   *
   * @example
   * ```tsx
   * <CopilotKit runtimeUrl="/api/copilotkit" a2ui={{ theme: myCustomTheme }}>
   *   {children}
   * </CopilotKit>
   * ```
   */
  a2ui?: {
    /**
     * Override the default A2UI viewer theme.
     * When omitted, the built-in `viewerTheme` from `@copilotkit/a2ui-renderer` is used.
     */
    theme?: Theme;
    /**
     * Optional component catalog to pass to the A2UI renderer.
     * When omitted, the default basicCatalog is used.
     */
    catalog?: any;
    /**
     * Optional custom loading component shown while an A2UI surface is generating.
     * When omitted, a default animated skeleton is shown.
     */
    loadingComponent?: React$1.ComponentType;
    /**
     * When true (the default), the full component schemas from the catalog are
     * sent as agent context so the agent knows what components and props are
     * available. The A2UI middleware can overwrite this with a server-side
     * schema if configured. Set to false to disable.
     */
    includeSchema?: boolean;
    /**
     * Options for the A2UI error-recovery status UI (OSS-162): how long before
     * the transient "Retrying…" hint appears, after how many attempts, and how
     * much retry/debug detail to surface. When omitted, sane defaults apply.
     */
    recovery?: A2UIRecoveryRendererOptions;
  };
  /**
   * Default throttle interval (in milliseconds) for `useAgent` re-renders
   * triggered by `OnMessagesChanged` notifications. This value is used as
   * a fallback when neither the `useAgent()` hook nor `<CopilotChat>` /
   * `<CopilotSidebar>` / `<CopilotPopup>` specify an explicit `throttleMs`.
   *
   * @default undefined (components/hooks without an explicit throttleMs will be unthrottled)
   */
  defaultThrottleMs?: number;
  /**
   * Default anchor corner for the inspector button and window.
   * Only used on first load before the user drags to a custom position.
   * Defaults to `{ horizontal: "right", vertical: "top" }`.
   */
  inspectorDefaultAnchor?: Anchor;
  /**
   * Enable debug logging for the client-side event pipeline.
   */
  debug?: DebugConfig;
}
declare const CopilotKitProvider: React$1.FC<CopilotKitProviderProps>;
//#endregion
//#region src/v2/providers/SandboxFunctionsContext.d.ts
declare const SandboxFunctionsContext: react.Context<readonly SandboxFunction[]>;
declare function useSandboxFunctions(): readonly SandboxFunction[];
//#endregion
//#region src/v2/a2ui/A2UIMessageRenderer.d.ts
/**
 * User action with dataContextPath, as dispatched by A2UI components.
 */
type A2UIUserAction = {
  name: string;
  sourceComponentId: string;
  surfaceId: string;
  timestamp: string;
  context?: Record<string, unknown>;
  dataContextPath?: string;
};
type A2UIMessageRendererOptions = {
  theme: Theme; /** Optional component catalog to pass to A2UIProvider */
  catalog?: any; /** Optional custom loading component shown while the A2UI surface is building. */
  loadingComponent?: React.ComponentType;
  /**
   * Pre-paint recovery/loading UX options (OSS-162): timing before the
   * "Retrying…" sub-label appears + how much retry/debug detail to surface.
   */
  recovery?: A2UIRecoveryRendererOptions;
};
declare function createA2UIMessageRenderer(options: A2UIMessageRendererOptions): ReactActivityMessageRenderer<any>;
//#endregion
//#region src/components/copilot-provider/copilotkit-props.d.ts
/**
 * Props for CopilotKit.
 */
/**
 * We shouldn't need this `Omit` here, but using it because `CopilotKitProps`
 * and `CopilotKitProviderProps` have non-identical `children` types
 *
 * TODO: Remove this `Omit` once this is resolved.
 */
interface CopilotKitProps extends Omit<CopilotKitProviderProps, "children"> {
  /**
   * Your Copilot Cloud API key.
   *
   * Don't have it yet? Go to https://cloud.copilotkit.ai and get one for free.
   */
  publicApiKey?: string;
  /**
   * Your public license key for accessing premium CopilotKit features.
   *
   * Don't have it yet? Go to https://cloud.copilotkit.ai and get one for free.
   */
  publicLicenseKey?: string;
  /**
   * Restrict input to a specific topic.
   * @deprecated Use `guardrails_c` instead to control input restrictions
   */
  cloudRestrictToTopic?: {
    validTopics?: string[];
    invalidTopics?: string[];
  };
  /**
   * Restrict input to specific topics using guardrails.
   * @remarks
   *
   * This feature is only available when using CopilotKit's hosted cloud service. To use this feature, sign up at https://cloud.copilotkit.ai to get your publicApiKey. The feature allows restricting chat conversations to specific topics.
   */
  guardrails_c?: {
    validTopics?: string[];
    invalidTopics?: string[];
  };
  /**
   * The endpoint for the Copilot Runtime instance. [Click here for more information](/concepts/copilot-runtime).
   */
  runtimeUrl?: 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.
   * Can be a static object or a function that returns headers dynamically
   * (useful for refreshing auth tokens).
   *
   * For example:
   * ```tsx
   * // Static headers
   * headers={{ "Authorization": "Bearer X" }}
   *
   * // Dynamic headers (re-evaluated on each render)
   * headers={() => ({ "Authorization": `Bearer ${getToken()}` })}
   * ```
   */
  headers?: Record<string, string> | (() => Record<string, string>);
  /**
   * The children to be rendered within the CopilotKit.
   */
  children: ReactNode;
  /**
   * Custom properties to be sent with the request.
   * Can include threadMetadata for thread creation and authorization for LangGraph Platform authentication.
   * For example:
   * ```js
   * {
   *   'user_id': 'users_id',
   *   'authorization': 'your-auth-token', // For LangGraph Platform authentication
   *   threadMetadata: {
   *     'account_id': '123',
   *     'user_type': 'premium'
   *   }
   * }
   * ```
   *
   * **Note**: The `authorization` property is automatically forwarded to LangGraph agents. See the [LangGraph Agent Authentication Guide](/coagents/shared/guides/langgraph-platform-authentication) for details.
   */
  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.
   *
   * To enable HTTP-only cookie authentication, set `credentials="include"` and configure
   * CORS on your runtime endpoint:
   *
   * ```tsx
   * // Frontend (https://myapp.com)
   * <CopilotKit runtimeUrl="https://api.myapp.com/copilotkit" credentials="include">
   *   {children}
   * </CopilotKit>
   *
   * // Backend (https://api.myapp.com)
   * copilotRuntimeNextJSAppRouterEndpoint({
   *   runtime,
   *   endpoint: "/copilotkit",
   *   cors: {
   *     origin: "https://myapp.com",
   *     credentials: true,
   *   },
   * });
   * ```
   */
  credentials?: RequestCredentials;
  /**
   * Whether to show the dev console (error banners and toasts).
   *
   * @deprecated Use `enableInspector` to control the AG-UI inspector,
   * which is what most users want. `showDevConsole` only controls
   * error toasts/banners, not the inspector button.
   * Defaults to `false` for production safety.
   */
  showDevConsole?: boolean;
  /**
   * The name of the agent to use.
   */
  agent?: string;
  /**
   * The forwarded parameters to use for the task.
   */
  forwardedParameters?: Pick<ForwardedParametersInput, "temperature">;
  /**
   * The auth config to use for the CopilotKit.
   * @remarks
   *
   * This feature is only available when using CopilotKit's hosted cloud service. To use this feature, sign up at https://cloud.copilotkit.ai to get your publicApiKey. The feature allows restricting chat conversations to specific topics.
   */
  authConfig_c?: {
    SignInComponent: React.ComponentType<{
      onSignInComplete: (authState: AuthState) => void;
    }>;
  };
  /**
   * The thread id to use for the CopilotKit.
   */
  threadId?: string;
  /**
   * Optional error handler for comprehensive debugging and observability.
   *
   * **Requires publicApiKey**: Error handling only works when publicApiKey is provided.
   * This is a premium Copilot Cloud feature.
   *
   * @param errorEvent - Structured error event with rich debugging context
   *
   * @example
   * ```typescript
   * <CopilotKit
   *   publicApiKey="ck_pub_your_key"
   *   onError={(errorEvent) => {
   *     debugDashboard.capture(errorEvent);
   *   }}
   * >
   * ```
   */
  onError?: CopilotErrorHandler;
  /**
   * Enable or disable the CopilotKit Inspector, letting you inspect AG-UI events,
   * view agent messages, check agent state, and visualize agent context. Defaults
   * to enabled.
   */
  enableInspector?: boolean;
  /**
   * Enable debug logging. On the server (`CopilotRuntime`), this enables
   * structured Pino logging of the AG-UI event pipeline. On the client,
   * this configuration is forwarded to the AG-UI transport layer
   * (`transformChunks`) for transport-level debug output.
   *
   * Pass `true` for full output, or an object for granular control:
   *
   * ```tsx
   * <CopilotKit debug={true} runtimeUrl="...">
   *   {children}
   * </CopilotKit>
   * ```
   */
  debug?: DebugConfig;
}
//#endregion
//#region src/components/copilot-provider/copilotkit.d.ts
declare function CopilotKit({
  children,
  ...props
}: CopilotKitProps): react_jsx_runtime0.JSX.Element;
declare const defaultCopilotContextCategories: string[];
//#endregion
export { InterruptEvent as $, CopilotChatSuggestionPill as $t, UseLearnFromUserActionRecorder as A, LangGraphInterruptRenderHandlerProps as An, CopilotSidebarViewProps as At, AgentContextInput as B, SystemMessageFunction as Bn, CopilotChatViewProps as Bt, UseAttachmentsReturn as C, CopilotContextParams as Cn, CopilotPopup as Ct, useLearnFromUserActionInCurrentThread as D, LangGraphInterruptActionSetter as Dn, CopilotPopupView as Dt, UseLearnFromUserActionInCurrentThreadRecorder as E, LangGraphInterruptAction as En, CopilotSidebarProps as Et, useThreads as F, CrewsResponseStatus as Fn, DefaultCloseIcon as Ft, useAgent as G, ActionRenderPropsNoArgs as Gn, IntelligenceIndicator as Gt, useAgentContext as H, Tree as Hn, CopilotChatMessageView as Ht, UseInterruptConfig as I, CrewsStateItem as In, DefaultOpenIcon as It, useRenderTool as J, CatchAllActionRenderProps as Jn, IntelligenceIndicatorStatus as Jt, useHumanInTheLoop as K, ActionRenderPropsNoArgsWait as Kn, IntelligenceIndicatorProps as Kt, useInterrupt as L, CrewsTaskStateItem as Ln, CopilotChat as Lt, Thread as M, QueuedInterruptEvent as Mn, CopilotModalHeaderProps as Mt, UseThreadsInput as N, CrewsAgentState as Nn, CopilotChatToggleButton as Nt, LearnFromUserActionInput as O, LangGraphInterruptActionSetterArgs as On, CopilotPopupViewProps as Ot, UseThreadsResult as P, CrewsResponse as Pn, CopilotChatToggleButtonProps as Pt, SandboxFunction as Q, RenderFunctionStatus as Qn, CopilotChatSuggestionViewProps as Qt, useConfigureSuggestions as R, CrewsToolStateItem as Rn, CopilotChatProps as Rt, UseAttachmentsProps as S, CopilotContext as Sn, CopilotChatAttachmentQueue as St, LearnFromUserActionInCurrentThreadInput as T, CoAgentStateRender as Tn, CopilotSidebar as Tt, useCapabilities as U, TreeNode as Un, CopilotChatMessageViewProps as Ut, JsonSerializable as V, DocumentPointer as Vn, AutoScrollMode as Vt, UseAgentUpdate as W, ActionRenderProps as Wn, INTELLIGENCE_TURN_HEAD as Wt, useFrontendTool as X, FrontendAction as Xn, IntelligenceIndicatorViewProps as Xt, useComponent as Y, CatchAllFrontendAction as Yn, IntelligenceIndicatorView as Yt, useRenderActivityMessage as Z, FrontendActionAvailability as Zn, CopilotChatSuggestionView as Zt, CopilotKitCoreReactSubscriber as _, AudioRecorderError as _n, WildcardToolCallRender as _t, A2UIUserAction as a, CopilotChatAssistantMessage as an, ReactActivityMessageRenderer as at, UseLearningContainersArgs as b, CoagentInChatRenderFunction as bn, AttachmentsConfig$1 as bt, SandboxFunctionsContext as c, CopilotChatToolCallsViewProps as cn, ReactCustomMessageRenderer as ct, CopilotKitProviderProps as d, ToolsMenuItem as dn, MCPAppsActivityContent as dt, CopilotChatSuggestionPillProps as en, InterruptHandlerProps as et, A2UIRecoveryRendererOptions as f, CopilotChatConfigurationProvider as fn, MCPAppsActivityContentSchema as ft, CopilotKitCoreReactConfig as g, useCopilotChatConfiguration as gn, CopilotKitInspectorProps as gt, CopilotKitCoreReact as h, CopilotChatLabels as hn, CopilotKitInspector as ht, A2UIMessageRendererOptions as i, CopilotChatUserMessageProps as in, ReactFrontendTool as it, useLearnFromUserAction as j, LangGraphInterruptRenderProps as jn, CopilotModalHeader as jt, LearnFromUserActionResult as k, LangGraphInterruptRender as kn, CopilotSidebarView as kt, useSandboxFunctions as l, CopilotChatInput as ln, ReactCustomMessageRendererPosition as lt, useCopilotKit as m, CopilotChatConfigurationValue as mn, MCPAppsActivityType as mt, defaultCopilotContextCategories as n, CopilotChatReasoningMessageProps as nn, defineToolCallRenderer as nt, createA2UIMessageRenderer as o, CopilotChatAssistantMessageProps as on, ReactToolCallRenderer as ot, CopilotKitContextValue as p, CopilotChatConfigurationProviderProps as pn, MCPAppsActivityRenderer as pt, useDefaultRenderTool as q, ActionRenderPropsWait as qn, getIntelligenceTurnAnchors as qt, CopilotKitProps as r, CopilotChatUserMessage as rn, ReactHumanInTheLoop as rt, InspectorAnchor as s, CopilotChatToolCallsView as sn, useRenderCustomMessages as st, CopilotKit as t, CopilotChatReasoningMessage as tn, InterruptRenderProps as tt, CopilotKitProvider as u, CopilotChatInputProps as un, useRenderToolCall as ut, UseLearningContainersInCurrentThreadArgs as v, AudioRecorderState as vn, Attachment$1 as vt, useAttachments as w, useCopilotContext as wn, CopilotPopupProps as wt, useLearningContainers as x, CopilotApiConfig as xn, CopilotChatAttachmentRenderer as xt, useLearningContainersInCurrentThread as y, CopilotChatAudioRecorder as yn, AttachmentModality as yt, useSuggestions as z, CopilotChatSuggestionConfiguration as zn, CopilotChatView as zt };
//# sourceMappingURL=copilotkit-DqDT5RLa.d.mts.map