@copilotkit/react-core 1.59.5-canary.1781104893 → 1.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{copilotkit-CWGR3Ict.cjs → copilotkit-BTHcCAVQ.cjs} +68 -103
- package/dist/copilotkit-BTHcCAVQ.cjs.map +1 -0
- package/dist/{copilotkit-CD3EqiJ4.d.cts → copilotkit-C9ptuh-b.d.cts} +9 -35
- package/dist/{copilotkit-B83H_vWJ.d.mts.map → copilotkit-C9ptuh-b.d.cts.map} +1 -1
- package/dist/{copilotkit-DBOofUYQ.mjs → copilotkit-CV519nFv.mjs} +69 -104
- package/dist/copilotkit-CV519nFv.mjs.map +1 -0
- package/dist/{copilotkit-B83H_vWJ.d.mts → copilotkit-DvbI8G0d.d.mts} +9 -35
- package/dist/{copilotkit-CD3EqiJ4.d.cts.map → copilotkit-DvbI8G0d.d.mts.map} +1 -1
- package/dist/index.cjs +5 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -6
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -9
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +39 -49
- package/dist/index.umd.js.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 +67 -102
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +6 -6
- package/skills/react-core/SKILL.md +5 -5
- package/skills/react-core/references/chat-components.md +2 -1
- package/skills/react-core/references/client-side-tools.md +1 -1
- package/skills/react-core/references/custom-message-renderers.md +8 -11
- package/skills/react-core/references/debug-mode.md +15 -15
- package/skills/react-core/references/provider-setup.md +45 -52
- package/skills/react-core/references/rendering-activity-messages.md +6 -12
- package/dist/copilotkit-CWGR3Ict.cjs.map +0 -1
- package/dist/copilotkit-DBOofUYQ.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-BTHcCAVQ.cjs');
|
|
5
5
|
require("./index.css");
|
|
6
6
|
let _copilotkit_a2ui_renderer = require("@copilotkit/a2ui-renderer");
|
|
7
7
|
|
package/dist/v2/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as InterruptEvent, $t as CopilotChatSuggestionPill, A as UseLearnFromUserActionRecorder, At as CopilotSidebarViewProps, B as AgentContextInput, Bt as CopilotChatViewProps, C as UseAttachmentsReturn, Ct as CopilotPopup, D as useLearnFromUserActionInCurrentThread, Dt as CopilotPopupView, E as UseLearnFromUserActionInCurrentThreadRecorder, Et as CopilotSidebarProps, F as useThreads, Ft as DefaultCloseIcon, G as useAgent, Gt as IntelligenceIndicator, H as useAgentContext, Ht as CopilotChatMessageView, I as UseInterruptConfig, It as DefaultOpenIcon, J as useRenderTool, Jt as IntelligenceIndicatorStatus, K as useHumanInTheLoop, Kt as IntelligenceIndicatorProps, L as useInterrupt, Lt as CopilotChat, M as Thread, Mt as CopilotModalHeaderProps, N as UseThreadsInput, Nt as CopilotChatToggleButton, O as LearnFromUserActionInput, Ot as CopilotPopupViewProps, P as UseThreadsResult, Pt as CopilotChatToggleButtonProps, Q as SandboxFunction, Qt as CopilotChatSuggestionViewProps, R as useConfigureSuggestions, Rt as CopilotChatProps, S as UseAttachmentsProps, St as CopilotChatAttachmentQueue, T as LearnFromUserActionInCurrentThreadInput, Tt as CopilotSidebar, U as useCapabilities, Ut as CopilotChatMessageViewProps, V as JsonSerializable, Vt as AutoScrollMode, W as UseAgentUpdate, Wt as INTELLIGENCE_TURN_HEAD, X as useFrontendTool, Xt as IntelligenceIndicatorViewProps, Y as useComponent, Yt as IntelligenceIndicatorView, Z as useRenderActivityMessage, Zt as CopilotChatSuggestionView, _ as CopilotKitCoreReactSubscriber, _n as AudioRecorderError, _t as WildcardToolCallRender, a as A2UIUserAction, an as CopilotChatAssistantMessage, at as ReactActivityMessageRenderer, b as UseLearningContainersArgs, bt as AttachmentsConfig, c as SandboxFunctionsContext, cn as CopilotChatToolCallsViewProps, ct as ReactCustomMessageRenderer, d as CopilotKitProviderProps, dn as ToolsMenuItem, dt as MCPAppsActivityContent, en as CopilotChatSuggestionPillProps, et as InterruptHandlerProps, f as A2UIRecoveryRendererOptions, fn as CopilotChatConfigurationProvider, ft as MCPAppsActivityContentSchema, g as CopilotKitCoreReactConfig, gn as useCopilotChatConfiguration, gt as CopilotKitInspectorProps, h as CopilotKitCoreReact, hn as CopilotChatLabels, ht as CopilotKitInspector, i as A2UIMessageRendererOptions, in as CopilotChatUserMessageProps, it as ReactFrontendTool, j as useLearnFromUserAction, jt as CopilotModalHeader, k as LearnFromUserActionResult, kt as CopilotSidebarView, l as useSandboxFunctions, ln as CopilotChatInput, lt as ReactCustomMessageRendererPosition, m as useCopilotKit, mn as CopilotChatConfigurationValue, mt as MCPAppsActivityType, nn as CopilotChatReasoningMessageProps, nt as defineToolCallRenderer, o as createA2UIMessageRenderer, on as CopilotChatAssistantMessageProps, ot as ReactToolCallRenderer, p as CopilotKitContextValue, pn as CopilotChatConfigurationProviderProps, pt as MCPAppsActivityRenderer, q as useDefaultRenderTool, qt as getIntelligenceTurnAnchors, r as CopilotKitProps, rn as CopilotChatUserMessage, rt as ReactHumanInTheLoop, s as InspectorAnchor, sn as CopilotChatToolCallsView, st as useRenderCustomMessages, t as CopilotKit, tn as CopilotChatReasoningMessage, tt as InterruptRenderProps, u as CopilotKitProvider, un as CopilotChatInputProps, ut as useRenderToolCall, v as UseLearningContainersInCurrentThreadArgs, vn as AudioRecorderState, vt as Attachment, w as useAttachments, wt as CopilotPopupProps, x as useLearningContainers, xt as CopilotChatAttachmentRenderer, y as useLearningContainersInCurrentThread, yn as CopilotChatAudioRecorder, yt as AttachmentModality, z as useSuggestions, zt as CopilotChatView } from "../copilotkit-
|
|
1
|
+
import { $ as InterruptEvent, $t as CopilotChatSuggestionPill, A as UseLearnFromUserActionRecorder, At as CopilotSidebarViewProps, B as AgentContextInput, Bt as CopilotChatViewProps, C as UseAttachmentsReturn, Ct as CopilotPopup, D as useLearnFromUserActionInCurrentThread, Dt as CopilotPopupView, E as UseLearnFromUserActionInCurrentThreadRecorder, Et as CopilotSidebarProps, F as useThreads, Ft as DefaultCloseIcon, G as useAgent, Gt as IntelligenceIndicator, H as useAgentContext, Ht as CopilotChatMessageView, I as UseInterruptConfig, It as DefaultOpenIcon, J as useRenderTool, Jt as IntelligenceIndicatorStatus, K as useHumanInTheLoop, Kt as IntelligenceIndicatorProps, L as useInterrupt, Lt as CopilotChat, M as Thread, Mt as CopilotModalHeaderProps, N as UseThreadsInput, Nt as CopilotChatToggleButton, O as LearnFromUserActionInput, Ot as CopilotPopupViewProps, P as UseThreadsResult, Pt as CopilotChatToggleButtonProps, Q as SandboxFunction, Qt as CopilotChatSuggestionViewProps, R as useConfigureSuggestions, Rt as CopilotChatProps, S as UseAttachmentsProps, St as CopilotChatAttachmentQueue, T as LearnFromUserActionInCurrentThreadInput, Tt as CopilotSidebar, U as useCapabilities, Ut as CopilotChatMessageViewProps, V as JsonSerializable, Vt as AutoScrollMode, W as UseAgentUpdate, Wt as INTELLIGENCE_TURN_HEAD, X as useFrontendTool, Xt as IntelligenceIndicatorViewProps, Y as useComponent, Yt as IntelligenceIndicatorView, Z as useRenderActivityMessage, Zt as CopilotChatSuggestionView, _ as CopilotKitCoreReactSubscriber, _n as AudioRecorderError, _t as WildcardToolCallRender, a as A2UIUserAction, an as CopilotChatAssistantMessage, at as ReactActivityMessageRenderer, b as UseLearningContainersArgs, bt as AttachmentsConfig, c as SandboxFunctionsContext, cn as CopilotChatToolCallsViewProps, ct as ReactCustomMessageRenderer, d as CopilotKitProviderProps, dn as ToolsMenuItem, dt as MCPAppsActivityContent, en as CopilotChatSuggestionPillProps, et as InterruptHandlerProps, f as A2UIRecoveryRendererOptions, fn as CopilotChatConfigurationProvider, ft as MCPAppsActivityContentSchema, g as CopilotKitCoreReactConfig, gn as useCopilotChatConfiguration, gt as CopilotKitInspectorProps, h as CopilotKitCoreReact, hn as CopilotChatLabels, ht as CopilotKitInspector, i as A2UIMessageRendererOptions, in as CopilotChatUserMessageProps, it as ReactFrontendTool, j as useLearnFromUserAction, jt as CopilotModalHeader, k as LearnFromUserActionResult, kt as CopilotSidebarView, l as useSandboxFunctions, ln as CopilotChatInput, lt as ReactCustomMessageRendererPosition, m as useCopilotKit, mn as CopilotChatConfigurationValue, mt as MCPAppsActivityType, nn as CopilotChatReasoningMessageProps, nt as defineToolCallRenderer, o as createA2UIMessageRenderer, on as CopilotChatAssistantMessageProps, ot as ReactToolCallRenderer, p as CopilotKitContextValue, pn as CopilotChatConfigurationProviderProps, pt as MCPAppsActivityRenderer, q as useDefaultRenderTool, qt as getIntelligenceTurnAnchors, r as CopilotKitProps, rn as CopilotChatUserMessage, rt as ReactHumanInTheLoop, s as InspectorAnchor, sn as CopilotChatToolCallsView, st as useRenderCustomMessages, t as CopilotKit, tn as CopilotChatReasoningMessage, tt as InterruptRenderProps, u as CopilotKitProvider, un as CopilotChatInputProps, ut as useRenderToolCall, v as UseLearningContainersInCurrentThreadArgs, vn as AudioRecorderState, vt as Attachment, w as useAttachments, wt as CopilotPopupProps, x as useLearningContainers, xt as CopilotChatAttachmentRenderer, y as useLearningContainersInCurrentThread, yn as CopilotChatAudioRecorder, yt as AttachmentModality, z as useSuggestions, zt as CopilotChatView } from "../copilotkit-C9ptuh-b.cjs";
|
|
2
2
|
import "./index.css";
|
|
3
3
|
import { Theme as A2UITheme, defaultTheme as a2uiDefaultTheme } from "@copilotkit/a2ui-renderer";
|
|
4
4
|
export * from "@copilotkit/core";
|
package/dist/v2/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as InterruptEvent, $t as CopilotChatSuggestionPill, A as UseLearnFromUserActionRecorder, At as CopilotSidebarViewProps, B as AgentContextInput, Bt as CopilotChatViewProps, C as UseAttachmentsReturn, Ct as CopilotPopup, D as useLearnFromUserActionInCurrentThread, Dt as CopilotPopupView, E as UseLearnFromUserActionInCurrentThreadRecorder, Et as CopilotSidebarProps, F as useThreads, Ft as DefaultCloseIcon, G as useAgent, Gt as IntelligenceIndicator, H as useAgentContext, Ht as CopilotChatMessageView, I as UseInterruptConfig, It as DefaultOpenIcon, J as useRenderTool, Jt as IntelligenceIndicatorStatus, K as useHumanInTheLoop, Kt as IntelligenceIndicatorProps, L as useInterrupt, Lt as CopilotChat, M as Thread, Mt as CopilotModalHeaderProps, N as UseThreadsInput, Nt as CopilotChatToggleButton, O as LearnFromUserActionInput, Ot as CopilotPopupViewProps, P as UseThreadsResult, Pt as CopilotChatToggleButtonProps, Q as SandboxFunction, Qt as CopilotChatSuggestionViewProps, R as useConfigureSuggestions, Rt as CopilotChatProps, S as UseAttachmentsProps, St as CopilotChatAttachmentQueue, T as LearnFromUserActionInCurrentThreadInput, Tt as CopilotSidebar, U as useCapabilities, Ut as CopilotChatMessageViewProps, V as JsonSerializable, Vt as AutoScrollMode, W as UseAgentUpdate, Wt as INTELLIGENCE_TURN_HEAD, X as useFrontendTool, Xt as IntelligenceIndicatorViewProps, Y as useComponent, Yt as IntelligenceIndicatorView, Z as useRenderActivityMessage, Zt as CopilotChatSuggestionView, _ as CopilotKitCoreReactSubscriber, _n as AudioRecorderError, _t as WildcardToolCallRender, a as A2UIUserAction, an as CopilotChatAssistantMessage, at as ReactActivityMessageRenderer, b as UseLearningContainersArgs, bt as AttachmentsConfig, c as SandboxFunctionsContext, cn as CopilotChatToolCallsViewProps, ct as ReactCustomMessageRenderer, d as CopilotKitProviderProps, dn as ToolsMenuItem, dt as MCPAppsActivityContent, en as CopilotChatSuggestionPillProps, et as InterruptHandlerProps, f as A2UIRecoveryRendererOptions, fn as CopilotChatConfigurationProvider, ft as MCPAppsActivityContentSchema, g as CopilotKitCoreReactConfig, gn as useCopilotChatConfiguration, gt as CopilotKitInspectorProps, h as CopilotKitCoreReact, hn as CopilotChatLabels, ht as CopilotKitInspector, i as A2UIMessageRendererOptions, in as CopilotChatUserMessageProps, it as ReactFrontendTool, j as useLearnFromUserAction, jt as CopilotModalHeader, k as LearnFromUserActionResult, kt as CopilotSidebarView, l as useSandboxFunctions, ln as CopilotChatInput, lt as ReactCustomMessageRendererPosition, m as useCopilotKit, mn as CopilotChatConfigurationValue, mt as MCPAppsActivityType, nn as CopilotChatReasoningMessageProps, nt as defineToolCallRenderer, o as createA2UIMessageRenderer, on as CopilotChatAssistantMessageProps, ot as ReactToolCallRenderer, p as CopilotKitContextValue, pn as CopilotChatConfigurationProviderProps, pt as MCPAppsActivityRenderer, q as useDefaultRenderTool, qt as getIntelligenceTurnAnchors, r as CopilotKitProps, rn as CopilotChatUserMessage, rt as ReactHumanInTheLoop, s as InspectorAnchor, sn as CopilotChatToolCallsView, st as useRenderCustomMessages, t as CopilotKit, tn as CopilotChatReasoningMessage, tt as InterruptRenderProps, u as CopilotKitProvider, un as CopilotChatInputProps, ut as useRenderToolCall, v as UseLearningContainersInCurrentThreadArgs, vn as AudioRecorderState, vt as Attachment, w as useAttachments, wt as CopilotPopupProps, x as useLearningContainers, xt as CopilotChatAttachmentRenderer, y as useLearningContainersInCurrentThread, yn as CopilotChatAudioRecorder, yt as AttachmentModality, z as useSuggestions, zt as CopilotChatView } from "../copilotkit-
|
|
1
|
+
import { $ as InterruptEvent, $t as CopilotChatSuggestionPill, A as UseLearnFromUserActionRecorder, At as CopilotSidebarViewProps, B as AgentContextInput, Bt as CopilotChatViewProps, C as UseAttachmentsReturn, Ct as CopilotPopup, D as useLearnFromUserActionInCurrentThread, Dt as CopilotPopupView, E as UseLearnFromUserActionInCurrentThreadRecorder, Et as CopilotSidebarProps, F as useThreads, Ft as DefaultCloseIcon, G as useAgent, Gt as IntelligenceIndicator, H as useAgentContext, Ht as CopilotChatMessageView, I as UseInterruptConfig, It as DefaultOpenIcon, J as useRenderTool, Jt as IntelligenceIndicatorStatus, K as useHumanInTheLoop, Kt as IntelligenceIndicatorProps, L as useInterrupt, Lt as CopilotChat, M as Thread, Mt as CopilotModalHeaderProps, N as UseThreadsInput, Nt as CopilotChatToggleButton, O as LearnFromUserActionInput, Ot as CopilotPopupViewProps, P as UseThreadsResult, Pt as CopilotChatToggleButtonProps, Q as SandboxFunction, Qt as CopilotChatSuggestionViewProps, R as useConfigureSuggestions, Rt as CopilotChatProps, S as UseAttachmentsProps, St as CopilotChatAttachmentQueue, T as LearnFromUserActionInCurrentThreadInput, Tt as CopilotSidebar, U as useCapabilities, Ut as CopilotChatMessageViewProps, V as JsonSerializable, Vt as AutoScrollMode, W as UseAgentUpdate, Wt as INTELLIGENCE_TURN_HEAD, X as useFrontendTool, Xt as IntelligenceIndicatorViewProps, Y as useComponent, Yt as IntelligenceIndicatorView, Z as useRenderActivityMessage, Zt as CopilotChatSuggestionView, _ as CopilotKitCoreReactSubscriber, _n as AudioRecorderError, _t as WildcardToolCallRender, a as A2UIUserAction, an as CopilotChatAssistantMessage, at as ReactActivityMessageRenderer, b as UseLearningContainersArgs, bt as AttachmentsConfig, c as SandboxFunctionsContext, cn as CopilotChatToolCallsViewProps, ct as ReactCustomMessageRenderer, d as CopilotKitProviderProps, dn as ToolsMenuItem, dt as MCPAppsActivityContent, en as CopilotChatSuggestionPillProps, et as InterruptHandlerProps, f as A2UIRecoveryRendererOptions, fn as CopilotChatConfigurationProvider, ft as MCPAppsActivityContentSchema, g as CopilotKitCoreReactConfig, gn as useCopilotChatConfiguration, gt as CopilotKitInspectorProps, h as CopilotKitCoreReact, hn as CopilotChatLabels, ht as CopilotKitInspector, i as A2UIMessageRendererOptions, in as CopilotChatUserMessageProps, it as ReactFrontendTool, j as useLearnFromUserAction, jt as CopilotModalHeader, k as LearnFromUserActionResult, kt as CopilotSidebarView, l as useSandboxFunctions, ln as CopilotChatInput, lt as ReactCustomMessageRendererPosition, m as useCopilotKit, mn as CopilotChatConfigurationValue, mt as MCPAppsActivityType, nn as CopilotChatReasoningMessageProps, nt as defineToolCallRenderer, o as createA2UIMessageRenderer, on as CopilotChatAssistantMessageProps, ot as ReactToolCallRenderer, p as CopilotKitContextValue, pn as CopilotChatConfigurationProviderProps, pt as MCPAppsActivityRenderer, q as useDefaultRenderTool, qt as getIntelligenceTurnAnchors, r as CopilotKitProps, rn as CopilotChatUserMessage, rt as ReactHumanInTheLoop, s as InspectorAnchor, sn as CopilotChatToolCallsView, st as useRenderCustomMessages, t as CopilotKit, tn as CopilotChatReasoningMessage, tt as InterruptRenderProps, u as CopilotKitProvider, un as CopilotChatInputProps, ut as useRenderToolCall, v as UseLearningContainersInCurrentThreadArgs, vn as AudioRecorderState, vt as Attachment, w as useAttachments, wt as CopilotPopupProps, x as useLearningContainers, xt as CopilotChatAttachmentRenderer, y as useLearningContainersInCurrentThread, yn as CopilotChatAudioRecorder, yt as AttachmentModality, z as useSuggestions, zt as CopilotChatView } from "../copilotkit-DvbI8G0d.mjs";
|
|
2
2
|
import "./index.css";
|
|
3
3
|
import { Theme as A2UITheme, defaultTheme as a2uiDefaultTheme } from "@copilotkit/a2ui-renderer";
|
|
4
4
|
export * from "@copilotkit/core";
|
package/dist/v2/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { $ as
|
|
3
|
+
import { $ as useAgent, A as INTELLIGENCE_TURN_HEAD, B as CopilotChatToolCallsView, C as CopilotChatToggleButton, Ct as useCopilotChatConfiguration, D as CopilotChatView_default, E as CopilotChat, F as CopilotChatSuggestionPill, G as useLearnFromUserAction, H as useLearningContainers, I as CopilotChatReasoningMessage_default, J as useConfigureSuggestions, K as useThreads, L as CopilotChatUserMessage_default, M as getIntelligenceTurnAnchors, N as IntelligenceIndicatorView, O as CopilotChatAttachmentQueue, P as CopilotChatSuggestionView, Q as UseAgentUpdate, R as CopilotChatAttachmentRenderer, S as CopilotModalHeader, St as CopilotChatConfigurationProvider, T as DefaultOpenIcon, U as useAttachments, V as useLearningContainersInCurrentThread, W as useLearnFromUserActionInCurrentThread, X as useAgentContext, Y as useSuggestions, Z as useCapabilities, _ as WildcardToolCallRender, _t as useCopilotKit, at as CopilotKitProvider, b as CopilotPopupView, bt as AudioRecorderError, ct as useSandboxFunctions, dt as MCPAppsActivityType, et as useHumanInTheLoop, ft as CopilotKitInspector, gt as defineToolCallRenderer, ht as useRenderTool, it as useRenderCustomMessages, j as IntelligenceIndicator, k as CopilotChatMessageView, lt as MCPAppsActivityContentSchema, mt as useDefaultRenderTool, nt as useFrontendTool, ot as createA2UIMessageRenderer, pt as useRenderToolCall, q as useInterrupt, rt as useRenderActivityMessage, st as SandboxFunctionsContext, t as CopilotKit, tt as useComponent, ut as MCPAppsActivityRenderer, v as CopilotPopup, vt as CopilotKitCoreReact, w as DefaultCloseIcon, x as CopilotSidebarView, xt as CopilotChatAudioRecorder, y as CopilotSidebar, yt as CopilotChatInput_default, z as CopilotChatAssistantMessage_default } from "../copilotkit-CV519nFv.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
|
@@ -3579,67 +3579,61 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3579
3579
|
return null;
|
|
3580
3580
|
}
|
|
3581
3581
|
|
|
3582
|
-
//#endregion
|
|
3583
|
-
//#region src/v2/hooks/use-agent-context.tsx
|
|
3584
|
-
function useAgentContext(context) {
|
|
3585
|
-
const { description, value } = context;
|
|
3586
|
-
const { copilotkit } = useCopilotKit();
|
|
3587
|
-
const stringValue = (0, react.useMemo)(() => {
|
|
3588
|
-
if (typeof value === "string") return value;
|
|
3589
|
-
return JSON.stringify(value);
|
|
3590
|
-
}, [value]);
|
|
3591
|
-
(0, react.useLayoutEffect)(() => {
|
|
3592
|
-
if (!copilotkit) return;
|
|
3593
|
-
const id = copilotkit.addContext({
|
|
3594
|
-
description,
|
|
3595
|
-
value: stringValue
|
|
3596
|
-
});
|
|
3597
|
-
return () => {
|
|
3598
|
-
copilotkit.removeContext(id);
|
|
3599
|
-
};
|
|
3600
|
-
}, [
|
|
3601
|
-
description,
|
|
3602
|
-
stringValue,
|
|
3603
|
-
copilotkit
|
|
3604
|
-
]);
|
|
3605
|
-
}
|
|
3606
|
-
|
|
3607
3582
|
//#endregion
|
|
3608
3583
|
//#region src/v2/a2ui/A2UICatalogContext.tsx
|
|
3609
3584
|
/**
|
|
3610
3585
|
* Renders agent context describing the available A2UI catalog and custom components.
|
|
3611
3586
|
* Only mount this component when A2UI is enabled.
|
|
3612
3587
|
*
|
|
3588
|
+
* The entries are scoped to the agents the runtime applies A2UI to
|
|
3589
|
+
* (`copilotkit.a2uiAgents`, #5369), so agents outside that list don't receive
|
|
3590
|
+
* the catalog/schema/guidelines payload on their runs.
|
|
3591
|
+
*
|
|
3613
3592
|
* When `includeSchema` is true, the full component schemas (JSON Schema) are also
|
|
3614
3593
|
* sent as context using the same description key as the A2UI middleware, so the
|
|
3615
3594
|
* middleware can optionally overwrite it with a server-side schema.
|
|
3616
3595
|
*/
|
|
3617
3596
|
function A2UICatalogContext({ catalog, includeSchema }) {
|
|
3618
|
-
useAgentContext({
|
|
3619
|
-
description: "A2UI catalog capabilities: available catalog IDs and custom component definitions the client can render.",
|
|
3620
|
-
value: (0, _copilotkit_a2ui_renderer.buildCatalogContextValue)(catalog)
|
|
3621
|
-
});
|
|
3622
3597
|
const { copilotkit } = useCopilotKit();
|
|
3598
|
+
const capabilitiesValue = (0, react.useMemo)(() => (0, _copilotkit_a2ui_renderer.buildCatalogContextValue)(catalog), [catalog]);
|
|
3623
3599
|
const schemaValue = (0, react.useMemo)(() => includeSchema !== false ? JSON.stringify((0, _copilotkit_a2ui_renderer.extractCatalogComponentSchemas)(catalog)) : null, [catalog, includeSchema]);
|
|
3600
|
+
const a2uiAgentsKey = copilotkit?.a2uiAgents?.join(",");
|
|
3624
3601
|
(0, react.useLayoutEffect)(() => {
|
|
3625
|
-
if (!copilotkit
|
|
3602
|
+
if (!copilotkit) return;
|
|
3603
|
+
const agentIds = copilotkit.a2uiAgents;
|
|
3604
|
+
const scope = agentIds ? { agentIds } : {};
|
|
3626
3605
|
const ids = [];
|
|
3627
3606
|
ids.push(copilotkit.addContext({
|
|
3628
|
-
description:
|
|
3629
|
-
value:
|
|
3630
|
-
|
|
3631
|
-
ids.push(copilotkit.addContext({
|
|
3632
|
-
description: "A2UI generation guidelines — protocol rules, tool arguments, path rules, data model format, and form/two-way-binding instructions.",
|
|
3633
|
-
value: _copilotkit_shared.A2UI_DEFAULT_GENERATION_GUIDELINES
|
|
3634
|
-
}));
|
|
3635
|
-
ids.push(copilotkit.addContext({
|
|
3636
|
-
description: "A2UI design guidelines — visual design rules, component hierarchy tips, and action handler patterns.",
|
|
3637
|
-
value: _copilotkit_shared.A2UI_DEFAULT_DESIGN_GUIDELINES
|
|
3607
|
+
description: "A2UI catalog capabilities: available catalog IDs and custom component definitions the client can render.",
|
|
3608
|
+
value: capabilitiesValue,
|
|
3609
|
+
...scope
|
|
3638
3610
|
}));
|
|
3611
|
+
if (schemaValue) {
|
|
3612
|
+
ids.push(copilotkit.addContext({
|
|
3613
|
+
description: _copilotkit_a2ui_renderer.A2UI_SCHEMA_CONTEXT_DESCRIPTION,
|
|
3614
|
+
value: schemaValue,
|
|
3615
|
+
...scope
|
|
3616
|
+
}));
|
|
3617
|
+
ids.push(copilotkit.addContext({
|
|
3618
|
+
description: "A2UI generation guidelines — protocol rules, tool arguments, path rules, data model format, and form/two-way-binding instructions.",
|
|
3619
|
+
value: _copilotkit_shared.A2UI_DEFAULT_GENERATION_GUIDELINES,
|
|
3620
|
+
...scope
|
|
3621
|
+
}));
|
|
3622
|
+
ids.push(copilotkit.addContext({
|
|
3623
|
+
description: "A2UI design guidelines — visual design rules, component hierarchy tips, and action handler patterns.",
|
|
3624
|
+
value: _copilotkit_shared.A2UI_DEFAULT_DESIGN_GUIDELINES,
|
|
3625
|
+
...scope
|
|
3626
|
+
}));
|
|
3627
|
+
}
|
|
3639
3628
|
return () => {
|
|
3640
3629
|
for (const id of ids) copilotkit.removeContext(id);
|
|
3641
3630
|
};
|
|
3642
|
-
}, [
|
|
3631
|
+
}, [
|
|
3632
|
+
copilotkit,
|
|
3633
|
+
capabilitiesValue,
|
|
3634
|
+
schemaValue,
|
|
3635
|
+
a2uiAgentsKey
|
|
3636
|
+
]);
|
|
3643
3637
|
return null;
|
|
3644
3638
|
}
|
|
3645
3639
|
|
|
@@ -4392,6 +4386,31 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4392
4386
|
if (agent && "capabilities" in agent) return agent.capabilities;
|
|
4393
4387
|
}
|
|
4394
4388
|
|
|
4389
|
+
//#endregion
|
|
4390
|
+
//#region src/v2/hooks/use-agent-context.tsx
|
|
4391
|
+
function useAgentContext(context) {
|
|
4392
|
+
const { description, value } = context;
|
|
4393
|
+
const { copilotkit } = useCopilotKit();
|
|
4394
|
+
const stringValue = (0, react.useMemo)(() => {
|
|
4395
|
+
if (typeof value === "string") return value;
|
|
4396
|
+
return JSON.stringify(value);
|
|
4397
|
+
}, [value]);
|
|
4398
|
+
(0, react.useLayoutEffect)(() => {
|
|
4399
|
+
if (!copilotkit) return;
|
|
4400
|
+
const id = copilotkit.addContext({
|
|
4401
|
+
description,
|
|
4402
|
+
value: stringValue
|
|
4403
|
+
});
|
|
4404
|
+
return () => {
|
|
4405
|
+
copilotkit.removeContext(id);
|
|
4406
|
+
};
|
|
4407
|
+
}, [
|
|
4408
|
+
description,
|
|
4409
|
+
stringValue,
|
|
4410
|
+
copilotkit
|
|
4411
|
+
]);
|
|
4412
|
+
}
|
|
4413
|
+
|
|
4395
4414
|
//#endregion
|
|
4396
4415
|
//#region src/v2/hooks/use-suggestions.tsx
|
|
4397
4416
|
function useSuggestions({ agentId } = {}) {
|
|
@@ -6463,58 +6482,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6463
6482
|
//#endregion
|
|
6464
6483
|
//#region src/v2/components/chat/CopilotChatMessageView.tsx
|
|
6465
6484
|
/**
|
|
6466
|
-
* Builds a map of message.id → stable per-row React key for an entire message
|
|
6467
|
-
* list. A message's canonical `id` is not stable within a turn: some backends
|
|
6468
|
-
* re-key a message mid-stream (e.g. LangChain replaces its transient
|
|
6469
|
-
* `lc_run--…` streaming id with the provider's final `resp_…` id in the
|
|
6470
|
-
* MESSAGES_SNAPSHOT). Keying rows by `id` made React unmount/remount the row
|
|
6471
|
-
* on that swap — the visible HITL chat flash. Tool-call ids survive the
|
|
6472
|
-
* rename, so an assistant message anchored by a tool call is keyed by its
|
|
6473
|
-
* first tool-call id (`tc:<anchorToolCallId>`); everything else falls back to
|
|
6474
|
-
* `id`.
|
|
6475
|
-
*
|
|
6476
|
-
* Load-bearing assumption: this only helps when the first tool-call id itself
|
|
6477
|
-
* is stable across the rename; backends that re-key tool-call ids mid-stream
|
|
6478
|
-
* still remount.
|
|
6479
|
-
*
|
|
6480
|
-
* Collision rule: two distinct assistant messages can occasionally share a
|
|
6481
|
-
* first-tool-call id (e.g. due to upstream bugs or replayed state). First
|
|
6482
|
-
* occurrence (in list order) claims `tc:<id>`; later collisions fall back to
|
|
6483
|
-
* `message.id`. Every assigned key is checked against the claimed set, so
|
|
6484
|
-
* keys are unique even for pathological ids (e.g. a raw message id beginning
|
|
6485
|
-
* with "tc:"); collisions disambiguate with a deterministic numeric suffix.
|
|
6486
|
-
*
|
|
6487
|
-
* Precondition: callers must pass a deduplicated list (see
|
|
6488
|
-
* `deduplicateMessages`); duplicate message ids would silently overwrite map
|
|
6489
|
-
* entries.
|
|
6490
|
-
*
|
|
6491
|
-
* Order caveat: the collision rule is order-sensitive — if two messages
|
|
6492
|
-
* sharing a first tool-call id swap list positions across renders, the
|
|
6493
|
-
* claimant changes and both rows remount. Acceptable: that situation already
|
|
6494
|
-
* indicates an upstream id bug, and keys remain unique.
|
|
6495
|
-
*/
|
|
6496
|
-
function buildRowRenderKeys(messages) {
|
|
6497
|
-
const keys = /* @__PURE__ */ new Map();
|
|
6498
|
-
const claimed = /* @__PURE__ */ new Set();
|
|
6499
|
-
for (const message of messages) {
|
|
6500
|
-
let candidate;
|
|
6501
|
-
if (message.role === "assistant") {
|
|
6502
|
-
const anchorToolCallId = message.toolCalls?.[0]?.id;
|
|
6503
|
-
if (anchorToolCallId) candidate = `tc:${anchorToolCallId}`;
|
|
6504
|
-
}
|
|
6505
|
-
let assigned = message.id;
|
|
6506
|
-
if (candidate && !claimed.has(candidate)) assigned = candidate;
|
|
6507
|
-
else if (claimed.has(assigned)) {
|
|
6508
|
-
let n = 2;
|
|
6509
|
-
while (claimed.has(`${assigned}:${n}`)) n += 1;
|
|
6510
|
-
assigned = `${assigned}:${n}`;
|
|
6511
|
-
}
|
|
6512
|
-
keys.set(message.id, assigned);
|
|
6513
|
-
claimed.add(assigned);
|
|
6514
|
-
}
|
|
6515
|
-
return keys;
|
|
6516
|
-
}
|
|
6517
|
-
/**
|
|
6518
6485
|
* Resolves a slot value into a { Component, slotProps } pair, handling the three
|
|
6519
6486
|
* slot forms: a component type, a className string, or a partial-props object.
|
|
6520
6487
|
*/
|
|
@@ -6693,7 +6660,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6693
6660
|
return copilotkit.getStateByRun(config.agentId, config.threadId, resolvedRunId);
|
|
6694
6661
|
};
|
|
6695
6662
|
const deduplicatedMessages = (0, react.useMemo)(() => deduplicateMessages(messages), [messages]);
|
|
6696
|
-
const rowRenderKeys = (0, react.useMemo)(() => buildRowRenderKeys(deduplicatedMessages), [deduplicatedMessages]);
|
|
6697
6663
|
if (process.env.NODE_ENV === "development" && deduplicatedMessages.length < messages.length) console.warn(`CopilotChatMessageView: Merged ${messages.length - deduplicatedMessages.length} message(s) with duplicate IDs.`);
|
|
6698
6664
|
const { Component: AssistantComponent, slotProps: assistantSlotProps } = (0, react.useMemo)(() => resolveSlotComponent(assistantMessage, CopilotChatAssistantMessage_default), [assistantMessage]);
|
|
6699
6665
|
const { Component: UserComponent, slotProps: userSlotProps } = (0, react.useMemo)(() => resolveSlotComponent(userMessage, CopilotChatUserMessage_default), [userMessage]);
|
|
@@ -6724,42 +6690,41 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6724
6690
|
const renderMessageBlock = (message) => {
|
|
6725
6691
|
const elements = [];
|
|
6726
6692
|
const stateSnapshot = getStateSnapshotForMessage(message.id);
|
|
6727
|
-
const rowKey = rowRenderKeys.get(message.id) ?? message.id;
|
|
6728
6693
|
if (renderCustomMessage) elements.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemoizedCustomMessage, {
|
|
6729
6694
|
message,
|
|
6730
6695
|
position: "before",
|
|
6731
6696
|
renderCustomMessage,
|
|
6732
6697
|
stateSnapshot
|
|
6733
|
-
}, `${
|
|
6698
|
+
}, `${message.id}-custom-before`));
|
|
6734
6699
|
if (message.role === "assistant") elements.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemoizedAssistantMessage, {
|
|
6735
6700
|
message,
|
|
6736
6701
|
messages,
|
|
6737
6702
|
isRunning,
|
|
6738
6703
|
AssistantMessageComponent: AssistantComponent,
|
|
6739
6704
|
slotProps: assistantSlotProps
|
|
6740
|
-
},
|
|
6705
|
+
}, message.id));
|
|
6741
6706
|
else if (message.role === "user") elements.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemoizedUserMessage, {
|
|
6742
6707
|
message,
|
|
6743
6708
|
UserMessageComponent: UserComponent,
|
|
6744
6709
|
slotProps: userSlotProps
|
|
6745
|
-
},
|
|
6710
|
+
}, message.id));
|
|
6746
6711
|
else if (message.role === "activity") elements.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemoizedActivityMessage, {
|
|
6747
6712
|
message,
|
|
6748
6713
|
renderActivityMessage
|
|
6749
|
-
},
|
|
6714
|
+
}, message.id));
|
|
6750
6715
|
else if (message.role === "reasoning") elements.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemoizedReasoningMessage, {
|
|
6751
6716
|
message,
|
|
6752
6717
|
messages,
|
|
6753
6718
|
isRunning,
|
|
6754
6719
|
ReasoningMessageComponent: ReasoningComponent,
|
|
6755
6720
|
slotProps: reasoningSlotProps
|
|
6756
|
-
},
|
|
6721
|
+
}, message.id));
|
|
6757
6722
|
if (renderCustomMessage) elements.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemoizedCustomMessage, {
|
|
6758
6723
|
message,
|
|
6759
6724
|
position: "after",
|
|
6760
6725
|
renderCustomMessage,
|
|
6761
6726
|
stateSnapshot
|
|
6762
|
-
}, `${
|
|
6727
|
+
}, `${message.id}-custom-after`));
|
|
6763
6728
|
const intelligenceTurnId = intelligenceTurnAnchors.get(message.id);
|
|
6764
6729
|
if (intelligenceTurnId !== void 0) elements.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IntelligenceIndicator, {
|
|
6765
6730
|
message,
|
|
@@ -6805,7 +6770,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6805
6770
|
transform: `translateY(${virtualItem.start}px)`
|
|
6806
6771
|
},
|
|
6807
6772
|
children: renderMessageBlock(message)
|
|
6808
|
-
},
|
|
6773
|
+
}, message.id);
|
|
6809
6774
|
})
|
|
6810
6775
|
}) : messageElements,
|
|
6811
6776
|
interruptElement,
|