@copilotkit/react-ui 0.0.0-0.0.0-max-changeset-10101010101010-20260109191632

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 (395) hide show
  1. package/CHANGELOG.md +17415 -0
  2. package/LICENSE +21 -0
  3. package/README.md +141 -0
  4. package/dist/chunk-3W6J75HS.mjs +126 -0
  5. package/dist/chunk-3W6J75HS.mjs.map +1 -0
  6. package/dist/chunk-54JAUBUJ.mjs +26 -0
  7. package/dist/chunk-54JAUBUJ.mjs.map +1 -0
  8. package/dist/chunk-7OURDQZJ.mjs +133 -0
  9. package/dist/chunk-7OURDQZJ.mjs.map +1 -0
  10. package/dist/chunk-7PR2KJDO.mjs +222 -0
  11. package/dist/chunk-7PR2KJDO.mjs.map +1 -0
  12. package/dist/chunk-BH6PCAAL.mjs +81 -0
  13. package/dist/chunk-BH6PCAAL.mjs.map +1 -0
  14. package/dist/chunk-C3GSYRC3.mjs +118 -0
  15. package/dist/chunk-C3GSYRC3.mjs.map +1 -0
  16. package/dist/chunk-DBKRAOH7.mjs +34 -0
  17. package/dist/chunk-DBKRAOH7.mjs.map +1 -0
  18. package/dist/chunk-EFZPSZWO.mjs +1 -0
  19. package/dist/chunk-EFZPSZWO.mjs.map +1 -0
  20. package/dist/chunk-ELGRNEAO.mjs +32 -0
  21. package/dist/chunk-ELGRNEAO.mjs.map +1 -0
  22. package/dist/chunk-ELUJRANC.mjs +21 -0
  23. package/dist/chunk-ELUJRANC.mjs.map +1 -0
  24. package/dist/chunk-FFJHOZX6.mjs +202 -0
  25. package/dist/chunk-FFJHOZX6.mjs.map +1 -0
  26. package/dist/chunk-GDSZGYCE.mjs +32 -0
  27. package/dist/chunk-GDSZGYCE.mjs.map +1 -0
  28. package/dist/chunk-HIW7RXCD.mjs +184 -0
  29. package/dist/chunk-HIW7RXCD.mjs.map +1 -0
  30. package/dist/chunk-IEMQ2SQW.mjs +93 -0
  31. package/dist/chunk-IEMQ2SQW.mjs.map +1 -0
  32. package/dist/chunk-IHFR6PYG.mjs +116 -0
  33. package/dist/chunk-IHFR6PYG.mjs.map +1 -0
  34. package/dist/chunk-IK2BPURM.mjs +400 -0
  35. package/dist/chunk-IK2BPURM.mjs.map +1 -0
  36. package/dist/chunk-IU3WTXLQ.mjs +1 -0
  37. package/dist/chunk-IU3WTXLQ.mjs.map +1 -0
  38. package/dist/chunk-JGMFJZMG.mjs +11 -0
  39. package/dist/chunk-JGMFJZMG.mjs.map +1 -0
  40. package/dist/chunk-JY2CSDKN.mjs +135 -0
  41. package/dist/chunk-JY2CSDKN.mjs.map +1 -0
  42. package/dist/chunk-JZ3RFQQ6.mjs +128 -0
  43. package/dist/chunk-JZ3RFQQ6.mjs.map +1 -0
  44. package/dist/chunk-KXE2JCUH.mjs +1 -0
  45. package/dist/chunk-KXE2JCUH.mjs.map +1 -0
  46. package/dist/chunk-LQEFRHRT.mjs +30 -0
  47. package/dist/chunk-LQEFRHRT.mjs.map +1 -0
  48. package/dist/chunk-MMVDU6DF.mjs +1 -0
  49. package/dist/chunk-MMVDU6DF.mjs.map +1 -0
  50. package/dist/chunk-MRXNTQOX.mjs +59 -0
  51. package/dist/chunk-MRXNTQOX.mjs.map +1 -0
  52. package/dist/chunk-NCIAFFQ2.mjs +82 -0
  53. package/dist/chunk-NCIAFFQ2.mjs.map +1 -0
  54. package/dist/chunk-NGJ32FAP.mjs +30 -0
  55. package/dist/chunk-NGJ32FAP.mjs.map +1 -0
  56. package/dist/chunk-NRA3CFEE.mjs +97 -0
  57. package/dist/chunk-NRA3CFEE.mjs.map +1 -0
  58. package/dist/chunk-O72ZB5V3.mjs +140 -0
  59. package/dist/chunk-O72ZB5V3.mjs.map +1 -0
  60. package/dist/chunk-PLHTVHUW.mjs +82 -0
  61. package/dist/chunk-PLHTVHUW.mjs.map +1 -0
  62. package/dist/chunk-Q5V6S67N.mjs +103 -0
  63. package/dist/chunk-Q5V6S67N.mjs.map +1 -0
  64. package/dist/chunk-QB3GUN2N.mjs +31 -0
  65. package/dist/chunk-QB3GUN2N.mjs.map +1 -0
  66. package/dist/chunk-QIOJXTIQ.mjs +64 -0
  67. package/dist/chunk-QIOJXTIQ.mjs.map +1 -0
  68. package/dist/chunk-QPQRLXN3.mjs +435 -0
  69. package/dist/chunk-QPQRLXN3.mjs.map +1 -0
  70. package/dist/chunk-RYUCX3ZK.mjs +32 -0
  71. package/dist/chunk-RYUCX3ZK.mjs.map +1 -0
  72. package/dist/chunk-SC6JRFAJ.mjs +1 -0
  73. package/dist/chunk-SC6JRFAJ.mjs.map +1 -0
  74. package/dist/chunk-T26KLXLH.mjs +1 -0
  75. package/dist/chunk-T26KLXLH.mjs.map +1 -0
  76. package/dist/chunk-UFN2VWSR.mjs +25 -0
  77. package/dist/chunk-UFN2VWSR.mjs.map +1 -0
  78. package/dist/chunk-V7W6IM2V.mjs +1 -0
  79. package/dist/chunk-V7W6IM2V.mjs.map +1 -0
  80. package/dist/chunk-WB3YULQ4.mjs +1 -0
  81. package/dist/chunk-WB3YULQ4.mjs.map +1 -0
  82. package/dist/chunk-XWG3L6QC.mjs +258 -0
  83. package/dist/chunk-XWG3L6QC.mjs.map +1 -0
  84. package/dist/chunk-Y4FKRAKJ.mjs +12 -0
  85. package/dist/chunk-Y4FKRAKJ.mjs.map +1 -0
  86. package/dist/components/chat/Button.d.ts +9 -0
  87. package/dist/components/chat/Button.js +71 -0
  88. package/dist/components/chat/Button.js.map +1 -0
  89. package/dist/components/chat/Button.mjs +10 -0
  90. package/dist/components/chat/Button.mjs.map +1 -0
  91. package/dist/components/chat/Chat.d.ts +204 -0
  92. package/dist/components/chat/Chat.js +2270 -0
  93. package/dist/components/chat/Chat.js.map +1 -0
  94. package/dist/components/chat/Chat.mjs +29 -0
  95. package/dist/components/chat/Chat.mjs.map +1 -0
  96. package/dist/components/chat/ChatContext.d.ts +145 -0
  97. package/dist/components/chat/ChatContext.js +329 -0
  98. package/dist/components/chat/ChatContext.js.map +1 -0
  99. package/dist/components/chat/ChatContext.mjs +13 -0
  100. package/dist/components/chat/ChatContext.mjs.map +1 -0
  101. package/dist/components/chat/CodeBlock.d.ts +14 -0
  102. package/dist/components/chat/CodeBlock.js +510 -0
  103. package/dist/components/chat/CodeBlock.js.map +1 -0
  104. package/dist/components/chat/CodeBlock.mjs +14 -0
  105. package/dist/components/chat/CodeBlock.mjs.map +1 -0
  106. package/dist/components/chat/Header.d.ts +9 -0
  107. package/dist/components/chat/Header.js +582 -0
  108. package/dist/components/chat/Header.js.map +1 -0
  109. package/dist/components/chat/Header.mjs +17 -0
  110. package/dist/components/chat/Header.mjs.map +1 -0
  111. package/dist/components/chat/Icons.d.ts +20 -0
  112. package/dist/components/chat/Icons.js +297 -0
  113. package/dist/components/chat/Icons.js.map +1 -0
  114. package/dist/components/chat/Icons.mjs +38 -0
  115. package/dist/components/chat/Icons.mjs.map +1 -0
  116. package/dist/components/chat/ImageUploadQueue.d.ts +13 -0
  117. package/dist/components/chat/ImageUploadQueue.js +106 -0
  118. package/dist/components/chat/ImageUploadQueue.js.map +1 -0
  119. package/dist/components/chat/ImageUploadQueue.mjs +8 -0
  120. package/dist/components/chat/ImageUploadQueue.mjs.map +1 -0
  121. package/dist/components/chat/Input.d.ts +9 -0
  122. package/dist/components/chat/Input.js +396 -0
  123. package/dist/components/chat/Input.js.map +1 -0
  124. package/dist/components/chat/Input.mjs +14 -0
  125. package/dist/components/chat/Input.mjs.map +1 -0
  126. package/dist/components/chat/Markdown.d.ts +10 -0
  127. package/dist/components/chat/Markdown.js +652 -0
  128. package/dist/components/chat/Markdown.js.map +1 -0
  129. package/dist/components/chat/Markdown.mjs +11 -0
  130. package/dist/components/chat/Markdown.mjs.map +1 -0
  131. package/dist/components/chat/Messages.d.ts +13 -0
  132. package/dist/components/chat/Messages.js +1195 -0
  133. package/dist/components/chat/Messages.js.map +1 -0
  134. package/dist/components/chat/Messages.mjs +20 -0
  135. package/dist/components/chat/Messages.mjs.map +1 -0
  136. package/dist/components/chat/Modal.d.ts +51 -0
  137. package/dist/components/chat/Modal.js +3075 -0
  138. package/dist/components/chat/Modal.js.map +1 -0
  139. package/dist/components/chat/Modal.mjs +38 -0
  140. package/dist/components/chat/Modal.mjs.map +1 -0
  141. package/dist/components/chat/Popup.d.ts +13 -0
  142. package/dist/components/chat/Popup.js +3086 -0
  143. package/dist/components/chat/Popup.js.map +1 -0
  144. package/dist/components/chat/Popup.mjs +39 -0
  145. package/dist/components/chat/Popup.mjs.map +1 -0
  146. package/dist/components/chat/PoweredByTag.d.ts +7 -0
  147. package/dist/components/chat/PoweredByTag.js +61 -0
  148. package/dist/components/chat/PoweredByTag.js.map +1 -0
  149. package/dist/components/chat/PoweredByTag.mjs +9 -0
  150. package/dist/components/chat/PoweredByTag.mjs.map +1 -0
  151. package/dist/components/chat/Sidebar.d.ts +13 -0
  152. package/dist/components/chat/Sidebar.js +3095 -0
  153. package/dist/components/chat/Sidebar.js.map +1 -0
  154. package/dist/components/chat/Sidebar.mjs +39 -0
  155. package/dist/components/chat/Sidebar.mjs.map +1 -0
  156. package/dist/components/chat/Suggestion.d.ts +12 -0
  157. package/dist/components/chat/Suggestion.js +56 -0
  158. package/dist/components/chat/Suggestion.js.map +1 -0
  159. package/dist/components/chat/Suggestion.mjs +9 -0
  160. package/dist/components/chat/Suggestion.mjs.map +1 -0
  161. package/dist/components/chat/Suggestions.d.ts +9 -0
  162. package/dist/components/chat/Suggestions.js +81 -0
  163. package/dist/components/chat/Suggestions.js.map +1 -0
  164. package/dist/components/chat/Suggestions.mjs +10 -0
  165. package/dist/components/chat/Suggestions.mjs.map +1 -0
  166. package/dist/components/chat/Textarea.d.ts +15 -0
  167. package/dist/components/chat/Textarea.js +84 -0
  168. package/dist/components/chat/Textarea.js.map +1 -0
  169. package/dist/components/chat/Textarea.mjs +8 -0
  170. package/dist/components/chat/Textarea.mjs.map +1 -0
  171. package/dist/components/chat/Window.d.ts +9 -0
  172. package/dist/components/chat/Window.js +164 -0
  173. package/dist/components/chat/Window.js.map +1 -0
  174. package/dist/components/chat/Window.mjs +10 -0
  175. package/dist/components/chat/Window.mjs.map +1 -0
  176. package/dist/components/chat/index.d.ts +18 -0
  177. package/dist/components/chat/index.js +3122 -0
  178. package/dist/components/chat/index.js.map +1 -0
  179. package/dist/components/chat/index.mjs +69 -0
  180. package/dist/components/chat/index.mjs.map +1 -0
  181. package/dist/components/chat/messages/AssistantMessage.d.ts +9 -0
  182. package/dist/components/chat/messages/AssistantMessage.js +775 -0
  183. package/dist/components/chat/messages/AssistantMessage.js.map +1 -0
  184. package/dist/components/chat/messages/AssistantMessage.mjs +13 -0
  185. package/dist/components/chat/messages/AssistantMessage.mjs.map +1 -0
  186. package/dist/components/chat/messages/ErrorMessage.d.ts +9 -0
  187. package/dist/components/chat/messages/ErrorMessage.js +722 -0
  188. package/dist/components/chat/messages/ErrorMessage.js.map +1 -0
  189. package/dist/components/chat/messages/ErrorMessage.mjs +66 -0
  190. package/dist/components/chat/messages/ErrorMessage.mjs.map +1 -0
  191. package/dist/components/chat/messages/ImageRenderer.d.ts +12 -0
  192. package/dist/components/chat/messages/ImageRenderer.js +58 -0
  193. package/dist/components/chat/messages/ImageRenderer.js.map +1 -0
  194. package/dist/components/chat/messages/ImageRenderer.mjs +8 -0
  195. package/dist/components/chat/messages/ImageRenderer.mjs.map +1 -0
  196. package/dist/components/chat/messages/LegacyRenderMessage.d.ts +28 -0
  197. package/dist/components/chat/messages/LegacyRenderMessage.js +1023 -0
  198. package/dist/components/chat/messages/LegacyRenderMessage.js.map +1 -0
  199. package/dist/components/chat/messages/LegacyRenderMessage.mjs +17 -0
  200. package/dist/components/chat/messages/LegacyRenderMessage.mjs.map +1 -0
  201. package/dist/components/chat/messages/RenderMessage.d.ts +9 -0
  202. package/dist/components/chat/messages/RenderMessage.js +898 -0
  203. package/dist/components/chat/messages/RenderMessage.js.map +1 -0
  204. package/dist/components/chat/messages/RenderMessage.mjs +16 -0
  205. package/dist/components/chat/messages/RenderMessage.mjs.map +1 -0
  206. package/dist/components/chat/messages/UserMessage.d.ts +9 -0
  207. package/dist/components/chat/messages/UserMessage.js +56 -0
  208. package/dist/components/chat/messages/UserMessage.js.map +1 -0
  209. package/dist/components/chat/messages/UserMessage.mjs +8 -0
  210. package/dist/components/chat/messages/UserMessage.mjs.map +1 -0
  211. package/dist/components/chat/props.d.ts +298 -0
  212. package/dist/components/chat/props.js +19 -0
  213. package/dist/components/chat/props.js.map +1 -0
  214. package/dist/components/chat/props.mjs +2 -0
  215. package/dist/components/chat/props.mjs.map +1 -0
  216. package/dist/components/dev-console/console.d.ts +11 -0
  217. package/dist/components/dev-console/console.js +537 -0
  218. package/dist/components/dev-console/console.js.map +1 -0
  219. package/dist/components/dev-console/console.mjs +17 -0
  220. package/dist/components/dev-console/console.mjs.map +1 -0
  221. package/dist/components/dev-console/icons.d.ts +9 -0
  222. package/dist/components/dev-console/icons.js +131 -0
  223. package/dist/components/dev-console/icons.js.map +1 -0
  224. package/dist/components/dev-console/icons.mjs +16 -0
  225. package/dist/components/dev-console/icons.mjs.map +1 -0
  226. package/dist/components/dev-console/index.d.ts +3 -0
  227. package/dist/components/dev-console/index.js +537 -0
  228. package/dist/components/dev-console/index.js.map +1 -0
  229. package/dist/components/dev-console/index.mjs +18 -0
  230. package/dist/components/dev-console/index.mjs.map +1 -0
  231. package/dist/components/dev-console/types.d.ts +9 -0
  232. package/dist/components/dev-console/types.js +19 -0
  233. package/dist/components/dev-console/types.js.map +1 -0
  234. package/dist/components/dev-console/types.mjs +1 -0
  235. package/dist/components/dev-console/types.mjs.map +1 -0
  236. package/dist/components/dev-console/utils.d.ts +10 -0
  237. package/dist/components/dev-console/utils.js +177 -0
  238. package/dist/components/dev-console/utils.js.map +1 -0
  239. package/dist/components/dev-console/utils.mjs +16 -0
  240. package/dist/components/dev-console/utils.mjs.map +1 -0
  241. package/dist/components/help-modal/icons.d.ts +9 -0
  242. package/dist/components/help-modal/icons.js +107 -0
  243. package/dist/components/help-modal/icons.js.map +1 -0
  244. package/dist/components/help-modal/icons.mjs +12 -0
  245. package/dist/components/help-modal/icons.mjs.map +1 -0
  246. package/dist/components/help-modal/index.d.ts +2 -0
  247. package/dist/components/help-modal/index.js +137 -0
  248. package/dist/components/help-modal/index.js.map +1 -0
  249. package/dist/components/help-modal/index.mjs +10 -0
  250. package/dist/components/help-modal/index.mjs.map +1 -0
  251. package/dist/components/help-modal/modal.d.ts +5 -0
  252. package/dist/components/help-modal/modal.js +135 -0
  253. package/dist/components/help-modal/modal.js.map +1 -0
  254. package/dist/components/help-modal/modal.mjs +9 -0
  255. package/dist/components/help-modal/modal.mjs.map +1 -0
  256. package/dist/components/index.d.ts +19 -0
  257. package/dist/components/index.js +3126 -0
  258. package/dist/components/index.js.map +1 -0
  259. package/dist/components/index.mjs +76 -0
  260. package/dist/components/index.mjs.map +1 -0
  261. package/dist/context/index.d.ts +2 -0
  262. package/dist/context/index.js +19 -0
  263. package/dist/context/index.js.map +1 -0
  264. package/dist/context/index.mjs +2 -0
  265. package/dist/context/index.mjs.map +1 -0
  266. package/dist/hooks/index.d.ts +2 -0
  267. package/dist/hooks/index.js +36 -0
  268. package/dist/hooks/index.js.map +1 -0
  269. package/dist/hooks/index.mjs +9 -0
  270. package/dist/hooks/index.mjs.map +1 -0
  271. package/dist/hooks/use-copilot-chat-suggestions.d.ts +66 -0
  272. package/dist/hooks/use-copilot-chat-suggestions.js +34 -0
  273. package/dist/hooks/use-copilot-chat-suggestions.js.map +1 -0
  274. package/dist/hooks/use-copilot-chat-suggestions.mjs +8 -0
  275. package/dist/hooks/use-copilot-chat-suggestions.mjs.map +1 -0
  276. package/dist/hooks/use-copy-to-clipboard.d.ts +9 -0
  277. package/dist/hooks/use-copy-to-clipboard.js +60 -0
  278. package/dist/hooks/use-copy-to-clipboard.js.map +1 -0
  279. package/dist/hooks/use-copy-to-clipboard.mjs +8 -0
  280. package/dist/hooks/use-copy-to-clipboard.mjs.map +1 -0
  281. package/dist/hooks/use-dark-mode.d.ts +3 -0
  282. package/dist/hooks/use-dark-mode.js +35 -0
  283. package/dist/hooks/use-dark-mode.js.map +1 -0
  284. package/dist/hooks/use-dark-mode.mjs +8 -0
  285. package/dist/hooks/use-dark-mode.mjs.map +1 -0
  286. package/dist/hooks/use-push-to-talk.d.ts +19 -0
  287. package/dist/hooks/use-push-to-talk.js +195 -0
  288. package/dist/hooks/use-push-to-talk.js.map +1 -0
  289. package/dist/hooks/use-push-to-talk.mjs +12 -0
  290. package/dist/hooks/use-push-to-talk.mjs.map +1 -0
  291. package/dist/index.css +1258 -0
  292. package/dist/index.css.map +1 -0
  293. package/dist/index.d.ts +21 -0
  294. package/dist/index.js +3135 -0
  295. package/dist/index.js.map +1 -0
  296. package/dist/index.mjs +84 -0
  297. package/dist/index.mjs.map +1 -0
  298. package/dist/lib/utils.d.ts +4 -0
  299. package/dist/lib/utils.js +76 -0
  300. package/dist/lib/utils.js.map +1 -0
  301. package/dist/lib/utils.mjs +34 -0
  302. package/dist/lib/utils.mjs.map +1 -0
  303. package/dist/types/css.d.ts +22 -0
  304. package/dist/types/css.js +19 -0
  305. package/dist/types/css.js.map +1 -0
  306. package/dist/types/css.mjs +1 -0
  307. package/dist/types/css.mjs.map +1 -0
  308. package/dist/types/index.d.ts +3 -0
  309. package/dist/types/index.js +19 -0
  310. package/dist/types/index.js.map +1 -0
  311. package/dist/types/index.mjs +2 -0
  312. package/dist/types/index.mjs.map +1 -0
  313. package/dist/types/suggestions.d.ts +9 -0
  314. package/dist/types/suggestions.js +19 -0
  315. package/dist/types/suggestions.js.map +1 -0
  316. package/dist/types/suggestions.mjs +1 -0
  317. package/dist/types/suggestions.mjs.map +1 -0
  318. package/dist/v2/index.css +4 -0
  319. package/dist/v2/index.css.map +1 -0
  320. package/dist/v2/index.d.ts +2 -0
  321. package/dist/v2/index.js +2 -0
  322. package/dist/v2/index.js.map +1 -0
  323. package/dist/v2/index.mjs +2 -0
  324. package/dist/v2/index.mjs.map +1 -0
  325. package/jest.config.js +5 -0
  326. package/package.json +83 -0
  327. package/postcss.config.js +60 -0
  328. package/src/components/chat/Button.tsx +18 -0
  329. package/src/components/chat/Chat.tsx +795 -0
  330. package/src/components/chat/ChatContext.tsx +248 -0
  331. package/src/components/chat/CodeBlock.tsx +418 -0
  332. package/src/components/chat/Header.tsx +24 -0
  333. package/src/components/chat/Icons.tsx +237 -0
  334. package/src/components/chat/ImageUploadQueue.tsx +77 -0
  335. package/src/components/chat/Input.tsx +156 -0
  336. package/src/components/chat/Markdown.tsx +144 -0
  337. package/src/components/chat/Messages.tsx +206 -0
  338. package/src/components/chat/Modal.tsx +220 -0
  339. package/src/components/chat/Popup.tsx +77 -0
  340. package/src/components/chat/PoweredByTag.tsx +42 -0
  341. package/src/components/chat/Sidebar.tsx +96 -0
  342. package/src/components/chat/Suggestion.tsx +29 -0
  343. package/src/components/chat/Suggestions.tsx +23 -0
  344. package/src/components/chat/Textarea.tsx +77 -0
  345. package/src/components/chat/Window.tsx +152 -0
  346. package/src/components/chat/index.tsx +11 -0
  347. package/src/components/chat/messages/AssistantMessage.tsx +118 -0
  348. package/src/components/chat/messages/ErrorMessage.tsx +59 -0
  349. package/src/components/chat/messages/ImageRenderer.tsx +37 -0
  350. package/src/components/chat/messages/LegacyRenderMessage.tsx +150 -0
  351. package/src/components/chat/messages/RenderMessage.tsx +61 -0
  352. package/src/components/chat/messages/UserMessage.tsx +46 -0
  353. package/src/components/chat/props.ts +353 -0
  354. package/src/components/dev-console/console.tsx +242 -0
  355. package/src/components/dev-console/icons.tsx +99 -0
  356. package/src/components/dev-console/index.tsx +2 -0
  357. package/src/components/dev-console/types.ts +7 -0
  358. package/src/components/dev-console/utils.ts +142 -0
  359. package/src/components/help-modal/icons.tsx +68 -0
  360. package/src/components/help-modal/index.tsx +1 -0
  361. package/src/components/help-modal/modal.tsx +101 -0
  362. package/src/components/index.ts +2 -0
  363. package/src/context/index.ts +1 -0
  364. package/src/css/animations.css +35 -0
  365. package/src/css/button.css +67 -0
  366. package/src/css/colors.css +78 -0
  367. package/src/css/console.css +166 -0
  368. package/src/css/crew.css +277 -0
  369. package/src/css/header.css +65 -0
  370. package/src/css/input.css +152 -0
  371. package/src/css/markdown.css +150 -0
  372. package/src/css/messages.css +244 -0
  373. package/src/css/panel.css +39 -0
  374. package/src/css/popup.css +22 -0
  375. package/src/css/sidebar.css +34 -0
  376. package/src/css/suggestions.css +43 -0
  377. package/src/css/window.css +60 -0
  378. package/src/hooks/index.ts +1 -0
  379. package/src/hooks/use-copilot-chat-suggestions.tsx +71 -0
  380. package/src/hooks/use-copy-to-clipboard.tsx +29 -0
  381. package/src/hooks/use-dark-mode.ts +10 -0
  382. package/src/hooks/use-push-to-talk.tsx +167 -0
  383. package/src/index.tsx +7 -0
  384. package/src/lib/utils.test.ts +7 -0
  385. package/src/lib/utils.ts +27 -0
  386. package/src/styles.css +14 -0
  387. package/src/types/css.ts +21 -0
  388. package/src/types/index.ts +2 -0
  389. package/src/types/suggestions.ts +7 -0
  390. package/src/v2/index.ts +1 -0
  391. package/src/v2/styles.css +1 -0
  392. package/tailwind.config.js +7 -0
  393. package/tsconfig.json +12 -0
  394. package/tsup.config.ts +11 -0
  395. package/typedoc.json +4 -0
