@copilotkit/react-ui 1.7.2-next.2 → 1.8.0-next.3

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 (161) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{chunk-QXTRFMPM.mjs → chunk-2LRE4W6A.mjs} +13 -11
  3. package/dist/chunk-2LRE4W6A.mjs.map +1 -0
  4. package/dist/{chunk-QXQDIFOC.mjs → chunk-5GNYGURH.mjs} +48 -37
  5. package/dist/chunk-5GNYGURH.mjs.map +1 -0
  6. package/dist/{chunk-CBBFRI3Q.mjs → chunk-5JY5QJ2W.mjs} +9 -5
  7. package/dist/chunk-5JY5QJ2W.mjs.map +1 -0
  8. package/dist/{chunk-OFYI4UU4.mjs → chunk-7RIBDD4K.mjs} +19 -3
  9. package/dist/chunk-7RIBDD4K.mjs.map +1 -0
  10. package/dist/{chunk-YAGE7RCE.mjs → chunk-CGVOCLHN.mjs} +2 -2
  11. package/dist/chunk-FBYETUFL.mjs +118 -0
  12. package/dist/chunk-FBYETUFL.mjs.map +1 -0
  13. package/dist/chunk-GDJAAFIK.mjs +24 -0
  14. package/dist/chunk-GDJAAFIK.mjs.map +1 -0
  15. package/dist/{chunk-6FTRYYR5.mjs → chunk-GJME6MK4.mjs} +72 -62
  16. package/dist/chunk-GJME6MK4.mjs.map +1 -0
  17. package/dist/{chunk-AELKLZSG.mjs → chunk-KG6DW6R2.mjs} +10 -10
  18. package/dist/{chunk-DLG7BZTA.mjs → chunk-LKCAF2HG.mjs} +2 -2
  19. package/dist/{chunk-R2O33F44.mjs → chunk-LXCH2BIB.mjs} +2 -2
  20. package/dist/chunk-ORSMX3SE.mjs +244 -0
  21. package/dist/chunk-ORSMX3SE.mjs.map +1 -0
  22. package/dist/{chunk-UPTB2MVO.mjs → chunk-PCTCOQK2.mjs} +4 -10
  23. package/dist/chunk-PCTCOQK2.mjs.map +1 -0
  24. package/dist/{chunk-ZIF5JJCH.mjs → chunk-QGK5GOSC.mjs} +24 -53
  25. package/dist/chunk-QGK5GOSC.mjs.map +1 -0
  26. package/dist/{chunk-WGAZXTUA.mjs → chunk-TOQ7P4DO.mjs} +6 -9
  27. package/dist/chunk-TOQ7P4DO.mjs.map +1 -0
  28. package/dist/{chunk-3XAXY2Z3.mjs → chunk-UZTZXMYS.mjs} +2 -2
  29. package/dist/{chunk-RQNJNK2W.mjs → chunk-VC4NO5QZ.mjs} +2 -2
  30. package/dist/{chunk-YQ3D5IQV.mjs → chunk-XNQO5AZZ.mjs} +2 -5
  31. package/dist/chunk-XNQO5AZZ.mjs.map +1 -0
  32. package/dist/chunk-YC4NBUGE.mjs +97 -0
  33. package/dist/chunk-YC4NBUGE.mjs.map +1 -0
  34. package/dist/components/chat/Button.js.map +1 -1
  35. package/dist/components/chat/Button.mjs +3 -3
  36. package/dist/components/chat/Chat.d.ts +17 -1
  37. package/dist/components/chat/Chat.js +378 -905
  38. package/dist/components/chat/Chat.js.map +1 -1
  39. package/dist/components/chat/Chat.mjs +11 -18
  40. package/dist/components/chat/ChatContext.d.ts +20 -0
  41. package/dist/components/chat/ChatContext.js +44 -74
  42. package/dist/components/chat/ChatContext.js.map +1 -1
  43. package/dist/components/chat/ChatContext.mjs +2 -2
  44. package/dist/components/chat/CodeBlock.js +58 -82
  45. package/dist/components/chat/CodeBlock.js.map +1 -1
  46. package/dist/components/chat/CodeBlock.mjs +2 -2
  47. package/dist/components/chat/Header.js +516 -4
  48. package/dist/components/chat/Header.js.map +1 -1
  49. package/dist/components/chat/Header.mjs +10 -3
  50. package/dist/components/chat/Icons.d.ts +10 -9
  51. package/dist/components/chat/Icons.js +125 -164
  52. package/dist/components/chat/Icons.js.map +1 -1
  53. package/dist/components/chat/Icons.mjs +9 -5
  54. package/dist/components/chat/Input.d.ts +1 -1
  55. package/dist/components/chat/Input.js +11 -9
  56. package/dist/components/chat/Input.js.map +1 -1
  57. package/dist/components/chat/Input.mjs +3 -3
  58. package/dist/components/chat/Markdown.js +58 -56
  59. package/dist/components/chat/Markdown.js.map +1 -1
  60. package/dist/components/chat/Markdown.mjs +3 -3
  61. package/dist/components/chat/Messages.d.ts +1 -1
  62. package/dist/components/chat/Messages.js +70 -60
  63. package/dist/components/chat/Messages.js.map +1 -1
  64. package/dist/components/chat/Messages.mjs +3 -3
  65. package/dist/components/chat/Modal.js +1708 -1749
  66. package/dist/components/chat/Modal.js.map +1 -1
  67. package/dist/components/chat/Modal.mjs +21 -21
  68. package/dist/components/chat/Popup.js +1708 -1749
  69. package/dist/components/chat/Popup.js.map +1 -1
  70. package/dist/components/chat/Popup.mjs +22 -22
  71. package/dist/components/chat/Response.js.map +1 -1
  72. package/dist/components/chat/Response.mjs +3 -3
  73. package/dist/components/chat/Sidebar.js +1710 -1751
  74. package/dist/components/chat/Sidebar.js.map +1 -1
  75. package/dist/components/chat/Sidebar.mjs +22 -22
  76. package/dist/components/chat/Suggestion.js +4 -40
  77. package/dist/components/chat/Suggestion.js.map +1 -1
  78. package/dist/components/chat/Suggestion.mjs +2 -2
  79. package/dist/components/chat/Window.js.map +1 -1
  80. package/dist/components/chat/Window.mjs +3 -3
  81. package/dist/components/chat/index.js +1710 -1751
  82. package/dist/components/chat/index.js.map +1 -1
  83. package/dist/components/chat/index.mjs +24 -24
  84. package/dist/components/chat/messages/AssistantMessage.js +211 -59
  85. package/dist/components/chat/messages/AssistantMessage.js.map +1 -1
  86. package/dist/components/chat/messages/AssistantMessage.mjs +5 -5
  87. package/dist/components/chat/messages/RenderTextMessage.js +18 -2
  88. package/dist/components/chat/messages/RenderTextMessage.js.map +1 -1
  89. package/dist/components/chat/messages/RenderTextMessage.mjs +1 -1
  90. package/dist/components/chat/props.d.ts +53 -0
  91. package/dist/components/chat/props.js.map +1 -1
  92. package/dist/components/dev-console/console.js +51 -233
  93. package/dist/components/dev-console/console.js.map +1 -1
  94. package/dist/components/dev-console/console.mjs +3 -3
  95. package/dist/components/dev-console/index.js +51 -233
  96. package/dist/components/dev-console/index.js.map +1 -1
  97. package/dist/components/dev-console/index.mjs +3 -3
  98. package/dist/components/help-modal/index.js +29 -147
  99. package/dist/components/help-modal/index.js.map +1 -1
  100. package/dist/components/help-modal/index.mjs +1 -1
  101. package/dist/components/help-modal/modal.js +29 -147
  102. package/dist/components/help-modal/modal.js.map +1 -1
  103. package/dist/components/help-modal/modal.mjs +1 -1
  104. package/dist/components/index.js +1683 -1724
  105. package/dist/components/index.js.map +1 -1
  106. package/dist/components/index.mjs +28 -28
  107. package/dist/index.css +254 -90
  108. package/dist/index.css.map +1 -1
  109. package/dist/index.js +1692 -1733
  110. package/dist/index.js.map +1 -1
  111. package/dist/index.mjs +28 -28
  112. package/dist/types/css.d.ts +7 -1
  113. package/dist/types/css.js.map +1 -1
  114. package/package.json +4 -4
  115. package/src/components/chat/Chat.tsx +59 -22
  116. package/src/components/chat/ChatContext.tsx +29 -1
  117. package/src/components/chat/CodeBlock.tsx +2 -4
  118. package/src/components/chat/Header.tsx +8 -3
  119. package/src/components/chat/Icons.tsx +108 -108
  120. package/src/components/chat/Input.tsx +42 -38
  121. package/src/components/chat/Markdown.tsx +0 -3
  122. package/src/components/chat/Messages.tsx +68 -56
  123. package/src/components/chat/Suggestion.tsx +2 -3
  124. package/src/components/chat/messages/AssistantMessage.tsx +95 -3
  125. package/src/components/chat/messages/RenderTextMessage.tsx +17 -1
  126. package/src/components/chat/props.ts +66 -0
  127. package/src/components/dev-console/console.tsx +16 -54
  128. package/src/components/help-modal/modal.tsx +38 -101
  129. package/src/css/button.css +15 -4
  130. package/src/css/colors.css +27 -6
  131. package/src/css/console.css +46 -39
  132. package/src/css/header.css +22 -5
  133. package/src/css/input.css +24 -17
  134. package/src/css/markdown.css +2 -1
  135. package/src/css/messages.css +125 -15
  136. package/src/css/panel.css +1 -0
  137. package/src/css/suggestions.css +14 -6
  138. package/src/types/css.ts +7 -1
  139. package/dist/chunk-3VNMQWGT.mjs +0 -25
  140. package/dist/chunk-3VNMQWGT.mjs.map +0 -1
  141. package/dist/chunk-6FTRYYR5.mjs.map +0 -1
  142. package/dist/chunk-CBBFRI3Q.mjs.map +0 -1
  143. package/dist/chunk-FZC7X5PK.mjs +0 -262
  144. package/dist/chunk-FZC7X5PK.mjs.map +0 -1
  145. package/dist/chunk-OFYI4UU4.mjs.map +0 -1
  146. package/dist/chunk-QXQDIFOC.mjs.map +0 -1
  147. package/dist/chunk-QXTRFMPM.mjs.map +0 -1
  148. package/dist/chunk-TI7SY2RI.mjs +0 -164
  149. package/dist/chunk-TI7SY2RI.mjs.map +0 -1
  150. package/dist/chunk-UPTB2MVO.mjs.map +0 -1
  151. package/dist/chunk-VEC45H6Q.mjs +0 -18
  152. package/dist/chunk-VEC45H6Q.mjs.map +0 -1
  153. package/dist/chunk-WGAZXTUA.mjs.map +0 -1
  154. package/dist/chunk-YQ3D5IQV.mjs.map +0 -1
  155. package/dist/chunk-ZIF5JJCH.mjs.map +0 -1
  156. /package/dist/{chunk-YAGE7RCE.mjs.map → chunk-CGVOCLHN.mjs.map} +0 -0
  157. /package/dist/{chunk-AELKLZSG.mjs.map → chunk-KG6DW6R2.mjs.map} +0 -0
  158. /package/dist/{chunk-DLG7BZTA.mjs.map → chunk-LKCAF2HG.mjs.map} +0 -0
  159. /package/dist/{chunk-R2O33F44.mjs.map → chunk-LXCH2BIB.mjs.map} +0 -0
  160. /package/dist/{chunk-3XAXY2Z3.mjs.map → chunk-UZTZXMYS.mjs.map} +0 -0
  161. /package/dist/{chunk-RQNJNK2W.mjs.map → chunk-VC4NO5QZ.mjs.map} +0 -0
@@ -90,7 +90,7 @@ __export(chat_exports, {
90
90
  module.exports = __toCommonJS(chat_exports);
91
91
 
92
92
  // src/components/chat/Modal.tsx
93
- var import_react13 = __toESM(require("react"));
93
+ var import_react14 = __toESM(require("react"));
94
94
 
95
95
  // src/components/chat/ChatContext.tsx
96
96
  var import_react = __toESM(require("react"));
@@ -147,7 +147,20 @@ var SendIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
147
147
  xmlns: "http://www.w3.org/2000/svg",
148
148
  fill: "none",
149
149
  viewBox: "0 0 24 24",
150
- strokeWidth: 1.5,
150
+ strokeWidth: "1.5",
151
+ stroke: "currentColor",
152
+ width: "24",
153
+ height: "24",
154
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 19V5m0 0l-7 7m7-7l7 7" })
155
+ }
156
+ );
157
+ var MicrophoneIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
158
+ "svg",
159
+ {
160
+ xmlns: "http://www.w3.org/2000/svg",
161
+ fill: "none",
162
+ viewBox: "0 0 24 24",
163
+ strokeWidth: "1.5",
151
164
  stroke: "currentColor",
152
165
  width: "24",
153
166
  height: "24",
@@ -156,184 +169,157 @@ var SendIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
156
169
  {
157
170
  strokeLinecap: "round",
158
171
  strokeLinejoin: "round",
159
- d: "M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5"
172
+ d: "M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"
160
173
  }
161
174
  )
162
175
  }
163
176
  );
164
- var SpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
177
+ var StopIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
165
178
  "svg",
166
179
  {
167
- style: {
168
- animation: "copilotKitSpinAnimation 1s linear infinite",
169
- color: "rgb(107 114 128)"
170
- },
171
- width: "24",
172
- height: "24",
173
180
  xmlns: "http://www.w3.org/2000/svg",
174
181
  fill: "none",
175
182
  viewBox: "0 0 24 24",
176
- children: [
177
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
178
- "circle",
179
- {
180
- style: { opacity: 0.25 },
181
- cx: "12",
182
- cy: "12",
183
- r: "10",
184
- stroke: "currentColor",
185
- strokeWidth: "4"
186
- }
187
- ),
188
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
189
- "path",
190
- {
191
- style: { opacity: 0.75 },
192
- fill: "currentColor",
193
- d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
194
- }
195
- )
196
- ]
183
+ strokeWidth: "1.5",
184
+ stroke: "currentColor",
185
+ width: "24",
186
+ height: "24",
187
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
188
+ "path",
189
+ {
190
+ strokeLinecap: "round",
191
+ strokeLinejoin: "round",
192
+ d: "M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"
193
+ }
194
+ )
197
195
  }
198
196
  );
199
- var SmallSpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
197
+ var RegenerateIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
200
198
  "svg",
201
199
  {
202
- style: {
203
- animation: "copilotKitSpinAnimation 1s linear infinite"
204
- },
205
- width: "13",
206
- height: "13",
207
200
  xmlns: "http://www.w3.org/2000/svg",
208
201
  fill: "none",
209
202
  viewBox: "0 0 24 24",
210
- children: [
211
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
212
- "circle",
213
- {
214
- style: { opacity: 0.25 },
215
- cx: "12",
216
- cy: "12",
217
- r: "10",
218
- stroke: "currentColor",
219
- strokeWidth: "4"
220
- }
221
- ),
222
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
223
- "path",
224
- {
225
- style: { opacity: 0.75 },
226
- fill: "currentColor",
227
- d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
228
- }
229
- )
230
- ]
203
+ strokeWidth: "2",
204
+ stroke: "currentColor",
205
+ width: "16",
206
+ height: "16",
207
+ style: { minWidth: "16px", minHeight: "16px" },
208
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
209
+ "path",
210
+ {
211
+ strokeLinecap: "round",
212
+ strokeLinejoin: "round",
213
+ d: "M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99"
214
+ }
215
+ )
231
216
  }
232
217
  );
233
- var ActivityIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
218
+ var CopyIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
234
219
  "svg",
235
220
  {
236
- style: {
237
- display: "inline-block",
238
- marginLeft: "0.25rem",
239
- marginRight: "0.25rem"
240
- },
241
- height: "24",
242
- width: "24",
243
- viewBox: "0 0 27 27",
244
221
  xmlns: "http://www.w3.org/2000/svg",
245
- fill: "currentColor",
246
- children: [
247
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { className: "copilotKitActivityDot1", cx: "4", cy: "12", r: "3" }),
248
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { className: "copilotKitActivityDot1 copilotKitActivityDot2", cx: "12", cy: "12", r: "3" }),
249
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { className: "copilotKitActivityDot1 copilotKitActivityDot3", cx: "20", cy: "12", r: "3" })
250
- ]
222
+ fill: "none",
223
+ viewBox: "0 0 24 24",
224
+ strokeWidth: "2",
225
+ stroke: "currentColor",
226
+ width: "16",
227
+ height: "16",
228
+ style: { minWidth: "16px", minHeight: "16px" },
229
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
230
+ "path",
231
+ {
232
+ strokeLinecap: "round",
233
+ strokeLinejoin: "round",
234
+ d: "M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75"
235
+ }
236
+ )
251
237
  }
252
238
  );
253
- function CheckIcon(_a) {
254
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
255
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
256
- "svg",
257
- __spreadProps(__spreadValues({
258
- xmlns: "http://www.w3.org/2000/svg",
259
- viewBox: "0 0 256 256",
260
- fill: "currentColor",
261
- style: { height: "1rem", width: "1rem" },
262
- className
263
- }, props), {
264
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m229.66 77.66-128 128a8 8 0 0 1-11.32 0l-56-56a8 8 0 0 1 11.32-11.32L96 188.69 218.34 66.34a8 8 0 0 1 11.32 11.32Z" })
265
- })
266
- );
267
- }
268
- function DownloadIcon(_a) {
269
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
270
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
271
- "svg",
272
- __spreadProps(__spreadValues({
273
- xmlns: "http://www.w3.org/2000/svg",
274
- viewBox: "0 0 256 256",
275
- fill: "currentColor",
276
- style: { height: "1rem", width: "1rem" },
277
- className
278
- }, props), {
279
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M224 152v56a16 16 0 0 1-16 16H48a16 16 0 0 1-16-16v-56a8 8 0 0 1 16 0v56h160v-56a8 8 0 0 1 16 0Zm-101.66 5.66a8 8 0 0 0 11.32 0l40-40a8 8 0 0 0-11.32-11.32L136 132.69V40a8 8 0 0 0-16 0v92.69l-26.34-26.35a8 8 0 0 0-11.32 11.32Z" })
280
- })
281
- );
282
- }
283
- function CopyIcon(_a) {
284
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
285
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
286
- "svg",
287
- __spreadProps(__spreadValues({
288
- xmlns: "http://www.w3.org/2000/svg",
289
- viewBox: "0 0 256 256",
290
- fill: "currentColor",
291
- style: { height: "1rem", width: "1rem" },
292
- className
293
- }, props), {
294
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M216 32H88a8 8 0 0 0-8 8v40H40a8 8 0 0 0-8 8v128a8 8 0 0 0 8 8h128a8 8 0 0 0 8-8v-40h40a8 8 0 0 0 8-8V40a8 8 0 0 0-8-8Zm-56 176H48V96h112Zm48-48h-32V88a8 8 0 0 0-8-8H96V48h112Z" })
295
- })
296
- );
297
- }
298
- var StopIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
239
+ var SmallSpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitSpinner", style: { width: "13px", height: "13px" } });
240
+ var SpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitSpinner", style: { width: "24px", height: "24px" } });
241
+ var ActivityIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
242
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitActivityDot", style: { animationDelay: "0s" } }),
243
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitActivityDot", style: { animationDelay: "0.2s" } }),
244
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitActivityDot", style: { animationDelay: "0.4s" } })
245
+ ] });
246
+ var ThumbsUpIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
299
247
  "svg",
300
248
  {
301
249
  xmlns: "http://www.w3.org/2000/svg",
302
- viewBox: "0 0 256 256",
303
- fill: "currentColor",
304
- style: { height: "1rem", width: "1rem" },
305
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24Zm0 192a88 88 0 1 1 88-88 88.1 88.1 0 0 1-88 88Zm24-120h-48a8 8 0 0 0-8 8v48a8 8 0 0 0 8 8h48a8 8 0 0 0 8-8v-48a8 8 0 0 0-8-8Zm-8 48h-32v-32h32Z" })
250
+ fill: "none",
251
+ viewBox: "0 0 24 24",
252
+ strokeWidth: "2",
253
+ stroke: "currentColor",
254
+ width: "16",
255
+ height: "16",
256
+ style: { minWidth: "16px", minHeight: "16px" },
257
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
258
+ "path",
259
+ {
260
+ strokeLinecap: "round",
261
+ strokeLinejoin: "round",
262
+ d: "M6.633 10.5c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 012.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 00.322-1.672V3a.75.75 0 01.75-.75A2.25 2.25 0 0116.5 4.5c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 01-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 00-1.423-.23H5.904M14.25 9h2.25M5.904 18.75c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 01-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 10.203 4.167 9.75 5 9.75h1.053c.472 0 .745.556.5.96a8.958 8.958 0 00-1.302 4.665c0 1.194.232 2.333.654 3.375z"
263
+ }
264
+ )
306
265
  }
