@copilotkit/react-core 1.50.0-beta.1 → 1.50.0-beta.10

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 (201) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/dist/{chunk-UJBV5GAG.mjs → chunk-3775VM7Y.mjs} +32 -65
  3. package/dist/chunk-3775VM7Y.mjs.map +1 -0
  4. package/dist/{chunk-3GURHDG7.mjs → chunk-4HRUQH6U.mjs} +3 -3
  5. package/dist/{chunk-7BYHZLPL.mjs → chunk-4RRMC7L2.mjs} +4 -4
  6. package/dist/chunk-4RRMC7L2.mjs.map +1 -0
  7. package/dist/{chunk-D3QSYDJR.mjs → chunk-7IBF6RBW.mjs} +2 -2
  8. package/dist/{chunk-GMI4KO4X.mjs → chunk-7SHWECGN.mjs} +2 -2
  9. package/dist/{chunk-OVYFRPSN.mjs → chunk-ABWT4DRT.mjs} +2 -2
  10. package/dist/{chunk-WVLHXIFP.mjs → chunk-AFNWX62Q.mjs} +2 -2
  11. package/dist/{chunk-WVLHXIFP.mjs.map → chunk-AFNWX62Q.mjs.map} +1 -1
  12. package/dist/{chunk-JRT5BJF3.mjs → chunk-B5ELMVT7.mjs} +2 -2
  13. package/dist/{chunk-TXI72QHK.mjs → chunk-EG56H77V.mjs} +2 -2
  14. package/dist/{chunk-DCHSCK62.mjs → chunk-FYMZKPOL.mjs} +36 -42
  15. package/dist/chunk-FYMZKPOL.mjs.map +1 -0
  16. package/dist/{chunk-FBD24VEH.mjs → chunk-HE22TZMF.mjs} +2 -2
  17. package/dist/{chunk-FBD24VEH.mjs.map → chunk-HE22TZMF.mjs.map} +1 -1
  18. package/dist/chunk-I76HKHPJ.mjs +32 -0
  19. package/dist/chunk-I76HKHPJ.mjs.map +1 -0
  20. package/dist/{chunk-LHKZJ2ND.mjs → chunk-PMWUKW3Z.mjs} +3 -3
  21. package/dist/{chunk-NROJOTQP.mjs → chunk-QNUAXSDP.mjs} +9 -6
  22. package/dist/chunk-QNUAXSDP.mjs.map +1 -0
  23. package/dist/{chunk-NG26QEGF.mjs → chunk-T2VBHAAP.mjs} +9 -3
  24. package/dist/chunk-T2VBHAAP.mjs.map +1 -0
  25. package/dist/{chunk-QU6NONOD.mjs → chunk-U2ZRVVKT.mjs} +2 -2
  26. package/dist/{chunk-R4MR43UQ.mjs → chunk-VV56AVPB.mjs} +33 -9
  27. package/dist/chunk-VV56AVPB.mjs.map +1 -0
  28. package/dist/{chunk-5X5DJRQQ.mjs → chunk-WF65O6HX.mjs} +2 -7
  29. package/dist/chunk-WF65O6HX.mjs.map +1 -0
  30. package/dist/chunk-XDFVCQD3.mjs +27 -0
  31. package/dist/chunk-XDFVCQD3.mjs.map +1 -0
  32. package/dist/{chunk-WMJVBMUX.mjs → chunk-YCG6SNAU.mjs} +2 -2
  33. package/dist/{chunk-3R423LZT.mjs → chunk-YJGPIN3R.mjs} +3 -3
  34. package/dist/{chunk-BR5YEYZJ.mjs → chunk-YTQHRJUA.mjs} +2 -2
  35. package/dist/chunk-Z6JV2LRY.mjs +37 -0
  36. package/dist/chunk-Z6JV2LRY.mjs.map +1 -0
  37. package/dist/{chunk-24SCZAB4.mjs → chunk-ZYTXB6HH.mjs} +22 -14
  38. package/dist/chunk-ZYTXB6HH.mjs.map +1 -0
  39. package/dist/components/CopilotListeners.js +13 -146
  40. package/dist/components/CopilotListeners.js.map +1 -1
  41. package/dist/components/CopilotListeners.mjs +1 -6
  42. package/dist/components/copilot-provider/copilot-messages.js +1 -1
  43. package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
  44. package/dist/components/copilot-provider/copilot-messages.mjs +2 -2
  45. package/dist/components/copilot-provider/copilotkit-props.d.ts +1 -1
  46. package/dist/components/copilot-provider/copilotkit.d.ts +1 -1
  47. package/dist/components/copilot-provider/copilotkit.js +35 -40
  48. package/dist/components/copilot-provider/copilotkit.js.map +1 -1
  49. package/dist/components/copilot-provider/copilotkit.mjs +9 -9
  50. package/dist/components/copilot-provider/index.d.ts +1 -1
  51. package/dist/components/copilot-provider/index.js +35 -40
  52. package/dist/components/copilot-provider/index.js.map +1 -1
  53. package/dist/components/copilot-provider/index.mjs +9 -9
  54. package/dist/components/dev-console/console-trigger.js +1 -1
  55. package/dist/components/dev-console/console-trigger.js.map +1 -1
  56. package/dist/components/dev-console/console-trigger.mjs +3 -3
  57. package/dist/components/dev-console/developer-console-modal.js +1 -1
  58. package/dist/components/dev-console/developer-console-modal.js.map +1 -1
  59. package/dist/components/dev-console/developer-console-modal.mjs +2 -2
  60. package/dist/components/index.d.ts +1 -1
  61. package/dist/components/index.js +35 -40
  62. package/dist/components/index.js.map +1 -1
  63. package/dist/components/index.mjs +9 -9
  64. package/dist/context/copilot-context.d.ts +1 -1
  65. package/dist/context/copilot-context.js +1 -1
  66. package/dist/context/copilot-context.js.map +1 -1
  67. package/dist/context/copilot-context.mjs +1 -1
  68. package/dist/context/index.d.ts +1 -1
  69. package/dist/context/index.js +1 -1
  70. package/dist/context/index.js.map +1 -1
  71. package/dist/context/index.mjs +1 -1
  72. package/dist/{copilot-context-1cd70a3f.d.ts → copilot-context-ec77e921.d.ts} +3 -3
  73. package/dist/hooks/index.d.ts +2 -2
  74. package/dist/hooks/index.js +254 -219
  75. package/dist/hooks/index.js.map +1 -1
  76. package/dist/hooks/index.mjs +24 -23
  77. package/dist/hooks/use-agent-nodename.d.ts +3 -0
  78. package/dist/hooks/use-agent-nodename.js +56 -0
  79. package/dist/hooks/use-agent-nodename.js.map +1 -0
  80. package/dist/hooks/use-agent-nodename.mjs +8 -0
  81. package/dist/hooks/use-coagent-state-render-bridge.js +8 -5
  82. package/dist/hooks/use-coagent-state-render-bridge.js.map +1 -1
  83. package/dist/hooks/use-coagent-state-render-bridge.mjs +2 -2
  84. package/dist/hooks/use-coagent-state-render.js +1 -1
  85. package/dist/hooks/use-coagent-state-render.js.map +1 -1
  86. package/dist/hooks/use-coagent-state-render.mjs +2 -2
  87. package/dist/hooks/use-coagent.js +58 -21
  88. package/dist/hooks/use-coagent.js.map +1 -1
  89. package/dist/hooks/use-coagent.mjs +2 -1
  90. package/dist/hooks/use-copilot-action.js +5 -1
  91. package/dist/hooks/use-copilot-action.js.map +1 -1
  92. package/dist/hooks/use-copilot-action.mjs +2 -2
  93. package/dist/hooks/use-copilot-additional-instructions.js +1 -1
  94. package/dist/hooks/use-copilot-additional-instructions.js.map +1 -1
  95. package/dist/hooks/use-copilot-additional-instructions.mjs +2 -2
  96. package/dist/hooks/use-copilot-authenticated-action.js +6 -2
  97. package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
  98. package/dist/hooks/use-copilot-authenticated-action.mjs +4 -4
  99. package/dist/hooks/use-copilot-chat-headless_c.js +128 -140
  100. package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
  101. package/dist/hooks/use-copilot-chat-headless_c.mjs +6 -6
  102. package/dist/hooks/{use-configure-chat-suggestions.d.ts → use-copilot-chat-suggestions.d.ts} +2 -3
  103. package/dist/hooks/use-copilot-chat-suggestions.js +60 -0
  104. package/dist/hooks/use-copilot-chat-suggestions.js.map +1 -0
  105. package/dist/hooks/use-copilot-chat-suggestions.mjs +8 -0
  106. package/dist/hooks/use-copilot-chat-suggestions.mjs.map +1 -0
  107. package/dist/hooks/use-copilot-chat.js +126 -138
  108. package/dist/hooks/use-copilot-chat.js.map +1 -1
  109. package/dist/hooks/use-copilot-chat.mjs +6 -6
  110. package/dist/hooks/use-copilot-chat_internal.d.ts +18 -1
  111. package/dist/hooks/use-copilot-chat_internal.js +126 -138
  112. package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
  113. package/dist/hooks/use-copilot-chat_internal.mjs +5 -5
  114. package/dist/hooks/use-copilot-readable.d.ts +1 -1
  115. package/dist/hooks/use-copilot-readable.js +29 -5
  116. package/dist/hooks/use-copilot-readable.js.map +1 -1
  117. package/dist/hooks/use-copilot-readable.mjs +1 -1
  118. package/dist/hooks/use-default-tool.js +5 -1
  119. package/dist/hooks/use-default-tool.js.map +1 -1
  120. package/dist/hooks/use-default-tool.mjs +3 -3
  121. package/dist/hooks/use-frontend-tool.js +5 -1
  122. package/dist/hooks/use-frontend-tool.js.map +1 -1
  123. package/dist/hooks/use-frontend-tool.mjs +1 -1
  124. package/dist/hooks/use-langgraph-interrupt-render.js +77 -13
  125. package/dist/hooks/use-langgraph-interrupt-render.js.map +1 -1
  126. package/dist/hooks/use-langgraph-interrupt-render.mjs +3 -2
  127. package/dist/hooks/use-langgraph-interrupt.d.ts +1 -1
  128. package/dist/hooks/use-langgraph-interrupt.js +3 -3
  129. package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
  130. package/dist/hooks/use-langgraph-interrupt.mjs +2 -2
  131. package/dist/hooks/use-make-copilot-document-readable.js +1 -1
  132. package/dist/hooks/use-make-copilot-document-readable.js.map +1 -1
  133. package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
  134. package/dist/index.d.ts +2 -2
  135. package/dist/index.js +273 -246
  136. package/dist/index.js.map +1 -1
  137. package/dist/index.mjs +34 -33
  138. package/dist/lib/copilot-task.d.ts +1 -1
  139. package/dist/lib/copilot-task.js.map +1 -1
  140. package/dist/lib/copilot-task.mjs +10 -10
  141. package/dist/lib/index.d.ts +1 -1
  142. package/dist/lib/index.js.map +1 -1
  143. package/dist/lib/index.mjs +10 -10
  144. package/dist/types/index.d.ts +1 -1
  145. package/dist/types/interrupt-action.d.ts +1 -1
  146. package/dist/types/interrupt-action.js.map +1 -1
  147. package/dist/utils/index.mjs +3 -3
  148. package/dist/v2/index.css +4 -0
  149. package/dist/v2/index.css.map +1 -0
  150. package/dist/v2/index.js.map +1 -1
  151. package/dist/v2/index.mjs +2 -0
  152. package/dist/v2/index.mjs.map +1 -1
  153. package/jest.config.js +12 -0
  154. package/package.json +14 -11
  155. package/src/components/CopilotListeners.tsx +1 -2
  156. package/src/components/copilot-provider/copilot-messages.tsx +0 -41
  157. package/src/components/copilot-provider/copilotkit.tsx +31 -31
  158. package/src/context/copilot-context.tsx +2 -2
  159. package/src/hooks/__tests__/use-coagent-config.test.ts +189 -129
  160. package/src/hooks/index.ts +2 -2
  161. package/src/hooks/use-agent-nodename.ts +30 -0
  162. package/src/hooks/use-coagent-state-render-bridge.tsx +22 -22
  163. package/src/hooks/use-coagent.ts +22 -13
  164. package/src/hooks/use-copilot-chat-suggestions.tsx +124 -0
  165. package/src/hooks/use-copilot-chat_internal.ts +78 -78
  166. package/src/hooks/use-copilot-readable.ts +30 -12
  167. package/src/hooks/use-frontend-tool.ts +10 -2
  168. package/src/hooks/use-langgraph-interrupt-render.ts +25 -7
  169. package/src/hooks/use-langgraph-interrupt.ts +2 -3
  170. package/src/types/interrupt-action.ts +2 -5
  171. package/src/v2/index.ts +2 -0
  172. package/tsup.config.ts +1 -1
  173. package/dist/chunk-24SCZAB4.mjs.map +0 -1
  174. package/dist/chunk-5X5DJRQQ.mjs.map +0 -1
  175. package/dist/chunk-7BYHZLPL.mjs.map +0 -1
  176. package/dist/chunk-CB7CRBDG.mjs +0 -48
  177. package/dist/chunk-CB7CRBDG.mjs.map +0 -1
  178. package/dist/chunk-DCHSCK62.mjs.map +0 -1
  179. package/dist/chunk-IUSKVYUI.mjs +0 -13
  180. package/dist/chunk-IUSKVYUI.mjs.map +0 -1
  181. package/dist/chunk-NG26QEGF.mjs.map +0 -1
  182. package/dist/chunk-NROJOTQP.mjs.map +0 -1
  183. package/dist/chunk-R4MR43UQ.mjs.map +0 -1
  184. package/dist/chunk-UJBV5GAG.mjs.map +0 -1
  185. package/dist/hooks/use-configure-chat-suggestions.js +0 -210
  186. package/dist/hooks/use-configure-chat-suggestions.js.map +0 -1
  187. package/dist/hooks/use-configure-chat-suggestions.mjs +0 -13
  188. package/src/hooks/use-configure-chat-suggestions.tsx +0 -85
  189. /package/dist/{chunk-3GURHDG7.mjs.map → chunk-4HRUQH6U.mjs.map} +0 -0
  190. /package/dist/{chunk-D3QSYDJR.mjs.map → chunk-7IBF6RBW.mjs.map} +0 -0
  191. /package/dist/{chunk-GMI4KO4X.mjs.map → chunk-7SHWECGN.mjs.map} +0 -0
  192. /package/dist/{chunk-OVYFRPSN.mjs.map → chunk-ABWT4DRT.mjs.map} +0 -0
  193. /package/dist/{chunk-JRT5BJF3.mjs.map → chunk-B5ELMVT7.mjs.map} +0 -0
  194. /package/dist/{chunk-TXI72QHK.mjs.map → chunk-EG56H77V.mjs.map} +0 -0
  195. /package/dist/{chunk-LHKZJ2ND.mjs.map → chunk-PMWUKW3Z.mjs.map} +0 -0
  196. /package/dist/{chunk-QU6NONOD.mjs.map → chunk-U2ZRVVKT.mjs.map} +0 -0
  197. /package/dist/{chunk-WMJVBMUX.mjs.map → chunk-YCG6SNAU.mjs.map} +0 -0
  198. /package/dist/{chunk-3R423LZT.mjs.map → chunk-YJGPIN3R.mjs.map} +0 -0
  199. /package/dist/{chunk-BR5YEYZJ.mjs.map → chunk-YTQHRJUA.mjs.map} +0 -0
  200. /package/dist/hooks/{use-configure-chat-suggestions.mjs.map → use-agent-nodename.mjs.map} +0 -0
  201. /package/src/v2/{styles.css → index.css} +0 -0
