@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
@@ -0,0 +1,398 @@
1
+ import { ReactNode } from "react";
2
+
3
+ /**
4
+ * Status of a response or action that requires user input
5
+ */
6
+ export type ResponseStatus = "inProgress" | "complete" | "executing";
7
+
8
+ /**
9
+ * Response data structure for the ResponseRenderer
10
+ */
11
+ export interface Response {
12
+ /**
13
+ * Unique identifier for the response
14
+ */
15
+ id: string;
16
+
17
+ /**
18
+ * The content of the response to display
19
+ */
20
+ content: string;
21
+
22
+ /**
23
+ * Optional metadata for the response
24
+ */
25
+ metadata?: Record<string, any>;
26
+ }
27
+
28
+ /**
29
+ * Optional cache for storing user feedback
30
+ */
31
+ export interface ResponseCache<T extends { id: string }> {
32
+ /**
33
+ * Get feedback for a specific ID
34
+ */
35
+ getResponse: (id: string) => T | undefined;
36
+
37
+ /**
38
+ * Set feedback for a specific ID
39
+ */
40
+ setResponse: (id: string, response: T) => void;
41
+ }
42
+
43
+ /**
44
+ * Props for custom icon components
45
+ */
46
+ export interface ResponseRendererIconProps {
47
+ className?: string;
48
+ }
49
+
50
+ /**
51
+ * Icons for the ResponseRenderer component
52
+ */
53
+ export interface ResponseRendererIcons {
54
+ /**
55
+ * Icon for expanding content
56
+ */
57
+ expand?: React.ComponentType<ResponseRendererIconProps>;
58
+
59
+ /**
60
+ * Icon for collapsing content
61
+ */
62
+ collapse?: React.ComponentType<ResponseRendererIconProps>;
63
+ }
64
+
65
+ /**
66
+ * Labels for the ResponseRenderer component
67
+ */
68
+ export interface ResponseRendererLabels {
69
+ /**
70
+ * Label for the response section
71
+ */
72
+ responseLabel?: string;
73
+
74
+ /**
75
+ * Label for the approve button
76
+ */
77
+ approveLabel?: string;
78
+
79
+ /**
80
+ * Label for the reject button
81
+ */
82
+ rejectLabel?: string;
83
+
84
+ /**
85
+ * Message shown when approved
86
+ */
87
+ approvedMessage?: string;
88
+
89
+ /**
90
+ * Message shown when rejected
91
+ */
92
+ rejectedMessage?: string;
93
+
94
+ /**
95
+ * Message shown when feedback is submitted
96
+ */
97
+ feedbackSubmittedMessage?: string;
98
+ }
99
+
100
+ /**
101
+ * Props for the content renderer component
102
+ */
103
+ export interface ContentRendererProps {
104
+ /**
105
+ * Content to render
106
+ */
107
+ content: string;
108
+
109
+ /**
110
+ * CSS class name for styling
111
+ */
112
+ className?: string;
113
+ }
114
+
115
+ /**
116
+ * Props for the feedback button component
117
+ */
118
+ export interface FeedbackButtonProps {
119
+ /**
120
+ * The text to display on the button
121
+ */
122
+ label: string;
123
+
124
+ /**
125
+ * Function to call when the button is clicked
126
+ */
127
+ onClick: () => void;
128
+
129
+ /**
130
+ * CSS class name for styling
131
+ */
132
+ className?: string;
133
+ }
134
+
135
+ /**
136
+ * Props for the completed feedback display component
137
+ */
138
+ export interface CompletedFeedbackProps {
139
+ /**
140
+ * The message to display
141
+ */
142
+ message: string;
143
+
144
+ /**
145
+ * CSS class name for styling
146
+ */
147
+ className?: string;
148
+ }
149
+
150
+ /**
151
+ * Props for the ResponseRenderer component
152
+ */
153
+ export interface ResponseRendererProps {
154
+ /**
155
+ * The response data to render
156
+ */
157
+ response: Response;
158
+
159
+ /**
160
+ * The current status of the response
161
+ */
162
+ status: ResponseStatus;
163
+
164
+ /**
165
+ * Function to call when a response is given
166
+ */
167
+ onRespond?: (input: string) => void;
168
+
169
+ /**
170
+ * Custom icons for the component
171
+ */
172
+ icons?: ResponseRendererIcons;
173
+
174
+ /**
175
+ * Custom labels for the component
176
+ */
177
+ labels?: ResponseRendererLabels;
178
+
179
+ /**
180
+ * Custom component for rendering content
181
+ */
182
+ ContentRenderer?: React.ComponentType<ContentRendererProps>;
183
+
184
+ /**
185
+ * Custom component for rendering feedback buttons
186
+ */
187
+ FeedbackButton?: React.ComponentType<FeedbackButtonProps>;
188
+
189
+ /**
190
+ * Custom component for rendering completed feedback
191
+ */
192
+ CompletedFeedback?: React.ComponentType<CompletedFeedbackProps>;
193
+
194
+ /**
195
+ * CSS class for the root element
196
+ */
197
+ className?: string;
198
+
199
+ /**
200
+ * CSS class for the content element
201
+ */
202
+ contentClassName?: string;
203
+
204
+ /**
205
+ * CSS class for the actions container
206
+ */
207
+ actionsClassName?: string;
208
+
209
+ /**
210
+ * CSS class for feedback buttons
211
+ */
212
+ buttonClassName?: string;
213
+
214
+ /**
215
+ * CSS class for completed feedback
216
+ */
217
+ completedFeedbackClassName?: string;
218
+
219
+ /**
220
+ * Children nodes
221
+ */
222
+ children?: ReactNode;
223
+ }
224
+
225
+ /**
226
+ * Base state item interface for agent state items
227
+ */
228
+ export interface StateItem {
229
+ /**
230
+ * Unique identifier for the item
231
+ */
232
+ id: string;
233
+
234
+ /**
235
+ * Timestamp when the item was created
236
+ */
237
+ timestamp: string;
238
+ }
239
+
240
+ /**
241
+ * Tool execution state item
242
+ */
243
+ export interface ToolStateItem extends StateItem {
244
+ /**
245
+ * Name of the tool that was executed
246
+ */
247
+ tool: string;
248
+
249
+ /**
250
+ * Optional thought process for the tool execution
251
+ */
252
+ thought?: string;
253
+
254
+ /**
255
+ * Result of the tool execution
256
+ */
257
+ result?: any;
258
+ }
259
+
260
+ /**
261
+ * Task state item
262
+ */
263
+ export interface TaskStateItem extends StateItem {
264
+ /**
265
+ * Name of the task
266
+ */
267
+ name: string;
268
+
269
+ /**
270
+ * Description of the task
271
+ */
272
+ description?: string;
273
+ }
274
+
275
+ /**
276
+ * AgentState containing information about steps and tasks
277
+ */
278
+ export interface AgentState {
279
+ /**
280
+ * Array of tool execution steps
281
+ */
282
+ steps?: ToolStateItem[];
283
+
284
+ /**
285
+ * Array of tasks
286
+ */
287
+ tasks?: TaskStateItem[];
288
+ }
289
+
290
+ /**
291
+ * Props for the item renderer component
292
+ */
293
+ export interface StateItemRendererProps {
294
+ /**
295
+ * The item to render
296
+ */
297
+ item: ToolStateItem | TaskStateItem;
298
+
299
+ /**
300
+ * Whether the item is the newest
301
+ */
302
+ isNewest: boolean;
303
+
304
+ /**
305
+ * CSS class for the item container
306
+ */
307
+ className?: string;
308
+ }
309
+
310
+ /**
311
+ * Props for the skeleton loader component
312
+ */
313
+ export interface SkeletonLoaderProps {
314
+ /**
315
+ * CSS class for the skeleton
316
+ */
317
+ className?: string;
318
+ }
319
+
320
+ /**
321
+ * Props for the DefaultStateRenderer component
322
+ */
323
+ export interface StateRendererProps {
324
+ /**
325
+ * The state to render
326
+ */
327
+ state?: AgentState;
328
+
329
+ /**
330
+ * The current status
331
+ */
332
+ status: ResponseStatus;
333
+
334
+ /**
335
+ * Custom component for rendering individual state items
336
+ */
337
+ StateItemRenderer?: React.ComponentType<StateItemRendererProps>;
338
+
339
+ /**
340
+ * Custom component for showing a loading skeleton
341
+ */
342
+ SkeletonLoader?: React.ComponentType<SkeletonLoaderProps>;
343
+
344
+ /**
345
+ * Custom labels for the component
346
+ */
347
+ labels?: {
348
+ /**
349
+ * Label shown when in progress
350
+ */
351
+ inProgressLabel?: string;
352
+
353
+ /**
354
+ * Label shown when complete
355
+ */
356
+ completeLabel?: string;
357
+
358
+ /**
359
+ * Label shown when no items are present
360
+ */
361
+ emptyLabel?: string;
362
+ };
363
+
364
+ /**
365
+ * Custom icons for the component
366
+ */
367
+ icons?: ResponseRendererIcons;
368
+
369
+ /**
370
+ * CSS class for the root element
371
+ */
372
+ className?: string;
373
+
374
+ /**
375
+ * CSS class for the content container
376
+ */
377
+ contentClassName?: string;
378
+
379
+ /**
380
+ * CSS class for state items
381
+ */
382
+ itemClassName?: string;
383
+
384
+ /**
385
+ * Maximum height for the content area
386
+ */
387
+ maxHeight?: string;
388
+
389
+ /**
390
+ * Initial collapsed state
391
+ */
392
+ defaultCollapsed?: boolean;
393
+
394
+ /**
395
+ * Children nodes
396
+ */
397
+ children?: ReactNode;
398
+ }
@@ -82,39 +82,6 @@ export function CopilotDevConsole() {
82
82
  checkForUpdates();
83
83
  }, []);
