@copilotkit/react-core 1.9.2-next.20 → 1.9.2-next.22
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 +18 -0
- package/dist/{chunk-MTAJI7HV.mjs → chunk-6ZLSC4KB.mjs} +20 -15
- package/dist/chunk-6ZLSC4KB.mjs.map +1 -0
- package/dist/{chunk-R2LNRHJP.mjs → chunk-BSAVFYRQ.mjs} +5 -5
- package/dist/{chunk-R2LNRHJP.mjs.map → chunk-BSAVFYRQ.mjs.map} +1 -1
- package/dist/{chunk-3SLA7Q2N.mjs → chunk-CUAFWKTQ.mjs} +4 -4
- package/dist/{chunk-K42OD3J6.mjs → chunk-GEE5AMYL.mjs} +8 -8
- package/dist/{chunk-KWQPQ4MM.mjs → chunk-GIMSRCVW.mjs} +6 -6
- package/dist/{chunk-ZOMEQ3XC.mjs → chunk-KLENTCQV.mjs} +33 -7
- package/dist/{chunk-ZOMEQ3XC.mjs.map → chunk-KLENTCQV.mjs.map} +1 -1
- package/dist/{chunk-UGJGKBFB.mjs → chunk-NGQN3JRJ.mjs} +2 -2
- package/dist/{chunk-SJJNFYGQ.mjs → chunk-SGF6C7I6.mjs} +4 -4
- 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.js +1 -1
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +8 -8
- package/dist/components/copilot-provider/index.js +1 -1
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +8 -8
- package/dist/components/error-boundary/error-boundary.mjs +2 -2
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +8 -8
- package/dist/context/index.mjs +4 -4
- package/dist/hooks/index.js +42 -11
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +14 -14
- package/dist/hooks/use-chat.js +16 -11
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +3 -3
- package/dist/hooks/use-coagent.js +42 -11
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +13 -13
- package/dist/hooks/use-copilot-chat.js +16 -11
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +12 -12
- package/dist/hooks/use-langgraph-interrupt-render.mjs +1 -1
- package/dist/hooks/use-langgraph-interrupt.js +16 -11
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +13 -13
- package/dist/index.js +43 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -18
- package/dist/lib/copilot-task.mjs +10 -10
- package/dist/lib/index.mjs +10 -10
- package/dist/setupTests.d.ts +2 -0
- package/dist/setupTests.js +26 -0
- package/dist/setupTests.js.map +1 -0
- package/dist/setupTests.mjs +24 -0
- package/dist/setupTests.mjs.map +1 -0
- package/dist/utils/extract.mjs +8 -8
- package/dist/utils/index.mjs +8 -8
- package/jest.config.js +4 -0
- package/package.json +6 -3
- package/src/components/copilot-provider/copilot-messages.tsx +1 -1
- package/src/hooks/__tests__/use-coagent-config.test.ts +284 -0
- package/src/hooks/use-chat.ts +2 -0
- package/src/hooks/use-coagent.ts +36 -0
- package/src/setupTests.ts +26 -0
- package/tsconfig.json +2 -2
- package/dist/chunk-MTAJI7HV.mjs.map +0 -1
- /package/dist/{chunk-3SLA7Q2N.mjs.map → chunk-CUAFWKTQ.mjs.map} +0 -0
- /package/dist/{chunk-K42OD3J6.mjs.map → chunk-GEE5AMYL.mjs.map} +0 -0
- /package/dist/{chunk-KWQPQ4MM.mjs.map → chunk-GIMSRCVW.mjs.map} +0 -0
- /package/dist/{chunk-UGJGKBFB.mjs.map → chunk-NGQN3JRJ.mjs.map} +0 -0
- /package/dist/{chunk-SJJNFYGQ.mjs.map → chunk-SGF6C7I6.mjs.map} +0 -0
package/dist/hooks/use-chat.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useChat
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-6ZLSC4KB.mjs";
|
|
4
4
|
import "../chunk-4CEQJ2X6.mjs";
|
|
5
|
-
import "../chunk-3OQM3NEK.mjs";
|
|
6
|
-
import "../chunk-O7ARI5CV.mjs";
|
|
7
5
|
import "../chunk-JWAXDYOW.mjs";
|
|
8
6
|
import "../chunk-GFJW4RIM.mjs";
|
|
7
|
+
import "../chunk-3OQM3NEK.mjs";
|
|
8
|
+
import "../chunk-O7ARI5CV.mjs";
|
|
9
9
|
import "../chunk-YAF2LATQ.mjs";
|
|
10
10
|
import "../chunk-DKZTPL66.mjs";
|
|
11
11
|
import "../chunk-SKC7AJIV.mjs";
|
|
@@ -765,17 +765,22 @@ function useChat(options) {
|
|
|
765
765
|
lastAgentStateMessage.state.messages
|
|
766
766
|
);
|
|
767
767
|
}
|
|
768
|
-
setCoagentStatesWithRef((prevAgentStates) =>
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
768
|
+
setCoagentStatesWithRef((prevAgentStates) => {
|
|
769
|
+
var _a2;
|
|
770
|
+
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
771
|
+
[lastAgentStateMessage.agentName]: {
|
|
772
|
+
name: lastAgentStateMessage.agentName,
|
|
773
|
+
state: lastAgentStateMessage.state,
|
|
774
|
+
running: lastAgentStateMessage.running,
|
|
775
|
+
active: lastAgentStateMessage.active,
|
|
776
|
+
threadId: lastAgentStateMessage.threadId,
|
|
777
|
+
nodeName: lastAgentStateMessage.nodeName,
|
|
778
|
+
runId: lastAgentStateMessage.runId,
|
|
779
|
+
// Preserve existing config from previous state
|
|
780
|
+
config: (_a2 = prevAgentStates[lastAgentStateMessage.agentName]) == null ? void 0 : _a2.config
|
|
781
|
+
}
|
|
782
|
+
});
|
|
783
|
+
});
|
|
779
784
|
if (lastAgentStateMessage.running) {
|
|
780
785
|
setAgentSession({
|
|
781
786
|
threadId: lastAgentStateMessage.threadId,
|
|
@@ -1436,6 +1441,32 @@ function useCoAgent(options) {
|
|
|
1436
1441
|
// reset initialstate on reset
|
|
1437
1442
|
coagentStates[name] === void 0
|
|
1438
1443
|
]);
|
|
1444
|
+
(0, import_react9.useEffect)(() => {
|
|
1445
|
+
const newConfig = options.config ? options.config : options.configurable ? { configurable: options.configurable } : void 0;
|
|
1446
|
+
if (newConfig === void 0)
|
|
1447
|
+
return;
|
|
1448
|
+
setCoagentStatesWithRef((prev) => {
|
|
1449
|
+
var _a;
|
|
1450
|
+
const existing = (_a = prev[name]) != null ? _a : {
|
|
1451
|
+
name,
|
|
1452
|
+
state: isInternalStateManagementWithInitial(options) ? options.initialState : {},
|
|
1453
|
+
config: {},
|
|
1454
|
+
running: false,
|
|
1455
|
+
active: false,
|
|
1456
|
+
threadId: void 0,
|
|
1457
|
+
nodeName: void 0,
|
|
1458
|
+
runId: void 0
|
|
1459
|
+
};
|
|
1460
|
+
if (JSON.stringify(existing.config) === JSON.stringify(newConfig)) {
|
|
1461
|
+
return prev;
|
|
1462
|
+
}
|
|
1463
|
+
return __spreadProps(__spreadValues({}, prev), {
|
|
1464
|
+
[name]: __spreadProps(__spreadValues({}, existing), {
|
|
1465
|
+
config: newConfig
|
|
1466
|
+
})
|
|
1467
|
+
});
|
|
1468
|
+
});
|
|
1469
|
+
}, [JSON.stringify(options.config), JSON.stringify(options.configurable)]);
|
|
1439
1470
|
const runAgentCallback = useAsyncCallback(
|
|
1440
1471
|
(hint) => __async(this, null, function* () {
|
|
1441
1472
|
yield runAgent(name, context, appendMessage, runChatCompletion, hint);
|