@@ -0,0 +1,582 @@
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
+ var __async = (__this, __arguments, generator) => {
30
+ return new Promise((resolve, reject) => {
31
+ var fulfilled = (value) => {
32
+ try {
33
+ step(generator.next(value));
34
+ } catch (e) {
35
+ reject(e);
36
+ }
37
+ };
38
+ var rejected = (value) => {
39
+ try {
40
+ step(generator.throw(value));
41
+ } catch (e) {
42
+ reject(e);
43
+ }
44
+ };
45
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
46
+ step((generator = generator.apply(__this, __arguments)).next());
47
+ });
48
+ };
49
+
50
+ // src/components/chat/Header.tsx
51
+ var Header_exports = {};
52
+ __export(Header_exports, {
53
+ Header: () => Header
54
+ });
55
+ module.exports = __toCommonJS(Header_exports);
56
+
57
+ // src/components/chat/ChatContext.tsx
58
+ var import_react = __toESM(require("react"));
59
+
60
+ // src/components/chat/Icons.tsx
61
+ var import_jsx_runtime = require("react/jsx-runtime");
62
+ var SmallSpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitSpinner", style: { width: "13px", height: "13px" } });
63
+
64
+ // src/components/chat/ChatContext.tsx
65
+ var import_jsx_runtime2 = require("react/jsx-runtime");
66
+ var ChatContext = import_react.default.createContext(void 0);
67
+ function useChatContext() {
68
+ const context = import_react.default.useContext(ChatContext);
69
+ if (context === void 0) {
70
+ throw new Error(
71
+ "Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?"
72
+ );
73
+ }
74
+ return context;
75
+ }
76
+
77
+ // src/components/dev-console/utils.ts
78
+ var import_react_core = require("@copilotkit/react-core");
79
+ var import_react_core2 = require("@copilotkit/react-core");
80
+ function getPublishedCopilotKitVersion(current, forceCheck = false) {
81
+ return __async(this, null, function* () {
82
+ const LOCAL_STORAGE_KEY = "__copilotkit_version_check__";
83
+ const serializedVersion = localStorage.getItem(LOCAL_STORAGE_KEY);
84
+ if (serializedVersion && !forceCheck) {
85
+ try {
86
+ const parsedVersion = JSON.parse(serializedVersion);
87
+ const oneHour = 60 * 60 * 1e3;
88
+ const now = (/* @__PURE__ */ new Date()).getTime();
89
+ if (parsedVersion.current === current && now - new Date(parsedVersion.lastChecked).getTime() < oneHour) {
90
+ return parsedVersion;
91
+ }
92
+ } catch (error) {
93
+ console.error("Failed to parse CopilotKitVersion from localStorage", error);
94
+ }
95
+ }
96
+ try {
97
+ const response = yield fetch("https://api.cloud.copilotkit.ai/check-for-updates", {
98
+ method: "POST",
99
+ headers: {
100
+ "Content-Type": "application/json"
101
+ },
102
+ body: JSON.stringify({
103
+ packages: [
104
+ {
105
+ packageName: "@copilotkit/shared",
106
+ packageVersion: current
107
+ }
108
+ ]
109
+ })
110
+ });
111
+ const data = yield response.json();
112
+ const version = {
113
+ current,
114
+ lastChecked: (/* @__PURE__ */ new Date()).getTime(),
115
+ latest: data.packages[0].latestVersion,
116
+ severity: data.packages[0].severity,
117
+ advisory: data.packages[0].advisory || null
118
+ };
119
+ localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(version));
120
+ return version;
121
+ } catch (error) {
122
+ console.error("Failed to check for updates", error);
123
+ throw error;
124
+ }
125
+ });
126
+ }
127
+ function logReadables(context) {
128
+ console.log("%cCurrent Readables:", "font-size: 16px; font-weight: bold;");
129
+ const readables = context.getContextString([], import_react_core.defaultCopilotContextCategories).trim();
130
+ if (readables.length === 0) {
131
+ console.log("No readables found");
132
+ return;
133
+ }
134
+ console.log(readables);
135
+ }
136
+ function logActions(context) {
137
+ console.log("%cCurrent Actions:", "font-size: 16px; font-weight: bold;");
138
+ if (Object.values(context.actions).length === 0) {
139
+ console.log("No actions found");
140
+ return;
141
+ }
142
+ for (const action of Object.values(context.actions)) {
143
+ console.group(action.name);
144
+ console.log("name", action.name);
145
+ console.log("description", action.description);
146
+ console.log("parameters", action.parameters);
147
+ console.groupEnd();
148
+ }
149
+ }
150
+ function logMessages(context) {
151
+ console.log("%cCurrent Messages:", "font-size: 16px; font-weight: bold;");
152
+ if (context.messages.length === 0) {
153
+ console.log("No messages found");
154
+ return;
155
+ }
156
+ const tableData = context.messages.map((message) => {
157
+ if (message.isTextMessage()) {
158
+ return {
159
+ id: message.id,
160
+ type: "TextMessage",
161
+ role: message.role,
162
+ name: void 0,
163
+ scope: void 0,
164
+ content: message.content
165
+ };
166
+ } else if (message.isActionExecutionMessage()) {
167
+ return {
168
+ id: message.id,
169
+ type: "ActionExecutionMessage",
170
+ role: void 0,
171
+ name: message.name,
172
+ scope: message.parentMessageId,
173
+ content: message.arguments
174
+ };
175
+ } else if (message.isResultMessage()) {
176
+ return {
177
+ id: message.id,
178
+ type: "ResultMessage",
179
+ role: void 0,
180
+ name: message.actionName,
181
+ scope: message.actionExecutionId,
182
+ content: message.result
183
+ };
184
+ } else if (message.isAgentStateMessage()) {
185
+ return {
186
+ id: message.id,
187
+ type: `AgentStateMessage (running: ${message.running})`,
188
+ role: message.role,
189
+ name: void 0,
190
+ scope: message.threadId,
191
+ content: message.state
192
+ };
193
+ }
194
+ });
195
+ console.table(tableData);
196
+ }
197
+
198
+ // src/components/dev-console/console.tsx
199
+ var import_react_core3 = require("@copilotkit/react-core");
200
+ var import_react3 = require("react");
201
+
202
+ // src/components/dev-console/icons.tsx
203
+ var import_jsx_runtime3 = require("react/jsx-runtime");
204
+ var ExclamationMarkTriangleIcon = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
205
+ "svg",
206
+ {
207
+ width: "13.3967723px",
208
+ height: "12px",
209
+ viewBox: "0 0 13.3967723 12",
210
+ version: "1.1",
211
+ xmlns: "http://www.w3.org/2000/svg",
212
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "exclamation-triangle", fill: "#CD2121", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
213
+ "path",
214
+ {
215
+ d: "M5.39935802,0.75 C5.97670802,-0.25 7.42007802,-0.25 7.99742802,0.75 L13.193588,9.75 C13.770888,10.75 13.049288,12 11.894588,12 L1.50223802,12 C0.34753802,12 -0.37414898,10.75 0.20319802,9.75 L5.39935802,0.75 Z M6.69838802,2.5 C7.11260802,2.5 7.44838802,2.83579 7.44838802,3.25 L7.44838802,6.25 C7.44838802,6.66421 7.11260802,7 6.69838802,7 C6.28417802,7 5.94838802,6.66421 5.94838802,6.25 L5.94838802,3.25 C5.94838802,2.83579 6.28417802,2.5 6.69838802,2.5 Z M6.69838802,10.5 C7.25067802,10.5 7.69838802,10.0523 7.69838802,9.5 C7.69838802,8.9477 7.25067802,8.5 6.69838802,8.5 C6.14610802,8.5 5.69838802,8.9477 5.69838802,9.5 C5.69838802,10.0523 6.14610802,10.5 6.69838802,10.5 Z",
216
+ id: "Shape"
217
+ }
218
+ ) }) })
219
+ }
220
+ );
221
+ var ExclamationMarkIcon = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
222
+ "svg",
223
+ {
224
+ width: "14px",
225
+ height: "14px",
226
+ viewBox: "0 0 14 14",
227
+ version: "1.1",
228
+ xmlns: "http://www.w3.org/2000/svg",
229
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "exclamation-circle", fill: "#EC662C", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
230
+ "path",
231
+ {
232
+ d: "M7,14 C10.866,14 14,10.866 14,7 C14,3.13401 10.866,0 7,0 C3.13401,0 0,3.13401 0,7 C0,10.866 3.13401,14 7,14 Z M7,3 C7.41421,3 7.75,3.33579 7.75,3.75 L7.75,6.75 C7.75,7.16421 7.41421,7.5 7,7.5 C6.58579,7.5 6.25,7.16421 6.25,6.75 L6.25,3.75 C6.25,3.33579 6.58579,3 7,3 Z M7,11 C7.55228,11 8,10.5523 8,10 C8,9.4477 7.55228,9 7,9 C6.44772,9 6,9.4477 6,10 C6,10.5523 6.44772,11 7,11 Z",
233
+ id: "Shape"
234
+ }
235
+ ) }) })
236
+ }
237
+ );
238
+ var ChevronDownIcon = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
239
+ "svg",
240
+ {
241
+ width: "7px",
242
+ height: "4px",
243
+ viewBox: "0 0 7 4",
244
+ version: "1.1",
245
+ xmlns: "http://www.w3.org/2000/svg",
246
+ fill: "currentColor",
247
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "Group", fill: "currentColor", fillRule: "nonzero", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
248
+ "path",
249
+ {
250
+ d: "M3.71690723,3.90271086 C3.59268176,4.03242971 3.39143629,4.03242971 3.26721082,3.90271086 L0.0853966595,0.57605615 C-0.0314221035,0.444981627 -0.0279751448,0.240725043 0.0931934622,0.114040675 C0.214362069,-0.0126436935 0.409725445,-0.0162475626 0.535093061,0.105888951 L3.49205902,3.19746006 L6.44902499,0.105888951 C6.52834574,0.0168884389 6.64780588,-0.0197473458 6.7605411,0.0103538404 C6.87327633,0.0404550266 6.96130636,0.132492308 6.99009696,0.250359396 C7.01888756,0.368226483 6.98384687,0.493124608 6.89872139,0.57605615 L3.71690723,3.90271086 Z",
251
+ id: "Path"
252
+ }
253
+ ) }) })
254
+ }
255
+ );
256
+ var CheckIcon = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
257
+ "svg",
258
+ {
259
+ width: "14px",
260
+ height: "14px",
261
+ viewBox: "0 0 14 14",
262
+ version: "1.1",
263
+ xmlns: "http://www.w3.org/2000/svg",
264
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "Group-2", transform: "translate(-118, 0)", fill: "#1BC030", fillRule: "nonzero", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { id: "Group", transform: "translate(118, 0)", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
265
+ "path",
266
+ {
267
+ d: "M0,7 C0,3.13384615 3.13384615,0 7,0 C10.8661538,0 14,3.13384615 14,7 C14,10.8661538 10.8661538,14 7,14 C3.13384615,14 0,10.8661538 0,7 Z M9.59179487,5.69764103 C9.70905818,5.54139023 9.73249341,5.33388318 9.65303227,5.15541491 C9.57357113,4.97694665 9.40367989,4.85551619 9.20909814,4.83811118 C9.01451638,4.82070616 8.82577109,4.91005717 8.71589744,5.07158974 L6.39261538,8.32389744 L5.22666667,7.15794872 C5.01450582,6.96025518 4.68389046,6.9660885 4.47883563,7.17114332 C4.27378081,7.37619815 4.26794748,7.70681351 4.46564103,7.91897436 L6.08102564,9.53435897 C6.19289944,9.64614839 6.3482622,9.70310251 6.50588106,9.69010587 C6.66349993,9.67710922 6.80743532,9.59547613 6.89948718,9.46687179 L9.59179487,5.69764103 L9.59179487,5.69764103 Z",
268
+ id: "Shape"
269
+ }
270
+ ) }) }) })
271
+ }
272
+ );
273
+
274
+ // src/components/dev-console/console.tsx
275
+ var import_react4 = require("@headlessui/react");
276
+ var import_shared = require("@copilotkit/shared");
277
+
278
+ // src/components/help-modal/modal.tsx
279
+ var import_react2 = require("react");
280
+
281
+ // src/components/help-modal/icons.tsx
282
+ var import_jsx_runtime4 = require("react/jsx-runtime");
283
+ var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
284
+ "svg",
285
+ {
286
+ xmlns: "http://www.w3.org/2000/svg",
287
+ fill: "none",
288
+ viewBox: "0 0 24 24",
289
+ strokeWidth: "1.5",
290
+ stroke: "currentColor",
291
+ width: "20",
292
+ height: "20",
293
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
294
+ }
295
+ );
296
+
297
+ // src/components/help-modal/modal.tsx
298
+ var import_jsx_runtime5 = require("react/jsx-runtime");
299
+ function CopilotKitHelpModal() {
300
+ const [showHelpModal, setShowHelpModal] = (0, import_react2.useState)(false);
301
+ const buttonRef = (0, import_react2.useRef)(null);
302
+ const popoverRef = (0, import_react2.useRef)(null);
303
+ (0, import_react2.useEffect)(() => {
304
+ const handleClickOutside = (event) => {
305
+ if (popoverRef.current && !popoverRef.current.contains(event.target) && buttonRef.current && !buttonRef.current.contains(event.target)) {
306
+ setShowHelpModal(false);
307
+ }
308
+ };
309
+ if (showHelpModal) {
310
+ document.addEventListener("mousedown", handleClickOutside);
311
+ }
312
+ return () => {
313
+ document.removeEventListener("mousedown", handleClickOutside);
314
+ };
315
+ }, [showHelpModal]);
316
+ const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
317
+ "button",
318
+ {
319
+ ref: buttonRef,
320
+ onClick: () => setShowHelpModal(!showHelpModal),
321
+ className: "copilotKitDebugMenuTriggerButton relative",
322
+ "aria-label": "Open Help",
323
+ children: "Help"
324
+ }
325
+ );
326
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative", children: [
327
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HelpButton, {}),
328
+ showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
329
+ "div",
330
+ {
331
+ ref: popoverRef,
332
+ className: "absolute mt-2 z-50",
333
+ style: {
334
+ top: "100%",
335
+ right: "-120px",
336
+ width: "380px"
337
+ },
338
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "copilotKitHelpModal rounded-lg shadow-xl w-full p-4 flex-col relative", children: [
339
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
340
+ "button",
341
+ {
342
+ className: "copilotKitHelpModalCloseButton absolute text-gray-400 hover:text-gray-600 focus:outline-none",
343
+ style: { top: "10px", right: "10px" },
344
+ onClick: () => setShowHelpModal(false),
345
+ "aria-label": "Close",
346
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CloseIcon, {})
347
+ }
348
+ ),
349
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "w-full flex mb-6 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { className: "text-2xl font-bold", children: "Help Options" }) }),
350
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-4 mb-4", children: [
351
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
352
+ "a",
353
+ {
354
+ href: "https://docs.copilotkit.ai/coagents/troubleshooting/common-issues",
355
+ target: "_blank",
356
+ rel: "noopener noreferrer",
357
+ children: "Visit the Troubleshooting and FAQ section in the docs"
358
+ }
359
+ ) }),
360
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
361
+ "a",
362
+ {
363
+ href: "https://go.copilotkit.ai/dev-console-support-discord",
364
+ target: "_blank",
365
+ rel: "noopener noreferrer",
366
+ children: "Go to Discord Support Channel (Community Support)"
367
+ }
368
+ ) }),
369
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
370
+ "a",
371
+ {
372
+ href: "https://go.copilotkit.ai/dev-console-support-slack",
373
+ target: "_blank",
374
+ rel: "noopener noreferrer",
375
+ children: "Apply for Priority Direct Slack Support"
376
+ }
377
+ ) })
378
+ ] })
379
+ ] })
380
+ }
381
+ )
382
+ ] });
383
+ }
384
+
385
+ // src/components/dev-console/console.tsx
386
+ var import_jsx_runtime6 = require("react/jsx-runtime");
387
+ function CopilotDevConsole() {
388
+ const currentVersion = import_shared.COPILOTKIT_VERSION;
389
+ const context = (0, import_react_core3.useCopilotContext)();
390
+ const [showDevConsole, setShowDevConsole] = (0, import_react3.useState)(false);
391
+ (0, import_react3.useEffect)(() => {
392
+ setShowDevConsole((0, import_react_core2.shouldShowDevConsole)(context.showDevConsole));
393
+ }, [context.showDevConsole]);
394
+ const dontRunTwiceInDevMode = (0, import_react3.useRef)(false);
395
+ const [versionStatus, setVersionStatus] = (0, import_react3.useState)("unknown");
396
+ const [latestVersion, setLatestVersion] = (0, import_react3.useState)("");
397
+ const consoleRef = (0, import_react3.useRef)(null);
398
+ const [debugButtonMode, setDebugButtonMode] = (0, import_react3.useState)("full");
399
+ const checkForUpdates = (force = false) => {
400
+ setVersionStatus("checking");
401
+ getPublishedCopilotKitVersion(currentVersion, force).then((v) => {
402
+ setLatestVersion(v.latest);
403
+ let versionOk = false;
404
+ if (v.current === v.latest) {
405
+ versionOk = true;
406
+ } else if (/[a-zA-Z]/.test(v.current)) {
407
+ versionOk = true;
408
+ }
409
+ if (versionOk) {
410
+ setVersionStatus("latest");
411
+ } else if (v.severity !== "low") {
412
+ setVersionStatus("outdated");
413
+ } else {
414
+ setVersionStatus("update-available");
415
+ }
416
+ }).catch((e) => {
417
+ console.error(e);
418
+ setVersionStatus("unknown");
419
+ });
420
+ };
421
+ (0, import_react3.useEffect)(() => {
422
+ if (dontRunTwiceInDevMode.current === true) {
423
+ return;
424
+ }
425
+ dontRunTwiceInDevMode.current = true;
426
+ checkForUpdates();
427
+ }, []);
428
+ if (!showDevConsole) {
429
+ return null;
430
+ }
431
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
432
+ "div",
433
+ {
434
+ ref: consoleRef,
435
+ className: "copilotKitDevConsole " + (versionStatus === "update-available" ? "copilotKitDevConsoleUpgrade" : "") + (versionStatus === "outdated" ? "copilotKitDevConsoleWarnOutdated" : ""),
436
+ children: [
437
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
438
+ VersionInfo,
439
+ {
440
+ showDevConsole: context.showDevConsole,
441
+ versionStatus,
442
+ currentVersion,
443
+ latestVersion
444
+ }
445
+ ),
446
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CopilotKitHelpModal, {}),
447
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
448
+ DebugMenuButton,
449
+ {
450
+ setShowDevConsole,
451
+ checkForUpdates,
452
+ mode: debugButtonMode
453
+ }
454
+ )
455
+ ]
456
+ }
457
+ );
458
+ }
459
+ function VersionInfo({
460
+ showDevConsole,
461
+ versionStatus,
462
+ currentVersion,
463
+ latestVersion
464
+ }) {
465
+ const [copyStatus, setCopyStatus] = (0, import_react3.useState)("");
466
+ let versionLabel = "";
467
+ let versionIcon = "";
468
+ let currentVersionLabel = currentVersion;
469
+ if (versionStatus === "latest") {
470
+ versionLabel = "latest";
471
+ versionIcon = CheckIcon;
472
+ } else if (versionStatus === "checking") {
473
+ versionLabel = "checking";
474
+ versionIcon = SmallSpinnerIcon;
475
+ } else if (versionStatus === "update-available") {
476
+ versionLabel = "update available";
477
+ versionIcon = ExclamationMarkIcon;
478
+ currentVersionLabel = `${currentVersion} \u2192 ${latestVersion}`;
479
+ } else if (versionStatus === "outdated") {
480
+ versionLabel = "outdated";
481
+ versionIcon = ExclamationMarkTriangleIcon;
482
+ currentVersionLabel = `${currentVersion} \u2192 ${latestVersion}`;
483
+ }
484
+ let asideLabel = "";
485
+ if (showDevConsole === true) {
486
+ asideLabel = "(enabled)";
487
+ }
488
+ const installCommand = [
489
+ `npm install`,
490
+ `@copilotkit/react-core@${latestVersion}`,
491
+ `@copilotkit/react-ui@${latestVersion}`,
492
+ `@copilotkit/react-textarea@${latestVersion}`,
493
+ `&& npm install @copilotkit/runtime@${latestVersion}`
494
+ ].join(" ");
495
+ const handleCopyClick = () => {
496
+ navigator.clipboard.writeText(installCommand.trim()).then(() => {
497
+ setCopyStatus("Command copied to clipboard!");
498
+ setTimeout(() => setCopyStatus(""), 1e3);
499
+ });
500
+ };
501
+ if (versionStatus === "update-available" || versionStatus === "outdated") {
502
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "copilotKitVersionInfo", children: [
503
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { children: [
504
+ currentVersionLabel,
505
+ " ",
506
+ versionIcon
507
+ ] }),
508
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { onClick: handleCopyClick, children: copyStatus || installCommand })
509
+ ] });
510
+ }
511
+ return null;
512
+ }
513
+ function DebugMenuButton({
514
+ setShowDevConsole,
515
+ checkForUpdates,
516
+ mode
517
+ }) {
518
+ const context = (0, import_react_core3.useCopilotContext)();
519
+ const messagesContext = (0, import_react_core3.useCopilotMessagesContext)();
520
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react4.Menu, { children: [
521
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
522
+ import_react4.MenuButton,
523
+ {
524
+ className: `copilotKitDebugMenuTriggerButton ${mode === "compact" ? "compact" : ""}`,
525
+ children: mode == "compact" ? "Debug" : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
526
+ "Debug ",
527
+ ChevronDownIcon
528
+ ] })
529
+ }
530
+ ),
531
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
532
+ import_react4.MenuItems,
533
+ {
534
+ transition: true,
535
+ anchor: "bottom end",
536
+ className: "copilotKitDebugMenu",
537
+ style: { zIndex: 40 },
538
+ children: [
539
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react4.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logReadables(context), children: "Log Readables" }) }),
540
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react4.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logActions(context), children: "Log Actions" }) }),
541
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react4.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
542
+ "button",
543
+ {
544
+ className: "copilotKitDebugMenuItem",
545
+ onClick: () => logMessages(messagesContext),
546
+ children: "Log Messages"
547
+ }
548
+ ) }),
549
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react4.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => checkForUpdates(true), children: "Check for Updates" }) }),
550
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("hr", {}),
551
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react4.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => setShowDevConsole(false), children: "Hide Dev Console" }) })
552
+ ]
553
+ }
554
+ )
555
+ ] }) });
556
+ }
557
+
558
+ // src/components/chat/Header.tsx
559
+ var import_jsx_runtime7 = require("react/jsx-runtime");
560
+ var Header = ({}) => {
561
+ const { setOpen, icons, labels } = useChatContext();
562
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "copilotKitHeader", children: [
563
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: labels.title }),
564
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "copilotKitHeaderControls", children: [
565
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CopilotDevConsole, {}),
566
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
567
+ "button",
568
+ {
569
+ onClick: () => setOpen(false),
570
+ "aria-label": "Close",
571
+ className: "copilotKitHeaderCloseButton",
572
+ children: icons.headerCloseIcon
573
+ }
574
+ )
575
+ ] })
576
+ ] });
577
+ };
578
+ // Annotate the CommonJS export names for ESM import in node:
579
+ 0 && (module.exports = {
580
+ Header
581
+ });
582
+ //# sourceMappingURL=Header.js.map