@copilotkit/react-core 1.75.0 → 1.75.2
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-D2emzYuj.cjs → copilotkit-Beiw32bn.cjs} +6 -16
- package/dist/copilotkit-Beiw32bn.cjs.map +1 -0
- package/dist/{copilotkit-CoWG8EAX.mjs → copilotkit-D9iy3p2l.mjs} +6 -16
- package/dist/copilotkit-D9iy3p2l.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.umd.js +5 -15
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/headless.cjs +4 -14
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.mjs +4 -14
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/index.umd.js +5 -15
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +8 -8
- package/dist/copilotkit-CoWG8EAX.mjs.map +0 -1
- package/dist/copilotkit-D2emzYuj.cjs.map +0 -1
package/dist/v2/headless.mjs
CHANGED
|
@@ -475,6 +475,7 @@ function useAgent({ agentId, threadId, runtimeAgentId, updates, throttleMs } = {
|
|
|
475
475
|
if (updateFlags.includes(UseAgentUpdate.OnStateChanged)) handlers.onStateChanged = batchedForceUpdate;
|
|
476
476
|
if (updateFlags.includes(UseAgentUpdate.OnRunStatusChanged)) {
|
|
477
477
|
handlers.onRunInitialized = batchedForceUpdate;
|
|
478
|
+
handlers.onRunStartedEvent = batchedForceUpdate;
|
|
478
479
|
handlers.onRunFinalized = batchedForceUpdate;
|
|
479
480
|
handlers.onRunFailed = batchedForceUpdate;
|
|
480
481
|
handlers.onRunErrorEvent = batchedForceUpdate;
|
|
@@ -860,7 +861,6 @@ function useInterrupt(config) {
|
|
|
860
861
|
pendingRef.current = pending;
|
|
861
862
|
const [handlerResult, setHandlerResult] = useState(null);
|
|
862
863
|
const interruptStateRef = useRef(new ɵInterruptState());
|
|
863
|
-
const interruptRunIdsRef = useRef(/* @__PURE__ */ new Map());
|
|
864
864
|
const legacyRunIdRef = useRef(void 0);
|
|
865
865
|
useEffect(() => {
|
|
866
866
|
const interruptState = interruptStateRef.current;
|
|
@@ -874,16 +874,11 @@ function useInterrupt(config) {
|
|
|
874
874
|
};
|
|
875
875
|
},
|
|
876
876
|
onRunFinishedEvent: (params) => {
|
|
877
|
-
if (params.outcome === "interrupt")
|
|
878
|
-
const runId = params.input.runId;
|
|
879
|
-
for (const interrupt of params.interrupts) interruptRunIdsRef.current.set(interrupt.id, runId);
|
|
880
|
-
localStandard = params.interrupts;
|
|
881
|
-
}
|
|
877
|
+
if (params.outcome === "interrupt") localStandard = params.interrupts;
|
|
882
878
|
},
|
|
883
879
|
onRunStartedEvent: () => {
|
|
884
880
|
localLegacy = null;
|
|
885
881
|
localStandard = null;
|
|
886
|
-
interruptRunIdsRef.current.clear();
|
|
887
882
|
legacyRunIdRef.current = void 0;
|
|
888
883
|
interruptState.clear();
|
|
889
884
|
setPending(null);
|
|
@@ -903,7 +898,6 @@ function useInterrupt(config) {
|
|
|
903
898
|
onRunFailed: () => {
|
|
904
899
|
localLegacy = null;
|
|
905
900
|
localStandard = null;
|
|
906
|
-
interruptRunIdsRef.current.clear();
|
|
907
901
|
legacyRunIdRef.current = void 0;
|
|
908
902
|
interruptState.clear();
|
|
909
903
|
setPending(null);
|
|
@@ -943,7 +937,6 @@ function useInterrupt(config) {
|
|
|
943
937
|
return;
|
|
944
938
|
}
|
|
945
939
|
if (decision.kind !== "resume") return;
|
|
946
|
-
const runId = decision.resume.map((entry) => interruptRunIdsRef.current.get(entry.interruptId)).find((candidate) => candidate !== void 0);
|
|
947
940
|
for (const toolResult of decision.toolResults) agent.addMessage({
|
|
948
941
|
id: randomUUID$1(),
|
|
949
942
|
role: "tool",
|
|
@@ -953,8 +946,7 @@ function useInterrupt(config) {
|
|
|
953
946
|
try {
|
|
954
947
|
return await copilotkit.runAgent({
|
|
955
948
|
agent,
|
|
956
|
-
resume: decision.resume
|
|
957
|
-
...runId !== void 0 ? { runId } : {}
|
|
949
|
+
resume: decision.resume
|
|
958
950
|
});
|
|
959
951
|
} catch (err) {
|
|
960
952
|
console.error("[CopilotKit] useInterrupt resolve: runAgent rejected; clearing pending + rethrowing", err);
|
|
@@ -981,7 +973,6 @@ function useInterrupt(config) {
|
|
|
981
973
|
return;
|
|
982
974
|
}
|
|
983
975
|
if (decision.kind !== "resume") return;
|
|
984
|
-
const runId = decision.resume.map((entry) => interruptRunIdsRef.current.get(entry.interruptId)).find((candidate) => candidate !== void 0);
|
|
985
976
|
for (const toolResult of decision.toolResults) agent.addMessage({
|
|
986
977
|
id: randomUUID$1(),
|
|
987
978
|
role: "tool",
|
|
@@ -991,8 +982,7 @@ function useInterrupt(config) {
|
|
|
991
982
|
try {
|
|
992
983
|
return await copilotkit.runAgent({
|
|
993
984
|
agent,
|
|
994
|
-
resume: decision.resume
|
|
995
|
-
...runId !== void 0 ? { runId } : {}
|
|
985
|
+
resume: decision.resume
|
|
996
986
|
});
|
|
997
987
|
} catch (err) {
|
|
998
988
|
console.error("[CopilotKit] useInterrupt resolve: runAgent rejected; clearing pending + rethrowing", err);
|