@copilotkit/react-core 1.55.3 → 1.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/{copilotkit-Cd-NrDyp.mjs → copilotkit-BebqQrYT.mjs} +94 -44
  2. package/dist/copilotkit-BebqQrYT.mjs.map +1 -0
  3. package/dist/{copilotkit-Dgdpbqjt.cjs → copilotkit-Cvb6WpAX.cjs} +98 -42
  4. package/dist/copilotkit-Cvb6WpAX.cjs.map +1 -0
  5. package/dist/{copilotkit-dwDWYpya.d.cts → copilotkit-Dv8zU8_U.d.cts} +47 -10
  6. package/dist/copilotkit-Dv8zU8_U.d.cts.map +1 -0
  7. package/dist/{copilotkit-BuhSUZHb.d.mts → copilotkit-f2Uq0RwG.d.mts} +47 -10
  8. package/dist/copilotkit-f2Uq0RwG.d.mts.map +1 -0
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.d.cts +1 -1
  11. package/dist/index.d.mts +1 -1
  12. package/dist/index.mjs +1 -1
  13. package/dist/index.umd.js +41 -17
  14. package/dist/index.umd.js.map +1 -1
  15. package/dist/v2/index.cjs +2 -1
  16. package/dist/v2/index.d.cts +2 -2
  17. package/dist/v2/index.d.mts +2 -2
  18. package/dist/v2/index.mjs +2 -2
  19. package/dist/v2/index.umd.js +92 -42
  20. package/dist/v2/index.umd.js.map +1 -1
  21. package/package.json +6 -6
  22. package/src/components/copilot-provider/__tests__/error-visibility-prod.test.tsx +70 -0
  23. package/src/components/copilot-provider/copilot-messages.tsx +39 -24
  24. package/src/components/copilot-provider/copilotkit-props.tsx +26 -6
  25. package/src/components/copilot-provider/copilotkit.tsx +4 -1
  26. package/src/v2/components/chat/CopilotChatAssistantMessage.tsx +18 -15
  27. package/src/v2/components/chat/CopilotChatReasoningMessage.tsx +17 -4
  28. package/src/v2/components/chat/CopilotChatUserMessage.tsx +13 -10
  29. package/src/v2/components/chat/__tests__/CopilotChat.e2e.test.tsx +131 -5
  30. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.test.tsx +1 -1
  31. package/src/v2/components/chat/__tests__/CopilotChatCopyButton.clipboard.test.tsx +241 -0
  32. package/src/v2/hooks/__tests__/use-agent-throttle.test.tsx +10 -10
  33. package/src/v2/hooks/__tests__/use-capabilities.test.tsx +76 -0
  34. package/src/v2/hooks/index.ts +1 -0
  35. package/src/v2/hooks/use-agent.tsx +23 -4
  36. package/src/v2/hooks/use-capabilities.tsx +25 -0
  37. package/src/v2/providers/CopilotKitProvider.tsx +15 -2
  38. package/dist/copilotkit-BuhSUZHb.d.mts.map +0 -1
  39. package/dist/copilotkit-Cd-NrDyp.mjs.map +0 -1
  40. package/dist/copilotkit-Dgdpbqjt.cjs.map +0 -1
  41. package/dist/copilotkit-dwDWYpya.d.cts.map +0 -1
package/dist/v2/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_copilotkit = require('../copilotkit-Dgdpbqjt.cjs');
4
+ const require_copilotkit = require('../copilotkit-Cvb6WpAX.cjs');
5
5
  require("./index.css");
6
6
  let _copilotkit_a2ui_renderer = require("@copilotkit/a2ui-renderer");
7
7
 
@@ -69,6 +69,7 @@ exports.defineToolCallRenderer = require_copilotkit.defineToolCallRenderer;
69
69
  exports.useAgent = require_copilotkit.useAgent;
70
70
  exports.useAgentContext = require_copilotkit.useAgentContext;
71
71
  exports.useAttachments = require_copilotkit.useAttachments;
72
+ exports.useCapabilities = require_copilotkit.useCapabilities;
72
73
  exports.useComponent = require_copilotkit.useComponent;
73
74
  exports.useConfigureSuggestions = require_copilotkit.useConfigureSuggestions;
74
75
  exports.useCopilotChatConfiguration = require_copilotkit.useCopilotChatConfiguration;