307
266
  );
308
- var RegenerateIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
267
+ var ThumbsDownIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
309
268
  "svg",
310
269
  {
311
270
  xmlns: "http://www.w3.org/2000/svg",
312
- viewBox: "0 0 256 256",
313
- fill: "currentColor",
314
- style: { height: "1rem", width: "1rem" },
315
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M197.67 186.37a8 8 0 0 1 0 11.29C196.58 198.73 170.82 224 128 224c-37.39 0-64.53-22.4-80-39.85V208a8 8 0 0 1-16 0v-48a8 8 0 0 1 8-8h48a8 8 0 0 1 0 16H55.44C67.76 183.35 93 208 128 208c36 0 58.14-21.46 58.36-21.68a8 8 0 0 1 11.31.05ZM216 40a8 8 0 0 0-8 8v23.85C192.53 54.4 165.39 32 128 32c-42.82 0-68.58 25.27-69.66 26.34a8 8 0 0 0 11.3 11.34C69.86 69.46 92 48 128 48c35 0 60.24 24.65 72.56 40H168a8 8 0 0 0 0 16h48a8 8 0 0 0 8-8V48a8 8 0 0 0-8-8Z" })
271
+ fill: "none",
272
+ viewBox: "0 0 24 24",
273
+ strokeWidth: "2",
274
+ stroke: "currentColor",
275
+ width: "16",
276
+ height: "16",
277
+ style: { minWidth: "16px", minHeight: "16px" },
278
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
279
+ "path",
280
+ {
281
+ strokeLinecap: "round",
282
+ strokeLinejoin: "round",
283
+ d: "M7.5 15h2.25m8.024-9.75c.011.05.028.1.052.148.591 1.2.924 2.55.924 3.977a8.96 8.96 0 01-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398C20.613 14.547 19.833 15 19 15h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 00.303-.54m.023-8.25H16.48a4.5 4.5 0 01-1.423-.23l-3.114-1.04a4.5 4.5 0 00-1.423-.23H6.504c-.618 0-1.217.247-1.605.729A11.95 11.95 0 002.25 12c0 .434.023.863.068 1.285C2.427 14.306 3.346 15 4.372 15h3.126c.618 0 .991.724.725 1.282A7.471 7.471 0 007.5 19.5a2.25 2.25 0 002.25 2.25.75.75 0 00.75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 002.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384"
284
+ }
285
+ )
316
286
  }
317
287
  );
318
- var PushToTalkIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
288
+ var DownloadIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
319
289
  "svg",
320
290
  {
321
291
  xmlns: "http://www.w3.org/2000/svg",
322
292
  fill: "none",
323
293
  viewBox: "0 0 24 24",
324
- strokeWidth: 1.5,
294
+ strokeWidth: "2",
325
295
  stroke: "currentColor",
326
- className: "w-6 h-6",
296
+ width: "16",
297
+ height: "16",
298
+ style: { minWidth: "16px", minHeight: "16px" },
327
299
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
328
300
  "path",
329
301
  {
330
302
  strokeLinecap: "round",
331
303
  strokeLinejoin: "round",
332
- d: "M12 18.75a6 6 0 0 0 6-6v-1.5m-6 7.5a6 6 0 0 1-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 0 1-3-3V4.5a3 3 0 1 1 6 0v8.25a3 3 0 0 1-3 3Z"
304
+ d: "M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"
333
305
  }
334
306
  )
335
307
  }
336
308
  );
309
+ var CheckIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
310
+ "svg",
311
+ {
312
+ xmlns: "http://www.w3.org/2000/svg",
313
+ fill: "none",
314
+ viewBox: "0 0 24 24",
315
+ strokeWidth: "2",
316
+ stroke: "currentColor",
317
+ width: "16",
318
+ height: "16",
319
+ style: { minWidth: "16px", minHeight: "16px" },
320
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" })
321
+ }
322
+ );
337
323
 
338
324
  // src/components/chat/ChatContext.tsx
339
325
  var import_jsx_runtime2 = require("react/jsx-runtime");
@@ -364,7 +350,11 @@ var ChatContextProvider = ({
364
350
  placeholder: "Type a message...",
365
351
  error: "\u274C An error occurred. Please try again.",
366
352
  stopGenerating: "Stop generating",
367
- regenerateResponse: "Regenerate response"
353
+ regenerateResponse: "Regenerate response",
354
+ copyToClipboard: "Copy to clipboard",
355
+ thumbsUp: "Thumbs up",
356
+ thumbsDown: "Thumbs down",
357
+ copied: "Copied!"
368
358
  }), labels),
369
359
  [labels]
370
360
  );
@@ -378,7 +368,7 @@ var ChatContextProvider = ({
378
368
  spinnerIcon: SpinnerIcon,
379
369
  stopIcon: StopIcon,
380
370
  regenerateIcon: RegenerateIcon,
381
- pushToTalkIcon: PushToTalkIcon
371
+ pushToTalkIcon: MicrophoneIcon
382
372
  }), icons),
383
373
  [icons]
384
374
  );
@@ -521,846 +511,1354 @@ var Button = ({}) => {
521
511
  ) });
522
512
  };
523
513
 
524
- // src/components/chat/Header.tsx
525
- var import_jsx_runtime5 = require("react/jsx-runtime");
526
- var Header = ({}) => {
527
- const { setOpen, icons, labels } = useChatContext();
528
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "copilotKitHeader", children: [
529
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: labels.title }),
530
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { onClick: () => setOpen(false), "aria-label": "Close", children: icons.headerCloseIcon })
531
- ] });
532
- };
533
-
534
- // src/components/chat/Messages.tsx
535
- var import_react3 = require("react");
536
- var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
514
+ // src/components/dev-console/utils.ts
537
515
  var import_react_core = require("@copilotkit/react-core");
