@copilotkit/react-core 1.61.1 → 1.61.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.
Files changed (41) hide show
  1. package/dist/{copilotkit-UY-H6Kx7.mjs → copilotkit-Be-o2UaU.mjs} +210 -119
  2. package/dist/copilotkit-Be-o2UaU.mjs.map +1 -0
  3. package/dist/{copilotkit-M1FiciGd.d.mts → copilotkit-Bpt1c_-q.d.mts} +79 -71
  4. package/dist/copilotkit-Bpt1c_-q.d.mts.map +1 -0
  5. package/dist/{copilotkit-BCJDP8qd.cjs → copilotkit-CTCjVxkH.cjs} +199 -108
  6. package/dist/copilotkit-CTCjVxkH.cjs.map +1 -0
  7. package/dist/{copilotkit-CEdu_aie.d.cts → copilotkit-ClqbUuGX.d.cts} +79 -71
  8. package/dist/copilotkit-ClqbUuGX.d.cts.map +1 -0
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +1 -1
  12. package/dist/index.d.cts.map +1 -1
  13. package/dist/index.d.mts +1 -1
  14. package/dist/index.d.mts.map +1 -1
  15. package/dist/index.mjs +1 -1
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/index.umd.js +167 -94
  18. package/dist/index.umd.js.map +1 -1
  19. package/dist/v2/context.d.cts +5 -1
  20. package/dist/v2/context.d.cts.map +1 -1
  21. package/dist/v2/context.d.mts +5 -1
  22. package/dist/v2/context.d.mts.map +1 -1
  23. package/dist/v2/headless.cjs +167 -93
  24. package/dist/v2/headless.cjs.map +1 -1
  25. package/dist/v2/headless.d.cts +76 -68
  26. package/dist/v2/headless.d.cts.map +1 -1
  27. package/dist/v2/headless.d.mts +76 -68
  28. package/dist/v2/headless.d.mts.map +1 -1
  29. package/dist/v2/headless.mjs +168 -94
  30. package/dist/v2/headless.mjs.map +1 -1
  31. package/dist/v2/index.cjs +1 -1
  32. package/dist/v2/index.d.cts +2 -2
  33. package/dist/v2/index.d.mts +2 -2
  34. package/dist/v2/index.mjs +1 -1
  35. package/dist/v2/index.umd.js +198 -107
  36. package/dist/v2/index.umd.js.map +1 -1
  37. package/package.json +6 -6
  38. package/dist/copilotkit-BCJDP8qd.cjs.map +0 -1
  39. package/dist/copilotkit-CEdu_aie.d.cts.map +0 -1
  40. package/dist/copilotkit-M1FiciGd.d.mts.map +0 -1
  41. package/dist/copilotkit-UY-H6Kx7.mjs.map +0 -1
@@ -8,7 +8,11 @@ import { AbstractAgent } from "@ag-ui/client";
8
8
  //#region src/v2/types/react-tool-call-renderer.d.ts
