@copilotkit/react-ui 1.5.1-next.2 → 1.5.1-next.3

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 (83) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/{chunk-F2W5FD7L.mjs → chunk-2B57NCBA.mjs} +3 -3
  3. package/dist/{chunk-PNQVKBPN.mjs → chunk-4FIGRRFS.mjs} +2 -2
  4. package/dist/{chunk-PNQVKBPN.mjs.map → chunk-4FIGRRFS.mjs.map} +1 -1
  5. package/dist/{chunk-EMQEEXUB.mjs → chunk-4LUMV4YO.mjs} +3 -8
  6. package/dist/chunk-4LUMV4YO.mjs.map +1 -0
  7. package/dist/{chunk-BH6PCAAL.mjs → chunk-4T3TMQNJ.mjs} +2 -38
  8. package/dist/chunk-4T3TMQNJ.mjs.map +1 -0
  9. package/dist/{chunk-UWVGLGFQ.mjs → chunk-63ZKP62F.mjs} +4 -8
  10. package/dist/chunk-63ZKP62F.mjs.map +1 -0
  11. package/dist/{chunk-DCNCY2PL.mjs → chunk-DHGDU64D.mjs} +11 -114
  12. package/dist/chunk-DHGDU64D.mjs.map +1 -0
  13. package/dist/{chunk-3E7HY2UN.mjs → chunk-OMTPWC7T.mjs} +4 -5
  14. package/dist/chunk-OMTPWC7T.mjs.map +1 -0
  15. package/dist/{chunk-7II4YL7R.mjs → chunk-RKPANT3F.mjs} +6 -2
  16. package/dist/chunk-RKPANT3F.mjs.map +1 -0
  17. package/dist/{chunk-WSMMTZCM.mjs → chunk-TKFQ7VQR.mjs} +2 -2
  18. package/dist/{chunk-375NVWZM.mjs → chunk-VYKDFXGS.mjs} +2 -2
  19. package/dist/chunk-WOUWNTAV.mjs +72 -0
  20. package/dist/chunk-WOUWNTAV.mjs.map +1 -0
  21. package/dist/components/chat/Chat.d.ts +5 -50
  22. package/dist/components/chat/Chat.js +41 -249
  23. package/dist/components/chat/Chat.js.map +1 -1
  24. package/dist/components/chat/Chat.mjs +8 -8
  25. package/dist/components/chat/Input.js +2 -7
  26. package/dist/components/chat/Input.js.map +1 -1
  27. package/dist/components/chat/Input.mjs +1 -1
  28. package/dist/components/chat/Messages.d.ts +3 -3
  29. package/dist/components/chat/Messages.js.map +1 -1
  30. package/dist/components/chat/Messages.mjs +1 -1
  31. package/dist/components/chat/Modal.d.ts +1 -1
  32. package/dist/components/chat/Modal.js +41 -253
  33. package/dist/components/chat/Modal.js.map +1 -1
  34. package/dist/components/chat/Modal.mjs +9 -9
  35. package/dist/components/chat/Popup.js +41 -253
  36. package/dist/components/chat/Popup.js.map +1 -1
  37. package/dist/components/chat/Popup.mjs +10 -10
  38. package/dist/components/chat/Sidebar.js +41 -253
  39. package/dist/components/chat/Sidebar.js.map +1 -1
  40. package/dist/components/chat/Sidebar.mjs +10 -10
  41. package/dist/components/chat/index.js +41 -253
  42. package/dist/components/chat/index.js.map +1 -1
  43. package/dist/components/chat/index.mjs +11 -11
  44. package/dist/components/chat/messages/RenderActionExecutionMessage.js +3 -4
  45. package/dist/components/chat/messages/RenderActionExecutionMessage.js.map +1 -1
  46. package/dist/components/chat/messages/RenderActionExecutionMessage.mjs +1 -1
  47. package/dist/components/dev-console/console.js +28 -128
  48. package/dist/components/dev-console/console.js.map +1 -1
  49. package/dist/components/dev-console/console.mjs +4 -4
  50. package/dist/components/dev-console/index.js +28 -128
  51. package/dist/components/dev-console/index.js.map +1 -1
  52. package/dist/components/dev-console/index.mjs +4 -4
  53. package/dist/components/dev-console/utils.js +1 -1
  54. package/dist/components/dev-console/utils.js.map +1 -1
  55. package/dist/components/dev-console/utils.mjs +1 -1
  56. package/dist/components/help-modal/icons.d.ts +1 -4
  57. package/dist/components/help-modal/icons.js +2 -39
  58. package/dist/components/help-modal/icons.js.map +1 -1
  59. package/dist/components/help-modal/icons.mjs +3 -5
  60. package/dist/components/help-modal/index.js +27 -147
  61. package/dist/components/help-modal/index.js.map +1 -1
  62. package/dist/components/help-modal/index.mjs +2 -2
  63. package/dist/components/help-modal/modal.js +27 -147
  64. package/dist/components/help-modal/modal.js.map +1 -1
  65. package/dist/components/help-modal/modal.mjs +2 -2
  66. package/dist/components/index.js +41 -253
  67. package/dist/components/index.js.map +1 -1
  68. package/dist/components/index.mjs +11 -11
  69. package/dist/index.js +43 -255
  70. package/dist/index.js.map +1 -1
  71. package/dist/index.mjs +11 -11
  72. package/package.json +4 -4
  73. package/dist/chunk-3E7HY2UN.mjs.map +0 -1
  74. package/dist/chunk-7II4YL7R.mjs.map +0 -1
  75. package/dist/chunk-BH6PCAAL.mjs.map +0 -1
  76. package/dist/chunk-DCNCY2PL.mjs.map +0 -1
  77. package/dist/chunk-EMQEEXUB.mjs.map +0 -1
  78. package/dist/chunk-TI7SY2RI.mjs +0 -164
  79. package/dist/chunk-TI7SY2RI.mjs.map +0 -1
  80. package/dist/chunk-UWVGLGFQ.mjs.map +0 -1
  81. /package/dist/{chunk-F2W5FD7L.mjs.map → chunk-2B57NCBA.mjs.map} +0 -0
  82. /package/dist/{chunk-WSMMTZCM.mjs.map → chunk-TKFQ7VQR.mjs.map} +0 -0
  83. /package/dist/{chunk-375NVWZM.mjs.map → chunk-VYKDFXGS.mjs.map} +0 -0
