@copilotkit/react-core 1.55.3-canary.1776243725 → 1.55.3-canary.1776979102

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 (58) hide show
  1. package/dist/{copilotkit-opur-20s.d.mts → copilotkit-3mXoM0Hd.d.mts} +9 -29
  2. package/dist/copilotkit-3mXoM0Hd.d.mts.map +1 -0
  3. package/dist/{copilotkit-EfopO2gn.d.cts → copilotkit-BDDjvB-p.d.cts} +9 -29
  4. package/dist/copilotkit-BDDjvB-p.d.cts.map +1 -0
  5. package/dist/{copilotkit-BoOnQHlE.cjs → copilotkit-BkcqmpWt.cjs} +162 -280
  6. package/dist/copilotkit-BkcqmpWt.cjs.map +1 -0
  7. package/dist/{copilotkit-Bm4ox8G0.mjs → copilotkit-C7n8Umv9.mjs} +164 -276
  8. package/dist/copilotkit-C7n8Umv9.mjs.map +1 -0
  9. package/dist/index.cjs +4 -9
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +1 -1
  12. package/dist/index.d.mts +1 -1
  13. package/dist/index.mjs +4 -9
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/index.umd.js +143 -230
  16. package/dist/index.umd.js.map +1 -1
  17. package/dist/v2/index.cjs +1 -2
  18. package/dist/v2/index.d.cts +2 -2
  19. package/dist/v2/index.d.mts +2 -2
  20. package/dist/v2/index.mjs +2 -2
  21. package/dist/v2/index.umd.js +165 -279
  22. package/dist/v2/index.umd.js.map +1 -1
  23. package/package.json +6 -6
  24. package/src/components/copilot-provider/copilot-messages.tsx +24 -39
  25. package/src/components/copilot-provider/copilotkit-props.tsx +5 -9
  26. package/src/components/copilot-provider/copilotkit.tsx +1 -4
  27. package/src/hooks/__tests__/use-copilot-chat-internal-connect.test.tsx +16 -27
  28. package/src/hooks/use-copilot-chat_internal.ts +4 -15
  29. package/src/v2/__tests__/utils/test-helpers.tsx +7 -40
  30. package/src/v2/components/chat/CopilotChat.tsx +1 -1
  31. package/src/v2/components/chat/CopilotChatAssistantMessage.tsx +15 -18
  32. package/src/v2/components/chat/CopilotChatMessageView.tsx +2 -7
  33. package/src/v2/components/chat/CopilotChatReasoningMessage.tsx +4 -17
  34. package/src/v2/components/chat/CopilotChatUserMessage.tsx +10 -13
  35. package/src/v2/components/chat/__tests__/CopilotChat.e2e.test.tsx +5 -131
  36. package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.tsx +0 -60
  37. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.test.tsx +1 -1
  38. package/src/v2/components/chat/__tests__/CopilotChatToolRendering.e2e.test.tsx +2 -5
  39. package/src/v2/components/chat/__tests__/CopilotChatToolRerenders.e2e.test.tsx +2 -5
  40. package/src/v2/components/chat/__tests__/MCPAppsActivityRenderer.e2e.test.tsx +1 -55
  41. package/src/v2/hooks/__tests__/use-agent-context-timing.e2e.test.tsx +0 -8
  42. package/src/v2/hooks/__tests__/use-agent-throttle.test.tsx +10 -10
  43. package/src/v2/hooks/__tests__/use-agent.e2e.test.tsx +2 -13
  44. package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.tsx +4 -23
  45. package/src/v2/hooks/index.ts +0 -1
  46. package/src/v2/hooks/use-agent.tsx +10 -157
  47. package/src/v2/hooks/use-render-activity-message.tsx +3 -9
  48. package/src/v2/hooks/use-render-custom-messages.tsx +1 -6
  49. package/src/v2/providers/CopilotKitProvider.tsx +2 -6
  50. package/dist/copilotkit-Bm4ox8G0.mjs.map +0 -1
  51. package/dist/copilotkit-BoOnQHlE.cjs.map +0 -1
  52. package/dist/copilotkit-EfopO2gn.d.cts.map +0 -1
  53. package/dist/copilotkit-opur-20s.d.mts.map +0 -1
  54. package/src/components/copilot-provider/__tests__/error-visibility-prod.test.tsx +0 -70
  55. package/src/v2/components/chat/__tests__/CopilotChatCopyButton.clipboard.test.tsx +0 -241
  56. package/src/v2/hooks/__tests__/use-agent-thread-isolation.test.tsx +0 -327
  57. package/src/v2/hooks/__tests__/use-capabilities.test.tsx +0 -76
  58. package/src/v2/hooks/use-capabilities.tsx +0 -25
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 { $t as CoagentInChatRenderFunction, An as FrontendActionAvailability, Cn as ActionRenderProps, Dn as CatchAllActionRenderProps, En as ActionRenderPropsWait, M as useAgent, On as CatchAllFrontendAction, Sn as TreeNode, Tn as ActionRenderPropsNoArgsWait, Z as useRenderToolCall$1, _n as CrewsToolStateItem, an as LangGraphInterruptAction, bn as DocumentPointer, cn as LangGraphInterruptRender, dn as QueuedInterruptEvent, en as CopilotApiConfig, fn as CrewsAgentState, gn as CrewsTaskStateItem, hn as CrewsStateItem, in as CoAgentStateRender, jn as RenderFunctionStatus, kn as FrontendAction, ln as LangGraphInterruptRenderHandlerProps, mn as CrewsResponseStatus, n as defaultCopilotContextCategories, nn as CopilotContextParams, on as LangGraphInterruptActionSetter, pn as CrewsResponse, r as CopilotKitProps, rn as useCopilotContext, sn as LangGraphInterruptActionSetterArgs, t as CopilotKit, tn as CopilotContext, un as LangGraphInterruptRenderProps, vn as CopilotChatSuggestionConfiguration, wn as ActionRenderPropsNoArgs, xn as Tree, yn as SystemMessageFunction } from "./copilotkit-BDDjvB-p.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 { $t as CoagentInChatRenderFunction, An as FrontendActionAvailability, Cn as ActionRenderProps, Dn as CatchAllActionRenderProps, En as ActionRenderPropsWait, M as useAgent, On as CatchAllFrontendAction, Sn as TreeNode, Tn as ActionRenderPropsNoArgsWait, Z as useRenderToolCall$1, _n as CrewsToolStateItem, an as LangGraphInterruptAction, bn as DocumentPointer, cn as LangGraphInterruptRender, dn as QueuedInterruptEvent, en as CopilotApiConfig, fn as CrewsAgentState, gn as CrewsTaskStateItem, hn as CrewsStateItem, in as CoAgentStateRender, jn as RenderFunctionStatus, kn as FrontendAction, ln as LangGraphInterruptRenderHandlerProps, mn as CrewsResponseStatus, n as defaultCopilotContextCategories, nn as CopilotContextParams, on as LangGraphInterruptActionSetter, pn as CrewsResponse, r as CopilotKitProps, rn as useCopilotContext, sn as LangGraphInterruptActionSetterArgs, t as CopilotKit, tn as CopilotContext, un as LangGraphInterruptRenderProps, vn as CopilotChatSuggestionConfiguration, wn as ActionRenderPropsNoArgs, xn as Tree, yn as SystemMessageFunction } from "./copilotkit-3mXoM0Hd.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-Bm4ox8G0.mjs";
3
+ import { $ as useCopilotKit, B as useConfigureSuggestions, J as useFrontendTool$1, U as useAgent, V as useSuggestions, W as useHumanInTheLoop$1, X as useRenderCustomMessages, Z as useRenderToolCall$1, a as ThreadsProvider, c as CoAgentStateRendersProvider, d as shouldShowDevConsole, f as useToast, g as useCopilotContext, h as CopilotContext, i as ThreadsContext, l as useCoAgentStateRenders, m as useCopilotMessagesContext, mt as useCopilotChatConfiguration, n as defaultCopilotContextCategories, nt as defineToolCallRenderer, o as useThreads, p as CopilotMessagesContext, r as CoAgentStateRenderBridge, s as CoAgentStateRendersContext, t as CopilotKit, u as useAsyncCallback, z as useInterrupt } from "./copilotkit-C7n8Umv9.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";
@@ -40,11 +40,7 @@ function useCopilotChatInternal({ suggestions, onInProgress, onSubmitMessage, on
40
40
  const existingConfig = useCopilotChatConfiguration();
41
41
  const [agentAvailable, setAgentAvailable] = useState(false);
42
42
  const resolvedAgentId = existingConfig?.agentId ?? "default";
43
- const { agent } = useAgent({
44
- agentId: resolvedAgentId,
45
- threadId: existingConfig?.threadId
46
- });
47
- const lastConnectedAgentRef = useRef(null);
43
+ const { agent } = useAgent({ agentId: resolvedAgentId });
48
44
  useEffect(() => {
49
45
  let detached = false;
50
46
  const connectAbortController = new AbortController();
@@ -59,12 +55,11 @@ function useCopilotChatInternal({ suggestions, onInProgress, onSubmitMessage, on
59
55
  if (error instanceof AGUIConnectNotImplementedError) {} else console.error("CopilotChat: connectAgent failed", error);
60
56
  }
61
57
  };
62
- if (agent && agent !== lastConnectedAgentRef.current && copilotkit.runtimeConnectionStatus === CopilotKitCoreRuntimeConnectionStatus.Connected) {
63
- lastConnectedAgentRef.current = agent;
58
+ if (agent && existingConfig?.threadId && agent.threadId !== existingConfig.threadId && copilotkit.runtimeConnectionStatus === CopilotKitCoreRuntimeConnectionStatus.Connected) {
59
+ agent.threadId = existingConfig.threadId;
64
60
  connect(agent);
65
61
  }
66
62
  return () => {
67
- lastConnectedAgentRef.current = null;
68
63
  detached = true;
69
64
  connectAbortController.abort();
70
65
  agent?.detachActiveRun();