538
- var import_jsx_runtime6 = require("react/jsx-runtime");
539
- var Messages = ({
540
- messages,
541
- inProgress,
542
- children,
543
- RenderTextMessage: RenderTextMessage2,
544
- RenderActionExecutionMessage: RenderActionExecutionMessage2,
545
- RenderAgentStateMessage: RenderAgentStateMessage2,
546
- RenderResultMessage: RenderResultMessage2,
547
- AssistantMessage: AssistantMessage2,
548
- UserMessage: UserMessage2
549
- }) => {
550
- const context = useChatContext();
551
- const initialMessages = (0, import_react3.useMemo)(
552
- () => makeInitialMessages(context.labels.initial),
553
- [context.labels.initial]
554
- );
555
- messages = [...initialMessages, ...messages];
556
- const actionResults = {};
557
- for (let i = 0; i < messages.length; i++) {
558
- if (messages[i].isActionExecutionMessage()) {
559
- const id = messages[i].id;
560
- const resultMessage = messages.find(
561
- (message) => message.isResultMessage() && message.actionExecutionId === id
562
- );
563
- if (resultMessage) {
564
- actionResults[id] = import_runtime_client_gql.ResultMessage.decodeResult(resultMessage.result || "");
565
- }
566
- }
516
+ function shouldShowDevConsole(showDevConsole) {
517
+ if (typeof showDevConsole === "boolean") {
518
+ return showDevConsole;
567
519
  }
568
- const { messagesEndRef, messagesContainerRef } = useScrollToBottom(messages);
569
- const interrupt = (0, import_react_core.useLangGraphInterruptRender)();
570
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "copilotKitMessages", ref: messagesContainerRef, children: [
571
- messages.map((message, index) => {
572
- const isCurrentMessage = index === messages.length - 1;
573
- if (message.isTextMessage()) {
574
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
575
- RenderTextMessage2,
576
- {
577
- message,
578
- inProgress,
579
- index,
580
- isCurrentMessage,
581
- AssistantMessage: AssistantMessage2,
582
- UserMessage: UserMessage2
583
- },
584
- index
585
- );
586
- } else if (message.isActionExecutionMessage()) {
587
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
588
- RenderActionExecutionMessage2,
589
- {
590
- message,
591
- inProgress,
592
- index,
593
- isCurrentMessage,
594
- actionResult: actionResults[message.id],
595
- AssistantMessage: AssistantMessage2,
596
- UserMessage: UserMessage2
597
- },
598
- index
599
- );
600
- } else if (message.isAgentStateMessage()) {
601
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
602
- RenderAgentStateMessage2,
603
- {
604
- message,
605
- inProgress,
606
- index,
607
- isCurrentMessage,
608
- AssistantMessage: AssistantMessage2,
609
- UserMessage: UserMessage2
610
- },
611
- index
612
- );
613
- } else if (message.isResultMessage()) {
614
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
615
- RenderResultMessage2,
616
- {
617
- message,
618
- inProgress,
619
- index,
620
- isCurrentMessage,
621
- AssistantMessage: AssistantMessage2,
622
- UserMessage: UserMessage2
623
- },
624
- index
625
- );
626
- }
627
- }),
628
- interrupt,
629
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("footer", { ref: messagesEndRef, children })
630
- ] });
631
- };
632
- function makeInitialMessages(initial) {
633
- let initialArray = [];
634
- if (initial) {
635
- if (Array.isArray(initial)) {
636
- initialArray.push(...initial);
637
- } else {
638
- initialArray.push(initial);
639
- }
520
+ return getHostname() === "localhost" || getHostname() === "127.0.0.1" || getHostname() === "0.0.0.0" || getHostname() === "::1";
521
+ }
522
+ function getHostname() {
523
+ if (typeof window !== "undefined" && window.location) {
524
+ return window.location.hostname;
640
525
  }
641
- return initialArray.map(
642
- (message) => new import_runtime_client_gql.TextMessage({
643
- role: import_runtime_client_gql.Role.Assistant,
644
- content: message
645
- })
646
- );
526
+ return "";
647
527
  }
648
- function useScrollToBottom(messages) {
649
- const messagesEndRef = (0, import_react3.useRef)(null);
650
- const messagesContainerRef = (0, import_react3.useRef)(null);
651
- const isProgrammaticScrollRef = (0, import_react3.useRef)(false);
652
- const isUserScrollUpRef = (0, import_react3.useRef)(false);
653
- const scrollToBottom = () => {
654
- if (messagesEndRef.current) {
655
- isProgrammaticScrollRef.current = true;
656
- messagesEndRef.current.scrollIntoView({
657
- behavior: "auto"
658
- });
659
- }
660
- };
661
- const handleScroll = () => {
662
- if (isProgrammaticScrollRef.current) {
663
- isProgrammaticScrollRef.current = false;
664
- return;
665
- }
666
- if (messagesContainerRef.current) {
667
- const { scrollTop, scrollHeight, clientHeight } = messagesContainerRef.current;
668
- isUserScrollUpRef.current = scrollTop + clientHeight < scrollHeight;
669
- }
670
- };
671
- (0, import_react3.useEffect)(() => {
672
- const container = messagesContainerRef.current;
673
- if (container) {
674
- container.addEventListener("scroll", handleScroll);
675
- }
676
- return () => {
677
- if (container) {
678
- container.removeEventListener("scroll", handleScroll);
528
+ function getPublishedCopilotKitVersion(current, forceCheck = false) {
529
+ return __async(this, null, function* () {
530
+ const LOCAL_STORAGE_KEY = "__copilotkit_version_check__";
531
+ const serializedVersion = localStorage.getItem(LOCAL_STORAGE_KEY);
532
+ if (serializedVersion && !forceCheck) {
533
+ try {
534
+ const parsedVersion = JSON.parse(serializedVersion);
535
+ const oneHour = 60 * 60 * 1e3;
536
+ const now = (/* @__PURE__ */ new Date()).getTime();
537
+ if (parsedVersion.current === current && now - new Date(parsedVersion.lastChecked).getTime() < oneHour) {
538
+ return parsedVersion;
539
+ }
540
+ } catch (error) {
541
+ console.error("Failed to parse CopilotKitVersion from localStorage", error);
679
542
  }
680
- };
681
- }, []);
682
- (0, import_react3.useEffect)(() => {
683
- const container = messagesContainerRef.current;
684
- if (!container) {
685
- return;
686
543
  }
687
- const mutationObserver = new MutationObserver(() => {
688
- if (!isUserScrollUpRef.current) {
689
- scrollToBottom();
690
- }
691
- });
692
- mutationObserver.observe(container, {
693
- childList: true,
694
- subtree: true,
695
- characterData: true
696
- });
697
- return () => {
698
- mutationObserver.disconnect();
699
- };
700
- }, []);
701
- (0, import_react3.useEffect)(() => {
702
- isUserScrollUpRef.current = false;
703
- scrollToBottom();
704
- }, [messages.filter((m) => m.isTextMessage() && m.role === import_runtime_client_gql.Role.User).length]);
705
- return { messagesEndRef, messagesContainerRef };
706
- }
707
-
708
- // src/components/chat/Input.tsx
709
- var import_react6 = require("react");
544
+ try {
545
+ const response = yield fetch("https://api.cloud.copilotkit.ai/check-for-updates", {
546
+ method: "POST",
547
+ headers: {
548
+ "Content-Type": "application/json"
549
+ },
550
+ body: JSON.stringify({
551
+ packages: [
552
+ {
553
+ packageName: "@copilotkit/shared",
554
+ packageVersion: current
555
+ }
556
+ ]
557
+ })
558
+ });
559
+ const data = yield response.json();
560
+ const version = {
561
+ current,
562
+ lastChecked: (/* @__PURE__ */ new Date()).getTime(),
563
+ latest: data.packages[0].latestVersion,
564
+ severity: data.packages[0].severity,
565
+ advisory: data.packages[0].advisory || null
566
+ };
567
+ localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(version));
568
+ return version;
569
+ } catch (error) {
570
+ console.error("Failed to check for updates", error);
571
+ throw error;
572
+ }
573
+ });
574
+ }
575
+ function logReadables(context) {
576
+ console.log("%cCurrent Readables:", "font-size: 16px; font-weight: bold;");
577
+ const readables = context.getContextString([], import_react_core.defaultCopilotContextCategories).trim();
578
+ if (readables.length === 0) {
579
+ console.log("No readables found");
580
+ return;
581
+ }
582
+ console.log(readables);
583
+ }
584
+ function logActions(context) {
585
+ console.log("%cCurrent Actions:", "font-size: 16px; font-weight: bold;");
586
+ if (Object.values(context.actions).length === 0) {
587
+ console.log("No actions found");
588
+ return;
589
+ }
590
+ for (const action of Object.values(context.actions)) {
591
+ console.group(action.name);
592
+ console.log("name", action.name);
593
+ console.log("description", action.description);
594
+ console.log("parameters", action.parameters);
595
+ console.groupEnd();
596
+ }
597
+ }
598
+ function logMessages(context) {
599
+ console.log("%cCurrent Messages:", "font-size: 16px; font-weight: bold;");
600
+ if (context.messages.length === 0) {
601
+ console.log("No messages found");
602
+ return;
603
+ }
604
+ const tableData = context.messages.map((message) => {
605
+ if (message.isTextMessage()) {
606
+ return {
607
+ id: message.id,
608
+ type: "TextMessage",
609
+ role: message.role,
610
+ name: void 0,
611
+ scope: void 0,
612
+ content: message.content
613
+ };
614
+ } else if (message.isActionExecutionMessage()) {
615
+ return {
616
+ id: message.id,
617
+ type: "ActionExecutionMessage",
618
+ role: void 0,
619
+ name: message.name,
620
+ scope: message.parentMessageId,
621
+ content: message.arguments
622
+ };
623
+ } else if (message.isResultMessage()) {
624
+ return {
625
+ id: message.id,
626
+ type: "ResultMessage",
627
+ role: void 0,
628
+ name: message.actionName,
629
+ scope: message.actionExecutionId,
630
+ content: message.result
631
+ };
632
+ } else if (message.isAgentStateMessage()) {
633
+ return {
634
+ id: message.id,
635
+ type: `AgentStateMessage (running: ${message.running})`,
636
+ role: message.role,
637
+ name: void 0,
638
+ scope: message.threadId,
639
+ content: message.state
640
+ };
641
+ }
642
+ });
643
+ console.table(tableData);
644
+ }
710
645
 
711
- // src/components/chat/Textarea.tsx
646
+ // src/components/dev-console/console.tsx
647
+ var import_react_core2 = require("@copilotkit/react-core");
712
648
  var import_react4 = require("react");
713
- var import_jsx_runtime7 = require("react/jsx-runtime");
714
- var AutoResizingTextarea = (0, import_react4.forwardRef)(
715
- ({ maxRows = 1, placeholder, value, onChange, onKeyDown, autoFocus }, ref) => {
716
- const internalTextareaRef = (0, import_react4.useRef)(null);
717
- const [maxHeight, setMaxHeight] = (0, import_react4.useState)(0);
718
- (0, import_react4.useImperativeHandle)(ref, () => internalTextareaRef.current);
719
- (0, import_react4.useEffect)(() => {
720
- const calculateMaxHeight = () => {
721
- const textarea = internalTextareaRef.current;
722
- if (textarea) {
723
- textarea.style.height = "auto";
724
- const singleRowHeight = textarea.scrollHeight;
725
- setMaxHeight(singleRowHeight * maxRows);
726
- if (autoFocus) {
727
- textarea.focus();
728
- }
729
- }
730
- };
731
- calculateMaxHeight();
732
- }, [maxRows]);
733
- (0, import_react4.useEffect)(() => {
734
- const textarea = internalTextareaRef.current;
735
- if (textarea) {
736
- textarea.style.height = "auto";
737
- textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`;
649
+
650
+ // src/components/dev-console/icons.tsx
651
+ var import_jsx_runtime5 = require("react/jsx-runtime");
652
+ var ExclamationMarkTriangleIcon = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
653
+ "svg",
654
+ {
655
+ width: "13.3967723px",
656
+ height: "12px",
657
+ viewBox: "0 0 13.3967723 12",
658
+ version: "1.1",
659
+ xmlns: "http://www.w3.org/2000/svg",
660
+ 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: "exclamation-triangle", fill: "#CD2121", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
661
+ "path",
662
+ {
663
+ d: "M5.39935802,0.75 C5.97670802,-0.25 7.42007802,-0.25 7.99742802,0.75 L13.193588,9.75 C13.770888,10.75 13.049288,12 11.894588,12 L1.50223802,12 C0.34753802,12 -0.37414898,10.75 0.20319802,9.75 L5.39935802,0.75 Z M6.69838802,2.5 C7.11260802,2.5 7.44838802,2.83579 7.44838802,3.25 L7.44838802,6.25 C7.44838802,6.66421 7.11260802,7 6.69838802,7 C6.28417802,7 5.94838802,6.66421 5.94838802,6.25 L5.94838802,3.25 C5.94838802,2.83579 6.28417802,2.5 6.69838802,2.5 Z M6.69838802,10.5 C7.25067802,10.5 7.69838802,10.0523 7.69838802,9.5 C7.69838802,8.9477 7.25067802,8.5 6.69838802,8.5 C6.14610802,8.5 5.69838802,8.9477 5.69838802,9.5 C5.69838802,10.0523 6.14610802,10.5 6.69838802,10.5 Z",
664
+ id: "Shape"
738
665
  }
739
- }, [value, maxHeight]);
740
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
741
- "textarea",
666
+ ) }) })
667
+ }
668
+ );
669
+ var ExclamationMarkIcon = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
670
+ "svg",
671
+ {
672
+ width: "14px",
673
+ height: "14px",
674
+ viewBox: "0 0 14 14",
675
+ version: "1.1",
676
+ xmlns: "http://www.w3.org/2000/svg",
677
+ 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: "exclamation-circle", fill: "#EC662C", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
678
+ "path",
742
679
  {
743
- ref: internalTextareaRef,
744
- value,
745
- onChange,
746
- onKeyDown,
747
- placeholder,
748
- style: {
749
- overflow: "auto",
750
- resize: "none",
751
- maxHeight: `${maxHeight}px`
752
- },
753
- rows: 1
680
+ d: "M7,14 C10.866,14 14,10.866 14,7 C14,3.13401 10.866,0 7,0 C3.13401,0 0,3.13401 0,7 C0,10.866 3.13401,14 7,14 Z M7,3 C7.41421,3 7.75,3.33579 7.75,3.75 L7.75,6.75 C7.75,7.16421 7.41421,7.5 7,7.5 C6.58579,7.5 6.25,7.16421 6.25,6.75 L6.25,3.75 C6.25,3.33579 6.58579,3 7,3 Z M7,11 C7.55228,11 8,10.5523 8,10 C8,9.4477 7.55228,9 7,9 C6.44772,9 6,9.4477 6,10 C6,10.5523 6.44772,11 7,11 Z",
681
+ id: "Shape"
754
682
  }
755
- );
683
+ ) }) })
756
684
  }
757
685
  );
758
- var Textarea_default = AutoResizingTextarea;
759
-
760
- // src/hooks/use-push-to-talk.tsx
761
- var import_react_core2 = require("@copilotkit/react-core");
762
- var import_react5 = require("react");
763
- var startRecording = (mediaStreamRef, mediaRecorderRef, audioContextRef, recordedChunks, onStop) => __async(void 0, null, function* () {
764
- if (!mediaStreamRef.current || !audioContextRef.current) {
765
- mediaStreamRef.current = yield navigator.mediaDevices.getUserMedia({ audio: true });
766
- audioContextRef.current = new window.AudioContext();
767
- yield audioContextRef.current.resume();
686
+ var ChevronDownIcon = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { width: "7px", height: "4px", viewBox: "0 0 7 4", version: "1.1", xmlns: "http://www.w3.org/2000/svg", 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", fill: "#000000", fillRule: "nonzero", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
687
+ "path",
688
+ {
689
+ d: "M3.71690723,3.90271086 C3.59268176,4.03242971 3.39143629,4.03242971 3.26721082,3.90271086 L0.0853966595,0.57605615 C-0.0314221035,0.444981627 -0.0279751448,0.240725043 0.0931934622,0.114040675 C0.214362069,-0.0126436935 0.409725445,-0.0162475626 0.535093061,0.105888951 L3.49205902,3.19746006 L6.44902499,0.105888951 C6.52834574,0.0168884389 6.64780588,-0.0197473458 6.7605411,0.0103538404 C6.87327633,0.0404550266 6.96130636,0.132492308 6.99009696,0.250359396 C7.01888756,0.368226483 6.98384687,0.493124608 6.89872139,0.57605615 L3.71690723,3.90271086 Z",
690
+ id: "Path"
768
691
  }
769
- mediaRecorderRef.current = new MediaRecorder(mediaStreamRef.current);
770
- mediaRecorderRef.current.start(1e3);
771
- mediaRecorderRef.current.ondataavailable = (event) => {
772
- recordedChunks.push(event.data);
773
- };
774
- mediaRecorderRef.current.onstop = onStop;
775
- });
776
- var stopRecording = (mediaRecorderRef) => {
777
- if (mediaRecorderRef.current && mediaRecorderRef.current.state !== "inactive") {
778
- mediaRecorderRef.current.stop();
692
+ ) }) }) });
693
+ var CheckIcon2 = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
694
+ "svg",
695
+ {
696
+ width: "14px",
697
+ height: "14px",
698
+ viewBox: "0 0 14 14",
699
+ version: "1.1",
700
+ xmlns: "http://www.w3.org/2000/svg",
701
+ 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)(
702
+ "path",
703
+ {
704
+ 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",
705
+ id: "Shape"
706
+ }
707
+ ) }) }) })
779
708
  }
780
- };
781
- var transcribeAudio = (recordedChunks, transcribeAudioUrl) => __async(void 0, null, function* () {
782
- const completeBlob = new Blob(recordedChunks, { type: "audio/mp4" });
783
- const formData = new FormData();
784
- formData.append("file", completeBlob, "recording.mp4");
785
- const response = yield fetch(transcribeAudioUrl, {
786
- method: "POST",
787
- body: formData
788
- });
789
- if (!response.ok) {
790
- throw new Error(`Error: ${response.statusText}`);
709
+ );
710
+
711
+ // src/components/dev-console/console.tsx
712
+ var import_react5 = require("@headlessui/react");
713
+ var import_shared = require("@copilotkit/shared");
714
+
715
+ // src/components/help-modal/modal.tsx
716
+ var import_react3 = require("react");
717
+
718
+ // src/components/help-modal/icons.tsx
719
+ var import_jsx_runtime6 = require("react/jsx-runtime");
720
+ var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
721
+ "svg",
722
+ {
723
+ xmlns: "http://www.w3.org/2000/svg",
724
+ fill: "none",
725
+ viewBox: "0 0 24 24",
726
+ strokeWidth: "1.5",
727
+ stroke: "currentColor",
728
+ width: "20",
729
+ height: "20",
730
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
791
731
  }
792
- const transcription = yield response.json();
793
- return transcription.text;
794
- });
795
- var playAudioResponse = (text, textToSpeechUrl, audioContext) => {
796
- const encodedText = encodeURIComponent(text);
797
- const url = `${textToSpeechUrl}?text=${encodedText}`;
798
- fetch(url).then((response) => response.arrayBuffer()).then((arrayBuffer) => audioContext.decodeAudioData(arrayBuffer)).then((audioBuffer) => {
799
- const source = audioContext.createBufferSource();
800
- source.buffer = audioBuffer;
801
- source.connect(audioContext.destination);
802
- source.start(0);
803
- }).catch((error) => {
804
- console.error("Error with decoding audio data", error);
805
- });
806
- };
807
- var usePushToTalk = ({
808
- sendFunction,
809
- inProgress
810
- }) => {
811
- const [pushToTalkState, setPushToTalkState] = (0, import_react5.useState)("idle");
812
- const mediaStreamRef = (0, import_react5.useRef)(null);
813
- const audioContextRef = (0, import_react5.useRef)(null);
814
- const mediaRecorderRef = (0, import_react5.useRef)(null);
815
- const recordedChunks = (0, import_react5.useRef)([]);
816
- const generalContext = (0, import_react_core2.useCopilotContext)();
817
- const messagesContext = (0, import_react_core2.useCopilotMessagesContext)();
818
- const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
819
- const [startReadingFromMessageId, setStartReadingFromMessageId] = (0, import_react5.useState)(null);
820
- (0, import_react5.useEffect)(() => {
821
- if (pushToTalkState === "recording") {
822
- startRecording(
823
- mediaStreamRef,
824
- mediaRecorderRef,
825
- audioContextRef,
826
- recordedChunks.current,
827
- () => {
828
- setPushToTalkState("transcribing");
829
- }
830
- );
831
- } else {
832
- stopRecording(mediaRecorderRef);
833
- if (pushToTalkState === "transcribing") {
834
- transcribeAudio(recordedChunks.current, context.copilotApiConfig.transcribeAudioUrl).then(
835
- (transcription) => __async(void 0, null, function* () {
836
- recordedChunks.current = [];
837
- setPushToTalkState("idle");
838
- const message = yield sendFunction(transcription);
839
- setStartReadingFromMessageId(message.id);
840
- })
841
- );
732
+ );
733
+
734
+ // src/components/help-modal/modal.tsx
735
+ var import_jsx_runtime7 = require("react/jsx-runtime");
736
+ function CopilotKitHelpModal() {
737
+ const [showHelpModal, setShowHelpModal] = (0, import_react3.useState)(false);
738
+ const buttonRef = (0, import_react3.useRef)(null);
739
+ const popoverRef = (0, import_react3.useRef)(null);
740
+ (0, import_react3.useEffect)(() => {
741
+ const handleClickOutside = (event) => {
742
+ if (popoverRef.current && !popoverRef.current.contains(event.target) && buttonRef.current && !buttonRef.current.contains(event.target)) {
743
+ setShowHelpModal(false);
842
744
  }
745
+ };
746
+ if (showHelpModal) {
747
+ document.addEventListener("mousedown", handleClickOutside);
843
748
  }
844
749
  return () => {
845
- stopRecording(mediaRecorderRef);
750
+ document.removeEventListener("mousedown", handleClickOutside);
846
751
  };
847
- }, [pushToTalkState]);
848
- (0, import_react5.useEffect)(() => {
849
- if (inProgress === false && startReadingFromMessageId) {
850
- const lastMessageIndex = context.messages.findIndex(
851
- (message) => message.id === startReadingFromMessageId
852
- );
853
- const messagesAfterLast = context.messages.slice(lastMessageIndex + 1).filter(
854
- (message) => message.isTextMessage() && message.role === "assistant"
855
- );
856
- const text = messagesAfterLast.map((message) => message.content).join("\n");
857
- playAudioResponse(text, context.copilotApiConfig.textToSpeechUrl, audioContextRef.current);
858
- setStartReadingFromMessageId(null);
752
+ }, [showHelpModal]);
753
+ const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
754
+ "button",
755
+ {
756
+ ref: buttonRef,
757
+ onClick: () => setShowHelpModal(!showHelpModal),
758
+ className: "copilotKitDebugMenuTriggerButton relative",
759
+ "aria-label": "Open Help",
760
+ children: "Help"
859
761
  }
860
- }, [startReadingFromMessageId, inProgress]);
861
- return { pushToTalkState, setPushToTalkState };
862
- };
762
+ );
763
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative", children: [
764
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HelpButton, {}),
765
+ showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
766
+ "div",
767
+ {
768
+ ref: popoverRef,
769
+ className: "absolute mt-2 z-50",
770
+ style: {
771
+ top: "100%",
772
+ right: "-120px",
773
+ width: "380px"
774
+ },
775
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "bg-white rounded-lg shadow-xl w-full p-4 flex-col relative", children: [
776
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
777
+ "button",
778
+ {
779
+ className: "absolute text-gray-400 hover:text-gray-600 focus:outline-none",
780
+ style: { top: "10px", right: "10px" },
781
+ onClick: () => setShowHelpModal(false),
782
+ "aria-label": "Close",
783
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CloseIcon2, {})
784
+ }
785
+ ),
786
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-full flex mb-6 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { className: "text-2xl font-bold", children: "Help Options" }) }),
787
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-4 mb-4", children: [
788
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
789
+ "a",
790
+ {
791
+ href: "https://docs.copilotkit.ai/coagents/troubleshooting/common-issues",
792
+ target: "_blank",
793
+ rel: "noopener noreferrer",
794
+ children: "Visit the Troubleshooting and FAQ section in the docs"
795
+ }
796
+ ) }),
797
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
798
+ "a",
799
+ {
800
+ href: "https://go.copilotkit.ai/dev-console-support-discord",
801
+ target: "_blank",
802
+ rel: "noopener noreferrer",
803
+ children: "Go to Discord Support Channel (Community Support)"
804
+ }
805
+ ) }),
806
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
807
+ "a",
808
+ {
809
+ href: "https://go.copilotkit.ai/dev-console-support-slack",
810
+ target: "_blank",
811
+ rel: "noopener noreferrer",
812
+ children: "Apply for Priority Direct Slack Support"
813
+ }
814
+ ) })
815
+ ] })
816
+ ] })
817
+ }
818
+ )
819
+ ] });
820
+ }
863
821
 
864
- // src/components/chat/Input.tsx
865
- var import_react_core3 = require("@copilotkit/react-core");
822
+ // src/components/dev-console/console.tsx
866
823
  var import_jsx_runtime8 = require("react/jsx-runtime");
867
- var Input = ({ inProgress, onSend, isVisible = false }) => {
868
- const context = useChatContext();
869
- const copilotContext = (0, import_react_core3.useCopilotContext)();
870
- const pushToTalkConfigured = copilotContext.copilotApiConfig.textToSpeechUrl !== void 0 && copilotContext.copilotApiConfig.transcribeAudioUrl !== void 0;
871
- const textareaRef = (0, import_react6.useRef)(null);
872
- const handleDivClick = (event) => {
873
- var _a;
874
- if (event.target !== event.currentTarget)
875
- return;
876
- (_a = textareaRef.current) == null ? void 0 : _a.focus();
824
+ function CopilotDevConsole() {
825
+ const currentVersion = import_shared.COPILOTKIT_VERSION;
826
+ const context = (0, import_react_core2.useCopilotContext)();
827
+ const [showDevConsole, setShowDevConsole] = (0, import_react4.useState)(false);
828
+ (0, import_react4.useEffect)(() => {
829
+ setShowDevConsole(shouldShowDevConsole(context.showDevConsole));
830
+ }, [context.showDevConsole]);
831
+ const dontRunTwiceInDevMode = (0, import_react4.useRef)(false);
832
+ const [versionStatus, setVersionStatus] = (0, import_react4.useState)("unknown");
833
+ const [latestVersion, setLatestVersion] = (0, import_react4.useState)("");
834
+ const consoleRef = (0, import_react4.useRef)(null);
835
+ const [debugButtonMode, setDebugButtonMode] = (0, import_react4.useState)("full");
836
+ const checkForUpdates = (force = false) => {
837
+ setVersionStatus("checking");
838
+ getPublishedCopilotKitVersion(currentVersion, force).then((v) => {
839
+ setLatestVersion(v.latest);
840
+ let versionOk = false;
841
+ if (v.current === v.latest) {
842
+ versionOk = true;
843
+ } else if (/[a-zA-Z]/.test(v.current)) {
844
+ versionOk = true;
845
+ }
846
+ if (versionOk) {
847
+ setVersionStatus("latest");
848
+ } else if (v.severity !== "low") {
849
+ setVersionStatus("outdated");
850
+ } else {
851
+ setVersionStatus("update-available");
852
+ }
853
+ }).catch((e) => {
854
+ console.error(e);
855
+ setVersionStatus("unknown");
856
+ });
877
857
  };
878
- const [text, setText] = (0, import_react6.useState)("");
879
- const send = () => {
880
- var _a;
881
- if (inProgress)
858
+ (0, import_react4.useEffect)(() => {
859
+ if (dontRunTwiceInDevMode.current === true) {
882
860
  return;
883
- onSend(text);
884
- setText("");
885
- (_a = textareaRef.current) == null ? void 0 : _a.focus();
886
- };
887
- (0, import_react6.useEffect)(() => {
888
- var _a;
889
- if (isVisible) {
890
- (_a = textareaRef.current) == null ? void 0 : _a.focus();
891
861
  }
892
- }, [isVisible]);
893
- const { pushToTalkState, setPushToTalkState } = usePushToTalk({
894
- sendFunction: onSend,
895
- inProgress
896
- });
897
- const sendIcon = inProgress || pushToTalkState === "transcribing" ? context.icons.activityIcon : context.icons.sendIcon;
898
- const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
899
- const canSend = () => {
900
- var _a;
901
- const interruptEvent = (_a = copilotContext.langGraphInterruptAction) == null ? void 0 : _a.event;
902
- const interruptInProgress = (interruptEvent == null ? void 0 : interruptEvent.name) === "LangGraphInterruptEvent" && !(interruptEvent == null ? void 0 : interruptEvent.response);
903
- return !inProgress && text.trim().length > 0 && pushToTalkState === "idle" && !interruptInProgress;
862
+ dontRunTwiceInDevMode.current = true;
863
+ checkForUpdates();
864
+ }, []);
865
+ if (!showDevConsole) {
866
+ return null;
867
+ }
868
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
869
+ "div",
870
+ {
871
+ ref: consoleRef,
872
+ className: "copilotKitDevConsole " + (versionStatus === "update-available" ? "copilotKitDevConsoleUpgrade" : "") + (versionStatus === "outdated" ? "copilotKitDevConsoleWarnOutdated" : ""),
873
+ children: [
874
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
875
+ VersionInfo,
876
+ {
877
+ showDevConsole: context.showDevConsole,
878
+ versionStatus,
879
+ currentVersion,
880
+ latestVersion
881
+ }
882
+ ),
883
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CopilotKitHelpModal, {}),
884
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
885
+ DebugMenuButton,
886
+ {
887
+ setShowDevConsole,
888
+ checkForUpdates,
889
+ mode: debugButtonMode
890
+ }
891
+ )
892
+ ]
893
+ }
894
+ );
895
+ }
896
+ function VersionInfo({
897
+ showDevConsole,
898
+ versionStatus,
899
+ currentVersion,
900
+ latestVersion
901
+ }) {
902
+ const [copyStatus, setCopyStatus] = (0, import_react4.useState)("");
903
+ let versionLabel = "";
904
+ let versionIcon = "";
905
+ let currentVersionLabel = currentVersion;
906
+ if (versionStatus === "latest") {
907
+ versionLabel = "latest";
908
+ versionIcon = CheckIcon2;
909
+ } else if (versionStatus === "checking") {
910
+ versionLabel = "checking";
911
+ versionIcon = SmallSpinnerIcon;
912
+ } else if (versionStatus === "update-available") {
913
+ versionLabel = "update available";
914
+ versionIcon = ExclamationMarkIcon;
915
+ currentVersionLabel = `${currentVersion} \u2192 ${latestVersion}`;
916
+ } else if (versionStatus === "outdated") {
917
+ versionLabel = "outdated";
918
+ versionIcon = ExclamationMarkTriangleIcon;
919
+ currentVersionLabel = `${currentVersion} \u2192 ${latestVersion}`;
920
+ }
921
+ let asideLabel = "";
922
+ if (showDevConsole === "auto") {
923
+ asideLabel = "(localhost only)";
924
+ } else if (showDevConsole === true) {
925
+ asideLabel = "(always on)";
926
+ }
927
+ const installCommand = [
928
+ `npm install`,
929
+ `@copilotkit/react-core@${latestVersion}`,
930
+ `@copilotkit/react-ui@${latestVersion}`,
931
+ `@copilotkit/react-textarea@${latestVersion}`,
932
+ `&& npm install @copilotkit/runtime@${latestVersion}`
933
+ ].join(" ");
934
+ const handleCopyClick = () => {
935
+ navigator.clipboard.writeText(installCommand.trim()).then(() => {
936
+ setCopyStatus("Command copied to clipboard!");
937
+ setTimeout(() => setCopyStatus(""), 1e3);
938
+ });
904
939
  };
905
- const sendDisabled = !canSend();
906
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
940
+ if (versionStatus === "update-available" || versionStatus === "outdated") {
941
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "copilotKitVersionInfo", children: [
942
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { children: [
943
+ currentVersionLabel,
944
+ " ",
945
+ versionIcon
946
+ ] }),
947
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { onClick: handleCopyClick, children: copyStatus || installCommand })
948
+ ] });
949
+ }
950
+ return null;
951
+ }
952
+ function DebugMenuButton({
953
+ setShowDevConsole,
954
+ checkForUpdates,
955
+ mode
956
+ }) {
957
+ const context = (0, import_react_core2.useCopilotContext)();
958
+ const messagesContext = (0, import_react_core2.useCopilotMessagesContext)();
959
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "bg-black top-24 w-52 text-right", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react5.Menu, { children: [
907
960
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
908
- Textarea_default,
961
+ import_react5.MenuButton,
909
962
  {
910
- ref: textareaRef,
911
- placeholder: context.labels.placeholder,
912
- autoFocus: true,
913
- maxRows: 5,
914
- value: text,
915
- onChange: (event) => setText(event.target.value),
916
- onKeyDown: (event) => {
917
- if (event.key === "Enter" && !event.shiftKey) {
918
- event.preventDefault();
919
- if (canSend()) {
920
- send();
921
- }
922
- }
923
- }
963
+ className: `copilotKitDebugMenuTriggerButton ${mode === "compact" ? "compact" : ""}`,
964
+ children: mode == "compact" ? "Debug" : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
965
+ "Debug ",
966
+ ChevronDownIcon
967
+ ] })
924
968
  }
925
969
  ),
926
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "copilotKitInputControls", children: [
927
- showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
928
- "button",
929
- {
930
- onClick: () => setPushToTalkState(pushToTalkState === "idle" ? "recording" : "transcribing"),
931
- className: pushToTalkState === "recording" ? "copilotKitPushToTalkRecording" : "",
932
- children: context.icons.pushToTalkIcon
933
- }
934
- ),
935
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
936
- "button",
937
- {
938
- disabled: sendDisabled,
939
- onClick: send,
940
- "data-copilotkit-in-progress": !!inProgress,
941
- "data-testid": inProgress ? "copilot-chat-request-in-progress" : void 0,
942
- children: sendIcon
943
- }
944
- )
945
- ] })
946
- ] });
947
- };
970
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
971
+ import_react5.MenuItems,
972
+ {
973
+ transition: true,
974
+ anchor: "bottom end",
975
+ className: "copilotKitDebugMenu",
976
+ style: { zIndex: 40 },
977
+ children: [
978
+ /* @__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" }) }),
979
+ /* @__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" }) }),
980
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
981
+ "button",
982
+ {
983
+ className: "copilotKitDebugMenuItem",
984
+ onClick: () => logMessages(messagesContext),
985
+ children: "Log Messages"
986
+ }
987
+ ) }),
988
+ /* @__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" }) }),
989
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("hr", {}),
990
+ /* @__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" }) })
991
+ ]
992
+ }
993
+ )
994
+ ] }) });
995
+ }
948
996
 
949
- // src/components/chat/Response.tsx
997
+ // src/components/chat/Header.tsx
950
998
  var import_jsx_runtime9 = require("react/jsx-runtime");
951
- var ResponseButton = ({ onClick, inProgress }) => {
952
- const context = useChatContext();
953
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { onClick, className: "copilotKitResponseButton", children: [
954
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: inProgress ? context.icons.stopIcon : context.icons.regenerateIcon }),
955
- inProgress ? context.labels.stopGenerating : context.labels.regenerateResponse
999
+ var Header = ({}) => {
1000
+ const { setOpen, icons, labels } = useChatContext();
1001
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "copilotKitHeader", children: [
1002
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: labels.title }),
1003
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "copilotKitHeaderControls", children: [
1004
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CopilotDevConsole, {}),
1005
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { onClick: () => setOpen(false), "aria-label": "Close", children: icons.headerCloseIcon })
1006
+ ] })
956
1007
  ] });
957
1008
  };
958
1009
 
959
- // src/components/chat/messages/RenderTextMessage.tsx
1010
+ // src/components/chat/Messages.tsx
1011
+ var import_react6 = require("react");
1012
+ var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
1013
+ var import_react_core3 = require("@copilotkit/react-core");
960
1014
  var import_jsx_runtime10 = require("react/jsx-runtime");
961
- function RenderTextMessage(props) {
962
- const { message, inProgress, index, isCurrentMessage, UserMessage: UserMessage2, AssistantMessage: AssistantMessage2 } = props;
963
- if (message.isTextMessage()) {
964
- if (message.role === "user") {
965
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
966
- UserMessage2,
967
- {
968
- "data-message-role": "user",
969
- message: message.content,
970
- rawData: message
971
- },
972
- index
973
- );
974
- } else if (message.role == "assistant") {
975
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
976
- AssistantMessage2,
977
- {
978
- "data-message-role": "assistant",
979
- message: message.content,
980
- rawData: message,
981
- isLoading: inProgress && isCurrentMessage && !message.content,
982
- isGenerating: inProgress && isCurrentMessage && !!message.content
983
- },
984
- index
1015
+ var Messages = ({
1016
+ messages,
1017
+ inProgress,
1018
+ children,
1019
+ RenderTextMessage: RenderTextMessage2,
1020
+ RenderActionExecutionMessage: RenderActionExecutionMessage2,
1021
+ RenderAgentStateMessage: RenderAgentStateMessage2,
1022
+ RenderResultMessage: RenderResultMessage2,
1023
+ AssistantMessage: AssistantMessage2,
1024
+ UserMessage: UserMessage2,
1025
+ onRegenerate,
1026
+ onCopy,
1027
+ onThumbsUp,
1028
+ onThumbsDown
1029
+ }) => {
1030
+ const context = useChatContext();
1031
+ const initialMessages = (0, import_react6.useMemo)(
1032
+ () => makeInitialMessages(context.labels.initial),
1033
+ [context.labels.initial]
1034
+ );
1035
+ messages = [...initialMessages, ...messages];
1036
+ const actionResults = {};
1037
+ for (let i = 0; i < messages.length; i++) {
1038
+ if (messages[i].isActionExecutionMessage()) {
1039
+ const id = messages[i].id;
1040
+ const resultMessage = messages.find(
1041
+ (message) => message.isResultMessage() && message.actionExecutionId === id
985
1042
  );
986
- }
987
- }
988
- }
989
-
990
- // src/components/chat/messages/RenderActionExecutionMessage.tsx
991
- var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
992
- var import_react_core4 = require("@copilotkit/react-core");
993
- var import_jsx_runtime11 = require("react/jsx-runtime");
994
- function RenderActionExecutionMessage(props) {
995
- const { chatComponentsCache } = (0, import_react_core4.useCopilotContext)();
996
- const { message, inProgress, index, isCurrentMessage, actionResult, AssistantMessage: AssistantMessage2 } = props;
997
- if (message.isActionExecutionMessage()) {
998
- if (chatComponentsCache.current !== null && (chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"])) {
999
- const render = chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"];
1000
- if (typeof render === "string") {
1001
- if (isCurrentMessage && inProgress) {
1002
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1003
- AssistantMessage2,
1004
- {
1005
- rawData: message,
1006
- "data-message-role": "assistant",
1007
- isLoading: false,
1008
- isGenerating: true,
1009
- message: render
1010
- },
1011
- index
1012
- );
1013
- } else {
1014
- return null;
1015
- }
1016
- } else {
1017
- const args = message.arguments;
1018
- let status = "inProgress";
1019
- if (actionResult !== void 0) {
1020
- status = "complete";
1021
- } else if (message.status.code !== import_runtime_client_gql2.MessageStatusCode.Pending) {
1022
- status = "executing";
1023
- }
1024
- try {
1025
- const toRender = render({
1026
- status,
1027
- args,
1028
- result: actionResult,
1029
- name: message.name
1030
- });
1031
- if (!toRender && status === "complete") {
1032
- return null;
1033
- }
1034
- if (typeof toRender === "string") {
1035
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1036
- AssistantMessage2,
1037
- {
1038
- rawData: message,
1039
- "data-message-role": "assistant",
1040
- isLoading: false,
1041
- isGenerating: false,
1042
- message: toRender
1043
- },
1044
- index
1045
- );
1046
- } else {
1047
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1048
- AssistantMessage2,
1049
- {
1050
- rawData: message,
1051
- "data-message-role": "action-render",
1052
- isLoading: false,
1053
- isGenerating: false,
1054
- subComponent: toRender
1055
- },
1056
- index
1057
- );
1058
- }
1059
- } catch (e) {
1060
- console.error(`Error executing render function for action ${message.name}: ${e}`);
1061
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1062
- AssistantMessage2,
1063
- {
1064
- rawData: message,
1065
- "data-message-role": "assistant",
1066
- isLoading: false,
1067
- isGenerating: false,
1068
- subComponent: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
1069
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("b", { children: [
1070
- "\u274C Error executing render function for action ",
1071
- message.name,
1072
- ":"
1073
- ] }),
1074
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("pre", { children: e instanceof Error ? e.message : String(e) })
1075
- ] })
1076
- },
1077
- index
1078
- );
1079
- }
1043
+ if (resultMessage) {
1044
+ actionResults[id] = import_runtime_client_gql.ResultMessage.decodeResult(resultMessage.result || "");
1080
1045
  }
1081
- } else if (!inProgress || !isCurrentMessage) {
1082
- return null;
1083
- } else {
1084
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1085
- AssistantMessage2,
1086
- {
1087
- rawData: message,
1088
- "data-message-role": "assistant",
1089
- isLoading: true,
1090
- isGenerating: true
1091
- },
1092
- index
1093
- );
1094
1046
  }
1095
1047
  }
1096
- }
1097
-
1098
- // src/components/chat/messages/RenderResultMessage.tsx
1099
- var import_jsx_runtime12 = require("react/jsx-runtime");
1100
- function RenderResultMessage(props) {
1101
- const { message, inProgress, index, isCurrentMessage, AssistantMessage: AssistantMessage2 } = props;
1102
- if (message.isResultMessage() && inProgress && isCurrentMessage) {
1103
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1104
- AssistantMessage2,
1105
- {
1106
- "data-message-role": "assistant",
1107
- rawData: message,
1108
- isLoading: true,
1109
- isGenerating: true
1110
- },
1111
- index
1112
- );
1113
- } else {
1114
- return null;
1115
- }
1116
- }
1117
-
1118
- // src/components/chat/messages/RenderAgentStateMessage.tsx
1119
- var import_react_core5 = require("@copilotkit/react-core");
1120
- var import_jsx_runtime13 = require("react/jsx-runtime");
1121
- function RenderAgentStateMessage(props) {
1122
- const { chatComponentsCache } = (0, import_react_core5.useCopilotContext)();
1123
- const { message, inProgress, index, isCurrentMessage, AssistantMessage: AssistantMessage2 } = props;
1124
- if (message.isAgentStateMessage()) {
1125
- let render;
1126
- if (chatComponentsCache.current !== null) {
1127
- render = chatComponentsCache.current.coAgentStateRenders[`${message.agentName}-${message.nodeName}`] || chatComponentsCache.current.coAgentStateRenders[`${message.agentName}-global`];
1128
- }
1129
- if (render) {
1130
- if (typeof render === "string") {
1131
- if (isCurrentMessage && inProgress) {
1132
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1133
- AssistantMessage2,
1048
+ const { messagesEndRef, messagesContainerRef } = useScrollToBottom(messages);
1049
+ const interrupt = (0, import_react_core3.useLangGraphInterruptRender)();
1050
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "copilotKitMessages", ref: messagesContainerRef, children: [
1051
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "copilotKitMessagesContainer", children: [
1052
+ messages.map((message, index) => {
1053
+ const isCurrentMessage = index === messages.length - 1;
1054
+ if (message.isTextMessage()) {
1055
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1056
+ RenderTextMessage2,
1134
1057
  {
1135
- rawData: message,
1136
- message: render,
1137
- "data-message-role": "assistant",
1138
- isLoading: true,
1139
- isGenerating: true
1058
+ message,
1059
+ inProgress,
1060
+ index,
1061
+ isCurrentMessage,
1062
+ AssistantMessage: AssistantMessage2,
1063
+ UserMessage: UserMessage2,
1064
+ onRegenerate,
1065
+ onCopy,
1066
+ onThumbsUp,
1067
+ onThumbsDown
1140
1068
  },
1141
1069
  index
1142
1070
  );
1143
- } else {
1144
- return null;
1145
- }
1146
- } else {
1147
- const state = message.state;
1148
- let status = message.active ? "inProgress" : "complete";
1149
- const toRender = render({
1150
- status,
1151
- state,
1152
- nodeName: message.nodeName
1153
- });
1154
- if (!toRender && status === "complete") {
1155
- return null;
1156
- }
1157
- if (!toRender && isCurrentMessage && inProgress) {
1158
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1159
- AssistantMessage2,
1071
+ } else if (message.isActionExecutionMessage()) {
1072
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1073
+ RenderActionExecutionMessage2,
1160
1074
  {
1161
- "data-message-role": "assistant",
1162
- rawData: message,
1163
- isLoading: true,
1164
- isGenerating: true
1075
+ message,
1076
+ inProgress,
1077
+ index,
1078
+ isCurrentMessage,
1079
+ actionResult: actionResults[message.id],
1080
+ AssistantMessage: AssistantMessage2,
1081
+ UserMessage: UserMessage2
1165
1082
  },
1166
1083
  index
1167
1084
  );
1168
- } else if (!toRender) {
1169
- return null;
1170
- }
1171
- if (typeof toRender === "string") {
1172
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1173
- AssistantMessage2,
1085
+ } else if (message.isAgentStateMessage()) {
1086
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1087
+ RenderAgentStateMessage2,
1174
1088
  {
1175
- rawData: message,
1176
- message: toRender,
1177
- isLoading: true,
1178
- isGenerating: true,
1179
- "data-message-role": "assistant"
1089
+ message,
1090
+ inProgress,
1091
+ index,
1092
+ isCurrentMessage,
1093
+ AssistantMessage: AssistantMessage2,
1094
+ UserMessage: UserMessage2
1180
1095
  },
1181
1096
  index
1182
1097
  );
1183
- } else {
1184
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1185
- AssistantMessage2,
1098
+ } else if (message.isResultMessage()) {
1099
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1100
+ RenderResultMessage2,
1186
1101
  {
1187
- rawData: message,
1188
- "data-message-role": "agent-state-render",
1189
- isLoading: false,
1190
- isGenerating: false,
1191
- subComponent: toRender
1102
+ message,
1103
+ inProgress,
1104
+ index,
1105
+ isCurrentMessage,
1106
+ AssistantMessage: AssistantMessage2,
1107
+ UserMessage: UserMessage2
1192
1108
  },
1193
1109
  index
1194
1110
  );
1195
1111
  }
1196
- }
1197
- } else if (!inProgress || !isCurrentMessage) {
1198
- return null;
1112
+ }),
1113
+ interrupt
1114
+ ] }),
1115
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("footer", { className: "copilotKitMessagesFooter", ref: messagesEndRef, children })
1116
+ ] });
1117
+ };
1118
+ function makeInitialMessages(initial) {
1119
+ let initialArray = [];
1120
+ if (initial) {
1121
+ if (Array.isArray(initial)) {
1122
+ initialArray.push(...initial);
1199
1123
  } else {
1200
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1201
- AssistantMessage2,
1202
- {
1203
- rawData: message,
1204
- isLoading: true,
1205
- isGenerating: true,
1206
- "data-message-role": "assistant"
1207
- },
1208
- index
1209
- );
1124
+ initialArray.push(initial);
1210
1125
  }
1211
1126
  }
1127
+ return initialArray.map(
1128
+ (message) => new import_runtime_client_gql.TextMessage({
1129
+ role: import_runtime_client_gql.Role.Assistant,
1130
+ content: message
1131
+ })
1132
+ );
1212
1133
  }
1213
-
1214
- // src/components/chat/Markdown.tsx
1215
- var import_react8 = require("react");
1216
- var import_react_markdown = __toESM(require("react-markdown"));
1217
-
1218
- // src/components/chat/CodeBlock.tsx
1219
- var import_react7 = require("react");
1220
- var import_react_syntax_highlighter = require("react-syntax-highlighter");
1221
-
1222
- // src/hooks/use-copy-to-clipboard.tsx
1223
- var React5 = __toESM(require("react"));
1224
- function useCopyToClipboard({ timeout = 2e3 }) {
1225
- const [isCopied, setIsCopied] = React5.useState(false);
1226
- const copyToClipboard = (value) => {
1227
- var _a;
1228
- if (typeof window === "undefined" || !((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
1229
- return;
1230
- }
1231
- if (!value) {
1232
- return;
1134
+ function useScrollToBottom(messages) {
1135
+ const messagesEndRef = (0, import_react6.useRef)(null);
1136
+ const messagesContainerRef = (0, import_react6.useRef)(null);
1137
+ const isProgrammaticScrollRef = (0, import_react6.useRef)(false);
1138
+ const isUserScrollUpRef = (0, import_react6.useRef)(false);
1139
+ const scrollToBottom = () => {
1140
+ if (messagesEndRef.current) {
1141
+ isProgrammaticScrollRef.current = true;
1142
+ messagesEndRef.current.scrollIntoView({
1143
+ behavior: "auto"
1144
+ });
1233
1145
  }
1234
- navigator.clipboard.writeText(value).then(() => {
1235
- setIsCopied(true);
1236
- setTimeout(() => {
1237
- setIsCopied(false);
1238
- }, timeout);
1239
- });
1240
1146
  };
1241
- return { isCopied, copyToClipboard };
1242
- }
1243
-
1244
- // src/components/chat/CodeBlock.tsx
1245
- var import_jsx_runtime14 = require("react/jsx-runtime");
1246
- var programmingLanguages = {
1247
- javascript: ".js",
1248
- python: ".py",
1249
- java: ".java",
1250
- c: ".c",
1251
- cpp: ".cpp",
1252
- "c++": ".cpp",
1253
- "c#": ".cs",
1254
- ruby: ".rb",
1255
- php: ".php",
1256
- swift: ".swift",
1257
- "objective-c": ".m",
1258
- kotlin: ".kt",
1259
- typescript: ".ts",
1260
- go: ".go",
1261
- perl: ".pl",
1262
- rust: ".rs",
1263
- scala: ".scala",
1264
- haskell: ".hs",
1265
- lua: ".lua",
1266
- shell: ".sh",
1267
- sql: ".sql",
1268
- html: ".html",
1269
- css: ".css"
1270
- // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component
1271
- };
1272
- var generateRandomString = (length, lowercase = false) => {
1273
- const chars = "ABCDEFGHJKLMNPQRSTUVWXY3456789";
1274
- let result = "";
1275
- for (let i = 0; i < length; i++) {
1276
- result += chars.charAt(Math.floor(Math.random() * chars.length));
1277
- }
1278
- return lowercase ? result.toLowerCase() : result;
1279
- };
1280
- var CodeBlock = (0, import_react7.memo)(({ language, value }) => {
1281
- const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
1282
- const downloadAsFile = () => {
1283
- if (typeof window === "undefined") {
1147
+ const handleScroll = () => {
1148
+ if (isProgrammaticScrollRef.current) {
1149
+ isProgrammaticScrollRef.current = false;
1284
1150
  return;
1285
1151
  }
1286
- const fileExtension = programmingLanguages[language] || ".file";
1287
- const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;
1288
- const fileName = window.prompt("Enter file name", suggestedFileName);
1289
- if (!fileName) {
1290
- return;
1152
+ if (messagesContainerRef.current) {
1153
+ const { scrollTop, scrollHeight, clientHeight } = messagesContainerRef.current;
1154
+ isUserScrollUpRef.current = scrollTop + clientHeight < scrollHeight;
1291
1155
  }
1292
- const blob = new Blob([value], { type: "text/plain" });
1293
- const url = URL.createObjectURL(blob);
1294
- const link = document.createElement("a");
1295
- link.download = fileName;
1296
- link.href = url;
1297
- link.style.display = "none";
1298
- document.body.appendChild(link);
1299
- link.click();
1300
- document.body.removeChild(link);
1301
- URL.revokeObjectURL(url);
1302
1156
  };
1303
- const onCopy = () => {
1304
- if (isCopied)
1157
+ (0, import_react6.useEffect)(() => {
1158
+ const container = messagesContainerRef.current;
1159
+ if (container) {
1160
+ container.addEventListener("scroll", handleScroll);
1161
+ }
1162
+ return () => {
1163
+ if (container) {
1164
+ container.removeEventListener("scroll", handleScroll);
1165
+ }
1166
+ };
1167
+ }, []);
1168
+ (0, import_react6.useEffect)(() => {
1169
+ const container = messagesContainerRef.current;
1170
+ if (!container) {
1305
1171
  return;
1306
- copyToClipboard(value);
1307
- };
1308
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "copilotKitCodeBlock", children: [
1309
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
1310
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
1311
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
1312
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: downloadAsFile, children: [
1313
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DownloadIcon, {}),
1314
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "sr-only", children: "Download" })
1315
- ] }),
1316
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: [
1317
- isCopied ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CheckIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CopyIcon, {}),
1318
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "sr-only", children: "Copy code" })
1319
- ] })
1320
- ] })
1321
- ] }),
1322
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1323
- import_react_syntax_highlighter.Prism,
1172
+ }
1173
+ const mutationObserver = new MutationObserver(() => {
1174
+ if (!isUserScrollUpRef.current) {
1175
+ scrollToBottom();
1176
+ }
1177
+ });
1178
+ mutationObserver.observe(container, {
1179
+ childList: true,
1180
+ subtree: true,
1181
+ characterData: true
1182
+ });
1183
+ return () => {
1184
+ mutationObserver.disconnect();
1185
+ };
1186
+ }, []);
1187
+ (0, import_react6.useEffect)(() => {
1188
+ isUserScrollUpRef.current = false;
1189
+ scrollToBottom();
1190
+ }, [messages.filter((m) => m.isTextMessage() && m.role === import_runtime_client_gql.Role.User).length]);
1191
+ return { messagesEndRef, messagesContainerRef };
1192
+ }
1193
+
1194
+ // src/components/chat/Input.tsx
1195
+ var import_react9 = require("react");
1196
+
1197
+ // src/components/chat/Textarea.tsx
1198
+ var import_react7 = require("react");
1199
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1200
+ var AutoResizingTextarea = (0, import_react7.forwardRef)(
1201
+ ({ maxRows = 1, placeholder, value, onChange, onKeyDown, autoFocus }, ref) => {
1202
+ const internalTextareaRef = (0, import_react7.useRef)(null);
1203
+ const [maxHeight, setMaxHeight] = (0, import_react7.useState)(0);
1204
+ (0, import_react7.useImperativeHandle)(ref, () => internalTextareaRef.current);
1205
+ (0, import_react7.useEffect)(() => {
1206
+ const calculateMaxHeight = () => {
1207
+ const textarea = internalTextareaRef.current;
1208
+ if (textarea) {
1209
+ textarea.style.height = "auto";
1210
+ const singleRowHeight = textarea.scrollHeight;
1211
+ setMaxHeight(singleRowHeight * maxRows);
1212
+ if (autoFocus) {
1213
+ textarea.focus();
1214
+ }
1215
+ }
1216
+ };
1217
+ calculateMaxHeight();
1218
+ }, [maxRows]);
1219
+ (0, import_react7.useEffect)(() => {
1220
+ const textarea = internalTextareaRef.current;
1221
+ if (textarea) {
1222
+ textarea.style.height = "auto";
1223
+ textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`;
1224
+ }
1225
+ }, [value, maxHeight]);
1226
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1227
+ "textarea",
1324
1228
  {
1325
- language,
1326
- style: highlightStyle,
1327
- PreTag: "div",
1328
- customStyle: {
1329
- margin: 0,
1330
- borderBottomLeftRadius: "0.375rem",
1331
- borderBottomRightRadius: "0.375rem"
1229
+ ref: internalTextareaRef,
1230
+ value,
1231
+ onChange,
1232
+ onKeyDown,
1233
+ placeholder,
1234
+ style: {
1235
+ overflow: "auto",
1236
+ resize: "none",
1237
+ maxHeight: `${maxHeight}px`
1332
1238
  },
1333
- children: value
1239
+ rows: 1
1334
1240
  }
1335
- )
1336
- ] });
1241
+ );
1242
+ }
1243
+ );
1244
+ var Textarea_default = AutoResizingTextarea;
1245
+
1246
+ // src/hooks/use-push-to-talk.tsx
1247
+ var import_react_core4 = require("@copilotkit/react-core");
1248
+ var import_react8 = require("react");
1249
+ var startRecording = (mediaStreamRef, mediaRecorderRef, audioContextRef, recordedChunks, onStop) => __async(void 0, null, function* () {
1250
+ if (!mediaStreamRef.current || !audioContextRef.current) {
1251
+ mediaStreamRef.current = yield navigator.mediaDevices.getUserMedia({ audio: true });
1252
+ audioContextRef.current = new window.AudioContext();
1253
+ yield audioContextRef.current.resume();
1254
+ }
1255
+ mediaRecorderRef.current = new MediaRecorder(mediaStreamRef.current);
1256
+ mediaRecorderRef.current.start(1e3);
1257
+ mediaRecorderRef.current.ondataavailable = (event) => {
1258
+ recordedChunks.push(event.data);
1259
+ };
1260
+ mediaRecorderRef.current.onstop = onStop;
1337
1261
  });