@@ -1,27 +1,27 @@
1
1
  import {
2
2
  CopilotSidebar
3
- } from "../../chunk-WSMMTZCM.mjs";
4
- import "../../chunk-UWVGLGFQ.mjs";
3
+ } from "../../chunk-TKFQ7VQR.mjs";
4
+ import "../../chunk-63ZKP62F.mjs";
5
5
  import "../../chunk-YAGE7RCE.mjs";
6
6
  import "../../chunk-VEC45H6Q.mjs";
7
7
  import "../../chunk-RQNJNK2W.mjs";
8
- import "../../chunk-DCNCY2PL.mjs";
8
+ import "../../chunk-DHGDU64D.mjs";
9
9
  import "../../chunk-6INMITFA.mjs";
10
10
  import "../../chunk-RU73BEZM.mjs";
11
11
  import "../../chunk-V7W6IM2V.mjs";
12
- import "../../chunk-3E7HY2UN.mjs";
12
+ import "../../chunk-OMTPWC7T.mjs";
13
13
  import "../../chunk-ZABXREBH.mjs";
14
14
  import "../../chunk-RJCZRKTV.mjs";
15
- import "../../chunk-F2W5FD7L.mjs";
16
- import "../../chunk-PNQVKBPN.mjs";
15
+ import "../../chunk-2B57NCBA.mjs";
16
+ import "../../chunk-4FIGRRFS.mjs";
17
17
  import "../../chunk-KXE2JCUH.mjs";
