@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.
Files changed (32) hide show
  1. package/dist/{copilotkit-EfopO2gn.d.cts → copilotkit-9_JxoZgF.d.cts} +8 -1
  2. package/dist/{copilotkit-EfopO2gn.d.cts.map → copilotkit-9_JxoZgF.d.cts.map} +1 -1
  3. package/dist/{copilotkit-BZuXjQLc.cjs → copilotkit-9l47K1Ot.cjs} +53 -35
  4. package/dist/copilotkit-9l47K1Ot.cjs.map +1 -0
  5. package/dist/{copilotkit-opur-20s.d.mts → copilotkit-Dcf7Lkjb.d.mts} +8 -1
  6. package/dist/{copilotkit-opur-20s.d.mts.map → copilotkit-Dcf7Lkjb.d.mts.map} +1 -1
  7. package/dist/{copilotkit-BzVUuD95.mjs → copilotkit-a2pL_KeT.mjs} +54 -36
  8. package/dist/copilotkit-a2pL_KeT.mjs.map +1 -0
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.d.cts +1 -1
  11. package/dist/index.d.mts +1 -1
  12. package/dist/index.mjs +1 -1
  13. package/dist/index.umd.js +21 -10
  14. package/dist/index.umd.js.map +1 -1
  15. package/dist/v2/index.cjs +1 -1
  16. package/dist/v2/index.d.cts +1 -1
  17. package/dist/v2/index.d.mts +1 -1
  18. package/dist/v2/index.mjs +1 -1
  19. package/dist/v2/index.umd.js +53 -35
  20. package/dist/v2/index.umd.js.map +1 -1
  21. package/package.json +6 -6
  22. package/src/components/copilot-provider/__tests__/error-visibility-prod.test.tsx +70 -0
  23. package/src/components/copilot-provider/copilot-messages.tsx +39 -24
  24. package/src/v2/components/chat/CopilotChatAssistantMessage.tsx +18 -15
  25. package/src/v2/components/chat/CopilotChatReasoningMessage.tsx +17 -4
  26. package/src/v2/components/chat/CopilotChatUserMessage.tsx +13 -10
  27. package/src/v2/components/chat/__tests__/CopilotChat.e2e.test.tsx +131 -5
  28. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.test.tsx +1 -1
  29. package/src/v2/components/chat/__tests__/CopilotChatCopyButton.clipboard.test.tsx +241 -0
  30. package/src/v2/hooks/use-interrupt.tsx +10 -1
  31. package/dist/copilotkit-BZuXjQLc.cjs.map +0 -1
  32. package/dist/copilotkit-BzVUuD95.mjs.map +0 -1
package/dist/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-BZuXjQLc.cjs');
4
+ const require_copilotkit = require('./copilotkit-9l47K1Ot.cjs');
5
5
  let react = require("react");
6
6
  react = require_copilotkit.__toESM(react);
