@copilotkit/react-core 1.63.1 → 1.63.2-canary.1784918757

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.
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-nu7NwzH6.cjs');
4
+ const require_copilotkit = require('../copilotkit-rYTwMndy.cjs');
5
5
  require("./index.css");
6
6
  let _copilotkit_a2ui_renderer = require("@copilotkit/a2ui-renderer");
7
7
 
@@ -1,4 +1,4 @@
1
- import { $ as useComponent, $t as CopilotSidebarView, A as useAttachments, An as CopilotChatAssistantMessageProps, At as ɵMcpFollowUpHost, B as UseInterruptConfig, Bn as useCopilotChatConfiguration, Bt as CopilotThreadsDrawer, C as NewMemory, Cn as CopilotChatSuggestionPill, Ct as OpenGenerativeUIContent, D as useLearningContainers, Dn as CopilotChatUserMessage, Dt as MCPAppsActivityContentSchema, E as UseLearningContainersArgs, En as CopilotChatReasoningMessageProps, Et as MCPAppsActivityContent, F as LearnFromUserActionResult, Fn as ToolsMenuItem, Ft as Attachment, G as JsonSerializable, Gt as UseThreadsResult, H as useConfigureSuggestions, Hn as AudioRecorderState, Ht as CopilotThreadsDrawerRowRenderer, I as UseLearnFromUserActionRecorder, In as CopilotChatConfigurationProvider, It as AttachmentModality, J as UseAgentUpdate, Jt as CopilotPopupProps, K as useAgentContext, Kt as useThreads, L as useLearnFromUserAction, Ln as CopilotChatConfigurationProviderProps, Lt as AttachmentsConfig, M as UseLearnFromUserActionInCurrentThreadRecorder, Mn as CopilotChatToolCallsViewProps, Mt as CopilotKitInspector, N as useLearnFromUserActionInCurrentThread, Nn as CopilotChatInput, Nt as CopilotKitInspectorProps, O as UseAttachmentsProps, On as CopilotChatUserMessageProps, Ot as MCPAppsActivityRenderer, P as LearnFromUserActionInput, Pn as CopilotChatInputProps, Pt as WildcardToolCallRender, Q as useRenderTool, Qt as CopilotPopupViewProps, R as UseMemoriesResult, Rn as CopilotChatConfigurationValue, Rt as CopilotChatAttachmentRenderer, S as MemoryScope, Sn as CopilotChatSuggestionViewProps, St as OpenGenerativeUIActivityType, T as useLearningContainersInCurrentThread, Tn as CopilotChatReasoningMessage, Tt as OpenGenerativeUIToolRenderer, U as useSuggestions, Un as CopilotChatAudioRecorder, Ut as Thread, V as useInterrupt, Vn as AudioRecorderError, Vt as CopilotThreadsDrawerProps, W as AgentContextInput, Wt as UseThreadsInput, X as useHumanInTheLoop, Xt as CopilotSidebarProps, Y as useAgent, Yt as CopilotSidebar, Z as useDefaultRenderTool, Zt as CopilotPopupView, _ as CopilotKitCoreReactConfig, _n as getIntelligenceTurnAnchors, _t as ReactCustomMessageRendererPosition, a as A2UIMessageRendererOptions, an as DefaultCloseIcon, at as InterruptEvent, b as MemoryChanges, bn as IntelligenceIndicatorViewProps, bt as GenerateSandboxedUiArgsSchema, c as InspectorAnchor, cn as CopilotChatProps, ct as InterruptResolveFn, d as CopilotKitProvider, dn as AutoScrollMode, dt as ReactHumanInTheLoop, en as CopilotSidebarViewProps, et as useFrontendTool, f as CopilotKitProviderProps, fn as CopilotChatMessageView, ft as ReactFrontendTool, g as CopilotKitCoreReact, gn as IntelligenceIndicatorProps, gt as ReactCustomMessageRenderer, h as useCopilotKit, hn as IntelligenceIndicator, ht as useRenderCustomMessages, i as A2UIActionInterceptor, in as CopilotChatToggleButtonProps, it as InterruptCancelFn, j as LearnFromUserActionInCurrentThreadInput, jn as CopilotChatToolCallsView, jt as ɵrunMcpFollowUp, k as UseAttachmentsReturn, kn as CopilotChatAssistantMessage, kt as MCPAppsActivityType, l as SandboxFunctionsContext, ln as CopilotChatView, lt as ResumeEntry, m as CopilotKitContextValue, mn as INTELLIGENCE_TURN_HEAD, mt as ReactToolCallRenderer, nn as CopilotModalHeaderProps, nt as SandboxFunction, o as A2UIUserAction, on as DefaultOpenIcon, ot as InterruptHandlerProps, p as A2UIRecoveryRendererOptions, pn as CopilotChatMessageViewProps, pt as ReactActivityMessageRenderer, q as useCapabilities, qt as CopilotPopup, r as CopilotKitProps, rn as CopilotChatToggleButton, rt as Interrupt, s as createA2UIMessageRenderer, sn as CopilotChat, st as InterruptRenderProps, t as CopilotKit, tn as CopilotModalHeader, tt as useRenderActivityMessage, u as useSandboxFunctions, un as CopilotChatViewProps, ut as defineToolCallRenderer, v as CopilotKitCoreReactSubscriber, vn as IntelligenceIndicatorStatus, vt as useRenderToolCall, w as UseLearningContainersInCurrentThreadArgs, wn as CopilotChatSuggestionPillProps, wt as OpenGenerativeUIContentSchema, x as MemoryKind, xn as CopilotChatSuggestionView, xt as OpenGenerativeUIActivityRenderer, y as Memory, yn as IntelligenceIndicatorView, yt as GenerateSandboxedUiArgs, z as useMemories, zn as CopilotChatLabels, zt as CopilotChatAttachmentQueue } from "../copilotkit-BHs-vx6l.cjs";
1
+ import { $ as useComponent, $t as CopilotSidebarView, A as useAttachments, An as CopilotChatAssistantMessageProps, At as ɵMcpFollowUpHost, B as UseInterruptConfig, Bn as useCopilotChatConfiguration, Bt as CopilotThreadsDrawer, C as NewMemory, Cn as CopilotChatSuggestionPill, Ct as OpenGenerativeUIContent, D as useLearningContainers, Dn as CopilotChatUserMessage, Dt as MCPAppsActivityContentSchema, E as UseLearningContainersArgs, En as CopilotChatReasoningMessageProps, Et as MCPAppsActivityContent, F as LearnFromUserActionResult, Fn as ToolsMenuItem, Ft as Attachment, G as JsonSerializable, Gt as UseThreadsResult, H as useConfigureSuggestions, Hn as AudioRecorderState, Ht as CopilotThreadsDrawerRowRenderer, I as UseLearnFromUserActionRecorder, In as CopilotChatConfigurationProvider, It as AttachmentModality, J as UseAgentUpdate, Jt as CopilotPopupProps, K as useAgentContext, Kt as useThreads, L as useLearnFromUserAction, Ln as CopilotChatConfigurationProviderProps, Lt as AttachmentsConfig, M as UseLearnFromUserActionInCurrentThreadRecorder, Mn as CopilotChatToolCallsViewProps, Mt as CopilotKitInspector, N as useLearnFromUserActionInCurrentThread, Nn as CopilotChatInput, Nt as CopilotKitInspectorProps, O as UseAttachmentsProps, On as CopilotChatUserMessageProps, Ot as MCPAppsActivityRenderer, P as LearnFromUserActionInput, Pn as CopilotChatInputProps, Pt as WildcardToolCallRender, Q as useRenderTool, Qt as CopilotPopupViewProps, R as UseMemoriesResult, Rn as CopilotChatConfigurationValue, Rt as CopilotChatAttachmentRenderer, S as MemoryScope, Sn as CopilotChatSuggestionViewProps, St as OpenGenerativeUIActivityType, T as useLearningContainersInCurrentThread, Tn as CopilotChatReasoningMessage, Tt as OpenGenerativeUIToolRenderer, U as useSuggestions, Un as CopilotChatAudioRecorder, Ut as Thread, V as useInterrupt, Vn as AudioRecorderError, Vt as CopilotThreadsDrawerProps, W as AgentContextInput, Wt as UseThreadsInput, X as useHumanInTheLoop, Xt as CopilotSidebarProps, Y as useAgent, Yt as CopilotSidebar, Z as useDefaultRenderTool, Zt as CopilotPopupView, _ as CopilotKitCoreReactConfig, _n as getIntelligenceTurnAnchors, _t as ReactCustomMessageRendererPosition, a as A2UIMessageRendererOptions, an as DefaultCloseIcon, at as InterruptEvent, b as MemoryChanges, bn as IntelligenceIndicatorViewProps, bt as GenerateSandboxedUiArgsSchema, c as InspectorAnchor, cn as CopilotChatProps, ct as InterruptResolveFn, d as CopilotKitProvider, dn as AutoScrollMode, dt as ReactHumanInTheLoop, en as CopilotSidebarViewProps, et as useFrontendTool, f as CopilotKitProviderProps, fn as CopilotChatMessageView, ft as ReactFrontendTool, g as CopilotKitCoreReact, gn as IntelligenceIndicatorProps, gt as ReactCustomMessageRenderer, h as useCopilotKit, hn as IntelligenceIndicator, ht as useRenderCustomMessages, i as A2UIActionInterceptor, in as CopilotChatToggleButtonProps, it as InterruptCancelFn, j as LearnFromUserActionInCurrentThreadInput, jn as CopilotChatToolCallsView, jt as ɵrunMcpFollowUp, k as UseAttachmentsReturn, kn as CopilotChatAssistantMessage, kt as MCPAppsActivityType, l as SandboxFunctionsContext, ln as CopilotChatView, lt as ResumeEntry, m as CopilotKitContextValue, mn as INTELLIGENCE_TURN_HEAD, mt as ReactToolCallRenderer, nn as CopilotModalHeaderProps, nt as SandboxFunction, o as A2UIUserAction, on as DefaultOpenIcon, ot as InterruptHandlerProps, p as A2UIRecoveryRendererOptions, pn as CopilotChatMessageViewProps, pt as ReactActivityMessageRenderer, q as useCapabilities, qt as CopilotPopup, r as CopilotKitProps, rn as CopilotChatToggleButton, rt as Interrupt, s as createA2UIMessageRenderer, sn as CopilotChat, st as InterruptRenderProps, t as CopilotKit, tn as CopilotModalHeader, tt as useRenderActivityMessage, u as useSandboxFunctions, un as CopilotChatViewProps, ut as defineToolCallRenderer, v as CopilotKitCoreReactSubscriber, vn as IntelligenceIndicatorStatus, vt as useRenderToolCall, w as UseLearningContainersInCurrentThreadArgs, wn as CopilotChatSuggestionPillProps, wt as OpenGenerativeUIContentSchema, x as MemoryKind, xn as CopilotChatSuggestionView, xt as OpenGenerativeUIActivityRenderer, y as Memory, yn as IntelligenceIndicatorView, yt as GenerateSandboxedUiArgs, z as useMemories, zn as CopilotChatLabels, zt as CopilotChatAttachmentQueue } from "../copilotkit-CXvuYw_F.cjs";
2
2
  import { Theme as A2UITheme, defaultTheme as a2uiDefaultTheme } from "@copilotkit/a2ui-renderer";
