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