@copilotkit/react-core 1.69.3 → 1.70.0
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/dist/{copilotkit-JdHy0xdu.mjs → copilotkit-B7aFKfQR.mjs} +65 -21
- package/dist/copilotkit-B7aFKfQR.mjs.map +1 -0
- package/dist/{copilotkit-BPeh62mW.cjs → copilotkit-BE76j111.cjs} +70 -20
- package/dist/copilotkit-BE76j111.cjs.map +1 -0
- package/dist/{copilotkit-CrNUgJiq.d.cts → copilotkit-BuzP0VeG.d.cts} +31 -4
- package/dist/copilotkit-BuzP0VeG.d.cts.map +1 -0
- package/dist/{copilotkit-DgO31tBq.d.mts → copilotkit-CbZGwElm.d.mts} +31 -4
- package/dist/copilotkit-CbZGwElm.d.mts.map +1 -0
- package/dist/index.cjs +93 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +17 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +93 -21
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +133 -32
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/headless.cjs +14 -7
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.d.cts.map +1 -1
- package/dist/v2/headless.d.mts.map +1 -1
- package/dist/v2/headless.mjs +14 -7
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +2 -1
- package/dist/v2/index.d.cts +2 -2
- package/dist/v2/index.d.mts +2 -2
- package/dist/v2/index.mjs +2 -2
- package/dist/v2/index.umd.js +64 -19
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +9 -9
- package/skills/react-core/SKILL.md +1 -1
- package/dist/copilotkit-BPeh62mW.cjs.map +0 -1
- package/dist/copilotkit-CrNUgJiq.d.cts.map +0 -1
- package/dist/copilotkit-DgO31tBq.d.mts.map +0 -1
- package/dist/copilotkit-JdHy0xdu.mjs.map +0 -1
|
@@ -1382,7 +1382,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
1382
1382
|
side: "bottom",
|
|
1383
1383
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
1384
1384
|
className: "cpk:flex cpk:items-center cpk:gap-1 cpk:text-xs cpk:font-medium",
|
|
1385
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children:
|
|
1385
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: labels.chatInputToolbarAddButtonLabel }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
1386
1386
|
className: "cpk:rounded cpk:bg-[#4a4a4a] cpk:px-1 cpk:py-[1px] cpk:font-mono cpk:text-[11px] cpk:text-white cpk:dark:bg-[#e0e0e0] cpk:dark:text-black",
|
|
1387
1387
|
children: "/"
|
|
1388
1388
|
})]
|
|
@@ -3536,6 +3536,8 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
3536
3536
|
const a2uiCatalogProvided = !!a2ui?.catalog;
|
|
3537
3537
|
const a2uiActive = runtimeA2UIEnabled || a2uiCatalogProvided;
|
|
3538
3538
|
const [runtimeLicenseStatus, setRuntimeLicenseStatus] = (0, react.useState)(void 0);
|
|
3539
|
+
const [runtimeEntitlements, setRuntimeEntitlements] = (0, react.useState)(void 0);
|
|
3540
|
+
const [runtimeEntitlementRetryPending, setRuntimeEntitlementRetryPending] = (0, react.useState)(false);
|
|
3539
3541
|
const requestInspectorOpen = (0, react.useCallback)((request) => {
|
|
3540
3542
|
setInspectorOpenRequest({ ...request });
|
|
3541
3543
|
}, []);
|
|
@@ -3726,6 +3728,8 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
3726
3728
|
setRuntimeA2UIEnabled(copilotkit.a2uiEnabled);
|
|
3727
3729
|
setRuntimeOpenGenUIEnabled(copilotkit.openGenerativeUIEnabled);
|
|
3728
3730
|
setRuntimeLicenseStatus(copilotkit.licenseStatus);
|
|
3731
|
+
setRuntimeEntitlements(copilotkit.runtimeEntitlements);
|
|
3732
|
+
setRuntimeEntitlementRetryPending(copilotkit.runtimeEntitlementRetryPending);
|
|
3729
3733
|
};
|
|
3730
3734
|
const subscription = copilotkit.subscribe({ onRuntimeConnectionStatusChanged: syncRuntimeInfo });
|
|
3731
3735
|
syncRuntimeInfo();
|
|
@@ -3866,7 +3870,26 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
3866
3870
|
copilotkit,
|
|
3867
3871
|
executingToolCallIds
|
|
3868
3872
|
}), [copilotkit, executingToolCallIds]);
|
|
3869
|
-
const
|
|
3873
|
+
const retryableRuntimeEntitlementFailure = runtimeEntitlements?.status !== "ready" && runtimeEntitlements?.error.retryable === true;
|
|
3874
|
+
const hasNonReadyRuntimeEntitlement = runtimeEntitlements !== void 0 && runtimeEntitlements.status !== "ready";
|
|
3875
|
+
const hasLegacyRuntimeEntitlementFallback = runtimeLicenseStatus === "valid" || runtimeLicenseStatus === "expiring";
|
|
3876
|
+
const runtimeEntitlementRetryInProgress = retryableRuntimeEntitlementFailure && runtimeEntitlementRetryPending && !hasLegacyRuntimeEntitlementFallback;
|
|
3877
|
+
const runtimeEntitlementFailureSettled = hasNonReadyRuntimeEntitlement && !runtimeEntitlementRetryInProgress && !hasLegacyRuntimeEntitlementFallback;
|
|
3878
|
+
const licenseContextValue = (0, react.useMemo)(() => {
|
|
3879
|
+
const runtimeLicenseContext = (0, _copilotkit_shared.createLicenseContextValue)(runtimeEntitlementRetryInProgress ? void 0 : runtimeLicenseStatus, runtimeEntitlements);
|
|
3880
|
+
if (!runtimeEntitlementFailureSettled) return runtimeLicenseContext;
|
|
3881
|
+
return {
|
|
3882
|
+
...runtimeLicenseContext,
|
|
3883
|
+
checkFeature: () => false,
|
|
3884
|
+
getLimit: () => null
|
|
3885
|
+
};
|
|
3886
|
+
}, [
|
|
3887
|
+
runtimeEntitlementFailureSettled,
|
|
3888
|
+
runtimeEntitlementRetryInProgress,
|
|
3889
|
+
runtimeEntitlements,
|
|
3890
|
+
runtimeLicenseStatus
|
|
3891
|
+
]);
|
|
3892
|
+
const runtimeLicenseWarningStatus = runtimeEntitlementRetryInProgress ? void 0 : licenseContextValue.status ?? void 0;
|
|
3870
3893
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SandboxFunctionsContext.Provider, {
|
|
3871
3894
|
value: sandboxFunctionsList,
|
|
3872
3895
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_copilotkit_react_core_v2_context.CopilotKitContext.Provider, {
|
|
@@ -3886,10 +3909,10 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
3886
3909
|
openRequest: inspectorOpenRequest
|
|
3887
3910
|
}) : null]
|
|
3888
3911
|
}),
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3912
|
+
runtimeLicenseWarningStatus === "none" && !resolvedPublicKey && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LicenseWarningBanner, { type: "no_license" }),
|
|
3913
|
+
runtimeLicenseWarningStatus === "expired" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LicenseWarningBanner, { type: "expired" }),
|
|
3914
|
+
runtimeLicenseWarningStatus === "invalid" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LicenseWarningBanner, { type: "invalid" }),
|
|
3915
|
+
runtimeLicenseWarningStatus === "expiring" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LicenseWarningBanner, { type: "expiring" })
|
|
3893
3916
|
]
|
|
3894
3917
|
})
|
|
3895
3918
|
})
|
|
@@ -3989,7 +4012,7 @@ const EMPTY_DEPS$1 = [];
|
|
|
3989
4012
|
function useFrontendTool(tool, deps) {
|
|
3990
4013
|
const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
|
|
3991
4014
|
const extraDeps = deps ?? EMPTY_DEPS$1;
|
|
3992
|
-
(0, react.
|
|
4015
|
+
(0, react.useLayoutEffect)(() => {
|
|
3993
4016
|
const name = tool.name;
|
|
3994
4017
|
if (copilotkit.getTool({
|
|
3995
4018
|
toolName: name,
|
|
@@ -4356,6 +4379,8 @@ function safeStringifyForAttr(value) {
|
|
|
4356
4379
|
|
|
4357
4380
|
//#endregion
|
|
4358
4381
|
//#region src/v2/hooks/use-human-in-the-loop.tsx
|
|
4382
|
+
/** Registration name of a catch-all tool: handles any otherwise-unhandled call. */
|
|
4383
|
+
const WILDCARD_TOOL_NAME = "*";
|
|
4359
4384
|
function useHumanInTheLoop(tool, deps) {
|
|
4360
4385
|
const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
|
|
4361
4386
|
const resolvePromiseRef = (0, react.useRef)(null);
|
|
@@ -4391,10 +4416,11 @@ function useHumanInTheLoop(tool, deps) {
|
|
|
4391
4416
|
}, []);
|
|
4392
4417
|
const RenderComponent = (0, react.useCallback)((props) => {
|
|
4393
4418
|
const ToolComponent = tool.render;
|
|
4419
|
+
const name = tool.name === WILDCARD_TOOL_NAME ? props.name : tool.name;
|
|
4394
4420
|
if (props.status === _copilotkit_core.ToolCallStatus.InProgress) {
|
|
4395
4421
|
const enhancedProps = {
|
|
4396
4422
|
...props,
|
|
4397
|
-
name
|
|
4423
|
+
name,
|
|
4398
4424
|
description: tool.description || "",
|
|
4399
4425
|
agentId: tool.agentId,
|
|
4400
4426
|
respond: void 0
|
|
@@ -4403,7 +4429,7 @@ function useHumanInTheLoop(tool, deps) {
|
|
|
4403
4429
|
} else if (props.status === _copilotkit_core.ToolCallStatus.Executing) {
|
|
4404
4430
|
const enhancedProps = {
|
|
4405
4431
|
...props,
|
|
4406
|
-
name
|
|
4432
|
+
name,
|
|
4407
4433
|
description: tool.description || "",
|
|
4408
4434
|
agentId: tool.agentId,
|
|
4409
4435
|
respond
|
|
@@ -4412,7 +4438,7 @@ function useHumanInTheLoop(tool, deps) {
|
|
|
4412
4438
|
} else if (props.status === _copilotkit_core.ToolCallStatus.Complete) {
|
|
4413
4439
|
const enhancedProps = {
|
|
4414
4440
|
...props,
|
|
4415
|
-
name
|
|
4441
|
+
name,
|
|
4416
4442
|
description: tool.description || "",
|
|
4417
4443
|
agentId: tool.agentId,
|
|
4418
4444
|
respond: void 0
|
|
@@ -4432,7 +4458,7 @@ function useHumanInTheLoop(tool, deps) {
|
|
|
4432
4458
|
handler,
|
|
4433
4459
|
render: RenderComponent
|
|
4434
4460
|
}, deps);
|
|
4435
|
-
(0, react.
|
|
4461
|
+
(0, react.useLayoutEffect)(() => {
|
|
4436
4462
|
return () => {
|
|
4437
4463
|
copilotkit.removeHookRenderToolCall(tool.name, tool.agentId);
|
|
4438
4464
|
};
|
|
@@ -4897,8 +4923,12 @@ function normalizeStaticSuggestions(suggestions) {
|
|
|
4897
4923
|
}
|
|
4898
4924
|
|
|
4899
4925
|
//#endregion
|
|
4900
|
-
//#region src/v2/
|
|
4926
|
+
//#region src/v2/types/interrupt.ts
|
|
4927
|
+
/** Name of the legacy custom event agents emit to signal an interrupt. */
|
|
4901
4928
|
const INTERRUPT_EVENT_NAME = "on_interrupt";
|
|
4929
|
+
|
|
4930
|
+
//#endregion
|
|
4931
|
+
//#region src/v2/hooks/use-interrupt.tsx
|
|
4902
4932
|
function isPromiseLike(value) {
|
|
4903
4933
|
return (typeof value === "object" || typeof value === "function") && value !== null && typeof Reflect.get(value, "then") === "function";
|
|
4904
4934
|
}
|
|
@@ -5235,7 +5265,7 @@ function useThreadStoreSelector(store, selector) {
|
|
|
5235
5265
|
*/
|
|
5236
5266
|
function useThreads$1({ agentId, includeArchived, limit, enabled = true }) {
|
|
5237
5267
|
const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
|
|
5238
|
-
const [store] = (0, react.useState)(() => (0, _copilotkit_core.ɵcreateThreadStore)({ fetch:
|
|
5268
|
+
const [store] = (0, react.useState)(() => (0, _copilotkit_core.ɵcreateThreadStore)({ fetch: copilotkit.ɵruntimeFetch }));
|
|
5239
5269
|
const coreThreads = useThreadStoreSelector(store, _copilotkit_core.ɵselectThreads);
|
|
5240
5270
|
const threads = (0, react.useMemo)(() => coreThreads.map(({ id, agentId, name, archived, createdAt, updatedAt, lastRunAt }) => ({
|
|
5241
5271
|
id,
|
|
@@ -5934,21 +5964,35 @@ function CopilotChatToolCallsView({ message, messages = [] }) {
|
|
|
5934
5964
|
|
|
5935
5965
|
//#endregion
|
|
5936
5966
|
//#region src/v2/components/chat/CopilotChatAssistantMessage.tsx
|
|
5967
|
+
/**
|
|
5968
|
+
* Binds the Inspector action to the active chat without making the full
|
|
5969
|
+
* assistant message subscribe to chat configuration changes.
|
|
5970
|
+
*/
|
|
5971
|
+
function BoundInspectorButton({ inspectorButton, messageId, openInspector, ...props }) {
|
|
5972
|
+
const chatConfiguration = useCopilotChatConfiguration();
|
|
5973
|
+
return renderSlot(inspectorButton, CopilotChatAssistantMessage.InspectorButton, {
|
|
5974
|
+
...props,
|
|
5975
|
+
onClick: () => openInspector({
|
|
5976
|
+
messageId,
|
|
5977
|
+
threadId: chatConfiguration?.threadId,
|
|
5978
|
+
agentId: chatConfiguration?.agentId
|
|
5979
|
+
})
|
|
5980
|
+
});
|
|
5981
|
+
}
|
|
5937
5982
|
function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible = true, markdownRenderer, toolbar, copyButton, inspectorButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, toolCallsView, children, className, ...props }) {
|
|
5938
5983
|
useKatexStyles();
|
|
5939
5984
|
const { isInspectorEnabled, openInspector } = useCopilotKitInspector();
|
|
5940
|
-
const chatConfiguration = useCopilotChatConfiguration();
|
|
5941
5985
|
const boundMarkdownRenderer = renderSlot(markdownRenderer, CopilotChatAssistantMessage.MarkdownRenderer, { content: message.content || "" });
|
|
5942
5986
|
const boundCopyButton = renderSlot(copyButton, CopilotChatAssistantMessage.CopyButton, { onClick: async () => {
|
|
5943
5987
|
if (message.content) return await (0, _copilotkit_shared.copyToClipboard)(message.content);
|
|
5944
5988
|
return false;
|
|
5945
5989
|
} });
|
|
5946
5990
|
const boundThumbsUpButton = renderSlot(thumbsUpButton, CopilotChatAssistantMessage.ThumbsUpButton, { onClick: onThumbsUp ? () => onThumbsUp(message) : void 0 });
|
|
5947
|
-
const boundInspectorButton =
|
|
5991
|
+
const boundInspectorButton = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BoundInspectorButton, {
|
|
5992
|
+
inspectorButton,
|
|
5948
5993
|
messageId: message.id,
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
}) });
|
|
5994
|
+
openInspector
|
|
5995
|
+
});
|
|
5952
5996
|
const boundThumbsDownButton = renderSlot(thumbsDownButton, CopilotChatAssistantMessage.ThumbsDownButton, { onClick: onThumbsDown ? () => onThumbsDown(message) : void 0 });
|
|
5953
5997
|
const boundReadAloudButton = renderSlot(readAloudButton, CopilotChatAssistantMessage.ReadAloudButton, { onClick: onReadAloud ? () => onReadAloud(message) : void 0 });
|
|
5954
5998
|
const boundRegenerateButton = renderSlot(regenerateButton, CopilotChatAssistantMessage.RegenerateButton, { onClick: onRegenerate ? () => onRegenerate(message) : void 0 });
|
|
@@ -8528,7 +8572,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
|
|
|
8528
8572
|
const startRunActivityReconnectRef = (0, react.useRef)(null);
|
|
8529
8573
|
const runtimeStatus = copilotkit.runtimeConnectionStatus === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Connected ? "Connected" : copilotkit.runtimeConnectionStatus;
|
|
8530
8574
|
const hasNativeIntelligenceRunActivity = hasExplicitThreadId && runtimeStatus === "Connected" && !!copilotkit.intelligence?.wsUrl && copilotkit.threadEndpoints?.realtimeMetadata === true;
|
|
8531
|
-
const [standaloneRunActivityStore] = (0, react.useState)(() => (0, _copilotkit_core.ɵcreateThreadStore)({ fetch:
|
|
8575
|
+
const [standaloneRunActivityStore] = (0, react.useState)(() => (0, _copilotkit_core.ɵcreateThreadStore)({ fetch: copilotkit.ɵruntimeFetch }));
|
|
8532
8576
|
const previousThreadRef = (0, react.useRef)(null);
|
|
8533
8577
|
const hasExplicitThreadIdRef = (0, react.useRef)(hasExplicitThreadId);
|
|
8534
8578
|
hasExplicitThreadIdRef.current = hasExplicitThreadId;
|
|
@@ -12339,6 +12383,12 @@ Object.defineProperty(exports, 'INTELLIGENCE_TURN_HEAD', {
|
|
|
12339
12383
|
return INTELLIGENCE_TURN_HEAD;
|
|
12340
12384
|
}
|
|
12341
12385
|
});
|
|
12386
|
+
Object.defineProperty(exports, 'INTERRUPT_EVENT_NAME', {
|
|
12387
|
+
enumerable: true,
|
|
12388
|
+
get: function () {
|
|
12389
|
+
return INTERRUPT_EVENT_NAME;
|
|
12390
|
+
}
|
|
12391
|
+
});
|
|
12342
12392
|
Object.defineProperty(exports, 'IntelligenceIndicator', {
|
|
12343
12393
|
enumerable: true,
|
|
12344
12394
|
get: function () {
|
|
@@ -12639,4 +12689,4 @@ Object.defineProperty(exports, 'ɵrunMcpFollowUp', {
|
|
|
12639
12689
|
return ɵrunMcpFollowUp;
|
|
12640
12690
|
}
|
|
12641
12691
|
});
|
|
12642
|
-
//# sourceMappingURL=copilotkit-
|
|
12692
|
+
//# sourceMappingURL=copilotkit-BE76j111.cjs.map
|