@copilotkit/react-core 1.9.2-next.10 → 1.9.2-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 +0 -56
- package/dist/{chunk-3YHYWAHK.mjs → chunk-2FW7HH6W.mjs} +3 -3
- package/dist/{chunk-OF4SZTLL.mjs → chunk-2XSUXRGG.mjs} +4 -4
- package/dist/{chunk-WOGURSAL.mjs → chunk-3XXVDQ7Z.mjs} +8 -10
- package/dist/chunk-3XXVDQ7Z.mjs.map +1 -0
- package/dist/{chunk-XFOTNHYA.mjs → chunk-6KGEF242.mjs} +2 -3
- package/dist/chunk-6KGEF242.mjs.map +1 -0
- package/dist/{chunk-EXU7GWLC.mjs → chunk-C3SYYVMR.mjs} +5 -5
- package/dist/{chunk-JPMIAGI6.mjs → chunk-C6F6EQNA.mjs} +2 -2
- package/dist/{chunk-3OQM3NEK.mjs → chunk-CCESTGAM.mjs} +2 -2
- package/dist/chunk-HD2GE3DK.mjs +359 -0
- package/dist/chunk-HD2GE3DK.mjs.map +1 -0
- package/dist/{chunk-G7LYGERN.mjs → chunk-HJP2RX5R.mjs} +14 -81
- package/dist/chunk-HJP2RX5R.mjs.map +1 -0
- package/dist/{chunk-ADIITPD2.mjs → chunk-IVXB3GYK.mjs} +6 -9
- package/dist/{chunk-ADIITPD2.mjs.map → chunk-IVXB3GYK.mjs.map} +1 -1
- package/dist/{chunk-EF5BNM34.mjs → chunk-LDACFA2B.mjs} +3 -3
- package/dist/{chunk-UBNRUXEK.mjs → chunk-LZDDYZEY.mjs} +2 -2
- package/dist/{chunk-FXK6RQIN.mjs → chunk-PUNALT2S.mjs} +2 -2
- package/dist/{chunk-CMQV4XNY.mjs → chunk-Q5D5XQFA.mjs} +2 -2
- package/dist/{chunk-SJJNFYGQ.mjs → chunk-QQZLIEXK.mjs} +3 -3
- package/dist/{chunk-JDEWNLNP.mjs → chunk-QRGDQSGZ.mjs} +5 -38
- package/dist/chunk-QRGDQSGZ.mjs.map +1 -0
- package/dist/{chunk-55QZ2SVJ.mjs → chunk-RUY6MLHA.mjs} +6 -36
- package/dist/chunk-RUY6MLHA.mjs.map +1 -0
- package/dist/{chunk-NQVCZQ5T.mjs → chunk-T42PN5VN.mjs} +4 -4
- package/dist/{chunk-ERXWDCY6.mjs → chunk-UHQMV2CE.mjs} +2 -2
- package/dist/chunk-VRXANACV.mjs +277 -0
- package/dist/chunk-VRXANACV.mjs.map +1 -0
- package/dist/components/copilot-provider/copilot-messages.js +3 -37
- package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
- package/dist/components/copilot-provider/copilot-messages.mjs +3 -3
- package/dist/components/copilot-provider/copilotkit-props.d.ts +2 -21
- package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.d.ts +1 -1
- package/dist/components/copilot-provider/copilotkit.js +238 -326
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +8 -8
- package/dist/components/copilot-provider/index.d.ts +1 -1
- package/dist/components/copilot-provider/index.js +238 -326
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +8 -8
- package/dist/components/error-boundary/error-boundary.js +146 -135
- package/dist/components/error-boundary/error-boundary.js.map +1 -1
- package/dist/components/error-boundary/error-boundary.mjs +4 -4
- package/dist/components/error-boundary/error-utils.js.map +1 -1
- package/dist/components/error-boundary/error-utils.mjs +2 -2
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +238 -326
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +8 -8
- package/dist/components/toast/toast-provider.js +85 -118
- package/dist/components/toast/toast-provider.js.map +1 -1
- package/dist/components/toast/toast-provider.mjs +1 -1
- package/dist/components/usage-banner.js +146 -135
- package/dist/components/usage-banner.js.map +1 -1
- package/dist/components/usage-banner.mjs +1 -1
- package/dist/context/copilot-context.d.ts +1 -1
- package/dist/context/copilot-context.js +1 -2
- package/dist/context/copilot-context.js.map +1 -1
- package/dist/context/copilot-context.mjs +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.js +1 -2
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/{copilot-context-3da805ab.d.ts → copilot-context-f9b2b4c3.d.ts} +1 -5
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +12 -108
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +19 -19
- package/dist/hooks/use-chat.d.ts +1 -1
- package/dist/hooks/use-chat.js +12 -105
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +5 -5
- package/dist/hooks/use-coagent-state-render.js +1 -2
- package/dist/hooks/use-coagent-state-render.js.map +1 -1
- package/dist/hooks/use-coagent-state-render.mjs +3 -3
- package/dist/hooks/use-coagent.d.ts +1 -1
- package/dist/hooks/use-coagent.js +12 -108
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +11 -11
- package/dist/hooks/use-copilot-action.js +1 -2
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +4 -4
- package/dist/hooks/use-copilot-additional-instructions.js +1 -2
- package/dist/hooks/use-copilot-additional-instructions.js.map +1 -1
- package/dist/hooks/use-copilot-additional-instructions.mjs +2 -2
- package/dist/hooks/use-copilot-authenticated-action.js +1 -2
- package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
- package/dist/hooks/use-copilot-authenticated-action.mjs +5 -5
- package/dist/hooks/use-copilot-chat.d.ts +1 -1
- package/dist/hooks/use-copilot-chat.js +12 -105
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +10 -10
- package/dist/hooks/use-copilot-readable.js +1 -2
- package/dist/hooks/use-copilot-readable.js.map +1 -1
- package/dist/hooks/use-copilot-readable.mjs +2 -2
- package/dist/hooks/use-copilot-runtime-client.d.ts +0 -2
- package/dist/hooks/use-copilot-runtime-client.js +2 -52
- package/dist/hooks/use-copilot-runtime-client.js.map +1 -1
- package/dist/hooks/use-copilot-runtime-client.mjs +2 -2
- package/dist/hooks/use-langgraph-interrupt-render.js +1 -2
- package/dist/hooks/use-langgraph-interrupt-render.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt-render.mjs +2 -2
- package/dist/hooks/use-langgraph-interrupt.d.ts +1 -1
- package/dist/hooks/use-langgraph-interrupt.js +12 -105
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +11 -11
- package/dist/hooks/use-make-copilot-document-readable.js +1 -2
- package/dist/hooks/use-make-copilot-document-readable.js.map +1 -1
- package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +247 -400
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -20
- package/dist/lib/copilot-task.d.ts +1 -1
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +9 -9
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +9 -9
- package/dist/types/interrupt-action.d.ts +1 -1
- package/dist/utils/extract.d.ts +1 -1
- package/dist/utils/extract.js.map +1 -1
- package/dist/utils/extract.mjs +8 -8
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +8 -8
- package/dist/utils/utils.test.d.ts +2 -0
- package/dist/utils/utils.test.js +9 -0
- package/dist/utils/utils.test.js.map +1 -0
- package/dist/utils/utils.test.mjs +7 -0
- package/dist/utils/utils.test.mjs.map +1 -0
- package/jest.config.js +3 -7
- package/package.json +3 -4
- package/src/components/copilot-provider/copilot-messages.tsx +3 -42
- package/src/components/copilot-provider/copilotkit-props.tsx +0 -21
- package/src/components/copilot-provider/copilotkit.tsx +0 -2
- package/src/components/toast/toast-provider.tsx +24 -49
- package/src/components/usage-banner.tsx +147 -144
- package/src/context/copilot-context.tsx +1 -7
- package/src/hooks/use-chat.ts +6 -106
- package/src/hooks/use-coagent.ts +0 -5
- package/src/hooks/use-copilot-runtime-client.ts +39 -41
- package/tsconfig.json +8 -1
- package/tsup.config.ts +6 -6
- package/dist/chunk-55QZ2SVJ.mjs.map +0 -1
- package/dist/chunk-57K2ZJ5F.mjs +0 -348
- package/dist/chunk-57K2ZJ5F.mjs.map +0 -1
- package/dist/chunk-G7LYGERN.mjs.map +0 -1
- package/dist/chunk-JDEWNLNP.mjs.map +0 -1
- package/dist/chunk-WOGURSAL.mjs.map +0 -1
- package/dist/chunk-XFOTNHYA.mjs.map +0 -1
- package/dist/chunk-YAF2LATQ.mjs +0 -310
- package/dist/chunk-YAF2LATQ.mjs.map +0 -1
- package/src/components/copilot-provider/__tests__/copilotkit-trace.test.tsx +0 -75
- /package/dist/{chunk-3YHYWAHK.mjs.map → chunk-2FW7HH6W.mjs.map} +0 -0
- /package/dist/{chunk-OF4SZTLL.mjs.map → chunk-2XSUXRGG.mjs.map} +0 -0
- /package/dist/{chunk-EXU7GWLC.mjs.map → chunk-C3SYYVMR.mjs.map} +0 -0
- /package/dist/{chunk-JPMIAGI6.mjs.map → chunk-C6F6EQNA.mjs.map} +0 -0
- /package/dist/{chunk-3OQM3NEK.mjs.map → chunk-CCESTGAM.mjs.map} +0 -0
- /package/dist/{chunk-EF5BNM34.mjs.map → chunk-LDACFA2B.mjs.map} +0 -0
- /package/dist/{chunk-UBNRUXEK.mjs.map → chunk-LZDDYZEY.mjs.map} +0 -0
- /package/dist/{chunk-FXK6RQIN.mjs.map → chunk-PUNALT2S.mjs.map} +0 -0
- /package/dist/{chunk-CMQV4XNY.mjs.map → chunk-Q5D5XQFA.mjs.map} +0 -0
- /package/dist/{chunk-SJJNFYGQ.mjs.map → chunk-QQZLIEXK.mjs.map} +0 -0
- /package/dist/{chunk-NQVCZQ5T.mjs.map → chunk-T42PN5VN.mjs.map} +0 -0
- /package/dist/{chunk-ERXWDCY6.mjs.map → chunk-UHQMV2CE.mjs.map} +0 -0
|
@@ -183,14 +183,12 @@ export function ToastProvider({
|
|
|
183
183
|
border: `1px solid ${colors.border}`,
|
|
184
184
|
borderLeft: `4px solid ${colors.border}`,
|
|
185
185
|
borderRadius: "8px",
|
|
186
|
-
padding: "
|
|
186
|
+
padding: "10px 14px",
|
|
187
187
|
fontSize: "13px",
|
|
188
188
|
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
|
|
189
189
|
backdropFilter: "blur(8px)",
|
|
190
|
-
maxWidth: "
|
|
191
|
-
|
|
192
|
-
boxSizing: "border-box",
|
|
193
|
-
overflow: "hidden",
|
|
190
|
+
maxWidth: "500px",
|
|
191
|
+
minWidth: "350px",
|
|
194
192
|
}}
|
|
195
193
|
>
|
|
196
194
|
<div
|
|
@@ -201,15 +199,7 @@ export function ToastProvider({
|
|
|
201
199
|
gap: "10px",
|
|
202
200
|
}}
|
|
203
201
|
>
|
|
204
|
-
<div
|
|
205
|
-
style={{
|
|
206
|
-
display: "flex",
|
|
207
|
-
alignItems: "center",
|
|
208
|
-
gap: "8px",
|
|
209
|
-
flex: 1,
|
|
210
|
-
minWidth: 0,
|
|
211
|
-
}}
|
|
212
|
-
>
|
|
202
|
+
<div style={{ display: "flex", alignItems: "center", gap: "8px", flex: 1 }}>
|
|
213
203
|
<div
|
|
214
204
|
style={{
|
|
215
205
|
width: "12px",
|
|
@@ -219,15 +209,7 @@ export function ToastProvider({
|
|
|
219
209
|
flexShrink: 0,
|
|
220
210
|
}}
|
|
221
211
|
/>
|
|
222
|
-
<div
|
|
223
|
-
style={{
|
|
224
|
-
display: "flex",
|
|
225
|
-
alignItems: "center",
|
|
226
|
-
gap: "10px",
|
|
227
|
-
flex: 1,
|
|
228
|
-
minWidth: 0,
|
|
229
|
-
}}
|
|
230
|
-
>
|
|
212
|
+
<div style={{ display: "flex", alignItems: "center", gap: "10px", flex: 1 }}>
|
|
231
213
|
<div
|
|
232
214
|
style={{
|
|
233
215
|
color: colors.text,
|
|
@@ -235,37 +217,30 @@ export function ToastProvider({
|
|
|
235
217
|
fontWeight: "400",
|
|
236
218
|
fontSize: "13px",
|
|
237
219
|
flex: 1,
|
|
238
|
-
|
|
220
|
+
wordWrap: "break-word",
|
|
239
221
|
overflowWrap: "break-word",
|
|
240
|
-
|
|
241
|
-
overflow: "hidden",
|
|
242
|
-
display: "-webkit-box",
|
|
243
|
-
WebkitLineClamp: 10,
|
|
244
|
-
WebkitBoxOrient: "vertical",
|
|
222
|
+
hyphens: "auto",
|
|
245
223
|
}}
|
|
246
224
|
>
|
|
247
225
|
{(() => {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
226
|
+
const message = bannerError.message;
|
|
227
|
+
const markdownLinkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
|
|
228
|
+
const plainUrlRegex = /(https?:\/\/[^\s)]+)/g;
|
|
229
|
+
|
|
230
|
+
// Remove URLs and markdown links from the message, keep just the text
|
|
231
|
+
let cleanMessage = message
|
|
232
|
+
.replace(markdownLinkRegex, "") // Remove [text](url)
|
|
233
|
+
.replace(plainUrlRegex, "") // Remove plain URLs
|
|
234
|
+
.replace(/See more:\s*/g, "") // Remove "See more:" text
|
|
235
|
+
.replace(/\s+/g, " ") // Clean up extra spaces
|
|
236
|
+
.trim();
|
|
237
|
+
|
|
238
|
+
// Truncate very long messages for better display
|
|
239
|
+
if (cleanMessage.length > 120) {
|
|
240
|
+
cleanMessage = cleanMessage.substring(0, 117) + "...";
|
|
254
241
|
}
|
|
255
242
|
|
|
256
|
-
|
|
257
|
-
message = message.split(" - ")[0]; // Remove everything after " - {"
|
|
258
|
-
message = message.split(": Error code")[0]; // Remove ": Error code: 401"
|
|
259
|
-
message = message.replace(/:\s*\d{3}$/, ""); // Remove trailing ": 401"
|
|
260
|
-
message = message.replace(/See more:.*$/g, ""); // Remove "See more" links
|
|
261
|
-
message = message.trim();
|
|
262
|
-
|
|
263
|
-
// If it's still garbage (contains { or '), use fallback
|
|
264
|
-
// if (message.includes("{") || message.includes("'")) {
|
|
265
|
-
// return "Configuration error.... Please check your setup.";
|
|
266
|
-
// }
|
|
267
|
-
|
|
268
|
-
return message || "Configuration error occurred.";
|
|
243
|
+
return cleanMessage;
|
|
269
244
|
})()}
|
|
270
245
|
</div>
|
|
271
246
|
|
|
@@ -287,7 +262,7 @@ export function ToastProvider({
|
|
|
287
262
|
// Check for plain URLs
|
|
288
263
|
const urlMatch = plainUrlRegex.exec(message);
|
|
289
264
|
if (urlMatch) {
|
|
290
|
-
url = urlMatch[0]
|
|
265
|
+
url = urlMatch[0];
|
|
291
266
|
buttonText = "See More";
|
|
292
267
|
}
|
|
293
268
|
}
|
|
@@ -21,8 +21,8 @@ const defaultIcons: Record<Severity, JSX.Element> = {
|
|
|
21
21
|
[Severity.CRITICAL]: (
|
|
22
22
|
<svg
|
|
23
23
|
viewBox="0 0 24 24"
|
|
24
|
-
width="
|
|
25
|
-
height="
|
|
24
|
+
width="18"
|
|
25
|
+
height="18"
|
|
26
26
|
stroke="currentColor"
|
|
27
27
|
strokeWidth="2.5"
|
|
28
28
|
fill="none"
|
|
@@ -37,8 +37,8 @@ const defaultIcons: Record<Severity, JSX.Element> = {
|
|
|
37
37
|
[Severity.WARNING]: (
|
|
38
38
|
<svg
|
|
39
39
|
viewBox="0 0 24 24"
|
|
40
|
-
width="
|
|
41
|
-
height="
|
|
40
|
+
width="18"
|
|
41
|
+
height="18"
|
|
42
42
|
stroke="currentColor"
|
|
43
43
|
strokeWidth="2.5"
|
|
44
44
|
fill="none"
|
|
@@ -53,8 +53,8 @@ const defaultIcons: Record<Severity, JSX.Element> = {
|
|
|
53
53
|
[Severity.INFO]: (
|
|
54
54
|
<svg
|
|
55
55
|
viewBox="0 0 24 24"
|
|
56
|
-
width="
|
|
57
|
-
height="
|
|
56
|
+
width="18"
|
|
57
|
+
height="18"
|
|
58
58
|
stroke="currentColor"
|
|
59
59
|
strokeWidth="2.5"
|
|
60
60
|
fill="none"
|
|
@@ -79,46 +79,23 @@ export function UsageBanner({
|
|
|
79
79
|
return null;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
//
|
|
82
|
+
// Parse markdown links from message and clean it up
|
|
83
83
|
const parseMessage = (rawMessage: string) => {
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (
|
|
88
|
-
rawMessage.toLowerCase().includes("authentication") ||
|
|
89
|
-
rawMessage.toLowerCase().includes("api key")
|
|
90
|
-
) {
|
|
91
|
-
return "Authentication failed. Please check your API key.";
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (rawMessage.toLowerCase().includes("rate limit")) {
|
|
95
|
-
return "Rate limit exceeded. Please try again later.";
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (rawMessage.toLowerCase().includes("checkpointer")) {
|
|
99
|
-
return "Agent configuration error. Please check your setup.";
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// For any other error, extract just the main error type
|
|
103
|
-
let cleanMessage = rawMessage;
|
|
104
|
-
|
|
105
|
-
// Remove everything after the first " - " or ":" followed by technical details
|
|
106
|
-
cleanMessage = cleanMessage.split(" - ")[0];
|
|
107
|
-
cleanMessage = cleanMessage.split(": Error code")[0];
|
|
108
|
-
cleanMessage = cleanMessage.split(": 401")[0];
|
|
109
|
-
cleanMessage = cleanMessage.split(": 403")[0];
|
|
110
|
-
cleanMessage = cleanMessage.split(": 404")[0];
|
|
111
|
-
cleanMessage = cleanMessage.split(": 500")[0];
|
|
84
|
+
// Extract markdown links: [text](url)
|
|
85
|
+
const linkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
|
|
86
|
+
const matches = Array.from(rawMessage.matchAll(linkRegex));
|
|
112
87
|
|
|
113
|
-
|
|
114
|
-
|
|
88
|
+
if (matches.length > 0) {
|
|
89
|
+
// Remove "See more:" and markdown links from the main message
|
|
90
|
+
let cleanMessage = rawMessage
|
|
91
|
+
.replace(/\.\s*See more:\s*\[([^\]]+)\]\(([^)]+)\)/g, ".")
|
|
92
|
+
.replace(/See more:\s*\[([^\]]+)\]\(([^)]+)\)/g, "")
|
|
93
|
+
.trim();
|
|
115
94
|
|
|
116
|
-
|
|
117
|
-
if (cleanMessage.includes("{") || cleanMessage.includes("'") || cleanMessage.length > 60) {
|
|
118
|
-
return "Configuration error. Please check your setup.";
|
|
95
|
+
return cleanMessage;
|
|
119
96
|
}
|
|
120
97
|
|
|
121
|
-
return
|
|
98
|
+
return rawMessage;
|
|
122
99
|
};
|
|
123
100
|
|
|
124
101
|
const cleanMessage = parseMessage(message);
|
|
@@ -126,7 +103,7 @@ export function UsageBanner({
|
|
|
126
103
|
|
|
127
104
|
const themeConfigs = {
|
|
128
105
|
[Severity.INFO]: {
|
|
129
|
-
bg: "
|
|
106
|
+
bg: "linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%)",
|
|
130
107
|
border: "#93c5fd",
|
|
131
108
|
text: "#1e40af",
|
|
132
109
|
icon: "#3b82f6",
|
|
@@ -134,7 +111,7 @@ export function UsageBanner({
|
|
|
134
111
|
primaryBtnHover: "#2563eb",
|
|
135
112
|
},
|
|
136
113
|
[Severity.WARNING]: {
|
|
137
|
-
bg: "
|
|
114
|
+
bg: "linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%)",
|
|
138
115
|
border: "#fbbf24",
|
|
139
116
|
text: "#92400e",
|
|
140
117
|
icon: "#f59e0b",
|
|
@@ -142,7 +119,7 @@ export function UsageBanner({
|
|
|
142
119
|
primaryBtnHover: "#d97706",
|
|
143
120
|
},
|
|
144
121
|
[Severity.CRITICAL]: {
|
|
145
|
-
bg: "
|
|
122
|
+
bg: "linear-gradient(135deg, #fef2f2 0%, #fecaca 100%)",
|
|
146
123
|
border: "#f87171",
|
|
147
124
|
text: "#991b1b",
|
|
148
125
|
icon: "#ef4444",
|
|
@@ -157,13 +134,13 @@ export function UsageBanner({
|
|
|
157
134
|
<div
|
|
158
135
|
style={{
|
|
159
136
|
position: "fixed",
|
|
160
|
-
bottom: "
|
|
137
|
+
bottom: "20px",
|
|
161
138
|
left: "50%",
|
|
162
139
|
transform: "translateX(-50%)",
|
|
163
|
-
|
|
164
|
-
|
|
140
|
+
maxWidth: "min(95vw, 680px)",
|
|
141
|
+
width: "100%",
|
|
165
142
|
zIndex: 10000,
|
|
166
|
-
animation: "bannerSlideIn 0.
|
|
143
|
+
animation: "bannerSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1)",
|
|
167
144
|
}}
|
|
168
145
|
>
|
|
169
146
|
<style>
|
|
@@ -171,29 +148,28 @@ export function UsageBanner({
|
|
|
171
148
|
@keyframes bannerSlideIn {
|
|
172
149
|
from {
|
|
173
150
|
opacity: 0;
|
|
174
|
-
transform: translateX(-50%) translateY(
|
|
175
|
-
scale: 0.95;
|
|
151
|
+
transform: translateX(-50%) translateY(10px);
|
|
176
152
|
}
|
|
177
153
|
to {
|
|
178
154
|
opacity: 1;
|
|
179
155
|
transform: translateX(-50%) translateY(0);
|
|
180
|
-
scale: 1;
|
|
181
156
|
}
|
|
182
157
|
}
|
|
183
158
|
`}
|
|
184
159
|
</style>
|
|
185
160
|
<div
|
|
186
161
|
style={{
|
|
187
|
-
|
|
162
|
+
display: "flex",
|
|
163
|
+
alignItems: "flex-start",
|
|
164
|
+
gap: "14px",
|
|
165
|
+
borderRadius: "16px",
|
|
188
166
|
border: `1px solid ${themeConfig.border}`,
|
|
189
167
|
background: themeConfig.bg,
|
|
190
|
-
padding: "
|
|
191
|
-
boxShadow: "0
|
|
168
|
+
padding: "18px 20px",
|
|
169
|
+
boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)",
|
|
192
170
|
position: "relative",
|
|
193
|
-
backdropFilter: "blur(
|
|
194
|
-
WebkitBackdropFilter: "blur(
|
|
195
|
-
boxSizing: "border-box",
|
|
196
|
-
overflow: "hidden",
|
|
171
|
+
backdropFilter: "blur(10px)",
|
|
172
|
+
WebkitBackdropFilter: "blur(10px)",
|
|
197
173
|
}}
|
|
198
174
|
>
|
|
199
175
|
{/* Close button */}
|
|
@@ -202,117 +178,144 @@ export function UsageBanner({
|
|
|
202
178
|
onClick={onClose}
|
|
203
179
|
style={{
|
|
204
180
|
position: "absolute",
|
|
205
|
-
top: "
|
|
206
|
-
right: "
|
|
207
|
-
background: "rgba(255, 255, 255, 0.
|
|
181
|
+
top: "12px",
|
|
182
|
+
right: "12px",
|
|
183
|
+
background: "rgba(255, 255, 255, 0.8)",
|
|
208
184
|
border: "none",
|
|
209
185
|
color: themeConfig.text,
|
|
210
186
|
cursor: "pointer",
|
|
211
|
-
fontSize: "
|
|
187
|
+
fontSize: "18px",
|
|
212
188
|
lineHeight: "1",
|
|
213
|
-
padding: "
|
|
214
|
-
borderRadius: "
|
|
215
|
-
|
|
216
|
-
|
|
189
|
+
padding: "6px",
|
|
190
|
+
borderRadius: "8px",
|
|
191
|
+
opacity: 0.7,
|
|
192
|
+
transition: "all 0.2s ease",
|
|
217
193
|
display: "flex",
|
|
218
194
|
alignItems: "center",
|
|
219
195
|
justifyContent: "center",
|
|
196
|
+
width: "28px",
|
|
197
|
+
height: "28px",
|
|
220
198
|
}}
|
|
221
199
|
title="Close"
|
|
200
|
+
onMouseOver={(e) => {
|
|
201
|
+
e.currentTarget.style.opacity = "1";
|
|
202
|
+
e.currentTarget.style.background = "rgba(255, 255, 255, 1)";
|
|
203
|
+
e.currentTarget.style.transform = "scale(1.05)";
|
|
204
|
+
}}
|
|
205
|
+
onMouseOut={(e) => {
|
|
206
|
+
e.currentTarget.style.opacity = "0.7";
|
|
207
|
+
e.currentTarget.style.background = "rgba(255, 255, 255, 0.8)";
|
|
208
|
+
e.currentTarget.style.transform = "scale(1)";
|
|
209
|
+
}}
|
|
222
210
|
>
|
|
223
211
|
×
|
|
224
212
|
</button>
|
|
225
213
|
)}
|
|
226
214
|
|
|
227
|
-
{/*
|
|
215
|
+
{/* Icon */}
|
|
228
216
|
<div
|
|
229
217
|
style={{
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
textOverflow: "ellipsis",
|
|
240
|
-
display: "-webkit-box",
|
|
241
|
-
WebkitLineClamp: 2,
|
|
242
|
-
WebkitBoxOrient: "vertical",
|
|
218
|
+
color: themeConfig.icon,
|
|
219
|
+
flexShrink: 0,
|
|
220
|
+
marginTop: "1px",
|
|
221
|
+
padding: "6px",
|
|
222
|
+
borderRadius: "10px",
|
|
223
|
+
background: "rgba(255, 255, 255, 0.7)",
|
|
224
|
+
display: "flex",
|
|
225
|
+
alignItems: "center",
|
|
226
|
+
justifyContent: "center",
|
|
243
227
|
}}
|
|
244
228
|
>
|
|
245
|
-
{
|
|
229
|
+
{Icon}
|
|
246
230
|
</div>
|
|
247
231
|
|
|
248
|
-
{/*
|
|
249
|
-
{
|
|
232
|
+
{/* Content */}
|
|
233
|
+
<div style={{ flex: 1, paddingRight: onClose ? "40px" : "0" }}>
|
|
234
|
+
{/* Message */}
|
|
250
235
|
<div
|
|
251
236
|
style={{
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
237
|
+
fontSize: "15px",
|
|
238
|
+
fontWeight: 600,
|
|
239
|
+
color: themeConfig.text,
|
|
240
|
+
lineHeight: "1.5",
|
|
241
|
+
marginBottom: actions ? "12px" : "0",
|
|
242
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
255
243
|
}}
|
|
256
244
|
>
|
|
257
|
-
{
|
|
258
|
-
<button
|
|
259
|
-
onClick={actions.secondary.onClick}
|
|
260
|
-
style={{
|
|
261
|
-
borderRadius: "8px",
|
|
262
|
-
padding: "6px 12px",
|
|
263
|
-
fontSize: "13px",
|
|
264
|
-
fontWeight: 500,
|
|
265
|
-
color: themeConfig.text,
|
|
266
|
-
backgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
267
|
-
border: `1px solid ${themeConfig.border}`,
|
|
268
|
-
cursor: "pointer",
|
|
269
|
-
transition: "all 0.2s ease",
|
|
270
|
-
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
271
|
-
}}
|
|
272
|
-
onMouseOver={(e) => {
|
|
273
|
-
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 1)";
|
|
274
|
-
e.currentTarget.style.transform = "translateY(-1px)";
|
|
275
|
-
}}
|
|
276
|
-
onMouseOut={(e) => {
|
|
277
|
-
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.9)";
|
|
278
|
-
e.currentTarget.style.transform = "translateY(0)";
|
|
279
|
-
}}
|
|
280
|
-
>
|
|
281
|
-
{actions.secondary.label}
|
|
282
|
-
</button>
|
|
283
|
-
)}
|
|
284
|
-
{actions.primary && (
|
|
285
|
-
<button
|
|
286
|
-
onClick={actions.primary.onClick}
|
|
287
|
-
style={{
|
|
288
|
-
borderRadius: "8px",
|
|
289
|
-
padding: "6px 12px",
|
|
290
|
-
fontSize: "13px",
|
|
291
|
-
fontWeight: 600,
|
|
292
|
-
color: "#fff",
|
|
293
|
-
backgroundColor: themeConfig.primaryBtn,
|
|
294
|
-
border: "none",
|
|
295
|
-
cursor: "pointer",
|
|
296
|
-
transition: "all 0.2s ease",
|
|
297
|
-
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
|
|
298
|
-
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
299
|
-
}}
|
|
300
|
-
onMouseOver={(e) => {
|
|
301
|
-
e.currentTarget.style.backgroundColor = themeConfig.primaryBtnHover;
|
|
302
|
-
e.currentTarget.style.transform = "translateY(-1px)";
|
|
303
|
-
e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.2)";
|
|
304
|
-
}}
|
|
305
|
-
onMouseOut={(e) => {
|
|
306
|
-
e.currentTarget.style.backgroundColor = themeConfig.primaryBtn;
|
|
307
|
-
e.currentTarget.style.transform = "translateY(0)";
|
|
308
|
-
e.currentTarget.style.boxShadow = "0 2px 8px rgba(0, 0, 0, 0.15)";
|
|
309
|
-
}}
|
|
310
|
-
>
|
|
311
|
-
{actions.primary.label}
|
|
312
|
-
</button>
|
|
313
|
-
)}
|
|
245
|
+
{cleanMessage}
|
|
314
246
|
</div>
|
|
315
|
-
|
|
247
|
+
|
|
248
|
+
{/* Actions */}
|
|
249
|
+
{actions && (
|
|
250
|
+
<div
|
|
251
|
+
style={{
|
|
252
|
+
display: "flex",
|
|
253
|
+
gap: "10px",
|
|
254
|
+
flexWrap: "wrap",
|
|
255
|
+
}}
|
|
256
|
+
>
|
|
257
|
+
{actions.secondary && (
|
|
258
|
+
<button
|
|
259
|
+
onClick={actions.secondary.onClick}
|
|
260
|
+
style={{
|
|
261
|
+
borderRadius: "10px",
|
|
262
|
+
padding: "8px 16px",
|
|
263
|
+
fontSize: "14px",
|
|
264
|
+
fontWeight: 500,
|
|
265
|
+
color: themeConfig.text,
|
|
266
|
+
backgroundColor: "rgba(255, 255, 255, 0.8)",
|
|
267
|
+
border: `1.5px solid ${themeConfig.border}`,
|
|
268
|
+
cursor: "pointer",
|
|
269
|
+
transition: "all 0.2s ease",
|
|
270
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
271
|
+
}}
|
|
272
|
+
onMouseOver={(e) => {
|
|
273
|
+
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 1)";
|
|
274
|
+
e.currentTarget.style.transform = "translateY(-1px)";
|
|
275
|
+
e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.15)";
|
|
276
|
+
}}
|
|
277
|
+
onMouseOut={(e) => {
|
|
278
|
+
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.8)";
|
|
279
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
280
|
+
e.currentTarget.style.boxShadow = "none";
|
|
281
|
+
}}
|
|
282
|
+
>
|
|
283
|
+
{actions.secondary.label}
|
|
284
|
+
</button>
|
|
285
|
+
)}
|
|
286
|
+
{actions.primary && (
|
|
287
|
+
<button
|
|
288
|
+
onClick={actions.primary.onClick}
|
|
289
|
+
style={{
|
|
290
|
+
borderRadius: "10px",
|
|
291
|
+
padding: "8px 16px",
|
|
292
|
+
fontSize: "14px",
|
|
293
|
+
fontWeight: 600,
|
|
294
|
+
color: "#fff",
|
|
295
|
+
backgroundColor: themeConfig.primaryBtn,
|
|
296
|
+
border: "none",
|
|
297
|
+
cursor: "pointer",
|
|
298
|
+
transition: "all 0.2s ease",
|
|
299
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
|
|
300
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
301
|
+
}}
|
|
302
|
+
onMouseOver={(e) => {
|
|
303
|
+
e.currentTarget.style.backgroundColor = themeConfig.primaryBtnHover;
|
|
304
|
+
e.currentTarget.style.transform = "translateY(-1px)";
|
|
305
|
+
e.currentTarget.style.boxShadow = "0 6px 16px rgba(0, 0, 0, 0.2)";
|
|
306
|
+
}}
|
|
307
|
+
onMouseOut={(e) => {
|
|
308
|
+
e.currentTarget.style.backgroundColor = themeConfig.primaryBtn;
|
|
309
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
310
|
+
e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.15)";
|
|
311
|
+
}}
|
|
312
|
+
>
|
|
313
|
+
{actions.primary.label}
|
|
314
|
+
</button>
|
|
315
|
+
)}
|
|
316
|
+
</div>
|
|
317
|
+
)}
|
|
318
|
+
</div>
|
|
316
319
|
</div>
|
|
317
320
|
</div>
|
|
318
321
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CopilotCloudConfig, FunctionCallHandler
|
|
1
|
+
import { CopilotCloudConfig, FunctionCallHandler } from "@copilotkit/shared";
|
|
2
2
|
import {
|
|
3
3
|
ActionRenderProps,
|
|
4
4
|
CatchAllActionRenderProps,
|
|
@@ -218,11 +218,6 @@ export interface CopilotContextParams {
|
|
|
218
218
|
langGraphInterruptAction: LangGraphInterruptAction | null;
|
|
219
219
|
setLangGraphInterruptAction: LangGraphInterruptActionSetter;
|
|
220
220
|
removeLangGraphInterruptAction: () => void;
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Optional trace handler for comprehensive debugging and observability.
|
|
224
|
-
*/
|
|
225
|
-
onTrace?: CopilotTraceHandler;
|
|
226
221
|
}
|
|
227
222
|
|
|
228
223
|
const emptyCopilotContext: CopilotContextParams = {
|
|
@@ -293,7 +288,6 @@ const emptyCopilotContext: CopilotContextParams = {
|
|
|
293
288
|
langGraphInterruptAction: null,
|
|
294
289
|
setLangGraphInterruptAction: () => null,
|
|
295
290
|
removeLangGraphInterruptAction: () => null,
|
|
296
|
-
onTrace: undefined,
|
|
297
291
|
};
|
|
298
292
|
|
|
299
293
|
export const CopilotContext = React.createContext<CopilotContextParams>(emptyCopilotContext);
|