@@ -1,6 +1,6 @@
1
- import { $ as MCPAppsActivityContentSchema, A as useAgentContext, At as CopilotChatSuggestionView, B as InterruptEvent, Bt as CopilotChatToolCallsView, C as useThreads, Ct as DefaultOpenIcon, D as useSuggestions, Dt as CopilotChatViewProps, E as useConfigureSuggestions, Et as CopilotChatView, F as useRenderTool, Ft as CopilotChatReasoningMessageProps, G as ReactFrontendTool, Gt as CopilotChatConfigurationProvider, H as InterruptRenderProps, Ht as CopilotChatInput, I as useComponent, It as CopilotChatUserMessage, J as useRenderCustomMessages, Jt as CopilotChatLabels, K as ReactActivityMessageRenderer, Kt as CopilotChatConfigurationProviderProps, L as useFrontendTool, Lt as CopilotChatUserMessageProps, M as useAgent, Mt as CopilotChatSuggestionPill, N as useHumanInTheLoop, Nt as CopilotChatSuggestionPillProps, O as AgentContextInput, Ot as CopilotChatMessageView, P as useDefaultRenderTool, Pt as CopilotChatReasoningMessage, Q as MCPAppsActivityContent, Qt as CopilotChatAudioRecorder, R as useRenderActivityMessage, Rt as CopilotChatAssistantMessage, S as UseThreadsResult, St as DefaultCloseIcon, T as useInterrupt, Tt as CopilotChatProps, U as defineToolCallRenderer, Ut as CopilotChatInputProps, V as InterruptHandlerProps, Vt as CopilotChatToolCallsViewProps, W as ReactHumanInTheLoop, Wt as ToolsMenuItem, X as ReactCustomMessageRendererPosition, Xt as AudioRecorderError, Y as ReactCustomMessageRenderer, Yt as useCopilotChatConfiguration, Z as useRenderToolCall, Zt as AudioRecorderState, _ as UseAttachmentsProps, _t as CopilotSidebarViewProps, a as A2UIUserAction, at as Attachment, b as Thread, bt as CopilotChatToggleButton, c as SandboxFunctionsContext, ct as CopilotChatAttachmentRenderer, d as CopilotKitProvider, dt as CopilotPopupProps, et as MCPAppsActivityRenderer, f as CopilotKitProviderProps, ft as CopilotSidebar, g as CopilotKitCoreReactSubscriber, gt as CopilotSidebarView, h as CopilotKitCoreReactConfig, ht as CopilotPopupViewProps, i as A2UIMessageRendererOptions, it as WildcardToolCallRender, j as UseAgentUpdate, jt as CopilotChatSuggestionViewProps, k as JsonSerializable, kt as CopilotChatMessageViewProps, l as useSandboxFunctions, lt as CopilotChatAttachmentQueue, m as CopilotKitCoreReact, mt as CopilotPopupView, nt as CopilotKitInspector, o as createA2UIMessageRenderer, ot as AttachmentModality, p as useCopilotKit, pt as CopilotSidebarProps, q as ReactToolCallRenderer, qt as CopilotChatConfigurationValue, r as CopilotKitProps, rt as CopilotKitInspectorProps, s as InspectorAnchor, st as AttachmentsConfig, t as CopilotKit, tt as MCPAppsActivityType, u as CopilotKitContextValue, ut as CopilotPopup, v as UseAttachmentsReturn, vt as CopilotModalHeader, w as UseInterruptConfig, wt as CopilotChat, x as UseThreadsInput, xt as CopilotChatToggleButtonProps, y as useAttachments, yt as CopilotModalHeaderProps, z as SandboxFunction, zt as CopilotChatAssistantMessageProps } from "../copilotkit-dwDWYpya.cjs";
1
+ import { $ as MCPAppsActivityContent, $t as CopilotChatAudioRecorder, A as useAgentContext, At as CopilotChatMessageViewProps, B as SandboxFunction, Bt as CopilotChatAssistantMessageProps, C as useThreads, Ct as DefaultCloseIcon, D as useSuggestions, Dt as CopilotChatView, E as useConfigureSuggestions, Et as CopilotChatProps, F as useDefaultRenderTool, Ft as CopilotChatReasoningMessage, G as ReactHumanInTheLoop, Gt as ToolsMenuItem, H as InterruptHandlerProps, Ht as CopilotChatToolCallsViewProps, I as useRenderTool, It as CopilotChatReasoningMessageProps, J as ReactToolCallRenderer, Jt as CopilotChatConfigurationValue, K as ReactFrontendTool, Kt as CopilotChatConfigurationProvider, L as useComponent, Lt as CopilotChatUserMessage, M as UseAgentUpdate, Mt as CopilotChatSuggestionViewProps, N as useAgent, Nt as CopilotChatSuggestionPill, O as AgentContextInput, Ot as CopilotChatViewProps, P as useHumanInTheLoop, Pt as CopilotChatSuggestionPillProps, Q as useRenderToolCall, Qt as AudioRecorderState, R as useFrontendTool, Rt as CopilotChatUserMessageProps, S as UseThreadsResult, St as CopilotChatToggleButtonProps, T as useInterrupt, Tt as CopilotChat, U as InterruptRenderProps, Ut as CopilotChatInput, V as InterruptEvent, Vt as CopilotChatToolCallsView, W as defineToolCallRenderer, Wt as CopilotChatInputProps, X as ReactCustomMessageRenderer, Xt as useCopilotChatConfiguration, Y as useRenderCustomMessages, Yt as CopilotChatLabels, Z as ReactCustomMessageRendererPosition, Zt as AudioRecorderError, _ as UseAttachmentsProps, _t as CopilotSidebarView, a as A2UIUserAction, at as WildcardToolCallRender, b as Thread, bt as CopilotModalHeaderProps, c as SandboxFunctionsContext, ct as AttachmentsConfig, d as CopilotKitProvider, dt as CopilotPopup, et as MCPAppsActivityContentSchema, f as CopilotKitProviderProps, ft as CopilotPopupProps, g as CopilotKitCoreReactSubscriber, gt as CopilotPopupViewProps, h as CopilotKitCoreReactConfig, ht as CopilotPopupView, i as A2UIMessageRendererOptions, it as CopilotKitInspectorProps, j as useCapabilities, jt as CopilotChatSuggestionView, k as JsonSerializable, kt as CopilotChatMessageView, l as useSandboxFunctions, lt as CopilotChatAttachmentRenderer, m as CopilotKitCoreReact, mt as CopilotSidebarProps, nt as MCPAppsActivityType, o as createA2UIMessageRenderer, ot as Attachment, p as useCopilotKit, pt as CopilotSidebar, q as ReactActivityMessageRenderer, qt as CopilotChatConfigurationProviderProps, r as CopilotKitProps, rt as CopilotKitInspector, s as InspectorAnchor, st as AttachmentModality, t as CopilotKit, tt as MCPAppsActivityRenderer, u as CopilotKitContextValue, ut as CopilotChatAttachmentQueue, v as UseAttachmentsReturn, vt as CopilotSidebarViewProps, w as UseInterruptConfig, wt as DefaultOpenIcon, x as UseThreadsInput, xt as CopilotChatToggleButton, y as useAttachments, yt as CopilotModalHeader, z as useRenderActivityMessage, zt as CopilotChatAssistantMessage } from "../copilotkit-Dv8zU8_U.cjs";
2
2
  import "./index.css";
3
3
  import { Theme as A2UITheme, defaultTheme as a2uiDefaultTheme } from "@copilotkit/a2ui-renderer";
4
4
  export * from "@copilotkit/core";
5
5
  export * from "@ag-ui/client";