3
3
  export * from "@copilotkit/core";
4
4
  export * from "@ag-ui/client";
@@ -1,4 +1,4 @@
1
- import { $ as useComponent, $t as CopilotSidebarView, A as useAttachments, An as CopilotChatAssistantMessageProps, At as ɵMcpFollowUpHost, B as UseInterruptConfig, Bn as useCopilotChatConfiguration, Bt as CopilotThreadsDrawer, C as NewMemory, Cn as CopilotChatSuggestionPill, Ct as OpenGenerativeUIContent, D as useLearningContainers, Dn as CopilotChatUserMessage, Dt as MCPAppsActivityContentSchema, E as UseLearningContainersArgs, En as CopilotChatReasoningMessageProps, Et as MCPAppsActivityContent, F as LearnFromUserActionResult, Fn as ToolsMenuItem, Ft as Attachment, G as JsonSerializable, Gt as UseThreadsResult, H as useConfigureSuggestions, Hn as AudioRecorderState, Ht as CopilotThreadsDrawerRowRenderer, I as UseLearnFromUserActionRecorder, In as CopilotChatConfigurationProvider, It as AttachmentModality, J as UseAgentUpdate, Jt as CopilotPopupProps, K as useAgentContext, Kt as useThreads, L as useLearnFromUserAction, Ln as CopilotChatConfigurationProviderProps, Lt as AttachmentsConfig, M as UseLearnFromUserActionInCurrentThreadRecorder, Mn as CopilotChatToolCallsViewProps, Mt as CopilotKitInspector, N as useLearnFromUserActionInCurrentThread, Nn as CopilotChatInput, Nt as CopilotKitInspectorProps, O as UseAttachmentsProps, On as CopilotChatUserMessageProps, Ot as MCPAppsActivityRenderer, P as LearnFromUserActionInput, Pn as CopilotChatInputProps, Pt as WildcardToolCallRender, Q as useRenderTool, Qt as CopilotPopupViewProps, R as UseMemoriesResult, Rn as CopilotChatConfigurationValue, Rt as CopilotChatAttachmentRenderer, S as MemoryScope, Sn as CopilotChatSuggestionViewProps, St as OpenGenerativeUIActivityType, T as useLearningContainersInCurrentThread, Tn as CopilotChatReasoningMessage, Tt as OpenGenerativeUIToolRenderer, U as useSuggestions, Un as CopilotChatAudioRecorder, Ut as Thread, V as useInterrupt, Vn as AudioRecorderError, Vt as CopilotThreadsDrawerProps, W as AgentContextInput, Wt as UseThreadsInput, X as useHumanInTheLoop, Xt as CopilotSidebarProps, Y as useAgent, Yt as CopilotSidebar, Z as useDefaultRenderTool, Zt as CopilotPopupView, _ as CopilotKitCoreReactConfig, _n as getIntelligenceTurnAnchors, _t as ReactCustomMessageRendererPosition, a as A2UIMessageRendererOptions, an as DefaultCloseIcon, at as InterruptEvent, b as MemoryChanges, bn as IntelligenceIndicatorViewProps, bt as GenerateSandboxedUiArgsSchema, c as InspectorAnchor, cn as CopilotChatProps, ct as InterruptResolveFn, d as CopilotKitProvider, dn as AutoScrollMode, dt as ReactHumanInTheLoop, en as CopilotSidebarViewProps, et as useFrontendTool, f as CopilotKitProviderProps, fn as CopilotChatMessageView, ft as ReactFrontendTool, g as CopilotKitCoreReact, gn as IntelligenceIndicatorProps, gt as ReactCustomMessageRenderer, h as useCopilotKit, hn as IntelligenceIndicator, ht as useRenderCustomMessages, i as A2UIActionInterceptor, in as CopilotChatToggleButtonProps, it as InterruptCancelFn, j as LearnFromUserActionInCurrentThreadInput, jn as CopilotChatToolCallsView, jt as ɵrunMcpFollowUp, k as UseAttachmentsReturn, kn as CopilotChatAssistantMessage, kt as MCPAppsActivityType, l as SandboxFunctionsContext, ln as CopilotChatView, lt as ResumeEntry, m as CopilotKitContextValue, mn as INTELLIGENCE_TURN_HEAD, mt as ReactToolCallRenderer, nn as CopilotModalHeaderProps, nt as SandboxFunction, o as A2UIUserAction, on as DefaultOpenIcon, ot as InterruptHandlerProps, p as A2UIRecoveryRendererOptions, pn as CopilotChatMessageViewProps, pt as ReactActivityMessageRenderer, q as useCapabilities, qt as CopilotPopup, r as CopilotKitProps, rn as CopilotChatToggleButton, rt as Interrupt, s as createA2UIMessageRenderer, sn as CopilotChat, st as InterruptRenderProps, t as CopilotKit, tn as CopilotModalHeader, tt as useRenderActivityMessage, u as useSandboxFunctions, un as CopilotChatViewProps, ut as defineToolCallRenderer, v as CopilotKitCoreReactSubscriber, vn as IntelligenceIndicatorStatus, vt as useRenderToolCall, w as UseLearningContainersInCurrentThreadArgs, wn as CopilotChatSuggestionPillProps, wt as OpenGenerativeUIContentSchema, x as MemoryKind, xn as CopilotChatSuggestionView, xt as OpenGenerativeUIActivityRenderer, y as Memory, yn as IntelligenceIndicatorView, yt as GenerateSandboxedUiArgs, z as useMemories, zn as CopilotChatLabels, zt as CopilotChatAttachmentQueue } from "../copilotkit-CN_LykOC.mjs";
1
+ import { $ as useComponent, $t as CopilotSidebarView, A as useAttachments, An as CopilotChatAssistantMessageProps, At as ɵMcpFollowUpHost, B as UseInterruptConfig, Bn as useCopilotChatConfiguration, Bt as CopilotThreadsDrawer, C as NewMemory, Cn as CopilotChatSuggestionPill, Ct as OpenGenerativeUIContent, D as useLearningContainers, Dn as CopilotChatUserMessage, Dt as MCPAppsActivityContentSchema, E as UseLearningContainersArgs, En as CopilotChatReasoningMessageProps, Et as MCPAppsActivityContent, F as LearnFromUserActionResult, Fn as ToolsMenuItem, Ft as Attachment, G as JsonSerializable, Gt as UseThreadsResult, H as useConfigureSuggestions, Hn as AudioRecorderState, Ht as CopilotThreadsDrawerRowRenderer, I as UseLearnFromUserActionRecorder, In as CopilotChatConfigurationProvider, It as AttachmentModality, J as UseAgentUpdate, Jt as CopilotPopupProps, K as useAgentContext, Kt as useThreads, L as useLearnFromUserAction, Ln as CopilotChatConfigurationProviderProps, Lt as AttachmentsConfig, M as UseLearnFromUserActionInCurrentThreadRecorder, Mn as CopilotChatToolCallsViewProps, Mt as CopilotKitInspector, N as useLearnFromUserActionInCurrentThread, Nn as CopilotChatInput, Nt as CopilotKitInspectorProps, O as UseAttachmentsProps, On as CopilotChatUserMessageProps, Ot as MCPAppsActivityRenderer, P as LearnFromUserActionInput, Pn as CopilotChatInputProps, Pt as WildcardToolCallRender, Q as useRenderTool, Qt as CopilotPopupViewProps, R as UseMemoriesResult, Rn as CopilotChatConfigurationValue, Rt as CopilotChatAttachmentRenderer, S as MemoryScope, Sn as CopilotChatSuggestionViewProps, St as OpenGenerativeUIActivityType, T as useLearningContainersInCurrentThread, Tn as CopilotChatReasoningMessage, Tt as OpenGenerativeUIToolRenderer, U as useSuggestions, Un as CopilotChatAudioRecorder, Ut as Thread, V as useInterrupt, Vn as AudioRecorderError, Vt as CopilotThreadsDrawerProps, W as AgentContextInput, Wt as UseThreadsInput, X as useHumanInTheLoop, Xt as CopilotSidebarProps, Y as useAgent, Yt as CopilotSidebar, Z as useDefaultRenderTool, Zt as CopilotPopupView, _ as CopilotKitCoreReactConfig, _n as getIntelligenceTurnAnchors, _t as ReactCustomMessageRendererPosition, a as A2UIMessageRendererOptions, an as DefaultCloseIcon, at as InterruptEvent, b as MemoryChanges, bn as IntelligenceIndicatorViewProps, bt as GenerateSandboxedUiArgsSchema, c as InspectorAnchor, cn as CopilotChatProps, ct as InterruptResolveFn, d as CopilotKitProvider, dn as AutoScrollMode, dt as ReactHumanInTheLoop, en as CopilotSidebarViewProps, et as useFrontendTool, f as CopilotKitProviderProps, fn as CopilotChatMessageView, ft as ReactFrontendTool, g as CopilotKitCoreReact, gn as IntelligenceIndicatorProps, gt as ReactCustomMessageRenderer, h as useCopilotKit, hn as IntelligenceIndicator, ht as useRenderCustomMessages, i as A2UIActionInterceptor, in as CopilotChatToggleButtonProps, it as InterruptCancelFn, j as LearnFromUserActionInCurrentThreadInput, jn as CopilotChatToolCallsView, jt as ɵrunMcpFollowUp, k as UseAttachmentsReturn, kn as CopilotChatAssistantMessage, kt as MCPAppsActivityType, l as SandboxFunctionsContext, ln as CopilotChatView, lt as ResumeEntry, m as CopilotKitContextValue, mn as INTELLIGENCE_TURN_HEAD, mt as ReactToolCallRenderer, nn as CopilotModalHeaderProps, nt as SandboxFunction, o as A2UIUserAction, on as DefaultOpenIcon, ot as InterruptHandlerProps, p as A2UIRecoveryRendererOptions, pn as CopilotChatMessageViewProps, pt as ReactActivityMessageRenderer, q as useCapabilities, qt as CopilotPopup, r as CopilotKitProps, rn as CopilotChatToggleButton, rt as Interrupt, s as createA2UIMessageRenderer, sn as CopilotChat, st as InterruptRenderProps, t as CopilotKit, tn as CopilotModalHeader, tt as useRenderActivityMessage, u as useSandboxFunctions, un as CopilotChatViewProps, ut as defineToolCallRenderer, v as CopilotKitCoreReactSubscriber, vn as IntelligenceIndicatorStatus, vt as useRenderToolCall, w as UseLearningContainersInCurrentThreadArgs, wn as CopilotChatSuggestionPillProps, wt as OpenGenerativeUIContentSchema, x as MemoryKind, xn as CopilotChatSuggestionView, xt as OpenGenerativeUIActivityRenderer, y as Memory, yn as IntelligenceIndicatorView, yt as GenerateSandboxedUiArgs, z as useMemories, zn as CopilotChatLabels, zt as CopilotChatAttachmentQueue } from "../copilotkit-BE1n5tSI.mjs";
2
2
  import { Theme as A2UITheme, defaultTheme as a2uiDefaultTheme } from "@copilotkit/a2ui-renderer";
