@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,248 @@
1
+ import React, { useMemo, useState } from "react";
2
+ import * as DefaultIcons from "./Icons";
3
+ import { ThumbsDownIcon, ThumbsUpIcon } from "./Icons";
4
+
5
+ /**
6
+ * Icons for CopilotChat component.
7
+ */
8
+ export interface CopilotChatIcons {
9
+ /**
10
+ * The icon to use for the open chat button.
11
+ * @default <OpenIcon />
12
+ */
13
+ openIcon?: React.ReactNode;
14
+
15
+ /**
16
+ * The icon to use for the close chat button.
17
+ * @default <CloseIcon />
18
+ */
19
+ closeIcon?: React.ReactNode;
20
+
21
+ /**
22
+ * The icon to use for the close chat button in the header.
23
+ * @default <HeaderCloseIcon />
24
+ */
25
+ headerCloseIcon?: React.ReactNode;
26
+
27
+ /**
28
+ * The icon to use for the send button.
29
+ * @default <SendIcon />
30
+ */
31
+ sendIcon?: React.ReactNode;
32
+
33
+ /**
34
+ * The icon to use for the activity indicator.
35
+ * @default <ActivityIcon />
36
+ */
37
+ activityIcon?: React.ReactNode;
38
+
39
+ /**
40
+ * The icon to use for the spinner.
41
+ * @default <SpinnerIcon />
42
+ */
43
+ spinnerIcon?: React.ReactNode;
44
+
45
+ /**
46
+ * The icon to use for the stop button.
47
+ * @default <StopIcon />
48
+ */
49
+ stopIcon?: React.ReactNode;
50
+
51
+ /**
52
+ * The icon to use for the regenerate button.
53
+ * @default <RegenerateIcon />
54
+ */
55
+ regenerateIcon?: React.ReactNode;
56
+
57
+ /**
58
+ * The icons to use for push to talk.
59
+ * @default <PushToTalkIcon />
60
+ */
61
+
62
+ pushToTalkIcon?: React.ReactNode;
63
+
64
+ /**
65
+ * The icons to use for copy assistant response
66
+ * @default <CopyIcon />
67
+ */
68
+
69
+ copyIcon?: React.ReactNode;
70
+
71
+ /**
72
+ * The icon to use for thumbs up/response approval.
73
+ * @default <ThumbsUpIcon />
74
+ */
75
+
76
+ thumbsUpIcon?: React.ReactNode;
77
+
78
+ /**
79
+ * The icon to use for thumbs down/response rejection.
80
+ * @default <ThumbsDownIcon />
81
+ */
82
+
83
+ thumbsDownIcon?: React.ReactNode;
84
+
85
+ /**
86
+ * The icon to use for the upload button.
87
+ * @default <UploadIcon />
88
+ */
89
+ uploadIcon?: React.ReactNode;
90
+ }
91
+
92
+ /**
93
+ * Labels for CopilotChat component.
94
+ */
95
+ export interface CopilotChatLabels {
96
+ /**
97
+ * The initial message(s) to display in the chat window.
98
+ */
99
+ initial?: string | string[];
100
+
101
+ /**
102
+ * The title to display in the header.
103
+ * @default "CopilotKit"
104
+ */
105
+ title?: string;
106
+
107
+ /**
108
+ * The placeholder to display in the input.
109
+ * @default "Type a message..."
110
+ */
111
+ placeholder?: string;
112
+
113
+ /**
114
+ * The message to display when an error occurs.
115
+ * @default "❌ An error occurred. Please try again."
116
+ */
117
+ error?: string;
118
+
119
+ /**
120
+ * The label to display on the stop button.
121
+ * @default "Stop generating"
122
+ */
123
+ stopGenerating?: string;
124
+
125
+ /**
126
+ * The label to display on the regenerate button.
127
+ * @default "Regenerate response"
128
+ */
129
+ regenerateResponse?: string;
130
+
131
+ /**
132
+ * The label for the copy button.
133
+ * @default "Copy to clipboard"
134
+ */
135
+ copyToClipboard?: string;
136
+
137
+ /**
138
+ * The label for the thumbs up button.
139
+ * @default "Thumbs up"
140
+ */
141
+ thumbsUp?: string;
142
+
143
+ /**
144
+ * The label for the thumbs down button.
145
+ * @default "Thumbs down"
146
+ */
147
+ thumbsDown?: string;
148
+
149
+ /**
150
+ * The text to display when content is copied.
151
+ * @default "Copied!"
152
+ */
153
+ copied?: string;
154
+ }
155
+
156
+ interface ChatContext {
157
+ labels: Required<CopilotChatLabels>;
158
+ icons: Required<CopilotChatIcons>;
159
+ open: boolean;
160
+ setOpen: (open: boolean) => void;
161
+ }
162
+
163
+ export const ChatContext = React.createContext<ChatContext | undefined>(undefined);
164
+
165
+ export function useChatContext(): ChatContext {
166
+ const context = React.useContext(ChatContext);
167
+ if (context === undefined) {
168
+ throw new Error(
169
+ "Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?",
170
+ );
171
+ }
172
+ return context;
173
+ }
174
+
175
+ interface ChatContextProps {
176
+ // temperature?: number;
177
+ // instructions?: string;
178
+ // maxFeedback?: number;
179
+ labels?: CopilotChatLabels;
180
+ icons?: CopilotChatIcons;
181
+ children?: React.ReactNode;
182
+ open: boolean;
183
+ setOpen: (open: boolean) => void;
184
+ }
185
+
186
+ export const ChatContextProvider = ({
187
+ // temperature,
188
+ // instructions,
189
+ // maxFeedback,
190
+ labels,
191
+ icons,
192
+ children,
193
+ open,
194
+ setOpen,
195
+ }: ChatContextProps) => {
196
+ const memoizedLabels = useMemo(
197
+ () => ({
198
+ ...{
199
+ initial: "",
200
+ title: "CopilotKit",
201
+ placeholder: "Type a message...",
202
+ error: "❌ An error occurred. Please try again.",
203
+ stopGenerating: "Stop generating",
204
+ regenerateResponse: "Regenerate response",
205
+ copyToClipboard: "Copy to clipboard",
206
+ thumbsUp: "Thumbs up",
207
+ thumbsDown: "Thumbs down",
208
+ copied: "Copied!",
209
+ },
210
+ ...labels,
211
+ }),
212
+ [labels],
213
+ );
214
+
215
+ const memoizedIcons = useMemo(
216
+ () => ({
217
+ ...{
218
+ openIcon: DefaultIcons.OpenIcon,
219
+ closeIcon: DefaultIcons.CloseIcon,
220
+ headerCloseIcon: DefaultIcons.HeaderCloseIcon,
221
+ sendIcon: DefaultIcons.SendIcon,
222
+ activityIcon: DefaultIcons.ActivityIcon,
223
+ spinnerIcon: DefaultIcons.SpinnerIcon,
224
+ stopIcon: DefaultIcons.StopIcon,
225
+ regenerateIcon: DefaultIcons.RegenerateIcon,
226
+ pushToTalkIcon: DefaultIcons.MicrophoneIcon,
227
+ copyIcon: DefaultIcons.CopyIcon,
228
+ thumbsUpIcon: DefaultIcons.ThumbsUpIcon,
229
+ thumbsDownIcon: DefaultIcons.ThumbsDownIcon,
230
+ uploadIcon: DefaultIcons.UploadIcon,
231
+ },
232
+ ...icons,
233
+ }),
234
+ [icons],
235
+ );
236
+
237
+ const context = useMemo(
238
+ () => ({
239
+ labels: memoizedLabels,
240
+ icons: memoizedIcons,
241
+ open,
242
+ setOpen,
243
+ }),
244
+ [memoizedLabels, memoizedIcons, open, setOpen],
245
+ );
246
+
247
+ return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;
248
+ };
@@ -0,0 +1,418 @@
1
+ import { FC, memo, useEffect, useState } from "react";
2
+ import { Prism, Light } from "react-syntax-highlighter";
3
+ import { useCopyToClipboard } from "../../hooks/use-copy-to-clipboard";
4
+ import { CheckIcon, CopyIcon, DownloadIcon } from "./Icons";
5
+
6
+ interface CodeActionButtonProps {
7
+ onClick: () => void;
8
+ children: React.ReactNode;
9
+ }
10
+
11
+ interface Props {
12
+ language: string;
13
+ value: string;
14
+ }
15
+
16
+ interface languageMap {
17
+ [key: string]: string | undefined;
18
+ }
19
+
20
+ export const programmingLanguages: languageMap = {
21
+ javascript: ".js",
22
+ python: ".py",
23
+ java: ".java",
24
+ c: ".c",
25
+ cpp: ".cpp",
26
+ "c++": ".cpp",
27
+ "c#": ".cs",
28
+ ruby: ".rb",
29
+ php: ".php",
30
+ swift: ".swift",
31
+ "objective-c": ".m",
32
+ kotlin: ".kt",
33
+ typescript: ".ts",
34
+ go: ".go",
35
+ perl: ".pl",
36
+ rust: ".rs",
37
+ scala: ".scala",
38
+ haskell: ".hs",
39
+ lua: ".lua",
40
+ shell: ".sh",
41
+ sql: ".sql",
42
+ html: ".html",
43
+ css: ".css",
44
+ // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component
45
+ };
46
+
47
+ export const generateRandomString = (length: number, lowercase = false) => {
48
+ const chars = "ABCDEFGHJKLMNPQRSTUVWXY3456789"; // excluding similar looking characters like Z, 2, I, 1, O, 0
49
+ let result = "";
50
+ for (let i = 0; i < length; i++) {
51
+ result += chars.charAt(Math.floor(Math.random() * chars.length));
52
+ }
53
+ return lowercase ? result.toLowerCase() : result;
54
+ };
55
+
56
+ const CodeBlock: FC<Props> = memo(({ language, value }) => {
57
+ const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2000 });
58
+ const [SyntaxHighlighter, setSyntaxHighlighter] = useState<typeof Light | typeof Prism>(
59
+ () => Light,
60
+ );
61
+
62
+ useEffect(() => {
63
+ try {
64
+ new RegExp("(?<=#)\\w+");
65
+ setSyntaxHighlighter(() => Prism);
66
+ } catch {
67
+ setSyntaxHighlighter(() => Light);
68
+ }
69
+ }, []);
70
+
71
+ const downloadAsFile = () => {
72
+ if (typeof window === "undefined") {
73
+ return;
74
+ }
75
+ const fileExtension = programmingLanguages[language] || ".file";
76
+ const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;
77
+ const fileName = window.prompt("Enter file name", suggestedFileName);
78
+
79
+ if (!fileName) {
80
+ // User pressed cancel on prompt.
81
+ return;
82
+ }
83
+
84
+ const blob = new Blob([value], { type: "text/plain" });
85
+ const url = URL.createObjectURL(blob);
86
+ const link = document.createElement("a");
87
+ link.download = fileName;
88
+ link.href = url;
89
+ link.style.display = "none";
90
+ document.body.appendChild(link);
91
+ link.click();
92
+ document.body.removeChild(link);
93
+ URL.revokeObjectURL(url);
94
+ };
95
+
96
+ const onCopy = () => {
97
+ if (isCopied) return;
98
+ copyToClipboard(value);
99
+ };
100
+
101
+ return (
102
+ <div className="copilotKitCodeBlock">
103
+ <div className="copilotKitCodeBlockToolbar">
104
+ <span className="copilotKitCodeBlockToolbarLanguage">{language}</span>
105
+ <div className="copilotKitCodeBlockToolbarButtons">
106
+ <button className="copilotKitCodeBlockToolbarButton" onClick={downloadAsFile}>
107
+ {DownloadIcon}
108
+ </button>
109
+ <button className="copilotKitCodeBlockToolbarButton" onClick={onCopy}>
110
+ {isCopied ? CheckIcon : CopyIcon}
111
+ </button>
112
+ </div>
113
+ </div>
114
+ <SyntaxHighlighter
115
+ language={language}
116
+ style={highlightStyle}
117
+ PreTag="div"
118
+ customStyle={{
119
+ margin: 0,
120
+ borderBottomLeftRadius: "0.375rem",
121
+ borderBottomRightRadius: "0.375rem",
122
+ }}
123
+ >
124
+ {value}
125
+ </SyntaxHighlighter>
126
+ </div>
127
+ );
128
+ });
129
+ CodeBlock.displayName = "CodeBlock";
130
+
131
+ export { CodeBlock };
132
+
133
+ // import { vscDarkPlus as highlightStyle } from "react-syntax-highlighter/dist/esm/styles/prism";
134
+ // As a workaround, we inline the vscDarkPlus from react-syntax-highlighter.
135
+ // Importing it as recommended in the documentation leads to build errors in the non app router
136
+ // (Next.js classic) setup.
137
+ const highlightStyle: any = {
138
+ 'pre[class*="language-"]': {
139
+ color: "#d4d4d4",
140
+ fontSize: "13px",
141
+ textShadow: "none",
142
+ fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
143
+ direction: "ltr",
144
+ textAlign: "left",
145
+ whiteSpace: "pre",
146
+ wordSpacing: "normal",
147
+ wordBreak: "normal",
148
+ lineHeight: "1.5",
149
+ MozTabSize: "4",
150
+ OTabSize: "4",
151
+ tabSize: "4",
152
+ WebkitHyphens: "none",
153
+ MozHyphens: "none",
154
+ msHyphens: "none",
155
+ hyphens: "none",
156
+ padding: "1em",
157
+ margin: ".5em 0",
158
+ overflow: "auto",
159
+ background: "#1e1e1e",
160
+ },
161
+ 'code[class*="language-"]': {
162
+ color: "#d4d4d4",
163
+ fontSize: "13px",
164
+ textShadow: "none",
165
+ fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
166
+ direction: "ltr",
167
+ textAlign: "left",
168
+ whiteSpace: "pre",
169
+ wordSpacing: "normal",
170
+ wordBreak: "normal",
171
+ lineHeight: "1.5",
172
+ MozTabSize: "4",
173
+ OTabSize: "4",
174
+ tabSize: "4",
175
+ WebkitHyphens: "none",
176
+ MozHyphens: "none",
177
+ msHyphens: "none",
178
+ hyphens: "none",
179
+ },
180
+ 'pre[class*="language-"]::selection': {
181
+ textShadow: "none",
182
+ background: "#264F78",
183
+ },
184
+ 'code[class*="language-"]::selection': {
185
+ textShadow: "none",
186
+ background: "#264F78",
187
+ },
188
+ 'pre[class*="language-"] *::selection': {
189
+ textShadow: "none",
190
+ background: "#264F78",
191
+ },
192
+ 'code[class*="language-"] *::selection': {
193
+ textShadow: "none",
194
+ background: "#264F78",
195
+ },
196
+ ':not(pre) > code[class*="language-"]': {
197
+ padding: ".1em .3em",
198
+ borderRadius: ".3em",
199
+ color: "#db4c69",
200
+ background: "#1e1e1e",
201
+ },
202
+ ".namespace": {
203
+ Opacity: ".7",
204
+ },
205
+ "doctype.doctype-tag": {
206
+ color: "#569CD6",
207
+ },
208
+ "doctype.name": {
209
+ color: "#9cdcfe",
210
+ },
211
+ comment: {
212
+ color: "#6a9955",
213
+ },
214
+ prolog: {
215
+ color: "#6a9955",
216
+ },
217
+ punctuation: {
218
+ color: "#d4d4d4",
219
+ },
220
+ ".language-html .language-css .token.punctuation": {
221
+ color: "#d4d4d4",
222
+ },
223
+ ".language-html .language-javascript .token.punctuation": {
224
+ color: "#d4d4d4",
225
+ },
226
+ property: {
227
+ color: "#9cdcfe",
228
+ },
229
+ tag: {
230
+ color: "#569cd6",
231
+ },
232
+ boolean: {
233
+ color: "#569cd6",
234
+ },
235
+ number: {
236
+ color: "#b5cea8",
237
+ },
238
+ constant: {
239
+ color: "#9cdcfe",
240
+ },
241
+ symbol: {
242
+ color: "#b5cea8",
243
+ },
244
+ inserted: {
245
+ color: "#b5cea8",
246
+ },
247
+ unit: {
248
+ color: "#b5cea8",
249
+ },
250
+ selector: {
251
+ color: "#d7ba7d",
252
+ },
253
+ "attr-name": {
254
+ color: "#9cdcfe",
255
+ },
256
+ string: {
257
+ color: "#ce9178",
258
+ },
259
+ char: {
260
+ color: "#ce9178",
261
+ },
262
+ builtin: {
263
+ color: "#ce9178",
264
+ },
265
+ deleted: {
266
+ color: "#ce9178",
267
+ },
268
+ ".language-css .token.string.url": {
269
+ textDecoration: "underline",
270
+ },
271
+ operator: {
272
+ color: "#d4d4d4",
273
+ },
274
+ entity: {
275
+ color: "#569cd6",
276
+ },
277
+ "operator.arrow": {
278
+ color: "#569CD6",
279
+ },
280
+ atrule: {
281
+ color: "#ce9178",
282
+ },
283
+ "atrule.rule": {
284
+ color: "#c586c0",
285
+ },
286
+ "atrule.url": {
287
+ color: "#9cdcfe",
288
+ },
289
+ "atrule.url.function": {
290
+ color: "#dcdcaa",
291
+ },
292
+ "atrule.url.punctuation": {
293
+ color: "#d4d4d4",
294
+ },
295
+ keyword: {
296
+ color: "#569CD6",
297
+ },
298
+ "keyword.module": {
299
+ color: "#c586c0",
300
+ },
301
+ "keyword.control-flow": {
302
+ color: "#c586c0",
303
+ },
304
+ function: {
305
+ color: "#dcdcaa",
306
+ },
307
+ "function.maybe-class-name": {
308
+ color: "#dcdcaa",
309
+ },
310
+ regex: {
311
+ color: "#d16969",
312
+ },
313
+ important: {
314
+ color: "#569cd6",
315
+ },
316
+ italic: {
317
+ fontStyle: "italic",
318
+ },
319
+ "class-name": {
320
+ color: "#4ec9b0",
321
+ },
322
+ "maybe-class-name": {
323
+ color: "#4ec9b0",
324
+ },
325
+ console: {
326
+ color: "#9cdcfe",
327
+ },
328
+ parameter: {
329
+ color: "#9cdcfe",
330
+ },
331
+ interpolation: {
332
+ color: "#9cdcfe",
333
+ },
334
+ "punctuation.interpolation-punctuation": {
335
+ color: "#569cd6",
336
+ },
337
+ variable: {
338
+ color: "#9cdcfe",
339
+ },
340
+ "imports.maybe-class-name": {
341
+ color: "#9cdcfe",
342
+ },
343
+ "exports.maybe-class-name": {
344
+ color: "#9cdcfe",
345
+ },
346
+ escape: {
347
+ color: "#d7ba7d",
348
+ },
349
+ "tag.punctuation": {
350
+ color: "#808080",
351
+ },
352
+ cdata: {
353
+ color: "#808080",
354
+ },
355
+ "attr-value": {
356
+ color: "#ce9178",
357
+ },
358
+ "attr-value.punctuation": {
359
+ color: "#ce9178",
360
+ },
361
+ "attr-value.punctuation.attr-equals": {
362
+ color: "#d4d4d4",
363
+ },
364
+ namespace: {
365
+ color: "#4ec9b0",
366
+ },
367
+ 'pre[class*="language-javascript"]': {
368
+ color: "#9cdcfe",
369
+ },
370
+ 'code[class*="language-javascript"]': {
371
+ color: "#9cdcfe",
372
+ },
373
+ 'pre[class*="language-jsx"]': {
374
+ color: "#9cdcfe",
375
+ },
376
+ 'code[class*="language-jsx"]': {
377
+ color: "#9cdcfe",
378
+ },
379
+ 'pre[class*="language-typescript"]': {
380
+ color: "#9cdcfe",
381
+ },
382
+ 'code[class*="language-typescript"]': {
383
+ color: "#9cdcfe",
384
+ },
385
+ 'pre[class*="language-tsx"]': {
386
+ color: "#9cdcfe",
387
+ },
388
+ 'code[class*="language-tsx"]': {
389
+ color: "#9cdcfe",
390
+ },
391
+ 'pre[class*="language-css"]': {
392
+ color: "#ce9178",
393
+ },
394
+ 'code[class*="language-css"]': {
395
+ color: "#ce9178",
396
+ },
397
+ 'pre[class*="language-html"]': {
398
+ color: "#d4d4d4",
399
+ },
400
+ 'code[class*="language-html"]': {
401
+ color: "#d4d4d4",
402
+ },
403
+ ".language-regex .token.anchor": {
404
+ color: "#dcdcaa",
405
+ },
406
+ ".language-html .token.punctuation": {
407
+ color: "#808080",
408
+ },
409
+ 'pre[class*="language-"] > code[class*="language-"]': {
410
+ position: "relative",
411
+ zIndex: "1",
412
+ },
413
+ ".line-highlight.line-highlight": {
414
+ background: "#f7ebc6",
415
+ boxShadow: "inset 5px 0 0 #f7d87c",
416
+ zIndex: "0",
417
+ },
418
+ };
@@ -0,0 +1,24 @@
1
+ import { HeaderProps } from "./props";
2
+ import { useChatContext } from "./ChatContext";
3
+ import { CopilotDevConsole } from "../dev-console";
4
+ import React from "react";
5
+
6
+ export const Header = ({}: HeaderProps) => {
7
+ const { setOpen, icons, labels } = useChatContext();
8
+
9
+ return (
10
+ <div className="copilotKitHeader">
11
+ <div>{labels.title}</div>
12
+ <div className="copilotKitHeaderControls">
13
+ <CopilotDevConsole />
14
+ <button
15
+ onClick={() => setOpen(false)}
16
+ aria-label="Close"
17
+ className="copilotKitHeaderCloseButton"
18
+ >
19
+ {icons.headerCloseIcon}
20
+ </button>
21
+ </div>
22
+ </div>
23
+ );
24
+ };