6
- export { type A2UIMessageRendererOptions, type A2UITheme, type A2UIUserAction, AgentContextInput, Attachment, AttachmentModality, AttachmentsConfig, AudioRecorderError, AudioRecorderState, CopilotChat, CopilotChatAssistantMessage, CopilotChatAssistantMessageProps, CopilotChatAttachmentQueue, CopilotChatAttachmentRenderer, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, CopilotChatConfigurationProviderProps, CopilotChatConfigurationValue, CopilotChatInput, CopilotChatInputProps, CopilotChatLabels, CopilotChatMessageView, CopilotChatMessageViewProps, CopilotChatProps, CopilotChatReasoningMessage, CopilotChatReasoningMessageProps, CopilotChatSuggestionPill, CopilotChatSuggestionPillProps, CopilotChatSuggestionView, CopilotChatSuggestionViewProps, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, CopilotChatToggleButtonProps, CopilotChatToolCallsView, CopilotChatToolCallsViewProps, CopilotChatUserMessage, CopilotChatUserMessageProps, CopilotChatView, CopilotChatViewProps, CopilotKit, CopilotKitContextValue, CopilotKitCoreReact, CopilotKitCoreReactConfig, CopilotKitCoreReactSubscriber, CopilotKitInspector, CopilotKitInspectorProps, type CopilotKitProps, CopilotKitProvider, CopilotKitProviderProps, CopilotModalHeader, CopilotModalHeaderProps, CopilotPopup, CopilotPopupProps, CopilotPopupView, CopilotPopupViewProps, CopilotSidebar, CopilotSidebarProps, CopilotSidebarView, CopilotSidebarViewProps, InspectorAnchor, InterruptEvent, InterruptHandlerProps, InterruptRenderProps, JsonSerializable, MCPAppsActivityContent, MCPAppsActivityContentSchema, MCPAppsActivityRenderer, MCPAppsActivityType, ReactActivityMessageRenderer, ReactCustomMessageRenderer, ReactCustomMessageRendererPosition, ReactFrontendTool, ReactHumanInTheLoop, ReactToolCallRenderer, SandboxFunction, SandboxFunctionsContext, Thread, ToolsMenuItem, UseAgentUpdate, UseAttachmentsProps, UseAttachmentsReturn, UseInterruptConfig, UseThreadsInput, UseThreadsResult, WildcardToolCallRender, a2uiDefaultTheme, createA2UIMessageRenderer, defineToolCallRenderer, useAgent, useAgentContext, useAttachments, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useDefaultRenderTool, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderActivityMessage, useRenderCustomMessages, useRenderTool, useRenderToolCall, useSandboxFunctions, useSuggestions, useThreads };
6
+ export { type A2UIMessageRendererOptions, type A2UITheme, type A2UIUserAction, AgentContextInput, Attachment, AttachmentModality, AttachmentsConfig, AudioRecorderError, AudioRecorderState, CopilotChat, CopilotChatAssistantMessage, CopilotChatAssistantMessageProps, CopilotChatAttachmentQueue, CopilotChatAttachmentRenderer, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, CopilotChatConfigurationProviderProps, CopilotChatConfigurationValue, CopilotChatInput, CopilotChatInputProps, CopilotChatLabels, CopilotChatMessageView, CopilotChatMessageViewProps, CopilotChatProps, CopilotChatReasoningMessage, CopilotChatReasoningMessageProps, CopilotChatSuggestionPill, CopilotChatSuggestionPillProps, CopilotChatSuggestionView, CopilotChatSuggestionViewProps, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, CopilotChatToggleButtonProps, CopilotChatToolCallsView, CopilotChatToolCallsViewProps, CopilotChatUserMessage, CopilotChatUserMessageProps, CopilotChatView, CopilotChatViewProps, CopilotKit, CopilotKitContextValue, CopilotKitCoreReact, CopilotKitCoreReactConfig, CopilotKitCoreReactSubscriber, CopilotKitInspector, CopilotKitInspectorProps, type CopilotKitProps, CopilotKitProvider, CopilotKitProviderProps, CopilotModalHeader, CopilotModalHeaderProps, CopilotPopup, CopilotPopupProps, CopilotPopupView, CopilotPopupViewProps, CopilotSidebar, CopilotSidebarProps, CopilotSidebarView, CopilotSidebarViewProps, InspectorAnchor, InterruptEvent, InterruptHandlerProps, InterruptRenderProps, JsonSerializable, MCPAppsActivityContent, MCPAppsActivityContentSchema, MCPAppsActivityRenderer, MCPAppsActivityType, ReactActivityMessageRenderer, ReactCustomMessageRenderer, ReactCustomMessageRendererPosition, ReactFrontendTool, ReactHumanInTheLoop, ReactToolCallRenderer, SandboxFunction, SandboxFunctionsContext, Thread, ToolsMenuItem, UseAgentUpdate, UseAttachmentsProps, UseAttachmentsReturn, UseInterruptConfig, UseThreadsInput, UseThreadsResult, WildcardToolCallRender, a2uiDefaultTheme, createA2UIMessageRenderer, defineToolCallRenderer, useAgent, useAgentContext, useAttachments, useCapabilities, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useDefaultRenderTool, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderActivityMessage, useRenderCustomMessages, useRenderTool, useRenderToolCall, useSandboxFunctions, useSuggestions, useThreads };
@@ -1,6 +1,6 @@
1
- import { $ as MCPAppsActivityContentSchema, A as useAgentContext, At as CopilotChatSuggestionView, B as InterruptEvent, Bt as CopilotChatToolCallsView, C as useThreads, Ct as DefaultOpenIcon, D as useSuggestions, Dt as CopilotChatViewProps, E as useConfigureSuggestions, Et as CopilotChatView, F as useRenderTool, Ft as CopilotChatReasoningMessageProps, G as ReactFrontendTool, Gt as CopilotChatConfigurationProvider, H as InterruptRenderProps, Ht as CopilotChatInput, I as useComponent, It as CopilotChatUserMessage, J as useRenderCustomMessages, Jt as CopilotChatLabels, K as ReactActivityMessageRenderer, Kt as CopilotChatConfigurationProviderProps, L as useFrontendTool, Lt as CopilotChatUserMessageProps, M as useAgent, Mt as CopilotChatSuggestionPill, N as useHumanInTheLoop, Nt as CopilotChatSuggestionPillProps, O as AgentContextInput, Ot as CopilotChatMessageView, P as useDefaultRenderTool, Pt as CopilotChatReasoningMessage, Q as MCPAppsActivityContent, Qt as CopilotChatAudioRecorder, R as useRenderActivityMessage, Rt as CopilotChatAssistantMessage, S as UseThreadsResult, St as DefaultCloseIcon, T as useInterrupt, Tt as CopilotChatProps, U as defineToolCallRenderer, Ut as CopilotChatInputProps, V as InterruptHandlerProps, Vt as CopilotChatToolCallsViewProps, W as ReactHumanInTheLoop, Wt as ToolsMenuItem, X as ReactCustomMessageRendererPosition, Xt as AudioRecorderError, Y as ReactCustomMessageRenderer, Yt as useCopilotChatConfiguration, Z as useRenderToolCall, Zt as AudioRecorderState, _ as UseAttachmentsProps, _t as CopilotSidebarViewProps, a as A2UIUserAction, at as Attachment, b as Thread, bt as CopilotChatToggleButton, c as SandboxFunctionsContext, ct as CopilotChatAttachmentRenderer, d as CopilotKitProvider, dt as CopilotPopupProps, et as MCPAppsActivityRenderer, f as CopilotKitProviderProps, ft as CopilotSidebar, g as CopilotKitCoreReactSubscriber, gt as CopilotSidebarView, h as CopilotKitCoreReactConfig, ht as CopilotPopupViewProps, i as A2UIMessageRendererOptions, it as WildcardToolCallRender, j as UseAgentUpdate, jt as CopilotChatSuggestionViewProps, k as JsonSerializable, kt as CopilotChatMessageViewProps, l as useSandboxFunctions, lt as CopilotChatAttachmentQueue, m as CopilotKitCoreReact, mt as CopilotPopupView, nt as CopilotKitInspector, o as createA2UIMessageRenderer, ot as AttachmentModality, p as useCopilotKit, pt as CopilotSidebarProps, q as ReactToolCallRenderer, qt as CopilotChatConfigurationValue, r as CopilotKitProps, rt as CopilotKitInspectorProps, s as InspectorAnchor, st as AttachmentsConfig, t as CopilotKit, tt as MCPAppsActivityType, u as CopilotKitContextValue, ut as CopilotPopup, v as UseAttachmentsReturn, vt as CopilotModalHeader, w as UseInterruptConfig, wt as CopilotChat, x as UseThreadsInput, xt as CopilotChatToggleButtonProps, y as useAttachments, yt as CopilotModalHeaderProps, z as SandboxFunction, zt as CopilotChatAssistantMessageProps } from "../copilotkit-BuhSUZHb.mjs";
1
+ import { $ as MCPAppsActivityContent, $t as CopilotChatAudioRecorder, A as useAgentContext, At as CopilotChatMessageViewProps, B as SandboxFunction, Bt as CopilotChatAssistantMessageProps, C as useThreads, Ct as DefaultCloseIcon, D as useSuggestions, Dt as CopilotChatView, E as useConfigureSuggestions, Et as CopilotChatProps, F as useDefaultRenderTool, Ft as CopilotChatReasoningMessage, G as ReactHumanInTheLoop, Gt as ToolsMenuItem, H as InterruptHandlerProps, Ht as CopilotChatToolCallsViewProps, I as useRenderTool, It as CopilotChatReasoningMessageProps, J as ReactToolCallRenderer, Jt as CopilotChatConfigurationValue, K as ReactFrontendTool, Kt as CopilotChatConfigurationProvider, L as useComponent, Lt as CopilotChatUserMessage, M as UseAgentUpdate, Mt as CopilotChatSuggestionViewProps, N as useAgent, Nt as CopilotChatSuggestionPill, O as AgentContextInput, Ot as CopilotChatViewProps, P as useHumanInTheLoop, Pt as CopilotChatSuggestionPillProps, Q as useRenderToolCall, Qt as AudioRecorderState, R as useFrontendTool, Rt as CopilotChatUserMessageProps, S as UseThreadsResult, St as CopilotChatToggleButtonProps, T as useInterrupt, Tt as CopilotChat, U as InterruptRenderProps, Ut as CopilotChatInput, V as InterruptEvent, Vt as CopilotChatToolCallsView, W as defineToolCallRenderer, Wt as CopilotChatInputProps, X as ReactCustomMessageRenderer, Xt as useCopilotChatConfiguration, Y as useRenderCustomMessages, Yt as CopilotChatLabels, Z as ReactCustomMessageRendererPosition, Zt as AudioRecorderError, _ as UseAttachmentsProps, _t as CopilotSidebarView, a as A2UIUserAction, at as WildcardToolCallRender, b as Thread, bt as CopilotModalHeaderProps, c as SandboxFunctionsContext, ct as AttachmentsConfig, d as CopilotKitProvider, dt as CopilotPopup, et as MCPAppsActivityContentSchema, f as CopilotKitProviderProps, ft as CopilotPopupProps, g as CopilotKitCoreReactSubscriber, gt as CopilotPopupViewProps, h as CopilotKitCoreReactConfig, ht as CopilotPopupView, i as A2UIMessageRendererOptions, it as CopilotKitInspectorProps, j as useCapabilities, jt as CopilotChatSuggestionView, k as JsonSerializable, kt as CopilotChatMessageView, l as useSandboxFunctions, lt as CopilotChatAttachmentRenderer, m as CopilotKitCoreReact, mt as CopilotSidebarProps, nt as MCPAppsActivityType, o as createA2UIMessageRenderer, ot as Attachment, p as useCopilotKit, pt as CopilotSidebar, q as ReactActivityMessageRenderer, qt as CopilotChatConfigurationProviderProps, r as CopilotKitProps, rt as CopilotKitInspector, s as InspectorAnchor, st as AttachmentModality, t as CopilotKit, tt as MCPAppsActivityRenderer, u as CopilotKitContextValue, ut as CopilotChatAttachmentQueue, v as UseAttachmentsReturn, vt as CopilotSidebarViewProps, w as UseInterruptConfig, wt as DefaultOpenIcon, x as UseThreadsInput, xt as CopilotChatToggleButton, y as useAttachments, yt as CopilotModalHeader, z as useRenderActivityMessage, zt as CopilotChatAssistantMessage } from "../copilotkit-f2Uq0RwG.mjs";
2
2
  import "./index.css";
