@copilotkit/react-core 1.55.3-canary.1776215089 → 1.55.3-canary.1776260990
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-EfopO2gn.d.cts → copilotkit-9_JxoZgF.d.cts} +8 -1
- package/dist/{copilotkit-EfopO2gn.d.cts.map → copilotkit-9_JxoZgF.d.cts.map} +1 -1
- package/dist/{copilotkit-BZuXjQLc.cjs → copilotkit-9l47K1Ot.cjs} +53 -35
- package/dist/copilotkit-9l47K1Ot.cjs.map +1 -0
- package/dist/{copilotkit-opur-20s.d.mts → copilotkit-Dcf7Lkjb.d.mts} +8 -1
- package/dist/{copilotkit-opur-20s.d.mts.map → copilotkit-Dcf7Lkjb.d.mts.map} +1 -1
- package/dist/{copilotkit-BzVUuD95.mjs → copilotkit-a2pL_KeT.mjs} +54 -36
- package/dist/copilotkit-a2pL_KeT.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.umd.js +21 -10
- 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 +53 -35
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +6 -6
- package/src/components/copilot-provider/__tests__/error-visibility-prod.test.tsx +70 -0
- package/src/components/copilot-provider/copilot-messages.tsx +39 -24
- package/src/v2/components/chat/CopilotChatAssistantMessage.tsx +18 -15
- package/src/v2/components/chat/CopilotChatReasoningMessage.tsx +17 -4
- package/src/v2/components/chat/CopilotChatUserMessage.tsx +13 -10
- package/src/v2/components/chat/__tests__/CopilotChat.e2e.test.tsx +131 -5
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.test.tsx +1 -1
- package/src/v2/components/chat/__tests__/CopilotChatCopyButton.clipboard.test.tsx +241 -0
- package/src/v2/hooks/use-interrupt.tsx +10 -1
- package/dist/copilotkit-BZuXjQLc.cjs.map +0 -1
- package/dist/copilotkit-BzVUuD95.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-9l47K1Ot.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 MCPAppsActivityContent, $t as CopilotChatAudioRecorder, A as useAgentContext, At as CopilotChatMessageViewProps, B as SandboxFunction, Bt as CopilotChatAssistantMessageProps, C as useThreads, Ct as DefaultCloseIcon, D as useSuggestions, Dt as CopilotChatView, E as useConfigureSuggestions, Et as CopilotChatProps, F as useDefaultRenderTool, Ft as CopilotChatReasoningMessage, G as ReactHumanInTheLoop, Gt as ToolsMenuItem, H as InterruptHandlerProps, Ht as CopilotChatToolCallsViewProps, I as useRenderTool, It as CopilotChatReasoningMessageProps, J as ReactToolCallRenderer, Jt as CopilotChatConfigurationValue, K as ReactFrontendTool, Kt as CopilotChatConfigurationProvider, L as useComponent, Lt as CopilotChatUserMessage, M as UseAgentUpdate, Mt as CopilotChatSuggestionViewProps, N as useAgent, Nt as CopilotChatSuggestionPill, O as AgentContextInput, Ot as CopilotChatViewProps, P as useHumanInTheLoop, Pt as CopilotChatSuggestionPillProps, Q as useRenderToolCall, Qt as AudioRecorderState, R as useFrontendTool, Rt as CopilotChatUserMessageProps, S as UseThreadsResult, St as CopilotChatToggleButtonProps, T as useInterrupt, Tt as CopilotChat, U as InterruptRenderProps, Ut as CopilotChatInput, V as InterruptEvent, Vt as CopilotChatToolCallsView, W as defineToolCallRenderer, Wt as CopilotChatInputProps, X as ReactCustomMessageRenderer, Xt as useCopilotChatConfiguration, Y as useRenderCustomMessages, Yt as CopilotChatLabels, Z as ReactCustomMessageRendererPosition, Zt as AudioRecorderError, _ as UseAttachmentsProps, _t as CopilotSidebarView, a as A2UIUserAction, at as WildcardToolCallRender, b as Thread, bt as CopilotModalHeaderProps, c as SandboxFunctionsContext, ct as AttachmentsConfig, d as CopilotKitProvider, dt as CopilotPopup, et as MCPAppsActivityContentSchema, f as CopilotKitProviderProps, ft as CopilotPopupProps, g as CopilotKitCoreReactSubscriber, gt as CopilotPopupViewProps, h as CopilotKitCoreReactConfig, ht as CopilotPopupView, i as A2UIMessageRendererOptions, it as CopilotKitInspectorProps, j as useCapabilities, jt as CopilotChatSuggestionView, k as JsonSerializable, kt as CopilotChatMessageView, l as useSandboxFunctions, lt as CopilotChatAttachmentRenderer, m as CopilotKitCoreReact, mt as CopilotSidebarProps, nt as MCPAppsActivityType, o as createA2UIMessageRenderer, ot as Attachment, p as useCopilotKit, pt as CopilotSidebar, q as ReactActivityMessageRenderer, qt as CopilotChatConfigurationProviderProps, r as CopilotKitProps, rt as CopilotKitInspector, s as InspectorAnchor, st as AttachmentModality, t as CopilotKit, tt as MCPAppsActivityRenderer, u as CopilotKitContextValue, ut as CopilotChatAttachmentQueue, v as UseAttachmentsReturn, vt as CopilotSidebarViewProps, w as UseInterruptConfig, wt as DefaultOpenIcon, x as UseThreadsInput, xt as CopilotChatToggleButton, y as useAttachments, yt as CopilotModalHeader, z as useRenderActivityMessage, zt as CopilotChatAssistantMessage } from "../copilotkit-
|
|
1
|
+
import { $ as MCPAppsActivityContent, $t as CopilotChatAudioRecorder, A as useAgentContext, At as CopilotChatMessageViewProps, B as SandboxFunction, Bt as CopilotChatAssistantMessageProps, C as useThreads, Ct as DefaultCloseIcon, D as useSuggestions, Dt as CopilotChatView, E as useConfigureSuggestions, Et as CopilotChatProps, F as useDefaultRenderTool, Ft as CopilotChatReasoningMessage, G as ReactHumanInTheLoop, Gt as ToolsMenuItem, H as InterruptHandlerProps, Ht as CopilotChatToolCallsViewProps, I as useRenderTool, It as CopilotChatReasoningMessageProps, J as ReactToolCallRenderer, Jt as CopilotChatConfigurationValue, K as ReactFrontendTool, Kt as CopilotChatConfigurationProvider, L as useComponent, Lt as CopilotChatUserMessage, M as UseAgentUpdate, Mt as CopilotChatSuggestionViewProps, N as useAgent, Nt as CopilotChatSuggestionPill, O as AgentContextInput, Ot as CopilotChatViewProps, P as useHumanInTheLoop, Pt as CopilotChatSuggestionPillProps, Q as useRenderToolCall, Qt as AudioRecorderState, R as useFrontendTool, Rt as CopilotChatUserMessageProps, S as UseThreadsResult, St as CopilotChatToggleButtonProps, T as useInterrupt, Tt as CopilotChat, U as InterruptRenderProps, Ut as CopilotChatInput, V as InterruptEvent, Vt as CopilotChatToolCallsView, W as defineToolCallRenderer, Wt as CopilotChatInputProps, X as ReactCustomMessageRenderer, Xt as useCopilotChatConfiguration, Y as useRenderCustomMessages, Yt as CopilotChatLabels, Z as ReactCustomMessageRendererPosition, Zt as AudioRecorderError, _ as UseAttachmentsProps, _t as CopilotSidebarView, a as A2UIUserAction, at as WildcardToolCallRender, b as Thread, bt as CopilotModalHeaderProps, c as SandboxFunctionsContext, ct as AttachmentsConfig, d as CopilotKitProvider, dt as CopilotPopup, et as MCPAppsActivityContentSchema, f as CopilotKitProviderProps, ft as CopilotPopupProps, g as CopilotKitCoreReactSubscriber, gt as CopilotPopupViewProps, h as CopilotKitCoreReactConfig, ht as CopilotPopupView, i as A2UIMessageRendererOptions, it as CopilotKitInspectorProps, j as useCapabilities, jt as CopilotChatSuggestionView, k as JsonSerializable, kt as CopilotChatMessageView, l as useSandboxFunctions, lt as CopilotChatAttachmentRenderer, m as CopilotKitCoreReact, mt as CopilotSidebarProps, nt as MCPAppsActivityType, o as createA2UIMessageRenderer, ot as Attachment, p as useCopilotKit, pt as CopilotSidebar, q as ReactActivityMessageRenderer, qt as CopilotChatConfigurationProviderProps, r as CopilotKitProps, rt as CopilotKitInspector, s as InspectorAnchor, st as AttachmentModality, t as CopilotKit, tt as MCPAppsActivityRenderer, u as CopilotKitContextValue, ut as CopilotChatAttachmentQueue, v as UseAttachmentsReturn, vt as CopilotSidebarViewProps, w as UseInterruptConfig, wt as DefaultOpenIcon, x as UseThreadsInput, xt as CopilotChatToggleButton, y as useAttachments, yt as CopilotModalHeader, z as useRenderActivityMessage, zt as CopilotChatAssistantMessage } from "../copilotkit-9_JxoZgF.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 MCPAppsActivityContent, $t as CopilotChatAudioRecorder, A as useAgentContext, At as CopilotChatMessageViewProps, B as SandboxFunction, Bt as CopilotChatAssistantMessageProps, C as useThreads, Ct as DefaultCloseIcon, D as useSuggestions, Dt as CopilotChatView, E as useConfigureSuggestions, Et as CopilotChatProps, F as useDefaultRenderTool, Ft as CopilotChatReasoningMessage, G as ReactHumanInTheLoop, Gt as ToolsMenuItem, H as InterruptHandlerProps, Ht as CopilotChatToolCallsViewProps, I as useRenderTool, It as CopilotChatReasoningMessageProps, J as ReactToolCallRenderer, Jt as CopilotChatConfigurationValue, K as ReactFrontendTool, Kt as CopilotChatConfigurationProvider, L as useComponent, Lt as CopilotChatUserMessage, M as UseAgentUpdate, Mt as CopilotChatSuggestionViewProps, N as useAgent, Nt as CopilotChatSuggestionPill, O as AgentContextInput, Ot as CopilotChatViewProps, P as useHumanInTheLoop, Pt as CopilotChatSuggestionPillProps, Q as useRenderToolCall, Qt as AudioRecorderState, R as useFrontendTool, Rt as CopilotChatUserMessageProps, S as UseThreadsResult, St as CopilotChatToggleButtonProps, T as useInterrupt, Tt as CopilotChat, U as InterruptRenderProps, Ut as CopilotChatInput, V as InterruptEvent, Vt as CopilotChatToolCallsView, W as defineToolCallRenderer, Wt as CopilotChatInputProps, X as ReactCustomMessageRenderer, Xt as useCopilotChatConfiguration, Y as useRenderCustomMessages, Yt as CopilotChatLabels, Z as ReactCustomMessageRendererPosition, Zt as AudioRecorderError, _ as UseAttachmentsProps, _t as CopilotSidebarView, a as A2UIUserAction, at as WildcardToolCallRender, b as Thread, bt as CopilotModalHeaderProps, c as SandboxFunctionsContext, ct as AttachmentsConfig, d as CopilotKitProvider, dt as CopilotPopup, et as MCPAppsActivityContentSchema, f as CopilotKitProviderProps, ft as CopilotPopupProps, g as CopilotKitCoreReactSubscriber, gt as CopilotPopupViewProps, h as CopilotKitCoreReactConfig, ht as CopilotPopupView, i as A2UIMessageRendererOptions, it as CopilotKitInspectorProps, j as useCapabilities, jt as CopilotChatSuggestionView, k as JsonSerializable, kt as CopilotChatMessageView, l as useSandboxFunctions, lt as CopilotChatAttachmentRenderer, m as CopilotKitCoreReact, mt as CopilotSidebarProps, nt as MCPAppsActivityType, o as createA2UIMessageRenderer, ot as Attachment, p as useCopilotKit, pt as CopilotSidebar, q as ReactActivityMessageRenderer, qt as CopilotChatConfigurationProviderProps, r as CopilotKitProps, rt as CopilotKitInspector, s as InspectorAnchor, st as AttachmentModality, t as CopilotKit, tt as MCPAppsActivityRenderer, u as CopilotKitContextValue, ut as CopilotChatAttachmentQueue, v as UseAttachmentsReturn, vt as CopilotSidebarViewProps, w as UseInterruptConfig, wt as DefaultOpenIcon, x as UseThreadsInput, xt as CopilotChatToggleButton, y as useAttachments, yt as CopilotModalHeader, z as useRenderActivityMessage, zt as CopilotChatAssistantMessage } from "../copilotkit-
|
|
1
|
+
import { $ as MCPAppsActivityContent, $t as CopilotChatAudioRecorder, A as useAgentContext, At as CopilotChatMessageViewProps, B as SandboxFunction, Bt as CopilotChatAssistantMessageProps, C as useThreads, Ct as DefaultCloseIcon, D as useSuggestions, Dt as CopilotChatView, E as useConfigureSuggestions, Et as CopilotChatProps, F as useDefaultRenderTool, Ft as CopilotChatReasoningMessage, G as ReactHumanInTheLoop, Gt as ToolsMenuItem, H as InterruptHandlerProps, Ht as CopilotChatToolCallsViewProps, I as useRenderTool, It as CopilotChatReasoningMessageProps, J as ReactToolCallRenderer, Jt as CopilotChatConfigurationValue, K as ReactFrontendTool, Kt as CopilotChatConfigurationProvider, L as useComponent, Lt as CopilotChatUserMessage, M as UseAgentUpdate, Mt as CopilotChatSuggestionViewProps, N as useAgent, Nt as CopilotChatSuggestionPill, O as AgentContextInput, Ot as CopilotChatViewProps, P as useHumanInTheLoop, Pt as CopilotChatSuggestionPillProps, Q as useRenderToolCall, Qt as AudioRecorderState, R as useFrontendTool, Rt as CopilotChatUserMessageProps, S as UseThreadsResult, St as CopilotChatToggleButtonProps, T as useInterrupt, Tt as CopilotChat, U as InterruptRenderProps, Ut as CopilotChatInput, V as InterruptEvent, Vt as CopilotChatToolCallsView, W as defineToolCallRenderer, Wt as CopilotChatInputProps, X as ReactCustomMessageRenderer, Xt as useCopilotChatConfiguration, Y as useRenderCustomMessages, Yt as CopilotChatLabels, Z as ReactCustomMessageRendererPosition, Zt as AudioRecorderError, _ as UseAttachmentsProps, _t as CopilotSidebarView, a as A2UIUserAction, at as WildcardToolCallRender, b as Thread, bt as CopilotModalHeaderProps, c as SandboxFunctionsContext, ct as AttachmentsConfig, d as CopilotKitProvider, dt as CopilotPopup, et as MCPAppsActivityContentSchema, f as CopilotKitProviderProps, ft as CopilotPopupProps, g as CopilotKitCoreReactSubscriber, gt as CopilotPopupViewProps, h as CopilotKitCoreReactConfig, ht as CopilotPopupView, i as A2UIMessageRendererOptions, it as CopilotKitInspectorProps, j as useCapabilities, jt as CopilotChatSuggestionView, k as JsonSerializable, kt as CopilotChatMessageView, l as useSandboxFunctions, lt as CopilotChatAttachmentRenderer, m as CopilotKitCoreReact, mt as CopilotSidebarProps, nt as MCPAppsActivityType, o as createA2UIMessageRenderer, ot as Attachment, p as useCopilotKit, pt as CopilotSidebar, q as ReactActivityMessageRenderer, qt as CopilotChatConfigurationProviderProps, r as CopilotKitProps, rt as CopilotKitInspector, s as InspectorAnchor, st as AttachmentModality, t as CopilotKit, tt as MCPAppsActivityRenderer, u as CopilotKitContextValue, ut as CopilotChatAttachmentQueue, v as UseAttachmentsReturn, vt as CopilotSidebarViewProps, w as UseInterruptConfig, wt as DefaultOpenIcon, x as UseThreadsInput, xt as CopilotChatToggleButton, y as useAttachments, yt as CopilotModalHeader, z as useRenderActivityMessage, zt as CopilotChatAssistantMessage } from "../copilotkit-Dcf7Lkjb.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 CopilotKitProvider, A as CopilotChatSuggestionView, B as useConfigureSuggestions, C as CopilotChatToggleButton, D as CopilotChatView_default, E as CopilotChat, F as CopilotChatAssistantMessage_default, G as useRenderTool, H as useCapabilities, I as CopilotChatToolCallsView, J as useRenderActivityMessage, K as useComponent, L as useAttachments, M as CopilotChatReasoningMessage_default, N as CopilotChatUserMessage_default, O as CopilotChatAttachmentQueue, P as CopilotChatAttachmentRenderer, Q as useRenderToolCall, R as useThreads, S as CopilotModalHeader, T as DefaultOpenIcon, U as useHumanInTheLoop, V as useSuggestions, W as useDefaultRenderTool, X as UseAgentUpdate, Y as useRenderCustomMessages, Z as useAgent, _ as WildcardToolCallRender, at as SandboxFunctionsContext, b as CopilotPopupView, ct as MCPAppsActivityRenderer, dt as CopilotChatInput_default, et as useCopilotKit, ft as AudioRecorderError, ht as useCopilotChatConfiguration, it as createA2UIMessageRenderer, j as CopilotChatSuggestionPill, k as CopilotChatMessageView, lt as MCPAppsActivityType, mt as CopilotChatConfigurationProvider, nt as useAgentContext, ot as useSandboxFunctions, pt as CopilotChatAudioRecorder, q as useFrontendTool, rt as defineToolCallRenderer, st as MCPAppsActivityContentSchema, t as CopilotKit, tt as CopilotKitCoreReact, ut as CopilotKitInspector, v as CopilotPopup, w as DefaultCloseIcon, x as CopilotSidebarView, y as CopilotSidebar, z as useInterrupt } from "../copilotkit-
|
|
3
|
+
import { $ as CopilotKitProvider, A as CopilotChatSuggestionView, B as useConfigureSuggestions, C as CopilotChatToggleButton, D as CopilotChatView_default, E as CopilotChat, F as CopilotChatAssistantMessage_default, G as useRenderTool, H as useCapabilities, I as CopilotChatToolCallsView, J as useRenderActivityMessage, K as useComponent, L as useAttachments, M as CopilotChatReasoningMessage_default, N as CopilotChatUserMessage_default, O as CopilotChatAttachmentQueue, P as CopilotChatAttachmentRenderer, Q as useRenderToolCall, R as useThreads, S as CopilotModalHeader, T as DefaultOpenIcon, U as useHumanInTheLoop, V as useSuggestions, W as useDefaultRenderTool, X as UseAgentUpdate, Y as useRenderCustomMessages, Z as useAgent, _ as WildcardToolCallRender, at as SandboxFunctionsContext, b as CopilotPopupView, ct as MCPAppsActivityRenderer, dt as CopilotChatInput_default, et as useCopilotKit, ft as AudioRecorderError, ht as useCopilotChatConfiguration, it as createA2UIMessageRenderer, j as CopilotChatSuggestionPill, k as CopilotChatMessageView, lt as MCPAppsActivityType, mt as CopilotChatConfigurationProvider, nt as useAgentContext, ot as useSandboxFunctions, pt as CopilotChatAudioRecorder, q as useFrontendTool, rt as defineToolCallRenderer, st as MCPAppsActivityContentSchema, t as CopilotKit, tt as CopilotKitCoreReact, ut as CopilotKitInspector, v as CopilotPopup, w as DefaultCloseIcon, x as CopilotSidebarView, y as CopilotSidebar, z as useInterrupt } from "../copilotkit-a2pL_KeT.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
|
@@ -4535,8 +4535,10 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4535
4535
|
* ```
|
|
4536
4536
|
*/
|
|
4537
4537
|
function useInterrupt(config) {
|
|
4538
|
+
var _config$agent;
|
|
4538
4539
|
const { copilotkit } = useCopilotKit();
|
|
4539
|
-
const { agent } = useAgent({ agentId: config.agentId });
|
|
4540
|
+
const { agent: internalAgent } = useAgent({ agentId: config.agentId });
|
|
4541
|
+
const agent = (_config$agent = config.agent) !== null && _config$agent !== void 0 ? _config$agent : internalAgent;
|
|
4540
4542
|
const [pendingEvent, setPendingEvent] = (0, react.useState)(null);
|
|
4541
4543
|
const pendingEventRef = (0, react.useRef)(pendingEvent);
|
|
4542
4544
|
pendingEventRef.current = pendingEvent;
|
|
@@ -4947,11 +4949,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4947
4949
|
useKatexStyles();
|
|
4948
4950
|
const boundMarkdownRenderer = renderSlot(markdownRenderer, CopilotChatAssistantMessage.MarkdownRenderer, { content: message.content || "" });
|
|
4949
4951
|
const boundCopyButton = renderSlot(copyButton, CopilotChatAssistantMessage.CopyButton, { onClick: async () => {
|
|
4950
|
-
if (message.content)
|
|
4951
|
-
|
|
4952
|
-
} catch (err) {
|
|
4953
|
-
console.error("Failed to copy message:", err);
|
|
4954
|
-
}
|
|
4952
|
+
if (message.content) return await (0, _copilotkit_shared.copyToClipboard)(message.content);
|
|
4953
|
+
return false;
|
|
4955
4954
|
} });
|
|
4956
4955
|
const boundThumbsUpButton = renderSlot(thumbsUpButton, CopilotChatAssistantMessage.ThumbsUpButton, { onClick: onThumbsUp });
|
|
4957
4956
|
const boundThumbsDownButton = renderSlot(thumbsDownButton, CopilotChatAssistantMessage.ThumbsDownButton, { onClick: onThumbsDown });
|
|
@@ -5051,14 +5050,17 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5051
5050
|
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
5052
5051
|
};
|
|
5053
5052
|
}, []);
|
|
5054
|
-
const handleClick = (event) => {
|
|
5055
|
-
|
|
5056
|
-
if (
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5053
|
+
const handleClick = async (event) => {
|
|
5054
|
+
let success = false;
|
|
5055
|
+
if (onClick) success = await Promise.resolve(onClick(event)) === true;
|
|
5056
|
+
if (success) {
|
|
5057
|
+
setCopied(true);
|
|
5058
|
+
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
5059
|
+
timerRef.current = setTimeout(() => {
|
|
5060
|
+
timerRef.current = null;
|
|
5061
|
+
setCopied(false);
|
|
5062
|
+
}, 2e3);
|
|
5063
|
+
}
|
|
5062
5064
|
};
|
|
5063
5065
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
5064
5066
|
"data-testid": "copilot-copy-button",
|
|
@@ -5220,11 +5222,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5220
5222
|
const mediaParts = (0, react.useMemo)(() => getMediaParts(message.content), [message.content]);
|
|
5221
5223
|
const BoundMessageRenderer = renderSlot(messageRenderer, CopilotChatUserMessage.MessageRenderer, { content: flattenedContent });
|
|
5222
5224
|
const BoundCopyButton = renderSlot(copyButton, CopilotChatUserMessage.CopyButton, { onClick: async () => {
|
|
5223
|
-
if (flattenedContent)
|
|
5224
|
-
|
|
5225
|
-
} catch (err) {
|
|
5226
|
-
console.error("Failed to copy message:", err);
|
|
5227
|
-
}
|
|
5225
|
+
if (flattenedContent) return await (0, _copilotkit_shared.copyToClipboard)(flattenedContent);
|
|
5226
|
+
return false;
|
|
5228
5227
|
} });
|
|
5229
5228
|
const BoundEditButton = renderSlot(editButton, CopilotChatUserMessage.EditButton, { onClick: () => onEditMessage === null || onEditMessage === void 0 ? void 0 : onEditMessage({ message }) });
|
|
5230
5229
|
const BoundBranchNavigation = renderSlot(branchNavigation, CopilotChatUserMessage.BranchNavigation, {
|
|
@@ -5314,10 +5313,13 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5314
5313
|
const config = useCopilotChatConfiguration();
|
|
5315
5314
|
const labels = (_config$labels = config === null || config === void 0 ? void 0 : config.labels) !== null && _config$labels !== void 0 ? _config$labels : CopilotChatDefaultLabels;
|
|
5316
5315
|
const [copied, setCopied] = (0, react.useState)(false);
|
|
5317
|
-
const handleClick = (event) => {
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
if (
|
|
5316
|
+
const handleClick = async (event) => {
|
|
5317
|
+
let success = false;
|
|
5318
|
+
if (onClick) success = await Promise.resolve(onClick(event)) === true;
|
|
5319
|
+
if (success) {
|
|
5320
|
+
setCopied(true);
|
|
5321
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
5322
|
+
}
|
|
5321
5323
|
};
|
|
5322
5324
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
5323
5325
|
"data-testid": "copilot-user-copy-button",
|
|
@@ -5427,17 +5429,24 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5427
5429
|
return () => clearInterval(timer);
|
|
5428
5430
|
}, [isStreaming]);
|
|
5429
5431
|
const [isOpen, setIsOpen] = (0, react.useState)(isStreaming);
|
|
5432
|
+
const userToggledRef = (0, react.useRef)(false);
|
|
5430
5433
|
(0, react.useEffect)(() => {
|
|
5431
|
-
if (isStreaming)
|
|
5432
|
-
|
|
5434
|
+
if (isStreaming) {
|
|
5435
|
+
userToggledRef.current = false;
|
|
5436
|
+
setIsOpen(true);
|
|
5437
|
+
} else if (!userToggledRef.current) setIsOpen(false);
|
|
5433
5438
|
}, [isStreaming]);
|
|
5439
|
+
const handleToggle = hasContent ? () => {
|
|
5440
|
+
userToggledRef.current = true;
|
|
5441
|
+
setIsOpen((prev) => !prev);
|
|
5442
|
+
} : void 0;
|
|
5434
5443
|
const label = isStreaming ? "Thinking…" : `Thought for ${formatDuration(elapsed)}`;
|
|
5435
5444
|
const boundHeader = renderSlot(header, CopilotChatReasoningMessage.Header, {
|
|
5436
5445
|
isOpen,
|
|
5437
5446
|
label,
|
|
5438
5447
|
hasContent,
|
|
5439
5448
|
isStreaming,
|
|
5440
|
-
onClick:
|
|
5449
|
+
onClick: handleToggle
|
|
5441
5450
|
});
|
|
5442
5451
|
const boundContent = renderSlot(contentView, CopilotChatReasoningMessage.Content, {
|
|
5443
5452
|
isStreaming,
|
|
@@ -8169,6 +8178,20 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
8169
8178
|
/**
|
|
8170
8179
|
* An internal context to separate the messages state (which is constantly changing) from the rest of CopilotKit context
|
|
8171
8180
|
*/
|
|
8181
|
+
/**
|
|
8182
|
+
* Determine whether a GraphQL error should be suppressed based on its visibility
|
|
8183
|
+
* and whether the dev console is active.
|
|
8184
|
+
*
|
|
8185
|
+
* Returns `null` when the error should be surfaced to the UI, or a log prefix
|
|
8186
|
+
* string when the error should be suppressed (logged to console only).
|
|
8187
|
+
*
|
|
8188
|
+
* Exported for unit testing.
|
|
8189
|
+
*/
|
|
8190
|
+
function getErrorSuppression(visibility, isDev) {
|
|
8191
|
+
if (visibility === _copilotkit_shared.ErrorVisibility.SILENT) return "CopilotKit Silent Error:";
|
|
8192
|
+
if (!isDev && visibility === _copilotkit_shared.ErrorVisibility.DEV_ONLY) return "CopilotKit Error (hidden in production):";
|
|
8193
|
+
return null;
|
|
8194
|
+
}
|
|
8172
8195
|
const MessagesTapContext = (0, react.createContext)(null);
|
|
8173
8196
|
function useMessagesTap() {
|
|
8174
8197
|
const tap = (0, react.useContext)(MessagesTapContext);
|
|
@@ -8253,13 +8276,9 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
8253
8276
|
const graphQLErrors = error.graphQLErrors;
|
|
8254
8277
|
const routeError = (gqlError) => {
|
|
8255
8278
|
const extensions = gqlError.extensions;
|
|
8256
|
-
const
|
|
8257
|
-
if (
|
|
8258
|
-
console.error(
|
|
8259
|
-
return;
|
|
8260
|
-
}
|
|
8261
|
-
if (visibility === _copilotkit_shared.ErrorVisibility.SILENT) {
|
|
8262
|
-
console.error("CopilotKit Silent Error:", gqlError.message);
|
|
8279
|
+
const suppression = getErrorSuppression(extensions === null || extensions === void 0 ? void 0 : extensions.visibility, shouldShowDevConsole(showDevConsole));
|
|
8280
|
+
if (suppression) {
|
|
8281
|
+
console.error(suppression, gqlError.message);
|
|
8263
8282
|
return;
|
|
8264
8283
|
}
|
|
8265
8284
|
const ckError = createStructuredError(gqlError);
|
|
@@ -8276,8 +8295,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
8276
8295
|
}
|
|
8277
8296
|
};
|
|
8278
8297
|
graphQLErrors.forEach(routeError);
|
|
8279
|
-
} else
|
|
8280
|
-
else {
|
|
8298
|
+
} else {
|
|
8281
8299
|
const fallbackError = new _copilotkit_shared.CopilotKitError({
|
|
8282
8300
|
message: (error === null || error === void 0 ? void 0 : error.message) || String(error),
|
|
8283
8301
|
code: _copilotkit_shared.CopilotKitErrorCode.UNKNOWN
|