3
3
  export * from "@copilotkit/core";
4
4
  export * from "@ag-ui/client";
package/dist/v2/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { $ as useCapabilities, A as CopilotChatMessageView, At as CopilotChatConfigurationProvider, B as CopilotChatAssistantMessage_default, C as CopilotModalHeader, Ct as CopilotKitInspector, D as CopilotChat, Dt as CopilotChatInput_default, E as DefaultOpenIcon, Et as CopilotKitCoreReact, F as CopilotChatSuggestionView, G as useLearnFromUserActionInCurrentThread, H as useLearningContainersInCurrentThread, I as CopilotChatSuggestionPill, J as useThreads, K as useLearnFromUserAction, L as CopilotChatReasoningMessage_default, M as IntelligenceIndicator, N as getIntelligenceTurnAnchors, O as CopilotChatView_default, Ot as AudioRecorderError, P as IntelligenceIndicatorView, Q as useAgentContext, R as CopilotChatUserMessage_default, S as CopilotSidebarView, St as ɵrunMcpFollowUp, T as DefaultCloseIcon, Tt as useCopilotKit, U as useLearningContainers, V as CopilotChatToolCallsView, W as useAttachments, X as useConfigureSuggestions, Y as useInterrupt, Z as useSuggestions, _ as WildcardToolCallRender, _t as SandboxFunctionsContext, at as useComponent, b as CopilotSidebar, bt as MCPAppsActivityRenderer, ct as useRenderCustomMessages, dt as createA2UIMessageRenderer, et as UseAgentUpdate, ft as GenerateSandboxedUiArgsSchema, gt as OpenGenerativeUIToolRenderer, ht as OpenGenerativeUIContentSchema, it as useRenderTool, j as INTELLIGENCE_TURN_HEAD, jt as useCopilotChatConfiguration, k as CopilotChatAttachmentQueue, kt as CopilotChatAudioRecorder, lt as CopilotKitProvider, mt as OpenGenerativeUIActivityType, nt as useHumanInTheLoop, ot as useFrontendTool, pt as OpenGenerativeUIActivityRenderer, q as useMemories, rt as useDefaultRenderTool, st as useRenderActivityMessage, t as CopilotKit, tt as useAgent, ut as defineToolCallRenderer, v as CopilotThreadsDrawer, vt as useSandboxFunctions, w as CopilotChatToggleButton, wt as useRenderToolCall, x as CopilotPopupView, xt as MCPAppsActivityType, y as CopilotPopup, yt as MCPAppsActivityContentSchema, z as CopilotChatAttachmentRenderer } from "../copilotkit-BLh58_Tt.mjs";
3
+ import { $ as useCapabilities, A as CopilotChatMessageView, At as CopilotChatConfigurationProvider, B as CopilotChatAssistantMessage_default, C as CopilotModalHeader, Ct as CopilotKitInspector, D as CopilotChat, Dt as CopilotChatInput_default, E as DefaultOpenIcon, Et as CopilotKitCoreReact, F as CopilotChatSuggestionView, G as useLearnFromUserActionInCurrentThread, H as useLearningContainersInCurrentThread, I as CopilotChatSuggestionPill, J as useThreads, K as useLearnFromUserAction, L as CopilotChatReasoningMessage_default, M as IntelligenceIndicator, N as getIntelligenceTurnAnchors, O as CopilotChatView_default, Ot as AudioRecorderError, P as IntelligenceIndicatorView, Q as useAgentContext, R as CopilotChatUserMessage_default, S as CopilotSidebarView, St as ɵrunMcpFollowUp, T as DefaultCloseIcon, Tt as useCopilotKit, U as useLearningContainers, V as CopilotChatToolCallsView, W as useAttachments, X as useConfigureSuggestions, Y as useInterrupt, Z as useSuggestions, _ as WildcardToolCallRender, _t as SandboxFunctionsContext, at as useComponent, b as CopilotSidebar, bt as MCPAppsActivityRenderer, ct as useRenderCustomMessages, dt as createA2UIMessageRenderer, et as UseAgentUpdate, ft as GenerateSandboxedUiArgsSchema, gt as OpenGenerativeUIToolRenderer, ht as OpenGenerativeUIContentSchema, it as useRenderTool, j as INTELLIGENCE_TURN_HEAD, jt as useCopilotChatConfiguration, k as CopilotChatAttachmentQueue, kt as CopilotChatAudioRecorder, lt as CopilotKitProvider, mt as OpenGenerativeUIActivityType, nt as useHumanInTheLoop, ot as useFrontendTool, pt as OpenGenerativeUIActivityRenderer, q as useMemories, rt as useDefaultRenderTool, st as useRenderActivityMessage, t as CopilotKit, tt as useAgent, ut as defineToolCallRenderer, v as CopilotThreadsDrawer, vt as useSandboxFunctions, w as CopilotChatToggleButton, wt as useRenderToolCall, x as CopilotPopupView, xt as MCPAppsActivityType, y as CopilotPopup, yt as MCPAppsActivityContentSchema, z as CopilotChatAttachmentRenderer } from "../copilotkit-DL0LvmwQ.mjs";
4
4
  import "./index.css";
