@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/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_copilotkit = require('./copilotkit-D2emzYuj.cjs');
4
+ const require_copilotkit = require('./copilotkit-Beiw32bn.cjs');
5
5
  let react = require("react");
6
6
  react = require_copilotkit.__toESM(react);
7
7
  let _copilotkit_core = require("@copilotkit/core");
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Pt as useCopilotChatConfiguration, Q as useSuggestions, X as INTERRUPT_EVENT_NAME, Y as useInterrupt, Z as useConfigureSuggestions, a as ThreadsProvider, c as CoAgentStateRendersProvider, ct as useFrontendTool$1, d as shouldShowDevConsole, f as useToast, ft as useCopilotKit, g as useCopilotContext, h as CopilotContext, ht as defineToolCallRenderer, i as ThreadsContext, kt as useRenderToolCall$1, l as useCoAgentStateRenders, m as useCopilotMessagesContext, n as defaultCopilotContextCategories, nt as useAgent, o as useThreads, p as CopilotMessagesContext, r as CoAgentStateRenderBridge, rt as useHumanInTheLoop$1, s as CoAgentStateRendersContext, t as CopilotKit, u as useAsyncCallback, ut as useRenderCustomMessages } from "./copilotkit-CoWG8EAX.mjs";
3
+ import { Pt as useCopilotChatConfiguration, Q as useSuggestions, X as INTERRUPT_EVENT_NAME, Y as useInterrupt, Z as useConfigureSuggestions, a as ThreadsProvider, c as CoAgentStateRendersProvider, ct as useFrontendTool$1, d as shouldShowDevConsole, f as useToast, ft as useCopilotKit, g as useCopilotContext, h as CopilotContext, ht as defineToolCallRenderer, i as ThreadsContext, kt as useRenderToolCall$1, l as useCoAgentStateRenders, m as useCopilotMessagesContext, n as defaultCopilotContextCategories, nt as useAgent, o as useThreads, p as CopilotMessagesContext, r as CoAgentStateRenderBridge, rt as useHumanInTheLoop$1, s as CoAgentStateRendersContext, t as CopilotKit, u as useAsyncCallback, ut as useRenderCustomMessages } from "./copilotkit-D9iy3p2l.mjs";
4
4
  import React, { Fragment, createElement, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
5
5
  import { CopilotKitCoreRuntimeConnectionStatus, ToolCallStatus } from "@copilotkit/core";
6
6
  import { AGUIConnectNotImplementedError, HttpAgent } from "@ag-ui/client";
package/dist/index.umd.js CHANGED
@@ -583,7 +583,7 @@ react_markdown = __toESM(react_markdown);
583
583
 
584
584
  //#endregion
585
585
  //#region package.json
586
- var version = "1.75.0";
586
+ var version = "1.75.2";
587
587
 
588
588
  //#endregion
589
589
  //#region src/v2/components/CopilotKitInspector.tsx
@@ -3008,6 +3008,7 @@ react_markdown = __toESM(react_markdown);
3008
3008
  if (updateFlags.includes(UseAgentUpdate.OnStateChanged)) handlers.onStateChanged = batchedForceUpdate;
3009
3009
  if (updateFlags.includes(UseAgentUpdate.OnRunStatusChanged)) {
3010
3010
  handlers.onRunInitialized = batchedForceUpdate;
3011
+ handlers.onRunStartedEvent = batchedForceUpdate;
3011
3012
  handlers.onRunFinalized = batchedForceUpdate;
3012
3013
  handlers.onRunFailed = batchedForceUpdate;
3013
3014
  handlers.onRunErrorEvent = batchedForceUpdate;
@@ -3318,7 +3319,6 @@ react_markdown = __toESM(react_markdown);
3318
3319
  pendingRef.current = pending;
3319
3320
  const [handlerResult, setHandlerResult] = (0, react.useState)(null);
3320
3321
  const interruptStateRef = (0, react.useRef)(new _copilotkit_core.ɵInterruptState());
3321
- const interruptRunIdsRef = (0, react.useRef)(/* @__PURE__ */ new Map());
3322
3322
  const legacyRunIdRef = (0, react.useRef)(void 0);
3323
3323
  (0, react.useEffect)(() => {
3324
3324
  const interruptState = interruptStateRef.current;
@@ -3332,16 +3332,11 @@ react_markdown = __toESM(react_markdown);
3332
3332
  };
3333
3333
  },
3334
3334
  onRunFinishedEvent: (params) => {
3335
- if (params.outcome === "interrupt") {
3336
- const runId = params.input.runId;
3337
- for (const interrupt of params.interrupts) interruptRunIdsRef.current.set(interrupt.id, runId);
3338
- localStandard = params.interrupts;
3339
- }
3335
+ if (params.outcome === "interrupt") localStandard = params.interrupts;
3340
3336
  },
3341
3337
  onRunStartedEvent: () => {
3342
3338
  localLegacy = null;
3343
3339
  localStandard = null;
3344
- interruptRunIdsRef.current.clear();
3345
3340
  legacyRunIdRef.current = void 0;
3346
3341
  interruptState.clear();
3347
3342
  setPending(null);
@@ -3361,7 +3356,6 @@ react_markdown = __toESM(react_markdown);
3361
3356
  onRunFailed: () => {
3362
3357
  localLegacy = null;
3363
3358
  localStandard = null;
3364
- interruptRunIdsRef.current.clear();
3365
3359
  legacyRunIdRef.current = void 0;
3366
3360
  interruptState.clear();
3367
3361
  setPending(null);
@@ -3401,7 +3395,6 @@ react_markdown = __toESM(react_markdown);
3401
3395
  return;
3402
3396
  }
3403
3397
  if (decision.kind !== "resume") return;
3404
- const runId = decision.resume.map((entry) => interruptRunIdsRef.current.get(entry.interruptId)).find((candidate) => candidate !== void 0);
3405
3398
  for (const toolResult of decision.toolResults) agent.addMessage({
3406
3399
  id: (0, _ag_ui_client.randomUUID)(),
3407
3400
  role: "tool",
@@ -3411,8 +3404,7 @@ react_markdown = __toESM(react_markdown);
3411
3404
  try {
3412
3405
  return await copilotkit.runAgent({
3413
3406
  agent,
3414
- resume: decision.resume,
3415
- ...runId !== void 0 ? { runId } : {}
3407
+ resume: decision.resume
3416
3408
  });
3417
3409
  } catch (err) {
3418
3410
  console.error("[CopilotKit] useInterrupt resolve: runAgent rejected; clearing pending + rethrowing", err);
@@ -3439,7 +3431,6 @@ react_markdown = __toESM(react_markdown);
3439
3431
  return;
3440
3432
  }
3441
3433
  if (decision.kind !== "resume") return;
3442
- const runId = decision.resume.map((entry) => interruptRunIdsRef.current.get(entry.interruptId)).find((candidate) => candidate !== void 0);
3443
3434
  for (const toolResult of decision.toolResults) agent.addMessage({
3444
3435
  id: (0, _ag_ui_client.randomUUID)(),
3445
3436
  role: "tool",
@@ -3449,8 +3440,7 @@ react_markdown = __toESM(react_markdown);
3449
3440
  try {
3450
3441
  return await copilotkit.runAgent({
3451
3442
  agent,
3452
- resume: decision.resume,
3453
- ...runId !== void 0 ? { runId } : {}
3443
+ resume: decision.resume
3454
3444
  });
3455
3445
  } catch (err) {
3456
3446
  console.error("[CopilotKit] useInterrupt resolve: runAgent rejected; clearing pending + rethrowing", err);