@copilotkit/react-ui 1.4.1-pre.6 → 1.4.2-tyler-reset-chat.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/CHANGELOG.md +59 -0
- package/dist/{chunk-RS6UPR5N.mjs → chunk-2B57NCBA.mjs} +5 -1
- package/dist/chunk-2B57NCBA.mjs.map +1 -0
- package/dist/chunk-4T3TMQNJ.mjs +45 -0
- package/dist/chunk-4T3TMQNJ.mjs.map +1 -0
- package/dist/{chunk-H5CXJBR5.mjs → chunk-B6A6OMIG.mjs} +6 -2
- package/dist/chunk-B6A6OMIG.mjs.map +1 -0
- package/dist/chunk-KXE2JCUH.mjs +1 -0
- package/dist/chunk-KXE2JCUH.mjs.map +1 -0
- package/dist/{chunk-ORHE7FYT.mjs → chunk-OI5EKZPO.mjs} +110 -14
- package/dist/chunk-OI5EKZPO.mjs.map +1 -0
- package/dist/{chunk-ECPBML4L.mjs → chunk-RQRK6DEW.mjs} +2 -2
- package/dist/chunk-WOUWNTAV.mjs +72 -0
- package/dist/chunk-WOUWNTAV.mjs.map +1 -0
- package/dist/{chunk-TSIFZ5N5.mjs → chunk-Z2RXDT7O.mjs} +2 -2
- package/dist/components/chat/Chat.d.ts +50 -5
- package/dist/components/chat/Chat.js +260 -57
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +7 -4
- package/dist/components/chat/Modal.d.ts +1 -1
- package/dist/components/chat/Modal.js +273 -66
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +8 -5
- package/dist/components/chat/Popup.js +275 -68
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +9 -6
- package/dist/components/chat/Sidebar.js +277 -70
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +9 -6
- package/dist/components/chat/index.js +279 -72
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +10 -7
- package/dist/components/dev-console/console.js +138 -32
- package/dist/components/dev-console/console.js.map +1 -1
- package/dist/components/dev-console/console.mjs +4 -1
- package/dist/components/dev-console/index.js +138 -32
- package/dist/components/dev-console/index.js.map +1 -1
- package/dist/components/dev-console/index.mjs +4 -1
- package/dist/components/help-modal/icons.d.ts +6 -0
- package/dist/components/help-modal/icons.js +70 -0
- package/dist/components/help-modal/icons.js.map +1 -0
- package/dist/components/help-modal/icons.mjs +10 -0
- package/dist/components/help-modal/icons.mjs.map +1 -0
- package/dist/components/help-modal/index.d.ts +2 -0
- package/dist/components/help-modal/index.js +135 -0
- package/dist/components/help-modal/index.js.map +1 -0
- package/dist/components/help-modal/index.mjs +10 -0
- package/dist/components/help-modal/index.mjs.map +1 -0
- package/dist/components/help-modal/modal.d.ts +5 -0
- package/dist/components/help-modal/modal.js +133 -0
- package/dist/components/help-modal/modal.js.map +1 -0
- package/dist/components/help-modal/modal.mjs +9 -0
- package/dist/components/help-modal/modal.mjs.map +1 -0
- package/dist/components/index.js +279 -72
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +10 -7
- package/dist/index.js +283 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -7
- package/package.json +7 -7
- package/src/components/chat/Chat.tsx +167 -8
- package/src/components/chat/Modal.tsx +4 -0
- package/src/components/dev-console/console.tsx +4 -1
- package/src/components/help-modal/icons.tsx +40 -0
- package/src/components/help-modal/index.tsx +1 -0
- package/src/components/help-modal/modal.tsx +91 -0
- package/dist/chunk-H5CXJBR5.mjs.map +0 -1
- package/dist/chunk-ORHE7FYT.mjs.map +0 -1
- package/dist/chunk-RS6UPR5N.mjs.map +0 -1
- /package/dist/{chunk-ECPBML4L.mjs.map → chunk-RQRK6DEW.mjs.map} +0 -0
- /package/dist/{chunk-TSIFZ5N5.mjs.map → chunk-Z2RXDT7O.mjs.map} +0 -0
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotPopup
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-Z2RXDT7O.mjs";
|
|
4
|
+
import "../../chunk-B6A6OMIG.mjs";
|
|
5
5
|
import "../../chunk-YAGE7RCE.mjs";
|
|
6
6
|
import "../../chunk-VEC45H6Q.mjs";
|
|
7
7
|
import "../../chunk-RQNJNK2W.mjs";
|
|
8
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-OI5EKZPO.mjs";
|
|
9
|
+
import "../../chunk-6INMITFA.mjs";
|
|
10
|
+
import "../../chunk-RU73BEZM.mjs";
|
|
9
11
|
import "../../chunk-V7W6IM2V.mjs";
|
|
10
12
|
import "../../chunk-OMTPWC7T.mjs";
|
|
11
13
|
import "../../chunk-ZABXREBH.mjs";
|
|
12
|
-
import "../../chunk-6INMITFA.mjs";
|
|
13
|
-
import "../../chunk-RU73BEZM.mjs";
|
|
14
14
|
import "../../chunk-RJCZRKTV.mjs";
|
|
15
|
-
import "../../chunk-
|
|
15
|
+
import "../../chunk-2B57NCBA.mjs";
|
|
16
16
|
import "../../chunk-4FIGRRFS.mjs";
|
|
17
|
+
import "../../chunk-KXE2JCUH.mjs";
|
|
18
|
+
import "../../chunk-WOUWNTAV.mjs";
|
|
19
|
+
import "../../chunk-4T3TMQNJ.mjs";
|
|
17
20
|
import "../../chunk-OTPAZXVR.mjs";
|
|
18
21
|
import "../../chunk-4LUMV4YO.mjs";
|
|
19
22
|
import "../../chunk-YQFVRDNC.mjs";
|
|
@@ -82,10 +82,10 @@ __export(Sidebar_exports, {
|
|
|
82
82
|
CopilotSidebar: () => CopilotSidebar
|
|
83
83
|
});
|
|
84
84
|
module.exports = __toCommonJS(Sidebar_exports);
|
|
85
|
-
var
|
|
85
|
+
var import_react14 = require("react");
|
|
86
86
|
|
|
87
87
|
// src/components/chat/Modal.tsx
|
|
88
|
-
var
|
|
88
|
+
var import_react13 = __toESM(require("react"));
|
|
89
89
|
|
|
90
90
|
// src/components/chat/ChatContext.tsx
|
|
91
91
|
var import_react = __toESM(require("react"));
|
|
@@ -1664,7 +1664,7 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
|
|
|
1664
1664
|
});
|
|
1665
1665
|
|
|
1666
1666
|
// src/components/chat/Chat.tsx
|
|
1667
|
-
var
|
|
1667
|
+
var import_react12 = __toESM(require("react"));
|
|
1668
1668
|
var import_react_core8 = require("@copilotkit/react-core");
|
|
1669
1669
|
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
1670
1670
|
var import_shared3 = require("@copilotkit/shared");
|
|
@@ -1803,7 +1803,7 @@ function logMessages(context) {
|
|
|
1803
1803
|
|
|
1804
1804
|
// src/components/dev-console/console.tsx
|
|
1805
1805
|
var import_react_core7 = require("@copilotkit/react-core");
|
|
1806
|
-
var
|
|
1806
|
+
var import_react10 = require("react");
|
|
1807
1807
|
|
|
1808
1808
|
// src/components/dev-console/icons.tsx
|
|
1809
1809
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
@@ -1890,21 +1890,128 @@ var CopilotKitIcon = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
|
1890
1890
|
);
|
|
1891
1891
|
|
|
1892
1892
|
// src/components/dev-console/console.tsx
|
|
1893
|
-
var
|
|
1893
|
+
var import_react11 = require("@headlessui/react");
|
|
1894
1894
|
var import_shared2 = require("@copilotkit/shared");
|
|
1895
|
+
|
|
1896
|
+
// src/components/help-modal/modal.tsx
|
|
1897
|
+
var import_react9 = require("react");
|
|
1898
|
+
|
|
1899
|
+
// src/components/help-modal/icons.tsx
|
|
1895
1900
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1901
|
+
var LifeBuoyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1902
|
+
"svg",
|
|
1903
|
+
{
|
|
1904
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1905
|
+
width: "24",
|
|
1906
|
+
height: "24",
|
|
1907
|
+
viewBox: "0 0 24 24",
|
|
1908
|
+
fill: "none",
|
|
1909
|
+
stroke: "currentColor",
|
|
1910
|
+
strokeWidth: "2",
|
|
1911
|
+
strokeLinecap: "round",
|
|
1912
|
+
strokeLinejoin: "round",
|
|
1913
|
+
className: "icon icon-tabler icons-tabler-outline icon-tabler-lifebuoy",
|
|
1914
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("g", { transform: "translate(0, -1)", children: [
|
|
1915
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
1916
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" }),
|
|
1917
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" }),
|
|
1918
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M15 15l3.35 3.35" }),
|
|
1919
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M9 15l-3.35 3.35" }),
|
|
1920
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M5.65 5.65l3.35 3.35" }),
|
|
1921
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M18.35 5.65l-3.35 3.35" })
|
|
1922
|
+
] })
|
|
1923
|
+
}
|
|
1924
|
+
);
|
|
1925
|
+
var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1926
|
+
"svg",
|
|
1927
|
+
{
|
|
1928
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1929
|
+
fill: "none",
|
|
1930
|
+
viewBox: "0 0 24 24",
|
|
1931
|
+
strokeWidth: "1.5",
|
|
1932
|
+
stroke: "currentColor",
|
|
1933
|
+
width: "20",
|
|
1934
|
+
height: "20",
|
|
1935
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
1936
|
+
}
|
|
1937
|
+
);
|
|
1938
|
+
|
|
1939
|
+
// src/components/help-modal/modal.tsx
|
|
1940
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1941
|
+
function CopilotKitHelpModal() {
|
|
1942
|
+
const [showHelpModal, setShowHelpModal] = (0, import_react9.useState)(false);
|
|
1943
|
+
const [issueDescription, setIssueDescription] = (0, import_react9.useState)("");
|
|
1944
|
+
const handleSubmit = () => {
|
|
1945
|
+
setShowHelpModal(false);
|
|
1946
|
+
};
|
|
1947
|
+
const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1948
|
+
"button",
|
|
1949
|
+
{
|
|
1950
|
+
onClick: () => setShowHelpModal(true),
|
|
1951
|
+
className: "p-2 bg-transparent rounded-full shadow-lg hover:shadow-xl transition-shadow duration-300 focus:outline-none focus:ring-2 focus:ring-blue-500",
|
|
1952
|
+
"aria-label": "Open Help",
|
|
1953
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LifeBuoyIcon, {})
|
|
1954
|
+
}
|
|
1955
|
+
);
|
|
1956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
1957
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(HelpButton, {}),
|
|
1958
|
+
showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1959
|
+
"div",
|
|
1960
|
+
{
|
|
1961
|
+
className: "fixed inset-0 flex items-center justify-center p-4",
|
|
1962
|
+
style: { backgroundColor: "rgba(11, 15, 26, 0.5)", zIndex: 99 },
|
|
1963
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "bg-white rounded-lg shadow-xl max-w-md w-full p-4 flex-col relative", children: [
|
|
1964
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1965
|
+
"button",
|
|
1966
|
+
{
|
|
1967
|
+
className: "absolute text-gray-400 hover:text-gray-600 focus:outline-none",
|
|
1968
|
+
style: { top: "10px", right: "10px" },
|
|
1969
|
+
onClick: () => setShowHelpModal(false),
|
|
1970
|
+
"aria-label": "Close",
|
|
1971
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CloseIcon2, {})
|
|
1972
|
+
}
|
|
1973
|
+
),
|
|
1974
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w-full flex mb-6 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h2", { className: "text-2xl font-bold", children: "Help Options" }) }),
|
|
1975
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-4 mb-4", children: [
|
|
1976
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "block w-full text-center py-2 px-4 bg-blue-500 text-white rounded hover:bg-blue-600 transition duration-150 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1977
|
+
"a",
|
|
1978
|
+
{
|
|
1979
|
+
href: "https://go.copilotkit.ai/dev-console-support-discord",
|
|
1980
|
+
target: "_blank",
|
|
1981
|
+
rel: "noopener noreferrer",
|
|
1982
|
+
children: "Go to Discord Support Channel (Community Support)"
|
|
1983
|
+
}
|
|
1984
|
+
) }),
|
|
1985
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "block w-full text-center py-2 px-4 bg-blue-500 text-white rounded hover:bg-blue-600 transition duration-150 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1986
|
+
"a",
|
|
1987
|
+
{
|
|
1988
|
+
href: "https://go.copilotkit.ai/dev-console-support-slack",
|
|
1989
|
+
target: "_blank",
|
|
1990
|
+
rel: "noopener noreferrer",
|
|
1991
|
+
children: "Apply for Priority Direct Slack Support"
|
|
1992
|
+
}
|
|
1993
|
+
) })
|
|
1994
|
+
] })
|
|
1995
|
+
] })
|
|
1996
|
+
}
|
|
1997
|
+
)
|
|
1998
|
+
] });
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
// src/components/dev-console/console.tsx
|
|
2002
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1896
2003
|
function CopilotDevConsole() {
|
|
1897
2004
|
const currentVersion = import_shared2.COPILOTKIT_VERSION;
|
|
1898
2005
|
const context = (0, import_react_core7.useCopilotContext)();
|
|
1899
|
-
const [showDevConsole, setShowDevConsole] = (0,
|
|
1900
|
-
(0,
|
|
2006
|
+
const [showDevConsole, setShowDevConsole] = (0, import_react10.useState)(false);
|
|
2007
|
+
(0, import_react10.useEffect)(() => {
|
|
1901
2008
|
setShowDevConsole(shouldShowDevConsole(context.showDevConsole));
|
|
1902
2009
|
}, [context.showDevConsole]);
|
|
1903
|
-
const dontRunTwiceInDevMode = (0,
|
|
1904
|
-
const [versionStatus, setVersionStatus] = (0,
|
|
1905
|
-
const [latestVersion, setLatestVersion] = (0,
|
|
1906
|
-
const consoleRef = (0,
|
|
1907
|
-
const [debugButtonMode, setDebugButtonMode] = (0,
|
|
2010
|
+
const dontRunTwiceInDevMode = (0, import_react10.useRef)(false);
|
|
2011
|
+
const [versionStatus, setVersionStatus] = (0, import_react10.useState)("unknown");
|
|
2012
|
+
const [latestVersion, setLatestVersion] = (0, import_react10.useState)("");
|
|
2013
|
+
const consoleRef = (0, import_react10.useRef)(null);
|
|
2014
|
+
const [debugButtonMode, setDebugButtonMode] = (0, import_react10.useState)("full");
|
|
1908
2015
|
const checkForUpdates = (force = false) => {
|
|
1909
2016
|
setVersionStatus("checking");
|
|
1910
2017
|
getPublishedCopilotKitVersion(currentVersion, force).then((v) => {
|
|
@@ -1927,14 +2034,14 @@ function CopilotDevConsole() {
|
|
|
1927
2034
|
setVersionStatus("unknown");
|
|
1928
2035
|
});
|
|
1929
2036
|
};
|
|
1930
|
-
(0,
|
|
2037
|
+
(0, import_react10.useEffect)(() => {
|
|
1931
2038
|
if (dontRunTwiceInDevMode.current === true) {
|
|
1932
2039
|
return;
|
|
1933
2040
|
}
|
|
1934
2041
|
dontRunTwiceInDevMode.current = true;
|
|
1935
2042
|
checkForUpdates();
|
|
1936
2043
|
}, []);
|
|
1937
|
-
(0,
|
|
2044
|
+
(0, import_react10.useEffect)(() => {
|
|
1938
2045
|
const handleResize = (entries) => {
|
|
1939
2046
|
for (let entry of entries) {
|
|
1940
2047
|
if (entry.target === consoleRef.current) {
|
|
@@ -1966,14 +2073,14 @@ function CopilotDevConsole() {
|
|
|
1966
2073
|
if (!showDevConsole) {
|
|
1967
2074
|
return null;
|
|
1968
2075
|
}
|
|
1969
|
-
return /* @__PURE__ */ (0,
|
|
2076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1970
2077
|
"div",
|
|
1971
2078
|
{
|
|
1972
2079
|
ref: consoleRef,
|
|
1973
2080
|
className: "copilotKitDevConsole " + (versionStatus === "update-available" ? "copilotKitDevConsoleUpgrade" : "") + (versionStatus === "outdated" ? "copilotKitDevConsoleWarnOutdated" : ""),
|
|
1974
2081
|
children: [
|
|
1975
|
-
/* @__PURE__ */ (0,
|
|
1976
|
-
/* @__PURE__ */ (0,
|
|
2082
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "copilotKitDevConsoleLogo", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("a", { href: "https://copilotkit.ai", target: "_blank", children: CopilotKitIcon }) }),
|
|
2083
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1977
2084
|
VersionInfo,
|
|
1978
2085
|
{
|
|
1979
2086
|
showDevConsole: context.showDevConsole,
|
|
@@ -1982,7 +2089,8 @@ function CopilotDevConsole() {
|
|
|
1982
2089
|
latestVersion
|
|
1983
2090
|
}
|
|
1984
2091
|
),
|
|
1985
|
-
/* @__PURE__ */ (0,
|
|
2092
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CopilotKitHelpModal, {}),
|
|
2093
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1986
2094
|
DebugMenuButton,
|
|
1987
2095
|
{
|
|
1988
2096
|
setShowDevConsole,
|
|
@@ -2000,7 +2108,7 @@ function VersionInfo({
|
|
|
2000
2108
|
currentVersion,
|
|
2001
2109
|
latestVersion
|
|
2002
2110
|
}) {
|
|
2003
|
-
const [copyStatus, setCopyStatus] = (0,
|
|
2111
|
+
const [copyStatus, setCopyStatus] = (0, import_react10.useState)("");
|
|
2004
2112
|
let versionLabel = "";
|
|
2005
2113
|
let versionIcon = "";
|
|
2006
2114
|
let currentVersionLabel = currentVersion;
|
|
@@ -2037,12 +2145,12 @@ function VersionInfo({
|
|
|
2037
2145
|
setTimeout(() => setCopyStatus(""), 1e3);
|
|
2038
2146
|
});
|
|
2039
2147
|
};
|
|
2040
|
-
return /* @__PURE__ */ (0,
|
|
2041
|
-
/* @__PURE__ */ (0,
|
|
2148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitVersionInfo", children: [
|
|
2149
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("header", { children: [
|
|
2042
2150
|
"COPILOTKIT DEV CONSOLE",
|
|
2043
|
-
showDevConsole === "auto" && /* @__PURE__ */ (0,
|
|
2151
|
+
showDevConsole === "auto" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("aside", { children: asideLabel })
|
|
2044
2152
|
] }),
|
|
2045
|
-
/* @__PURE__ */ (0,
|
|
2153
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("section", { children: [
|
|
2046
2154
|
"Version: ",
|
|
2047
2155
|
versionLabel,
|
|
2048
2156
|
" (",
|
|
@@ -2050,7 +2158,7 @@ function VersionInfo({
|
|
|
2050
2158
|
") ",
|
|
2051
2159
|
versionIcon
|
|
2052
2160
|
] }),
|
|
2053
|
-
(versionStatus === "update-available" || versionStatus === "outdated") && /* @__PURE__ */ (0,
|
|
2161
|
+
(versionStatus === "update-available" || versionStatus === "outdated") && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("footer", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { onClick: handleCopyClick, children: copyStatus || installCommand }) })
|
|
2054
2162
|
] });
|
|
2055
2163
|
}
|
|
2056
2164
|
function DebugMenuButton({
|
|
@@ -2060,22 +2168,22 @@ function DebugMenuButton({
|
|
|
2060
2168
|
}) {
|
|
2061
2169
|
const context = (0, import_react_core7.useCopilotContext)();
|
|
2062
2170
|
const messagesContext = (0, import_react_core7.useCopilotMessagesContext)();
|
|
2063
|
-
return /* @__PURE__ */ (0,
|
|
2064
|
-
/* @__PURE__ */ (0,
|
|
2171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "bg-black top-24 w-52 text-right", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react11.Menu, { children: [
|
|
2172
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react11.MenuButton, { className: `copilotKitDebugMenuButton ${mode === "compact" ? "compact" : ""}`, children: mode == "compact" ? "Debug" : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2065
2173
|
"Debug ",
|
|
2066
2174
|
ChevronDownIcon
|
|
2067
2175
|
] }) }),
|
|
2068
|
-
/* @__PURE__ */ (0,
|
|
2069
|
-
|
|
2176
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2177
|
+
import_react11.MenuItems,
|
|
2070
2178
|
{
|
|
2071
2179
|
transition: true,
|
|
2072
2180
|
anchor: "bottom end",
|
|
2073
2181
|
className: "copilotKitDebugMenu",
|
|
2074
2182
|
style: { zIndex: 40 },
|
|
2075
2183
|
children: [
|
|
2076
|
-
/* @__PURE__ */ (0,
|
|
2077
|
-
/* @__PURE__ */ (0,
|
|
2078
|
-
/* @__PURE__ */ (0,
|
|
2184
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logReadables(context), children: "Log Readables" }) }),
|
|
2185
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logActions(context), children: "Log Actions" }) }),
|
|
2186
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2079
2187
|
"button",
|
|
2080
2188
|
{
|
|
2081
2189
|
className: "copilotKitDebugMenuItem",
|
|
@@ -2083,9 +2191,9 @@ function DebugMenuButton({
|
|
|
2083
2191
|
children: "Log Messages"
|
|
2084
2192
|
}
|
|
2085
2193
|
) }),
|
|
2086
|
-
/* @__PURE__ */ (0,
|
|
2087
|
-
/* @__PURE__ */ (0,
|
|
2088
|
-
/* @__PURE__ */ (0,
|
|
2194
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => checkForUpdates(true), children: "Check for Updates" }) }),
|
|
2195
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("hr", {}),
|
|
2196
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => setShowDevConsole(false), children: "Hide Dev Console" }) })
|
|
2089
2197
|
]
|
|
2090
2198
|
}
|
|
2091
2199
|
)
|
|
@@ -2093,13 +2201,16 @@ function DebugMenuButton({
|
|
|
2093
2201
|
}
|
|
2094
2202
|
|
|
2095
2203
|
// src/components/chat/Chat.tsx
|
|
2096
|
-
var
|
|
2204
|
+
var import_react_core9 = require("@copilotkit/react-core");
|
|
2205
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2097
2206
|
function CopilotChat({
|
|
2098
2207
|
instructions,
|
|
2099
2208
|
onSubmitMessage,
|
|
2100
2209
|
makeSystemMessage,
|
|
2101
2210
|
showResponseButton = true,
|
|
2102
2211
|
onInProgress,
|
|
2212
|
+
onStopGeneration,
|
|
2213
|
+
onReloadMessages,
|
|
2103
2214
|
Messages: Messages2 = Messages,
|
|
2104
2215
|
RenderTextMessage: RenderTextMessage2 = RenderTextMessage,
|
|
2105
2216
|
RenderActionExecutionMessage: RenderActionExecutionMessage2 = RenderActionExecutionMessage,
|
|
@@ -2112,7 +2223,7 @@ function CopilotChat({
|
|
|
2112
2223
|
labels
|
|
2113
2224
|
}) {
|
|
2114
2225
|
const context = (0, import_react_core8.useCopilotContext)();
|
|
2115
|
-
(0,
|
|
2226
|
+
(0, import_react12.useEffect)(() => {
|
|
2116
2227
|
context.setChatInstructions(instructions || "");
|
|
2117
2228
|
}, [instructions]);
|
|
2118
2229
|
const {
|
|
@@ -2122,12 +2233,18 @@ function CopilotChat({
|
|
|
2122
2233
|
sendMessage,
|
|
2123
2234
|
stopGeneration,
|
|
2124
2235
|
reloadMessages
|
|
2125
|
-
} = useCopilotChatLogic(
|
|
2126
|
-
|
|
2236
|
+
} = useCopilotChatLogic(
|
|
2237
|
+
makeSystemMessage,
|
|
2238
|
+
onInProgress,
|
|
2239
|
+
onSubmitMessage,
|
|
2240
|
+
onStopGeneration,
|
|
2241
|
+
onReloadMessages
|
|
2242
|
+
);
|
|
2243
|
+
const chatContext = import_react12.default.useContext(ChatContext);
|
|
2127
2244
|
const isVisible = chatContext ? chatContext.open : true;
|
|
2128
|
-
return /* @__PURE__ */ (0,
|
|
2129
|
-
/* @__PURE__ */ (0,
|
|
2130
|
-
/* @__PURE__ */ (0,
|
|
2245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
2246
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CopilotDevConsole, {}),
|
|
2247
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2131
2248
|
Messages2,
|
|
2132
2249
|
{
|
|
2133
2250
|
RenderTextMessage: RenderTextMessage2,
|
|
@@ -2137,9 +2254,9 @@ function CopilotChat({
|
|
|
2137
2254
|
messages: visibleMessages,
|
|
2138
2255
|
inProgress: isLoading,
|
|
2139
2256
|
children: [
|
|
2140
|
-
currentSuggestions.length > 0 && /* @__PURE__ */ (0,
|
|
2141
|
-
/* @__PURE__ */ (0,
|
|
2142
|
-
/* @__PURE__ */ (0,
|
|
2257
|
+
currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
2258
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h6", { children: "Suggested:" }),
|
|
2259
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "suggestions", children: currentSuggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2143
2260
|
Suggestion,
|
|
2144
2261
|
{
|
|
2145
2262
|
title: suggestion.title,
|
|
@@ -2151,7 +2268,7 @@ function CopilotChat({
|
|
|
2151
2268
|
index
|
|
2152
2269
|
)) })
|
|
2153
2270
|
] }),
|
|
2154
|
-
showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ (0,
|
|
2271
|
+
showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2155
2272
|
ResponseButton2,
|
|
2156
2273
|
{
|
|
2157
2274
|
onClick: isLoading ? stopGeneration : reloadMessages,
|
|
@@ -2161,7 +2278,7 @@ function CopilotChat({
|
|
|
2161
2278
|
]
|
|
2162
2279
|
}
|
|
2163
2280
|
),
|
|
2164
|
-
/* @__PURE__ */ (0,
|
|
2281
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Input2, { inProgress: isLoading, onSend: sendMessage, isVisible })
|
|
2165
2282
|
] });
|
|
2166
2283
|
}
|
|
2167
2284
|
function WrappedCopilotChat({
|
|
@@ -2170,31 +2287,38 @@ function WrappedCopilotChat({
|
|
|
2170
2287
|
labels,
|
|
2171
2288
|
className
|
|
2172
2289
|
}) {
|
|
2173
|
-
const chatContext =
|
|
2290
|
+
const chatContext = import_react12.default.useContext(ChatContext);
|
|
2174
2291
|
if (!chatContext) {
|
|
2175
|
-
return /* @__PURE__ */ (0,
|
|
2176
|
-
}, children: /* @__PURE__ */ (0,
|
|
2292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
|
|
2293
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `copilotKitChat ${className}`, children }) });
|
|
2177
2294
|
}
|
|
2178
|
-
return /* @__PURE__ */ (0,
|
|
2295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children });
|
|
2179
2296
|
}
|
|
2180
2297
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2181
|
-
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
|
|
2182
|
-
|
|
2298
|
+
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
|
|
2299
|
+
var _a;
|
|
2300
|
+
const {
|
|
2301
|
+
visibleMessages,
|
|
2302
|
+
appendMessage,
|
|
2303
|
+
reloadMessages: defaultReloadMessages,
|
|
2304
|
+
stopGeneration: defaultStopGeneration,
|
|
2305
|
+
isLoading
|
|
2306
|
+
} = (0, import_react_core8.useCopilotChat)({
|
|
2183
2307
|
id: (0, import_shared3.randomId)(),
|
|
2184
2308
|
makeSystemMessage
|
|
2185
2309
|
});
|
|
2186
|
-
const [currentSuggestions, setCurrentSuggestions] = (0,
|
|
2187
|
-
const suggestionsAbortControllerRef = (0,
|
|
2188
|
-
const debounceTimerRef = (0,
|
|
2310
|
+
const [currentSuggestions, setCurrentSuggestions] = (0, import_react12.useState)([]);
|
|
2311
|
+
const suggestionsAbortControllerRef = (0, import_react12.useRef)(null);
|
|
2312
|
+
const debounceTimerRef = (0, import_react12.useRef)();
|
|
2189
2313
|
const abortSuggestions = () => {
|
|
2190
|
-
var
|
|
2191
|
-
(
|
|
2314
|
+
var _a2;
|
|
2315
|
+
(_a2 = suggestionsAbortControllerRef.current) == null ? void 0 : _a2.abort();
|
|
2192
2316
|
suggestionsAbortControllerRef.current = null;
|
|
2193
2317
|
};
|
|
2194
2318
|
const generalContext = (0, import_react_core8.useCopilotContext)();
|
|
2195
2319
|
const messagesContext = (0, import_react_core8.useCopilotMessagesContext)();
|
|
2196
2320
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
2197
|
-
(0,
|
|
2321
|
+
(0, import_react12.useEffect)(() => {
|
|
2198
2322
|
onInProgress == null ? void 0 : onInProgress(isLoading);
|
|
2199
2323
|
abortSuggestions();
|
|
2200
2324
|
debounceTimerRef.current = setTimeout(
|
|
@@ -2214,7 +2338,13 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2214
2338
|
return () => {
|
|
2215
2339
|
clearTimeout(debounceTimerRef.current);
|
|
2216
2340
|
};
|
|
2217
|
-
}, [
|
|
2341
|
+
}, [
|
|
2342
|
+
isLoading,
|
|
2343
|
+
context.chatSuggestionConfiguration,
|
|
2344
|
+
// hackish way to trigger suggestions reload on reset, but better than moving suggestions to the
|
|
2345
|
+
// global context
|
|
2346
|
+
visibleMessages.length == 0
|
|
2347
|
+
]);
|
|
2218
2348
|
const sendMessage = (messageContent) => __async(void 0, null, function* () {
|
|
2219
2349
|
abortSuggestions();
|
|
2220
2350
|
setCurrentSuggestions([]);
|
|
@@ -2232,6 +2362,79 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2232
2362
|
appendMessage(message);
|
|
2233
2363
|
return message;
|
|
2234
2364
|
});
|
|
2365
|
+
const messages = visibleMessages;
|
|
2366
|
+
const { setMessages } = messagesContext;
|
|
2367
|
+
const currentAgentName = (_a = generalContext.agentSession) == null ? void 0 : _a.agentName;
|
|
2368
|
+
const restartCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2369
|
+
if (generalContext.agentSession) {
|
|
2370
|
+
generalContext.setAgentSession(__spreadProps(__spreadValues({}, generalContext.agentSession), {
|
|
2371
|
+
nodeName: void 0,
|
|
2372
|
+
threadId: void 0
|
|
2373
|
+
}));
|
|
2374
|
+
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2375
|
+
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2376
|
+
[generalContext.agentSession.agentName]: __spreadProps(__spreadValues({}, prevAgentStates[generalContext.agentSession.agentName]), {
|
|
2377
|
+
threadId: void 0,
|
|
2378
|
+
nodeName: void 0,
|
|
2379
|
+
runId: void 0
|
|
2380
|
+
})
|
|
2381
|
+
});
|
|
2382
|
+
});
|
|
2383
|
+
}
|
|
2384
|
+
});
|
|
2385
|
+
const runCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2386
|
+
if (generalContext.agentSession) {
|
|
2387
|
+
yield (0, import_react_core9.runAgent)(generalContext.agentSession.agentName, context, appendMessage, hint);
|
|
2388
|
+
}
|
|
2389
|
+
});
|
|
2390
|
+
const stopCurrentAgent = () => {
|
|
2391
|
+
if (generalContext.agentSession) {
|
|
2392
|
+
(0, import_react_core9.stopAgent)(generalContext.agentSession.agentName, context);
|
|
2393
|
+
}
|
|
2394
|
+
};
|
|
2395
|
+
const setCurrentAgentState = (state) => {
|
|
2396
|
+
if (generalContext.agentSession) {
|
|
2397
|
+
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2398
|
+
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2399
|
+
[generalContext.agentSession.agentName]: {
|
|
2400
|
+
state
|
|
2401
|
+
}
|
|
2402
|
+
});
|
|
2403
|
+
});
|
|
2404
|
+
}
|
|
2405
|
+
};
|
|
2406
|
+
function stopGeneration() {
|
|
2407
|
+
if (onStopGeneration) {
|
|
2408
|
+
onStopGeneration({
|
|
2409
|
+
messages,
|
|
2410
|
+
setMessages,
|
|
2411
|
+
stopGeneration: defaultStopGeneration,
|
|
2412
|
+
currentAgentName,
|
|
2413
|
+
restartCurrentAgent,
|
|
2414
|
+
stopCurrentAgent,
|
|
2415
|
+
runCurrentAgent,
|
|
2416
|
+
setCurrentAgentState
|
|
2417
|
+
});
|
|
2418
|
+
} else {
|
|
2419
|
+
defaultStopGeneration();
|
|
2420
|
+
}
|
|
2421
|
+
}
|
|
2422
|
+
function reloadMessages() {
|
|
2423
|
+
if (onReloadMessages) {
|
|
2424
|
+
onReloadMessages({
|
|
2425
|
+
messages,
|
|
2426
|
+
setMessages,
|
|
2427
|
+
stopGeneration: defaultStopGeneration,
|
|
2428
|
+
currentAgentName,
|
|
2429
|
+
restartCurrentAgent,
|
|
2430
|
+
stopCurrentAgent,
|
|
2431
|
+
runCurrentAgent,
|
|
2432
|
+
setCurrentAgentState
|
|
2433
|
+
});
|
|
2434
|
+
} else {
|
|
2435
|
+
defaultReloadMessages();
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2235
2438
|
return {
|
|
2236
2439
|
visibleMessages,
|
|
2237
2440
|
isLoading,
|
|
@@ -2243,7 +2446,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2243
2446
|
};
|
|
2244
2447
|
|
|
2245
2448
|
// src/components/chat/Modal.tsx
|
|
2246
|
-
var
|
|
2449
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2247
2450
|
var CopilotModal = ({
|
|
2248
2451
|
instructions,
|
|
2249
2452
|
defaultOpen = false,
|
|
@@ -2251,6 +2454,8 @@ var CopilotModal = ({
|
|
|
2251
2454
|
hitEscapeToClose = true,
|
|
2252
2455
|
onSetOpen,
|
|
2253
2456
|
onSubmitMessage,
|
|
2457
|
+
onStopGeneration,
|
|
2458
|
+
onReloadMessages,
|
|
2254
2459
|
shortcut = "/",
|
|
2255
2460
|
icons,
|
|
2256
2461
|
labels,
|
|
@@ -2266,28 +2471,30 @@ var CopilotModal = ({
|
|
|
2266
2471
|
className,
|
|
2267
2472
|
children
|
|
2268
2473
|
}) => {
|
|
2269
|
-
const [openState, setOpenState] =
|
|
2474
|
+
const [openState, setOpenState] = import_react13.default.useState(defaultOpen);
|
|
2270
2475
|
const setOpen = (open) => {
|
|
2271
2476
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
2272
2477
|
setOpenState(open);
|
|
2273
2478
|
};
|
|
2274
|
-
return /* @__PURE__ */ (0,
|
|
2479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
2275
2480
|
children,
|
|
2276
|
-
/* @__PURE__ */ (0,
|
|
2277
|
-
/* @__PURE__ */ (0,
|
|
2278
|
-
/* @__PURE__ */ (0,
|
|
2481
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className, children: [
|
|
2482
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button2, {}),
|
|
2483
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2279
2484
|
Window2,
|
|
2280
2485
|
{
|
|
2281
2486
|
clickOutsideToClose,
|
|
2282
2487
|
shortcut,
|
|
2283
2488
|
hitEscapeToClose,
|
|
2284
2489
|
children: [
|
|
2285
|
-
/* @__PURE__ */ (0,
|
|
2286
|
-
/* @__PURE__ */ (0,
|
|
2490
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Header2, {}),
|
|
2491
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2287
2492
|
CopilotChat,
|
|
2288
2493
|
{
|
|
2289
2494
|
instructions,
|
|
2290
2495
|
onSubmitMessage,
|
|
2496
|
+
onStopGeneration,
|
|
2497
|
+
onReloadMessages,
|
|
2291
2498
|
makeSystemMessage,
|
|
2292
2499
|
showResponseButton,
|
|
2293
2500
|
onInProgress,
|
|
@@ -2304,12 +2511,12 @@ var CopilotModal = ({
|
|
|
2304
2511
|
};
|
|
2305
2512
|
|
|
2306
2513
|
// src/components/chat/Sidebar.tsx
|
|
2307
|
-
var
|
|
2514
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2308
2515
|
function CopilotSidebar(props) {
|
|
2309
2516
|
props = __spreadProps(__spreadValues({}, props), {
|
|
2310
2517
|
className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
|
|
2311
2518
|
});
|
|
2312
|
-
const [expandedClassName, setExpandedClassName] = (0,
|
|
2519
|
+
const [expandedClassName, setExpandedClassName] = (0, import_react14.useState)(
|
|
2313
2520
|
props.defaultOpen ? "sidebarExpanded" : ""
|
|
2314
2521
|
);
|
|
2315
2522
|
const onSetOpen = (open) => {
|
|
@@ -2317,7 +2524,7 @@ function CopilotSidebar(props) {
|
|
|
2317
2524
|
(_a = props.onSetOpen) == null ? void 0 : _a.call(props, open);
|
|
2318
2525
|
setExpandedClassName(open ? "sidebarExpanded" : "");
|
|
2319
2526
|
};
|
|
2320
|
-
return /* @__PURE__ */ (0,
|
|
2527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CopilotModal, __spreadProps(__spreadValues(__spreadValues({}, props), { onSetOpen }), { children: props.children })) });
|
|
2321
2528
|
}
|
|
2322
2529
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2323
2530
|
0 && (module.exports = {
|