@copilotkit/react-ui 1.51.4-next.7 → 1.51.4-next.8

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 (226) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +18 -12
  3. package/dist/{chunk-O72ZB5V3.mjs → chunk-2QEDCM6H.mjs} +22 -12
  4. package/dist/chunk-2QEDCM6H.mjs.map +1 -0
  5. package/dist/{chunk-54JAUBUJ.mjs → chunk-6SMTHXVA.mjs} +4 -2
  6. package/dist/chunk-6SMTHXVA.mjs.map +1 -0
  7. package/dist/{chunk-IEMQ2SQW.mjs → chunk-6TLDRWAD.mjs} +5 -3
  8. package/dist/{chunk-IEMQ2SQW.mjs.map → chunk-6TLDRWAD.mjs.map} +1 -1
  9. package/dist/{chunk-UFN2VWSR.mjs → chunk-72FQQMQ2.mjs} +2 -2
  10. package/dist/chunk-72FQQMQ2.mjs.map +1 -0
  11. package/dist/{chunk-ELGRNEAO.mjs → chunk-AOUHT4JR.mjs} +4 -2
  12. package/dist/chunk-AOUHT4JR.mjs.map +1 -0
  13. package/dist/{chunk-C3GSYRC3.mjs → chunk-BNJX66OH.mjs} +2 -2
  14. package/dist/{chunk-NRA3CFEE.mjs → chunk-C27LZFA5.mjs} +2 -2
  15. package/dist/{chunk-FFJHOZX6.mjs → chunk-C7WM7GM3.mjs} +44 -11
  16. package/dist/chunk-C7WM7GM3.mjs.map +1 -0
  17. package/dist/{chunk-6TWQUA2Q.mjs → chunk-CNIC5HO5.mjs} +8 -3
  18. package/dist/chunk-CNIC5HO5.mjs.map +1 -0
  19. package/dist/chunk-CQCXH5LY.mjs +143 -0
  20. package/dist/chunk-CQCXH5LY.mjs.map +1 -0
  21. package/dist/{chunk-RYUCX3ZK.mjs → chunk-DM2V5WTG.mjs} +4 -2
  22. package/dist/chunk-DM2V5WTG.mjs.map +1 -0
  23. package/dist/{chunk-JZ3RFQQ6.mjs → chunk-DSHTRV2R.mjs} +16 -4
  24. package/dist/chunk-DSHTRV2R.mjs.map +1 -0
  25. package/dist/{chunk-GDSZGYCE.mjs → chunk-EACIYBQH.mjs} +3 -3
  26. package/dist/{chunk-XWG3L6QC.mjs → chunk-GBAPANZE.mjs} +76 -11
  27. package/dist/chunk-GBAPANZE.mjs.map +1 -0
  28. package/dist/{chunk-Q5V6S67N.mjs → chunk-GFE5ZSPV.mjs} +15 -6
  29. package/dist/chunk-GFE5ZSPV.mjs.map +1 -0
  30. package/dist/{chunk-VHKHX7GV.mjs → chunk-HHLX4MQN.mjs} +2 -2
  31. package/dist/{chunk-WNX755OE.mjs → chunk-ICA2EXIX.mjs} +7 -4
  32. package/dist/chunk-ICA2EXIX.mjs.map +1 -0
  33. package/dist/{chunk-QIOJXTIQ.mjs → chunk-IWOCQACI.mjs} +12 -3
  34. package/dist/chunk-IWOCQACI.mjs.map +1 -0
  35. package/dist/{chunk-BH6PCAAL.mjs → chunk-JYHRHKV5.mjs} +12 -3
  36. package/dist/chunk-JYHRHKV5.mjs.map +1 -0
  37. package/dist/{chunk-IK2BPURM.mjs → chunk-LIXN3OVQ.mjs} +12 -7
  38. package/dist/chunk-LIXN3OVQ.mjs.map +1 -0
  39. package/dist/{chunk-PD36EMOZ.mjs → chunk-MC6PY7XH.mjs} +75 -54
  40. package/dist/chunk-MC6PY7XH.mjs.map +1 -0
  41. package/dist/{chunk-LYYDXL2G.mjs → chunk-OQWEOBRX.mjs} +3 -3
  42. package/dist/chunk-OQWEOBRX.mjs.map +1 -0
  43. package/dist/{chunk-LBR23XXF.mjs → chunk-P34CL4LC.mjs} +4 -4
  44. package/dist/{chunk-F2CDEOFX.mjs → chunk-PF3QBO7V.mjs} +2 -2
  45. package/dist/chunk-PF3QBO7V.mjs.map +1 -0
  46. package/dist/{chunk-7CMZ7YPQ.mjs → chunk-PP2A5RP6.mjs} +2 -2
  47. package/dist/{chunk-7CMZ7YPQ.mjs.map → chunk-PP2A5RP6.mjs.map} +1 -1
  48. package/dist/{chunk-RKQM2AE5.mjs → chunk-Q64GLWPQ.mjs} +2 -2
  49. package/dist/{chunk-RKQM2AE5.mjs.map → chunk-Q64GLWPQ.mjs.map} +1 -1
  50. package/dist/{chunk-OHGUQZJT.mjs → chunk-T4NNQG6T.mjs} +50 -41
  51. package/dist/chunk-T4NNQG6T.mjs.map +1 -0
  52. package/dist/{chunk-DBKRAOH7.mjs → chunk-TGM5PKBF.mjs} +16 -6
  53. package/dist/chunk-TGM5PKBF.mjs.map +1 -0
  54. package/dist/{chunk-JY2CSDKN.mjs → chunk-YDJ4YUUF.mjs} +22 -16
  55. package/dist/chunk-YDJ4YUUF.mjs.map +1 -0
  56. package/dist/components/chat/Button.js +3 -1
  57. package/dist/components/chat/Button.js.map +1 -1
  58. package/dist/components/chat/Button.mjs +3 -3
  59. package/dist/components/chat/Chat.js +285 -132
  60. package/dist/components/chat/Chat.js.map +1 -1
  61. package/dist/components/chat/Chat.mjs +18 -18
  62. package/dist/components/chat/ChatContext.js +63 -9
  63. package/dist/components/chat/ChatContext.js.map +1 -1
  64. package/dist/components/chat/ChatContext.mjs +2 -2
  65. package/dist/components/chat/CodeBlock.js +20 -6
  66. package/dist/components/chat/CodeBlock.js.map +1 -1
  67. package/dist/components/chat/CodeBlock.mjs +3 -3
  68. package/dist/components/chat/Header.js +88 -28
  69. package/dist/components/chat/Header.js.map +1 -1
  70. package/dist/components/chat/Header.mjs +8 -8
  71. package/dist/components/chat/Icons.js +75 -10
  72. package/dist/components/chat/Icons.js.map +1 -1
  73. package/dist/components/chat/Icons.mjs +1 -1
  74. package/dist/components/chat/Input.js +90 -62
  75. package/dist/components/chat/Input.js.map +1 -1
  76. package/dist/components/chat/Input.mjs +6 -6
  77. package/dist/components/chat/Markdown.js +34 -8
  78. package/dist/components/chat/Markdown.js.map +1 -1
  79. package/dist/components/chat/Markdown.mjs +4 -4
  80. package/dist/components/chat/Messages.js +59 -16
  81. package/dist/components/chat/Messages.js.map +1 -1
  82. package/dist/components/chat/Messages.mjs +11 -11
  83. package/dist/components/chat/Modal.js +403 -189
  84. package/dist/components/chat/Modal.js.map +1 -1
  85. package/dist/components/chat/Modal.mjs +27 -27
  86. package/dist/components/chat/Popup.js +403 -189
  87. package/dist/components/chat/Popup.js.map +1 -1
  88. package/dist/components/chat/Popup.mjs +28 -28
  89. package/dist/components/chat/PoweredByTag.d.ts +1 -1
  90. package/dist/components/chat/PoweredByTag.js +3 -1
  91. package/dist/components/chat/PoweredByTag.js.map +1 -1
  92. package/dist/components/chat/PoweredByTag.mjs +1 -1
  93. package/dist/components/chat/Sidebar.js +403 -189
  94. package/dist/components/chat/Sidebar.js.map +1 -1
  95. package/dist/components/chat/Sidebar.mjs +28 -28
  96. package/dist/components/chat/Suggestion.d.ts +1 -1
  97. package/dist/components/chat/Suggestion.js +13 -2
  98. package/dist/components/chat/Suggestion.js.map +1 -1
  99. package/dist/components/chat/Suggestion.mjs +2 -2
  100. package/dist/components/chat/Suggestions.js +13 -2
  101. package/dist/components/chat/Suggestions.js.map +1 -1
  102. package/dist/components/chat/Suggestions.mjs +3 -3
  103. package/dist/components/chat/Textarea.js +4 -1
  104. package/dist/components/chat/Textarea.js.map +1 -1
  105. package/dist/components/chat/Textarea.mjs +1 -1
  106. package/dist/components/chat/Window.js +3 -1
  107. package/dist/components/chat/Window.js.map +1 -1
  108. package/dist/components/chat/Window.mjs +3 -3
  109. package/dist/components/chat/index.js +403 -189
  110. package/dist/components/chat/index.js.map +1 -1
  111. package/dist/components/chat/index.mjs +29 -29
  112. package/dist/components/chat/messages/AssistantMessage.js +37 -9
  113. package/dist/components/chat/messages/AssistantMessage.js.map +1 -1
  114. package/dist/components/chat/messages/AssistantMessage.mjs +6 -6
  115. package/dist/components/chat/messages/ErrorMessage.js +65 -31
  116. package/dist/components/chat/messages/ErrorMessage.js.map +1 -1
  117. package/dist/components/chat/messages/ErrorMessage.mjs +33 -27
  118. package/dist/components/chat/messages/ErrorMessage.mjs.map +1 -1
  119. package/dist/components/chat/messages/ImageRenderer.js +15 -5
  120. package/dist/components/chat/messages/ImageRenderer.js.map +1 -1
  121. package/dist/components/chat/messages/ImageRenderer.mjs +1 -1
  122. package/dist/components/chat/messages/LegacyRenderMessage.js +55 -15
  123. package/dist/components/chat/messages/LegacyRenderMessage.js.map +1 -1
  124. package/dist/components/chat/messages/LegacyRenderMessage.mjs +10 -10
  125. package/dist/components/chat/messages/RenderMessage.js +55 -15
  126. package/dist/components/chat/messages/RenderMessage.js.map +1 -1
  127. package/dist/components/chat/messages/RenderMessage.mjs +9 -9
  128. package/dist/components/chat/messages/UserMessage.js +3 -1
  129. package/dist/components/chat/messages/UserMessage.js.map +1 -1
  130. package/dist/components/chat/messages/UserMessage.mjs +1 -1
  131. package/dist/components/chat/props.js.map +1 -1
  132. package/dist/components/dev-console/console.js +85 -27
  133. package/dist/components/dev-console/console.js.map +1 -1
  134. package/dist/components/dev-console/console.mjs +6 -6
  135. package/dist/components/dev-console/icons.js +14 -5
  136. package/dist/components/dev-console/icons.js.map +1 -1
  137. package/dist/components/dev-console/icons.mjs +1 -1
  138. package/dist/components/dev-console/index.js +85 -27
  139. package/dist/components/dev-console/index.js.map +1 -1
  140. package/dist/components/dev-console/index.mjs +6 -6
  141. package/dist/components/dev-console/utils.js +21 -15
  142. package/dist/components/dev-console/utils.js.map +1 -1
  143. package/dist/components/dev-console/utils.mjs +1 -1
  144. package/dist/components/help-modal/icons.d.ts +1 -1
  145. package/dist/components/help-modal/icons.js +11 -2
  146. package/dist/components/help-modal/icons.js.map +1 -1
  147. package/dist/components/help-modal/icons.mjs +1 -1
  148. package/dist/components/help-modal/index.js +8 -1
  149. package/dist/components/help-modal/index.js.map +1 -1
  150. package/dist/components/help-modal/index.mjs +2 -2
  151. package/dist/components/help-modal/modal.js +8 -1
  152. package/dist/components/help-modal/modal.js.map +1 -1
  153. package/dist/components/help-modal/modal.mjs +2 -2
  154. package/dist/components/index.js +403 -189
  155. package/dist/components/index.js.map +1 -1
  156. package/dist/components/index.mjs +29 -29
  157. package/dist/hooks/use-copy-to-clipboard.d.ts +1 -1
  158. package/dist/hooks/use-copy-to-clipboard.js +3 -1
  159. package/dist/hooks/use-copy-to-clipboard.js.map +1 -1
  160. package/dist/hooks/use-copy-to-clipboard.mjs +1 -1
  161. package/dist/hooks/use-push-to-talk.js +17 -10
  162. package/dist/hooks/use-push-to-talk.js.map +1 -1
  163. package/dist/hooks/use-push-to-talk.mjs +1 -1
  164. package/dist/index.js +403 -189
  165. package/dist/index.js.map +1 -1
  166. package/dist/index.mjs +34 -34
  167. package/dist/index.umd.js.map +1 -1
  168. package/dist/lib/utils.js.map +1 -1
  169. package/dist/lib/utils.mjs.map +1 -1
  170. package/package.json +4 -5
  171. package/src/components/chat/Button.tsx +6 -2
  172. package/src/components/chat/Chat.tsx +75 -48
  173. package/src/components/chat/ChatContext.tsx +6 -2
  174. package/src/components/chat/CodeBlock.tsx +11 -6
  175. package/src/components/chat/Icons.tsx +45 -10
  176. package/src/components/chat/Input.tsx +30 -7
  177. package/src/components/chat/Markdown.tsx +12 -3
  178. package/src/components/chat/Messages.tsx +24 -8
  179. package/src/components/chat/Modal.tsx +12 -2
  180. package/src/components/chat/Popup.tsx +3 -1
  181. package/src/components/chat/PoweredByTag.tsx +5 -1
  182. package/src/components/chat/Sidebar.tsx +3 -1
  183. package/src/components/chat/Suggestion.tsx +6 -1
  184. package/src/components/chat/Textarea.tsx +15 -3
  185. package/src/components/chat/messages/AssistantMessage.tsx +12 -4
  186. package/src/components/chat/messages/ErrorMessage.tsx +3 -1
  187. package/src/components/chat/messages/ImageRenderer.tsx +17 -5
  188. package/src/components/chat/messages/LegacyRenderMessage.tsx +4 -1
  189. package/src/components/chat/messages/UserMessage.tsx +12 -4
  190. package/src/components/chat/props.ts +13 -3
  191. package/src/components/dev-console/console.tsx +35 -9
  192. package/src/components/dev-console/icons.tsx +6 -1
  193. package/src/components/dev-console/utils.ts +23 -15
  194. package/src/components/help-modal/icons.tsx +10 -2
  195. package/src/hooks/use-copy-to-clipboard.tsx +3 -1
  196. package/src/hooks/use-push-to-talk.tsx +45 -18
  197. package/src/lib/utils.ts +4 -1
  198. package/tsconfig.json +1 -1
  199. package/tsup.config.ts +5 -1
  200. package/dist/chunk-3W6J75HS.mjs +0 -126
  201. package/dist/chunk-3W6J75HS.mjs.map +0 -1
  202. package/dist/chunk-54JAUBUJ.mjs.map +0 -1
  203. package/dist/chunk-6TWQUA2Q.mjs.map +0 -1
  204. package/dist/chunk-BH6PCAAL.mjs.map +0 -1
  205. package/dist/chunk-DBKRAOH7.mjs.map +0 -1
  206. package/dist/chunk-ELGRNEAO.mjs.map +0 -1
  207. package/dist/chunk-F2CDEOFX.mjs.map +0 -1
  208. package/dist/chunk-FFJHOZX6.mjs.map +0 -1
  209. package/dist/chunk-IK2BPURM.mjs.map +0 -1
  210. package/dist/chunk-JY2CSDKN.mjs.map +0 -1
  211. package/dist/chunk-JZ3RFQQ6.mjs.map +0 -1
  212. package/dist/chunk-LYYDXL2G.mjs.map +0 -1
  213. package/dist/chunk-O72ZB5V3.mjs.map +0 -1
  214. package/dist/chunk-OHGUQZJT.mjs.map +0 -1
  215. package/dist/chunk-PD36EMOZ.mjs.map +0 -1
  216. package/dist/chunk-Q5V6S67N.mjs.map +0 -1
  217. package/dist/chunk-QIOJXTIQ.mjs.map +0 -1
  218. package/dist/chunk-RYUCX3ZK.mjs.map +0 -1
  219. package/dist/chunk-UFN2VWSR.mjs.map +0 -1
  220. package/dist/chunk-WNX755OE.mjs.map +0 -1
  221. package/dist/chunk-XWG3L6QC.mjs.map +0 -1
  222. /package/dist/{chunk-C3GSYRC3.mjs.map → chunk-BNJX66OH.mjs.map} +0 -0
  223. /package/dist/{chunk-NRA3CFEE.mjs.map → chunk-C27LZFA5.mjs.map} +0 -0
  224. /package/dist/{chunk-GDSZGYCE.mjs.map → chunk-EACIYBQH.mjs.map} +0 -0
  225. /package/dist/{chunk-VHKHX7GV.mjs.map → chunk-HHLX4MQN.mjs.map} +0 -0
  226. /package/dist/{chunk-LBR23XXF.mjs.map → chunk-P34CL4LC.mjs.map} +0 -0