7
7
  let _copilotkit_core = require("@copilotkit/core");
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { An as FrontendAction, Cn as TreeNode, Dn as ActionRenderPropsWait, En as ActionRenderPropsNoArgsWait, Mn as RenderFunctionStatus, N as useAgent, On as CatchAllActionRenderProps, Q as useRenderToolCall$1, Sn as Tree, Tn as ActionRenderPropsNoArgs, _n as CrewsTaskStateItem, an as CoAgentStateRender, bn as SystemMessageFunction, cn as LangGraphInterruptActionSetterArgs, dn as LangGraphInterruptRenderProps, en as CoagentInChatRenderFunction, fn as QueuedInterruptEvent, gn as CrewsStateItem, hn as CrewsResponseStatus, in as useCopilotContext, jn as FrontendActionAvailability, kn as CatchAllFrontendAction, ln as LangGraphInterruptRender, mn as CrewsResponse, n as defaultCopilotContextCategories, nn as CopilotContext, on as LangGraphInterruptAction, pn as CrewsAgentState, r as CopilotKitProps, rn as CopilotContextParams, sn as LangGraphInterruptActionSetter, t as CopilotKit, tn as CopilotApiConfig, un as LangGraphInterruptRenderHandlerProps, vn as CrewsToolStateItem, wn as ActionRenderProps, xn as DocumentPointer, yn as CopilotChatSuggestionConfiguration } from "./copilotkit-EfopO2gn.cjs";
1
+ import { An as FrontendAction, Cn as TreeNode, Dn as ActionRenderPropsWait, En as ActionRenderPropsNoArgsWait, Mn as RenderFunctionStatus, N as useAgent, On as CatchAllActionRenderProps, Q as useRenderToolCall$1, Sn as Tree, Tn as ActionRenderPropsNoArgs, _n as CrewsTaskStateItem, an as CoAgentStateRender, bn as SystemMessageFunction, cn as LangGraphInterruptActionSetterArgs, dn as LangGraphInterruptRenderProps, en as CoagentInChatRenderFunction, fn as QueuedInterruptEvent, gn as CrewsStateItem, hn as CrewsResponseStatus, in as useCopilotContext, jn as FrontendActionAvailability, kn as CatchAllFrontendAction, ln as LangGraphInterruptRender, mn as CrewsResponse, n as defaultCopilotContextCategories, nn as CopilotContext, on as LangGraphInterruptAction, pn as CrewsAgentState, r as CopilotKitProps, rn as CopilotContextParams, sn as LangGraphInterruptActionSetter, t as CopilotKit, tn as CopilotApiConfig, un as LangGraphInterruptRenderHandlerProps, vn as CrewsToolStateItem, wn as ActionRenderProps, xn as DocumentPointer, yn as CopilotChatSuggestionConfiguration } from "./copilotkit-9_JxoZgF.cjs";
2
2
  import "./v2/index.cjs";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
  import { CopilotRuntimeClient, CopilotRuntimeClientOptions, ForwardedParametersInput, Message } from "@copilotkit/runtime-client-gql";
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { An as FrontendAction, Cn as TreeNode, Dn as ActionRenderPropsWait, En as ActionRenderPropsNoArgsWait, Mn as RenderFunctionStatus, N as useAgent, On as CatchAllActionRenderProps, Q as useRenderToolCall$1, Sn as Tree, Tn as ActionRenderPropsNoArgs, _n as CrewsTaskStateItem, an as CoAgentStateRender, bn as SystemMessageFunction, cn as LangGraphInterruptActionSetterArgs, dn as LangGraphInterruptRenderProps, en as CoagentInChatRenderFunction, fn as QueuedInterruptEvent, gn as CrewsStateItem, hn as CrewsResponseStatus, in as useCopilotContext, jn as FrontendActionAvailability, kn as CatchAllFrontendAction, ln as LangGraphInterruptRender, mn as CrewsResponse, n as defaultCopilotContextCategories, nn as CopilotContext, on as LangGraphInterruptAction, pn as CrewsAgentState, r as CopilotKitProps, rn as CopilotContextParams, sn as LangGraphInterruptActionSetter, t as CopilotKit, tn as CopilotApiConfig, un as LangGraphInterruptRenderHandlerProps, vn as CrewsToolStateItem, wn as ActionRenderProps, xn as DocumentPointer, yn as CopilotChatSuggestionConfiguration } from "./copilotkit-opur-20s.mjs";
1
+ import { An as FrontendAction, Cn as TreeNode, Dn as ActionRenderPropsWait, En as ActionRenderPropsNoArgsWait, Mn as RenderFunctionStatus, N as useAgent, On as CatchAllActionRenderProps, Q as useRenderToolCall$1, Sn as Tree, Tn as ActionRenderPropsNoArgs, _n as CrewsTaskStateItem, an as CoAgentStateRender, bn as SystemMessageFunction, cn as LangGraphInterruptActionSetterArgs, dn as LangGraphInterruptRenderProps, en as CoagentInChatRenderFunction, fn as QueuedInterruptEvent, gn as CrewsStateItem, hn as CrewsResponseStatus, in as useCopilotContext, jn as FrontendActionAvailability, kn as CatchAllFrontendAction, ln as LangGraphInterruptRender, mn as CrewsResponse, n as defaultCopilotContextCategories, nn as CopilotContext, on as LangGraphInterruptAction, pn as CrewsAgentState, r as CopilotKitProps, rn as CopilotContextParams, sn as LangGraphInterruptActionSetter, t as CopilotKit, tn as CopilotApiConfig, un as LangGraphInterruptRenderHandlerProps, vn as CrewsToolStateItem, wn as ActionRenderProps, xn as DocumentPointer, yn as CopilotChatSuggestionConfiguration } from "./copilotkit-Dcf7Lkjb.mjs";
2
2
  import "./v2/index.mjs";
3
3
  import React, { ReactNode, RefObject, SetStateAction } from "react";
