@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
@@ -128,7 +128,14 @@ var CloseIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
128
128
  stroke: "currentColor",
129
129
  width: "24",
130
130
  height: "24",
131
- 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" })
131
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
132
+ "path",
133
+ {
134
+ strokeLinecap: "round",
135
+ strokeLinejoin: "round",
136
+ d: "M19.5 8.25l-7.5 7.5-7.5-7.5"
137
+ }
138
+ )
132
139
  }
133
140
  );
134
141
  var HeaderCloseIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -141,7 +148,14 @@ var HeaderCloseIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
141
148
  stroke: "currentColor",
142
149
  width: "24",
143
150
  height: "24",
144
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
151
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
152
+ "path",
153
+ {
154
+ strokeLinecap: "round",
155
+ strokeLinejoin: "round",
156
+ d: "M6 18L18 6M6 6l12 12"
157
+ }
158
+ )
145
159
  }
146
160
  );
147
161
  var SendIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -154,7 +168,14 @@ var SendIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
154
168
  stroke: "currentColor",
155
169
  width: "24",
156
170
  height: "24",
157
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 19V5m0 0l-7 7m7-7l7 7" })
171
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
172
+ "path",
173
+ {
174
+ strokeLinecap: "round",
175
+ strokeLinejoin: "round",
176
+ d: "M12 19V5m0 0l-7 7m7-7l7 7"
177
+ }
178
+ )
158
179
  }
159
180
  );
160
181
  var MicrophoneIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -239,12 +260,42 @@ var CopyIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
239
260
  )
240
261
  }
241
262
  );
242
- var SmallSpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitSpinner", style: { width: "13px", height: "13px" } });
243
- var SpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitSpinner", style: { width: "24px", height: "24px" } });
263
+ var SmallSpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
264
+ "span",
265
+ {
266
+ className: "copilotKitSpinner",
267
+ style: { width: "13px", height: "13px" }
268
+ }
269
+ );
270
+ var SpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
271
+ "span",
272
+ {
273
+ className: "copilotKitSpinner",
274
+ style: { width: "24px", height: "24px" }
275
+ }
276
+ );
244
277
  var ActivityIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
245
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitActivityDot", style: { animationDelay: "0s" } }),
246
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitActivityDot", style: { animationDelay: "0.2s" } }),
247
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitActivityDot", style: { animationDelay: "0.4s" } })
278
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
279
+ "span",
280
+ {
281
+ className: "copilotKitActivityDot",
282
+ style: { animationDelay: "0s" }
283
+ }
284
+ ),
285
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
286
+ "span",
287
+ {
288
+ className: "copilotKitActivityDot",
289
+ style: { animationDelay: "0.2s" }
290
+ }
291
+ ),
292
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
293
+ "span",
294
+ {
295
+ className: "copilotKitActivityDot",
296
+ style: { animationDelay: "0.4s" }
297
+ }
298
+ )
248
299
  ] });
249
300
  var ThumbsUpIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
250
301
  "svg",
@@ -319,7 +370,14 @@ var UploadIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
319
370
  stroke: "currentColor",
320
371
  width: "24",
321
372
  height: "24",
322
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.5v15m7.5-7.5h-15" })
373
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
374
+ "path",
375
+ {
376
+ strokeLinecap: "round",
377
+ strokeLinejoin: "round",
378
+ d: "M12 4.5v15m7.5-7.5h-15"
379
+ }
380
+ )
323
381
  }
324
382
  );
325
383
  var CheckIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -333,13 +391,22 @@ var CheckIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
333
391
  width: "16",
334
392
  height: "16",
335
393
  style: { minWidth: "16px", minHeight: "16px" },
336
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" })
394
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
395
+ "path",
396
+ {
397
+ strokeLinecap: "round",
398
+ strokeLinejoin: "round",
399
+ d: "M4.5 12.75l6 6 9-13.5"
400
+ }
401
+ )
337
402
  }
338
403
  );
339
404
 
340
405
  // src/components/chat/ChatContext.tsx
341
406
  var import_jsx_runtime2 = require("react/jsx-runtime");
