@copilotkit/react-core 1.62.3 → 1.63.1
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/v2/index.umd.js
CHANGED
|
@@ -1815,6 +1815,34 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
1815
1815
|
|
|
1816
1816
|
//#endregion
|
|
1817
1817
|
//#region src/v2/components/MCPAppsActivityRenderer.tsx
|
|
1818
|
+
/**
|
|
1819
|
+
* Run an MCP app `ui/message` follow-up, scoped to the thread it was enqueued
|
|
1820
|
+
* for (issue #5819).
|
|
1821
|
+
*
|
|
1822
|
+
* The MCP request queue delays follow-up work until the agent is idle. There is
|
|
1823
|
+
* a single shared registry agent per id, and switching threads overwrites its
|
|
1824
|
+
* `threadId`/`messages` in place. So if the host switches threads while a
|
|
1825
|
+
* follow-up is queued, running it now would execute against — and stream into —
|
|
1826
|
+
* the now-foreground thread.
|
|
1827
|
+
*
|
|
1828
|
+
* - **Same thread** (the common case): run on the shared agent, unchanged.
|
|
1829
|
+
* - **Thread changed**: the shared agent has moved on, so the follow-up can no
|
|
1830
|
+
* longer run in its originating thread's context. Drop it rather than leak it
|
|
1831
|
+
* into the current thread. (The MCP app already received its `ui/message` ack
|
|
1832
|
+
* at enqueue time; only the optional agent turn is skipped.)
|
|
1833
|
+
*
|
|
1834
|
+
* @internal exported for testing.
|
|
1835
|
+
*/
|
|
1836
|
+
async function ɵrunMcpFollowUp({ host, agent, capturedThreadId }) {
|
|
1837
|
+
const currentThreadId = agent.threadId || "default";
|
|
1838
|
+
const originThreadId = capturedThreadId || "default";
|
|
1839
|
+
if (currentThreadId === originThreadId) return host.runAgent({ agent });
|
|
1840
|
+
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.`);
|
|
1841
|
+
return {
|
|
1842
|
+
result: void 0,
|
|
1843
|
+
newMessages: []
|
|
1844
|
+
};
|
|
1845
|
+
}
|
|
1818
1846
|
const PROTOCOL_VERSION = "2025-06-18";
|
|
1819
1847
|
function buildSandboxHTML(extraCspDomains) {
|
|
1820
1848
|
const baseScriptSrc = "'self' 'wasm-unsafe-eval' 'unsafe-inline' 'unsafe-eval' blob: data: http://localhost:* https://localhost:*";
|
|
@@ -2137,7 +2165,14 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2137
2165
|
content: textContent
|
|
2138
2166
|
});
|
|
2139
2167
|
sendResponse(msg.id, { isError: false });
|
|
2140
|
-
if ((params.followUp ?? role === "user") && textContent)
|
|
2168
|
+
if ((params.followUp ?? role === "user") && textContent) {
|
|
2169
|
+
const capturedThreadId = currentAgent.threadId || "default";
|
|
2170
|
+
mcpAppsRequestQueue.enqueue(currentAgent, () => ɵrunMcpFollowUp({
|
|
2171
|
+
host: copilotkit,
|
|
2172
|
+
agent: currentAgent,
|
|
2173
|
+
capturedThreadId
|
|
2174
|
+
})).catch((err) => console.error("[MCPAppsRenderer] ui/message agent run failed:", err));
|
|
2175
|
+
}
|
|
2141
2176
|
} catch (err) {
|
|
2142
2177
|
console.error("[MCPAppsRenderer] ui/message error:", err);
|
|
2143
2178
|
sendResponse(msg.id, { isError: true });
|
|
@@ -3620,6 +3655,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3620
3655
|
if (copilotkitRef.current === null) {
|
|
3621
3656
|
copilotkitRef.current = new CopilotKitCoreReact({
|
|
3622
3657
|
runtimeUrl: chatApiEndpoint,
|
|
3658
|
+
deferInitialConnection: true,
|
|
3623
3659
|
runtimeTransport: useSingleEndpoint === true ? "single" : useSingleEndpoint === false ? "rest" : "auto",
|
|
3624
3660
|
headers: mergedHeaders,
|
|
3625
3661
|
credentials,
|
|
@@ -3703,6 +3739,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3703
3739
|
} : properties);
|
|
3704
3740
|
copilotkit.setAgents__unsafe_dev_only(mergedAgents);
|
|
3705
3741
|
copilotkit.setDebug(debug);
|
|
3742
|
+
copilotkit.connect();
|
|
3706
3743
|
}, [
|
|
3707
3744
|
copilotkit,
|
|
3708
3745
|
chatApiEndpoint,
|
|
@@ -11514,12 +11551,17 @@ Object.defineProperty(exports, 'CopilotSidebarView', {
|
|
|
11514
11551
|
}
|
|
11515
11552
|
});
|
|
11516
11553
|
exports.CopilotThreadsDrawer = CopilotThreadsDrawer;
|
|
11554
|
+
exports.GenerateSandboxedUiArgsSchema = GenerateSandboxedUiArgsSchema;
|
|
11517
11555
|
exports.INTELLIGENCE_TURN_HEAD = INTELLIGENCE_TURN_HEAD;
|
|
11518
11556
|
exports.IntelligenceIndicator = IntelligenceIndicator;
|
|
11519
11557
|
exports.IntelligenceIndicatorView = IntelligenceIndicatorView;
|
|
11520
11558
|
exports.MCPAppsActivityContentSchema = MCPAppsActivityContentSchema;
|
|
11521
11559
|
exports.MCPAppsActivityRenderer = MCPAppsActivityRenderer;
|
|
11522
11560
|
exports.MCPAppsActivityType = MCPAppsActivityType;
|
|
11561
|
+
exports.OpenGenerativeUIActivityRenderer = OpenGenerativeUIActivityRenderer;
|
|
11562
|
+
exports.OpenGenerativeUIActivityType = OpenGenerativeUIActivityType;
|
|
11563
|
+
exports.OpenGenerativeUIContentSchema = OpenGenerativeUIContentSchema;
|
|
11564
|
+
exports.OpenGenerativeUIToolRenderer = OpenGenerativeUIToolRenderer;
|
|
11523
11565
|
exports.SandboxFunctionsContext = SandboxFunctionsContext;
|
|
11524
11566
|
exports.UseAgentUpdate = UseAgentUpdate;
|
|
11525
11567
|
exports.WildcardToolCallRender = WildcardToolCallRender;
|
|
@@ -11556,6 +11598,7 @@ exports.useRenderToolCall = useRenderToolCall;
|
|
|
11556
11598
|
exports.useSandboxFunctions = useSandboxFunctions;
|
|
11557
11599
|
exports.useSuggestions = useSuggestions;
|
|
11558
11600
|
exports.useThreads = useThreads;
|
|
11601
|
+
exports.ɵrunMcpFollowUp = ɵrunMcpFollowUp;
|
|
11559
11602
|
Object.keys(_copilotkit_core).forEach(function (k) {
|
|
11560
11603
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
11561
11604
|
enumerable: true,
|