package/dist/index.js CHANGED
@@ -132,7 +132,14 @@ var CloseIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
132
132
  stroke: "currentColor",
133
133
  width: "24",
134
134
  height: "24",
135
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" })
135
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
136
+ "path",
137
+ {
138
+ strokeLinecap: "round",
139
+ strokeLinejoin: "round",
140
+ d: "M19.5 8.25l-7.5 7.5-7.5-7.5"
141
+ }
142
+ )
136
143
  }
137
144
  );
138
145
  var HeaderCloseIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -145,7 +152,14 @@ var HeaderCloseIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
145
152
  stroke: "currentColor",
146
153
  width: "24",
147
154
  height: "24",
148
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
155
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
156
+ "path",
157
+ {
158
+ strokeLinecap: "round",
159
+ strokeLinejoin: "round",
160
+ d: "M6 18L18 6M6 6l12 12"
161
+ }
162
+ )
149
163
  }
150
164
  );
151
165
  var SendIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -158,7 +172,14 @@ var SendIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
158
172
  stroke: "currentColor",
159
173
  width: "24",
160
174
  height: "24",
161
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 19V5m0 0l-7 7m7-7l7 7" })
175
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
176
+ "path",
177
+ {
178
+ strokeLinecap: "round",
179
+ strokeLinejoin: "round",
180
+ d: "M12 19V5m0 0l-7 7m7-7l7 7"
181
+ }
182
+ )
162
183
  }
