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