@@ -2,28 +2,28 @@ import {
2
2
  CopilotKit,
3
3
  CopilotKitInternal,
4
4
  defaultCopilotContextCategories
5
- } from "../../chunk-DCHSCK62.mjs";
5
+ } from "../../chunk-FYMZKPOL.mjs";
6
6
  import "../../chunk-LHERIF3L.mjs";
7
- import "../../chunk-FBD24VEH.mjs";
8
- import "../../chunk-LHKZJ2ND.mjs";
9
- import "../../chunk-WMJVBMUX.mjs";
7
+ import "../../chunk-HE22TZMF.mjs";
8
+ import "../../chunk-PMWUKW3Z.mjs";
9
+ import "../../chunk-YCG6SNAU.mjs";
10
10
  import "../../chunk-PIF5KJYI.mjs";
11
+ import "../../chunk-RKTVJRK7.mjs";
11
12
  import "../../chunk-CYDWEPFL.mjs";
12
- import "../../chunk-2IDV5OHF.mjs";
13
13
  import "../../chunk-ICIK2BSB.mjs";
14
- import "../../chunk-RKTVJRK7.mjs";
14
+ import "../../chunk-2IDV5OHF.mjs";
15
15
  import "../../chunk-YYN33GSG.mjs";
16
16
  import "../../chunk-PMAFHQ7P.mjs";
