@copilotkit/react-core 0.0.0-fix-debug-infosys-20251107162427 → 0.0.0-fix-restore-handle-method-node-http-20260105204107

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 (355) hide show
  1. package/CHANGELOG.md +309 -4
  2. package/dist/chunk-36KQV2NA.mjs +1 -0
  3. package/dist/{chunk-OKCYPO4I.mjs → chunk-3MHWEKFN.mjs} +5 -5
  4. package/dist/chunk-4RRMC7L2.mjs +32 -0
  5. package/dist/chunk-4RRMC7L2.mjs.map +1 -0
  6. package/dist/{chunk-E3624YDU.mjs → chunk-53K6WNJG.mjs} +8 -6
  7. package/dist/{chunk-E3624YDU.mjs.map → chunk-53K6WNJG.mjs.map} +1 -1
  8. package/dist/{chunk-N4WEHORG.mjs → chunk-6PUNP7CD.mjs} +4 -4
  9. package/dist/chunk-6PUNP7CD.mjs.map +1 -0
  10. package/dist/chunk-7DTB7S5V.mjs +83 -0
  11. package/dist/chunk-7DTB7S5V.mjs.map +1 -0
  12. package/dist/{chunk-BBUQMG45.mjs → chunk-7IBF6RBW.mjs} +3 -3
  13. package/dist/{chunk-BBUQMG45.mjs.map → chunk-7IBF6RBW.mjs.map} +1 -1
  14. package/dist/chunk-A6NKSGH3.mjs +1 -0
  15. package/dist/{chunk-MGWRDFBE.mjs → chunk-ABWT4DRT.mjs} +2 -2
  16. package/dist/{chunk-EUX2P2E7.mjs → chunk-AFNWX62Q.mjs} +11 -9
  17. package/dist/chunk-AFNWX62Q.mjs.map +1 -0
  18. package/dist/{chunk-MQYWH4E6.mjs → chunk-BUSWSDYO.mjs} +2 -2
  19. package/dist/chunk-CDUIA2WM.mjs +60 -0
  20. package/dist/chunk-CDUIA2WM.mjs.map +1 -0
  21. package/dist/chunk-CYDWEPFL.mjs +1 -0
  22. package/dist/{chunk-ZLQVRPDS.mjs → chunk-DMLQZG75.mjs} +1 -1
  23. package/dist/chunk-DMLQZG75.mjs.map +1 -0
  24. package/dist/{chunk-U7QULEVO.mjs → chunk-E7SE25ZU.mjs} +3 -3
  25. package/dist/chunk-F555TVE4.mjs +33 -0
  26. package/dist/chunk-F555TVE4.mjs.map +1 -0
  27. package/dist/chunk-FD6FGKYY.mjs +1 -0
  28. package/dist/chunk-FDOMAPJY.mjs +59 -0
  29. package/dist/chunk-FDOMAPJY.mjs.map +1 -0
  30. package/dist/{chunk-OAGAFMUM.mjs → chunk-FQFXYAV7.mjs} +6 -5
  31. package/dist/{chunk-OAGAFMUM.mjs.map → chunk-FQFXYAV7.mjs.map} +1 -1
  32. package/dist/chunk-GPEJNVE5.mjs +80 -0
  33. package/dist/chunk-GPEJNVE5.mjs.map +1 -0
  34. package/dist/chunk-I76HKHPJ.mjs +32 -0
  35. package/dist/chunk-I76HKHPJ.mjs.map +1 -0
  36. package/dist/{chunk-C6IANC2R.mjs → chunk-INPM7YKW.mjs} +9 -45
  37. package/dist/chunk-INPM7YKW.mjs.map +1 -0
  38. package/dist/chunk-JD7BAH7U.mjs +1 -0
  39. package/dist/chunk-LSHFN2Y5.mjs +349 -0
  40. package/dist/chunk-LSHFN2Y5.mjs.map +1 -0
  41. package/dist/chunk-NB2FKV2V.mjs +1 -0
  42. package/dist/chunk-NBK4KBLX.mjs +54 -0
  43. package/dist/chunk-NBK4KBLX.mjs.map +1 -0
  44. package/dist/chunk-QNUAXSDP.mjs +166 -0
  45. package/dist/chunk-QNUAXSDP.mjs.map +1 -0
  46. package/dist/chunk-RB2TXKFP.mjs +551 -0
  47. package/dist/chunk-RB2TXKFP.mjs.map +1 -0
  48. package/dist/{chunk-EDBI5PCJ.mjs → chunk-RW2Y52HO.mjs} +2 -2
  49. package/dist/chunk-RW2Y52HO.mjs.map +1 -0
  50. package/dist/{chunk-N4VN2B5S.mjs → chunk-SNON4QA6.mjs} +4 -4
  51. package/dist/chunk-SPCZTZCY.mjs +1 -0
  52. package/dist/chunk-SPCZTZCY.mjs.map +1 -0
  53. package/dist/chunk-VV56AVPB.mjs +125 -0
  54. package/dist/chunk-VV56AVPB.mjs.map +1 -0
  55. package/dist/chunk-WF65O6HX.mjs +66 -0
  56. package/dist/chunk-WF65O6HX.mjs.map +1 -0
  57. package/dist/chunk-XDFVCQD3.mjs +27 -0
  58. package/dist/chunk-XDFVCQD3.mjs.map +1 -0
  59. package/dist/{chunk-GT5WI3AF.mjs → chunk-YTQHRJUA.mjs} +7 -9
  60. package/dist/chunk-YTQHRJUA.mjs.map +1 -0
  61. package/dist/{chunk-5FHSUKQL.mjs → chunk-YYN33GSG.mjs} +5 -2
  62. package/dist/chunk-YYN33GSG.mjs.map +1 -0
  63. package/dist/chunk-Z6JV2LRY.mjs +37 -0
  64. package/dist/chunk-Z6JV2LRY.mjs.map +1 -0
  65. package/dist/chunk-ZVF5Q6IH.mjs +29 -0
  66. package/dist/chunk-ZVF5Q6IH.mjs.map +1 -0
  67. package/dist/chunk-ZYTXB6HH.mjs +151 -0
  68. package/dist/chunk-ZYTXB6HH.mjs.map +1 -0
  69. package/dist/components/CopilotListeners.d.ts +3 -0
  70. package/dist/components/CopilotListeners.js +101 -0
  71. package/dist/components/CopilotListeners.js.map +1 -0
  72. package/dist/components/CopilotListeners.mjs +9 -0
  73. package/dist/components/CopilotListeners.mjs.map +1 -0
  74. package/dist/components/copilot-provider/copilot-messages.js +14 -48
  75. package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
  76. package/dist/components/copilot-provider/copilot-messages.mjs +3 -3
  77. package/dist/components/copilot-provider/copilotkit-props.d.ts +15 -2
  78. package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
  79. package/dist/components/copilot-provider/copilotkit.d.ts +2 -1
  80. package/dist/components/copilot-provider/copilotkit.js +491 -1361
  81. package/dist/components/copilot-provider/copilotkit.js.map +1 -1
  82. package/dist/components/copilot-provider/copilotkit.mjs +15 -13
  83. package/dist/components/copilot-provider/index.d.ts +2 -1
  84. package/dist/components/copilot-provider/index.js +491 -1361
  85. package/dist/components/copilot-provider/index.js.map +1 -1
  86. package/dist/components/copilot-provider/index.mjs +16 -13
  87. package/dist/components/dev-console/console-trigger.js +10 -8
  88. package/dist/components/dev-console/console-trigger.js.map +1 -1
  89. package/dist/components/dev-console/console-trigger.mjs +226 -6
  90. package/dist/components/dev-console/console-trigger.mjs.map +1 -1
  91. package/dist/components/dev-console/developer-console-modal.js +10 -8
  92. package/dist/components/dev-console/developer-console-modal.js.map +1 -1
  93. package/dist/components/dev-console/developer-console-modal.mjs +3 -3
  94. package/dist/components/error-boundary/error-boundary.d.ts +7 -7
  95. package/dist/components/error-boundary/error-boundary.js +3 -3
  96. package/dist/components/error-boundary/error-boundary.js.map +1 -1
  97. package/dist/components/error-boundary/error-boundary.mjs +3 -3
  98. package/dist/components/error-boundary/error-utils.d.ts +1 -1
  99. package/dist/components/error-boundary/error-utils.js +3 -3
  100. package/dist/components/error-boundary/error-utils.js.map +1 -1
  101. package/dist/components/error-boundary/error-utils.mjs +1 -1
  102. package/dist/components/index.d.ts +2 -1
  103. package/dist/components/index.js +491 -1361
  104. package/dist/components/index.js.map +1 -1
  105. package/dist/components/index.mjs +17 -13
  106. package/dist/components/toast/exclamation-mark-icon.d.ts +2 -2
  107. package/dist/components/toast/toast-provider.d.ts +3 -3
  108. package/dist/components/usage-banner.d.ts +2 -2
  109. package/dist/context/coagent-state-renders-context.d.ts +24 -0
  110. package/dist/context/coagent-state-renders-context.js +91 -0
  111. package/dist/context/coagent-state-renders-context.js.map +1 -0
  112. package/dist/context/coagent-state-renders-context.mjs +12 -0
  113. package/dist/context/coagent-state-renders-context.mjs.map +1 -0
  114. package/dist/context/copilot-context.d.ts +1 -1
  115. package/dist/context/copilot-context.js +10 -8
  116. package/dist/context/copilot-context.js.map +1 -1
  117. package/dist/context/copilot-context.mjs +1 -1
  118. package/dist/context/copilot-messages-context.d.ts +18 -11
  119. package/dist/context/copilot-messages-context.js.map +1 -1
  120. package/dist/context/copilot-messages-context.mjs +1 -1
  121. package/dist/context/index.d.ts +6 -2
  122. package/dist/context/index.js +110 -10
  123. package/dist/context/index.js.map +1 -1
  124. package/dist/context/index.mjs +23 -7
  125. package/dist/context/threads-context.d.ts +16 -0
  126. package/dist/context/threads-context.js +59 -0
  127. package/dist/context/threads-context.js.map +1 -0
  128. package/dist/context/threads-context.mjs +12 -0
  129. package/dist/context/threads-context.mjs.map +1 -0
  130. package/dist/{copilot-context-cf9de848.d.ts → copilot-context-ec77e921.d.ts} +36 -32
  131. package/dist/hooks/index.d.ts +9 -6
  132. package/dist/hooks/index.js +1109 -1841
  133. package/dist/hooks/index.js.map +1 -1
  134. package/dist/hooks/index.mjs +45 -53
  135. package/dist/hooks/use-agent-nodename.d.ts +3 -0
  136. package/dist/hooks/use-agent-nodename.js +56 -0
  137. package/dist/hooks/use-agent-nodename.js.map +1 -0
  138. package/dist/hooks/use-agent-nodename.mjs +8 -0
  139. package/dist/hooks/use-agent-nodename.mjs.map +1 -0
  140. package/dist/hooks/use-coagent-state-render-bridge.d.ts +100 -0
  141. package/dist/hooks/use-coagent-state-render-bridge.js +214 -0
  142. package/dist/hooks/use-coagent-state-render-bridge.js.map +1 -0
  143. package/dist/hooks/use-coagent-state-render-bridge.mjs +15 -0
  144. package/dist/hooks/use-coagent-state-render-bridge.mjs.map +1 -0
  145. package/dist/hooks/use-coagent-state-render.js +31 -20
  146. package/dist/hooks/use-coagent-state-render.js.map +1 -1
  147. package/dist/hooks/use-coagent-state-render.mjs +3 -2
  148. package/dist/hooks/use-coagent.d.ts +2 -14
  149. package/dist/hooks/use-coagent.js +138 -1898
  150. package/dist/hooks/use-coagent.js.map +1 -1
  151. package/dist/hooks/use-coagent.mjs +2 -30
  152. package/dist/hooks/use-configure-chat-suggestions.d.ts +36 -0
  153. package/dist/hooks/use-configure-chat-suggestions.js +79 -0
  154. package/dist/hooks/use-configure-chat-suggestions.js.map +1 -0
  155. package/dist/hooks/use-configure-chat-suggestions.mjs +47 -0
  156. package/dist/hooks/use-configure-chat-suggestions.mjs.map +1 -0
  157. package/dist/hooks/use-copilot-action.d.ts +8 -45
  158. package/dist/hooks/use-copilot-action.js +219 -349
  159. package/dist/hooks/use-copilot-action.js.map +1 -1
  160. package/dist/hooks/use-copilot-action.mjs +4 -5
  161. package/dist/hooks/use-copilot-additional-instructions.js +10 -8
  162. package/dist/hooks/use-copilot-additional-instructions.js.map +1 -1
  163. package/dist/hooks/use-copilot-additional-instructions.mjs +2 -2
  164. package/dist/hooks/use-copilot-authenticated-action.js +236 -248
  165. package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
  166. package/dist/hooks/use-copilot-authenticated-action.mjs +6 -6
  167. package/dist/hooks/use-copilot-chat-headless_c.d.ts +2 -10
  168. package/dist/hooks/use-copilot-chat-headless_c.js +585 -1374
  169. package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
  170. package/dist/hooks/use-copilot-chat-headless_c.mjs +12 -22
  171. package/dist/hooks/use-copilot-chat-suggestions.d.ts +35 -0
  172. package/dist/hooks/use-copilot-chat-suggestions.js +60 -0
  173. package/dist/hooks/use-copilot-chat-suggestions.js.map +1 -0
  174. package/dist/hooks/use-copilot-chat-suggestions.mjs +8 -0
  175. package/dist/hooks/use-copilot-chat-suggestions.mjs.map +1 -0
  176. package/dist/hooks/use-copilot-chat.d.ts +2 -10
  177. package/dist/hooks/use-copilot-chat.js +579 -1393
  178. package/dist/hooks/use-copilot-chat.js.map +1 -1
  179. package/dist/hooks/use-copilot-chat.mjs +12 -22
  180. package/dist/hooks/use-copilot-chat_internal.d.ts +77 -14
  181. package/dist/hooks/use-copilot-chat_internal.js +577 -1367
  182. package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
  183. package/dist/hooks/use-copilot-chat_internal.mjs +13 -23
  184. package/dist/hooks/use-copilot-readable.d.ts +1 -1
  185. package/dist/hooks/use-copilot-readable.js +25 -152
  186. package/dist/hooks/use-copilot-readable.js.map +1 -1
  187. package/dist/hooks/use-copilot-readable.mjs +1 -2
  188. package/dist/hooks/use-default-tool.js +216 -349
  189. package/dist/hooks/use-default-tool.js.map +1 -1
  190. package/dist/hooks/use-default-tool.mjs +5 -6
  191. package/dist/hooks/use-flat-category-store.js +4 -1
  192. package/dist/hooks/use-flat-category-store.js.map +1 -1
  193. package/dist/hooks/use-flat-category-store.mjs +1 -1
  194. package/dist/hooks/use-frontend-tool.d.ts +3 -3
  195. package/dist/hooks/use-frontend-tool.js +42 -370
  196. package/dist/hooks/use-frontend-tool.js.map +1 -1
  197. package/dist/hooks/use-frontend-tool.mjs +1 -6
  198. package/dist/hooks/use-human-in-the-loop.d.ts +4 -3
  199. package/dist/hooks/use-human-in-the-loop.js +61 -393
  200. package/dist/hooks/use-human-in-the-loop.js.map +1 -1
  201. package/dist/hooks/use-human-in-the-loop.mjs +1 -6
  202. package/dist/hooks/use-langgraph-interrupt-render.d.ts +3 -2
  203. package/dist/hooks/use-langgraph-interrupt-render.js +157 -37
  204. package/dist/hooks/use-langgraph-interrupt-render.js.map +1 -1
  205. package/dist/hooks/use-langgraph-interrupt-render.mjs +7 -4
  206. package/dist/hooks/use-langgraph-interrupt.d.ts +1 -1
  207. package/dist/hooks/use-langgraph-interrupt.js +24 -1642
  208. package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
  209. package/dist/hooks/use-langgraph-interrupt.mjs +2 -23
  210. package/dist/hooks/use-lazy-tool-renderer.d.ts +6 -0
  211. package/dist/hooks/use-lazy-tool-renderer.js +53 -0
  212. package/dist/hooks/use-lazy-tool-renderer.js.map +1 -0
  213. package/dist/hooks/use-lazy-tool-renderer.mjs +8 -0
  214. package/dist/hooks/use-lazy-tool-renderer.mjs.map +1 -0
  215. package/dist/hooks/use-make-copilot-document-readable.js +11 -9
  216. package/dist/hooks/use-make-copilot-document-readable.js.map +1 -1
  217. package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
  218. package/dist/hooks/use-render-tool-call.d.ts +7 -6
  219. package/dist/hooks/use-render-tool-call.js +36 -386
  220. package/dist/hooks/use-render-tool-call.js.map +1 -1
  221. package/dist/hooks/use-render-tool-call.mjs +1 -6
  222. package/dist/index.d.ts +11 -6
  223. package/dist/index.js +1456 -3033
  224. package/dist/index.js.map +1 -1
  225. package/dist/index.mjs +85 -68
  226. package/dist/lib/copilot-task.d.ts +2 -2
  227. package/dist/lib/copilot-task.js +1 -0
  228. package/dist/lib/copilot-task.js.map +1 -1
  229. package/dist/lib/copilot-task.mjs +18 -14
  230. package/dist/lib/index.d.ts +1 -1
  231. package/dist/lib/index.js +1 -0
  232. package/dist/lib/index.js.map +1 -1
  233. package/dist/lib/index.mjs +18 -14
  234. package/dist/setupTests.d.ts +2 -2
  235. package/dist/types/frontend-action.d.ts +5 -5
  236. package/dist/types/index.d.ts +4 -0
  237. package/dist/types/index.js.map +1 -1
  238. package/dist/types/index.mjs +2 -1
  239. package/dist/types/interrupt-action.d.ts +1 -1
  240. package/dist/types/interrupt-action.js.map +1 -1
  241. package/dist/types/interrupt-action.mjs +1 -0
  242. package/dist/utils/index.d.ts +0 -12
  243. package/dist/utils/index.js +6 -325
  244. package/dist/utils/index.js.map +1 -1
  245. package/dist/utils/index.mjs +1 -21
  246. package/dist/utils/utils.js.map +1 -1
  247. package/dist/v2/index.css +4 -0
  248. package/dist/v2/index.css.map +1 -0
  249. package/dist/v2/index.d.ts +2 -0
  250. package/dist/v2/index.js +27 -0
  251. package/dist/v2/index.js.map +1 -0
  252. package/dist/v2/index.mjs +6 -0
  253. package/dist/v2/index.mjs.map +1 -0
  254. package/jest.config.js +12 -0
  255. package/package.json +24 -10
  256. package/src/components/CopilotListeners.tsx +81 -0
  257. package/src/components/copilot-provider/copilot-messages.tsx +6 -48
  258. package/src/components/copilot-provider/copilotkit-props.tsx +15 -1
  259. package/src/components/copilot-provider/copilotkit.tsx +189 -148
  260. package/src/components/error-boundary/error-utils.tsx +3 -3
  261. package/src/context/coagent-state-renders-context.tsx +76 -0
  262. package/src/context/copilot-context.tsx +21 -21
  263. package/src/context/copilot-messages-context.tsx +3 -3
  264. package/src/context/index.ts +8 -0
  265. package/src/context/threads-context.tsx +41 -0
  266. package/src/hooks/__tests__/use-coagent-config.test.ts +189 -129
  267. package/src/hooks/index.ts +12 -3
  268. package/src/hooks/use-agent-nodename.ts +30 -0
  269. package/src/hooks/use-coagent-state-render-bridge.tsx +293 -0
  270. package/src/hooks/use-coagent-state-render.ts +4 -7
  271. package/src/hooks/use-coagent.ts +136 -247
  272. package/src/hooks/use-configure-chat-suggestions.tsx +86 -0
  273. package/src/hooks/use-copilot-action.ts +88 -199
  274. package/src/hooks/use-copilot-chat-headless_c.ts +2 -1
  275. package/src/hooks/use-copilot-chat-suggestions.tsx +124 -0
  276. package/src/hooks/use-copilot-chat.ts +4 -1
  277. package/src/hooks/use-copilot-chat_internal.ts +410 -263
  278. package/src/hooks/use-copilot-readable.ts +23 -25
  279. package/src/hooks/use-flat-category-store.ts +4 -3
  280. package/src/hooks/use-frontend-tool.ts +86 -8
  281. package/src/hooks/use-human-in-the-loop.ts +111 -13
  282. package/src/hooks/use-langgraph-interrupt-render.ts +108 -40
  283. package/src/hooks/use-langgraph-interrupt.ts +18 -48
  284. package/src/hooks/use-lazy-tool-renderer.tsx +30 -0
  285. package/src/hooks/use-make-copilot-document-readable.ts +1 -1
  286. package/src/hooks/use-render-tool-call.ts +73 -13
  287. package/src/lib/copilot-task.ts +1 -1
  288. package/src/types/index.ts +1 -0
  289. package/src/types/interrupt-action.ts +8 -7
  290. package/src/utils/index.ts +0 -3
  291. package/src/utils/utils.ts +7 -0
  292. package/src/v2/index.css +1 -0
  293. package/src/v2/index.ts +4 -0
  294. package/tsup.config.ts +1 -1
  295. package/dist/chunk-5FHSUKQL.mjs.map +0 -1
  296. package/dist/chunk-6GPVUMBU.mjs +0 -13
  297. package/dist/chunk-6GPVUMBU.mjs.map +0 -1
  298. package/dist/chunk-AKR2SSUJ.mjs +0 -22
  299. package/dist/chunk-AKR2SSUJ.mjs.map +0 -1
  300. package/dist/chunk-BXXJQ2BL.mjs +0 -239
  301. package/dist/chunk-BXXJQ2BL.mjs.map +0 -1
  302. package/dist/chunk-C6IANC2R.mjs.map +0 -1
  303. package/dist/chunk-DXEQPN43.mjs +0 -231
  304. package/dist/chunk-DXEQPN43.mjs.map +0 -1
  305. package/dist/chunk-DZTU6PGS.mjs +0 -1
  306. package/dist/chunk-EDBI5PCJ.mjs.map +0 -1
  307. package/dist/chunk-EUX2P2E7.mjs.map +0 -1
  308. package/dist/chunk-EVVO67QO.mjs +0 -25
  309. package/dist/chunk-EVVO67QO.mjs.map +0 -1
  310. package/dist/chunk-GGLAHG3I.mjs +0 -804
  311. package/dist/chunk-GGLAHG3I.mjs.map +0 -1
  312. package/dist/chunk-GT5WI3AF.mjs.map +0 -1
  313. package/dist/chunk-HDOG2RTM.mjs +0 -37
  314. package/dist/chunk-HDOG2RTM.mjs.map +0 -1
  315. package/dist/chunk-MIXSWZSB.mjs +0 -71
  316. package/dist/chunk-MIXSWZSB.mjs.map +0 -1
  317. package/dist/chunk-N4WEHORG.mjs.map +0 -1
  318. package/dist/chunk-NSBAWITG.mjs +0 -332
  319. package/dist/chunk-NSBAWITG.mjs.map +0 -1
  320. package/dist/chunk-OT5NHMEC.mjs +0 -723
  321. package/dist/chunk-OT5NHMEC.mjs.map +0 -1
  322. package/dist/chunk-T3376SZS.mjs +0 -142
  323. package/dist/chunk-T3376SZS.mjs.map +0 -1
  324. package/dist/chunk-YPBKY4KY.mjs +0 -1
  325. package/dist/chunk-YPSGKPDA.mjs +0 -1
  326. package/dist/chunk-ZLQVRPDS.mjs.map +0 -1
  327. package/dist/chunk-ZVOLWJCY.mjs +0 -47
  328. package/dist/chunk-ZVOLWJCY.mjs.map +0 -1
  329. package/dist/hooks/use-chat.d.ts +0 -145
  330. package/dist/hooks/use-chat.js +0 -1129
  331. package/dist/hooks/use-chat.js.map +0 -1
  332. package/dist/hooks/use-chat.mjs +0 -14
  333. package/dist/index-1f5b66ac.d.ts +0 -36
  334. package/dist/utils/extract.d.ts +0 -43
  335. package/dist/utils/extract.js +0 -208
  336. package/dist/utils/extract.js.map +0 -1
  337. package/dist/utils/extract.mjs +0 -25
  338. package/dist/utils/suggestions.d.ts +0 -11
  339. package/dist/utils/suggestions.js +0 -343
  340. package/dist/utils/suggestions.js.map +0 -1
  341. package/dist/utils/suggestions.mjs +0 -25
  342. package/src/hooks/use-chat.ts +0 -1142
  343. package/src/utils/extract.ts +0 -215
  344. package/src/utils/suggestions.ts +0 -208
  345. /package/dist/{chunk-DZTU6PGS.mjs.map → chunk-36KQV2NA.mjs.map} +0 -0
  346. /package/dist/{chunk-OKCYPO4I.mjs.map → chunk-3MHWEKFN.mjs.map} +0 -0
  347. /package/dist/{chunk-YPBKY4KY.mjs.map → chunk-A6NKSGH3.mjs.map} +0 -0
  348. /package/dist/{chunk-MGWRDFBE.mjs.map → chunk-ABWT4DRT.mjs.map} +0 -0
  349. /package/dist/{chunk-MQYWH4E6.mjs.map → chunk-BUSWSDYO.mjs.map} +0 -0
  350. /package/dist/{chunk-YPSGKPDA.mjs.map → chunk-CYDWEPFL.mjs.map} +0 -0
  351. /package/dist/{chunk-U7QULEVO.mjs.map → chunk-E7SE25ZU.mjs.map} +0 -0
  352. /package/dist/{hooks/use-chat.mjs.map → chunk-FD6FGKYY.mjs.map} +0 -0
  353. /package/dist/{utils/extract.mjs.map → chunk-JD7BAH7U.mjs.map} +0 -0
  354. /package/dist/{utils/suggestions.mjs.map → chunk-NB2FKV2V.mjs.map} +0 -0
  355. /package/dist/{chunk-N4VN2B5S.mjs.map → chunk-SNON4QA6.mjs.map} +0 -0