5
5
  import { defaultTheme as a2uiDefaultTheme } from "@copilotkit/a2ui-renderer";
6
6
 
@@ -37,7 +37,7 @@ react = __toESM(react);
37
37
  _radix_ui_react_tooltip = __toESM(_radix_ui_react_tooltip);
38
38
  _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
39
39
 
40
- //#region src/v2/lib/slots.tsx
40
+ //#region src/v2/lib/shallow-stable-ref.ts
41
41
  /**
42
42
  * Shallow equality comparison for objects.
43
43
  */
@@ -77,64 +77,6 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
77
77
  ref.current = value;
78
78
  return ref.current;
79
79
  }
80
- /**
81
- * Check if a value is a React component type (function, class, forwardRef, memo, etc.)
82
- */
83
- function isReactComponentType(value) {
84
- if (typeof value === "function") return true;
85
- if (value && typeof value === "object" && "$$typeof" in value && !react.default.isValidElement(value)) return true;
86
- return false;
87
- }
88
- /**
89
- * Internal function to render a slot value as a React element (non-memoized).
90
- */
91
- function renderSlotElement(slot, DefaultComponent, props) {
92
- if (typeof slot === "string") {
93
- const existingClassName = props.className;
94
- return react.default.createElement(DefaultComponent, {
95
- ...props,
96
- className: (0, tailwind_merge.twMerge)(existingClassName, slot)
97
- });
98
- }
99
- if (isReactComponentType(slot)) return react.default.createElement(slot, props);
100
- if (slot && typeof slot === "object" && !react.default.isValidElement(slot)) return react.default.createElement(DefaultComponent, {
101
- ...props,
102
- ...slot
103
- });
104
- return react.default.createElement(DefaultComponent, props);
105
- }
106
- /**
107
- * Internal memoized wrapper component for renderSlot.
108
- * Uses forwardRef to support ref forwarding.
109
- */
110
- const MemoizedSlotWrapper = react.default.memo(react.default.forwardRef(function MemoizedSlotWrapper(props, ref) {
111
- const { $slot, $component, ...rest } = props;
112
- return renderSlotElement($slot, $component, ref !== null ? {
113
- ...rest,
114
- ref
115
- } : rest);
116
- }), (prev, next) => {
117
- if (prev.$slot !== next.$slot) return false;
118
- if (prev.$component !== next.$component) return false;
119
- const { $slot: _ps, $component: _pc, ...prevRest } = prev;
120
- const { $slot: _ns, $component: _nc, ...nextRest } = next;
121
- return shallowEqual(prevRest, nextRest);
122
- });
123
- /**
124
- * Renders a slot value as a memoized React element.
125
- * Automatically prevents unnecessary re-renders using shallow prop comparison.
126
- * Supports ref forwarding.
127
- *
128
- * @example
129
- * renderSlot(customInput, CopilotChatInput, { onSubmit: handleSubmit })
130
- */
131
- function renderSlot(slot, DefaultComponent, props) {
132
- return react.default.createElement(MemoizedSlotWrapper, {
133
- ...props,
134
- $slot: slot,
135
- $component: DefaultComponent
136
- });
137
- }
138
80
 
