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

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