@copilotkit/react-core 2.0.0-next.1 → 2.0.0-rc.0

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 (538) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +18 -12
  3. package/dist/MarkdownRendererContext-B4Us6mwL.d.cts +954 -0
  4. package/dist/MarkdownRendererContext-B4Us6mwL.d.cts.map +1 -0
  5. package/dist/MarkdownRendererContext-CRKFzsEB.d.mts +954 -0
  6. package/dist/MarkdownRendererContext-CRKFzsEB.d.mts.map +1 -0
  7. package/dist/MarkdownSurfaces-C2XZISKn.cjs +3964 -0
  8. package/dist/MarkdownSurfaces-C2XZISKn.cjs.map +1 -0
  9. package/dist/MarkdownSurfaces-ChSlVYOk.mjs +3655 -0
  10. package/dist/MarkdownSurfaces-ChSlVYOk.mjs.map +1 -0
  11. package/dist/context.cjs +144 -0
  12. package/dist/context.cjs.map +1 -0
  13. package/dist/context.d.cts +166 -0
  14. package/dist/context.d.cts.map +1 -0
  15. package/dist/context.d.mts +166 -0
  16. package/dist/context.d.mts.map +1 -0
  17. package/dist/context.mjs +136 -0
  18. package/dist/context.mjs.map +1 -0
  19. package/dist/generative-ui.cjs +8151 -0
  20. package/dist/generative-ui.cjs.map +1 -0
  21. package/dist/generative-ui.d.cts +4952 -0
  22. package/dist/generative-ui.d.cts.map +1 -0
  23. package/dist/generative-ui.d.mts +4952 -0
  24. package/dist/generative-ui.d.mts.map +1 -0
  25. package/dist/generative-ui.mjs +8137 -0
  26. package/dist/generative-ui.mjs.map +1 -0
  27. package/dist/headless.cjs +1927 -0
  28. package/dist/headless.cjs.map +1 -0
  29. package/dist/headless.d.cts +1117 -0
  30. package/dist/headless.d.cts.map +1 -0
  31. package/dist/headless.d.mts +1008 -0
  32. package/dist/headless.d.mts.map +1 -0
  33. package/dist/headless.mjs +1869 -0
  34. package/dist/headless.mjs.map +1 -0
  35. package/dist/index.cjs +15576 -0
  36. package/dist/index.cjs.map +1 -0
  37. package/dist/index.css +2 -0
  38. package/dist/index.d.cts +3450 -0
  39. package/dist/index.d.cts.map +1 -0
  40. package/dist/index.d.mts +3433 -0
  41. package/dist/index.d.mts.map +1 -0
  42. package/dist/index.mjs +13927 -146
  43. package/dist/index.mjs.map +1 -1
  44. package/dist/index.umd.js +18856 -0
  45. package/dist/index.umd.js.map +1 -0
  46. package/package.json +124 -52
  47. package/CHANGELOG.md +0 -4210
  48. package/dist/chunk-2IDV5OHF.mjs +0 -11
  49. package/dist/chunk-2IDV5OHF.mjs.map +0 -1
  50. package/dist/chunk-36KQV2NA.mjs +0 -1
  51. package/dist/chunk-36KQV2NA.mjs.map +0 -1
  52. package/dist/chunk-3V5TOYKW.mjs +0 -120
  53. package/dist/chunk-3V5TOYKW.mjs.map +0 -1
  54. package/dist/chunk-4CEQJ2X6.mjs +0 -31
  55. package/dist/chunk-4CEQJ2X6.mjs.map +0 -1
  56. package/dist/chunk-4RRMC7L2.mjs +0 -32
  57. package/dist/chunk-4RRMC7L2.mjs.map +0 -1
  58. package/dist/chunk-4YZA2BZC.mjs +0 -551
  59. package/dist/chunk-4YZA2BZC.mjs.map +0 -1
  60. package/dist/chunk-53K6WNJG.mjs +0 -36
  61. package/dist/chunk-53K6WNJG.mjs.map +0 -1
  62. package/dist/chunk-6ESSSQ7Q.mjs +0 -134
  63. package/dist/chunk-6ESSSQ7Q.mjs.map +0 -1
  64. package/dist/chunk-6PUNP7CD.mjs +0 -102
  65. package/dist/chunk-6PUNP7CD.mjs.map +0 -1
  66. package/dist/chunk-6YOKPWQ7.mjs +0 -1
  67. package/dist/chunk-6YOKPWQ7.mjs.map +0 -1
  68. package/dist/chunk-6ZLPNY7X.mjs +0 -225
  69. package/dist/chunk-6ZLPNY7X.mjs.map +0 -1
  70. package/dist/chunk-7DTB7S5V.mjs +0 -83
  71. package/dist/chunk-7DTB7S5V.mjs.map +0 -1
  72. package/dist/chunk-7IBF6RBW.mjs +0 -23
  73. package/dist/chunk-7IBF6RBW.mjs.map +0 -1
  74. package/dist/chunk-A6NKSGH3.mjs +0 -1
  75. package/dist/chunk-A6NKSGH3.mjs.map +0 -1
  76. package/dist/chunk-ABWT4DRT.mjs +0 -24
  77. package/dist/chunk-ABWT4DRT.mjs.map +0 -1
  78. package/dist/chunk-AFNWX62Q.mjs +0 -110
  79. package/dist/chunk-AFNWX62Q.mjs.map +0 -1
  80. package/dist/chunk-BUSWSDYO.mjs +0 -17
  81. package/dist/chunk-BUSWSDYO.mjs.map +0 -1
  82. package/dist/chunk-CDUIA2WM.mjs +0 -60
  83. package/dist/chunk-CDUIA2WM.mjs.map +0 -1
  84. package/dist/chunk-CYDWEPFL.mjs +0 -1
  85. package/dist/chunk-CYDWEPFL.mjs.map +0 -1
  86. package/dist/chunk-DMLQZG75.mjs +0 -25
  87. package/dist/chunk-DMLQZG75.mjs.map +0 -1
  88. package/dist/chunk-E7SE25ZU.mjs +0 -59
  89. package/dist/chunk-E7SE25ZU.mjs.map +0 -1
  90. package/dist/chunk-EFL5OBKN.mjs +0 -310
  91. package/dist/chunk-EFL5OBKN.mjs.map +0 -1
  92. package/dist/chunk-F555TVE4.mjs +0 -33
  93. package/dist/chunk-F555TVE4.mjs.map +0 -1
  94. package/dist/chunk-FD6FGKYY.mjs +0 -1
  95. package/dist/chunk-FD6FGKYY.mjs.map +0 -1
  96. package/dist/chunk-FDOMAPJY.mjs +0 -59
  97. package/dist/chunk-FDOMAPJY.mjs.map +0 -1
  98. package/dist/chunk-FQFXYAV7.mjs +0 -86
  99. package/dist/chunk-FQFXYAV7.mjs.map +0 -1
  100. package/dist/chunk-GPEJNVE5.mjs +0 -80
  101. package/dist/chunk-GPEJNVE5.mjs.map +0 -1
  102. package/dist/chunk-HE22TZMF.mjs +0 -186
  103. package/dist/chunk-HE22TZMF.mjs.map +0 -1
  104. package/dist/chunk-I76HKHPJ.mjs +0 -32
  105. package/dist/chunk-I76HKHPJ.mjs.map +0 -1
  106. package/dist/chunk-ICIK2BSB.mjs +0 -17
  107. package/dist/chunk-ICIK2BSB.mjs.map +0 -1
  108. package/dist/chunk-JD7BAH7U.mjs +0 -1
  109. package/dist/chunk-JD7BAH7U.mjs.map +0 -1
  110. package/dist/chunk-LHERIF3L.mjs +0 -83
  111. package/dist/chunk-LHERIF3L.mjs.map +0 -1
  112. package/dist/chunk-LSHFN2Y5.mjs +0 -349
  113. package/dist/chunk-LSHFN2Y5.mjs.map +0 -1
  114. package/dist/chunk-LUGEI4YQ.mjs +0 -1
  115. package/dist/chunk-LUGEI4YQ.mjs.map +0 -1
  116. package/dist/chunk-NB2FKV2V.mjs +0 -1
  117. package/dist/chunk-NB2FKV2V.mjs.map +0 -1
  118. package/dist/chunk-NBK4KBLX.mjs +0 -54
  119. package/dist/chunk-NBK4KBLX.mjs.map +0 -1
  120. package/dist/chunk-O7ARI5CV.mjs +0 -31
  121. package/dist/chunk-O7ARI5CV.mjs.map +0 -1
  122. package/dist/chunk-PIF5KJYI.mjs +0 -103
  123. package/dist/chunk-PIF5KJYI.mjs.map +0 -1
  124. package/dist/chunk-PMAFHQ7P.mjs +0 -65
  125. package/dist/chunk-PMAFHQ7P.mjs.map +0 -1
  126. package/dist/chunk-QNUAXSDP.mjs +0 -166
  127. package/dist/chunk-QNUAXSDP.mjs.map +0 -1
  128. package/dist/chunk-RKTVJRK7.mjs +0 -143
  129. package/dist/chunk-RKTVJRK7.mjs.map +0 -1
  130. package/dist/chunk-SKC7AJIV.mjs +0 -61
  131. package/dist/chunk-SKC7AJIV.mjs.map +0 -1
  132. package/dist/chunk-SPCZTZCY.mjs +0 -1
  133. package/dist/chunk-SPCZTZCY.mjs.map +0 -1
  134. package/dist/chunk-VV56AVPB.mjs +0 -125
  135. package/dist/chunk-VV56AVPB.mjs.map +0 -1
  136. package/dist/chunk-WF65O6HX.mjs +0 -66
  137. package/dist/chunk-WF65O6HX.mjs.map +0 -1
  138. package/dist/chunk-XDFVCQD3.mjs +0 -27
  139. package/dist/chunk-XDFVCQD3.mjs.map +0 -1
  140. package/dist/chunk-YCG6SNAU.mjs +0 -759
  141. package/dist/chunk-YCG6SNAU.mjs.map +0 -1
  142. package/dist/chunk-YTQHRJUA.mjs +0 -86
  143. package/dist/chunk-YTQHRJUA.mjs.map +0 -1
  144. package/dist/chunk-YYN33GSG.mjs +0 -73
  145. package/dist/chunk-YYN33GSG.mjs.map +0 -1
  146. package/dist/chunk-Z6JV2LRY.mjs +0 -37
  147. package/dist/chunk-Z6JV2LRY.mjs.map +0 -1
  148. package/dist/chunk-ZVF5Q6IH.mjs +0 -29
  149. package/dist/chunk-ZVF5Q6IH.mjs.map +0 -1
  150. package/dist/chunk-ZYTXB6HH.mjs +0 -151
  151. package/dist/chunk-ZYTXB6HH.mjs.map +0 -1
  152. package/dist/components/CopilotListeners.d.ts +0 -3
  153. package/dist/components/CopilotListeners.js +0 -101
  154. package/dist/components/CopilotListeners.js.map +0 -1
  155. package/dist/components/CopilotListeners.mjs +0 -9
  156. package/dist/components/CopilotListeners.mjs.map +0 -1
  157. package/dist/components/copilot-provider/copilot-messages.d.ts +0 -24
  158. package/dist/components/copilot-provider/copilot-messages.js +0 -351
  159. package/dist/components/copilot-provider/copilot-messages.js.map +0 -1
  160. package/dist/components/copilot-provider/copilot-messages.mjs +0 -16
  161. package/dist/components/copilot-provider/copilot-messages.mjs.map +0 -1
  162. package/dist/components/copilot-provider/copilotkit-props.d.ts +0 -160
  163. package/dist/components/copilot-provider/copilotkit-props.js +0 -19
  164. package/dist/components/copilot-provider/copilotkit-props.js.map +0 -1
  165. package/dist/components/copilot-provider/copilotkit-props.mjs +0 -1
  166. package/dist/components/copilot-provider/copilotkit-props.mjs.map +0 -1
  167. package/dist/components/copilot-provider/copilotkit.d.ts +0 -19
  168. package/dist/components/copilot-provider/copilotkit.js +0 -1960
  169. package/dist/components/copilot-provider/copilotkit.js.map +0 -1
  170. package/dist/components/copilot-provider/copilotkit.mjs +0 -31
  171. package/dist/components/copilot-provider/copilotkit.mjs.map +0 -1
  172. package/dist/components/copilot-provider/index.d.ts +0 -14
  173. package/dist/components/copilot-provider/index.js +0 -1960
  174. package/dist/components/copilot-provider/index.js.map +0 -1
  175. package/dist/components/copilot-provider/index.mjs +0 -30
  176. package/dist/components/copilot-provider/index.mjs.map +0 -1
  177. package/dist/components/dev-console/console-trigger.d.ts +0 -8
  178. package/dist/components/dev-console/console-trigger.js +0 -1202
  179. package/dist/components/dev-console/console-trigger.js.map +0 -1
  180. package/dist/components/dev-console/console-trigger.mjs +0 -233
  181. package/dist/components/dev-console/console-trigger.mjs.map +0 -1
  182. package/dist/components/dev-console/developer-console-modal.d.ts +0 -10
  183. package/dist/components/dev-console/developer-console-modal.js +0 -987
  184. package/dist/components/dev-console/developer-console-modal.js.map +0 -1
  185. package/dist/components/dev-console/developer-console-modal.mjs +0 -12
  186. package/dist/components/dev-console/developer-console-modal.mjs.map +0 -1
  187. package/dist/components/dev-console/icons.d.ts +0 -9
  188. package/dist/components/dev-console/icons.js +0 -131
  189. package/dist/components/dev-console/icons.js.map +0 -1
  190. package/dist/components/dev-console/icons.mjs +0 -16
  191. package/dist/components/dev-console/icons.mjs.map +0 -1
  192. package/dist/components/error-boundary/error-boundary.d.ts +0 -31
  193. package/dist/components/error-boundary/error-boundary.js +0 -500
  194. package/dist/components/error-boundary/error-boundary.js.map +0 -1
  195. package/dist/components/error-boundary/error-boundary.mjs +0 -15
  196. package/dist/components/error-boundary/error-boundary.mjs.map +0 -1
  197. package/dist/components/error-boundary/error-utils.d.ts +0 -11
  198. package/dist/components/error-boundary/error-utils.js +0 -190
  199. package/dist/components/error-boundary/error-utils.js.map +0 -1
  200. package/dist/components/error-boundary/error-utils.mjs +0 -14
  201. package/dist/components/error-boundary/error-utils.mjs.map +0 -1
  202. package/dist/components/index.d.ts +0 -14
  203. package/dist/components/index.js +0 -1960
  204. package/dist/components/index.js.map +0 -1
  205. package/dist/components/index.mjs +0 -31
  206. package/dist/components/index.mjs.map +0 -1
  207. package/dist/components/toast/exclamation-mark-icon.d.ts +0 -9
  208. package/dist/components/toast/exclamation-mark-icon.js +0 -55
  209. package/dist/components/toast/exclamation-mark-icon.js.map +0 -1
  210. package/dist/components/toast/exclamation-mark-icon.mjs +0 -8
  211. package/dist/components/toast/exclamation-mark-icon.mjs.map +0 -1
  212. package/dist/components/toast/toast-provider.d.ts +0 -27
  213. package/dist/components/toast/toast-provider.js +0 -347
  214. package/dist/components/toast/toast-provider.js.map +0 -1
  215. package/dist/components/toast/toast-provider.mjs +0 -10
  216. package/dist/components/toast/toast-provider.mjs.map +0 -1
  217. package/dist/components/usage-banner.d.ts +0 -29
  218. package/dist/components/usage-banner.js +0 -247
  219. package/dist/components/usage-banner.js.map +0 -1
  220. package/dist/components/usage-banner.mjs +0 -12
  221. package/dist/components/usage-banner.mjs.map +0 -1
  222. package/dist/context/coagent-state-renders-context.d.ts +0 -24
  223. package/dist/context/coagent-state-renders-context.js +0 -91
  224. package/dist/context/coagent-state-renders-context.js.map +0 -1
  225. package/dist/context/coagent-state-renders-context.mjs +0 -12
  226. package/dist/context/coagent-state-renders-context.mjs.map +0 -1
  227. package/dist/context/copilot-context.d.ts +0 -10
  228. package/dist/context/copilot-context.js +0 -161
  229. package/dist/context/copilot-context.js.map +0 -1
  230. package/dist/context/copilot-context.mjs +0 -10
  231. package/dist/context/copilot-context.mjs.map +0 -1
  232. package/dist/context/copilot-messages-context.d.ts +0 -18
  233. package/dist/context/copilot-messages-context.js +0 -60
  234. package/dist/context/copilot-messages-context.js.map +0 -1
  235. package/dist/context/copilot-messages-context.mjs +0 -10
  236. package/dist/context/copilot-messages-context.mjs.map +0 -1
  237. package/dist/context/index.d.ts +0 -15
  238. package/dist/context/index.js +0 -285
  239. package/dist/context/index.js.map +0 -1
  240. package/dist/context/index.mjs +0 -33
  241. package/dist/context/index.mjs.map +0 -1
  242. package/dist/context/threads-context.d.ts +0 -16
  243. package/dist/context/threads-context.js +0 -59
  244. package/dist/context/threads-context.js.map +0 -1
  245. package/dist/context/threads-context.mjs +0 -12
  246. package/dist/context/threads-context.mjs.map +0 -1
  247. package/dist/copilot-context-ec77e921.d.ts +0 -209
  248. package/dist/hooks/index.d.ts +0 -33
  249. package/dist/hooks/index.js +0 -1774
  250. package/dist/hooks/index.js.map +0 -1
  251. package/dist/hooks/index.mjs +0 -91
  252. package/dist/hooks/index.mjs.map +0 -1
  253. package/dist/hooks/use-agent-nodename.d.ts +0 -3
  254. package/dist/hooks/use-agent-nodename.js +0 -56
  255. package/dist/hooks/use-agent-nodename.js.map +0 -1
  256. package/dist/hooks/use-agent-nodename.mjs +0 -8
  257. package/dist/hooks/use-agent-nodename.mjs.map +0 -1
  258. package/dist/hooks/use-coagent-state-render-bridge.d.ts +0 -100
  259. package/dist/hooks/use-coagent-state-render-bridge.js +0 -214
  260. package/dist/hooks/use-coagent-state-render-bridge.js.map +0 -1
  261. package/dist/hooks/use-coagent-state-render-bridge.mjs +0 -15
  262. package/dist/hooks/use-coagent-state-render-bridge.mjs.map +0 -1
  263. package/dist/hooks/use-coagent-state-render.d.ts +0 -55
  264. package/dist/hooks/use-coagent-state-render.js +0 -255
  265. package/dist/hooks/use-coagent-state-render.js.map +0 -1
  266. package/dist/hooks/use-coagent-state-render.mjs +0 -11
  267. package/dist/hooks/use-coagent-state-render.mjs.map +0 -1
  268. package/dist/hooks/use-coagent.d.ts +0 -192
  269. package/dist/hooks/use-coagent.js +0 -233
  270. package/dist/hooks/use-coagent.js.map +0 -1
  271. package/dist/hooks/use-coagent.mjs +0 -9
  272. package/dist/hooks/use-coagent.mjs.map +0 -1
  273. package/dist/hooks/use-configure-chat-suggestions.d.ts +0 -36
  274. package/dist/hooks/use-configure-chat-suggestions.js +0 -79
  275. package/dist/hooks/use-configure-chat-suggestions.js.map +0 -1
  276. package/dist/hooks/use-configure-chat-suggestions.mjs +0 -47
  277. package/dist/hooks/use-configure-chat-suggestions.mjs.map +0 -1
  278. package/dist/hooks/use-copilot-action.d.ts +0 -103
  279. package/dist/hooks/use-copilot-action.js +0 -295
  280. package/dist/hooks/use-copilot-action.js.map +0 -1
  281. package/dist/hooks/use-copilot-action.mjs +0 -11
  282. package/dist/hooks/use-copilot-action.mjs.map +0 -1
  283. package/dist/hooks/use-copilot-additional-instructions.d.ts +0 -26
  284. package/dist/hooks/use-copilot-additional-instructions.js +0 -177
  285. package/dist/hooks/use-copilot-additional-instructions.js.map +0 -1
  286. package/dist/hooks/use-copilot-additional-instructions.mjs +0 -9
  287. package/dist/hooks/use-copilot-additional-instructions.mjs.map +0 -1
  288. package/dist/hooks/use-copilot-authenticated-action.d.ts +0 -18
  289. package/dist/hooks/use-copilot-authenticated-action.js +0 -462
  290. package/dist/hooks/use-copilot-authenticated-action.js.map +0 -1
  291. package/dist/hooks/use-copilot-authenticated-action.mjs +0 -13
  292. package/dist/hooks/use-copilot-authenticated-action.mjs.map +0 -1
  293. package/dist/hooks/use-copilot-chat-headless_c.d.ts +0 -25
  294. package/dist/hooks/use-copilot-chat-headless_c.js +0 -1044
  295. package/dist/hooks/use-copilot-chat-headless_c.js.map +0 -1
  296. package/dist/hooks/use-copilot-chat-headless_c.mjs +0 -24
  297. package/dist/hooks/use-copilot-chat-headless_c.mjs.map +0 -1
  298. package/dist/hooks/use-copilot-chat-suggestions.d.ts +0 -35
  299. package/dist/hooks/use-copilot-chat-suggestions.js +0 -60
  300. package/dist/hooks/use-copilot-chat-suggestions.js.map +0 -1
  301. package/dist/hooks/use-copilot-chat-suggestions.mjs +0 -8
  302. package/dist/hooks/use-copilot-chat-suggestions.mjs.map +0 -1
  303. package/dist/hooks/use-copilot-chat.d.ts +0 -92
  304. package/dist/hooks/use-copilot-chat.js +0 -978
  305. package/dist/hooks/use-copilot-chat.js.map +0 -1
  306. package/dist/hooks/use-copilot-chat.mjs +0 -21
  307. package/dist/hooks/use-copilot-chat.mjs.map +0 -1
  308. package/dist/hooks/use-copilot-chat_internal.d.ts +0 -244
  309. package/dist/hooks/use-copilot-chat_internal.js +0 -976
  310. package/dist/hooks/use-copilot-chat_internal.js.map +0 -1
  311. package/dist/hooks/use-copilot-chat_internal.mjs +0 -22
  312. package/dist/hooks/use-copilot-chat_internal.mjs.map +0 -1
  313. package/dist/hooks/use-copilot-readable.d.ts +0 -37
  314. package/dist/hooks/use-copilot-readable.js +0 -61
  315. package/dist/hooks/use-copilot-readable.js.map +0 -1
  316. package/dist/hooks/use-copilot-readable.mjs +0 -8
  317. package/dist/hooks/use-copilot-readable.mjs.map +0 -1
  318. package/dist/hooks/use-copilot-runtime-client.d.ts +0 -10
  319. package/dist/hooks/use-copilot-runtime-client.js +0 -203
  320. package/dist/hooks/use-copilot-runtime-client.js.map +0 -1
  321. package/dist/hooks/use-copilot-runtime-client.mjs +0 -9
  322. package/dist/hooks/use-copilot-runtime-client.mjs.map +0 -1
  323. package/dist/hooks/use-default-tool.d.ts +0 -8
  324. package/dist/hooks/use-default-tool.js +0 -302
  325. package/dist/hooks/use-default-tool.js.map +0 -1
  326. package/dist/hooks/use-default-tool.mjs +0 -12
  327. package/dist/hooks/use-default-tool.mjs.map +0 -1
  328. package/dist/hooks/use-flat-category-store.d.ts +0 -9
  329. package/dist/hooks/use-flat-category-store.js +0 -93
  330. package/dist/hooks/use-flat-category-store.js.map +0 -1
  331. package/dist/hooks/use-flat-category-store.mjs +0 -8
  332. package/dist/hooks/use-flat-category-store.mjs.map +0 -1
  333. package/dist/hooks/use-frontend-tool.d.ts +0 -11
  334. package/dist/hooks/use-frontend-tool.js +0 -104
  335. package/dist/hooks/use-frontend-tool.js.map +0 -1
  336. package/dist/hooks/use-frontend-tool.mjs +0 -8
  337. package/dist/hooks/use-frontend-tool.mjs.map +0 -1
  338. package/dist/hooks/use-human-in-the-loop.d.ts +0 -13
  339. package/dist/hooks/use-human-in-the-loop.js +0 -122
  340. package/dist/hooks/use-human-in-the-loop.js.map +0 -1
  341. package/dist/hooks/use-human-in-the-loop.mjs +0 -8
  342. package/dist/hooks/use-human-in-the-loop.mjs.map +0 -1
  343. package/dist/hooks/use-langgraph-interrupt-render.d.ts +0 -6
  344. package/dist/hooks/use-langgraph-interrupt-render.js +0 -318
  345. package/dist/hooks/use-langgraph-interrupt-render.js.map +0 -1
  346. package/dist/hooks/use-langgraph-interrupt-render.mjs +0 -14
  347. package/dist/hooks/use-langgraph-interrupt-render.mjs.map +0 -1
  348. package/dist/hooks/use-langgraph-interrupt.d.ts +0 -14
  349. package/dist/hooks/use-langgraph-interrupt.js +0 -201
  350. package/dist/hooks/use-langgraph-interrupt.js.map +0 -1
  351. package/dist/hooks/use-langgraph-interrupt.mjs +0 -10
  352. package/dist/hooks/use-langgraph-interrupt.mjs.map +0 -1
  353. package/dist/hooks/use-lazy-tool-renderer.d.ts +0 -6
  354. package/dist/hooks/use-lazy-tool-renderer.js +0 -53
  355. package/dist/hooks/use-lazy-tool-renderer.js.map +0 -1
  356. package/dist/hooks/use-lazy-tool-renderer.mjs +0 -8
  357. package/dist/hooks/use-lazy-tool-renderer.mjs.map +0 -1
  358. package/dist/hooks/use-make-copilot-document-readable.d.ts +0 -12
  359. package/dist/hooks/use-make-copilot-document-readable.js +0 -176
  360. package/dist/hooks/use-make-copilot-document-readable.js.map +0 -1
  361. package/dist/hooks/use-make-copilot-document-readable.mjs +0 -9
  362. package/dist/hooks/use-make-copilot-document-readable.mjs.map +0 -1
  363. package/dist/hooks/use-render-tool-call.d.ts +0 -12
  364. package/dist/hooks/use-render-tool-call.js +0 -90
  365. package/dist/hooks/use-render-tool-call.js.map +0 -1
  366. package/dist/hooks/use-render-tool-call.mjs +0 -8
  367. package/dist/hooks/use-render-tool-call.mjs.map +0 -1
  368. package/dist/hooks/use-tree.d.ts +0 -19
  369. package/dist/hooks/use-tree.js +0 -175
  370. package/dist/hooks/use-tree.js.map +0 -1
  371. package/dist/hooks/use-tree.mjs +0 -8
  372. package/dist/hooks/use-tree.mjs.map +0 -1
  373. package/dist/index.d.ts +0 -43
  374. package/dist/index.js +0 -3528
  375. package/dist/index.js.map +0 -1
  376. package/dist/lib/copilot-task.d.ts +0 -97
  377. package/dist/lib/copilot-task.js +0 -194
  378. package/dist/lib/copilot-task.js.map +0 -1
  379. package/dist/lib/copilot-task.mjs +0 -31
  380. package/dist/lib/copilot-task.mjs.map +0 -1
  381. package/dist/lib/index.d.ts +0 -11
  382. package/dist/lib/index.js +0 -196
  383. package/dist/lib/index.js.map +0 -1
  384. package/dist/lib/index.mjs +0 -32
  385. package/dist/lib/index.mjs.map +0 -1
  386. package/dist/lib/status-checker.d.ts +0 -17
  387. package/dist/lib/status-checker.js +0 -102
  388. package/dist/lib/status-checker.js.map +0 -1
  389. package/dist/lib/status-checker.mjs +0 -8
  390. package/dist/lib/status-checker.mjs.map +0 -1
  391. package/dist/setupTests.d.ts +0 -2
  392. package/dist/setupTests.js +0 -26
  393. package/dist/setupTests.js.map +0 -1
  394. package/dist/setupTests.mjs +0 -24
  395. package/dist/setupTests.mjs.map +0 -1
  396. package/dist/types/chat-suggestion-configuration.d.ts +0 -22
  397. package/dist/types/chat-suggestion-configuration.js +0 -19
  398. package/dist/types/chat-suggestion-configuration.js.map +0 -1
  399. package/dist/types/chat-suggestion-configuration.mjs +0 -1
  400. package/dist/types/chat-suggestion-configuration.mjs.map +0 -1
  401. package/dist/types/coagent-action.d.ts +0 -29
  402. package/dist/types/coagent-action.js +0 -19
  403. package/dist/types/coagent-action.js.map +0 -1
  404. package/dist/types/coagent-action.mjs +0 -1
  405. package/dist/types/coagent-action.mjs.map +0 -1
  406. package/dist/types/coagent-state.d.ts +0 -15
  407. package/dist/types/coagent-state.js +0 -19
  408. package/dist/types/coagent-state.js.map +0 -1
  409. package/dist/types/coagent-state.mjs +0 -1
  410. package/dist/types/coagent-state.mjs.map +0 -1
  411. package/dist/types/crew.d.ts +0 -79
  412. package/dist/types/crew.js +0 -19
  413. package/dist/types/crew.js.map +0 -1
  414. package/dist/types/crew.mjs +0 -2
  415. package/dist/types/crew.mjs.map +0 -1
  416. package/dist/types/document-pointer.d.ts +0 -9
  417. package/dist/types/document-pointer.js +0 -19
  418. package/dist/types/document-pointer.js.map +0 -1
  419. package/dist/types/document-pointer.mjs +0 -1
  420. package/dist/types/document-pointer.mjs.map +0 -1
  421. package/dist/types/frontend-action.d.ts +0 -127
  422. package/dist/types/frontend-action.js +0 -53
  423. package/dist/types/frontend-action.js.map +0 -1
  424. package/dist/types/frontend-action.mjs +0 -8
  425. package/dist/types/frontend-action.mjs.map +0 -1
  426. package/dist/types/index.d.ts +0 -12
  427. package/dist/types/index.js +0 -19
  428. package/dist/types/index.js.map +0 -1
  429. package/dist/types/index.mjs +0 -4
  430. package/dist/types/index.mjs.map +0 -1
  431. package/dist/types/interrupt-action.d.ts +0 -10
  432. package/dist/types/interrupt-action.js +0 -19
  433. package/dist/types/interrupt-action.js.map +0 -1
  434. package/dist/types/interrupt-action.mjs +0 -2
  435. package/dist/types/interrupt-action.mjs.map +0 -1
  436. package/dist/types/system-message.d.ts +0 -3
  437. package/dist/types/system-message.js +0 -19
  438. package/dist/types/system-message.js.map +0 -1
  439. package/dist/types/system-message.mjs +0 -1
  440. package/dist/types/system-message.mjs.map +0 -1
  441. package/dist/utils/dev-console.d.ts +0 -3
  442. package/dist/utils/dev-console.js +0 -41
  443. package/dist/utils/dev-console.js.map +0 -1
  444. package/dist/utils/dev-console.mjs +0 -8
  445. package/dist/utils/dev-console.mjs.map +0 -1
  446. package/dist/utils/index.d.ts +0 -2
  447. package/dist/utils/index.js +0 -52
  448. package/dist/utils/index.js.map +0 -1
  449. package/dist/utils/index.mjs +0 -13
  450. package/dist/utils/index.mjs.map +0 -1
  451. package/dist/utils/suggestions-constants.d.ts +0 -9
  452. package/dist/utils/suggestions-constants.js +0 -35
  453. package/dist/utils/suggestions-constants.js.map +0 -1
  454. package/dist/utils/suggestions-constants.mjs +0 -8
  455. package/dist/utils/suggestions-constants.mjs.map +0 -1
  456. package/dist/utils/utils.d.ts +0 -2
  457. package/dist/utils/utils.js +0 -19
  458. package/dist/utils/utils.js.map +0 -1
  459. package/dist/utils/utils.mjs +0 -1
  460. package/dist/utils/utils.mjs.map +0 -1
  461. package/dist/v2/index.css +0 -4
  462. package/dist/v2/index.css.map +0 -1
  463. package/dist/v2/index.d.ts +0 -2
  464. package/dist/v2/index.js +0 -27
  465. package/dist/v2/index.js.map +0 -1
  466. package/dist/v2/index.mjs +0 -6
  467. package/dist/v2/index.mjs.map +0 -1
  468. package/jest.config.js +0 -25
  469. package/src/components/CopilotListeners.tsx +0 -81
  470. package/src/components/copilot-provider/__tests__/copilotkit-error.test.tsx +0 -75
  471. package/src/components/copilot-provider/copilot-messages.tsx +0 -274
  472. package/src/components/copilot-provider/copilotkit-props.tsx +0 -169
  473. package/src/components/copilot-provider/copilotkit.tsx +0 -671
  474. package/src/components/copilot-provider/index.ts +0 -3
  475. package/src/components/dev-console/console-trigger.tsx +0 -254
  476. package/src/components/dev-console/developer-console-modal.tsx +0 -866
  477. package/src/components/dev-console/icons.tsx +0 -101
  478. package/src/components/error-boundary/error-boundary.tsx +0 -91
  479. package/src/components/error-boundary/error-utils.tsx +0 -100
  480. package/src/components/index.ts +0 -1
  481. package/src/components/toast/exclamation-mark-icon.tsx +0 -27
  482. package/src/components/toast/toast-provider.tsx +0 -363
  483. package/src/components/usage-banner.tsx +0 -259
  484. package/src/context/coagent-state-renders-context.tsx +0 -76
  485. package/src/context/copilot-context.tsx +0 -332
  486. package/src/context/copilot-messages-context.tsx +0 -35
  487. package/src/context/index.ts +0 -16
  488. package/src/context/threads-context.tsx +0 -41
  489. package/src/hooks/__tests__/use-coagent-config.test.ts +0 -351
  490. package/src/hooks/index.ts +0 -34
  491. package/src/hooks/use-agent-nodename.ts +0 -30
  492. package/src/hooks/use-coagent-state-render-bridge.tsx +0 -293
  493. package/src/hooks/use-coagent-state-render.ts +0 -152
  494. package/src/hooks/use-coagent.ts +0 -366
  495. package/src/hooks/use-configure-chat-suggestions.tsx +0 -86
  496. package/src/hooks/use-copilot-action.ts +0 -236
  497. package/src/hooks/use-copilot-additional-instructions.ts +0 -85
  498. package/src/hooks/use-copilot-authenticated-action.ts +0 -70
  499. package/src/hooks/use-copilot-chat-headless_c.ts +0 -258
  500. package/src/hooks/use-copilot-chat-suggestions.tsx +0 -124
  501. package/src/hooks/use-copilot-chat.ts +0 -130
  502. package/src/hooks/use-copilot-chat_internal.ts +0 -696
  503. package/src/hooks/use-copilot-readable.ts +0 -135
  504. package/src/hooks/use-copilot-runtime-client.ts +0 -164
  505. package/src/hooks/use-default-tool.ts +0 -7
  506. package/src/hooks/use-flat-category-store.ts +0 -105
  507. package/src/hooks/use-frontend-tool.ts +0 -96
  508. package/src/hooks/use-human-in-the-loop.ts +0 -122
  509. package/src/hooks/use-langgraph-interrupt-render.ts +0 -136
  510. package/src/hooks/use-langgraph-interrupt.ts +0 -36
  511. package/src/hooks/use-lazy-tool-renderer.tsx +0 -30
  512. package/src/hooks/use-make-copilot-document-readable.ts +0 -30
  513. package/src/hooks/use-render-tool-call.ts +0 -80
  514. package/src/hooks/use-tree.ts +0 -207
  515. package/src/index.tsx +0 -7
  516. package/src/lib/copilot-task.ts +0 -201
  517. package/src/lib/index.ts +0 -1
  518. package/src/lib/status-checker.ts +0 -64
  519. package/src/setupTests.ts +0 -26
  520. package/src/types/chat-suggestion-configuration.ts +0 -23
  521. package/src/types/coagent-action.ts +0 -31
  522. package/src/types/coagent-state.ts +0 -13
  523. package/src/types/crew.ts +0 -89
  524. package/src/types/document-pointer.ts +0 -7
  525. package/src/types/frontend-action.ts +0 -202
  526. package/src/types/index.ts +0 -17
  527. package/src/types/interrupt-action.ts +0 -43
  528. package/src/types/system-message.ts +0 -4
  529. package/src/utils/dev-console.ts +0 -19
  530. package/src/utils/index.ts +0 -2
  531. package/src/utils/suggestions-constants.ts +0 -8
  532. package/src/utils/utils.test.ts +0 -7
  533. package/src/utils/utils.ts +0 -8
  534. package/src/v2/index.css +0 -1
  535. package/src/v2/index.ts +0 -4
  536. package/tsconfig.json +0 -8
  537. package/tsup.config.ts +0 -16
  538. package/typedoc.json +0 -4