18
- import "../../chunk-TI7SY2RI.mjs";
19
- import "../../chunk-BH6PCAAL.mjs";
18
+ import "../../chunk-WOUWNTAV.mjs";
19
+ import "../../chunk-4T3TMQNJ.mjs";
20
20
  import "../../chunk-OTPAZXVR.mjs";
21
- import "../../chunk-EMQEEXUB.mjs";
21
+ import "../../chunk-4LUMV4YO.mjs";
22
22
  import "../../chunk-YQFVRDNC.mjs";
23
23
  import "../../chunk-YQ3D5IQV.mjs";
24
- import "../../chunk-7II4YL7R.mjs";
24
+ import "../../chunk-RKPANT3F.mjs";
25
25
  import "../../chunk-3XAXY2Z3.mjs";
26
26
  import "../../chunk-CBBFRI3Q.mjs";
27
27
  import "../../chunk-UPTB2MVO.mjs";
@@ -880,10 +880,7 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
880
880
  });
881
881
  const sendIcon = inProgress || pushToTalkState === "transcribing" ? context.icons.activityIcon : context.icons.sendIcon;
882
882
  const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
883
- const canSend = () => {
884
- return !inProgress && text.trim().length > 0 && pushToTalkState === "idle";
885
- };
886
- const sendDisabled = !canSend();
883
+ const sendDisabled = inProgress || text.length === 0 || pushToTalkState !== "idle";
887
884
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
888
885
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
889
886
  Textarea_default,
@@ -897,9 +894,7 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
897
894
  onKeyDown: (event) => {
898
895
  if (event.key === "Enter" && !event.shiftKey) {
899
896
  event.preventDefault();
900
- if (canSend()) {
901
- send();
902
- }
897
+ send();
903
898
  }
904
899
  }
905
900
  }
@@ -946,9 +941,9 @@ var import_react7 = require("react");
946
941
  var import_react_syntax_highlighter = require("react-syntax-highlighter");
947
942
 
948
943
  // src/hooks/use-copy-to-clipboard.tsx
