@copilotkit/react-core 1.70.3 → 1.71.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-BU3OvveB.cjs → copilotkit-B4Jb1QEy.cjs} +365 -153
- package/dist/copilotkit-B4Jb1QEy.cjs.map +1 -0
- package/dist/{copilotkit-Bs98akp9.d.mts → copilotkit-ChjzWqn6.d.mts} +33 -8
- package/dist/copilotkit-ChjzWqn6.d.mts.map +1 -0
- package/dist/{copilotkit-X2eGbOwf.d.cts → copilotkit-DCIXZawe.d.cts} +33 -8
- package/dist/copilotkit-DCIXZawe.d.cts.map +1 -0
- package/dist/{copilotkit-Ap_yisA5.mjs → copilotkit-snbJkMqQ.mjs} +364 -152
- package/dist/copilotkit-snbJkMqQ.mjs.map +1 -0
- package/dist/index.cjs +3 -3
- 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 +4 -4
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +176 -138
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/context.cjs +4 -0
- package/dist/v2/context.cjs.map +1 -1
- package/dist/v2/context.d.cts +3 -1
- package/dist/v2/context.d.cts.map +1 -1
- package/dist/v2/context.d.mts +3 -1
- package/dist/v2/context.d.mts.map +1 -1
- package/dist/v2/context.mjs +3 -1
- package/dist/v2/context.mjs.map +1 -1
- package/dist/v2/headless.cjs +16 -4
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.d.cts +9 -4
- package/dist/v2/headless.d.cts.map +1 -1
- package/dist/v2/headless.d.mts +9 -4
- package/dist/v2/headless.d.mts.map +1 -1
- package/dist/v2/headless.mjs +17 -5
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.css +1 -1
- package/dist/v2/index.d.cts +1 -1
- package/dist/v2/index.d.mts +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/index.umd.js +491 -277
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +7 -7
- package/skills/react-core/SKILL.md +1 -1
- package/skills/react-core/references/agent-access.md +69 -26
- package/skills/react-core/references/chat-components.md +22 -5
- package/dist/copilotkit-Ap_yisA5.mjs.map +0 -1
- package/dist/copilotkit-BU3OvveB.cjs.map +0 -1
- package/dist/copilotkit-Bs98akp9.d.mts.map +0 -1
- package/dist/copilotkit-X2eGbOwf.d.cts.map +0 -1
|
@@ -32,6 +32,7 @@ let _ag_ui_client = require("@ag-ui/client");
|
|
|
32
32
|
let tailwind_merge = require("tailwind-merge");
|
|
33
33
|
let lucide_react = require("lucide-react");
|
|
34
34
|
let _copilotkit_shared = require("@copilotkit/shared");
|
|
35
|
+
let _copilotkit_react_core_v2_context = require("@copilotkit/react-core/v2/context");
|
|
35
36
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
36
37
|
let _radix_ui_react_slot = require("@radix-ui/react-slot");
|
|
37
38
|
let class_variance_authority = require("class-variance-authority");
|
|
@@ -41,7 +42,6 @@ _radix_ui_react_tooltip = __toESM(_radix_ui_react_tooltip);
|
|
|
41
42
|
let _radix_ui_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
42
43
|
_radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
43
44
|
let streamdown = require("streamdown");
|
|
44
|
-
let _copilotkit_react_core_v2_context = require("@copilotkit/react-core/v2/context");
|
|
45
45
|
let zod = require("zod");
|
|
46
46
|
let _copilotkit_a2ui_renderer = require("@copilotkit/a2ui-renderer");
|
|
47
47
|
let zod_to_json_schema = require("zod-to-json-schema");
|
|
@@ -106,7 +106,12 @@ const CopilotChatDefaultLabels = {
|
|
|
106
106
|
assistantMessageToolbarCopyCodeCopiedLabel: "Copied",
|
|
107
107
|
assistantMessageToolbarCopyMessageLabel: "Copy",
|
|
108
108
|
assistantMessageToolbarInspectorLabel: "View in Inspector",
|
|
109
|
-
|
|
109
|
+
assistantMessageToolbarInspectorDescription: "Open this message in the Inspector",
|
|
110
|
+
assistantMessageToolbarInspectorLocalOnlyLabel: "Local only",
|
|
111
|
+
assistantMessageToolbarInspectorLocalOnlyDescription: "Only visible on localhost or loopback hosts in development. Never shown in production.",
|
|
112
|
+
assistantMessageToolbarInspectorTitle: "CopilotKit Inspector",
|
|
113
|
+
assistantMessageToolbarInspectorHideLabel: "Hide this icon",
|
|
114
|
+
assistantMessageToolbarInspectorHideDescription: "Until you reload this page",
|
|
110
115
|
assistantMessageToolbarThumbsUpLabel: "Good response",
|
|
111
116
|
assistantMessageToolbarThumbsDownLabel: "Bad response",
|
|
112
117
|
assistantMessageToolbarReadAloudLabel: "Read aloud",
|
|
@@ -147,7 +152,8 @@ const CopilotChatConfigurationProvider = ({ children, labels, agentId, threadId,
|
|
|
147
152
|
...parentConfig?.labels,
|
|
148
153
|
...stableLabels
|
|
149
154
|
}), [stableLabels, parentConfig?.labels]);
|
|
150
|
-
const
|
|
155
|
+
const providerAgentId = (0, _copilotkit_react_core_v2_context.useDefaultAgentId)();
|
|
156
|
+
const resolvedAgentId = agentId ?? parentConfig?.agentId ?? providerAgentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
|
|
151
157
|
const threadIdPropIsAuthoritative = threadId !== void 0 && hasExplicitThreadId !== false;
|
|
152
158
|
const isThreadIdControlled = threadIdPropIsAuthoritative;
|
|
153
159
|
const [activeThreadOverride, setActiveThreadOverride] = (0, react.useState)(null);
|
|
@@ -357,9 +363,9 @@ ControlledModalOpenScope.displayName = "ControlledModalOpenScope";
|
|
|
357
363
|
|
|
358
364
|
//#endregion
|
|
359
365
|
//#region src/v2/lib/utils.ts
|
|
360
|
-
const twMerge$
|
|
366
|
+
const twMerge$10 = (0, tailwind_merge.extendTailwindMerge)({ prefix: "cpk" });
|
|
361
367
|
function cn(...inputs) {
|
|
362
|
-
return twMerge$
|
|
368
|
+
return twMerge$10((0, clsx.clsx)(inputs));
|
|
363
369
|
}
|
|
364
370
|
|
|
365
371
|
//#endregion
|
|
@@ -504,6 +510,14 @@ function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
|
|
|
504
510
|
...props
|
|
505
511
|
});
|
|
506
512
|
}
|
|
513
|
+
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
514
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Label, {
|
|
515
|
+
"data-slot": "dropdown-menu-label",
|
|
516
|
+
"data-inset": inset,
|
|
517
|
+
className: cn("cpk:px-2 cpk:py-1.5 cpk:text-sm cpk:font-medium cpk:data-[inset]:pl-8", className),
|
|
518
|
+
...props
|
|
519
|
+
});
|
|
520
|
+
}
|
|
507
521
|
function DropdownMenuSeparator({ className, ...props }) {
|
|
508
522
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Separator, {
|
|
509
523
|
"data-slot": "dropdown-menu-separator",
|
|
@@ -1620,21 +1634,28 @@ function useRenderToolCall() {
|
|
|
1620
1634
|
|
|
1621
1635
|
//#endregion
|
|
1622
1636
|
//#region src/v2/components/CopilotKitInspector.tsx
|
|
1623
|
-
const CopilotKitInspector = ({ core, openRequest }) => {
|
|
1637
|
+
const CopilotKitInspector = ({ core, openRequest, onVisibilityChange }) => {
|
|
1624
1638
|
const mountRef = react.useRef(null);
|
|
1625
1639
|
const inspectorRef = react.useRef(null);
|
|
1626
1640
|
const latestCoreRef = react.useRef(core ?? null);
|
|
1627
1641
|
const latestOpenRequestRef = react.useRef(openRequest);
|
|
1642
|
+
const visibilityCallbackRef = react.useRef(onVisibilityChange);
|
|
1643
|
+
visibilityCallbackRef.current = onVisibilityChange;
|
|
1628
1644
|
latestCoreRef.current = core ?? null;
|
|
1629
1645
|
latestOpenRequestRef.current = openRequest;
|
|
1630
1646
|
react.useEffect(() => {
|
|
1631
1647
|
let mounted = true;
|
|
1632
1648
|
let inspector = null;
|
|
1649
|
+
const handleVisibilityChange = (event) => {
|
|
1650
|
+
const visible = event.detail?.visible;
|
|
1651
|
+
visibilityCallbackRef.current?.(visible === true);
|
|
1652
|
+
};
|
|
1633
1653
|
import("@copilotkit/web-inspector").then((mod) => {
|
|
1634
1654
|
if (!mounted || !mountRef.current) return;
|
|
1635
1655
|
mod.defineWebInspector?.();
|
|
1636
1656
|
inspector = mountRef.current.ownerDocument.createElement(mod.WEB_INSPECTOR_TAG);
|
|
1637
1657
|
mod.configureWebInspectorElement(inspector, latestCoreRef.current);
|
|
1658
|
+
inspector.addEventListener("cpk-inspector-visibility-change", handleVisibilityChange);
|
|
1638
1659
|
mountRef.current.appendChild(inspector);
|
|
1639
1660
|
inspectorRef.current = inspector;
|
|
1640
1661
|
const request = latestOpenRequestRef.current;
|
|
@@ -1644,7 +1665,9 @@ const CopilotKitInspector = ({ core, openRequest }) => {
|
|
|
1644
1665
|
});
|
|
1645
1666
|
return () => {
|
|
1646
1667
|
mounted = false;
|
|
1668
|
+
inspector?.removeEventListener("cpk-inspector-visibility-change", handleVisibilityChange);
|
|
1647
1669
|
inspector?.remove();
|
|
1670
|
+
visibilityCallbackRef.current?.(false);
|
|
1648
1671
|
if (inspectorRef.current === inspector) inspectorRef.current = null;
|
|
1649
1672
|
};
|
|
1650
1673
|
}, []);
|
|
@@ -3673,14 +3696,19 @@ function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
|
|
|
3673
3696
|
}, [value, warningMessage]);
|
|
3674
3697
|
return value;
|
|
3675
3698
|
}
|
|
3676
|
-
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, enableInspector, useSingleEndpoint, onError, a2ui, defaultThrottleMs, debug }) => {
|
|
3699
|
+
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, enableInspector, agentId, useSingleEndpoint, onError, a2ui, defaultThrottleMs, debug }) => {
|
|
3677
3700
|
const [shouldRenderInspector, setShouldRenderInspector] = (0, react.useState)(false);
|
|
3701
|
+
const [inspectorVisible, setInspectorVisible] = (0, react.useState)(false);
|
|
3678
3702
|
(0, react.useEffect)(() => {
|
|
3679
3703
|
setShouldRenderInspector((0, _copilotkit_shared.shouldEnableInspector)({
|
|
3680
3704
|
enableInspector,
|
|
3681
3705
|
isBrowser: true,
|
|
3682
3706
|
isDevelopment: process.env.NODE_ENV === "development"
|
|
3683
|
-
})
|
|
3707
|
+
}) && [
|
|
3708
|
+
"localhost",
|
|
3709
|
+
"127.0.0.1",
|
|
3710
|
+
"[::1]"
|
|
3711
|
+
].includes(window.location.hostname));
|
|
3684
3712
|
}, [enableInspector]);
|
|
3685
3713
|
const [inspectorOpenRequest, setInspectorOpenRequest] = (0, react.useState)(null);
|
|
3686
3714
|
const [runtimeA2UIEnabled, setRuntimeA2UIEnabled] = (0, react.useState)(false);
|
|
@@ -3696,9 +3724,15 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
3696
3724
|
setInspectorOpenRequest({ ...request });
|
|
3697
3725
|
}, []);
|
|
3698
3726
|
const inspectorContextValue = (0, react.useMemo)(() => ({
|
|
3699
|
-
|
|
3727
|
+
providerEnableInspector: enableInspector,
|
|
3728
|
+
isInspectorEnabled: shouldRenderInspector && inspectorVisible,
|
|
3700
3729
|
openInspector: requestInspectorOpen
|
|
3701
|
-
}), [
|
|
3730
|
+
}), [
|
|
3731
|
+
enableInspector,
|
|
3732
|
+
shouldRenderInspector,
|
|
3733
|
+
inspectorVisible,
|
|
3734
|
+
requestInspectorOpen
|
|
3735
|
+
]);
|
|
3702
3736
|
const renderToolCallsList = useStableArrayProp(renderToolCalls, "renderToolCalls must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.", (initial, next) => {
|
|
3703
3737
|
const key = (rc) => `${rc?.agentId ?? ""}:${rc?.name ?? ""}`;
|
|
3704
3738
|
const setFrom = (arr) => new Set(arr.map(key));
|
|
@@ -4095,9 +4129,13 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
4095
4129
|
}),
|
|
4096
4130
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CopilotKitInspectorContextProvider, {
|
|
4097
4131
|
value: inspectorContextValue,
|
|
4098
|
-
children: [
|
|
4132
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_copilotkit_react_core_v2_context.CopilotKitAgentIdContext.Provider, {
|
|
4133
|
+
value: agentId,
|
|
4134
|
+
children
|
|
4135
|
+
}), shouldRenderInspector ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitInspector, {
|
|
4099
4136
|
core: copilotkit,
|
|
4100
|
-
openRequest: inspectorOpenRequest
|
|
4137
|
+
openRequest: inspectorOpenRequest,
|
|
4138
|
+
onVisibilityChange: setInspectorVisible
|
|
4101
4139
|
}) : null]
|
|
4102
4140
|
}),
|
|
4103
4141
|
runtimeLicenseWarningStatus === "none" && !resolvedPublicKey && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LicenseWarningBanner, { type: "no_license" }),
|
|
@@ -4679,7 +4717,8 @@ function useAgent({ agentId, threadId, runtimeAgentId, updates, throttleMs } = {
|
|
|
4679
4717
|
if (runtimeAgentId != null && threadId == null) throw new Error(`useAgent: \`runtimeAgentId\` requires \`threadId\`. A proxied agent exists to scope a thread to a private instance; without a threadId it behaves like the shared agent while adding a registration and a local agentId to keep unique. Either pass the thread, e.g. useAgent({ agentId: "${agentId ?? "chat-1"}", runtimeAgentId: "${runtimeAgentId}", threadId }), or bind to the agent directly with useAgent({ agentId: "${runtimeAgentId}" }).`);
|
|
4680
4718
|
if (runtimeAgentId != null && agentId == null) throw new Error(`useAgent: \`runtimeAgentId\` requires an explicit \`agentId\`. The proxied agent is registered under \`agentId\`, and the usual fallbacks (chat configuration, then "${_copilotkit_shared.DEFAULT_AGENT_ID}") name agents that already exist — registering over one throws or shadows it. Pick a local id for this hook, e.g. useAgent({ agentId: "chat-1", runtimeAgentId: "${runtimeAgentId}", threadId }).`);
|
|
4681
4719
|
const chatConfig = useCopilotChatConfiguration();
|
|
4682
|
-
const
|
|
4720
|
+
const providerAgentId = (0, _copilotkit_react_core_v2_context.useDefaultAgentId)();
|
|
4721
|
+
const resolvedAgentId = agentId ?? chatConfig?.agentId ?? providerAgentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
|
|
4683
4722
|
const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
|
|
4684
4723
|
const providerThrottleMs = copilotkit.defaultThrottleMs;
|
|
4685
4724
|
const [, forceUpdate] = (0, react.useReducer)((x) => x + 1, 0);
|
|
@@ -4907,7 +4946,12 @@ function useAgentContext(context) {
|
|
|
4907
4946
|
function useSuggestions({ agentId } = {}) {
|
|
4908
4947
|
const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
|
|
4909
4948
|
const config = useCopilotChatConfiguration();
|
|
4910
|
-
const
|
|
4949
|
+
const providerAgentId = (0, _copilotkit_react_core_v2_context.useDefaultAgentId)();
|
|
4950
|
+
const resolvedAgentId = (0, react.useMemo)(() => agentId ?? config?.agentId ?? providerAgentId ?? _copilotkit_shared.DEFAULT_AGENT_ID, [
|
|
4951
|
+
agentId,
|
|
4952
|
+
config?.agentId,
|
|
4953
|
+
providerAgentId
|
|
4954
|
+
]);
|
|
4911
4955
|
const [suggestions, setSuggestions] = (0, react.useState)(() => {
|
|
4912
4956
|
return copilotkit.getSuggestions(resolvedAgentId).suggestions;
|
|
4913
4957
|
});
|
|
@@ -6211,6 +6255,289 @@ function CopilotChatToolCallsView({ message, messages = [] }) {
|
|
|
6211
6255
|
}) });
|
|
6212
6256
|
}
|
|
6213
6257
|
|
|
6258
|
+
//#endregion
|
|
6259
|
+
//#region src/v2/components/chat/CopilotChatInspectorButton.tsx
|
|
6260
|
+
let shortcutsHidden = false;
|
|
6261
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
6262
|
+
const subscribe = (listener) => {
|
|
6263
|
+
listeners.add(listener);
|
|
6264
|
+
return () => {
|
|
6265
|
+
listeners.delete(listener);
|
|
6266
|
+
};
|
|
6267
|
+
};
|
|
6268
|
+
const getSnapshot = () => shortcutsHidden;
|
|
6269
|
+
const getServerSnapshot = () => false;
|
|
6270
|
+
function useInspectorShortcutsHidden() {
|
|
6271
|
+
return (0, react.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
6272
|
+
}
|
|
6273
|
+
function hideShortcuts() {
|
|
6274
|
+
shortcutsHidden = true;
|
|
6275
|
+
listeners.forEach((listener) => listener());
|
|
6276
|
+
}
|
|
6277
|
+
function InspectorKiteIcon({ className, ...props }) {
|
|
6278
|
+
const id = (0, react.useId)();
|
|
6279
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
6280
|
+
...props,
|
|
6281
|
+
"aria-hidden": "true",
|
|
6282
|
+
className: (0, tailwind_merge.twMerge)("cpk:size-4", className),
|
|
6283
|
+
viewBox: "4.57 3.36 17.8 17.8",
|
|
6284
|
+
fill: "none",
|
|
6285
|
+
children: [
|
|
6286
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6287
|
+
d: "M6.36084 10.9855C8.34277 8.393 9.98843 5.82939 10.6204 3.75914C10.6382 3.70281 10.7043 3.67888 10.7534 3.7114C12.9536 5.16894 16.9635 6.12833 20.5086 6.15085C20.5703 6.15124 20.6124 6.2114 20.5895 6.26829C19.4109 9.25938 17.9705 14.6189 17.9148 20.7392C17.9148 20.8301 17.7873 20.8627 17.7419 20.7837C15.7236 17.2522 9.26021 12.2898 6.39414 11.1186C6.34112 11.0968 6.32556 11.0313 6.36084 10.9855Z",
|
|
6288
|
+
fill: `url(#${id}-paint0_linear)`
|
|
6289
|
+
}),
|
|
6290
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6291
|
+
d: "M13.0475 9.39974C9.95016 10.3806 7.11935 10.9259 6.44331 11.0498C6.40027 11.0577 6.39115 11.1172 6.43152 11.134C9.3203 12.3347 15.7516 17.2826 17.7511 20.7998C17.7551 20.8075 17.7647 20.8103 17.7728 20.8068C17.7809 20.803 17.7853 20.793 17.7819 20.7844L13.0475 9.39974Z",
|
|
6292
|
+
fill: `url(#${id}-paint1_linear)`
|
|
6293
|
+
}),
|
|
6294
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6295
|
+
d: "M10.762 3.705C13.4137 5.15161 16.4787 5.80132 20.545 6.14367C20.5703 6.14585 20.5787 6.18008 20.5557 6.19197C20.0359 6.45923 17.0574 7.97512 14.8455 8.78701C14.2524 9.00453 13.6564 9.20632 13.0692 9.39249C13.0562 9.39656 13.0419 9.39015 13.0369 9.37774L10.7005 3.75979C10.6849 3.72196 10.7257 3.68538 10.762 3.705Z",
|
|
6296
|
+
fill: `url(#${id}-paint2_linear)`
|
|
6297
|
+
}),
|
|
6298
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6299
|
+
d: "M10.7145 3.79041L17.8305 20.7659",
|
|
6300
|
+
stroke: "#513C9F",
|
|
6301
|
+
strokeWidth: "0.17284",
|
|
6302
|
+
strokeLinecap: "round"
|
|
6303
|
+
}),
|
|
6304
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6305
|
+
d: "M6.44531 11.0476C6.44531 11.0476 10.375 10.3422 14.0686 9.06804C17.7623 7.7939 20.5122 6.23373 20.5122 6.23373",
|
|
6306
|
+
stroke: "#513C9F",
|
|
6307
|
+
strokeWidth: "0.17284",
|
|
6308
|
+
strokeLinecap: "round"
|
|
6309
|
+
}),
|
|
6310
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6311
|
+
d: "M11.6914 5.93518L9.05534 14.7068M9.05534 14.7068H15.3203M9.05534 14.7068L0.15625 26.3646",
|
|
6312
|
+
stroke: "#ABABAB",
|
|
6313
|
+
strokeWidth: "0.302474",
|
|
6314
|
+
strokeLinecap: "round"
|
|
6315
|
+
}),
|
|
6316
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6317
|
+
d: "M6.02539 23.9646L4.85806 24.1287C5.46272 25.7287 6.70381 26.4276 8.18528 26.4276C11.8147 26.4276 10.707 22.3227 12.8103 22.3227C14.3358 22.3227 13.7155 25.6498 16.9992 25.6498C19.0029 25.6498 19.2028 23.631 18.8607 22.7625C18.8589 22.7572 18.8568 22.7524 18.8538 22.7476L18.3166 21.9253C18.2817 21.8706 18.1968 21.8912 18.1907 21.9562L18.0908 22.9529C18.0838 23.0222 18.0857 23.0913 18.0936 23.1605C18.1764 23.8491 18.2291 25.5202 16.9992 25.5202C15.7015 25.5202 15.3895 22.2362 12.8103 22.2362C9.78393 22.2362 10.1726 26.298 8.31487 26.298C7.08938 26.298 6.15447 24.9153 6.02539 23.9646Z",
|
|
6318
|
+
fill: `url(#${id}-paint3_linear)`
|
|
6319
|
+
}),
|
|
6320
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("defs", { children: [
|
|
6321
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
|
|
6322
|
+
id: `${id}-paint0_linear`,
|
|
6323
|
+
x1: "15.5372",
|
|
6324
|
+
y1: "5.0278",
|
|
6325
|
+
x2: "12.0802",
|
|
6326
|
+
y2: "14.534",
|
|
6327
|
+
gradientUnits: "userSpaceOnUse",
|
|
6328
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { stopColor: "#6430AB" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6329
|
+
offset: "1",
|
|
6330
|
+
stopColor: "#AA89D8"
|
|
6331
|
+
})]
|
|
6332
|
+
}),
|
|
6333
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
|
|
6334
|
+
id: `${id}-paint1_linear`,
|
|
6335
|
+
x1: "12.8583",
|
|
6336
|
+
y1: "10.3858",
|
|
6337
|
+
x2: "8.40764",
|
|
6338
|
+
y2: "18.9846",
|
|
6339
|
+
gradientUnits: "userSpaceOnUse",
|
|
6340
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { stopColor: "#005DBB" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6341
|
+
offset: "1",
|
|
6342
|
+
stopColor: "#3D92E8"
|
|
6343
|
+
})]
|
|
6344
|
+
}),
|
|
6345
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
|
|
6346
|
+
id: `${id}-paint2_linear`,
|
|
6347
|
+
x1: "14.8452",
|
|
6348
|
+
y1: "5.02774",
|
|
6349
|
+
x2: "13.5047",
|
|
6350
|
+
y2: "9.21911",
|
|
6351
|
+
gradientUnits: "userSpaceOnUse",
|
|
6352
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { stopColor: "#1B70C4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6353
|
+
offset: "1",
|
|
6354
|
+
stopColor: "#54A4F2"
|
|
6355
|
+
})]
|
|
6356
|
+
}),
|
|
6357
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
|
|
6358
|
+
id: `${id}-paint3_linear`,
|
|
6359
|
+
x1: "4.85806",
|
|
6360
|
+
y1: "24.2455",
|
|
6361
|
+
x2: "18.9963",
|
|
6362
|
+
y2: "24.2455",
|
|
6363
|
+
gradientUnits: "userSpaceOnUse",
|
|
6364
|
+
children: [
|
|
6365
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { stopColor: "#4497EA" }),
|
|
6366
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6367
|
+
offset: "0.254755",
|
|
6368
|
+
stopColor: "#1463B2"
|
|
6369
|
+
}),
|
|
6370
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6371
|
+
offset: "0.498725",
|
|
6372
|
+
stopColor: "#0A437D"
|
|
6373
|
+
}),
|
|
6374
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6375
|
+
offset: "0.666667",
|
|
6376
|
+
stopColor: "#2476C8"
|
|
6377
|
+
}),
|
|
6378
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6379
|
+
offset: "0.972542",
|
|
6380
|
+
stopColor: "#0C549A"
|
|
6381
|
+
})
|
|
6382
|
+
]
|
|
6383
|
+
})
|
|
6384
|
+
] })
|
|
6385
|
+
]
|
|
6386
|
+
});
|
|
6387
|
+
}
|
|
6388
|
+
function CopilotChatInspectorButton({ title, className, onClick, onPointerDown, onPointerEnter, onPointerLeave, onKeyDown, disabled, ...props }) {
|
|
6389
|
+
const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
|
|
6390
|
+
const { isInspectorEnabled } = useCopilotKitInspector();
|
|
6391
|
+
const hidden = useInspectorShortcutsHidden();
|
|
6392
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
6393
|
+
const [dark, setDark] = (0, react.useState)(false);
|
|
6394
|
+
const trigger = (0, react.useRef)(null);
|
|
6395
|
+
const closeTimer = (0, react.useRef)(null);
|
|
6396
|
+
const openedByHover = (0, react.useRef)(false);
|
|
6397
|
+
const primaryLabel = title || labels.assistantMessageToolbarInspectorLabel;
|
|
6398
|
+
const cancelClose = () => {
|
|
6399
|
+
if (closeTimer.current !== null) clearTimeout(closeTimer.current);
|
|
6400
|
+
closeTimer.current = null;
|
|
6401
|
+
};
|
|
6402
|
+
(0, react.useEffect)(() => cancelClose, []);
|
|
6403
|
+
const changeOpen = (next) => {
|
|
6404
|
+
cancelClose();
|
|
6405
|
+
if (next) setDark(!!trigger.current?.closest(".dark"));
|
|
6406
|
+
setOpen(next);
|
|
6407
|
+
};
|
|
6408
|
+
const scheduleClose = () => {
|
|
6409
|
+
cancelClose();
|
|
6410
|
+
closeTimer.current = setTimeout(() => {
|
|
6411
|
+
if (openedByHover.current) setOpen(false);
|
|
6412
|
+
}, 180);
|
|
6413
|
+
};
|
|
6414
|
+
if (!isInspectorEnabled || hidden) return null;
|
|
6415
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownMenu, {
|
|
6416
|
+
open,
|
|
6417
|
+
onOpenChange: changeOpen,
|
|
6418
|
+
modal: false,
|
|
6419
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuTrigger, {
|
|
6420
|
+
asChild: true,
|
|
6421
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
6422
|
+
...props,
|
|
6423
|
+
ref: trigger,
|
|
6424
|
+
type: "button",
|
|
6425
|
+
disabled,
|
|
6426
|
+
variant: "assistantMessageToolbarButton",
|
|
6427
|
+
size: "icon",
|
|
6428
|
+
"data-testid": "copilot-inspector-button",
|
|
6429
|
+
"aria-label": `${labels.assistantMessageToolbarInspectorTitle} (${labels.assistantMessageToolbarInspectorLocalOnlyLabel.toLowerCase()})`,
|
|
6430
|
+
className: (0, tailwind_merge.twMerge)("cpk:size-8 cpk:p-1.5", className),
|
|
6431
|
+
onPointerEnter: (event) => {
|
|
6432
|
+
onPointerEnter?.(event);
|
|
6433
|
+
if (!disabled && event.pointerType !== "touch") {
|
|
6434
|
+
openedByHover.current = true;
|
|
6435
|
+
changeOpen(true);
|
|
6436
|
+
}
|
|
6437
|
+
},
|
|
6438
|
+
onPointerLeave: (event) => {
|
|
6439
|
+
onPointerLeave?.(event);
|
|
6440
|
+
scheduleClose();
|
|
6441
|
+
},
|
|
6442
|
+
onPointerDown: (event) => {
|
|
6443
|
+
onPointerDown?.(event);
|
|
6444
|
+
event.preventDefault();
|
|
6445
|
+
},
|
|
6446
|
+
onClick: (event) => {
|
|
6447
|
+
changeOpen(false);
|
|
6448
|
+
onClick?.(event);
|
|
6449
|
+
},
|
|
6450
|
+
onKeyDown: (event) => {
|
|
6451
|
+
openedByHover.current = false;
|
|
6452
|
+
onKeyDown?.(event);
|
|
6453
|
+
if (!event.defaultPrevented && (event.key === "Enter" || event.key === " ")) {
|
|
6454
|
+
event.preventDefault();
|
|
6455
|
+
event.currentTarget.click();
|
|
6456
|
+
}
|
|
6457
|
+
},
|
|
6458
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Wrench, {
|
|
6459
|
+
"aria-hidden": "true",
|
|
6460
|
+
className: "cpk:size-4",
|
|
6461
|
+
"data-testid": "copilot-inspector-icon"
|
|
6462
|
+
})
|
|
6463
|
+
})
|
|
6464
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownMenuContent, {
|
|
6465
|
+
align: "start",
|
|
6466
|
+
side: "top",
|
|
6467
|
+
sideOffset: 6,
|
|
6468
|
+
className: (0, tailwind_merge.twMerge)("cpk:w-64 cpk:p-1 cpk:text-sm", dark && "dark"),
|
|
6469
|
+
onPointerEnter: cancelClose,
|
|
6470
|
+
onPointerLeave: scheduleClose,
|
|
6471
|
+
onKeyDown: () => {
|
|
6472
|
+
openedByHover.current = false;
|
|
6473
|
+
},
|
|
6474
|
+
onOpenAutoFocus: (event) => {
|
|
6475
|
+
if (openedByHover.current) event.preventDefault();
|
|
6476
|
+
},
|
|
6477
|
+
onCloseAutoFocus: (event) => {
|
|
6478
|
+
if (openedByHover.current) event.preventDefault();
|
|
6479
|
+
},
|
|
6480
|
+
onFocusOutside: () => changeOpen(false),
|
|
6481
|
+
children: [
|
|
6482
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownMenuLabel, {
|
|
6483
|
+
className: "cpk:flex cpk:items-center cpk:justify-between cpk:gap-3 cpk:px-2 cpk:py-2",
|
|
6484
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6485
|
+
className: "cpk:text-xs cpk:font-medium",
|
|
6486
|
+
children: labels.assistantMessageToolbarInspectorTitle
|
|
6487
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tooltip, {
|
|
6488
|
+
delayDuration: 1e3,
|
|
6489
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipTrigger, {
|
|
6490
|
+
asChild: true,
|
|
6491
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6492
|
+
tabIndex: 0,
|
|
6493
|
+
className: "cpk:cursor-help cpk:rounded cpk:bg-muted cpk:px-1.5 cpk:py-0.5 cpk:text-[10px] cpk:font-normal cpk:text-muted-foreground",
|
|
6494
|
+
children: labels.assistantMessageToolbarInspectorLocalOnlyLabel
|
|
6495
|
+
})
|
|
6496
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipContent, {
|
|
6497
|
+
side: "top",
|
|
6498
|
+
sideOffset: 6,
|
|
6499
|
+
className: (0, tailwind_merge.twMerge)("cpk:max-w-48 cpk:text-wrap", dark && "dark"),
|
|
6500
|
+
onPointerEnter: cancelClose,
|
|
6501
|
+
onPointerLeave: scheduleClose,
|
|
6502
|
+
children: labels.assistantMessageToolbarInspectorLocalOnlyDescription
|
|
6503
|
+
})]
|
|
6504
|
+
})]
|
|
6505
|
+
}),
|
|
6506
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuSeparator, {}),
|
|
6507
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuItem, {
|
|
6508
|
+
asChild: true,
|
|
6509
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
6510
|
+
type: "button",
|
|
6511
|
+
onClick,
|
|
6512
|
+
className: "cpk:w-full cpk:cursor-pointer cpk:items-start cpk:text-left",
|
|
6513
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(InspectorKiteIcon, { className: "cpk:mt-0.5" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6514
|
+
className: "cpk:block",
|
|
6515
|
+
children: primaryLabel
|
|
6516
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6517
|
+
className: "cpk:block cpk:text-xs cpk:text-muted-foreground",
|
|
6518
|
+
children: labels.assistantMessageToolbarInspectorDescription
|
|
6519
|
+
})] })]
|
|
6520
|
+
})
|
|
6521
|
+
}),
|
|
6522
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownMenuItem, {
|
|
6523
|
+
onSelect: hideShortcuts,
|
|
6524
|
+
className: "cpk:cursor-pointer cpk:items-start",
|
|
6525
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.EyeOff, {
|
|
6526
|
+
"aria-hidden": "true",
|
|
6527
|
+
className: "cpk:mt-0.5"
|
|
6528
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6529
|
+
className: "cpk:block",
|
|
6530
|
+
children: labels.assistantMessageToolbarInspectorHideLabel
|
|
6531
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6532
|
+
className: "cpk:block cpk:text-xs cpk:text-muted-foreground",
|
|
6533
|
+
children: labels.assistantMessageToolbarInspectorHideDescription
|
|
6534
|
+
})] })]
|
|
6535
|
+
})
|
|
6536
|
+
]
|
|
6537
|
+
})]
|
|
6538
|
+
});
|
|
6539
|
+
}
|
|
6540
|
+
|
|
6214
6541
|
//#endregion
|
|
6215
6542
|
//#region src/v2/components/chat/CopilotChatAssistantMessage.tsx
|
|
6216
6543
|
/**
|
|
@@ -6231,30 +6558,32 @@ function BoundInspectorButton({ inspectorButton, messageId, openInspector, ...pr
|
|
|
6231
6558
|
function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible = true, markdownRenderer, toolbar, copyButton, inspectorButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, toolCallsView, children, className, ...props }) {
|
|
6232
6559
|
useKatexStyles();
|
|
6233
6560
|
const { isInspectorEnabled, openInspector } = useCopilotKitInspector();
|
|
6561
|
+
const shortcutsHidden = useInspectorShortcutsHidden();
|
|
6562
|
+
const showInspectorShortcut = isInspectorEnabled && !shortcutsHidden;
|
|
6234
6563
|
const boundMarkdownRenderer = renderSlot(markdownRenderer, CopilotChatAssistantMessage.MarkdownRenderer, { content: message.content || "" });
|
|
6235
6564
|
const boundCopyButton = renderSlot(copyButton, CopilotChatAssistantMessage.CopyButton, { onClick: async () => {
|
|
6236
6565
|
if (message.content) return await (0, _copilotkit_shared.copyToClipboard)(message.content);
|
|
6237
6566
|
return false;
|
|
6238
6567
|
} });
|
|
6239
6568
|
const boundThumbsUpButton = renderSlot(thumbsUpButton, CopilotChatAssistantMessage.ThumbsUpButton, { onClick: onThumbsUp ? () => onThumbsUp(message) : void 0 });
|
|
6240
|
-
const boundInspectorButton = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BoundInspectorButton, {
|
|
6569
|
+
const boundInspectorButton = showInspectorShortcut ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BoundInspectorButton, {
|
|
6241
6570
|
inspectorButton,
|
|
6242
6571
|
messageId: message.id,
|
|
6243
6572
|
openInspector
|
|
6244
|
-
});
|
|
6573
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
|
|
6245
6574
|
const boundThumbsDownButton = renderSlot(thumbsDownButton, CopilotChatAssistantMessage.ThumbsDownButton, { onClick: onThumbsDown ? () => onThumbsDown(message) : void 0 });
|
|
6246
6575
|
const boundReadAloudButton = renderSlot(readAloudButton, CopilotChatAssistantMessage.ReadAloudButton, { onClick: onReadAloud ? () => onReadAloud(message) : void 0 });
|
|
6247
6576
|
const boundRegenerateButton = renderSlot(regenerateButton, CopilotChatAssistantMessage.RegenerateButton, { onClick: onRegenerate ? () => onRegenerate(message) : void 0 });
|
|
6248
6577
|
const boundToolbar = renderSlot(toolbar, CopilotChatAssistantMessage.Toolbar, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6249
|
-
className: "cpk:flex cpk:items-center cpk:gap-1",
|
|
6578
|
+
className: "cpk:flex cpk:w-full cpk:items-center cpk:gap-1",
|
|
6250
6579
|
children: [
|
|
6251
6580
|
boundCopyButton,
|
|
6252
|
-
isInspectorEnabled && boundInspectorButton,
|
|
6253
6581
|
(onThumbsUp || thumbsUpButton) && boundThumbsUpButton,
|
|
6254
6582
|
(onThumbsDown || thumbsDownButton) && boundThumbsDownButton,
|
|
6255
6583
|
(onReadAloud || readAloudButton) && boundReadAloudButton,
|
|
6256
6584
|
(onRegenerate || regenerateButton) && boundRegenerateButton,
|
|
6257
|
-
additionalToolbarItems
|
|
6585
|
+
additionalToolbarItems,
|
|
6586
|
+
showInspectorShortcut && boundInspectorButton
|
|
6258
6587
|
]
|
|
6259
6588
|
}) });
|
|
6260
6589
|
const boundToolCallsView = renderSlot(toolCallsView, CopilotChatToolCallsView, {
|
|
@@ -6263,7 +6592,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
|
|
|
6263
6592
|
});
|
|
6264
6593
|
const hasContent = !!(message.content && message.content.trim().length > 0);
|
|
6265
6594
|
const isLatestAssistantMessage = message.role === "assistant" && messages?.[messages.length - 1]?.id === message.id;
|
|
6266
|
-
const shouldShowToolbar = toolbarVisible && (hasContent ||
|
|
6595
|
+
const shouldShowToolbar = toolbarVisible && (hasContent || showInspectorShortcut) && !(isRunning && isLatestAssistantMessage);
|
|
6267
6596
|
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6268
6597
|
"data-copilotkit": true,
|
|
6269
6598
|
style: { display: "contents" },
|
|
@@ -6304,110 +6633,6 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
|
|
|
6304
6633
|
]
|
|
6305
6634
|
});
|
|
6306
6635
|
}
|
|
6307
|
-
function CopilotKitColoredIcon() {
|
|
6308
|
-
const gradientId = (0, react.useId)().replace(/:/g, "");
|
|
6309
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
6310
|
-
"aria-hidden": "true",
|
|
6311
|
-
className: "cpk:size-5",
|
|
6312
|
-
"data-testid": "copilot-inspector-icon",
|
|
6313
|
-
viewBox: "0 0 24 24",
|
|
6314
|
-
children: [
|
|
6315
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6316
|
-
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",
|
|
6317
|
-
fill: `url(#${gradientId}-purple)`
|
|
6318
|
-
}),
|
|
6319
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6320
|
-
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",
|
|
6321
|
-
fill: `url(#${gradientId}-blue)`
|
|
6322
|
-
}),
|
|
6323
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6324
|
-
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",
|
|
6325
|
-
fill: `url(#${gradientId}-light-blue)`
|
|
6326
|
-
}),
|
|
6327
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6328
|
-
className: "cpk:fill-[#513C9F] cpk:dark:fill-[#B99AE8]",
|
|
6329
|
-
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"
|
|
6330
|
-
}),
|
|
6331
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6332
|
-
className: "cpk:fill-[#513C9F] cpk:dark:fill-[#B99AE8]",
|
|
6333
|
-
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"
|
|
6334
|
-
}),
|
|
6335
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6336
|
-
className: "cpk:fill-[#ABABAB] cpk:dark:fill-[#D4D4D4]",
|
|
6337
|
-
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"
|
|
6338
|
-
}),
|
|
6339
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6340
|
-
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",
|
|
6341
|
-
fill: `url(#${gradientId}-tail)`
|
|
6342
|
-
}),
|
|
6343
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("defs", { children: [
|
|
6344
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
|
|
6345
|
-
gradientUnits: "userSpaceOnUse",
|
|
6346
|
-
id: `${gradientId}-purple`,
|
|
6347
|
-
x1: "17.852",
|
|
6348
|
-
x2: "14.202",
|
|
6349
|
-
y1: "1.467",
|
|
6350
|
-
y2: "11.504",
|
|
6351
|
-
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", {
|
|
6352
|
-
className: "cpk:[stop-color:#AA89D8] cpk:dark:[stop-color:#D3BDF7]",
|
|
6353
|
-
offset: "1"
|
|
6354
|
-
})]
|
|
6355
|
-
}),
|
|
6356
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
|
|
6357
|
-
gradientUnits: "userSpaceOnUse",
|
|
6358
|
-
id: `${gradientId}-blue`,
|
|
6359
|
-
x1: "15.024",
|
|
6360
|
-
x2: "10.324",
|
|
6361
|
-
y1: "7.125",
|
|
6362
|
-
y2: "16.204",
|
|
6363
|
-
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", {
|
|
6364
|
-
className: "cpk:[stop-color:#3D92E8] cpk:dark:[stop-color:#84C0FA]",
|
|
6365
|
-
offset: "1"
|
|
6366
|
-
})]
|
|
6367
|
-
}),
|
|
6368
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
|
|
6369
|
-
gradientUnits: "userSpaceOnUse",
|
|
6370
|
-
id: `${gradientId}-light-blue`,
|
|
6371
|
-
x1: "17.122",
|
|
6372
|
-
x2: "15.707",
|
|
6373
|
-
y1: "1.467",
|
|
6374
|
-
y2: "5.892",
|
|
6375
|
-
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", {
|
|
6376
|
-
className: "cpk:[stop-color:#54A4F2] cpk:dark:[stop-color:#9ACDFF]",
|
|
6377
|
-
offset: "1"
|
|
6378
|
-
})]
|
|
6379
|
-
}),
|
|
6380
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
|
|
6381
|
-
gradientUnits: "userSpaceOnUse",
|
|
6382
|
-
id: `${gradientId}-tail`,
|
|
6383
|
-
x1: "6.577",
|
|
6384
|
-
x2: "21.506",
|
|
6385
|
-
y1: "21.758",
|
|
6386
|
-
y2: "21.758",
|
|
6387
|
-
children: [
|
|
6388
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { className: "cpk:[stop-color:#4497EA] cpk:dark:[stop-color:#79BCF5]" }),
|
|
6389
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6390
|
-
className: "cpk:[stop-color:#1463B2] cpk:dark:[stop-color:#4594D8]",
|
|
6391
|
-
offset: ".255"
|
|
6392
|
-
}),
|
|
6393
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6394
|
-
className: "cpk:[stop-color:#0A437D] cpk:dark:[stop-color:#347CB7]",
|
|
6395
|
-
offset: ".499"
|
|
6396
|
-
}),
|
|
6397
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6398
|
-
className: "cpk:[stop-color:#2476C8] cpk:dark:[stop-color:#58A4E5]",
|
|
6399
|
-
offset: ".667"
|
|
6400
|
-
}),
|
|
6401
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
6402
|
-
className: "cpk:[stop-color:#0C549A] cpk:dark:[stop-color:#3C87C7]",
|
|
6403
|
-
offset: ".973"
|
|
6404
|
-
})
|
|
6405
|
-
]
|
|
6406
|
-
})
|
|
6407
|
-
] })
|
|
6408
|
-
]
|
|
6409
|
-
});
|
|
6410
|
-
}
|
|
6411
6636
|
(function(_CopilotChatAssistantMessage) {
|
|
6412
6637
|
_CopilotChatAssistantMessage.MarkdownRenderer = ({ content, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.Streamdown, {
|
|
6413
6638
|
className,
|
|
@@ -6465,30 +6690,7 @@ function CopilotKitColoredIcon() {
|
|
|
6465
6690
|
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]" })
|
|
6466
6691
|
});
|
|
6467
6692
|
};
|
|
6468
|
-
_CopilotChatAssistantMessage.InspectorButton =
|
|
6469
|
-
const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
|
|
6470
|
-
const primaryLabel = title || labels.assistantMessageToolbarInspectorLabel;
|
|
6471
|
-
const accessibleLabel = `${primaryLabel} (local only)`;
|
|
6472
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ToolbarButton, {
|
|
6473
|
-
"data-testid": "copilot-inspector-button",
|
|
6474
|
-
title: accessibleLabel,
|
|
6475
|
-
className: (0, tailwind_merge.twMerge)("cpk:w-auto cpk:gap-1.5 cpk:px-2", className),
|
|
6476
|
-
tooltipClassName: "cpk:max-w-64 cpk:text-left cpk:leading-4",
|
|
6477
|
-
tooltip: "View this message in the Inspector to get more information. This button and the inspector only display during local development (localhost, dev env).",
|
|
6478
|
-
...props,
|
|
6479
|
-
children: [
|
|
6480
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitColoredIcon, {}),
|
|
6481
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6482
|
-
className: "cpk:font-medium",
|
|
6483
|
-
children: primaryLabel
|
|
6484
|
-
}),
|
|
6485
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6486
|
-
className: "cpk:text-xs cpk:text-muted-foreground",
|
|
6487
|
-
children: "(local only)"
|
|
6488
|
-
})
|
|
6489
|
-
]
|
|
6490
|
-
});
|
|
6491
|
-
};
|
|
6693
|
+
_CopilotChatAssistantMessage.InspectorButton = CopilotChatInspectorButton;
|
|
6492
6694
|
_CopilotChatAssistantMessage.ThumbsUpButton = ({ title, ...props }) => {
|
|
6493
6695
|
const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
|
|
6494
6696
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
@@ -8738,9 +8940,15 @@ function useInspectorThreadOverride(args) {
|
|
|
8738
8940
|
|
|
8739
8941
|
//#endregion
|
|
8740
8942
|
//#region src/v2/components/chat/CopilotChat.tsx
|
|
8741
|
-
function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen, attachments: attachmentsConfig, onError, throttleMs, ...props }) {
|
|
8943
|
+
function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isModalDefaultOpen, attachments: attachmentsConfig, onError, throttleMs, ...props }) {
|
|
8742
8944
|
const existingConfig = useCopilotChatConfiguration();
|
|
8743
|
-
const
|
|
8945
|
+
const inspector = useCopilotKitInspector();
|
|
8946
|
+
const inspectorContextValue = (0, react.useMemo)(() => ({
|
|
8947
|
+
...inspector,
|
|
8948
|
+
isInspectorEnabled: inspector.isInspectorEnabled && (inspector.providerEnableInspector ?? inspectorTools ?? true)
|
|
8949
|
+
}), [inspector, inspectorTools]);
|
|
8950
|
+
const providerAgentId = (0, _copilotkit_react_core_v2_context.useDefaultAgentId)();
|
|
8951
|
+
const resolvedAgentId = agentId ?? existingConfig?.agentId ?? providerAgentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
|
|
8744
8952
|
const providedThreadId = threadId ?? existingConfig?.threadId;
|
|
8745
8953
|
const baseThreadId = (0, react.useMemo)(() => providedThreadId ?? (0, _copilotkit_shared.randomUUID)(), [providedThreadId]);
|
|
8746
8954
|
const baseHasExplicitThreadId = !!threadId || !!existingConfig?.hasExplicitThreadId;
|
|
@@ -9313,7 +9521,10 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
|
|
|
9313
9521
|
}),
|
|
9314
9522
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(LastUserMessageContext.Provider, {
|
|
9315
9523
|
value: lastUserMessageState,
|
|
9316
|
-
children:
|
|
9524
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitInspectorContextProvider, {
|
|
9525
|
+
value: inspectorContextValue,
|
|
9526
|
+
children: RenderedChatView
|
|
9527
|
+
})
|
|
9317
9528
|
})
|
|
9318
9529
|
]
|
|
9319
9530
|
})
|
|
@@ -10021,7 +10232,8 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
|
|
|
10021
10232
|
const featureLicensed = checkFeature("threads");
|
|
10022
10233
|
const licensed = licensePresent && featureLicensed;
|
|
10023
10234
|
const licensePending = status === null;
|
|
10024
|
-
const
|
|
10235
|
+
const providerAgentId = (0, _copilotkit_react_core_v2_context.useDefaultAgentId)();
|
|
10236
|
+
const resolvedAgentId = agentId ?? configuration?.agentId ?? providerAgentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
|
|
10025
10237
|
const activeThreadId = configuration?.threadId ?? null;
|
|
10026
10238
|
const { threads, isLoading, listError, fetchMoreError, hasMoreThreads, isFetchingMoreThreads, archiveThread, unarchiveThread, deleteThread, fetchMoreThreads, refetchThreads, startNewThread } = useThreads$1({
|
|
10027
10239
|
agentId: resolvedAgentId,
|
|
@@ -12995,4 +13207,4 @@ Object.defineProperty(exports, 'ɵrunMcpFollowUp', {
|
|
|
12995
13207
|
return ɵrunMcpFollowUp;
|
|
12996
13208
|
}
|
|
12997
13209
|
});
|
|
12998
|
-
//# sourceMappingURL=copilotkit-
|
|
13210
|
+
//# sourceMappingURL=copilotkit-B4Jb1QEy.cjs.map
|