17
17
  import "../../chunk-6PUNP7CD.mjs";
18
18
  import "../../chunk-O7ARI5CV.mjs";
19
- import "../../chunk-NROJOTQP.mjs";
20
- import "../../chunk-5X5DJRQQ.mjs";
19
+ import "../../chunk-QNUAXSDP.mjs";
21
20
  import "../../chunk-NB2FKV2V.mjs";
22
21
  import "../../chunk-F555TVE4.mjs";
22
+ import "../../chunk-WF65O6HX.mjs";
23
23
  import "../../chunk-EFL5OBKN.mjs";
24
24
  import "../../chunk-6ZLPNY7X.mjs";
25
25
  import "../../chunk-FDOMAPJY.mjs";
26
- import "../../chunk-WVLHXIFP.mjs";
26
+ import "../../chunk-AFNWX62Q.mjs";
27
27
  import "../../chunk-DMLQZG75.mjs";
28
28
  import "../../chunk-SKC7AJIV.mjs";
29
29
  export {
@@ -3,7 +3,7 @@ export { CopilotKitProps } from './copilotkit-props.js';
3
3
  import 'react/jsx-runtime';
4
4
  import '@copilotkit/runtime-client-gql';
5
5
  import 'react';
6
- import '../../copilot-context-1cd70a3f.js';
6
+ import '../../copilot-context-ec77e921.js';
7
7
  import '@copilotkit/shared';
8
8
  import '../../types/frontend-action.js';
9
9
  import '../../hooks/use-tree.js';
@@ -165,7 +165,7 @@ var emptyCopilotContext = {
165
165
  interruptEventQueue: {},
166
166
  addInterruptEvent: () => {
167
167
  },
168
- removeInterruptEvent: () => {
168
+ resolveInterruptEvent: () => {
169
169
  },
170
170
  onError: () => {
171
171
  },
@@ -2292,6 +2292,8 @@ function useThreads() {
2292
2292
  // src/hooks/use-coagent-state-render-bridge.tsx
2293
2293
  var import_shared10 = require("@copilotkit/shared");
2294
2294
  function getStateWithoutConstantKeys(state) {
2295
+ if (!state)
2296
+ return {};
2295
2297
  const _a = state, { messages, tools, copilotkit } = _a, stateWithoutConstantKeys = __objRest(_a, ["messages", "tools", "copilotkit"]);
2296
2298
  return stateWithoutConstantKeys;
2297
2299
  }
@@ -2338,9 +2340,6 @@ function useCoagentStateRenderBridge(agentId, props) {
2338
2340
  unsubscribe();
2339
2341
  };
2340
2342
  }, [agentId, nodeName]);
2341
- if (messageIndexInRun !== 0) {
2342
- return null;
2343
- }
2344
2343
  const getStateRender = (0, import_react13.useCallback)(
2345
2344
  (messageId) => {
2346
2345
  return Object.entries(coAgentStateRenders).find(([stateRenderId, stateRender]) => {
@@ -2368,7 +2367,7 @@ function useCoagentStateRenderBridge(agentId, props) {
2368
2367
  return canRender;
2369
2368
  }
2370
2369
  const renderClaimedByOtherMessage = Object.values(claimsRef.current).find(
2371
- (c) => c.stateRenderId === stateRenderId && (0, import_shared10.dataToUUID)(JSON.stringify(getStateWithoutConstantKeys(c.stateSnapshot))) === (0, import_shared10.dataToUUID)(JSON.stringify(getStateWithoutConstantKeys(renderSnapshot)))
2370
+ (c) => c.stateRenderId === stateRenderId && (0, import_shared10.dataToUUID)(getStateWithoutConstantKeys(c.stateSnapshot)) === (0, import_shared10.dataToUUID)(getStateWithoutConstantKeys(renderSnapshot))
2372
2371
  );
2373
2372
  if (renderClaimedByOtherMessage) {
2374
2373
  if (renderSnapshot && renderClaimedByOtherMessage.stateSnapshot && !areStatesEquals(renderClaimedByOtherMessage.stateSnapshot, renderSnapshot)) {
@@ -2385,6 +2384,9 @@ function useCoagentStateRenderBridge(agentId, props) {
2385
2384
  };
2386
2385
  return (0, import_react13.useMemo)(() => {
2387
2386
  var _a2, _b, _c;
2387
+ if (messageIndexInRun !== 0) {
2388
+ return null;
2389
+ }
2388
2390
  const [stateRenderId, stateRender] = (_a2 = getStateRender(message.id)) != null ? _a2 : [];
2389
2391
  if (!stateRender || !stateRenderId) {
2390
2392
  return null;
@@ -2431,7 +2433,8 @@ function useCoagentStateRenderBridge(agentId, props) {
2431
2433
  agent == null ? void 0 : agent.isRunning,
2432
2434
  nodeName,
2433
2435
  effectiveRunId,
2434
- message.id
2436
+ message.id,
2437
+ messageIndexInRun
2435
2438
  ]);
2436
2439
  }
2437
2440
  function CoAgentStateRenderBridge(props) {
@@ -2476,11 +2479,9 @@ var usePredictStateSubscription = (agent) => {
2476
2479
  }, [agent, getSubscriber]);
2477
2480
  };
2478
2481
  function CopilotListeners() {
2479
- var _a, _b;
2480
2482
  const { copilotkit } = (0, import_react15.useCopilotKit)();
2481
- const { agentSession } = useCopilotContext();
2482
2483
  const existingConfig = (0, import_react15.useCopilotChatConfiguration)();
2483
- const resolvedAgentId = (_b = (_a = agentSession == null ? void 0 : agentSession.agentName) != null ? _a : existingConfig == null ? void 0 : existingConfig.agentId) != null ? _b : "default";
2484
+ const resolvedAgentId = existingConfig == null ? void 0 : existingConfig.agentId;
2484
2485
  const { setBannerError } = useToast();
2485
2486
  const { agent } = (0, import_react15.useAgent)({ agentId: resolvedAgentId });
2486
2487
  usePredictStateSubscription(agent);
@@ -2505,15 +2506,7 @@ function CopilotKit(_a) {
2505
2506
  const enabled = shouldShowDevConsole(props.showDevConsole);
2506
2507
  const publicApiKey = props.publicApiKey || props.publicLicenseKey;
2507
2508
  const renderArr = (0, import_react16.useMemo)(() => [{ render: CoAgentStateRenderBridge }], []);
2508
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToastProvider, { enabled, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CopilotErrorBoundary, { publicApiKey, showUsageBanner: enabled, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ThreadsProvider, { threadId: props.threadId, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2509
- import_react17.CopilotKitProvider,
2510
- {
2511
- runtimeUrl: props.runtimeUrl,
2512
- renderCustomMessages: renderArr,
2513
- useSingleEndpoint: true,
2514
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CopilotKitInternal, __spreadProps(__spreadValues({}, props), { children }))
2515
- }
2516
- ) }) }) });
2509
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToastProvider, { enabled, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CopilotErrorBoundary, { publicApiKey, showUsageBanner: enabled, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ThreadsProvider, { threadId: props.threadId, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react17.CopilotKitProvider, __spreadProps(__spreadValues({}, props), { renderCustomMessages: renderArr, useSingleEndpoint: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CopilotKitInternal, __spreadProps(__spreadValues({}, props), { children })) })) }) }) });
2517
2510
  }
