@copilotkit/react-core 1.69.2 → 1.69.3

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 (33) hide show
  1. package/dist/{copilotkit-Ba7qwYt3.cjs → copilotkit-BPeh62mW.cjs} +73 -56
  2. package/dist/copilotkit-BPeh62mW.cjs.map +1 -0
  3. package/dist/{copilotkit-CF1Pm2VG.d.cts → copilotkit-CrNUgJiq.d.cts} +17 -15
  4. package/dist/{copilotkit-CF1Pm2VG.d.cts.map → copilotkit-CrNUgJiq.d.cts.map} +1 -1
  5. package/dist/{copilotkit-TdM-5onZ.d.mts → copilotkit-DgO31tBq.d.mts} +17 -15
  6. package/dist/{copilotkit-TdM-5onZ.d.mts.map → copilotkit-DgO31tBq.d.mts.map} +1 -1
  7. package/dist/{copilotkit-BmW2sFH6.mjs → copilotkit-JdHy0xdu.mjs} +74 -57
  8. package/dist/copilotkit-JdHy0xdu.mjs.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 +73 -55
  14. package/dist/index.umd.js.map +1 -1
  15. package/dist/v2/headless.cjs +1 -1
  16. package/dist/v2/headless.cjs.map +1 -1
  17. package/dist/v2/headless.mjs +1 -1
  18. package/dist/v2/headless.mjs.map +1 -1
  19. package/dist/v2/index.cjs +1 -1
  20. package/dist/v2/index.d.cts +1 -1
  21. package/dist/v2/index.d.mts +1 -1
  22. package/dist/v2/index.mjs +1 -1
  23. package/dist/v2/index.umd.js +76 -58
  24. package/dist/v2/index.umd.js.map +1 -1
  25. package/package.json +7 -8
  26. package/skills/react-core/SKILL.md +5 -3
  27. package/skills/react-core/references/agent-access.md +68 -1
  28. package/skills/react-core/references/debug-mode.md +21 -34
  29. package/skills/react-core/references/switching-agents-recipes.md +1 -0
  30. package/skills/react-core/references/switching-agents.md +9 -0
  31. package/skills/react-core/references/threads.md +65 -0
  32. package/dist/copilotkit-Ba7qwYt3.cjs.map +0 -1
  33. package/dist/copilotkit-BmW2sFH6.mjs.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-Ba7qwYt3.cjs');
4
+ const require_copilotkit = require('../copilotkit-BPeh62mW.cjs');
5
5
  require("./index.css");
6
6
  let _copilotkit_a2ui_renderer = require("@copilotkit/a2ui-renderer");
7
7
  let _copilotkit_react_core_v2_context = require("@copilotkit/react-core/v2/context");