3
3
  import { Theme as A2UITheme, defaultTheme as a2uiDefaultTheme } from "@copilotkit/a2ui-renderer";
4
4
  export * from "@copilotkit/core";
5
5
  export * from "@ag-ui/client";
6
- export { type A2UIMessageRendererOptions, type A2UITheme, type A2UIUserAction, AgentContextInput, Attachment, AttachmentModality, AttachmentsConfig, AudioRecorderError, AudioRecorderState, CopilotChat, CopilotChatAssistantMessage, CopilotChatAssistantMessageProps, CopilotChatAttachmentQueue, CopilotChatAttachmentRenderer, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, CopilotChatConfigurationProviderProps, CopilotChatConfigurationValue, CopilotChatInput, CopilotChatInputProps, CopilotChatLabels, CopilotChatMessageView, CopilotChatMessageViewProps, CopilotChatProps, CopilotChatReasoningMessage, CopilotChatReasoningMessageProps, CopilotChatSuggestionPill, CopilotChatSuggestionPillProps, CopilotChatSuggestionView, CopilotChatSuggestionViewProps, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, CopilotChatToggleButtonProps, CopilotChatToolCallsView, CopilotChatToolCallsViewProps, CopilotChatUserMessage, CopilotChatUserMessageProps, CopilotChatView, CopilotChatViewProps, CopilotKit, CopilotKitContextValue, CopilotKitCoreReact, CopilotKitCoreReactConfig, CopilotKitCoreReactSubscriber, CopilotKitInspector, CopilotKitInspectorProps, type CopilotKitProps, CopilotKitProvider, CopilotKitProviderProps, CopilotModalHeader, CopilotModalHeaderProps, CopilotPopup, CopilotPopupProps, CopilotPopupView, CopilotPopupViewProps, CopilotSidebar, CopilotSidebarProps, CopilotSidebarView, CopilotSidebarViewProps, InspectorAnchor, InterruptEvent, InterruptHandlerProps, InterruptRenderProps, JsonSerializable, MCPAppsActivityContent, MCPAppsActivityContentSchema, MCPAppsActivityRenderer, MCPAppsActivityType, ReactActivityMessageRenderer, ReactCustomMessageRenderer, ReactCustomMessageRendererPosition, ReactFrontendTool, ReactHumanInTheLoop, ReactToolCallRenderer, SandboxFunction, SandboxFunctionsContext, Thread, ToolsMenuItem, UseAgentUpdate, UseAttachmentsProps, UseAttachmentsReturn, UseInterruptConfig, UseThreadsInput, UseThreadsResult, WildcardToolCallRender, a2uiDefaultTheme, createA2UIMessageRenderer, defineToolCallRenderer, useAgent, useAgentContext, useAttachments, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useDefaultRenderTool, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderActivityMessage, useRenderCustomMessages, useRenderTool, useRenderToolCall, useSandboxFunctions, useSuggestions, useThreads };
6
+ export { type A2UIMessageRendererOptions, type A2UITheme, type A2UIUserAction, AgentContextInput, Attachment, AttachmentModality, AttachmentsConfig, AudioRecorderError, AudioRecorderState, CopilotChat, CopilotChatAssistantMessage, CopilotChatAssistantMessageProps, CopilotChatAttachmentQueue, CopilotChatAttachmentRenderer, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, CopilotChatConfigurationProviderProps, CopilotChatConfigurationValue, CopilotChatInput, CopilotChatInputProps, CopilotChatLabels, CopilotChatMessageView, CopilotChatMessageViewProps, CopilotChatProps, CopilotChatReasoningMessage, CopilotChatReasoningMessageProps, CopilotChatSuggestionPill, CopilotChatSuggestionPillProps, CopilotChatSuggestionView, CopilotChatSuggestionViewProps, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, CopilotChatToggleButtonProps, CopilotChatToolCallsView, CopilotChatToolCallsViewProps, CopilotChatUserMessage, CopilotChatUserMessageProps, CopilotChatView, CopilotChatViewProps, CopilotKit, CopilotKitContextValue, CopilotKitCoreReact, CopilotKitCoreReactConfig, CopilotKitCoreReactSubscriber, CopilotKitInspector, CopilotKitInspectorProps, type CopilotKitProps, CopilotKitProvider, CopilotKitProviderProps, CopilotModalHeader, CopilotModalHeaderProps, CopilotPopup, CopilotPopupProps, CopilotPopupView, CopilotPopupViewProps, CopilotSidebar, CopilotSidebarProps, CopilotSidebarView, CopilotSidebarViewProps, InspectorAnchor, InterruptEvent, InterruptHandlerProps, InterruptRenderProps, JsonSerializable, MCPAppsActivityContent, MCPAppsActivityContentSchema, MCPAppsActivityRenderer, MCPAppsActivityType, ReactActivityMessageRenderer, ReactCustomMessageRenderer, ReactCustomMessageRendererPosition, ReactFrontendTool, ReactHumanInTheLoop, ReactToolCallRenderer, SandboxFunction, SandboxFunctionsContext, Thread, ToolsMenuItem, UseAgentUpdate, UseAttachmentsProps, UseAttachmentsReturn, UseInterruptConfig, UseThreadsInput, UseThreadsResult, WildcardToolCallRender, a2uiDefaultTheme, createA2UIMessageRenderer, defineToolCallRenderer, useAgent, useAgentContext, useAttachments, useCapabilities, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useDefaultRenderTool, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderActivityMessage, useRenderCustomMessages, useRenderTool, useRenderToolCall, useSandboxFunctions, useSuggestions, useThreads };
package/dist/v2/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { $ as useCopilotKit, A as CopilotChatSuggestionView, B as useConfigureSuggestions, C as CopilotChatToggleButton, D as CopilotChatView_default, E as CopilotChat, F as CopilotChatAssistantMessage_default, G as useComponent, H as useHumanInTheLoop, I as CopilotChatToolCallsView, J as useRenderCustomMessages, K as useFrontendTool, L as useAttachments, M as CopilotChatReasoningMessage_default, N as CopilotChatUserMessage_default, O as CopilotChatAttachmentQueue, P as CopilotChatAttachmentRenderer, Q as CopilotKitProvider, R as useThreads, S as CopilotModalHeader, T as DefaultOpenIcon, U as useDefaultRenderTool, V as useSuggestions, W as useRenderTool, X as useAgent, Y as UseAgentUpdate, Z as useRenderToolCall, _ as WildcardToolCallRender, at as useSandboxFunctions, b as CopilotPopupView, ct as MCPAppsActivityType, dt as AudioRecorderError, et as CopilotKitCoreReact, ft as CopilotChatAudioRecorder, it as SandboxFunctionsContext, j as CopilotChatSuggestionPill, k as CopilotChatMessageView, lt as CopilotKitInspector, mt as useCopilotChatConfiguration, nt as defineToolCallRenderer, ot as MCPAppsActivityContentSchema, pt as CopilotChatConfigurationProvider, q as useRenderActivityMessage, rt as createA2UIMessageRenderer, st as MCPAppsActivityRenderer, t as CopilotKit, tt as useAgentContext, ut as CopilotChatInput_default, v as CopilotPopup, w as DefaultCloseIcon, x as CopilotSidebarView, y as CopilotSidebar, z as useInterrupt } from "../copilotkit-Cd-NrDyp.mjs";
3
+ import { $ as CopilotKitProvider, A as CopilotChatSuggestionView, B as useConfigureSuggestions, C as CopilotChatToggleButton, D as CopilotChatView_default, E as CopilotChat, F as CopilotChatAssistantMessage_default, G as useRenderTool, H as useCapabilities, I as CopilotChatToolCallsView, J as useRenderActivityMessage, K as useComponent, L as useAttachments, M as CopilotChatReasoningMessage_default, N as CopilotChatUserMessage_default, O as CopilotChatAttachmentQueue, P as CopilotChatAttachmentRenderer, Q as useRenderToolCall, R as useThreads, S as CopilotModalHeader, T as DefaultOpenIcon, U as useHumanInTheLoop, V as useSuggestions, W as useDefaultRenderTool, X as UseAgentUpdate, Y as useRenderCustomMessages, Z as useAgent, _ as WildcardToolCallRender, at as SandboxFunctionsContext, b as CopilotPopupView, ct as MCPAppsActivityRenderer, dt as CopilotChatInput_default, et as useCopilotKit, ft as AudioRecorderError, ht as useCopilotChatConfiguration, it as createA2UIMessageRenderer, j as CopilotChatSuggestionPill, k as CopilotChatMessageView, lt as MCPAppsActivityType, mt as CopilotChatConfigurationProvider, nt as useAgentContext, ot as useSandboxFunctions, pt as CopilotChatAudioRecorder, q as useFrontendTool, rt as defineToolCallRenderer, st as MCPAppsActivityContentSchema, t as CopilotKit, tt as CopilotKitCoreReact, ut as CopilotKitInspector, v as CopilotPopup, w as DefaultCloseIcon, x as CopilotSidebarView, y as CopilotSidebar, z as useInterrupt } from "../copilotkit-BebqQrYT.mjs";
4
4
  import "./index.css";