342
- var ChatContext = import_react.default.createContext(void 0);
407
+ var ChatContext = import_react.default.createContext(
408
+ void 0
409
+ );
343
410
  function useChatContext() {
344
411
  const context = import_react.default.useContext(ChatContext);
345
412
  if (context === void 0) {
@@ -547,24 +614,30 @@ function getPublishedCopilotKitVersion(current, forceCheck = false) {
547
614
  return parsedVersion;
548
615
  }
549
616
  } catch (error) {
550
- console.error("Failed to parse CopilotKitVersion from localStorage", error);
617
+ console.error(
618
+ "Failed to parse CopilotKitVersion from localStorage",
619
+ error
620
+ );
551
621
  }
552
622
  }
553
623
  try {
554
- const response = yield fetch("https://api.cloud.copilotkit.ai/check-for-updates", {
555
- method: "POST",
556
- headers: {
557
- "Content-Type": "application/json"
558
- },
559
- body: JSON.stringify({
560
- packages: [
561
- {
562
- packageName: "@copilotkit/shared",
563
- packageVersion: current
564
- }
565
- ]
566
- })
567
- });
624
+ const response = yield fetch(
625
+ "https://api.cloud.copilotkit.ai/check-for-updates",
626
+ {
627
+ method: "POST",
628
+ headers: {
629
+ "Content-Type": "application/json"
630
+ },
631
+ body: JSON.stringify({
632
+ packages: [
633
+ {
634
+ packageName: "@copilotkit/shared",
635
+ packageVersion: current
636
+ }
637
+ ]
638
+ })
639
+ }
640
+ );
568
641
  const data = yield response.json();
569
642
  const version = {
570
643
  current,
@@ -718,13 +791,22 @@ var CheckIcon2 = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
718
791
  viewBox: "0 0 14 14",
719
792
  version: "1.1",
720
793
  xmlns: "http://www.w3.org/2000/svg",
721
- 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)(
722
- "path",
794
+ 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)(
795
+ "g",
723
796
  {
724
- 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",
725
- id: "Shape"
797
+ id: "Group-2",
798
+ transform: "translate(-118, 0)",
799
+ fill: "#1BC030",
800
+ fillRule: "nonzero",
801
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Group", transform: "translate(118, 0)", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
802
+ "path",
803
+ {
804
+ 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",
805
+ id: "Shape"
806
+ }
807
+ ) })
726
808
  }
727
- ) }) }) })
809
+ ) })
728
810
  }
729
811
  );
730
812
 
@@ -747,7 +829,14 @@ var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
747
829
  stroke: "currentColor",
748
830
  width: "20",
749
831
  height: "20",
750
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
832
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
833
+ "path",
834
+ {
835
+ strokeLinecap: "round",
836
+ strokeLinejoin: "round",
837
+ d: "M6 18L18 6M6 6l12 12"
838
+ }
839
+ )
751
840
  }
752
841
  );
753
842
 
