@copilotkit/react-ui 1.4.1-pre.5 → 1.4.1
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 +65 -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-63ZKP62F.mjs} +2 -2
- package/dist/{chunk-ORHE7FYT.mjs → chunk-DHGDU64D.mjs} +8 -8
- package/dist/chunk-KXE2JCUH.mjs +1 -0
- package/dist/chunk-MMVDU6DF.mjs +1 -0
- package/dist/chunk-MMVDU6DF.mjs.map +1 -0
- package/dist/{chunk-ECPBML4L.mjs → chunk-TKFQ7VQR.mjs} +2 -2
- package/dist/{chunk-TSIFZ5N5.mjs → chunk-VYKDFXGS.mjs} +2 -2
- package/dist/chunk-WOUWNTAV.mjs +72 -0
- package/dist/chunk-WOUWNTAV.mjs.map +1 -0
- package/dist/components/chat/Chat.js +159 -51
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +7 -4
- package/dist/components/chat/Modal.js +168 -60
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +8 -5
- package/dist/components/chat/Popup.js +170 -62
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +9 -6
- package/dist/components/chat/Sidebar.js +172 -64
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +9 -6
- package/dist/components/chat/index.js +174 -66
- 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.d.ts +3 -0
- package/dist/components/index.js +178 -66
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +18 -9
- package/dist/index.css +4 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +180 -68
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -9
- package/package.json +7 -7
- 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/src/components/index.ts +1 -0
- package/src/css/markdown.css +5 -0
- package/dist/chunk-JD7BAH7U.mjs +0 -1
- package/dist/chunk-RS6UPR5N.mjs.map +0 -1
- /package/dist/{chunk-H5CXJBR5.mjs.map → chunk-63ZKP62F.mjs.map} +0 -0
- /package/dist/{chunk-ORHE7FYT.mjs.map → chunk-DHGDU64D.mjs.map} +0 -0
- /package/dist/{chunk-JD7BAH7U.mjs.map → chunk-KXE2JCUH.mjs.map} +0 -0
- /package/dist/{chunk-ECPBML4L.mjs.map → chunk-TKFQ7VQR.mjs.map} +0 -0
- /package/dist/{chunk-TSIFZ5N5.mjs.map → chunk-VYKDFXGS.mjs.map} +0 -0
package/dist/components/index.js
CHANGED
|
@@ -80,14 +80,16 @@ var __async = (__this, __arguments, generator) => {
|
|
|
80
80
|
var components_exports = {};
|
|
81
81
|
__export(components_exports, {
|
|
82
82
|
CopilotChat: () => CopilotChat,
|
|
83
|
+
CopilotDevConsole: () => CopilotDevConsole,
|
|
83
84
|
CopilotPopup: () => CopilotPopup,
|
|
84
85
|
CopilotSidebar: () => CopilotSidebar,
|
|
86
|
+
shouldShowDevConsole: () => shouldShowDevConsole,
|
|
85
87
|
useChatContext: () => useChatContext
|
|
86
88
|
});
|
|
87
89
|
module.exports = __toCommonJS(components_exports);
|
|
88
90
|
|
|
89
91
|
// src/components/chat/Modal.tsx
|
|
90
|
-
var
|
|
92
|
+
var import_react13 = __toESM(require("react"));
|
|
91
93
|
|
|
92
94
|
// src/components/chat/ChatContext.tsx
|
|
93
95
|
var import_react = __toESM(require("react"));
|
|
@@ -1666,7 +1668,7 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
|
|
|
1666
1668
|
});
|
|
1667
1669
|
|
|
1668
1670
|
// src/components/chat/Chat.tsx
|
|
1669
|
-
var
|
|
1671
|
+
var import_react12 = __toESM(require("react"));
|
|
1670
1672
|
var import_react_core8 = require("@copilotkit/react-core");
|
|
1671
1673
|
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
1672
1674
|
var import_shared3 = require("@copilotkit/shared");
|
|
@@ -1805,7 +1807,7 @@ function logMessages(context) {
|
|
|
1805
1807
|
|
|
1806
1808
|
// src/components/dev-console/console.tsx
|
|
1807
1809
|
var import_react_core7 = require("@copilotkit/react-core");
|
|
1808
|
-
var
|
|
1810
|
+
var import_react10 = require("react");
|
|
1809
1811
|
|
|
1810
1812
|
// src/components/dev-console/icons.tsx
|
|
1811
1813
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
@@ -1892,21 +1894,128 @@ var CopilotKitIcon = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
|
1892
1894
|
);
|
|
1893
1895
|
|
|
1894
1896
|
// src/components/dev-console/console.tsx
|
|
1895
|
-
var
|
|
1897
|
+
var import_react11 = require("@headlessui/react");
|
|
1896
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
|
|
1897
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");
|
|
1898
2007
|
function CopilotDevConsole() {
|
|
1899
2008
|
const currentVersion = import_shared2.COPILOTKIT_VERSION;
|
|
1900
2009
|
const context = (0, import_react_core7.useCopilotContext)();
|
|
1901
|
-
const [showDevConsole, setShowDevConsole] = (0,
|
|
1902
|
-
(0,
|
|
2010
|
+
const [showDevConsole, setShowDevConsole] = (0, import_react10.useState)(false);
|
|
2011
|
+
(0, import_react10.useEffect)(() => {
|
|
1903
2012
|
setShowDevConsole(shouldShowDevConsole(context.showDevConsole));
|
|
1904
2013
|
}, [context.showDevConsole]);
|
|
1905
|
-
const dontRunTwiceInDevMode = (0,
|
|
1906
|
-
const [versionStatus, setVersionStatus] = (0,
|
|
1907
|
-
const [latestVersion, setLatestVersion] = (0,
|
|
1908
|
-
const consoleRef = (0,
|
|
1909
|
-
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");
|
|
1910
2019
|
const checkForUpdates = (force = false) => {
|
|
1911
2020
|
setVersionStatus("checking");
|
|
1912
2021
|
getPublishedCopilotKitVersion(currentVersion, force).then((v) => {
|
|
@@ -1929,14 +2038,14 @@ function CopilotDevConsole() {
|
|
|
1929
2038
|
setVersionStatus("unknown");
|
|
1930
2039
|
});
|
|
1931
2040
|
};
|
|
1932
|
-
(0,
|
|
2041
|
+
(0, import_react10.useEffect)(() => {
|
|
1933
2042
|
if (dontRunTwiceInDevMode.current === true) {
|
|
1934
2043
|
return;
|
|
1935
2044
|
}
|
|
1936
2045
|
dontRunTwiceInDevMode.current = true;
|
|
1937
2046
|
checkForUpdates();
|
|
1938
2047
|
}, []);
|
|
1939
|
-
(0,
|
|
2048
|
+
(0, import_react10.useEffect)(() => {
|
|
1940
2049
|
const handleResize = (entries) => {
|
|
1941
2050
|
for (let entry of entries) {
|
|
1942
2051
|
if (entry.target === consoleRef.current) {
|
|
@@ -1968,14 +2077,14 @@ function CopilotDevConsole() {
|
|
|
1968
2077
|
if (!showDevConsole) {
|
|
1969
2078
|
return null;
|
|
1970
2079
|
}
|
|
1971
|
-
return /* @__PURE__ */ (0,
|
|
2080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1972
2081
|
"div",
|
|
1973
2082
|
{
|
|
1974
2083
|
ref: consoleRef,
|
|
1975
2084
|
className: "copilotKitDevConsole " + (versionStatus === "update-available" ? "copilotKitDevConsoleUpgrade" : "") + (versionStatus === "outdated" ? "copilotKitDevConsoleWarnOutdated" : ""),
|
|
1976
2085
|
children: [
|
|
1977
|
-
/* @__PURE__ */ (0,
|
|
1978
|
-
/* @__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)(
|
|
1979
2088
|
VersionInfo,
|
|
1980
2089
|
{
|
|
1981
2090
|
showDevConsole: context.showDevConsole,
|
|
@@ -1984,7 +2093,8 @@ function CopilotDevConsole() {
|
|
|
1984
2093
|
latestVersion
|
|
1985
2094
|
}
|
|
1986
2095
|
),
|
|
1987
|
-
/* @__PURE__ */ (0,
|
|
2096
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CopilotKitHelpModal, {}),
|
|
2097
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1988
2098
|
DebugMenuButton,
|
|
1989
2099
|
{
|
|
1990
2100
|
setShowDevConsole,
|
|
@@ -2002,7 +2112,7 @@ function VersionInfo({
|
|
|
2002
2112
|
currentVersion,
|
|
2003
2113
|
latestVersion
|
|
2004
2114
|
}) {
|
|
2005
|
-
const [copyStatus, setCopyStatus] = (0,
|
|
2115
|
+
const [copyStatus, setCopyStatus] = (0, import_react10.useState)("");
|
|
2006
2116
|
let versionLabel = "";
|
|
2007
2117
|
let versionIcon = "";
|
|
2008
2118
|
let currentVersionLabel = currentVersion;
|
|
@@ -2039,12 +2149,12 @@ function VersionInfo({
|
|
|
2039
2149
|
setTimeout(() => setCopyStatus(""), 1e3);
|
|
2040
2150
|
});
|
|
2041
2151
|
};
|
|
2042
|
-
return /* @__PURE__ */ (0,
|
|
2043
|
-
/* @__PURE__ */ (0,
|
|
2152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitVersionInfo", children: [
|
|
2153
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("header", { children: [
|
|
2044
2154
|
"COPILOTKIT DEV CONSOLE",
|
|
2045
|
-
showDevConsole === "auto" && /* @__PURE__ */ (0,
|
|
2155
|
+
showDevConsole === "auto" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("aside", { children: asideLabel })
|
|
2046
2156
|
] }),
|
|
2047
|
-
/* @__PURE__ */ (0,
|
|
2157
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("section", { children: [
|
|
2048
2158
|
"Version: ",
|
|
2049
2159
|
versionLabel,
|
|
2050
2160
|
" (",
|
|
@@ -2052,7 +2162,7 @@ function VersionInfo({
|
|
|
2052
2162
|
") ",
|
|
2053
2163
|
versionIcon
|
|
2054
2164
|
] }),
|
|
2055
|
-
(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 }) })
|
|
2056
2166
|
] });
|
|
2057
2167
|
}
|
|
2058
2168
|
function DebugMenuButton({
|
|
@@ -2062,22 +2172,22 @@ function DebugMenuButton({
|
|
|
2062
2172
|
}) {
|
|
2063
2173
|
const context = (0, import_react_core7.useCopilotContext)();
|
|
2064
2174
|
const messagesContext = (0, import_react_core7.useCopilotMessagesContext)();
|
|
2065
|
-
return /* @__PURE__ */ (0,
|
|
2066
|
-
/* @__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: [
|
|
2067
2177
|
"Debug ",
|
|
2068
2178
|
ChevronDownIcon
|
|
2069
2179
|
] }) }),
|
|
2070
|
-
/* @__PURE__ */ (0,
|
|
2071
|
-
|
|
2180
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2181
|
+
import_react11.MenuItems,
|
|
2072
2182
|
{
|
|
2073
2183
|
transition: true,
|
|
2074
2184
|
anchor: "bottom end",
|
|
2075
2185
|
className: "copilotKitDebugMenu",
|
|
2076
2186
|
style: { zIndex: 40 },
|
|
2077
2187
|
children: [
|
|
2078
|
-
/* @__PURE__ */ (0,
|
|
2079
|
-
/* @__PURE__ */ (0,
|
|
2080
|
-
/* @__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)(
|
|
2081
2191
|
"button",
|
|
2082
2192
|
{
|
|
2083
2193
|
className: "copilotKitDebugMenuItem",
|
|
@@ -2085,9 +2195,9 @@ function DebugMenuButton({
|
|
|
2085
2195
|
children: "Log Messages"
|
|
2086
2196
|
}
|
|
2087
2197
|
) }),
|
|
2088
|
-
/* @__PURE__ */ (0,
|
|
2089
|
-
/* @__PURE__ */ (0,
|
|
2090
|
-
/* @__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" }) })
|
|
2091
2201
|
]
|
|
2092
2202
|
}
|
|
2093
2203
|
)
|
|
@@ -2095,7 +2205,7 @@ function DebugMenuButton({
|
|
|
2095
2205
|
}
|
|
2096
2206
|
|
|
2097
2207
|
// src/components/chat/Chat.tsx
|
|
2098
|
-
var
|
|
2208
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2099
2209
|
function CopilotChat({
|
|
2100
2210
|
instructions,
|
|
2101
2211
|
onSubmitMessage,
|
|
@@ -2114,7 +2224,7 @@ function CopilotChat({
|
|
|
2114
2224
|
labels
|
|
2115
2225
|
}) {
|
|
2116
2226
|
const context = (0, import_react_core8.useCopilotContext)();
|
|
2117
|
-
(0,
|
|
2227
|
+
(0, import_react12.useEffect)(() => {
|
|
2118
2228
|
context.setChatInstructions(instructions || "");
|
|
2119
2229
|
}, [instructions]);
|
|
2120
2230
|
const {
|
|
@@ -2125,11 +2235,11 @@ function CopilotChat({
|
|
|
2125
2235
|
stopGeneration,
|
|
2126
2236
|
reloadMessages
|
|
2127
2237
|
} = useCopilotChatLogic(makeSystemMessage, onInProgress, onSubmitMessage);
|
|
2128
|
-
const chatContext =
|
|
2238
|
+
const chatContext = import_react12.default.useContext(ChatContext);
|
|
2129
2239
|
const isVisible = chatContext ? chatContext.open : true;
|
|
2130
|
-
return /* @__PURE__ */ (0,
|
|
2131
|
-
/* @__PURE__ */ (0,
|
|
2132
|
-
/* @__PURE__ */ (0,
|
|
2240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
2241
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CopilotDevConsole, {}),
|
|
2242
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2133
2243
|
Messages2,
|
|
2134
2244
|
{
|
|
2135
2245
|
RenderTextMessage: RenderTextMessage2,
|
|
@@ -2139,9 +2249,9 @@ function CopilotChat({
|
|
|
2139
2249
|
messages: visibleMessages,
|
|
2140
2250
|
inProgress: isLoading,
|
|
2141
2251
|
children: [
|
|
2142
|
-
currentSuggestions.length > 0 && /* @__PURE__ */ (0,
|
|
2143
|
-
/* @__PURE__ */ (0,
|
|
2144
|
-
/* @__PURE__ */ (0,
|
|
2252
|
+
currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
2253
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h6", { children: "Suggested:" }),
|
|
2254
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "suggestions", children: currentSuggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2145
2255
|
Suggestion,
|
|
2146
2256
|
{
|
|
2147
2257
|
title: suggestion.title,
|
|
@@ -2153,7 +2263,7 @@ function CopilotChat({
|
|
|
2153
2263
|
index
|
|
2154
2264
|
)) })
|
|
2155
2265
|
] }),
|
|
2156
|
-
showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ (0,
|
|
2266
|
+
showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2157
2267
|
ResponseButton2,
|
|
2158
2268
|
{
|
|
2159
2269
|
onClick: isLoading ? stopGeneration : reloadMessages,
|
|
@@ -2163,7 +2273,7 @@ function CopilotChat({
|
|
|
2163
2273
|
]
|
|
2164
2274
|
}
|
|
2165
2275
|
),
|
|
2166
|
-
/* @__PURE__ */ (0,
|
|
2276
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Input2, { inProgress: isLoading, onSend: sendMessage, isVisible })
|
|
2167
2277
|
] });
|
|
2168
2278
|
}
|
|
2169
2279
|
function WrappedCopilotChat({
|
|
@@ -2172,12 +2282,12 @@ function WrappedCopilotChat({
|
|
|
2172
2282
|
labels,
|
|
2173
2283
|
className
|
|
2174
2284
|
}) {
|
|
2175
|
-
const chatContext =
|
|
2285
|
+
const chatContext = import_react12.default.useContext(ChatContext);
|
|
2176
2286
|
if (!chatContext) {
|
|
2177
|
-
return /* @__PURE__ */ (0,
|
|
2178
|
-
}, children: /* @__PURE__ */ (0,
|
|
2287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
|
|
2288
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `copilotKitChat ${className}`, children }) });
|
|
2179
2289
|
}
|
|
2180
|
-
return /* @__PURE__ */ (0,
|
|
2290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children });
|
|
2181
2291
|
}
|
|
2182
2292
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2183
2293
|
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
|
|
@@ -2185,9 +2295,9 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2185
2295
|
id: (0, import_shared3.randomId)(),
|
|
2186
2296
|
makeSystemMessage
|
|
2187
2297
|
});
|
|
2188
|
-
const [currentSuggestions, setCurrentSuggestions] = (0,
|
|
2189
|
-
const suggestionsAbortControllerRef = (0,
|
|
2190
|
-
const debounceTimerRef = (0,
|
|
2298
|
+
const [currentSuggestions, setCurrentSuggestions] = (0, import_react12.useState)([]);
|
|
2299
|
+
const suggestionsAbortControllerRef = (0, import_react12.useRef)(null);
|
|
2300
|
+
const debounceTimerRef = (0, import_react12.useRef)();
|
|
2191
2301
|
const abortSuggestions = () => {
|
|
2192
2302
|
var _a;
|
|
2193
2303
|
(_a = suggestionsAbortControllerRef.current) == null ? void 0 : _a.abort();
|
|
@@ -2196,7 +2306,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2196
2306
|
const generalContext = (0, import_react_core8.useCopilotContext)();
|
|
2197
2307
|
const messagesContext = (0, import_react_core8.useCopilotMessagesContext)();
|
|
2198
2308
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
2199
|
-
(0,
|
|
2309
|
+
(0, import_react12.useEffect)(() => {
|
|
2200
2310
|
onInProgress == null ? void 0 : onInProgress(isLoading);
|
|
2201
2311
|
abortSuggestions();
|
|
2202
2312
|
debounceTimerRef.current = setTimeout(
|
|
@@ -2245,7 +2355,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
2245
2355
|
};
|
|
2246
2356
|
|
|
2247
2357
|
// src/components/chat/Modal.tsx
|
|
2248
|
-
var
|
|
2358
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2249
2359
|
var CopilotModal = ({
|
|
2250
2360
|
instructions,
|
|
2251
2361
|
defaultOpen = false,
|
|
@@ -2268,24 +2378,24 @@ var CopilotModal = ({
|
|
|
2268
2378
|
className,
|
|
2269
2379
|
children
|
|
2270
2380
|
}) => {
|
|
2271
|
-
const [openState, setOpenState] =
|
|
2381
|
+
const [openState, setOpenState] = import_react13.default.useState(defaultOpen);
|
|
2272
2382
|
const setOpen = (open) => {
|
|
2273
2383
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
2274
2384
|
setOpenState(open);
|
|
2275
2385
|
};
|
|
2276
|
-
return /* @__PURE__ */ (0,
|
|
2386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
2277
2387
|
children,
|
|
2278
|
-
/* @__PURE__ */ (0,
|
|
2279
|
-
/* @__PURE__ */ (0,
|
|
2280
|
-
/* @__PURE__ */ (0,
|
|
2388
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className, children: [
|
|
2389
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button2, {}),
|
|
2390
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2281
2391
|
Window2,
|
|
2282
2392
|
{
|
|
2283
2393
|
clickOutsideToClose,
|
|
2284
2394
|
shortcut,
|
|
2285
2395
|
hitEscapeToClose,
|
|
2286
2396
|
children: [
|
|
2287
|
-
/* @__PURE__ */ (0,
|
|
2288
|
-
/* @__PURE__ */ (0,
|
|
2397
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Header2, {}),
|
|
2398
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2289
2399
|
CopilotChat,
|
|
2290
2400
|
{
|
|
2291
2401
|
instructions,
|
|
@@ -2306,22 +2416,22 @@ var CopilotModal = ({
|
|
|
2306
2416
|
};
|
|
2307
2417
|
|
|
2308
2418
|
// src/components/chat/Popup.tsx
|
|
2309
|
-
var
|
|
2419
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2310
2420
|
function CopilotPopup(props) {
|
|
2311
2421
|
props = __spreadProps(__spreadValues({}, props), {
|
|
2312
2422
|
className: props.className ? props.className + " copilotKitPopup" : "copilotKitPopup"
|
|
2313
2423
|
});
|
|
2314
|
-
return /* @__PURE__ */ (0,
|
|
2424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CopilotModal, __spreadProps(__spreadValues({}, props), { children: props.children }));
|
|
2315
2425
|
}
|
|
2316
2426
|
|
|
2317
2427
|
// src/components/chat/Sidebar.tsx
|
|
2318
|
-
var
|
|
2319
|
-
var
|
|
2428
|
+
var import_react14 = require("react");
|
|
2429
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2320
2430
|
function CopilotSidebar(props) {
|
|
2321
2431
|
props = __spreadProps(__spreadValues({}, props), {
|
|
2322
2432
|
className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
|
|
2323
2433
|
});
|
|
2324
|
-
const [expandedClassName, setExpandedClassName] = (0,
|
|
2434
|
+
const [expandedClassName, setExpandedClassName] = (0, import_react14.useState)(
|
|
2325
2435
|
props.defaultOpen ? "sidebarExpanded" : ""
|
|
2326
2436
|
);
|
|
2327
2437
|
const onSetOpen = (open) => {
|
|
@@ -2329,13 +2439,15 @@ function CopilotSidebar(props) {
|
|
|
2329
2439
|
(_a = props.onSetOpen) == null ? void 0 : _a.call(props, open);
|
|
2330
2440
|
setExpandedClassName(open ? "sidebarExpanded" : "");
|
|
2331
2441
|
};
|
|
2332
|
-
return /* @__PURE__ */ (0,
|
|
2442
|
+
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 })) });
|
|
2333
2443
|
}
|
|
2334
2444
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2335
2445
|
0 && (module.exports = {
|
|
2336
2446
|
CopilotChat,
|
|
2447
|
+
CopilotDevConsole,
|
|
2337
2448
|
CopilotPopup,
|
|
2338
2449
|
CopilotSidebar,
|
|
2450
|
+
shouldShowDevConsole,
|
|
2339
2451
|
useChatContext
|
|
2340
2452
|
});
|
|
2341
2453
|
//# sourceMappingURL=index.js.map
|