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

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