@copilotkit/react-core 1.50.0-beta.2 → 1.50.0-beta.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 +33 -0
- package/dist/{chunk-BPJ6V4YX.mjs → chunk-4HRUQH6U.mjs} +2 -2
- package/dist/{chunk-7BYHZLPL.mjs → chunk-4RRMC7L2.mjs} +4 -4
- package/dist/chunk-4RRMC7L2.mjs.map +1 -0
- package/dist/{chunk-D3QSYDJR.mjs → chunk-7IBF6RBW.mjs} +2 -2
- package/dist/{chunk-OVYFRPSN.mjs → chunk-ABWT4DRT.mjs} +2 -2
- package/dist/{chunk-WVLHXIFP.mjs → chunk-AFNWX62Q.mjs} +2 -2
- package/dist/{chunk-WVLHXIFP.mjs.map → chunk-AFNWX62Q.mjs.map} +1 -1
- package/dist/{chunk-LD3MGPZB.mjs → chunk-HE22TZMF.mjs} +2 -2
- package/dist/{chunk-EHXVGFWN.mjs → chunk-OX2QTNTD.mjs} +3 -3
- package/dist/{chunk-LHKZJ2ND.mjs → chunk-PMWUKW3Z.mjs} +3 -3
- package/dist/{chunk-OAEX7G5G.mjs → chunk-PQPWQ6GH.mjs} +2 -2
- package/dist/{chunk-TGIWTM6S.mjs → chunk-QNUAXSDP.mjs} +2 -2
- package/dist/{chunk-TGIWTM6S.mjs.map → chunk-QNUAXSDP.mjs.map} +1 -1
- package/dist/{chunk-ISNVEPPQ.mjs → chunk-VV56AVPB.mjs} +17 -7
- package/dist/chunk-VV56AVPB.mjs.map +1 -0
- package/dist/{chunk-6SK26J65.mjs → chunk-Y2L7KDVW.mjs} +2 -2
- package/dist/{chunk-WMJVBMUX.mjs → chunk-YCG6SNAU.mjs} +2 -2
- package/dist/{chunk-BR5YEYZJ.mjs → chunk-YTQHRJUA.mjs} +2 -2
- package/dist/{chunk-6F7Q6CPI.mjs → chunk-ZCV3A2FP.mjs} +4 -4
- package/dist/{chunk-SD7TUPQM.mjs → chunk-ZU6ZBX4E.mjs} +32 -37
- package/dist/chunk-ZU6ZBX4E.mjs.map +1 -0
- package/dist/components/copilot-provider/copilot-messages.js +1 -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 +1 -1
- package/dist/components/copilot-provider/copilotkit.d.ts +1 -1
- package/dist/components/copilot-provider/copilotkit.js +26 -31
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +7 -7
- package/dist/components/copilot-provider/index.d.ts +1 -1
- package/dist/components/copilot-provider/index.js +26 -31
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +7 -7
- package/dist/components/dev-console/console-trigger.js +1 -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 +1 -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/index.d.ts +1 -1
- package/dist/components/index.js +26 -31
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +7 -7
- 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-81022020.d.ts → copilot-context-ec77e921.d.ts} +2 -2
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +19 -9
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +11 -11
- package/dist/hooks/use-coagent-state-render-bridge.js +1 -1
- package/dist/hooks/use-coagent-state-render-bridge.js.map +1 -1
- package/dist/hooks/use-coagent-state-render-bridge.mjs +2 -2
- package/dist/hooks/use-coagent-state-render.js +1 -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-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 +1 -1
- package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
- package/dist/hooks/use-copilot-authenticated-action.mjs +2 -2
- package/dist/hooks/use-copilot-chat-headless_c.js +17 -7
- package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
- package/dist/hooks/use-copilot-chat-headless_c.mjs +5 -5
- package/dist/hooks/use-copilot-chat.js +17 -7
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +5 -5
- package/dist/hooks/use-copilot-chat_internal.js +17 -7
- package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
- package/dist/hooks/use-copilot-chat_internal.mjs +4 -4
- package/dist/hooks/use-langgraph-interrupt-render.js +16 -6
- 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 +3 -3
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +2 -2
- 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 +43 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -17
- package/dist/lib/copilot-task.d.ts +1 -1
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +8 -8
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +8 -8
- package/dist/types/index.d.ts +1 -1
- package/dist/types/interrupt-action.d.ts +1 -1
- package/dist/types/interrupt-action.js.map +1 -1
- package/dist/v2/index.css +4 -0
- package/dist/v2/index.css.map +1 -0
- package/dist/v2/index.js.map +1 -1
- package/dist/v2/index.mjs +2 -0
- package/dist/v2/index.mjs.map +1 -1
- package/package.json +10 -8
- package/src/components/copilot-provider/copilotkit.tsx +30 -30
- package/src/context/copilot-context.tsx +2 -2
- package/src/hooks/use-coagent-state-render-bridge.tsx +2 -2
- package/src/hooks/use-langgraph-interrupt-render.ts +15 -5
- package/src/hooks/use-langgraph-interrupt.ts +2 -3
- package/src/types/interrupt-action.ts +1 -4
- package/src/v2/index.ts +2 -0
- package/tsup.config.ts +1 -1
- package/dist/chunk-7BYHZLPL.mjs.map +0 -1
- package/dist/chunk-ISNVEPPQ.mjs.map +0 -1
- package/dist/chunk-SD7TUPQM.mjs.map +0 -1
- /package/dist/{chunk-BPJ6V4YX.mjs.map → chunk-4HRUQH6U.mjs.map} +0 -0
- /package/dist/{chunk-D3QSYDJR.mjs.map → chunk-7IBF6RBW.mjs.map} +0 -0
- /package/dist/{chunk-OVYFRPSN.mjs.map → chunk-ABWT4DRT.mjs.map} +0 -0
- /package/dist/{chunk-LD3MGPZB.mjs.map → chunk-HE22TZMF.mjs.map} +0 -0
- /package/dist/{chunk-EHXVGFWN.mjs.map → chunk-OX2QTNTD.mjs.map} +0 -0
- /package/dist/{chunk-LHKZJ2ND.mjs.map → chunk-PMWUKW3Z.mjs.map} +0 -0
- /package/dist/{chunk-OAEX7G5G.mjs.map → chunk-PQPWQ6GH.mjs.map} +0 -0
- /package/dist/{chunk-6SK26J65.mjs.map → chunk-Y2L7KDVW.mjs.map} +0 -0
- /package/dist/{chunk-WMJVBMUX.mjs.map → chunk-YCG6SNAU.mjs.map} +0 -0
- /package/dist/{chunk-BR5YEYZJ.mjs.map → chunk-YTQHRJUA.mjs.map} +0 -0
- /package/dist/{chunk-6F7Q6CPI.mjs.map → chunk-ZCV3A2FP.mjs.map} +0 -0
- /package/src/v2/{styles.css → index.css} +0 -0
package/dist/index.js
CHANGED
|
@@ -198,7 +198,7 @@ var emptyCopilotContext = {
|
|
|
198
198
|
interruptEventQueue: {},
|
|
199
199
|
addInterruptEvent: () => {
|
|
200
200
|
},
|
|
201
|
-
|
|
201
|
+
resolveInterruptEvent: () => {
|
|
202
202
|
},
|
|
203
203
|
onError: () => {
|
|
204
204
|
},
|
|
@@ -2522,7 +2522,7 @@ function useCoagentStateRenderBridge(agentId, props) {
|
|
|
2522
2522
|
return canRender;
|
|
2523
2523
|
}
|
|
2524
2524
|
const renderClaimedByOtherMessage = Object.values(claimsRef.current).find(
|
|
2525
|
-
(c) => c.stateRenderId === stateRenderId && (0, import_shared10.dataToUUID)(
|
|
2525
|
+
(c) => c.stateRenderId === stateRenderId && (0, import_shared10.dataToUUID)(getStateWithoutConstantKeys(c.stateSnapshot)) === (0, import_shared10.dataToUUID)(getStateWithoutConstantKeys(renderSnapshot))
|
|
2526
2526
|
);
|
|
2527
2527
|
if (renderClaimedByOtherMessage) {
|
|
2528
2528
|
if (renderSnapshot && renderClaimedByOtherMessage.stateSnapshot && !areStatesEquals(renderClaimedByOtherMessage.stateSnapshot, renderSnapshot)) {
|
|
@@ -2661,14 +2661,7 @@ function CopilotKit(_a) {
|
|
|
2661
2661
|
const enabled = shouldShowDevConsole(props.showDevConsole);
|
|
2662
2662
|
const publicApiKey = props.publicApiKey || props.publicLicenseKey;
|
|
2663
2663
|
const renderArr = (0, import_react17.useMemo)(() => [{ render: CoAgentStateRenderBridge }], []);
|
|
2664
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToastProvider, { enabled, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CopilotErrorBoundary, { publicApiKey, showUsageBanner: enabled, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ThreadsProvider, { threadId: props.threadId, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2665
|
-
import_react18.CopilotKitProvider,
|
|
2666
|
-
__spreadProps(__spreadValues({}, props), {
|
|
2667
|
-
renderCustomMessages: renderArr,
|
|
2668
|
-
useSingleEndpoint: true,
|
|
2669
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CopilotKitInternal, __spreadProps(__spreadValues({}, props), { children }))
|
|
2670
|
-
})
|
|
2671
|
-
) }) }) });
|
|
2664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToastProvider, { enabled, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CopilotErrorBoundary, { publicApiKey, showUsageBanner: enabled, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ThreadsProvider, { threadId: props.threadId, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react18.CopilotKitProvider, __spreadProps(__spreadValues({}, props), { renderCustomMessages: renderArr, useSingleEndpoint: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CopilotKitInternal, __spreadProps(__spreadValues({}, props), { children })) })) }) }) });
|
|
2672
2665
|
}
|
|
2673
2666
|
function CopilotKitInternal(cpkProps) {
|
|
2674
2667
|
var _b;
|
|
@@ -2906,20 +2899,17 @@ ${nonDocumentStrings}`;
|
|
|
2906
2899
|
const chatAbortControllerRef = (0, import_react17.useRef)(null);
|
|
2907
2900
|
const showDevConsole = shouldShowDevConsole(props.showDevConsole);
|
|
2908
2901
|
const [interruptActions, _setInterruptActions] = (0, import_react17.useState)({});
|
|
2909
|
-
const setInterruptAction = (0, import_react17.useCallback)(
|
|
2910
|
-
(
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
[action.id]: __spreadValues(__spreadValues({}, (_a2 = prev[action.id]) != null ? _a2 : {}), action)
|
|
2918
|
-
});
|
|
2902
|
+
const setInterruptAction = (0, import_react17.useCallback)((action) => {
|
|
2903
|
+
_setInterruptActions((prev) => {
|
|
2904
|
+
var _a2;
|
|
2905
|
+
if (action == null || !action.id) {
|
|
2906
|
+
return prev;
|
|
2907
|
+
}
|
|
2908
|
+
return __spreadProps(__spreadValues({}, prev), {
|
|
2909
|
+
[action.id]: __spreadValues(__spreadValues({}, (_a2 = prev[action.id]) != null ? _a2 : {}), action)
|
|
2919
2910
|
});
|
|
2920
|
-
}
|
|
2921
|
-
|
|
2922
|
-
);
|
|
2911
|
+
});
|
|
2912
|
+
}, []);
|
|
2923
2913
|
const removeInterruptAction = (0, import_react17.useCallback)((actionId) => {
|
|
2924
2914
|
_setInterruptActions((prev) => {
|
|
2925
2915
|
const _a2 = prev, { [actionId]: _ } = _a2, rest = __objRest(_a2, [__restKey(actionId)]);
|
|
@@ -2935,14 +2925,19 @@ ${nonDocumentStrings}`;
|
|
|
2935
2925
|
});
|
|
2936
2926
|
});
|
|
2937
2927
|
}, []);
|
|
2938
|
-
const
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2928
|
+
const resolveInterruptEvent = (0, import_react17.useCallback)(
|
|
2929
|
+
(threadId2, eventId, response) => {
|
|
2930
|
+
setInterruptEventQueue((prev) => {
|
|
2931
|
+
const threadQueue = prev[threadId2] || [];
|
|
2932
|
+
return __spreadProps(__spreadValues({}, prev), {
|
|
2933
|
+
[threadId2]: threadQueue.map(
|
|
2934
|
+
(queuedEvent) => queuedEvent.eventId === eventId ? __spreadProps(__spreadValues({}, queuedEvent), { event: __spreadProps(__spreadValues({}, queuedEvent.event), { response }) }) : queuedEvent
|
|
2935
|
+
)
|
|
2936
|
+
});
|
|
2943
2937
|
});
|
|
2944
|
-
}
|
|
2945
|
-
|
|
2938
|
+
},
|
|
2939
|
+
[]
|
|
2940
|
+
);
|
|
2946
2941
|
const memoizedChildren = (0, import_react17.useMemo)(() => children, [children]);
|
|
2947
2942
|
const [bannerError, setBannerError] = (0, import_react17.useState)(null);
|
|
2948
2943
|
const agentLock = (0, import_react17.useMemo)(() => {
|
|
@@ -3060,7 +3055,7 @@ ${nonDocumentStrings}`;
|
|
|
3060
3055
|
removeInterruptAction,
|
|
3061
3056
|
interruptEventQueue,
|
|
3062
3057
|
addInterruptEvent,
|
|
3063
|
-
|
|
3058
|
+
resolveInterruptEvent,
|
|
3064
3059
|
bannerError,
|
|
3065
3060
|
setBannerError,
|
|
3066
3061
|
onError: handleErrors,
|
|
@@ -3186,7 +3181,7 @@ function useLangGraphInterruptRender(agent) {
|
|
|
3186
3181
|
threadId,
|
|
3187
3182
|
interruptEventQueue,
|
|
3188
3183
|
addInterruptEvent,
|
|
3189
|
-
|
|
3184
|
+
resolveInterruptEvent
|
|
3190
3185
|
} = useCopilotContext();
|
|
3191
3186
|
const existingConfig = (0, import_react22.useCopilotChatConfiguration)();
|
|
3192
3187
|
const resolvedAgentId = (_a = existingConfig == null ? void 0 : existingConfig.agentId) != null ? _a : "default";
|
|
@@ -3194,6 +3189,7 @@ function useLangGraphInterruptRender(agent) {
|
|
|
3194
3189
|
(0, import_react21.useEffect)(() => {
|
|
3195
3190
|
if (!agent)
|
|
3196
3191
|
return;
|
|
3192
|
+
let localInterrupt = null;
|
|
3197
3193
|
const subscriber = {
|
|
3198
3194
|
onCustomEvent: ({ event }) => {
|
|
3199
3195
|
if (event.name === "on_interrupt") {
|
|
@@ -3202,12 +3198,21 @@ function useLangGraphInterruptRender(agent) {
|
|
|
3202
3198
|
type: event.type,
|
|
3203
3199
|
value: (0, import_shared14.parseJson)(event.value, event.value)
|
|
3204
3200
|
};
|
|
3205
|
-
const eventId = (0, import_shared14.dataToUUID)(
|
|
3206
|
-
|
|
3201
|
+
const eventId = (0, import_shared14.dataToUUID)(eventData, "interruptEvents");
|
|
3202
|
+
localInterrupt = {
|
|
3207
3203
|
eventId,
|
|
3208
3204
|
threadId,
|
|
3209
3205
|
event: eventData
|
|
3210
|
-
}
|
|
3206
|
+
};
|
|
3207
|
+
}
|
|
3208
|
+
},
|
|
3209
|
+
onRunStartedEvent: () => {
|
|
3210
|
+
localInterrupt = null;
|
|
3211
|
+
},
|
|
3212
|
+
onRunFinalized: () => {
|
|
3213
|
+
if (localInterrupt) {
|
|
3214
|
+
addInterruptEvent(localInterrupt);
|
|
3215
|
+
localInterrupt = null;
|
|
3211
3216
|
}
|
|
3212
3217
|
}
|
|
3213
3218
|
};
|
|
@@ -3225,7 +3230,7 @@ function useLangGraphInterruptRender(agent) {
|
|
|
3225
3230
|
}
|
|
3226
3231
|
}
|
|
3227
3232
|
});
|
|
3228
|
-
|
|
3233
|
+
resolveInterruptEvent(threadId, eventId, response != null ? response : "");
|
|
3229
3234
|
},
|
|
3230
3235
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3231
3236
|
[agent, threadId]
|
|
@@ -4724,11 +4729,11 @@ var import_shared23 = require("@copilotkit/shared");
|
|
|
4724
4729
|
function useLangGraphInterrupt(action, dependencies) {
|
|
4725
4730
|
const { setInterruptAction, removeInterruptAction, interruptActions, threadId } = (0, import_react45.useContext)(CopilotContext);
|
|
4726
4731
|
const { addToast } = useToast();
|
|
4727
|
-
const actionId = (0, import_shared23.dataToUUID)(
|
|
4732
|
+
const actionId = (0, import_shared23.dataToUUID)(action, "lgAction");
|
|
4728
4733
|
(0, import_react45.useEffect)(() => {
|
|
4729
4734
|
if (!action)
|
|
4730
4735
|
return;
|
|
4731
|
-
setInterruptAction(
|
|
4736
|
+
setInterruptAction(__spreadProps(__spreadValues({}, action), { id: actionId }));
|
|
4732
4737
|
return () => {
|
|
4733
4738
|
removeInterruptAction(actionId);
|
|
4734
4739
|
};
|