4
4
  import { StaticSuggestionsConfig, Suggestion } from "@copilotkit/core";
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { B as useConfigureSuggestions, Q as useRenderToolCall$1, U as useHumanInTheLoop$1, V as useSuggestions, Y as useRenderCustomMessages, Z as useAgent, a as ThreadsProvider, c as CoAgentStateRendersProvider, d as shouldShowDevConsole, et as useCopilotKit, f as useToast, g as useCopilotContext, h as CopilotContext, ht as useCopilotChatConfiguration, i as ThreadsContext, l as useCoAgentStateRenders, m as useCopilotMessagesContext, n as defaultCopilotContextCategories, o as useThreads, p as CopilotMessagesContext, q as useFrontendTool$1, r as CoAgentStateRenderBridge, rt as defineToolCallRenderer, s as CoAgentStateRendersContext, t as CopilotKit, u as useAsyncCallback, z as useInterrupt } from "./copilotkit-BzVUuD95.mjs";
3
+ import { B as useConfigureSuggestions, Q as useRenderToolCall$1, U as useHumanInTheLoop$1, V as useSuggestions, Y as useRenderCustomMessages, Z as useAgent, a as ThreadsProvider, c as CoAgentStateRendersProvider, d as shouldShowDevConsole, et as useCopilotKit, f as useToast, g as useCopilotContext, h as CopilotContext, ht as useCopilotChatConfiguration, i as ThreadsContext, l as useCoAgentStateRenders, m as useCopilotMessagesContext, n as defaultCopilotContextCategories, o as useThreads, p as CopilotMessagesContext, q as useFrontendTool$1, r as CoAgentStateRenderBridge, rt as defineToolCallRenderer, s as CoAgentStateRendersContext, t as CopilotKit, u as useAsyncCallback, z as useInterrupt } from "./copilotkit-a2pL_KeT.mjs";
4
4
  import React, { Fragment, createElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
5
5
  import { CopilotKitCoreRuntimeConnectionStatus, ToolCallStatus } from "@copilotkit/core";
6
6
  import { AGUIConnectNotImplementedError, HttpAgent } from "@ag-ui/client";
package/dist/index.umd.js CHANGED
@@ -2988,8 +2988,10 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2988
2988
  * ```
2989
2989
  */
2990
2990
  function useInterrupt(config) {
2991
+ var _config$agent;
2991
2992
  const { copilotkit } = useCopilotKit();
2992
- const { agent } = useAgent({ agentId: config.agentId });
2993
+ const { agent: internalAgent } = useAgent({ agentId: config.agentId });
2994
+ const agent = (_config$agent = config.agent) !== null && _config$agent !== void 0 ? _config$agent : internalAgent;
2993
2995
  const [pendingEvent, setPendingEvent] = (0, react.useState)(null);
2994
2996
  const pendingEventRef = (0, react.useRef)(pendingEvent);
2995
2997
  pendingEventRef.current = pendingEvent;
@@ -3680,6 +3682,20 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3680
3682
  /**
3681
3683
  * An internal context to separate the messages state (which is constantly changing) from the rest of CopilotKit context
3682
3684
  */
3685
+ /**
3686
+ * Determine whether a GraphQL error should be suppressed based on its visibility
3687
+ * and whether the dev console is active.
3688
+ *
3689
+ * Returns `null` when the error should be surfaced to the UI, or a log prefix
3690
+ * string when the error should be suppressed (logged to console only).
3691
+ *
3692
+ * Exported for unit testing.
3693
+ */
3694
+ function getErrorSuppression(visibility, isDev) {
3695
+ if (visibility === _copilotkit_shared.ErrorVisibility.SILENT) return "CopilotKit Silent Error:";
3696
+ if (!isDev && visibility === _copilotkit_shared.ErrorVisibility.DEV_ONLY) return "CopilotKit Error (hidden in production):";
3697
+ return null;
3698
+ }
3683
3699
  const MessagesTapContext = (0, react.createContext)(null);
3684
3700
  function useMessagesTap() {
3685
3701
  const tap = (0, react.useContext)(MessagesTapContext);
@@ -3764,13 +3780,9 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3764
3780
  const graphQLErrors = error.graphQLErrors;
3765
3781
  const routeError = (gqlError) => {
3766
3782
  const extensions = gqlError.extensions;
3767
- const visibility = extensions === null || extensions === void 0 ? void 0 : extensions.visibility;
3768
- if (!shouldShowDevConsole(showDevConsole)) {
3769
- console.error("CopilotKit Error (hidden in production):", gqlError.message);
3770
- return;
3771
- }
3772
- if (visibility === _copilotkit_shared.ErrorVisibility.SILENT) {
3773
- console.error("CopilotKit Silent Error:", gqlError.message);
3783
+ const suppression = getErrorSuppression(extensions === null || extensions === void 0 ? void 0 : extensions.visibility, shouldShowDevConsole(showDevConsole));
3784
+ if (suppression) {
3785
+ console.error(suppression, gqlError.message);
3774
3786
  return;
3775
3787
  }
3776
3788
  const ckError = createStructuredError(gqlError);
@@ -3787,8 +3799,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3787
3799
  }
3788
3800
  };
3789
3801
  graphQLErrors.forEach(routeError);
3790
- } else if (!shouldShowDevConsole(showDevConsole)) console.error("CopilotKit Error (hidden in production):", error);
3791
- else {
3802
+ } else {
3792
3803
  const fallbackError = new _copilotkit_shared.CopilotKitError({
3793
3804
  message: (error === null || error === void 0 ? void 0 : error.message) || String(error),
3794
3805
  code: _copilotkit_shared.CopilotKitErrorCode.UNKNOWN