@copilotkit/react-core 1.70.0 → 1.70.1
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-BuzP0VeG.d.cts → copilotkit-CtF2clxZ.d.cts} +20 -20
- package/dist/copilotkit-CtF2clxZ.d.cts.map +1 -0
- package/dist/{copilotkit-BE76j111.cjs → copilotkit-CxLT6zFx.cjs} +145 -211
- package/dist/copilotkit-CxLT6zFx.cjs.map +1 -0
- package/dist/{copilotkit-B7aFKfQR.mjs → copilotkit-DiUK2Bhq.mjs} +145 -211
- package/dist/copilotkit-DiUK2Bhq.mjs.map +1 -0
- package/dist/{copilotkit-CbZGwElm.d.mts → copilotkit-DsWuxPUQ.d.mts} +20 -20
- package/dist/copilotkit-DsWuxPUQ.d.mts.map +1 -0
- package/dist/index.cjs +5 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -4
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +142 -207
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/headless.cjs +2 -1
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.mjs +2 -1
- 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 +144 -210
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +11 -8
- package/skills/react-core/SKILL.md +1 -1
- package/skills/react-core/references/threads.md +1 -1
- package/dist/copilotkit-B7aFKfQR.mjs.map +0 -1
- package/dist/copilotkit-BE76j111.cjs.map +0 -1
- package/dist/copilotkit-BuzP0VeG.d.cts.map +0 -1
- package/dist/copilotkit-CbZGwElm.d.mts.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-CxLT6zFx.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-CtF2clxZ.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-DsWuxPUQ.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-DiUK2Bhq.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
|
@@ -1876,7 +1876,6 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
1876
1876
|
newMessages: []
|
|
1877
1877
|
};
|
|
1878
1878
|
}
|
|
1879
|
-
const PROTOCOL_VERSION = "2025-06-18";
|
|
1880
1879
|
function buildSandboxHTML(extraCspDomains) {
|
|
1881
1880
|
const baseScriptSrc = "'self' 'wasm-unsafe-eval' 'unsafe-inline' 'unsafe-eval' blob: data: http://localhost:* https://localhost:*";
|
|
1882
1881
|
const baseFrameSrc = "* blob: data: http://localhost:* https://localhost:*";
|
|
@@ -1988,6 +1987,13 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
1988
1987
|
}
|
|
1989
1988
|
};
|
|
1990
1989
|
const mcpAppsRequestQueue = new MCPAppsRequestQueue();
|
|
1990
|
+
const MCP_OPEN_LINK_BLOCKED_SCHEMES = new Set([
|
|
1991
|
+
"javascript:",
|
|
1992
|
+
"data:",
|
|
1993
|
+
"vbscript:",
|
|
1994
|
+
"blob:",
|
|
1995
|
+
"file:"
|
|
1996
|
+
]);
|
|
1991
1997
|
/**
|
|
1992
1998
|
* Activity type for MCP Apps events - must match the middleware's MCPAppsActivityType
|
|
1993
1999
|
*/
|
|
@@ -2003,18 +2009,32 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2003
2009
|
serverId: zod.z.string().optional(),
|
|
2004
2010
|
toolInput: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
2005
2011
|
});
|
|
2006
|
-
function isRequest(msg) {
|
|
2007
|
-
return "id" in msg && "method" in msg;
|
|
2008
|
-
}
|
|
2009
|
-
function isNotification(msg) {
|
|
2010
|
-
return !("id" in msg) && "method" in msg;
|
|
2011
|
-
}
|
|
2012
2012
|
/**
|
|
2013
2013
|
* MCP Apps Extension Activity Renderer
|
|
2014
2014
|
*
|
|
2015
2015
|
* Renders MCP Apps UI in a sandboxed iframe with full protocol support.
|
|
2016
2016
|
* Fetches resource content on-demand via proxied MCP requests.
|
|
2017
2017
|
*/
|
|
2018
|
+
/**
|
|
2019
|
+
* Permissive `ui/message` schema. ext-apps restricts the request to
|
|
2020
|
+
* `role: "user"` with no `followUp`, but CopilotKit intentionally extends
|
|
2021
|
+
* `ui/message` with `role` ("user" | "assistant") and `followUp` (documented
|
|
2022
|
+
* behavior with dedicated tests). We register our own handler (instead of the
|
|
2023
|
+
* bridge's strict `onmessage`) so those extensions survive the migration.
|
|
2024
|
+
*
|
|
2025
|
+
* Going forward, widgets SHOULD pass the extensions under
|
|
2026
|
+
* `params._meta.copilotkit`; the top-level `role`/`followUp` fields are the
|
|
2027
|
+
* legacy channel, kept for backward compatibility and slated for deprecation.
|
|
2028
|
+
*/
|
|
2029
|
+
const CopilotKitUiMessageSchema = zod.z.object({
|
|
2030
|
+
method: zod.z.literal("ui/message"),
|
|
2031
|
+
params: zod.z.object({
|
|
2032
|
+
role: zod.z.string().optional(),
|
|
2033
|
+
content: zod.z.array(zod.z.any()).optional(),
|
|
2034
|
+
followUp: zod.z.boolean().optional(),
|
|
2035
|
+
_meta: zod.z.record(zod.z.string(), zod.z.any()).optional()
|
|
2036
|
+
}).passthrough()
|
|
2037
|
+
});
|
|
2018
2038
|
const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, agent }) {
|
|
2019
2039
|
const { copilotkit } = useCopilotKit();
|
|
2020
2040
|
const containerRef = (0, react.useRef)(null);
|
|
@@ -2028,41 +2048,12 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2028
2048
|
contentRef.current = content;
|
|
2029
2049
|
const agentRef = (0, react.useRef)(agent);
|
|
2030
2050
|
agentRef.current = agent;
|
|
2051
|
+
const bridgeRef = (0, react.useRef)(null);
|
|
2031
2052
|
const fetchStateRef = (0, react.useRef)({
|
|
2032
2053
|
inProgress: false,
|
|
2033
2054
|
promise: null,
|
|
2034
2055
|
resourceUri: null
|
|
2035
2056
|
});
|
|
2036
|
-
const sendToIframe = (0, react.useCallback)((msg) => {
|
|
2037
|
-
if (iframeRef.current?.contentWindow) {
|
|
2038
|
-
console.log("[MCPAppsRenderer] Sending to iframe:", msg);
|
|
2039
|
-
iframeRef.current.contentWindow.postMessage(msg, "*");
|
|
2040
|
-
}
|
|
2041
|
-
}, []);
|
|
2042
|
-
const sendResponse = (0, react.useCallback)((id, result) => {
|
|
2043
|
-
sendToIframe({
|
|
2044
|
-
jsonrpc: "2.0",
|
|
2045
|
-
id,
|
|
2046
|
-
result
|
|
2047
|
-
});
|
|
2048
|
-
}, [sendToIframe]);
|
|
2049
|
-
const sendErrorResponse = (0, react.useCallback)((id, code, message) => {
|
|
2050
|
-
sendToIframe({
|
|
2051
|
-
jsonrpc: "2.0",
|
|
2052
|
-
id,
|
|
2053
|
-
error: {
|
|
2054
|
-
code,
|
|
2055
|
-
message
|
|
2056
|
-
}
|
|
2057
|
-
});
|
|
2058
|
-
}, [sendToIframe]);
|
|
2059
|
-
const sendNotification = (0, react.useCallback)((method, params) => {
|
|
2060
|
-
sendToIframe({
|
|
2061
|
-
jsonrpc: "2.0",
|
|
2062
|
-
method,
|
|
2063
|
-
params: params || {}
|
|
2064
|
-
});
|
|
2065
|
-
}, [sendToIframe]);
|
|
2066
2057
|
(0, react.useEffect)(() => {
|
|
2067
2058
|
const { resourceUri, serverHash, serverId } = content;
|
|
2068
2059
|
if (fetchStateRef.current.inProgress && fetchStateRef.current.resourceUri === resourceUri) {
|
|
@@ -2117,11 +2108,15 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2117
2108
|
const container = containerRef.current;
|
|
2118
2109
|
if (!container) return;
|
|
2119
2110
|
let mounted = true;
|
|
2120
|
-
let
|
|
2121
|
-
let initialListener = null;
|
|
2111
|
+
let bridge = null;
|
|
2122
2112
|
let createdIframe = null;
|
|
2123
2113
|
const setup = async () => {
|
|
2124
2114
|
try {
|
|
2115
|
+
const bridgeModule = await import("@modelcontextprotocol/ext-apps/app-bridge").catch((importErr) => {
|
|
2116
|
+
throw new Error("MCP Apps require '@modelcontextprotocol/ext-apps' and its peer '@modelcontextprotocol/sdk'. Install them with: npm install @modelcontextprotocol/ext-apps @modelcontextprotocol/sdk", { cause: importErr });
|
|
2117
|
+
});
|
|
2118
|
+
if (!mounted) return;
|
|
2119
|
+
const { AppBridge, PostMessageTransport } = bridgeModule;
|
|
2125
2120
|
const iframe = document.createElement("iframe");
|
|
2126
2121
|
createdIframe = iframe;
|
|
2127
2122
|
iframe.style.width = "100%";
|
|
@@ -2132,151 +2127,108 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2132
2127
|
iframe.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms");
|
|
2133
2128
|
iframe.setAttribute("data-testid", "mcp-app-iframe");
|
|
2134
2129
|
iframe.setAttribute("title", "Interactive MCP application");
|
|
2135
|
-
const sandboxReady = new Promise((resolve) => {
|
|
2136
|
-
initialListener = (event) => {
|
|
2137
|
-
if (event.source === iframe.contentWindow) {
|
|
2138
|
-
if (event.data?.method === "ui/notifications/sandbox-proxy-ready") {
|
|
2139
|
-
if (initialListener) {
|
|
2140
|
-
window.removeEventListener("message", initialListener);
|
|
2141
|
-
initialListener = null;
|
|
2142
|
-
}
|
|
2143
|
-
resolve();
|
|
2144
|
-
}
|
|
2145
|
-
}
|
|
2146
|
-
};
|
|
2147
|
-
window.addEventListener("message", initialListener);
|
|
2148
|
-
});
|
|
2149
|
-
if (!mounted) {
|
|
2150
|
-
if (initialListener) {
|
|
2151
|
-
window.removeEventListener("message", initialListener);
|
|
2152
|
-
initialListener = null;
|
|
2153
|
-
}
|
|
2154
|
-
return;
|
|
2155
|
-
}
|
|
2156
2130
|
const cspDomains = fetchedResource._meta?.ui?.csp?.resourceDomains;
|
|
2157
2131
|
iframe.srcdoc = buildSandboxHTML(cspDomains);
|
|
2158
2132
|
iframeRef.current = iframe;
|
|
2159
2133
|
container.appendChild(iframe);
|
|
2160
|
-
|
|
2161
|
-
if (!
|
|
2162
|
-
console.log("[MCPAppsRenderer] Sandbox proxy ready");
|
|
2163
|
-
messageHandler = async (event) => {
|
|
2164
|
-
if (event.source !== iframe.contentWindow) return;
|
|
2165
|
-
const msg = event.data;
|
|
2166
|
-
if (!msg || typeof msg !== "object" || msg.jsonrpc !== "2.0") return;
|
|
2167
|
-
console.log("[MCPAppsRenderer] Received from iframe:", msg);
|
|
2168
|
-
if (isRequest(msg)) switch (msg.method) {
|
|
2169
|
-
case "ui/initialize":
|
|
2170
|
-
sendResponse(msg.id, {
|
|
2171
|
-
protocolVersion: PROTOCOL_VERSION,
|
|
2172
|
-
hostInfo: {
|
|
2173
|
-
name: "CopilotKit MCP Apps Host",
|
|
2174
|
-
version: "1.0.0"
|
|
2175
|
-
},
|
|
2176
|
-
hostCapabilities: {
|
|
2177
|
-
openLinks: {},
|
|
2178
|
-
logging: {}
|
|
2179
|
-
},
|
|
2180
|
-
hostContext: {
|
|
2181
|
-
theme: "light",
|
|
2182
|
-
platform: "web"
|
|
2183
|
-
}
|
|
2184
|
-
});
|
|
2185
|
-
break;
|
|
2186
|
-
case "ui/message": {
|
|
2187
|
-
const currentAgent = agentRef.current;
|
|
2188
|
-
if (!currentAgent) {
|
|
2189
|
-
console.warn("[MCPAppsRenderer] ui/message: No agent available");
|
|
2190
|
-
sendResponse(msg.id, { isError: false });
|
|
2191
|
-
break;
|
|
2192
|
-
}
|
|
2193
|
-
try {
|
|
2194
|
-
const params = msg.params;
|
|
2195
|
-
const role = params.role || "user";
|
|
2196
|
-
const textContent = params.content?.filter((c) => c.type === "text" && c.text).map((c) => c.text).join("\n") || "";
|
|
2197
|
-
if (textContent) currentAgent.addMessage({
|
|
2198
|
-
id: crypto.randomUUID(),
|
|
2199
|
-
role,
|
|
2200
|
-
content: textContent
|
|
2201
|
-
});
|
|
2202
|
-
sendResponse(msg.id, { isError: false });
|
|
2203
|
-
if ((params.followUp ?? role === "user") && textContent) {
|
|
2204
|
-
const capturedThreadId = currentAgent.threadId || "default";
|
|
2205
|
-
mcpAppsRequestQueue.enqueue(currentAgent, () => ɵrunMcpFollowUp({
|
|
2206
|
-
host: copilotkit,
|
|
2207
|
-
agent: currentAgent,
|
|
2208
|
-
capturedThreadId
|
|
2209
|
-
})).catch((err) => console.error("[MCPAppsRenderer] ui/message agent run failed:", err));
|
|
2210
|
-
}
|
|
2211
|
-
} catch (err) {
|
|
2212
|
-
console.error("[MCPAppsRenderer] ui/message error:", err);
|
|
2213
|
-
sendResponse(msg.id, { isError: true });
|
|
2214
|
-
}
|
|
2215
|
-
break;
|
|
2216
|
-
}
|
|
2217
|
-
case "ui/open-link": {
|
|
2218
|
-
const url = msg.params?.url;
|
|
2219
|
-
if (url) {
|
|
2220
|
-
window.open(url, "_blank", "noopener,noreferrer");
|
|
2221
|
-
sendResponse(msg.id, { isError: false });
|
|
2222
|
-
} else sendErrorResponse(msg.id, -32602, "Missing url parameter");
|
|
2223
|
-
break;
|
|
2224
|
-
}
|
|
2225
|
-
case "tools/call": {
|
|
2226
|
-
const { serverHash, serverId } = contentRef.current;
|
|
2227
|
-
const currentAgent = agentRef.current;
|
|
2228
|
-
if (!serverHash) {
|
|
2229
|
-
sendErrorResponse(msg.id, -32603, "No server hash available for proxying");
|
|
2230
|
-
break;
|
|
2231
|
-
}
|
|
2232
|
-
if (!currentAgent) {
|
|
2233
|
-
sendErrorResponse(msg.id, -32603, "No agent available for proxying");
|
|
2234
|
-
break;
|
|
2235
|
-
}
|
|
2236
|
-
try {
|
|
2237
|
-
const runResult = await mcpAppsRequestQueue.enqueue(currentAgent, () => currentAgent.runAgent({ forwardedProps: { __proxiedMCPRequest: {
|
|
2238
|
-
serverHash,
|
|
2239
|
-
serverId,
|
|
2240
|
-
method: "tools/call",
|
|
2241
|
-
params: msg.params
|
|
2242
|
-
} } }));
|
|
2243
|
-
sendResponse(msg.id, runResult.result || {});
|
|
2244
|
-
} catch (err) {
|
|
2245
|
-
console.error("[MCPAppsRenderer] tools/call error:", err);
|
|
2246
|
-
sendErrorResponse(msg.id, -32603, String(err));
|
|
2247
|
-
}
|
|
2248
|
-
break;
|
|
2249
|
-
}
|
|
2250
|
-
default: sendErrorResponse(msg.id, -32601, `Method not found: ${msg.method}`);
|
|
2251
|
-
}
|
|
2252
|
-
if (isNotification(msg)) switch (msg.method) {
|
|
2253
|
-
case "ui/notifications/initialized":
|
|
2254
|
-
console.log("[MCPAppsRenderer] Inner iframe initialized");
|
|
2255
|
-
if (mounted) setIframeReady(true);
|
|
2256
|
-
break;
|
|
2257
|
-
case "ui/notifications/size-changed": {
|
|
2258
|
-
const { width, height } = msg.params || {};
|
|
2259
|
-
console.log("[MCPAppsRenderer] Size change:", {
|
|
2260
|
-
width,
|
|
2261
|
-
height
|
|
2262
|
-
});
|
|
2263
|
-
if (mounted) setIframeSize({
|
|
2264
|
-
width: typeof width === "number" ? width : void 0,
|
|
2265
|
-
height: typeof height === "number" ? height : void 0
|
|
2266
|
-
});
|
|
2267
|
-
break;
|
|
2268
|
-
}
|
|
2269
|
-
case "notifications/message":
|
|
2270
|
-
console.log("[MCPAppsRenderer] App log:", msg.params);
|
|
2271
|
-
break;
|
|
2272
|
-
}
|
|
2273
|
-
};
|
|
2274
|
-
window.addEventListener("message", messageHandler);
|
|
2134
|
+
const win = iframe.contentWindow;
|
|
2135
|
+
if (!win) throw new Error("Sandbox iframe has no contentWindow");
|
|
2275
2136
|
let html;
|
|
2276
2137
|
if (fetchedResource.text) html = fetchedResource.text;
|
|
2277
2138
|
else if (fetchedResource.blob) html = atob(fetchedResource.blob);
|
|
2278
2139
|
else throw new Error("Resource has no text or blob content");
|
|
2279
|
-
|
|
2140
|
+
bridge = new AppBridge(null, {
|
|
2141
|
+
name: "CopilotKit MCP Apps Host",
|
|
2142
|
+
version: "1.0.0"
|
|
2143
|
+
}, {
|
|
2144
|
+
openLinks: {},
|
|
2145
|
+
logging: {},
|
|
2146
|
+
message: { text: {} }
|
|
2147
|
+
}, { hostContext: {
|
|
2148
|
+
theme: "light",
|
|
2149
|
+
platform: "web"
|
|
2150
|
+
} });
|
|
2151
|
+
bridge.onsandboxready = () => {
|
|
2152
|
+
bridge?.sendSandboxResourceReady({ html });
|
|
2153
|
+
};
|
|
2154
|
+
bridge.setRequestHandler(CopilotKitUiMessageSchema, async (req) => {
|
|
2155
|
+
const currentAgent = agentRef.current;
|
|
2156
|
+
if (!currentAgent) {
|
|
2157
|
+
console.warn("[MCPAppsRenderer] ui/message: No agent available");
|
|
2158
|
+
return { isError: false };
|
|
2159
|
+
}
|
|
2160
|
+
try {
|
|
2161
|
+
const params = req.params;
|
|
2162
|
+
const ck = params._meta?.copilotkit ?? {};
|
|
2163
|
+
const role = ck.role || params.role || "user";
|
|
2164
|
+
const textContent = params.content?.filter((c) => c.type === "text" && c.text).map((c) => c.text).join("\n") || "";
|
|
2165
|
+
if (textContent) currentAgent.addMessage({
|
|
2166
|
+
id: crypto.randomUUID(),
|
|
2167
|
+
role,
|
|
2168
|
+
content: textContent
|
|
2169
|
+
});
|
|
2170
|
+
if ((ck.followUp ?? params.followUp ?? role === "user") && textContent) {
|
|
2171
|
+
const capturedThreadId = currentAgent.threadId || "default";
|
|
2172
|
+
mcpAppsRequestQueue.enqueue(currentAgent, () => ɵrunMcpFollowUp({
|
|
2173
|
+
host: copilotkit,
|
|
2174
|
+
agent: currentAgent,
|
|
2175
|
+
capturedThreadId
|
|
2176
|
+
})).catch((err) => console.error("[MCPAppsRenderer] ui/message agent run failed:", err));
|
|
2177
|
+
}
|
|
2178
|
+
return { isError: false };
|
|
2179
|
+
} catch (err) {
|
|
2180
|
+
console.error("[MCPAppsRenderer] ui/message error:", err);
|
|
2181
|
+
return { isError: true };
|
|
2182
|
+
}
|
|
2183
|
+
});
|
|
2184
|
+
bridge.onopenlink = async ({ url }) => {
|
|
2185
|
+
let parsed;
|
|
2186
|
+
try {
|
|
2187
|
+
parsed = new URL(url);
|
|
2188
|
+
} catch {
|
|
2189
|
+
console.warn("[MCPAppsRenderer] ui/open-link rejected: unparseable url");
|
|
2190
|
+
return { isError: true };
|
|
2191
|
+
}
|
|
2192
|
+
if (MCP_OPEN_LINK_BLOCKED_SCHEMES.has(parsed.protocol)) {
|
|
2193
|
+
console.warn("[MCPAppsRenderer] ui/open-link rejected: blocked scheme", parsed.protocol);
|
|
2194
|
+
return { isError: true };
|
|
2195
|
+
}
|
|
2196
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
2197
|
+
return { isError: false };
|
|
2198
|
+
};
|
|
2199
|
+
bridge.oncalltool = async (params) => {
|
|
2200
|
+
const { serverHash, serverId } = contentRef.current;
|
|
2201
|
+
const currentAgent = agentRef.current;
|
|
2202
|
+
if (!serverHash) throw new Error("No server hash available for proxying");
|
|
2203
|
+
if (!currentAgent) throw new Error("No agent available for proxying");
|
|
2204
|
+
return (await mcpAppsRequestQueue.enqueue(currentAgent, () => currentAgent.runAgent({ forwardedProps: { __proxiedMCPRequest: {
|
|
2205
|
+
serverHash,
|
|
2206
|
+
serverId,
|
|
2207
|
+
method: "tools/call",
|
|
2208
|
+
params
|
|
2209
|
+
} } }))).result || { content: [] };
|
|
2210
|
+
};
|
|
2211
|
+
bridge.onsizechange = (p) => {
|
|
2212
|
+
if (!mounted) return;
|
|
2213
|
+
const { width, height } = p || {};
|
|
2214
|
+
setIframeSize({
|
|
2215
|
+
width: typeof width === "number" ? width : void 0,
|
|
2216
|
+
height: typeof height === "number" ? height : void 0
|
|
2217
|
+
});
|
|
2218
|
+
};
|
|
2219
|
+
bridge.oninitialized = () => {
|
|
2220
|
+
if (mounted) setIframeReady(true);
|
|
2221
|
+
};
|
|
2222
|
+
bridge.onloggingmessage = (p) => {
|
|
2223
|
+
console.log("[MCPAppsRenderer] App log:", p);
|
|
2224
|
+
};
|
|
2225
|
+
const transport = new PostMessageTransport(win, win);
|
|
2226
|
+
await bridge.connect(transport);
|
|
2227
|
+
if (!mounted) {
|
|
2228
|
+
await bridge.close();
|
|
2229
|
+
return;
|
|
2230
|
+
}
|
|
2231
|
+
bridgeRef.current = bridge;
|
|
2280
2232
|
} catch (err) {
|
|
2281
2233
|
console.error("[MCPAppsRenderer] Setup error:", err);
|
|
2282
2234
|
if (mounted) setError(err instanceof Error ? err : new Error(String(err)));
|
|
@@ -2285,11 +2237,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2285
2237
|
setup();
|
|
2286
2238
|
return () => {
|
|
2287
2239
|
mounted = false;
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
initialListener = null;
|
|
2291
|
-
}
|
|
2292
|
-
if (messageHandler) window.removeEventListener("message", messageHandler);
|
|
2240
|
+
bridgeRef.current = null;
|
|
2241
|
+
bridge?.close();
|
|
2293
2242
|
if (createdIframe) {
|
|
2294
2243
|
createdIframe.remove();
|
|
2295
2244
|
createdIframe = null;
|
|
@@ -2299,9 +2248,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2299
2248
|
}, [
|
|
2300
2249
|
isLoading,
|
|
2301
2250
|
fetchedResource,
|
|
2302
|
-
|
|
2303
|
-
sendResponse,
|
|
2304
|
-
sendErrorResponse
|
|
2251
|
+
copilotkit
|
|
2305
2252
|
]);
|
|
2306
2253
|
(0, react.useEffect)(() => {
|
|
2307
2254
|
if (iframeRef.current) {
|
|
@@ -2313,25 +2260,11 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2313
2260
|
}
|
|
2314
2261
|
}, [iframeSize]);
|
|
2315
2262
|
(0, react.useEffect)(() => {
|
|
2316
|
-
if (iframeReady && content.toolInput) {
|
|
2317
|
-
|
|
2318
|
-
sendNotification("ui/notifications/tool-input", { arguments: content.toolInput });
|
|
2319
|
-
}
|
|
2320
|
-
}, [
|
|
2321
|
-
iframeReady,
|
|
2322
|
-
content.toolInput,
|
|
2323
|
-
sendNotification
|
|
2324
|
-
]);
|
|
2263
|
+
if (iframeReady && content.toolInput) bridgeRef.current?.sendToolInput({ arguments: content.toolInput });
|
|
2264
|
+
}, [iframeReady, content.toolInput]);
|
|
2325
2265
|
(0, react.useEffect)(() => {
|
|
2326
|
-
if (iframeReady && content.result)
|
|
2327
|
-
|
|
2328
|
-
sendNotification("ui/notifications/tool-result", content.result);
|
|
2329
|
-
}
|
|
2330
|
-
}, [
|
|
2331
|
-
iframeReady,
|
|
2332
|
-
content.result,
|
|
2333
|
-
sendNotification
|
|
2334
|
-
]);
|
|
2266
|
+
if (iframeReady && content.result) bridgeRef.current?.sendToolResult(content.result);
|
|
2267
|
+
}, [iframeReady, content.result]);
|
|
2335
2268
|
const borderStyle = fetchedResource?._meta?.ui?.prefersBorder === true ? {
|
|
2336
2269
|
borderRadius: "8px",
|
|
2337
2270
|
backgroundColor: "#f9f9f9",
|
|
@@ -4050,7 +3983,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4050
3983
|
tool.name,
|
|
4051
3984
|
tool.available,
|
|
4052
3985
|
copilotkit,
|
|
4053
|
-
JSON.stringify(extraDeps)
|
|
3986
|
+
JSON.stringify(extraDeps),
|
|
3987
|
+
JSON.stringify(tool.webmcp ?? null)
|
|
4054
3988
|
]);
|
|
4055
3989
|
}
|
|
4056
3990
|
|
|
@@ -5844,9 +5778,9 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5844
5778
|
* }
|
|
5845
5779
|
* ```
|
|
5846
5780
|
*
|
|
5847
|
-
* @deprecated
|
|
5848
|
-
*
|
|
5849
|
-
*
|
|
5781
|
+
* @deprecated This hook supports only the legacy plural-container annotation.
|
|
5782
|
+
* Configure `getLearningContainerId` on `CopilotKitIntelligence` for new
|
|
5783
|
+
* Intelligence runtimes.
|
|
5850
5784
|
*/
|
|
5851
5785
|
function useLearningContainers({ threadId, learningContainers }) {
|
|
5852
5786
|
const { copilotkit } = useCopilotKit();
|
|
@@ -5950,9 +5884,9 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5950
5884
|
* }
|
|
5951
5885
|
* ```
|
|
5952
5886
|
*
|
|
5953
|
-
* @deprecated
|
|
5954
|
-
*
|
|
5955
|
-
*
|
|
5887
|
+
* @deprecated This hook supports only the legacy plural-container annotation.
|
|
5888
|
+
* Configure `getLearningContainerId` on `CopilotKitIntelligence` for new
|
|
5889
|
+
* Intelligence runtimes.
|
|
5956
5890
|
*/
|
|
5957
5891
|
function useLearningContainersInCurrentThread({ learningContainers }) {
|
|
5958
5892
|
const threadId = useCopilotChatConfiguration()?.threadId;
|
|
@@ -10952,7 +10886,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
10952
10886
|
switch (error.code) {
|
|
10953
10887
|
case _copilotkit_shared.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR: return { primary: {
|
|
10954
10888
|
label: "Show me how",
|
|
10955
|
-
onClick: () => window.open("https://docs.copilotkit.ai/
|
|
10889
|
+
onClick: () => window.open("https://docs.copilotkit.ai/intelligence/overview#plans-and-access", "_blank", "noopener,noreferrer")
|
|
10956
10890
|
} };
|
|
10957
10891
|
case _copilotkit_shared.CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR: return { primary: {
|
|
10958
10892
|
label: "Upgrade",
|