@copilotkit/react-core 0.0.0-fix-error-surfacing-prod-20251006214656 → 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 -3
- package/dist/{chunk-YH4YWCG3.mjs → chunk-2TLKKHCN.mjs} +2 -2
- package/dist/{chunk-7UPUN5NS.mjs → chunk-55UOFCC4.mjs} +2 -2
- package/dist/{chunk-JBO3OMXT.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-GXIE5DCC.mjs → chunk-P6KEB6HU.mjs} +5 -5
- package/dist/{chunk-52WOP34K.mjs → chunk-Q3MCVRO3.mjs} +20 -7
- package/dist/chunk-Q3MCVRO3.mjs.map +1 -0
- package/dist/{chunk-2RW7YL4Z.mjs → chunk-QATHZ5U6.mjs} +2 -2
- package/dist/{chunk-UD5ZZNOQ.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-X7DY7TBT.mjs → chunk-VCYV4GLO.mjs} +3 -3
- package/dist/{chunk-TPQPHC2X.mjs → chunk-VXXDWHQ2.mjs} +3 -3
- package/dist/components/copilot-provider/copilotkit.js +16 -6
- 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 +16 -6
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +3 -3
- package/dist/components/index.js +16 -6
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +3 -3
- package/dist/hooks/index.js +33 -8
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +12 -12
- package/dist/hooks/use-chat.js +31 -6
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +3 -2
- package/dist/hooks/use-coagent.js +31 -6
- 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 +31 -6
- 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 +31 -6
- 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 +31 -6
- 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 +31 -6
- 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 +31 -6
- 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 +18 -8
- 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 +20 -9
- 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-52WOP34K.mjs.map +0 -1
- package/dist/chunk-CV2PDTC7.mjs.map +0 -1
- package/dist/chunk-YH6JKJML.mjs.map +0 -1
- /package/dist/{chunk-YH4YWCG3.mjs.map → chunk-2TLKKHCN.mjs.map} +0 -0
- /package/dist/{chunk-7UPUN5NS.mjs.map → chunk-55UOFCC4.mjs.map} +0 -0
- /package/dist/{chunk-JBO3OMXT.mjs.map → chunk-GFCDU2YP.mjs.map} +0 -0
- /package/dist/{chunk-GXIE5DCC.mjs.map → chunk-P6KEB6HU.mjs.map} +0 -0
- /package/dist/{chunk-2RW7YL4Z.mjs.map → chunk-QATHZ5U6.mjs.map} +0 -0
- /package/dist/{chunk-UD5ZZNOQ.mjs.map → chunk-SU2G5I76.mjs.map} +0 -0
- /package/dist/{chunk-X7DY7TBT.mjs.map → chunk-VCYV4GLO.mjs.map} +0 -0
- /package/dist/{chunk-TPQPHC2X.mjs.map → chunk-VXXDWHQ2.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# ui
|
|
2
2
|
|
|
3
|
-
## 0.0.0-fix-
|
|
3
|
+
## 0.0.0-fix-allow-action-wrapper-disable-20251007143856
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
+
- dedbd2f: - fix: allow disabling actions in the new action hooks
|
|
7
8
|
- c9e499f: - feat: create targeted convenience wrappers around copilot action
|
|
8
|
-
- @copilotkit/runtime-client-gql@0.0.0-fix-
|
|
9
|
-
- @copilotkit/shared@0.0.0-fix-
|
|
9
|
+
- @copilotkit/runtime-client-gql@0.0.0-fix-allow-action-wrapper-disable-20251007143856
|
|
10
|
+
- @copilotkit/shared@0.0.0-fix-allow-action-wrapper-disable-20251007143856
|
|
10
11
|
|
|
11
12
|
## 1.10.6-next.1
|
|
12
13
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCopilotChat
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VXXDWHQ2.mjs";
|
|
4
4
|
|
|
5
5
|
// src/hooks/use-copilot-chat.ts
|
|
6
6
|
function useCopilotChat2(options = {}) {
|
|
@@ -31,4 +31,4 @@ function useCopilotChat2(options = {}) {
|
|
|
31
31
|
export {
|
|
32
32
|
useCopilotChat2 as useCopilotChat
|
|
33
33
|
};
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-2TLKKHCN.mjs.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-4CEQJ2X6.mjs";
|
|
4
4
|
import {
|
|
5
5
|
defaultCopilotContextCategories
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-P6KEB6HU.mjs";
|
|
7
7
|
import {
|
|
8
8
|
__async,
|
|
9
9
|
__spreadValues
|
|
@@ -117,4 +117,4 @@ ${instructions}
|
|
|
117
117
|
export {
|
|
118
118
|
CopilotTask
|
|
119
119
|
};
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
120
|
+
//# sourceMappingURL=chunk-55UOFCC4.mjs.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-4CEQJ2X6.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useCopilotRuntimeClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-Q3MCVRO3.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useAsyncCallback,
|
|
9
9
|
useErrorToast
|
|
@@ -720,4 +720,4 @@ function getPairedFeAction(actions, message) {
|
|
|
720
720
|
export {
|
|
721
721
|
useChat
|
|
722
722
|
};
|
|
723
|
-
//# sourceMappingURL=chunk-
|
|
723
|
+
//# sourceMappingURL=chunk-GFCDU2YP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/use-frontend-tool.ts"],"sourcesContent":["import { useCopilotAction } from \"./use-copilot-action\";\nimport { FrontendAction } from \"../types/frontend-action\";\nimport { Parameter } from \"@copilotkit/shared\";\n\ntype UseToolCallArgs<T extends Parameter[] | [] = []> = {\n available?: \"disabled\" | undefined;\n} & Pick<\n FrontendAction<T>,\n \"name\" | \"description\" | \"parameters\" | \"handler\" | \"followUp\" | \"render\"\n>;\n\nexport function useFrontendTool<const T extends Parameter[] | [] = []>(\n tool: UseToolCallArgs<T>,\n dependencies?: any[],\n) {\n // Use the existing useCopilotAction hook\n useCopilotAction<T>(tool, dependencies);\n}\n"],"mappings":";;;;;AAWO,SAAS,gBACd,MACA,cACA;AAEA,mBAAoB,MAAM,YAAY;AACxC;","names":[]}
|
|
@@ -12,7 +12,7 @@ function useHumanInTheLoop(tool, dependencies) {
|
|
|
12
12
|
const _a = tool, { render } = _a, toolRest = __objRest(_a, ["render"]);
|
|
13
13
|
useCopilotAction(
|
|
14
14
|
__spreadProps(__spreadValues({}, toolRest), {
|
|
15
|
-
available: "remote",
|
|
15
|
+
available: tool.available ? tool.available : "remote",
|
|
16
16
|
renderAndWaitForResponse: render
|
|
17
17
|
}),
|
|
18
18
|
dependencies
|
|
@@ -22,4 +22,4 @@ function useHumanInTheLoop(tool, dependencies) {
|
|
|
22
22
|
export {
|
|
23
23
|
useHumanInTheLoop
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-M7TN7DDX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/use-human-in-the-loop.ts"],"sourcesContent":["import { useCopilotAction } from \"./use-copilot-action\";\nimport { FrontendAction } from \"../types\";\nimport { Parameter } from \"@copilotkit/shared\";\n\ntype UseToolCallArgs<T extends Parameter[] | [] = []> = {\n available?: \"disabled\" | undefined;\n render: FrontendAction<T>[\"renderAndWaitForResponse\"];\n} & Pick<FrontendAction<T>, \"name\" | \"description\" | \"parameters\">;\n\nexport function useHumanInTheLoop<const T extends Parameter[] | [] = []>(\n tool: UseToolCallArgs<T>,\n dependencies?: any[],\n) {\n const { render, ...toolRest } = tool;\n\n useCopilotAction(\n {\n ...toolRest,\n available: tool.available ? tool.available : \"remote\",\n renderAndWaitForResponse: render,\n },\n dependencies,\n );\n}\n"],"mappings":";;;;;;;;;;AASO,SAAS,kBACd,MACA,cACA;AACA,QAAgC,WAAxB,SAbV,IAakC,IAAb,qBAAa,IAAb,CAAX;AAER;AAAA,IACE,iCACK,WADL;AAAA,MAEE,WAAW,KAAK,YAAY,KAAK,YAAY;AAAA,MAC7C,0BAA0B;AAAA,IAC5B;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -8,9 +8,6 @@ import {
|
|
|
8
8
|
CopilotMessages,
|
|
9
9
|
MessagesTapProvider
|
|
10
10
|
} from "./chunk-C6IANC2R.mjs";
|
|
11
|
-
import {
|
|
12
|
-
shouldShowDevConsole
|
|
13
|
-
} from "./chunk-ICIK2BSB.mjs";
|
|
14
11
|
import {
|
|
15
12
|
use_tree_default
|
|
16
13
|
} from "./chunk-RKTVJRK7.mjs";
|
|
@@ -19,7 +16,10 @@ import {
|
|
|
19
16
|
} from "./chunk-5FHSUKQL.mjs";
|
|
20
17
|
import {
|
|
21
18
|
useCopilotRuntimeClient
|
|
22
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-Q3MCVRO3.mjs";
|
|
20
|
+
import {
|
|
21
|
+
shouldShowDevConsole
|
|
22
|
+
} from "./chunk-ICIK2BSB.mjs";
|
|
23
23
|
import {
|
|
24
24
|
ToastProvider
|
|
25
25
|
} from "./chunk-EFL5OBKN.mjs";
|
|
@@ -801,4 +801,4 @@ export {
|
|
|
801
801
|
CopilotKitInternal,
|
|
802
802
|
defaultCopilotContextCategories
|
|
803
803
|
};
|
|
804
|
-
//# sourceMappingURL=chunk-
|
|
804
|
+
//# sourceMappingURL=chunk-P6KEB6HU.mjs.map
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
shouldShowDevConsole
|
|
3
|
+
} from "./chunk-ICIK2BSB.mjs";
|
|
1
4
|
import {
|
|
2
5
|
useToast
|
|
3
6
|
} from "./chunk-EFL5OBKN.mjs";
|
|
@@ -59,10 +62,15 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
59
62
|
const routeError = (gqlError) => {
|
|
60
63
|
const extensions = gqlError.extensions;
|
|
61
64
|
const visibility = extensions == null ? void 0 : extensions.visibility;
|
|
65
|
+
const isDev = shouldShowDevConsole(showDevConsole != null ? showDevConsole : false);
|
|
62
66
|
if (visibility === ErrorVisibility.SILENT) {
|
|
63
67
|
console.error("CopilotKit Silent Error:", gqlError.message);
|
|
64
68
|
return;
|
|
65
69
|
}
|
|
70
|
+
if (!isDev) {
|
|
71
|
+
console.error("CopilotKit Error (hidden in production):", gqlError.message);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
66
74
|
const now = Date.now();
|
|
67
75
|
const errorMessage = gqlError.message;
|
|
68
76
|
if (lastStructuredErrorRef.current && lastStructuredErrorRef.current.message === errorMessage && now - lastStructuredErrorRef.current.timestamp < 150) {
|
|
@@ -84,12 +92,17 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
84
92
|
};
|
|
85
93
|
graphQLErrors.forEach(routeError);
|
|
86
94
|
} else {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
const isDev = shouldShowDevConsole(showDevConsole != null ? showDevConsole : false);
|
|
96
|
+
if (!isDev) {
|
|
97
|
+
console.error("CopilotKit Error (hidden in production):", error);
|
|
98
|
+
} else {
|
|
99
|
+
const fallbackError = new CopilotKitError({
|
|
100
|
+
message: (error == null ? void 0 : error.message) || String(error),
|
|
101
|
+
code: CopilotKitErrorCode.UNKNOWN
|
|
102
|
+
});
|
|
103
|
+
setBannerError(fallbackError);
|
|
104
|
+
traceUIError(fallbackError, error);
|
|
105
|
+
}
|
|
93
106
|
}
|
|
94
107
|
},
|
|
95
108
|
handleGQLWarning: (message) => {
|
|
@@ -131,4 +144,4 @@ function createStructuredError(gqlError) {
|
|
|
131
144
|
export {
|
|
132
145
|
useCopilotRuntimeClient
|
|
133
146
|
};
|
|
134
|
-
//# sourceMappingURL=chunk-
|
|
147
|
+
//# sourceMappingURL=chunk-Q3MCVRO3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/use-copilot-runtime-client.ts"],"sourcesContent":["import {\n CopilotRuntimeClient,\n CopilotRuntimeClientOptions,\n GraphQLError,\n} from \"@copilotkit/runtime-client-gql\";\nimport { useToast } from \"../components/toast/toast-provider\";\nimport { useMemo, useRef } from \"react\";\nimport {\n ErrorVisibility,\n CopilotKitApiDiscoveryError,\n CopilotKitRemoteEndpointDiscoveryError,\n CopilotKitAgentDiscoveryError,\n CopilotKitError,\n CopilotKitErrorCode,\n CopilotErrorHandler,\n CopilotErrorEvent,\n} from \"@copilotkit/shared\";\nimport { shouldShowDevConsole } from \"../utils/dev-console\";\n\nexport interface CopilotRuntimeClientHookOptions extends CopilotRuntimeClientOptions {\n showDevConsole?: boolean;\n onError: CopilotErrorHandler;\n}\n\nexport const useCopilotRuntimeClient = (options: CopilotRuntimeClientHookOptions) => {\n const { setBannerError } = useToast();\n const { showDevConsole, onError, ...runtimeOptions } = options;\n\n // Deduplication state for structured errors\n const lastStructuredErrorRef = useRef<{ message: string; timestamp: number } | null>(null);\n\n // Helper function to trace UI errors\n const traceUIError = async (error: CopilotKitError, originalError?: any) => {\n try {\n const errorEvent: CopilotErrorEvent = {\n type: \"error\",\n timestamp: Date.now(),\n context: {\n source: \"ui\",\n request: {\n operation: \"runtimeClient\",\n url: runtimeOptions.url,\n startTime: Date.now(),\n },\n technical: {\n environment: \"browser\",\n userAgent: typeof navigator !== \"undefined\" ? navigator.userAgent : undefined,\n stackTrace: originalError instanceof Error ? originalError.stack : undefined,\n },\n },\n error,\n };\n await onError(errorEvent);\n } catch (error) {\n console.error(\"Error in onError handler:\", error);\n }\n };\n\n const runtimeClient = useMemo(() => {\n return new CopilotRuntimeClient({\n ...runtimeOptions,\n handleGQLErrors: (error) => {\n if ((error as any).graphQLErrors?.length) {\n const graphQLErrors = (error as any).graphQLErrors as GraphQLError[];\n\n // Route all errors to banners for consistent UI\n const routeError = (gqlError: GraphQLError) => {\n const extensions = gqlError.extensions;\n const visibility = extensions?.visibility as ErrorVisibility;\n const isDev = shouldShowDevConsole(showDevConsole ?? false);\n\n // Silent errors - just log\n if (visibility === ErrorVisibility.SILENT) {\n console.error(\"CopilotKit Silent Error:\", gqlError.message);\n return;\n }\n\n if (!isDev) {\n console.error(\"CopilotKit Error (hidden in production):\", gqlError.message);\n return;\n }\n\n // All errors (including DEV_ONLY) show as banners for consistency\n // Deduplicate to prevent spam\n const now = Date.now();\n const errorMessage = gqlError.message;\n if (\n lastStructuredErrorRef.current &&\n lastStructuredErrorRef.current.message === errorMessage &&\n now - lastStructuredErrorRef.current.timestamp < 150\n ) {\n return; // Skip duplicate\n }\n lastStructuredErrorRef.current = { message: errorMessage, timestamp: now };\n\n const ckError = createStructuredError(gqlError);\n if (ckError) {\n setBannerError(ckError);\n // Trace the error\n traceUIError(ckError, gqlError);\n // TODO: if onError & renderError should work without key, insert here\n } else {\n // Fallback for unstructured errors\n const fallbackError = new CopilotKitError({\n message: gqlError.message,\n code: CopilotKitErrorCode.UNKNOWN,\n });\n setBannerError(fallbackError);\n // Trace the fallback error\n traceUIError(fallbackError, gqlError);\n // TODO: if onError & renderError should work without key, insert here\n }\n };\n\n // Process all errors as banners\n graphQLErrors.forEach(routeError);\n } else {\n const isDev = shouldShowDevConsole(showDevConsole ?? false);\n if (!isDev) {\n console.error(\"CopilotKit Error (hidden in production):\", error);\n } else {\n // Route non-GraphQL errors to banner as well\n const fallbackError = new CopilotKitError({\n message: error?.message || String(error),\n code: CopilotKitErrorCode.UNKNOWN,\n });\n setBannerError(fallbackError);\n // Trace the non-GraphQL error\n traceUIError(fallbackError, error);\n // TODO: if onError & renderError should work without key, insert here\n }\n }\n },\n handleGQLWarning: (message: string) => {\n console.warn(message);\n // Show warnings as banners too for consistency\n const warningError = new CopilotKitError({\n message,\n code: CopilotKitErrorCode.UNKNOWN,\n });\n setBannerError(warningError);\n },\n });\n }, [runtimeOptions, setBannerError, showDevConsole, onError]);\n\n return runtimeClient;\n};\n\n// Create appropriate structured error from GraphQL error\nfunction createStructuredError(gqlError: GraphQLError): CopilotKitError | null {\n const extensions = gqlError.extensions;\n const originalError = extensions?.originalError as any;\n const message = originalError?.message || gqlError.message;\n const code = extensions?.code as CopilotKitErrorCode;\n\n if (code) {\n return new CopilotKitError({ message, code });\n }\n\n // Legacy error detection by stack trace\n if (originalError?.stack?.includes(\"CopilotApiDiscoveryError\")) {\n return new CopilotKitApiDiscoveryError({ message });\n }\n if (originalError?.stack?.includes(\"CopilotKitRemoteEndpointDiscoveryError\")) {\n return new CopilotKitRemoteEndpointDiscoveryError({ message });\n }\n if (originalError?.stack?.includes(\"CopilotKitAgentDiscoveryError\")) {\n return new CopilotKitAgentDiscoveryError({\n agentName: \"\",\n availableAgents: [],\n });\n }\n\n return null;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA,EACE;AAAA,OAGK;AAEP,SAAS,SAAS,cAAc;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAQA,IAAM,0BA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B,yCAAY;AAClC,QAAM,WAAU,+CAAe,YAAW,SAAS;AACnD,QAAM,OAAO,yCAAY;AAEzB,MAAI,MAAM;AACR,WAAO,IAAI,gBAAgB,EAAE,SAAS,KAAK,CAAC;AAAA,EAC9C;AAGA,OAAI,oDAAe,UAAf,mBAAsB,SAAS,6BAA6B;AAC9D,WAAO,IAAI,4BAA4B,EAAE,QAAQ,CAAC;AAAA,EACpD;AACA,OAAI,oDAAe,UAAf,mBAAsB,SAAS,2CAA2C;AAC5E,WAAO,IAAI,uCAAuC,EAAE,QAAQ,CAAC;AAAA,EAC/D;AACA,OAAI,oDAAe,UAAf,mBAAsB,SAAS,kCAAkC;AACnE,WAAO,IAAI,8BAA8B;AAAA,MACvC,WAAW;AAAA,MACX,iBAAiB,CAAC;AAAA,IACpB,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":["error","_a"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCopilotChat
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VXXDWHQ2.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useToast
|
|
6
6
|
} from "./chunk-EFL5OBKN.mjs";
|
|
@@ -68,4 +68,4 @@ function useLangGraphInterrupt(action, dependencies) {
|
|
|
68
68
|
export {
|
|
69
69
|
useLangGraphInterrupt
|
|
70
70
|
};
|
|
71
|
-
//# sourceMappingURL=chunk-
|
|
71
|
+
//# sourceMappingURL=chunk-QATHZ5U6.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCopilotChat
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VXXDWHQ2.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useCopilotContext
|
|
6
6
|
} from "./chunk-EUX2P2E7.mjs";
|
|
@@ -82,4 +82,4 @@ function useCopilotChatHeadless_c(options = {}) {
|
|
|
82
82
|
export {
|
|
83
83
|
useCopilotChatHeadless_c
|
|
84
84
|
};
|
|
85
|
-
//# sourceMappingURL=chunk-
|
|
85
|
+
//# sourceMappingURL=chunk-SU2G5I76.mjs.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
function useRenderToolCall(tool, dependencies) {
|
|
11
11
|
useCopilotAction(
|
|
12
12
|
__spreadProps(__spreadValues({}, tool), {
|
|
13
|
-
available: "frontend"
|
|
13
|
+
available: tool.available ? tool.available : "frontend"
|
|
14
14
|
}),
|
|
15
15
|
dependencies
|
|
16
16
|
);
|
|
@@ -19,4 +19,4 @@ function useRenderToolCall(tool, dependencies) {
|
|
|
19
19
|
export {
|
|
20
20
|
useRenderToolCall
|
|
21
21
|
};
|
|
22
|
-
//# sourceMappingURL=chunk-
|
|
22
|
+
//# sourceMappingURL=chunk-V6DILK7X.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/use-render-tool-call.ts"],"sourcesContent":["import { useCopilotAction } from \"./use-copilot-action\";\nimport { FrontendAction, FrontendActionAvailability } from \"../types\";\nimport { Parameter } from \"@copilotkit/shared\";\n\ntype UseToolCallArgs<T extends Parameter[] | [] = []> = {\n available?: \"disabled\" | undefined;\n} & Pick<FrontendAction<T>, \"name\" | \"description\" | \"parameters\" | \"render\">;\n\nexport function useRenderToolCall<const T extends Parameter[] | [] = []>(\n tool: UseToolCallArgs<T>,\n dependencies?: any[],\n) {\n useCopilotAction<T>(\n {\n ...tool,\n available: tool.available ? tool.available : \"frontend\",\n },\n dependencies,\n );\n}\n"],"mappings":";;;;;;;;;AAQO,SAAS,kBACd,MACA,cACA;AACA;AAAA,IACE,iCACK,OADL;AAAA,MAEE,WAAW,KAAK,YAAY,KAAK,YAAY;AAAA,IAC/C;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCopilotChat
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VXXDWHQ2.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useMessagesTap
|
|
6
6
|
} from "./chunk-C6IANC2R.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useCopilotRuntimeClient
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Q3MCVRO3.mjs";
|
|
10
10
|
import {
|
|
11
11
|
useAsyncCallback
|
|
12
12
|
} from "./chunk-N4WEHORG.mjs";
|
|
@@ -236,4 +236,4 @@ export {
|
|
|
236
236
|
stopAgent,
|
|
237
237
|
runAgent
|
|
238
238
|
};
|
|
239
|
-
//# sourceMappingURL=chunk-
|
|
239
|
+
//# sourceMappingURL=chunk-VCYV4GLO.mjs.map
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
} from "./chunk-ZVOLWJCY.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useChat
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GFCDU2YP.mjs";
|
|
7
7
|
import {
|
|
8
8
|
defaultCopilotContextCategories,
|
|
9
9
|
reloadSuggestions
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-P6KEB6HU.mjs";
|
|
11
11
|
import {
|
|
12
12
|
useAsyncCallback
|
|
13
13
|
} from "./chunk-N4WEHORG.mjs";
|
|
@@ -329,4 +329,4 @@ export {
|
|
|
329
329
|
useCopilotChat,
|
|
330
330
|
defaultSystemMessage
|
|
331
331
|
};
|
|
332
|
-
//# sourceMappingURL=chunk-
|
|
332
|
+
//# sourceMappingURL=chunk-VXXDWHQ2.mjs.map
|
|
@@ -1153,10 +1153,15 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
1153
1153
|
const routeError = (gqlError) => {
|
|
1154
1154
|
const extensions = gqlError.extensions;
|
|
1155
1155
|
const visibility = extensions == null ? void 0 : extensions.visibility;
|
|
1156
|
+
const isDev = shouldShowDevConsole(showDevConsole != null ? showDevConsole : false);
|
|
1156
1157
|
if (visibility === import_shared6.ErrorVisibility.SILENT) {
|
|
1157
1158
|
console.error("CopilotKit Silent Error:", gqlError.message);
|
|
1158
1159
|
return;
|
|
1159
1160
|
}
|
|
1161
|
+
if (!isDev) {
|
|
1162
|
+
console.error("CopilotKit Error (hidden in production):", gqlError.message);
|
|
1163
|
+
return;
|
|
1164
|
+
}
|
|
1160
1165
|
const now = Date.now();
|
|
1161
1166
|
const errorMessage = gqlError.message;
|
|
1162
1167
|
if (lastStructuredErrorRef.current && lastStructuredErrorRef.current.message === errorMessage && now - lastStructuredErrorRef.current.timestamp < 150) {
|
|
@@ -1178,12 +1183,17 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
1178
1183
|
};
|
|
1179
1184
|
graphQLErrors.forEach(routeError);
|
|
1180
1185
|
} else {
|
|
1181
|
-
const
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
|
|
1186
|
+
const isDev = shouldShowDevConsole(showDevConsole != null ? showDevConsole : false);
|
|
1187
|
+
if (!isDev) {
|
|
1188
|
+
console.error("CopilotKit Error (hidden in production):", error);
|
|
1189
|
+
} else {
|
|
1190
|
+
const fallbackError = new import_shared6.CopilotKitError({
|
|
1191
|
+
message: (error == null ? void 0 : error.message) || String(error),
|
|
1192
|
+
code: import_shared6.CopilotKitErrorCode.UNKNOWN
|
|
1193
|
+
});
|
|
1194
|
+
setBannerError(fallbackError);
|
|
1195
|
+
traceUIError(fallbackError, error);
|
|
1196
|
+
}
|
|
1187
1197
|
}
|
|
1188
1198
|
},
|
|
1189
1199
|
handleGQLWarning: (message) => {
|