@copilotkit/react-core 1.62.3 → 1.63.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-BfFY1fzd.d.cts → copilotkit-BHs-vx6l.d.cts} +134 -2
- package/dist/copilotkit-BHs-vx6l.d.cts.map +1 -0
- package/dist/{copilotkit-ympAovXs.mjs → copilotkit-BLh58_Tt.mjs} +40 -3
- package/dist/copilotkit-BLh58_Tt.mjs.map +1 -0
- package/dist/{copilotkit-Bp6BD8xe.d.mts → copilotkit-CN_LykOC.d.mts} +134 -2
- package/dist/copilotkit-CN_LykOC.d.mts.map +1 -0
- package/dist/{copilotkit-5MptLWNR.cjs → copilotkit-nu7NwzH6.cjs} +75 -2
- package/dist/copilotkit-nu7NwzH6.cjs.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 +38 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/headless.d.mts +1 -1
- package/dist/v2/index.cjs +7 -1
- package/dist/v2/index.css +1 -1
- package/dist/v2/index.d.cts +2 -3
- package/dist/v2/index.d.mts +2 -3
- package/dist/v2/index.mjs +2 -2
- package/dist/v2/index.umd.js +44 -1
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +8 -8
- package/dist/copilotkit-5MptLWNR.cjs.map +0 -1
- package/dist/copilotkit-BfFY1fzd.d.cts.map +0 -1
- package/dist/copilotkit-Bp6BD8xe.d.mts.map +0 -1
- package/dist/copilotkit-ympAovXs.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-
|
|
4
|
+
const require_copilotkit = require('./copilotkit-nu7NwzH6.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 { $n as
|
|
1
|
+
import { $n as LangGraphInterruptRender, Gn as CopilotApiConfig, Jn as useCopilotContext, Kn as CopilotContext, Qn as LangGraphInterruptActionSetterArgs, Sr as RenderFunctionStatus, Wn as CoagentInChatRenderFunction, Xn as LangGraphInterruptAction, Y as useAgent, Yn as CoAgentStateRender, Zn as LangGraphInterruptActionSetter, _r as ActionRenderPropsWait, ar as CrewsResponseStatus, br as FrontendAction, cr as CrewsToolStateItem, dr as DocumentPointer, er as LangGraphInterruptRenderHandlerProps, fr as Tree, gr as ActionRenderPropsNoArgsWait, hr as ActionRenderPropsNoArgs, ir as CrewsResponse, lr as CopilotChatSuggestionConfiguration, mr as ActionRenderProps, n as defaultCopilotContextCategories, nr as QueuedInterruptEvent, or as CrewsStateItem, pr as TreeNode, qn as CopilotContextParams, r as CopilotKitProps, rr as CrewsAgentState, sr as CrewsTaskStateItem, t as CopilotKit, tr as LangGraphInterruptRenderProps, ur as SystemMessageFunction, vr as CatchAllActionRenderProps, vt as useRenderToolCall$1, xr as FrontendActionAvailability, yr as CatchAllFrontendAction } from "./copilotkit-BHs-vx6l.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 { $n as
|
|
1
|
+
import { $n as LangGraphInterruptRender, Gn as CopilotApiConfig, Jn as useCopilotContext, Kn as CopilotContext, Qn as LangGraphInterruptActionSetterArgs, Sr as RenderFunctionStatus, Wn as CoagentInChatRenderFunction, Xn as LangGraphInterruptAction, Y as useAgent, Yn as CoAgentStateRender, Zn as LangGraphInterruptActionSetter, _r as ActionRenderPropsWait, ar as CrewsResponseStatus, br as FrontendAction, cr as CrewsToolStateItem, dr as DocumentPointer, er as LangGraphInterruptRenderHandlerProps, fr as Tree, gr as ActionRenderPropsNoArgsWait, hr as ActionRenderPropsNoArgs, ir as CrewsResponse, lr as CopilotChatSuggestionConfiguration, mr as ActionRenderProps, n as defaultCopilotContextCategories, nr as QueuedInterruptEvent, or as CrewsStateItem, pr as TreeNode, qn as CopilotContextParams, r as CopilotKitProps, rr as CrewsAgentState, sr as CrewsTaskStateItem, t as CopilotKit, tr as LangGraphInterruptRenderProps, ur as SystemMessageFunction, vr as CatchAllActionRenderProps, vt as useRenderToolCall$1, xr as FrontendActionAvailability, yr as CatchAllFrontendAction } from "./copilotkit-CN_LykOC.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 { Tt as
|
|
3
|
+
import { Tt as useCopilotKit, X as useConfigureSuggestions, Y as useInterrupt, Z as useSuggestions, a as ThreadsProvider, c as CoAgentStateRendersProvider, ct as useRenderCustomMessages, d as shouldShowDevConsole, f as useToast, g as useCopilotContext, h as CopilotContext, i as ThreadsContext, jt as useCopilotChatConfiguration, l as useCoAgentStateRenders, m as useCopilotMessagesContext, n as defaultCopilotContextCategories, nt as useHumanInTheLoop$1, o as useThreads, ot as useFrontendTool$1, p as CopilotMessagesContext, r as CoAgentStateRenderBridge, s as CoAgentStateRendersContext, t as CopilotKit, tt as useAgent, u as useAsyncCallback, ut as defineToolCallRenderer, wt as useRenderToolCall$1 } from "./copilotkit-BLh58_Tt.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
|
@@ -677,6 +677,34 @@ react_markdown = __toESM(react_markdown);
|
|
|
677
677
|
|
|
678
678
|
//#endregion
|
|
679
679
|
//#region src/v2/components/MCPAppsActivityRenderer.tsx
|
|
680
|
+
/**
|
|
681
|
+
* Run an MCP app `ui/message` follow-up, scoped to the thread it was enqueued
|
|
682
|
+
* for (issue #5819).
|
|
683
|
+
*
|
|
684
|
+
* The MCP request queue delays follow-up work until the agent is idle. There is
|
|
685
|
+
* a single shared registry agent per id, and switching threads overwrites its
|
|
686
|
+
* `threadId`/`messages` in place. So if the host switches threads while a
|
|
687
|
+
* follow-up is queued, running it now would execute against — and stream into —
|
|
688
|
+
* the now-foreground thread.
|
|
689
|
+
*
|
|
690
|
+
* - **Same thread** (the common case): run on the shared agent, unchanged.
|
|
691
|
+
* - **Thread changed**: the shared agent has moved on, so the follow-up can no
|
|
692
|
+
* longer run in its originating thread's context. Drop it rather than leak it
|
|
693
|
+
* into the current thread. (The MCP app already received its `ui/message` ack
|
|
694
|
+
* at enqueue time; only the optional agent turn is skipped.)
|
|
695
|
+
*
|
|
696
|
+
* @internal exported for testing.
|
|
697
|
+
*/
|
|
698
|
+
async function ɵrunMcpFollowUp({ host, agent, capturedThreadId }) {
|
|
699
|
+
const currentThreadId = agent.threadId || "default";
|
|
700
|
+
const originThreadId = capturedThreadId || "default";
|
|
701
|
+
if (currentThreadId === originThreadId) return host.runAgent({ agent });
|
|
702
|
+
console.warn(`[MCPAppsRenderer] ui/message follow-up dropped: the thread changed (${originThreadId} → ${currentThreadId}) between enqueue and execution, so running it would leak into the now-foreground thread.`);
|
|
703
|
+
return {
|
|
704
|
+
result: void 0,
|
|
705
|
+
newMessages: []
|
|
706
|
+
};
|
|
707
|
+
}
|
|
680
708
|
const PROTOCOL_VERSION = "2025-06-18";
|
|
681
709
|
function buildSandboxHTML(extraCspDomains) {
|
|
682
710
|
const baseScriptSrc = "'self' 'wasm-unsafe-eval' 'unsafe-inline' 'unsafe-eval' blob: data: http://localhost:* https://localhost:*";
|
|
@@ -999,7 +1027,14 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
999
1027
|
content: textContent
|
|
1000
1028
|
});
|
|
1001
1029
|
sendResponse(msg.id, { isError: false });
|
|
1002
|
-
if ((params.followUp ?? role === "user") && textContent)
|
|
1030
|
+
if ((params.followUp ?? role === "user") && textContent) {
|
|
1031
|
+
const capturedThreadId = currentAgent.threadId || "default";
|
|
1032
|
+
mcpAppsRequestQueue.enqueue(currentAgent, () => ɵrunMcpFollowUp({
|
|
1033
|
+
host: copilotkit,
|
|
1034
|
+
agent: currentAgent,
|
|
1035
|
+
capturedThreadId
|
|
1036
|
+
})).catch((err) => console.error("[MCPAppsRenderer] ui/message agent run failed:", err));
|
|
1037
|
+
}
|
|
1003
1038
|
} catch (err) {
|
|
1004
1039
|
console.error("[MCPAppsRenderer] ui/message error:", err);
|
|
1005
1040
|
sendResponse(msg.id, { isError: true });
|
|
@@ -2482,6 +2517,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2482
2517
|
if (copilotkitRef.current === null) {
|
|
2483
2518
|
copilotkitRef.current = new CopilotKitCoreReact({
|
|
2484
2519
|
runtimeUrl: chatApiEndpoint,
|
|
2520
|
+
deferInitialConnection: true,
|
|
2485
2521
|
runtimeTransport: useSingleEndpoint === true ? "single" : useSingleEndpoint === false ? "rest" : "auto",
|
|
2486
2522
|
headers: mergedHeaders,
|
|
2487
2523
|
credentials,
|
|
@@ -2565,6 +2601,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2565
2601
|
} : properties);
|
|
2566
2602
|
copilotkit.setAgents__unsafe_dev_only(mergedAgents);
|
|
2567
2603
|
copilotkit.setDebug(debug);
|
|
2604
|
+
copilotkit.connect();
|
|
2568
2605
|
}, [
|
|
2569
2606
|
copilotkit,
|
|
2570
2607
|
chatApiEndpoint,
|