@copilotkit/react-core 1.10.4-next.0 → 1.10.4-next.2
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-BKODPOZI.mjs → chunk-2MGJO3FY.mjs} +7 -7
- package/dist/{chunk-DLEXVOQE.mjs → chunk-2QZSAQTX.mjs} +4 -4
- package/dist/{chunk-6EKLRL7B.mjs → chunk-36FJAVOF.mjs} +2 -2
- package/dist/{chunk-TQGWN4FE.mjs → chunk-5KVEE73R.mjs} +4 -4
- package/dist/{chunk-SAWWZBE3.mjs → chunk-6WTWBXEJ.mjs} +56 -15
- package/dist/chunk-6WTWBXEJ.mjs.map +1 -0
- package/dist/{chunk-KOGKA4V5.mjs → chunk-AALETENN.mjs} +3 -3
- package/dist/{chunk-B6ZYKFIA.mjs → chunk-CLAHAV6J.mjs} +10 -10
- package/dist/{chunk-CLMDRYEN.mjs → chunk-CXDK6XA5.mjs} +2 -2
- package/dist/{chunk-QXSEHCPY.mjs → chunk-DSDAZA3B.mjs} +4 -4
- package/dist/{chunk-PI7BDJ6G.mjs → chunk-EBSAU46C.mjs} +5 -5
- package/dist/{chunk-W7W43PPC.mjs → chunk-HWM2Z3J3.mjs} +2 -2
- package/dist/{chunk-FG3FWUVW.mjs → chunk-ID5JRMGN.mjs} +3 -3
- package/dist/{chunk-X2DNXTME.mjs → chunk-JEMBA7PE.mjs} +4 -4
- package/dist/{chunk-JJDXTTEN.mjs → chunk-KWS75AOU.mjs} +3 -3
- package/dist/{chunk-V5PU37CB.mjs → chunk-LLLCUHOO.mjs} +9 -10
- package/dist/chunk-LLLCUHOO.mjs.map +1 -0
- package/dist/{chunk-3RHHNUVV.mjs → chunk-MZ37BAAE.mjs} +2 -2
- package/dist/{chunk-L3I57GMV.mjs → chunk-N4VN2B5S.mjs} +4 -4
- package/dist/{chunk-FAUNHSQU.mjs → chunk-Q3MCVRO3.mjs} +1 -3
- package/dist/chunk-Q3MCVRO3.mjs.map +1 -0
- package/dist/{chunk-IN7GE4NO.mjs → chunk-QF3Q5LUN.mjs} +2 -2
- package/dist/{chunk-2DXYQG42.mjs → chunk-QNJNOZH3.mjs} +12 -11
- package/dist/chunk-QNJNOZH3.mjs.map +1 -0
- package/dist/{chunk-TEMLWRRT.mjs → chunk-YHT6CWIY.mjs} +8 -2
- package/dist/{chunk-TEMLWRRT.mjs.map → chunk-YHT6CWIY.mjs.map} +1 -1
- package/dist/components/copilot-provider/copilot-messages.js +7 -1
- package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
- package/dist/components/copilot-provider/copilot-messages.mjs +3 -3
- package/dist/components/copilot-provider/copilotkit-props.d.ts +1 -1
- package/dist/components/copilot-provider/copilotkit.d.ts +1 -1
- package/dist/components/copilot-provider/copilotkit.js +51 -6
- 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 -1
- package/dist/components/copilot-provider/index.js +51 -6
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +10 -10
- package/dist/components/dev-console/console-trigger.js +7 -1
- package/dist/components/dev-console/console-trigger.js.map +1 -1
- package/dist/components/dev-console/console-trigger.mjs +3 -3
- package/dist/components/dev-console/developer-console-modal.js +7 -1
- package/dist/components/dev-console/developer-console-modal.js.map +1 -1
- package/dist/components/dev-console/developer-console-modal.mjs +2 -2
- package/dist/components/error-boundary/error-boundary.mjs +2 -2
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +51 -6
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +10 -10
- package/dist/context/copilot-context.d.ts +1 -1
- package/dist/context/copilot-context.js +7 -1
- 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 +2 -2
- package/dist/context/index.d.ts +2 -2
- package/dist/context/index.js +7 -1
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +4 -4
- package/dist/{copilot-context-256f9020.d.ts → copilot-context-59740e82.d.ts} +4 -1
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +12 -8
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +35 -35
- package/dist/hooks/use-chat.d.ts +1 -1
- package/dist/hooks/use-chat.js +9 -6
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +4 -4
- package/dist/hooks/use-coagent-state-render.js +7 -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 +12 -8
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +16 -16
- package/dist/hooks/use-copilot-action.js +7 -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 +7 -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 +7 -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-headless_c.d.ts +2 -2
- package/dist/hooks/use-copilot-chat-headless_c.js +9 -6
- package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
- package/dist/hooks/use-copilot-chat-headless_c.mjs +16 -16
- package/dist/hooks/use-copilot-chat.d.ts +2 -2
- package/dist/hooks/use-copilot-chat.js +9 -6
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +16 -16
- package/dist/hooks/use-copilot-chat_internal.d.ts +2 -2
- package/dist/hooks/use-copilot-chat_internal.js +9 -6
- package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
- package/dist/hooks/use-copilot-chat_internal.mjs +15 -15
- package/dist/hooks/use-copilot-readable.js +7 -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 +1 -1
- package/dist/hooks/use-copilot-runtime-client.js +0 -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 +7 -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 +9 -6
- 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 +7 -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-08c43df1.d.ts → index-d1743abe.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +56 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -40
- package/dist/lib/copilot-task.d.ts +1 -1
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +12 -12
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +12 -12
- package/dist/types/interrupt-action.d.ts +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 +2 -2
- 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/copilotkit.tsx +55 -2
- package/src/context/copilot-context.tsx +11 -2
- package/src/hooks/use-chat.ts +3 -3
- package/src/hooks/use-coagent.ts +2 -1
- package/src/hooks/use-copilot-runtime-client.ts +4 -4
- package/dist/chunk-2DXYQG42.mjs.map +0 -1
- package/dist/chunk-FAUNHSQU.mjs.map +0 -1
- package/dist/chunk-SAWWZBE3.mjs.map +0 -1
- package/dist/chunk-V5PU37CB.mjs.map +0 -1
- /package/dist/{chunk-BKODPOZI.mjs.map → chunk-2MGJO3FY.mjs.map} +0 -0
- /package/dist/{chunk-DLEXVOQE.mjs.map → chunk-2QZSAQTX.mjs.map} +0 -0
- /package/dist/{chunk-6EKLRL7B.mjs.map → chunk-36FJAVOF.mjs.map} +0 -0
- /package/dist/{chunk-TQGWN4FE.mjs.map → chunk-5KVEE73R.mjs.map} +0 -0
- /package/dist/{chunk-KOGKA4V5.mjs.map → chunk-AALETENN.mjs.map} +0 -0
- /package/dist/{chunk-B6ZYKFIA.mjs.map → chunk-CLAHAV6J.mjs.map} +0 -0
- /package/dist/{chunk-CLMDRYEN.mjs.map → chunk-CXDK6XA5.mjs.map} +0 -0
- /package/dist/{chunk-QXSEHCPY.mjs.map → chunk-DSDAZA3B.mjs.map} +0 -0
- /package/dist/{chunk-PI7BDJ6G.mjs.map → chunk-EBSAU46C.mjs.map} +0 -0
- /package/dist/{chunk-W7W43PPC.mjs.map → chunk-HWM2Z3J3.mjs.map} +0 -0
- /package/dist/{chunk-FG3FWUVW.mjs.map → chunk-ID5JRMGN.mjs.map} +0 -0
- /package/dist/{chunk-X2DNXTME.mjs.map → chunk-JEMBA7PE.mjs.map} +0 -0
- /package/dist/{chunk-JJDXTTEN.mjs.map → chunk-KWS75AOU.mjs.map} +0 -0
- /package/dist/{chunk-3RHHNUVV.mjs.map → chunk-MZ37BAAE.mjs.map} +0 -0
- /package/dist/{chunk-L3I57GMV.mjs.map → chunk-N4VN2B5S.mjs.map} +0 -0
- /package/dist/{chunk-IN7GE4NO.mjs.map → chunk-QF3Q5LUN.mjs.map} +0 -0
package/dist/components/index.js
CHANGED
|
@@ -162,9 +162,15 @@ var emptyCopilotContext = {
|
|
|
162
162
|
langGraphInterruptAction: null,
|
|
163
163
|
setLangGraphInterruptAction: () => null,
|
|
164
164
|
removeLangGraphInterruptAction: () => null,
|
|
165
|
-
onError:
|
|
165
|
+
onError: () => {
|
|
166
|
+
},
|
|
166
167
|
bannerError: null,
|
|
167
168
|
setBannerError: () => {
|
|
169
|
+
},
|
|
170
|
+
internalErrorHandlers: {},
|
|
171
|
+
setInternalErrorHandler: () => {
|
|
172
|
+
},
|
|
173
|
+
removeInternalErrorHandler: () => {
|
|
168
174
|
}
|
|
169
175
|
};
|
|
170
176
|
var CopilotContext = import_react.default.createContext(emptyCopilotContext);
|
|
@@ -1113,8 +1119,6 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
1113
1119
|
const _a = options, { showDevConsole, onError } = _a, runtimeOptions = __objRest(_a, ["showDevConsole", "onError"]);
|
|
1114
1120
|
const lastStructuredErrorRef = (0, import_react7.useRef)(null);
|
|
1115
1121
|
const traceUIError = (error, originalError) => __async(void 0, null, function* () {
|
|
1116
|
-
if (!onError || !runtimeOptions.publicApiKey)
|
|
1117
|
-
return;
|
|
1118
1122
|
try {
|
|
1119
1123
|
const errorEvent = {
|
|
1120
1124
|
type: "error",
|
|
@@ -2460,13 +2464,51 @@ ${nonDocumentStrings}`;
|
|
|
2460
2464
|
}, {});
|
|
2461
2465
|
return __spreadValues(__spreadValues(__spreadValues({}, copilotApiConfig.headers || {}), copilotApiConfig.publicApiKey ? { [import_shared10.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: copilotApiConfig.publicApiKey } : {}), authHeaders);
|
|
2462
2466
|
}, [copilotApiConfig.headers, copilotApiConfig.publicApiKey, authStates]);
|
|
2467
|
+
const [internalErrorHandlers, _setInternalErrorHandler] = (0, import_react11.useState)({});
|
|
2468
|
+
const setInternalErrorHandler = (0, import_react11.useCallback)((handler) => {
|
|
2469
|
+
_setInternalErrorHandler((prev) => __spreadValues(__spreadValues({}, prev), handler));
|
|
2470
|
+
}, []);
|
|
2471
|
+
const removeInternalErrorHandler = (0, import_react11.useCallback)((key) => {
|
|
2472
|
+
_setInternalErrorHandler((prev) => {
|
|
2473
|
+
const _a2 = prev, { [key]: _removed } = _a2, rest = __objRest(_a2, [__restKey(key)]);
|
|
2474
|
+
return rest;
|
|
2475
|
+
});
|
|
2476
|
+
}, []);
|
|
2477
|
+
const onErrorRef = (0, import_react11.useRef)(props.onError);
|
|
2478
|
+
(0, import_react11.useEffect)(() => {
|
|
2479
|
+
onErrorRef.current = props.onError;
|
|
2480
|
+
}, [props.onError]);
|
|
2481
|
+
const internalHandlersRef = (0, import_react11.useRef)({});
|
|
2482
|
+
(0, import_react11.useEffect)(() => {
|
|
2483
|
+
internalHandlersRef.current = internalErrorHandlers;
|
|
2484
|
+
}, [internalErrorHandlers]);
|
|
2485
|
+
const handleErrors = (0, import_react11.useCallback)(
|
|
2486
|
+
(error) => __async(this, null, function* () {
|
|
2487
|
+
if (copilotApiConfig.publicApiKey && onErrorRef.current) {
|
|
2488
|
+
try {
|
|
2489
|
+
yield onErrorRef.current(error);
|
|
2490
|
+
} catch (e) {
|
|
2491
|
+
console.error("Error in public onError handler:", e);
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
const handlers = Object.values(internalHandlersRef.current);
|
|
2495
|
+
yield Promise.all(
|
|
2496
|
+
handlers.map(
|
|
2497
|
+
(h) => Promise.resolve(h(error)).catch(
|
|
2498
|
+
(e) => console.error("Error in internal error handler:", e)
|
|
2499
|
+
)
|
|
2500
|
+
)
|
|
2501
|
+
);
|
|
2502
|
+
}),
|
|
2503
|
+
[copilotApiConfig.publicApiKey]
|
|
2504
|
+
);
|
|
2463
2505
|
const runtimeClient = useCopilotRuntimeClient({
|
|
2464
2506
|
url: copilotApiConfig.chatApiEndpoint,
|
|
2465
2507
|
publicApiKey,
|
|
2466
2508
|
headers,
|
|
2467
2509
|
credentials: copilotApiConfig.credentials,
|
|
2468
2510
|
showDevConsole: shouldShowDevConsole(props.showDevConsole),
|
|
2469
|
-
onError:
|
|
2511
|
+
onError: handleErrors
|
|
2470
2512
|
});
|
|
2471
2513
|
const [chatSuggestionConfiguration, setChatSuggestionConfiguration] = (0, import_react11.useState)({});
|
|
2472
2514
|
const addChatSuggestionConfiguration = (0, import_react11.useCallback)(
|
|
@@ -2652,9 +2694,12 @@ ${nonDocumentStrings}`;
|
|
|
2652
2694
|
langGraphInterruptAction,
|
|
2653
2695
|
setLangGraphInterruptAction,
|
|
2654
2696
|
removeLangGraphInterruptAction,
|
|
2655
|
-
onError: props.onError,
|
|
2656
2697
|
bannerError,
|
|
2657
|
-
setBannerError
|
|
2698
|
+
setBannerError,
|
|
2699
|
+
onError: handleErrors,
|
|
2700
|
+
internalErrorHandlers,
|
|
2701
|
+
setInternalErrorHandler,
|
|
2702
|
+
removeInternalErrorHandler
|
|
2658
2703
|
},
|
|
2659
2704
|
children: [
|
|
2660
2705
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MessagesTapProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(CopilotMessages, { children: [
|