@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
@@ -0,0 +1,954 @@
1
+ import { AbstractAgent } from "@ag-ui/client";
2
+ import React$1, { ComponentType, ReactNode } from "react";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
+ import { StreamingMarkdownRendererProps } from "@copilotkit/markdown-renderer/react";
5
+ import { A2UIFunctionPermissions, A2UIFunctionReturnType, A2UIOperation, ChildRef, GenerativeUIComponentManifest, GenerativeUIFunctionManifest, GenerativeUIRejectedOperation, GenerativeUISurfaceContent, GenerativeUISurfaceStatus, GenerativeUISurfaceSummary, GenerativeUIUserEvent, StandardSchemaV1 } from "@copilotkit/shared";
6
+ import { ActivityMessage } from "@ag-ui/core";
7
+ import { SurfaceModel } from "@a2ui/web_core/v0_9";
8
+
9
+ //#region src/generative-ui/errors.d.ts
10
+ type GenerativeUIErrorCode = "function_not_found" | "function_conflict" | "invalid_arguments" | "handler_failed" | "invalid_event_args" | "event_forward_failed" /** A function value or check could not be computed. */ | "expression_error" /** A function the caller may not call: `openUrl` from the agent. */ | "invalid_function_call" /** An event arrived while the agent was running: it was not sent. */ | "agent_busy";
11
+ declare class GenerativeUIError extends Error {
12
+ readonly code: GenerativeUIErrorCode;
13
+ constructor(code: GenerativeUIErrorCode, message: string);
14
+ }
15
+ type GenerativeUIInvokeResult = {
16
+ ok: true;
17
+ result: unknown;
18
+ } | {
19
+ ok: false;
20
+ error: GenerativeUIError;
21
+ };
22
+ type Components<UI extends GenerativeUI<any>> = GenerativeUIDefinitionsOf<UI>["components"];
23
+ type EventsOf<UI extends GenerativeUI<any>, Component extends keyof Components<UI>> = Components<UI>[Component]["events"] extends Record<string, unknown> ? Components<UI>[Component]["events"] : {};
24
+ type IsUnion<T, U = T> = T extends unknown ? [U] extends [T] ? false : true : never;
25
+ /** One member of a union. Used only after IsUnion proved the members equal. */
26
+ type OneOf<U> = UnionToIntersection<U extends unknown ? () => U : never> extends (() => infer R) ? R : never;
27
+ /** Every event name that a component of the UI declares, bases included. */
28
+ type GenerativeUIEventName<UI extends GenerativeUI<any>> = { [Component in keyof Components<UI>]: keyof EventsOf<UI, Component> & string }[keyof Components<UI>];
29
+ type EventArgs<UI extends GenerativeUI<any>, Name extends string> = { [Component in keyof Components<UI>]: Name extends keyof EventsOf<UI, Component> ? GenerativeUIEventInput<Name, EventsOf<UI, Component>[Name], GenerativeUIDefinitionsOf<UI>["functions"]> : never }[keyof Components<UI>];
30
+ /**
31
+ * Type of an event prop as seen by a component, looked up by event name in
32
+ * the generative UI that renders the component:
33
+ * `onSubmit?: GenerativeUIEventHandler<typeof ui, "onSubmit">`.
34
+ *
35
+ * The argument is the event `parameters` input. A matched event without
36
+ * `parameters` takes the input of its function.
37
+ *
38
+ * When components of the UI declare the event with different arguments, the
39
+ * result is not callable and names the conflict.
40
+ */
41
+ type GenerativeUIEventHandler<UI extends GenerativeUI<any>, Name extends GenerativeUIEventName<UI>> = true extends IsUnion<EventArgs<UI, Name>> ? {
42
+ readonly error: `"${Name}" has different parameters on different components of this generative UI`;
43
+ } : (args: OneOf<EventArgs<UI, Name>>) => Promise<GenerativeUIInvokeResult>;
44
+ interface GenerativeUIErrorInfo {
45
+ kind: "render" | "props" | "operation" | "function" | "event";
46
+ surfaceId: string;
47
+ componentId?: string;
48
+ error: Error;
49
+ }
50
+ //#endregion
51
+ //#region src/generative-ui/schema.d.ts
52
+ /** Any Standard Schema: zod, Valibot, ArkType, and more. */
53
+ type GenerativeUISchema = StandardSchemaV1;
54
+ /** The output type of a schema: what validation gives back. */
55
+ type SchemaOutput<Schema> = Schema extends StandardSchemaV1<any, infer Output> ? Output : never;
56
+ /** The input type of a schema: what validation takes. */
57
+ type SchemaInput<Schema> = Schema extends StandardSchemaV1<infer Input, any> ? Input : never;
58
+ //#endregion
59
+ //#region src/generative-ui/catalog.d.ts
60
+ type GenerativeUISlotKind = "single" | "multiple";
61
+ /**
62
+ * The schema of the props of a component: any Standard Schema of an object,
63
+ * for example `z.object({ ... })` or `v.object({ ... })`. The model gets
64
+ * the props as JSON Schema, so the schema must give one: Standard JSON
65
+ * Schema (zod 4.2+, ArkType, Valibot with `toStandardJsonSchema`) or zod 3.
66
+ * It must validate synchronously, because props are checked while a
67
+ * surface renders.
68
+ */
69
+ type PropsSchema = StandardSchemaV1<Record<string, unknown>, Record<string, unknown>>;
70
+ /** An event prop of a component. */
71
+ interface GenerativeUIEventDefinition {
72
+ description?: string;
73
+ /**
74
+ * Arguments the component passes when it calls the event prop. An event
75
+ * that matches a declared function can leave this out. Then the function
76
+ * parameters are used.
77
+ */
78
+ parameters?: GenerativeUISchema;
79
+ }
80
+ /**
81
+ * A function that generated UI can call. The handler comes from
82
+ * `useGenerativeUIFunction`.
83
+ */
84
+ interface GenerativeUIFunctionDefinition extends A2UIFunctionPermissions {
85
+ description?: string;
86
+ parameters: GenerativeUISchema;
87
+ /**
88
+ * Who may call it. `"rendererOnly"` (the default, as in A2UI 1.0): event
89
+ * bindings and prop values. `"agentOnly"`: `callRendererFunction`.
90
+ * `"rendererOrAgent"`: both. The agent calls only what you allow.
91
+ */
92
+ allowedCallers?: A2UIFunctionPermissions["allowedCallers"];
93
+ /**
94
+ * True for a function that runs only from a user gesture, like `openUrl`.
95
+ * It is then for the renderer only.
96
+ */
97
+ requiresUserActivation?: boolean;
98
+ /** What the handler gives back, as A2UI 1.0 names it. */
99
+ returnType?: A2UIFunctionReturnType;
100
+ }
101
+ /**
102
+ * Gives a bound prop its value. It gets the full state and the model-set
103
+ * props of the node, before the props schema parses them (no defaults or
104
+ * transforms). It runs in the browser and must be pure.
105
+ */
106
+ type GenerativeUISelector = (state: Record<string, unknown>, props: Record<string, unknown>) => unknown;
107
+ /**
108
+ * Method syntax makes the parameters bivariant. So a selector with typed
109
+ * parameters fits this runtime type.
110
+ */
111
+ type RuntimeSelector = {
112
+ select(state: Record<string, unknown>, props: Record<string, unknown>): unknown;
113
+ }["select"];
114
+ /** One component of a generative UI, as the renderer reads it. */
115
+ interface GenerativeUIComponentDefinition {
116
+ component: ComponentType<any>;
117
+ description?: string;
118
+ /**
119
+ * Positional prefix across props, slots and events for catalog consumers.
120
+ * Remaining visible keys follow in declaration order (props, slots, events).
121
+ * A2UI exports encode this as property order, not a protocol field.
122
+ */
123
+ parameterOrder?: readonly string[];
124
+ /** All data props: the props the model sets and the bound props. */
125
+ props?: PropsSchema;
126
+ /** Explicit selectors for bound props. */
127
+ bind?: Record<string, RuntimeSelector>;
128
+ /** Callback props. */
129
+ events?: Record<string, GenerativeUIEventDefinition>;
130
+ /**
131
+ * Child props, filled with rendered child components. A "multiple" slot
132
+ * takes a list of component ids, or a template `{ componentId, path }`
133
+ * that renders one component for each item of the list at `path`.
134
+ */
135
+ slots?: Record<string, GenerativeUISlotKind>;
136
+ /**
137
+ * Props that the component can write. Each one gets a setter prop named
138
+ * `set` + the prop name: `value` gets `setValue`. When the model binds the
139
+ * prop to `{ "@path" }`, the setter writes the surface data model at that
140
+ * path, and the agent can no longer change that path. Else the setter
141
+ * changes local state only.
142
+ */
143
+ writable?: readonly string[];
144
+ /**
145
+ * Who applies the `accessibility` envelope of the component: by default
146
+ * the engine, in a wrapper element around the component. `"self"` for a
147
+ * component that must not be wrapped (a table row or cell) and applies
148
+ * the attributes itself with `useGenerativeUIAccessibility()`.
149
+ */
150
+ accessibility?: "wrapper" | "self";
151
+ }
152
+ /** A component after `createGenerativeUI` resolved its bindings. */
153
+ interface ResolvedGenerativeUIComponent extends GenerativeUIComponentDefinition {
154
+ /**
155
+ * One selector for each bound prop. A prop with the name of a top-level
156
+ * state key reads `state[key]`. A `bind` entry wins over the name rule.
157
+ */
158
+ selectors: Record<string, GenerativeUISelector>;
159
+ /** Event name to the name of the declared function it calls. */
160
+ eventFunctions: Record<string, string>;
161
+ /** The keys of `props`, read from its JSON Schema. */
162
+ propKeys: readonly string[];
163
+ /**
164
+ * The component references in `props` (`child()`, `childList()`), at any
165
+ * depth. The renderer replaces each one with the rendered component. The
166
+ * `slots` of the definition are not in here.
167
+ */
168
+ childRefs: readonly ChildRef[];
169
+ /** Who applies the `accessibility` envelope; see the definition. */
170
+ accessibility: "wrapper" | "self";
171
+ }
172
+ /** Type-level data of one component, kept in `GenerativeUI["definitions"]`. */
173
+ interface GenerativeUIComponentTypes {
174
+ /** The `props` schema, or `unknown` when the component has none. */
175
+ props: unknown;
176
+ /** The `events` object, or `unknown` when the component has none. */
177
+ events: unknown;
178
+ /** The `slots` object, or `unknown` when the component has none. */
179
+ slots: unknown;
180
+ /** The `writable` list, or `unknown` when the component has none. */
181
+ writable: unknown;
182
+ }
183
+ /** Type-level data of a generative UI, with the keys of its bases merged in. */
184
+ interface GenerativeUIDefinitions {
185
+ state: Record<string, GenerativeUISchema>;
186
+ functions: Record<string, GenerativeUIFunctionDefinition>;
187
+ components: Record<string, GenerativeUIComponentTypes>;
188
+ }
189
+ /**
190
+ * Experimental. The result of `createGenerativeUI`: the components the model
191
+ * can render, the app state they read, and the functions they call. Give it
192
+ * to the provider (`generativeUI={{ ui }}`) and to the typed hooks.
193
+ */
194
+ interface GenerativeUI<Definitions extends GenerativeUIDefinitions = GenerativeUIDefinitions> {
195
+ /** Surfaces pin to this id. */
196
+ readonly id: string;
197
+ /** State schemas, bases first. */
198
+ readonly state: ReadonlyMap<string, GenerativeUISchema>;
199
+ /** Declared functions, bases first. */
200
+ readonly functions: ReadonlyMap<string, GenerativeUIFunctionDefinition>;
201
+ /** Components, bases first. */
202
+ readonly components: ReadonlyMap<string, ResolvedGenerativeUIComponent>;
203
+ /** What the model sees: model-set props and unmatched events only. */
204
+ readonly manifestComponents: Record<string, GenerativeUIComponentManifest>;
205
+ /** Type only, never set at runtime. */
206
+ readonly definitions?: Definitions;
207
+ /**
208
+ * A copy without the named components. The model no longer sees them, so
209
+ * the prompt gets smaller. State and functions stay. Call it once, at
210
+ * module level, like `createGenerativeUI`.
211
+ *
212
+ * @throws Error when a name is not a component of this UI.
213
+ *
214
+ * @example
215
+ * ```ts
216
+ * const ui = createGenerativeUI({
217
+ * id: "acme/app@1",
218
+ * extends: [standardUI.omit(["Map", "Chart"])],
219
+ * components: {},
220
+ * });
221
+ * ```
222
+ */
223
+ omit<Names extends keyof Definitions["components"] & string>(names: readonly Names[]): GenerativeUI<OmitComponents<Definitions, Names>>;
224
+ }
225
+ /** Definitions without some components. */
226
+ type OmitComponents<Definitions extends GenerativeUIDefinitions, Names extends PropertyKey> = {
227
+ state: Definitions["state"];
228
+ functions: Definitions["functions"];
229
+ components: Omit<Definitions["components"], Names>;
230
+ };
231
+ type AnyGenerativeUI = GenerativeUI<any>;
232
+ /**
233
+ * Any function or class component. Unlike `ComponentType`, checking a value
234
+ * against it does not read the component's props type. So a component can
235
+ * type its props from `typeof ui` without a circular type reference.
236
+ */
237
+ type AnyComponent = ((...args: never) => unknown) | (abstract new (...args: never) => unknown);
238
+ type Simplify<T> = { [Key in keyof T]: T[Key] } & {};
239
+ /** `A | B` to `A & B`. */
240
+ type UnionToIntersection<U> = (U extends unknown ? (value: U) => void : never) extends ((value: infer I) => void) ? I : never;
241
+ type OutputOf<Schema> = SchemaOutput<Schema>;
242
+ type InputOf<Schema> = SchemaInput<Schema>;
243
+ /** The prop names. None for a component without `props`. */
244
+ type PropKeys<Props> = Props extends PropsSchema ? keyof OutputOf<Props> & string : never;
245
+ /** The input type of one prop of a props schema. */
246
+ type PropInput<Props, Key> = Key extends keyof InputOf<Props> ? InputOf<Props>[Key] : never;
247
+ /** The type-level data of a generative UI. */
248
+ type GenerativeUIDefinitionsOf<UI extends AnyGenerativeUI> = NonNullable<UI["definitions"]>;
249
+ type StateValues<State> = Simplify<{ [Key in keyof State]: OutputOf<State[Key]> }>;
250
+ /**
251
+ * The state object of a generative UI, bases included. Selectors get it, and
252
+ * `useGenerativeUIState(ui, key, value)` sets one key of it.
253
+ */
254
+ type GenerativeUIStateOf<UI extends AnyGenerativeUI> = StateValues<GenerativeUIDefinitionsOf<UI>["state"]>;
255
+ /** The declared functions of a generative UI, bases included. */
256
+ type GenerativeUIFunctionsOf<UI extends AnyGenerativeUI> = GenerativeUIDefinitionsOf<UI>["functions"];
257
+ /** The name of a declared function of a generative UI. */
258
+ type GenerativeUIFunctionName<UI extends AnyGenerativeUI> = keyof GenerativeUIFunctionsOf<UI> & string;
259
+ /**
260
+ * The name of a component of a generative UI, bases included. For
261
+ * `GenerativeUI<any>`, it is `string`.
262
+ */
263
+ type GenerativeUIComponentName<UI extends AnyGenerativeUI> = keyof GenerativeUIDefinitionsOf<UI>["components"] & string;
264
+ type FunctionInput<Functions, Name> = Name extends keyof Functions ? Functions[Name] extends GenerativeUIFunctionDefinition ? InputOf<Functions[Name]["parameters"]> : never : never;
265
+ /** What a caller passes to a declared function (the schema input). */
266
+ type GenerativeUIFunctionInput<UI extends AnyGenerativeUI, Name extends GenerativeUIFunctionName<UI>> = FunctionInput<GenerativeUIFunctionsOf<UI>, Name>;
267
+ /**
268
+ * What the handler of a declared function gets: the parsed arguments (the
269
+ * schema output, with defaults set).
270
+ */
271
+ type GenerativeUIFunctionArgs<UI extends AnyGenerativeUI, Name extends GenerativeUIFunctionName<UI>> = OutputOf<GenerativeUIFunctionsOf<UI>[Name]["parameters"]>;
272
+ /**
273
+ * The function an event calls: the function with the same name, else the
274
+ * name without `on` and with a lowercase first letter. `never` when none.
275
+ */
276
+ type MatchedFunction<Name extends string, Functions> = Name extends keyof Functions ? Name : Name extends `on${infer Rest}` ? Uncapitalize<Rest> extends keyof Functions ? Uncapitalize<Rest> : never : never;
277
+ /**
278
+ * The argument type of an event prop. The event `parameters` input when it
279
+ * declares them, else the input of the matched function.
280
+ */
281
+ type GenerativeUIEventInput<Name extends string, Event, Functions> = "parameters" extends keyof Event ? InputOf<Event["parameters" & keyof Event]> : FunctionInput<Functions, MatchedFunction<Name, Functions>>;
282
+ type DataProps<Props> = Props extends PropsSchema ? OutputOf<Props> : {};
283
+ type EventProps<Events, Functions> = Events extends Record<string, unknown> ? { [Name in keyof Events]?: (args: GenerativeUIEventInput<Name & string, Events[Name], Functions>) => Promise<GenerativeUIInvokeResult> } : {};
284
+ type SlotProps<Slots> = Slots extends Record<string, unknown> ? { [Name in keyof Slots]?: ReactNode } : {};
285
+ type WritableKeys<Writable> = Writable extends readonly (infer Key)[] ? Key & string : never;
286
+ /** One setter for each writable prop: `value` gets `setValue`. */
287
+ type SetterProps<Props, Writable> = { [Key in WritableKeys<Writable> & PropKeys<Props> as `set${Capitalize<Key>}`]: (value: PropInput<Props, Key>) => void };
288
+ /**
289
+ * Props that the renderer passes to a component:
290
+ * `function CheckoutForm(props: GenerativeUIComponentProps<typeof ui, "CheckoutForm">)`.
291
+ * Data props are the parsed `props` schema, bound props included. Event and
292
+ * slot props are present only when they are bound or filled. Each writable
293
+ * prop gets a setter (`value` gets `setValue`), which is always present.
294
+ */
295
+ type GenerativeUIComponentProps<UI extends AnyGenerativeUI, Name extends keyof GenerativeUIDefinitionsOf<UI>["components"] & string> = Simplify<DataProps<GenerativeUIDefinitionsOf<UI>["components"][Name]["props"]> & EventProps<GenerativeUIDefinitionsOf<UI>["components"][Name]["events"], GenerativeUIDefinitionsOf<UI>["functions"]> & SlotProps<GenerativeUIDefinitionsOf<UI>["components"][Name]["slots"]> & SetterProps<GenerativeUIDefinitionsOf<UI>["components"][Name]["props"], GenerativeUIDefinitionsOf<UI>["components"][Name]["writable"]>>;
296
+ type BaseDefinitions<Bases extends readonly AnyGenerativeUI[]> = GenerativeUIDefinitionsOf<Bases[number]>;
297
+ type MergedState<Bases extends readonly AnyGenerativeUI[], State> = Simplify<UnionToIntersection<BaseDefinitions<Bases>["state"]> & State>;
298
+ type MergedFunctions<Bases extends readonly AnyGenerativeUI[], Functions> = Simplify<UnionToIntersection<BaseDefinitions<Bases>["functions"]> & Functions>;
299
+ /** Props keys with the name of a top-level state key. */
300
+ type NameKeys<Props, State> = PropKeys<Props> & keyof State;
301
+ type SelectorFor<Props, State, Key extends PropKeys<Props>> = (state: StateValues<State>, props: Simplify<Omit<InputOf<Props>, NameKeys<Props, State> | Key>>) => PropInput<Props, Key>;
302
+ type BindSelectors<Props, State> = { [Key in PropKeys<Props>]?: SelectorFor<Props, State, Key> };
303
+ /** Name-bound keys whose state type does not fit the prop schema input. */
304
+ type MismatchedNameKeys<Props, State> = { [Key in NameKeys<Props, State>]: [OutputOf<State[Key]>] extends [PropInput<Props, Key>] ? never : Key }[NameKeys<Props, State>];
305
+ /**
306
+ * `bind` is optional. When a prop has the name of a state key but the state
307
+ * type does not fit, `bind` must give that prop a selector.
308
+ */
309
+ type BindField<Props, State> = [MismatchedNameKeys<Props, State>] extends [never] ? {
310
+ bind?: BindSelectors<Props, State>;
311
+ } : {
312
+ bind: BindSelectors<Props, State> & { [Key in MismatchedNameKeys<Props, State>]-?: SelectorFor<Props, State, Key> };
313
+ };
314
+ /** `unknown` (no props) or an object schema. Else `props` gets an error. */
315
+ type PropsCheck<Props> = unknown extends Props ? unknown : Props extends PropsSchema ? unknown : {
316
+ props?: PropsSchema;
317
+ };
318
+ type MatchCheck<Name extends string, Event, Functions> = [MatchedFunction<Name, Functions>] extends [never] ? "parameters" extends keyof Event ? unknown : {
319
+ parameters: GenerativeUISchema;
320
+ } : "parameters" extends keyof Event ? [OutputOf<Event["parameters" & keyof Event]>] extends [FunctionInput<Functions, MatchedFunction<Name, Functions>>] ? unknown : {
321
+ parameters: `The output of these parameters does not fit the input of function "${MatchedFunction<Name, Functions> & string}".`;
322
+ } : unknown;
323
+ /**
324
+ * `unknown` when the event is valid. Else a type the event does not fit, so
325
+ * `tsc` reports the error on the event.
326
+ */
327
+ type EventCheck<Name extends string, Event, Functions> = Event extends GenerativeUIEventDefinition ? MatchCheck<Name, Event, Functions> : GenerativeUIEventDefinition;
328
+ type EventsCheck<Events, Functions> = { [Name in keyof Events]: EventCheck<Name & string, Events[Name], Functions> };
329
+ /** Props that a component can list in `writable`: not bound by name. */
330
+ type WritableKey<Props, State> = Exclude<PropKeys<Props>, NameKeys<Props, State>>;
331
+ /**
332
+ * Each component config is split over four mapped types. Each one infers
333
+ * one part (props, events, slots, writable) of every component. The checks
334
+ * are in `NoInfer`, so they do not change what is inferred. They are not
335
+ * intersected with schema types directly, because two schema class types do
336
+ * not intersect cleanly.
337
+ */
338
+ type ComponentsConfig<Props, Events, Slots, Writable, State, Functions> = { [Name in keyof Props]: {
339
+ component: AnyComponent;
340
+ description?: string;
341
+ parameterOrder?: readonly string[];
342
+ props?: Props[Name];
343
+ accessibility?: "wrapper" | "self";
344
+ } & NoInfer<PropsCheck<Props[Name]> & BindField<Props[Name], State>> } & { [Name in keyof Events]: {
345
+ events?: Events[Name] & NoInfer<EventsCheck<Events[Name], Functions>>;
346
+ } } & { [Name in keyof Slots]: {
347
+ slots?: Slots[Name] & Record<string, GenerativeUISlotKind>;
348
+ } } & { [Name in keyof Writable]: {
349
+ writable?: Writable[Name] & NoInfer<readonly WritableKey<Props[Name & keyof Props], State>[]>;
350
+ } };
351
+ /** The config of `createGenerativeUI`. */
352
+ interface CreateGenerativeUIConfig<Bases extends readonly AnyGenerativeUI[], State extends Record<string, GenerativeUISchema>, Functions extends Record<string, GenerativeUIFunctionDefinition>, Props extends Record<string, unknown>, Events extends Record<string, unknown>, Slots extends Record<string, unknown>, Writable extends Record<string, unknown>> {
353
+ /** Surfaces pin to it. Use a versioned id, for example "acme/store@1". */
354
+ id: string;
355
+ /** Bases. Their state, functions and components merge in, in order. */
356
+ extends?: Bases;
357
+ /** App state schemas, by top-level key. Put it before `components`. */
358
+ state?: State;
359
+ /** Functions that components can call. */
360
+ functions?: Functions;
361
+ /**
362
+ * New React components for components of the bases, by name. The model
363
+ * sees the same component: its description, props, events and slots stay.
364
+ * The new component gets the same props as the one it replaces.
365
+ */
366
+ overrides?: NoInfer<OverridesConfig<Bases>>;
367
+ /** The components the model can render. */
368
+ components: ComponentsConfig<Props, Events, Slots, Writable, MergedState<Bases, State>, MergedFunctions<Bases, Functions>>;
369
+ }
370
+ /** The definitions of the bases, merged. */
371
+ type BasesDefinitions<Bases extends readonly AnyGenerativeUI[]> = ResultDefinitions<Bases, {}, {}, {}, {}, {}, {}>;
372
+ /** One new React component for each component of the bases that it names. */
373
+ type OverridesConfig<Bases extends readonly AnyGenerativeUI[]> = { [Name in keyof BasesDefinitions<Bases>["components"] & string]?: {
374
+ component: ComponentType<BasesDefinitions<Bases> extends infer Definitions extends GenerativeUIDefinitions ? GenerativeUIComponentProps<GenerativeUI<Definitions>, Name> : never>;
375
+ } };
376
+ type OwnComponents<Props, Events, Slots, Writable> = { [Name in keyof Props]: {
377
+ props: Props[Name];
378
+ events: Name extends keyof Events ? Events[Name] : unknown;
379
+ slots: Name extends keyof Slots ? Slots[Name] : unknown;
380
+ writable: Name extends keyof Writable ? Writable[Name] : unknown;
381
+ } };
382
+ type ResultDefinitions<Bases extends readonly AnyGenerativeUI[], State, Functions, Props, Events, Slots, Writable> = {
383
+ state: MergedState<Bases, State>;
384
+ functions: MergedFunctions<Bases, Functions>;
385
+ components: Simplify<UnionToIntersection<BaseDefinitions<Bases>["components"]> & OwnComponents<Props, Events, Slots, Writable>>;
386
+ };
387
+ /**
388
+ * The id of the catalog that declared each component of `ui`. A component
389
+ * from `extends` keeps the id of its base. Not exported from the package.
390
+ */
391
+ /**
392
+ * Experimental. Declares the components the model can render, the app state
393
+ * they read, and the functions they call.
394
+ *
395
+ * - A prop with the name of a top-level state key is bound to that state.
396
+ * - `bind: { prop: (state, props) => value }` binds a prop to a selector.
397
+ * - An event binds to the function with its name, else to the name without
398
+ * `on` (`onAddToCart` calls `addToCart`).
399
+ * - `writable: ["value"]` gives the component a `setValue` prop. See
400
+ * `GenerativeUIComponentDefinition.writable`.
401
+ *
402
+ * The model does not see bound props or matched events.
403
+ *
404
+ * @param config - `id`, then optional `extends`, `state`, `functions` and
405
+ * `overrides`, then `components`. Put `state` before `components`, so the selectors
406
+ * get typed state.
407
+ * @throws Error when a name comes from two places, an override names no
408
+ * component of the bases, `props` is not an object
409
+ * schema with a JSON Schema, a key is reserved or used
410
+ * twice on a component, an event matches two functions, an unmatched event
411
+ * has no `parameters`, a `bind` key is not a prop, a `writable` key is not
412
+ * a prop or is a bound prop, or a setter name is already a key of the
413
+ * component. Also throws when `parameterOrder` contains duplicate or unknown
414
+ * keys, or an ordered component declares integer-index keys whose JSON object
415
+ * enumeration order cannot be controlled.
416
+ *
417
+ * @example
418
+ * ```ts
419
+ * const ui = createGenerativeUI({
420
+ * id: "acme/store@1",
421
+ * state: { cart: cartSchema },
422
+ * functions: { addToCart: { parameters: z.object({ productId: z.string() }) } },
423
+ * components: {
424
+ * CartSummary: {
425
+ * component: CartSummary,
426
+ * props: z.object({ count: z.number() }),
427
+ * bind: { count: (state) => state.cart.count },
428
+ * },
429
+ * },
430
+ * });
431
+ * ```
432
+ */
433
+ declare function createGenerativeUI<Bases extends readonly AnyGenerativeUI[] = [], State extends Record<string, GenerativeUISchema> = {}, Functions extends Record<string, GenerativeUIFunctionDefinition> = {}, Props extends Record<string, unknown> = {}, Events extends Record<string, unknown> = {}, Slots extends Record<string, unknown> = {}, Writable extends Record<string, unknown> = {}>(config: CreateGenerativeUIConfig<Bases, State, Functions, Props, Events, Slots, Writable>): GenerativeUI<ResultDefinitions<Bases, State, Functions, Props, Events, Slots, Writable>>;
434
+ //#endregion
435
+ //#region src/generative-ui/accessibility.d.ts
436
+ /**
437
+ * The `accessibility` of the A2UI 1.0 component envelope, with its dynamic
438
+ * values resolved. Every component may carry it next to `id` and
439
+ * `component`; it is not a prop of the component.
440
+ */
441
+ interface GenerativeUIAccessibility {
442
+ /** A short name for assistive technologies, 1 to 3 words. */
443
+ label?: string;
444
+ /** Instructions, format requirements, or what an action does. */
445
+ description?: string;
446
+ /** How screen readers announce changes (WAI-ARIA `aria-live`). */
447
+ live?: "off" | "polite" | "assertive";
448
+ /** True hides the component and its children from assistive technologies. */
449
+ hidden?: boolean;
450
+ }
451
+ /** The ARIA attributes of a resolved `accessibility`, ready to spread. */
452
+ interface GenerativeUIAriaAttributes {
453
+ "aria-label"?: string;
454
+ "aria-description"?: string;
455
+ "aria-live"?: "off" | "polite" | "assertive";
456
+ "aria-hidden"?: true;
457
+ }
458
+ /**
459
+ * Experimental. The ARIA attributes of the `accessibility` that the model
460
+ * gave the component being rendered, to spread on its root element. The
461
+ * standard components do this; a custom component does it itself:
462
+ *
463
+ * @example
464
+ * ```tsx
465
+ * function Panel({ children }: { children?: ReactNode }) {
466
+ * const aria = useGenerativeUIAccessibility();
467
+ * return <section {...aria}>{children}</section>;
468
+ * }
469
+ * ```
470
+ *
471
+ * Outside of generated UI it gives `{}`.
472
+ */
473
+ declare function useGenerativeUIAccessibility(): GenerativeUIAriaAttributes;
474
+ //#endregion
475
+ //#region src/generative-ui/dispatcher.d.ts
476
+ /**
477
+ * Holds the latest handler of one mounted `useGenerativeUIFunction`. The hook
478
+ * updates `current` on each render, so it registers only once per mount.
479
+ */
480
+ interface GenerativeUIHandlerRef {
481
+ current: (args: any) => unknown;
482
+ }
483
+ /** The component of a surface that called a function. */
484
+ interface GenerativeUIInvocationOrigin {
485
+ surfaceId: string;
486
+ componentId: string;
487
+ }
488
+ /**
489
+ * What called a function: a component of a surface, or the agent with a
490
+ * `callRendererFunction` operation.
491
+ */
492
+ type GenerativeUICallOrigin = GenerativeUIInvocationOrigin | {
493
+ functionCallId: string;
494
+ };
495
+ interface GenerativeUIDispatcher {
496
+ /**
497
+ * Call a declared function with arguments from generated UI or from the
498
+ * agent. Never throws: every failure becomes `{ ok: false, error }`.
499
+ */
500
+ invoke(name: string, args: unknown, origin: GenerativeUICallOrigin): Promise<GenerativeUIInvokeResult>;
501
+ /** The declared functions that have exactly one mounted handler, as JSON Schema. */
502
+ listExposed(): Record<string, GenerativeUIFunctionManifest>;
503
+ /**
504
+ * Mount a handler for a declared function. Returns the function that
505
+ * unmounts it. Calling the returned function more than once is safe.
506
+ */
507
+ register(name: string, ref: GenerativeUIHandlerRef): () => void;
508
+ /** How many handlers are mounted for `name`, for the inspector. */
509
+ handlerCount(name: string): number;
510
+ }
511
+ //#endregion
512
+ //#region src/generative-ui/surface-manager.d.ts
513
+ interface ManagedSurface {
514
+ readonly key: string;
515
+ readonly threadId: string;
516
+ readonly surfaceId: string;
517
+ readonly agentId: string | undefined;
518
+ /** Replaced by an empty model when the surface closes, to free its data. */
519
+ model: SurfaceModel<any>;
520
+ readonly createdAt: number;
521
+ target: string;
522
+ status: GenerativeUISurfaceStatus;
523
+ deleted: boolean;
524
+ /** Its first createSurface was rejected, so it never existed. */
525
+ failed: boolean;
526
+ /** Rejections reported by the runtime. */
527
+ serverRejected: GenerativeUIRejectedOperation[];
528
+ /** Rejections detected while applying operations in the browser. */
529
+ clientRejected: GenerativeUIRejectedOperation[];
530
+ /** The committed operations of the latest content, for the inspector. */
531
+ operations: readonly A2UIOperation[];
532
+ }
533
+ interface GenerativeUISurfaceManagerOptions {
534
+ onOperationRejected?: (info: {
535
+ surfaceId: string;
536
+ index: number;
537
+ reason: string;
538
+ }) => void;
539
+ }
540
+ /** What one mount of a target tells the model. */
541
+ interface GenerativeUITargetOptions {
542
+ /** Where the target is on the page and what to show in it. */
543
+ description?: string;
544
+ /**
545
+ * The only components that the surfaces of the target can use. Left out,
546
+ * every component of the UI is allowed.
547
+ */
548
+ components?: readonly string[];
549
+ }
550
+ /** A mounted target, as the manifest lists it. */
551
+ interface GenerativeUIMountedTarget {
552
+ id: string;
553
+ description?: string;
554
+ components?: string[];
555
+ }
556
+ /**
557
+ * Framework-agnostic store of generated surfaces. One web_core SurfaceModel per
558
+ * (threadId, surfaceId), shared by every mount. Applies only newly committed
559
+ * operations, validates each before applying it, and owns app state and the
560
+ * data model paths that the user wrote, so agent updates cannot overwrite
561
+ * them. App state never goes into a surface's data model. Selectors read it
562
+ * with `getState()`.
563
+ */
564
+ declare class GenerativeUISurfaceManager {
565
+ private readonly ui;
566
+ private readonly options;
567
+ private readonly surfaces;
568
+ private readonly bookkeeping;
569
+ private readonly listeners;
570
+ /** Mounts of each target id, in mount order. */
571
+ private readonly targets;
572
+ private state;
573
+ /**
574
+ * User-owned data model values, by surface key, then by path. Kept when a
575
+ * surface is rebuilt. Cleared when the surface is deleted.
576
+ */
577
+ private readonly owned;
578
+ /**
579
+ * Keys of the surfaces that a `deleteSurface` removed. A surface id is
580
+ * unique for the life of the page, so a key stays here when its surface is
581
+ * built again.
582
+ */
583
+ private readonly deletedKeys;
584
+ /**
585
+ * Surfaces that share their data model, by surface key: the parts of a
586
+ * chat surface that the prose lift split. A user write to one part goes
587
+ * to every part, so an input in one part drives a binding in another.
588
+ */
589
+ private readonly linked;
590
+ private readonly webCoreCatalog;
591
+ private activeThreadId;
592
+ private version;
593
+ constructor(ui: GenerativeUI, options?: GenerativeUISurfaceManagerOptions);
594
+ subscribe: (listener: () => void) => (() => void);
595
+ getVersion: () => number;
596
+ private notify;
597
+ setActiveThread(threadId: string | undefined): void;
598
+ getActiveThread(): string | undefined;
599
+ ingest(threadId: string, agentId: string | undefined, content: GenerativeUISurfaceContent): void;
600
+ /** The surface of a `key` (see `surfaceKey`), unless it is deleted. */
601
+ getSurfaceByKey(key: string): ManagedSurface | undefined;
602
+ getSurface(threadId: string, surfaceId: string): ManagedSurface | undefined;
603
+ getSurfaceForTarget(target: string, threadId?: string | undefined): ManagedSurface | undefined;
604
+ /**
605
+ * A surface whose first createSurface was rejected, so the chat can show
606
+ * the error where the surface would be. `undefined` for any other surface.
607
+ */
608
+ getFailedSurface(threadId: string, surfaceId: string): ManagedSurface | undefined;
609
+ /**
610
+ * The surfaces of a thread, for the model. A surface with user-owned
611
+ * values lists them in `dataModel`, so the model can read what the user
612
+ * entered. A surface with dropped operations lists them in `rejected`, so
613
+ * the model can fix them on the next run. A deleted surface, or one that
614
+ * was never created, has a `status`, so the model knows that the id is
615
+ * not a live surface.
616
+ */
617
+ describeSurfaces(threadId: string): Record<string, GenerativeUISurfaceSummary>;
618
+ /** Every surface that is not deleted, oldest first, for the inspector. */
619
+ debugSurfaces(): {
620
+ surfaceId: string;
621
+ threadId: string;
622
+ agentId: string | undefined;
623
+ target: string;
624
+ status: GenerativeUISurfaceStatus;
625
+ operations: readonly A2UIOperation[];
626
+ dataModel: any;
627
+ userValues: {
628
+ [k: string]: unknown;
629
+ };
630
+ rejected: ({
631
+ source: "runtime";
632
+ index: number;
633
+ reason: string;
634
+ } | {
635
+ source: "browser";
636
+ index: number;
637
+ reason: string;
638
+ })[];
639
+ }[];
640
+ /**
641
+ * Marks a target as mounted. Returns the function that unmounts it. Calling
642
+ * that function more than once has no effect.
643
+ *
644
+ * @param id - The target id.
645
+ * @param options - The description and the allowed components of this mount.
646
+ */
647
+ registerTarget(id: string, options?: GenerativeUITargetOptions): () => void;
648
+ /**
649
+ * The mounted targets. Each has the description and the component list of
650
+ * its earliest mount that has one.
651
+ */
652
+ getMountedTargets(): GenerativeUIMountedTarget[];
653
+ /**
654
+ * The component list of the earliest mount of `id` that has one.
655
+ * `undefined` when no mount of `id` limits its components.
656
+ */
657
+ private targetComponents;
658
+ /** The components that `validateOperation` allows on a surface. */
659
+ private allowedComponentsFor;
660
+ /**
661
+ * The app state object. It is the same object until a key changes, so it
662
+ * can be a `useSyncExternalStore` snapshot.
663
+ */
664
+ getState: () => Readonly<Record<string, unknown>>;
665
+ /** Sets one state key. Notifies only when the value changed. */
666
+ setState(key: string, value: unknown): void;
667
+ /** Removes one state key. Notifies only when the key was set. */
668
+ removeState(key: string): void;
669
+ /**
670
+ * Makes the surfaces of `surfaceIds` share their data model: a user write
671
+ * to one of them goes to all of them (see `setOwnedValue`). The markdown
672
+ * transport links the parts of a chat surface that the prose lift split.
673
+ * A later call for one of the surfaces replaces its group.
674
+ *
675
+ * @param threadId - The thread of the surfaces.
676
+ * @param surfaceIds - The surface ids of the group. One id clears a link.
677
+ */
678
+ linkSurfaces(threadId: string, surfaceIds: readonly string[]): void;
679
+ /**
680
+ * Writes a user value into the data model of a surface, and marks `path`
681
+ * as user-owned. Then agent writes to that path, or below it, are ignored.
682
+ * An agent write above it keeps the user value. Ownership ends when the
683
+ * surface is deleted. Does nothing for an unknown or deleted surface. The
684
+ * surfaces linked to it (see `linkSurfaces`) get the same write.
685
+ *
686
+ * @param key - The `key` of the surface.
687
+ * @param path - An absolute JSON pointer, for example "/form/email".
688
+ * @param value - The new value. It is copied.
689
+ * @throws Error when a path segment is "__proto__", "constructor" or
690
+ * "prototype", or when the path does not fit the data (for example, a
691
+ * segment above it holds a string).
692
+ */
693
+ setOwnedValue(key: string, path: string, value: unknown): void;
694
+ private writeOwnedValue;
695
+ /**
696
+ * Writes the user-owned values into the new, empty data model of a rebuilt
697
+ * surface. The agent operations are applied after it.
698
+ */
699
+ private restoreOwnedValues;
700
+ /**
701
+ * The value that an agent write puts at `path`, with the user-owned values
702
+ * below `path` written back into it. `undefined` when `path` is user-owned
703
+ * or below a user-owned path, so the agent cannot write it. Throws when a
704
+ * user value does not fit the new value.
705
+ */
706
+ private mergeOwnedValues;
707
+ private extendsApplied;
708
+ private createSurface;
709
+ private disposeSurface;
710
+ /**
711
+ * Marks a surface deleted and frees its components and data. The record
712
+ * stays, so the model is still told about the id and the bookkeeping does
713
+ * not rebuild the surface for content that was already applied.
714
+ */
715
+ private closeSurface;
716
+ /** The surfaces of a thread that a part of `surfaceId` reads, for tests. */
717
+ getLinkedSurfaceIds(threadId: string, surfaceId: string): string[];
718
+ /**
719
+ * Drops the node keys that the app sets: bound props and matched events.
720
+ * The model does not see them, so a model value for one is ignored, not
721
+ * rejected. This runs before validation, because validation rejects keys
722
+ * that are not in the manifest. It never changes the given operation.
723
+ */
724
+ private dropAppSetKeys;
725
+ private dropAppSetNodeKeys;
726
+ /**
727
+ * The surfaces that `validateOperation` gets for one operation of the
728
+ * content of `surface`.
729
+ *
730
+ * - `knownSurfaces`: the surface, when it exists before the operation. It
731
+ * does not exist before its first createSurface, or after a delete.
732
+ * - `createdSurfaces`: the surface, when a createSurface at this position
733
+ * uses its id again. That is the case after the first operation, and for
734
+ * a surface that was deleted before, unless the content replays that
735
+ * delete.
736
+ */
737
+ private surfacesFor;
738
+ private applyOperation;
739
+ /** The first node with props of the wrong type, as a reason. */
740
+ private nodesProblem;
741
+ /**
742
+ * Writes an agent value at `path` and keeps the user-owned values. A write
743
+ * to a user-owned path is ignored, not rejected. Gives the reason when the
744
+ * value does not fit the data, else `undefined`.
745
+ */
746
+ private writeAgentData;
747
+ private checkNodeProps;
748
+ private upsertNode;
749
+ }
750
+ //#endregion
751
+ //#region src/generative-ui/standard/tokens.d.ts
752
+ declare const RADII: readonly ["2xs", "xs", "sm", "md", "lg", "xl", "2xl", "3xl", "4xl", "full"];
753
+ declare const TEXT_COLORS: readonly ["default", "prose", "primary", "emphasis", "secondary", "tertiary", "success", "info", "warning", "caution", "danger", "discovery"];
754
+ declare const BORDER_COLORS: readonly ["default", "subtle", "strong", "info", "warning", "caution", "success", "danger", "discovery"];
755
+ declare const BACKGROUNDS: readonly ["surface", "surface-secondary", "surface-tertiary", "surface-elevated", "surface-elevated-secondary", "surface-inverted", "surface-soft", "info", "warning", "caution", "success", "danger", "discovery", "info-solid", "warning-solid", "caution-solid", "success-solid", "danger-solid", "discovery-solid"];
756
+ //#endregion
757
+ //#region src/generative-ui/theme.d.ts
758
+ type TextColor = (typeof TEXT_COLORS)[number];
759
+ type BorderColor = (typeof BORDER_COLORS)[number];
760
+ type Background = (typeof BACKGROUNDS)[number];
761
+ type Radius = Exclude<(typeof RADII)[number], "full">;
762
+ type Tint = "info" | "warning" | "caution" | "success" | "danger" | "discovery";
763
+ type ChartSeries = 1 | 2 | 3 | 4 | 5 | 6;
764
+ /** Every CSS variable that the standard components read. */
765
+ type GenerativeUIThemeVariable = `--a2ui-color-text-${TextColor}` | `--a2ui-color-${Background}` | `--a2ui-color-border-${BorderColor}` | `--a2ui-color-${Tint}-soft` | `--a2ui-radius-${Radius}` | `--a2ui-chart-${ChartSeries}` | "--a2ui-color-accent" | "--a2ui-color-on-accent" | "--a2ui-color-panel" | "--a2ui-color-control" | "--a2ui-color-focus" | "--a2ui-color-shimmer" | "--a2ui-color-chart-cursor" | "--a2ui-color-slider-track" | "--a2ui-color-badge-secondary" | "--a2ui-color-border-control" | "--a2ui-color-highlight-green" | "--a2ui-color-highlight-orange" | "--a2ui-color-highlight-pink" | "--a2ui-color-backdrop" | "--a2ui-color-overlay" | "--a2ui-color-rating" | "--a2ui-shadow-xs" | "--a2ui-shadow-sm" | "--a2ui-shadow-soft" | "--a2ui-shadow-md" | "--a2ui-font-family" | "--a2ui-heading-margin" | "--a2ui-block-margin";
766
+ /** Values for the theme variables. A name that is not one is a type error. */
767
+ type GenerativeUIThemeVariables = { [Variable in GenerativeUIThemeVariable]?: string };
768
+ /** The values of one color scheme, plus the map style of that scheme. */
769
+ type GenerativeUIThemeValues = GenerativeUIThemeVariables & {
770
+ /** A MapLibre style URL for the Map component. */mapStyle?: string;
771
+ };
772
+ /**
773
+ * The look of generated UI. Values at the top level apply in light and in
774
+ * dark mode. Values in `dark` replace them in dark mode. Dark mode is on
775
+ * when an ancestor of the surface has the `dark` class, like the CopilotKit
776
+ * chat.
777
+ *
778
+ * @example
779
+ * ```ts
780
+ * const theme: GenerativeUITheme = {
781
+ * "--a2ui-color-accent": "#d97706",
782
+ * "--a2ui-font-family": "Inter, sans-serif",
783
+ * dark: { "--a2ui-color-panel": "#1f2937" },
784
+ * };
785
+ * ```
786
+ */
787
+ type GenerativeUITheme = GenerativeUIThemeValues & {
788
+ dark?: GenerativeUIThemeValues;
789
+ };
790
+ //#endregion
791
+ //#region src/generative-ui/runtime-context.d.ts
792
+ interface GenerativeUIErrorBoundaryConfig {
793
+ /** Replaces the default per-component fallback. */
794
+ fallback?: (props: {
795
+ error: Error;
796
+ retry: () => void;
797
+ surfaceId: string;
798
+ componentId: string;
799
+ }) => ReactNode;
800
+ /** Called for render, props, operation, function and event failures. */
801
+ onError?: (info: GenerativeUIErrorInfo) => void;
802
+ }
803
+ interface GenerativeUIBaseConfig {
804
+ /**
805
+ * The result of `createGenerativeUI`: the components the model can render,
806
+ * the app state they read and the functions they call.
807
+ */
808
+ ui: GenerativeUI;
809
+ /**
810
+ * The agents that get the generative UI. When omitted, every agent gets
811
+ * it. Other agents get no envelope.
812
+ */
813
+ agentIds?: string[];
814
+ /**
815
+ * Values for the `--a2ui-*` CSS variables and the map style. Top-level
816
+ * values apply in both modes. `dark` changes them in dark mode, which is
817
+ * on under a `.dark` class, like the CopilotKit chat.
818
+ */
819
+ theme?: GenerativeUITheme;
820
+ /** Fallback UI and error reporting for generated UI. */
821
+ errorBoundary?: GenerativeUIErrorBoundaryConfig;
822
+ }
823
+ /**
824
+ * The tool transport: the model calls the `render_ui` tool, and the runtime
825
+ * validates each operation before it streams it to the client.
826
+ */
827
+ interface GenerativeUIToolConfig extends GenerativeUIBaseConfig {
828
+ /** Leave it out, or set "tool". */
829
+ transport?: "tool";
830
+ sendContext?: never;
831
+ includeCatalog?: never;
832
+ }
833
+ /**
834
+ * The markdown transport: the model writes the operations in ```a2ui fences
835
+ * in its reply. The client reads and validates them.
836
+ */
837
+ interface GenerativeUIMarkdownConfig extends GenerativeUIBaseConfig {
838
+ transport: "markdown";
839
+ /**
840
+ * Send the component schema and the fence guideline as context entries.
841
+ * Set `false` when the backend builds its own prompt from the envelope.
842
+ * Default `true`.
843
+ */
844
+ sendContext?: boolean;
845
+ /**
846
+ * Send the component schemas in the envelope (`catalog.components`).
847
+ * Default `true`.
848
+ */
849
+ includeCatalog?: boolean;
850
+ }
851
+ /**
852
+ * Experimental. The `generativeUI` prop of `CopilotKitProvider`. Set
853
+ * `transport: "markdown"` to get the markdown options.
854
+ *
855
+ * @example
856
+ * ```tsx
857
+ * <CopilotKitProvider generativeUI={{ ui }} />
858
+ * <CopilotKitProvider generativeUI={{ ui, transport: "markdown", sendContext: false }} />
859
+ * ```
860
+ */
861
+ type GenerativeUIConfig = GenerativeUIToolConfig | GenerativeUIMarkdownConfig;
862
+ interface GenerativeUIRuntime {
863
+ manager: GenerativeUISurfaceManager;
864
+ dispatcher: GenerativeUIDispatcher;
865
+ /** The generative UI given to the provider as `generativeUI={{ ui }}`. */
866
+ ui: GenerativeUI;
867
+ /** How the model sends operations. "tool" when the config leaves it out. */
868
+ transport: "tool" | "markdown";
869
+ /** The latest `generativeUI` config of the provider. */
870
+ readonly config: GenerativeUIConfig;
871
+ /** The latest `theme`. Each surface root sets its CSS variables. */
872
+ theme?: GenerativeUITheme;
873
+ forwardEvent: (event: GenerativeUIUserEvent, agentId: string | undefined) => Promise<GenerativeUIInvokeResult>;
874
+ reportError: (info: GenerativeUIErrorInfo) => void;
875
+ readonly errorFallback?: GenerativeUIErrorBoundaryConfig["fallback"];
876
+ }
877
+ declare function useGenerativeUIRuntime(): GenerativeUIRuntime | null;
878
+ //#endregion
879
+ //#region src/types/react-activity-message-renderer.d.ts
880
+ interface ReactActivityMessageRenderer<TActivityContent> {
881
+ /**
882
+ * Activity type to match when rendering. Use "*" as a wildcard renderer.
883
+ */
884
+ activityType: string;
885
+ /**
886
+ * Optional agent ID to scope the renderer to a particular agent.
887
+ */
888
+ agentId?: string;
889
+ /**
890
+ * Schema describing the activity content payload.
891
+ */
892
+ content: StandardSchemaV1<any, TActivityContent>;
893
+ /**
894
+ * React component invoked to render the activity message.
895
+ */
896
+ render: React.ComponentType<{
897
+ activityType: string;
898
+ content: TActivityContent;
899
+ message: ActivityMessage;
900
+ agent: AbstractAgent | undefined;
901
+ }>;
902
+ }
903
+ //#endregion
904
+ //#region src/generative-ui/chat.d.ts
905
+ interface GenerativeUIChatSurfaceProps {
906
+ surfaceId: string;
907
+ isStreaming: boolean;
908
+ /**
909
+ * Set when operations from the latest render_ui call were rejected. The
910
+ * message is user-facing; `error.cause` holds the same list as `rejected`.
911
+ */
912
+ error?: Error;
913
+ /** Rejected operations from the latest render_ui call, with validator reasons. */
914
+ rejected: GenerativeUIRejectedOperation[];
915
+ children: ReactNode;
916
+ }
917
+ declare function DefaultGenerativeUIChatCard({
918
+ surfaceId,
919
+ isStreaming,
920
+ error,
921
+ children
922
+ }: GenerativeUIChatSurfaceProps): react_jsx_runtime0.JSX.Element;
923
+ //#endregion
924
+ //#region src/providers/MarkdownRendererContext.d.ts
925
+ /** Props every markdown renderer (built-in or plugged-in) receives. */
926
+ interface MarkdownRendererProps {
927
+ /** Raw, possibly-partial (streaming) markdown string. */
928
+ content: string;
929
+ /** Hint that the message is still streaming, for cursor/affordance use. */
930
+ isStreaming?: boolean;
931
+ className?: string;
932
+ }
933
+ /**
934
+ * Config for the built-in default renderer. Pass this (instead of a component)
935
+ * as `markdownRenderer` to configure the built-in renderer without writing a
936
+ * wrapper — e.g. `markdownRenderer={{ nodeRenderers: { codeBlock: Shiki } }}`.
937
+ */
938
+ type DefaultMarkdownRendererProps = Pick<StreamingMarkdownRendererProps, "nodeRenderers" | "caret" | "options" | "className" | "onLinkClick" | "onCitationClick">;
939
+ /** A markdown renderer: a component, OR config for the built-in default. */
940
+ type MarkdownRenderer = React$1.ComponentType<MarkdownRendererProps> | DefaultMarkdownRendererProps;
941
+ declare const MarkdownRendererProvider: React$1.FC<{
942
+ renderer?: MarkdownRenderer;
943
+ children: React$1.ReactNode;
944
+ }>;
945
+ /**
946
+ * The markdown renderer set at the provider level, or `undefined` when none was
947
+ * supplied. Message components fall back to the built-in
948
+ * `StreamingMarkdownDefaultRenderer` (via `CopilotChatAssistantMessage.MarkdownRenderer`)
949
+ * when this is `undefined`.
950
+ */
951
+ declare function useMarkdownRenderer(): MarkdownRenderer | undefined;
952
+ //#endregion
953
+ export { GenerativeUIFunctionInput as A, GenerativeUIInvokeResult as B, GenerativeUIComponentDefinition as C, GenerativeUIEventDefinition as D, GenerativeUIDefinitionsOf as E, SchemaInput as F, GenerativeUIError as I, GenerativeUIErrorCode as L, GenerativeUISlotKind as M, GenerativeUIStateOf as N, GenerativeUIFunctionArgs as O, createGenerativeUI as P, GenerativeUIErrorInfo as R, GenerativeUI as S, GenerativeUIComponentProps as T, GenerativeUIThemeVariables as _, useMarkdownRenderer as a, useGenerativeUIAccessibility as b, ReactActivityMessageRenderer as c, GenerativeUIMarkdownConfig as d, GenerativeUIToolConfig as f, GenerativeUIThemeVariable as g, GenerativeUIThemeValues as h, MarkdownRendererProvider as i, GenerativeUIFunctionName as j, GenerativeUIFunctionDefinition as k, GenerativeUIConfig as l, GenerativeUITheme as m, MarkdownRenderer as n, DefaultGenerativeUIChatCard as o, useGenerativeUIRuntime as p, MarkdownRendererProps as r, GenerativeUIChatSurfaceProps as s, DefaultMarkdownRendererProps as t, GenerativeUIErrorBoundaryConfig as u, GenerativeUIAccessibility as v, GenerativeUIComponentName as w, CreateGenerativeUIConfig as x, GenerativeUIAriaAttributes as y, GenerativeUIEventHandler as z };
954
+ //# sourceMappingURL=MarkdownRendererContext-CRKFzsEB.d.mts.map