84
84
 
85
- useEffect(() => {
86
- const handleResize = (entries: ResizeObserverEntry[]) => {
87
- for (let entry of entries) {
88
- if (entry.target === consoleRef.current) {
89
- const width = entry.contentRect.width;
90
- if (width < 400) {
91
- setDebugButtonMode("compact");
92
- } else {
93
- setDebugButtonMode("full");
94
- }
95
- }
96
- }
97
- };
98
-
99
- const observer = new ResizeObserver(handleResize);
100
- if (consoleRef.current) {
101
- observer.observe(consoleRef.current);
102
-
103
- const initialWidth = consoleRef.current.getBoundingClientRect().width;
104
- if (initialWidth < 400) {
105
- setDebugButtonMode("compact");
106
- } else {
107
- setDebugButtonMode("full");
108
- }
109
- }
110
-
111
- return () => {
112
- if (consoleRef.current) {
113
- observer.unobserve(consoleRef.current);
114
- }
115
- };
116
- }, [consoleRef.current]);
117
-
118
85
  if (!showDevConsole) {
119
86
  return null;
120
87
  }
@@ -127,11 +94,6 @@ export function CopilotDevConsole() {
127
94
  (versionStatus === "outdated" ? "copilotKitDevConsoleWarnOutdated" : "")
128
95
  }