@@ -1,4 +1,4 @@
1
- import { $ as useRenderTool, $t as CopilotPopupViewProps, A as UseAttachmentsReturn, An as CopilotChatAssistantMessage, At as MCPAppsActivityType, B as useMemories, Bn as CopilotChatConfigurationValue, Bt as CopilotChatAttachmentQueue, C as MemoryScope, Cn as CopilotChatSuggestionViewProps, Ct as OpenGenerativeUIActivityType, D as UseLearningContainersArgs, Dn as CopilotChatReasoningMessageProps, Dt as MCPAppsActivityContent, E as useLearningContainersInCurrentThread, En as CopilotChatReasoningMessage, Et as OpenGenerativeUIToolRenderer, F as LearnFromUserActionInput, Fn as CopilotChatInput, Ft as WildcardToolCallRender, G as AgentContextInput, Gn as CopilotChatAudioRecorder, Gt as UseThreadsInput, H as useInterrupt, Hn as useCopilotChatConfiguration, Ht as CopilotThreadsDrawerProps, I as LearnFromUserActionResult, In as CopilotChatInputProps, It as Attachment, J as useCapabilities, Jt as CopilotPopup, K as JsonSerializable, Kt as UseThreadsResult, L as UseLearnFromUserActionRecorder, Ln as ToolsMenuItem, Lt as AttachmentModality, M as LearnFromUserActionInCurrentThreadInput, Mn as CopilotChatFeedbackMessage, Mt as ɵrunMcpFollowUp, N as UseLearnFromUserActionInCurrentThreadRecorder, Nn as CopilotChatToolCallsView, Nt as CopilotKitInspector, O as useLearningContainers, On as CopilotChatUserMessage, Ot as MCPAppsActivityContentSchema, P as useLearnFromUserActionInCurrentThread, Pn as CopilotChatToolCallsViewProps, Pt as CopilotKitInspectorProps, Q as useDefaultRenderTool, Qt as CopilotPopupView, R as useLearnFromUserAction, Rn as CopilotChatConfigurationProvider, Rt as AttachmentsConfig, S as MemoryKind, Sn as CopilotChatSuggestionView, St as OpenGenerativeUIActivityRenderer, T as UseLearningContainersInCurrentThreadArgs, Tn as CopilotChatSuggestionPillProps, Tt as OpenGenerativeUIContentSchema, U as useConfigureSuggestions, Un as AudioRecorderError, Ut as CopilotThreadsDrawerRowRenderer, V as UseInterruptConfig, Vn as CopilotChatLabels, Vt as CopilotThreadsDrawer, W as useSuggestions, Wn as AudioRecorderState, Wt as Thread, X as useAgent, Xt as CopilotSidebar, Y as UseAgentUpdate, Yt as CopilotPopupProps, Z as useHumanInTheLoop, Zt as CopilotSidebarProps, _ as CopilotKitCoreReact, _n as IntelligenceIndicatorProps, _t as ReactCustomMessageRenderer, a as A2UIMessageRendererOptions, an as CopilotChatToggleButtonProps, at as InterruptCancelFn, b as Memory, bn as IntelligenceIndicatorView, bt as GenerateSandboxedUiArgs, c as InspectorAnchor, cn as CopilotChat, ct as InterruptRenderProps, d as CopilotKitProvider, dn as CopilotChatViewProps, dt as defineToolCallRenderer, en as CopilotSidebarView, et as useComponent, f as CopilotKitProviderProps, fn as AutoScrollMode, ft as ReactHumanInTheLoop, g as useLicenseContext, gn as IntelligenceIndicator, gt as useRenderCustomMessages, h as useCopilotKit, hn as INTELLIGENCE_TURN_HEAD, ht as ReactToolCallRenderer, i as A2UIActionInterceptor, in as CopilotChatToggleButton, it as Interrupt, j as useAttachments, jn as CopilotChatAssistantMessageProps, jt as ɵMcpFollowUpHost, k as UseAttachmentsProps, kn as CopilotChatUserMessageProps, kt as MCPAppsActivityRenderer, l as SandboxFunctionsContext, ln as CopilotChatProps, lt as InterruptResolveFn, m as CopilotKitContextValue, mn as CopilotChatMessageViewProps, mt as ReactActivityMessageRenderer, nn as CopilotModalHeader, nt as useRenderActivityMessage, o as A2UIUserAction, on as DefaultCloseIcon, ot as InterruptEvent, p as A2UIRecoveryRendererOptions, pn as CopilotChatMessageView, pt as ReactFrontendTool, q as useAgentContext, qt as useThreads, r as CopilotKitProps, rn as CopilotModalHeaderProps, rt as SandboxFunction, s as createA2UIMessageRenderer, sn as DefaultOpenIcon, st as InterruptHandlerProps, t as CopilotKit, tn as CopilotSidebarViewProps, tt as useFrontendTool, u as useSandboxFunctions, un as CopilotChatView, ut as ResumeEntry, v as CopilotKitCoreReactConfig, vn as getIntelligenceTurnAnchors, vt as ReactCustomMessageRendererPosition, w as NewMemory, wn as CopilotChatSuggestionPill, wt as OpenGenerativeUIContent, x as MemoryChanges, xn as IntelligenceIndicatorViewProps, xt as GenerateSandboxedUiArgsSchema, y as CopilotKitCoreReactSubscriber, yn as IntelligenceIndicatorStatus, yt as useRenderToolCall, z as UseMemoriesResult, zn as CopilotChatConfigurationProviderProps, zt as CopilotChatAttachmentRenderer } from "../copilotkit-CF1Pm2VG.cjs";
1
+ import { $ as useRenderTool, $t as CopilotPopupViewProps, A as UseAttachmentsReturn, An as CopilotChatAssistantMessage, At as MCPAppsActivityType, B as useMemories, Bn as CopilotChatConfigurationValue, Bt as CopilotChatAttachmentQueue, C as MemoryScope, Cn as CopilotChatSuggestionViewProps, Ct as OpenGenerativeUIActivityType, D as UseLearningContainersArgs, Dn as CopilotChatReasoningMessageProps, Dt as MCPAppsActivityContent, E as useLearningContainersInCurrentThread, En as CopilotChatReasoningMessage, Et as OpenGenerativeUIToolRenderer, F as LearnFromUserActionInput, Fn as CopilotChatInput, Ft as WildcardToolCallRender, G as AgentContextInput, Gn as CopilotChatAudioRecorder, Gt as UseThreadsInput, H as useInterrupt, Hn as useCopilotChatConfiguration, Ht as CopilotThreadsDrawerProps, I as LearnFromUserActionResult, In as CopilotChatInputProps, It as Attachment, J as useCapabilities, Jt as CopilotPopup, K as JsonSerializable, Kt as UseThreadsResult, L as UseLearnFromUserActionRecorder, Ln as ToolsMenuItem, Lt as AttachmentModality, M as LearnFromUserActionInCurrentThreadInput, Mn as CopilotChatFeedbackMessage, Mt as ɵrunMcpFollowUp, N as UseLearnFromUserActionInCurrentThreadRecorder, Nn as CopilotChatToolCallsView, Nt as CopilotKitInspector, O as useLearningContainers, On as CopilotChatUserMessage, Ot as MCPAppsActivityContentSchema, P as useLearnFromUserActionInCurrentThread, Pn as CopilotChatToolCallsViewProps, Pt as CopilotKitInspectorProps, Q as useDefaultRenderTool, Qt as CopilotPopupView, R as useLearnFromUserAction, Rn as CopilotChatConfigurationProvider, Rt as AttachmentsConfig, S as MemoryKind, Sn as CopilotChatSuggestionView, St as OpenGenerativeUIActivityRenderer, T as UseLearningContainersInCurrentThreadArgs, Tn as CopilotChatSuggestionPillProps, Tt as OpenGenerativeUIContentSchema, U as useConfigureSuggestions, Un as AudioRecorderError, Ut as CopilotThreadsDrawerRowRenderer, V as UseInterruptConfig, Vn as CopilotChatLabels, Vt as CopilotThreadsDrawer, W as useSuggestions, Wn as AudioRecorderState, Wt as Thread, X as useAgent, Xt as CopilotSidebar, Y as UseAgentUpdate, Yt as CopilotPopupProps, Z as useHumanInTheLoop, Zt as CopilotSidebarProps, _ as CopilotKitCoreReact, _n as IntelligenceIndicatorProps, _t as ReactCustomMessageRenderer, a as A2UIMessageRendererOptions, an as CopilotChatToggleButtonProps, at as InterruptCancelFn, b as Memory, bn as IntelligenceIndicatorView, bt as GenerateSandboxedUiArgs, c as InspectorAnchor, cn as CopilotChat, ct as InterruptRenderProps, d as CopilotKitProvider, dn as CopilotChatViewProps, dt as defineToolCallRenderer, en as CopilotSidebarView, et as useComponent, f as CopilotKitProviderProps, fn as AutoScrollMode, ft as ReactHumanInTheLoop, g as useLicenseContext, gn as IntelligenceIndicator, gt as useRenderCustomMessages, h as useCopilotKit, hn as INTELLIGENCE_TURN_HEAD, ht as ReactToolCallRenderer, i as A2UIActionInterceptor, in as CopilotChatToggleButton, it as Interrupt, j as useAttachments, jn as CopilotChatAssistantMessageProps, jt as ɵMcpFollowUpHost, k as UseAttachmentsProps, kn as CopilotChatUserMessageProps, kt as MCPAppsActivityRenderer, l as SandboxFunctionsContext, ln as CopilotChatProps, lt as InterruptResolveFn, m as CopilotKitContextValue, mn as CopilotChatMessageViewProps, mt as ReactActivityMessageRenderer, nn as CopilotModalHeader, nt as useRenderActivityMessage, o as A2UIUserAction, on as DefaultCloseIcon, ot as InterruptEvent, p as A2UIRecoveryRendererOptions, pn as CopilotChatMessageView, pt as ReactFrontendTool, q as useAgentContext, qt as useThreads, r as CopilotKitProps, rn as CopilotModalHeaderProps, rt as SandboxFunction, s as createA2UIMessageRenderer, sn as DefaultOpenIcon, st as InterruptHandlerProps, t as CopilotKit, tn as CopilotSidebarViewProps, tt as useFrontendTool, u as useSandboxFunctions, un as CopilotChatView, ut as ResumeEntry, v as CopilotKitCoreReactConfig, vn as getIntelligenceTurnAnchors, vt as ReactCustomMessageRendererPosition, w as NewMemory, wn as CopilotChatSuggestionPill, wt as OpenGenerativeUIContent, x as MemoryChanges, xn as IntelligenceIndicatorViewProps, xt as GenerateSandboxedUiArgsSchema, y as CopilotKitCoreReactSubscriber, yn as IntelligenceIndicatorStatus, yt as useRenderToolCall, z as UseMemoriesResult, zn as CopilotChatConfigurationProviderProps, zt as CopilotChatAttachmentRenderer } from "../copilotkit-CrNUgJiq.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 useRenderTool, $t as CopilotPopupViewProps, A as UseAttachmentsReturn, An as CopilotChatAssistantMessage, At as MCPAppsActivityType, B as useMemories, Bn as CopilotChatConfigurationValue, Bt as CopilotChatAttachmentQueue, C as MemoryScope, Cn as CopilotChatSuggestionViewProps, Ct as OpenGenerativeUIActivityType, D as UseLearningContainersArgs, Dn as CopilotChatReasoningMessageProps, Dt as MCPAppsActivityContent, E as useLearningContainersInCurrentThread, En as CopilotChatReasoningMessage, Et as OpenGenerativeUIToolRenderer, F as LearnFromUserActionInput, Fn as CopilotChatInput, Ft as WildcardToolCallRender, G as AgentContextInput, Gn as CopilotChatAudioRecorder, Gt as UseThreadsInput, H as useInterrupt, Hn as useCopilotChatConfiguration, Ht as CopilotThreadsDrawerProps, I as LearnFromUserActionResult, In as CopilotChatInputProps, It as Attachment, J as useCapabilities, Jt as CopilotPopup, K as JsonSerializable, Kt as UseThreadsResult, L as UseLearnFromUserActionRecorder, Ln as ToolsMenuItem, Lt as AttachmentModality, M as LearnFromUserActionInCurrentThreadInput, Mn as CopilotChatFeedbackMessage, Mt as ɵrunMcpFollowUp, N as UseLearnFromUserActionInCurrentThreadRecorder, Nn as CopilotChatToolCallsView, Nt as CopilotKitInspector, O as useLearningContainers, On as CopilotChatUserMessage, Ot as MCPAppsActivityContentSchema, P as useLearnFromUserActionInCurrentThread, Pn as CopilotChatToolCallsViewProps, Pt as CopilotKitInspectorProps, Q as useDefaultRenderTool, Qt as CopilotPopupView, R as useLearnFromUserAction, Rn as CopilotChatConfigurationProvider, Rt as AttachmentsConfig, S as MemoryKind, Sn as CopilotChatSuggestionView, St as OpenGenerativeUIActivityRenderer, T as UseLearningContainersInCurrentThreadArgs, Tn as CopilotChatSuggestionPillProps, Tt as OpenGenerativeUIContentSchema, U as useConfigureSuggestions, Un as AudioRecorderError, Ut as CopilotThreadsDrawerRowRenderer, V as UseInterruptConfig, Vn as CopilotChatLabels, Vt as CopilotThreadsDrawer, W as useSuggestions, Wn as AudioRecorderState, Wt as Thread, X as useAgent, Xt as CopilotSidebar, Y as UseAgentUpdate, Yt as CopilotPopupProps, Z as useHumanInTheLoop, Zt as CopilotSidebarProps, _ as useCopilotKit, _n as IntelligenceIndicatorProps, _t as ReactCustomMessageRenderer, a as A2UIMessageRendererOptions, an as CopilotChatToggleButtonProps, at as InterruptCancelFn, b as Memory, bn as IntelligenceIndicatorView, bt as GenerateSandboxedUiArgs, c as CopilotKitCoreReact, cn as CopilotChat, ct as InterruptRenderProps, d as InspectorAnchor, dn as CopilotChatViewProps, dt as defineToolCallRenderer, en as CopilotSidebarView, et as useComponent, f as SandboxFunctionsContext, fn as AutoScrollMode, ft as ReactHumanInTheLoop, g as CopilotKitProviderProps, gn as IntelligenceIndicator, gt as useRenderCustomMessages, h as CopilotKitProvider, hn as INTELLIGENCE_TURN_HEAD, ht as ReactToolCallRenderer, i as A2UIActionInterceptor, in as CopilotChatToggleButton, it as Interrupt, j as useAttachments, jn as CopilotChatAssistantMessageProps, jt as ɵMcpFollowUpHost, k as UseAttachmentsProps, kn as CopilotChatUserMessageProps, kt as MCPAppsActivityRenderer, l as CopilotKitCoreReactConfig, ln as CopilotChatProps, lt as InterruptResolveFn, m as CopilotKitContextValue, mn as CopilotChatMessageViewProps, mt as ReactActivityMessageRenderer, nn as CopilotModalHeader, nt as useRenderActivityMessage, o as A2UIUserAction, on as DefaultCloseIcon, ot as InterruptEvent, p as useSandboxFunctions, pn as CopilotChatMessageView, pt as ReactFrontendTool, q as useAgentContext, qt as useThreads, r as CopilotKitProps, rn as CopilotModalHeaderProps, rt as SandboxFunction, s as createA2UIMessageRenderer, sn as DefaultOpenIcon, st as InterruptHandlerProps, t as CopilotKit, tn as CopilotSidebarViewProps, tt as useFrontendTool, u as CopilotKitCoreReactSubscriber, un as CopilotChatView, ut as ResumeEntry, v as useLicenseContext, vn as getIntelligenceTurnAnchors, vt as ReactCustomMessageRendererPosition, w as NewMemory, wn as CopilotChatSuggestionPill, wt as OpenGenerativeUIContent, x as MemoryChanges, xn as IntelligenceIndicatorViewProps, xt as GenerateSandboxedUiArgsSchema, y as A2UIRecoveryRendererOptions, yn as IntelligenceIndicatorStatus, yt as useRenderToolCall, z as UseMemoriesResult, zn as CopilotChatConfigurationProviderProps, zt as CopilotChatAttachmentRenderer } from "../copilotkit-TdM-5onZ.mjs";
1
+ import { $ as useRenderTool, $t as CopilotPopupViewProps, A as UseAttachmentsReturn, An as CopilotChatAssistantMessage, At as MCPAppsActivityType, B as useMemories, Bn as CopilotChatConfigurationValue, Bt as CopilotChatAttachmentQueue, C as MemoryScope, Cn as CopilotChatSuggestionViewProps, Ct as OpenGenerativeUIActivityType, D as UseLearningContainersArgs, Dn as CopilotChatReasoningMessageProps, Dt as MCPAppsActivityContent, E as useLearningContainersInCurrentThread, En as CopilotChatReasoningMessage, Et as OpenGenerativeUIToolRenderer, F as LearnFromUserActionInput, Fn as CopilotChatInput, Ft as WildcardToolCallRender, G as AgentContextInput, Gn as CopilotChatAudioRecorder, Gt as UseThreadsInput, H as useInterrupt, Hn as useCopilotChatConfiguration, Ht as CopilotThreadsDrawerProps, I as LearnFromUserActionResult, In as CopilotChatInputProps, It as Attachment, J as useCapabilities, Jt as CopilotPopup, K as JsonSerializable, Kt as UseThreadsResult, L as UseLearnFromUserActionRecorder, Ln as ToolsMenuItem, Lt as AttachmentModality, M as LearnFromUserActionInCurrentThreadInput, Mn as CopilotChatFeedbackMessage, Mt as ɵrunMcpFollowUp, N as UseLearnFromUserActionInCurrentThreadRecorder, Nn as CopilotChatToolCallsView, Nt as CopilotKitInspector, O as useLearningContainers, On as CopilotChatUserMessage, Ot as MCPAppsActivityContentSchema, P as useLearnFromUserActionInCurrentThread, Pn as CopilotChatToolCallsViewProps, Pt as CopilotKitInspectorProps, Q as useDefaultRenderTool, Qt as CopilotPopupView, R as useLearnFromUserAction, Rn as CopilotChatConfigurationProvider, Rt as AttachmentsConfig, S as MemoryKind, Sn as CopilotChatSuggestionView, St as OpenGenerativeUIActivityRenderer, T as UseLearningContainersInCurrentThreadArgs, Tn as CopilotChatSuggestionPillProps, Tt as OpenGenerativeUIContentSchema, U as useConfigureSuggestions, Un as AudioRecorderError, Ut as CopilotThreadsDrawerRowRenderer, V as UseInterruptConfig, Vn as CopilotChatLabels, Vt as CopilotThreadsDrawer, W as useSuggestions, Wn as AudioRecorderState, Wt as Thread, X as useAgent, Xt as CopilotSidebar, Y as UseAgentUpdate, Yt as CopilotPopupProps, Z as useHumanInTheLoop, Zt as CopilotSidebarProps, _ as useCopilotKit, _n as IntelligenceIndicatorProps, _t as ReactCustomMessageRenderer, a as A2UIMessageRendererOptions, an as CopilotChatToggleButtonProps, at as InterruptCancelFn, b as Memory, bn as IntelligenceIndicatorView, bt as GenerateSandboxedUiArgs, c as CopilotKitCoreReact, cn as CopilotChat, ct as InterruptRenderProps, d as InspectorAnchor, dn as CopilotChatViewProps, dt as defineToolCallRenderer, en as CopilotSidebarView, et as useComponent, f as SandboxFunctionsContext, fn as AutoScrollMode, ft as ReactHumanInTheLoop, g as CopilotKitProviderProps, gn as IntelligenceIndicator, gt as useRenderCustomMessages, h as CopilotKitProvider, hn as INTELLIGENCE_TURN_HEAD, ht as ReactToolCallRenderer, i as A2UIActionInterceptor, in as CopilotChatToggleButton, it as Interrupt, j as useAttachments, jn as CopilotChatAssistantMessageProps, jt as ɵMcpFollowUpHost, k as UseAttachmentsProps, kn as CopilotChatUserMessageProps, kt as MCPAppsActivityRenderer, l as CopilotKitCoreReactConfig, ln as CopilotChatProps, lt as InterruptResolveFn, m as CopilotKitContextValue, mn as CopilotChatMessageViewProps, mt as ReactActivityMessageRenderer, nn as CopilotModalHeader, nt as useRenderActivityMessage, o as A2UIUserAction, on as DefaultCloseIcon, ot as InterruptEvent, p as useSandboxFunctions, pn as CopilotChatMessageView, pt as ReactFrontendTool, q as useAgentContext, qt as useThreads, r as CopilotKitProps, rn as CopilotModalHeaderProps, rt as SandboxFunction, s as createA2UIMessageRenderer, sn as DefaultOpenIcon, st as InterruptHandlerProps, t as CopilotKit, tn as CopilotSidebarViewProps, tt as useFrontendTool, u as CopilotKitCoreReactSubscriber, un as CopilotChatView, ut as ResumeEntry, v as useLicenseContext, vn as getIntelligenceTurnAnchors, vt as ReactCustomMessageRendererPosition, w as NewMemory, wn as CopilotChatSuggestionPill, wt as OpenGenerativeUIContent, x as MemoryChanges, xn as IntelligenceIndicatorViewProps, xt as GenerateSandboxedUiArgsSchema, y as A2UIRecoveryRendererOptions, yn as IntelligenceIndicatorStatus, yt as useRenderToolCall, z as UseMemoriesResult, zn as CopilotChatConfigurationProviderProps, zt as CopilotChatAttachmentRenderer } from "../copilotkit-DgO31tBq.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 CopilotChatAudioRecorder, B as CopilotChatAssistantMessage_default, C as CopilotModalHeader, Ct as MCPAppsActivityRenderer, D as CopilotChat, Dt as useRenderToolCall, E as DefaultOpenIcon, Et as CopilotKitInspector, 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, Mt as useCopilotChatConfiguration, N as getIntelligenceTurnAnchors, O as CopilotChatView_default, Ot as CopilotChatInput_default, P as IntelligenceIndicatorView, Q as useAgentContext, R as CopilotChatUserMessage_default, S as CopilotSidebarView, St as MCPAppsActivityContentSchema, T as DefaultCloseIcon, Tt as ɵrunMcpFollowUp, U as useLearningContainers, V as CopilotChatToolCallsView, W as useAttachments, X as useConfigureSuggestions, Y as useInterrupt, Z as useSuggestions, _ as WildcardToolCallRender, _t as OpenGenerativeUIActivityType, at as useComponent, b as CopilotSidebar, bt as SandboxFunctionsContext, ct as useRenderCustomMessages, dt as useLicenseContext, et as UseAgentUpdate, ft as CopilotKitCoreReact, gt as OpenGenerativeUIActivityRenderer, ht as GenerateSandboxedUiArgsSchema, it as useRenderTool, j as INTELLIGENCE_TURN_HEAD, jt as CopilotChatConfigurationProvider, k as CopilotChatAttachmentQueue, kt as AudioRecorderError, lt as CopilotKitProvider, mt as createA2UIMessageRenderer, nt as useHumanInTheLoop, ot as useFrontendTool, pt as defineToolCallRenderer, q as useMemories, rt as useDefaultRenderTool, st as useRenderActivityMessage, t as CopilotKit, tt as useAgent, ut as useCopilotKit, v as CopilotThreadsDrawer, vt as OpenGenerativeUIContentSchema, w as CopilotChatToggleButton, wt as MCPAppsActivityType, x as CopilotPopupView, xt as useSandboxFunctions, y as CopilotPopup, yt as OpenGenerativeUIToolRenderer, z as CopilotChatAttachmentRenderer } from "../copilotkit-BmW2sFH6.mjs";
3
+ import { $ as useCapabilities, A as CopilotChatMessageView, At as CopilotChatAudioRecorder, B as CopilotChatAssistantMessage_default, C as CopilotModalHeader, Ct as MCPAppsActivityRenderer, D as CopilotChat, Dt as useRenderToolCall, E as DefaultOpenIcon, Et as CopilotKitInspector, 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, Mt as useCopilotChatConfiguration, N as getIntelligenceTurnAnchors, O as CopilotChatView_default, Ot as CopilotChatInput_default, P as IntelligenceIndicatorView, Q as useAgentContext, R as CopilotChatUserMessage_default, S as CopilotSidebarView, St as MCPAppsActivityContentSchema, T as DefaultCloseIcon, Tt as ɵrunMcpFollowUp, U as useLearningContainers, V as CopilotChatToolCallsView, W as useAttachments, X as useConfigureSuggestions, Y as useInterrupt, Z as useSuggestions, _ as WildcardToolCallRender, _t as OpenGenerativeUIActivityType, at as useComponent, b as CopilotSidebar, bt as SandboxFunctionsContext, ct as useRenderCustomMessages, dt as useLicenseContext, et as UseAgentUpdate, ft as CopilotKitCoreReact, gt as OpenGenerativeUIActivityRenderer, ht as GenerateSandboxedUiArgsSchema, it as useRenderTool, j as INTELLIGENCE_TURN_HEAD, jt as CopilotChatConfigurationProvider, k as CopilotChatAttachmentQueue, kt as AudioRecorderError, lt as CopilotKitProvider, mt as createA2UIMessageRenderer, nt as useHumanInTheLoop, ot as useFrontendTool, pt as defineToolCallRenderer, q as useMemories, rt as useDefaultRenderTool, st as useRenderActivityMessage, t as CopilotKit, tt as useAgent, ut as useCopilotKit, v as CopilotThreadsDrawer, vt as OpenGenerativeUIContentSchema, w as CopilotChatToggleButton, wt as MCPAppsActivityType, x as CopilotPopupView, xt as useSandboxFunctions, y as CopilotPopup, yt as OpenGenerativeUIToolRenderer, z as CopilotChatAttachmentRenderer } from "../copilotkit-JdHy0xdu.mjs";
4
4
  import "./index.css";