5
5
  import { defaultTheme as a2uiDefaultTheme } from "@copilotkit/a2ui-renderer";
6
6
 
@@ -8,4 +8,4 @@ export * from "@copilotkit/core"
8
8
 
9
9
  export * from "@ag-ui/client"
10
10
 
11
- export { AudioRecorderError, CopilotChat, CopilotChatAssistantMessage_default as CopilotChatAssistantMessage, CopilotChatAttachmentQueue, CopilotChatAttachmentRenderer, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, CopilotChatInput_default as CopilotChatInput, CopilotChatMessageView, CopilotChatReasoningMessage_default as CopilotChatReasoningMessage, CopilotChatSuggestionPill, CopilotChatSuggestionView, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, CopilotChatToolCallsView, CopilotChatUserMessage_default as CopilotChatUserMessage, CopilotChatView_default as CopilotChatView, CopilotKit, CopilotKitCoreReact, CopilotKitInspector, CopilotKitProvider, CopilotModalHeader, CopilotPopup, CopilotPopupView, CopilotSidebar, CopilotSidebarView, MCPAppsActivityContentSchema, MCPAppsActivityRenderer, MCPAppsActivityType, SandboxFunctionsContext, UseAgentUpdate, WildcardToolCallRender, a2uiDefaultTheme, createA2UIMessageRenderer, defineToolCallRenderer, useAgent, useAgentContext, useAttachments, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useDefaultRenderTool, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderActivityMessage, useRenderCustomMessages, useRenderTool, useRenderToolCall, useSandboxFunctions, useSuggestions, useThreads };
11
+ export { AudioRecorderError, CopilotChat, CopilotChatAssistantMessage_default as CopilotChatAssistantMessage, CopilotChatAttachmentQueue, CopilotChatAttachmentRenderer, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, CopilotChatInput_default as CopilotChatInput, CopilotChatMessageView, CopilotChatReasoningMessage_default as CopilotChatReasoningMessage, CopilotChatSuggestionPill, CopilotChatSuggestionView, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, CopilotChatToolCallsView, CopilotChatUserMessage_default as CopilotChatUserMessage, CopilotChatView_default as CopilotChatView, CopilotKit, CopilotKitCoreReact, CopilotKitInspector, CopilotKitProvider, CopilotModalHeader, CopilotPopup, CopilotPopupView, CopilotSidebar, CopilotSidebarView, MCPAppsActivityContentSchema, MCPAppsActivityRenderer, MCPAppsActivityType, SandboxFunctionsContext, UseAgentUpdate, WildcardToolCallRender, a2uiDefaultTheme, createA2UIMessageRenderer, defineToolCallRenderer, useAgent, useAgentContext, useAttachments, useCapabilities, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useDefaultRenderTool, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderActivityMessage, useRenderCustomMessages, useRenderTool, useRenderToolCall, useSandboxFunctions, useSuggestions, useThreads };
@@ -3108,7 +3108,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3108
3108
  }, [value, warningMessage]);
