@copilotkit/react-core 1.10.0-next.1 → 1.10.0-next.11
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 +94 -0
- package/dist/{chunk-KV25ZRMH.mjs → chunk-2TSNHEIS.mjs} +6 -6
- package/dist/chunk-2TSNHEIS.mjs.map +1 -0
- package/dist/{chunk-DF4YG4PF.mjs → chunk-3RHHNUVV.mjs} +2 -2
- package/dist/{chunk-LNAQ7JG3.mjs → chunk-6EKLRL7B.mjs} +2 -2
- package/dist/{chunk-JZQOCH4A.mjs → chunk-ADZDXHVC.mjs} +4 -4
- package/dist/{chunk-4CFY3CON.mjs → chunk-CLMDRYEN.mjs} +2 -2
- package/dist/{chunk-VM7CVIET.mjs → chunk-COEUPDRL.mjs} +20 -21
- package/dist/chunk-COEUPDRL.mjs.map +1 -0
- package/dist/{chunk-RGKZCCPA.mjs → chunk-DLEXVOQE.mjs} +5 -5
- package/dist/{chunk-YAF2LATQ.mjs → chunk-EFL5OBKN.mjs} +1 -1
- package/dist/chunk-EFL5OBKN.mjs.map +1 -0
- package/dist/{chunk-JWAXDYOW.mjs → chunk-FAUNHSQU.mjs} +3 -3
- package/dist/chunk-ICIK2BSB.mjs +17 -0
- package/dist/chunk-ICIK2BSB.mjs.map +1 -0
- package/dist/chunk-IHAZJF3V.mjs +34 -0
- package/dist/chunk-IHAZJF3V.mjs.map +1 -0
- package/dist/{chunk-Q6FZZJ5A.mjs → chunk-IN7GE4NO.mjs} +2 -2
- package/dist/{chunk-4XVBXDCX.mjs → chunk-JBLMXZ3O.mjs} +8 -8
- package/dist/{chunk-NXCJELW7.mjs → chunk-JJDXTTEN.mjs} +3 -3
- package/dist/chunk-KDAZGZ24.mjs +1 -0
- package/dist/{chunk-VOMGRGWT.mjs → chunk-L6HQIJ74.mjs} +33 -17
- package/dist/chunk-L6HQIJ74.mjs.map +1 -0
- package/dist/{chunk-OMVNJ7S3.mjs → chunk-LVWV62JZ.mjs} +37 -24
- package/dist/chunk-LVWV62JZ.mjs.map +1 -0
- package/dist/{chunk-3OQM3NEK.mjs → chunk-N4WEHORG.mjs} +2 -2
- package/dist/chunk-OKRZF3DD.mjs +225 -0
- package/dist/chunk-OKRZF3DD.mjs.map +1 -0
- package/dist/{chunk-SGF6C7I6.mjs → chunk-Q42NJFXR.mjs} +11 -16
- package/dist/chunk-Q42NJFXR.mjs.map +1 -0
- package/dist/chunk-QGE7U4NV.mjs +85 -0
- package/dist/chunk-QGE7U4NV.mjs.map +1 -0
- package/dist/{chunk-XGRBCWK6.mjs → chunk-TEMLWRRT.mjs} +3 -3
- package/dist/chunk-TEMLWRRT.mjs.map +1 -0
- package/dist/{chunk-PYULBXCD.mjs → chunk-TWYUYC4F.mjs} +44 -10
- package/dist/chunk-TWYUYC4F.mjs.map +1 -0
- package/dist/{chunk-WUORFPJ7.mjs → chunk-X2DNXTME.mjs} +6 -6
- package/dist/{chunk-DCTJZ742.mjs → chunk-ZLQVRPDS.mjs} +5 -2
- package/dist/chunk-ZLQVRPDS.mjs.map +1 -0
- package/dist/components/copilot-provider/copilot-messages.d.ts +17 -1
- package/dist/components/copilot-provider/copilot-messages.js +46 -7
- package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
- package/dist/components/copilot-provider/copilot-messages.mjs +11 -7
- package/dist/components/copilot-provider/copilotkit-props.d.ts +5 -3
- package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.d.ts +1 -2
- package/dist/components/copilot-provider/copilotkit.js +337 -555
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +10 -10
- package/dist/components/copilot-provider/index.d.ts +1 -2
- package/dist/components/copilot-provider/index.js +337 -555
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +10 -10
- package/dist/components/error-boundary/error-boundary.js +176 -323
- 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 -2
- package/dist/components/index.js +337 -555
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +10 -10
- package/dist/components/toast/toast-provider.js.map +1 -1
- package/dist/components/toast/toast-provider.mjs +1 -1
- package/dist/components/usage-banner.d.ts +10 -4
- package/dist/components/usage-banner.js +176 -302
- package/dist/components/usage-banner.js.map +1 -1
- package/dist/components/usage-banner.mjs +3 -1
- package/dist/context/copilot-context.d.ts +1 -2
- package/dist/context/copilot-context.js +2 -2
- package/dist/context/copilot-context.js.map +1 -1
- package/dist/context/copilot-context.mjs +1 -1
- package/dist/context/copilot-messages-context.d.ts +11 -15
- package/dist/context/copilot-messages-context.js +4 -1
- package/dist/context/copilot-messages-context.js.map +1 -1
- package/dist/context/copilot-messages-context.mjs +1 -1
- package/dist/context/index.d.ts +2 -2
- package/dist/context/index.js +6 -3
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +5 -5
- package/dist/{copilot-context-bd88d30d.d.ts → copilot-context-256f9020.d.ts} +4 -22
- package/dist/hooks/index.d.ts +7 -5
- package/dist/hooks/index.js +250 -122
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +42 -34
- package/dist/hooks/use-chat.d.ts +1 -2
- package/dist/hooks/use-chat.js +11 -3
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +6 -6
- package/dist/hooks/use-coagent-state-render.js +2 -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 +3 -4
- package/dist/hooks/use-coagent.js +114 -81
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +16 -16
- package/dist/hooks/use-copilot-action.js +2 -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 +2 -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 +2 -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-headless_c.d.ts +33 -0
- package/dist/hooks/use-copilot-chat-headless_c.js +1837 -0
- package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -0
- package/dist/hooks/use-copilot-chat-headless_c.mjs +31 -0
- package/dist/hooks/use-copilot-chat-headless_c.mjs.map +1 -0
- package/dist/hooks/use-copilot-chat.d.ts +52 -82
- package/dist/hooks/use-copilot-chat.js +60 -13
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +16 -17
- package/dist/hooks/use-copilot-chat_internal.d.ts +177 -0
- package/dist/hooks/use-copilot-chat_internal.js +1770 -0
- package/dist/hooks/use-copilot-chat_internal.js.map +1 -0
- package/dist/hooks/use-copilot-chat_internal.mjs +29 -0
- package/dist/hooks/use-copilot-chat_internal.mjs.map +1 -0
- package/dist/hooks/use-copilot-readable.js +2 -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.js +9 -1
- package/dist/hooks/use-copilot-runtime-client.js.map +1 -1
- package/dist/hooks/use-copilot-runtime-client.mjs +3 -3
- package/dist/hooks/use-langgraph-interrupt-render.js +2 -2
- package/dist/hooks/use-langgraph-interrupt-render.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt-render.mjs +3 -3
- package/dist/hooks/use-langgraph-interrupt.d.ts +3 -4
- package/dist/hooks/use-langgraph-interrupt.js +32 -11
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +16 -16
- package/dist/hooks/use-make-copilot-document-readable.js +2 -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-08c43df1.d.ts +36 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +460 -471
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -39
- package/dist/lib/copilot-task.d.ts +1 -2
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +12 -12
- package/dist/lib/index.d.ts +1 -2
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +12 -12
- package/dist/types/interrupt-action.d.ts +2 -3
- package/dist/utils/dev-console.d.ts +1 -1
- package/dist/utils/dev-console.js +9 -1
- package/dist/utils/dev-console.js.map +1 -1
- package/dist/utils/dev-console.mjs +1 -1
- package/dist/utils/extract.d.ts +2 -2
- package/dist/utils/extract.js.map +1 -1
- package/dist/utils/extract.mjs +10 -10
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.js +9 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +11 -11
- package/dist/utils/suggestions.d.ts +2 -2
- package/dist/utils/suggestions.js.map +1 -1
- package/dist/utils/suggestions.mjs +10 -10
- package/package.json +3 -3
- package/src/components/copilot-provider/copilot-messages.tsx +57 -1
- package/src/components/copilot-provider/copilotkit-props.tsx +4 -1
- package/src/components/copilot-provider/copilotkit.tsx +20 -10
- package/src/components/error-boundary/error-boundary.tsx +5 -15
- package/src/components/toast/toast-provider.tsx +1 -3
- package/src/components/usage-banner.tsx +193 -316
- package/src/context/copilot-context.tsx +12 -6
- package/src/context/copilot-messages-context.tsx +7 -1
- package/src/hooks/__tests__/use-coagent-config.test.ts +8 -1
- package/src/hooks/index.ts +7 -2
- package/src/hooks/use-coagent.ts +17 -19
- package/src/hooks/use-copilot-chat-headless_c.ts +187 -0
- package/src/hooks/use-copilot-chat.ts +64 -495
- package/src/hooks/use-copilot-chat_internal.ts +543 -0
- package/src/hooks/use-langgraph-interrupt.ts +1 -1
- package/src/utils/dev-console.ts +18 -2
- package/dist/chunk-57K2ZJ5F.mjs +0 -348
- package/dist/chunk-57K2ZJ5F.mjs.map +0 -1
- package/dist/chunk-CQPYJIBH.mjs +0 -1
- package/dist/chunk-DCTJZ742.mjs.map +0 -1
- package/dist/chunk-GFJW4RIM.mjs +0 -9
- package/dist/chunk-GFJW4RIM.mjs.map +0 -1
- package/dist/chunk-KV25ZRMH.mjs.map +0 -1
- package/dist/chunk-OMVNJ7S3.mjs.map +0 -1
- package/dist/chunk-PYULBXCD.mjs.map +0 -1
- package/dist/chunk-SGF6C7I6.mjs.map +0 -1
- package/dist/chunk-VM7CVIET.mjs.map +0 -1
- package/dist/chunk-VOMGRGWT.mjs.map +0 -1
- package/dist/chunk-XGRBCWK6.mjs.map +0 -1
- package/dist/chunk-YAF2LATQ.mjs.map +0 -1
- /package/dist/{chunk-DF4YG4PF.mjs.map → chunk-3RHHNUVV.mjs.map} +0 -0
- /package/dist/{chunk-LNAQ7JG3.mjs.map → chunk-6EKLRL7B.mjs.map} +0 -0
- /package/dist/{chunk-JZQOCH4A.mjs.map → chunk-ADZDXHVC.mjs.map} +0 -0
- /package/dist/{chunk-4CFY3CON.mjs.map → chunk-CLMDRYEN.mjs.map} +0 -0
- /package/dist/{chunk-RGKZCCPA.mjs.map → chunk-DLEXVOQE.mjs.map} +0 -0
- /package/dist/{chunk-JWAXDYOW.mjs.map → chunk-FAUNHSQU.mjs.map} +0 -0
- /package/dist/{chunk-Q6FZZJ5A.mjs.map → chunk-IN7GE4NO.mjs.map} +0 -0
- /package/dist/{chunk-4XVBXDCX.mjs.map → chunk-JBLMXZ3O.mjs.map} +0 -0
- /package/dist/{chunk-NXCJELW7.mjs.map → chunk-JJDXTTEN.mjs.map} +0 -0
- /package/dist/{chunk-CQPYJIBH.mjs.map → chunk-KDAZGZ24.mjs.map} +0 -0
- /package/dist/{chunk-3OQM3NEK.mjs.map → chunk-N4WEHORG.mjs.map} +0 -0
- /package/dist/{chunk-WUORFPJ7.mjs.map → chunk-X2DNXTME.mjs.map} +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotKit,
|
|
3
3
|
defaultCopilotContextCategories
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
4
|
+
} from "../../chunk-LVWV62JZ.mjs";
|
|
5
|
+
import "../../chunk-TWYUYC4F.mjs";
|
|
6
|
+
import "../../chunk-Q42NJFXR.mjs";
|
|
7
7
|
import "../../chunk-2IDV5OHF.mjs";
|
|
8
8
|
import "../../chunk-PMAFHQ7P.mjs";
|
|
9
9
|
import "../../chunk-5FHSUKQL.mjs";
|
|
10
10
|
import "../../chunk-RKTVJRK7.mjs";
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-ZLQVRPDS.mjs";
|
|
12
|
+
import "../../chunk-OKRZF3DD.mjs";
|
|
13
|
+
import "../../chunk-N4WEHORG.mjs";
|
|
14
14
|
import "../../chunk-O7ARI5CV.mjs";
|
|
15
|
-
import "../../chunk-
|
|
16
|
-
import "../../chunk-
|
|
17
|
-
import "../../chunk-
|
|
18
|
-
import "../../chunk-
|
|
15
|
+
import "../../chunk-FAUNHSQU.mjs";
|
|
16
|
+
import "../../chunk-ICIK2BSB.mjs";
|
|
17
|
+
import "../../chunk-TEMLWRRT.mjs";
|
|
18
|
+
import "../../chunk-EFL5OBKN.mjs";
|
|
19
19
|
import "../../chunk-SKC7AJIV.mjs";
|
|
20
20
|
export {
|
|
21
21
|
CopilotKit,
|
|
@@ -114,345 +114,203 @@ var StatusChecker = class {
|
|
|
114
114
|
// src/components/usage-banner.tsx
|
|
115
115
|
var import_shared2 = require("@copilotkit/shared");
|
|
116
116
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
117
|
-
var defaultIcons = {
|
|
118
|
-
[import_shared2.Severity.CRITICAL]: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
119
|
-
"svg",
|
|
120
|
-
{
|
|
121
|
-
viewBox: "0 0 24 24",
|
|
122
|
-
width: "16",
|
|
123
|
-
height: "16",
|
|
124
|
-
stroke: "currentColor",
|
|
125
|
-
strokeWidth: "2.5",
|
|
126
|
-
fill: "none",
|
|
127
|
-
strokeLinecap: "round",
|
|
128
|
-
strokeLinejoin: "round",
|
|
129
|
-
children: [
|
|
130
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
131
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "15", y1: "9", x2: "9", y2: "15" }),
|
|
132
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
|
|
133
|
-
]
|
|
134
|
-
}
|
|
135
|
-
),
|
|
136
|
-
[import_shared2.Severity.WARNING]: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
137
|
-
"svg",
|
|
138
|
-
{
|
|
139
|
-
viewBox: "0 0 24 24",
|
|
140
|
-
width: "16",
|
|
141
|
-
height: "16",
|
|
142
|
-
stroke: "currentColor",
|
|
143
|
-
strokeWidth: "2.5",
|
|
144
|
-
fill: "none",
|
|
145
|
-
strokeLinecap: "round",
|
|
146
|
-
strokeLinejoin: "round",
|
|
147
|
-
children: [
|
|
148
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" }),
|
|
149
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
|
|
150
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
151
|
-
]
|
|
152
|
-
}
|
|
153
|
-
),
|
|
154
|
-
[import_shared2.Severity.INFO]: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
155
|
-
"svg",
|
|
156
|
-
{
|
|
157
|
-
viewBox: "0 0 24 24",
|
|
158
|
-
width: "16",
|
|
159
|
-
height: "16",
|
|
160
|
-
stroke: "currentColor",
|
|
161
|
-
strokeWidth: "2.5",
|
|
162
|
-
fill: "none",
|
|
163
|
-
strokeLinecap: "round",
|
|
164
|
-
strokeLinejoin: "round",
|
|
165
|
-
children: [
|
|
166
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
167
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "12", y1: "16", x2: "12", y2: "12" }),
|
|
168
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })
|
|
169
|
-
]
|
|
170
|
-
}
|
|
171
|
-
)
|
|
172
|
-
};
|
|
173
117
|
function UsageBanner({
|
|
174
118
|
severity = import_shared2.Severity.CRITICAL,
|
|
175
119
|
message = "",
|
|
176
|
-
icon,
|
|
177
120
|
onClose,
|
|
178
121
|
actions
|
|
179
122
|
}) {
|
|
180
123
|
if (!message || !severity) {
|
|
181
124
|
return null;
|
|
182
125
|
}
|
|
183
|
-
const
|
|
184
|
-
if (rawMessage.toLowerCase().includes("authentication") || rawMessage.toLowerCase().includes("api key")) {
|
|
185
|
-
return "Authentication failed. Please check your API key.";
|
|
186
|
-
}
|
|
187
|
-
if (rawMessage.toLowerCase().includes("rate limit")) {
|
|
188
|
-
return "Rate limit exceeded. Please try again later.";
|
|
189
|
-
}
|
|
190
|
-
if (rawMessage.toLowerCase().includes("checkpointer")) {
|
|
191
|
-
return "Agent configuration error. Please check your setup.";
|
|
192
|
-
}
|
|
193
|
-
let cleanMessage2 = rawMessage;
|
|
194
|
-
cleanMessage2 = cleanMessage2.split(" - ")[0];
|
|
195
|
-
cleanMessage2 = cleanMessage2.split(": Error code")[0];
|
|
196
|
-
cleanMessage2 = cleanMessage2.split(": 401")[0];
|
|
197
|
-
cleanMessage2 = cleanMessage2.split(": 403")[0];
|
|
198
|
-
cleanMessage2 = cleanMessage2.split(": 404")[0];
|
|
199
|
-
cleanMessage2 = cleanMessage2.split(": 500")[0];
|
|
200
|
-
cleanMessage2 = cleanMessage2.replace(/See more:.*$/g, "").trim();
|
|
201
|
-
if (cleanMessage2.includes("{") || cleanMessage2.includes("'") || cleanMessage2.length > 60) {
|
|
202
|
-
return "Configuration error. Please check your setup.";
|
|
203
|
-
}
|
|
204
|
-
return cleanMessage2 || "An error occurred. Please check your configuration.";
|
|
205
|
-
};
|
|
206
|
-
const cleanMessage = parseMessage(message);
|
|
207
|
-
const Icon = icon || defaultIcons[severity];
|
|
208
|
-
const themeConfigs = {
|
|
126
|
+
const themes = {
|
|
209
127
|
[import_shared2.Severity.INFO]: {
|
|
210
|
-
bg: "
|
|
211
|
-
border: "#
|
|
212
|
-
text: "#
|
|
213
|
-
|
|
214
|
-
primaryBtn: "#3b82f6",
|
|
215
|
-
primaryBtnHover: "#2563eb"
|
|
128
|
+
bg: "#f8fafc",
|
|
129
|
+
border: "#e2e8f0",
|
|
130
|
+
text: "#475569",
|
|
131
|
+
accent: "#3b82f6"
|
|
216
132
|
},
|
|
217
133
|
[import_shared2.Severity.WARNING]: {
|
|
218
|
-
bg: "
|
|
134
|
+
bg: "#fffbeb",
|
|
219
135
|
border: "#fbbf24",
|
|
220
136
|
text: "#92400e",
|
|
221
|
-
|
|
222
|
-
primaryBtn: "#f59e0b",
|
|
223
|
-
primaryBtnHover: "#d97706"
|
|
137
|
+
accent: "#f59e0b"
|
|
224
138
|
},
|
|
225
139
|
[import_shared2.Severity.CRITICAL]: {
|
|
226
|
-
bg: "
|
|
227
|
-
border: "#
|
|
228
|
-
text: "#
|
|
229
|
-
|
|
230
|
-
primaryBtn: "#ef4444",
|
|
231
|
-
primaryBtnHover: "#dc2626"
|
|
140
|
+
bg: "#fef2f2",
|
|
141
|
+
border: "#fecaca",
|
|
142
|
+
text: "#dc2626",
|
|
143
|
+
accent: "#ef4444"
|
|
232
144
|
}
|
|
233
145
|
};
|
|
234
|
-
const
|
|
235
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
236
|
-
"
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
bottom: "24px",
|
|
241
|
-
left: "50%",
|
|
242
|
-
transform: "translateX(-50%)",
|
|
243
|
-
width: "400px",
|
|
244
|
-
maxWidth: "90vw",
|
|
245
|
-
zIndex: 1e4,
|
|
246
|
-
animation: "bannerSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1)"
|
|
247
|
-
},
|
|
248
|
-
children: [
|
|
249
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: `
|
|
250
|
-
@keyframes bannerSlideIn {
|
|
251
|
-
from {
|
|
252
|
-
opacity: 0;
|
|
253
|
-
transform: translateX(-50%) translateY(20px);
|
|
254
|
-
scale: 0.95;
|
|
255
|
-
}
|
|
256
|
-
to {
|
|
257
|
-
opacity: 1;
|
|
258
|
-
transform: translateX(-50%) translateY(0);
|
|
259
|
-
scale: 1;
|
|
260
|
-
}
|
|
146
|
+
const theme = themes[severity];
|
|
147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
148
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: `
|
|
149
|
+
@keyframes slideUp {
|
|
150
|
+
from { opacity: 0; transform: translateX(-50%) translateY(8px); }
|
|
151
|
+
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
261
152
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
boxShadow: "0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08)",
|
|
272
|
-
position: "relative",
|
|
273
|
-
backdropFilter: "blur(12px)",
|
|
274
|
-
WebkitBackdropFilter: "blur(12px)",
|
|
275
|
-
boxSizing: "border-box",
|
|
276
|
-
overflow: "hidden"
|
|
277
|
-
},
|
|
278
|
-
children: [
|
|
279
|
-
onClose && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
280
|
-
"button",
|
|
281
|
-
{
|
|
282
|
-
onClick: onClose,
|
|
283
|
-
style: {
|
|
284
|
-
position: "absolute",
|
|
285
|
-
top: "8px",
|
|
286
|
-
right: "8px",
|
|
287
|
-
background: "rgba(255, 255, 255, 0.9)",
|
|
288
|
-
border: "none",
|
|
289
|
-
color: themeConfig.text,
|
|
290
|
-
cursor: "pointer",
|
|
291
|
-
fontSize: "16px",
|
|
292
|
-
lineHeight: "1",
|
|
293
|
-
padding: "4px",
|
|
294
|
-
borderRadius: "4px",
|
|
295
|
-
width: "20px",
|
|
296
|
-
height: "20px",
|
|
297
|
-
display: "flex",
|
|
298
|
-
alignItems: "center",
|
|
299
|
-
justifyContent: "center"
|
|
300
|
-
},
|
|
301
|
-
title: "Close",
|
|
302
|
-
children: "\xD7"
|
|
303
|
-
}
|
|
304
|
-
),
|
|
305
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
306
|
-
"div",
|
|
307
|
-
{
|
|
308
|
-
style: {
|
|
309
|
-
fontSize: "14px",
|
|
310
|
-
fontWeight: 500,
|
|
311
|
-
color: themeConfig.text,
|
|
312
|
-
lineHeight: "1.4",
|
|
313
|
-
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
314
|
-
paddingRight: onClose ? "30px" : "0",
|
|
315
|
-
marginBottom: actions ? "12px" : "0",
|
|
316
|
-
wordBreak: "break-word",
|
|
317
|
-
overflow: "hidden",
|
|
318
|
-
textOverflow: "ellipsis",
|
|
319
|
-
display: "-webkit-box",
|
|
320
|
-
WebkitLineClamp: 2,
|
|
321
|
-
WebkitBoxOrient: "vertical"
|
|
322
|
-
},
|
|
323
|
-
children: cleanMessage
|
|
324
|
-
}
|
|
325
|
-
),
|
|
326
|
-
actions && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
327
|
-
"div",
|
|
328
|
-
{
|
|
329
|
-
style: {
|
|
330
|
-
display: "flex",
|
|
331
|
-
gap: "8px",
|
|
332
|
-
flexWrap: "wrap"
|
|
333
|
-
},
|
|
334
|
-
children: [
|
|
335
|
-
actions.secondary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
336
|
-
"button",
|
|
337
|
-
{
|
|
338
|
-
onClick: actions.secondary.onClick,
|
|
339
|
-
style: {
|
|
340
|
-
borderRadius: "8px",
|
|
341
|
-
padding: "6px 12px",
|
|
342
|
-
fontSize: "13px",
|
|
343
|
-
fontWeight: 500,
|
|
344
|
-
color: themeConfig.text,
|
|
345
|
-
backgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
346
|
-
border: `1px solid ${themeConfig.border}`,
|
|
347
|
-
cursor: "pointer",
|
|
348
|
-
transition: "all 0.2s ease",
|
|
349
|
-
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
350
|
-
},
|
|
351
|
-
onMouseOver: (e) => {
|
|
352
|
-
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 1)";
|
|
353
|
-
e.currentTarget.style.transform = "translateY(-1px)";
|
|
354
|
-
},
|
|
355
|
-
onMouseOut: (e) => {
|
|
356
|
-
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.9)";
|
|
357
|
-
e.currentTarget.style.transform = "translateY(0)";
|
|
358
|
-
},
|
|
359
|
-
children: actions.secondary.label
|
|
360
|
-
}
|
|
361
|
-
),
|
|
362
|
-
actions.primary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
363
|
-
"button",
|
|
364
|
-
{
|
|
365
|
-
onClick: actions.primary.onClick,
|
|
366
|
-
style: {
|
|
367
|
-
borderRadius: "8px",
|
|
368
|
-
padding: "6px 12px",
|
|
369
|
-
fontSize: "13px",
|
|
370
|
-
fontWeight: 600,
|
|
371
|
-
color: "#fff",
|
|
372
|
-
backgroundColor: themeConfig.primaryBtn,
|
|
373
|
-
border: "none",
|
|
374
|
-
cursor: "pointer",
|
|
375
|
-
transition: "all 0.2s ease",
|
|
376
|
-
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
|
|
377
|
-
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
378
|
-
},
|
|
379
|
-
onMouseOver: (e) => {
|
|
380
|
-
e.currentTarget.style.backgroundColor = themeConfig.primaryBtnHover;
|
|
381
|
-
e.currentTarget.style.transform = "translateY(-1px)";
|
|
382
|
-
e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.2)";
|
|
383
|
-
},
|
|
384
|
-
onMouseOut: (e) => {
|
|
385
|
-
e.currentTarget.style.backgroundColor = themeConfig.primaryBtn;
|
|
386
|
-
e.currentTarget.style.transform = "translateY(0)";
|
|
387
|
-
e.currentTarget.style.boxShadow = "0 2px 8px rgba(0, 0, 0, 0.15)";
|
|
388
|
-
},
|
|
389
|
-
children: actions.primary.label
|
|
390
|
-
}
|
|
391
|
-
)
|
|
392
|
-
]
|
|
393
|
-
}
|
|
394
|
-
)
|
|
395
|
-
]
|
|
153
|
+
|
|
154
|
+
.usage-banner {
|
|
155
|
+
position: fixed;
|
|
156
|
+
bottom: 24px;
|
|
157
|
+
left: 50%;
|
|
158
|
+
transform: translateX(-50%);
|
|
159
|
+
width: min(600px, calc(100vw - 32px));
|
|
160
|
+
z-index: 10000;
|
|
161
|
+
animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
|
|
396
162
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
163
|
+
|
|
164
|
+
.banner-content {
|
|
165
|
+
background: linear-gradient(135deg, ${theme.bg} 0%, ${theme.bg}f5 100%);
|
|
166
|
+
border: 1px solid ${theme.border};
|
|
167
|
+
border-radius: 12px;
|
|
168
|
+
padding: 18px 20px;
|
|
169
|
+
box-shadow:
|
|
170
|
+
0 4px 24px rgba(0, 0, 0, 0.08),
|
|
171
|
+
0 2px 8px rgba(0, 0, 0, 0.04),
|
|
172
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.7);
|
|
173
|
+
display: flex;
|
|
174
|
+
align-items: center;
|
|
175
|
+
gap: 16px;
|
|
176
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
|
|
177
|
+
backdrop-filter: blur(12px);
|
|
178
|
+
position: relative;
|
|
179
|
+
overflow: hidden;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.banner-content::before {
|
|
183
|
+
content: '';
|
|
184
|
+
position: absolute;
|
|
185
|
+
top: 0;
|
|
186
|
+
left: 0;
|
|
187
|
+
right: 0;
|
|
188
|
+
height: 1px;
|
|
189
|
+
background: linear-gradient(90deg, transparent, ${theme.accent}40, transparent);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.banner-message {
|
|
193
|
+
color: ${theme.text};
|
|
194
|
+
font-size: 14px;
|
|
195
|
+
line-height: 1.5;
|
|
196
|
+
font-weight: 500;
|
|
197
|
+
flex: 1;
|
|
198
|
+
letter-spacing: -0.01em;
|
|
418
199
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
200
|
+
|
|
201
|
+
.close-btn {
|
|
202
|
+
background: rgba(0, 0, 0, 0.05);
|
|
203
|
+
border: none;
|
|
204
|
+
color: ${theme.text};
|
|
205
|
+
cursor: pointer;
|
|
206
|
+
padding: 0;
|
|
207
|
+
border-radius: 6px;
|
|
208
|
+
opacity: 0.6;
|
|
209
|
+
transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
|
|
210
|
+
font-size: 14px;
|
|
211
|
+
line-height: 1;
|
|
212
|
+
flex-shrink: 0;
|
|
213
|
+
width: 24px;
|
|
214
|
+
height: 24px;
|
|
215
|
+
display: flex;
|
|
216
|
+
align-items: center;
|
|
217
|
+
justify-content: center;
|
|
425
218
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
219
|
+
|
|
220
|
+
.close-btn:hover {
|
|
221
|
+
opacity: 1;
|
|
222
|
+
background: rgba(0, 0, 0, 0.08);
|
|
223
|
+
transform: scale(1.05);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.btn-primary {
|
|
227
|
+
background: linear-gradient(135deg, ${theme.accent} 0%, ${theme.accent}e6 100%);
|
|
228
|
+
color: white;
|
|
229
|
+
border: none;
|
|
230
|
+
border-radius: 8px;
|
|
231
|
+
padding: 10px 18px;
|
|
232
|
+
font-size: 13px;
|
|
233
|
+
font-weight: 600;
|
|
234
|
+
cursor: pointer;
|
|
235
|
+
transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
|
|
236
|
+
font-family: inherit;
|
|
237
|
+
flex-shrink: 0;
|
|
238
|
+
box-shadow:
|
|
239
|
+
0 2px 8px ${theme.accent}30,
|
|
240
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.2);
|
|
241
|
+
letter-spacing: -0.01em;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.btn-primary:hover {
|
|
245
|
+
transform: translateY(-1px) scale(1.02);
|
|
246
|
+
box-shadow:
|
|
247
|
+
0 4px 12px ${theme.accent}40,
|
|
248
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.25);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.btn-primary:active {
|
|
252
|
+
transform: translateY(0) scale(0.98);
|
|
253
|
+
transition: all 0.08s cubic-bezier(0.16, 1, 0.3, 1);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
@media (max-width: 640px) {
|
|
257
|
+
.usage-banner {
|
|
258
|
+
width: calc(100vw - 24px);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.banner-content {
|
|
262
|
+
padding: 16px;
|
|
263
|
+
gap: 12px;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.banner-message {
|
|
267
|
+
font-size: 13px;
|
|
268
|
+
line-height: 1.45;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.btn-primary {
|
|
272
|
+
padding: 8px 14px;
|
|
273
|
+
font-size: 12px;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.close-btn {
|
|
277
|
+
width: 22px;
|
|
278
|
+
height: 22px;
|
|
279
|
+
font-size: 12px;
|
|
439
280
|
}
|
|
440
281
|
}
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
{
|
|
449
|
-
severity: error.severity || import_shared2.Severity.CRITICAL,
|
|
450
|
-
message: error.message,
|
|
451
|
-
onClose,
|
|
452
|
-
actions: getErrorActions(error)
|
|
453
|
-
}
|
|
454
|
-
);
|
|
282
|
+
` }),
|
|
283
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usage-banner", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "banner-content", children: [
|
|
284
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "banner-message", children: message }),
|
|
285
|
+
(actions == null ? void 0 : actions.primary) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "btn-primary", onClick: actions.primary.onClick, children: actions.primary.label }),
|
|
286
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "close-btn", onClick: onClose, title: "Close", children: "\xD7" })
|
|
287
|
+
] }) })
|
|
288
|
+
] });
|
|
455
289
|
}
|
|
290
|
+
var getErrorActions = (error) => {
|
|
291
|
+
switch (error.code) {
|
|
292
|
+
case import_shared2.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR:
|
|
293
|
+
return {
|
|
294
|
+
primary: {
|
|
295
|
+
label: "Show me how",
|
|
296
|
+
onClick: () => window.open(
|
|
297
|
+
"https://docs.copilotkit.ai/docs/guides/subscription",
|
|
298
|
+
"_blank",
|
|
299
|
+
"noopener,noreferrer"
|
|
300
|
+
)
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
case import_shared2.CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR:
|
|
304
|
+
return {
|
|
305
|
+
primary: {
|
|
306
|
+
label: "Upgrade",
|
|
307
|
+
onClick: () => window.open("https://cloud.copilotkit.ai", "_blank", "noopener,noreferrer")
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
default:
|
|
311
|
+
return void 0;
|
|
312
|
+
}
|
|
313
|
+
};
|
|
456
314
|
|
|
457
315
|
// src/components/error-boundary/error-utils.tsx
|
|
458
316
|
var import_react2 = require("react");
|
|
@@ -603,22 +461,17 @@ var CopilotErrorBoundary = class extends import_react3.default.Component {
|
|
|
603
461
|
console.error("CopilotKit Error:", error, errorInfo);
|
|
604
462
|
}
|
|
605
463
|
render() {
|
|
606
|
-
var _a, _b;
|
|
464
|
+
var _a, _b, _c, _d;
|
|
607
465
|
if (this.state.hasError) {
|
|
608
466
|
if (this.state.error instanceof import_shared4.CopilotKitError) {
|
|
609
|
-
if (this.state.error.visibility === import_shared4.ErrorVisibility.BANNER) {
|
|
610
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ErrorToast2, { error: this.state.error, children: renderCopilotKitUsage(
|
|
611
|
-
this.state.error,
|
|
612
|
-
() => this.setState({ hasError: false, error: void 0 })
|
|
613
|
-
) });
|
|
614
|
-
}
|
|
615
467
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
616
468
|
this.props.children,
|
|
617
469
|
this.props.showUsageBanner && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
618
470
|
UsageBanner,
|
|
619
471
|
{
|
|
620
|
-
severity: (_a = this.state.status) == null ? void 0 : _a.severity,
|
|
621
|
-
message: (
|
|
472
|
+
severity: (_b = (_a = this.state.status) == null ? void 0 : _a.severity) != null ? _b : this.state.error.severity,
|
|
473
|
+
message: (_d = (_c = this.state.status) == null ? void 0 : _c.message) != null ? _d : this.state.error.message,
|
|
474
|
+
actions: getErrorActions(this.state.error)
|
|
622
475
|
}
|
|
623
476
|
)
|
|
624
477
|
] });
|