5
5
  import { defaultTheme as a2uiDefaultTheme } from "@copilotkit/a2ui-renderer";
6
6
 
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
 
3
3
  (function(global, factory) {
4
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('./index.css'), require('@copilotkit/core'), require('@ag-ui/client'), require('react'), require('tailwind-merge'), require('lucide-react'), require('@copilotkit/shared'), require('react/jsx-runtime'), require('@radix-ui/react-slot'), require('class-variance-authority'), require('clsx'), require('@radix-ui/react-tooltip'), require('@radix-ui/react-dropdown-menu'), require('streamdown'), require('zod'), require('@lit-labs/react'), require('@copilotkit/a2ui-renderer'), require('zod-to-json-schema'), require('react-dom'), require('@tanstack/react-virtual'), require('use-stick-to-bottom'), require('@copilotkit/web-components/threads-drawer')) :
5
- typeof define === 'function' && define.amd ? define(['exports', './index.css', '@copilotkit/core', '@ag-ui/client', 'react', 'tailwind-merge', 'lucide-react', '@copilotkit/shared', 'react/jsx-runtime', '@radix-ui/react-slot', 'class-variance-authority', 'clsx', '@radix-ui/react-tooltip', '@radix-ui/react-dropdown-menu', 'streamdown', 'zod', '@lit-labs/react', '@copilotkit/a2ui-renderer', 'zod-to-json-schema', 'react-dom', '@tanstack/react-virtual', 'use-stick-to-bottom', '@copilotkit/web-components/threads-drawer'], factory) :
6
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CopilotKitReactCoreV2 = {}), global.src_v2_index_css,global.CopilotKitCore,global.AgUIClient,global.React,global.tailwindMerge,global.lucideReact,global.CopilotKitShared,global.ReactJsxRuntime,global.RadixReactSlot,global.classVarianceAuthority,global.clsx,global.RadixReactTooltip,global.RadixReactDropdownMenu,global.streamdown,global.Zod,global.LitLabsReact,global.CopilotKitA2UIRenderer,global.zod_to_json_schema,global.ReactDOM,global._tanstack_react_virtual,global.useStickToBottom,global._copilotkit_web_components_threads_drawer));
7
- })(this, function(exports, src_v2_index_css, _copilotkit_core, _ag_ui_client, react, tailwind_merge, lucide_react, _copilotkit_shared, react_jsx_runtime, _radix_ui_react_slot, class_variance_authority, clsx, _radix_ui_react_tooltip, _radix_ui_react_dropdown_menu, streamdown, zod, _lit_labs_react, _copilotkit_a2ui_renderer, zod_to_json_schema, react_dom, _tanstack_react_virtual, use_stick_to_bottom, _copilotkit_web_components_threads_drawer) {
4
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('./index.css'), require('@copilotkit/core'), require('@ag-ui/client'), require('react'), require('tailwind-merge'), require('lucide-react'), require('@copilotkit/shared'), require('react/jsx-runtime'), require('@radix-ui/react-slot'), require('class-variance-authority'), require('clsx'), require('@radix-ui/react-tooltip'), require('@radix-ui/react-dropdown-menu'), require('streamdown'), require('zod'), require('@copilotkit/a2ui-renderer'), require('zod-to-json-schema'), require('react-dom'), require('@tanstack/react-virtual'), require('use-stick-to-bottom'), require('@copilotkit/web-components/threads-drawer')) :
5
+ typeof define === 'function' && define.amd ? define(['exports', './index.css', '@copilotkit/core', '@ag-ui/client', 'react', 'tailwind-merge', 'lucide-react', '@copilotkit/shared', 'react/jsx-runtime', '@radix-ui/react-slot', 'class-variance-authority', 'clsx', '@radix-ui/react-tooltip', '@radix-ui/react-dropdown-menu', 'streamdown', 'zod', '@copilotkit/a2ui-renderer', 'zod-to-json-schema', 'react-dom', '@tanstack/react-virtual', 'use-stick-to-bottom', '@copilotkit/web-components/threads-drawer'], factory) :
6
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CopilotKitReactCoreV2 = {}), global.src_v2_index_css,global.CopilotKitCore,global.AgUIClient,global.React,global.tailwindMerge,global.lucideReact,global.CopilotKitShared,global.ReactJsxRuntime,global.RadixReactSlot,global.classVarianceAuthority,global.clsx,global.RadixReactTooltip,global.RadixReactDropdownMenu,global.streamdown,global.Zod,global.CopilotKitA2UIRenderer,global.zod_to_json_schema,global.ReactDOM,global._tanstack_react_virtual,global.useStickToBottom,global._copilotkit_web_components_threads_drawer));
7
+ })(this, function(exports, src_v2_index_css, _copilotkit_core, _ag_ui_client, react, tailwind_merge, lucide_react, _copilotkit_shared, react_jsx_runtime, _radix_ui_react_slot, class_variance_authority, clsx, _radix_ui_react_tooltip, _radix_ui_react_dropdown_menu, streamdown, zod, _copilotkit_a2ui_renderer, zod_to_json_schema, react_dom, _tanstack_react_virtual, use_stick_to_bottom, _copilotkit_web_components_threads_drawer) {
8
8
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
9
9
  //#region \0rolldown/runtime.js
10
10
  var __create = Object.create;
@@ -91,7 +91,7 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
91
91
  assistantMessageToolbarCopyCodeCopiedLabel: "Copied",
92
92
  assistantMessageToolbarCopyMessageLabel: "Copy",
93
93
  assistantMessageToolbarInspectorLabel: "View in Inspector",
94
- assistantMessageToolbarInspectorLocalOnlyLabel: "Local Only",
94
+ assistantMessageToolbarInspectorLocalOnlyLabel: "Development Only",
95
95
  assistantMessageToolbarThumbsUpLabel: "Good response",
96
96
  assistantMessageToolbarThumbsDownLabel: "Bad response",
97
97
  assistantMessageToolbarReadAloudLabel: "Read aloud",
@@ -1636,32 +1636,43 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
1636
1636
 
1637
1637
  //#endregion
1638
1638
  //#region src/v2/components/CopilotKitInspector.tsx
1639
- const CopilotKitInspector = ({ core, openRequest, ...rest }) => {
1640
- const [InspectorComponent, setInspectorComponent] = react.useState(null);
1639
+ const CopilotKitInspector = ({ core, openRequest }) => {
1640
+ const mountRef = react.useRef(null);
1641
1641
  const inspectorRef = react.useRef(null);
1642
+ const latestCoreRef = react.useRef(core ?? null);
1643
+ const latestOpenRequestRef = react.useRef(openRequest);
1644
+ latestCoreRef.current = core ?? null;
1645
+ latestOpenRequestRef.current = openRequest;
1642
1646
  react.useEffect(() => {
1643
1647
  let mounted = true;
1648
+ let inspector = null;
1644
1649
  import("@copilotkit/web-inspector").then((mod) => {
1650
+ if (!mounted || !mountRef.current) return;
1645
1651
  mod.defineWebInspector?.();
1646
- const Component = (0, _lit_labs_react.createComponent)({
1647
- tagName: mod.WEB_INSPECTOR_TAG,
1648
- elementClass: mod.WebInspectorElement,
1649
- react
1650
- });
1651
- if (mounted) setInspectorComponent(() => Component);
1652
+ inspector = mountRef.current.ownerDocument.createElement(mod.WEB_INSPECTOR_TAG);
1653
+ mod.configureWebInspectorElement(inspector, latestCoreRef.current);
1654
+ mountRef.current.appendChild(inspector);
1655
+ inspectorRef.current = inspector;
1656
+ const request = latestOpenRequestRef.current;
1657
+ if (request) inspector.openInspector("message_toolbar", request);
1658
+ }).catch((error) => {
1659
+ console.error("Failed to load CopilotKit inspector:", error);
1652
1660
  });
1653
1661
  return () => {
1654
1662
  mounted = false;
1663
+ inspector?.remove();
1664
+ if (inspectorRef.current === inspector) inspectorRef.current = null;
1655
1665
  };
1656
1666
  }, []);
1667
+ react.useEffect(() => {
1668
+ if (inspectorRef.current) inspectorRef.current.core = core ?? null;
1669
+ }, [core]);
1657
1670
  react.useEffect(() => {
1658
1671
  if (openRequest) inspectorRef.current?.openInspector("message_toolbar", openRequest);
1659
- }, [InspectorComponent, openRequest]);
1660
- if (!InspectorComponent) return null;
1661
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InspectorComponent, {
1662
- ref: inspectorRef,
1663
- ...rest,
1664
- core: core ?? null
1672
+ }, [openRequest]);
1673
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1674
+ ref: mountRef,
1675
+ style: { display: "contents" }
1665
1676
  });
1666
1677
  };
