@copilotkit/react-core 1.9.2-next.3 → 1.9.2-next.4
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 +12 -0
- package/dist/{chunk-PUNALT2S.mjs → chunk-7G6RR4HE.mjs} +2 -2
- package/dist/{chunk-Q5D5XQFA.mjs → chunk-CMQV4XNY.mjs} +2 -2
- package/dist/{chunk-UHQMV2CE.mjs → chunk-ERXWDCY6.mjs} +2 -2
- package/dist/{chunk-C3SYYVMR.mjs → chunk-I4JPQECN.mjs} +4 -4
- package/dist/{chunk-RUY6MLHA.mjs → chunk-ISYBUDL4.mjs} +34 -3
- package/dist/chunk-ISYBUDL4.mjs.map +1 -0
- package/dist/{chunk-T42PN5VN.mjs → chunk-JHIZ5HAI.mjs} +2 -2
- package/dist/{chunk-C6F6EQNA.mjs → chunk-JPMIAGI6.mjs} +2 -2
- package/dist/{chunk-HJP2RX5R.mjs → chunk-JXF732XG.mjs} +3 -3
- package/dist/{chunk-3XXVDQ7Z.mjs → chunk-RN3ZRHI7.mjs} +8 -6
- package/dist/chunk-RN3ZRHI7.mjs.map +1 -0
- package/dist/{chunk-LDACFA2B.mjs → chunk-S4BOATBG.mjs} +3 -3
- package/dist/{chunk-2FW7HH6W.mjs → chunk-T4ZKC4X4.mjs} +2 -2
- package/dist/{chunk-LZDDYZEY.mjs → chunk-UBNRUXEK.mjs} +2 -2
- package/dist/{chunk-2XSUXRGG.mjs → chunk-VF6UPRKM.mjs} +3 -3
- package/dist/{chunk-QRGDQSGZ.mjs → chunk-VJCHRQ7Q.mjs} +2 -2
- package/dist/{chunk-6KGEF242.mjs → chunk-XFOTNHYA.mjs} +3 -2
- package/dist/chunk-XFOTNHYA.mjs.map +1 -0
- package/dist/{chunk-IVXB3GYK.mjs → chunk-ZHEEHGLS.mjs} +4 -4
- package/dist/components/copilot-provider/copilot-messages.js +2 -1
- package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
- package/dist/components/copilot-provider/copilot-messages.mjs +2 -2
- package/dist/components/copilot-provider/copilotkit-props.d.ts +21 -2
- 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 +38 -5
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +4 -4
- package/dist/components/copilot-provider/index.d.ts +1 -1
- package/dist/components/copilot-provider/index.js +38 -5
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +4 -4
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +38 -5
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +4 -4
- package/dist/context/copilot-context.d.ts +1 -1
- package/dist/context/copilot-context.js +2 -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 +2 -1
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/{copilot-context-f9b2b4c3.d.ts → copilot-context-3da805ab.d.ts} +5 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +34 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +15 -15
- package/dist/hooks/use-chat.d.ts +1 -1
- package/dist/hooks/use-chat.js +34 -3
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +3 -3
- package/dist/hooks/use-coagent-state-render.js +2 -1
- package/dist/hooks/use-coagent-state-render.js.map +1 -1
- package/dist/hooks/use-coagent-state-render.mjs +2 -2
- package/dist/hooks/use-coagent.d.ts +1 -1
- package/dist/hooks/use-coagent.js +34 -3
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +7 -7
- package/dist/hooks/use-copilot-action.js +2 -1
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +2 -2
- package/dist/hooks/use-copilot-additional-instructions.js +2 -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 +2 -1
- package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
- package/dist/hooks/use-copilot-authenticated-action.mjs +3 -3
- package/dist/hooks/use-copilot-chat.d.ts +1 -1
- package/dist/hooks/use-copilot-chat.js +34 -3
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +6 -6
- package/dist/hooks/use-copilot-readable.js +2 -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 +2 -0
- package/dist/hooks/use-copilot-runtime-client.js +52 -2
- package/dist/hooks/use-copilot-runtime-client.js.map +1 -1
- package/dist/hooks/use-copilot-runtime-client.mjs +1 -1
- package/dist/hooks/use-langgraph-interrupt-render.js +2 -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 +34 -3
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +7 -7
- package/dist/hooks/use-make-copilot-document-readable.js +2 -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 +38 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -16
- package/dist/lib/copilot-task.d.ts +1 -1
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +5 -5
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +5 -5
- package/dist/types/interrupt-action.d.ts +1 -1
- package/dist/utils/extract.d.ts +1 -1
- package/dist/utils/extract.js.map +1 -1
- package/dist/utils/extract.mjs +4 -4
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +4 -4
- package/package.json +5 -5
- package/src/components/copilot-provider/__tests__/copilotkit-trace.test.tsx +74 -0
- package/src/components/copilot-provider/copilotkit-props.tsx +21 -0
- package/src/components/copilot-provider/copilotkit.tsx +2 -0
- package/src/context/copilot-context.tsx +7 -1
- package/src/hooks/use-copilot-runtime-client.ts +41 -2
- package/tsup.config.ts +6 -6
- package/dist/chunk-3XXVDQ7Z.mjs.map +0 -1
- package/dist/chunk-6KGEF242.mjs.map +0 -1
- package/dist/chunk-RUY6MLHA.mjs.map +0 -1
- package/dist/utils/utils.test.d.ts +0 -2
- package/dist/utils/utils.test.js +0 -9
- package/dist/utils/utils.test.js.map +0 -1
- package/dist/utils/utils.test.mjs +0 -7
- package/dist/utils/utils.test.mjs.map +0 -1
- /package/dist/{chunk-PUNALT2S.mjs.map → chunk-7G6RR4HE.mjs.map} +0 -0
- /package/dist/{chunk-Q5D5XQFA.mjs.map → chunk-CMQV4XNY.mjs.map} +0 -0
- /package/dist/{chunk-UHQMV2CE.mjs.map → chunk-ERXWDCY6.mjs.map} +0 -0
- /package/dist/{chunk-C3SYYVMR.mjs.map → chunk-I4JPQECN.mjs.map} +0 -0
- /package/dist/{chunk-T42PN5VN.mjs.map → chunk-JHIZ5HAI.mjs.map} +0 -0
- /package/dist/{chunk-C6F6EQNA.mjs.map → chunk-JPMIAGI6.mjs.map} +0 -0
- /package/dist/{chunk-HJP2RX5R.mjs.map → chunk-JXF732XG.mjs.map} +0 -0
- /package/dist/{chunk-LDACFA2B.mjs.map → chunk-S4BOATBG.mjs.map} +0 -0
- /package/dist/{chunk-2FW7HH6W.mjs.map → chunk-T4ZKC4X4.mjs.map} +0 -0
- /package/dist/{chunk-LZDDYZEY.mjs.map → chunk-UBNRUXEK.mjs.map} +0 -0
- /package/dist/{chunk-2XSUXRGG.mjs.map → chunk-VF6UPRKM.mjs.map} +0 -0
- /package/dist/{chunk-QRGDQSGZ.mjs.map → chunk-VJCHRQ7Q.mjs.map} +0 -0
- /package/dist/{chunk-IVXB3GYK.mjs.map → chunk-ZHEEHGLS.mjs.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotKit,
|
|
3
3
|
defaultCopilotContextCategories
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-RN3ZRHI7.mjs";
|
|
5
5
|
import "../../chunk-QQZLIEXK.mjs";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-VJCHRQ7Q.mjs";
|
|
7
7
|
import "../../chunk-5FHSUKQL.mjs";
|
|
8
8
|
import "../../chunk-RKTVJRK7.mjs";
|
|
9
9
|
import "../../chunk-PMAFHQ7P.mjs";
|
|
@@ -11,10 +11,10 @@ import "../../chunk-HD2GE3DK.mjs";
|
|
|
11
11
|
import "../../chunk-DCTJZ742.mjs";
|
|
12
12
|
import "../../chunk-CCESTGAM.mjs";
|
|
13
13
|
import "../../chunk-O7ARI5CV.mjs";
|
|
14
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-ISYBUDL4.mjs";
|
|
15
15
|
import "../../chunk-GFJW4RIM.mjs";
|
|
16
16
|
import "../../chunk-VRXANACV.mjs";
|
|
17
|
-
import "../../chunk-
|
|
17
|
+
import "../../chunk-XFOTNHYA.mjs";
|
|
18
18
|
import "../../chunk-SKC7AJIV.mjs";
|
|
19
19
|
export {
|
|
20
20
|
CopilotKit,
|
|
@@ -3,7 +3,7 @@ export { CopilotKitProps } from './copilot-provider/copilotkit-props.js';
|
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import '@copilotkit/runtime-client-gql';
|
|
5
5
|
import 'react';
|
|
6
|
-
import '../copilot-context-
|
|
6
|
+
import '../copilot-context-3da805ab.js';
|
|
7
7
|
import '@copilotkit/shared';
|
|
8
8
|
import '../types/frontend-action.js';
|
|
9
9
|
import '../hooks/use-tree.js';
|
package/dist/components/index.js
CHANGED
|
@@ -161,7 +161,8 @@ var emptyCopilotContext = {
|
|
|
161
161
|
},
|
|
162
162
|
langGraphInterruptAction: null,
|
|
163
163
|
setLangGraphInterruptAction: () => null,
|
|
164
|
-
removeLangGraphInterruptAction: () => null
|
|
164
|
+
removeLangGraphInterruptAction: () => null,
|
|
165
|
+
onTrace: void 0
|
|
165
166
|
};
|
|
166
167
|
var CopilotContext = import_react.default.createContext(emptyCopilotContext);
|
|
167
168
|
function useCopilotContext() {
|
|
@@ -795,8 +796,35 @@ var import_react7 = require("react");
|
|
|
795
796
|
var import_shared5 = require("@copilotkit/shared");
|
|
796
797
|
var useCopilotRuntimeClient = (options) => {
|
|
797
798
|
const { setBannerError } = useToast();
|
|
798
|
-
const _a = options, { showDevConsole } = _a, runtimeOptions = __objRest(_a, ["showDevConsole"]);
|
|
799
|
+
const _a = options, { showDevConsole, onTrace } = _a, runtimeOptions = __objRest(_a, ["showDevConsole", "onTrace"]);
|
|
799
800
|
const lastStructuredErrorRef = (0, import_react7.useRef)(null);
|
|
801
|
+
const traceUIError = (error, originalError) => __async(void 0, null, function* () {
|
|
802
|
+
if (!onTrace || !runtimeOptions.publicApiKey)
|
|
803
|
+
return;
|
|
804
|
+
try {
|
|
805
|
+
const traceEvent = {
|
|
806
|
+
type: "error",
|
|
807
|
+
timestamp: Date.now(),
|
|
808
|
+
context: {
|
|
809
|
+
source: "ui",
|
|
810
|
+
request: {
|
|
811
|
+
operation: "runtimeClient",
|
|
812
|
+
url: runtimeOptions.url,
|
|
813
|
+
startTime: Date.now()
|
|
814
|
+
},
|
|
815
|
+
technical: {
|
|
816
|
+
environment: process.env.NODE_ENV,
|
|
817
|
+
userAgent: typeof navigator !== "undefined" ? navigator.userAgent : void 0,
|
|
818
|
+
stackTrace: originalError instanceof Error ? originalError.stack : void 0
|
|
819
|
+
}
|
|
820
|
+
},
|
|
821
|
+
error
|
|
822
|
+
};
|
|
823
|
+
yield onTrace(traceEvent);
|
|
824
|
+
} catch (traceError) {
|
|
825
|
+
console.error("Error in onTrace handler:", traceError);
|
|
826
|
+
}
|
|
827
|
+
});
|
|
800
828
|
const runtimeClient = (0, import_react7.useMemo)(() => {
|
|
801
829
|
return new import_runtime_client_gql2.CopilotRuntimeClient(__spreadProps(__spreadValues({}, runtimeOptions), {
|
|
802
830
|
handleGQLErrors: (error) => {
|
|
@@ -824,12 +852,14 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
824
852
|
const ckError = createStructuredError(gqlError);
|
|
825
853
|
if (ckError) {
|
|
826
854
|
setBannerError(ckError);
|
|
855
|
+
traceUIError(ckError, gqlError);
|
|
827
856
|
} else {
|
|
828
857
|
const fallbackError = new import_shared5.CopilotKitError({
|
|
829
858
|
message: gqlError.message,
|
|
830
859
|
code: import_shared5.CopilotKitErrorCode.UNKNOWN
|
|
831
860
|
});
|
|
832
861
|
setBannerError(fallbackError);
|
|
862
|
+
traceUIError(fallbackError, gqlError);
|
|
833
863
|
}
|
|
834
864
|
};
|
|
835
865
|
graphQLErrors.forEach(routeError);
|
|
@@ -843,6 +873,7 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
843
873
|
code: import_shared5.CopilotKitErrorCode.UNKNOWN
|
|
844
874
|
});
|
|
845
875
|
setBannerError(fallbackError);
|
|
876
|
+
traceUIError(fallbackError, error);
|
|
846
877
|
}
|
|
847
878
|
}
|
|
848
879
|
},
|
|
@@ -855,7 +886,7 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
855
886
|
setBannerError(warningError);
|
|
856
887
|
}
|
|
857
888
|
}));
|
|
858
|
-
}, [runtimeOptions, setBannerError, showDevConsole]);
|
|
889
|
+
}, [runtimeOptions, setBannerError, showDevConsole, onTrace]);
|
|
859
890
|
return runtimeClient;
|
|
860
891
|
};
|
|
861
892
|
function createStructuredError(gqlError) {
|
|
@@ -1635,7 +1666,8 @@ ${nonDocumentStrings}`;
|
|
|
1635
1666
|
publicApiKey: copilotApiConfig.publicApiKey,
|
|
1636
1667
|
headers,
|
|
1637
1668
|
credentials: copilotApiConfig.credentials,
|
|
1638
|
-
showDevConsole: (_b = props.showDevConsole) != null ? _b : false
|
|
1669
|
+
showDevConsole: (_b = props.showDevConsole) != null ? _b : false,
|
|
1670
|
+
onTrace: props.onTrace
|
|
1639
1671
|
});
|
|
1640
1672
|
const [chatSuggestionConfiguration, setChatSuggestionConfiguration] = (0, import_react10.useState)({});
|
|
1641
1673
|
const addChatSuggestionConfiguration = (id, suggestion) => {
|
|
@@ -1778,7 +1810,8 @@ ${nonDocumentStrings}`;
|
|
|
1778
1810
|
setExtensions,
|
|
1779
1811
|
langGraphInterruptAction,
|
|
1780
1812
|
setLangGraphInterruptAction,
|
|
1781
|
-
removeLangGraphInterruptAction
|
|
1813
|
+
removeLangGraphInterruptAction,
|
|
1814
|
+
onTrace: props.onTrace
|
|
1782
1815
|
},
|
|
1783
1816
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CopilotMessages, { children: memoizedChildren })
|
|
1784
1817
|
}
|