@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
package/dist/components/index.js
CHANGED
|
@@ -89,7 +89,7 @@ __export(components_exports, {
|
|
|
89
89
|
module.exports = __toCommonJS(components_exports);
|
|
90
90
|
|
|
91
91
|
// src/components/chat/Modal.tsx
|
|
92
|
-
var
|
|
92
|
+
var import_react13 = __toESM(require("react"));
|
|
93
93
|
|
|
94
94
|
// src/components/chat/ChatContext.tsx
|
|
95
95
|
var import_react = __toESM(require("react"));
|
|
@@ -1668,7 +1668,7 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
|
|
|
1668
1668
|
});
|
|
1669
1669
|
|
|
1670
1670
|
// src/components/chat/Chat.tsx
|
|
1671
|
-
var
|
|
1671
|
+
var import_react12 = __toESM(require("react"));
|
|
1672
1672
|
var import_react_core8 = require("@copilotkit/react-core");
|
|
1673
1673
|
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
1674
1674
|
var import_shared3 = require("@copilotkit/shared");
|
|
@@ -1807,7 +1807,7 @@ function logMessages(context) {
|
|
|
1807
1807
|
|
|
1808
1808
|
// src/components/dev-console/console.tsx
|
|
1809
1809
|
var import_react_core7 = require("@copilotkit/react-core");
|
|
1810
|
-
var
|
|
1810
|
+
var import_react10 = require("react");
|
|
1811
1811
|
|
|
1812
1812
|
// src/components/dev-console/icons.tsx
|
|
1813
1813
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
@@ -1894,21 +1894,128 @@ var CopilotKitIcon = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
|
1894
1894
|
);
|
|
1895
1895
|
|
|
1896
1896
|
// src/components/dev-console/console.tsx
|
|
1897
|
-
var
|
|
1897
|
+
var import_react11 = require("@headlessui/react");
|
|
1898
1898
|
var import_shared2 = require("@copilotkit/shared");
|
|
1899
|
+
|
|
1900
|
+
// src/components/help-modal/modal.tsx
|
|
1901
|
+
var import_react9 = require("react");
|
|
1902
|
+
|
|
1903
|
+
// src/components/help-modal/icons.tsx
|
|
1899
1904
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1905
|
+
var LifeBuoyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1906
|
+
"svg",
|
|
1907
|
+
{
|
|
1908
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1909
|
+
width: "24",
|
|
1910
|
+
height: "24",
|
|
1911
|
+
viewBox: "0 0 24 24",
|
|
1912
|
+
fill: "none",
|
|
1913
|
+
stroke: "currentColor",
|
|
1914
|
+
strokeWidth: "2",
|
|
1915
|
+
strokeLinecap: "round",
|
|
1916
|
+
strokeLinejoin: "round",
|
|
1917
|
+
className: "icon icon-tabler icons-tabler-outline icon-tabler-lifebuoy",
|
|
1918
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("g", { transform: "translate(0, -1)", children: [
|
|
1919
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
1920
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" }),
|
|
1921
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" }),
|
|
1922
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M15 15l3.35 3.35" }),
|
|
1923
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M9 15l-3.35 3.35" }),
|
|
1924
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M5.65 5.65l3.35 3.35" }),
|
|
1925
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M18.35 5.65l-3.35 3.35" })
|
|
1926
|
+
] })
|
|
1927
|
+
}
|
|
1928
|
+
);
|
|
1929
|
+
var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1930
|
+
"svg",
|
|
1931
|
+
{
|
|
1932
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1933
|
+
fill: "none",
|
|
1934
|
+
viewBox: "0 0 24 24",
|
|
1935
|
+
strokeWidth: "1.5",
|
|
1936
|
+
stroke: "currentColor",
|
|
1937
|
+
width: "20",
|
|
1938
|
+
height: "20",
|
|
1939
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
1940
|
+
}
|
|
1941
|
+
);
|
|
1942
|
+
|
|
1943
|
+
// src/components/help-modal/modal.tsx
|
|
1944
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1945
|
+
function CopilotKitHelpModal() {
|
|
1946
|
+
const [showHelpModal, setShowHelpModal] = (0, import_react9.useState)(false);
|
|
1947
|
+
const [issueDescription, setIssueDescription] = (0, import_react9.useState)("");
|
|
1948
|
+
const handleSubmit = () => {
|
|
1949
|
+
setShowHelpModal(false);
|
|
1950
|
+
};
|
|
1951
|
+
const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1952
|
+
"button",
|
|
1953
|
+
{
|
|
1954
|
+
onClick: () => setShowHelpModal(true),
|
|
1955
|
+
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",
|
|
1956
|
+
"aria-label": "Open Help",
|
|
1957
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LifeBuoyIcon, {})
|
|
1958
|
+
}
|
|
1959
|
+
);
|
|
1960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
1961
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(HelpButton, {}),
|
|
1962
|
+
showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1963
|
+
"div",
|
|
1964
|
+
{
|
|
1965
|
+
className: "fixed inset-0 flex items-center justify-center p-4",
|
|
1966
|
+
style: { backgroundColor: "rgba(11, 15, 26, 0.5)", zIndex: 99 },
|
|
1967
|
+
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: [
|
|
1968
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1969
|
+
"button",
|
|
1970
|
+
{
|
|
1971
|
+
className: "absolute text-gray-400 hover:text-gray-600 focus:outline-none",
|
|
1972
|
+
style: { top: "10px", right: "10px" },
|
|
1973
|
+
onClick: () => setShowHelpModal(false),
|
|
1974
|
+
"aria-label": "Close",
|
|
1975
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CloseIcon2, {})
|
|
1976
|
+
}
|
|
1977
|
+
),
|
|
1978
|
+
/* @__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" }) }),
|
|
1979
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-4 mb-4", children: [
|
|
1980
|
+
/* @__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)(
|
|
1981
|
+
"a",
|
|
1982
|
+
{
|
|
1983
|
+
href: "https://go.copilotkit.ai/dev-console-support-discord",
|
|
1984
|
+
target: "_blank",
|
|
1985
|
+
rel: "noopener noreferrer",
|
|
1986
|
+
children: "Go to Discord Support Channel (Community Support)"
|
|
1987
|
+
}
|
|
1988
|
+
) }),
|
|
1989
|
+
/* @__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)(
|
|
1990
|
+
"a",
|
|
1991
|
+
{
|
|
1992
|
+
href: "https://go.copilotkit.ai/dev-console-support-slack",
|
|
1993
|
+
target: "_blank",
|
|
1994
|
+
rel: "noopener noreferrer",
|
|
1995
|
+
children: "Apply for Priority Direct Slack Support"
|
|
1996
|
+
}
|
|
1997
|
+
) })
|
|
1998
|
+
] })
|
|
1999
|
+
] })
|
|
2000
|
+
}
|
|
2001
|
+
)
|
|
2002
|
+
] });
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
// src/components/dev-console/console.tsx
|
|
2006
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1900
2007
|
function CopilotDevConsole() {
|
|
1901
2008
|
const currentVersion = import_shared2.COPILOTKIT_VERSION;
|
|
1902
2009
|
const context = (0, import_react_core7.useCopilotContext)();
|
|
1903
|
-
const [showDevConsole, setShowDevConsole] = (0,
|
|
1904
|
-
(0,
|
|
2010
|
+
const [showDevConsole, setShowDevConsole] = (0, import_react10.useState)(false);
|
|
2011
|
+
(0, import_react10.useEffect)(() => {
|
|
1905
2012
|
setShowDevConsole(shouldShowDevConsole(context.showDevConsole));
|
|
1906
2013
|
}, [context.showDevConsole]);
|
|
1907
|
-
const dontRunTwiceInDevMode = (0,
|
|
1908
|
-
const [versionStatus, setVersionStatus] = (0,
|
|
1909
|
-
const [latestVersion, setLatestVersion] = (0,
|
|
1910
|
-
const consoleRef = (0,
|
|
1911
|
-
const [debugButtonMode, setDebugButtonMode] = (0,
|
|
2014
|
+
const dontRunTwiceInDevMode = (0, import_react10.useRef)(false);
|
|
2015
|
+
const [versionStatus, setVersionStatus] = (0, import_react10.useState)("unknown");
|
|
2016
|
+
const [latestVersion, setLatestVersion] = (0, import_react10.useState)("");
|
|
2017
|
+
const consoleRef = (0, import_react10.useRef)(null);
|
|
2018
|
+
const [debugButtonMode, setDebugButtonMode] = (0, import_react10.useState)("full");
|
|
1912
2019
|
const checkForUpdates = (force = false) => {
|
|
1913
2020
|
setVersionStatus("checking");
|
|
1914
2021
|
getPublishedCopilotKitVersion(currentVersion, force).then((v) => {
|
|
@@ -1931,14 +2038,14 @@ function CopilotDevConsole() {
|
|
|
1931
2038
|
setVersionStatus("unknown");
|
|
1932
2039
|
});
|
|
1933
2040
|
};
|
|
1934
|
-
(0,
|
|
2041
|
+
(0, import_react10.useEffect)(() => {
|
|
1935
2042
|
if (dontRunTwiceInDevMode.current === true) {
|
|
1936
2043
|
return;
|
|
1937
2044
|
}
|
|
1938
2045
|
dontRunTwiceInDevMode.current = true;
|
|
1939
2046
|
checkForUpdates();
|
|
1940
2047
|
}, []);
|
|
1941
|
-
(0,
|
|
2048
|
+
(0, import_react10.useEffect)(() => {
|
|
1942
2049
|
const handleResize = (entries) => {
|
|
1943
2050
|
for (let entry of entries) {
|
|
1944
2051
|
if (entry.target === consoleRef.current) {
|
|
@@ -1970,14 +2077,14 @@ function CopilotDevConsole() {
|
|
|
1970
2077
|
if (!showDevConsole) {
|
|
1971
2078
|
return null;
|
|
1972
2079
|
}
|
|
1973
|
-
return /* @__PURE__ */ (0,
|
|
2080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1974
2081
|
"div",
|
|
1975
2082
|
{
|
|
1976
2083
|
ref: consoleRef,
|
|
1977
2084
|
className: "copilotKitDevConsole " + (versionStatus === "update-available" ? "copilotKitDevConsoleUpgrade" : "") + (versionStatus === "outdated" ? "copilotKitDevConsoleWarnOutdated" : ""),
|
|
1978
2085
|
children: [
|
|
1979
|
-
/* @__PURE__ */ (0,
|
|
1980
|
-
/* @__PURE__ */ (0,
|
|
2086
|
+
/* @__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 }) }),
|
|
2087
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1981
2088
|
VersionInfo,
|
|
1982
2089
|
{
|
|
1983
2090
|
showDevConsole: context.showDevConsole,
|
|
@@ -1986,7 +2093,8 @@ function CopilotDevConsole() {
|
|
|
1986
2093
|
latestVersion
|
|
1987
2094
|
}
|
|
1988
2095
|
),
|
|
1989
|
-
/* @__PURE__ */ (0,
|
|
2096
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CopilotKitHelpModal, {}),
|
|
2097
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1990
2098
|
DebugMenuButton,
|
|
1991
2099
|
{
|
|
1992
2100
|
setShowDevConsole,
|
|
@@ -2004,7 +2112,7 @@ function VersionInfo({
|
|
|
2004
2112
|
currentVersion,
|
|
2005
2113
|
latestVersion
|
|
2006
2114
|
}) {
|
|
2007
|
-
const [copyStatus, setCopyStatus] = (0,
|
|
2115
|
+
const [copyStatus, setCopyStatus] = (0, import_react10.useState)("");
|
|
2008
2116
|
let versionLabel = "";
|
|
2009
2117
|
let versionIcon = "";
|
|
2010
2118
|
let currentVersionLabel = currentVersion;
|
|
@@ -2041,12 +2149,12 @@ function VersionInfo({
|
|
|
2041
2149
|
setTimeout(() => setCopyStatus(""), 1e3);
|
|
2042
2150
|
});
|
|
2043
2151
|
};
|
|
2044
|
-
return /* @__PURE__ */ (0,
|
|
2045
|
-
/* @__PURE__ */ (0,
|
|
2152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitVersionInfo", children: [
|
|
2153
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("header", { children: [
|
|
2046
2154
|
"COPILOTKIT DEV CONSOLE",
|
|
2047
|
-
showDevConsole === "auto" && /* @__PURE__ */ (0,
|
|
2155
|
+
showDevConsole === "auto" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("aside", { children: asideLabel })
|
|
2048
2156
|
] }),
|
|
2049
|
-
/* @__PURE__ */ (0,
|
|
2157
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("section", { children: [
|
|
2050
2158
|
"Version: ",
|
|
2051
2159
|
versionLabel,
|
|
2052
2160
|
" (",
|
|
@@ -2054,7 +2162,7 @@ function VersionInfo({
|
|
|
2054
2162
|
") ",
|
|
2055
2163
|
versionIcon
|
|
2056
2164
|
] }),
|
|
2057
|
-
(versionStatus === "update-available" || versionStatus === "outdated") && /* @__PURE__ */ (0,
|
|
2165
|
+
(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 }) })
|
|
2058
2166
|
] });
|
|
2059
2167
|
}
|
|
2060
2168
|
function DebugMenuButton({
|
|
@@ -2064,22 +2172,22 @@ function DebugMenuButton({
|
|
|
2064
2172
|
}) {
|
|
2065
2173
|
const context = (0, import_react_core7.useCopilotContext)();
|
|
2066
2174
|
const messagesContext = (0, import_react_core7.useCopilotMessagesContext)();
|
|
2067
|
-
return /* @__PURE__ */ (0,
|
|
2068
|
-
/* @__PURE__ */ (0,
|
|
2175
|
+
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: [
|
|
2176
|
+
/* @__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: [
|
|
2069
2177
|
"Debug ",
|
|
2070
2178
|
ChevronDownIcon
|
|
2071
2179
|
] }) }),
|
|
2072
|
-
/* @__PURE__ */ (0,
|
|
2073
|
-
|
|
2180
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2181
|
+
import_react11.MenuItems,
|
|
2074
2182
|
{
|
|
2075
2183
|
transition: true,
|
|
2076
2184
|
anchor: "bottom end",
|
|
2077
2185
|
className: "copilotKitDebugMenu",
|
|
2078
2186
|
style: { zIndex: 40 },
|
|
2079
2187
|
children: [
|
|
2080
|
-
/* @__PURE__ */ (0,
|
|
2081
|
-
/* @__PURE__ */ (0,
|
|
2082
|
-
/* @__PURE__ */ (0,
|
|
2188
|
+
/* @__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" }) }),
|
|
2189
|
+
/* @__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" }) }),
|
|
2190
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2083
2191
|
"button",
|
|
2084
2192
|
{
|
|
2085
2193
|
className: "copilotKitDebugMenuItem",
|
|
@@ -2087,9 +2195,9 @@ function DebugMenuButton({
|
|
|
2087
2195
|
children: "Log Messages"
|
|
2088
2196
|
}
|
|
2089
2197
|
) }),
|
|
2090
|
-
/* @__PURE__ */ (0,
|
|
2091
|
-
/* @__PURE__ */ (0,
|
|
2092
|
-
/* @__PURE__ */ (0,
|
|
2198
|
+
/* @__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" }) }),
|
|
2199
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("hr", {}),
|
|
2200
|
+
/* @__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" }) })
|
|
2093
2201
|
]
|
|
2094
2202
|
}
|
|
2095
2203
|
)
|
|
@@ -2097,13 +2205,16 @@ function DebugMenuButton({
|
|
|
2097
2205
|
}
|
|
2098
2206
|
|
|
2099
2207
|
// src/components/chat/Chat.tsx
|
|
2100
|
-
var
|
|
2208
|
+
var import_react_core9 = require("@copilotkit/react-core");
|
|
2209
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2101
2210
|
function CopilotChat({
|
|
2102
2211
|
instructions,
|
|
2103
2212
|
onSubmitMessage,
|
|
2104
2213
|
makeSystemMessage,
|
|
2105
2214
|
showResponseButton = true,
|
|
2106
2215
|
onInProgress,
|
|
2216
|
+
onStopGeneration,
|
|
2217
|
+
onReloadMessages,
|
|
2107
2218
|
Messages: Messages2 = Messages,
|
|
2108
2219
|
RenderTextMessage: RenderTextMessage2 = RenderTextMessage,
|
|
2109
2220
|
RenderActionExecutionMessage: RenderActionExecutionMessage2 = RenderActionExecutionMessage,
|
|
@@ -2116,7 +2227,7 @@ function CopilotChat({
|
|
|
2116
2227
|
labels
|
|
2117
2228
|
}) {
|
|
2118
2229
|
const context = (0, import_react_core8.useCopilotContext)();
|
|
2119
|
-
(0,
|
|
2230
|
+
(0, import_react12.useEffect)(() => {
|
|
2120
2231
|
context.setChatInstructions(instructions || "");
|
|
2121
2232
|
}, [instructions]);
|
|
2122
2233
|
const {
|
|
@@ -2126,12 +2237,18 @@ function CopilotChat({
|
|
|
2126
2237
|
sendMessage,
|
|
2127
2238
|
stopGeneration,
|
|
2128
2239
|
reloadMessages
|
|
2129
|
-
} = useCopilotChatLogic(
|
|
2130
|
-
|
|
2240
|
+
} = useCopilotChatLogic(
|
|
2241
|
+
makeSystemMessage,
|
|
2242
|
+
onInProgress,
|
|
2243
|
+
onSubmitMessage,
|
|
2244
|
+
onStopGeneration,
|
|
2245
|
+
onReloadMessages
|
|
2246
|
+
);
|
|
2247
|
+
const chatContext = import_react12.default.useContext(ChatContext);
|
|
2131
2248
|
const isVisible = chatContext ? chatContext.open : true;
|
|
2132
|
-
return /* @__PURE__ */ (0,
|
|
2133
|
-
/* @__PURE__ */ (0,
|
|
2134
|
-
/* @__PURE__ */ (0,
|
|
2249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
2250
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CopilotDevConsole, {}),
|
|
2251
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2135
2252
|
Messages2,
|
|
2136
2253
|
{
|
|
2137
2254
|
RenderTextMessage: RenderTextMessage2,
|
|
@@ -2141,9 +2258,9 @@ function CopilotChat({
|
|
|
2141
2258
|
messages: visibleMessages,
|
|
2142
2259
|
inProgress: isLoading,
|
|
2143
2260
|
children: [
|
|
2144
|
-
currentSuggestions.length > 0 && /* @__PURE__ */ (0,
|
|
2145
|
-
/* @__PURE__ */ (0,
|
|
2146
|
-
/* @__PURE__ */ (0,
|
|
2261
|
+
currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
2262
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h6", { children: "Suggested:" }),
|
|
2263
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "suggestions", children: currentSuggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2147
2264
|
Suggestion,
|
|
2148
2265
|
{
|
|
2149
2266
|
title: suggestion.title,
|
|
@@ -2155,7 +2272,7 @@ function CopilotChat({
|
|
|
2155
2272
|
index
|
|
2156
2273
|
)) })
|
|
2157
2274
|
] }),
|
|
2158
|
-
showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ (0,
|
|
2275
|
+
showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2159
2276
|
ResponseButton2,
|
|
2160
2277
|
{
|
|
2161
2278
|
onClick: isLoading ? stopGeneration : reloadMessages,
|
|
@@ -2165,7 +2282,7 @@ function CopilotChat({
|
|
|
2165
2282
|
]
|
|
2166
2283
|
}
|
|
2167
2284
|
),
|
|
2168
|
-
/* @__PURE__ */ (0,
|
|
2285
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Input2, { inProgress: isLoading, onSend: sendMessage, isVisible })
|
|
2169
2286
|
] });
|
|
2170
2287
|
}
|
|
2171
2288
|
function WrappedCopilotChat({
|
|
@@ -2174,31 +2291,38 @@ function WrappedCopilotChat({
|
|
|
2174
2291
|
labels,
|
|
2175
2292
|
className
|
|
2176
2293
|
}) {
|
|
2177
|
-
const chatContext =
|
|
2294
|
+
const chatContext = import_react12.default.useContext(ChatContext);
|
|
2178
2295
|
if (!chatContext) {
|
|
2179
|
-
return /* @__PURE__ */ (0,
|
|
2180
|
-
}, children: /* @__PURE__ */ (0,
|
|
2296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
|
|
2297
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `copilotKitChat ${className}`, children }) });
|
|
2181
2298
|
}
|
|
2182
|
-
return /* @__PURE__ */ (0,
|
|
2299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children });
|
|
2183
2300
|
}
|
|
2184
2301
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2185
|
-
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
|
|
2186
|
-
|
|
2302
|
+
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
|
|
2303
|
+
var _a;
|
|
2304
|
+
const {
|
|
2305
|
+
visibleMessages,
|
|
2306
|
+
appendMessage,
|
|
2307
|
+
reloadMessages: defaultReloadMessages,
|
|
2308
|
+
stopGeneration: defaultStopGeneration,
|
|
2309
|
+
isLoading
|
|
2310
|
+
} = (0, import_react_core8.useCopilotChat)({
|
|
2187
2311
|
id: (0, import_shared3.randomId)(),
|
|
2188
2312
|
makeSystemMessage
|
|
2189
2313
|
});
|
|
2190
|
-
const [currentSuggestions, setCurrentSuggestions] = (0,
|
|
2191
|
-
const suggestionsAbortControllerRef = (0,
|
|
2192
|
-
const debounceTimerRef = (0,
|
|
2314
|
+
const [currentSuggestions, setCurrentSuggestions] = (0, import_react12.useState)([]);
|
|
2315
|
+
const suggestionsAbortControllerRef = (0, import_react12.useRef)(null);
|
|
2316
|
+
const debounceTimerRef = (0, import_react12.useRef)();
|
|
2193
2317
|
const abortSuggestions = () => {
|
|
2194
|
-
var
|
|
2195
|
-
(
|
|
2318
|
+
var _a2;
|
|
2319
|
+
(_a2 = suggestionsAbortControllerRef.current) == null ? void 0 : _a2.abort();
|
|
2196
2320
|
suggestionsAbortControllerRef.current = null;
|
|
2197
2321
|
};
|
|
2198
2322
|
const generalContext = (0, import_react_core8.useCopilotContext)();
|
|
2199
2323
|
const messagesContext = (0, import_react_core8.useCopilotMessagesContext)();
|
|
2200
2324
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
2201
|
-
(0,
|
|
2325
|
+
(0, import_react12.useEffect)(() => {
|
|
2202
2326
|
onInProgress == null ? void 0 : onInProgress(isLoading);
|
|
2203
2327
|
abortSuggestions();
|
|
2204
2328
|
debounceTimerRef.current = setTimeout(
|
|
@@ -2218,7 +2342,13 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2218
2342
|
return () => {
|
|
2219
2343
|
clearTimeout(debounceTimerRef.current);
|
|
2220
2344
|
};
|
|
2221
|
-
}, [
|
|
2345
|
+
}, [
|
|
2346
|
+
isLoading,
|
|
2347
|
+
context.chatSuggestionConfiguration,
|
|
2348
|
+
// hackish way to trigger suggestions reload on reset, but better than moving suggestions to the
|
|
2349
|
+
// global context
|
|
2350
|
+
visibleMessages.length == 0
|
|
2351
|
+
]);
|
|
2222
2352
|
const sendMessage = (messageContent) => __async(void 0, null, function* () {
|
|
2223
2353
|
abortSuggestions();
|
|
2224
2354
|
setCurrentSuggestions([]);
|
|
@@ -2236,6 +2366,79 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2236
2366
|
appendMessage(message);
|
|
2237
2367
|
return message;
|
|
2238
2368
|
});
|
|
2369
|
+
const messages = visibleMessages;
|
|
2370
|
+
const { setMessages } = messagesContext;
|
|
2371
|
+
const currentAgentName = (_a = generalContext.agentSession) == null ? void 0 : _a.agentName;
|
|
2372
|
+
const restartCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2373
|
+
if (generalContext.agentSession) {
|
|
2374
|
+
generalContext.setAgentSession(__spreadProps(__spreadValues({}, generalContext.agentSession), {
|
|
2375
|
+
nodeName: void 0,
|
|
2376
|
+
threadId: void 0
|
|
2377
|
+
}));
|
|
2378
|
+
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2379
|
+
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2380
|
+
[generalContext.agentSession.agentName]: __spreadProps(__spreadValues({}, prevAgentStates[generalContext.agentSession.agentName]), {
|
|
2381
|
+
threadId: void 0,
|
|
2382
|
+
nodeName: void 0,
|
|
2383
|
+
runId: void 0
|
|
2384
|
+
})
|
|
2385
|
+
});
|
|
2386
|
+
});
|
|
2387
|
+
}
|
|
2388
|
+
});
|
|
2389
|
+
const runCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2390
|
+
if (generalContext.agentSession) {
|
|
2391
|
+
yield (0, import_react_core9.runAgent)(generalContext.agentSession.agentName, context, appendMessage, hint);
|
|
2392
|
+
}
|
|
2393
|
+
});
|
|
2394
|
+
const stopCurrentAgent = () => {
|
|
2395
|
+
if (generalContext.agentSession) {
|
|
2396
|
+
(0, import_react_core9.stopAgent)(generalContext.agentSession.agentName, context);
|
|
2397
|
+
}
|
|
2398
|
+
};
|
|
2399
|
+
const setCurrentAgentState = (state) => {
|
|
2400
|
+
if (generalContext.agentSession) {
|
|
2401
|
+
generalContext.setCoagentStates((prevAgentStates) => {
|
|
2402
|
+
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
2403
|
+
[generalContext.agentSession.agentName]: {
|
|
2404
|
+
state
|
|
2405
|
+
}
|
|
2406
|
+
});
|
|
2407
|
+
});
|
|
2408
|
+
}
|
|
2409
|
+
};
|
|
2410
|
+
function stopGeneration() {
|
|
2411
|
+
if (onStopGeneration) {
|
|
2412
|
+
onStopGeneration({
|
|
2413
|
+
messages,
|
|
2414
|
+
setMessages,
|
|
2415
|
+
stopGeneration: defaultStopGeneration,
|
|
2416
|
+
currentAgentName,
|
|
2417
|
+
restartCurrentAgent,
|
|
2418
|
+
stopCurrentAgent,
|
|
2419
|
+
runCurrentAgent,
|
|
2420
|
+
setCurrentAgentState
|
|
2421
|
+
});
|
|
2422
|
+
} else {
|
|
2423
|
+
defaultStopGeneration();
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
function reloadMessages() {
|
|
2427
|
+
if (onReloadMessages) {
|
|
2428
|
+
onReloadMessages({
|
|
2429
|
+
messages,
|
|
2430
|
+
setMessages,
|
|
2431
|
+
stopGeneration: defaultStopGeneration,
|
|
2432
|
+
currentAgentName,
|
|
2433
|
+
restartCurrentAgent,
|
|
2434
|
+
stopCurrentAgent,
|
|
2435
|
+
runCurrentAgent,
|
|
2436
|
+
setCurrentAgentState
|
|
2437
|
+
});
|
|
2438
|
+
} else {
|
|
2439
|
+
defaultReloadMessages();
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2239
2442
|
return {
|
|
2240
2443
|
visibleMessages,
|
|
2241
2444
|
isLoading,
|
|
@@ -2247,7 +2450,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2247
2450
|
};
|
|
2248
2451
|
|
|
2249
2452
|
// src/components/chat/Modal.tsx
|
|
2250
|
-
var
|
|
2453
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2251
2454
|
var CopilotModal = ({
|
|
2252
2455
|
instructions,
|
|
2253
2456
|
defaultOpen = false,
|
|
@@ -2255,6 +2458,8 @@ var CopilotModal = ({
|
|
|
2255
2458
|
hitEscapeToClose = true,
|
|
2256
2459
|
onSetOpen,
|
|
2257
2460
|
onSubmitMessage,
|
|
2461
|
+
onStopGeneration,
|
|
2462
|
+
onReloadMessages,
|
|
2258
2463
|
shortcut = "/",
|
|
2259
2464
|
icons,
|
|
2260
2465
|
labels,
|
|
@@ -2270,28 +2475,30 @@ var CopilotModal = ({
|
|
|
2270
2475
|
className,
|
|
2271
2476
|
children
|
|
2272
2477
|
}) => {
|
|
2273
|
-
const [openState, setOpenState] =
|
|
2478
|
+
const [openState, setOpenState] = import_react13.default.useState(defaultOpen);
|
|
2274
2479
|
const setOpen = (open) => {
|
|
2275
2480
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
2276
2481
|
setOpenState(open);
|
|
2277
2482
|
};
|
|
2278
|
-
return /* @__PURE__ */ (0,
|
|
2483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
2279
2484
|
children,
|
|
2280
|
-
/* @__PURE__ */ (0,
|
|
2281
|
-
/* @__PURE__ */ (0,
|
|
2282
|
-
/* @__PURE__ */ (0,
|
|
2485
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className, children: [
|
|
2486
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button2, {}),
|
|
2487
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2283
2488
|
Window2,
|
|
2284
2489
|
{
|
|
2285
2490
|
clickOutsideToClose,
|
|
2286
2491
|
shortcut,
|
|
2287
2492
|
hitEscapeToClose,
|
|
2288
2493
|
children: [
|
|
2289
|
-
/* @__PURE__ */ (0,
|
|
2290
|
-
/* @__PURE__ */ (0,
|
|
2494
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Header2, {}),
|
|
2495
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2291
2496
|
CopilotChat,
|
|
2292
2497
|
{
|
|
2293
2498
|
instructions,
|
|
2294
2499
|
onSubmitMessage,
|
|
2500
|
+
onStopGeneration,
|
|
2501
|
+
onReloadMessages,
|
|
2295
2502
|
makeSystemMessage,
|
|
2296
2503
|
showResponseButton,
|
|
2297
2504
|
onInProgress,
|
|
@@ -2308,22 +2515,22 @@ var CopilotModal = ({
|
|
|
2308
2515
|
};
|
|
2309
2516
|
|
|
2310
2517
|
// src/components/chat/Popup.tsx
|
|
2311
|
-
var
|
|
2518
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2312
2519
|
function CopilotPopup(props) {
|
|
2313
2520
|
props = __spreadProps(__spreadValues({}, props), {
|
|
2314
2521
|
className: props.className ? props.className + " copilotKitPopup" : "copilotKitPopup"
|
|
2315
2522
|
});
|
|
2316
|
-
return /* @__PURE__ */ (0,
|
|
2523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CopilotModal, __spreadProps(__spreadValues({}, props), { children: props.children }));
|
|
2317
2524
|
}
|
|
2318
2525
|
|
|
2319
2526
|
// src/components/chat/Sidebar.tsx
|
|
2320
|
-
var
|
|
2321
|
-
var
|
|
2527
|
+
var import_react14 = require("react");
|
|
2528
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2322
2529
|
function CopilotSidebar(props) {
|
|
2323
2530
|
props = __spreadProps(__spreadValues({}, props), {
|
|
2324
2531
|
className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
|
|
2325
2532
|
});
|
|
2326
|
-
const [expandedClassName, setExpandedClassName] = (0,
|
|
2533
|
+
const [expandedClassName, setExpandedClassName] = (0, import_react14.useState)(
|
|
2327
2534
|
props.defaultOpen ? "sidebarExpanded" : ""
|
|
2328
2535
|
);
|
|
2329
2536
|
const onSetOpen = (open) => {
|
|
@@ -2331,7 +2538,7 @@ function CopilotSidebar(props) {
|
|
|
2331
2538
|
(_a = props.onSetOpen) == null ? void 0 : _a.call(props, open);
|
|
2332
2539
|
setExpandedClassName(open ? "sidebarExpanded" : "");
|
|
2333
2540
|
};
|
|
2334
|
-
return /* @__PURE__ */ (0,
|
|
2541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CopilotModal, __spreadProps(__spreadValues(__spreadValues({}, props), { onSetOpen }), { children: props.children })) });
|
|
2335
2542
|
}
|
|
2336
2543
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2337
2544
|
0 && (module.exports = {
|