163
184
  );
164
185
  var MicrophoneIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -243,12 +264,42 @@ var CopyIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
243
264
  )
244
265
  }
245
266
  );
246
- var SmallSpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitSpinner", style: { width: "13px", height: "13px" } });
247
- var SpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitSpinner", style: { width: "24px", height: "24px" } });
267
+ var SmallSpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
268
+ "span",
269
+ {
270
+ className: "copilotKitSpinner",
271
+ style: { width: "13px", height: "13px" }
272
+ }
273
+ );
274
+ var SpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
275
+ "span",
276
+ {
277
+ className: "copilotKitSpinner",
278
+ style: { width: "24px", height: "24px" }
279
+ }
280
+ );
248
281
  var ActivityIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
249
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitActivityDot", style: { animationDelay: "0s" } }),
250
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitActivityDot", style: { animationDelay: "0.2s" } }),
251
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitActivityDot", style: { animationDelay: "0.4s" } })
282
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
283
+ "span",
284
+ {
285
+ className: "copilotKitActivityDot",
286
+ style: { animationDelay: "0s" }
287
+ }
288
+ ),
289
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
290
+ "span",
291
+ {
292
+ className: "copilotKitActivityDot",
293
+ style: { animationDelay: "0.2s" }
294
+ }
295
+ ),
296
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
297
+ "span",
298
+ {
299
+ className: "copilotKitActivityDot",
300
+ style: { animationDelay: "0.4s" }
301
+ }
302
+ )
252
303
  ] });
