@copilotkit/react-core 1.50.0-beta.0 → 1.50.0-beta.10
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 +93 -0
- package/dist/{chunk-UJBV5GAG.mjs → chunk-3775VM7Y.mjs} +32 -65
- package/dist/chunk-3775VM7Y.mjs.map +1 -0
- package/dist/{chunk-3GURHDG7.mjs → chunk-4HRUQH6U.mjs} +3 -3
- package/dist/{chunk-7BYHZLPL.mjs → chunk-4RRMC7L2.mjs} +4 -4
- package/dist/chunk-4RRMC7L2.mjs.map +1 -0
- package/dist/{chunk-D3QSYDJR.mjs → chunk-7IBF6RBW.mjs} +2 -2
- package/dist/{chunk-GMI4KO4X.mjs → chunk-7SHWECGN.mjs} +2 -2
- package/dist/{chunk-OVYFRPSN.mjs → chunk-ABWT4DRT.mjs} +2 -2
- package/dist/{chunk-WVLHXIFP.mjs → chunk-AFNWX62Q.mjs} +2 -2
- package/dist/{chunk-WVLHXIFP.mjs.map → chunk-AFNWX62Q.mjs.map} +1 -1
- package/dist/{chunk-JRT5BJF3.mjs → chunk-B5ELMVT7.mjs} +2 -2
- package/dist/{chunk-TXI72QHK.mjs → chunk-EG56H77V.mjs} +2 -2
- package/dist/{chunk-DCHSCK62.mjs → chunk-FYMZKPOL.mjs} +36 -42
- package/dist/chunk-FYMZKPOL.mjs.map +1 -0
- package/dist/{chunk-FBD24VEH.mjs → chunk-HE22TZMF.mjs} +2 -2
- package/dist/{chunk-FBD24VEH.mjs.map → chunk-HE22TZMF.mjs.map} +1 -1
- package/dist/chunk-I76HKHPJ.mjs +32 -0
- package/dist/chunk-I76HKHPJ.mjs.map +1 -0
- package/dist/{chunk-LHKZJ2ND.mjs → chunk-PMWUKW3Z.mjs} +3 -3
- package/dist/{chunk-NROJOTQP.mjs → chunk-QNUAXSDP.mjs} +9 -6
- package/dist/chunk-QNUAXSDP.mjs.map +1 -0
- package/dist/{chunk-NG26QEGF.mjs → chunk-T2VBHAAP.mjs} +9 -3
- package/dist/chunk-T2VBHAAP.mjs.map +1 -0
- package/dist/{chunk-QU6NONOD.mjs → chunk-U2ZRVVKT.mjs} +2 -2
- package/dist/{chunk-R4MR43UQ.mjs → chunk-VV56AVPB.mjs} +33 -9
- package/dist/chunk-VV56AVPB.mjs.map +1 -0
- package/dist/{chunk-5X5DJRQQ.mjs → chunk-WF65O6HX.mjs} +2 -7
- package/dist/chunk-WF65O6HX.mjs.map +1 -0
- package/dist/chunk-XDFVCQD3.mjs +27 -0
- package/dist/chunk-XDFVCQD3.mjs.map +1 -0
- package/dist/{chunk-WMJVBMUX.mjs → chunk-YCG6SNAU.mjs} +2 -2
- package/dist/{chunk-3R423LZT.mjs → chunk-YJGPIN3R.mjs} +3 -3
- package/dist/{chunk-BR5YEYZJ.mjs → chunk-YTQHRJUA.mjs} +2 -2
- package/dist/chunk-Z6JV2LRY.mjs +37 -0
- package/dist/chunk-Z6JV2LRY.mjs.map +1 -0
- package/dist/{chunk-24SCZAB4.mjs → chunk-ZYTXB6HH.mjs} +22 -14
- package/dist/chunk-ZYTXB6HH.mjs.map +1 -0
- package/dist/components/CopilotListeners.js +13 -146
- package/dist/components/CopilotListeners.js.map +1 -1
- package/dist/components/CopilotListeners.mjs +1 -6
- package/dist/components/copilot-provider/copilot-messages.js +1 -1
- package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
- package/dist/components/copilot-provider/copilot-messages.mjs +2 -2
- package/dist/components/copilot-provider/copilotkit-props.d.ts +1 -1
- package/dist/components/copilot-provider/copilotkit.d.ts +1 -1
- package/dist/components/copilot-provider/copilotkit.js +35 -40
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +9 -9
- package/dist/components/copilot-provider/index.d.ts +1 -1
- package/dist/components/copilot-provider/index.js +35 -40
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +9 -9
- package/dist/components/dev-console/console-trigger.js +1 -1
- package/dist/components/dev-console/console-trigger.js.map +1 -1
- package/dist/components/dev-console/console-trigger.mjs +3 -3
- package/dist/components/dev-console/developer-console-modal.js +1 -1
- package/dist/components/dev-console/developer-console-modal.js.map +1 -1
- package/dist/components/dev-console/developer-console-modal.mjs +2 -2
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +35 -40
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +9 -9
- package/dist/context/copilot-context.d.ts +1 -1
- package/dist/context/copilot-context.js +1 -1
- package/dist/context/copilot-context.js.map +1 -1
- package/dist/context/copilot-context.mjs +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.js +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/{copilot-context-1cd70a3f.d.ts → copilot-context-ec77e921.d.ts} +3 -3
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +254 -219
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +24 -23
- package/dist/hooks/use-agent-nodename.d.ts +3 -0
- package/dist/hooks/use-agent-nodename.js +56 -0
- package/dist/hooks/use-agent-nodename.js.map +1 -0
- package/dist/hooks/use-agent-nodename.mjs +8 -0
- package/dist/hooks/use-coagent-state-render-bridge.js +8 -5
- package/dist/hooks/use-coagent-state-render-bridge.js.map +1 -1
- package/dist/hooks/use-coagent-state-render-bridge.mjs +2 -2
- package/dist/hooks/use-coagent-state-render.js +1 -1
- package/dist/hooks/use-coagent-state-render.js.map +1 -1
- package/dist/hooks/use-coagent-state-render.mjs +2 -2
- package/dist/hooks/use-coagent.js +58 -21
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +2 -1
- package/dist/hooks/use-copilot-action.js +5 -1
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +2 -2
- package/dist/hooks/use-copilot-additional-instructions.js +1 -1
- package/dist/hooks/use-copilot-additional-instructions.js.map +1 -1
- package/dist/hooks/use-copilot-additional-instructions.mjs +2 -2
- package/dist/hooks/use-copilot-authenticated-action.js +6 -2
- package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
- package/dist/hooks/use-copilot-authenticated-action.mjs +4 -4
- package/dist/hooks/use-copilot-chat-headless_c.js +128 -140
- package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
- package/dist/hooks/use-copilot-chat-headless_c.mjs +6 -6
- package/dist/hooks/{use-configure-chat-suggestions.d.ts → use-copilot-chat-suggestions.d.ts} +2 -3
- package/dist/hooks/use-copilot-chat-suggestions.js +60 -0
- package/dist/hooks/use-copilot-chat-suggestions.js.map +1 -0
- package/dist/hooks/use-copilot-chat-suggestions.mjs +8 -0
- package/dist/hooks/use-copilot-chat-suggestions.mjs.map +1 -0
- package/dist/hooks/use-copilot-chat.js +126 -138
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +6 -6
- package/dist/hooks/use-copilot-chat_internal.d.ts +18 -1
- package/dist/hooks/use-copilot-chat_internal.js +126 -138
- package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
- package/dist/hooks/use-copilot-chat_internal.mjs +5 -5
- package/dist/hooks/use-copilot-readable.d.ts +1 -1
- package/dist/hooks/use-copilot-readable.js +29 -5
- package/dist/hooks/use-copilot-readable.js.map +1 -1
- package/dist/hooks/use-copilot-readable.mjs +1 -1
- package/dist/hooks/use-default-tool.js +5 -1
- package/dist/hooks/use-default-tool.js.map +1 -1
- package/dist/hooks/use-default-tool.mjs +3 -3
- package/dist/hooks/use-frontend-tool.js +5 -1
- package/dist/hooks/use-frontend-tool.js.map +1 -1
- package/dist/hooks/use-frontend-tool.mjs +1 -1
- package/dist/hooks/use-langgraph-interrupt-render.js +77 -13
- package/dist/hooks/use-langgraph-interrupt-render.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt-render.mjs +3 -2
- package/dist/hooks/use-langgraph-interrupt.d.ts +1 -1
- package/dist/hooks/use-langgraph-interrupt.js +3 -3
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +2 -2
- package/dist/hooks/use-make-copilot-document-readable.js +1 -1
- package/dist/hooks/use-make-copilot-document-readable.js.map +1 -1
- package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +273 -246
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -33
- package/dist/lib/copilot-task.d.ts +1 -1
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +10 -10
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +10 -10
- package/dist/types/index.d.ts +1 -1
- package/dist/types/interrupt-action.d.ts +1 -1
- package/dist/types/interrupt-action.js.map +1 -1
- package/dist/utils/index.mjs +3 -3
- package/dist/v2/index.css +4 -0
- package/dist/v2/index.css.map +1 -0
- package/dist/v2/index.js.map +1 -1
- package/dist/v2/index.mjs +2 -0
- package/dist/v2/index.mjs.map +1 -1
- package/jest.config.js +12 -0
- package/package.json +27 -24
- package/src/components/CopilotListeners.tsx +1 -2
- package/src/components/copilot-provider/copilot-messages.tsx +0 -41
- package/src/components/copilot-provider/copilotkit.tsx +31 -31
- package/src/context/copilot-context.tsx +2 -2
- package/src/hooks/__tests__/use-coagent-config.test.ts +189 -129
- package/src/hooks/index.ts +2 -2
- package/src/hooks/use-agent-nodename.ts +30 -0
- package/src/hooks/use-coagent-state-render-bridge.tsx +22 -22
- package/src/hooks/use-coagent.ts +22 -13
- package/src/hooks/use-copilot-chat-suggestions.tsx +124 -0
- package/src/hooks/use-copilot-chat_internal.ts +78 -78
- package/src/hooks/use-copilot-readable.ts +30 -12
- package/src/hooks/use-frontend-tool.ts +10 -2
- package/src/hooks/use-langgraph-interrupt-render.ts +25 -7
- package/src/hooks/use-langgraph-interrupt.ts +2 -3
- package/src/types/interrupt-action.ts +2 -5
- package/src/v2/index.ts +2 -0
- package/tsup.config.ts +1 -1
- package/dist/chunk-24SCZAB4.mjs.map +0 -1
- package/dist/chunk-5X5DJRQQ.mjs.map +0 -1
- package/dist/chunk-7BYHZLPL.mjs.map +0 -1
- package/dist/chunk-CB7CRBDG.mjs +0 -48
- package/dist/chunk-CB7CRBDG.mjs.map +0 -1
- package/dist/chunk-DCHSCK62.mjs.map +0 -1
- package/dist/chunk-IUSKVYUI.mjs +0 -13
- package/dist/chunk-IUSKVYUI.mjs.map +0 -1
- package/dist/chunk-NG26QEGF.mjs.map +0 -1
- package/dist/chunk-NROJOTQP.mjs.map +0 -1
- package/dist/chunk-R4MR43UQ.mjs.map +0 -1
- package/dist/chunk-UJBV5GAG.mjs.map +0 -1
- package/dist/hooks/use-configure-chat-suggestions.js +0 -210
- package/dist/hooks/use-configure-chat-suggestions.js.map +0 -1
- package/dist/hooks/use-configure-chat-suggestions.mjs +0 -13
- package/src/hooks/use-configure-chat-suggestions.tsx +0 -85
- /package/dist/{chunk-3GURHDG7.mjs.map → chunk-4HRUQH6U.mjs.map} +0 -0
- /package/dist/{chunk-D3QSYDJR.mjs.map → chunk-7IBF6RBW.mjs.map} +0 -0
- /package/dist/{chunk-GMI4KO4X.mjs.map → chunk-7SHWECGN.mjs.map} +0 -0
- /package/dist/{chunk-OVYFRPSN.mjs.map → chunk-ABWT4DRT.mjs.map} +0 -0
- /package/dist/{chunk-JRT5BJF3.mjs.map → chunk-B5ELMVT7.mjs.map} +0 -0
- /package/dist/{chunk-TXI72QHK.mjs.map → chunk-EG56H77V.mjs.map} +0 -0
- /package/dist/{chunk-LHKZJ2ND.mjs.map → chunk-PMWUKW3Z.mjs.map} +0 -0
- /package/dist/{chunk-QU6NONOD.mjs.map → chunk-U2ZRVVKT.mjs.map} +0 -0
- /package/dist/{chunk-WMJVBMUX.mjs.map → chunk-YCG6SNAU.mjs.map} +0 -0
- /package/dist/{chunk-3R423LZT.mjs.map → chunk-YJGPIN3R.mjs.map} +0 -0
- /package/dist/{chunk-BR5YEYZJ.mjs.map → chunk-YTQHRJUA.mjs.map} +0 -0
- /package/dist/hooks/{use-configure-chat-suggestions.mjs.map → use-agent-nodename.mjs.map} +0 -0
- /package/src/v2/{styles.css → index.css} +0 -0
|
@@ -2,28 +2,28 @@ import {
|
|
|
2
2
|
CopilotKit,
|
|
3
3
|
CopilotKitInternal,
|
|
4
4
|
defaultCopilotContextCategories
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-FYMZKPOL.mjs";
|
|
6
6
|
import "../../chunk-LHERIF3L.mjs";
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-HE22TZMF.mjs";
|
|
8
|
+
import "../../chunk-PMWUKW3Z.mjs";
|
|
9
|
+
import "../../chunk-YCG6SNAU.mjs";
|
|
10
10
|
import "../../chunk-PIF5KJYI.mjs";
|
|
11
|
+
import "../../chunk-RKTVJRK7.mjs";
|
|
11
12
|
import "../../chunk-CYDWEPFL.mjs";
|
|
12
|
-
import "../../chunk-2IDV5OHF.mjs";
|
|
13
13
|
import "../../chunk-ICIK2BSB.mjs";
|
|
14
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-2IDV5OHF.mjs";
|
|
15
15
|
import "../../chunk-YYN33GSG.mjs";
|
|
16
16
|
import "../../chunk-PMAFHQ7P.mjs";
|
|
17
17
|
import "../../chunk-6PUNP7CD.mjs";
|
|
18
18
|
import "../../chunk-O7ARI5CV.mjs";
|
|
19
|
-
import "../../chunk-
|
|
20
|
-
import "../../chunk-5X5DJRQQ.mjs";
|
|
19
|
+
import "../../chunk-QNUAXSDP.mjs";
|
|
21
20
|
import "../../chunk-NB2FKV2V.mjs";
|
|
22
21
|
import "../../chunk-F555TVE4.mjs";
|
|
22
|
+
import "../../chunk-WF65O6HX.mjs";
|
|
23
23
|
import "../../chunk-EFL5OBKN.mjs";
|
|
24
24
|
import "../../chunk-6ZLPNY7X.mjs";
|
|
25
25
|
import "../../chunk-FDOMAPJY.mjs";
|
|
26
|
-
import "../../chunk-
|
|
26
|
+
import "../../chunk-AFNWX62Q.mjs";
|
|
27
27
|
import "../../chunk-DMLQZG75.mjs";
|
|
28
28
|
import "../../chunk-SKC7AJIV.mjs";
|
|
29
29
|
export {
|
|
@@ -3,7 +3,7 @@ export { CopilotKitProps } from './copilotkit-props.js';
|
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import '@copilotkit/runtime-client-gql';
|
|
5
5
|
import 'react';
|
|
6
|
-
import '../../copilot-context-
|
|
6
|
+
import '../../copilot-context-ec77e921.js';
|
|
7
7
|
import '@copilotkit/shared';
|
|
8
8
|
import '../../types/frontend-action.js';
|
|
9
9
|
import '../../hooks/use-tree.js';
|
|
@@ -165,7 +165,7 @@ var emptyCopilotContext = {
|
|
|
165
165
|
interruptEventQueue: {},
|
|
166
166
|
addInterruptEvent: () => {
|
|
167
167
|
},
|
|
168
|
-
|
|
168
|
+
resolveInterruptEvent: () => {
|
|
169
169
|
},
|
|
170
170
|
onError: () => {
|
|
171
171
|
},
|
|
@@ -2292,6 +2292,8 @@ function useThreads() {
|
|
|
2292
2292
|
// src/hooks/use-coagent-state-render-bridge.tsx
|
|
2293
2293
|
var import_shared10 = require("@copilotkit/shared");
|
|
2294
2294
|
function getStateWithoutConstantKeys(state) {
|
|
2295
|
+
if (!state)
|
|
2296
|
+
return {};
|
|
2295
2297
|
const _a = state, { messages, tools, copilotkit } = _a, stateWithoutConstantKeys = __objRest(_a, ["messages", "tools", "copilotkit"]);
|
|
2296
2298
|
return stateWithoutConstantKeys;
|
|
2297
2299
|
}
|
|
@@ -2338,9 +2340,6 @@ function useCoagentStateRenderBridge(agentId, props) {
|
|
|
2338
2340
|
unsubscribe();
|
|
2339
2341
|
};
|
|
2340
2342
|
}, [agentId, nodeName]);
|
|
2341
|
-
if (messageIndexInRun !== 0) {
|
|
2342
|
-
return null;
|
|
2343
|
-
}
|
|
2344
2343
|
const getStateRender = (0, import_react13.useCallback)(
|
|
2345
2344
|
(messageId) => {
|
|
2346
2345
|
return Object.entries(coAgentStateRenders).find(([stateRenderId, stateRender]) => {
|
|
@@ -2368,7 +2367,7 @@ function useCoagentStateRenderBridge(agentId, props) {
|
|
|
2368
2367
|
return canRender;
|
|
2369
2368
|
}
|
|
2370
2369
|
const renderClaimedByOtherMessage = Object.values(claimsRef.current).find(
|
|
2371
|
-
(c) => c.stateRenderId === stateRenderId && (0, import_shared10.dataToUUID)(
|
|
2370
|
+
(c) => c.stateRenderId === stateRenderId && (0, import_shared10.dataToUUID)(getStateWithoutConstantKeys(c.stateSnapshot)) === (0, import_shared10.dataToUUID)(getStateWithoutConstantKeys(renderSnapshot))
|
|
2372
2371
|
);
|
|
2373
2372
|
if (renderClaimedByOtherMessage) {
|
|
2374
2373
|
if (renderSnapshot && renderClaimedByOtherMessage.stateSnapshot && !areStatesEquals(renderClaimedByOtherMessage.stateSnapshot, renderSnapshot)) {
|
|
@@ -2385,6 +2384,9 @@ function useCoagentStateRenderBridge(agentId, props) {
|
|
|
2385
2384
|
};
|
|
2386
2385
|
return (0, import_react13.useMemo)(() => {
|
|
2387
2386
|
var _a2, _b, _c;
|
|
2387
|
+
if (messageIndexInRun !== 0) {
|
|
2388
|
+
return null;
|
|
2389
|
+
}
|
|
2388
2390
|
const [stateRenderId, stateRender] = (_a2 = getStateRender(message.id)) != null ? _a2 : [];
|
|
2389
2391
|
if (!stateRender || !stateRenderId) {
|
|
2390
2392
|
return null;
|
|
@@ -2431,7 +2433,8 @@ function useCoagentStateRenderBridge(agentId, props) {
|
|
|
2431
2433
|
agent == null ? void 0 : agent.isRunning,
|
|
2432
2434
|
nodeName,
|
|
2433
2435
|
effectiveRunId,
|
|
2434
|
-
message.id
|
|
2436
|
+
message.id,
|
|
2437
|
+
messageIndexInRun
|
|
2435
2438
|
]);
|
|
2436
2439
|
}
|
|
2437
2440
|
function CoAgentStateRenderBridge(props) {
|
|
@@ -2476,11 +2479,9 @@ var usePredictStateSubscription = (agent) => {
|
|
|
2476
2479
|
}, [agent, getSubscriber]);
|
|
2477
2480
|
};
|
|
2478
2481
|
function CopilotListeners() {
|
|
2479
|
-
var _a, _b;
|
|
2480
2482
|
const { copilotkit } = (0, import_react15.useCopilotKit)();
|
|
2481
|
-
const { agentSession } = useCopilotContext();
|
|
2482
2483
|
const existingConfig = (0, import_react15.useCopilotChatConfiguration)();
|
|
2483
|
-
const resolvedAgentId =
|
|
2484
|
+
const resolvedAgentId = existingConfig == null ? void 0 : existingConfig.agentId;
|
|
2484
2485
|
const { setBannerError } = useToast();
|
|
2485
2486
|
const { agent } = (0, import_react15.useAgent)({ agentId: resolvedAgentId });
|
|
2486
2487
|
usePredictStateSubscription(agent);
|
|
@@ -2505,15 +2506,7 @@ function CopilotKit(_a) {
|
|
|
2505
2506
|
const enabled = shouldShowDevConsole(props.showDevConsole);
|
|
2506
2507
|
const publicApiKey = props.publicApiKey || props.publicLicenseKey;
|
|
2507
2508
|
const renderArr = (0, import_react16.useMemo)(() => [{ render: CoAgentStateRenderBridge }], []);
|
|
2508
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToastProvider, { enabled, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CopilotErrorBoundary, { publicApiKey, showUsageBanner: enabled, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ThreadsProvider, { threadId: props.threadId, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2509
|
-
import_react17.CopilotKitProvider,
|
|
2510
|
-
{
|
|
2511
|
-
runtimeUrl: props.runtimeUrl,
|
|
2512
|
-
renderCustomMessages: renderArr,
|
|
2513
|
-
useSingleEndpoint: true,
|
|
2514
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CopilotKitInternal, __spreadProps(__spreadValues({}, props), { children }))
|
|
2515
|
-
}
|
|
2516
|
-
) }) }) });
|
|
2509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToastProvider, { enabled, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CopilotErrorBoundary, { publicApiKey, showUsageBanner: enabled, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ThreadsProvider, { threadId: props.threadId, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react17.CopilotKitProvider, __spreadProps(__spreadValues({}, props), { renderCustomMessages: renderArr, useSingleEndpoint: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CopilotKitInternal, __spreadProps(__spreadValues({}, props), { children })) })) }) }) });
|
|
2517
2510
|
}
|
|
2518
2511
|
function CopilotKitInternal(cpkProps) {
|
|
2519
2512
|
var _b;
|
|
@@ -2751,20 +2744,17 @@ ${nonDocumentStrings}`;
|
|
|
2751
2744
|
const chatAbortControllerRef = (0, import_react16.useRef)(null);
|
|
2752
2745
|
const showDevConsole = shouldShowDevConsole(props.showDevConsole);
|
|
2753
2746
|
const [interruptActions, _setInterruptActions] = (0, import_react16.useState)({});
|
|
2754
|
-
const setInterruptAction = (0, import_react16.useCallback)(
|
|
2755
|
-
(
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
[action.id]: __spreadValues(__spreadValues({}, (_a2 = prev[action.id]) != null ? _a2 : {}), action)
|
|
2763
|
-
});
|
|
2747
|
+
const setInterruptAction = (0, import_react16.useCallback)((action) => {
|
|
2748
|
+
_setInterruptActions((prev) => {
|
|
2749
|
+
var _a2;
|
|
2750
|
+
if (action == null || !action.id) {
|
|
2751
|
+
return prev;
|
|
2752
|
+
}
|
|
2753
|
+
return __spreadProps(__spreadValues({}, prev), {
|
|
2754
|
+
[action.id]: __spreadValues(__spreadValues({}, (_a2 = prev[action.id]) != null ? _a2 : {}), action)
|
|
2764
2755
|
});
|
|
2765
|
-
}
|
|
2766
|
-
|
|
2767
|
-
);
|
|
2756
|
+
});
|
|
2757
|
+
}, []);
|
|
2768
2758
|
const removeInterruptAction = (0, import_react16.useCallback)((actionId) => {
|
|
2769
2759
|
_setInterruptActions((prev) => {
|
|
2770
2760
|
const _a2 = prev, { [actionId]: _ } = _a2, rest = __objRest(_a2, [__restKey(actionId)]);
|
|
@@ -2780,14 +2770,19 @@ ${nonDocumentStrings}`;
|
|
|
2780
2770
|
});
|
|
2781
2771
|
});
|
|
2782
2772
|
}, []);
|
|
2783
|
-
const
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2773
|
+
const resolveInterruptEvent = (0, import_react16.useCallback)(
|
|
2774
|
+
(threadId2, eventId, response) => {
|
|
2775
|
+
setInterruptEventQueue((prev) => {
|
|
2776
|
+
const threadQueue = prev[threadId2] || [];
|
|
2777
|
+
return __spreadProps(__spreadValues({}, prev), {
|
|
2778
|
+
[threadId2]: threadQueue.map(
|
|
2779
|
+
(queuedEvent) => queuedEvent.eventId === eventId ? __spreadProps(__spreadValues({}, queuedEvent), { event: __spreadProps(__spreadValues({}, queuedEvent.event), { response }) }) : queuedEvent
|
|
2780
|
+
)
|
|
2781
|
+
});
|
|
2788
2782
|
});
|
|
2789
|
-
}
|
|
2790
|
-
|
|
2783
|
+
},
|
|
2784
|
+
[]
|
|
2785
|
+
);
|
|
2791
2786
|
const memoizedChildren = (0, import_react16.useMemo)(() => children, [children]);
|
|
2792
2787
|
const [bannerError, setBannerError] = (0, import_react16.useState)(null);
|
|
2793
2788
|
const agentLock = (0, import_react16.useMemo)(() => {
|
|
@@ -2850,7 +2845,7 @@ ${nonDocumentStrings}`;
|
|
|
2850
2845
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2851
2846
|
import_react17.CopilotChatConfigurationProvider,
|
|
2852
2847
|
{
|
|
2853
|
-
agentId: (_b =
|
|
2848
|
+
agentId: (_b = props.agent) != null ? _b : "default",
|
|
2854
2849
|
threadId,
|
|
2855
2850
|
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2856
2851
|
CopilotContext.Provider,
|
|
@@ -2905,7 +2900,7 @@ ${nonDocumentStrings}`;
|
|
|
2905
2900
|
removeInterruptAction,
|
|
2906
2901
|
interruptEventQueue,
|
|
2907
2902
|
addInterruptEvent,
|
|
2908
|
-
|
|
2903
|
+
resolveInterruptEvent,
|
|
2909
2904
|
bannerError,
|
|
2910
2905
|
setBannerError,
|
|
2911
2906
|
onError: handleErrors,
|