949
- var React5 = __toESM(require("react"));
944
+ var React6 = __toESM(require("react"));
950
945
  function useCopyToClipboard({ timeout = 2e3 }) {
951
- const [isCopied, setIsCopied] = React5.useState(false);
946
+ const [isCopied, setIsCopied] = React6.useState(false);
952
947
  const copyToClipboard = (value) => {
953
948
  var _a;
954
949
  if (typeof window === "undefined" || !((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
@@ -1444,8 +1439,8 @@ function RenderActionExecutionMessage(props) {
1444
1439
  const { chatComponentsCache } = (0, import_react_core3.useCopilotContext)();
1445
1440
  const { icons } = useChatContext();
1446
1441
  if (message.isActionExecutionMessage()) {
1447
- if (chatComponentsCache.current !== null && (chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"])) {
1448
- const render = chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"];
1442
+ if (chatComponentsCache.current !== null && chatComponentsCache.current.actions[message.name]) {
1443
+ const render = chatComponentsCache.current.actions[message.name];
1449
1444
  if (typeof render === "string") {
1450
1445
  if (isCurrentMessage && inProgress) {
1451
1446
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
@@ -1468,8 +1463,7 @@ function RenderActionExecutionMessage(props) {
1468
1463
  const toRender = render({
1469
1464
  status,
1470
1465
  args,
1471
- result: actionResult,
1472
- name: message.name
1466
+ result: actionResult
1473
1467
  });
1474
1468
  if (!toRender && status === "complete") {
1475
1469
  return null;
@@ -1783,7 +1777,7 @@ function logMessages(context) {
1783
1777
  type: "ActionExecutionMessage",
1784
1778
  role: void 0,
1785
1779
  name: message.name,
1786
- scope: message.parentMessageId,
1780
+ scope: message.scope,
1787
1781
  content: message.arguments
1788
1782
  };
1789
1783
  } else if (message.isResultMessage()) {
@@ -1906,52 +1900,41 @@ var import_react9 = require("react");
1906
1900
 
1907
1901
  // src/components/help-modal/icons.tsx
1908
1902
  var import_jsx_runtime18 = require("react/jsx-runtime");
1909
- var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1903
+ var LifeBuoyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1910
1904
  "svg",
1911
1905
  {
1912
1906
  xmlns: "http://www.w3.org/2000/svg",
1913
- fill: "none",
1907
+ width: "24",
1908
+ height: "24",
1914
1909
  viewBox: "0 0 24 24",
1915
- strokeWidth: "1.5",
1910
+ fill: "none",
1916
1911
  stroke: "currentColor",
1917
- width: "20",
1918
- height: "20",
1919
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
1912
+ strokeWidth: "2",
1913
+ strokeLinecap: "round",
1914
+ strokeLinejoin: "round",
1915
+ className: "icon icon-tabler icons-tabler-outline icon-tabler-lifebuoy",
1916
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("g", { transform: "translate(0, -1)", children: [
1917
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
1918
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" }),
1919
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" }),
1920
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M15 15l3.35 3.35" }),
1921
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M9 15l-3.35 3.35" }),
1922
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M5.65 5.65l3.35 3.35" }),
1923
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M18.35 5.65l-3.35 3.35" })
1924
+ ] })
1920
1925
  }
1921
1926
  );
1922
- var LoadingSpinnerIcon = ({ color = "rgb(107 114 128)" }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1927
+ var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1923
1928
  "svg",
1924
1929
  {
1925
- style: {
1926
- animation: "copilotKitSpinAnimation 1s linear infinite",
1927
- color
1928
- },
1929
- width: "24",
1930
- height: "24",
1931
1930
  xmlns: "http://www.w3.org/2000/svg",
1932
1931
  fill: "none",
1933
1932
  viewBox: "0 0 24 24",
1934
- children: [
1935
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1936
- "circle",
1937
- {
1938
- style: { opacity: 0.25 },
1939
- cx: "12",
1940
- cy: "12",
1941
- r: "10",
1942
- stroke: "currentColor",
1943
- strokeWidth: "4"
1944
- }
1945
- ),
1946
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1947
- "path",
1948
- {
1949
- style: { opacity: 0.75 },
1950
- fill: "currentColor",
1951
- d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
1952
- }
1953
- )
1954
- ]
1933
+ strokeWidth: "1.5",
1934
+ stroke: "currentColor",
1935
+ width: "20",
1936
+ height: "20",
1937
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
1955
1938
  }
1956
1939
  );
1957
1940
 
@@ -1960,52 +1943,18 @@ var import_jsx_runtime19 = require("react/jsx-runtime");
1960
1943
  function CopilotKitHelpModal() {
1961
1944
  const [showHelpModal, setShowHelpModal] = (0, import_react9.useState)(false);
1962
1945
  const [issueDescription, setIssueDescription] = (0, import_react9.useState)("");
1963
- const [email, setEmail] = (0, import_react9.useState)("");
1964
- const [emailError, setEmailError] = (0, import_react9.useState)("");
1965
- const [submitting, setSubmitting] = (0, import_react9.useState)(false);
1966
- const validateEmail = (email2) => {
1967
- const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
1968
- return re.test(email2);
1969
- };
1970
- const handleSubmit = (e) => __async(this, null, function* () {
1971
- e.preventDefault();
1972
- if ((email == null ? void 0 : email.length) > 0 && !validateEmail(email)) {
1973
- setEmailError("Please enter a valid email address");
1974
- return;
1975
- }
1976
- setSubmitting(true);
1977
- yield fetch("https://api.segment.io/v1/track", {
1978
- method: "POST",
1979
- headers: {
1980
- "Content-Type": "application/json"
1981
- },
1982
- body: JSON.stringify({
1983
- event: "oss.dev-console.help",
1984
- anonymousId: window.crypto.randomUUID(),
1985
- properties: { email, text: issueDescription },
1986
- writeKey: "q0gQqvGYyw9pNyhIocNzefSYKGO1aiwW"
1987
- })
1988
- });
1989
- setEmailError("");
1990
- setEmail("");
1991
- setIssueDescription("");
1992
- setSubmitting(false);
1946
+ const handleSubmit = () => {
1993
1947
  setShowHelpModal(false);
1994
- });
1948
+ };
1995
1949
  const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1996
1950
  "button",
1997
1951
  {
1998
1952
  onClick: () => setShowHelpModal(true),
1999
- style: { width: "50px", height: "30px", marginRight: "0.25rem" },
2000
- className: "text-sm p-0 bg-transparent rounded border border-blue-500",
1953
+ 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",
2001
1954
  "aria-label": "Open Help",
2002
- children: "Help"
1955
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LifeBuoyIcon, {})
2003
1956
  }
2004
1957
  );
2005
- const submitButtonDisabled = (0, import_react9.useMemo)(
2006
- () => submitting || !!emailError || issueDescription == null || (issueDescription == null ? void 0 : issueDescription.length) == 0,
2007
- [submitting, emailError, issueDescription]
2008
- );
2009
1958
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
2010
1959
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(HelpButton, {}),
2011
1960
  showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
@@ -2026,15 +1975,6 @@ function CopilotKitHelpModal() {
2026
1975
  ),
2027
1976
  /* @__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" }) }),
2028
1977
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-4 mb-4", children: [
2029
- /* @__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)(
2030
- "a",
2031
- {
2032
- href: "https://docs.copilotkit.ai/coagents/troubleshooting/common-issues",
2033
- target: "_blank",
2034
- rel: "noopener noreferrer",
2035
- children: "Visit the Troubleshooting and FAQ section in the docs"
2036
- }
2037
- ) }),
2038
1978
  /* @__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)(
2039
1979
  "a",
2040
1980
  {
@@ -2053,52 +1993,6 @@ function CopilotKitHelpModal() {
2053
1993
  children: "Apply for Priority Direct Slack Support"
2054
1994
  }
2055
1995
  ) })
2056
- ] }),
2057
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("form", { onSubmit: handleSubmit, className: "flex flex-col space-y-2", children: [
2058
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
2059
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { htmlFor: "feedback", className: "block text-sm font-medium text-gray-700 mb-1", children: "Let us know what your issue is:" }),
2060
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2061
- "textarea",
2062
- {
2063
- id: "feedback",
2064
- rows: 4,
2065
- className: "w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500",
2066
- placeholder: "A Loom link / screen recording is always great!",
2067
- onChange: (e) => setIssueDescription(e.target.value),
2068
- value: issueDescription,
2069
- required: true
2070
- }
2071
- )
2072
- ] }),
2073
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
2074
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { htmlFor: "email", className: "block text-sm font-medium text-gray-700 mb-1", children: "Email (optional):" }),
2075
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2076
- "input",
2077
- {
2078
- type: "email",
2079
- id: "email",
2080
- className: `w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500 ${emailError ? "border-red-500" : ""}`,
2081
- placeholder: "Enter your email for follow-up",
2082
- onChange: (e) => {
2083
- setEmail(e.target.value);
2084
- setEmailError("");
2085
- },
2086
- value: email
2087
- }
2088
- ),
2089
- emailError && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-red-500 text-sm mt-1", children: emailError })
2090
- ] }),
2091
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "bg-gray-50 px-4 py-4 sm:px-6 sm:flex sm:flex-row-reverse rounded-b-lg", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2092
- "button",
2093
- {
2094
- type: "submit",
2095
- onClick: handleSubmit,
2096
- disabled: submitButtonDisabled,
2097
- style: submitButtonDisabled ? { backgroundColor: "rgb(216, 216, 216)", color: "rgb(129, 129, 129)" } : void 0,
2098
- className: "w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-500 text-base font-medium text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm disabled:shadow-none",
2099
- children: submitting ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LoadingSpinnerIcon, { color: "white" }) : "Submit"
2100
- }
2101
- ) })
2102
1996
  ] })
2103
1997
  ] })
2104
1998
  }
@@ -2309,7 +2203,6 @@ function DebugMenuButton({
2309
2203
  }
2310
2204
 
2311
2205
  // src/components/chat/Chat.tsx
2312
- var import_react_core9 = require("@copilotkit/react-core");
2313
2206
  var import_jsx_runtime21 = require("react/jsx-runtime");
2314
2207
  function CopilotChat({
2315
2208
  instructions,
@@ -2317,8 +2210,6 @@ function CopilotChat({
2317
2210
  makeSystemMessage,
2318
2211
  showResponseButton = true,
2319
2212
  onInProgress,
2320
- onStopGeneration,
2321
- onReloadMessages,
2322
2213
  Messages: Messages2 = Messages,
2323
2214
  RenderTextMessage: RenderTextMessage2 = RenderTextMessage,
2324
2215
  RenderActionExecutionMessage: RenderActionExecutionMessage2 = RenderActionExecutionMessage,
@@ -2341,13 +2232,7 @@ function CopilotChat({
2341
2232
  sendMessage,
2342
2233
  stopGeneration,
2343
2234
  reloadMessages
2344
- } = useCopilotChatLogic(
2345
- makeSystemMessage,
2346
- onInProgress,
2347
- onSubmitMessage,
2348
- onStopGeneration,
2349
- onReloadMessages
2350
- );
2235
+ } = useCopilotChatLogic(makeSystemMessage, onInProgress, onSubmitMessage);
2351
2236
  const chatContext = import_react12.default.useContext(ChatContext);
2352
2237
  const isVisible = chatContext ? chatContext.open : true;
2353
2238
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
@@ -2403,16 +2288,8 @@ function WrappedCopilotChat({
2403
2288
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children });
2404
2289
  }
2405
2290
  var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
2406
- var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
2407
- var _a;
2408
- const {
2409
- visibleMessages,
2410
- appendMessage,
2411
- reloadMessages: defaultReloadMessages,
2412
- stopGeneration: defaultStopGeneration,
2413
- runChatCompletion,
2414
- isLoading
2415
- } = (0, import_react_core8.useCopilotChat)({
2291
+ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
2292
+ const { visibleMessages, appendMessage, reloadMessages, stopGeneration, isLoading } = (0, import_react_core8.useCopilotChat)({
2416
2293
  id: (0, import_shared3.randomId)(),
2417
2294
  makeSystemMessage
2418
2295
  });
@@ -2420,8 +2297,8 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
2420
2297
  const suggestionsAbortControllerRef = (0, import_react12.useRef)(null);
2421
2298
  const debounceTimerRef = (0, import_react12.useRef)();
2422
2299
  const abortSuggestions = () => {
2423
- var _a2;
2424
- (_a2 = suggestionsAbortControllerRef.current) == null ? void 0 : _a2.abort();
2300
+ var _a;
2301
+ (_a = suggestionsAbortControllerRef.current) == null ? void 0 : _a.abort();
2425
2302
  suggestionsAbortControllerRef.current = null;
2426
2303
  };
2427
2304
  const generalContext = (0, import_react_core8.useCopilotContext)();
@@ -2447,13 +2324,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
2447
2324
  return () => {
2448
2325
  clearTimeout(debounceTimerRef.current);
2449
2326
  };
2450
- }, [
2451
- isLoading,
2452
- context.chatSuggestionConfiguration,
2453
- // hackish way to trigger suggestions reload on reset, but better than moving suggestions to the
2454
- // global context
2455
- visibleMessages.length == 0
2456
- ]);
2327
+ }, [isLoading, context.chatSuggestionConfiguration]);
2457
2328
  const sendMessage = (messageContent) => __async(void 0, null, function* () {
2458
2329
  abortSuggestions();
2459
2330
  setCurrentSuggestions([]);
@@ -2471,85 +2342,6 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
2471
2342
  appendMessage(message);
2472
2343
  return message;
2473
2344
  });
2474
- const messages = visibleMessages;
2475
- const { setMessages } = messagesContext;
2476
- const currentAgentName = (_a = generalContext.agentSession) == null ? void 0 : _a.agentName;
2477
- const restartCurrentAgent = (hint) => __async(void 0, null, function* () {
2478
- if (generalContext.agentSession) {
2479
- generalContext.setAgentSession(__spreadProps(__spreadValues({}, generalContext.agentSession), {
2480
- nodeName: void 0,
2481
- threadId: void 0
2482
- }));
2483
- generalContext.setCoagentStates((prevAgentStates) => {
2484
- return __spreadProps(__spreadValues({}, prevAgentStates), {
2485
- [generalContext.agentSession.agentName]: __spreadProps(__spreadValues({}, prevAgentStates[generalContext.agentSession.agentName]), {
2486
- threadId: void 0,
2487
- nodeName: void 0,
2488
- runId: void 0
2489
- })
2490
- });
2491
- });
2492
- }
2493
- });
2494
- const runCurrentAgent = (hint) => __async(void 0, null, function* () {
2495
- if (generalContext.agentSession) {
2496
- yield (0, import_react_core9.runAgent)(
2497
- generalContext.agentSession.agentName,
2498
- context,
2499
- appendMessage,
2500
- runChatCompletion,
2501
- hint
2502
- );
2503
- }
2504
- });
2505
- const stopCurrentAgent = () => {
2506
- if (generalContext.agentSession) {
2507
- (0, import_react_core9.stopAgent)(generalContext.agentSession.agentName, context);
2508
- }
2509
- };
2510
- const setCurrentAgentState = (state) => {
2511
- if (generalContext.agentSession) {
2512
- generalContext.setCoagentStates((prevAgentStates) => {
2513
- return __spreadProps(__spreadValues({}, prevAgentStates), {
2514
- [generalContext.agentSession.agentName]: {
2515
- state
2516
- }
2517
- });
2518
- });
2519
- }
2520
- };
2521
- function stopGeneration() {
2522
- if (onStopGeneration) {
2523
- onStopGeneration({
2524
- messages,
2525
- setMessages,
2526
- stopGeneration: defaultStopGeneration,
2527
- currentAgentName,
2528
- restartCurrentAgent,
2529
- stopCurrentAgent,
2530
- runCurrentAgent,
2531
- setCurrentAgentState
2532
- });
2533
- } else {
2534
- defaultStopGeneration();
2535
- }
2536
- }
2537
- function reloadMessages() {
2538
- if (onReloadMessages) {
2539
- onReloadMessages({
2540
- messages,
2541
- setMessages,
2542
- stopGeneration: defaultStopGeneration,
2543
- currentAgentName,
2544
- restartCurrentAgent,
2545
- stopCurrentAgent,
2546
- runCurrentAgent,
2547
- setCurrentAgentState
2548
- });
2549
- } else {
2550
- defaultReloadMessages();
2551
- }
2552
- }
2553
2345
  return {
2554
2346
  visibleMessages,
2555
2347
  isLoading,
@@ -2569,8 +2361,6 @@ var CopilotModal = ({
2569
2361
  hitEscapeToClose = true,
2570
2362
  onSetOpen,
2571
2363
  onSubmitMessage,
2572
- onStopGeneration,
2573
- onReloadMessages,
2574
2364
  shortcut = "/",
2575
2365
  icons,
2576
2366
  labels,
@@ -2608,8 +2398,6 @@ var CopilotModal = ({
2608
2398
  {
2609
2399
  instructions,
2610
2400
  onSubmitMessage,
2611
- onStopGeneration,
2612
- onReloadMessages,
2613
2401
  makeSystemMessage,
2614
2402
  showResponseButton,
2615
2403
  onInProgress,