253
304
  var ThumbsUpIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
254
305
  "svg",
@@ -323,7 +374,14 @@ var UploadIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
323
374
  stroke: "currentColor",
324
375
  width: "24",
325
376
  height: "24",
326
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.5v15m7.5-7.5h-15" })
377
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
378
+ "path",
379
+ {
380
+ strokeLinecap: "round",
381
+ strokeLinejoin: "round",
382
+ d: "M12 4.5v15m7.5-7.5h-15"
383
+ }
384
+ )
327
385
  }
328
386
  );
329
387
  var CheckIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -337,13 +395,22 @@ var CheckIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
337
395
  width: "16",
338
396
  height: "16",
339
397
  style: { minWidth: "16px", minHeight: "16px" },
340
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" })
398
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
399
+ "path",
400
+ {
401
+ strokeLinecap: "round",
402
+ strokeLinejoin: "round",
403
+ d: "M4.5 12.75l6 6 9-13.5"
404
+ }
405
+ )
341
406
  }
342
407
  );
343
408
 
344
409
  // src/components/chat/ChatContext.tsx
345
410
  var import_jsx_runtime2 = require("react/jsx-runtime");
346
- var ChatContext = import_react.default.createContext(void 0);
411
+ var ChatContext = import_react.default.createContext(
412
+ void 0
413
+ );
347
414
  function useChatContext() {
348
415
  const context = import_react.default.useContext(ChatContext);
349
416
  if (context === void 0) {
@@ -551,24 +618,30 @@ function getPublishedCopilotKitVersion(current, forceCheck = false) {
551
618
  return parsedVersion;
552
619
  }
553
620
  } catch (error) {
554
- console.error("Failed to parse CopilotKitVersion from localStorage", error);
621
+ console.error(
622
+ "Failed to parse CopilotKitVersion from localStorage",
623
+ error
624
+ );
555
625
  }
556
626
  }
557
627
  try {
558
- const response = yield fetch("https://api.cloud.copilotkit.ai/check-for-updates", {
559
- method: "POST",
560
- headers: {
561
- "Content-Type": "application/json"
562
- },
563
- body: JSON.stringify({
564
- packages: [
565
- {
566
- packageName: "@copilotkit/shared",
567
- packageVersion: current
568
- }
569
- ]
570
- })
571
- });
628
+ const response = yield fetch(
629
+ "https://api.cloud.copilotkit.ai/check-for-updates",
630
+ {
631
+ method: "POST",
632
+ headers: {
633
+ "Content-Type": "application/json"
634
+ },
635
+ body: JSON.stringify({
636
+ packages: [
637
+ {
638
+ packageName: "@copilotkit/shared",
639
+ packageVersion: current
640
+ }
641
+ ]
642
+ })
643
+ }
644
+ );
572
645
  const data = yield response.json();
573
646
  const version = {
574
647
  current,
@@ -722,13 +795,22 @@ var CheckIcon2 = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
722
795
  viewBox: "0 0 14 14",
723
796
  version: "1.1",
724
797
  xmlns: "http://www.w3.org/2000/svg",
725
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Group-2", transform: "translate(-118, 0)", fill: "#1BC030", fillRule: "nonzero", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Group", transform: "translate(118, 0)", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
726
- "path",
798
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
799
+ "g",
727
800
  {
728
- 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",
729
- id: "Shape"
801
+ id: "Group-2",
802
+ transform: "translate(-118, 0)",
803
+ fill: "#1BC030",
804
+ fillRule: "nonzero",
805
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Group", transform: "translate(118, 0)", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
806
+ "path",
807
+ {
808
+ 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",
809
+ id: "Shape"
810
+ }
811
+ ) })
730
812
  }
731
- ) }) }) })
813
+ ) })
732
814
  }
733
815
  );
734
816
 
@@ -751,7 +833,14 @@ var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
751
833
  stroke: "currentColor",
752
834
  width: "20",
753
835
  height: "20",
754
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
836
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
837
+ "path",
838
+ {
839
+ strokeLinecap: "round",
840
+ strokeLinejoin: "round",
841
+ d: "M6 18L18 6M6 6l12 12"
842
+ }
843
+ )
755
844
  }
756
845
  );
757
846
 
@@ -856,7 +945,9 @@ function CopilotDevConsole() {
856
945
  const [versionStatus, setVersionStatus] = (0, import_react4.useState)("unknown");
857
946
  const [latestVersion, setLatestVersion] = (0, import_react4.useState)("");
858
947
  const consoleRef = (0, import_react4.useRef)(null);
859
- const [debugButtonMode, setDebugButtonMode] = (0, import_react4.useState)("full");
948
+ const [debugButtonMode, setDebugButtonMode] = (0, import_react4.useState)(
949
+ "full"
950
+ );
860
951
  const checkForUpdates = (force = false) => {
861
952
  setVersionStatus("checking");
862
953
  getPublishedCopilotKitVersion(currentVersion, force).then((v) => {
@@ -997,8 +1088,22 @@ function DebugMenuButton({
997
1088
  className: "copilotKitDebugMenu",
998
1089
  style: { zIndex: 40 },
999
1090
  children: [
1000
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logReadables(context), children: "Log Readables" }) }),
1001
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logActions(context), children: "Log Actions" }) }),
1091
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1092
+ "button",
1093
+ {
1094
+ className: "copilotKitDebugMenuItem",
1095
+ onClick: () => logReadables(context),
1096
+ children: "Log Readables"
1097
+ }
1098
+ ) }),
1099
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1100
+ "button",
1101
+ {
1102
+ className: "copilotKitDebugMenuItem",
1103
+ onClick: () => logActions(context),
1104
+ children: "Log Actions"
1105
+ }
1106
+ ) }),
1002
1107
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1003
1108
  "button",