3109
3109
  return value;
3110
3110
  }
3111
- const CopilotKitProvider = ({ children, runtimeUrl, headers = {}, credentials, publicApiKey, publicLicenseKey, licenseToken, properties = {}, agents__unsafe_dev_only: agents = {}, selfManagedAgents = {}, renderToolCalls, renderActivityMessages, renderCustomMessages, frontendTools, humanInTheLoop, openGenerativeUI, showDevConsole = false, useSingleEndpoint, onError, a2ui, defaultThrottleMs, inspectorDefaultAnchor }) => {
3111
+ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = {}, credentials, publicApiKey, publicLicenseKey, licenseToken, properties = {}, agents__unsafe_dev_only: agents = {}, selfManagedAgents = {}, renderToolCalls, renderActivityMessages, renderCustomMessages, frontendTools, humanInTheLoop, openGenerativeUI, showDevConsole = false, useSingleEndpoint, onError, a2ui, defaultThrottleMs, inspectorDefaultAnchor, debug }) => {
3112
3112
  var _openGenerativeUI$des;
3113
3113
  const [shouldRenderInspector, setShouldRenderInspector] = (0, react.useState)(false);
3114
3114
  const [runtimeA2UIEnabled, setRuntimeA2UIEnabled] = (0, react.useState)(false);
@@ -3170,6 +3170,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3170
3170
  ...selfManagedAgents
3171
3171
  }), [agents, selfManagedAgents]);
3172
3172
  const hasLocalAgents = mergedAgents && Object.keys(mergedAgents).length > 0;
3173
+ const headers = typeof headersProp === "function" ? headersProp() : headersProp;
3173
3174
  const mergedHeaders = (0, react.useMemo)(() => {
3174
3175
  if (!resolvedPublicKey) return headers;
3175
3176
  if (headers[HEADER_NAME]) return headers;
@@ -3271,7 +3272,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3271
3272
  tools: allTools,
3272
3273
  renderToolCalls: allRenderToolCalls,
3273
3274
  renderActivityMessages: allActivityRenderers,
3274
- renderCustomMessages: renderCustomMessagesList
3275
+ renderCustomMessages: renderCustomMessagesList,
3276
+ debug
3275
3277
  });
3276
3278
  if (defaultThrottleMs !== void 0) copilotkitRef.current.setDefaultThrottleMs(defaultThrottleMs);
3277
3279
  }
@@ -3345,6 +3347,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3345
3347
  copilotkit.setCredentials(credentials);
3346
3348
  copilotkit.setProperties(properties);
3347
3349
  copilotkit.setAgents__unsafe_dev_only(mergedAgents);
