@copilotkit/react-core 1.68.1 → 1.68.3-canary.1786716392
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-BICg0AyJ.d.cts → copilotkit-B1K0Tgnz.d.cts} +47 -3
- package/dist/copilotkit-B1K0Tgnz.d.cts.map +1 -0
- package/dist/{copilotkit-BrfN8YeF.d.mts → copilotkit-CZjzQPdq.d.mts} +47 -3
- package/dist/copilotkit-CZjzQPdq.d.mts.map +1 -0
- package/dist/{copilotkit-Ck0RL8hh.mjs → copilotkit-DT2FmOwK.mjs} +263 -19
- package/dist/copilotkit-DT2FmOwK.mjs.map +1 -0
- package/dist/{copilotkit-8KSSmCH_.cjs → copilotkit-EFunREg5.cjs} +268 -18
- package/dist/copilotkit-EFunREg5.cjs.map +1 -0
- package/dist/index.cjs +14 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +14 -7
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +62 -16
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/headless.cjs +2 -0
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.d.cts +2 -0
- package/dist/v2/headless.d.cts.map +1 -1
- package/dist/v2/headless.d.mts +2 -0
- package/dist/v2/headless.d.mts.map +1 -1
- package/dist/v2/headless.mjs +2 -0
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +2 -1
- package/dist/v2/index.css +1 -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 +262 -17
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +8 -8
- package/skills/react-core/SKILL.md +1 -1
- package/dist/copilotkit-8KSSmCH_.cjs.map +0 -1
- package/dist/copilotkit-BICg0AyJ.d.cts.map +0 -1
- package/dist/copilotkit-BrfN8YeF.d.mts.map +0 -1
- package/dist/copilotkit-Ck0RL8hh.mjs.map +0 -1
|
@@ -106,6 +106,8 @@ const CopilotChatDefaultLabels = {
|
|
|
106
106
|
assistantMessageToolbarCopyCodeLabel: "Copy",
|
|
107
107
|
assistantMessageToolbarCopyCodeCopiedLabel: "Copied",
|
|
108
108
|
assistantMessageToolbarCopyMessageLabel: "Copy",
|
|
109
|
+
assistantMessageToolbarInspectorLabel: "View in Inspector",
|
|
110
|
+
assistantMessageToolbarInspectorLocalOnlyLabel: "Local Only",
|
|
109
111
|
assistantMessageToolbarThumbsUpLabel: "Good response",
|
|
110
112
|
assistantMessageToolbarThumbsDownLabel: "Bad response",
|
|
111
113
|
assistantMessageToolbarReadAloudLabel: "Read aloud",
|
|
@@ -1524,8 +1526,9 @@ function useRenderToolCall() {
|
|
|
1524
1526
|
|
|
1525
1527
|
//#endregion
|
|
1526
1528
|
//#region src/v2/components/CopilotKitInspector.tsx
|
|
1527
|
-
const CopilotKitInspector = ({ core, ...rest }) => {
|
|
1529
|
+
const CopilotKitInspector = ({ core, openRequest, ...rest }) => {
|
|
1528
1530
|
const [InspectorComponent, setInspectorComponent] = react.useState(null);
|
|
1531
|
+
const inspectorRef = react.useRef(null);
|
|
1529
1532
|
react.useEffect(() => {
|
|
1530
1533
|
let mounted = true;
|
|
1531
1534
|
import("@copilotkit/web-inspector").then((mod) => {
|
|
@@ -1541,14 +1544,29 @@ const CopilotKitInspector = ({ core, ...rest }) => {
|
|
|
1541
1544
|
mounted = false;
|
|
1542
1545
|
};
|
|
1543
1546
|
}, []);
|
|
1547
|
+
react.useEffect(() => {
|
|
1548
|
+
if (openRequest) inspectorRef.current?.openInspector("message_toolbar", openRequest);
|
|
1549
|
+
}, [InspectorComponent, openRequest]);
|
|
1544
1550
|
if (!InspectorComponent) return null;
|
|
1545
1551
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InspectorComponent, {
|
|
1552
|
+
ref: inspectorRef,
|
|
1546
1553
|
...rest,
|
|
1547
1554
|
core: core ?? null
|
|
1548
1555
|
});
|
|
1549
1556
|
};
|
|
1550
1557
|
CopilotKitInspector.displayName = "CopilotKitInspector";
|
|
1551
1558
|
|
|
1559
|
+
//#endregion
|
|
1560
|
+
//#region src/v2/components/CopilotKitInspectorContext.tsx
|
|
1561
|
+
const CopilotKitInspectorContext = react.createContext({
|
|
1562
|
+
isLocalInspectorEnabled: false,
|
|
1563
|
+
openInspector: () => void 0
|
|
1564
|
+
});
|
|
1565
|
+
const CopilotKitInspectorContextProvider = CopilotKitInspectorContext.Provider;
|
|
1566
|
+
function useCopilotKitInspector() {
|
|
1567
|
+
return react.useContext(CopilotKitInspectorContext);
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1552
1570
|
//#endregion
|
|
1553
1571
|
//#region src/v2/components/license-warning-banner.tsx
|
|
1554
1572
|
const LICENSE_BANNER_OFFSET_PX = 52;
|
|
@@ -3493,6 +3511,8 @@ function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
|
|
|
3493
3511
|
}
|
|
3494
3512
|
const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY_HEADERS, credentials, publicApiKey, publicLicenseKey, licenseToken, properties = EMPTY_PROPERTIES, agents__unsafe_dev_only: agents = EMPTY_AGENTS, selfManagedAgents = EMPTY_AGENTS, renderToolCalls, renderActivityMessages, renderCustomMessages, frontendTools, humanInTheLoop, openGenerativeUI, showDevConsole = false, useSingleEndpoint, onError, a2ui, defaultThrottleMs, inspectorDefaultAnchor, debug }) => {
|
|
3495
3513
|
const [shouldRenderInspector, setShouldRenderInspector] = (0, react.useState)(false);
|
|
3514
|
+
const [isLocalInspectorEnabled, setIsLocalInspectorEnabled] = (0, react.useState)(false);
|
|
3515
|
+
const [inspectorOpenRequest, setInspectorOpenRequest] = (0, react.useState)(null);
|
|
3496
3516
|
const [runtimeA2UIEnabled, setRuntimeA2UIEnabled] = (0, react.useState)(false);
|
|
3497
3517
|
const [runtimeOpenGenUIEnabled, setRuntimeOpenGenUIEnabled] = (0, react.useState)(false);
|
|
3498
3518
|
const [catalogToggleVersion, setCatalogToggleVersion] = (0, react.useState)(0);
|
|
@@ -3502,11 +3522,30 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
3502
3522
|
const [runtimeLicenseStatus, setRuntimeLicenseStatus] = (0, react.useState)(void 0);
|
|
3503
3523
|
(0, react.useEffect)(() => {
|
|
3504
3524
|
if (typeof window === "undefined") return;
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3525
|
+
const isLocalhost = new Set(["localhost", "127.0.0.1"]).has(window.location?.hostname ?? "");
|
|
3526
|
+
const canShowLocalInspectorAction = process.env.NODE_ENV === "development" && isLocalhost;
|
|
3527
|
+
if (showDevConsole === true) {
|
|
3528
|
+
setShouldRenderInspector(true);
|
|
3529
|
+
setIsLocalInspectorEnabled(canShowLocalInspectorAction);
|
|
3530
|
+
} else if (showDevConsole === "auto") if (isLocalhost) {
|
|
3531
|
+
setShouldRenderInspector(true);
|
|
3532
|
+
setIsLocalInspectorEnabled(canShowLocalInspectorAction);
|
|
3533
|
+
} else {
|
|
3534
|
+
setShouldRenderInspector(false);
|
|
3535
|
+
setIsLocalInspectorEnabled(false);
|
|
3536
|
+
}
|
|
3537
|
+
else {
|
|
3538
|
+
setShouldRenderInspector(false);
|
|
3539
|
+
setIsLocalInspectorEnabled(false);
|
|
3540
|
+
}
|
|
3509
3541
|
}, [showDevConsole]);
|
|
3542
|
+
const requestInspectorOpen = (0, react.useCallback)((request) => {
|
|
3543
|
+
setInspectorOpenRequest({ ...request });
|
|
3544
|
+
}, []);
|
|
3545
|
+
const inspectorContextValue = (0, react.useMemo)(() => ({
|
|
3546
|
+
isLocalInspectorEnabled,
|
|
3547
|
+
openInspector: requestInspectorOpen
|
|
3548
|
+
}), [isLocalInspectorEnabled, requestInspectorOpen]);
|
|
3510
3549
|
const renderToolCallsList = useStableArrayProp(renderToolCalls, "renderToolCalls must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.", (initial, next) => {
|
|
3511
3550
|
const key = (rc) => `${rc?.agentId ?? ""}:${rc?.name ?? ""}`;
|
|
3512
3551
|
const setFrom = (arr) => new Set(arr.map(key));
|
|
@@ -3843,11 +3882,14 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
3843
3882
|
catalog: filteredCatalog,
|
|
3844
3883
|
includeSchema: a2ui?.includeSchema
|
|
3845
3884
|
}),
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3885
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CopilotKitInspectorContextProvider, {
|
|
3886
|
+
value: inspectorContextValue,
|
|
3887
|
+
children: [children, shouldRenderInspector ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitInspector, {
|
|
3888
|
+
core: copilotkit,
|
|
3889
|
+
defaultAnchor: inspectorDefaultAnchor,
|
|
3890
|
+
openRequest: inspectorOpenRequest
|
|
3891
|
+
}) : null]
|
|
3892
|
+
}),
|
|
3851
3893
|
runtimeLicenseStatus === "none" && !resolvedPublicKey && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LicenseWarningBanner, { type: "no_license" }),
|
|
3852
3894
|
runtimeLicenseStatus === "expired" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LicenseWarningBanner, { type: "expired" }),
|
|
3853
3895
|
runtimeLicenseStatus === "invalid" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LicenseWarningBanner, { type: "invalid" }),
|
|
@@ -4601,6 +4643,75 @@ function useAgent({ agentId, threadId, runtimeAgentId, updates, throttleMs } = {
|
|
|
4601
4643
|
};
|
|
4602
4644
|
}
|
|
4603
4645
|
|
|
4646
|
+
//#endregion
|
|
4647
|
+
//#region src/v2/hooks/use-subagent.tsx
|
|
4648
|
+
const warnedAmbiguousNames = /* @__PURE__ */ new Set();
|
|
4649
|
+
function resolveSubagent(subagents, subagentRunId, subagentName) {
|
|
4650
|
+
if (subagentRunId) {
|
|
4651
|
+
const match = subagents[subagentRunId];
|
|
4652
|
+
return match ? { ...match } : void 0;
|
|
4653
|
+
}
|
|
4654
|
+
if (subagentName) {
|
|
4655
|
+
const matches = Object.values(subagents).filter((s) => s.name === subagentName);
|
|
4656
|
+
if (matches.length === 0) return;
|
|
4657
|
+
const chosen = matches[matches.length - 1];
|
|
4658
|
+
return matches.length > 1 ? {
|
|
4659
|
+
...chosen,
|
|
4660
|
+
isAmbiguous: true,
|
|
4661
|
+
matchCount: matches.length
|
|
4662
|
+
} : { ...chosen };
|
|
4663
|
+
}
|
|
4664
|
+
}
|
|
4665
|
+
/**
|
|
4666
|
+
* Read a subagent's live lifecycle state (name, description, running status)
|
|
4667
|
+
* from the CopilotKit core subagent registry, by id or by declared name.
|
|
4668
|
+
*
|
|
4669
|
+
* @example
|
|
4670
|
+
* const sub = useSubagent({ subagentRunId: message.subagentRunId });
|
|
4671
|
+
* // sub?.name, sub?.description, sub?.status
|
|
4672
|
+
*/
|
|
4673
|
+
function useSubagent(params) {
|
|
4674
|
+
const { subagentRunId, subagentName, agentId } = params;
|
|
4675
|
+
const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
|
|
4676
|
+
const config = useCopilotChatConfiguration();
|
|
4677
|
+
const resolvedAgentId = (0, react.useMemo)(() => agentId ?? config?.agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID, [agentId, config?.agentId]);
|
|
4678
|
+
const [subagent, setSubagent] = (0, react.useState)(() => resolveSubagent(copilotkit.getSubagents(resolvedAgentId), subagentRunId, subagentName));
|
|
4679
|
+
(0, react.useEffect)(() => {
|
|
4680
|
+
setSubagent(resolveSubagent(copilotkit.getSubagents(resolvedAgentId), subagentRunId, subagentName));
|
|
4681
|
+
}, [
|
|
4682
|
+
copilotkit,
|
|
4683
|
+
resolvedAgentId,
|
|
4684
|
+
subagentRunId,
|
|
4685
|
+
subagentName
|
|
4686
|
+
]);
|
|
4687
|
+
(0, react.useEffect)(() => {
|
|
4688
|
+
const subscription = copilotkit.subscribe({ onSubagentsChanged: ({ agentId: changedAgentId, subagents }) => {
|
|
4689
|
+
if (changedAgentId !== resolvedAgentId) return;
|
|
4690
|
+
setSubagent(resolveSubagent(subagents, subagentRunId, subagentName));
|
|
4691
|
+
} });
|
|
4692
|
+
return () => {
|
|
4693
|
+
subscription.unsubscribe();
|
|
4694
|
+
};
|
|
4695
|
+
}, [
|
|
4696
|
+
copilotkit,
|
|
4697
|
+
resolvedAgentId,
|
|
4698
|
+
subagentRunId,
|
|
4699
|
+
subagentName
|
|
4700
|
+
]);
|
|
4701
|
+
(0, react.useEffect)(() => {
|
|
4702
|
+
if (process.env.NODE_ENV === "production" || !subagentName || !subagent?.isAmbiguous) return;
|
|
4703
|
+
const key = `${subagentName}:${subagent.matchCount}`;
|
|
4704
|
+
if (warnedAmbiguousNames.has(key)) return;
|
|
4705
|
+
warnedAmbiguousNames.add(key);
|
|
4706
|
+
console.warn(`[CopilotKit] useSubagent({ subagentName: ${JSON.stringify(subagentName)} }) matched ${subagent.matchCount} subagents. Returning the most recently started one; pass a subagentRunId for a stable reference.`);
|
|
4707
|
+
}, [
|
|
4708
|
+
subagentName,
|
|
4709
|
+
subagent?.isAmbiguous,
|
|
4710
|
+
subagent?.matchCount
|
|
4711
|
+
]);
|
|
4712
|
+
return subagent;
|
|
4713
|
+
}
|
|
4714
|
+
|
|
4604
4715
|
//#endregion
|
|
4605
4716
|
//#region src/v2/hooks/use-capabilities.tsx
|
|
4606
4717
|
/**
|
|
@@ -5896,14 +6007,21 @@ function CopilotChatToolCallsView({ message, messages = [] }) {
|
|
|
5896
6007
|
|
|
5897
6008
|
//#endregion
|
|
5898
6009
|
//#region src/v2/components/chat/CopilotChatAssistantMessage.tsx
|
|
5899
|
-
function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible = true, markdownRenderer, toolbar, copyButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, toolCallsView, children, className, ...props }) {
|
|
6010
|
+
function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible = true, markdownRenderer, toolbar, copyButton, inspectorButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, toolCallsView, children, className, ...props }) {
|
|
5900
6011
|
useKatexStyles();
|
|
6012
|
+
const { isLocalInspectorEnabled, openInspector } = useCopilotKitInspector();
|
|
6013
|
+
const chatConfiguration = useCopilotChatConfiguration();
|
|
5901
6014
|
const boundMarkdownRenderer = renderSlot(markdownRenderer, CopilotChatAssistantMessage.MarkdownRenderer, { content: message.content || "" });
|
|
5902
6015
|
const boundCopyButton = renderSlot(copyButton, CopilotChatAssistantMessage.CopyButton, { onClick: async () => {
|
|
5903
6016
|
if (message.content) return await (0, _copilotkit_shared.copyToClipboard)(message.content);
|
|
5904
6017
|
return false;
|
|
5905
6018
|
} });
|
|
5906
6019
|
const boundThumbsUpButton = renderSlot(thumbsUpButton, CopilotChatAssistantMessage.ThumbsUpButton, { onClick: onThumbsUp ? () => onThumbsUp(message) : void 0 });
|
|
6020
|
+
const boundInspectorButton = renderSlot(inspectorButton, CopilotChatAssistantMessage.InspectorButton, { onClick: () => openInspector({
|
|
6021
|
+
messageId: message.id,
|
|
6022
|
+
threadId: chatConfiguration?.threadId,
|
|
6023
|
+
agentId: chatConfiguration?.agentId
|
|
6024
|
+
}) });
|
|
5907
6025
|
const boundThumbsDownButton = renderSlot(thumbsDownButton, CopilotChatAssistantMessage.ThumbsDownButton, { onClick: onThumbsDown ? () => onThumbsDown(message) : void 0 });
|
|
5908
6026
|
const boundReadAloudButton = renderSlot(readAloudButton, CopilotChatAssistantMessage.ReadAloudButton, { onClick: onReadAloud ? () => onReadAloud(message) : void 0 });
|
|
5909
6027
|
const boundRegenerateButton = renderSlot(regenerateButton, CopilotChatAssistantMessage.RegenerateButton, { onClick: onRegenerate ? () => onRegenerate(message) : void 0 });
|
|
@@ -5911,6 +6029,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
|
|
|
5911
6029
|
className: "cpk:flex cpk:items-center cpk:gap-1",
|
|
5912
6030
|
children: [
|
|
5913
6031
|
boundCopyButton,
|
|
6032
|
+
isLocalInspectorEnabled && boundInspectorButton,
|
|
5914
6033
|
(onThumbsUp || thumbsUpButton) && boundThumbsUpButton,
|
|
5915
6034
|
(onThumbsDown || thumbsDownButton) && boundThumbsDownButton,
|
|
5916
6035
|
(onReadAloud || readAloudButton) && boundReadAloudButton,
|
|
@@ -5933,6 +6052,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
|
|
|
5933
6052
|
toolbar: boundToolbar,
|
|
5934
6053
|
toolCallsView: boundToolCallsView,
|
|
5935
6054
|
copyButton: boundCopyButton,
|
|
6055
|
+
inspectorButton: boundInspectorButton,
|
|
5936
6056
|
thumbsUpButton: boundThumbsUpButton,
|
|
5937
6057
|
thumbsDownButton: boundThumbsDownButton,
|
|
5938
6058
|
readAloudButton: boundReadAloudButton,
|
|
@@ -5964,6 +6084,110 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
|
|
|
5964
6084
|
]
|
|
5965
6085
|
});
|
|
5966
6086
|
}
|
|
6087
|
+
function CopilotKitColoredIcon() {
|
|
6088
|
+
const gradientId = (0, react.useId)().replace(/:/g, "");
|
|
6089
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
6090
|
+
"aria-hidden": "true",
|
|
6091
|
+
className: "cpk:size-5",
|
|
6092
|
+
"data-testid": "copilot-inspector-icon",
|
|
6093
|
+
viewBox: "0 0 24 24",
|
|
6094
|
+
children: [
|
|
6095
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6096
|
+
d: "M8.162 7.758c2.093-2.738 3.831-5.445 4.498-7.63a.093.093 0 01.14-.051c2.324 1.539 6.558 2.552 10.301 2.576a.09.09 0 01.085.124c-1.243 3.158-2.765 8.817-2.823 15.28-.001.095-.135.13-.183.046-2.131-3.729-8.955-8.968-11.982-10.205a.09.09 0 01-.036-.14z",
|
|
6097
|
+
fill: `url(#${gradientId}-purple)`
|
|
6098
|
+
}),
|
|
6099
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6100
|
+
d: "M15.223 6.083A61.492 61.492 0 018.25 7.827c-.045.008-.055.071-.012.089 3.05 1.267 9.84 6.492 11.952 10.206a.017.017 0 00.022.007.018.018 0 00.01-.024l-4.999-12.02z",
|
|
6101
|
+
fill: `url(#${gradientId}-blue)`
|
|
6102
|
+
}),
|
|
6103
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6104
|
+
d: "M12.81.07c2.8 1.528 6.037 2.214 10.33 2.575.028.002.036.039.012.051-.55.282-3.695 1.883-6.03 2.74-.626.23-1.256.443-1.876.64a.028.028 0 01-.033-.016L12.746.128c-.017-.04.027-.078.065-.058z",
|
|
6105
|
+
fill: `url(#${gradientId}-light-blue)`
|
|
6106
|
+
}),
|
|
6107
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6108
|
+
className: "cpk:fill-[#513C9F] cpk:dark:fill-[#B99AE8]",
|
|
6109
|
+
d: "M12.725.075c.046-.019.1.003.119.05l7.514 17.923a.091.091 0 01-.148.1l-.02-.03L12.675.195a.091.091 0 01.049-.12z"
|
|
6110
|
+
}),
|
|
6111
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6112
|
+
className: "cpk:fill-[#513C9F] cpk:dark:fill-[#B99AE8]",
|
|
6113
|
+
d: "M23.06 2.66c.044-.025.1-.01.125.034.025.044.009.1-.035.124v.001l-.008.004-.025.015-.1.054a41.384 41.384 0 01-1.811.92A47.05 47.05 0 0116.33 5.82c-1.954.674-3.97 1.197-5.497 1.552a66.27 66.27 0 01-2.38.507l-.138.026-.036.007h-.01l-.002.002a.091.091 0 11-.033-.18l.016.09-.015-.09h.002l.01-.002.035-.007.137-.025a66.16 66.16 0 002.373-.506c1.524-.354 3.533-.876 5.479-1.547a46.857 46.857 0 006.276-2.709c.166-.087.295-.156.381-.204l.099-.054.024-.014.008-.004z"
|
|
6114
|
+
}),
|
|
6115
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6116
|
+
className: "cpk:fill-[#ABABAB] cpk:dark:fill-[#D4D4D4]",
|
|
6117
|
+
d: "M13.838 2.272a.16.16 0 01.107.2l-2.72 9.055h6.4l.061.013a.16.16 0 010 .295l-.061.013h-6.541L.679 24.099l-.05.04a.16.16 0 01-.194-.245l10.43-12.285 2.773-9.23a.16.16 0 01.2-.107z"
|
|
6118
|
+
}),
|
|
6119
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6120
|
+
d: "M7.809 21.461l-1.232.173c.638 1.69 1.949 2.427 3.514 2.427 3.831 0 2.661-4.334 4.883-4.334 1.61 0 .956 3.513 4.423 3.513 2.116 0 2.326-2.131 1.966-3.048l-.008-.016-.567-.868c-.037-.058-.127-.036-.133.032l-.106 1.053a1.01 1.01 0 00.003.219c.088.727.144 2.491-1.155 2.491-1.37 0-1.7-3.467-4.423-3.467-3.196 0-2.785 4.289-4.747 4.289-1.294 0-2.28-1.46-2.418-2.464z",
|
|
6121
|
+
fill: `url(#${gradientId}-tail)`
|
|
6122
|
+
}),
|
|
6123
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("defs", { children: [
|
|
6124
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
|
|
6125
|
+
gradientUnits: "userSpaceOnUse",
|
|
6126
|
+
id: `${gradientId}-purple`,
|
|
6127
|
+
x1: "17.852",
|
|
6128
|
+
x2: "14.202",
|
|
6129
|
+
y1: "1.467",
|
|
6130
|
+
y2: "11.504",
|
|
6131
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { className: "cpk:[stop-color:#6430AB] cpk:dark:[stop-color:#B792F0]" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6132
|
+
className: "cpk:[stop-color:#AA89D8] cpk:dark:[stop-color:#D3BDF7]",
|
|
6133
|
+
offset: "1"
|
|
6134
|
+
})]
|
|
6135
|
+
}),
|
|
6136
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
|
|
6137
|
+
gradientUnits: "userSpaceOnUse",
|
|
6138
|
+
id: `${gradientId}-blue`,
|
|
6139
|
+
x1: "15.024",
|
|
6140
|
+
x2: "10.324",
|
|
6141
|
+
y1: "7.125",
|
|
6142
|
+
y2: "16.204",
|
|
6143
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { className: "cpk:[stop-color:#005DBB] cpk:dark:[stop-color:#4D9FEF]" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6144
|
+
className: "cpk:[stop-color:#3D92E8] cpk:dark:[stop-color:#84C0FA]",
|
|
6145
|
+
offset: "1"
|
|
6146
|
+
})]
|
|
6147
|
+
}),
|
|
6148
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
|
|
6149
|
+
gradientUnits: "userSpaceOnUse",
|
|
6150
|
+
id: `${gradientId}-light-blue`,
|
|
6151
|
+
x1: "17.122",
|
|
6152
|
+
x2: "15.707",
|
|
6153
|
+
y1: "1.467",
|
|
6154
|
+
y2: "5.892",
|
|
6155
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { className: "cpk:[stop-color:#1B70C4] cpk:dark:[stop-color:#61ACF2]" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6156
|
+
className: "cpk:[stop-color:#54A4F2] cpk:dark:[stop-color:#9ACDFF]",
|
|
6157
|
+
offset: "1"
|
|
6158
|
+
})]
|
|
6159
|
+
}),
|
|
6160
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
|
|
6161
|
+
gradientUnits: "userSpaceOnUse",
|
|
6162
|
+
id: `${gradientId}-tail`,
|
|
6163
|
+
x1: "6.577",
|
|
6164
|
+
x2: "21.506",
|
|
6165
|
+
y1: "21.758",
|
|
6166
|
+
y2: "21.758",
|
|
6167
|
+
children: [
|
|
6168
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { className: "cpk:[stop-color:#4497EA] cpk:dark:[stop-color:#79BCF5]" }),
|
|
6169
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6170
|
+
className: "cpk:[stop-color:#1463B2] cpk:dark:[stop-color:#4594D8]",
|
|
6171
|
+
offset: ".255"
|
|
6172
|
+
}),
|
|
6173
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6174
|
+
className: "cpk:[stop-color:#0A437D] cpk:dark:[stop-color:#347CB7]",
|
|
6175
|
+
offset: ".499"
|
|
6176
|
+
}),
|
|
6177
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6178
|
+
className: "cpk:[stop-color:#2476C8] cpk:dark:[stop-color:#58A4E5]",
|
|
6179
|
+
offset: ".667"
|
|
6180
|
+
}),
|
|
6181
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6182
|
+
className: "cpk:[stop-color:#0C549A] cpk:dark:[stop-color:#3C87C7]",
|
|
6183
|
+
offset: ".973"
|
|
6184
|
+
})
|
|
6185
|
+
]
|
|
6186
|
+
})
|
|
6187
|
+
] })
|
|
6188
|
+
]
|
|
6189
|
+
});
|
|
6190
|
+
}
|
|
5967
6191
|
(function(_CopilotChatAssistantMessage) {
|
|
5968
6192
|
_CopilotChatAssistantMessage.MarkdownRenderer = ({ content, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.Streamdown, {
|
|
5969
6193
|
className,
|
|
@@ -5975,7 +6199,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
|
|
|
5975
6199
|
className: (0, tailwind_merge.twMerge)("cpk:w-full cpk:bg-transparent cpk:flex cpk:items-center cpk:-ml-[5px] cpk:-mt-[0px]", className),
|
|
5976
6200
|
...props
|
|
5977
6201
|
});
|
|
5978
|
-
const ToolbarButton = _CopilotChatAssistantMessage.ToolbarButton = ({ title, children, ...props }) => {
|
|
6202
|
+
const ToolbarButton = _CopilotChatAssistantMessage.ToolbarButton = ({ title, tooltip, children, ...props }) => {
|
|
5979
6203
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipTrigger, {
|
|
5980
6204
|
asChild: true,
|
|
5981
6205
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
@@ -5987,7 +6211,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
|
|
|
5987
6211
|
})
|
|
5988
6212
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipContent, {
|
|
5989
6213
|
side: "bottom",
|
|
5990
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: title })
|
|
6214
|
+
children: tooltip ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: title })
|
|
5991
6215
|
})] });
|
|
5992
6216
|
};
|
|
5993
6217
|
_CopilotChatAssistantMessage.CopyButton = ({ className, title, onClick, ...props }) => {
|
|
@@ -6020,6 +6244,25 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
|
|
|
6020
6244
|
children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "cpk:size-[18px]" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Copy, { className: "cpk:size-[18px]" })
|
|
6021
6245
|
});
|
|
6022
6246
|
};
|
|
6247
|
+
_CopilotChatAssistantMessage.InspectorButton = ({ title, ...props }) => {
|
|
6248
|
+
const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
|
|
6249
|
+
const primaryLabel = title || labels.assistantMessageToolbarInspectorLabel;
|
|
6250
|
+
const localOnlyLabel = labels.assistantMessageToolbarInspectorLocalOnlyLabel;
|
|
6251
|
+
const accessibleLabel = `${primaryLabel} (${localOnlyLabel})`;
|
|
6252
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
6253
|
+
"data-testid": "copilot-inspector-button",
|
|
6254
|
+
title: accessibleLabel,
|
|
6255
|
+
tooltip: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6256
|
+
className: "cpk:flex cpk:flex-col cpk:gap-0.5",
|
|
6257
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: primaryLabel }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6258
|
+
className: "cpk:text-[10px] cpk:opacity-65",
|
|
6259
|
+
children: localOnlyLabel
|
|
6260
|
+
})]
|
|
6261
|
+
}),
|
|
6262
|
+
...props,
|
|
6263
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitColoredIcon, {})
|
|
6264
|
+
});
|
|
6265
|
+
};
|
|
6023
6266
|
_CopilotChatAssistantMessage.ThumbsUpButton = ({ title, ...props }) => {
|
|
6024
6267
|
const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
|
|
6025
6268
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
@@ -6060,6 +6303,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
|
|
|
6060
6303
|
CopilotChatAssistantMessage.MarkdownRenderer.displayName = "CopilotChatAssistantMessage.MarkdownRenderer";
|
|
6061
6304
|
CopilotChatAssistantMessage.Toolbar.displayName = "CopilotChatAssistantMessage.Toolbar";
|
|
6062
6305
|
CopilotChatAssistantMessage.CopyButton.displayName = "CopilotChatAssistantMessage.CopyButton";
|
|
6306
|
+
CopilotChatAssistantMessage.InspectorButton.displayName = "CopilotChatAssistantMessage.InspectorButton";
|
|
6063
6307
|
CopilotChatAssistantMessage.ThumbsUpButton.displayName = "CopilotChatAssistantMessage.ThumbsUpButton";
|
|
6064
6308
|
CopilotChatAssistantMessage.ThumbsDownButton.displayName = "CopilotChatAssistantMessage.ThumbsDownButton";
|
|
6065
6309
|
CopilotChatAssistantMessage.ReadAloudButton.displayName = "CopilotChatAssistantMessage.ReadAloudButton";
|
|
@@ -8161,7 +8405,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
|
|
|
8161
8405
|
const providedThreadId = threadId ?? existingConfig?.threadId;
|
|
8162
8406
|
const resolvedThreadId = (0, react.useMemo)(() => providedThreadId ?? (0, _copilotkit_shared.randomUUID)(), [providedThreadId]);
|
|
8163
8407
|
const hasExplicitThreadId = !!threadId || !!existingConfig?.hasExplicitThreadId;
|
|
8164
|
-
const { agent } = useAgent({
|
|
8408
|
+
const { agent, isReady } = useAgent({
|
|
8165
8409
|
agentId: resolvedAgentId,
|
|
8166
8410
|
throttleMs
|
|
8167
8411
|
});
|
|
@@ -8607,8 +8851,8 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
|
|
|
8607
8851
|
}, []);
|
|
8608
8852
|
const mergedProps = {
|
|
8609
8853
|
isRunning: agent.isRunning,
|
|
8610
|
-
suggestions: autoSuggestions,
|
|
8611
|
-
onSelectSuggestion: handleSelectSuggestion,
|
|
8854
|
+
suggestions: isReady ? autoSuggestions : [],
|
|
8855
|
+
onSelectSuggestion: isReady ? handleSelectSuggestion : void 0,
|
|
8612
8856
|
suggestionView: stableSuggestionView,
|
|
8613
8857
|
...restProps
|
|
8614
8858
|
};
|
|
@@ -8641,7 +8885,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
|
|
|
8641
8885
|
const RenderedChatView = renderSlot(chatView, CopilotChatView, {
|
|
8642
8886
|
...mergedProps,
|
|
8643
8887
|
messages,
|
|
8644
|
-
onSubmitMessage: onSubmitInput,
|
|
8888
|
+
onSubmitMessage: isReady ? onSubmitInput : void 0,
|
|
8645
8889
|
onStop: effectiveStopHandler,
|
|
8646
8890
|
inputMode: effectiveMode,
|
|
8647
8891
|
inputValue,
|
|
@@ -12265,6 +12509,12 @@ Object.defineProperty(exports, 'useSandboxFunctions', {
|
|
|
12265
12509
|
return useSandboxFunctions;
|
|
12266
12510
|
}
|
|
12267
12511
|
});
|
|
12512
|
+
Object.defineProperty(exports, 'useSubagent', {
|
|
12513
|
+
enumerable: true,
|
|
12514
|
+
get: function () {
|
|
12515
|
+
return useSubagent;
|
|
12516
|
+
}
|
|
12517
|
+
});
|
|
12268
12518
|
Object.defineProperty(exports, 'useSuggestions', {
|
|
12269
12519
|
enumerable: true,
|
|
12270
12520
|
get: function () {
|
|
@@ -12295,4 +12545,4 @@ Object.defineProperty(exports, 'ɵrunMcpFollowUp', {
|
|
|
12295
12545
|
return ɵrunMcpFollowUp;
|
|
12296
12546
|
}
|
|
12297
12547
|
});
|
|
12298
|
-
//# sourceMappingURL=copilotkit-
|
|
12548
|
+
//# sourceMappingURL=copilotkit-EFunREg5.cjs.map
|