1338
- CodeBlock.displayName = "CodeBlock";
1339
- var highlightStyle = {
1340
- 'pre[class*="language-"]': {
1341
- color: "#d4d4d4",
1342
- fontSize: "13px",
1343
- textShadow: "none",
1344
- fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
1345
- direction: "ltr",
1346
- textAlign: "left",
1347
- whiteSpace: "pre",
1348
- wordSpacing: "normal",
1349
- wordBreak: "normal",
1350
- lineHeight: "1.5",
1351
- MozTabSize: "4",
1352
- OTabSize: "4",
1353
- tabSize: "4",
1354
- WebkitHyphens: "none",
1355
- MozHyphens: "none",
1356
- msHyphens: "none",
1357
- hyphens: "none",
1358
- padding: "1em",
1359
- margin: ".5em 0",
1360
- overflow: "auto",
1361
- background: "#1e1e1e"
1362
- },
1363
- 'code[class*="language-"]': {
1262
+ var stopRecording = (mediaRecorderRef) => {
1263
+ if (mediaRecorderRef.current && mediaRecorderRef.current.state !== "inactive") {
1264
+ mediaRecorderRef.current.stop();
1265
+ }
1266
+ };
1267
+ var transcribeAudio = (recordedChunks, transcribeAudioUrl) => __async(void 0, null, function* () {
1268
+ const completeBlob = new Blob(recordedChunks, { type: "audio/mp4" });
1269
+ const formData = new FormData();
1270
+ formData.append("file", completeBlob, "recording.mp4");
1271
+ const response = yield fetch(transcribeAudioUrl, {
1272
+ method: "POST",
1273
+ body: formData
1274
+ });
1275
+ if (!response.ok) {
1276
+ throw new Error(`Error: ${response.statusText}`);
1277
+ }
1278
+ const transcription = yield response.json();
1279
+ return transcription.text;
1280
+ });
1281
+ var playAudioResponse = (text, textToSpeechUrl, audioContext) => {
1282
+ const encodedText = encodeURIComponent(text);
1283
+ const url = `${textToSpeechUrl}?text=${encodedText}`;
1284
+ fetch(url).then((response) => response.arrayBuffer()).then((arrayBuffer) => audioContext.decodeAudioData(arrayBuffer)).then((audioBuffer) => {
1285
+ const source = audioContext.createBufferSource();
1286
+ source.buffer = audioBuffer;
1287
+ source.connect(audioContext.destination);
1288
+ source.start(0);
1289
+ }).catch((error) => {
1290
+ console.error("Error with decoding audio data", error);
1291
+ });
1292
+ };
1293
+ var usePushToTalk = ({
1294
+ sendFunction,
1295
+ inProgress
1296
+ }) => {
1297
+ const [pushToTalkState, setPushToTalkState] = (0, import_react8.useState)("idle");
1298
+ const mediaStreamRef = (0, import_react8.useRef)(null);
1299
+ const audioContextRef = (0, import_react8.useRef)(null);
1300
+ const mediaRecorderRef = (0, import_react8.useRef)(null);
1301
+ const recordedChunks = (0, import_react8.useRef)([]);
1302
+ const generalContext = (0, import_react_core4.useCopilotContext)();
1303
+ const messagesContext = (0, import_react_core4.useCopilotMessagesContext)();
1304
+ const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
1305
+ const [startReadingFromMessageId, setStartReadingFromMessageId] = (0, import_react8.useState)(null);
1306
+ (0, import_react8.useEffect)(() => {
1307
+ if (pushToTalkState === "recording") {
1308
+ startRecording(
1309
+ mediaStreamRef,
1310
+ mediaRecorderRef,
1311
+ audioContextRef,
1312
+ recordedChunks.current,
1313
+ () => {
1314
+ setPushToTalkState("transcribing");
1315
+ }
1316
+ );
1317
+ } else {
1318
+ stopRecording(mediaRecorderRef);
1319
+ if (pushToTalkState === "transcribing") {
1320
+ transcribeAudio(recordedChunks.current, context.copilotApiConfig.transcribeAudioUrl).then(
1321
+ (transcription) => __async(void 0, null, function* () {
1322
+ recordedChunks.current = [];
1323
+ setPushToTalkState("idle");
1324
+ const message = yield sendFunction(transcription);
1325
+ setStartReadingFromMessageId(message.id);
1326
+ })
1327
+ );
1328
+ }
1329
+ }
1330
+ return () => {
1331
+ stopRecording(mediaRecorderRef);
1332
+ };
1333
+ }, [pushToTalkState]);
1334
+ (0, import_react8.useEffect)(() => {
1335
+ if (inProgress === false && startReadingFromMessageId) {
1336
+ const lastMessageIndex = context.messages.findIndex(
1337
+ (message) => message.id === startReadingFromMessageId
1338
+ );
1339
+ const messagesAfterLast = context.messages.slice(lastMessageIndex + 1).filter(
1340
+ (message) => message.isTextMessage() && message.role === "assistant"
1341
+ );
1342
+ const text = messagesAfterLast.map((message) => message.content).join("\n");
1343
+ playAudioResponse(text, context.copilotApiConfig.textToSpeechUrl, audioContextRef.current);
1344
+ setStartReadingFromMessageId(null);
1345
+ }
1346
+ }, [startReadingFromMessageId, inProgress]);
1347
+ return { pushToTalkState, setPushToTalkState };
1348
+ };
1349
+
1350
+ // src/components/chat/Input.tsx
1351
+ var import_react_core5 = require("@copilotkit/react-core");
1352
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1353
+ var Input = ({ inProgress, onSend, isVisible = false, onStop }) => {
1354
+ const context = useChatContext();
1355
+ const copilotContext = (0, import_react_core5.useCopilotContext)();
1356
+ const pushToTalkConfigured = copilotContext.copilotApiConfig.textToSpeechUrl !== void 0 && copilotContext.copilotApiConfig.transcribeAudioUrl !== void 0;
1357
+ const textareaRef = (0, import_react9.useRef)(null);
1358
+ const handleDivClick = (event) => {
1359
+ var _a;
1360
+ if (event.target !== event.currentTarget)
1361
+ return;
1362
+ (_a = textareaRef.current) == null ? void 0 : _a.focus();
1363
+ };
1364
+ const [text, setText] = (0, import_react9.useState)("");
1365
+ const send = () => {
1366
+ var _a;
1367
+ if (inProgress)
1368
+ return;
1369
+ onSend(text);
1370
+ setText("");
1371
+ (_a = textareaRef.current) == null ? void 0 : _a.focus();
1372
+ };
1373
+ (0, import_react9.useEffect)(() => {
1374
+ var _a;
1375
+ if (isVisible) {
1376
+ (_a = textareaRef.current) == null ? void 0 : _a.focus();
1377
+ }
1378
+ }, [isVisible]);
1379
+ const { pushToTalkState, setPushToTalkState } = usePushToTalk({
1380
+ sendFunction: onSend,
1381
+ inProgress
1382
+ });
1383
+ const isInProgress = inProgress || pushToTalkState === "transcribing";
1384
+ const buttonIcon = isInProgress ? context.icons.stopIcon : context.icons.sendIcon;
1385
+ const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
1386
+ const canSend = () => {
1387
+ var _a;
1388
+ const interruptEvent = (_a = copilotContext.langGraphInterruptAction) == null ? void 0 : _a.event;
1389
+ const interruptInProgress = (interruptEvent == null ? void 0 : interruptEvent.name) === "LangGraphInterruptEvent" && !(interruptEvent == null ? void 0 : interruptEvent.response);
1390
+ return (isInProgress || !isInProgress && text.trim().length > 0) && pushToTalkState === "idle" && !interruptInProgress;
1391
+ };
1392
+ const sendDisabled = !canSend();
1393
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "copilotKitInputContainer", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
1394
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1395
+ Textarea_default,
1396
+ {
1397
+ ref: textareaRef,
1398
+ placeholder: context.labels.placeholder,
1399
+ autoFocus: true,
1400
+ maxRows: 5,
1401
+ value: text,
1402
+ onChange: (event) => setText(event.target.value),
1403
+ onKeyDown: (event) => {
1404
+ if (event.key === "Enter" && !event.shiftKey) {
1405
+ event.preventDefault();
1406
+ if (canSend()) {
1407
+ send();
1408
+ }
1409
+ }
1410
+ }
1411
+ }
1412
+ ),
1413
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "copilotKitInputControls", children: [
1414
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { flexGrow: 1 } }),
1415
+ showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1416
+ "button",
1417
+ {
1418
+ onClick: () => setPushToTalkState(pushToTalkState === "idle" ? "recording" : "transcribing"),
1419
+ className: pushToTalkState === "recording" ? "copilotKitPushToTalkRecording" : "",
1420
+ children: context.icons.pushToTalkIcon
1421
+ }
1422
+ ),
1423
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1424
+ "button",
1425
+ {
1426
+ disabled: sendDisabled,
1427
+ onClick: isInProgress ? onStop : send,
1428
+ "data-copilotkit-in-progress": inProgress,
1429
+ "data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
1430
+ children: buttonIcon
1431
+ }
1432
+ )
1433
+ ] })
1434
+ ] }) });
1435
+ };
1436
+
1437
+ // src/components/chat/Response.tsx
1438
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1439
+ var ResponseButton = ({ onClick, inProgress }) => {
1440
+ const context = useChatContext();
1441
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { onClick, className: "copilotKitResponseButton", children: [
1442
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: inProgress ? context.icons.stopIcon : context.icons.regenerateIcon }),
1443
+ inProgress ? context.labels.stopGenerating : context.labels.regenerateResponse
1444
+ ] });
1445
+ };
1446
+
1447
+ // src/components/chat/messages/RenderTextMessage.tsx
1448
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1449
+ function RenderTextMessage(props) {
1450
+ const {
1451
+ message,
1452
+ inProgress,
1453
+ index,
1454
+ isCurrentMessage,
1455
+ UserMessage: UserMessage2,
1456
+ AssistantMessage: AssistantMessage2,
1457
+ onRegenerate,
1458
+ onCopy,
1459
+ onThumbsUp,
1460
+ onThumbsDown
1461
+ } = props;
1462
+ if (message.isTextMessage()) {
1463
+ if (message.role === "user") {
1464
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1465
+ UserMessage2,
1466
+ {
1467
+ "data-message-role": "user",
1468
+ message: message.content,
1469
+ rawData: message
1470
+ },
1471
+ index
1472
+ );
1473
+ } else if (message.role == "assistant") {
1474
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1475
+ AssistantMessage2,
1476
+ {
1477
+ "data-message-role": "assistant",
1478
+ message: message.content,
1479
+ rawData: message,
1480
+ isLoading: inProgress && isCurrentMessage && !message.content,
1481
+ isGenerating: inProgress && isCurrentMessage && !!message.content,
1482
+ isCurrentMessage,
1483
+ onRegenerate,
1484
+ onCopy,
1485
+ onThumbsUp,
1486
+ onThumbsDown
1487
+ },
1488
+ index
1489
+ );
1490
+ }
1491
+ }
1492
+ }
1493
+
1494
+ // src/components/chat/messages/RenderActionExecutionMessage.tsx
1495
+ var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
1496
+ var import_react_core6 = require("@copilotkit/react-core");
1497
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1498
+ function RenderActionExecutionMessage(props) {
1499
+ const { chatComponentsCache } = (0, import_react_core6.useCopilotContext)();
1500
+ const { message, inProgress, index, isCurrentMessage, actionResult, AssistantMessage: AssistantMessage2 } = props;
1501
+ if (message.isActionExecutionMessage()) {
1502
+ if (chatComponentsCache.current !== null && (chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"])) {
1503
+ const render = chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"];
1504
+ if (typeof render === "string") {
1505
+ if (isCurrentMessage && inProgress) {
1506
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1507
+ AssistantMessage2,
1508
+ {
1509
+ rawData: message,
1510
+ "data-message-role": "assistant",
1511
+ isLoading: false,
1512
+ isGenerating: true,
1513
+ message: render
1514
+ },
1515
+ index
1516
+ );
1517
+ } else {
1518
+ return null;
1519
+ }
1520
+ } else {
1521
+ const args = message.arguments;
1522
+ let status = "inProgress";
1523
+ if (actionResult !== void 0) {
1524
+ status = "complete";
1525
+ } else if (message.status.code !== import_runtime_client_gql2.MessageStatusCode.Pending) {
1526
+ status = "executing";
1527
+ }
1528
+ try {
1529
+ const toRender = render({
1530
+ status,
1531
+ args,
1532
+ result: actionResult,
1533
+ name: message.name
1534
+ });
1535
+ if (!toRender && status === "complete") {
1536
+ return null;
1537
+ }
1538
+ if (typeof toRender === "string") {
1539
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1540
+ AssistantMessage2,
1541
+ {
1542
+ rawData: message,
1543
+ "data-message-role": "assistant",
1544
+ isLoading: false,
1545
+ isGenerating: false,
1546
+ message: toRender
1547
+ },
1548
+ index
1549
+ );
1550
+ } else {
1551
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1552
+ AssistantMessage2,
1553
+ {
1554
+ rawData: message,
1555
+ "data-message-role": "action-render",
1556
+ isLoading: false,
1557
+ isGenerating: false,
1558
+ subComponent: toRender
1559
+ },
1560
+ index
1561
+ );
1562
+ }
1563
+ } catch (e) {
1564
+ console.error(`Error executing render function for action ${message.name}: ${e}`);
1565
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1566
+ AssistantMessage2,
1567
+ {
1568
+ rawData: message,
1569
+ "data-message-role": "assistant",
1570
+ isLoading: false,
1571
+ isGenerating: false,
1572
+ subComponent: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
1573
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("b", { children: [
1574
+ "\u274C Error executing render function for action ",
1575
+ message.name,
1576
+ ":"
1577
+ ] }),
1578
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("pre", { children: e instanceof Error ? e.message : String(e) })
1579
+ ] })
1580
+ },
1581
+ index
1582
+ );
1583
+ }
1584
+ }
1585
+ } else if (!inProgress || !isCurrentMessage) {
1586
+ return null;
1587
+ } else {
1588
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1589
+ AssistantMessage2,
1590
+ {
1591
+ rawData: message,
1592
+ "data-message-role": "assistant",
1593
+ isLoading: true,
1594
+ isGenerating: true
1595
+ },
1596
+ index
1597
+ );
1598
+ }
1599
+ }
1600
+ }
1601
+
1602
+ // src/components/chat/messages/RenderResultMessage.tsx
1603
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1604
+ function RenderResultMessage(props) {
1605
+ const { message, inProgress, index, isCurrentMessage, AssistantMessage: AssistantMessage2 } = props;
1606
+ if (message.isResultMessage() && inProgress && isCurrentMessage) {
1607
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1608
+ AssistantMessage2,
1609
+ {
1610
+ "data-message-role": "assistant",
1611
+ rawData: message,
1612
+ isLoading: true,
1613
+ isGenerating: true
1614
+ },
1615
+ index
1616
+ );
1617
+ } else {
1618
+ return null;
1619
+ }
1620
+ }
1621
+
1622
+ // src/components/chat/messages/RenderAgentStateMessage.tsx
1623
+ var import_react_core7 = require("@copilotkit/react-core");
1624
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1625
+ function RenderAgentStateMessage(props) {
1626
+ const { chatComponentsCache } = (0, import_react_core7.useCopilotContext)();
1627
+ const { message, inProgress, index, isCurrentMessage, AssistantMessage: AssistantMessage2 } = props;
1628
+ if (message.isAgentStateMessage()) {
1629
+ let render;
1630
+ if (chatComponentsCache.current !== null) {
1631
+ render = chatComponentsCache.current.coAgentStateRenders[`${message.agentName}-${message.nodeName}`] || chatComponentsCache.current.coAgentStateRenders[`${message.agentName}-global`];
1632
+ }
1633
+ if (render) {
1634
+ if (typeof render === "string") {
1635
+ if (isCurrentMessage && inProgress) {
1636
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1637
+ AssistantMessage2,
1638
+ {
1639
+ rawData: message,
1640
+ message: render,
1641
+ "data-message-role": "assistant",
1642
+ isLoading: true,
1643
+ isGenerating: true
1644
+ },
1645
+ index
1646
+ );
1647
+ } else {
1648
+ return null;
1649
+ }
1650
+ } else {
1651
+ const state = message.state;
1652
+ let status = message.active ? "inProgress" : "complete";
1653
+ const toRender = render({
1654
+ status,
1655
+ state,
1656
+ nodeName: message.nodeName
1657
+ });
1658
+ if (!toRender && status === "complete") {
1659
+ return null;
1660
+ }
1661
+ if (!toRender && isCurrentMessage && inProgress) {
1662
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1663
+ AssistantMessage2,
1664
+ {
1665
+ "data-message-role": "assistant",
1666
+ rawData: message,
1667
+ isLoading: true,
1668
+ isGenerating: true
1669
+ },
1670
+ index
1671
+ );
1672
+ } else if (!toRender) {
1673
+ return null;
1674
+ }
1675
+ if (typeof toRender === "string") {
1676
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1677
+ AssistantMessage2,
1678
+ {
1679
+ rawData: message,
1680
+ message: toRender,
1681
+ isLoading: true,
1682
+ isGenerating: true,
1683
+ "data-message-role": "assistant"
1684
+ },
1685
+ index
1686
+ );
1687
+ } else {
1688
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1689
+ AssistantMessage2,
1690
+ {
1691
+ rawData: message,
1692
+ "data-message-role": "agent-state-render",
1693
+ isLoading: false,
1694
+ isGenerating: false,
1695
+ subComponent: toRender
1696
+ },
1697
+ index
1698
+ );
1699
+ }
1700
+ }
1701
+ } else if (!inProgress || !isCurrentMessage) {
1702
+ return null;
1703
+ } else {
1704
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1705
+ AssistantMessage2,
1706
+ {
1707
+ rawData: message,
1708
+ isLoading: true,
1709
+ isGenerating: true,
1710
+ "data-message-role": "assistant"
1711
+ },
1712
+ index
1713
+ );
1714
+ }
1715
+ }
1716
+ }
1717
+
1718
+ // src/components/chat/Markdown.tsx
1719
+ var import_react11 = require("react");
1720
+ var import_react_markdown = __toESM(require("react-markdown"));
1721
+
1722
+ // src/components/chat/CodeBlock.tsx
1723
+ var import_react10 = require("react");
1724
+ var import_react_syntax_highlighter = require("react-syntax-highlighter");
1725
+
1726
+ // src/hooks/use-copy-to-clipboard.tsx
1727
+ var React7 = __toESM(require("react"));
1728
+ function useCopyToClipboard({ timeout = 2e3 }) {
1729
+ const [isCopied, setIsCopied] = React7.useState(false);
1730
+ const copyToClipboard = (value) => {
1731
+ var _a;
1732
+ if (typeof window === "undefined" || !((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
1733
+ return;
1734
+ }
1735
+ if (!value) {
1736
+ return;
1737
+ }
1738
+ navigator.clipboard.writeText(value).then(() => {
1739
+ setIsCopied(true);
1740
+ setTimeout(() => {
1741
+ setIsCopied(false);
1742
+ }, timeout);
1743
+ });
1744
+ };
1745
+ return { isCopied, copyToClipboard };
1746
+ }
1747
+
1748
+ // src/components/chat/CodeBlock.tsx
1749
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1750
+ var programmingLanguages = {
1751
+ javascript: ".js",
1752
+ python: ".py",
1753
+ java: ".java",
1754
+ c: ".c",
1755
+ cpp: ".cpp",
1756
+ "c++": ".cpp",
1757
+ "c#": ".cs",
1758
+ ruby: ".rb",
1759
+ php: ".php",
1760
+ swift: ".swift",
1761
+ "objective-c": ".m",
1762
+ kotlin: ".kt",
1763
+ typescript: ".ts",
1764
+ go: ".go",
1765
+ perl: ".pl",
1766
+ rust: ".rs",
1767
+ scala: ".scala",
1768
+ haskell: ".hs",
1769
+ lua: ".lua",
1770
+ shell: ".sh",
1771
+ sql: ".sql",
1772
+ html: ".html",
1773
+ css: ".css"
1774
+ // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component
1775
+ };
1776
+ var generateRandomString = (length, lowercase = false) => {
1777
+ const chars = "ABCDEFGHJKLMNPQRSTUVWXY3456789";
1778
+ let result = "";
1779
+ for (let i = 0; i < length; i++) {
1780
+ result += chars.charAt(Math.floor(Math.random() * chars.length));
1781
+ }
1782
+ return lowercase ? result.toLowerCase() : result;
1783
+ };
1784
+ var CodeBlock = (0, import_react10.memo)(({ language, value }) => {
1785
+ const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
1786
+ const downloadAsFile = () => {
1787
+ if (typeof window === "undefined") {
1788
+ return;
1789
+ }
1790
+ const fileExtension = programmingLanguages[language] || ".file";
1791
+ const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;
1792
+ const fileName = window.prompt("Enter file name", suggestedFileName);
1793
+ if (!fileName) {
1794
+ return;
1795
+ }
1796
+ const blob = new Blob([value], { type: "text/plain" });
1797
+ const url = URL.createObjectURL(blob);
1798
+ const link = document.createElement("a");
1799
+ link.download = fileName;
1800
+ link.href = url;
1801
+ link.style.display = "none";
1802
+ document.body.appendChild(link);
1803
+ link.click();
1804
+ document.body.removeChild(link);
1805
+ URL.revokeObjectURL(url);
1806
+ };
1807
+ const onCopy = () => {
1808
+ if (isCopied)
1809
+ return;
1810
+ copyToClipboard(value);
1811
+ };
1812
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "copilotKitCodeBlock", children: [
1813
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
1814
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
1815
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
1816
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: downloadAsFile, children: DownloadIcon }),
1817
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: isCopied ? CheckIcon : CopyIcon })
1818
+ ] })
1819
+ ] }),
1820
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1821
+ import_react_syntax_highlighter.Prism,
1822
+ {
1823
+ language,
1824
+ style: highlightStyle,
1825
+ PreTag: "div",
1826
+ customStyle: {
1827
+ margin: 0,
1828
+ borderBottomLeftRadius: "0.375rem",
1829
+ borderBottomRightRadius: "0.375rem"
1830
+ },
1831
+ children: value
1832
+ }
1833
+ )
1834
+ ] });
1835
+ });
1836
+ CodeBlock.displayName = "CodeBlock";
1837
+ var highlightStyle = {
1838
+ 'pre[class*="language-"]': {
1839
+ color: "#d4d4d4",
1840
+ fontSize: "13px",
1841
+ textShadow: "none",
1842
+ fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
1843
+ direction: "ltr",
1844
+ textAlign: "left",
1845
+ whiteSpace: "pre",
1846
+ wordSpacing: "normal",
1847
+ wordBreak: "normal",
1848
+ lineHeight: "1.5",
1849
+ MozTabSize: "4",
1850
+ OTabSize: "4",
1851
+ tabSize: "4",
1852
+ WebkitHyphens: "none",
1853
+ MozHyphens: "none",
1854
+ msHyphens: "none",
1855
+ hyphens: "none",
1856
+ padding: "1em",
1857
+ margin: ".5em 0",
1858
+ overflow: "auto",
1859
+ background: "#1e1e1e"
1860
+ },
1861
+ 'code[class*="language-"]': {
1364
1862
  color: "#d4d4d4",
1365
1863
  fontSize: "13px",
1366
1864
  textShadow: "none",
@@ -1582,855 +2080,302 @@ var highlightStyle = {
1582
2080
  color: "#9cdcfe"
1583
2081
  },
1584
2082
  'code[class*="language-typescript"]': {
1585
- color: "#9cdcfe"
1586
- },
1587
- 'pre[class*="language-tsx"]': {
1588
- color: "#9cdcfe"
1589
- },
1590
- 'code[class*="language-tsx"]': {
1591
- color: "#9cdcfe"
1592
- },
1593
- 'pre[class*="language-css"]': {
1594
- color: "#ce9178"
1595
- },
1596
- 'code[class*="language-css"]': {
1597
- color: "#ce9178"
1598
- },
1599
- 'pre[class*="language-html"]': {
1600
- color: "#d4d4d4"
1601
- },
1602
- 'code[class*="language-html"]': {
1603
- color: "#d4d4d4"
1604
- },
1605
- ".language-regex .token.anchor": {
1606
- color: "#dcdcaa"
1607
- },
1608
- ".language-html .token.punctuation": {
1609
- color: "#808080"
1610
- },
1611
- 'pre[class*="language-"] > code[class*="language-"]': {
1612
- position: "relative",
1613
- zIndex: "1"
2083
+ color: "#9cdcfe"
1614
2084
  },
1615
- ".line-highlight.line-highlight": {
1616
- background: "#f7ebc6",
1617
- boxShadow: "inset 5px 0 0 #f7d87c",
1618
- zIndex: "0"
1619
- }
1620
- };
1621
-
1622
- // src/components/chat/Markdown.tsx
1623
- var import_remark_gfm = __toESM(require("remark-gfm"));
1624
- var import_remark_math = __toESM(require("remark-math"));
1625
- var import_jsx_runtime15 = require("react/jsx-runtime");
1626
- var MemoizedReactMarkdown = (0, import_react8.memo)(
1627
- import_react_markdown.default,
1628
- (prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className
1629
- );
1630
- var Markdown = ({ content }) => {
1631
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "copilotKitMarkdown", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MemoizedReactMarkdown, { components, remarkPlugins: [import_remark_gfm.default, import_remark_math.default], children: content }) });
1632
- };
1633
- var components = {
1634
- p({ children }) {
1635
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children });
2085
+ 'pre[class*="language-tsx"]': {
2086
+ color: "#9cdcfe"
1636
2087
  },
