@copilotkit/react-core 1.9.1-next.0 → 1.9.2-next.0
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 +17 -0
- package/dist/{chunk-B5UA5G3E.mjs → chunk-2FW7HH6W.mjs} +12 -8
- package/dist/chunk-2FW7HH6W.mjs.map +1 -0
- package/dist/{chunk-ERFA53MG.mjs → chunk-6KGEF242.mjs} +2 -2
- package/dist/chunk-6KGEF242.mjs.map +1 -0
- package/dist/{chunk-2J3SMMGW.mjs → chunk-C6F6EQNA.mjs} +2 -2
- package/dist/chunk-CCESTGAM.mjs +102 -0
- package/dist/chunk-CCESTGAM.mjs.map +1 -0
- package/dist/chunk-GFJW4RIM.mjs +9 -0
- package/dist/chunk-GFJW4RIM.mjs.map +1 -0
- package/dist/chunk-HD2GE3DK.mjs +359 -0
- package/dist/chunk-HD2GE3DK.mjs.map +1 -0
- package/dist/{chunk-74AJEJTV.mjs → chunk-HJP2RX5R.mjs} +11 -6
- package/dist/chunk-HJP2RX5R.mjs.map +1 -0
- package/dist/{chunk-EQ4XLLT4.mjs → chunk-LDACFA2B.mjs} +3 -3
- package/dist/{chunk-FGBRHBRR.mjs → chunk-LZDDYZEY.mjs} +2 -2
- package/dist/chunk-NNSXCFQO.mjs +154 -0
- package/dist/chunk-NNSXCFQO.mjs.map +1 -0
- package/dist/{chunk-WZAEVHLK.mjs → chunk-Q5D5XQFA.mjs} +2 -2
- package/dist/{chunk-534J55RX.mjs → chunk-QQZLIEXK.mjs} +9 -7
- package/dist/chunk-QQZLIEXK.mjs.map +1 -0
- package/dist/chunk-RUY6MLHA.mjs +119 -0
- package/dist/chunk-RUY6MLHA.mjs.map +1 -0
- package/dist/{chunk-MDIIRGJD.mjs → chunk-SGLWMQ2J.mjs} +25 -17
- package/dist/chunk-SGLWMQ2J.mjs.map +1 -0
- package/dist/{chunk-G27C5EFO.mjs → chunk-T42PN5VN.mjs} +7 -5
- package/dist/{chunk-G27C5EFO.mjs.map → chunk-T42PN5VN.mjs.map} +1 -1
- package/dist/{chunk-VQ3VTO26.mjs → chunk-UHQMV2CE.mjs} +2 -2
- package/dist/{chunk-4DVPRMVH.mjs → chunk-UIT6QMUJ.mjs} +7 -7
- package/dist/chunk-VRXANACV.mjs +277 -0
- package/dist/chunk-VRXANACV.mjs.map +1 -0
- package/dist/{chunk-2FLZLANO.mjs → chunk-XY5BN4HZ.mjs} +19 -12
- package/dist/chunk-XY5BN4HZ.mjs.map +1 -0
- package/dist/{chunk-7HDYPEWS.mjs → chunk-YDENFEKA.mjs} +2 -2
- package/dist/{chunk-4VWM6JNK.mjs → chunk-YZDRMIOM.mjs} +6 -6
- package/dist/components/copilot-provider/copilot-messages.js +105 -11
- package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
- package/dist/components/copilot-provider/copilot-messages.mjs +4 -2
- package/dist/components/copilot-provider/copilotkit-props.d.ts +4 -3
- 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 +863 -441
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +10 -9
- package/dist/components/copilot-provider/index.d.ts +1 -1
- package/dist/components/copilot-provider/index.js +863 -441
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +10 -9
- package/dist/components/error-boundary/error-boundary.js +320 -159
- package/dist/components/error-boundary/error-boundary.js.map +1 -1
- package/dist/components/error-boundary/error-boundary.mjs +4 -3
- package/dist/components/error-boundary/error-utils.js +2 -1
- package/dist/components/error-boundary/error-utils.js.map +1 -1
- package/dist/components/error-boundary/error-utils.mjs +2 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +863 -441
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +10 -9
- package/dist/components/toast/toast-provider.d.ts +9 -12
- package/dist/components/toast/toast-provider.js +218 -191
- package/dist/components/toast/toast-provider.js.map +1 -1
- package/dist/components/toast/toast-provider.mjs +1 -2
- package/dist/components/usage-banner.d.ts +3 -2
- package/dist/components/usage-banner.js +311 -153
- 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 -1
- 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 -1
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/{copilot-context-309906bb.d.ts → copilot-context-f9b2b4c3.d.ts} +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +160 -75
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +33 -32
- package/dist/hooks/use-chat.d.ts +1 -1
- package/dist/hooks/use-chat.js +243 -68
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +6 -3
- package/dist/hooks/use-coagent-state-render.js +10 -5
- package/dist/hooks/use-coagent-state-render.js.map +1 -1
- package/dist/hooks/use-coagent-state-render.mjs +3 -4
- package/dist/hooks/use-coagent.d.ts +1 -1
- package/dist/hooks/use-coagent.js +148 -67
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +14 -13
- package/dist/hooks/use-copilot-action.js +5 -4
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +4 -3
- package/dist/hooks/use-copilot-additional-instructions.js +1 -1
- 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 +5 -4
- package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
- package/dist/hooks/use-copilot-authenticated-action.mjs +5 -4
- package/dist/hooks/use-copilot-chat.d.ts +1 -1
- package/dist/hooks/use-copilot-chat.js +138 -62
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +13 -12
- package/dist/hooks/use-copilot-readable.js +1 -1
- 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 +5 -2
- package/dist/hooks/use-copilot-runtime-client.js +101 -128
- 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 +1 -1
- 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 +140 -64
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +14 -13
- package/dist/hooks/use-make-copilot-document-readable.js +1 -1
- 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 +913 -480
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -34
- package/dist/lib/copilot-task.d.ts +1 -1
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +11 -10
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +11 -10
- package/dist/types/interrupt-action.d.ts +1 -1
- package/dist/utils/dev-console.d.ts +1 -1
- package/dist/utils/dev-console.js +1 -10
- package/dist/utils/dev-console.js.map +1 -1
- package/dist/utils/dev-console.mjs +1 -1
- package/dist/utils/extract.d.ts +1 -1
- package/dist/utils/extract.js.map +1 -1
- package/dist/utils/extract.mjs +10 -9
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +7 -14
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +12 -11
- package/package.json +3 -3
- package/src/components/copilot-provider/copilot-messages.tsx +163 -4
- package/src/components/copilot-provider/copilotkit-props.tsx +3 -2
- package/src/components/copilot-provider/copilotkit.tsx +8 -2
- package/src/components/error-boundary/error-boundary.tsx +6 -5
- package/src/components/error-boundary/error-utils.tsx +1 -1
- package/src/components/toast/toast-provider.tsx +260 -93
- package/src/components/usage-banner.tsx +311 -131
- package/src/context/copilot-context.tsx +2 -2
- package/src/hooks/use-chat.ts +4 -0
- package/src/hooks/use-coagent-state-render.ts +9 -3
- package/src/hooks/use-coagent.ts +10 -3
- package/src/hooks/use-copilot-runtime-client.ts +153 -12
- package/src/utils/dev-console.ts +2 -17
- package/dist/chunk-22ENANUU.mjs +0 -250
- package/dist/chunk-22ENANUU.mjs.map +0 -1
- package/dist/chunk-2FLZLANO.mjs.map +0 -1
- package/dist/chunk-534J55RX.mjs.map +0 -1
- package/dist/chunk-6PK72HMH.mjs +0 -63
- package/dist/chunk-6PK72HMH.mjs.map +0 -1
- package/dist/chunk-74AJEJTV.mjs.map +0 -1
- package/dist/chunk-B5UA5G3E.mjs.map +0 -1
- package/dist/chunk-BKTARDXX.mjs +0 -40
- package/dist/chunk-BKTARDXX.mjs.map +0 -1
- package/dist/chunk-D34OH4VN.mjs +0 -201
- package/dist/chunk-D34OH4VN.mjs.map +0 -1
- package/dist/chunk-ERFA53MG.mjs.map +0 -1
- package/dist/chunk-MDIIRGJD.mjs.map +0 -1
- package/dist/chunk-MLAS4QUR.mjs +0 -18
- package/dist/chunk-MLAS4QUR.mjs.map +0 -1
- /package/dist/{chunk-2J3SMMGW.mjs.map → chunk-C6F6EQNA.mjs.map} +0 -0
- /package/dist/{chunk-EQ4XLLT4.mjs.map → chunk-LDACFA2B.mjs.map} +0 -0
- /package/dist/{chunk-FGBRHBRR.mjs.map → chunk-LZDDYZEY.mjs.map} +0 -0
- /package/dist/{chunk-WZAEVHLK.mjs.map → chunk-Q5D5XQFA.mjs.map} +0 -0
- /package/dist/{chunk-VQ3VTO26.mjs.map → chunk-UHQMV2CE.mjs.map} +0 -0
- /package/dist/{chunk-4DVPRMVH.mjs.map → chunk-UIT6QMUJ.mjs.map} +0 -0
- /package/dist/{chunk-7HDYPEWS.mjs.map → chunk-YDENFEKA.mjs.map} +0 -0
- /package/dist/{chunk-4VWM6JNK.mjs.map → chunk-YZDRMIOM.mjs.map} +0 -0
|
@@ -55,7 +55,7 @@ __export(error_boundary_exports, {
|
|
|
55
55
|
});
|
|
56
56
|
module.exports = __toCommonJS(error_boundary_exports);
|
|
57
57
|
var import_react3 = __toESM(require("react"));
|
|
58
|
-
var
|
|
58
|
+
var import_shared4 = require("@copilotkit/shared");
|
|
59
59
|
|
|
60
60
|
// src/lib/status-checker.ts
|
|
61
61
|
var import_shared = require("@copilotkit/shared");
|
|
@@ -115,14 +115,14 @@ var StatusChecker = class {
|
|
|
115
115
|
var import_shared2 = require("@copilotkit/shared");
|
|
116
116
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
117
117
|
var defaultIcons = {
|
|
118
|
-
[import_shared2.Severity.
|
|
118
|
+
[import_shared2.Severity.CRITICAL]: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
119
119
|
"svg",
|
|
120
120
|
{
|
|
121
121
|
viewBox: "0 0 24 24",
|
|
122
|
-
width: "
|
|
123
|
-
height: "
|
|
122
|
+
width: "18",
|
|
123
|
+
height: "18",
|
|
124
124
|
stroke: "currentColor",
|
|
125
|
-
strokeWidth: "2",
|
|
125
|
+
strokeWidth: "2.5",
|
|
126
126
|
fill: "none",
|
|
127
127
|
strokeLinecap: "round",
|
|
128
128
|
strokeLinejoin: "round",
|
|
@@ -132,179 +132,337 @@ var defaultIcons = {
|
|
|
132
132
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
|
|
133
133
|
]
|
|
134
134
|
}
|
|
135
|
+
),
|
|
136
|
+
[import_shared2.Severity.WARNING]: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
137
|
+
"svg",
|
|
138
|
+
{
|
|
139
|
+
viewBox: "0 0 24 24",
|
|
140
|
+
width: "18",
|
|
141
|
+
height: "18",
|
|
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: "18",
|
|
159
|
+
height: "18",
|
|
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
|
+
}
|
|
135
171
|
)
|
|
136
172
|
};
|
|
137
173
|
function UsageBanner({
|
|
138
|
-
severity = import_shared2.Severity.
|
|
174
|
+
severity = import_shared2.Severity.CRITICAL,
|
|
139
175
|
message = "",
|
|
140
176
|
icon,
|
|
177
|
+
onClose,
|
|
141
178
|
actions
|
|
142
179
|
}) {
|
|
143
180
|
if (!message || !severity) {
|
|
144
181
|
return null;
|
|
145
182
|
}
|
|
183
|
+
const parseMessage = (rawMessage) => {
|
|
184
|
+
const linkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
|
|
185
|
+
const matches = Array.from(rawMessage.matchAll(linkRegex));
|
|
186
|
+
if (matches.length > 0) {
|
|
187
|
+
let cleanMessage2 = rawMessage.replace(/\.\s*See more:\s*\[([^\]]+)\]\(([^)]+)\)/g, ".").replace(/See more:\s*\[([^\]]+)\]\(([^)]+)\)/g, "").trim();
|
|
188
|
+
return cleanMessage2;
|
|
189
|
+
}
|
|
190
|
+
return rawMessage;
|
|
191
|
+
};
|
|
192
|
+
const cleanMessage = parseMessage(message);
|
|
146
193
|
const Icon = icon || defaultIcons[severity];
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
194
|
+
const themeConfigs = {
|
|
195
|
+
[import_shared2.Severity.INFO]: {
|
|
196
|
+
bg: "linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%)",
|
|
197
|
+
border: "#93c5fd",
|
|
198
|
+
text: "#1e40af",
|
|
199
|
+
icon: "#3b82f6",
|
|
200
|
+
primaryBtn: "#3b82f6",
|
|
201
|
+
primaryBtnHover: "#2563eb"
|
|
202
|
+
},
|
|
203
|
+
[import_shared2.Severity.WARNING]: {
|
|
204
|
+
bg: "linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%)",
|
|
205
|
+
border: "#fbbf24",
|
|
206
|
+
text: "#92400e",
|
|
207
|
+
icon: "#f59e0b",
|
|
208
|
+
primaryBtn: "#f59e0b",
|
|
209
|
+
primaryBtnHover: "#d97706"
|
|
210
|
+
},
|
|
211
|
+
[import_shared2.Severity.CRITICAL]: {
|
|
212
|
+
bg: "linear-gradient(135deg, #fef2f2 0%, #fecaca 100%)",
|
|
213
|
+
border: "#f87171",
|
|
214
|
+
text: "#991b1b",
|
|
215
|
+
icon: "#ef4444",
|
|
216
|
+
primaryBtn: "#ef4444",
|
|
217
|
+
primaryBtnHover: "#dc2626"
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
const themeConfig = themeConfigs[severity] || themeConfigs[import_shared2.Severity.CRITICAL];
|
|
221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
173
222
|
"div",
|
|
174
223
|
{
|
|
175
224
|
style: {
|
|
176
225
|
position: "fixed",
|
|
177
|
-
bottom: "
|
|
226
|
+
bottom: "20px",
|
|
178
227
|
left: "50%",
|
|
179
228
|
transform: "translateX(-50%)",
|
|
180
|
-
maxWidth: "
|
|
181
|
-
|
|
229
|
+
maxWidth: "min(95vw, 680px)",
|
|
230
|
+
width: "100%",
|
|
231
|
+
zIndex: 1e4,
|
|
232
|
+
animation: "bannerSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1)"
|
|
182
233
|
},
|
|
183
|
-
children:
|
|
184
|
-
"
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
"
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
234
|
+
children: [
|
|
235
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: `
|
|
236
|
+
@keyframes bannerSlideIn {
|
|
237
|
+
from {
|
|
238
|
+
opacity: 0;
|
|
239
|
+
transform: translateX(-50%) translateY(10px);
|
|
240
|
+
}
|
|
241
|
+
to {
|
|
242
|
+
opacity: 1;
|
|
243
|
+
transform: translateX(-50%) translateY(0);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
` }),
|
|
247
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
248
|
+
"div",
|
|
249
|
+
{
|
|
250
|
+
style: {
|
|
251
|
+
display: "flex",
|
|
252
|
+
alignItems: "flex-start",
|
|
253
|
+
gap: "14px",
|
|
254
|
+
borderRadius: "16px",
|
|
255
|
+
border: `1px solid ${themeConfig.border}`,
|
|
256
|
+
background: themeConfig.bg,
|
|
257
|
+
padding: "18px 20px",
|
|
258
|
+
boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)",
|
|
259
|
+
position: "relative",
|
|
260
|
+
backdropFilter: "blur(10px)",
|
|
261
|
+
WebkitBackdropFilter: "blur(10px)"
|
|
262
|
+
},
|
|
263
|
+
children: [
|
|
264
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
265
|
+
"button",
|
|
266
|
+
{
|
|
267
|
+
onClick: onClose,
|
|
268
|
+
style: {
|
|
269
|
+
position: "absolute",
|
|
270
|
+
top: "12px",
|
|
271
|
+
right: "12px",
|
|
272
|
+
background: "rgba(255, 255, 255, 0.8)",
|
|
273
|
+
border: "none",
|
|
274
|
+
color: themeConfig.text,
|
|
275
|
+
cursor: "pointer",
|
|
276
|
+
fontSize: "18px",
|
|
277
|
+
lineHeight: "1",
|
|
278
|
+
padding: "6px",
|
|
279
|
+
borderRadius: "8px",
|
|
280
|
+
opacity: 0.7,
|
|
281
|
+
transition: "all 0.2s ease",
|
|
282
|
+
display: "flex",
|
|
283
|
+
alignItems: "center",
|
|
284
|
+
justifyContent: "center",
|
|
285
|
+
width: "28px",
|
|
286
|
+
height: "28px"
|
|
287
|
+
},
|
|
288
|
+
title: "Close",
|
|
289
|
+
onMouseOver: (e) => {
|
|
290
|
+
e.currentTarget.style.opacity = "1";
|
|
291
|
+
e.currentTarget.style.background = "rgba(255, 255, 255, 1)";
|
|
292
|
+
e.currentTarget.style.transform = "scale(1.05)";
|
|
293
|
+
},
|
|
294
|
+
onMouseOut: (e) => {
|
|
295
|
+
e.currentTarget.style.opacity = "0.7";
|
|
296
|
+
e.currentTarget.style.background = "rgba(255, 255, 255, 0.8)";
|
|
297
|
+
e.currentTarget.style.transform = "scale(1)";
|
|
298
|
+
},
|
|
299
|
+
children: "\xD7"
|
|
300
|
+
}
|
|
301
|
+
),
|
|
302
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
303
|
+
"div",
|
|
304
|
+
{
|
|
305
|
+
style: {
|
|
306
|
+
color: themeConfig.icon,
|
|
307
|
+
flexShrink: 0,
|
|
308
|
+
marginTop: "1px",
|
|
309
|
+
padding: "6px",
|
|
310
|
+
borderRadius: "10px",
|
|
311
|
+
background: "rgba(255, 255, 255, 0.7)",
|
|
312
|
+
display: "flex",
|
|
313
|
+
alignItems: "center",
|
|
314
|
+
justifyContent: "center"
|
|
315
|
+
},
|
|
316
|
+
children: Icon
|
|
317
|
+
}
|
|
318
|
+
),
|
|
319
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { flex: 1, paddingRight: onClose ? "40px" : "0" }, children: [
|
|
320
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
321
|
+
"div",
|
|
322
|
+
{
|
|
323
|
+
style: {
|
|
324
|
+
fontSize: "15px",
|
|
325
|
+
fontWeight: 600,
|
|
326
|
+
color: themeConfig.text,
|
|
327
|
+
lineHeight: "1.5",
|
|
328
|
+
marginBottom: actions ? "12px" : "0",
|
|
329
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
330
|
+
},
|
|
331
|
+
children: cleanMessage
|
|
332
|
+
}
|
|
333
|
+
),
|
|
334
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
335
|
+
"div",
|
|
336
|
+
{
|
|
337
|
+
style: {
|
|
338
|
+
display: "flex",
|
|
339
|
+
gap: "10px",
|
|
340
|
+
flexWrap: "wrap"
|
|
341
|
+
},
|
|
342
|
+
children: [
|
|
343
|
+
actions.secondary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
344
|
+
"button",
|
|
345
|
+
{
|
|
346
|
+
onClick: actions.secondary.onClick,
|
|
347
|
+
style: {
|
|
348
|
+
borderRadius: "10px",
|
|
349
|
+
padding: "8px 16px",
|
|
350
|
+
fontSize: "14px",
|
|
351
|
+
fontWeight: 500,
|
|
352
|
+
color: themeConfig.text,
|
|
353
|
+
backgroundColor: "rgba(255, 255, 255, 0.8)",
|
|
354
|
+
border: `1.5px solid ${themeConfig.border}`,
|
|
355
|
+
cursor: "pointer",
|
|
356
|
+
transition: "all 0.2s ease",
|
|
357
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
358
|
+
},
|
|
359
|
+
onMouseOver: (e) => {
|
|
360
|
+
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 1)";
|
|
361
|
+
e.currentTarget.style.transform = "translateY(-1px)";
|
|
362
|
+
e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.15)";
|
|
363
|
+
},
|
|
364
|
+
onMouseOut: (e) => {
|
|
365
|
+
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.8)";
|
|
366
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
367
|
+
e.currentTarget.style.boxShadow = "none";
|
|
368
|
+
},
|
|
369
|
+
children: actions.secondary.label
|
|
370
|
+
}
|
|
371
|
+
),
|
|
372
|
+
actions.primary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
373
|
+
"button",
|
|
374
|
+
{
|
|
375
|
+
onClick: actions.primary.onClick,
|
|
376
|
+
style: {
|
|
377
|
+
borderRadius: "10px",
|
|
378
|
+
padding: "8px 16px",
|
|
379
|
+
fontSize: "14px",
|
|
380
|
+
fontWeight: 600,
|
|
381
|
+
color: "#fff",
|
|
382
|
+
backgroundColor: themeConfig.primaryBtn,
|
|
383
|
+
border: "none",
|
|
384
|
+
cursor: "pointer",
|
|
385
|
+
transition: "all 0.2s ease",
|
|
386
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
|
|
387
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
388
|
+
},
|
|
389
|
+
onMouseOver: (e) => {
|
|
390
|
+
e.currentTarget.style.backgroundColor = themeConfig.primaryBtnHover;
|
|
391
|
+
e.currentTarget.style.transform = "translateY(-1px)";
|
|
392
|
+
e.currentTarget.style.boxShadow = "0 6px 16px rgba(0, 0, 0, 0.2)";
|
|
393
|
+
},
|
|
394
|
+
onMouseOut: (e) => {
|
|
395
|
+
e.currentTarget.style.backgroundColor = themeConfig.primaryBtn;
|
|
396
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
397
|
+
e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.15)";
|
|
398
|
+
},
|
|
399
|
+
children: actions.primary.label
|
|
400
|
+
}
|
|
401
|
+
)
|
|
402
|
+
]
|
|
403
|
+
}
|
|
404
|
+
)
|
|
405
|
+
] })
|
|
406
|
+
]
|
|
407
|
+
}
|
|
408
|
+
)
|
|
409
|
+
]
|
|
268
410
|
}
|
|
269
411
|
);
|
|
270
412
|
}
|
|
271
|
-
function renderCopilotKitUsage(error) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
413
|
+
function renderCopilotKitUsage(error, onClose) {
|
|
414
|
+
if (error.visibility !== import_shared2.ErrorVisibility.BANNER) {
|
|
415
|
+
return null;
|
|
416
|
+
}
|
|
417
|
+
const extractUrlFromMessage = (message) => {
|
|
418
|
+
const linkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
|
|
419
|
+
const match = linkRegex.exec(message);
|
|
420
|
+
return match ? match[2] : null;
|
|
421
|
+
};
|
|
422
|
+
const getErrorActions = (error2) => {
|
|
423
|
+
switch (error2.name) {
|
|
424
|
+
case import_shared2.ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR:
|
|
425
|
+
return {
|
|
426
|
+
primary: {
|
|
427
|
+
label: "Sign In",
|
|
428
|
+
onClick: () => window.location.href = "https://cloud.copilotkit.ai"
|
|
288
429
|
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
430
|
+
};
|
|
431
|
+
case import_shared2.ERROR_NAMES.UPGRADE_REQUIRED_ERROR:
|
|
432
|
+
return {
|
|
433
|
+
primary: {
|
|
434
|
+
label: "Upgrade",
|
|
435
|
+
onClick: () => window.location.href = "https://copilotkit.ai/"
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
case import_shared2.ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR:
|
|
439
|
+
case import_shared2.ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR:
|
|
440
|
+
case import_shared2.ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR:
|
|
441
|
+
return {
|
|
442
|
+
primary: {
|
|
443
|
+
label: "View Docs",
|
|
444
|
+
onClick: () => {
|
|
445
|
+
var _a;
|
|
446
|
+
const urlFromMessage = extractUrlFromMessage(error2.message);
|
|
447
|
+
const urlFromExtensions = (_a = error2.extensions) == null ? void 0 : _a.troubleshootingUrl;
|
|
448
|
+
const url = urlFromMessage || urlFromExtensions || "https://docs.copilotkit.ai/troubleshooting/common-issues";
|
|
449
|
+
window.open(url, "_blank");
|
|
303
450
|
}
|
|
304
451
|
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
|
|
452
|
+
};
|
|
453
|
+
default:
|
|
454
|
+
return void 0;
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
458
|
+
UsageBanner,
|
|
459
|
+
{
|
|
460
|
+
severity: error.severity || import_shared2.Severity.CRITICAL,
|
|
461
|
+
message: error.message,
|
|
462
|
+
onClose,
|
|
463
|
+
actions: getErrorActions(error)
|
|
464
|
+
}
|
|
465
|
+
);
|
|
308
466
|
}
|
|
309
467
|
|
|
310
468
|
// src/components/error-boundary/error-utils.tsx
|
|
@@ -312,6 +470,7 @@ var import_react2 = require("react");
|
|
|
312
470
|
|
|
313
471
|
// src/components/toast/toast-provider.tsx
|
|
314
472
|
var import_react = require("react");
|
|
473
|
+
var import_shared3 = require("@copilotkit/shared");
|
|
315
474
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
316
475
|
var ToastContext = (0, import_react.createContext)(void 0);
|
|
317
476
|
function useToast() {
|
|
@@ -375,7 +534,7 @@ function ErrorToast({ errors }) {
|
|
|
375
534
|
marginBottom: 4
|
|
376
535
|
},
|
|
377
536
|
children: [
|
|
378
|
-
"Copilot
|
|
537
|
+
"Copilot Runtime Error:",
|
|
379
538
|
" ",
|
|
380
539
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontFamily: "monospace", fontWeight: "normal" }, children: code })
|
|
381
540
|
]
|
|
@@ -423,7 +582,6 @@ function useErrorToast() {
|
|
|
423
582
|
}
|
|
424
583
|
|
|
425
584
|
// src/components/error-boundary/error-boundary.tsx
|
|
426
|
-
var import_shared4 = require("@copilotkit/shared");
|
|
427
585
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
428
586
|
var statusChecker = new StatusChecker();
|
|
429
587
|
var CopilotErrorBoundary = class extends import_react3.default.Component {
|
|
@@ -458,9 +616,12 @@ var CopilotErrorBoundary = class extends import_react3.default.Component {
|
|
|
458
616
|
render() {
|
|
459
617
|
var _a, _b;
|
|
460
618
|
if (this.state.hasError) {
|
|
461
|
-
if (this.state.error instanceof
|
|
462
|
-
if (
|
|
463
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ErrorToast2, { error: this.state.error, children: renderCopilotKitUsage(
|
|
619
|
+
if (this.state.error instanceof import_shared4.CopilotKitError) {
|
|
620
|
+
if (this.state.error.visibility === import_shared4.ErrorVisibility.BANNER) {
|
|
621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ErrorToast2, { error: this.state.error, children: renderCopilotKitUsage(
|
|
622
|
+
this.state.error,
|
|
623
|
+
() => this.setState({ hasError: false, error: void 0 })
|
|
624
|
+
) });
|
|
464
625
|
}
|
|
465
626
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
466
627
|
this.props.children,
|