@@ -852,7 +941,9 @@ function CopilotDevConsole() {
852
941
  const [versionStatus, setVersionStatus] = (0, import_react4.useState)("unknown");
853
942
  const [latestVersion, setLatestVersion] = (0, import_react4.useState)("");
854
943
  const consoleRef = (0, import_react4.useRef)(null);
855
- const [debugButtonMode, setDebugButtonMode] = (0, import_react4.useState)("full");
944
+ const [debugButtonMode, setDebugButtonMode] = (0, import_react4.useState)(
945
+ "full"
946
+ );
856
947
  const checkForUpdates = (force = false) => {
857
948
  setVersionStatus("checking");
858
949
  getPublishedCopilotKitVersion(currentVersion, force).then((v) => {
@@ -993,8 +1084,22 @@ function DebugMenuButton({
993
1084
  className: "copilotKitDebugMenu",
994
1085
  style: { zIndex: 40 },
995
1086
  children: [
996
- /* @__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" }) }),
997
- /* @__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" }) }),
1087
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1088
+ "button",
1089
+ {
1090
+ className: "copilotKitDebugMenuItem",
1091
+ onClick: () => logReadables(context),
1092
+ children: "Log Readables"
1093
+ }
1094
+ ) }),
1095
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1096
+ "button",
1097
+ {
1098
+ className: "copilotKitDebugMenuItem",
1099
+ onClick: () => logActions(context),
1100
+ children: "Log Actions"
1101
+ }
1102
+ ) }),
998
1103
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
999
1104
  "button",
1000
1105
  {
@@ -1003,9 +1108,23 @@ function DebugMenuButton({
1003
1108
  children: "Log Messages"
1004
1109
  }
1005
1110
  ) }),
1006
- /* @__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" }) }),
1111
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1112
+ "button",
1113
+ {
1114
+ className: "copilotKitDebugMenuItem",
1115
+ onClick: () => checkForUpdates(true),
1116
+ children: "Check for Updates"
1117
+ }
1118
+ ) }),
1007
1119
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("hr", {}),
1008
- /* @__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" }) })
1120
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1121
+ "button",
1122
+ {
1123
+ className: "copilotKitDebugMenuItem",
1124
+ onClick: () => setShowDevConsole(false),
1125
+ children: "Hide Dev Console"
1126
+ }
1127
+ ) })
1009
1128
  ]
1010
1129
  }
1011
1130
  )
@@ -1051,7 +1170,9 @@ var getTextContent = (content) => {
1051
1170
  return part.text;
1052
1171
  }
1053
1172
  return void 0;
1054
- }).filter((value) => typeof value === "string" && value.length > 0).join(" ").trim() || void 0;
1173
+ }).filter(
1174
+ (value) => typeof value === "string" && value.length > 0
1175
+ ).join(" ").trim() || void 0;
1055
1176
  };
1056
1177
  var UserMessage = (props) => {
1057
1178
  const { message, ImageRenderer: ImageRenderer2 } = props;
@@ -1075,7 +1196,9 @@ var import_react_syntax_highlighter = require("react-syntax-highlighter");
1075
1196
 
1076
1197
  // src/hooks/use-copy-to-clipboard.tsx
1077
1198
  var React5 = __toESM(require("react"));
1078
- function useCopyToClipboard({ timeout = 2e3 }) {
1199
+ function useCopyToClipboard({
1200
+ timeout = 2e3
1201
+ }) {
1079
1202
  const [isCopied, setIsCopied] = React5.useState(false);
1080
1203
  const copyToClipboard = (value) => {
1081
1204
  var _a;
@@ -1133,9 +1256,7 @@ var generateRandomString = (length, lowercase = false) => {
1133
1256
  };
1134
1257
  var CodeBlock = (0, import_react6.memo)(({ language, value }) => {
1135
1258
  const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
1136
- const [SyntaxHighlighter, setSyntaxHighlighter] = (0, import_react6.useState)(
1137
- () => import_react_syntax_highlighter.Light
1138
- );
1259
+ const [SyntaxHighlighter, setSyntaxHighlighter] = (0, import_react6.useState)(() => import_react_syntax_highlighter.Light);
1139
1260
  (0, import_react6.useEffect)(() => {
1140
1261
  try {
1141
1262
  new RegExp("(?<=#)\\w+");
@@ -1174,7 +1295,14 @@ var CodeBlock = (0, import_react6.memo)(({ language, value }) => {
1174
1295
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
1175
1296
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
1176
1297
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
1177
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: downloadAsFile, children: DownloadIcon }),
1298
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1299
+ "button",
1300
+ {
1301
+ className: "copilotKitCodeBlockToolbarButton",
1302
+ onClick: downloadAsFile,
1303
+ children: DownloadIcon
1304
+ }
1305
+ ),
1178
1306
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: isCopied ? CheckIcon : CopyIcon })
1179
1307
  ] })
1180
1308
  ] }),
@@ -1486,7 +1614,16 @@ var import_jsx_runtime12 = require("react/jsx-runtime");
1486
1614
  var defaultComponents = {
1487
1615
  a(_a) {
1488
1616
  var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
1489
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("a", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { target: "_blank", rel: "noopener noreferrer", children }));
1617
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1618
+ "a",
1619
+ __spreadProps(__spreadValues({
1620
+ className: "copilotKitMarkdownElement"
1621
+ }, props), {
1622
+ target: "_blank",
1623
+ rel: "noopener noreferrer",
1624
+ children
1625
+ })
1626
+ );
1490
1627
  },
1491
1628
  // @ts-expect-error -- inline
1492
1629
  code(_c) {
@@ -1584,7 +1721,10 @@ var Markdown = ({ content, components }) => {
1584
1721
  MemoizedReactMarkdown,
1585
1722
  {
1586
1723
  components: __spreadValues(__spreadValues({}, defaultComponents), components),
1587
- remarkPlugins: [import_remark_gfm.default, [import_remark_math.default, { singleDollarTextMath: false }]],
1724
+ remarkPlugins: [
1725
+ import_remark_gfm.default,
1726
+ [import_remark_math.default, { singleDollarTextMath: false }]
1727
+ ],
1588
1728
  rehypePlugins: [import_rehype_raw.default],
1589
1729
  children: content
1590
1730
  }
@@ -1703,7 +1843,11 @@ var AssistantMessage = (props) => {
1703
1843
  // src/components/chat/messages/ImageRenderer.tsx
1704
1844
  var import_react9 = require("react");
1705
1845
  var import_jsx_runtime14 = require("react/jsx-runtime");
1706
- var ImageRenderer = ({ image, content, className = "" }) => {
1846
+ var ImageRenderer = ({
1847
+ image,
1848
+ content,
1849
+ className = ""
1850
+ }) => {
1707
1851
  const [imageError, setImageError] = (0, import_react9.useState)(false);
1708
1852
  const imageSrc = `data:image/${image.format};base64,${image.bytes}`;
1709
1853
  const altText = content || "User uploaded image";
@@ -1711,10 +1855,16 @@ var ImageRenderer = ({ image, content, className = "" }) => {
1711
1855
  setImageError(true);
1712
1856
  };
1713
1857
  if (imageError) {
1714
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `copilotKitImageRendering copilotKitImageRenderingError ${className}`, children: [
1715
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitImageRenderingErrorMessage", children: "Failed to load image" }),
1716
- content && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitImageRenderingContent", children: content })
1717
- ] });
1858
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1859
+ "div",
1860
+ {
1861
+ className: `copilotKitImageRendering copilotKitImageRenderingError ${className}`,
1862
+ children: [
1863
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitImageRenderingErrorMessage", children: "Failed to load image" }),
1864
+ content && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitImageRenderingContent", children: content })
1865
+ ]
1866
+ }
1867
+ );
1718
1868
  }
1719
1869
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `copilotKitImageRendering ${className}`, children: [
1720
1870
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
@@ -1947,7 +2097,10 @@ var Messages = ({
1947
2097
  var _a;
1948
2098
  const { labels, icons } = useChatContext();
1949
2099
  const { messages: visibleMessages, interrupt } = (0, import_react_core5.useCopilotChatInternal)();
1950
- const initialMessages = (0, import_react10.useMemo)(() => makeInitialMessages(labels.initial), [labels.initial]);
2100
+ const initialMessages = (0, import_react10.useMemo)(
2101
+ () => makeInitialMessages(labels.initial),
2102
+ [labels.initial]
2103
+ );
1951
2104
  const messages = [...initialMessages, ...visibleMessages];
1952
2105
  const { messagesContainerRef, messagesEndRef } = useScrollToBottom(messages);
1953
2106
  const hasLegacyProps = !!(RenderTextMessage || RenderActionExecutionMessage || RenderAgentStateMessage || RenderResultMessage || RenderImageMessage);
@@ -2105,7 +2258,10 @@ var AutoResizingTextarea = (0, import_react11.forwardRef)(
2105
2258
  }, ref) => {
2106
2259
  const internalTextareaRef = (0, import_react11.useRef)(null);
2107
2260
  const [maxHeight, setMaxHeight] = (0, import_react11.useState)(0);
2108
- (0, import_react11.useImperativeHandle)(ref, () => internalTextareaRef.current);
2261
+ (0, import_react11.useImperativeHandle)(
2262
+ ref,
2263
+ () => internalTextareaRef.current
2264
+ );
2109
2265
  (0, import_react11.useEffect)(() => {
2110
2266
  const calculateMaxHeight = () => {
2111
2267
  const textarea = internalTextareaRef.current;
@@ -2155,7 +2311,9 @@ var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
2155
2311
  var import_react12 = require("react");
2156
2312
  var startRecording = (mediaStreamRef, mediaRecorderRef, audioContextRef, recordedChunks, onStop) => __async(void 0, null, function* () {
2157
2313
  if (!mediaStreamRef.current || !audioContextRef.current) {
2158
- mediaStreamRef.current = yield navigator.mediaDevices.getUserMedia({ audio: true });
2314
+ mediaStreamRef.current = yield navigator.mediaDevices.getUserMedia({
2315
+ audio: true
2316
+ });
2159
2317
  audioContextRef.current = new window.AudioContext();
2160
2318
  yield audioContextRef.current.resume();
2161
2319
  }
@@ -2224,14 +2382,15 @@ var usePushToTalk = ({
2224
2382
  } else {
2225
2383
  stopRecording(mediaRecorderRef);
2226
2384
  if (pushToTalkState === "transcribing") {
2227
- transcribeAudio(recordedChunks.current, context.copilotApiConfig.transcribeAudioUrl).then(
2228
- (transcription) => __async(void 0, null, function* () {
2229
- recordedChunks.current = [];
2230
- setPushToTalkState("idle");
2231
- const message = yield sendFunction(transcription);
2232
- setStartReadingFromMessageId(message.id);
2233
- })
2234
- );
2385
+ transcribeAudio(
2386
+ recordedChunks.current,
2387
+ context.copilotApiConfig.transcribeAudioUrl
2388
+ ).then((transcription) => __async(void 0, null, function* () {
2389
+ recordedChunks.current = [];
2390
+ setPushToTalkState("idle");
2391
+ const message = yield sendFunction(transcription);
2392
+ setStartReadingFromMessageId(message.id);
2393
+ }));
2235
2394
  }
2236
2395
  }
2237
2396
  return () => {
@@ -2246,7 +2405,11 @@ var usePushToTalk = ({
2246
2405
  const aguiMessages = (0, import_runtime_client_gql2.gqlToAGUI)(context.messages);
2247
2406
  const messagesAfterLast = aguiMessages.slice(lastMessageIndex + 1).filter((message) => message.role === "assistant");
2248
2407
  const text = messagesAfterLast.map((message) => message.content).join("\n");
2249
- playAudioResponse(text, context.copilotApiConfig.textToSpeechUrl, audioContextRef.current);
2408
+ playAudioResponse(
2409
+ text,
2410
+ context.copilotApiConfig.textToSpeechUrl,
2411
+ audioContextRef.current
2412
+ );
2250
2413
  setStartReadingFromMessageId(null);
2251
2414
  }
2252
2415
  }, [startReadingFromMessageId, inProgress]);
@@ -2268,7 +2431,9 @@ var useDarkMode = () => {
2268
2431
 
2269
2432
  // src/components/chat/PoweredByTag.tsx
2270
2433
  var import_jsx_runtime19 = require("react/jsx-runtime");
2271
- function PoweredByTag({ showPoweredBy = true }) {
2434
+ function PoweredByTag({
2435
+ showPoweredBy = true
2436
+ }) {
2272
2437
  const [mounted, setMounted] = (0, import_react13.useState)(false);
2273
2438
  const isDark = useDarkMode();
2274
2439
  (0, import_react13.useEffect)(() => {
@@ -2334,7 +2499,13 @@ var Input = ({
2334
2499
  if (!chatReady)
2335
2500
  return { buttonIcon: context.icons.spinnerIcon, buttonAlt: "Loading" };
2336
2501
  return isInProgress && !hideStopButton && chatReady ? { buttonIcon: context.icons.stopIcon, buttonAlt: "Stop" } : { buttonIcon: context.icons.sendIcon, buttonAlt: "Send" };
2337
- }, [isInProgress, chatReady, hideStopButton, context.icons.stopIcon, context.icons.sendIcon]);
2502
+ }, [
2503
+ isInProgress,
2504
+ chatReady,
2505
+ hideStopButton,
2506
+ context.icons.stopIcon,
2507
+ context.icons.sendIcon
2508
+ ]);
2338
2509
  const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
2339
2510
  const { interrupt } = (0, import_react_core7.useCopilotChatInternal)();
2340
2511
  const canSend = (0, import_react14.useMemo)(() => {
@@ -2344,56 +2515,64 @@ var Input = ({
2344
2515
  return isInProgress && !hideStopButton;
2345
2516
  }, [isInProgress, hideStopButton]);
2346
2517
  const sendDisabled = !canSend && !canStop;
2347
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`, children: [
2348
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
2349
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2350
- Textarea_default,
2351
- {
2352
- ref: textareaRef,
2353
- placeholder: context.labels.placeholder,
2354
- autoFocus: false,
2355
- maxRows: MAX_NEWLINES,
2356
- value: text,
2357
- onChange: (event) => setText(event.target.value),
2358
- onCompositionStart: () => setIsComposing(true),
2359
- onCompositionEnd: () => setIsComposing(false),
2360
- onKeyDown: (event) => {
2361
- if (event.key === "Enter" && !event.shiftKey && !isComposing) {
2362
- event.preventDefault();
2363
- if (canSend) {
2364
- send();
2518
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2519
+ "div",
2520
+ {
2521
+ className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`,
2522
+ children: [
2523
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
2524
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2525
+ Textarea_default,
2526
+ {
2527
+ ref: textareaRef,
2528
+ placeholder: context.labels.placeholder,
2529
+ autoFocus: false,
2530
+ maxRows: MAX_NEWLINES,
2531
+ value: text,
2532
+ onChange: (event) => setText(event.target.value),
2533
+ onCompositionStart: () => setIsComposing(true),
2534
+ onCompositionEnd: () => setIsComposing(false),
2535
+ onKeyDown: (event) => {
2536
+ if (event.key === "Enter" && !event.shiftKey && !isComposing) {
2537
+ event.preventDefault();
2538
+ if (canSend) {
2539
+ send();
2540
+ }
2541
+ }
2365
2542
  }
2366
2543
  }
2367
- }
2368
- }
2369
- ),
2370
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitInputControls", children: [
2371
- onUpload && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { onClick: onUpload, className: "copilotKitInputControlButton", children: context.icons.uploadIcon }),
2372
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { flexGrow: 1 } }),
2373
- showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2374
- "button",
2375
- {
2376
- onClick: () => setPushToTalkState(pushToTalkState === "idle" ? "recording" : "transcribing"),
2377
- className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
2378
- children: context.icons.pushToTalkIcon
2379
- }
2380
- ),
2381
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2382
- "button",
2383
- {
2384
- disabled: sendDisabled,
2385
- onClick: isInProgress && !hideStopButton ? onStop : send,
2386
- "data-copilotkit-in-progress": inProgress,
2387
- "data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
2388
- className: "copilotKitInputControlButton",
2389
- "aria-label": buttonAlt,
2390
- children: buttonIcon
2391
- }
2392
- )
2393
- ] })
2394
- ] }),
2395
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PoweredByTag, { showPoweredBy })
2396
- ] });
2544
+ ),
2545
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitInputControls", children: [
2546
+ onUpload && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { onClick: onUpload, className: "copilotKitInputControlButton", children: context.icons.uploadIcon }),
2547
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { flexGrow: 1 } }),
2548
+ showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2549
+ "button",
2550
+ {
2551
+ onClick: () => setPushToTalkState(
2552
+ pushToTalkState === "idle" ? "recording" : "transcribing"
2553
+ ),
2554
+ className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
2555
+ children: context.icons.pushToTalkIcon
2556
+ }
2557
+ ),
2558
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2559
+ "button",
2560
+ {
2561
+ disabled: sendDisabled,
2562
+ onClick: isInProgress && !hideStopButton ? onStop : send,
2563
+ "data-copilotkit-in-progress": inProgress,
2564
+ "data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
2565
+ className: "copilotKitInputControlButton",
2566
+ "aria-label": buttonAlt,
2567
+ children: buttonIcon
2568
+ }
2569
+ )
2570
+ ] })
2571
+ ] }),
2572
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PoweredByTag, { showPoweredBy })
2573
+ ]
2574
+ }
2575
+ );
2397
2576
  };
2398
2577
 
2399
2578
  // src/components/chat/Chat.tsx
@@ -2482,7 +2661,12 @@ var ImageUploadQueue = ({
2482
2661
  // src/components/chat/Suggestion.tsx
2483
2662
  var import_react_core8 = require("@copilotkit/react-core");
2484
2663
  var import_jsx_runtime22 = require("react/jsx-runtime");
2485
- function Suggestion({ title, onClick, partial, className }) {
2664
+ function Suggestion({
2665
+ title,
2666
+ onClick,
2667
+ partial,
2668
+ className
2669
+ }) {
2486
2670
  const { isLoading } = (0, import_react_core8.useCopilotChatInternal)();
2487
2671
  if (!title)
2488
2672
  return null;
@@ -2576,9 +2760,7 @@ function CopilotChat({
2576
2760
  const { publicApiKey, chatApiEndpoint } = copilotApiConfig;
2577
2761
  const [selectedImages, setSelectedImages] = (0, import_react15.useState)([]);
2578
2762
  const [chatError, setChatError] = (0, import_react15.useState)(null);
2579
- const [messageFeedback, setMessageFeedback] = (0, import_react15.useState)(
2580
- {}
2581
- );
2763
+ const [messageFeedback, setMessageFeedback] = (0, import_react15.useState)({});
2582
2764
  const fileInputRef = (0, import_react15.useRef)(null);
2583
2765
  const triggerObservabilityHook = (0, import_react15.useCallback)(
2584
2766
  (hookName, ...args) => {
@@ -2671,30 +2853,34 @@ function CopilotChat({
2671
2853
  if (imageItems.length === 0)
2672
2854
  return;
2673
2855
  e.preventDefault();
2674
- const imagePromises = imageItems.map((item) => {
2675
- const file = item.getAsFile();
2676
- if (!file)
2677
- return Promise.resolve(null);
2678
- return new Promise((resolve, reject) => {
2679
- const reader = new FileReader();
2680
- reader.onload = (e2) => {
2681
- var _a2, _b2;
2682
- const base64String = (_b2 = (_a2 = e2.target) == null ? void 0 : _a2.result) == null ? void 0 : _b2.split(",")[1];
2683
- if (base64String) {
2684
- resolve({
2685
- contentType: file.type,
2686
- bytes: base64String
2687
- });
2688
- } else {
2689
- resolve(null);
2690
- }
2691
- };
2692
- reader.onerror = reject;
2693
- reader.readAsDataURL(file);
2694
- });
2695
- });
2856
+ const imagePromises = imageItems.map(
2857
+ (item) => {
2858
+ const file = item.getAsFile();
2859
+ if (!file)
2860
+ return Promise.resolve(null);
2861
+ return new Promise((resolve, reject) => {
2862
+ const reader = new FileReader();
2863
+ reader.onload = (e2) => {
2864
+ var _a2, _b2;
2865
+ const base64String = (_b2 = (_a2 = e2.target) == null ? void 0 : _a2.result) == null ? void 0 : _b2.split(",")[1];
2866
+ if (base64String) {
2867
+ resolve({
2868
+ contentType: file.type,
2869
+ bytes: base64String
2870
+ });
2871
+ } else {
2872
+ resolve(null);
2873
+ }
2874
+ };
2875
+ reader.onerror = reject;
2876
+ reader.readAsDataURL(file);
2877
+ });
2878
+ }
2879
+ );
2696
2880
  try {
2697
- const loadedImages = (yield Promise.all(imagePromises)).filter((img) => img !== null);
2881
+ const loadedImages = (yield Promise.all(imagePromises)).filter(
2882
+ (img) => img !== null
2883
+ );
2698
2884
  setSelectedImages((prev) => [...prev, ...loadedImages]);
2699
2885
  } catch (error) {
2700
2886
  triggerChatError(error, "processClipboardImages", error);
@@ -2775,25 +2961,29 @@ function CopilotChat({
2775
2961
  if (!event.target.files || event.target.files.length === 0) {
2776
2962
  return;
2777
2963
  }
2778
- const files = Array.from(event.target.files).filter((file) => file.type.startsWith("image/"));
2964
+ const files = Array.from(event.target.files).filter(
2965
+ (file) => file.type.startsWith("image/")
2966
+ );
2779
2967
  if (files.length === 0)
2780
2968
  return;
2781
2969
  const fileReadPromises = files.map((file) => {
2782
- return new Promise((resolve, reject) => {
2783
- const reader = new FileReader();
2784
- reader.onload = (e) => {
2785
- var _a, _b;
2786
- const base64String = ((_b = (_a = e.target) == null ? void 0 : _a.result) == null ? void 0 : _b.split(",")[1]) || "";
2787
- if (base64String) {
2788
- resolve({
2789
- contentType: file.type,
2790
- bytes: base64String
2791
- });
2792
- }
2793
- };
2794
- reader.onerror = reject;
2795
- reader.readAsDataURL(file);
2796
- });
2970
+ return new Promise(
2971
+ (resolve, reject) => {
2972
+ const reader = new FileReader();
2973
+ reader.onload = (e) => {
2974
+ var _a, _b;
2975
+ const base64String = ((_b = (_a = e.target) == null ? void 0 : _a.result) == null ? void 0 : _b.split(",")[1]) || "";
2976
+ if (base64String) {
2977
+ resolve({
2978
+ contentType: file.type,
2979
+ bytes: base64String
2980
+ });
2981
+ }
2982
+ };
2983
+ reader.onerror = reject;
2984
+ reader.readAsDataURL(file);
2985
+ }
2986
+ );
2797
2987
  });
2798
2988
  try {
2799
2989
  const loadedImages = yield Promise.all(fileReadPromises);
@@ -2864,7 +3054,13 @@ function CopilotChat({
2864
3054
  }
2865
3055
  ),
2866
3056
  imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
2867
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ImageUploadQueue, { images: selectedImages, onRemoveImage: removeSelectedImage }),
3057
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3058
+ ImageUploadQueue,
3059
+ {
3060
+ images: selectedImages,
3061
+ onRemoveImage: removeSelectedImage
3062
+ }
3063
+ ),
2868
3064
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2869
3065
  "input",
2870
3066
  {
@@ -2902,8 +3098,17 @@ function WrappedCopilotChat({
2902
3098
  }) {
2903
3099
  const chatContext = import_react15.default.useContext(ChatContext);
2904
3100
  if (!chatContext) {
2905
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
2906
- }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children }) });
3101
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3102
+ ChatContextProvider,
3103
+ {
3104
+ icons,
3105
+ labels,
3106
+ open: true,
3107
+ setOpen: () => {
3108
+ },
3109
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children })
3110
+ }
3111
+ );
2907
3112
  }
2908
3113
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children });
2909
3114
  }
@@ -3052,37 +3257,46 @@ var CopilotModal = (_a) => {
3052
3257
  "observabilityHooks"
3053
3258
  ]);
3054
3259
  const [openState, setOpenState] = import_react16.default.useState(defaultOpen);
3055
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChatContextProvider, { icons, labels, open: openState, setOpen: setOpenState, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3056
- CopilotModalInner,
3057
- __spreadProps(__spreadValues({
3058
- observabilityHooks,
3059
- onSetOpen,
3060
- clickOutsideToClose: clickOutsideToClose != null ? clickOutsideToClose : true,
3061
- hitEscapeToClose: hitEscapeToClose != null ? hitEscapeToClose : true,
3062
- shortcut: shortcut != null ? shortcut : "/",
3063
- className,
3064
- Window: Window2,
3065
- Button: Button2,
3066
- Header: Header2,
3067
- instructions,
3068
- onSubmitMessage,
3069
- onStopGeneration,
3070
- onReloadMessages,
3071
- makeSystemMessage,
3072
- onInProgress,
3073
- Messages: Messages2,
3074
- Input: Input2,
3075
- AssistantMessage: AssistantMessage2,
3076
- UserMessage: UserMessage2,
3077
- onThumbsUp,
3078
- onThumbsDown,
3079
- onCopy,
3080
- onRegenerate,
3081
- markdownTagRenderers
3082
- }, props), {
3083
- children
3084
- })
3085
- ) });
3260
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3261
+ ChatContextProvider,
3262
+ {
3263
+ icons,
3264
+ labels,
3265
+ open: openState,
3266
+ setOpen: setOpenState,
3267
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3268
+ CopilotModalInner,
3269
+ __spreadProps(__spreadValues({
3270
+ observabilityHooks,
3271
+ onSetOpen,
3272
+ clickOutsideToClose: clickOutsideToClose != null ? clickOutsideToClose : true,
3273
+ hitEscapeToClose: hitEscapeToClose != null ? hitEscapeToClose : true,
3274
+ shortcut: shortcut != null ? shortcut : "/",
3275
+ className,
3276
+ Window: Window2,
3277
+ Button: Button2,
3278
+ Header: Header2,
3279
+ instructions,
3280
+ onSubmitMessage,
3281
+ onStopGeneration,
3282
+ onReloadMessages,
3283
+ makeSystemMessage,
3284
+ onInProgress,
3285
+ Messages: Messages2,
3286
+ Input: Input2,
3287
+ AssistantMessage: AssistantMessage2,
3288
+ UserMessage: UserMessage2,
3289
+ onThumbsUp,
3290
+ onThumbsDown,
3291
+ onCopy,
3292
+ onRegenerate,
3293
+ markdownTagRenderers
3294
+ }, props), {
3295
+ children
3296
+ })
3297
+ )
3298
+ }
3299
+ );
3086
3300
  };
3087
3301
 
3088
3302
  // src/components/chat/Popup.tsx