@copilotkitnext/react 0.0.22-alpha.4 → 0.0.22-alpha.5

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 (397) hide show
  1. package/dist/index.d.mts +635 -46
  2. package/dist/index.d.ts +635 -46
  3. package/dist/index.js +325 -22
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +4286 -109
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +4 -4
  8. package/dist/chunk-32YJ5VJ4.mjs +0 -157
  9. package/dist/chunk-32YJ5VJ4.mjs.map +0 -1
  10. package/dist/chunk-36HFWACS.mjs +0 -1
  11. package/dist/chunk-36HFWACS.mjs.map +0 -1
  12. package/dist/chunk-46BZRXWT.mjs +0 -16
  13. package/dist/chunk-46BZRXWT.mjs.map +0 -1
  14. package/dist/chunk-4UDBR75C.mjs +0 -106
  15. package/dist/chunk-4UDBR75C.mjs.map +0 -1
  16. package/dist/chunk-4XJK5IVQ.mjs +0 -83
  17. package/dist/chunk-4XJK5IVQ.mjs.map +0 -1
  18. package/dist/chunk-5JNWVLQI.mjs +0 -72
  19. package/dist/chunk-5JNWVLQI.mjs.map +0 -1
  20. package/dist/chunk-5SC3CO5Q.mjs +0 -69
  21. package/dist/chunk-5SC3CO5Q.mjs.map +0 -1
  22. package/dist/chunk-6VUKDHOD.mjs +0 -1
  23. package/dist/chunk-6VUKDHOD.mjs.map +0 -1
  24. package/dist/chunk-7HM7CU5A.mjs +0 -122
  25. package/dist/chunk-7HM7CU5A.mjs.map +0 -1
  26. package/dist/chunk-AEFM73CL.mjs +0 -32
  27. package/dist/chunk-AEFM73CL.mjs.map +0 -1
  28. package/dist/chunk-AI3Z3CHN.mjs +0 -97
  29. package/dist/chunk-AI3Z3CHN.mjs.map +0 -1
  30. package/dist/chunk-AXFRCGH6.mjs +0 -107
  31. package/dist/chunk-AXFRCGH6.mjs.map +0 -1
  32. package/dist/chunk-BNT754Z2.mjs +0 -185
  33. package/dist/chunk-BNT754Z2.mjs.map +0 -1
  34. package/dist/chunk-BT6C5OPU.mjs +0 -278
  35. package/dist/chunk-BT6C5OPU.mjs.map +0 -1
  36. package/dist/chunk-CDSO65ZY.mjs +0 -157
  37. package/dist/chunk-CDSO65ZY.mjs.map +0 -1
  38. package/dist/chunk-CGLGXQAU.mjs +0 -78
  39. package/dist/chunk-CGLGXQAU.mjs.map +0 -1
  40. package/dist/chunk-DVUQO72Z.mjs +0 -1
  41. package/dist/chunk-DVUQO72Z.mjs.map +0 -1
  42. package/dist/chunk-E56GYBP3.mjs +0 -101
  43. package/dist/chunk-E56GYBP3.mjs.map +0 -1
  44. package/dist/chunk-ETWJDCGE.mjs +0 -1
  45. package/dist/chunk-ETWJDCGE.mjs.map +0 -1
  46. package/dist/chunk-FIBK3DYE.mjs +0 -26
  47. package/dist/chunk-FIBK3DYE.mjs.map +0 -1
  48. package/dist/chunk-FVURPXQK.mjs +0 -45
  49. package/dist/chunk-FVURPXQK.mjs.map +0 -1
  50. package/dist/chunk-FZR2XQKR.mjs +0 -44
  51. package/dist/chunk-FZR2XQKR.mjs.map +0 -1
  52. package/dist/chunk-GK4NXPLC.mjs +0 -60
  53. package/dist/chunk-GK4NXPLC.mjs.map +0 -1
  54. package/dist/chunk-IA4CLXDM.mjs +0 -76
  55. package/dist/chunk-IA4CLXDM.mjs.map +0 -1
  56. package/dist/chunk-IICUCI5S.mjs +0 -43
  57. package/dist/chunk-IICUCI5S.mjs.map +0 -1
  58. package/dist/chunk-JLVGSNAO.mjs +0 -311
  59. package/dist/chunk-JLVGSNAO.mjs.map +0 -1
  60. package/dist/chunk-JWOIINVV.mjs +0 -237
  61. package/dist/chunk-JWOIINVV.mjs.map +0 -1
  62. package/dist/chunk-KCVDFZJX.mjs +0 -873
  63. package/dist/chunk-KCVDFZJX.mjs.map +0 -1
  64. package/dist/chunk-KPRUSQ3K.mjs +0 -1
  65. package/dist/chunk-KPRUSQ3K.mjs.map +0 -1
  66. package/dist/chunk-MWC5OV7Z.mjs +0 -1
  67. package/dist/chunk-MWC5OV7Z.mjs.map +0 -1
  68. package/dist/chunk-N5EP5OD5.mjs +0 -1
  69. package/dist/chunk-N5EP5OD5.mjs.map +0 -1
  70. package/dist/chunk-N5HC66HU.mjs +0 -311
  71. package/dist/chunk-N5HC66HU.mjs.map +0 -1
  72. package/dist/chunk-NB2GZAKG.mjs +0 -131
  73. package/dist/chunk-NB2GZAKG.mjs.map +0 -1
  74. package/dist/chunk-NB4DFAZH.mjs +0 -185
  75. package/dist/chunk-NB4DFAZH.mjs.map +0 -1
  76. package/dist/chunk-NNAYEAP2.mjs +0 -49
  77. package/dist/chunk-NNAYEAP2.mjs.map +0 -1
  78. package/dist/chunk-NNPKBGD6.mjs +0 -37
  79. package/dist/chunk-NNPKBGD6.mjs.map +0 -1
  80. package/dist/chunk-OMPVTGXH.mjs +0 -122
  81. package/dist/chunk-OMPVTGXH.mjs.map +0 -1
  82. package/dist/chunk-R5OLAA3L.mjs +0 -135
  83. package/dist/chunk-R5OLAA3L.mjs.map +0 -1
  84. package/dist/chunk-RF2CGPHQ.mjs +0 -215
  85. package/dist/chunk-RF2CGPHQ.mjs.map +0 -1
  86. package/dist/chunk-RGD2L3Z4.mjs +0 -96
  87. package/dist/chunk-RGD2L3Z4.mjs.map +0 -1
  88. package/dist/chunk-RK5P2LG6.mjs +0 -57
  89. package/dist/chunk-RK5P2LG6.mjs.map +0 -1
  90. package/dist/chunk-RRXDJCXI.mjs +0 -60
  91. package/dist/chunk-RRXDJCXI.mjs.map +0 -1
  92. package/dist/chunk-SPDE34WC.mjs +0 -283
  93. package/dist/chunk-SPDE34WC.mjs.map +0 -1
  94. package/dist/chunk-TAUOEJH2.mjs +0 -120
  95. package/dist/chunk-TAUOEJH2.mjs.map +0 -1
  96. package/dist/chunk-TBE7ZI5G.mjs +0 -45
  97. package/dist/chunk-TBE7ZI5G.mjs.map +0 -1
  98. package/dist/chunk-UOX5D73C.mjs +0 -22
  99. package/dist/chunk-UOX5D73C.mjs.map +0 -1
  100. package/dist/chunk-US4KNAAV.mjs +0 -1
  101. package/dist/chunk-US4KNAAV.mjs.map +0 -1
  102. package/dist/chunk-UZB3CTOY.mjs +0 -873
  103. package/dist/chunk-UZB3CTOY.mjs.map +0 -1
  104. package/dist/chunk-VBI6JXPC.mjs +0 -1
  105. package/dist/chunk-VBI6JXPC.mjs.map +0 -1
  106. package/dist/chunk-VVAXSF3M.mjs +0 -61
  107. package/dist/chunk-VVAXSF3M.mjs.map +0 -1
  108. package/dist/chunk-XO4IRKSC.mjs +0 -11
  109. package/dist/chunk-XO4IRKSC.mjs.map +0 -1
  110. package/dist/chunk-XU5CEPYQ.mjs +0 -75
  111. package/dist/chunk-XU5CEPYQ.mjs.map +0 -1
  112. package/dist/chunk-YPH4BHOY.mjs +0 -39
  113. package/dist/chunk-YPH4BHOY.mjs.map +0 -1
  114. package/dist/chunk-YZUPVMHC.mjs +0 -1
  115. package/dist/chunk-YZUPVMHC.mjs.map +0 -1
  116. package/dist/components/CopilotKitInspector.d.mts +0 -13
  117. package/dist/components/CopilotKitInspector.d.ts +0 -13
  118. package/dist/components/CopilotKitInspector.js +0 -69
  119. package/dist/components/CopilotKitInspector.js.map +0 -1
  120. package/dist/components/CopilotKitInspector.mjs +0 -7
  121. package/dist/components/CopilotKitInspector.mjs.map +0 -1
  122. package/dist/components/WildcardToolCallRender.d.mts +0 -7
  123. package/dist/components/WildcardToolCallRender.d.ts +0 -7
  124. package/dist/components/WildcardToolCallRender.js +0 -106
  125. package/dist/components/WildcardToolCallRender.js.map +0 -1
  126. package/dist/components/WildcardToolCallRender.mjs +0 -8
  127. package/dist/components/WildcardToolCallRender.mjs.map +0 -1
  128. package/dist/components/chat/CopilotChat.d.mts +0 -30
  129. package/dist/components/chat/CopilotChat.d.ts +0 -30
  130. package/dist/components/chat/CopilotChat.js +0 -2934
  131. package/dist/components/chat/CopilotChat.js.map +0 -1
  132. package/dist/components/chat/CopilotChat.mjs +0 -37
  133. package/dist/components/chat/CopilotChat.mjs.map +0 -1
  134. package/dist/components/chat/CopilotChatAssistantMessage.d.mts +0 -45
  135. package/dist/components/chat/CopilotChatAssistantMessage.d.ts +0 -45
  136. package/dist/components/chat/CopilotChatAssistantMessage.js +0 -735
  137. package/dist/components/chat/CopilotChatAssistantMessage.js.map +0 -1
  138. package/dist/components/chat/CopilotChatAssistantMessage.mjs +0 -29
  139. package/dist/components/chat/CopilotChatAssistantMessage.mjs.map +0 -1
  140. package/dist/components/chat/CopilotChatAudioRecorder.d.mts +0 -11
  141. package/dist/components/chat/CopilotChatAudioRecorder.d.ts +0 -11
  142. package/dist/components/chat/CopilotChatAudioRecorder.js +0 -131
  143. package/dist/components/chat/CopilotChatAudioRecorder.js.map +0 -1
  144. package/dist/components/chat/CopilotChatAudioRecorder.mjs +0 -9
  145. package/dist/components/chat/CopilotChatAudioRecorder.mjs.map +0 -1
  146. package/dist/components/chat/CopilotChatInput.d.mts +0 -67
  147. package/dist/components/chat/CopilotChatInput.d.ts +0 -67
  148. package/dist/components/chat/CopilotChatInput.js +0 -1305
  149. package/dist/components/chat/CopilotChatInput.js.map +0 -1
  150. package/dist/components/chat/CopilotChatInput.mjs +0 -16
  151. package/dist/components/chat/CopilotChatInput.mjs.map +0 -1
  152. package/dist/components/chat/CopilotChatMessageView.d.mts +0 -29
  153. package/dist/components/chat/CopilotChatMessageView.d.ts +0 -29
  154. package/dist/components/chat/CopilotChatMessageView.js +0 -1164
  155. package/dist/components/chat/CopilotChatMessageView.js.map +0 -1
  156. package/dist/components/chat/CopilotChatMessageView.mjs +0 -31
  157. package/dist/components/chat/CopilotChatMessageView.mjs.map +0 -1
  158. package/dist/components/chat/CopilotChatSuggestionPill.d.mts +0 -11
  159. package/dist/components/chat/CopilotChatSuggestionPill.d.ts +0 -11
  160. package/dist/components/chat/CopilotChatSuggestionPill.js +0 -76
  161. package/dist/components/chat/CopilotChatSuggestionPill.js.map +0 -1
  162. package/dist/components/chat/CopilotChatSuggestionPill.mjs +0 -10
  163. package/dist/components/chat/CopilotChatSuggestionPill.mjs.map +0 -1
  164. package/dist/components/chat/CopilotChatSuggestionView.d.mts +0 -33
  165. package/dist/components/chat/CopilotChatSuggestionView.d.ts +0 -33
  166. package/dist/components/chat/CopilotChatSuggestionView.js +0 -179
  167. package/dist/components/chat/CopilotChatSuggestionView.js.map +0 -1
  168. package/dist/components/chat/CopilotChatSuggestionView.mjs +0 -12
  169. package/dist/components/chat/CopilotChatSuggestionView.mjs.map +0 -1
  170. package/dist/components/chat/CopilotChatToggleButton.d.mts +0 -14
  171. package/dist/components/chat/CopilotChatToggleButton.d.ts +0 -14
  172. package/dist/components/chat/CopilotChatToggleButton.js +0 -222
  173. package/dist/components/chat/CopilotChatToggleButton.js.map +0 -1
  174. package/dist/components/chat/CopilotChatToggleButton.mjs +0 -16
  175. package/dist/components/chat/CopilotChatToggleButton.mjs.map +0 -1
  176. package/dist/components/chat/CopilotChatToolCallsView.d.mts +0 -10
  177. package/dist/components/chat/CopilotChatToolCallsView.d.ts +0 -10
  178. package/dist/components/chat/CopilotChatToolCallsView.js +0 -264
  179. package/dist/components/chat/CopilotChatToolCallsView.js.map +0 -1
  180. package/dist/components/chat/CopilotChatToolCallsView.mjs +0 -24
  181. package/dist/components/chat/CopilotChatToolCallsView.mjs.map +0 -1
  182. package/dist/components/chat/CopilotChatUserMessage.d.mts +0 -52
  183. package/dist/components/chat/CopilotChatUserMessage.d.ts +0 -52
  184. package/dist/components/chat/CopilotChatUserMessage.js +0 -523
  185. package/dist/components/chat/CopilotChatUserMessage.js.map +0 -1
  186. package/dist/components/chat/CopilotChatUserMessage.mjs +0 -14
  187. package/dist/components/chat/CopilotChatUserMessage.mjs.map +0 -1
  188. package/dist/components/chat/CopilotChatView.d.mts +0 -54
  189. package/dist/components/chat/CopilotChatView.d.ts +0 -54
  190. package/dist/components/chat/CopilotChatView.js +0 -2640
  191. package/dist/components/chat/CopilotChatView.js.map +0 -1
  192. package/dist/components/chat/CopilotChatView.mjs +0 -38
  193. package/dist/components/chat/CopilotChatView.mjs.map +0 -1
  194. package/dist/components/chat/CopilotModalHeader.d.mts +0 -22
  195. package/dist/components/chat/CopilotModalHeader.d.ts +0 -22
  196. package/dist/components/chat/CopilotModalHeader.js +0 -186
  197. package/dist/components/chat/CopilotModalHeader.js.map +0 -1
  198. package/dist/components/chat/CopilotModalHeader.mjs +0 -12
  199. package/dist/components/chat/CopilotModalHeader.mjs.map +0 -1
  200. package/dist/components/chat/CopilotPopup.d.mts +0 -33
  201. package/dist/components/chat/CopilotPopup.d.ts +0 -33
  202. package/dist/components/chat/CopilotPopup.js +0 -3343
  203. package/dist/components/chat/CopilotPopup.js.map +0 -1
  204. package/dist/components/chat/CopilotPopup.mjs +0 -43
  205. package/dist/components/chat/CopilotPopup.mjs.map +0 -1
  206. package/dist/components/chat/CopilotPopupView.d.mts +0 -30
  207. package/dist/components/chat/CopilotPopupView.d.ts +0 -30
  208. package/dist/components/chat/CopilotPopupView.js +0 -3003
  209. package/dist/components/chat/CopilotPopupView.js.map +0 -1
  210. package/dist/components/chat/CopilotPopupView.mjs +0 -41
  211. package/dist/components/chat/CopilotPopupView.mjs.map +0 -1
  212. package/dist/components/chat/CopilotSidebar.d.mts +0 -31
  213. package/dist/components/chat/CopilotSidebar.d.ts +0 -31
  214. package/dist/components/chat/CopilotSidebar.js +0 -3266
  215. package/dist/components/chat/CopilotSidebar.js.map +0 -1
  216. package/dist/components/chat/CopilotSidebar.mjs +0 -43
  217. package/dist/components/chat/CopilotSidebar.mjs.map +0 -1
  218. package/dist/components/chat/CopilotSidebarView.d.mts +0 -28
  219. package/dist/components/chat/CopilotSidebarView.d.ts +0 -28
  220. package/dist/components/chat/CopilotSidebarView.js +0 -2941
  221. package/dist/components/chat/CopilotSidebarView.js.map +0 -1
  222. package/dist/components/chat/CopilotSidebarView.mjs +0 -41
  223. package/dist/components/chat/CopilotSidebarView.mjs.map +0 -1
  224. package/dist/components/chat/index.d.mts +0 -23
  225. package/dist/components/chat/index.d.ts +0 -23
  226. package/dist/components/chat/index.js +0 -3503
  227. package/dist/components/chat/index.js.map +0 -1
  228. package/dist/components/chat/index.mjs +0 -95
  229. package/dist/components/chat/index.mjs.map +0 -1
  230. package/dist/components/index.d.mts +0 -29
  231. package/dist/components/index.d.ts +0 -29
  232. package/dist/components/index.js +0 -3583
  233. package/dist/components/index.js.map +0 -1
  234. package/dist/components/index.mjs +0 -104
  235. package/dist/components/index.mjs.map +0 -1
  236. package/dist/components/ui/button.d.mts +0 -14
  237. package/dist/components/ui/button.d.ts +0 -14
  238. package/dist/components/ui/button.js +0 -150
  239. package/dist/components/ui/button.js.map +0 -1
  240. package/dist/components/ui/button.mjs +0 -10
  241. package/dist/components/ui/button.mjs.map +0 -1
  242. package/dist/components/ui/dropdown-menu.d.mts +0 -28
  243. package/dist/components/ui/dropdown-menu.d.ts +0 -28
  244. package/dist/components/ui/dropdown-menu.js +0 -291
  245. package/dist/components/ui/dropdown-menu.js.map +0 -1
  246. package/dist/components/ui/dropdown-menu.mjs +0 -37
  247. package/dist/components/ui/dropdown-menu.mjs.map +0 -1
  248. package/dist/components/ui/tooltip.d.mts +0 -10
  249. package/dist/components/ui/tooltip.d.ts +0 -10
  250. package/dist/components/ui/tooltip.js +0 -103
  251. package/dist/components/ui/tooltip.js.map +0 -1
  252. package/dist/components/ui/tooltip.mjs +0 -14
  253. package/dist/components/ui/tooltip.mjs.map +0 -1
  254. package/dist/hooks/index.d.mts +0 -19
  255. package/dist/hooks/index.d.ts +0 -19
  256. package/dist/hooks/index.js +0 -691
  257. package/dist/hooks/index.js.map +0 -1
  258. package/dist/hooks/index.mjs +0 -45
  259. package/dist/hooks/index.mjs.map +0 -1
  260. package/dist/hooks/use-agent-context.d.mts +0 -5
  261. package/dist/hooks/use-agent-context.d.ts +0 -5
  262. package/dist/hooks/use-agent-context.js +0 -116
  263. package/dist/hooks/use-agent-context.js.map +0 -1
  264. package/dist/hooks/use-agent-context.mjs +0 -10
  265. package/dist/hooks/use-agent-context.mjs.map +0 -1
  266. package/dist/hooks/use-agent.d.mts +0 -16
  267. package/dist/hooks/use-agent.d.ts +0 -16
  268. package/dist/hooks/use-agent.js +0 -171
  269. package/dist/hooks/use-agent.js.map +0 -1
  270. package/dist/hooks/use-agent.mjs +0 -12
  271. package/dist/hooks/use-agent.mjs.map +0 -1
  272. package/dist/hooks/use-configure-suggestions.d.mts +0 -13
  273. package/dist/hooks/use-configure-suggestions.d.ts +0 -13
  274. package/dist/hooks/use-configure-suggestions.js +0 -232
  275. package/dist/hooks/use-configure-suggestions.js.map +0 -1
  276. package/dist/hooks/use-configure-suggestions.mjs +0 -11
  277. package/dist/hooks/use-configure-suggestions.mjs.map +0 -1
  278. package/dist/hooks/use-frontend-tool.d.mts +0 -8
  279. package/dist/hooks/use-frontend-tool.d.ts +0 -8
  280. package/dist/hooks/use-frontend-tool.js +0 -137
  281. package/dist/hooks/use-frontend-tool.js.map +0 -1
  282. package/dist/hooks/use-frontend-tool.mjs +0 -10
  283. package/dist/hooks/use-frontend-tool.mjs.map +0 -1
  284. package/dist/hooks/use-human-in-the-loop.d.mts +0 -7
  285. package/dist/hooks/use-human-in-the-loop.d.ts +0 -7
  286. package/dist/hooks/use-human-in-the-loop.js +0 -206
  287. package/dist/hooks/use-human-in-the-loop.js.map +0 -1
  288. package/dist/hooks/use-human-in-the-loop.mjs +0 -11
  289. package/dist/hooks/use-human-in-the-loop.mjs.map +0 -1
  290. package/dist/hooks/use-keyboard-height.d.mts +0 -15
  291. package/dist/hooks/use-keyboard-height.d.ts +0 -15
  292. package/dist/hooks/use-keyboard-height.js +0 -68
  293. package/dist/hooks/use-keyboard-height.js.map +0 -1
  294. package/dist/hooks/use-keyboard-height.mjs +0 -7
  295. package/dist/hooks/use-keyboard-height.mjs.map +0 -1
  296. package/dist/hooks/use-render-activity-message.d.mts +0 -5
  297. package/dist/hooks/use-render-activity-message.d.ts +0 -5
  298. package/dist/hooks/use-render-activity-message.js +0 -158
  299. package/dist/hooks/use-render-activity-message.js.map +0 -1
  300. package/dist/hooks/use-render-activity-message.mjs +0 -12
  301. package/dist/hooks/use-render-activity-message.mjs.map +0 -1
  302. package/dist/hooks/use-render-custom-messages.d.mts +0 -11
  303. package/dist/hooks/use-render-custom-messages.d.ts +0 -11
  304. package/dist/hooks/use-render-custom-messages.js +0 -170
  305. package/dist/hooks/use-render-custom-messages.js.map +0 -1
  306. package/dist/hooks/use-render-custom-messages.mjs +0 -12
  307. package/dist/hooks/use-render-custom-messages.mjs.map +0 -1
  308. package/dist/hooks/use-render-tool-call.d.mts +0 -16
  309. package/dist/hooks/use-render-tool-call.d.ts +0 -16
  310. package/dist/hooks/use-render-tool-call.js +0 -208
  311. package/dist/hooks/use-render-tool-call.js.map +0 -1
  312. package/dist/hooks/use-render-tool-call.mjs +0 -11
  313. package/dist/hooks/use-render-tool-call.mjs.map +0 -1
  314. package/dist/hooks/use-suggestions.d.mts +0 -14
  315. package/dist/hooks/use-suggestions.d.ts +0 -14
  316. package/dist/hooks/use-suggestions.js +0 -176
  317. package/dist/hooks/use-suggestions.js.map +0 -1
  318. package/dist/hooks/use-suggestions.mjs +0 -11
  319. package/dist/hooks/use-suggestions.mjs.map +0 -1
  320. package/dist/lib/react-core.d.mts +0 -33
  321. package/dist/lib/react-core.d.ts +0 -33
  322. package/dist/lib/react-core.js +0 -73
  323. package/dist/lib/react-core.js.map +0 -1
  324. package/dist/lib/react-core.mjs +0 -7
  325. package/dist/lib/react-core.mjs.map +0 -1
  326. package/dist/lib/slots.d.mts +0 -16
  327. package/dist/lib/slots.d.ts +0 -16
  328. package/dist/lib/slots.js +0 -60
  329. package/dist/lib/slots.js.map +0 -1
  330. package/dist/lib/slots.mjs +0 -7
  331. package/dist/lib/slots.mjs.map +0 -1
  332. package/dist/lib/utils.d.mts +0 -5
  333. package/dist/lib/utils.d.ts +0 -5
  334. package/dist/lib/utils.js +0 -35
  335. package/dist/lib/utils.js.map +0 -1
  336. package/dist/lib/utils.mjs +0 -7
  337. package/dist/lib/utils.mjs.map +0 -1
  338. package/dist/providers/CopilotChatConfigurationProvider.d.mts +0 -43
  339. package/dist/providers/CopilotChatConfigurationProvider.d.ts +0 -43
  340. package/dist/providers/CopilotChatConfigurationProvider.js +0 -109
  341. package/dist/providers/CopilotChatConfigurationProvider.js.map +0 -1
  342. package/dist/providers/CopilotChatConfigurationProvider.mjs +0 -11
  343. package/dist/providers/CopilotChatConfigurationProvider.mjs.map +0 -1
  344. package/dist/providers/CopilotKitProvider.d.mts +0 -33
  345. package/dist/providers/CopilotKitProvider.d.ts +0 -33
  346. package/dist/providers/CopilotKitProvider.js +0 -314
  347. package/dist/providers/CopilotKitProvider.js.map +0 -1
  348. package/dist/providers/CopilotKitProvider.mjs +0 -12
  349. package/dist/providers/CopilotKitProvider.mjs.map +0 -1
  350. package/dist/providers/index.d.mts +0 -13
  351. package/dist/providers/index.d.ts +0 -13
  352. package/dist/providers/index.js +0 -396
  353. package/dist/providers/index.js.map +0 -1
  354. package/dist/providers/index.mjs +0 -18
  355. package/dist/providers/index.mjs.map +0 -1
  356. package/dist/types/defineToolCallRenderer.d.mts +0 -41
  357. package/dist/types/defineToolCallRenderer.d.ts +0 -41
  358. package/dist/types/defineToolCallRenderer.js +0 -40
  359. package/dist/types/defineToolCallRenderer.js.map +0 -1
  360. package/dist/types/defineToolCallRenderer.mjs +0 -7
  361. package/dist/types/defineToolCallRenderer.mjs.map +0 -1
  362. package/dist/types/frontend-tool.d.mts +0 -9
  363. package/dist/types/frontend-tool.d.ts +0 -9
  364. package/dist/types/frontend-tool.js +0 -19
  365. package/dist/types/frontend-tool.js.map +0 -1
  366. package/dist/types/frontend-tool.mjs +0 -2
  367. package/dist/types/frontend-tool.mjs.map +0 -1
  368. package/dist/types/human-in-the-loop.d.mts +0 -29
  369. package/dist/types/human-in-the-loop.d.ts +0 -29
  370. package/dist/types/human-in-the-loop.js +0 -19
  371. package/dist/types/human-in-the-loop.js.map +0 -1
  372. package/dist/types/human-in-the-loop.mjs +0 -2
  373. package/dist/types/human-in-the-loop.mjs.map +0 -1
  374. package/dist/types/index.d.mts +0 -11
  375. package/dist/types/index.d.ts +0 -11
  376. package/dist/types/index.js +0 -42
  377. package/dist/types/index.js.map +0 -1
  378. package/dist/types/index.mjs +0 -13
  379. package/dist/types/index.mjs.map +0 -1
  380. package/dist/types/react-activity-message-renderer.d.mts +0 -29
  381. package/dist/types/react-activity-message-renderer.d.ts +0 -29
  382. package/dist/types/react-activity-message-renderer.js +0 -19
  383. package/dist/types/react-activity-message-renderer.js.map +0 -1
  384. package/dist/types/react-activity-message-renderer.mjs +0 -2
  385. package/dist/types/react-activity-message-renderer.mjs.map +0 -1
  386. package/dist/types/react-custom-message-renderer.d.mts +0 -18
  387. package/dist/types/react-custom-message-renderer.d.ts +0 -18
  388. package/dist/types/react-custom-message-renderer.js +0 -19
  389. package/dist/types/react-custom-message-renderer.js.map +0 -1
  390. package/dist/types/react-custom-message-renderer.mjs +0 -2
  391. package/dist/types/react-custom-message-renderer.mjs.map +0 -1
  392. package/dist/types/react-tool-call-renderer.d.mts +0 -30
  393. package/dist/types/react-tool-call-renderer.d.ts +0 -30
  394. package/dist/types/react-tool-call-renderer.js +0 -19
  395. package/dist/types/react-tool-call-renderer.js.map +0 -1
  396. package/dist/types/react-tool-call-renderer.mjs +0 -2
  397. package/dist/types/react-tool-call-renderer.mjs.map +0 -1