1667
1678
  CopilotKitInspector.displayName = "CopilotKitInspector";
@@ -1669,7 +1680,7 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
1669
1680
  //#endregion
1670
1681
  //#region src/v2/components/CopilotKitInspectorContext.tsx
1671
1682
  const CopilotKitInspectorContext = react.createContext({
1672
- isLocalInspectorEnabled: false,
1683
+ isInspectorEnabled: false,
1673
1684
  openInspector: () => void 0
1674
1685
  });
1675
1686
  const CopilotKitInspectorContextProvider = CopilotKitInspectorContext.Provider;
@@ -3523,9 +3534,15 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3523
3534
  }, [value, warningMessage]);
3524
3535
  return value;
3525
3536
  }
3526
- const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY_HEADERS, credentials, publicApiKey, publicLicenseKey, licenseToken, properties = EMPTY_PROPERTIES, agents__unsafe_dev_only: agents = EMPTY_AGENTS, selfManagedAgents = EMPTY_AGENTS, renderToolCalls, renderActivityMessages, renderCustomMessages, frontendTools, humanInTheLoop, openGenerativeUI, showDevConsole = false, useSingleEndpoint, onError, a2ui, defaultThrottleMs, inspectorDefaultAnchor, debug }) => {
3537
+ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY_HEADERS, credentials, publicApiKey, publicLicenseKey, licenseToken, properties = EMPTY_PROPERTIES, agents__unsafe_dev_only: agents = EMPTY_AGENTS, selfManagedAgents = EMPTY_AGENTS, renderToolCalls, renderActivityMessages, renderCustomMessages, frontendTools, humanInTheLoop, openGenerativeUI, enableInspector, useSingleEndpoint, onError, a2ui, defaultThrottleMs, debug }) => {
3527
3538
  const [shouldRenderInspector, setShouldRenderInspector] = (0, react.useState)(false);
3528
- const [isLocalInspectorEnabled, setIsLocalInspectorEnabled] = (0, react.useState)(false);
3539
+ (0, react.useEffect)(() => {
3540
+ setShouldRenderInspector((0, _copilotkit_shared.shouldEnableInspector)({
3541
+ enableInspector,
3542
+ isBrowser: true,
3543
+ isDevelopment: process.env.NODE_ENV === "development"
3544
+ }));
3545
+ }, [enableInspector]);
3529
3546
  const [inspectorOpenRequest, setInspectorOpenRequest] = (0, react.useState)(null);
3530
3547
  const [runtimeA2UIEnabled, setRuntimeA2UIEnabled] = (0, react.useState)(false);
3531
3548
  const [runtimeOpenGenUIEnabled, setRuntimeOpenGenUIEnabled] = (0, react.useState)(false);
@@ -3534,32 +3551,13 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3534
3551
  const a2uiCatalogProvided = !!a2ui?.catalog;
3535
3552
  const a2uiActive = runtimeA2UIEnabled || a2uiCatalogProvided;
3536
3553
  const [runtimeLicenseStatus, setRuntimeLicenseStatus] = (0, react.useState)(void 0);
3537
- (0, react.useEffect)(() => {
3538
- if (typeof window === "undefined") return;
3539
- const isLocalhost = new Set(["localhost", "127.0.0.1"]).has(window.location?.hostname ?? "");
3540
- const canShowLocalInspectorAction = process.env.NODE_ENV === "development" && isLocalhost;
3541
- if (showDevConsole === true) {
3542
- setShouldRenderInspector(true);
3543
- setIsLocalInspectorEnabled(canShowLocalInspectorAction);
3544
- } else if (showDevConsole === "auto") if (isLocalhost) {
3545
- setShouldRenderInspector(true);
3546
- setIsLocalInspectorEnabled(canShowLocalInspectorAction);
3547
- } else {
3548
- setShouldRenderInspector(false);
3549
- setIsLocalInspectorEnabled(false);
3550
- }
3551
- else {
3552
- setShouldRenderInspector(false);
3553
- setIsLocalInspectorEnabled(false);
3554
- }
3555
- }, [showDevConsole]);
3556
3554
  const requestInspectorOpen = (0, react.useCallback)((request) => {
3557
3555
  setInspectorOpenRequest({ ...request });
3558
3556
  }, []);
3559
3557
  const inspectorContextValue = (0, react.useMemo)(() => ({
3560
- isLocalInspectorEnabled,
3558
+ isInspectorEnabled: shouldRenderInspector,
3561
3559
  openInspector: requestInspectorOpen
3562
- }), [isLocalInspectorEnabled, requestInspectorOpen]);
3560
+ }), [shouldRenderInspector, requestInspectorOpen]);
3563
3561
  const renderToolCallsList = useStableArrayProp(renderToolCalls, "renderToolCalls must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.", (initial, next) => {
3564
3562
  const key = (rc) => `${rc?.agentId ?? ""}:${rc?.name ?? ""}`;
3565
3563
  const setFrom = (arr) => new Set(arr.map(key));
@@ -3900,7 +3898,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3900
3898
  value: inspectorContextValue,
3901
3899
  children: [children, shouldRenderInspector ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitInspector, {
3902
3900
  core: copilotkit,
3903
- defaultAnchor: inspectorDefaultAnchor,
3904
3901
  openRequest: inspectorOpenRequest
3905
3902
  }) : null]
3906
3903
  }),