139
81
  //#endregion
140
82
  //#region src/v2/providers/CopilotChatConfigurationProvider.tsx
@@ -342,9 +284,9 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
342
284
 
343
285
  //#endregion
344
286
  //#region src/v2/lib/utils.ts
345
- const twMerge$8 = (0, tailwind_merge.extendTailwindMerge)({ prefix: "cpk" });
287
+ const twMerge$9 = (0, tailwind_merge.extendTailwindMerge)({ prefix: "cpk" });
346
288
  function cn(...inputs) {
347
- return twMerge$8((0, clsx.clsx)(inputs));
289
+ return twMerge$9((0, clsx.clsx)(inputs));
348
290
  }
349
291
 
350
292
  //#endregion
@@ -438,12 +380,13 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
438
380
  ...props
439
381
  }) });
440
382
  }
441
- function TooltipTrigger({ ...props }) {
383
+ const TooltipTrigger = react.forwardRef(function TooltipTrigger({ ...props }, ref) {
442
384
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tooltip.Trigger, {
385
+ ref,
443
386
  "data-slot": "tooltip-trigger",
444
387
  ...props
445
388
  });
446
- }
389
+ });
447
390
  function TooltipContent({ className, sideOffset = 0, children, ...props }) {
448
391
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tooltip.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_tooltip.Content, {
449
392
  "data-copilotkit": true,
@@ -463,12 +406,13 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
463
406
  ...props
464
407
  });