2518
2511
  function CopilotKitInternal(cpkProps) {
2519
2512
  var _b;
@@ -2751,20 +2744,17 @@ ${nonDocumentStrings}`;
2751
2744
  const chatAbortControllerRef = (0, import_react16.useRef)(null);
2752
2745
  const showDevConsole = shouldShowDevConsole(props.showDevConsole);
2753
2746
  const [interruptActions, _setInterruptActions] = (0, import_react16.useState)({});
2754
- const setInterruptAction = (0, import_react16.useCallback)(
2755
- (threadId2, action) => {
2756
- _setInterruptActions((prev) => {
2757
- var _a2;
2758
- if (action == null || !action.id) {
2759
- return prev;
2760
- }
2761
- return __spreadProps(__spreadValues({}, prev), {
2762
- [action.id]: __spreadValues(__spreadValues({}, (_a2 = prev[action.id]) != null ? _a2 : {}), action)
2763
- });
2747
+ const setInterruptAction = (0, import_react16.useCallback)((action) => {
2748
+ _setInterruptActions((prev) => {
2749
+ var _a2;
2750
+ if (action == null || !action.id) {
2751
+ return prev;
2752
+ }
2753
+ return __spreadProps(__spreadValues({}, prev), {
2754
+ [action.id]: __spreadValues(__spreadValues({}, (_a2 = prev[action.id]) != null ? _a2 : {}), action)
2764
2755
  });
2765
- },
2766
- []
2767
- );
2756
+ });
2757
+ }, []);
2768
2758
  const removeInterruptAction = (0, import_react16.useCallback)((actionId) => {
2769
2759
  _setInterruptActions((prev) => {
2770
2760
  const _a2 = prev, { [actionId]: _ } = _a2, rest = __objRest(_a2, [__restKey(actionId)]);
@@ -2780,14 +2770,19 @@ ${nonDocumentStrings}`;
2780
2770
  });