@@ -5954,7 +5951,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5954
5951
  //#region src/v2/components/chat/CopilotChatAssistantMessage.tsx
5955
5952
  function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible = true, markdownRenderer, toolbar, copyButton, inspectorButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, toolCallsView, children, className, ...props }) {
5956
5953
  useKatexStyles();
5957
- const { isLocalInspectorEnabled, openInspector } = useCopilotKitInspector();
5954
+ const { isInspectorEnabled, openInspector } = useCopilotKitInspector();
5958
5955
  const chatConfiguration = useCopilotChatConfiguration();
5959
5956
  const boundMarkdownRenderer = renderSlot(markdownRenderer, CopilotChatAssistantMessage.MarkdownRenderer, { content: message.content || "" });
5960
5957
  const boundCopyButton = renderSlot(copyButton, CopilotChatAssistantMessage.CopyButton, { onClick: async () => {
@@ -5974,7 +5971,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5974
5971
  className: "cpk:flex cpk:items-center cpk:gap-1",
5975
5972
  children: [
5976
5973
  boundCopyButton,
5977
- isLocalInspectorEnabled && boundInspectorButton,
5974
+ isInspectorEnabled && boundInspectorButton,
5978
5975
  (onThumbsUp || thumbsUpButton) && boundThumbsUpButton,
5979
5976
  (onThumbsDown || thumbsDownButton) && boundThumbsDownButton,
5980
5977
  (onReadAloud || readAloudButton) && boundReadAloudButton,
@@ -5988,7 +5985,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5988
5985
  });
5989
5986
  const hasContent = !!(message.content && message.content.trim().length > 0);
5990
5987
  const isLatestAssistantMessage = message.role === "assistant" && messages?.[messages.length - 1]?.id === message.id;
5991
- const shouldShowToolbar = toolbarVisible && (hasContent || isLocalInspectorEnabled) && !(isRunning && isLatestAssistantMessage);
5988
+ const shouldShowToolbar = toolbarVisible && (hasContent || isInspectorEnabled) && !(isRunning && isLatestAssistantMessage);
5992
5989
  if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5993
5990
  "data-copilotkit": true,
5994
5991
  style: { display: "contents" },
@@ -11445,20 +11442,42 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
11445
11442
 
11446
11443
  //#endregion
11447
11444
  //#region src/v1-deprecated/components/CopilotListeners.tsx
11448
- const usePredictStateSubscription = (agent) => {
11449
- const predictStateToolsRef = (0, react.useRef)([]);
11450
- const getSubscriber = (0, react.useCallback)((agent) => ({
11445
+ function isPredictStateTool(value) {
11446
+ if (value === null || typeof value !== "object") return false;
11447
+ const config = value;
11448
+ return typeof config.tool === "string" && typeof config.state_key === "string" && (config.tool_argument === void 0 || typeof config.tool_argument === "string");
11449
+ }
11450
+ function getPredictStateUpdate(config, toolCallName, partialToolCallArgs) {
11451
+ if (config.tool !== toolCallName) return void 0;
11452
+ const emittedState = typeof partialToolCallArgs === "string" ? (0, _copilotkit_shared.partialJSONParse)(partialToolCallArgs) : partialToolCallArgs;
11453
+ if (emittedState === null || typeof emittedState !== "object") return;
11454
+ if (config.tool_argument) {
11455
+ if (!(config.tool_argument in emittedState)) return void 0;
11456
+ return { [config.state_key]: emittedState[config.tool_argument] };
11457
+ }
11458
+ return { [config.state_key]: emittedState };
11459
+ }
11460
+ function createPredictStateSubscriber(agent, predictStateToolsRef) {
11461
+ return {
11451
11462
  onCustomEvent: ({ event }) => {
11452
- if (event.name === "PredictState") predictStateToolsRef.current = event.value;
11463
+ if (event.name === "PredictState") predictStateToolsRef.current = Array.isArray(event.value) ? event.value.filter(isPredictStateTool) : [];
11453
11464
  },
11454
11465
  onToolCallArgsEvent: ({ partialToolCallArgs, toolCallName }) => {
11455
- predictStateToolsRef.current.forEach((t) => {
11456
- if (t?.tool !== toolCallName) return;
11457
- const emittedState = typeof partialToolCallArgs === "string" ? (0, _copilotkit_shared.parseJson)(partialToolCallArgs, partialToolCallArgs) : partialToolCallArgs;
11458
- agent.setState({ [t.state_key]: emittedState[t.state_key] });
11466
+ const updates = {};
11467
+ predictStateToolsRef.current.forEach((config) => {
11468
+ const update = getPredictStateUpdate(config, toolCallName, partialToolCallArgs);
11469
+ if (update) Object.assign(updates, update);
11470
+ });
11471
+ if (Object.keys(updates).length > 0) agent.setState({
11472
+ ...agent.state,
11473
+ ...updates
11459
11474
  });
11460
11475
  }
11461
- }), []);
11476
+ };
11477
+ }
11478
+ const usePredictStateSubscription = (agent) => {
11479
+ const predictStateToolsRef = (0, react.useRef)([]);
11480
+ const getSubscriber = (0, react.useCallback)((subscriptionAgent) => createPredictStateSubscriber(subscriptionAgent, predictStateToolsRef), []);
11462
11481
  (0, react.useEffect)(() => {
11463
11482
  if (!agent) return;
11464
11483
  const subscriber = getSubscriber(agent);
@@ -11517,7 +11536,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
11517
11536
  //#region src/v1-deprecated/components/copilot-provider/copilotkit.tsx
11518
11537
  function CopilotKit({ children, ...props }) {
11519
11538
  const enabled = shouldShowDevConsole(props.showDevConsole);
11520
- const showInspector = shouldShowDevConsole(props.enableInspector);
11521
11539
  const publicApiKey = props.publicApiKey || props.publicLicenseKey;
11522
11540
  const renderArr = (0, react.useMemo)(() => [{ render: CoAgentStateRenderBridge }], []);
11523
11541
  const { onError: _onError, ...v2Props } = props;
@@ -11530,7 +11548,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
11530
11548
  threadId: props.threadId,
11531
11549
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitProvider, {
11532
11550
  ...v2Props,
11533
- showDevConsole: showInspector,
11551
+ enableInspector: props.enableInspector,
11534
11552
  renderCustomMessages: renderArr,
11535
11553
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitInternal, {
11536
11554
  ...props,