465
408
  }
466
- function DropdownMenuTrigger({ ...props }) {
409
+ const DropdownMenuTrigger = react.forwardRef(function DropdownMenuTrigger({ ...props }, ref) {
467
410
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Trigger, {
411
+ ref,
468
412
  "data-slot": "dropdown-menu-trigger",
469
413
  ...props
470
414
  });
471
- }
415
+ });
472
416
  function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
473
417
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Content, {
474
418
  "data-copilotkit": true,
@@ -717,6 +661,67 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
717
661
  });
718
662
  CopilotChatAudioRecorder.displayName = "CopilotChatAudioRecorder";
719
663
 
664
+ //#endregion
665
+ //#region src/v2/lib/slots.tsx
666
+ /**
667
+ * Check if a value is a React component type (function, class, forwardRef, memo, etc.)
668
+ */
669
+ function isReactComponentType(value) {
670
+ if (typeof value === "function") return true;
671
+ if (value && typeof value === "object" && "$$typeof" in value && !react.default.isValidElement(value)) return true;
672
+ return false;
673
+ }
674
+ /**
675
+ * Internal function to render a slot value as a React element (non-memoized).
676
+ */
677
+ function renderSlotElement(slot, DefaultComponent, props) {
678
+ if (typeof slot === "string") {
679
+ const existingClassName = props.className;
680
+ return react.default.createElement(DefaultComponent, {
681
+ ...props,
682
+ className: (0, tailwind_merge.twMerge)(existingClassName, slot)
683
+ });
684
+ }
685
+ if (isReactComponentType(slot)) return react.default.createElement(slot, props);
686
+ if (slot && typeof slot === "object" && !react.default.isValidElement(slot)) return react.default.createElement(DefaultComponent, {
687
+ ...props,
688
+ ...slot
689
+ });
690
+ return react.default.createElement(DefaultComponent, props);
691
+ }
692
+ /**
693
+ * Internal memoized wrapper component for renderSlot.
694
+ * Uses forwardRef to support ref forwarding.
695
+ */
696
+ const MemoizedSlotWrapper = react.default.memo(react.default.forwardRef(function MemoizedSlotWrapper(props, ref) {
697
+ const { $slot, $component, ...rest } = props;
698
+ return renderSlotElement($slot, $component, ref !== null ? {
699
+ ...rest,
700
+ ref
701
+ } : rest);
702
+ }), (prev, next) => {
703
+ if (prev.$slot !== next.$slot) return false;
704
+ if (prev.$component !== next.$component) return false;
705
+ const { $slot: _ps, $component: _pc, ...prevRest } = prev;
706
+ const { $slot: _ns, $component: _nc, ...nextRest } = next;
707
+ return shallowEqual(prevRest, nextRest);
708
+ });
709
+ /**
710
+ * Renders a slot value as a memoized React element.
711
+ * Automatically prevents unnecessary re-renders using shallow prop comparison.
712
+ * Supports ref forwarding.
713
+ *
714
+ * @example
715
+ * renderSlot(customInput, CopilotChatInput, { onSubmit: handleSubmit })
716
+ */
717
+ function renderSlot(slot, DefaultComponent, props) {
718
+ return react.default.createElement(MemoizedSlotWrapper, {
719
+ ...props,
720
+ $slot: slot,
721
+ $component: DefaultComponent
722
+ });
723
+ }
724
+
720
725
  //#endregion
721
726
  //#region src/v2/components/chat/CopilotChatInput.tsx
722
727
  const SLASH_MENU_MAX_VISIBLE_ITEMS = 5;
@@ -1070,7 +1075,6 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
1070
1075
  }
1071
1076
  if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
1072
1077
  if (window.matchMedia("(max-width: 767px)").matches) {
1073
- ensureMeasurements();
1074
1078
  adjustTextareaHeight();
1075
1079
  updateLayout("expanded");
1076
1080
  return;
@@ -4411,11 +4415,14 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4411
4415
  const [, forceUpdate] = (0, react.useReducer)((x) => x + 1, 0);
4412
4416
  const updateFlags = (0, react.useMemo)(() => updates ?? ALL_UPDATES, [JSON.stringify(updates)]);
4413
4417
  const provisionalAgentCache = (0, react.useRef)(/* @__PURE__ */ new Map());
4414
- const agent = (0, react.useMemo)(() => {
4418
+ const { agent, isReady } = (0, react.useMemo)(() => {
4415
4419
  const existing = copilotkit.getAgent(resolvedAgentId);
4416
4420
  if (existing) {
4417
4421
  provisionalAgentCache.current.delete(resolvedAgentId);
4418
- return existing;
4422
+ return {
4423
+ agent: existing,
4424
+ isReady: true
4425
+ };
4419
4426
  }
4420
4427
  const isRuntimeConfigured = copilotkit.runtimeUrl !== void 0;
4421
4428
  const status = copilotkit.runtimeConnectionStatus;
@@ -4423,7 +4430,10 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4423
4430
  const cached = provisionalAgentCache.current.get(resolvedAgentId);
4424
4431
  if (cached) {
4425
4432
  copilotkit.applyHeadersToAgent(cached);
4426
- return cached;
4433
+ return {
4434
+ agent: cached,
4435
+ isReady: false
4436
+ };
4427
4437
  }
4428
4438
  const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
4429
4439
  runtimeUrl: copilotkit.runtimeUrl,
@@ -4433,13 +4443,19 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4433
4443
  });
4434
4444
  copilotkit.applyHeadersToAgent(provisional);
4435
4445
  provisionalAgentCache.current.set(resolvedAgentId, provisional);
4436
- return provisional;
4446
+ return {
4447
+ agent: provisional,
4448
+ isReady: false
4449
+ };
4437
4450
  }
4438
4451
  if (isRuntimeConfigured && status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Error) {
4439
4452
  const cached = provisionalAgentCache.current.get(resolvedAgentId);
4440
4453
  if (cached) {
4441
4454
  copilotkit.applyHeadersToAgent(cached);
4442
- return cached;
4455
+ return {
4456
+ agent: cached,
4457
+ isReady: false
4458
+ };
4443
4459
  }
4444
4460
  const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
4445
4461
  runtimeUrl: copilotkit.runtimeUrl,
@@ -4449,7 +4465,10 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4449
4465
  });
4450
4466
  copilotkit.applyHeadersToAgent(provisional);
4451
4467
  provisionalAgentCache.current.set(resolvedAgentId, provisional);
4452
- return provisional;
4468
+ return {
4469
+ agent: provisional,
4470
+ isReady: false
4471
+ };
4453
4472
  }