1637
- a(_a) {
1638
- var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
1639
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1640
- "a",
1641
- __spreadProps(__spreadValues({
1642
- style: { color: "blue", textDecoration: "underline" }
1643
- }, props), {
1644
- target: "_blank",
1645
- rel: "noopener noreferrer",
1646
- children
1647
- })
1648
- );
2088
+ 'code[class*="language-tsx"]': {
2089
+ color: "#9cdcfe"
1649
2090
  },
1650
- code(_c) {
1651
- var _d = _c, { children, className, inline } = _d, props = __objRest(_d, ["children", "className", "inline"]);
1652
- if (children.length) {
1653
- if (children[0] == "\u258D") {
1654
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1655
- "span",
1656
- {
1657
- style: {
1658
- animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
1659
- marginTop: "0.25rem"
1660
- },
1661
- children: "\u258D"
1662
- }
1663
- );
1664
- }
1665
- children[0] = children[0].replace("`\u258D`", "\u258D");
1666
- }
1667
- const match = /language-(\w+)/.exec(className || "");
1668
- if (inline) {
1669
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("code", __spreadProps(__spreadValues({ className }, props), { children }));
1670
- }
1671
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1672
- CodeBlock,
1673
- __spreadValues({
1674
- language: match && match[1] || "",
1675
- value: String(children).replace(/\n$/, "")
1676
- }, props),
1677
- Math.random()
1678
- );
1679
- }
1680
- };
1681
-
1682
- // src/components/chat/messages/AssistantMessage.tsx
1683
- var import_jsx_runtime16 = require("react/jsx-runtime");
1684
- var AssistantMessage = (props) => {
1685
- const { icons } = useChatContext();
1686
- const { message, isLoading, subComponent } = props;
1687
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
1688
- (message || isLoading) && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
1689
- message && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Markdown, { content: message || "" }),
1690
- isLoading && icons.spinnerIcon
1691
- ] }),
1692
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { marginBottom: "0.5rem" }, children: subComponent })
1693
- ] });
1694
- };
1695
-
1696
- // src/components/chat/messages/UserMessage.tsx
1697
- var import_jsx_runtime17 = require("react/jsx-runtime");
1698
- var UserMessage = (props) => {
1699
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: props.message });
1700
- };
1701
-
1702
- // src/components/chat/Suggestion.tsx
1703
- var import_react_core6 = require("@copilotkit/react-core");
1704
- var import_shared = require("@copilotkit/shared");
1705
- var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
1706
- var import_jsx_runtime18 = require("react/jsx-runtime");
1707
- function Suggestion({ title, message, onClick, partial, className }) {
1708
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1709
- "button",
1710
- {
1711
- disabled: partial,
1712
- onClick: (e) => {
1713
- e.preventDefault();
1714
- onClick(message);
1715
- },
1716
- className: className || "suggestion",
1717
- "data-test-id": "suggestion",
1718
- children: [
1719
- partial && SmallSpinnerIcon,
1720
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: title })
1721
- ]
1722
- }
1723
- );
1724
- }
1725
- var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggestions, abortControllerRef) => __async(void 0, null, function* () {
1726
- const abortController = abortControllerRef.current;
1727
- const tools = JSON.stringify(
1728
- Object.values(context.actions).map((action) => ({
1729
- name: action.name,
1730
- description: action.description,
1731
- jsonSchema: JSON.stringify((0, import_shared.actionParametersToJsonSchema)(action.parameters))
1732
- }))
1733
- );
1734
- const allSuggestions = [];
1735
- for (const config of Object.values(chatSuggestionConfiguration)) {
1736
- try {
1737
- const numOfSuggestionsInstructions = config.minSuggestions === 0 ? `Produce up to ${config.maxSuggestions} suggestions. If there are no highly relevant suggestions you can think of, provide an empty array.` : `Produce between ${config.minSuggestions} and ${config.maxSuggestions} suggestions.`;
1738
- const result = yield (0, import_react_core6.extract)({
1739
- context,
1740
- instructions: "Suggest what the user could say next. Provide clear, highly relevant suggestions. Do not literally suggest function calls. ",
1741
- data: config.instructions + "\n\n" + numOfSuggestionsInstructions + "\n\nAvailable tools: " + tools + "\n\n",
1742
- requestType: import_runtime_client_gql3.CopilotRequestType.Task,
1743
- parameters: [
1744
- {
1745
- name: "suggestions",
1746
- type: "object[]",
1747
- attributes: [
1748
- {
1749
- name: "title",
1750
- description: "The title of the suggestion. This is shown as a button and should be short.",
1751
- type: "string"
1752
- },
1753
- {
1754
- name: "message",
1755
- description: "The message to send when the suggestion is clicked. This should be a clear, complete sentence and will be sent as an instruction to the AI.",
1756
- type: "string"
1757
- }
1758
- ]
1759
- }
1760
- ],
1761
- include: {
1762
- messages: true,
1763
- readable: true
1764
- },
1765
- abortSignal: abortController == null ? void 0 : abortController.signal,
1766
- stream: ({ status, args }) => {
1767
- const suggestions = args.suggestions || [];
1768
- const newSuggestions = [];
1769
- for (let i = 0; i < suggestions.length; i++) {
1770
- if (config.maxSuggestions !== void 0 && i >= config.maxSuggestions) {
1771
- break;
1772
- }
1773
- const { title, message } = suggestions[i];
1774
- const partial = i == suggestions.length - 1 && status !== "complete";
1775
- newSuggestions.push({
1776
- title,
1777
- message,
1778
- partial,
1779
- className: config.className
1780
- });
1781
- }
1782
- setCurrentSuggestions([...allSuggestions, ...newSuggestions]);
1783
- }
1784
- });
1785
- allSuggestions.push(...result.suggestions);
1786
- } catch (error) {
1787
- console.error("Error loading suggestions", error);
1788
- }
1789
- }
1790
- if (abortControllerRef.current === abortController) {
1791
- abortControllerRef.current = null;
1792
- }
1793
- });
1794
-
1795
- // src/components/chat/Chat.tsx
1796
- var import_react12 = __toESM(require("react"));
1797
- var import_react_core9 = require("@copilotkit/react-core");
1798
- var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
1799
- var import_shared3 = require("@copilotkit/shared");
1800
-
1801
- // src/components/dev-console/utils.ts
1802
- var import_react_core7 = require("@copilotkit/react-core");
1803
- function shouldShowDevConsole(showDevConsole) {
1804
- if (typeof showDevConsole === "boolean") {
1805
- return showDevConsole;
1806
- }
1807
- return getHostname() === "localhost" || getHostname() === "127.0.0.1" || getHostname() === "0.0.0.0" || getHostname() === "::1";
1808
- }
1809
- function getHostname() {
1810
- if (typeof window !== "undefined" && window.location) {
1811
- return window.location.hostname;
1812
- }
1813
- return "";
1814
- }
1815
- function getPublishedCopilotKitVersion(current, forceCheck = false) {
1816
- return __async(this, null, function* () {
1817
- const LOCAL_STORAGE_KEY = "__copilotkit_version_check__";
1818
- const serializedVersion = localStorage.getItem(LOCAL_STORAGE_KEY);
1819
- if (serializedVersion && !forceCheck) {
1820
- try {
1821
- const parsedVersion = JSON.parse(serializedVersion);
1822
- const oneHour = 60 * 60 * 1e3;
1823
- const now = (/* @__PURE__ */ new Date()).getTime();
1824
- if (parsedVersion.current === current && now - new Date(parsedVersion.lastChecked).getTime() < oneHour) {
1825
- return parsedVersion;
1826
- }
1827
- } catch (error) {
1828
- console.error("Failed to parse CopilotKitVersion from localStorage", error);
1829
- }
1830
- }
1831
- try {
1832
- const response = yield fetch("https://api.cloud.copilotkit.ai/check-for-updates", {
1833
- method: "POST",
1834
- headers: {
1835
- "Content-Type": "application/json"
1836
- },
1837
- body: JSON.stringify({
1838
- packages: [
1839
- {
1840
- packageName: "@copilotkit/shared",
1841
- packageVersion: current
1842
- }
1843
- ]
1844
- })
1845
- });
1846
- const data = yield response.json();
1847
- const version = {
1848
- current,
1849
- lastChecked: (/* @__PURE__ */ new Date()).getTime(),
1850
- latest: data.packages[0].latestVersion,
1851
- severity: data.packages[0].severity,
1852
- advisory: data.packages[0].advisory || null
1853
- };
1854
- localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(version));
1855
- return version;
1856
- } catch (error) {
1857
- console.error("Failed to check for updates", error);
1858
- throw error;
1859
- }
1860
- });
1861
- }
1862
- function logReadables(context) {
1863
- console.log("%cCurrent Readables:", "font-size: 16px; font-weight: bold;");
1864
- const readables = context.getContextString([], import_react_core7.defaultCopilotContextCategories).trim();
1865
- if (readables.length === 0) {
1866
- console.log("No readables found");
1867
- return;
1868
- }
1869
- console.log(readables);
1870
- }
1871
- function logActions(context) {
1872
- console.log("%cCurrent Actions:", "font-size: 16px; font-weight: bold;");
1873
- if (Object.values(context.actions).length === 0) {
1874
- console.log("No actions found");
1875
- return;
1876
- }
1877
- for (const action of Object.values(context.actions)) {
1878
- console.group(action.name);
1879
- console.log("name", action.name);
1880
- console.log("description", action.description);
1881
- console.log("parameters", action.parameters);
1882
- console.groupEnd();
1883
- }
1884
- }
1885
- function logMessages(context) {
1886
- console.log("%cCurrent Messages:", "font-size: 16px; font-weight: bold;");
1887
- if (context.messages.length === 0) {
1888
- console.log("No messages found");
1889
- return;
2091
+ 'pre[class*="language-css"]': {
2092
+ color: "#ce9178"
2093
+ },
2094
+ 'code[class*="language-css"]': {
2095
+ color: "#ce9178"
2096
+ },
2097
+ 'pre[class*="language-html"]': {
2098
+ color: "#d4d4d4"
2099
+ },
2100
+ 'code[class*="language-html"]': {
2101
+ color: "#d4d4d4"
2102
+ },
2103
+ ".language-regex .token.anchor": {
2104
+ color: "#dcdcaa"
2105
+ },
2106
+ ".language-html .token.punctuation": {
2107
+ color: "#808080"
2108
+ },
2109
+ 'pre[class*="language-"] > code[class*="language-"]': {
2110
+ position: "relative",
2111
+ zIndex: "1"
2112
+ },
2113
+ ".line-highlight.line-highlight": {
2114
+ background: "#f7ebc6",
2115
+ boxShadow: "inset 5px 0 0 #f7d87c",
2116
+ zIndex: "0"
1890
2117
  }
1891
- const tableData = context.messages.map((message) => {
1892
- if (message.isTextMessage()) {
1893
- return {
1894
- id: message.id,
1895
- type: "TextMessage",
1896
- role: message.role,
1897
- name: void 0,
1898
- scope: void 0,
1899
- content: message.content
1900
- };
1901
- } else if (message.isActionExecutionMessage()) {
1902
- return {
1903
- id: message.id,
1904
- type: "ActionExecutionMessage",
1905
- role: void 0,
1906
- name: message.name,
1907
- scope: message.parentMessageId,
1908
- content: message.arguments
1909
- };
1910
- } else if (message.isResultMessage()) {
1911
- return {
1912
- id: message.id,
1913
- type: "ResultMessage",
1914
- role: void 0,
1915
- name: message.actionName,
1916
- scope: message.actionExecutionId,
1917
- content: message.result
1918
- };
1919
- } else if (message.isAgentStateMessage()) {
1920
- return {
1921
- id: message.id,
1922
- type: `AgentStateMessage (running: ${message.running})`,
1923
- role: message.role,
1924
- name: void 0,
1925
- scope: message.threadId,
1926
- content: message.state
1927
- };
1928
- }
1929
- });
1930
- console.table(tableData);
1931
- }
1932
-
1933
- // src/components/dev-console/console.tsx
1934
- var import_react_core8 = require("@copilotkit/react-core");
1935
- var import_react10 = require("react");
2118
+ };
1936
2119
 