@@ -1,1164 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/components/chat/CopilotChatMessageView.tsx
31
- var CopilotChatMessageView_exports = {};
32
- __export(CopilotChatMessageView_exports, {
33
- CopilotChatMessageView: () => CopilotChatMessageView,
34
- default: () => CopilotChatMessageView_default
35
- });
36
- module.exports = __toCommonJS(CopilotChatMessageView_exports);
37
-
38
- // src/lib/slots.tsx
39
- var import_react = __toESM(require("react"));
40
- function renderSlot(slot, DefaultComponent, props) {
41
- if (typeof slot === "string") {
42
- return import_react.default.createElement(DefaultComponent, {
43
- ...props,
44
- className: slot
45
- });
46
- }
47
- if (typeof slot === "function") {
48
- const Comp = slot;
49
- return import_react.default.createElement(Comp, props);
50
- }
51
- if (slot && typeof slot === "object" && !import_react.default.isValidElement(slot)) {
52
- return import_react.default.createElement(DefaultComponent, {
53
- ...props,
54
- ...slot
55
- });
56
- }
57
- return import_react.default.createElement(DefaultComponent, props);
58
- }
59
-
60
- // src/components/chat/CopilotChatAssistantMessage.tsx
61
- var import_react15 = require("react");
62
- var import_lucide_react = require("lucide-react");
63
-
64
- // src/providers/CopilotChatConfigurationProvider.tsx
65
- var import_react2 = require("react");
66
- var import_shared = require("@copilotkitnext/shared");
67
- var import_jsx_runtime = require("react/jsx-runtime");
68
- var CopilotChatDefaultLabels = {
69
- chatInputPlaceholder: "Type a message...",
70
- chatInputToolbarStartTranscribeButtonLabel: "Transcribe",
71
- chatInputToolbarCancelTranscribeButtonLabel: "Cancel",
72
- chatInputToolbarFinishTranscribeButtonLabel: "Finish",
73
- chatInputToolbarAddButtonLabel: "Add photos or files",
74
- chatInputToolbarToolsButtonLabel: "Tools",
75
- assistantMessageToolbarCopyCodeLabel: "Copy",
76
- assistantMessageToolbarCopyCodeCopiedLabel: "Copied",
77
- assistantMessageToolbarCopyMessageLabel: "Copy",
78
- assistantMessageToolbarThumbsUpLabel: "Good response",
79
- assistantMessageToolbarThumbsDownLabel: "Bad response",
80
- assistantMessageToolbarReadAloudLabel: "Read aloud",
81
- assistantMessageToolbarRegenerateLabel: "Regenerate",
82
- userMessageToolbarCopyMessageLabel: "Copy",
83
- userMessageToolbarEditMessageLabel: "Edit",
84
- chatDisclaimerText: "AI can make mistakes. Please verify important information.",
85
- chatToggleOpenLabel: "Open chat",
86
- chatToggleCloseLabel: "Close chat",
87
- modalHeaderTitle: "CopilotKit Chat"
88
- };
89
- var CopilotChatConfiguration = (0, import_react2.createContext)(null);
90
- var useCopilotChatConfiguration = () => {
91
- const configuration = (0, import_react2.useContext)(CopilotChatConfiguration);
92
- return configuration;
93
- };
94
-
95
- // src/components/chat/CopilotChatAssistantMessage.tsx
96
- var import_tailwind_merge2 = require("tailwind-merge");
97
-
98
- // src/components/ui/button.tsx
99
- var import_react_slot = require("@radix-ui/react-slot");
100
- var import_class_variance_authority = require("class-variance-authority");
101
-
102
- // src/lib/utils.ts
103
- var import_clsx = require("clsx");
104
- var import_tailwind_merge = require("tailwind-merge");
105
- function cn(...inputs) {
106
- return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
107
- }
108
-
109
- // src/components/ui/button.tsx
110
- var import_jsx_runtime2 = require("react/jsx-runtime");
111
- var buttonVariants = (0, import_class_variance_authority.cva)(
112
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
113
- {
114
- variants: {
115
- variant: {
116
- default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
117
- destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
118
- outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
119
- secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
120
- ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50 cursor-pointer",
121
- link: "text-primary underline-offset-4 hover:underline",
122
- assistantMessageToolbarButton: [
123
- "cursor-pointer",
124
- // Background and text
125
- "p-0 text-[rgb(93,93,93)] hover:bg-[#E8E8E8]",
126
- // Dark mode - lighter gray for better contrast
127
- "dark:text-[rgb(243,243,243)] dark:hover:bg-[#303030]",
128
- // Shape and sizing
129
- "h-8 w-8",
130
- // Interactions
131
- "transition-colors",
132
- // Hover states
133
- "hover:text-[rgb(93,93,93)]",
134
- "dark:hover:text-[rgb(243,243,243)]"
135
- ],
136
- chatInputToolbarPrimary: [
137
- "cursor-pointer",
138
- // Background and text
139
- "bg-black text-white",
140
- // Dark mode
141
- "dark:bg-white dark:text-black dark:focus-visible:outline-white",
142
- // Shape and sizing
143
- "rounded-full",
144
- // Interactions
145
- "transition-colors",
146
- // Focus states
147
- "focus:outline-none",
148
- // Hover states
149
- "hover:opacity-70 disabled:hover:opacity-100",
150
- // Disabled states
151
- "disabled:cursor-not-allowed disabled:bg-[#00000014] disabled:text-[rgb(13,13,13)]",
152
- "dark:disabled:bg-[#454545] dark:disabled:text-white "
153
- ],
154
- chatInputToolbarSecondary: [
155
- "cursor-pointer",
156
- // Background and text
157
- "bg-transparent text-[#444444]",
158
- // Dark mode
159
- "dark:text-white dark:border-[#404040]",
160
- // Shape and sizing
161
- "rounded-full",
162
- // Interactions
163
- "transition-colors",
164
- // Focus states
165
- "focus:outline-none",
166
- // Hover states
167
- "hover:bg-[#f8f8f8] hover:text-[#333333]",
168
- "dark:hover:bg-[#404040] dark:hover:text-[#FFFFFF]",
169
- // Disabled states
170
- "disabled:cursor-not-allowed disabled:opacity-50",
171
- "disabled:hover:bg-transparent disabled:hover:text-[#444444]",
172
- "dark:disabled:hover:bg-transparent dark:disabled:hover:text-[#CCCCCC]"
173
- ]
174
- },
175
- size: {
176
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
177
- sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
178
- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
179
- icon: "size-9",
180
- chatInputToolbarIcon: [
181
- // Shape and sizing
182
- "h-9 w-9 rounded-full"
183
- ],
184
- chatInputToolbarIconLabel: [
185
- // Shape and sizing
186
- "h-9 px-3 rounded-full",
187
- // Layout
188
- "gap-2",
189
- // Typography
190
- "font-normal"
191
- ]
192
- }
193
- },
194
- defaultVariants: {
195
- variant: "default",
196
- size: "default"
197
- }
198
- }
199
- );
200
- function Button({
201
- className,
202
- variant,
203
- size,
204
- asChild = false,
205
- ...props
206
- }) {
207
- const Comp = asChild ? import_react_slot.Slot : "button";
208
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
209
- Comp,
210
- {
211
- "data-slot": "button",
212
- className: cn(buttonVariants({ variant, size, className })),
213
- ...props
214
- }
215
- );
216
- }
217
-
218
- // src/components/ui/tooltip.tsx
219
- var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
220
- var import_jsx_runtime3 = require("react/jsx-runtime");
221
- function TooltipProvider({
222
- delayDuration = 0,
223
- ...props
224
- }) {
225
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
226
- TooltipPrimitive.Provider,
227
- {
228
- "data-slot": "tooltip-provider",
229
- delayDuration,
230
- ...props
231
- }
232
- );
233
- }
234
- function Tooltip({
235
- ...props
236
- }) {
237
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
238
- }
239
- function TooltipTrigger({
240
- ...props
241
- }) {
242
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
243
- }
244
- function TooltipContent({
245
- className,
246
- sideOffset = 0,
247
- children,
248
- ...props
249
- }) {
250
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
251
- TooltipPrimitive.Content,
252
- {
253
- "data-slot": "tooltip-content",
254
- sideOffset,
255
- className: cn(
256
- "bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
257
- className
258
- ),
259
- ...props,
260
- children: [
261
- children,
262
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
263
- ]
264
- }
265
- ) });
266
- }
267
-
268
- // src/components/chat/CopilotChatAssistantMessage.tsx
269
- var import_katex_min = require("katex/dist/katex.min.css");
270
- var import_streamdown = require("streamdown");
271
-
272
- // src/hooks/use-render-tool-call.tsx
273
- var import_react5 = require("react");
274
- var import_core2 = require("@copilotkitnext/core");
275
-
276
- // src/providers/CopilotKitProvider.tsx
277
- var import_react4 = require("react");
278
- var import_zod = require("zod");
279
-
280
- // src/lib/react-core.ts
281
- var import_core = require("@copilotkitnext/core");
282
-
283
- // src/components/CopilotKitInspector.tsx
284
- var React3 = __toESM(require("react"));
285
- var import_react3 = require("@lit-labs/react");
286
- var import_web_inspector = require("@copilotkitnext/web-inspector");
287
- var import_jsx_runtime4 = require("react/jsx-runtime");
288
- (0, import_web_inspector.defineWebInspector)();
289
- var CopilotKitInspectorBase = (0, import_react3.createComponent)({
290
- tagName: import_web_inspector.WEB_INSPECTOR_TAG,
291
- elementClass: import_web_inspector.WebInspectorElement,
292
- react: React3
293
- });
294
- var CopilotKitInspector = React3.forwardRef(
295
- ({ core, ...rest }, ref) => {
296
- const innerRef = React3.useRef(null);
297
- React3.useImperativeHandle(ref, () => innerRef.current, []);
298
- React3.useEffect(() => {
299
- if (innerRef.current) {
300
- innerRef.current.core = core ?? null;
301
- }
302
- }, [core]);
303
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
304
- CopilotKitInspectorBase,
305
- {
306
- ...rest,
307
- ref: innerRef
308
- }
309
- );
310
- }
311
- );
312
- CopilotKitInspector.displayName = "CopilotKitInspector";
313
-
314
- // src/providers/CopilotKitProvider.tsx
315
- var import_jsx_runtime5 = require("react/jsx-runtime");
316
- var CopilotKitContext = (0, import_react4.createContext)({
317
- copilotkit: null
318
- });
319
- var useCopilotKit = () => {
320
- const context = (0, import_react4.useContext)(CopilotKitContext);
321
- const [, forceUpdate] = (0, import_react4.useReducer)((x) => x + 1, 0);
322
- if (!context) {
323
- throw new Error("useCopilotKit must be used within CopilotKitProvider");
324
- }
325
- (0, import_react4.useEffect)(() => {
326
- const unsubscribe = context.copilotkit.subscribe({
327
- onRuntimeConnectionStatusChanged: () => {
328
- forceUpdate();
329
- }
330
- });
331
- return () => {
332
- unsubscribe();
333
- };
334
- }, []);
335
- return context;
336
- };
337
-
338
- // src/hooks/use-render-tool-call.tsx
339
- var import_shared2 = require("@copilotkitnext/shared");
340
- var import_shared3 = require("@copilotkitnext/shared");
341
- var import_jsx_runtime6 = require("react/jsx-runtime");
342
- function useRenderToolCall() {
343
- const { copilotkit } = useCopilotKit();
344
- const config = useCopilotChatConfiguration();
345
- const agentId = config?.agentId ?? import_shared2.DEFAULT_AGENT_ID;
346
- const [executingToolCallIds, setExecutingToolCallIds] = (0, import_react5.useState)(() => /* @__PURE__ */ new Set());
347
- const renderToolCalls = (0, import_react5.useSyncExternalStore)(
348
- (callback) => {
349
- return copilotkit.subscribe({
350
- onRenderToolCallsChanged: callback
351
- });
352
- },
353
- () => copilotkit.renderToolCalls,
354
- () => copilotkit.renderToolCalls
355
- );
356
- (0, import_react5.useEffect)(() => {
357
- const unsubscribe = copilotkit.subscribe({
358
- onToolExecutionStart: ({ toolCallId }) => {
359
- setExecutingToolCallIds((prev) => {
360
- if (prev.has(toolCallId)) return prev;
361
- const next = new Set(prev);
362
- next.add(toolCallId);
363
- return next;
364
- });
365
- },
366
- onToolExecutionEnd: ({ toolCallId }) => {
367
- setExecutingToolCallIds((prev) => {
368
- if (!prev.has(toolCallId)) return prev;
369
- const next = new Set(prev);
370
- next.delete(toolCallId);
371
- return next;
372
- });
373
- }
374
- });
375
- return () => unsubscribe();
376
- }, [copilotkit]);
377
- const renderToolCall = (0, import_react5.useCallback)(
378
- ({
379
- toolCall,
380
- toolMessage
381
- }) => {
382
- const exactMatches = renderToolCalls.filter(
383
- (rc) => rc.name === toolCall.function.name
384
- );
385
- const renderConfig = exactMatches.find((rc) => rc.agentId === agentId) || exactMatches.find((rc) => !rc.agentId) || exactMatches[0] || renderToolCalls.find((rc) => rc.name === "*");
386
- if (!renderConfig) {
387
- return null;
388
- }
389
- const RenderComponent = renderConfig.render;
390
- const args = (0, import_shared3.partialJSONParse)(toolCall.function.arguments);
391
- const toolName = toolCall.function.name;
392
- if (toolMessage) {
393
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
394
- RenderComponent,
395
- {
396
- name: toolName,
397
- args,
398
- status: import_core2.ToolCallStatus.Complete,
399
- result: toolMessage.content
400
- },
401
- toolCall.id
402
- );
403
- } else if (executingToolCallIds.has(toolCall.id)) {
404
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
405
- RenderComponent,
406
- {
407
- name: toolName,
408
- args,
409
- status: import_core2.ToolCallStatus.Executing,
410
- result: void 0
411
- },
412
- toolCall.id
413
- );
414
- } else {
415
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
416
- RenderComponent,
417
- {
418
- name: toolName,
419
- args,
420
- status: import_core2.ToolCallStatus.InProgress,
421
- result: void 0
422
- },
423
- toolCall.id
424
- );
425
- }
426
- },
427
- [renderToolCalls, executingToolCallIds, agentId]
428
- );
429
- return renderToolCall;
430
- }
431
-
432
- // src/hooks/use-render-custom-messages.tsx
433
- var import_jsx_runtime7 = require("react/jsx-runtime");
434
- function useRenderCustomMessages() {
435
- const { copilotkit } = useCopilotKit();
436
- const config = useCopilotChatConfiguration();
437
- if (!config) {
438
- return null;
439
- }
440
- const { agentId, threadId } = config;
441
- const customMessageRenderers = copilotkit.renderCustomMessages.filter((renderer) => renderer.agentId === void 0 || renderer.agentId === agentId).sort((a, b) => {
442
- const aHasAgent = a.agentId !== void 0;
443
- const bHasAgent = b.agentId !== void 0;
444
- if (aHasAgent === bHasAgent) return 0;
445
- return aHasAgent ? -1 : 1;
446
- });
447
- return function(params) {
448
- if (!customMessageRenderers.length) {
449
- return null;
450
- }
451
- const { message, position } = params;
452
- const runId = copilotkit.getRunIdForMessage(agentId, threadId, message.id);
453
- const agent = copilotkit.getAgent(agentId);
454
- if (!agent) {
455
- throw new Error("Agent not found");
456
- }
457
- const messagesIdsInRun = agent.messages.filter((msg) => copilotkit.getRunIdForMessage(agentId, threadId, msg.id) === runId).map((msg) => msg.id);
458
- const messageIndex = agent.messages.findIndex((msg) => msg.id === message.id) ?? 0;
459
- const messageIndexInRun = Math.min(messagesIdsInRun.indexOf(message.id), 0);
460
- const numberOfMessagesInRun = messagesIdsInRun.length;
461
- const stateSnapshot = copilotkit.getStateByRun(agentId, threadId, runId);
462
- let result = null;
463
- for (const renderer of customMessageRenderers) {
464
- if (!renderer.render) {
465
- continue;
466
- }
467
- const Component = renderer.render;
468
- result = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
469
- Component,
470
- {
471
- message,
472
- position,
473
- runId,
474
- messageIndex,
475
- messageIndexInRun,
476
- numberOfMessagesInRun,
477
- agentId,
478
- stateSnapshot
479
- },
480
- `${runId}-${message.id}-${position}`
481
- );
482
- if (result) {
483
- break;
484
- }
485
- }
486
- return result;
487
- };
488
- }
489
-
490
- // src/hooks/use-render-activity-message.tsx
491
- var import_shared4 = require("@copilotkitnext/shared");
492
- var import_react6 = require("react");
493
- var import_jsx_runtime8 = require("react/jsx-runtime");
494
- function useRenderActivityMessage() {
495
- const { copilotkit } = useCopilotKit();
496
- const config = useCopilotChatConfiguration();
497
- const agentId = config?.agentId ?? import_shared4.DEFAULT_AGENT_ID;
498
- const renderers = copilotkit.renderActivityMessages;
499
- return (0, import_react6.useCallback)(
500
- (message) => {
501
- if (!renderers.length) {
502
- return null;
503
- }
504
- const matches = renderers.filter(
505
- (renderer2) => renderer2.activityType === message.activityType
506
- );
507
- const renderer = matches.find((candidate) => candidate.agentId === agentId) ?? matches.find((candidate) => candidate.agentId === void 0) ?? renderers.find((candidate) => candidate.activityType === "*");
508
- if (!renderer) {
509
- return null;
510
- }
511
- const parseResult = renderer.content.safeParse(message.content);
512
- if (!parseResult.success) {
513
- console.warn(
514
- `Failed to parse content for activity message '${message.activityType}':`,
515
- parseResult.error
516
- );
517
- return null;
518
- }
519
- const Component = renderer.render;
520
- const agent = copilotkit.getAgent(agentId);
521
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
522
- Component,
523
- {
524
- activityType: message.activityType,
525
- content: parseResult.data,
526
- message,
527
- agent
528
- },
529
- message.id
530
- );
531
- },
532
- [agentId, copilotkit, renderers]
533
- );
534
- }
535
-
536
- // src/hooks/use-frontend-tool.tsx
537
- var import_react7 = require("react");
538
-
539
- // src/hooks/use-human-in-the-loop.tsx
540
- var import_react8 = require("react");
541
- var import_react9 = __toESM(require("react"));
542
-
543
- // src/hooks/use-agent.tsx
544
- var import_react10 = require("react");
545
- var import_shared5 = require("@copilotkitnext/shared");
546
-
547
- // src/hooks/use-agent-context.tsx
548
- var import_react11 = require("react");
549
-
550
- // src/hooks/use-suggestions.tsx
551
- var import_react12 = require("react");
552
- var import_shared6 = require("@copilotkitnext/shared");
553
-
554
- // src/hooks/use-configure-suggestions.tsx
555
- var import_react13 = require("react");
556
- var import_shared7 = require("@copilotkitnext/shared");
557
-
558
- // src/components/chat/CopilotChatToolCallsView.tsx
559
- var import_react14 = __toESM(require("react"));
560
- var import_jsx_runtime9 = require("react/jsx-runtime");
561
- function CopilotChatToolCallsView({
562
- message,
563
- messages = []
564
- }) {
565
- const renderToolCall = useRenderToolCall();
566
- if (!message.toolCalls || message.toolCalls.length === 0) {
567
- return null;
568
- }
569
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: message.toolCalls.map((toolCall) => {
570
- const toolMessage = messages.find(
571
- (m) => m.role === "tool" && m.toolCallId === toolCall.id
572
- );
573
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react14.default.Fragment, { children: renderToolCall({
574
- toolCall,
575
- toolMessage
576
- }) }, toolCall.id);
577
- }) });
578
- }
579
- var CopilotChatToolCallsView_default = CopilotChatToolCallsView;
580
-
581
- // src/components/chat/CopilotChatAssistantMessage.tsx
582
- var import_jsx_runtime10 = require("react/jsx-runtime");
583
- function CopilotChatAssistantMessage({
584
- message,
585
- messages,
586
- isRunning,
587
- onThumbsUp,
588
- onThumbsDown,
589
- onReadAloud,
590
- onRegenerate,
591
- additionalToolbarItems,
592
- toolbarVisible = true,
593
- markdownRenderer,
594
- toolbar,
595
- copyButton,
596
- thumbsUpButton,
597
- thumbsDownButton,
598
- readAloudButton,
599
- regenerateButton,
600
- toolCallsView,
601
- children,
602
- className,
603
- ...props
604
- }) {
605
- const boundMarkdownRenderer = renderSlot(
606
- markdownRenderer,
607
- CopilotChatAssistantMessage.MarkdownRenderer,
608
- {
609
- content: message.content || ""
610
- }
611
- );
612
- const boundCopyButton = renderSlot(
613
- copyButton,
614
- CopilotChatAssistantMessage.CopyButton,
615
- {
616
- onClick: async () => {
617
- if (message.content) {
618
- try {
619
- await navigator.clipboard.writeText(message.content);
620
- } catch (err) {
621
- console.error("Failed to copy message:", err);
622
- }
623
- }
624
- }
625
- }
626
- );
627
- const boundThumbsUpButton = renderSlot(
628
- thumbsUpButton,
629
- CopilotChatAssistantMessage.ThumbsUpButton,
630
- {
631
- onClick: onThumbsUp
632
- }
633
- );
634
- const boundThumbsDownButton = renderSlot(
635
- thumbsDownButton,
636
- CopilotChatAssistantMessage.ThumbsDownButton,
637
- {
638
- onClick: onThumbsDown
639
- }
640
- );
641
- const boundReadAloudButton = renderSlot(
642
- readAloudButton,
643
- CopilotChatAssistantMessage.ReadAloudButton,
644
- {
645
- onClick: onReadAloud
646
- }
647
- );
648
- const boundRegenerateButton = renderSlot(
649
- regenerateButton,
650
- CopilotChatAssistantMessage.RegenerateButton,
651
- {
652
- onClick: onRegenerate
653
- }
654
- );
655
- const boundToolbar = renderSlot(
656
- toolbar,
657
- CopilotChatAssistantMessage.Toolbar,
658
- {
659
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
660
- boundCopyButton,
661
- (onThumbsUp || thumbsUpButton) && boundThumbsUpButton,
662
- (onThumbsDown || thumbsDownButton) && boundThumbsDownButton,
663
- (onReadAloud || readAloudButton) && boundReadAloudButton,
664
- (onRegenerate || regenerateButton) && boundRegenerateButton,
665
- additionalToolbarItems
666
- ] })
667
- }
668
- );
669
- const boundToolCallsView = renderSlot(
670
- toolCallsView,
671
- CopilotChatToolCallsView_default,
672
- {
673
- message,
674
- messages
675
- }
676
- );
677
- const hasContent = !!(message.content && message.content.trim().length > 0);
678
- const isLatestAssistantMessage = message.role === "assistant" && messages?.[messages.length - 1]?.id === message.id;
679
- const shouldShowToolbar = toolbarVisible && hasContent && !(isRunning && isLatestAssistantMessage);
680
- if (children) {
681
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: children({
682
- markdownRenderer: boundMarkdownRenderer,
683
- toolbar: boundToolbar,
684
- toolCallsView: boundToolCallsView,
685
- copyButton: boundCopyButton,
686
- thumbsUpButton: boundThumbsUpButton,
687
- thumbsDownButton: boundThumbsDownButton,
688
- readAloudButton: boundReadAloudButton,
689
- regenerateButton: boundRegenerateButton,
690
- message,
691
- messages,
692
- isRunning,
693
- onThumbsUp,
694
- onThumbsDown,
695
- onReadAloud,
696
- onRegenerate,
697
- additionalToolbarItems,
698
- toolbarVisible: shouldShowToolbar
699
- }) });
700
- }
701
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
702
- "div",
703
- {
704
- className: (0, import_tailwind_merge2.twMerge)(
705
- "prose max-w-full break-words dark:prose-invert",
706
- className
707
- ),
708
- ...props,
709
- "data-message-id": message.id,
710
- children: [
711
- boundMarkdownRenderer,
712
- boundToolCallsView,
713
- shouldShowToolbar && boundToolbar
714
- ]
715
- }
716
- );
717
- }
718
- ((CopilotChatAssistantMessage2) => {
719
- CopilotChatAssistantMessage2.MarkdownRenderer = ({ content, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_streamdown.Streamdown, { className, ...props, children: content ?? "" });
720
- CopilotChatAssistantMessage2.Toolbar = ({
721
- className,
722
- ...props
723
- }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
724
- "div",
725
- {
726
- className: (0, import_tailwind_merge2.twMerge)(
727
- "w-full bg-transparent flex items-center -ml-[5px] -mt-[0px]",
728
- className
729
- ),
730
- ...props
731
- }
732
- );
733
- CopilotChatAssistantMessage2.ToolbarButton = ({ title, children, ...props }) => {
734
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Tooltip, { children: [
735
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
736
- Button,
737
- {
738
- type: "button",
739
- variant: "assistantMessageToolbarButton",
740
- "aria-label": title,
741
- ...props,
742
- children
743
- }
744
- ) }),
745
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipContent, { side: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: title }) })
746
- ] });
747
- };
748
- CopilotChatAssistantMessage2.CopyButton = ({ className, title, onClick, ...props }) => {
749
- const config = useCopilotChatConfiguration();
750
- const labels = config?.labels ?? CopilotChatDefaultLabels;
751
- const [copied, setCopied] = (0, import_react15.useState)(false);
752
- const handleClick = (event) => {
753
- setCopied(true);
754
- setTimeout(() => setCopied(false), 2e3);
755
- if (onClick) {
756
- onClick(event);
757
- }
758
- };
759
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
760
- CopilotChatAssistantMessage2.ToolbarButton,
761
- {
762
- title: title || labels.assistantMessageToolbarCopyMessageLabel,
763
- onClick: handleClick,
764
- className,
765
- ...props,
766
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Check, { className: "size-[18px]" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Copy, { className: "size-[18px]" })
767
- }
768
- );
769
- };
770
- CopilotChatAssistantMessage2.ThumbsUpButton = ({ title, ...props }) => {
771
- const config = useCopilotChatConfiguration();
772
- const labels = config?.labels ?? CopilotChatDefaultLabels;
773
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
774
- CopilotChatAssistantMessage2.ToolbarButton,
775
- {
776
- title: title || labels.assistantMessageToolbarThumbsUpLabel,
777
- ...props,
778
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.ThumbsUp, { className: "size-[18px]" })
779
- }
780
- );
781
- };
782
- CopilotChatAssistantMessage2.ThumbsDownButton = ({ title, ...props }) => {
783
- const config = useCopilotChatConfiguration();
784
- const labels = config?.labels ?? CopilotChatDefaultLabels;
785
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
786
- CopilotChatAssistantMessage2.ToolbarButton,
787
- {
788
- title: title || labels.assistantMessageToolbarThumbsDownLabel,
789
- ...props,
790
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.ThumbsDown, { className: "size-[18px]" })
791
- }
792
- );
793
- };
794
- CopilotChatAssistantMessage2.ReadAloudButton = ({ title, ...props }) => {
795
- const config = useCopilotChatConfiguration();
796
- const labels = config?.labels ?? CopilotChatDefaultLabels;
797
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
798
- CopilotChatAssistantMessage2.ToolbarButton,
799
- {
800
- title: title || labels.assistantMessageToolbarReadAloudLabel,
801
- ...props,
802
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Volume2, { className: "size-[20px]" })
803
- }
804
- );
805
- };
806
- CopilotChatAssistantMessage2.RegenerateButton = ({ title, ...props }) => {
807
- const config = useCopilotChatConfiguration();
808
- const labels = config?.labels ?? CopilotChatDefaultLabels;
809
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
810
- CopilotChatAssistantMessage2.ToolbarButton,
811
- {
812
- title: title || labels.assistantMessageToolbarRegenerateLabel,
813
- ...props,
814
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.RefreshCw, { className: "size-[18px]" })
815
- }
816
- );
817
- };
818
- })(CopilotChatAssistantMessage || (CopilotChatAssistantMessage = {}));
819
- CopilotChatAssistantMessage.MarkdownRenderer.displayName = "CopilotChatAssistantMessage.MarkdownRenderer";
820
- CopilotChatAssistantMessage.Toolbar.displayName = "CopilotChatAssistantMessage.Toolbar";
821
- CopilotChatAssistantMessage.CopyButton.displayName = "CopilotChatAssistantMessage.CopyButton";
822
- CopilotChatAssistantMessage.ThumbsUpButton.displayName = "CopilotChatAssistantMessage.ThumbsUpButton";
823
- CopilotChatAssistantMessage.ThumbsDownButton.displayName = "CopilotChatAssistantMessage.ThumbsDownButton";
824
- CopilotChatAssistantMessage.ReadAloudButton.displayName = "CopilotChatAssistantMessage.ReadAloudButton";
825
- CopilotChatAssistantMessage.RegenerateButton.displayName = "CopilotChatAssistantMessage.RegenerateButton";
826
- var CopilotChatAssistantMessage_default = CopilotChatAssistantMessage;
827
-
828
- // src/components/chat/CopilotChatUserMessage.tsx
829
- var import_react16 = require("react");
830
- var import_lucide_react2 = require("lucide-react");
831
- var import_tailwind_merge3 = require("tailwind-merge");
832
- var import_jsx_runtime11 = require("react/jsx-runtime");
833
- function flattenUserMessageContent(content) {
834
- if (!content) {
835
- return "";
836
- }
837
- if (typeof content === "string") {
838
- return content;
839
- }
840
- return content.map((part) => {
841
- if (part && typeof part === "object" && "type" in part && part.type === "text" && typeof part.text === "string") {
842
- return part.text;
843
- }
844
- return "";
845
- }).filter((text) => text.length > 0).join("\n");
846
- }
847
- function CopilotChatUserMessage({
848
- message,
849
- onEditMessage,
850
- branchIndex,
851
- numberOfBranches,
852
- onSwitchToBranch,
853
- additionalToolbarItems,
854
- messageRenderer,
855
- toolbar,
856
- copyButton,
857
- editButton,
858
- branchNavigation,
859
- children,
860
- className,
861
- ...props
862
- }) {
863
- const flattenedContent = (0, import_react16.useMemo)(
864
- () => flattenUserMessageContent(message.content),
865
- [message.content]
866
- );
867
- const BoundMessageRenderer = renderSlot(
868
- messageRenderer,
869
- CopilotChatUserMessage.MessageRenderer,
870
- {
871
- content: flattenedContent
872
- }
873
- );
874
- const BoundCopyButton = renderSlot(
875
- copyButton,
876
- CopilotChatUserMessage.CopyButton,
877
- {
878
- onClick: async () => {
879
- if (flattenedContent) {
880
- try {
881
- await navigator.clipboard.writeText(flattenedContent);
882
- } catch (err) {
883
- console.error("Failed to copy message:", err);
884
- }
885
- }
886
- }
887
- }
888
- );
889
- const BoundEditButton = renderSlot(
890
- editButton,
891
- CopilotChatUserMessage.EditButton,
892
- {
893
- onClick: () => onEditMessage?.({ message })
894
- }
895
- );
896
- const BoundBranchNavigation = renderSlot(
897
- branchNavigation,
898
- CopilotChatUserMessage.BranchNavigation,
899
- {
900
- currentBranch: branchIndex,
901
- numberOfBranches,
902
- onSwitchToBranch,
903
- message
904
- }
905
- );
906
- const showBranchNavigation = numberOfBranches && numberOfBranches > 1 && onSwitchToBranch;
907
- const BoundToolbar = renderSlot(toolbar, CopilotChatUserMessage.Toolbar, {
908
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1 justify-end", children: [
909
- additionalToolbarItems,
910
- BoundCopyButton,
911
- onEditMessage && BoundEditButton,
912
- showBranchNavigation && BoundBranchNavigation
913
- ] })
914
- });
915
- if (children) {
916
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: children({
917
- messageRenderer: BoundMessageRenderer,
918
- toolbar: BoundToolbar,
919
- copyButton: BoundCopyButton,
920
- editButton: BoundEditButton,
921
- branchNavigation: BoundBranchNavigation,
922
- message,
923
- branchIndex,
924
- numberOfBranches,
925
- additionalToolbarItems
926
- }) });
927
- }
928
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
929
- "div",
930
- {
931
- className: (0, import_tailwind_merge3.twMerge)("flex flex-col items-end group pt-10", className),
932
- "data-message-id": message.id,
933
- ...props,
934
- children: [
935
- BoundMessageRenderer,
936
- BoundToolbar
937
- ]
938
- }
939
- );
940
- }
941
- ((CopilotChatUserMessage2) => {
942
- CopilotChatUserMessage2.Container = ({ children, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
943
- "div",
944
- {
945
- className: (0, import_tailwind_merge3.twMerge)("flex flex-col items-end group", className),
946
- ...props,
947
- children
948
- }
949
- );
950
- CopilotChatUserMessage2.MessageRenderer = ({ content, className }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
951
- "div",
952
- {
953
- className: (0, import_tailwind_merge3.twMerge)(
954
- "prose dark:prose-invert bg-muted relative max-w-[80%] rounded-[18px] px-4 py-1.5 data-[multiline]:py-3 inline-block whitespace-pre-wrap",
955
- className
956
- ),
957
- children: content
958
- }
959
- );
960
- CopilotChatUserMessage2.Toolbar = ({
961
- className,
962
- ...props
963
- }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
964
- "div",
965
- {
966
- className: (0, import_tailwind_merge3.twMerge)(
967
- "w-full bg-transparent flex items-center justify-end -mr-[5px] mt-[4px] invisible group-hover:visible",
968
- className
969
- ),
970
- ...props
971
- }
972
- );
973
- CopilotChatUserMessage2.ToolbarButton = ({ title, children, className, ...props }) => {
974
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Tooltip, { children: [
975
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
976
- Button,
977
- {
978
- type: "button",
979
- variant: "assistantMessageToolbarButton",
980
- "aria-label": title,
981
- className: (0, import_tailwind_merge3.twMerge)(className),
982
- ...props,
983
- children
984
- }
985
- ) }),
986
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TooltipContent, { side: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: title }) })
987
- ] });
988
- };
989
- CopilotChatUserMessage2.CopyButton = ({ className, title, onClick, ...props }) => {
990
- const config = useCopilotChatConfiguration();
991
- const labels = config?.labels ?? CopilotChatDefaultLabels;
992
- const [copied, setCopied] = (0, import_react16.useState)(false);
993
- const handleClick = (event) => {
994
- setCopied(true);
995
- setTimeout(() => setCopied(false), 2e3);
996
- if (onClick) {
997
- onClick(event);
998
- }
999
- };
1000
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1001
- CopilotChatUserMessage2.ToolbarButton,
1002
- {
1003
- title: title || labels.userMessageToolbarCopyMessageLabel,
1004
- onClick: handleClick,
1005
- className,
1006
- ...props,
1007
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react2.Check, { className: "size-[18px]" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react2.Copy, { className: "size-[18px]" })
1008
- }
1009
- );
1010
- };
1011
- CopilotChatUserMessage2.EditButton = ({ className, title, ...props }) => {
1012
- const config = useCopilotChatConfiguration();
1013
- const labels = config?.labels ?? CopilotChatDefaultLabels;
1014
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1015
- CopilotChatUserMessage2.ToolbarButton,
1016
- {
1017
- title: title || labels.userMessageToolbarEditMessageLabel,
1018
- className,
1019
- ...props,
1020
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react2.Edit, { className: "size-[18px]" })
1021
- }
1022
- );
1023
- };
1024
- CopilotChatUserMessage2.BranchNavigation = ({
1025
- className,
1026
- currentBranch = 0,
1027
- numberOfBranches = 1,
1028
- onSwitchToBranch,
1029
- message,
1030
- ...props
1031
- }) => {
1032
- if (!numberOfBranches || numberOfBranches <= 1 || !onSwitchToBranch) {
1033
- return null;
1034
- }
1035
- const canGoPrev = currentBranch > 0;
1036
- const canGoNext = currentBranch < numberOfBranches - 1;
1037
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: (0, import_tailwind_merge3.twMerge)("flex items-center gap-1", className), ...props, children: [
1038
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1039
- Button,
1040
- {
1041
- type: "button",
1042
- variant: "assistantMessageToolbarButton",
1043
- onClick: () => onSwitchToBranch?.({
1044
- branchIndex: currentBranch - 1,
1045
- numberOfBranches,
1046
- message
1047
- }),
1048
- disabled: !canGoPrev,
1049
- className: "h-6 w-6 p-0",
1050
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react2.ChevronLeft, { className: "size-[20px]" })
1051
- }
1052
- ),
1053
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "text-sm text-muted-foreground px-0 font-medium", children: [
1054
- currentBranch + 1,
1055
- "/",
1056
- numberOfBranches
1057
- ] }),
1058
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1059
- Button,
1060
- {
1061
- type: "button",
1062
- variant: "assistantMessageToolbarButton",
1063
- onClick: () => onSwitchToBranch?.({
1064
- branchIndex: currentBranch + 1,
1065
- numberOfBranches,
1066
- message
1067
- }),
1068
- disabled: !canGoNext,
1069
- className: "h-6 w-6 p-0",
1070
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react2.ChevronRight, { className: "size-[20px]" })
1071
- }
1072
- )
1073
- ] });
1074
- };
1075
- })(CopilotChatUserMessage || (CopilotChatUserMessage = {}));
1076
- CopilotChatUserMessage.Container.displayName = "CopilotChatUserMessage.Container";
1077
- CopilotChatUserMessage.MessageRenderer.displayName = "CopilotChatUserMessage.MessageRenderer";
1078
- CopilotChatUserMessage.Toolbar.displayName = "CopilotChatUserMessage.Toolbar";
1079
- CopilotChatUserMessage.ToolbarButton.displayName = "CopilotChatUserMessage.ToolbarButton";
1080
- CopilotChatUserMessage.CopyButton.displayName = "CopilotChatUserMessage.CopyButton";
1081
- CopilotChatUserMessage.EditButton.displayName = "CopilotChatUserMessage.EditButton";
1082
- CopilotChatUserMessage.BranchNavigation.displayName = "CopilotChatUserMessage.BranchNavigation";
1083
- var CopilotChatUserMessage_default = CopilotChatUserMessage;
1084
-
1085
- // src/components/chat/CopilotChatMessageView.tsx
1086
- var import_tailwind_merge4 = require("tailwind-merge");
1087
- var import_jsx_runtime12 = require("react/jsx-runtime");
1088
- function CopilotChatMessageView({
1089
- messages = [],
1090
- assistantMessage,
1091
- userMessage,
1092
- cursor,
1093
- isRunning = false,
1094
- children,
1095
- className,
1096
- ...props
1097
- }) {
1098
- const renderCustomMessage = useRenderCustomMessages();
1099
- const renderActivityMessage = useRenderActivityMessage();
1100
- const messageElements = messages.flatMap((message) => {
1101
- const elements = [];
1102
- if (renderCustomMessage) {
1103
- elements.push(
1104
- renderCustomMessage({
1105
- message,
1106
- position: "before"
1107
- })
1108
- );
1109
- }
1110
- if (message.role === "assistant") {
1111
- elements.push(
1112
- renderSlot(assistantMessage, CopilotChatAssistantMessage_default, {
1113
- key: message.id,
1114
- message,
1115
- messages,
1116
- isRunning
1117
- })
1118
- );
1119
- } else if (message.role === "user") {
1120
- elements.push(
1121
- renderSlot(userMessage, CopilotChatUserMessage_default, {
1122
- key: message.id,
1123
- message
1124
- })
1125
- );
1126
- } else if (message.role === "activity") {
1127
- const renderedActivity = renderActivityMessage(message);
1128
- if (renderedActivity) {
1129
- elements.push(renderedActivity);
1130
- }
1131
- }
1132
- if (renderCustomMessage) {
1133
- elements.push(
1134
- renderCustomMessage({
1135
- message,
1136
- position: "after"
1137
- })
1138
- );
1139
- }
1140
- return elements;
1141
- }).filter(Boolean);
1142
- if (children) {
1143
- return children({ messageElements, messages, isRunning });
1144
- }
1145
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: (0, import_tailwind_merge4.twMerge)("flex flex-col", className), ...props, children: [
1146
- messageElements,
1147
- isRunning && renderSlot(cursor, CopilotChatMessageView.Cursor, {})
1148
- ] });
1149
- }
1150
- CopilotChatMessageView.Cursor = function Cursor({ className, ...props }) {
1151
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1152
- "div",
1153
- {
1154
- className: (0, import_tailwind_merge4.twMerge)("w-[11px] h-[11px] rounded-full bg-foreground animate-pulse-cursor ml-1", className),
1155
- ...props
1156
- }
1157
- );
1158
- };
1159
- var CopilotChatMessageView_default = CopilotChatMessageView;
1160
- // Annotate the CommonJS export names for ESM import in node:
1161
- 0 && (module.exports = {
1162
- CopilotChatMessageView
1163
- });
1164
- //# sourceMappingURL=CopilotChatMessageView.js.map