2781
2771
  });
2782
2772
  }, []);
2783
- const removeInterruptEvent = (0, import_react16.useCallback)((threadId2, eventId) => {
2784
- setInterruptEventQueue((prev) => {
2785
- const threadQueue = prev[threadId2] || [];
2786
- return __spreadProps(__spreadValues({}, prev), {
2787
- [threadId2]: threadQueue.filter((event) => event.eventId !== eventId)
2773
+ const resolveInterruptEvent = (0, import_react16.useCallback)(
2774
+ (threadId2, eventId, response) => {
2775
+ setInterruptEventQueue((prev) => {
2776
+ const threadQueue = prev[threadId2] || [];
2777
+ return __spreadProps(__spreadValues({}, prev), {
2778
+ [threadId2]: threadQueue.map(
2779
+ (queuedEvent) => queuedEvent.eventId === eventId ? __spreadProps(__spreadValues({}, queuedEvent), { event: __spreadProps(__spreadValues({}, queuedEvent.event), { response }) }) : queuedEvent
2780
+ )
2781
+ });
2788
2782
  });
2789
- });
2790
- }, []);
2783
+ },
2784
+ []
2785
+ );
2791
2786
  const memoizedChildren = (0, import_react16.useMemo)(() => children, [children]);
2792
2787
  const [bannerError, setBannerError] = (0, import_react16.useState)(null);
2793
2788
  const agentLock = (0, import_react16.useMemo)(() => {
@@ -2850,7 +2845,7 @@ ${nonDocumentStrings}`;
2850
2845
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2851
2846
  import_react17.CopilotChatConfigurationProvider,
2852
2847
  {
2853
- agentId: (_b = agentSession == null ? void 0 : agentSession.agentName) != null ? _b : "default",
2848
+ agentId: (_b = props.agent) != null ? _b : "default",
2854
2849
  threadId,
2855
2850
  children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2856
2851
  CopilotContext.Provider,
@@ -2905,7 +2900,7 @@ ${nonDocumentStrings}`;
2905
2900
  removeInterruptAction,
2906
2901
  interruptEventQueue,
2907
2902
  addInterruptEvent,
2908
- removeInterruptEvent,
2903
+ resolveInterruptEvent,
2909
2904
  bannerError,
2910
2905
  setBannerError,
2911
2906
  onError: handleErrors,