1937
- // src/components/dev-console/icons.tsx
2120
+ // src/components/chat/Markdown.tsx
2121
+ var import_remark_gfm = __toESM(require("remark-gfm"));
2122
+ var import_remark_math = __toESM(require("remark-math"));
1938
2123
  var import_jsx_runtime19 = require("react/jsx-runtime");
1939
- var ExclamationMarkTriangleIcon = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1940
- "svg",
1941
- {
1942
- width: "13.3967723px",
1943
- height: "12px",
1944
- viewBox: "0 0 13.3967723 12",
1945
- version: "1.1",
1946
- xmlns: "http://www.w3.org/2000/svg",
1947
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("g", { id: "exclamation-triangle", fill: "#CD2121", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1948
- "path",
1949
- {
1950
- d: "M5.39935802,0.75 C5.97670802,-0.25 7.42007802,-0.25 7.99742802,0.75 L13.193588,9.75 C13.770888,10.75 13.049288,12 11.894588,12 L1.50223802,12 C0.34753802,12 -0.37414898,10.75 0.20319802,9.75 L5.39935802,0.75 Z M6.69838802,2.5 C7.11260802,2.5 7.44838802,2.83579 7.44838802,3.25 L7.44838802,6.25 C7.44838802,6.66421 7.11260802,7 6.69838802,7 C6.28417802,7 5.94838802,6.66421 5.94838802,6.25 L5.94838802,3.25 C5.94838802,2.83579 6.28417802,2.5 6.69838802,2.5 Z M6.69838802,10.5 C7.25067802,10.5 7.69838802,10.0523 7.69838802,9.5 C7.69838802,8.9477 7.25067802,8.5 6.69838802,8.5 C6.14610802,8.5 5.69838802,8.9477 5.69838802,9.5 C5.69838802,10.0523 6.14610802,10.5 6.69838802,10.5 Z",
1951
- id: "Shape"
1952
- }
1953
- ) }) })
1954
- }
1955
- );
1956
- var ExclamationMarkIcon = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1957
- "svg",
1958
- {
1959
- width: "14px",
1960
- height: "14px",
1961
- viewBox: "0 0 14 14",
1962
- version: "1.1",
1963
- xmlns: "http://www.w3.org/2000/svg",
1964
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("g", { id: "exclamation-circle", fill: "#EC662C", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1965
- "path",
1966
- {
1967
- d: "M7,14 C10.866,14 14,10.866 14,7 C14,3.13401 10.866,0 7,0 C3.13401,0 0,3.13401 0,7 C0,10.866 3.13401,14 7,14 Z M7,3 C7.41421,3 7.75,3.33579 7.75,3.75 L7.75,6.75 C7.75,7.16421 7.41421,7.5 7,7.5 C6.58579,7.5 6.25,7.16421 6.25,6.75 L6.25,3.75 C6.25,3.33579 6.58579,3 7,3 Z M7,11 C7.55228,11 8,10.5523 8,10 C8,9.4477 7.55228,9 7,9 C6.44772,9 6,9.4477 6,10 C6,10.5523 6.44772,11 7,11 Z",
1968
- id: "Shape"
1969
- }
1970
- ) }) })
1971
- }
2124
+ var MemoizedReactMarkdown = (0, import_react11.memo)(
2125
+ import_react_markdown.default,
2126
+ (prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className
1972
2127
  );
1973
- var ChevronDownIcon = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { width: "7px", height: "4px", viewBox: "0 0 7 4", version: "1.1", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("g", { id: "Group", fill: "#000000", fillRule: "nonzero", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1974
- "path",
1975
- {
1976
- d: "M3.71690723,3.90271086 C3.59268176,4.03242971 3.39143629,4.03242971 3.26721082,3.90271086 L0.0853966595,0.57605615 C-0.0314221035,0.444981627 -0.0279751448,0.240725043 0.0931934622,0.114040675 C0.214362069,-0.0126436935 0.409725445,-0.0162475626 0.535093061,0.105888951 L3.49205902,3.19746006 L6.44902499,0.105888951 C6.52834574,0.0168884389 6.64780588,-0.0197473458 6.7605411,0.0103538404 C6.87327633,0.0404550266 6.96130636,0.132492308 6.99009696,0.250359396 C7.01888756,0.368226483 6.98384687,0.493124608 6.89872139,0.57605615 L3.71690723,3.90271086 Z",
1977
- id: "Path"
1978
- }
1979
- ) }) }) });
1980
- var CheckIcon2 = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1981
- "svg",
1982
- {
1983
- width: "14px",
1984
- height: "14px",
1985
- viewBox: "0 0 14 14",
1986
- version: "1.1",
1987
- xmlns: "http://www.w3.org/2000/svg",
1988
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("g", { id: "Group-2", transform: "translate(-118, 0)", fill: "#1BC030", fillRule: "nonzero", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("g", { id: "Group", transform: "translate(118, 0)", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1989
- "path",
1990
- {
1991
- 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",
1992
- id: "Shape"
2128
+ var Markdown = ({ content }) => {
2129
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "copilotKitMarkdown", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MemoizedReactMarkdown, { components, remarkPlugins: [import_remark_gfm.default, import_remark_math.default], children: content }) });
2130
+ };
2131
+ var components = {
2132
+ a(_a) {
2133
+ var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
2134
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2135
+ "a",
2136
+ __spreadProps(__spreadValues({
2137
+ style: { color: "blue", textDecoration: "underline" }
2138
+ }, props), {
2139
+ target: "_blank",
2140
+ rel: "noopener noreferrer",
2141
+ children
2142
+ })
2143
+ );
2144
+ },
2145
+ code(_c) {
2146
+ var _d = _c, { children, className, inline } = _d, props = __objRest(_d, ["children", "className", "inline"]);
2147
+ if (children.length) {
2148
+ if (children[0] == "\u258D") {
2149
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2150
+ "span",
2151
+ {
2152
+ style: {
2153
+ animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
2154
+ marginTop: "0.25rem"
2155
+ },
2156
+ children: "\u258D"
2157
+ }
2158
+ );
1993
2159
  }
1994
- ) }) }) })
1995
- }
1996
- );
1997
- var CopilotKitIcon = /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
1998
- "svg",
1999
- {
2000
- width: "33px",
2001
- height: "35px",
2002
- viewBox: "0 0 33 35",
2003
- version: "1.1",
2004
- xmlns: "http://www.w3.org/2000/svg",
2005
- children: [
2006
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("title", { children: "bd5c9079-929b-4d55-bdc9-16d1c8181b71" }),
2007
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2008
- "image",
2009
- {
2010
- x: "0",
2011
- y: "0",
2012
- width: "33",
2013
- height: "35",
2014
- xlinkHref: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAI0AAACXCAYAAAAoE9hYAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAjaADAAQAAAABAAAAlwAAAACI8Oz3AABAAElEQVR4Ae2dCYAlVXnvv6q79d7TMz37sIMgKKBCkLhkSKK4xJUMQVzAqJBgNDGJa2LsvJfERI0aiEbwRXnoQ2VYRASiQUFRUGQm7DAwzDBbT+/rvbfvXu/3P1V1+84CzEw3MNPD6a579nOqzvev73znO0t59rzZbQu88sXndp2w4gVLp5oG+6+47ivDu010kAb6B+lzP+Vjr1zZk0xV/ddMVIufap/34g+e+s9rX9351U1dT5npIIpMHkTPusePmto+tKhctVWPDW1/c27hIVNbCsFbCpa7/aR/f/SWFV2ZX974zsNG97iwOZjwedDshqiZlL3AD9JH9Y8PpTYMPJEuLj7+pclE5vBquXZ6MV/56Zu/ueGnmWpqzer3HzKym+xzPsib80+4lw/Y09Pjr7lm9GO+eR+eKI4tXdeRsomXv8a6Dj3eqn6iRoPl5qW83o60vyaT9O5IWPX2llrH+hsuXJbfy6oO2OTPg2Yn0p1/6ueWFK1wWTKReo1XDZoeqw7YxhcfYfNf9NtWSHTYVLVqxSAIqoFlU76NzEt6mzqSCQBkt3up1NrlHUdsXX22V92p2DnlfR40O5Az8N57+pfPgcv8YzLZdHjKS3i9uS1254Kitf3271qq81ATGkq1wPJCDVexEtS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ydEu37Pfn+J7/zXkIt50IxO3oK1rgKgEaU5YYAJhaUOCLawjufOW8i0Pnlm1/bo/7mAll9uO8/x9teQya14m6TgAAAABJRU5ErkJggg=="
2015
- }
2016
- ) })
2017
- ]
2160
+ children[0] = children[0].replace("`\u258D`", "\u258D");
2161
+ }
2162
+ const match = /language-(\w+)/.exec(className || "");
2163
+ if (inline) {
2164
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("code", __spreadProps(__spreadValues({ className }, props), { children }));
2165
+ }
2166
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2167
+ CodeBlock,
2168
+ __spreadValues({
2169
+ language: match && match[1] || "",
2170
+ value: String(children).replace(/\n$/, "")
2171
+ }, props),
2172
+ Math.random()
2173
+ );
2018
2174
  }