1004
1109
  {
@@ -1007,9 +1112,23 @@ function DebugMenuButton({
1007
1112
  children: "Log Messages"
1008
1113
  }
1009
1114
  ) }),
1010
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => checkForUpdates(true), children: "Check for Updates" }) }),
1115
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1116
+ "button",
1117
+ {
1118
+ className: "copilotKitDebugMenuItem",
1119
+ onClick: () => checkForUpdates(true),
1120
+ children: "Check for Updates"
1121
+ }
1122
+ ) }),
1011
1123
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("hr", {}),
1012
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => setShowDevConsole(false), children: "Hide Dev Console" }) })
1124
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1125
+ "button",
1126
+ {
1127
+ className: "copilotKitDebugMenuItem",
1128
+ onClick: () => setShowDevConsole(false),
1129
+ children: "Hide Dev Console"
1130
+ }
1131
+ ) })
1013
1132
  ]
1014
1133
  }
1015
1134
  )
@@ -1055,7 +1174,9 @@ var getTextContent = (content) => {
1055
1174
  return part.text;
1056
1175
  }
1057
1176
  return void 0;
1058
- }).filter((value) => typeof value === "string" && value.length > 0).join(" ").trim() || void 0;
1177
+ }).filter(
1178
+ (value) => typeof value === "string" && value.length > 0
1179
+ ).join(" ").trim() || void 0;
1059
1180
  };
1060
1181
  var UserMessage = (props) => {
1061
1182
  const { message, ImageRenderer: ImageRenderer2 } = props;
@@ -1079,7 +1200,9 @@ var import_react_syntax_highlighter = require("react-syntax-highlighter");
1079
1200
 
1080
1201
  // src/hooks/use-copy-to-clipboard.tsx
1081
1202
  var React5 = __toESM(require("react"));
1082
- function useCopyToClipboard({ timeout = 2e3 }) {
1203
+ function useCopyToClipboard({
1204
+ timeout = 2e3
1205
+ }) {
1083
1206
  const [isCopied, setIsCopied] = React5.useState(false);
1084
1207
  const copyToClipboard = (value) => {
1085
1208
  var _a;
@@ -1137,9 +1260,7 @@ var generateRandomString = (length, lowercase = false) => {
1137
1260
  };
1138
1261
  var CodeBlock = (0, import_react6.memo)(({ language, value }) => {
1139
1262
  const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
1140
- const [SyntaxHighlighter, setSyntaxHighlighter] = (0, import_react6.useState)(
1141
- () => import_react_syntax_highlighter.Light
1142
- );
1263
+ const [SyntaxHighlighter, setSyntaxHighlighter] = (0, import_react6.useState)(() => import_react_syntax_highlighter.Light);
1143
1264
  (0, import_react6.useEffect)(() => {
1144
1265
  try {
1145
1266
  new RegExp("(?<=#)\\w+");
@@ -1178,7 +1299,14 @@ var CodeBlock = (0, import_react6.memo)(({ language, value }) => {
1178
1299
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
1179
1300
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
1180
1301
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
1181
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: downloadAsFile, children: DownloadIcon }),
1302
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1303
+ "button",
1304
+ {
1305
+ className: "copilotKitCodeBlockToolbarButton",
1306
+ onClick: downloadAsFile,
1307
+ children: DownloadIcon
1308
+ }
1309
+ ),
1182
1310
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: isCopied ? CheckIcon : CopyIcon })
1183
1311
  ] })
1184
1312
  ] }),
@@ -1490,7 +1618,16 @@ var import_jsx_runtime12 = require("react/jsx-runtime");
1490
1618
  var defaultComponents = {
1491
1619
  a(_a) {
1492
1620
  var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
1493
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("a", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { target: "_blank", rel: "noopener noreferrer", children }));
1621
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1622
+ "a",
1623
+ __spreadProps(__spreadValues({
1624
+ className: "copilotKitMarkdownElement"
1625
+ }, props), {
1626
+ target: "_blank",
1627
+ rel: "noopener noreferrer",
1628
+ children
1629
+ })
1630
+ );
1494
1631
  },
1495
1632
  // @ts-expect-error -- inline