3350
+ copilotkit.setDebug(debug);
3348
3351
  }, [
3349
3352
  copilotkit,
3350
3353
  chatApiEndpoint,
@@ -3352,7 +3355,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3352
3355
  credentials,
3353
3356
  properties,
3354
3357
  mergedAgents,
3355
- useSingleEndpoint
3358
+ useSingleEndpoint,
3359
+ debug
3356
3360
  ]);
3357
3361
  const didMountRef = (0, react.useRef)(false);
3358
3362
  (0, react.useEffect)(() => {
@@ -3670,6 +3674,17 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3670
3674
  const handlers = {};
3671
3675
  let timerId = null;
3672
3676
  let active = true;
3677
+ let batchScheduled = false;
3678
+ const batchedForceUpdate = () => {
3679
+ if (!active) return;
3680
+ if (!batchScheduled) {
3681
+ batchScheduled = true;
3682
+ queueMicrotask(() => {
3683
+ batchScheduled = false;
3684
+ if (active) forceUpdate();
3685
+ });
3686
+ }
3687
+ };
3673
3688
  if (updateFlags.includes(UseAgentUpdate.OnMessagesChanged)) {
3674
3689
  const ms = effectiveThrottleMs;
3675
3690
  if (ms > 0) {
@@ -3694,11 +3709,11 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3694
3709
  handlers.onMessagesChanged = throttledNotify;
3695
3710
  } else handlers.onMessagesChanged = forceUpdate;
3696
3711
  }
3697
- if (updateFlags.includes(UseAgentUpdate.OnStateChanged)) handlers.onStateChanged = forceUpdate;
3712
+ if (updateFlags.includes(UseAgentUpdate.OnStateChanged)) handlers.onStateChanged = batchedForceUpdate;
3698
3713
  if (updateFlags.includes(UseAgentUpdate.OnRunStatusChanged)) {
3699
- handlers.onRunInitialized = forceUpdate;
3700
- handlers.onRunFinalized = forceUpdate;
3701
- handlers.onRunFailed = forceUpdate;
3714
+ handlers.onRunInitialized = batchedForceUpdate;
3715
+ handlers.onRunFinalized = batchedForceUpdate;
3716
+ handlers.onRunFailed = batchedForceUpdate;
3702
3717
  }
3703
3718
  const subscription = agent.subscribe(handlers);
3704
3719
  return () => {
@@ -4240,6 +4255,24 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4240
4255
  ]);
4241
4256
  }
4242
4257
 
4258
+ //#endregion
4259
+ //#region src/v2/hooks/use-capabilities.tsx
4260
+ /**
4261
+ * Returns the capabilities declared by the given agent (or the default agent).
4262
+ * Capabilities are populated from the runtime `/info` response at connection
4263
+ * time. The hook reads them synchronously from the agent instance — there is
4264
+ * no separate loading state, but the value will be `undefined` until the
4265
+ * runtime handshake completes.
4266
+ *
4267
+ * @param agentId - Optional agent ID. If omitted, uses the default agent.
4268
+ * @returns The agent's capabilities, or `undefined` if the agent doesn't
4269
+ * declare capabilities.
4270
+ */
4271
+ function useCapabilities(agentId) {
4272
+ const { agent } = useAgent({ agentId });
4273
+ if (agent && "capabilities" in agent) return agent.capabilities;
4274
+ }
4275
+
4243
4276
  //#endregion
4244
4277
  //#region src/v2/hooks/use-suggestions.tsx
4245
4278
  function useSuggestions({ agentId } = {}) {
@@ -4917,11 +4950,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4917
4950
  useKatexStyles();
4918
4951
  const boundMarkdownRenderer = renderSlot(markdownRenderer, CopilotChatAssistantMessage.MarkdownRenderer, { content: message.content || "" });
4919
4952
  const boundCopyButton = renderSlot(copyButton, CopilotChatAssistantMessage.CopyButton, { onClick: async () => {
4920
- if (message.content) try {
4921
- await navigator.clipboard.writeText(message.content);
4922
- } catch (err) {
4923
- console.error("Failed to copy message:", err);
4924
- }
4953
+ if (message.content) return await (0, _copilotkit_shared.copyToClipboard)(message.content);
4954
+ return false;
4925
4955
  } });
4926
4956
  const boundThumbsUpButton = renderSlot(thumbsUpButton, CopilotChatAssistantMessage.ThumbsUpButton, { onClick: onThumbsUp });
4927
4957
  const boundThumbsDownButton = renderSlot(thumbsDownButton, CopilotChatAssistantMessage.ThumbsDownButton, { onClick: onThumbsDown });
@@ -5021,14 +5051,17 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5021
5051
  if (timerRef.current !== null) clearTimeout(timerRef.current);
5022
5052
  };
5023
5053
  }, []);