2019
- );
2020
-
2021
- // src/components/dev-console/console.tsx
2022
- var import_react11 = require("@headlessui/react");
2023
- var import_shared2 = require("@copilotkit/shared");
2024
-
2025
- // src/components/help-modal/modal.tsx
2026
- var import_react9 = require("react");
2175
+ };
2027
2176
 
2028
- // src/components/help-modal/icons.tsx
2177
+ // src/components/chat/messages/AssistantMessage.tsx
2178
+ var import_react12 = require("react");
2029
2179
  var import_jsx_runtime20 = require("react/jsx-runtime");
2030
- var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2031
- "svg",
2032
- {
2033
- xmlns: "http://www.w3.org/2000/svg",
2034
- fill: "none",
2035
- viewBox: "0 0 24 24",
2036
- strokeWidth: "1.5",
2037
- stroke: "currentColor",
2038
- width: "20",
2039
- height: "20",
2040
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
2041
- }
2042
- );
2043
- var LoadingSpinnerIcon = ({ color = "rgb(107 114 128)" }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2044
- "svg",
2045
- {
2046
- style: {
2047
- animation: "copilotKitSpinAnimation 1s linear infinite",
2048
- color
2049
- },
2050
- width: "24",
2051
- height: "24",
2052
- xmlns: "http://www.w3.org/2000/svg",
2053
- fill: "none",
2054
- viewBox: "0 0 24 24",
2055
- children: [
2056
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2057
- "circle",
2058
- {
2059
- style: { opacity: 0.25 },
2060
- cx: "12",
2061
- cy: "12",
2062
- r: "10",
2063
- stroke: "currentColor",
2064
- strokeWidth: "4"
2065
- }
2066
- ),
2067
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2068
- "path",
2069
- {
2070
- style: { opacity: 0.75 },
2071
- fill: "currentColor",
2072
- d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
2073
- }
2074
- )
2075
- ]
2076
- }
2077
- );
2078
-
2079
- // src/components/help-modal/modal.tsx
2080
- var import_jsx_runtime21 = require("react/jsx-runtime");
2081
- function CopilotKitHelpModal() {
2082
- const [showHelpModal, setShowHelpModal] = (0, import_react9.useState)(false);
2083
- const [issueDescription, setIssueDescription] = (0, import_react9.useState)("");
2084
- const [email, setEmail] = (0, import_react9.useState)("");
2085
- const [emailError, setEmailError] = (0, import_react9.useState)("");
2086
- const [submitting, setSubmitting] = (0, import_react9.useState)(false);
2087
- const validateEmail = (email2) => {
2088
- const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
2089
- return re.test(email2);
2180
+ var AssistantMessage = (props) => {
2181
+ const { icons, labels } = useChatContext();
2182
+ const {
2183
+ message,
2184
+ isLoading,
2185
+ subComponent,
2186
+ onRegenerate,
2187
+ onCopy,
2188
+ onThumbsUp,
2189
+ onThumbsDown,
2190
+ isCurrentMessage
2191
+ } = props;
2192
+ const [copied, setCopied] = (0, import_react12.useState)(false);
2193
+ const handleCopy = () => {
2194
+ if (message && onCopy) {
2195
+ navigator.clipboard.writeText(message);
2196
+ setCopied(true);
2197
+ onCopy(message);
2198
+ setTimeout(() => setCopied(false), 2e3);
2199
+ } else if (message) {
2200
+ navigator.clipboard.writeText(message);
2201
+ setCopied(true);
2202
+ setTimeout(() => setCopied(false), 2e3);
2203
+ }
2090
2204
  };
2091
- const handleSubmit = (e) => __async(this, null, function* () {
2092
- e.preventDefault();
2093
- if ((email == null ? void 0 : email.length) > 0 && !validateEmail(email)) {
2094
- setEmailError("Please enter a valid email address");
2095
- return;
2205
+ const handleRegenerate = () => {
2206
+ if (onRegenerate) {
2207
+ onRegenerate();
2096
2208
  }
2097
- setSubmitting(true);
2098
- yield fetch("https://api.segment.io/v1/track", {
2099
- method: "POST",
2100
- headers: {
2101
- "Content-Type": "application/json"
2102
- },
2103
- body: JSON.stringify({
2104
- event: "oss.dev-console.help",
2105
- anonymousId: window.crypto.randomUUID(),
2106
- properties: { email, text: issueDescription },
2107
- writeKey: "q0gQqvGYyw9pNyhIocNzefSYKGO1aiwW"
2108
- })
2109
- });
2110
- setEmailError("");
2111
- setEmail("");
2112
- setIssueDescription("");
2113
- setSubmitting(false);
2114
- setShowHelpModal(false);
2115
- });
2116
- const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2117
- "button",
2118
- {
2119
- onClick: () => setShowHelpModal(true),
2120
- style: { width: "50px", height: "30px", marginRight: "0.25rem" },
2121
- className: "text-sm p-0 bg-transparent rounded border border-blue-500",
2122
- "aria-label": "Open Help",
2123
- children: "Help"
2209
+ };
2210
+ const handleThumbsUp = () => {
2211
+ if (onThumbsUp && message) {
2212
+ onThumbsUp(message);
2124
2213
  }
2125
- );
2126
- const submitButtonDisabled = (0, import_react9.useMemo)(
2127
- () => submitting || !!emailError || issueDescription == null || (issueDescription == null ? void 0 : issueDescription.length) == 0,
2128
- [submitting, emailError, issueDescription]
2129
- );
2130
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
2131
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(HelpButton, {}),
2132
- showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2133
- "div",
2134
- {
2135
- className: "fixed inset-0 flex items-center justify-center p-4",
2136
- style: { backgroundColor: "rgba(11, 15, 26, 0.5)", zIndex: 99 },
2137
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "bg-white rounded-lg shadow-xl max-w-md w-full p-4 flex-col relative", children: [
2138
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2139
- "button",
2140
- {
2141
- className: "absolute text-gray-400 hover:text-gray-600 focus:outline-none",
2142
- style: { top: "10px", right: "10px" },
2143
- onClick: () => setShowHelpModal(false),
2144
- "aria-label": "Close",
2145
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CloseIcon2, {})
2146
- }
2147
- ),
2148
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "w-full flex mb-6 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h2", { className: "text-2xl font-bold", children: "Help Options" }) }),
2149
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-4 mb-4", children: [
2150
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "block w-full text-center py-2 px-4 bg-blue-500 text-white rounded hover:bg-blue-600 transition duration-150 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2151
- "a",
2214
+ };
2215
+ const handleThumbsDown = () => {
2216
+ if (onThumbsDown && message) {
2217
+ onThumbsDown(message);
2218
+ }
2219
+ };
2220
+ const LoadingIcon = () => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: icons.activityIcon });
2221
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
2222
+ (message || isLoading) && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
2223
+ message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Markdown, { content: message || "" }),
2224
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LoadingIcon, {}),
2225
+ message && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2226
+ "div",
2227
+ {
2228
+ className: `copilotKitMessageControls ${isCurrentMessage ? "currentMessage" : ""}`,
2229
+ children: [
2230
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2231
+ "button",
2152
2232
  {
2153
- href: "https://docs.copilotkit.ai/coagents/troubleshooting/common-issues",
2154
- target: "_blank",
2155
- rel: "noopener noreferrer",
2156
- children: "Visit the Troubleshooting and FAQ section in the docs"
2233
+ className: "copilotKitMessageControlButton",
2234
+ onClick: handleRegenerate,
2235
+ "aria-label": labels.regenerateResponse,
2236
+ title: labels.regenerateResponse,
2237
+ children: RegenerateIcon
2157
2238
  }
2158
- ) }),
2159
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "block w-full text-center py-2 px-4 bg-blue-500 text-white rounded hover:bg-blue-600 transition duration-150 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2160
- "a",
2239
+ ),
2240
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2241
+ "button",
2161
2242
  {
2162
- href: "https://go.copilotkit.ai/dev-console-support-discord",
2163
- target: "_blank",
2164
- rel: "noopener noreferrer",
2165
- children: "Go to Discord Support Channel (Community Support)"
2243
+ className: "copilotKitMessageControlButton",
2244
+ onClick: handleCopy,
2245
+ "aria-label": labels.copyToClipboard,
2246
+ title: labels.copyToClipboard,
2247
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { fontSize: "10px", fontWeight: "bold" }, children: "\u2713" }) : CopyIcon
2166
2248
  }
2167
- ) }),
2168
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "block w-full text-center py-2 px-4 bg-blue-500 text-white rounded hover:bg-blue-600 transition duration-150 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2169
- "a",
2249
+ ),
2250
+ onThumbsUp && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2251
+ "button",
2170
2252
  {
2171
- href: "https://go.copilotkit.ai/dev-console-support-slack",
2172
- target: "_blank",
2173
- rel: "noopener noreferrer",
2174
- children: "Apply for Priority Direct Slack Support"
2253
+ className: "copilotKitMessageControlButton",
2254
+ onClick: handleThumbsUp,
2255
+ "aria-label": labels.thumbsUp,
2256
+ title: labels.thumbsUp,
2257
+ children: ThumbsUpIcon
2175
2258
  }
2176
- ) })
2177
- ] }),
2178
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("form", { onSubmit: handleSubmit, className: "flex flex-col space-y-2", children: [
2179
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
2180
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { htmlFor: "feedback", className: "block text-sm font-medium text-gray-700 mb-1", children: "Let us know what your issue is:" }),
2181
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2182
- "textarea",
2183
- {
2184
- id: "feedback",
2185
- rows: 4,
2186
- className: "w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500",
2187
- placeholder: "A Loom link / screen recording is always great!",
2188
- onChange: (e) => setIssueDescription(e.target.value),
2189
- value: issueDescription,
2190
- required: true
2191
- }
2192
- )
2193
- ] }),
2194
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
2195
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { htmlFor: "email", className: "block text-sm font-medium text-gray-700 mb-1", children: "Email (optional):" }),
2196
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2197
- "input",
2198
- {
2199
- type: "email",
2200
- id: "email",
2201
- className: `w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500 ${emailError ? "border-red-500" : ""}`,
2202
- placeholder: "Enter your email for follow-up",
2203
- onChange: (e) => {
2204
- setEmail(e.target.value);
2205
- setEmailError("");
2206
- },
2207
- value: email
2208
- }
2209
- ),
2210
- emailError && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-red-500 text-sm mt-1", children: emailError })
2211
- ] }),
2212
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "bg-gray-50 px-4 py-4 sm:px-6 sm:flex sm:flex-row-reverse rounded-b-lg", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2259
+ ),
2260
+ onThumbsDown && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2213
2261
  "button",