9
9
  interface ReactToolCallRenderer<T = unknown> {
10
10
  name: string;
11
- args: StandardSchemaV1<any, T>;
11
+ /**
12
+ * Schema describing the tool arguments. Optional — renderers registered for
13
+ * tools without parameters (e.g. HITL confirm dialogs) have no schema.
14
+ */
15
+ args?: StandardSchemaV1<any, T>;
12
16
  /**
13
17
  * Optional agent ID to constrain this tool renderer to a specific agent.
14
18
  * If specified, this renderer will only be used for the specified agent.
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.cts","names":[],"sources":["../../src/v2/types/react-tool-call-renderer.ts","../../src/v2/types/react-activity-message-renderer.ts","../../src/v2/types/react-custom-message-renderer.ts","../../src/v2/lib/react-core.ts","../../src/v2/context.ts"],"mappings":";;;;;;;;UAGiB,qBAAA;EACf,IAAA;EACA,IAAA,EAAM,gBAAA,MAAsB,CAAA;;;;AAF9B;EAOE,OAAA;EACA,MAAA,EAAQ,KAAA,CAAM,aAAA;IAER,IAAA;IACA,UAAA;IACA,IAAA,EAAM,OAAA,CAAQ,CAAA;IACd,MAAA,EAAQ,cAAA,CAAe,UAAA;IACvB,MAAA;EAAA;IAGA,IAAA;IACA,UAAA;IACA,IAAA,EAAM,CAAA;IACN,MAAA,EAAQ,cAAA,CAAe,SAAA;IACvB,MAAA;EAAA;IAGA,IAAA;IACA,UAAA;IACA,IAAA,EAAM,CAAA;IACN,MAAA,EAAQ,cAAA,CAAe,QAAA;IACvB,MAAA;EAAA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InC,kBAAA,CAAmB,eAAA,EAAiB,qBAAA;EAMpC,qBAAA,CAAsB,KAAA,EAAO,qBAAA;EAO7B,wBAAA,CAAyB,IAAA,UAAc,OAAA;EAAA,QAQ/B,6BAAA;EAAA,IAYJ,gBAAA,CAAA,GAAoB,OAAA,CAAM,YAAA;EAI9B,mBAAA,CAAoB,OAAA,EAAS,OAAA,CAAM,YAAA;EAYnC,SAAA,CACE,UAAA,EAAY,6BAAA,GACX,0BAAA;EHvH0B;;;;;;;;;;;;;EGwIvB,8BAAA,CAAA,GAAkC,OAAA;AAAA;;;UC7IzB,sBAAA;EACf,UAAA,EAAY,mBAAA;;AJTd;;;;EIeE,oBAAA,EAAsB,WAAA;AAAA;AAAA,cAGX,SAAA,EAAW,WAAA;AAAA,cAEX,iBAAA,EAAiB,KAAA,CAAA,OAAA,CAAA,sBAAA;AAAA,cAIjB,aAAA,QAAoB,sBAAA;AAAA,cA6BpB,cAAA,EAAc,KAAA,CAAA,OAAA,CAAA,mBAAA;AAAA,cAOd,iBAAA,QAAwB,mBAAA"}
1
+ {"version":3,"file":"context.d.cts","names":[],"sources":["../../src/v2/types/react-tool-call-renderer.ts","../../src/v2/types/react-activity-message-renderer.ts","../../src/v2/types/react-custom-message-renderer.ts","../../src/v2/lib/react-core.ts","../../src/v2/context.ts"],"mappings":";;;;;;;;UAGiB,qBAAA;EACf,IAAA;;;;;EAKA,IAAA,GAAO,gBAAA,MAAsB,CAAA;EANO;;;;EAWpC,OAAA;EACA,MAAA,EAAQ,KAAA,CAAM,aAAA;IAER,IAAA;IACA,UAAA;IACA,IAAA,EAAM,OAAA,CAAQ,CAAA;IACd,MAAA,EAAQ,cAAA,CAAe,UAAA;IACvB,MAAA;EAAA;IAGA,IAAA;IACA,UAAA;IACA,IAAA,EAAM,CAAA;IACN,MAAA,EAAQ,cAAA,CAAe,SAAA;IACvB,MAAA;EAAA;IAGA,IAAA;IACA,UAAA;IACA,IAAA,EAAM,CAAA;IACN,MAAA,EAAQ,c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AAA,CAAwB,SAAA,EAAW,0BAAA;EAInC,kBAAA,CAAmB,eAAA,EAAiB,qBAAA;EAMpC,qBAAA,CAAsB,KAAA,EAAO,qBAAA;EAO7B,wBAAA,CAAyB,IAAA,UAAc,OAAA;EAAA,QAQ/B,6BAAA;EAAA,IAYJ,gBAAA,CAAA,GAAoB,OAAA,CAAM,YAAA;EAI9B,mBAAA,CAAoB,OAAA,EAAS,OAAA,CAAM,YAAA;EAYnC,SAAA,CACE,UAAA,EAAY,6BAAA,GACX,0BAAA;EHnH0B;;;;;;;;;;;;;EGoIvB,8BAAA,CAAA,GAAkC,OAAA;AAAA;;;UC7IzB,sBAAA;EACf,UAAA,EAAY,mBAAA;;AJTd;;;;EIeE,oBAAA,EAAsB,WAAA;AAAA;AAAA,cAGX,SAAA,EAAW,WAAA;AAAA,cAEX,iBAAA,EAAiB,KAAA,CAAA,OAAA,CAAA,sBAAA;AAAA,cAIjB,aAAA,QAAoB,sBAAA;AAAA,cA6BpB,cAAA,EAAc,KAAA,CAAA,OAAA,CAAA,mBAAA;AAAA,cAOd,iBAAA,QAAwB,mBAAA"}
@@ -8,7 +8,11 @@ import { AbstractAgent } from "@ag-ui/client";
8
8
  //#region src/v2/types/react-tool-call-renderer.d.ts
9
9
  interface ReactToolCallRenderer<T = unknown> {
10
10
  name: string;
11
- args: StandardSchemaV1<any, T>;
11
+ /**
12
+ * Schema describing the tool arguments. Optional — renderers registered for
13
+ * tools without parameters (e.g. HITL confirm dialogs) have no schema.
14
+ */
15
+ args?: StandardSchemaV1<any, T>;
12
16
  /**
13
17
  * Optional agent ID to constrain this tool renderer to a specific agent.
14
18
  * If specified, this renderer will only be used for the specified agent.
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.mts","names":[],"sources":["../../src/v2/types/react-tool-call-renderer.ts","../../src/v2/types/react-activity-message-renderer.ts","../../src/v2/types/react-custom-message-renderer.ts","../../src/v2/lib/react-core.ts","../../src/v2/context.ts"],"mappings":";;;;;;;;UAGiB,q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,OAAA;AAAA;AAAA,cAGF,mBAAA,SAA4B,cAAA;EAAA,QAC/B,gBAAA;EAAA,QACA,oBAAA;EAAA,QAEA,4BAAA;EAAA,QAEA,qBAAA;EAAA,QACA,uBAAA;EAAA,QACA,iBAAA;cAEI,MAAA,EAAQ,yBAAA;EAAA,IAOhB,oBAAA,CAAA,GAAwB,QAAA,CAAS,0BAAA;EAAA,IAIjC,sBAAA,CAAA,GAA0B,QAAA,CAAS,4BAAA;EAAA,IAInC,eAAA,CAAA,GAAmB,QAAA,CAAS,qBAAA;EAmBhC,yBAAA,CACE,SAAA,EAAW,4BAAA;EAKb,uBAAA,CAAwB,SAAA,EAAW,0BAAA;EAInC,kBAAA,CAAmB,eAAA,EAAiB,qBAAA;EAMpC,qBAAA,CAAsB,KAAA,EAAO,qBAAA;EAO7B,wBAAA,CAAyB,IAAA,UAAc,OAAA;EAAA,QAQ/B,6BAAA;EAAA,IAYJ,gBAAA,CAAA,GAAoB,OAAA,CAAM,YAAA;EAI9B,mBAAA,CAAoB,OAAA,EAAS,OAAA,CAAM,YAAA;EAYnC,SAAA,CACE,UAAA,EAAY,6BAAA,GACX,0BAAA;EHvH0B;;;;;;;;;;;;;EGwIvB,8BAAA,CAAA,GAAkC,OAAA;AAAA;;;UC7IzB,sBAAA;EACf,UAAA,EAAY,mBAAA;;AJTd;;;;EIeE,oBAAA,EAAsB,WAAA;AAAA;AAAA,cAGX,SAAA,EAAW,WAAA;AAAA,cAEX,iBAAA,EAAiB,KAAA,CAAA,OAAA,CAAA,sBAAA;AAAA,cAIjB,aAAA,QAAoB,sBAAA;AAAA,cA6BpB,cAAA,EAAc,KAAA,CAAA,OAAA,CAAA,mBAAA;AAAA,cAOd,iBAAA,QAAwB,mBAAA"}
1
+ {"version":3,"file":"context.d.mts","names":[],"sources":["../../src/v2/types/react-tool-call-renderer.ts","../../src/v2/types/react-activity-message-renderer.ts","../../src/v2/types/react-custom-message-renderer.ts","../../src/v2/lib/react-core.ts","../../src/v2/context.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nected || status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Connecting)) {
234
234
  const cached = provisionalAgentCache.current.get(agentId);
235
235
  if (cached) {
236
- cached.headers = { ...copilotkit.headers };
236
+ copilotkit.applyHeadersToAgent(cached);
237
237
  return cached;
238
238
  }
239
239
  const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
@@ -242,14 +242,14 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
242
242
  transport: copilotkit.runtimeTransport,
243
243
  runtimeMode: "pending"
244
244
  });
245
- provisional.headers = { ...copilotkit.headers };
245
+ copilotkit.applyHeadersToAgent(provisional);
246
246
  provisionalAgentCache.current.set(agentId, provisional);
247
247
  return provisional;
248
248
  }
249
249
  if (isRuntimeConfigured && status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Error) {
250
250
  const cached = provisionalAgentCache.current.get(agentId);
251
251
  if (cached) {
252
- cached.headers = { ...copilotkit.headers };
252
+ copilotkit.applyHeadersToAgent(cached);
253
253
  return cached;
254
254
  }
255
255
  const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
@@ -258,7 +258,7 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
258
258
  transport: copilotkit.runtimeTransport,
259
259
  runtimeMode: "pending"
260
260
  });
261
- provisional.headers = { ...copilotkit.headers };
261
+ copilotkit.applyHeadersToAgent(provisional);
262
262
  provisionalAgentCache.current.set(agentId, provisional);
263
263
  return provisional;
264
264
  }
@@ -309,7 +309,7 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
309
309
  updateFlags
310
310
  ]);
311
311
  (0, react.useEffect)(() => {
312
- if (agent instanceof _ag_ui_client.HttpAgent) agent.headers = { ...copilotkit.headers };
312
+ if (agent instanceof _ag_ui_client.HttpAgent) copilotkit.applyHeadersToAgent(agent);
313
313
  }, [agent, JSON.stringify(copilotkit.headers)]);
314
314
  const chatConfig = useCopilotChatConfiguration();
315
315
  const configThreadId = chatConfig?.threadId;
@@ -521,114 +521,165 @@ const INTERRUPT_EVENT_NAME = "on_interrupt";
521
521
  function isPromiseLike(value) {
522
522
  return (typeof value === "object" || typeof value === "function") && value !== null && typeof Reflect.get(value, "then") === "function";
523
523
  }
524
+ /** Derive the legacy-compatible `event` for any pending interrupt. */
525
+ function toLegacyEvent(pending) {
526
+ if (pending.kind === "legacy") return pending.event;
527
+ return {
528
+ name: INTERRUPT_EVENT_NAME,
529
+ value: pending.interrupts[0]
530
+ };
531
+ }
524
532
  /**
525
- * Handles agent interrupts (`on_interrupt`) with optional filtering, preprocessing, and resume behavior.
526
- *
527
- * The hook listens to custom events on the active agent, stores interrupt payloads per run,
528
- * and surfaces a render callback once the run finalizes. Call `resolve` from your UI to resume
529
- * execution with user-provided data.
533
+ * Handles agent interrupts with optional filtering, preprocessing, and resume behavior.
530
534
  *
531
- * - `renderInChat: true` (default): the element is published into `<CopilotChat>` and this hook returns `void`.
532
- * - `renderInChat: false`: the hook returns the interrupt element so you can place it anywhere in your component tree.
535
+ * Supports both the AG-UI standard interrupt flow (`RUN_FINISHED` with
536
+ * `outcome.type === "interrupt"`) and the legacy custom-event flow
537
+ * (`on_interrupt`). For standard interrupts, `render` receives `interrupt`
538
+ * (the primary one) and `interrupts` (the full open set); call `resolve(payload)`
539
+ * to resume or `cancel()` to cancel. Resuming addresses the targeted interrupt
540
+ * and, once every open interrupt is addressed, submits a single spec `resume`
541
+ * array via `copilotkit.runAgent`.
533
542
  *
534
- * `event.value` is typed as `any` since the interrupt payload shape depends on your agent.
535
- * Type-narrow it in your callbacks (e.g. `handler`, `enabled`, `render`) as needed.
536
- *
537
- * @typeParam TResult - Inferred from `handler` return type. Exposed as `result` in `render`.
538
- * @param config - Interrupt configuration (renderer, optional handler/filter, and render mode).
539
- * @returns When `renderInChat` is `false`, returns the interrupt element (or `null` when idle).
540
- * Otherwise returns `void` and publishes the element into chat. In `render`, `result` is always
541
- * either the handler's resolved return value or `null` (including when no handler is provided,
542
- * when filtering skips the interrupt, or when handler execution fails).
543
- *
544
- * @example
545
- * ```tsx
546
- * import { useInterrupt } from "@copilotkit/react-core/v2";
547
- *
548
- * function InterruptUI() {
549
- * useInterrupt({
550
- * render: ({ event, resolve }) => (
551
- * <div>
552
- * <p>{event.value.question}</p>
553
- * <button onClick={() => resolve({ approved: true })}>Approve</button>
554
- * <button onClick={() => resolve({ approved: false })}>Reject</button>
555
- * </div>
556
- * ),
557
- * });
558
- *
559
- * return null;
560
- * }
561
- * ```
543
+ * - `renderInChat: true` (default): the element is published into `<CopilotChat>`; returns `void`.
544
+ * - `renderInChat: false`: the hook returns the interrupt element for manual placement.
562
545
  *
563
546
  * @example
564
547
  * ```tsx
565
- * import { useInterrupt } from "@copilotkit/react-core/v2";
566
- *
567
- * function CustomPanel() {
568
- * const interruptElement = useInterrupt({
569
- * renderInChat: false,
570
- * enabled: (event) => event.value.startsWith("approval:"),
571
- * handler: async ({ event }) => ({ label: event.value.toUpperCase() }),
572
- * render: ({ event, result, resolve }) => (
573
- * <aside>
574
- * <strong>{result?.label ?? ""}</strong>
575
- * <button onClick={() => resolve({ value: event.value })}>Continue</button>
576
- * </aside>
577
- * ),
578
- * });
579
- *
580
- * return <>{interruptElement}</>;
581
- * }
548
+ * useInterrupt({
549
+ * render: ({ interrupt, resolve, cancel }) => (
550
+ * <div>
551
+ * <p>{interrupt?.message}</p>
552
+ * <button onClick={() => resolve({ approved: true })}>Approve</button>
553
+ * <button onClick={() => cancel()}>Cancel</button>
554
+ * </div>
555
+ * ),
556
+ * });
582
557
  * ```
583
558
  */
584
559
  function useInterrupt(config) {
585
560
  const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
586
561
  const { agent } = useAgent({ agentId: config.agentId });
587
- const [pendingEvent, setPendingEvent] = (0, react.useState)(null);
588
- const pendingEventRef = (0, react.useRef)(pendingEvent);
589
- pendingEventRef.current = pendingEvent;
562
+ const [pending, setPending] = (0, react.useState)(null);
563
+ const pendingRef = (0, react.useRef)(pending);
564
+ pendingRef.current = pending;
590
565
  const [handlerResult, setHandlerResult] = (0, react.useState)(null);
566
+ const responsesRef = (0, react.useRef)({});
591
567
  (0, react.useEffect)(() => {
592
- let localInterrupt = null;
568
+ let localLegacy = null;
569
+ let localStandard = null;
593
570
  const subscription = agent.subscribe({
594
571
  onCustomEvent: ({ event }) => {
595
- if (event.name === INTERRUPT_EVENT_NAME) localInterrupt = {
572
+ if (event.name === INTERRUPT_EVENT_NAME) localLegacy = {
596
573
  name: event.name,
597
574
  value: event.value
598
575
  };
599
576
  },
577
+ onRunFinishedEvent: (params) => {
578
+ if (params.outcome === "interrupt") localStandard = params.interrupts;
579
+ },
600
580
  onRunStartedEvent: () => {
601
- localInterrupt = null;
602
- setPendingEvent(null);
581
+ localLegacy = null;
582
+ localStandard = null;
583
+ responsesRef.current = {};
584
+ setPending(null);
603
585
  },
604
586
  onRunFinalized: () => {
605
- if (localInterrupt) {
606
- setPendingEvent(localInterrupt);
607
- localInterrupt = null;
608
- }
587
+ if (localStandard && localStandard.length > 0) setPending({
588
+ kind: "standard",
589
+ interrupts: localStandard
590
+ });
591
+ else if (localLegacy) setPending({
592
+ kind: "legacy",
593
+ event: localLegacy
594
+ });
595
+ localLegacy = null;
596
+ localStandard = null;
609
597
  },
610
598
  onRunFailed: () => {
611
- localInterrupt = null;
612
- setPendingEvent(null);
599
+ localLegacy = null;
600
+ localStandard = null;
601
+ responsesRef.current = {};
602
+ setPending(null);
613
603
  }
614
604
  });
615
605
  return () => subscription.unsubscribe();
616
606
  }, [agent]);
617
- const resolve = (0, react.useCallback)(async (response) => {
607
+ const submitStandardIfComplete = (0, react.useCallback)(async (interrupts) => {
608
+ if (!interrupts.every((i) => responsesRef.current[i.id])) return;
609
+ const expired = interrupts.find((i) => (0, _ag_ui_client.isInterruptExpired)(i));
610
+ if (expired) {
611
+ console.error(`[CopilotKit] useInterrupt: interrupt ${expired.id} expired at ${expired.expiresAt}; not resuming.`);
612
+ responsesRef.current = {};
613
+ setPending(null);
614
+ return;
615
+ }
616
+ const resume = (0, _ag_ui_client.buildResumeArray)(interrupts, responsesRef.current);
617
+ for (const i of interrupts) {
618
+ if (!i.toolCallId) continue;
619
+ const response = responsesRef.current[i.id];
620
+ const content = response.status === "cancelled" ? { status: "cancelled" } : response.payload ?? { status: "resolved" };
621
+ agent.addMessage({
622
+ id: (0, _ag_ui_client.randomUUID)(),
623
+ role: "tool",
624
+ toolCallId: i.toolCallId,
625
+ content: JSON.stringify(content)
626
+ });
627
+ }
628
+ responsesRef.current = {};
618
629
  try {
630
+ return await copilotkit.runAgent({
631
+ agent,
632
+ resume
633
+ });
634
+ } catch (err) {
635
+ console.error("[CopilotKit] useInterrupt resolve: runAgent rejected; clearing pending + rethrowing", err);
636
+ setPending(null);
637
+ throw err;
638
+ }
639
+ }, [agent, copilotkit]);
640
+ const resolve = (0, react.useCallback)(async (payload, interruptId) => {
641
+ const current = pendingRef.current;
642
+ if (!current) return;
643
+ if (current.kind === "legacy") try {
619
644
  return await copilotkit.runAgent({
620
645
  agent,
621
646
  forwardedProps: { command: {
622
- resume: response,
623
- interruptEvent: pendingEventRef.current?.value
647
+ resume: payload,
648
+ interruptEvent: current.event.value
624
649
  } }
625
650
  });
626
651
  } catch (err) {
627
652
  console.error("[CopilotKit] useInterrupt resolve: runAgent rejected; clearing pending + rethrowing", err);
628
- setPendingEvent(null);
653
+ setPending(null);
629
654
  throw err;
630
655
  }
631
- }, [agent, copilotkit]);
656
+ if (current.interrupts.length > 1 && interruptId === void 0) console.warn(`[CopilotKit] useInterrupt: resolve()/cancel() called without an interruptId while ${current.interrupts.length} interrupts are open; defaulting to the first. Pass an interruptId to address a specific interrupt.`);
657
+ const id = interruptId ?? current.interrupts[0]?.id;
658
+ if (!id) return;
659
+ responsesRef.current[id] = {
660
+ status: "resolved",
661
+ payload
662
+ };
663
+ return submitStandardIfComplete(current.interrupts);
664
+ }, [
665
+ agent,
666
+ copilotkit,
667
+ submitStandardIfComplete
668
+ ]);
669
+ const cancel = (0, react.useCallback)(async (interruptId) => {
670
+ const current = pendingRef.current;
671
+ if (!current) return;
672
+ if (current.kind === "legacy") {
673
+ console.warn("[CopilotKit] useInterrupt: cancel() is not supported for legacy on_interrupt interrupts; dismissing.");
674
+ setPending(null);
675
+ return;
676
+ }
677
+ if (current.interrupts.length > 1 && interruptId === void 0) console.warn(`[CopilotKit] useInterrupt: resolve()/cancel() called without an interruptId while ${current.interrupts.length} interrupts are open; defaulting to the first. Pass an interruptId to address a specific interrupt.`);
678
+ const id = interruptId ?? current.interrupts[0]?.id;
679
+ if (!id) return;
680
+ responsesRef.current[id] = { status: "cancelled" };
681
+ return submitStandardIfComplete(current.interrupts);
682
+ }, [submitStandardIfComplete]);
632
683
  const renderRef = (0, react.useRef)(config.render);
633
684
  renderRef.current = config.render;
634
685
  const enabledRef = (0, react.useRef)(config.enabled);
@@ -637,6 +688,8 @@ function useInterrupt(config) {
637
688
  handlerRef.current = config.handler;
638
689
  const resolveRef = (0, react.useRef)(resolve);
639
690
  resolveRef.current = resolve;
691
+ const cancelRef = (0, react.useRef)(cancel);
692
+ cancelRef.current = cancel;
640
693
  const isEnabled = (event) => {
641
694
  const predicate = enabledRef.current;
642
695
  if (!predicate) return true;
@@ -648,11 +701,12 @@ function useInterrupt(config) {
648
701
  }
649
702
  };
650
703
  (0, react.useEffect)(() => {
651
- if (!pendingEvent) {
704
+ if (!pending) {
652
705
  setHandlerResult(null);
653
706
  return;
654
707
  }
655
- if (!isEnabled(pendingEvent)) {
708
+ const legacyEvent = toLegacyEvent(pending);
709
+ if (!isEnabled(legacyEvent)) {
656
710
  setHandlerResult(null);
657
711
  return;
658
712
  }
@@ -665,8 +719,11 @@ function useInterrupt(config) {
665
719
  let maybePromise;
666
720
  try {
667
721
  maybePromise = handler({
668
- event: pendingEvent,
669
- resolve: resolveRef.current
722
+ event: legacyEvent,
723
+ interrupt: pending.kind === "standard" ? pending.interrupts[0] : null,
724
+ interrupts: pending.kind === "standard" ? pending.interrupts : [],
725
+ resolve: resolveRef.current,
726
+ cancel: cancelRef.current
670
727
  });
671
728
  } catch (err) {
672
729
  console.error("[CopilotKit] useInterrupt handler threw; result will be null:", err);
@@ -685,19 +742,24 @@ function useInterrupt(config) {
685
742
  return () => {
686
743
  cancelled = true;
687
744
  };
688
- }, [pendingEvent]);
745
+ }, [pending]);
689
746
  const element = (0, react.useMemo)(() => {
690
- if (!pendingEvent) return null;
691
- if (!isEnabled(pendingEvent)) return null;
747
+ if (!pending) return null;
748
+ const legacyEvent = toLegacyEvent(pending);
749
+ if (!isEnabled(legacyEvent)) return null;
692
750
  return renderRef.current({
693
- event: pendingEvent,
751
+ event: legacyEvent,
752
+ interrupt: pending.kind === "standard" ? pending.interrupts[0] : null,
753
+ interrupts: pending.kind === "standard" ? pending.interrupts : [],
694
754
  result: handlerResult,
695
- resolve
755
+ resolve,
756
+ cancel
696
757
  });
697
758
  }, [
698
- pendingEvent,
759
+ pending,
699
760
  handlerResult,
700
- resolve
761
+ resolve,
762
+ cancel
701
763
  ]);
702
764
  (0, react.useEffect)(() => {
703
765
  if (config.renderInChat === false) return;
@@ -970,9 +1032,9 @@ function useThreadStoreSelector(store, selector) {
970
1032
  * current without polling — thread creates, renames, archives, and deletes
971
1033
  * from any client are reflected immediately.
972
1034
  *
973
- * Mutation methods (`renameThread`, `archiveThread`, `deleteThread`) return
974
- * promises that resolve once the platform confirms the operation and reject
975
- * with an `Error` on failure.
1035
+ * Mutation methods (`renameThread`, `archiveThread`, `unarchiveThread`,
1036
+ * `deleteThread`) return promises that resolve once the platform confirms the
1037
+ * operation and reject with an `Error` on failure.
976
1038
  *
977
1039
  * @param input - Agent identifier and optional list controls.
978
1040
  * @returns Thread list state and stable mutation callbacks.
@@ -1099,6 +1161,7 @@ function useThreads({ agentId, includeArchived, limit }) {
1099
1161
  }, [threadMutationsError]);
1100
1162
  const renameThread = (0, react.useMemo)(() => guardMutation((threadId, name) => store.renameThread(threadId, name)), [store, guardMutation]);
1101
1163
  const archiveThread = (0, react.useMemo)(() => guardMutation((threadId) => store.archiveThread(threadId)), [store, guardMutation]);
1164
+ const unarchiveThread = (0, react.useMemo)(() => guardMutation((threadId) => store.unarchiveThread(threadId)), [store, guardMutation]);
1102
1165
  const deleteThread = (0, react.useMemo)(() => guardMutation((threadId) => store.deleteThread(threadId)), [store, guardMutation]);
1103
1166
  return {
1104
1167
  threads,
@@ -1109,6 +1172,7 @@ function useThreads({ agentId, includeArchived, limit }) {
1109
1172
  fetchMoreThreads: (0, react.useCallback)(() => store.fetchNextPage(), [store]),
1110
1173
  renameThread,
1111
1174
  archiveThread,
1175
+ unarchiveThread,
1112
1176
  deleteThread
1113
1177
  };
1114
1178
  }
@@ -1183,10 +1247,20 @@ function useRenderTool(config, deps) {
1183
1247
  }) : defineToolCallRenderer({
1184
1248
  name: config.name,
1185
1249
  args: config.parameters,
1186
- render: (props) => config.render({
1187
- ...props,
1188
- parameters: props.args
1189
- }),
1250
+ render: (props) => {
1251
+ if (props.status === _copilotkit_core.ToolCallStatus.InProgress) return config.render({
1252
+ ...props,
1253
+ parameters: props.args
1254
+ });
1255
+ if (props.status === _copilotkit_core.ToolCallStatus.Executing) return config.render({
1256
+ ...props,
1257
+ parameters: props.args
1258
+ });
1259
+ return config.render({
1260
+ ...props,
1261
+ parameters: props.args
1262
+ });
1263
+ },
1190
1264
  ...config.agentId ? { agentId: config.agentId } : {}
1191
1265
  });
1192
1266
  copilotkit.addHookRenderToolCall(renderer);