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