129
96
  >
130
- <div className="copilotKitDevConsoleLogo">
131
- <a href="https://copilotkit.ai" target="_blank">
132
- {CopilotKitIcon}
133
- </a>
134
- </div>
135
97
  <VersionInfo
136
98
  showDevConsole={context.showDevConsole}
137
99
  versionStatus={versionStatus}
@@ -205,22 +167,20 @@ function VersionInfo({
205
167
  });
206
168
  };
207
169
 
208
- return (
209
- <div className="copilotKitVersionInfo">
210
- <header>
211
- COPILOTKIT DEV CONSOLE{showDevConsole === "auto" && <aside>{asideLabel}</aside>}
212
- </header>
213
- <section>
214
- Version: {versionLabel} ({currentVersionLabel}) {versionIcon}
215
- </section>
216
- {(versionStatus === "update-available" || versionStatus === "outdated") && (
217
- <footer>
218
- <button onClick={handleCopyClick}>{copyStatus || installCommand}</button>
219
- </footer>
220
- )}
221
- </div>
222
- );
170
+ if (versionStatus === "update-available" || versionStatus === "outdated") {
171
+ return (
172
+ <div className="copilotKitVersionInfo">
173
+ <p>
174
+ {currentVersionLabel} {versionIcon}
175
+ </p>
176
+ <button onClick={handleCopyClick}>{copyStatus || installCommand}</button>
177
+ </div>
178
+ );
179
+ }
180
+
181
+ return null;
223
182
  }