1496
1633
  code(_c) {
@@ -1588,7 +1725,10 @@ var Markdown = ({ content, components }) => {
1588
1725
  MemoizedReactMarkdown,
1589
1726
  {
1590
1727
  components: __spreadValues(__spreadValues({}, defaultComponents), components),
1591
- remarkPlugins: [import_remark_gfm.default, [import_remark_math.default, { singleDollarTextMath: false }]],
1728
+ remarkPlugins: [
1729
+ import_remark_gfm.default,
1730
+ [import_remark_math.default, { singleDollarTextMath: false }]
1731
+ ],
1592
1732
  rehypePlugins: [import_rehype_raw.default],
1593
1733
  children: content
1594
1734
  }
@@ -1707,7 +1847,11 @@ var AssistantMessage = (props) => {
1707
1847
  // src/components/chat/messages/ImageRenderer.tsx
1708
1848
  var import_react9 = require("react");
1709
1849
  var import_jsx_runtime14 = require("react/jsx-runtime");
1710
- var ImageRenderer = ({ image, content, className = "" }) => {
1850
+ var ImageRenderer = ({
1851
+ image,
1852
+ content,
1853
+ className = ""
1854
+ }) => {
1711
1855
  const [imageError, setImageError] = (0, import_react9.useState)(false);
1712
1856
  const imageSrc = `data:image/${image.format};base64,${image.bytes}`;
1713
1857
  const altText = content || "User uploaded image";
@@ -1715,10 +1859,16 @@ var ImageRenderer = ({ image, content, className = "" }) => {
1715
1859
  setImageError(true);
1716
1860
  };
1717
1861
  if (imageError) {
1718
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `copilotKitImageRendering copilotKitImageRenderingError ${className}`, children: [
1719
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitImageRenderingErrorMessage", children: "Failed to load image" }),
1720
- content && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitImageRenderingContent", children: content })
1721
- ] });
1862
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1863
+ "div",
1864
+ {
1865
+ className: `copilotKitImageRendering copilotKitImageRenderingError ${className}`,
1866
+ children: [
1867
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitImageRenderingErrorMessage", children: "Failed to load image" }),
1868
+ content && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitImageRenderingContent", children: content })
1869
+ ]
1870
+ }
1871
+ );
1722
1872
  }
1723
1873
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `copilotKitImageRendering ${className}`, children: [
1724
1874
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
@@ -1951,7 +2101,10 @@ var Messages = ({
1951
2101
  var _a;
1952
2102
  const { labels, icons } = useChatContext();
1953
2103
  const { messages: visibleMessages, interrupt } = (0, import_react_core5.useCopilotChatInternal)();
1954
- const initialMessages = (0, import_react10.useMemo)(() => makeInitialMessages(labels.initial), [labels.initial]);
2104
+ const initialMessages = (0, import_react10.useMemo)(
2105
+ () => makeInitialMessages(labels.initial),
2106
+ [labels.initial]
2107
+ );
1955
2108
  const messages = [...initialMessages, ...visibleMessages];
1956
2109
  const { messagesContainerRef, messagesEndRef } = useScrollToBottom(messages);
1957
2110
  const hasLegacyProps = !!(RenderTextMessage || RenderActionExecutionMessage || RenderAgentStateMessage || RenderResultMessage || RenderImageMessage);
@@ -2109,7 +2262,10 @@ var AutoResizingTextarea = (0, import_react11.forwardRef)(
2109
2262
  }, ref) => {
2110
2263
  const internalTextareaRef = (0, import_react11.useRef)(null);
2111
2264
  const [maxHeight, setMaxHeight] = (0, import_react11.useState)(0);
2112
- (0, import_react11.useImperativeHandle)(ref, () => internalTextareaRef.current);
2265
+ (0, import_react11.useImperativeHandle)(
2266
+ ref,
2267
+ () => internalTextareaRef.current
2268
+ );
2113
2269
  (0, import_react11.useEffect)(() => {
2114
2270
  const calculateMaxHeight = () => {
2115
2271
  const textarea = internalTextareaRef.current;
@@ -2159,7 +2315,9 @@ var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
2159
2315
  var import_react12 = require("react");
2160
2316
  var startRecording = (mediaStreamRef, mediaRecorderRef, audioContextRef, recordedChunks, onStop) => __async(void 0, null, function* () {
2161
2317
  if (!mediaStreamRef.current || !audioContextRef.current) {
2162
- mediaStreamRef.current = yield navigator.mediaDevices.getUserMedia({ audio: true });
2318
+ mediaStreamRef.current = yield navigator.mediaDevices.getUserMedia({
2319
+ audio: true
2320
+ });
2163
2321
  audioContextRef.current = new window.AudioContext();
2164
2322
  yield audioContextRef.current.resume();
2165
2323
  }
@@ -2228,14 +2386,15 @@ var usePushToTalk = ({
2228
2386
  } else {
2229
2387
  stopRecording(mediaRecorderRef);
2230
2388
  if (pushToTalkState === "transcribing") {
2231
- transcribeAudio(recordedChunks.current, context.copilotApiConfig.transcribeAudioUrl).then(
2232
- (transcription) => __async(void 0, null, function* () {
2233
- recordedChunks.current = [];
2234
- setPushToTalkState("idle");
2235
- const message = yield sendFunction(transcription);
2236
- setStartReadingFromMessageId(message.id);
2237
- })
2238
- );
2389
+ transcribeAudio(
2390
+ recordedChunks.current,
2391
+ context.copilotApiConfig.transcribeAudioUrl
2392
+ ).then((transcription) => __async(void 0, null, function* () {
2393
+ recordedChunks.current = [];
2394
+ setPushToTalkState("idle");
2395
+ const message = yield sendFunction(transcription);
2396
+ setStartReadingFromMessageId(message.id);
2397
+ }));
2239
2398
  }
2240
2399
  }
2241
2400
  return () => {
@@ -2250,7 +2409,11 @@ var usePushToTalk = ({
2250
2409
  const aguiMessages = (0, import_runtime_client_gql2.gqlToAGUI)(context.messages);
2251
2410
  const messagesAfterLast = aguiMessages.slice(lastMessageIndex + 1).filter((message) => message.role === "assistant");
2252
2411
  const text = messagesAfterLast.map((message) => message.content).join("\n");
2253
- playAudioResponse(text, context.copilotApiConfig.textToSpeechUrl, audioContextRef.current);
2412
+ playAudioResponse(
2413
+ text,
2414
+ context.copilotApiConfig.textToSpeechUrl,
2415
+ audioContextRef.current
2416
+ );
2254
2417
  setStartReadingFromMessageId(null);
2255
2418
  }
2256
2419
  }, [startReadingFromMessageId, inProgress]);
@@ -2272,7 +2435,9 @@ var useDarkMode = () => {
2272
2435
 
2273
2436
  // src/components/chat/PoweredByTag.tsx
2274
2437
  var import_jsx_runtime19 = require("react/jsx-runtime");
2275
- function PoweredByTag({ showPoweredBy = true }) {
2438
+ function PoweredByTag({
2439
+ showPoweredBy = true
2440
+ }) {
2276
2441
  const [mounted, setMounted] = (0, import_react13.useState)(false);
2277
2442
  const isDark = useDarkMode();
2278
2443
  (0, import_react13.useEffect)(() => {
@@ -2338,7 +2503,13 @@ var Input = ({
2338
2503
  if (!chatReady)
2339
2504
  return { buttonIcon: context.icons.spinnerIcon, buttonAlt: "Loading" };
2340
2505
  return isInProgress && !hideStopButton && chatReady ? { buttonIcon: context.icons.stopIcon, buttonAlt: "Stop" } : { buttonIcon: context.icons.sendIcon, buttonAlt: "Send" };
2341
- }, [isInProgress, chatReady, hideStopButton, context.icons.stopIcon, context.icons.sendIcon]);
2506
+ }, [
2507
+ isInProgress,
2508
+ chatReady,
2509
+ hideStopButton,
2510
+ context.icons.stopIcon,
2511
+ context.icons.sendIcon
2512
+ ]);
2342
2513
  const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
2343
2514
  const { interrupt } = (0, import_react_core7.useCopilotChatInternal)();
2344
2515
  const canSend = (0, import_react14.useMemo)(() => {
@@ -2348,56 +2519,64 @@ var Input = ({
2348
2519
  return isInProgress && !hideStopButton;
2349
2520
  }, [isInProgress, hideStopButton]);
2350
2521
  const sendDisabled = !canSend && !canStop;
2351
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`, children: [
2352
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
2353
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2354
- Textarea_default,
2355
- {
2356
- ref: textareaRef,
2357
- placeholder: context.labels.placeholder,
2358
- autoFocus: false,
2359
- maxRows: MAX_NEWLINES,
2360
- value: text,
2361
- onChange: (event) => setText(event.target.value),
2362
- onCompositionStart: () => setIsComposing(true),
2363
- onCompositionEnd: () => setIsComposing(false),
2364
- onKeyDown: (event) => {
2365
- if (event.key === "Enter" && !event.shiftKey && !isComposing) {
2366
- event.preventDefault();
2367
- if (canSend) {
2368
- send();
2522
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2523
+ "div",
2524
+ {
2525
+ className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`,
2526
+ children: [
2527
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
2528
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2529
+ Textarea_default,
2530
+ {
2531
+ ref: textareaRef,
2532
+ placeholder: context.labels.placeholder,
2533
+ autoFocus: false,
2534
+ maxRows: MAX_NEWLINES,
2535
+ value: text,
2536
+ onChange: (event) => setText(event.target.value),
2537
+ onCompositionStart: () => setIsComposing(true),
2538
+ onCompositionEnd: () => setIsComposing(false),
2539
+ onKeyDown: (event) => {
2540
+ if (event.key === "Enter" && !event.shiftKey && !isComposing) {
2541
+ event.preventDefault();
2542
+ if (canSend) {
2543
+ send();
2544
+ }
2545
+ }
2369
2546
  }
2370
2547
  }
2371
- }
2372
- }
2373
- ),
2374
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitInputControls", children: [
2375
- onUpload && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { onClick: onUpload, className: "copilotKitInputControlButton", children: context.icons.uploadIcon }),
2376
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { flexGrow: 1 } }),
2377
- showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2378
- "button",
2379
- {
2380
- onClick: () => setPushToTalkState(pushToTalkState === "idle" ? "recording" : "transcribing"),
2381
- className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
2382
- children: context.icons.pushToTalkIcon
2383
- }
2384
- ),
2385
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2386
- "button",
2387
- {
2388
- disabled: sendDisabled,
2389
- onClick: isInProgress && !hideStopButton ? onStop : send,
2390
- "data-copilotkit-in-progress": inProgress,
2391
- "data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
2392
- className: "copilotKitInputControlButton",
2393
- "aria-label": buttonAlt,
2394
- children: buttonIcon
2395
- }
2396
- )
2397
- ] })
2398
- ] }),
2399
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PoweredByTag, { showPoweredBy })
2400
- ] });
2548
+ ),
2549
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitInputControls", children: [
2550
+ onUpload && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { onClick: onUpload, className: "copilotKitInputControlButton", children: context.icons.uploadIcon }),
2551
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { flexGrow: 1 } }),
2552
+ showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2553
+ "button",
2554
+ {
2555
+ onClick: () => setPushToTalkState(
2556
+ pushToTalkState === "idle" ? "recording" : "transcribing"
2557
+ ),
2558
+ className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
2559
+ children: context.icons.pushToTalkIcon
2560
+ }
2561
+ ),
2562
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2563
+ "button",
2564
+ {
2565
+ disabled: sendDisabled,
2566
+ onClick: isInProgress && !hideStopButton ? onStop : send,
2567
+ "data-copilotkit-in-progress": inProgress,
2568
+ "data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
2569
+ className: "copilotKitInputControlButton",
2570
+ "aria-label": buttonAlt,
2571
+ children: buttonIcon
2572
+ }
2573
+ )
2574
+ ] })
2575
+ ] }),
2576
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PoweredByTag, { showPoweredBy })
2577
+ ]
2578
+ }
2579
+ );
2401
2580
  };