4454
4473
  const knownAgents = Object.keys(copilotkit.agents ?? {});
4455
4474
  const runtimePart = isRuntimeConfigured ? `runtimeUrl=${copilotkit.runtimeUrl}` : "no runtimeUrl";
@@ -4510,7 +4529,10 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4510
4529
  configThreadId,
4511
4530
  configHasExplicitThreadId
4512
4531
  ]);
4513
- return { agent };
4532
+ return {
4533
+ agent,
4534
+ isReady
4535
+ };
4514
4536
  }
4515
4537
 
4516
4538
  //#endregion
@@ -4818,8 +4840,9 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4818
4840
  const pendingRef = (0, react.useRef)(pending);
4819
4841
  pendingRef.current = pending;
4820
4842
  const [handlerResult, setHandlerResult] = (0, react.useState)(null);
4821
- const responsesRef = (0, react.useRef)({});
4843
+ const interruptStateRef = (0, react.useRef)(new _copilotkit_core.ɵInterruptState());
4822
4844
  (0, react.useEffect)(() => {
4845
+ const interruptState = interruptStateRef.current;
4823
4846
  let localLegacy = null;
4824
4847
  let localStandard = null;
4825
4848
  const subscription = agent.subscribe({
@@ -4835,106 +4858,111 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4835
4858
  onRunStartedEvent: () => {
4836
4859
  localLegacy = null;
4837
4860
  localStandard = null;
4838
- responsesRef.current = {};
4861
+ interruptState.clear();
4839
4862
  setPending(null);
4840
4863
  },
4841
4864
  onRunFinalized: () => {
4842
- if (localStandard && localStandard.length > 0) setPending({
4843
- kind: "standard",
4844
- interrupts: localStandard
4845
- });
4846
- else if (localLegacy) setPending({
4847
- kind: "legacy",
4848
- event: localLegacy
4849
- });
4865
+ if (localStandard && localStandard.length > 0) {
4866
+ interruptState.setStandard(localStandard);
4867
+ setPending(interruptState.pending);
4868
+ } else if (localLegacy) {
4869
+ interruptState.setLegacy(localLegacy);
4870
+ setPending(interruptState.pending);
4871
+ }
4850
4872
  localLegacy = null;
4851
4873
  localStandard = null;
4852
4874
  },
4853
4875
  onRunFailed: () => {
4854
4876
  localLegacy = null;
4855
4877
  localStandard = null;
4856
- responsesRef.current = {};
4878
+ interruptState.clear();
4857
4879
  setPending(null);
4858
4880
  }
4859
4881
  });
4860
- return () => subscription.unsubscribe();
4882
+ return () => {
4883
+ subscription.unsubscribe();
4884
+ interruptState.clear();
4885
+ };
4861
4886
  }, [agent]);