5024
- const handleClick = (event) => {
5025
- setCopied(true);
5026
- if (timerRef.current !== null) clearTimeout(timerRef.current);
5027
- timerRef.current = setTimeout(() => {
5028
- timerRef.current = null;
5029
- setCopied(false);
5030
- }, 2e3);
5031
- if (onClick) onClick(event);
5054
+ const handleClick = async (event) => {
5055
+ let success = false;
5056
+ if (onClick) success = await Promise.resolve(onClick(event)) === true;
5057
+ if (success) {
5058
+ setCopied(true);
5059
+ if (timerRef.current !== null) clearTimeout(timerRef.current);
5060
+ timerRef.current = setTimeout(() => {
5061
+ timerRef.current = null;
5062
+ setCopied(false);
5063
+ }, 2e3);
5064
+ }
5032
5065
  };
5033
5066
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
5034
5067
  "data-testid": "copilot-copy-button",
@@ -5190,11 +5223,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5190
5223
  const mediaParts = (0, react.useMemo)(() => getMediaParts(message.content), [message.content]);
5191
5224
  const BoundMessageRenderer = renderSlot(messageRenderer, CopilotChatUserMessage.MessageRenderer, { content: flattenedContent });
5192
5225
  const BoundCopyButton = renderSlot(copyButton, CopilotChatUserMessage.CopyButton, { onClick: async () => {
5193
- if (flattenedContent) try {
5194
- await navigator.clipboard.writeText(flattenedContent);
5195
- } catch (err) {
5196
- console.error("Failed to copy message:", err);
5197
- }
5226
+ if (flattenedContent) return await (0, _copilotkit_shared.copyToClipboard)(flattenedContent);
5227
+ return false;
5198
5228
  } });
5199
5229
  const BoundEditButton = renderSlot(editButton, CopilotChatUserMessage.EditButton, { onClick: () => onEditMessage === null || onEditMessage === void 0 ? void 0 : onEditMessage({ message }) });
5200
5230
  const BoundBranchNavigation = renderSlot(branchNavigation, CopilotChatUserMessage.BranchNavigation, {
@@ -5284,10 +5314,13 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5284
5314
  const config = useCopilotChatConfiguration();
5285
5315
  const labels = (_config$labels = config === null || config === void 0 ? void 0 : config.labels) !== null && _config$labels !== void 0 ? _config$labels : CopilotChatDefaultLabels;
5286
5316
  const [copied, setCopied] = (0, react.useState)(false);
5287
- const handleClick = (event) => {
5288
- setCopied(true);
5289
- setTimeout(() => setCopied(false), 2e3);
5290
- if (onClick) onClick(event);
5317
+ const handleClick = async (event) => {
5318
+ let success = false;
5319
+ if (onClick) success = await Promise.resolve(onClick(event)) === true;
5320
+ if (success) {
5321
+ setCopied(true);
5322
+ setTimeout(() => setCopied(false), 2e3);
5323
+ }
5291
5324
  };
5292
5325
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
5293
5326
  "data-testid": "copilot-user-copy-button",
@@ -5397,17 +5430,24 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5397
5430
  return () => clearInterval(timer);
5398
5431
  }, [isStreaming]);
5399
5432
  const [isOpen, setIsOpen] = (0, react.useState)(isStreaming);
5433
+ const userToggledRef = (0, react.useRef)(false);
5400
5434
  (0, react.useEffect)(() => {
5401
- if (isStreaming) setIsOpen(true);
5402
- else setIsOpen(false);
5435
+ if (isStreaming) {
5436
+ userToggledRef.current = false;
5437
+ setIsOpen(true);
5438
+ } else if (!userToggledRef.current) setIsOpen(false);
5403
5439
  }, [isStreaming]);
5440
+ const handleToggle = hasContent ? () => {
5441
+ userToggledRef.current = true;
5442
+ setIsOpen((prev) => !prev);
5443
+ } : void 0;
5404
5444
  const label = isStreaming ? "Thinking…" : `Thought for ${formatDuration(elapsed)}`;
5405
5445
  const boundHeader = renderSlot(header, CopilotChatReasoningMessage.Header, {
5406
5446
  isOpen,
5407
5447
  label,
5408
5448
  hasContent,
5409
5449
  isStreaming,
5410
- onClick: hasContent ? () => setIsOpen((prev) => !prev) : void 0
5450
+ onClick: handleToggle
5411
5451
  });
5412
5452
  const boundContent = renderSlot(contentView, CopilotChatReasoningMessage.Content, {
5413
5453
  isStreaming,
@@ -8139,6 +8179,20 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
8139
8179
  /**
8140
8180
  * An internal context to separate the messages state (which is constantly changing) from the rest of CopilotKit context
8141
8181
  */
8182
+ /**
8183
+ * Determine whether a GraphQL error should be suppressed based on its visibility
8184
+ * and whether the dev console is active.
8185
+ *
8186
+ * Returns `null` when the error should be surfaced to the UI, or a log prefix
8187
+ * string when the error should be suppressed (logged to console only).
8188
+ *
8189
+ * Exported for unit testing.
8190
+ */
8191
+ function getErrorSuppression(visibility, isDev) {
8192
+ if (visibility === _copilotkit_shared.ErrorVisibility.SILENT) return "CopilotKit Silent Error:";
8193
+ if (!isDev && visibility === _copilotkit_shared.ErrorVisibility.DEV_ONLY) return "CopilotKit Error (hidden in production):";
8194
+ return null;
8195
+ }
8142
8196
  const MessagesTapContext = (0, react.createContext)(null);
8143
8197
  function useMessagesTap() {
8144
8198
  const tap = (0, react.useContext)(MessagesTapContext);
@@ -8223,13 +8277,9 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
8223
8277
  const graphQLErrors = error.graphQLErrors;
8224
8278
  const routeError = (gqlError) => {
8225
8279
  const extensions = gqlError.extensions;
8226
- const visibility = extensions === null || extensions === void 0 ? void 0 : extensions.visibility;
8227
- if (!shouldShowDevConsole(showDevConsole)) {
8228
- console.error("CopilotKit Error (hidden in production):", gqlError.message);
8229
- return;
8230
- }
8231
- if (visibility === _copilotkit_shared.ErrorVisibility.SILENT) {
8232
- console.error("CopilotKit Silent Error:", gqlError.message);
8280
+ const suppression = getErrorSuppression(extensions === null || extensions === void 0 ? void 0 : extensions.visibility, shouldShowDevConsole(showDevConsole));
8281
+ if (suppression) {
8282
+ console.error(suppression, gqlError.message);
8233
8283
  return;
8234
8284
  }
8235
8285
  const ckError = createStructuredError(gqlError);
@@ -8246,8 +8296,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
8246
8296
  }
8247
8297
  };
8248
8298
  graphQLErrors.forEach(routeError);
8249
- } else if (!shouldShowDevConsole(showDevConsole)) console.error("CopilotKit Error (hidden in production):", error);
8250
- else {
8299
+ } else {
8251
8300
  const fallbackError = new _copilotkit_shared.CopilotKitError({
8252
8301
  message: (error === null || error === void 0 ? void 0 : error.message) || String(error),
8253
8302
  code: _copilotkit_shared.CopilotKitErrorCode.UNKNOWN
@@ -9227,7 +9276,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
9227
9276
  publicApiKey,
9228
9277
  ...cloud ? { cloud } : {},
9229
9278
  chatApiEndpoint,
9230
- headers: props.headers || {},
9279
+ headers: typeof props.headers === "function" ? props.headers() : props.headers || {},
9231
9280
  properties: props.properties || {},
9232
9281
  transcribeAudioUrl: props.transcribeAudioUrl,
9233
9282
  textToSpeechUrl: props.textToSpeechUrl,
@@ -9644,6 +9693,7 @@ exports.defineToolCallRenderer = defineToolCallRenderer;
9644
9693
  exports.useAgent = useAgent;
9645
9694
  exports.useAgentContext = useAgentContext;
9646
9695
  exports.useAttachments = useAttachments;
9696
+ exports.useCapabilities = useCapabilities;
9647
9697
  exports.useComponent = useComponent;
9648
9698
  exports.useConfigureSuggestions = useConfigureSuggestions;
9649
9699
  exports.useCopilotChatConfiguration = useCopilotChatConfiguration;