@@ -0,0 +1,81 @@
1
+ import { useCallback, useEffect, useMemo, useRef } from "react";
2
+ import { useAgent, useCopilotChatConfiguration, useCopilotKit } from "@copilotkitnext/react";
3
+ import { CopilotKitError, parseJson } from "@copilotkit/shared";
4
+ import { useCopilotContext } from "../context";
5
+ import { AbstractAgent, AgentSubscriber, AGUIConnectNotImplementedError } from "@ag-ui/client";
6
+ import { useErrorToast } from "./error-boundary/error-utils";
7
+ import { CopilotKitCoreSubscriber } from "@copilotkitnext/core";
8
+ import { useToast } from "./toast/toast-provider";
9
+ import { CopilotKitLowLevelError } from "@copilotkit/shared";
10
+
11
+ const usePredictStateSubscription = (agent?: AbstractAgent) => {
12
+ const predictStateToolsRef = useRef<
13
+ {
14
+ tool: string;
15
+ state_key: string;
16
+ tool_argument: string;
17
+ }[]
18
+ >([]);
19
+
20
+ const getSubscriber = useCallback(
21
+ (agent: AbstractAgent): AgentSubscriber => ({
22
+ onCustomEvent: ({ event }) => {
23
+ if (event.name === "PredictState") {
24
+ predictStateToolsRef.current = event.value;
25
+ }
26
+ },
27
+ onToolCallArgsEvent: ({ partialToolCallArgs, toolCallName }) => {
28
+ predictStateToolsRef.current.forEach((t) => {
29
+ if (t?.tool !== toolCallName) return;
30
+
31
+ const emittedState =
32
+ typeof partialToolCallArgs === "string"
33
+ ? parseJson(partialToolCallArgs as unknown as string, partialToolCallArgs)
34
+ : partialToolCallArgs;
35
+
36
+ agent.setState({
37
+ [t.state_key]: emittedState[t.state_key],
38
+ });
39
+ });
40
+ },
41
+ }),
42
+ [],
43
+ );
44
+
45
+ useEffect(() => {
46
+ if (!agent) return;
47
+
48
+ const subscriber = getSubscriber(agent);
49
+ const { unsubscribe } = agent.subscribe(subscriber);
50
+ return () => {
51
+ unsubscribe();
52
+ };
53
+ }, [agent, getSubscriber]);
54
+ };
55
+
56
+ export function CopilotListeners() {
57
+ const { copilotkit } = useCopilotKit();
58
+ const existingConfig = useCopilotChatConfiguration();
59
+ const resolvedAgentId = existingConfig?.agentId;
60
+ const { setBannerError } = useToast();
61
+
62
+ const { agent } = useAgent({ agentId: resolvedAgentId });
63
+
64
+ usePredictStateSubscription(agent);
65
+
66
+ useEffect(() => {
67
+ const subscriber: CopilotKitCoreSubscriber = {
68
+ onError: ({ error }) => {
69
+ // @ts-expect-error -- for now, choose a random CPK error type to display the error toast
70
+ setBannerError(new CopilotKitLowLevelError({ error, message: error.message }));
71
+ },
72
+ };
73
+ const subscription = copilotkit.subscribe(subscriber);
74
+
75
+ return () => {
76
+ subscription.unsubscribe();
77
+ };
78
+ }, [copilotkit?.subscribe]);
79
+
80
+ return null;
81
+ }
@@ -29,7 +29,7 @@ import {
29
29
  CopilotKitError,
30
30
  CopilotKitErrorCode,
31
31
  } from "@copilotkit/shared";