4862
- const submitStandardIfComplete = (0, react.useCallback)(async (interrupts) => {
4863
- if (!interrupts.every((i) => responsesRef.current[i.id])) return;
4864
- const expired = interrupts.find((i) => (0, _ag_ui_client.isInterruptExpired)(i));
4865
- if (expired) {
4866
- console.error(`[CopilotKit] useInterrupt: interrupt ${expired.id} expired at ${expired.expiresAt}; not resuming.`);
4867
- responsesRef.current = {};
4868
- setPending(null);
4869
- return;
4870
- }
4871
- const resume = (0, _ag_ui_client.buildResumeArray)(interrupts, responsesRef.current);
4872
- for (const i of interrupts) {
4873
- if (!i.toolCallId) continue;
4874
- const response = responsesRef.current[i.id];
4875
- const content = response.status === "cancelled" ? { status: "cancelled" } : response.payload ?? { status: "resolved" };
4876
- agent.addMessage({
4877
- id: (0, _ag_ui_client.randomUUID)(),
4878
- role: "tool",
4879
- toolCallId: i.toolCallId,
4880
- content: JSON.stringify(content)
4881
- });
4882
- }
4883
- responsesRef.current = {};
4884
- try {
4887
+ const resolve = (0, react.useCallback)(async (payload, interruptId) => {
4888
+ const current = pendingRef.current;
4889
+ if (!current) return;
4890
+ if (current.kind === "standard" && current.interrupts.length > 1 && interruptId === void 0) console.warn(`[CopilotKit] useInterrupt: resolve()/cancel() called without an interruptId while ${current.interrupts.length} interrupts are open; defaulting to the first. Pass an interruptId to address a specific interrupt.`);
4891
+ const decision = interruptStateRef.current.resolve(payload, interruptId);
4892
+ if (decision.kind === "legacy-resume") try {
4885
4893
  return await copilotkit.runAgent({
4886
4894
  agent,
4887
- resume
4895
+ forwardedProps: { command: {
4896
+ resume: decision.payload,
4897
+ interruptEvent: decision.interruptValue
4898
+ } }
4888
4899
  });
4889
4900
  } catch (err) {
4890
4901
  console.error("[CopilotKit] useInterrupt resolve: runAgent rejected; clearing pending + rethrowing", err);
4891
4902
  setPending(null);
4892
4903
  throw err;
4893
4904
  }
4894
- }, [agent, copilotkit]);
4895
- const resolve = (0, react.useCallback)(async (payload, interruptId) => {
4896
- const current = pendingRef.current;
4897
- if (!current) return;
4898
- if (current.kind === "legacy") try {
4905
+ if (decision.kind === "expired") {
4906
+ console.error(`[CopilotKit] useInterrupt: interrupt ${decision.interrupt.id} expired at ${decision.interrupt.expiresAt}; not resuming.`);
4907
+ interruptStateRef.current.clear();
4908
+ setPending(null);
4909
+ return;
4910
+ }
4911
+ if (decision.kind !== "resume") return;
4912
+ for (const toolResult of decision.toolResults) agent.addMessage({
4913
+ id: (0, _ag_ui_client.randomUUID)(),
4914
+ role: "tool",
4915
+ toolCallId: toolResult.toolCallId,
4916
+ content: toolResult.content
4917
+ });
4918
+ try {
4899
4919
  return await copilotkit.runAgent({
4900
4920
  agent,
4901
- forwardedProps: { command: {
4902
- resume: payload,
4903
- interruptEvent: current.event.value
4904
- } }
4921
+ resume: decision.resume
4905
4922
  });
4906
4923
  } catch (err) {
4907
4924
  console.error("[CopilotKit] useInterrupt resolve: runAgent rejected; clearing pending + rethrowing", err);
4925
+ interruptStateRef.current.clear();
4908
4926
  setPending(null);
4909
4927
  throw err;
4910
4928
  }
4911
- if (current.interrupts.length > 1 && interruptId === void 0) console.warn(`[CopilotKit] useInterrupt: resolve()/cancel() called without an interruptId while ${current.interrupts.length} interrupts are open; defaulting to the first. Pass an interruptId to address a specific interrupt.`);
4912
- const id = interruptId ?? current.interrupts[0]?.id;
4913
- if (!id) return;
4914
- responsesRef.current[id] = {
4915
- status: "resolved",
4916
- payload
4917
- };
4918
- return submitStandardIfComplete(current.interrupts);
4919
- }, [
4920
- agent,
4921
- copilotkit,
4922
- submitStandardIfComplete
4923
- ]);
4929
+ }, [agent, copilotkit]);
4924
4930
  const cancel = (0, react.useCallback)(async (interruptId) => {
4925
4931
  const current = pendingRef.current;
4926
4932
  if (!current) return;
4927
- if (current.kind === "legacy") {
4933
+ if (current.kind === "standard" && current.interrupts.length > 1 && interruptId === void 0) console.warn(`[CopilotKit] useInterrupt: resolve()/cancel() called without an interruptId while ${current.interrupts.length} interrupts are open; defaulting to the first. Pass an interruptId to address a specific interrupt.`);
4934
+ const decision = interruptStateRef.current.cancel(interruptId);
4935
+ if (decision.kind === "dismiss") {
4928
4936
  console.warn("[CopilotKit] useInterrupt: cancel() is not supported for legacy on_interrupt interrupts; dismissing.");
4937
+ interruptStateRef.current.clear();
4929
4938
  setPending(null);
4930
4939
  return;
4931
4940
  }
4932
- if (current.interrupts.length > 1 && interruptId === void 0) console.warn(`[CopilotKit] useInterrupt: resolve()/cancel() called without an interruptId while ${current.interrupts.length} interrupts are open; defaulting to the first. Pass an interruptId to address a specific interrupt.`);
4933
- const id = interruptId ?? current.interrupts[0]?.id;
4934
- if (!id) return;
4935
- responsesRef.current[id] = { status: "cancelled" };
4936
- return submitStandardIfComplete(current.interrupts);
4937
- }, [submitStandardIfComplete]);
4941
+ if (decision.kind === "expired") {
4942
+ console.error(`[CopilotKit] useInterrupt: interrupt ${decision.interrupt.id} expired at ${decision.interrupt.expiresAt}; not resuming.`);
4943
+ interruptStateRef.current.clear();
4944
+ setPending(null);
4945
+ return;
4946
+ }
4947
+ if (decision.kind !== "resume") return;
4948
+ for (const toolResult of decision.toolResults) agent.addMessage({
4949
+ id: (0, _ag_ui_client.randomUUID)(),
4950
+ role: "tool",
4951
+ toolCallId: toolResult.toolCallId,
4952
+ content: toolResult.content
4953
+ });
4954
+ try {
4955
+ return await copilotkit.runAgent({
4956
+ agent,
4957
+ resume: decision.resume
4958
+ });
4959
+ } catch (err) {
4960
+ console.error("[CopilotKit] useInterrupt resolve: runAgent rejected; clearing pending + rethrowing", err);
4961
+ interruptStateRef.current.clear();
4962
+ setPending(null);
4963
+ throw err;
4964
+ }
4965
+ }, [agent, copilotkit]);
4938
4966
  const renderRef = (0, react.useRef)(config.render);
4939
4967
  renderRef.current = config.render;
4940
4968
  const enabledRef = (0, react.useRef)(config.enabled);
@@ -4976,7 +5004,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4976
5004
  maybePromise = handler({
4977
5005
  event: legacyEvent,
4978
5006
  interrupt: pending.kind === "standard" ? pending.interrupts[0] : null,
4979
- interrupts: pending.kind === "standard" ? pending.interrupts : [],
5007
+ interrupts: pending.kind === "standard" ? [...pending.interrupts] : [],
4980
5008
  resolve: resolveRef.current,
4981
5009
  cancel: cancelRef.current
4982
5010
  });
@@ -5005,7 +5033,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5005
5033
  return renderRef.current({
5006
5034
  event: legacyEvent,
5007
5035
  interrupt: pending.kind === "standard" ? pending.interrupts[0] : null,
5008
- interrupts: pending.kind === "standard" ? pending.interrupts : [],
5036
+ interrupts: pending.kind === "standard" ? [...pending.interrupts] : [],
5009
5037
  result: handlerResult,
5010
5038
  resolve,
5011
5039
  cancel