@copilotkit/react-core 0.0.0-fix-error-surfacing-prod-20251007135841 → 0.0.0-fix-allow-action-wrapper-disable-20251007143856
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 +4 -5
- package/dist/{chunk-E3624YDU.mjs → chunk-2TLKKHCN.mjs} +2 -2
- package/dist/{chunk-EDBI5PCJ.mjs → chunk-55UOFCC4.mjs} +2 -2
- package/dist/{chunk-OT5NHMEC.mjs → chunk-GFCDU2YP.mjs} +2 -2
- package/dist/{chunk-YH6JKJML.mjs → chunk-KT3BEAIO.mjs} +1 -1
- package/dist/chunk-KT3BEAIO.mjs.map +1 -0
- package/dist/{chunk-33OKWHPL.mjs → chunk-M7TN7DDX.mjs} +2 -2
- package/dist/chunk-M7TN7DDX.mjs.map +1 -0
- package/dist/{chunk-GGLAHG3I.mjs → chunk-P6KEB6HU.mjs} +5 -5
- package/dist/{chunk-6ESSSQ7Q.mjs → chunk-Q3MCVRO3.mjs} +21 -8
- package/dist/chunk-Q3MCVRO3.mjs.map +1 -0
- package/dist/{chunk-MIXSWZSB.mjs → chunk-QATHZ5U6.mjs} +2 -2
- package/dist/{chunk-OAGAFMUM.mjs → chunk-SU2G5I76.mjs} +2 -2
- package/dist/{chunk-CV2PDTC7.mjs → chunk-V6DILK7X.mjs} +2 -2
- package/dist/chunk-V6DILK7X.mjs.map +1 -0
- package/dist/{chunk-BXXJQ2BL.mjs → chunk-VCYV4GLO.mjs} +3 -3
- package/dist/{chunk-NSBAWITG.mjs → chunk-VXXDWHQ2.mjs} +3 -3
- package/dist/components/copilot-provider/copilotkit.js +17 -7
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +3 -3
- package/dist/components/copilot-provider/index.js +17 -7
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +3 -3
- package/dist/components/index.js +17 -7
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +3 -3
- package/dist/hooks/index.js +34 -9
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +12 -12
- package/dist/hooks/use-chat.js +32 -7
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +3 -2
- package/dist/hooks/use-coagent.js +32 -7
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +6 -6
- package/dist/hooks/use-copilot-chat-headless_c.js +32 -7
- package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
- package/dist/hooks/use-copilot-chat-headless_c.mjs +6 -6
- package/dist/hooks/use-copilot-chat.js +32 -7
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +6 -6
- package/dist/hooks/use-copilot-chat_internal.js +32 -7
- package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
- package/dist/hooks/use-copilot-chat_internal.mjs +5 -5
- package/dist/hooks/use-copilot-runtime-client.js +32 -7
- package/dist/hooks/use-copilot-runtime-client.js.map +1 -1
- package/dist/hooks/use-copilot-runtime-client.mjs +2 -1
- package/dist/hooks/use-frontend-tool.d.ts +4 -1
- package/dist/hooks/use-frontend-tool.js.map +1 -1
- package/dist/hooks/use-frontend-tool.mjs +1 -1
- package/dist/hooks/use-human-in-the-loop.d.ts +4 -2
- package/dist/hooks/use-human-in-the-loop.js +1 -1
- package/dist/hooks/use-human-in-the-loop.js.map +1 -1
- package/dist/hooks/use-human-in-the-loop.mjs +1 -1
- package/dist/hooks/use-langgraph-interrupt.js +32 -7
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +6 -6
- package/dist/hooks/use-render-tool-call.d.ts +4 -1
- package/dist/hooks/use-render-tool-call.js +1 -1
- package/dist/hooks/use-render-tool-call.js.map +1 -1
- package/dist/hooks/use-render-tool-call.mjs +1 -1
- package/dist/index.js +19 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -15
- package/dist/lib/copilot-task.mjs +4 -4
- package/dist/lib/index.mjs +4 -4
- package/dist/utils/extract.mjs +3 -3
- package/dist/utils/index.mjs +5 -5
- package/dist/utils/suggestions.mjs +3 -3
- package/package.json +5 -5
- package/src/hooks/use-copilot-runtime-client.ts +21 -10
- package/src/hooks/use-frontend-tool.ts +8 -4
- package/src/hooks/use-human-in-the-loop.ts +7 -4
- package/src/hooks/use-render-tool-call.ts +7 -3
- package/dist/chunk-33OKWHPL.mjs.map +0 -1
- package/dist/chunk-6ESSSQ7Q.mjs.map +0 -1
- package/dist/chunk-CV2PDTC7.mjs.map +0 -1
- package/dist/chunk-YH6JKJML.mjs.map +0 -1
- /package/dist/{chunk-E3624YDU.mjs.map → chunk-2TLKKHCN.mjs.map} +0 -0
- /package/dist/{chunk-EDBI5PCJ.mjs.map → chunk-55UOFCC4.mjs.map} +0 -0
- /package/dist/{chunk-OT5NHMEC.mjs.map → chunk-GFCDU2YP.mjs.map} +0 -0
- /package/dist/{chunk-GGLAHG3I.mjs.map → chunk-P6KEB6HU.mjs.map} +0 -0
- /package/dist/{chunk-MIXSWZSB.mjs.map → chunk-QATHZ5U6.mjs.map} +0 -0
- /package/dist/{chunk-OAGAFMUM.mjs.map → chunk-SU2G5I76.mjs.map} +0 -0
- /package/dist/{chunk-BXXJQ2BL.mjs.map → chunk-VCYV4GLO.mjs.map} +0 -0
- /package/dist/{chunk-NSBAWITG.mjs.map → chunk-VXXDWHQ2.mjs.map} +0 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotKit,
|
|
3
3
|
defaultCopilotContextCategories
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-P6KEB6HU.mjs";
|
|
5
5
|
import "../chunk-DXEQPN43.mjs";
|
|
6
6
|
import "../chunk-OKCYPO4I.mjs";
|
|
7
7
|
import "../chunk-PIF5KJYI.mjs";
|
|
8
8
|
import "../chunk-N4VN2B5S.mjs";
|
|
9
9
|
import "../chunk-2IDV5OHF.mjs";
|
|
10
10
|
import "../chunk-C6IANC2R.mjs";
|
|
11
|
-
import "../chunk-ICIK2BSB.mjs";
|
|
12
11
|
import "../chunk-RKTVJRK7.mjs";
|
|
13
12
|
import "../chunk-PMAFHQ7P.mjs";
|
|
14
13
|
import "../chunk-5FHSUKQL.mjs";
|
|
15
|
-
import "../chunk-
|
|
14
|
+
import "../chunk-Q3MCVRO3.mjs";
|
|
15
|
+
import "../chunk-ICIK2BSB.mjs";
|
|
16
16
|
import "../chunk-N4WEHORG.mjs";
|
|
17
17
|
import "../chunk-O7ARI5CV.mjs";
|
|
18
18
|
import "../chunk-EFL5OBKN.mjs";
|
package/dist/hooks/index.js
CHANGED
|
@@ -274,6 +274,21 @@ function useToast() {
|
|
|
274
274
|
// src/hooks/use-copilot-runtime-client.ts
|
|
275
275
|
var import_react4 = require("react");
|
|
276
276
|
var import_shared3 = require("@copilotkit/shared");
|
|
277
|
+
|
|
278
|
+
// src/utils/dev-console.ts
|
|
279
|
+
function isLocalhost() {
|
|
280
|
+
if (typeof window === "undefined")
|
|
281
|
+
return false;
|
|
282
|
+
return window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname === "0.0.0.0";
|
|
283
|
+
}
|
|
284
|
+
function shouldShowDevConsole(showDevConsole) {
|
|
285
|
+
if (showDevConsole !== void 0) {
|
|
286
|
+
return showDevConsole;
|
|
287
|
+
}
|
|
288
|
+
return isLocalhost();
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// src/hooks/use-copilot-runtime-client.ts
|
|
277
292
|
var useCopilotRuntimeClient = (options) => {
|
|
278
293
|
const { setBannerError } = useToast();
|
|
279
294
|
const _a = options, { showDevConsole, onError } = _a, runtimeOptions = __objRest(_a, ["showDevConsole", "onError"]);
|
|
@@ -312,10 +327,15 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
312
327
|
const routeError = (gqlError) => {
|
|
313
328
|
const extensions = gqlError.extensions;
|
|
314
329
|
const visibility = extensions == null ? void 0 : extensions.visibility;
|
|
330
|
+
const isDev = shouldShowDevConsole(showDevConsole != null ? showDevConsole : false);
|
|
315
331
|
if (visibility === import_shared3.ErrorVisibility.SILENT) {
|
|
316
332
|
console.error("CopilotKit Silent Error:", gqlError.message);
|
|
317
333
|
return;
|
|
318
334
|
}
|
|
335
|
+
if (!isDev) {
|
|
336
|
+
console.error("CopilotKit Error (hidden in production):", gqlError.message);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
319
339
|
const now = Date.now();
|
|
320
340
|
const errorMessage = gqlError.message;
|
|
321
341
|
if (lastStructuredErrorRef.current && lastStructuredErrorRef.current.message === errorMessage && now - lastStructuredErrorRef.current.timestamp < 150) {
|
|
@@ -337,12 +357,17 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
337
357
|
};
|
|
338
358
|
graphQLErrors.forEach(routeError);
|
|
339
359
|
} else {
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
|
|
360
|
+
const isDev = shouldShowDevConsole(showDevConsole != null ? showDevConsole : false);
|
|
361
|
+
if (!isDev) {
|
|
362
|
+
console.error("CopilotKit Error (hidden in production):", error);
|
|
363
|
+
} else {
|
|
364
|
+
const fallbackError = new import_shared3.CopilotKitError({
|
|
365
|
+
message: (error == null ? void 0 : error.message) || String(error),
|
|
366
|
+
code: import_shared3.CopilotKitErrorCode.UNKNOWN
|
|
367
|
+
});
|
|
368
|
+
setBannerError(fallbackError);
|
|
369
|
+
traceUIError(fallbackError, error);
|
|
370
|
+
}
|
|
346
371
|
}
|
|
347
372
|
},
|
|
348
373
|
handleGQLWarning: (message) => {
|
|
@@ -354,7 +379,7 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
354
379
|
setBannerError(warningError);
|
|
355
380
|
}
|
|
356
381
|
}));
|
|
357
|
-
}, [runtimeOptions, setBannerError, onError]);
|
|
382
|
+
}, [runtimeOptions, setBannerError, showDevConsole, onError]);
|
|
358
383
|
return runtimeClient;
|
|
359
384
|
};
|
|
360
385
|
function createStructuredError(gqlError) {
|
|
@@ -2459,7 +2484,7 @@ function useHumanInTheLoop(tool, dependencies) {
|
|
|
2459
2484
|
const _a = tool, { render } = _a, toolRest = __objRest(_a, ["render"]);
|
|
2460
2485
|
useCopilotAction(
|
|
2461
2486
|
__spreadProps(__spreadValues({}, toolRest), {
|
|
2462
|
-
available: "remote",
|
|
2487
|
+
available: tool.available ? tool.available : "remote",
|
|
2463
2488
|
renderAndWaitForResponse: render
|
|
2464
2489
|
}),
|
|
2465
2490
|
dependencies
|
|
@@ -2470,7 +2495,7 @@ function useHumanInTheLoop(tool, dependencies) {
|
|
|
2470
2495
|
function useRenderToolCall(tool, dependencies) {
|
|
2471
2496
|
useCopilotAction(
|
|
2472
2497
|
__spreadProps(__spreadValues({}, tool), {
|
|
2473
|
-
available: "frontend"
|
|
2498
|
+
available: tool.available ? tool.available : "frontend"
|
|
2474
2499
|
}),
|
|
2475
2500
|
dependencies
|
|
2476
2501
|
);
|