2214
2262
  {
2215
- type: "submit",
2216
- onClick: handleSubmit,
2217
- disabled: submitButtonDisabled,
2218
- style: submitButtonDisabled ? { backgroundColor: "rgb(216, 216, 216)", color: "rgb(129, 129, 129)" } : void 0,
2219
- className: "w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-500 text-base font-medium text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm disabled:shadow-none",
2220
- children: submitting ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(LoadingSpinnerIcon, { color: "white" }) : "Submit"
2263
+ className: "copilotKitMessageControlButton",
2264
+ onClick: handleThumbsDown,
2265
+ "aria-label": labels.thumbsDown,
2266
+ title: labels.thumbsDown,
2267
+ children: ThumbsDownIcon
2221
2268
  }
2222
- ) })
2223
- ] })
2224
- ] })
2225
- }
2226
- )
2269
+ )
2270
+ ]
2271
+ }
2272
+ )
2273
+ ] }),
2274
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { marginBottom: "0.5rem" }, children: subComponent })
2227
2275
  ] });
2228
- }
2276
+ };
2229
2277
 
2230
- // src/components/dev-console/console.tsx
2278
+ // src/components/chat/messages/UserMessage.tsx
2279
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2280
+ var UserMessage = (props) => {
2281
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: props.message });
2282
+ };
2283
+
2284
+ // src/components/chat/Suggestion.tsx
2285
+ var import_react_core8 = require("@copilotkit/react-core");
2286
+ var import_shared2 = require("@copilotkit/shared");
2287
+ var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
2231
2288
  var import_jsx_runtime22 = require("react/jsx-runtime");
2232
- function CopilotDevConsole() {
2233
- const currentVersion = import_shared2.COPILOTKIT_VERSION;
2234
- const context = (0, import_react_core8.useCopilotContext)();
2235
- const [showDevConsole, setShowDevConsole] = (0, import_react10.useState)(false);
2236
- (0, import_react10.useEffect)(() => {
2237
- setShowDevConsole(shouldShowDevConsole(context.showDevConsole));
2238
- }, [context.showDevConsole]);
2239
- const dontRunTwiceInDevMode = (0, import_react10.useRef)(false);
2240
- const [versionStatus, setVersionStatus] = (0, import_react10.useState)("unknown");
2241
- const [latestVersion, setLatestVersion] = (0, import_react10.useState)("");
2242
- const consoleRef = (0, import_react10.useRef)(null);
2243
- const [debugButtonMode, setDebugButtonMode] = (0, import_react10.useState)("full");
2244
- const checkForUpdates = (force = false) => {
2245
- setVersionStatus("checking");
2246
- getPublishedCopilotKitVersion(currentVersion, force).then((v) => {
2247
- setLatestVersion(v.latest);
2248
- let versionOk = false;
2249
- if (v.current === v.latest) {
2250
- versionOk = true;
2251
- } else if (/[a-zA-Z]/.test(v.current)) {
2252
- versionOk = true;
2253
- }
2254
- if (versionOk) {
2255
- setVersionStatus("latest");
2256
- } else if (v.severity !== "low") {
2257
- setVersionStatus("outdated");
2258
- } else {
2259
- setVersionStatus("update-available");
2260
- }
2261
- }).catch((e) => {
2262
- console.error(e);
2263
- setVersionStatus("unknown");
2264
- });
2265
- };
2266
- (0, import_react10.useEffect)(() => {
2267
- if (dontRunTwiceInDevMode.current === true) {
2268
- return;
2269
- }
2270
- dontRunTwiceInDevMode.current = true;
2271
- checkForUpdates();
2272
- }, []);
2273
- (0, import_react10.useEffect)(() => {
2274
- const handleResize = (entries) => {
2275
- for (let entry of entries) {
2276
- if (entry.target === consoleRef.current) {
2277
- const width = entry.contentRect.width;
2278
- if (width < 400) {
2279
- setDebugButtonMode("compact");
2280
- } else {
2281
- setDebugButtonMode("full");
2282
- }
2283
- }
2284
- }
2285
- };
2286
- const observer = new ResizeObserver(handleResize);
2287
- if (consoleRef.current) {
2288
- observer.observe(consoleRef.current);
2289
- const initialWidth = consoleRef.current.getBoundingClientRect().width;
2290
- if (initialWidth < 400) {
2291
- setDebugButtonMode("compact");
2292
- } else {
2293
- setDebugButtonMode("full");
2294
- }
2295
- }
2296
- return () => {
2297
- if (consoleRef.current) {
2298
- observer.unobserve(consoleRef.current);
2299
- }
2300
- };
2301
- }, [consoleRef.current]);
2302
- if (!showDevConsole) {
2303
- return null;
2304
- }
2305
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2306
- "div",
2289
+ function Suggestion({ title, message, onClick, partial, className }) {
2290
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2291
+ "button",
2307
2292
  {
2308
- ref: consoleRef,
2309
- className: "copilotKitDevConsole " + (versionStatus === "update-available" ? "copilotKitDevConsoleUpgrade" : "") + (versionStatus === "outdated" ? "copilotKitDevConsoleWarnOutdated" : ""),
2310
- children: [
2311
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "copilotKitDevConsoleLogo", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("a", { href: "https://copilotkit.ai", target: "_blank", children: CopilotKitIcon }) }),
2312
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2313
- VersionInfo,
2293
+ disabled: partial,
2294
+ onClick: (e) => {
2295
+ e.preventDefault();
2296
+ onClick(message);
2297
+ },
2298
+ className: className || (partial ? "suggestion loading" : "suggestion"),
2299
+ "data-test-id": "suggestion",
2300
+ children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: title })
2301
+ }
2302
+ );
2303
+ }
2304
+ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggestions, abortControllerRef) => __async(void 0, null, function* () {
2305
+ const abortController = abortControllerRef.current;
2306
+ const tools = JSON.stringify(
2307
+ Object.values(context.actions).map((action) => ({
2308
+ name: action.name,
2309
+ description: action.description,
2310
+ jsonSchema: JSON.stringify((0, import_shared2.actionParametersToJsonSchema)(action.parameters))
2311
+ }))
2312
+ );
2313
+ const allSuggestions = [];
2314
+ for (const config of Object.values(chatSuggestionConfiguration)) {
2315
+ try {
2316
+ const numOfSuggestionsInstructions = config.minSuggestions === 0 ? `Produce up to ${config.maxSuggestions} suggestions. If there are no highly relevant suggestions you can think of, provide an empty array.` : `Produce between ${config.minSuggestions} and ${config.maxSuggestions} suggestions.`;
2317
+ const result = yield (0, import_react_core8.extract)({
2318
+ context,
2319
+ instructions: "Suggest what the user could say next. Provide clear, highly relevant suggestions. Do not literally suggest function calls. ",
2320
+ data: config.instructions + "\n\n" + numOfSuggestionsInstructions + "\n\nAvailable tools: " + tools + "\n\n",
2321
+ requestType: import_runtime_client_gql3.CopilotRequestType.Task,
2322
+ parameters: [
2314
2323
  {
2315
- showDevConsole: context.showDevConsole,
2316
- versionStatus,
2317
- currentVersion,
2318
- latestVersion
2324
+ name: "suggestions",
2325
+ type: "object[]",
2326
+ attributes: [
2327
+ {
2328
+ name: "title",
2329
+ description: "The title of the suggestion. This is shown as a button and should be short.",
2330
+ type: "string"
2331
+ },
2332
+ {
2333
+ name: "message",
2334
+ description: "The message to send when the suggestion is clicked. This should be a clear, complete sentence and will be sent as an instruction to the AI.",
2335
+ type: "string"
2336
+ }
2337
+ ]
2319
2338
  }
2320
- ),
2321
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CopilotKitHelpModal, {}),
2322
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2323
- DebugMenuButton,
2324
- {
2325
- setShowDevConsole,
2326
- checkForUpdates,
2327
- mode: debugButtonMode
2339
+ ],
2340
+ include: {
2341
+ messages: true,
2342
+ readable: true
2343
+ },
2344
+ abortSignal: abortController == null ? void 0 : abortController.signal,
2345
+ stream: ({ status, args }) => {
2346
+ const suggestions = args.suggestions || [];
2347
+ const newSuggestions = [];
2348
+ for (let i = 0; i < suggestions.length; i++) {
2349
+ if (config.maxSuggestions !== void 0 && i >= config.maxSuggestions) {
2350
+ break;
2351
+ }
2352
+ const { title, message } = suggestions[i];
2353
+ const partial = i == suggestions.length - 1 && status !== "complete";
2354
+ newSuggestions.push({
2355
+ title,
2356
+ message,
2357
+ partial,
2358
+ className: config.className
2359
+ });
2328
2360
  }
2329
- )
2330
- ]
2361
+ setCurrentSuggestions([...allSuggestions, ...newSuggestions]);
2362
+ }
2363
+ });
2364
+ allSuggestions.push(...result.suggestions);
2365
+ } catch (error) {
2366
+ console.error("Error loading suggestions", error);
2331
2367
  }
2332
- );
2333
- }
2334
- function VersionInfo({
2335
- showDevConsole,
2336
- versionStatus,
2337
- currentVersion,
2338
- latestVersion
2339
- }) {
2340
- const [copyStatus, setCopyStatus] = (0, import_react10.useState)("");
2341
- let versionLabel = "";
2342
- let versionIcon = "";
2343
- let currentVersionLabel = currentVersion;
2344
- if (versionStatus === "latest") {
2345
- versionLabel = "latest";
2346
- versionIcon = CheckIcon2;
2347
- } else if (versionStatus === "checking") {
2348
- versionLabel = "checking";
2349
- versionIcon = SmallSpinnerIcon;
2350
- } else if (versionStatus === "update-available") {
2351
- versionLabel = "update available";
2352
- versionIcon = ExclamationMarkIcon;
2353
- currentVersionLabel = `${currentVersion} \u2192 ${latestVersion}`;
2354
- } else if (versionStatus === "outdated") {
2355
- versionLabel = "outdated";
2356
- versionIcon = ExclamationMarkTriangleIcon;
2357
- currentVersionLabel = `${currentVersion} \u2192 ${latestVersion}`;
2358
2368
  }
2359
- let asideLabel = "";
2360
- if (showDevConsole === "auto") {
2361
- asideLabel = "(localhost only)";
2362
- } else if (showDevConsole === true) {
2363
- asideLabel = "(always on)";
2369
+ if (abortControllerRef.current === abortController) {
2370
+ abortControllerRef.current = null;
2364
2371
  }
2365
- const installCommand = [
2366
- `npm install`,
2367
- `@copilotkit/react-core@${latestVersion}`,
2368
- `@copilotkit/react-ui@${latestVersion}`,
2369
- `@copilotkit/react-textarea@${latestVersion}`,
2370
- `&& npm install @copilotkit/runtime@${latestVersion}`
2371
- ].join(" ");
2372
- const handleCopyClick = () => {
2373
- navigator.clipboard.writeText(installCommand.trim()).then(() => {
2374
- setCopyStatus("Command copied to clipboard!");
2375
- setTimeout(() => setCopyStatus(""), 1e3);
2376
- });
2377
- };
2378
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "copilotKitVersionInfo", children: [
2379
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("header", { children: [
2380
- "COPILOTKIT DEV CONSOLE",
2381
- showDevConsole === "auto" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("aside", { children: asideLabel })
2382
- ] }),
2383
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("section", { children: [
2384
- "Version: ",
2385
- versionLabel,
2386
- " (",
2387
- currentVersionLabel,
2388
- ") ",
2389
- versionIcon
2390
- ] }),
2391
- (versionStatus === "update-available" || versionStatus === "outdated") && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("footer", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { onClick: handleCopyClick, children: copyStatus || installCommand }) })
2392
- ] });
2393
- }
2394
- function DebugMenuButton({
2395
- setShowDevConsole,
2396
- checkForUpdates,
2397
- mode
2398
- }) {
2399
- const context = (0, import_react_core8.useCopilotContext)();
2400
- const messagesContext = (0, import_react_core8.useCopilotMessagesContext)();
2401
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "bg-black top-24 w-52 text-right", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react11.Menu, { children: [
2402
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react11.MenuButton, { className: `copilotKitDebugMenuButton ${mode === "compact" ? "compact" : ""}`, children: mode == "compact" ? "Debug" : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
2403
- "Debug ",
2404
- ChevronDownIcon
2405
- ] }) }),
2406
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2407
- import_react11.MenuItems,
2408
- {
2409
- transition: true,
2410
- anchor: "bottom end",
2411
- className: "copilotKitDebugMenu",
2412
- style: { zIndex: 40 },
2413
- children: [
2414
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logReadables(context), children: "Log Readables" }) }),
2415
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logActions(context), children: "Log Actions" }) }),
2416
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2417
- "button",
2418
- {
2419
- className: "copilotKitDebugMenuItem",
2420
- onClick: () => logMessages(messagesContext),
2421
- children: "Log Messages"
2422
- }
2423
- ) }),
2424
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => checkForUpdates(true), children: "Check for Updates" }) }),
2425
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("hr", {}),
2426
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => setShowDevConsole(false), children: "Hide Dev Console" }) })
2427
- ]
2428
- }
2429
- )
2430
- ] }) });
2431
- }
2372
+ });
2432
2373
 
2433
2374
  // src/components/chat/Chat.tsx
2375
+ var import_react13 = __toESM(require("react"));
2376
+ var import_react_core9 = require("@copilotkit/react-core");
2377
+ var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
2378
+ var import_shared3 = require("@copilotkit/shared");
2434
2379
  var import_react_core10 = require("@copilotkit/react-core");
2435
2380
  var import_jsx_runtime23 = require("react/jsx-runtime");
2436
2381
  function CopilotChat({
@@ -2441,6 +2386,10 @@ function CopilotChat({
2441
2386
  onInProgress,
2442
2387
  onStopGeneration,
2443
2388
  onReloadMessages,
2389
+ onRegenerate,
2390
+ onCopy,
2391
+ onThumbsUp,
2392
+ onThumbsDown,
2444
2393
  Messages: Messages2 = Messages,
2445
2394
  RenderTextMessage: RenderTextMessage2 = RenderTextMessage,
2446
2395
  RenderActionExecutionMessage: RenderActionExecutionMessage2 = RenderActionExecutionMessage,
@@ -2455,7 +2404,7 @@ function CopilotChat({
2455
2404
  UserMessage: UserMessage2 = UserMessage
2456
2405
  }) {
2457
2406
  const { additionalInstructions, setChatInstructions } = (0, import_react_core9.useCopilotContext)();
2458
- (0, import_react12.useEffect)(() => {
2407
+ (0, import_react13.useEffect)(() => {
2459
2408
  if (!(additionalInstructions == null ? void 0 : additionalInstructions.length)) {
2460
2409
  setChatInstructions(instructions || "");
2461
2410
  return;
@@ -2482,11 +2431,21 @@ function CopilotChat({
2482
2431
  onStopGeneration,
2483
2432
  onReloadMessages
2484
2433
  );
2485
- const chatContext = import_react12.default.useContext(ChatContext);
2434
+ const chatContext = import_react13.default.useContext(ChatContext);
2486
2435
  const isVisible = chatContext ? chatContext.open : true;
2436
+ const handleRegenerate = () => {
2437
+ if (onRegenerate) {
2438
+ onRegenerate();
2439
+ }
2440
+ reloadMessages();
2441
+ };
2442
+ const handleCopy = (message) => {
2443
+ if (onCopy) {
2444
+ onCopy(message);
2445
+ }
2446
+ };
2487
2447
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
2488
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CopilotDevConsole, {}),
2489
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2448
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2490
2449
  Messages2,
2491
2450
  {
2492
2451
  AssistantMessage: AssistantMessage2,
@@ -2497,32 +2456,32 @@ function CopilotChat({
2497
2456
  RenderResultMessage: RenderResultMessage2,
2498
2457
  messages: visibleMessages,
2499
2458
  inProgress: isLoading,
2500
- children: [
2501
- currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
2502
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h6", { children: "Suggested:" }),
2503
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "suggestions", children: currentSuggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2504
- Suggestion,
2505
- {
2506
- title: suggestion.title,
2507
- message: suggestion.message,
2508
- partial: suggestion.partial,
2509
- className: suggestion.className,
2510
- onClick: (message) => sendMessage(message)
2511
- },
2512
- index
2513
- )) })
2514
- ] }),
2515
- showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2516
- ResponseButton2,
2517
- {
2518
- onClick: isLoading ? stopGeneration : reloadMessages,
2519
- inProgress: isLoading
2520
- }
2521
- )
2522
- ]
2459
+ onRegenerate: handleRegenerate,
2460
+ onCopy: handleCopy,
2461
+ onThumbsUp,
2462
+ onThumbsDown,
2463
+ children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "suggestions", children: currentSuggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2464
+ Suggestion,
2465
+ {
2466
+ title: suggestion.title,
2467
+ message: suggestion.message,
2468
+ partial: suggestion.partial,
2469
+ className: suggestion.className,
2470
+ onClick: (message) => sendMessage(message)
2471
+ },
2472
+ index
2473
+ )) })
2523
2474
  }
2524
2475
  ),
2525
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Input2, { inProgress: isLoading, onSend: sendMessage, isVisible })
2476
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2477
+ Input2,
2478
+ {
2479
+ inProgress: isLoading,
2480
+ onSend: sendMessage,
2481
+ isVisible,
2482
+ onStop: stopGeneration
2483
+ }
2484
+ )
2526
2485
  ] });
2527
2486
  }
2528
2487
  function WrappedCopilotChat({
@@ -2531,7 +2490,7 @@ function WrappedCopilotChat({
2531
2490
  labels,
2532
2491
  className
2533
2492
  }) {
2534
- const chatContext = import_react12.default.useContext(ChatContext);
2493
+ const chatContext = import_react13.default.useContext(ChatContext);
2535
2494
  if (!chatContext) {
2536
2495
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
2537
2496
  }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: `copilotKitChat ${className}`, children }) });
@@ -2552,9 +2511,9 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
2552
2511
  id: (0, import_shared3.randomId)(),
2553
2512
  makeSystemMessage
2554
2513
  });
2555
- const [currentSuggestions, setCurrentSuggestions] = (0, import_react12.useState)([]);
2556
- const suggestionsAbortControllerRef = (0, import_react12.useRef)(null);
2557
- const debounceTimerRef = (0, import_react12.useRef)();
2514
+ const [currentSuggestions, setCurrentSuggestions] = (0, import_react13.useState)([]);
2515
+ const suggestionsAbortControllerRef = (0, import_react13.useRef)(null);
2516
+ const debounceTimerRef = (0, import_react13.useRef)();
2558
2517
  const abortSuggestions = () => {
2559
2518
  var _a2;
2560
2519
  (_a2 = suggestionsAbortControllerRef.current) == null ? void 0 : _a2.abort();
@@ -2563,7 +2522,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
2563
2522
  const generalContext = (0, import_react_core9.useCopilotContext)();
2564
2523
  const messagesContext = (0, import_react_core9.useCopilotMessagesContext)();
2565
2524
  const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
2566
- (0, import_react12.useEffect)(() => {
2525
+ (0, import_react13.useEffect)(() => {
2567
2526
  onInProgress == null ? void 0 : onInProgress(isLoading);
2568
2527
  abortSuggestions();
2569
2528
  debounceTimerRef.current = setTimeout(
@@ -2724,7 +2683,7 @@ var CopilotModal = ({
2724
2683
  className,
2725
2684
  children
2726
2685
  }) => {
2727
- const [openState, setOpenState] = import_react13.default.useState(defaultOpen);
2686
+ const [openState, setOpenState] = import_react14.default.useState(defaultOpen);
2728
2687
  const setOpen = (open) => {
2729
2688
  onSetOpen == null ? void 0 : onSetOpen(open);
2730
2689
  setOpenState(open);
@@ -2775,13 +2734,13 @@ function CopilotPopup(props) {
2775
2734
  }
2776
2735
 
2777
2736
  // src/components/chat/Sidebar.tsx
2778
- var import_react14 = require("react");
2737
+ var import_react15 = require("react");
2779
2738
  var import_jsx_runtime26 = require("react/jsx-runtime");
2780
2739
  function CopilotSidebar(props) {
2781
2740
  props = __spreadProps(__spreadValues({}, props), {
2782
2741
  className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
2783
2742
  });
2784
- const [expandedClassName, setExpandedClassName] = (0, import_react14.useState)(
2743
+ const [expandedClassName, setExpandedClassName] = (0, import_react15.useState)(
2785
2744
  props.defaultOpen ? "sidebarExpanded" : ""
2786
2745
  );
2787
2746
  const onSetOpen = (open) => {