package/dist/v2/index.js DELETED
@@ -1,27 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
-
17
- // src/v2/index.ts
18
- var v2_exports = {};
19
- module.exports = __toCommonJS(v2_exports);
20
- __reExport(v2_exports, require("@copilotkitnext/core"), module.exports);
21
- __reExport(v2_exports, require("@copilotkitnext/react"), module.exports);
22
- // Annotate the CommonJS export names for ESM import in node:
23
- 0 && (module.exports = {
24
- ...require("@copilotkitnext/core"),
25
- ...require("@copilotkitnext/react")
26
- });
27
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/v2/index.ts"],"sourcesContent":["import \"./index.css\";\n\nexport * from \"@copilotkitnext/core\";\nexport * from \"@copilotkitnext/react\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAEA,uBAAc,iCAFd;AAGA,uBAAc,kCAHd;","names":[]}
package/dist/v2/index.mjs DELETED
@@ -1,6 +0,0 @@
1
- import "../chunk-SKC7AJIV.mjs";
2
-
3
- // src/v2/index.ts
4
- export * from "@copilotkitnext/core";
5
- export * from "@copilotkitnext/react";
6
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/v2/index.ts"],"sourcesContent":["import \"./index.css\";\n\nexport * from \"@copilotkitnext/core\";\nexport * from \"@copilotkitnext/react\";\n"],"mappings":";;;AAEA,cAAc;AACd,cAAc;","names":[]}
package/jest.config.js DELETED
@@ -1,25 +0,0 @@
1
- /** @type {import('ts-jest').JestConfigWithTsJest} */
2
- module.exports = {
3
- preset: "ts-jest",
4
- testEnvironment: "jsdom",
5
- testMatch: [
6
- "<rootDir>/src/**/__tests__/**/*.(ts|tsx)",
7
- "<rootDir>/src/**/*.(test|spec).(ts|tsx)",
8
- ],
9
- setupFilesAfterEnv: ["<rootDir>/src/setupTests.ts"],
10
- moduleNameMapper: {
11
- "^@/(.*)$": "<rootDir>/src/$1",
12
- "\\.(css|less|scss|sass)$": "identity-obj-proxy",
13
- },
14
- transformIgnorePatterns: [
15
- "node_modules/(?!(react-markdown|streamdown|@copilotkitnext)/)",
16
- ],
17
- transform: {
18
- "^.+\\.(ts|tsx)$": "ts-jest",
19
- "^.+\\.(js|jsx|mjs)$": ["ts-jest", {
20
- tsconfig: {
21
- allowJs: true,
22
- },
23
- }],
24
- },
25
- };
@@ -1,81 +0,0 @@
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
- }
@@ -1,75 +0,0 @@
1
- /// <reference types="jest" />
2
- import { CopilotErrorEvent, CopilotErrorHandler } from "@copilotkit/shared";
3
-
4
- describe("CopilotKit onError types", () => {
5
- let mockError: jest.Mock;
6
-
7
- beforeEach(() => {
8
- mockError = jest.fn();
9
- });
10
-
11
- describe("onError type checking", () => {
12
- it("should accept CopilotErrorHandler type", () => {
13
- // RED: Will fail - testing type compatibility
14
- const handler: CopilotErrorHandler = mockError;
15
- expect(handler).toBeDefined();
16
- });
17
-
18
- it("should validate error event structure", () => {
19
- // RED: Will fail - validating event structure
20
- const mockEvent: CopilotErrorEvent = {
21
- type: "error",
22
- timestamp: Date.now(),
23
- context: {
24
- source: "ui",
25
- request: {
26
- operation: "test",
27
- startTime: Date.now(),
28
- },
29
- },
30
- };
31
-
32
- expect(mockEvent.type).toBe("error");
33
- expect(mockEvent.timestamp).toBeDefined();
34
- expect(mockEvent.context.source).toBe("ui");
35
- });
36
-
37
- it("should validate error event types", () => {
38
- // RED: Will fail - ensuring all event types are valid
39
- const validTypes: CopilotErrorEvent["type"][] = [
40
- "error",
41
- "request",
42
- "response",
43
- "agent_state",
44
- "action",
45
- "message",
46
- "performance",
47
- ];
48
-
49
- expect(validTypes).toContain("error");
50
- expect(validTypes).toContain("request");
51
- expect(validTypes).toContain("agent_state");
52
- });
53
- });
54
-
55
- describe("error handler functionality", () => {
56
- it("should accept error handler with proper signature", () => {
57
- // RED: Will fail - testing handler function signature
58
- const handler: CopilotErrorHandler = (errorEvent: CopilotErrorEvent) => {
59
- console.log("Error:", errorEvent.type);
60
- };
61
-
62
- expect(typeof handler).toBe("function");
63
- });
64
-
65
- it("should handle async error handlers", async () => {
66
- // RED: Will fail - testing async handler support
67
- const asyncHandler: CopilotErrorHandler = async (errorEvent: CopilotErrorEvent) => {
68
- await Promise.resolve();
69
- return;
70
- };
71
-
72
- expect(typeof asyncHandler).toBe("function");
73
- });
74
- });
75
- });
@@ -1,274 +0,0 @@
1
- /**
2
- * An internal context to separate the messages state (which is constantly changing) from the rest of CopilotKit context
3
- */
4
-
5
- import {
6
- ReactNode,
7
- useEffect,
8
- useState,
9
- useRef,
10
- useCallback,
11
- useMemo,
12
- createContext,
13
- useContext,
14
- } from "react";
15
- import { CopilotMessagesContext } from "../../context/copilot-messages-context";
16
- import {
17
- loadMessagesFromJsonRepresentation,
18
- Message,
19
- GraphQLError,
20
- } from "@copilotkit/runtime-client-gql";
21
- import { useCopilotContext } from "../../context/copilot-context";
22
- import { useToast } from "../toast/toast-provider";
23
- import { shouldShowDevConsole } from "../../utils/dev-console";
24
- import {
25
- ErrorVisibility,
26
- CopilotKitApiDiscoveryError,
27
- CopilotKitRemoteEndpointDiscoveryError,
28
- CopilotKitAgentDiscoveryError,
29
- CopilotKitError,
30
- CopilotKitErrorCode,
31
- } from "@copilotkit/shared";
32
- import { Suggestion } from "@copilotkitnext/core";
33
-
34
- // Helper to determine if error should show as banner based on visibility and legacy patterns
35
- function shouldShowAsBanner(gqlError: GraphQLError): boolean {
36
- const extensions = gqlError.extensions;
37
- if (!extensions) return false;
38
-
39
- // Priority 1: Check error code for discovery errors (these should always be banners)
40
- const code = extensions.code as CopilotKitErrorCode;
41
- if (
42
- code === CopilotKitErrorCode.AGENT_NOT_FOUND ||
43
- code === CopilotKitErrorCode.API_NOT_FOUND ||
44
- code === CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND ||
45
- code === CopilotKitErrorCode.CONFIGURATION_ERROR ||
46
- code === CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR ||
47
- code === CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR
48
- ) {
49
- return true;
50
- }
51
-
52
- // Priority 2: Check banner visibility
53
- if (extensions.visibility === ErrorVisibility.BANNER) {
54
- return true;
55
- }
56
-
57
- // Priority 3: Check for critical errors that should be banners regardless of formal classification
58
- const errorMessage = gqlError.message.toLowerCase();
59
- if (
60
- errorMessage.includes("api key") ||
61
- errorMessage.includes("401") ||
62
- errorMessage.includes("unauthorized") ||
63
- errorMessage.includes("authentication") ||
64
- errorMessage.includes("incorrect api key")
65
- ) {
66
- return true;
67
- }
68
-
69
- // Priority 4: Legacy stack trace detection for discovery errors
70
- const originalError = extensions.originalError as any;
71
- if (originalError?.stack) {
72
- return (
73
- originalError.stack.includes("CopilotApiDiscoveryError") ||
74
- originalError.stack.includes("CopilotKitRemoteEndpointDiscoveryError") ||
75
- originalError.stack.includes("CopilotKitAgentDiscoveryError")
76
- );
77
- }
78
-
79
- return false;
80
- }
81
-
82
- /**
83
- * MessagesTap is used to mitigate performance issues when we only need
84
- * a snapshot of the messages, not a continuously updating stream of messages.
85
- */
86
-
87
- export type MessagesTap = {
88
- getMessagesFromTap: () => Message[];
89
- updateTapMessages: (messages: Message[]) => void;
90
- };
91
-
92
- const MessagesTapContext = createContext<MessagesTap | null>(null);
93
-
94
- export function useMessagesTap() {
95
- const tap = useContext(MessagesTapContext);
96
- if (!tap) throw new Error("useMessagesTap must be used inside <MessagesTapProvider>");
97
- return tap;
98
- }
99
-
100
- export function MessagesTapProvider({ children }: { children: React.ReactNode }) {
101
- const messagesRef = useRef<Message[]>([]);
102
-
103
- const tapRef = useRef<MessagesTap>({
104
- getMessagesFromTap: () => messagesRef.current,
105
- updateTapMessages: (messages: Message[]) => {
106
- messagesRef.current = messages;
107
- },
108
- });
109
-
110
- return (
111
- <MessagesTapContext.Provider value={tapRef.current}>{children}</MessagesTapContext.Provider>
112
- );
113
- }
114
-
115
- /**
116
- * CopilotKit messages context.
117
- */
118
-
119
- export function CopilotMessages({ children }: { children: ReactNode }) {
120
- const [messages, setMessages] = useState<Message[]>([]);
121
- const lastLoadedThreadId = useRef<string>(undefined!);
122
- const lastLoadedAgentName = useRef<string>(undefined!);
123
- const lastLoadedMessages = useRef<string>(undefined!);
124
-
125
- const { updateTapMessages } = useMessagesTap();
126
-
127
- const { threadId, agentSession, showDevConsole, onError, copilotApiConfig } = useCopilotContext();
128
- const { setBannerError } = useToast();
129
-
130
- // Helper function to trace UI errors (similar to useCopilotRuntimeClient)
131
- const traceUIError = useCallback(
132
- async (error: CopilotKitError, originalError?: any) => {
133
- // Just check if onError and publicApiKey are defined
134
- if (!onError || !copilotApiConfig.publicApiKey) return;
135
-
136
- try {
137
- const traceEvent = {
138
- type: "error" as const,
139
- timestamp: Date.now(),
140
- context: {
141
- source: "ui" as const,
142
- request: {
143
- operation: "loadAgentState",
144
- url: copilotApiConfig.chatApiEndpoint,
145
- startTime: Date.now(),
146
- },
147
- technical: {
148
- environment: "browser",
149
- userAgent: typeof navigator !== "undefined" ? navigator.userAgent : undefined,
150
- stackTrace: originalError instanceof Error ? originalError.stack : undefined,
151
- },
152
- },
153
- error,
154
- };
155
- await onError(traceEvent);
156
- } catch (traceError) {
157
- console.error("Error in CopilotMessages onError handler:", traceError);
158
- }
159
- },
160
- [onError, copilotApiConfig.publicApiKey, copilotApiConfig.chatApiEndpoint],
161
- );
162
-
163
- const createStructuredError = (gqlError: GraphQLError): CopilotKitError | null => {
164
- const extensions = gqlError.extensions;
165
- const originalError = extensions?.originalError as any;
166
-
167
- // Priority: Check stack trace for discovery errors first
168
- if (originalError?.stack) {
169
- if (originalError.stack.includes("CopilotApiDiscoveryError")) {
170
- return new CopilotKitApiDiscoveryError({ message: originalError.message });
171
- }
172
- if (originalError.stack.includes("CopilotKitRemoteEndpointDiscoveryError")) {
173
- return new CopilotKitRemoteEndpointDiscoveryError({ message: originalError.message });
174
- }
175
- if (originalError.stack.includes("CopilotKitAgentDiscoveryError")) {
176
- return new CopilotKitAgentDiscoveryError({
177
- agentName: "",
178
- availableAgents: [],
179
- });
180
- }
181
- }
182
-
183
- // Fallback: Use the formal error code if available
184
- const message = originalError?.message || gqlError.message;
185
- const code = extensions?.code as CopilotKitErrorCode;
186
-
187
- if (code) {
188
- return new CopilotKitError({ message, code });
189
- }
190
-
191
- return null;
192
- };
193
-
194
- const handleGraphQLErrors = useCallback(
195
- (error: any) => {
196
- if (error.graphQLErrors?.length) {
197
- const graphQLErrors = error.graphQLErrors as GraphQLError[];
198
-
199
- // Route all errors to banners for consistent UI
200
- const routeError = (gqlError: GraphQLError) => {
201
- const extensions = gqlError.extensions;
202
- const visibility = extensions?.visibility as ErrorVisibility;
203
- const isDev = shouldShowDevConsole(showDevConsole);
204
-
205
- if (!isDev) {
206
- console.error("CopilotKit Error (hidden in production):", gqlError.message);
207
- return;
208
- }
209
-
210
- // Silent errors - just log
211
- if (visibility === ErrorVisibility.SILENT) {
212
- console.error("CopilotKit Silent Error:", gqlError.message);
213
- return;
214
- }
215
-
216
- // All other errors (including DEV_ONLY) show as banners for consistency
217
- const ckError = createStructuredError(gqlError);
218
- if (ckError) {
219
- setBannerError(ckError);
220
- // Trace the structured error
221
- traceUIError(ckError, gqlError);
222
- } else {
223
- // Fallback: create a generic error for unstructured GraphQL errors
224
- const fallbackError = new CopilotKitError({
225
- message: gqlError.message,
226
- code: CopilotKitErrorCode.UNKNOWN,
227
- });
228
- setBannerError(fallbackError);
229
- // Trace the fallback error
230
- traceUIError(fallbackError, gqlError);
231
- }
232
- };
233
-
234
- // Process all errors as banners
235
- graphQLErrors.forEach(routeError);
236
- } else {
237
- const isDev = shouldShowDevConsole(showDevConsole);
238
- if (!isDev) {
239
- console.error("CopilotKit Error (hidden in production):", error);
240
- } else {
241
- // Route non-GraphQL errors to banner as well
242
- const fallbackError = new CopilotKitError({
243
- message: error?.message || String(error),
244
- code: CopilotKitErrorCode.UNKNOWN,
245
- });
246
- setBannerError(fallbackError);
247
- // Trace the non-GraphQL error
248
- traceUIError(fallbackError, error);
249
- }
250
- }
251
- },
252
- [setBannerError, showDevConsole, traceUIError],
253
- );
254
-
255
- useEffect(() => {
256
- updateTapMessages(messages);
257
- }, [messages, updateTapMessages]);
258
-
259
- const memoizedChildren = useMemo(() => children, [children]);
260
- const [suggestions, setSuggestions] = useState<Suggestion[]>([]);
261
-
262
- return (
263
- <CopilotMessagesContext.Provider
264
- value={{
265
- messages,
266
- setMessages,
267
- suggestions,
268
- setSuggestions,
269
- }}
270
- >
271
- {memoizedChildren}
272
- </CopilotMessagesContext.Provider>
273
- );
274
- }
@@ -1,169 +0,0 @@
1
- import { ForwardedParametersInput } from "@copilotkit/runtime-client-gql";
2
- import { ReactNode } from "react";
3
- import { AuthState } from "../../context/copilot-context";
4
- import { CopilotErrorHandler } from "@copilotkit/shared";
5
- import { CopilotKitProviderProps } from "@copilotkitnext/react";
6
- /**
7
- * Props for CopilotKit.
8
- */
9
-
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"> {
17
- /**
18
- * Your Copilot Cloud API key.
19
- *
20
- * Don't have it yet? Go to https://cloud.copilotkit.ai and get one for free.
21
- */
22
- publicApiKey?: string;
23
-
24
- /**
25
- * Your public license key for accessing premium CopilotKit features.
26
- *
27
- * Don't have it yet? Go to https://cloud.copilotkit.ai and get one for free.
28
- */
29
- publicLicenseKey?: string;
30
-
31
- /**
32
- * Restrict input to a specific topic.
33
- * @deprecated Use `guardrails_c` instead to control input restrictions
34
- */
35
- cloudRestrictToTopic?: {
36
- validTopics?: string[];
37
- invalidTopics?: string[];
38
- };
39
-
40
- /**
41
- * Restrict input to specific topics using guardrails.
42
- * @remarks
43
- *
44
- * This feature is only available when using CopilotKit's hosted cloud service. To use this feature, sign up at https://cloud.copilotkit.ai to get your publicApiKey. The feature allows restricting chat conversations to specific topics.
45
- */
46
- guardrails_c?: {
47
- validTopics?: string[];
48
- invalidTopics?: string[];
49
- };
50
-
51
- /**
52
- * The endpoint for the Copilot Runtime instance. [Click here for more information](/concepts/copilot-runtime).
53
- */
54
- runtimeUrl?: string;
55
-
56
- /**
57
- * The endpoint for the Copilot transcribe audio service.
58
- */
59
- transcribeAudioUrl?: string;
60
-
61
- /**
62
- * The endpoint for the Copilot text to speech service.
63
- */
64
- textToSpeechUrl?: string;
65
-
66
- /**
67
- * Additional headers to be sent with the request.
68
- *
69
- * For example:
70
- * ```json
71
- * {
72
- * "Authorization": "Bearer X"
73
- * }
74
- * ```
75
- */
76
- headers?: Record<string, string>;
77
-
78
- /**
79
- * The children to be rendered within the CopilotKit.
80
- */
81
- children: ReactNode;
82
-
83
- /**
84
- * Custom properties to be sent with the request.
85
- * Can include threadMetadata for thread creation and authorization for LangGraph Platform authentication.
86
- * For example:
87
- * ```js
88
- * {
89
- * 'user_id': 'users_id',
90
- * 'authorization': 'your-auth-token', // For LangGraph Platform authentication
91
- * threadMetadata: {
92
- * 'account_id': '123',
93
- * 'user_type': 'premium'
94
- * }
95
- * }
96
- * ```
97
- *
98
- * **Note**: The `authorization` property is automatically forwarded to LangGraph agents. See the [LangGraph Agent Authentication Guide](/coagents/shared/guides/langgraph-platform-authentication) for details.
99
- */
100
- properties?: Record<string, any>;
101
-
102
- /**
103
- * Indicates whether the user agent should send or receive cookies from the other domain
104
- * in the case of cross-origin requests.
105
- */
106
- credentials?: RequestCredentials;
107
-
108
- /**
109
- * Whether to show the dev console.
110
- *
111
- * Set to `true` to show error banners and toasts, `false` to hide all error UI.
112
- * Defaults to `false` for production safety.
113
- */
114
- showDevConsole?: boolean;
115
-
116
- /**
117
- * The name of the agent to use.
118
- */
119
- agent?: string;
120
-
121
- /**
122
- * The forwarded parameters to use for the task.
123
- */
124
- forwardedParameters?: Pick<ForwardedParametersInput, "temperature">;
125
-
126
- /**
127
- * The auth config to use for the CopilotKit.
128
- * @remarks
129
- *
130
- * This feature is only available when using CopilotKit's hosted cloud service. To use this feature, sign up at https://cloud.copilotkit.ai to get your publicApiKey. The feature allows restricting chat conversations to specific topics.
131
- */
132
- authConfig_c?: {
133
- SignInComponent: React.ComponentType<{
134
- onSignInComplete: (authState: AuthState) => void;
135
- }>;
136
- };
137
-
138
- /**
139
- * The thread id to use for the CopilotKit.
140
- */
141
- threadId?: string;
142
-
143
- /**
144
- * Optional error handler for comprehensive debugging and observability.
145
- *
146
- * **Requires publicApiKey**: Error handling only works when publicApiKey is provided.
147
- * This is a premium Copilot Cloud feature.
148
- *
149
- * @param errorEvent - Structured error event with rich debugging context
150
- *
151
- * @example
152
- * ```typescript
153
- * <CopilotKit
154
- * publicApiKey="ck_pub_your_key"
155
- * onError={(errorEvent) => {
156
- * debugDashboard.capture(errorEvent);
157
- * }}
158
- * >
159
- * ```
160
- */
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;
169
- }