@copilotkit/react-core 1.51.3-next.2 → 1.51.3-next.4
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 +20 -0
- package/dist/{chunk-OBXQSB7S.mjs → chunk-37JRY3TC.mjs} +2 -2
- package/dist/{chunk-QNUAXSDP.mjs → chunk-3X3I7OJV.mjs} +12 -6
- package/dist/chunk-3X3I7OJV.mjs.map +1 -0
- package/dist/{chunk-W5BKJN46.mjs → chunk-AR533FGY.mjs} +2 -2
- package/dist/{chunk-4MLKBZGB.mjs → chunk-K2GJI3PT.mjs} +2 -2
- package/dist/{chunk-F555TVE4.mjs → chunk-LMHB2D4J.mjs} +3 -3
- package/dist/chunk-LMHB2D4J.mjs.map +1 -0
- package/dist/{chunk-M7U7RZLU.mjs → chunk-LWJIFZWN.mjs} +2 -2
- package/dist/{chunk-2VA5EV2P.mjs → chunk-THCOOWDH.mjs} +3 -3
- package/dist/components/copilot-provider/copilotkit.js +13 -7
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +3 -3
- package/dist/components/copilot-provider/index.js +13 -7
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +3 -3
- package/dist/components/index.js +13 -7
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +3 -3
- package/dist/context/index.js +2 -2
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/context/threads-context.js +2 -2
- package/dist/context/threads-context.js.map +1 -1
- package/dist/context/threads-context.mjs +1 -1
- package/dist/hooks/index.js +11 -5
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +5 -5
- package/dist/hooks/use-coagent-state-render-bridge.js +11 -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-copilot-chat-headless_c.js +11 -5
- package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
- package/dist/hooks/use-copilot-chat-headless_c.mjs +4 -4
- package/dist/hooks/use-copilot-chat.js +11 -5
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +4 -4
- package/dist/hooks/use-copilot-chat_internal.js +11 -5
- package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
- package/dist/hooks/use-copilot-chat_internal.mjs +3 -3
- package/dist/hooks/use-langgraph-interrupt-render.mjs +1 -1
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/lib/copilot-task.mjs +4 -4
- package/dist/lib/index.mjs +4 -4
- package/dist/setupTests.js +3 -1
- package/dist/setupTests.js.map +1 -1
- package/dist/setupTests.mjs +3 -1
- package/dist/setupTests.mjs.map +1 -1
- package/package.json +6 -6
- package/src/context/__tests__/threads-context.test.tsx +28 -0
- package/src/context/threads-context.tsx +2 -2
- package/src/hooks/__tests__/use-coagent-state-render.e2e.test.tsx +229 -0
- package/src/hooks/use-coagent-state-render-bridge.tsx +15 -5
- package/src/setupTests.ts +2 -0
- package/dist/chunk-F555TVE4.mjs.map +0 -1
- package/dist/chunk-QNUAXSDP.mjs.map +0 -1
- /package/dist/{chunk-OBXQSB7S.mjs.map → chunk-37JRY3TC.mjs.map} +0 -0
- /package/dist/{chunk-W5BKJN46.mjs.map → chunk-AR533FGY.mjs.map} +0 -0
- /package/dist/{chunk-4MLKBZGB.mjs.map → chunk-K2GJI3PT.mjs.map} +0 -0
- /package/dist/{chunk-M7U7RZLU.mjs.map → chunk-LWJIFZWN.mjs.map} +0 -0
- /package/dist/{chunk-2VA5EV2P.mjs.map → chunk-THCOOWDH.mjs.map} +0 -0
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
CopilotKit,
|
|
3
3
|
CopilotKitInternal,
|
|
4
4
|
defaultCopilotContextCategories
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-THCOOWDH.mjs";
|
|
6
6
|
import "../../chunk-FJEI7IBX.mjs";
|
|
7
7
|
import "../../chunk-CYDWEPFL.mjs";
|
|
8
8
|
import "../../chunk-2IDV5OHF.mjs";
|
|
@@ -13,9 +13,9 @@ import "../../chunk-PMAFHQ7P.mjs";
|
|
|
13
13
|
import "../../chunk-YYN33GSG.mjs";
|
|
14
14
|
import "../../chunk-BVBFFI7K.mjs";
|
|
15
15
|
import "../../chunk-O7ARI5CV.mjs";
|
|
16
|
-
import "../../chunk-
|
|
16
|
+
import "../../chunk-3X3I7OJV.mjs";
|
|
17
17
|
import "../../chunk-NB2FKV2V.mjs";
|
|
18
|
-
import "../../chunk-
|
|
18
|
+
import "../../chunk-LMHB2D4J.mjs";
|
|
19
19
|
import "../../chunk-WF65O6HX.mjs";
|
|
20
20
|
import "../../chunk-EFL5OBKN.mjs";
|
|
21
21
|
import "../../chunk-6ZLPNY7X.mjs";
|
|
@@ -1237,8 +1237,8 @@ var import_shared8 = require("@copilotkit/shared");
|
|
|
1237
1237
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1238
1238
|
var ThreadsContext = (0, import_react9.createContext)(void 0);
|
|
1239
1239
|
function ThreadsProvider({ children, threadId: explicitThreadId }) {
|
|
1240
|
-
const [internalThreadId, setThreadId] = (0, import_react9.useState)(
|
|
1241
|
-
const threadId = internalThreadId;
|
|
1240
|
+
const [internalThreadId, setThreadId] = (0, import_react9.useState)(() => (0, import_shared8.randomUUID)());
|
|
1241
|
+
const threadId = explicitThreadId != null ? explicitThreadId : internalThreadId;
|
|
1242
1242
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1243
1243
|
ThreadsContext.Provider,
|
|
1244
1244
|
{
|
|
@@ -1287,12 +1287,16 @@ function useCoagentStateRenderBridge(agentId, props) {
|
|
|
1287
1287
|
const { coAgentStateRenders, claimsRef } = useCoAgentStateRenders();
|
|
1288
1288
|
const { agent } = (0, import_react10.useAgent)({ agentId });
|
|
1289
1289
|
const [nodeName, setNodeName] = (0, import_react11.useState)(void 0);
|
|
1290
|
+
const [, forceUpdate] = (0, import_react11.useState)(0);
|
|
1290
1291
|
const runId = (_a = props.runId) != null ? _a : message.runId;
|
|
1291
1292
|
const effectiveRunId = runId || "pending";
|
|
1292
1293
|
(0, import_react11.useEffect)(() => {
|
|
1293
1294
|
if (!agent)
|
|
1294
1295
|
return;
|
|
1295
1296
|
const subscriber = {
|
|
1297
|
+
onStateChanged: () => {
|
|
1298
|
+
forceUpdate((value) => value + 1);
|
|
1299
|
+
},
|
|
1296
1300
|
onStepStartedEvent: ({ event }) => {
|
|
1297
1301
|
if (event.stepName !== nodeName) {
|
|
1298
1302
|
setNodeName(event.stepName);
|
|
@@ -1370,12 +1374,14 @@ function useCoagentStateRenderBridge(agentId, props) {
|
|
|
1370
1374
|
if (!canRender) {
|
|
1371
1375
|
return null;
|
|
1372
1376
|
}
|
|
1373
|
-
if (snapshot
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
} else {
|
|
1377
|
+
if (snapshot) {
|
|
1378
|
+
const existingSnapshot = claimsRef.current[message.id].stateSnapshot;
|
|
1379
|
+
const snapshotChanged = stateSnapshot && existingSnapshot !== void 0 && !areStatesEquals(existingSnapshot, snapshot);
|
|
1380
|
+
if (!claimsRef.current[message.id].locked || snapshotChanged) {
|
|
1378
1381
|
claimsRef.current[message.id].stateSnapshot = snapshot;
|
|
1382
|
+
if (stateSnapshot) {
|
|
1383
|
+
claimsRef.current[message.id].locked = true;
|
|
1384
|
+
}
|
|
1379
1385
|
}
|
|
1380
1386
|
}
|
|
1381
1387
|
if (stateRender.handler) {
|