183
+
224
184
  export default function DebugMenuButton({
225
185
  setShowDevConsole,
226
186
  checkForUpdates,
@@ -236,7 +196,9 @@ export default function DebugMenuButton({
236
196
  return (
237
197
  <div className="bg-black top-24 w-52 text-right">
238
198
  <Menu>
239
- <MenuButton className={`copilotKitDebugMenuButton ${mode === "compact" ? "compact" : ""}`}>
199
+ <MenuButton
200
+ className={`copilotKitDebugMenuTriggerButton ${mode === "compact" ? "compact" : ""}`}
201
+ >
240
202
  {mode == "compact" ? "Debug" : <>Debug {ChevronDownIcon}</>}
241
203
  </MenuButton>
242
204
 
@@ -1,73 +1,58 @@
1
- import React, { useMemo, useState } from "react";
2
- import { CloseIcon, LifeBuoyIcon, LoadingSpinnerIcon } from "./icons";
1
+ import React, { useMemo, useState, useRef, useEffect } from "react";
2
+ import { CloseIcon } from "./icons";
3
3
 
4
4
  export function CopilotKitHelpModal() {
5
5
  const [showHelpModal, setShowHelpModal] = useState(false);
6
- const [issueDescription, setIssueDescription] = useState("");
7
- const [email, setEmail] = useState("");
8
- const [emailError, setEmailError] = useState("");
9
- const [submitting, setSubmitting] = useState(false);
6
+ const buttonRef = useRef<HTMLButtonElement>(null);
7
+ const popoverRef = useRef<HTMLDivElement>(null);
10
8
 
11
- const validateEmail = (email: string) => {
12
- const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
13
- return re.test(email);
14
- };
9
+ // Close popover when clicking outside
10
+ useEffect(() => {
11
+ const handleClickOutside = (event: MouseEvent) => {
12
+ if (
13
+ popoverRef.current &&
14
+ !popoverRef.current.contains(event.target as Node) &&
15
+ buttonRef.current &&
16
+ !buttonRef.current.contains(event.target as Node)
17
+ ) {
18
+ setShowHelpModal(false);
19
+ }
20
+ };
15
21
 
16
- const handleSubmit = async (e: React.FormEvent) => {
17
- e.preventDefault();
18
-
19
- if (email?.length > 0 && !validateEmail(email)) {
20
- setEmailError("Please enter a valid email address");
21
- return;
22
+ if (showHelpModal) {
23
+ document.addEventListener("mousedown", handleClickOutside);
22
24
  }
23
- setSubmitting(true);
24
-
25
- await fetch("https://api.segment.io/v1/track", {
26
- method: "POST",
27
- headers: {
28
- "Content-Type": "application/json",
29
- },
30
- body: JSON.stringify({
31
- event: "oss.dev-console.help",
32
- anonymousId: window.crypto.randomUUID(),
33
- properties: { email, text: issueDescription },
34
- writeKey: "q0gQqvGYyw9pNyhIocNzefSYKGO1aiwW",
35
- }),
36
- });
37
25
 
38
- // Reset
39
- setEmailError("");
40
- setEmail("");
41
- setIssueDescription("");
42
- setSubmitting(false);
43
- setShowHelpModal(false);
44
- };
26
+ return () => {
27
+ document.removeEventListener("mousedown", handleClickOutside);
28
+ };
29
+ }, [showHelpModal]);
45
30
 
46
31
  const HelpButton = () => (
47
32
  <button
48
- onClick={() => setShowHelpModal(true)}
49
- style={{ width: "50px", height: "30px", marginRight: "0.25rem" }}
50
- className="text-sm p-0 bg-transparent rounded border border-blue-500"
33
+ ref={buttonRef}
34
+ onClick={() => setShowHelpModal(!showHelpModal)}
35
+ className="copilotKitDebugMenuTriggerButton relative"
51
36
  aria-label="Open Help"
52
37
  >
53
38
  Help
54
39
  </button>
55
40
  );
56
41
 
57
- const submitButtonDisabled = useMemo(
58
- () => submitting || !!emailError || issueDescription == null || issueDescription?.length == 0,
59
- [submitting, emailError, issueDescription],
60
- );
61
-
62
42
  return (
63
- <>
43
+ <div className="relative">
64
44
  <HelpButton />
65
45
  {showHelpModal && (
66
46
  <div
67
- className="fixed inset-0 flex items-center justify-center p-4"
68
- style={{ backgroundColor: "rgba(11, 15, 26, 0.5)", zIndex: 99 }}
47
+ ref={popoverRef}
48
+ className="absolute mt-2 z-50"
49
+ style={{
50
+ top: "100%",
51
+ right: "-120px",
52
+ width: "380px",
53
+ }}
69
54
  >
70
- <div className="bg-white rounded-lg shadow-xl max-w-md w-full p-4 flex-col relative">
55
+ <div className="bg-white rounded-lg shadow-xl w-full p-4 flex-col relative">
71
56
  <button
72
57
  className="absolute text-gray-400 hover:text-gray-600 focus:outline-none"
73
58
  style={{ top: "10px", right: "10px" }}
@@ -80,7 +65,7 @@ export function CopilotKitHelpModal() {
80
65
  <h2 className="text-2xl font-bold">Help Options</h2>
81
66
  </div>
82
67
  <div className="space-y-4 mb-4">
83
- <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">
68
+ <div className="copilotKitHelpItemButton">
84
69
  <a
85
70
  href="https://docs.copilotkit.ai/coagents/troubleshooting/common-issues"
86
71
  target="_blank"
@@ -89,7 +74,7 @@ export function CopilotKitHelpModal() {
89
74
  Visit the Troubleshooting and FAQ section in the docs
90
75
  </a>
91
76
  </div>
92
- <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">
77
+ <div className="copilotKitHelpItemButton">
93
78
  <a
94
79
  href="https://go.copilotkit.ai/dev-console-support-discord"
95
80
  target="_blank"
@@ -98,7 +83,7 @@ export function CopilotKitHelpModal() {
98
83
  Go to Discord Support Channel (Community Support)
99
84
  </a>
100
85
  </div>
101
- <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">
86
+ <div className="copilotKitHelpItemButton">
102
87
  <a
103
88
  href="https://go.copilotkit.ai/dev-console-support-slack"
104
89
  target="_blank"
@@ -108,57 +93,9 @@ export function CopilotKitHelpModal() {
108
93
  </a>
109
94
  </div>
110
95
  </div>
111
- <form onSubmit={handleSubmit} className="flex flex-col space-y-2">
112
- <div>
113
- <label htmlFor="feedback" className="block text-sm font-medium text-gray-700 mb-1">
114
- Let us know what your issue is:
115
- </label>
116
- <textarea
117
- id="feedback"
118
- rows={4}
119
- className="w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500"
120
- placeholder="A Loom link / screen recording is always great!"
121
- onChange={(e) => setIssueDescription(e.target.value)}
122
- value={issueDescription}
123
- required
124
- ></textarea>
125
- </div>
126
- <div>
127
- <label htmlFor="email" className="block text-sm font-medium text-gray-700 mb-1">
128
- Email (optional):
129
- </label>
130
- <input
131
- type="email"
132
- id="email"
133
- className={`w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500 ${emailError ? "border-red-500" : ""}`}
134
- placeholder="Enter your email for follow-up"
135
- onChange={(e) => {
136
- setEmail(e.target.value);
137
- setEmailError("");
138
- }}
139
- value={email}
140
- />
141
- {emailError && <p className="text-red-500 text-sm mt-1">{emailError}</p>}
142
- </div>
143
- <div className="bg-gray-50 px-4 py-4 sm:px-6 sm:flex sm:flex-row-reverse rounded-b-lg">
144
- <button
145
- type="submit"
146
- onClick={handleSubmit}
147
- disabled={submitButtonDisabled}
148
- style={
149
- submitButtonDisabled
150
- ? { backgroundColor: "rgb(216, 216, 216)", color: "rgb(129, 129, 129)" }
151
- : undefined
152
- }
153
- 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"
154
- >
155
- {submitting ? <LoadingSpinnerIcon color="white" /> : "Submit"}
156
- </button>
157
- </div>
158
- </form>
159
96
  </div>
160
97
  </div>
161
98
  )}
162
- </>
99
+ </div>
163
100
  );
164
101
  }
@@ -1,2 +1,3 @@
1
1
  export * from "./chat";
2
2
  export * from "./dev-console";
3
+ export * from "./crew";