2402
2581
 
2403
2582
  // src/components/chat/Chat.tsx
@@ -2486,7 +2665,12 @@ var ImageUploadQueue = ({
2486
2665
  // src/components/chat/Suggestion.tsx
2487
2666
  var import_react_core8 = require("@copilotkit/react-core");
2488
2667
  var import_jsx_runtime22 = require("react/jsx-runtime");
2489
- function Suggestion({ title, onClick, partial, className }) {
2668
+ function Suggestion({
2669
+ title,
2670
+ onClick,
2671
+ partial,
2672
+ className
2673
+ }) {
2490
2674
  const { isLoading } = (0, import_react_core8.useCopilotChatInternal)();
2491
2675
  if (!title)
2492
2676
  return null;
@@ -2580,9 +2764,7 @@ function CopilotChat({
2580
2764
  const { publicApiKey, chatApiEndpoint } = copilotApiConfig;
2581
2765
  const [selectedImages, setSelectedImages] = (0, import_react15.useState)([]);
2582
2766
  const [chatError, setChatError] = (0, import_react15.useState)(null);
2583
- const [messageFeedback, setMessageFeedback] = (0, import_react15.useState)(
2584
- {}
2585
- );
2767
+ const [messageFeedback, setMessageFeedback] = (0, import_react15.useState)({});
2586
2768
  const fileInputRef = (0, import_react15.useRef)(null);
2587
2769
  const triggerObservabilityHook = (0, import_react15.useCallback)(
2588
2770
  (hookName, ...args) => {
@@ -2675,30 +2857,34 @@ function CopilotChat({
2675
2857
  if (imageItems.length === 0)
2676
2858
  return;
2677
2859
  e.preventDefault();
2678
- const imagePromises = imageItems.map((item) => {
2679
- const file = item.getAsFile();
2680
- if (!file)
2681
- return Promise.resolve(null);
2682
- return new Promise((resolve, reject) => {
2683
- const reader = new FileReader();
2684
- reader.onload = (e2) => {
2685
- var _a2, _b2;
2686
- const base64String = (_b2 = (_a2 = e2.target) == null ? void 0 : _a2.result) == null ? void 0 : _b2.split(",")[1];
2687
- if (base64String) {
2688
- resolve({
2689
- contentType: file.type,
2690
- bytes: base64String
2691
- });
2692
- } else {
2693
- resolve(null);
2694
- }
2695
- };
2696
- reader.onerror = reject;
2697
- reader.readAsDataURL(file);
2698
- });
2699
- });
2860
+ const imagePromises = imageItems.map(
2861
+ (item) => {
2862
+ const file = item.getAsFile();
2863
+ if (!file)
2864
+ return Promise.resolve(null);
2865
+ return new Promise((resolve, reject) => {
2866
+ const reader = new FileReader();
2867
+ reader.onload = (e2) => {
2868
+ var _a2, _b2;
2869
+ const base64String = (_b2 = (_a2 = e2.target) == null ? void 0 : _a2.result) == null ? void 0 : _b2.split(",")[1];
2870
+ if (base64String) {
2871
+ resolve({
2872
+ contentType: file.type,
2873
+ bytes: base64String
2874
+ });
2875
+ } else {
2876
+ resolve(null);
2877
+ }
2878
+ };
2879
+ reader.onerror = reject;
2880
+ reader.readAsDataURL(file);
2881
+ });
2882
+ }
2883
+ );
2700
2884
  try {
2701
- const loadedImages = (yield Promise.all(imagePromises)).filter((img) => img !== null);
2885
+ const loadedImages = (yield Promise.all(imagePromises)).filter(
2886
+ (img) => img !== null
2887
+ );
2702
2888
  setSelectedImages((prev) => [...prev, ...loadedImages]);
2703
2889
  } catch (error) {
2704
2890
  triggerChatError(error, "processClipboardImages", error);
@@ -2779,25 +2965,29 @@ function CopilotChat({
2779
2965
  if (!event.target.files || event.target.files.length === 0) {
2780
2966
  return;
2781
2967
  }
2782
- const files = Array.from(event.target.files).filter((file) => file.type.startsWith("image/"));
2968
+ const files = Array.from(event.target.files).filter(
2969
+ (file) => file.type.startsWith("image/")
2970
+ );
2783
2971
  if (files.length === 0)
2784
2972
  return;
2785
2973
  const fileReadPromises = files.map((file) => {
2786
- return new Promise((resolve, reject) => {
2787
- const reader = new FileReader();
2788
- reader.onload = (e) => {
2789
- var _a, _b;
2790
- const base64String = ((_b = (_a = e.target) == null ? void 0 : _a.result) == null ? void 0 : _b.split(",")[1]) || "";
2791
- if (base64String) {
2792
- resolve({
2793
- contentType: file.type,
2794
- bytes: base64String
2795
- });
2796
- }
2797
- };
2798
- reader.onerror = reject;
2799
- reader.readAsDataURL(file);
2800
- });
2974
+ return new Promise(
2975
+ (resolve, reject) => {
2976
+ const reader = new FileReader();
2977
+ reader.onload = (e) => {
2978
+ var _a, _b;
2979
+ const base64String = ((_b = (_a = e.target) == null ? void 0 : _a.result) == null ? void 0 : _b.split(",")[1]) || "";
2980
+ if (base64String) {
2981
+ resolve({
2982
+ contentType: file.type,
2983
+ bytes: base64String
2984
+ });
2985
+ }
2986
+ };
2987
+ reader.onerror = reject;
2988
+ reader.readAsDataURL(file);
2989
+ }
2990
+ );
2801
2991
  });
2802
2992
  try {
2803
2993
  const loadedImages = yield Promise.all(fileReadPromises);
@@ -2868,7 +3058,13 @@ function CopilotChat({
2868
3058
  }
2869
3059
  ),
2870
3060
  imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
2871
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ImageUploadQueue, { images: selectedImages, onRemoveImage: removeSelectedImage }),
3061
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3062
+ ImageUploadQueue,
3063
+ {
3064
+ images: selectedImages,
3065
+ onRemoveImage: removeSelectedImage
3066
+ }
3067
+ ),
2872
3068
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2873
3069
  "input",
2874
3070
  {
@@ -2906,8 +3102,17 @@ function WrappedCopilotChat({
2906
3102
  }) {
2907
3103
  const chatContext = import_react15.default.useContext(ChatContext);
2908
3104
  if (!chatContext) {
2909
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
2910
- }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children }) });
3105
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3106
+ ChatContextProvider,
3107
+ {
3108
+ icons,
3109
+ labels,
3110
+ open: true,
3111
+ setOpen: () => {
3112
+ },
3113
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children })
3114
+ }
3115
+ );
2911
3116
  }
2912
3117
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children });
2913
3118
  }
@@ -3056,37 +3261,46 @@ var CopilotModal = (_a) => {
3056
3261
  "observabilityHooks"
3057
3262
  ]);
3058
3263
  const [openState, setOpenState] = import_react16.default.useState(defaultOpen);
3059
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChatContextProvider, { icons, labels, open: openState, setOpen: setOpenState, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3060
- CopilotModalInner,
3061
- __spreadProps(__spreadValues({
3062
- observabilityHooks,
3063
- onSetOpen,
3064
- clickOutsideToClose: clickOutsideToClose != null ? clickOutsideToClose : true,
3065
- hitEscapeToClose: hitEscapeToClose != null ? hitEscapeToClose : true,
3066
- shortcut: shortcut != null ? shortcut : "/",
3067
- className,
3068
- Window: Window2,
3069
- Button: Button2,
3070
- Header: Header2,
3071
- instructions,
3072
- onSubmitMessage,
3073
- onStopGeneration,
3074
- onReloadMessages,
3075
- makeSystemMessage,
3076
- onInProgress,
3077
- Messages: Messages2,
3078
- Input: Input2,
3079
- AssistantMessage: AssistantMessage2,
3080
- UserMessage: UserMessage2,
3081
- onThumbsUp,
3082
- onThumbsDown,
3083
- onCopy,
3084
- onRegenerate,
3085
- markdownTagRenderers
3086
- }, props), {
3087
- children
3088
- })
3089
- ) });
3264
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3265
+ ChatContextProvider,
3266
+ {
3267
+ icons,
3268
+ labels,
3269
+ open: openState,
3270
+ setOpen: setOpenState,
3271
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3272
+ CopilotModalInner,
3273
+ __spreadProps(__spreadValues({
3274
+ observabilityHooks,
3275
+ onSetOpen,
3276
+ clickOutsideToClose: clickOutsideToClose != null ? clickOutsideToClose : true,
3277
+ hitEscapeToClose: hitEscapeToClose != null ? hitEscapeToClose : true,
3278
+ shortcut: shortcut != null ? shortcut : "/",
3279
+ className,
3280
+ Window: Window2,
3281
+ Button: Button2,
3282
+ Header: Header2,
3283
+ instructions,
3284
+ onSubmitMessage,
3285
+ onStopGeneration,
3286
+ onReloadMessages,
3287
+ makeSystemMessage,
3288
+ onInProgress,
3289
+ Messages: Messages2,
3290
+ Input: Input2,
3291
+ AssistantMessage: AssistantMessage2,
3292
+ UserMessage: UserMessage2,
3293
+ onThumbsUp,
3294
+ onThumbsDown,
3295
+ onCopy,
3296
+ onRegenerate,
3297
+ markdownTagRenderers
3298
+ }, props), {
3299
+ children
3300
+ })
3301
+ )
3302
+ }
3303
+ );
3090
3304
  };
3091
3305
 
3092
3306
  // src/components/chat/Popup.tsx