@copilotkit/react-core 1.55.0-next.8 → 1.55.0-next.9
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/CHANGELOG.md +18 -5
- package/dist/{copilotkit-B3Mb1yVE.cjs → copilotkit-BDNjFNmk.cjs} +156 -92
- package/dist/copilotkit-BDNjFNmk.cjs.map +1 -0
- package/dist/{copilotkit-Dy5w3qEV.d.mts → copilotkit-BqcyhQjT.d.mts} +3 -1
- package/dist/{copilotkit-Dy5w3qEV.d.mts.map → copilotkit-BqcyhQjT.d.mts.map} +1 -1
- package/dist/{copilotkit-DNYSFuz5.mjs → copilotkit-DeOzjPsb.mjs} +157 -93
- package/dist/copilotkit-DeOzjPsb.mjs.map +1 -0
- package/dist/{copilotkit-DBzgOMby.d.cts → copilotkit-l-IBF4Xp.d.cts} +3 -1
- package/dist/{copilotkit-DBzgOMby.d.cts.map → copilotkit-l-IBF4Xp.d.cts.map} +1 -1
- package/dist/index.cjs +9 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +9 -4
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +160 -94
- 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 +160 -94
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +6 -6
- package/src/components/copilot-provider/__tests__/copilot-messages-key.test.tsx +92 -0
- package/src/components/copilot-provider/copilotkit.tsx +3 -3
- package/src/hooks/__tests__/use-copilot-chat-internal-connect.test.tsx +27 -16
- package/src/hooks/use-copilot-chat_internal.ts +15 -4
- package/src/v2/__tests__/utils/test-helpers.tsx +40 -7
- package/src/v2/components/chat/CopilotChat.tsx +4 -2
- package/src/v2/components/chat/CopilotChatMessageView.tsx +7 -2
- package/src/v2/components/chat/__tests__/CopilotChatToolRendering.e2e.test.tsx +5 -2
- package/src/v2/components/chat/__tests__/CopilotChatToolRerenders.e2e.test.tsx +5 -2
- package/src/v2/components/chat/__tests__/MCPAppsActivityRenderer.e2e.test.tsx +17 -1
- package/src/v2/hooks/__tests__/use-agent-context-timing.e2e.test.tsx +8 -0
- package/src/v2/hooks/__tests__/use-agent-thread-isolation.test.tsx +327 -0
- package/src/v2/hooks/__tests__/use-agent.e2e.test.tsx +13 -2
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.tsx +23 -4
- package/src/v2/hooks/use-agent.tsx +126 -6
- package/src/v2/hooks/use-render-custom-messages.tsx +6 -1
- package/dist/copilotkit-B3Mb1yVE.cjs.map +0 -1
- package/dist/copilotkit-DNYSFuz5.mjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as CrewsAgentState, Bt as CoagentInChatRenderFunction, Gt as CoAgentStateRender, Ht as CopilotContext, Jt as LangGraphInterruptActionSetterArgs, Kt as LangGraphInterruptAction, Qt as QueuedInterruptEvent, T as useAgent, U as useRenderToolCall$1, Ut as CopilotContextParams, Vt as CopilotApiConfig, Wt as useCopilotContext, Xt as LangGraphInterruptRenderHandlerProps, Yt as LangGraphInterruptRender, Zt as LangGraphInterruptRenderProps, _n as FrontendActionAvailability, an as CopilotChatSuggestionConfiguration, cn as Tree, dn as ActionRenderPropsNoArgs, en as CrewsResponse, fn as ActionRenderPropsNoArgsWait, gn as FrontendAction, hn as CatchAllFrontendAction, in as CrewsToolStateItem, ln as TreeNode, mn as CatchAllActionRenderProps, n as defaultCopilotContextCategories, nn as CrewsStateItem, on as SystemMessageFunction, pn as ActionRenderPropsWait, qt as LangGraphInterruptActionSetter, r as CopilotKitProps, rn as CrewsTaskStateItem, sn as DocumentPointer, t as CopilotKit, tn as CrewsResponseStatus, un as ActionRenderProps, vn as RenderFunctionStatus } from "./copilotkit-
|
|
1
|
+
import { $t as CrewsAgentState, Bt as CoagentInChatRenderFunction, Gt as CoAgentStateRender, Ht as CopilotContext, Jt as LangGraphInterruptActionSetterArgs, Kt as LangGraphInterruptAction, Qt as QueuedInterruptEvent, T as useAgent, U as useRenderToolCall$1, Ut as CopilotContextParams, Vt as CopilotApiConfig, Wt as useCopilotContext, Xt as LangGraphInterruptRenderHandlerProps, Yt as LangGraphInterruptRender, Zt as LangGraphInterruptRenderProps, _n as FrontendActionAvailability, an as CopilotChatSuggestionConfiguration, cn as Tree, dn as ActionRenderPropsNoArgs, en as CrewsResponse, fn as ActionRenderPropsNoArgsWait, gn as FrontendAction, hn as CatchAllFrontendAction, in as CrewsToolStateItem, ln as TreeNode, mn as CatchAllActionRenderProps, n as defaultCopilotContextCategories, nn as CrewsStateItem, on as SystemMessageFunction, pn as ActionRenderPropsWait, qt as LangGraphInterruptActionSetter, r as CopilotKitProps, rn as CrewsTaskStateItem, sn as DocumentPointer, t as CopilotKit, tn as CrewsResponseStatus, un as ActionRenderProps, vn as RenderFunctionStatus } from "./copilotkit-l-IBF4Xp.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 { $t as CrewsAgentState, Bt as CoagentInChatRenderFunction, Gt as CoAgentStateRender, Ht as CopilotContext, Jt as LangGraphInterruptActionSetterArgs, Kt as LangGraphInterruptAction, Qt as QueuedInterruptEvent, T as useAgent, U as useRenderToolCall$1, Ut as CopilotContextParams, Vt as CopilotApiConfig, Wt as useCopilotContext, Xt as LangGraphInterruptRenderHandlerProps, Yt as LangGraphInterruptRender, Zt as LangGraphInterruptRenderProps, _n as FrontendActionAvailability, an as CopilotChatSuggestionConfiguration, cn as Tree, dn as ActionRenderPropsNoArgs, en as CrewsResponse, fn as ActionRenderPropsNoArgsWait, gn as FrontendAction, hn as CatchAllFrontendAction, in as CrewsToolStateItem, ln as TreeNode, mn as CatchAllActionRenderProps, n as defaultCopilotContextCategories, nn as CrewsStateItem, on as SystemMessageFunction, pn as ActionRenderPropsWait, qt as LangGraphInterruptActionSetter, r as CopilotKitProps, rn as CrewsTaskStateItem, sn as DocumentPointer, t as CopilotKit, tn as CrewsResponseStatus, un as ActionRenderProps, vn as RenderFunctionStatus } from "./copilotkit-
|
|
1
|
+
import { $t as CrewsAgentState, Bt as CoagentInChatRenderFunction, Gt as CoAgentStateRender, Ht as CopilotContext, Jt as LangGraphInterruptActionSetterArgs, Kt as LangGraphInterruptAction, Qt as QueuedInterruptEvent, T as useAgent, U as useRenderToolCall$1, Ut as CopilotContextParams, Vt as CopilotApiConfig, Wt as useCopilotContext, Xt as LangGraphInterruptRenderHandlerProps, Yt as LangGraphInterruptRender, Zt as LangGraphInterruptRenderProps, _n as FrontendActionAvailability, an as CopilotChatSuggestionConfiguration, cn as Tree, dn as ActionRenderPropsNoArgs, en as CrewsResponse, fn as ActionRenderPropsNoArgsWait, gn as FrontendAction, hn as CatchAllFrontendAction, in as CrewsToolStateItem, ln as TreeNode, mn as CatchAllActionRenderProps, n as defaultCopilotContextCategories, nn as CrewsStateItem, on as SystemMessageFunction, pn as ActionRenderPropsWait, qt as LangGraphInterruptActionSetter, r as CopilotKitProps, rn as CrewsTaskStateItem, sn as DocumentPointer, t as CopilotKit, tn as CrewsResponseStatus, un as ActionRenderProps, vn as RenderFunctionStatus } from "./copilotkit-BqcyhQjT.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 {
|
|
3
|
+
import { B as useHumanInTheLoop$1, G as useFrontendTool$1, I as useInterrupt, L as useConfigureSuggestions, Q as useCopilotKit, R as useSuggestions, U as defineToolCallRenderer, X as useRenderToolCall$1, Y as useAgent, a as ThreadsProvider, c as CoAgentStateRendersProvider, d as shouldShowDevConsole, f as useToast, g as useCopilotContext, h as CopilotContext, i as ThreadsContext, l as useCoAgentStateRenders, lt as useCopilotChatConfiguration, m as useCopilotMessagesContext, n as defaultCopilotContextCategories, o as useThreads, p as CopilotMessagesContext, q as useRenderCustomMessages, r as CoAgentStateRenderBridge, s as CoAgentStateRendersContext, t as CopilotKit, u as useAsyncCallback } from "./copilotkit-DeOzjPsb.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,7 +40,11 @@ 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({
|
|
43
|
+
const { agent } = useAgent({
|
|
44
|
+
agentId: resolvedAgentId,
|
|
45
|
+
threadId: existingConfig?.threadId
|
|
46
|
+
});
|
|
47
|
+
const lastConnectedAgentRef = useRef(null);
|
|
44
48
|
useEffect(() => {
|
|
45
49
|
let detached = false;
|
|
46
50
|
const connectAbortController = new AbortController();
|
|
@@ -55,11 +59,12 @@ function useCopilotChatInternal({ suggestions, onInProgress, onSubmitMessage, on
|
|
|
55
59
|
if (error instanceof AGUIConnectNotImplementedError) {} else console.error("CopilotChat: connectAgent failed", error);
|
|
56
60
|
}
|
|
57
61
|
};
|
|
58
|
-
if (agent &&
|
|
59
|
-
|
|
62
|
+
if (agent && agent !== lastConnectedAgentRef.current && copilotkit.runtimeConnectionStatus === CopilotKitCoreRuntimeConnectionStatus.Connected) {
|
|
63
|
+
lastConnectedAgentRef.current = agent;
|
|
60
64
|
connect(agent);
|
|
61
65
|
}
|
|
62
66
|
return () => {
|
|
67
|
+
lastConnectedAgentRef.current = null;
|
|
63
68
|
detached = true;
|
|
64
69
|
connectAbortController.abort();
|
|
65
70
|
agent?.detachActiveRun();
|