@copilotkit/react-core 1.70.2 → 1.70.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.
- package/dist/{copilotkit-B1jSvZeb.mjs → copilotkit-Ap_yisA5.mjs} +220 -18
- package/dist/{copilotkit-DcFo270Y.cjs.map → copilotkit-Ap_yisA5.mjs.map} +1 -1
- package/dist/{copilotkit-DcFo270Y.cjs → copilotkit-BU3OvveB.cjs} +218 -16
- package/dist/copilotkit-BU3OvveB.cjs.map +1 -0
- package/dist/{copilotkit--Jyzm6hS.d.mts → copilotkit-Bs98akp9.d.mts} +2 -2
- package/dist/{copilotkit--Jyzm6hS.d.mts.map → copilotkit-Bs98akp9.d.mts.map} +1 -1
- package/dist/{copilotkit-BLYaCGcz.d.cts → copilotkit-X2eGbOwf.d.cts} +2 -2
- package/dist/{copilotkit-BLYaCGcz.d.cts.map → copilotkit-X2eGbOwf.d.cts.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +217 -15
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/headless.cjs +41 -2
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.d.cts.map +1 -1
- package/dist/v2/headless.d.mts.map +1 -1
- package/dist/v2/headless.mjs +41 -2
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.d.cts +1 -1
- package/dist/v2/index.d.mts +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/index.umd.js +217 -15
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +7 -7
- package/skills/react-core/SKILL.md +1 -1
- package/dist/copilotkit-B1jSvZeb.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-
|
|
4
|
+
const require_copilotkit = require('../copilotkit-BU3OvveB.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");
|
package/dist/v2/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as useRenderTool, $t as CopilotPopupView, A as UseAttachmentsReturn, An as CopilotChatUserMessageProps, At as MCPAppsActivityRenderer, B as useMemories, Bn as CopilotChatConfigurationProviderProps, Bt as CopilotChatAttachmentRenderer, C as MemoryScope, Cn as CopilotChatSuggestionView, Ct as OpenGenerativeUIActivityRenderer, D as UseLearningContainersArgs, Dn as CopilotChatReasoningMessage, Dt as OpenGenerativeUIToolRenderer, E as useLearningContainersInCurrentThread, En as CopilotChatSuggestionPillProps, Et as OpenGenerativeUIContentSchema, F as LearnFromUserActionInput, Fn as CopilotChatToolCallsViewProps, Ft as CopilotKitInspectorProps, G as AgentContextInput, Gn as AudioRecorderState, Gt as Thread, H as useInterrupt, Hn as CopilotChatLabels, Ht as CopilotThreadsDrawer, I as LearnFromUserActionResult, In as CopilotChatInput, It as WildcardToolCallRender, J as useCapabilities, Jt as useThreads, K as JsonSerializable, Kn as CopilotChatAudioRecorder, Kt as UseThreadsInput, L as UseLearnFromUserActionRecorder, Ln as CopilotChatInputProps, Lt as Attachment, M as LearnFromUserActionInCurrentThreadInput, Mn as CopilotChatAssistantMessageProps, Mt as ɵMcpFollowUpHost, N as UseLearnFromUserActionInCurrentThreadRecorder, Nn as CopilotChatFeedbackMessage, Nt as ɵrunMcpFollowUp, O as useLearningContainers, On as CopilotChatReasoningMessageProps, Ot as MCPAppsActivityContent, P as useLearnFromUserActionInCurrentThread, Pn as CopilotChatToolCallsView, Pt as CopilotKitInspector, Q as useDefaultRenderTool, Qt as CopilotSidebarProps, R as useLearnFromUserAction, Rn as ToolsMenuItem, Rt as AttachmentModality, S as MemoryKind, Sn as IntelligenceIndicatorViewProps, St as GenerateSandboxedUiArgsSchema, T as UseLearningContainersInCurrentThreadArgs, Tn as CopilotChatSuggestionPill, Tt as OpenGenerativeUIContent, U as useConfigureSuggestions, Un as useCopilotChatConfiguration, Ut as CopilotThreadsDrawerProps, V as UseInterruptConfig, Vn as CopilotChatConfigurationValue, Vt as CopilotChatAttachmentQueue, W as useSuggestions, Wn as AudioRecorderError, Wt as CopilotThreadsDrawerRowRenderer, X as useAgent, Xt as CopilotPopupProps, Y as UseAgentUpdate, Yt as CopilotPopup, Z as useHumanInTheLoop, Zt as CopilotSidebar, _ as CopilotKitCoreReact, _n as IntelligenceIndicator, _t as useRenderCustomMessages, a as A2UIMessageRendererOptions, an as CopilotChatToggleButton, at as Interrupt, b as Memory, bn as IntelligenceIndicatorStatus, bt as useRenderToolCall, c as InspectorAnchor, cn as DefaultOpenIcon, ct as InterruptHandlerProps, d as CopilotKitProvider, dn as CopilotChatView, dt as ResumeEntry, en as CopilotPopupViewProps, et as useComponent, f as CopilotKitProviderProps, fn as CopilotChatViewProps, ft as defineToolCallRenderer, g as useLicenseContext, gn as INTELLIGENCE_TURN_HEAD, gt as ReactToolCallRenderer, h as useCopilotKit, hn as CopilotChatMessageViewProps, ht as ReactActivityMessageRenderer, i as A2UIActionInterceptor, in as CopilotModalHeaderProps, it as INTERRUPT_EVENT_NAME, j as useAttachments, jn as CopilotChatAssistantMessage, jt as MCPAppsActivityType, k as UseAttachmentsProps, kn as CopilotChatUserMessage, kt as MCPAppsActivityContentSchema, l as SandboxFunctionsContext, ln as CopilotChat, lt as InterruptRenderProps, m as CopilotKitContextValue, mn as CopilotChatMessageView, mt as ReactFrontendTool, nn as CopilotSidebarViewProps, nt as useRenderActivityMessage, o as A2UIUserAction, on as CopilotChatToggleButtonProps, ot as InterruptCancelFn, p as A2UIRecoveryRendererOptions, pn as AutoScrollMode, pt as ReactHumanInTheLoop, q as useAgentContext, qt as UseThreadsResult, r as CopilotKitProps, rn as CopilotModalHeader, rt as SandboxFunction, s as createA2UIMessageRenderer, sn as DefaultCloseIcon, st as InterruptEvent, t as CopilotKit, tn as CopilotSidebarView, tt as useFrontendTool, u as useSandboxFunctions, un as CopilotChatProps, ut as InterruptResolveFn, v as CopilotKitCoreReactConfig, vn as IntelligenceIndicatorProps, vt as ReactCustomMessageRenderer, w as NewMemory, wn as CopilotChatSuggestionViewProps, wt as OpenGenerativeUIActivityType, x as MemoryChanges, xn as IntelligenceIndicatorView, xt as GenerateSandboxedUiArgs, y as CopilotKitCoreReactSubscriber, yn as getIntelligenceTurnAnchors, yt as ReactCustomMessageRendererPosition, z as UseMemoriesResult, zn as CopilotChatConfigurationProvider, zt as AttachmentsConfig } from "../copilotkit-
|
|
1
|
+
import { $ as useRenderTool, $t as CopilotPopupView, A as UseAttachmentsReturn, An as CopilotChatUserMessageProps, At as MCPAppsActivityRenderer, B as useMemories, Bn as CopilotChatConfigurationProviderProps, Bt as CopilotChatAttachmentRenderer, C as MemoryScope, Cn as CopilotChatSuggestionView, Ct as OpenGenerativeUIActivityRenderer, D as UseLearningContainersArgs, Dn as CopilotChatReasoningMessage, Dt as OpenGenerativeUIToolRenderer, E as useLearningContainersInCurrentThread, En as CopilotChatSuggestionPillProps, Et as OpenGenerativeUIContentSchema, F as LearnFromUserActionInput, Fn as CopilotChatToolCallsViewProps, Ft as CopilotKitInspectorProps, G as AgentContextInput, Gn as AudioRecorderState, Gt as Thread, H as useInterrupt, Hn as CopilotChatLabels, Ht as CopilotThreadsDrawer, I as LearnFromUserActionResult, In as CopilotChatInput, It as WildcardToolCallRender, J as useCapabilities, Jt as useThreads, K as JsonSerializable, Kn as CopilotChatAudioRecorder, Kt as UseThreadsInput, L as UseLearnFromUserActionRecorder, Ln as CopilotChatInputProps, Lt as Attachment, M as LearnFromUserActionInCurrentThreadInput, Mn as CopilotChatAssistantMessageProps, Mt as ɵMcpFollowUpHost, N as UseLearnFromUserActionInCurrentThreadRecorder, Nn as CopilotChatFeedbackMessage, Nt as ɵrunMcpFollowUp, O as useLearningContainers, On as CopilotChatReasoningMessageProps, Ot as MCPAppsActivityContent, P as useLearnFromUserActionInCurrentThread, Pn as CopilotChatToolCallsView, Pt as CopilotKitInspector, Q as useDefaultRenderTool, Qt as CopilotSidebarProps, R as useLearnFromUserAction, Rn as ToolsMenuItem, Rt as AttachmentModality, S as MemoryKind, Sn as IntelligenceIndicatorViewProps, St as GenerateSandboxedUiArgsSchema, T as UseLearningContainersInCurrentThreadArgs, Tn as CopilotChatSuggestionPill, Tt as OpenGenerativeUIContent, U as useConfigureSuggestions, Un as useCopilotChatConfiguration, Ut as CopilotThreadsDrawerProps, V as UseInterruptConfig, Vn as CopilotChatConfigurationValue, Vt as CopilotChatAttachmentQueue, W as useSuggestions, Wn as AudioRecorderError, Wt as CopilotThreadsDrawerRowRenderer, X as useAgent, Xt as CopilotPopupProps, Y as UseAgentUpdate, Yt as CopilotPopup, Z as useHumanInTheLoop, Zt as CopilotSidebar, _ as CopilotKitCoreReact, _n as IntelligenceIndicator, _t as useRenderCustomMessages, a as A2UIMessageRendererOptions, an as CopilotChatToggleButton, at as Interrupt, b as Memory, bn as IntelligenceIndicatorStatus, bt as useRenderToolCall, c as InspectorAnchor, cn as DefaultOpenIcon, ct as InterruptHandlerProps, d as CopilotKitProvider, dn as CopilotChatView, dt as ResumeEntry, en as CopilotPopupViewProps, et as useComponent, f as CopilotKitProviderProps, fn as CopilotChatViewProps, ft as defineToolCallRenderer, g as useLicenseContext, gn as INTELLIGENCE_TURN_HEAD, gt as ReactToolCallRenderer, h as useCopilotKit, hn as CopilotChatMessageViewProps, ht as ReactActivityMessageRenderer, i as A2UIActionInterceptor, in as CopilotModalHeaderProps, it as INTERRUPT_EVENT_NAME, j as useAttachments, jn as CopilotChatAssistantMessage, jt as MCPAppsActivityType, k as UseAttachmentsProps, kn as CopilotChatUserMessage, kt as MCPAppsActivityContentSchema, l as SandboxFunctionsContext, ln as CopilotChat, lt as InterruptRenderProps, m as CopilotKitContextValue, mn as CopilotChatMessageView, mt as ReactFrontendTool, nn as CopilotSidebarViewProps, nt as useRenderActivityMessage, o as A2UIUserAction, on as CopilotChatToggleButtonProps, ot as InterruptCancelFn, p as A2UIRecoveryRendererOptions, pn as AutoScrollMode, pt as ReactHumanInTheLoop, q as useAgentContext, qt as UseThreadsResult, r as CopilotKitProps, rn as CopilotModalHeader, rt as SandboxFunction, s as createA2UIMessageRenderer, sn as DefaultCloseIcon, st as InterruptEvent, t as CopilotKit, tn as CopilotSidebarView, tt as useFrontendTool, u as useSandboxFunctions, un as CopilotChatProps, ut as InterruptResolveFn, v as CopilotKitCoreReactConfig, vn as IntelligenceIndicatorProps, vt as ReactCustomMessageRenderer, w as NewMemory, wn as CopilotChatSuggestionViewProps, wt as OpenGenerativeUIActivityType, x as MemoryChanges, xn as IntelligenceIndicatorView, xt as GenerateSandboxedUiArgs, y as CopilotKitCoreReactSubscriber, yn as getIntelligenceTurnAnchors, yt as ReactCustomMessageRendererPosition, z as UseMemoriesResult, zn as CopilotChatConfigurationProvider, zt as AttachmentsConfig } from "../copilotkit-X2eGbOwf.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";
|
package/dist/v2/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as useRenderTool, $t as CopilotPopupView, A as UseAttachmentsReturn, An as CopilotChatUserMessageProps, At as MCPAppsActivityRenderer, B as useMemories, Bn as CopilotChatConfigurationProviderProps, Bt as CopilotChatAttachmentRenderer, C as MemoryScope, Cn as CopilotChatSuggestionView, Ct as OpenGenerativeUIActivityRenderer, D as UseLearningContainersArgs, Dn as CopilotChatReasoningMessage, Dt as OpenGenerativeUIToolRenderer, E as useLearningContainersInCurrentThread, En as CopilotChatSuggestionPillProps, Et as OpenGenerativeUIContentSchema, F as LearnFromUserActionInput, Fn as CopilotChatToolCallsViewProps, Ft as CopilotKitInspectorProps, G as AgentContextInput, Gn as AudioRecorderState, Gt as Thread, H as useInterrupt, Hn as CopilotChatLabels, Ht as CopilotThreadsDrawer, I as LearnFromUserActionResult, In as CopilotChatInput, It as WildcardToolCallRender, J as useCapabilities, Jt as useThreads, K as JsonSerializable, Kn as CopilotChatAudioRecorder, Kt as UseThreadsInput, L as UseLearnFromUserActionRecorder, Ln as CopilotChatInputProps, Lt as Attachment, M as LearnFromUserActionInCurrentThreadInput, Mn as CopilotChatAssistantMessageProps, Mt as ɵMcpFollowUpHost, N as UseLearnFromUserActionInCurrentThreadRecorder, Nn as CopilotChatFeedbackMessage, Nt as ɵrunMcpFollowUp, O as useLearningContainers, On as CopilotChatReasoningMessageProps, Ot as MCPAppsActivityContent, P as useLearnFromUserActionInCurrentThread, Pn as CopilotChatToolCallsView, Pt as CopilotKitInspector, Q as useDefaultRenderTool, Qt as CopilotSidebarProps, R as useLearnFromUserAction, Rn as ToolsMenuItem, Rt as AttachmentModality, S as MemoryKind, Sn as IntelligenceIndicatorViewProps, St as GenerateSandboxedUiArgsSchema, T as UseLearningContainersInCurrentThreadArgs, Tn as CopilotChatSuggestionPill, Tt as OpenGenerativeUIContent, U as useConfigureSuggestions, Un as useCopilotChatConfiguration, Ut as CopilotThreadsDrawerProps, V as UseInterruptConfig, Vn as CopilotChatConfigurationValue, Vt as CopilotChatAttachmentQueue, W as useSuggestions, Wn as AudioRecorderError, Wt as CopilotThreadsDrawerRowRenderer, X as useAgent, Xt as CopilotPopupProps, Y as UseAgentUpdate, Yt as CopilotPopup, Z as useHumanInTheLoop, Zt as CopilotSidebar, _ as useCopilotKit, _n as IntelligenceIndicator, _t as useRenderCustomMessages, a as A2UIMessageRendererOptions, an as CopilotChatToggleButton, at as Interrupt, b as Memory, bn as IntelligenceIndicatorStatus, bt as useRenderToolCall, c as CopilotKitCoreReact, cn as DefaultOpenIcon, ct as InterruptHandlerProps, d as InspectorAnchor, dn as CopilotChatView, dt as ResumeEntry, en as CopilotPopupViewProps, et as useComponent, f as SandboxFunctionsContext, fn as CopilotChatViewProps, ft as defineToolCallRenderer, g as CopilotKitProviderProps, gn as INTELLIGENCE_TURN_HEAD, gt as ReactToolCallRenderer, h as CopilotKitProvider, hn as CopilotChatMessageViewProps, ht as ReactActivityMessageRenderer, i as A2UIActionInterceptor, in as CopilotModalHeaderProps, it as INTERRUPT_EVENT_NAME, j as useAttachments, jn as CopilotChatAssistantMessage, jt as MCPAppsActivityType, k as UseAttachmentsProps, kn as CopilotChatUserMessage, kt as MCPAppsActivityContentSchema, l as CopilotKitCoreReactConfig, ln as CopilotChat, lt as InterruptRenderProps, m as CopilotKitContextValue, mn as CopilotChatMessageView, mt as ReactFrontendTool, nn as CopilotSidebarViewProps, nt as useRenderActivityMessage, o as A2UIUserAction, on as CopilotChatToggleButtonProps, ot as InterruptCancelFn, p as useSandboxFunctions, pn as AutoScrollMode, pt as ReactHumanInTheLoop, q as useAgentContext, qt as UseThreadsResult, r as CopilotKitProps, rn as CopilotModalHeader, rt as SandboxFunction, s as createA2UIMessageRenderer, sn as DefaultCloseIcon, st as InterruptEvent, t as CopilotKit, tn as CopilotSidebarView, tt as useFrontendTool, u as CopilotKitCoreReactSubscriber, un as CopilotChatProps, ut as InterruptResolveFn, v as useLicenseContext, vn as IntelligenceIndicatorProps, vt as ReactCustomMessageRenderer, w as NewMemory, wn as CopilotChatSuggestionViewProps, wt as OpenGenerativeUIActivityType, x as MemoryChanges, xn as IntelligenceIndicatorView, xt as GenerateSandboxedUiArgs, y as A2UIRecoveryRendererOptions, yn as getIntelligenceTurnAnchors, yt as ReactCustomMessageRendererPosition, z as UseMemoriesResult, zn as CopilotChatConfigurationProvider, zt as AttachmentsConfig } from "../copilotkit
|
|
1
|
+
import { $ as useRenderTool, $t as CopilotPopupView, A as UseAttachmentsReturn, An as CopilotChatUserMessageProps, At as MCPAppsActivityRenderer, B as useMemories, Bn as CopilotChatConfigurationProviderProps, Bt as CopilotChatAttachmentRenderer, C as MemoryScope, Cn as CopilotChatSuggestionView, Ct as OpenGenerativeUIActivityRenderer, D as UseLearningContainersArgs, Dn as CopilotChatReasoningMessage, Dt as OpenGenerativeUIToolRenderer, E as useLearningContainersInCurrentThread, En as CopilotChatSuggestionPillProps, Et as OpenGenerativeUIContentSchema, F as LearnFromUserActionInput, Fn as CopilotChatToolCallsViewProps, Ft as CopilotKitInspectorProps, G as AgentContextInput, Gn as AudioRecorderState, Gt as Thread, H as useInterrupt, Hn as CopilotChatLabels, Ht as CopilotThreadsDrawer, I as LearnFromUserActionResult, In as CopilotChatInput, It as WildcardToolCallRender, J as useCapabilities, Jt as useThreads, K as JsonSerializable, Kn as CopilotChatAudioRecorder, Kt as UseThreadsInput, L as UseLearnFromUserActionRecorder, Ln as CopilotChatInputProps, Lt as Attachment, M as LearnFromUserActionInCurrentThreadInput, Mn as CopilotChatAssistantMessageProps, Mt as ɵMcpFollowUpHost, N as UseLearnFromUserActionInCurrentThreadRecorder, Nn as CopilotChatFeedbackMessage, Nt as ɵrunMcpFollowUp, O as useLearningContainers, On as CopilotChatReasoningMessageProps, Ot as MCPAppsActivityContent, P as useLearnFromUserActionInCurrentThread, Pn as CopilotChatToolCallsView, Pt as CopilotKitInspector, Q as useDefaultRenderTool, Qt as CopilotSidebarProps, R as useLearnFromUserAction, Rn as ToolsMenuItem, Rt as AttachmentModality, S as MemoryKind, Sn as IntelligenceIndicatorViewProps, St as GenerateSandboxedUiArgsSchema, T as UseLearningContainersInCurrentThreadArgs, Tn as CopilotChatSuggestionPill, Tt as OpenGenerativeUIContent, U as useConfigureSuggestions, Un as useCopilotChatConfiguration, Ut as CopilotThreadsDrawerProps, V as UseInterruptConfig, Vn as CopilotChatConfigurationValue, Vt as CopilotChatAttachmentQueue, W as useSuggestions, Wn as AudioRecorderError, Wt as CopilotThreadsDrawerRowRenderer, X as useAgent, Xt as CopilotPopupProps, Y as UseAgentUpdate, Yt as CopilotPopup, Z as useHumanInTheLoop, Zt as CopilotSidebar, _ as useCopilotKit, _n as IntelligenceIndicator, _t as useRenderCustomMessages, a as A2UIMessageRendererOptions, an as CopilotChatToggleButton, at as Interrupt, b as Memory, bn as IntelligenceIndicatorStatus, bt as useRenderToolCall, c as CopilotKitCoreReact, cn as DefaultOpenIcon, ct as InterruptHandlerProps, d as InspectorAnchor, dn as CopilotChatView, dt as ResumeEntry, en as CopilotPopupViewProps, et as useComponent, f as SandboxFunctionsContext, fn as CopilotChatViewProps, ft as defineToolCallRenderer, g as CopilotKitProviderProps, gn as INTELLIGENCE_TURN_HEAD, gt as ReactToolCallRenderer, h as CopilotKitProvider, hn as CopilotChatMessageViewProps, ht as ReactActivityMessageRenderer, i as A2UIActionInterceptor, in as CopilotModalHeaderProps, it as INTERRUPT_EVENT_NAME, j as useAttachments, jn as CopilotChatAssistantMessage, jt as MCPAppsActivityType, k as UseAttachmentsProps, kn as CopilotChatUserMessage, kt as MCPAppsActivityContentSchema, l as CopilotKitCoreReactConfig, ln as CopilotChat, lt as InterruptRenderProps, m as CopilotKitContextValue, mn as CopilotChatMessageView, mt as ReactFrontendTool, nn as CopilotSidebarViewProps, nt as useRenderActivityMessage, o as A2UIUserAction, on as CopilotChatToggleButtonProps, ot as InterruptCancelFn, p as useSandboxFunctions, pn as AutoScrollMode, pt as ReactHumanInTheLoop, q as useAgentContext, qt as UseThreadsResult, r as CopilotKitProps, rn as CopilotModalHeader, rt as SandboxFunction, s as createA2UIMessageRenderer, sn as DefaultCloseIcon, st as InterruptEvent, t as CopilotKit, tn as CopilotSidebarView, tt as useFrontendTool, u as CopilotKitCoreReactSubscriber, un as CopilotChatProps, ut as InterruptResolveFn, v as useLicenseContext, vn as IntelligenceIndicatorProps, vt as ReactCustomMessageRenderer, w as NewMemory, wn as CopilotChatSuggestionViewProps, wt as OpenGenerativeUIActivityType, x as MemoryChanges, xn as IntelligenceIndicatorView, xt as GenerateSandboxedUiArgs, y as A2UIRecoveryRendererOptions, yn as getIntelligenceTurnAnchors, yt as ReactCustomMessageRendererPosition, z as UseMemoriesResult, zn as CopilotChatConfigurationProvider, zt as AttachmentsConfig } from "../copilotkit-Bs98akp9.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 useAgentContext, A as CopilotChatMessageView, At as AudioRecorderError, B as CopilotChatAssistantMessage_default, C as CopilotModalHeader, Ct as MCPAppsActivityContentSchema, D as CopilotChat, Dt as CopilotKitInspector, E as DefaultOpenIcon, Et as ɵrunMcpFollowUp, 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 CopilotChatConfigurationProvider, N as getIntelligenceTurnAnchors, Nt as useCopilotChatConfiguration, O as CopilotChatView_default, Ot as useRenderToolCall, P as IntelligenceIndicatorView, Q as useSuggestions, R as CopilotChatUserMessage_default, S as CopilotSidebarView, St as useSandboxFunctions, T as DefaultCloseIcon, Tt as MCPAppsActivityType, U as useLearningContainers, V as CopilotChatToolCallsView, W as useAttachments, X as INTERRUPT_EVENT_NAME, Y as useInterrupt, Z as useConfigureSuggestions, _ as WildcardToolCallRender, _t as OpenGenerativeUIActivityRenderer, at as useRenderTool, b as CopilotSidebar, bt as OpenGenerativeUIToolRenderer, ct as useRenderActivityMessage, dt as useCopilotKit, et as useCapabilities, ft as useLicenseContext, gt as GenerateSandboxedUiArgsSchema, ht as createA2UIMessageRenderer, it as useDefaultRenderTool, j as INTELLIGENCE_TURN_HEAD, jt as CopilotChatAudioRecorder, k as CopilotChatAttachmentQueue, kt as CopilotChatInput_default, lt as useRenderCustomMessages, mt as defineToolCallRenderer, nt as useAgent, ot as useComponent, pt as CopilotKitCoreReact, q as useMemories, rt as useHumanInTheLoop, st as useFrontendTool, t as CopilotKit, tt as UseAgentUpdate, ut as CopilotKitProvider, v as CopilotThreadsDrawer, vt as OpenGenerativeUIActivityType, w as CopilotChatToggleButton, wt as MCPAppsActivityRenderer, x as CopilotPopupView, xt as SandboxFunctionsContext, y as CopilotPopup, yt as OpenGenerativeUIContentSchema, z as CopilotChatAttachmentRenderer } from "../copilotkit-
|
|
3
|
+
import { $ as useAgentContext, A as CopilotChatMessageView, At as AudioRecorderError, B as CopilotChatAssistantMessage_default, C as CopilotModalHeader, Ct as MCPAppsActivityContentSchema, D as CopilotChat, Dt as CopilotKitInspector, E as DefaultOpenIcon, Et as ɵrunMcpFollowUp, 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 CopilotChatConfigurationProvider, N as getIntelligenceTurnAnchors, Nt as useCopilotChatConfiguration, O as CopilotChatView_default, Ot as useRenderToolCall, P as IntelligenceIndicatorView, Q as useSuggestions, R as CopilotChatUserMessage_default, S as CopilotSidebarView, St as useSandboxFunctions, T as DefaultCloseIcon, Tt as MCPAppsActivityType, U as useLearningContainers, V as CopilotChatToolCallsView, W as useAttachments, X as INTERRUPT_EVENT_NAME, Y as useInterrupt, Z as useConfigureSuggestions, _ as WildcardToolCallRender, _t as OpenGenerativeUIActivityRenderer, at as useRenderTool, b as CopilotSidebar, bt as OpenGenerativeUIToolRenderer, ct as useRenderActivityMessage, dt as useCopilotKit, et as useCapabilities, ft as useLicenseContext, gt as GenerateSandboxedUiArgsSchema, ht as createA2UIMessageRenderer, it as useDefaultRenderTool, j as INTELLIGENCE_TURN_HEAD, jt as CopilotChatAudioRecorder, k as CopilotChatAttachmentQueue, kt as CopilotChatInput_default, lt as useRenderCustomMessages, mt as defineToolCallRenderer, nt as useAgent, ot as useComponent, pt as CopilotKitCoreReact, q as useMemories, rt as useHumanInTheLoop, st as useFrontendTool, t as CopilotKit, tt as UseAgentUpdate, ut as CopilotKitProvider, v as CopilotThreadsDrawer, vt as OpenGenerativeUIActivityType, w as CopilotChatToggleButton, wt as MCPAppsActivityRenderer, x as CopilotPopupView, xt as SandboxFunctionsContext, y as CopilotPopup, yt as OpenGenerativeUIContentSchema, z as CopilotChatAttachmentRenderer } from "../copilotkit-Ap_yisA5.mjs";
|
|
4
4
|
import "./index.css";
|
|
5
5
|
import { defaultTheme as a2uiDefaultTheme } from "@copilotkit/a2ui-renderer";
|
|
6
6
|
|
package/dist/v2/index.umd.js
CHANGED
|
@@ -1660,6 +1660,29 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
1660
1660
|
if (prevProps.RenderComponent !== nextProps.RenderComponent) return false;
|
|
1661
1661
|
return true;
|
|
1662
1662
|
});
|
|
1663
|
+
const IS_DEVELOPMENT$1 = process.env.NODE_ENV !== "production";
|
|
1664
|
+
/**
|
|
1665
|
+
* Reports tool calls that resolved to no renderer.
|
|
1666
|
+
*
|
|
1667
|
+
* A tool call with no renderer paints an empty message container and says
|
|
1668
|
+
* nothing else, so the only signal a developer gets today is a blank space in
|
|
1669
|
+
* the chat. This names the call and the renderers that *are* registered, which
|
|
1670
|
+
* is the whole diagnosis when the cause is a name that does not match.
|
|
1671
|
+
*
|
|
1672
|
+
* @param toolNames - The unmatched tool names collected during render.
|
|
1673
|
+
* @param registered - The registry as it stands now, re-read at report time.
|
|
1674
|
+
* @param alreadyWarned - Names already reported, mutated to keep this once per name.
|
|
1675
|
+
*/
|
|
1676
|
+
function warnAboutUnrenderedToolCalls(toolNames, registered, alreadyWarned) {
|
|
1677
|
+
const registeredNames = Array.from(new Set(registered.map((rc) => rc.name)));
|
|
1678
|
+
const hasWildcard = registeredNames.includes("*");
|
|
1679
|
+
for (const toolName of toolNames) {
|
|
1680
|
+
if (hasWildcard || registeredNames.includes(toolName)) continue;
|
|
1681
|
+
if (alreadyWarned.has(toolName)) continue;
|
|
1682
|
+
alreadyWarned.add(toolName);
|
|
1683
|
+
console.warn(`[CopilotKit] The agent called the tool "${toolName}", and no renderer is registered for it, so that message rendered nothing. ` + (registeredNames.length === 0 ? "No tool-call renderers are registered. " : `Registered renderers: ${registeredNames.map((name) => `"${name}"`).join(", ")}. `) + `Register one with useRenderTool({ name: "${toolName}", ... }), or call useDefaultRenderTool() for a built-in card that covers every tool the agent calls. This warning is development-only.`);
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1663
1686
|
/**
|
|
1664
1687
|
* Hook that returns a function to render tool calls based on the render functions
|
|
1665
1688
|
* defined in CopilotKitProvider.
|
|
@@ -1669,13 +1692,18 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
1669
1692
|
function useRenderToolCall() {
|
|
1670
1693
|
const { copilotkit, executingToolCallIds } = useCopilotKit();
|
|
1671
1694
|
const agentId = useCopilotChatConfiguration()?.agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
|
|
1695
|
+
const unrenderedToolNames = (0, react.useRef)(/* @__PURE__ */ new Set());
|
|
1696
|
+
const warnedToolNames = (0, react.useRef)(/* @__PURE__ */ new Set());
|
|
1672
1697
|
const renderToolCalls = (0, react.useSyncExternalStore)((callback) => {
|
|
1673
1698
|
return copilotkit.subscribe({ onRenderToolCallsChanged: callback }).unsubscribe;
|
|
1674
1699
|
}, () => copilotkit.renderToolCalls, () => copilotkit.renderToolCalls);
|
|
1675
|
-
|
|
1700
|
+
const renderToolCall = (0, react.useCallback)(({ toolCall, toolMessage }) => {
|
|
1676
1701
|
const exactMatches = renderToolCalls.filter((rc) => rc.name === toolCall.function.name);
|
|
1677
1702
|
const renderConfig = exactMatches.find((rc) => rc.agentId === agentId) || exactMatches.find((rc) => !rc.agentId) || exactMatches[0] || renderToolCalls.find((rc) => rc.name === "*");
|
|
1678
|
-
if (!renderConfig)
|
|
1703
|
+
if (!renderConfig) {
|
|
1704
|
+
if (IS_DEVELOPMENT$1) unrenderedToolNames.current.add(toolCall.function.name);
|
|
1705
|
+
return null;
|
|
1706
|
+
}
|
|
1679
1707
|
const RenderComponent = renderConfig.render;
|
|
1680
1708
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolCallRenderer, {
|
|
1681
1709
|
toolCall,
|
|
@@ -1688,6 +1716,17 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
1688
1716
|
executingToolCallIds,
|
|
1689
1717
|
agentId
|
|
1690
1718
|
]);
|
|
1719
|
+
(0, react.useEffect)(() => {
|
|
1720
|
+
if (!IS_DEVELOPMENT$1) return;
|
|
1721
|
+
if (unrenderedToolNames.current.size === 0) return;
|
|
1722
|
+
const timer = setTimeout(() => {
|
|
1723
|
+
const pending = Array.from(unrenderedToolNames.current);
|
|
1724
|
+
unrenderedToolNames.current.clear();
|
|
1725
|
+
warnAboutUnrenderedToolCalls(pending, copilotkit.renderToolCalls, warnedToolNames.current);
|
|
1726
|
+
}, 0);
|
|
1727
|
+
return () => clearTimeout(timer);
|
|
1728
|
+
});
|
|
1729
|
+
return renderToolCall;
|
|
1691
1730
|
}
|
|
1692
1731
|
|
|
1693
1732
|
//#endregion
|
|
@@ -3166,6 +3205,95 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3166
3205
|
a2ui_operations: zod.z.array(zod.z.any()).optional(),
|
|
3167
3206
|
...A2UILifecycleFields
|
|
3168
3207
|
}).passthrough();
|
|
3208
|
+
const IS_DEVELOPMENT = process.env.NODE_ENV !== "production";
|
|
3209
|
+
/**
|
|
3210
|
+
* How long to wait for a surface to report its first paint before giving up on
|
|
3211
|
+
* the loader cross-over. Reaching it also means `onReady` never fired, which is
|
|
3212
|
+
* the signal the warning below reports.
|
|
3213
|
+
*/
|
|
3214
|
+
const PAINT_FALLBACK_MS = 8e3;
|
|
3215
|
+
/**
|
|
3216
|
+
* Names the operation kinds a surface received, for a warning that has to say
|
|
3217
|
+
* what did arrive as well as what did not.
|
|
3218
|
+
*
|
|
3219
|
+
* @param operations - The operations grouped under one surface.
|
|
3220
|
+
* @returns A comma-separated list of operation keys, or "none".
|
|
3221
|
+
*/
|
|
3222
|
+
function describeOperationKinds(operations) {
|
|
3223
|
+
const kinds = /* @__PURE__ */ new Set();
|
|
3224
|
+
for (const operation of operations) {
|
|
3225
|
+
if (!operation || typeof operation !== "object") continue;
|
|
3226
|
+
for (const key of Object.keys(operation)) if (key !== "version") kinds.add(key);
|
|
3227
|
+
}
|
|
3228
|
+
return kinds.size === 0 ? "none" : Array.from(kinds).join(", ");
|
|
3229
|
+
}
|
|
3230
|
+
/**
|
|
3231
|
+
* Reports surfaces that received operations and never painted.
|
|
3232
|
+
*
|
|
3233
|
+
* Reaching {@link PAINT_FALLBACK_MS} with no `onReady` means the operations were
|
|
3234
|
+
* accepted, were not malformed enough to raise the provider's error state, and
|
|
3235
|
+
* still put nothing on screen. Left alone that is invisible: the loader drops,
|
|
3236
|
+
* the turn finishes, and the only trace is an empty placeholder above the reply.
|
|
3237
|
+
*
|
|
3238
|
+
* `surfaceHasRenderableContent` already knows which half is missing, so the
|
|
3239
|
+
* warning says which rather than making the reader re-derive it.
|
|
3240
|
+
*
|
|
3241
|
+
* @param grouped - Operations grouped by surface id.
|
|
3242
|
+
*/
|
|
3243
|
+
function warnAboutUnpaintedSurfaces(grouped) {
|
|
3244
|
+
for (const [surfaceId, operations] of grouped) {
|
|
3245
|
+
if (surfaceHasRenderableContent(operations)) continue;
|
|
3246
|
+
const cause = operations.filter((o) => o?.updateComponents).length === 0 ? "no updateComponents operation arrived, so the surface was never given anything to draw" : "its components address their values by \"path\" and no updateDataModel carried a non-empty value, so every bound component drew empty";
|
|
3247
|
+
console.warn(`[CopilotKit] A2UI surface "${surfaceId}" received operations and never painted after ${String(PAINT_FALLBACK_MS)}ms: ${cause}. Operations received: ${describeOperationKinds(operations)}. The payload was accepted, so check what the agent sent rather than the client wiring. This warning is development-only.`);
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
/**
|
|
3251
|
+
* Names the component ids a surface was sent, for a warning about the one id
|
|
3252
|
+
* that is missing.
|
|
3253
|
+
*
|
|
3254
|
+
* @param operations - The operations grouped under one surface.
|
|
3255
|
+
* @returns A quoted, comma-separated list of ids, or "none".
|
|
3256
|
+
*/
|
|
3257
|
+
function describeComponentIds(operations) {
|
|
3258
|
+
const ids = [];
|
|
3259
|
+
for (const operation of operations) {
|
|
3260
|
+
const components = operation?.updateComponents?.components;
|
|
3261
|
+
if (!Array.isArray(components)) continue;
|
|
3262
|
+
for (const component of components) {
|
|
3263
|
+
const id = component?.id;
|
|
3264
|
+
if (typeof id === "string" && !ids.includes(id)) ids.push(id);
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
return ids.length === 0 ? "none" : ids.map((id) => `"${id}"`).join(", ");
|
|
3268
|
+
}
|
|
3269
|
+
/**
|
|
3270
|
+
* Reports a surface that is still waiting for its {@link ROOT_COMPONENT_ID}
|
|
3271
|
+
* component once its operations have stopped arriving.
|
|
3272
|
+
*
|
|
3273
|
+
* Both renderers begin walking a surface at that one id, and treat an id they
|
|
3274
|
+
* cannot find as not arrived yet — an animated placeholder. That is right while
|
|
3275
|
+
* operations stream. Once they have stopped it is not waiting, it is stuck, and
|
|
3276
|
+
* every other check calls it healthy: the surface exists, `processMessages` did
|
|
3277
|
+
* not throw, the component types were never reached, and
|
|
3278
|
+
* `surfaceHasRenderableContent` says yes on the strength of components plus a
|
|
3279
|
+
* data model, so `onReady` fires and the never-painted report is suppressed.
|
|
3280
|
+
* A complete, accepted payload therefore animates a grey box forever in silence.
|
|
3281
|
+
*
|
|
3282
|
+
* Reads the live components model rather than scanning the operations for the
|
|
3283
|
+
* id, so it covers every way the root can fail to resolve — not only a payload
|
|
3284
|
+
* that never named one.
|
|
3285
|
+
*
|
|
3286
|
+
* @param surfaceId - The surface the operations were addressed to.
|
|
3287
|
+
* @param operations - The operations processed for that surface.
|
|
3288
|
+
* @param surface - The live surface model, already known to exist.
|
|
3289
|
+
*/
|
|
3290
|
+
function warnAboutUnresolvedRoot(surfaceId, operations, surface) {
|
|
3291
|
+
if (surface?.componentsModel?.get?.(_copilotkit_a2ui_renderer.ROOT_COMPONENT_ID)) return;
|
|
3292
|
+
const componentOps = operations.filter((o) => o?.updateComponents);
|
|
3293
|
+
if (componentOps.length === 0) return;
|
|
3294
|
+
const cause = componentOps.some((o) => o.updateComponents?.components?.some?.((c) => c?.id === _copilotkit_a2ui_renderer.ROOT_COMPONENT_ID)) ? `a component with id "${_copilotkit_a2ui_renderer.ROOT_COMPONENT_ID}" WAS sent, so the components did not reach the surface's model — check for an A2UI render error above, or a catalog that took none of them` : `the components it received are named ${describeComponentIds(operations)}, and none of them is "${_copilotkit_a2ui_renderer.ROOT_COMPONENT_ID}" — rename the entry-point component to "${_copilotkit_a2ui_renderer.ROOT_COMPONENT_ID}", and make every other component reachable from it through child/children`;
|
|
3295
|
+
console.warn(`[CopilotKit] A2UI surface "${surfaceId}" has no "${_copilotkit_a2ui_renderer.ROOT_COMPONENT_ID}" component ${String(PAINT_FALLBACK_MS)}ms after its last operations were processed, so it is showing the placeholder for a component that has not arrived yet and will keep showing it: ${cause}. Operations received: ${describeOperationKinds(operations)}. This warning is development-only.`);
|
|
3296
|
+
}
|
|
3169
3297
|
function createA2UIMessageRenderer(options) {
|
|
3170
3298
|
const { theme, catalog, loadingComponent, recovery, onAction } = options;
|
|
3171
3299
|
const showAfterMs = recovery?.showAfterMs ?? 2e3;
|
|
@@ -3199,6 +3327,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3199
3327
|
return groups;
|
|
3200
3328
|
}, [operations]);
|
|
3201
3329
|
const hasOps = groupedOperations.size > 0;
|
|
3330
|
+
const groupedOperationsRef = (0, react.useRef)(groupedOperations);
|
|
3331
|
+
groupedOperationsRef.current = groupedOperations;
|
|
3202
3332
|
const renderLifecycle = (c) => {
|
|
3203
3333
|
const status = c?.status;
|
|
3204
3334
|
const debugExposure = resolveDebugExposure(c, optionDebugExposure);
|
|
@@ -3230,7 +3360,10 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3230
3360
|
readyRef.current = false;
|
|
3231
3361
|
return;
|
|
3232
3362
|
}
|
|
3233
|
-
const t = setTimeout(() =>
|
|
3363
|
+
const t = setTimeout(() => {
|
|
3364
|
+
setSurfaceReady(true);
|
|
3365
|
+
if (IS_DEVELOPMENT && !readyRef.current) warnAboutUnpaintedSurfaces(groupedOperationsRef.current);
|
|
3366
|
+
}, PAINT_FALLBACK_MS);
|
|
3234
3367
|
return () => clearTimeout(t);
|
|
3235
3368
|
}, [hasOps]);
|
|
3236
3369
|
if (!hasOps) return renderLifecycle(content);
|
|
@@ -3354,8 +3487,21 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3354
3487
|
const hash = JSON.stringify(operations);
|
|
3355
3488
|
if (hash === lastHashRef.current) return;
|
|
3356
3489
|
lastHashRef.current = hash;
|
|
3357
|
-
|
|
3490
|
+
const ops = getSurface(surfaceId) ? operations.filter((op) => !op?.createSurface) : operations;
|
|
3491
|
+
processMessages(ops);
|
|
3358
3492
|
if (onReady && surfaceHasRenderableContent(operations)) onReady();
|
|
3493
|
+
if (!IS_DEVELOPMENT) return;
|
|
3494
|
+
if (!getSurface(surfaceId)) {
|
|
3495
|
+
const missingSurfaceCheck = setTimeout(() => {
|
|
3496
|
+
if (getSurface(surfaceId)) return;
|
|
3497
|
+
console.warn(`[CopilotKit] A2UI processed ${String(ops.length)} operation(s) addressed to surface "${surfaceId}" and no surface by that id exists, so this card rendered nothing. Operations received: ${describeOperationKinds(ops)}. A createSurface for "${surfaceId}" has to arrive before, or with, the operations that target it. This warning is development-only.`);
|
|
3498
|
+
}, 0);
|
|
3499
|
+
return () => clearTimeout(missingSurfaceCheck);
|
|
3500
|
+
}
|
|
3501
|
+
const unresolvedRootCheck = setTimeout(() => {
|
|
3502
|
+
warnAboutUnresolvedRoot(surfaceId, operations, getSurface(surfaceId));
|
|
3503
|
+
}, PAINT_FALLBACK_MS);
|
|
3504
|
+
return () => clearTimeout(unresolvedRootCheck);
|
|
3359
3505
|
}, [
|
|
3360
3506
|
processMessages,
|
|
3361
3507
|
getSurface,
|
|
@@ -3382,10 +3528,26 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3382
3528
|
return Object.values(v).some((x) => Array.isArray(x) ? x.length > 0 : x !== null && x !== void 0 && x !== "");
|
|
3383
3529
|
});
|
|
3384
3530
|
}
|
|
3531
|
+
/**
|
|
3532
|
+
* Resolves the surface an operation addresses.
|
|
3533
|
+
*
|
|
3534
|
+
* The nested v0.9 `surfaceId` wins, because that is the id `MessageProcessor`
|
|
3535
|
+
* creates the surface under. Grouping by a top-level `surfaceId` instead files
|
|
3536
|
+
* the operations against a surface that never exists, which paints nothing —
|
|
3537
|
+
* the silence the missing-surface report above now names. A top-level
|
|
3538
|
+
* `surfaceId` is not the v0.9 shape, so it is honoured only when no nested id is
|
|
3539
|
+
* present. `getSurfaceId` in `@copilotkit/a2ui-renderer`'s web-components path
|
|
3540
|
+
* resolves it in the same order; the two disagreeing is what OSS-1048 recorded.
|
|
3541
|
+
*
|
|
3542
|
+
* @param operation - One A2UI operation, of any shape.
|
|
3543
|
+
* @returns The surface id, or null when the operation names none.
|
|
3544
|
+
*/
|
|
3385
3545
|
function getOperationSurfaceId(operation) {
|
|
3386
3546
|
if (!operation || typeof operation !== "object") return null;
|
|
3547
|
+
const nested = operation?.createSurface?.surfaceId ?? operation?.updateComponents?.surfaceId ?? operation?.updateDataModel?.surfaceId ?? operation?.deleteSurface?.surfaceId;
|
|
3548
|
+
if (typeof nested === "string") return nested;
|
|
3387
3549
|
if (typeof operation.surfaceId === "string") return operation.surfaceId;
|
|
3388
|
-
return
|
|
3550
|
+
return null;
|
|
3389
3551
|
}
|
|
3390
3552
|
|
|
3391
3553
|
//#endregion
|
|
@@ -3503,6 +3665,9 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3503
3665
|
const EMPTY_HEADERS = Object.freeze({});
|
|
3504
3666
|
const EMPTY_PROPERTIES = Object.freeze({});
|
|
3505
3667
|
const EMPTY_AGENTS = Object.freeze({});
|
|
3668
|
+
/** Registration name of a catch-all tool: handles any otherwise-unhandled call. */
|
|
3669
|
+
const WILDCARD_TOOL_NAME$1 = "*";
|
|
3670
|
+
const HUMAN_IN_THE_LOOP_ABORTED_MESSAGE = "Human-in-the-loop interaction aborted";
|
|
3506
3671
|
const DEFAULT_DESIGN_SKILL = `When generating UI with generateSandboxedUi, follow these design principles inspired by shadcn/ui:
|
|
3507
3672
|
|
|
3508
3673
|
- Use a minimal, flat aesthetic. Avoid drop shadows and gradients — rely on subtle borders (1px solid, light gray like #e5e7eb) to define surfaces.
|
|
@@ -3621,6 +3786,11 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3621
3786
|
}
|
|
3622
3787
|
const chatApiEndpoint = runtimeUrl ?? (resolvedPublicKey ? COPILOT_CLOUD_CHAT_URL$1 : void 0);
|
|
3623
3788
|
const frontendToolsList = useStableArrayProp(frontendTools, "frontendTools must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.");
|
|
3789
|
+
/**
|
|
3790
|
+
* A `humanInTheLoop` prop tool call that is parked, waiting on the user.
|
|
3791
|
+
* Keyed by tool call id, so parallel calls of one tool stay independent.
|
|
3792
|
+
*/
|
|
3793
|
+
const pendingHumanInTheLoopRef = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
3624
3794
|
const humanInTheLoopList = useStableArrayProp(humanInTheLoop, "humanInTheLoop must be a stable array. If you want to dynamically add or remove human-in-the-loop tools, use `useHumanInTheLoop` instead.");
|
|
3625
3795
|
const sandboxFunctionsList = useStableArrayProp(openGenerativeUI?.sandboxFunctions, "openGenerativeUI.sandboxFunctions must be a stable array.");
|
|
3626
3796
|
const processedHumanInTheLoopTools = (0, react.useMemo)(() => {
|
|
@@ -3633,20 +3803,52 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3633
3803
|
parameters: tool.parameters,
|
|
3634
3804
|
followUp: tool.followUp,
|
|
3635
3805
|
...tool.agentId && { agentId: tool.agentId },
|
|
3636
|
-
handler: async () => {
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3806
|
+
handler: async (_args, context) => {
|
|
3807
|
+
const signal = context?.signal;
|
|
3808
|
+
const key = context?.toolCall?.id ?? tool.name;
|
|
3809
|
+
return new Promise((resolve, reject) => {
|
|
3810
|
+
if (signal?.aborted) {
|
|
3811
|
+
reject(new Error(HUMAN_IN_THE_LOOP_ABORTED_MESSAGE));
|
|
3812
|
+
return;
|
|
3813
|
+
}
|
|
3814
|
+
const pending = { resolve };
|
|
3815
|
+
pendingHumanInTheLoopRef.current.set(key, pending);
|
|
3816
|
+
if (signal) {
|
|
3817
|
+
const onAbort = () => {
|
|
3818
|
+
pendingHumanInTheLoopRef.current.delete(key);
|
|
3819
|
+
reject(new Error(HUMAN_IN_THE_LOOP_ABORTED_MESSAGE));
|
|
3820
|
+
};
|
|
3821
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
3822
|
+
pending.detachAbort = () => {
|
|
3823
|
+
signal.removeEventListener("abort", onAbort);
|
|
3824
|
+
};
|
|
3825
|
+
}
|
|
3640
3826
|
});
|
|
3641
3827
|
}
|
|
3642
3828
|
};
|
|
3643
3829
|
processedTools.push(frontendTool);
|
|
3644
|
-
if (tool.render)
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3830
|
+
if (tool.render) {
|
|
3831
|
+
const ToolComponent = tool.render;
|
|
3832
|
+
const RenderComponent = (props) => (0, react.createElement)(ToolComponent, {
|
|
3833
|
+
...props,
|
|
3834
|
+
name: tool.name === WILDCARD_TOOL_NAME$1 ? props.name : tool.name,
|
|
3835
|
+
description: tool.description || "",
|
|
3836
|
+
agentId: tool.agentId,
|
|
3837
|
+
respond: props.status === _copilotkit_core.ToolCallStatus.Executing ? async (result) => {
|
|
3838
|
+
const pending = pendingHumanInTheLoopRef.current.get(props.toolCallId);
|
|
3839
|
+
if (!pending) return;
|
|
3840
|
+
pending.detachAbort?.();
|
|
3841
|
+
pendingHumanInTheLoopRef.current.delete(props.toolCallId);
|
|
3842
|
+
pending.resolve(result);
|
|
3843
|
+
} : void 0
|
|
3844
|
+
});
|
|
3845
|
+
processedRenderToolCalls.push({
|
|
3846
|
+
name: tool.name,
|
|
3847
|
+
args: tool.parameters,
|
|
3848
|
+
render: RenderComponent,
|
|
3849
|
+
...tool.agentId && { agentId: tool.agentId }
|
|
3850
|
+
});
|
|
3851
|
+
}
|
|
3650
3852
|
});
|
|
3651
3853
|
return {
|
|
3652
3854
|
tools: processedTools,
|