@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.
- package/CHANGELOG.md +21 -0
- package/dist/{chunk-QXTRFMPM.mjs → chunk-2LRE4W6A.mjs} +13 -11
- package/dist/chunk-2LRE4W6A.mjs.map +1 -0
- package/dist/{chunk-2C3ANQCY.mjs → chunk-5GNYGURH.mjs} +53 -42
- package/dist/chunk-5GNYGURH.mjs.map +1 -0
- package/dist/{chunk-CBBFRI3Q.mjs → chunk-5JY5QJ2W.mjs} +9 -5
- package/dist/chunk-5JY5QJ2W.mjs.map +1 -0
- package/dist/{chunk-OFYI4UU4.mjs → chunk-7RIBDD4K.mjs} +19 -3
- package/dist/chunk-7RIBDD4K.mjs.map +1 -0
- package/dist/{chunk-YAGE7RCE.mjs → chunk-CGVOCLHN.mjs} +2 -2
- package/dist/chunk-EJG6RRSX.mjs +138 -0
- package/dist/chunk-EJG6RRSX.mjs.map +1 -0
- package/dist/chunk-FBYETUFL.mjs +118 -0
- package/dist/chunk-FBYETUFL.mjs.map +1 -0
- package/dist/chunk-GDJAAFIK.mjs +24 -0
- package/dist/chunk-GDJAAFIK.mjs.map +1 -0
- package/dist/{chunk-6FTRYYR5.mjs → chunk-GJME6MK4.mjs} +72 -62
- package/dist/chunk-GJME6MK4.mjs.map +1 -0
- package/dist/{chunk-AZU4QOV5.mjs → chunk-KG6DW6R2.mjs} +12 -12
- package/dist/{chunk-3PJA5MFR.mjs → chunk-LKCAF2HG.mjs} +2 -2
- package/dist/{chunk-ADTTDBLB.mjs → chunk-LXCH2BIB.mjs} +2 -2
- package/dist/chunk-MCO235PS.mjs +164 -0
- package/dist/chunk-MCO235PS.mjs.map +1 -0
- package/dist/chunk-MWC5OV7Z.mjs +1 -0
- package/dist/chunk-N7LTE54T.mjs +1 -0
- package/dist/chunk-N7LTE54T.mjs.map +1 -0
- package/dist/chunk-ORSMX3SE.mjs +244 -0
- package/dist/chunk-ORSMX3SE.mjs.map +1 -0
- package/dist/{chunk-UPTB2MVO.mjs → chunk-PCTCOQK2.mjs} +4 -10
- package/dist/chunk-PCTCOQK2.mjs.map +1 -0
- package/dist/{chunk-22K5DDPF.mjs → chunk-QGK5GOSC.mjs} +31 -60
- package/dist/chunk-QGK5GOSC.mjs.map +1 -0
- package/dist/{chunk-WGAZXTUA.mjs → chunk-TOQ7P4DO.mjs} +6 -9
- package/dist/chunk-TOQ7P4DO.mjs.map +1 -0
- package/dist/chunk-UCVCAGU7.mjs +1 -0
- package/dist/chunk-UCVCAGU7.mjs.map +1 -0
- package/dist/{chunk-3XAXY2Z3.mjs → chunk-UZTZXMYS.mjs} +2 -2
- package/dist/{chunk-RQNJNK2W.mjs → chunk-VC4NO5QZ.mjs} +2 -2
- package/dist/{chunk-YQ3D5IQV.mjs → chunk-XNQO5AZZ.mjs} +2 -5
- package/dist/chunk-XNQO5AZZ.mjs.map +1 -0
- package/dist/chunk-YC4NBUGE.mjs +97 -0
- package/dist/chunk-YC4NBUGE.mjs.map +1 -0
- package/dist/components/chat/Button.js.map +1 -1
- package/dist/components/chat/Button.mjs +3 -3
- package/dist/components/chat/Chat.d.ts +17 -1
- package/dist/components/chat/Chat.js +378 -905
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +12 -19
- package/dist/components/chat/ChatContext.d.ts +20 -0
- package/dist/components/chat/ChatContext.js +44 -74
- package/dist/components/chat/ChatContext.js.map +1 -1
- package/dist/components/chat/ChatContext.mjs +2 -2
- package/dist/components/chat/CodeBlock.js +58 -82
- package/dist/components/chat/CodeBlock.js.map +1 -1
- package/dist/components/chat/CodeBlock.mjs +2 -2
- package/dist/components/chat/Header.js +516 -4
- package/dist/components/chat/Header.js.map +1 -1
- package/dist/components/chat/Header.mjs +10 -3
- package/dist/components/chat/Icons.d.ts +10 -9
- package/dist/components/chat/Icons.js +125 -164
- package/dist/components/chat/Icons.js.map +1 -1
- package/dist/components/chat/Icons.mjs +9 -5
- package/dist/components/chat/Input.d.ts +1 -1
- package/dist/components/chat/Input.js +11 -9
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +3 -3
- package/dist/components/chat/Markdown.js +58 -56
- package/dist/components/chat/Markdown.js.map +1 -1
- package/dist/components/chat/Markdown.mjs +3 -3
- package/dist/components/chat/Messages.d.ts +1 -1
- package/dist/components/chat/Messages.js +70 -60
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +3 -3
- package/dist/components/chat/Modal.js +1708 -1749
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +23 -23
- package/dist/components/chat/Popup.js +1708 -1749
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +24 -24
- package/dist/components/chat/Response.js.map +1 -1
- package/dist/components/chat/Response.mjs +3 -3
- package/dist/components/chat/Sidebar.js +1710 -1751
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +24 -24
- package/dist/components/chat/Suggestion.js +4 -40
- package/dist/components/chat/Suggestion.js.map +1 -1
- package/dist/components/chat/Suggestion.mjs +2 -2
- package/dist/components/chat/Window.js.map +1 -1
- package/dist/components/chat/Window.mjs +3 -3
- package/dist/components/chat/index.js +1710 -1751
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +27 -27
- package/dist/components/chat/messages/AssistantMessage.js +211 -59
- package/dist/components/chat/messages/AssistantMessage.js.map +1 -1
- package/dist/components/chat/messages/AssistantMessage.mjs +5 -5
- package/dist/components/chat/messages/RenderTextMessage.js +18 -2
- package/dist/components/chat/messages/RenderTextMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderTextMessage.mjs +1 -1
- package/dist/components/chat/props.d.ts +53 -0
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/crew/DefaultResponseRenderer.d.ts +110 -0
- package/dist/components/crew/DefaultResponseRenderer.js +175 -0
- package/dist/components/crew/DefaultResponseRenderer.js.map +1 -0
- package/dist/components/crew/DefaultResponseRenderer.mjs +10 -0
- package/dist/components/crew/DefaultResponseRenderer.mjs.map +1 -0
- package/dist/components/crew/DefaultStateRenderer.d.ts +88 -0
- package/dist/components/crew/DefaultStateRenderer.js +198 -0
- package/dist/components/crew/DefaultStateRenderer.js.map +1 -0
- package/dist/components/crew/DefaultStateRenderer.mjs +8 -0
- package/dist/components/crew/DefaultStateRenderer.mjs.map +1 -0
- package/dist/components/crew/index.d.ts +4 -0
- package/dist/components/crew/index.js +335 -0
- package/dist/components/crew/index.js.map +1 -0
- package/dist/components/crew/index.mjs +16 -0
- package/dist/components/crew/index.mjs.map +1 -0
- package/dist/components/crew/types.d.ts +340 -0
- package/dist/components/crew/types.js +19 -0
- package/dist/components/crew/types.js.map +1 -0
- package/dist/components/crew/types.mjs +2 -0
- package/dist/components/crew/types.mjs.map +1 -0
- package/dist/components/dev-console/console.js +51 -233
- package/dist/components/dev-console/console.js.map +1 -1
- package/dist/components/dev-console/console.mjs +5 -5
- package/dist/components/dev-console/index.js +51 -233
- package/dist/components/dev-console/index.js.map +1 -1
- package/dist/components/dev-console/index.mjs +5 -5
- package/dist/components/help-modal/index.js +29 -147
- package/dist/components/help-modal/index.js.map +1 -1
- package/dist/components/help-modal/index.mjs +1 -1
- package/dist/components/help-modal/modal.js +29 -147
- package/dist/components/help-modal/modal.js.map +1 -1
- package/dist/components/help-modal/modal.mjs +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +2191 -1942
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +43 -31
- package/dist/index.css +481 -90
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2192 -1943
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -31
- package/dist/types/css.d.ts +7 -1
- package/dist/types/css.js.map +1 -1
- package/package.json +4 -4
- package/src/components/chat/Chat.tsx +59 -22
- package/src/components/chat/ChatContext.tsx +29 -1
- package/src/components/chat/CodeBlock.tsx +2 -4
- package/src/components/chat/Header.tsx +8 -3
- package/src/components/chat/Icons.tsx +108 -108
- package/src/components/chat/Input.tsx +42 -38
- package/src/components/chat/Markdown.tsx +0 -3
- package/src/components/chat/Messages.tsx +68 -56
- package/src/components/chat/Suggestion.tsx +2 -3
- package/src/components/chat/messages/AssistantMessage.tsx +95 -3
- package/src/components/chat/messages/RenderTextMessage.tsx +17 -1
- package/src/components/chat/props.ts +66 -0
- package/src/components/crew/DefaultResponseRenderer.tsx +298 -0
- package/src/components/crew/DefaultStateRenderer.tsx +326 -0
- package/src/components/crew/index.ts +3 -0
- package/src/components/crew/types.ts +398 -0
- package/src/components/dev-console/console.tsx +16 -54
- package/src/components/help-modal/modal.tsx +38 -101
- package/src/components/index.ts +1 -0
- package/src/css/button.css +15 -4
- package/src/css/colors.css +27 -6
- package/src/css/console.css +46 -39
- package/src/css/crew.css +277 -0
- package/src/css/header.css +22 -5
- package/src/css/input.css +24 -17
- package/src/css/markdown.css +2 -1
- package/src/css/messages.css +125 -15
- package/src/css/panel.css +1 -0
- package/src/css/suggestions.css +14 -6
- package/src/styles.css +1 -0
- package/src/types/css.ts +7 -1
- package/dist/chunk-22K5DDPF.mjs.map +0 -1
- package/dist/chunk-2C3ANQCY.mjs.map +0 -1
- package/dist/chunk-3VNMQWGT.mjs +0 -25
- package/dist/chunk-3VNMQWGT.mjs.map +0 -1
- package/dist/chunk-6FTRYYR5.mjs.map +0 -1
- package/dist/chunk-CBBFRI3Q.mjs.map +0 -1
- package/dist/chunk-FZC7X5PK.mjs +0 -262
- package/dist/chunk-FZC7X5PK.mjs.map +0 -1
- package/dist/chunk-MMVDU6DF.mjs +0 -1
- package/dist/chunk-OFYI4UU4.mjs.map +0 -1
- package/dist/chunk-QXTRFMPM.mjs.map +0 -1
- package/dist/chunk-TI7SY2RI.mjs +0 -164
- package/dist/chunk-TI7SY2RI.mjs.map +0 -1
- package/dist/chunk-UPTB2MVO.mjs.map +0 -1
- package/dist/chunk-VEC45H6Q.mjs +0 -18
- package/dist/chunk-VEC45H6Q.mjs.map +0 -1
- package/dist/chunk-WGAZXTUA.mjs.map +0 -1
- package/dist/chunk-YQ3D5IQV.mjs.map +0 -1
- /package/dist/{chunk-YAGE7RCE.mjs.map → chunk-CGVOCLHN.mjs.map} +0 -0
- /package/dist/{chunk-AZU4QOV5.mjs.map → chunk-KG6DW6R2.mjs.map} +0 -0
- /package/dist/{chunk-3PJA5MFR.mjs.map → chunk-LKCAF2HG.mjs.map} +0 -0
- /package/dist/{chunk-ADTTDBLB.mjs.map → chunk-LXCH2BIB.mjs.map} +0 -0
- /package/dist/{chunk-MMVDU6DF.mjs.map → chunk-MWC5OV7Z.mjs.map} +0 -0
- /package/dist/{chunk-3XAXY2Z3.mjs.map → chunk-UZTZXMYS.mjs.map} +0 -0
- /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
|
-
|
|
209
|
-
|
|
210
|
-
<
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
</
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
|
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
|
|
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
|
|
7
|
-
const
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
17
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
className="
|
|
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
|
-
|
|
68
|
-
|
|
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
|
|
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="
|
|
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="
|
|
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="
|
|
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
|
}
|
package/src/components/index.ts
CHANGED