@copilotkit/react-core 1.62.1 → 1.62.2-canary.1784333495
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-Cga6AHO0.d.cts → copilotkit-C-k8T6fY.d.cts} +183 -6
- package/dist/copilotkit-C-k8T6fY.d.cts.map +1 -0
- package/dist/{copilotkit-DnLpJ2Cl.d.mts → copilotkit-D6Wy_7iY.d.mts} +183 -6
- package/dist/copilotkit-D6Wy_7iY.d.mts.map +1 -0
- package/dist/{copilotkit-CdpDZi3i.cjs → copilotkit-DLwoVUsE.cjs} +421 -31
- package/dist/copilotkit-DLwoVUsE.cjs.map +1 -0
- package/dist/{copilotkit-BtRkFsNR.mjs → copilotkit-dtSVHJCs.mjs} +411 -33
- package/dist/copilotkit-dtSVHJCs.mjs.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 +28 -17
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/headless.cjs +18 -14
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.d.cts +16 -2
- package/dist/v2/headless.d.cts.map +1 -1
- package/dist/v2/headless.d.mts +16 -2
- package/dist/v2/headless.d.mts.map +1 -1
- package/dist/v2/headless.mjs +19 -15
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +3 -1
- package/dist/v2/index.d.cts +2 -2
- package/dist/v2/index.d.mts +2 -2
- package/dist/v2/index.mjs +2 -2
- package/dist/v2/index.umd.js +410 -30
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +9 -9
- package/dist/copilotkit-BtRkFsNR.mjs.map +0 -1
- package/dist/copilotkit-CdpDZi3i.cjs.map +0 -1
- package/dist/copilotkit-Cga6AHO0.d.cts.map +0 -1
- package/dist/copilotkit-DnLpJ2Cl.d.mts.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-DLwoVUsE.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 CrewsResponseStatus, Bn as CopilotContext, Gn as LangGraphInterruptActionSetter, Hn as useCopilotContext, Jn as LangGraphInterruptRenderHandlerProps, Kn as LangGraphInterruptActionSetterArgs, Q as useAgent, Qn as CrewsResponse, Rn as CoagentInChatRenderFunction, Un as CoAgentStateRender, Vn as CopilotContextParams, Wn as LangGraphInterruptAction, Xn as QueuedInterruptEvent, Yn as LangGraphInterruptRenderProps, Zn as CrewsAgentState, ar as DocumentPointer, cr as ActionRenderProps, dr as ActionRenderPropsWait, er as CrewsStateItem, fr as CatchAllActionRenderProps, gr as RenderFunctionStatus, hr as FrontendActionAvailability, ir as SystemMessageFunction, lr as ActionRenderPropsNoArgs, mr as FrontendAction, n as defaultCopilotContextCategories, nr as CrewsToolStateItem, or as Tree, pr as CatchAllFrontendAction, qn as LangGraphInterruptRender, r as CopilotKitProps, rr as CopilotChatSuggestionConfiguration, sr as TreeNode, t as CopilotKit, tr as CrewsTaskStateItem, ur as ActionRenderPropsNoArgsWait, xt as useRenderToolCall$1, zn as CopilotApiConfig } from "./copilotkit-C-k8T6fY.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 CrewsResponseStatus, Bn as CopilotContext, Gn as LangGraphInterruptActionSetter, Hn as useCopilotContext, Jn as LangGraphInterruptRenderHandlerProps, Kn as LangGraphInterruptActionSetterArgs, Q as useAgent, Qn as CrewsResponse, Rn as CoagentInChatRenderFunction, Un as CoAgentStateRender, Vn as CopilotContextParams, Wn as LangGraphInterruptAction, Xn as QueuedInterruptEvent, Yn as LangGraphInterruptRenderProps, Zn as CrewsAgentState, ar as DocumentPointer, cr as ActionRenderProps, dr as ActionRenderPropsWait, er as CrewsStateItem, fr as CatchAllActionRenderProps, gr as RenderFunctionStatus, hr as FrontendActionAvailability, ir as SystemMessageFunction, lr as ActionRenderPropsNoArgs, mr as FrontendAction, n as defaultCopilotContextCategories, nr as CrewsToolStateItem, or as Tree, pr as CatchAllFrontendAction, qn as LangGraphInterruptRender, r as CopilotKitProps, rr as CopilotChatSuggestionConfiguration, sr as TreeNode, t as CopilotKit, tr as CrewsTaskStateItem, ur as ActionRenderPropsNoArgsWait, xt as useRenderToolCall$1, zn as CopilotApiConfig } from "./copilotkit-D6Wy_7iY.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 { Et as useCopilotChatConfiguration, X as useConfigureSuggestions, Y as useInterrupt, Z as useSuggestions, a as ThreadsProvider, bt as useCopilotKit, c as CoAgentStateRendersProvider, d as shouldShowDevConsole, dt as defineToolCallRenderer, f as useToast, g as useCopilotContext, h as CopilotContext, i as ThreadsContext, l as useCoAgentStateRenders, lt as useRenderCustomMessages, m as useCopilotMessagesContext, n as defaultCopilotContextCategories, nt as useAgent, o as useThreads, p as CopilotMessagesContext, r as CoAgentStateRenderBridge, rt as useHumanInTheLoop$1, s as CoAgentStateRendersContext, st as useFrontendTool$1, t as CopilotKit, u as useAsyncCallback, yt as useRenderToolCall$1 } from "./copilotkit-dtSVHJCs.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
|
@@ -2497,12 +2497,13 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2497
2497
|
}
|
|
2498
2498
|
const copilotkit = copilotkitRef.current;
|
|
2499
2499
|
(0, react.useEffect)(() => {
|
|
2500
|
-
|
|
2501
|
-
const subscription = copilotkit.subscribe({ onRuntimeConnectionStatusChanged: () => {
|
|
2500
|
+
const syncRuntimeInfo = () => {
|
|
2502
2501
|
setRuntimeA2UIEnabled(copilotkit.a2uiEnabled);
|
|
2503
2502
|
setRuntimeOpenGenUIEnabled(copilotkit.openGenerativeUIEnabled);
|
|
2504
2503
|
setRuntimeLicenseStatus(copilotkit.licenseStatus);
|
|
2505
|
-
}
|
|
2504
|
+
};
|
|
2505
|
+
const subscription = copilotkit.subscribe({ onRuntimeConnectionStatusChanged: syncRuntimeInfo });
|
|
2506
|
+
syncRuntimeInfo();
|
|
2506
2507
|
return () => {
|
|
2507
2508
|
subscription.unsubscribe();
|
|
2508
2509
|
};
|
|
@@ -2848,57 +2849,58 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2848
2849
|
UseAgentUpdate.OnRunStatusChanged
|
|
2849
2850
|
];
|
|
2850
2851
|
function useAgent({ agentId, updates, throttleMs } = {}) {
|
|
2851
|
-
|
|
2852
|
+
const chatConfig = useCopilotChatConfiguration();
|
|
2853
|
+
const resolvedAgentId = agentId ?? chatConfig?.agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
|
|
2852
2854
|
const { copilotkit } = useCopilotKit();
|
|
2853
2855
|
const providerThrottleMs = copilotkit.defaultThrottleMs;
|
|
2854
2856
|
const [, forceUpdate] = (0, react.useReducer)((x) => x + 1, 0);
|
|
2855
2857
|
const updateFlags = (0, react.useMemo)(() => updates ?? ALL_UPDATES, [JSON.stringify(updates)]);
|
|
2856
2858
|
const provisionalAgentCache = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
2857
2859
|
const agent = (0, react.useMemo)(() => {
|
|
2858
|
-
const existing = copilotkit.getAgent(
|
|
2860
|
+
const existing = copilotkit.getAgent(resolvedAgentId);
|
|
2859
2861
|
if (existing) {
|
|
2860
|
-
provisionalAgentCache.current.delete(
|
|
2862
|
+
provisionalAgentCache.current.delete(resolvedAgentId);
|
|
2861
2863
|
return existing;
|
|
2862
2864
|
}
|
|
2863
2865
|
const isRuntimeConfigured = copilotkit.runtimeUrl !== void 0;
|
|
2864
2866
|
const status = copilotkit.runtimeConnectionStatus;
|
|
2865
2867
|
if (isRuntimeConfigured && (status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Disconnected || status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Connecting)) {
|
|
2866
|
-
const cached = provisionalAgentCache.current.get(
|
|
2868
|
+
const cached = provisionalAgentCache.current.get(resolvedAgentId);
|
|
2867
2869
|
if (cached) {
|
|
2868
2870
|
copilotkit.applyHeadersToAgent(cached);
|
|
2869
2871
|
return cached;
|
|
2870
2872
|
}
|
|
2871
2873
|
const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
|
|
2872
2874
|
runtimeUrl: copilotkit.runtimeUrl,
|
|
2873
|
-
agentId,
|
|
2875
|
+
agentId: resolvedAgentId,
|
|
2874
2876
|
transport: copilotkit.runtimeTransport,
|
|
2875
2877
|
runtimeMode: "pending"
|
|
2876
2878
|
});
|
|
2877
2879
|
copilotkit.applyHeadersToAgent(provisional);
|
|
2878
|
-
provisionalAgentCache.current.set(
|
|
2880
|
+
provisionalAgentCache.current.set(resolvedAgentId, provisional);
|
|
2879
2881
|
return provisional;
|
|
2880
2882
|
}
|
|
2881
2883
|
if (isRuntimeConfigured && status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Error) {
|
|
2882
|
-
const cached = provisionalAgentCache.current.get(
|
|
2884
|
+
const cached = provisionalAgentCache.current.get(resolvedAgentId);
|
|
2883
2885
|
if (cached) {
|
|
2884
2886
|
copilotkit.applyHeadersToAgent(cached);
|
|
2885
2887
|
return cached;
|
|
2886
2888
|
}
|
|
2887
2889
|
const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
|
|
2888
2890
|
runtimeUrl: copilotkit.runtimeUrl,
|
|
2889
|
-
agentId,
|
|
2891
|
+
agentId: resolvedAgentId,
|
|
2890
2892
|
transport: copilotkit.runtimeTransport,
|
|
2891
2893
|
runtimeMode: "pending"
|
|
2892
2894
|
});
|
|
2893
2895
|
copilotkit.applyHeadersToAgent(provisional);
|
|
2894
|
-
provisionalAgentCache.current.set(
|
|
2896
|
+
provisionalAgentCache.current.set(resolvedAgentId, provisional);
|
|
2895
2897
|
return provisional;
|
|
2896
2898
|
}
|
|
2897
2899
|
const knownAgents = Object.keys(copilotkit.agents ?? {});
|
|
2898
2900
|
const runtimePart = isRuntimeConfigured ? `runtimeUrl=${copilotkit.runtimeUrl}` : "no runtimeUrl";
|
|
2899
|
-
throw new Error(`useAgent: Agent '${
|
|
2901
|
+
throw new Error(`useAgent: Agent '${resolvedAgentId}' not found after runtime sync (${runtimePart}). ` + (knownAgents.length ? `Known agents: [${knownAgents.join(", ")}]` : "No agents registered.") + " Verify your runtime /info and/or agents__unsafe_dev_only.");
|
|
2900
2902
|
}, [
|
|
2901
|
-
|
|
2903
|
+
resolvedAgentId,
|
|
2902
2904
|
copilotkit.agents,
|
|
2903
2905
|
copilotkit.runtimeConnectionStatus,
|
|
2904
2906
|
copilotkit.runtimeUrl,
|
|
@@ -2943,7 +2945,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2943
2945
|
(0, react.useEffect)(() => {
|
|
2944
2946
|
if (agent instanceof _ag_ui_client.HttpAgent) copilotkit.applyHeadersToAgent(agent);
|
|
2945
2947
|
}, [agent, JSON.stringify(copilotkit.headers)]);
|
|
2946
|
-
const chatConfig = useCopilotChatConfiguration();
|
|
2947
2948
|
const configThreadId = chatConfig?.threadId;
|
|
2948
2949
|
const configHasExplicitThreadId = chatConfig?.hasExplicitThreadId;
|
|
2949
2950
|
(0, react.useEffect)(() => {
|
|
@@ -5030,8 +5031,18 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5030
5031
|
}, [agent, getSubscriber]);
|
|
5031
5032
|
};
|
|
5032
5033
|
function CopilotListenersAgentSubscription() {
|
|
5033
|
-
const
|
|
5034
|
-
const
|
|
5034
|
+
const { copilotkit } = useCopilotKit();
|
|
5035
|
+
const configAgentId = useCopilotChatConfiguration()?.agentId;
|
|
5036
|
+
const { agent } = useAgent({ agentId: (0, react.useMemo)(() => {
|
|
5037
|
+
const requested = configAgentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
|
|
5038
|
+
const registered = copilotkit.agents ?? {};
|
|
5039
|
+
if (registered[requested]) return requested;
|
|
5040
|
+
if (requested === _copilotkit_shared.DEFAULT_AGENT_ID) {
|
|
5041
|
+
const firstRegistered = Object.keys(registered)[0];
|
|
5042
|
+
if (firstRegistered) return firstRegistered;
|
|
5043
|
+
}
|
|
5044
|
+
return requested;
|
|
5045
|
+
}, [configAgentId, copilotkit.agents]) });
|
|
5035
5046
|
usePredictStateSubscription(agent);
|
|
5036
5047
|
return null;
|
|
5037
5048
|
}
|