@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.
@@ -504,6 +504,7 @@ function useAgent({ agentId, threadId, runtimeAgentId, updates, throttleMs } = {
504
504
  if (updateFlags.includes(UseAgentUpdate.OnStateChanged)) handlers.onStateChanged = batchedForceUpdate;
505
505
  if (updateFlags.includes(UseAgentUpdate.OnRunStatusChanged)) {
506
506
  handlers.onRunInitialized = batchedForceUpdate;
507
+ handlers.onRunStartedEvent = batchedForceUpdate;
507
508
  handlers.onRunFinalized = batchedForceUpdate;
508
509
  handlers.onRunFailed = batchedForceUpdate;
509
510
  handlers.onRunErrorEvent = batchedForceUpdate;
@@ -889,7 +890,6 @@ function useInterrupt(config) {
889
890
  pendingRef.current = pending;
890
891
  const [handlerResult, setHandlerResult] = (0, react.useState)(null);
891
892
  const interruptStateRef = (0, react.useRef)(new _copilotkit_core.ɵInterruptState());
892
- const interruptRunIdsRef = (0, react.useRef)(/* @__PURE__ */ new Map());
893
893
  const legacyRunIdRef = (0, react.useRef)(void 0);
894
894
  (0, react.useEffect)(() => {
895
895
  const interruptState = interruptStateRef.current;
@@ -903,16 +903,11 @@ function useInterrupt(config) {
903
903
  };
904
904
  },
905
905
  onRunFinishedEvent: (params) => {
906
- if (params.outcome === "interrupt") {
907
- const runId = params.input.runId;
908
- for (const interrupt of params.interrupts) interruptRunIdsRef.current.set(interrupt.id, runId);
909
- localStandard = params.interrupts;
910
- }
906
+ if (params.outcome === "interrupt") localStandard = params.interrupts;
911
907
  },
912
908
  onRunStartedEvent: () => {
913
909
  localLegacy = null;
914
910
  localStandard = null;
915
- interruptRunIdsRef.current.clear();
916
911
  legacyRunIdRef.current = void 0;
917
912
  interruptState.clear();
918
913
  setPending(null);
@@ -932,7 +927,6 @@ function useInterrupt(config) {
932
927
  onRunFailed: () => {
933
928
  localLegacy = null;
934
929
  localStandard = null;
935
- interruptRunIdsRef.current.clear();
936
930
  legacyRunIdRef.current = void 0;
937
931
  interruptState.clear();
938
932
  setPending(null);
@@ -972,7 +966,6 @@ function useInterrupt(config) {
972
966
  return;
973
967
  }
974
968
  if (decision.kind !== "resume") return;
975
- const runId = decision.resume.map((entry) => interruptRunIdsRef.current.get(entry.interruptId)).find((candidate) => candidate !== void 0);
976
969
  for (const toolResult of decision.toolResults) agent.addMessage({
977
970
  id: (0, _ag_ui_client.randomUUID)(),
978
971
  role: "tool",
@@ -982,8 +975,7 @@ function useInterrupt(config) {
982
975
  try {
983
976
  return await copilotkit.runAgent({
984
977
  agent,
985
- resume: decision.resume,
986
- ...runId !== void 0 ? { runId } : {}
978
+ resume: decision.resume
987
979
  });
988
980
  } catch (err) {
989
981
  console.error("[CopilotKit] useInterrupt resolve: runAgent rejected; clearing pending + rethrowing", err);
@@ -1010,7 +1002,6 @@ function useInterrupt(config) {
1010
1002
  return;
1011
1003
  }
1012
1004
  if (decision.kind !== "resume") return;
1013
- const runId = decision.resume.map((entry) => interruptRunIdsRef.current.get(entry.interruptId)).find((candidate) => candidate !== void 0);
1014
1005
  for (const toolResult of decision.toolResults) agent.addMessage({
1015
1006
  id: (0, _ag_ui_client.randomUUID)(),
1016
1007
  role: "tool",
@@ -1020,8 +1011,7 @@ function useInterrupt(config) {
1020
1011
  try {
1021
1012
  return await copilotkit.runAgent({
1022
1013
  agent,
1023
- resume: decision.resume,
1024
- ...runId !== void 0 ? { runId } : {}
1014
+ resume: decision.resume
1025
1015
  });
1026
1016
  } catch (err) {
1027
1017
  console.error("[CopilotKit] useInterrupt resolve: runAgent rejected; clearing pending + rethrowing", err);