32
- import { SuggestionItem } from "../../utils/suggestions";
32
+ import { Suggestion } from "@copilotkitnext/core";
33
33
 
34
34
  // Helper to determine if error should show as banner based on visibility and legacy patterns
35
35
  function shouldShowAsBanner(gqlError: GraphQLError): boolean {
@@ -118,14 +118,13 @@ export function MessagesTapProvider({ children }: { children: React.ReactNode })
118
118
 
119
119
  export function CopilotMessages({ children }: { children: ReactNode }) {
120
120
  const [messages, setMessages] = useState<Message[]>([]);
121
- const lastLoadedThreadId = useRef<string>();
122
- const lastLoadedAgentName = useRef<string>();
123
- const lastLoadedMessages = useRef<string>();
121
+ const lastLoadedThreadId = useRef<string>(undefined!);
122
+ const lastLoadedAgentName = useRef<string>(undefined!);
123
+ const lastLoadedMessages = useRef<string>(undefined!);
124
124
 
125
125
  const { updateTapMessages } = useMessagesTap();
126
126
 
127
- const { threadId, agentSession, runtimeClient, showDevConsole, onError, copilotApiConfig } =
128
- useCopilotContext();
127
+ const { threadId, agentSession, showDevConsole, onError, copilotApiConfig } = useCopilotContext();
129
128
  const { setBannerError } = useToast();
130
129
 
131
130
  // Helper function to trace UI errors (similar to useCopilotRuntimeClient)
@@ -253,53 +252,12 @@ export function CopilotMessages({ children }: { children: ReactNode }) {
253
252
  [setBannerError, showDevConsole, traceUIError],
254
253
  );
255
254
 
256
- useEffect(() => {
257
- if (!threadId || threadId === lastLoadedThreadId.current) return;
258
- if (
259
- threadId === lastLoadedThreadId.current &&
260
- agentSession?.agentName === lastLoadedAgentName.current
261
- ) {
262
- return;
263
- }
264
-
265
- const fetchMessages = async () => {
266
- if (!agentSession?.agentName) return;
267
-
268
- const result = await runtimeClient.loadAgentState({
269
- threadId,
270
- agentName: agentSession?.agentName,
271
- });
272
-
273
- // Check for GraphQL errors and manually trigger error handling
274
- if (result.error) {
275
- // Update refs to prevent infinite retries of the same failed request
276
- lastLoadedThreadId.current = threadId;
277
- lastLoadedAgentName.current = agentSession?.agentName;
278
- handleGraphQLErrors(result.error);
279
- return; // Don't try to process the data if there's an error
280
- }
281
-
282
- const newMessages = result.data?.loadAgentState?.messages;
283
- if (newMessages === lastLoadedMessages.current) return;
284
-
285
- if (result.data?.loadAgentState) {
286
- lastLoadedMessages.current = newMessages;
287
- lastLoadedThreadId.current = threadId;
288
- lastLoadedAgentName.current = agentSession?.agentName;
289
-
290
- const messages = loadMessagesFromJsonRepresentation(JSON.parse(newMessages || "[]"));
291
- setMessages(messages);
292
- }
293
- };
294
- void fetchMessages();
295
- }, [threadId, agentSession?.agentName]);
296
-
297
255
  useEffect(() => {
298
256
  updateTapMessages(messages);
299
257
  }, [messages, updateTapMessages]);
300
258
 
301
259
  const memoizedChildren = useMemo(() => children, [children]);
302
- const [suggestions, setSuggestions] = useState<SuggestionItem[]>([]);
260
+ const [suggestions, setSuggestions] = useState<Suggestion[]>([]);
303
261
 
304
262
  return (
305
263
  <CopilotMessagesContext.Provider
@@ -2,11 +2,18 @@ import { ForwardedParametersInput } from "@copilotkit/runtime-client-gql";
2
2
  import { ReactNode } from "react";
3
3
  import { AuthState } from "../../context/copilot-context";
4
4
  import { CopilotErrorHandler } from "@copilotkit/shared";
5
+ import { CopilotKitProviderProps } from "@copilotkitnext/react";
5
6
  /**
6
7
  * Props for CopilotKit.
7
8
  */
8
9
 
9
- export interface CopilotKitProps {
10
+ /**
11
+ * We shouldn't need this `Omit` here, but using it because `CopilotKitProps`
12
+ * and `CopilotKitProviderProps` have non-identical `children` types
13
+ *
14
+ * TODO: Remove this `Omit` once this is resolved.
15
+ */
16
+ export interface CopilotKitProps extends Omit<CopilotKitProviderProps, "children"> {
10
17
  /**
11
18
  * Your Copilot Cloud API key.
12
19
  *
@@ -152,4 +159,11 @@ export interface CopilotKitProps {
152
159
  * ```
153
160
  */
154
161
  onError?: CopilotErrorHandler;
162
+
163
+ /**
164
+ * Enable or disable the CopilotKit Inspector, letting you inspect AG-UI events,
165
+ * view agent messages, check agent state, and visualize agent context. Defaults
166
+ * to enabled.
167
+ */
168
+ enableInspector?: boolean;
155
169
  }
@@ -15,6 +15,11 @@
15
15
  */
16
16
 
17
17
  import { useCallback, useEffect, useMemo, useRef, useState, SetStateAction } from "react";
18
+ import {
19
+ CopilotChatConfigurationProvider,
20
+ CopilotKitInspector,
21
+ CopilotKitProvider as CopilotKitNextProvider,
22
+ } from "@copilotkitnext/react";
18
23
  import {
19
24
  CopilotContext,
20
25
  CopilotApiConfig,
@@ -40,31 +45,45 @@ import {
40
45
  import { FrontendAction } from "../../types/frontend-action";
41
46
  import useFlatCategoryStore from "../../hooks/use-flat-category-store";
42
47
  import { CopilotKitProps } from "./copilotkit-props";
43
- import { CoAgentStateRender } from "../../types/coagent-action";
44
48
  import { CoagentState } from "../../types/coagent-state";
45
49
  import { CopilotMessages, MessagesTapProvider } from "./copilot-messages";
46
50
  import { ToastProvider } from "../toast/toast-provider";
47
51
  import { getErrorActions, UsageBanner } from "../usage-banner";
48
- import { useCopilotRuntimeClient } from "../../hooks/use-copilot-runtime-client";
49
52
  import { shouldShowDevConsole } from "../../utils";
50
53
  import { CopilotErrorBoundary } from "../error-boundary/error-boundary";
51
54
  import { Agent, ExtensionsInput } from "@copilotkit/runtime-client-gql";
52
55
  import {
53
- LangGraphInterruptAction,
56
+ LangGraphInterruptRender,
54
57
  LangGraphInterruptActionSetterArgs,
58
+ QueuedInterruptEvent,
55
59
  } from "../../types/interrupt-action";
56
- import { ConsoleTrigger } from "../dev-console/console-trigger";
60
+ import { CoAgentStateRendersProvider } from "../../context/coagent-state-renders-context";
61
+ import { CoAgentStateRenderBridge } from "../../hooks/use-coagent-state-render-bridge";
62
+ import { ThreadsProvider, useThreads } from "../../context/threads-context";
63
+ import { CopilotListeners } from "../CopilotListeners";
57
64
 
58
65
  export function CopilotKit({ children, ...props }: CopilotKitProps) {
59
66
  const enabled = shouldShowDevConsole(props.showDevConsole);
67
+ const showInspector = shouldShowDevConsole(props.enableInspector);
60
68
 
61
69
  // Use API key if provided, otherwise use the license key
62
70
  const publicApiKey = props.publicApiKey || props.publicLicenseKey;
63
71
 
72
+ const renderArr = useMemo(() => [{ render: CoAgentStateRenderBridge }], []);
73
+
64
74
  return (
65
75
  <ToastProvider enabled={enabled}>
66
76
  <CopilotErrorBoundary publicApiKey={publicApiKey} showUsageBanner={enabled}>
67
- <CopilotKitInternal {...props}>{children}</CopilotKitInternal>
77
+ <ThreadsProvider threadId={props.threadId}>
78
+ <CopilotKitNextProvider
79
+ {...props}
80
+ showDevConsole={showInspector}
81
+ renderCustomMessages={renderArr}
82
+ useSingleEndpoint={true}
83
+ >
84
+ <CopilotKitInternal {...props}>{children}</CopilotKitInternal>
85
+ </CopilotKitNextProvider>
86
+ </ThreadsProvider>
68
87
  </CopilotErrorBoundary>
69
88
  </ToastProvider>
70
89
  );
@@ -84,9 +103,11 @@ export function CopilotKitInternal(cpkProps: CopilotKitProps) {
84
103
  const chatApiEndpoint = props.runtimeUrl || COPILOT_CLOUD_CHAT_URL;
85
104
 
86
105
  const [actions, setActions] = useState<Record<string, FrontendAction<any>>>({});
87
- const [coAgentStateRenders, setCoAgentStateRenders] = useState<
88
- Record<string, CoAgentStateRender<any>>
89
- >({});
106
+
107
+ // State for registered actions from useCopilotAction
108
+ const [registeredActionConfigs, setRegisteredActionConfigs] = useState<
109
+ Map<string, { type: string; action: any; component: any }>
110
+ >(new Map());
90
111
 
91
112
  const chatComponentsCache = useRef<ChatComponentsCache>({
92
113
  actions: {},
@@ -124,23 +145,6 @@ export function CopilotKitInternal(cpkProps: CopilotKitProps) {
124
145
  });
125
146
  }, []);
126
147
 
127
- const setCoAgentStateRender = useCallback((id: string, stateRender: CoAgentStateRender<any>) => {
128
- setCoAgentStateRenders((prevPoints) => {
129
- return {
130
- ...prevPoints,
131
- [id]: stateRender,
132
- };
133
- });
134
- }, []);
135
-
136
- const removeCoAgentStateRender = useCallback((id: string) => {
137
- setCoAgentStateRenders((prevPoints) => {
138
- const newPoints = { ...prevPoints };
139
- delete newPoints[id];
140
- return newPoints;
141
- });
142
- }, []);
143
-
144
148
  const getContextString = useCallback(
145
149
  (documents: DocumentPointer[], categories: string[]) => {
146
150
  const documentsString = documents
@@ -318,15 +322,6 @@ export function CopilotKitInternal(cpkProps: CopilotKitProps) {
318
322
  [copilotApiConfig.publicApiKey],
319
323
  );
320
324
 
321
- const runtimeClient = useCopilotRuntimeClient({
322
- url: copilotApiConfig.chatApiEndpoint,
323
- publicApiKey: publicApiKey,
324
- headers,
325
- credentials: copilotApiConfig.credentials,
326
- showDevConsole: shouldShowDevConsole(props.showDevConsole),
327
- onError: handleErrors,
328
- });
329
-
330
325
  const [chatSuggestionConfiguration, setChatSuggestionConfiguration] = useState<{
331
326
  [key: string]: CopilotChatSuggestionConfiguration;
332
327
  }>({});
@@ -365,20 +360,6 @@ export function CopilotKitInternal(cpkProps: CopilotKitProps) {
365
360
  },
366
361
  [],
367
362
  );
368
- const hasLoadedAgents = useRef(false);
369
-
370
- useEffect(() => {
371
- if (hasLoadedAgents.current) return;
372
-
373
- const fetchData = async () => {
374
- const result = await runtimeClient.availableAgents();
375
- if (result.data?.availableAgents) {
376
- setAvailableAgents(result.data.availableAgents.agents);
377
- }
378
- hasLoadedAgents.current = true;
379
- };
380
- void fetchData();
381
- }, []);
382
363
 
383
364
  let initialAgentSession: AgentSession | null = null;
384
365
  if (props.agent) {
@@ -400,7 +381,8 @@ export function CopilotKitInternal(cpkProps: CopilotKitProps) {
400
381
  }
401
382
  }, [props.agent]);
402
383
 
403
- const [internalThreadId, setInternalThreadId] = useState<string>(props.threadId || randomUUID());
384
+ const { threadId, setThreadId: setInternalThreadId } = useThreads();
385
+
404
386
  const setThreadId = useCallback(
405
387
  (value: SetStateAction<string>) => {
406
388
  if (props.threadId) {
@@ -411,46 +393,64 @@ export function CopilotKitInternal(cpkProps: CopilotKitProps) {
411
393
  [props.threadId],
412
394
  );
413
395
 
414
- // update the internal threadId if the props.threadId changes
415
- useEffect(() => {
416
- if (props.threadId !== undefined) {
417
- setInternalThreadId(props.threadId);
418
- }
419
- }, [props.threadId]);
420
-
421
396
  const [runId, setRunId] = useState<string | null>(null);
422
397
 
423
398
  const chatAbortControllerRef = useRef<AbortController | null>(null);
424
399
 
425
400
  const showDevConsole = shouldShowDevConsole(props.showDevConsole);
426
401
 
427
- const [langGraphInterruptActions, _setLangGraphInterruptAction] = useState<
428
- Record<string, LangGraphInterruptAction | null>
402
+ const [interruptActions, _setInterruptActions] = useState<
403
+ Record<string, LangGraphInterruptRender>
429
404
  >({});
430
- const setLangGraphInterruptAction = useCallback(
431
- (threadId: string, action: LangGraphInterruptActionSetterArgs) => {
432
- _setLangGraphInterruptAction((prev) => {
433
- if (action == null)
434
- return {
435
- ...prev,
436
- [threadId]: null,
437
- };
438
- let event = prev[threadId]?.event;
439
- if (action.event) {
440
- // @ts-ignore
441
- event = { ...(prev[threadId]?.event || {}), ...action.event };
442
- }
405
+ const setInterruptAction = useCallback((action: LangGraphInterruptActionSetterArgs) => {
406
+ _setInterruptActions((prev) => {
407
+ if (action == null || !action.id) {
408
+ // Cannot set action without id
409
+ return prev;
410
+ }
411
+ return {
412
+ ...prev,
413
+ [action.id]: { ...(prev[action.id] ?? {}), ...action } as LangGraphInterruptRender,
414
+ };
415
+ });
416
+ }, []);
417
+ const removeInterruptAction = useCallback((actionId: string): void => {
418
+ _setInterruptActions((prev) => {
419
+ const { [actionId]: _, ...rest } = prev;
420
+ return rest;
421
+ });
422
+ }, []);
423
+
424
+ const [interruptEventQueue, setInterruptEventQueue] = useState<
425
+ Record<string, QueuedInterruptEvent[]>
426
+ >({});
427
+
428
+ const addInterruptEvent = useCallback((queuedEvent: QueuedInterruptEvent) => {
429
+ setInterruptEventQueue((prev) => {
430
+ const threadQueue = prev[queuedEvent.threadId] || [];
431
+ return {
432
+ ...prev,
433
+ [queuedEvent.threadId]: [...threadQueue, queuedEvent],
434
+ };
435
+ });
436
+ }, []);
437
+
438
+ const resolveInterruptEvent = useCallback(
439
+ (threadId: string, eventId: string, response: string) => {
440
+ setInterruptEventQueue((prev) => {
441
+ const threadQueue = prev[threadId] || [];
443
442
  return {
444
443
  ...prev,
445
- [threadId]: { ...(prev[threadId] ?? {}), ...action, event } as LangGraphInterruptAction,
444
+ [threadId]: threadQueue.map((queuedEvent) =>
445
+ queuedEvent.eventId === eventId
446
+ ? { ...queuedEvent, event: { ...queuedEvent.event, response } }
447
+ : queuedEvent,
448
+ ),
446
449
  };
447
450
  });
448
451
  },
449
452
  [],
450
453
  );
451
- const removeLangGraphInterruptAction = useCallback((threadId: string): void => {
452
- setLangGraphInterruptAction(threadId, null);
453
- }, []);
454
454
 
455
455
  const memoizedChildren = useMemo(() => children, [children]);
456
456
  const [bannerError, setBannerError] = useState<CopilotKitError | null>(null);
@@ -494,81 +494,122 @@ export function CopilotKitInternal(cpkProps: CopilotKitProps) {
494
494
  [setAuthStates],
495
495
  );
496
496
 
497
+ const handleSetRegisteredActions = useCallback((actionConfig: any): string => {
498
+ const key = actionConfig.action.name || randomUUID();
499
+ setRegisteredActionConfigs((prev) => {
500
+ const newMap = new Map(prev);
501
+ newMap.set(key, actionConfig);
502
+ return newMap;
503
+ });
504
+ return key;
505
+ }, []);
506
+
507
+ const handleRemoveRegisteredAction = useCallback((actionKey: string) => {
508
+ setRegisteredActionConfigs((prev) => {
509
+ const newMap = new Map(prev);
510
+ newMap.delete(actionKey);
511
+ return newMap;
512
+ });
513
+ }, []);
514
+
515
+ // Component to render all registered actions
516
+ const RegisteredActionsRenderer = useMemo(() => {
517
+ return () => (
518
+ <>
519
+ {Array.from(registeredActionConfigs.entries()).map(([key, config]) => {
520
+ const Component = config.component;
521
+ return <Component key={key} action={config.action} />;
522
+ })}
523
+ </>
524
+ );
525
+ }, [registeredActionConfigs]);
526
+
497
527
  return (
498
- <CopilotContext.Provider
499
- value={{
500
- actions,
501
- chatComponentsCache,
502
- getFunctionCallHandler,
503
- setAction,
504
- removeAction,
505
- coAgentStateRenders,
506
- setCoAgentStateRender,
507
- removeCoAgentStateRender,
508
- getContextString,
509
- addContext,
510
- removeContext,
511
- getAllContext,
512
- getDocumentsContext,
513
- addDocumentContext,
514
- removeDocumentContext,
515
- copilotApiConfig: copilotApiConfig,
516
- isLoading,
517
- setIsLoading,
518
- chatSuggestionConfiguration,
519
- addChatSuggestionConfiguration,
520
- removeChatSuggestionConfiguration,
521
- chatInstructions,
522
- setChatInstructions,
523
- additionalInstructions,
524
- setAdditionalInstructions,
525
- showDevConsole,
526
- coagentStates,
527
- setCoagentStates,
528
- coagentStatesRef,
529
- setCoagentStatesWithRef,
530
- agentSession,
531
- setAgentSession,
532
- runtimeClient,
533
- forwardedParameters,
534
- agentLock,
535
- threadId: internalThreadId,
536
- setThreadId,
537
- runId,
538
- setRunId,
539
- chatAbortControllerRef,
540
- availableAgents,
541
- authConfig_c: props.authConfig_c,
542
- authStates_c: authStates,
543
- setAuthStates_c: updateAuthStates,
544
- extensions,
545
- setExtensions: updateExtensions,
546
- langGraphInterruptAction: langGraphInterruptActions[internalThreadId] ?? null,
547
- setLangGraphInterruptAction,
548
- removeLangGraphInterruptAction,
549
- bannerError,
550
- setBannerError,
551
- onError: handleErrors,
552
- internalErrorHandlers,
553
- setInternalErrorHandler,
554
- removeInternalErrorHandler,
555
- }}
528
+ <CopilotChatConfigurationProvider
529
+ // labels={labels}
530
+ // isModalDefaultOpen={isModalDefaultOpen}
531
+ agentId={props.agent ?? "default"}
532
+ threadId={threadId}
556
533
  >
557
- <MessagesTapProvider>
558
- <CopilotMessages>
559
- {memoizedChildren}
560
- {showDevConsole && <ConsoleTrigger />}
561
- </CopilotMessages>
562
- </MessagesTapProvider>
563
- {bannerError && showDevConsole && (
564
- <UsageBanner
565
- severity={bannerError.severity}
566
- message={bannerError.message}
567
- onClose={() => setBannerError(null)}
568
- actions={getErrorActions(bannerError)}
569
- />
570
- )}
571
- </CopilotContext.Provider>
534
+ <CopilotContext.Provider
535
+ value={{
536
+ actions,
537
+ chatComponentsCache,
538
+ getFunctionCallHandler,
539
+ setAction,
540
+ removeAction,
541
+ setRegisteredActions: handleSetRegisteredActions,
542
+ removeRegisteredAction: handleRemoveRegisteredAction,
543
+ getContextString,
544
+ addContext,
545
+ removeContext,
546
+ getAllContext,
547
+ getDocumentsContext,
548
+ addDocumentContext,
549
+ removeDocumentContext,
550
+ copilotApiConfig: copilotApiConfig,
551
+ isLoading,
552
+ setIsLoading,
553
+ chatSuggestionConfiguration,
554
+ addChatSuggestionConfiguration,
555
+ removeChatSuggestionConfiguration,
556
+ chatInstructions,
557
+ setChatInstructions,
558
+ additionalInstructions,
559
+ setAdditionalInstructions,
560
+ showDevConsole,
561
+ coagentStates,
562
+ setCoagentStates,
563
+ coagentStatesRef,
564
+ setCoagentStatesWithRef,
565
+ agentSession,
566
+ setAgentSession,
567
+ forwardedParameters,
568
+ agentLock,
569
+ threadId,
570
+ setThreadId,
571
+ runId,
572
+ setRunId,
573
+ chatAbortControllerRef,
574
+ availableAgents,
575
+ authConfig_c: props.authConfig_c,
576
+ authStates_c: authStates,
577
+ setAuthStates_c: updateAuthStates,
578
+ extensions,
579
+ setExtensions: updateExtensions,
580
+ interruptActions,
581
+ setInterruptAction,
582
+ removeInterruptAction,
583
+ interruptEventQueue,
584
+ addInterruptEvent,
585
+ resolveInterruptEvent,
586
+ bannerError,
587
+ setBannerError,
588
+ onError: handleErrors,
589
+ internalErrorHandlers,
590
+ setInternalErrorHandler,
591
+ removeInternalErrorHandler,
592
+ }}
593
+ >
594
+ <CopilotListeners />
595
+ <CoAgentStateRendersProvider>
596
+ <MessagesTapProvider>
597
+ <CopilotMessages>
598
+ {memoizedChildren}
599
+ <RegisteredActionsRenderer />
600
+ </CopilotMessages>
601
+ </MessagesTapProvider>
602
+ {bannerError && showDevConsole && (
603
+ <UsageBanner
604
+ severity={bannerError.severity}
605
+ message={bannerError.message}
606
+ onClose={() => setBannerError(null)}
607
+ actions={getErrorActions(bannerError)}
608
+ />
609
+ )}
610
+ </CoAgentStateRendersProvider>
611
+ </CopilotContext.Provider>
612
+ </CopilotChatConfigurationProvider>
572
613
  );
573
614
  }
574
615
 
@@ -60,8 +60,8 @@ export function useErrorToast() {
60
60
  const { addToast } = useToast();
61
61
 
62
62
  return useCallback(
63
- (error: (Error | GraphQLError)[]) => {
64
- const errorId = error
63
+ (errors: (Error | GraphQLError)[]) => {
64
+ const errorId = errors
65
65
  .map((err) => {
66
66
  const message =
67
67
  "extensions" in err
@@ -75,7 +75,7 @@ export function useErrorToast() {
75
75
  addToast({
76
76
  type: "error",
77
77
  id: errorId, // Toast libraries typically dedupe by id
78
- message: <ErrorToast errors={error} />,
78
+ message: <ErrorToast errors={errors} />,
79
79
  });
80
80
  },
81
81
  [addToast],