@copilotkit/react-ui 1.5.1-next.1 → 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 +22 -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
@@ -882,10 +882,7 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
882
882
  });
883
883
  const sendIcon = inProgress || pushToTalkState === "transcribing" ? context.icons.activityIcon : context.icons.sendIcon;
884
884
  const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
885
- const canSend = () => {
886
- return !inProgress && text.trim().length > 0 && pushToTalkState === "idle";
887
- };
888
- const sendDisabled = !canSend();
885
+ const sendDisabled = inProgress || text.length === 0 || pushToTalkState !== "idle";
889
886
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
890
887
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
891
888
  Textarea_default,
@@ -899,9 +896,7 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
899
896
  onKeyDown: (event) => {
900
897
  if (event.key === "Enter" && !event.shiftKey) {
901
898
  event.preventDefault();
902
- if (canSend()) {
903
- send();
904
- }
899
+ send();
905
900
  }
906
901
  }
907
902
  }
@@ -948,9 +943,9 @@ var import_react7 = require("react");
948
943
  var import_react_syntax_highlighter = require("react-syntax-highlighter");
949
944
 
950
945
  // src/hooks/use-copy-to-clipboard.tsx
951
- var React5 = __toESM(require("react"));
946
+ var React6 = __toESM(require("react"));
952
947
  function useCopyToClipboard({ timeout = 2e3 }) {
953
- const [isCopied, setIsCopied] = React5.useState(false);
948
+ const [isCopied, setIsCopied] = React6.useState(false);
954
949
  const copyToClipboard = (value) => {
955
950
  var _a;
956
951
  if (typeof window === "undefined" || !((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
@@ -1446,8 +1441,8 @@ function RenderActionExecutionMessage(props) {
1446
1441
  const { chatComponentsCache } = (0, import_react_core3.useCopilotContext)();
1447
1442
  const { icons } = useChatContext();
1448
1443
  if (message.isActionExecutionMessage()) {
1449
- if (chatComponentsCache.current !== null && (chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"])) {
1450
- const render = chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"];
1444
+ if (chatComponentsCache.current !== null && chatComponentsCache.current.actions[message.name]) {
1445
+ const render = chatComponentsCache.current.actions[message.name];
1451
1446
  if (typeof render === "string") {
1452
1447
  if (isCurrentMessage && inProgress) {
1453
1448
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
@@ -1470,8 +1465,7 @@ function RenderActionExecutionMessage(props) {
1470
1465
  const toRender = render({
1471
1466
  status,
1472
1467
  args,
1473
- result: actionResult,
1474
- name: message.name
1468
+ result: actionResult
1475
1469
  });
1476
1470
  if (!toRender && status === "complete") {
1477
1471
  return null;
@@ -1785,7 +1779,7 @@ function logMessages(context) {
1785
1779
  type: "ActionExecutionMessage",
1786
1780
  role: void 0,
1787
1781
  name: message.name,
1788
- scope: message.parentMessageId,
1782
+ scope: message.scope,
1789
1783
  content: message.arguments
1790
1784
  };
1791
1785
  } else if (message.isResultMessage()) {
@@ -1908,52 +1902,41 @@ var import_react9 = require("react");
1908
1902
 
1909
1903
  // src/components/help-modal/icons.tsx
1910
1904
  var import_jsx_runtime18 = require("react/jsx-runtime");
1911
- var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1905
+ var LifeBuoyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1912
1906
  "svg",
1913
1907
  {
1914
1908
  xmlns: "http://www.w3.org/2000/svg",
1915
- fill: "none",
1909
+ width: "24",
1910
+ height: "24",
1916
1911
  viewBox: "0 0 24 24",
1917
- strokeWidth: "1.5",
1912
+ fill: "none",
1918
1913
  stroke: "currentColor",
1919
- width: "20",
1920
- height: "20",
1921
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
1914
+ strokeWidth: "2",
1915
+ strokeLinecap: "round",
1916
+ strokeLinejoin: "round",
1917
+ className: "icon icon-tabler icons-tabler-outline icon-tabler-lifebuoy",
1918
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("g", { transform: "translate(0, -1)", children: [
1919
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
1920
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" }),
1921
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" }),
1922
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M15 15l3.35 3.35" }),
1923
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M9 15l-3.35 3.35" }),
1924
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M5.65 5.65l3.35 3.35" }),
1925
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M18.35 5.65l-3.35 3.35" })
1926
+ ] })
1922
1927
  }
1923
1928
  );
1924
- var LoadingSpinnerIcon = ({ color = "rgb(107 114 128)" }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1929
+ var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1925
1930
  "svg",
1926
1931
  {
1927
- style: {
1928
- animation: "copilotKitSpinAnimation 1s linear infinite",
1929
- color
1930
- },
1931
- width: "24",
1932
- height: "24",
1933
1932
  xmlns: "http://www.w3.org/2000/svg",
1934
1933
  fill: "none",
1935
1934
  viewBox: "0 0 24 24",
1936
- children: [
1937
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1938
- "circle",
1939
- {
1940
- style: { opacity: 0.25 },
1941
- cx: "12",
1942
- cy: "12",
1943
- r: "10",
1944
- stroke: "currentColor",
1945
- strokeWidth: "4"
1946
- }
1947
- ),
1948
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1949
- "path",
1950
- {
1951
- style: { opacity: 0.75 },
1952
- fill: "currentColor",
1953
- 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"
1954
- }
1955
- )
1956
- ]
1935
+ strokeWidth: "1.5",
1936
+ stroke: "currentColor",
1937
+ width: "20",
1938
+ height: "20",
1939
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
1957
1940
  }
1958
1941
  );
1959
1942
 
@@ -1962,52 +1945,18 @@ var import_jsx_runtime19 = require("react/jsx-runtime");
1962
1945
  function CopilotKitHelpModal() {
1963
1946
  const [showHelpModal, setShowHelpModal] = (0, import_react9.useState)(false);
1964
1947
  const [issueDescription, setIssueDescription] = (0, import_react9.useState)("");
1965
- const [email, setEmail] = (0, import_react9.useState)("");
1966
- const [emailError, setEmailError] = (0, import_react9.useState)("");
1967
- const [submitting, setSubmitting] = (0, import_react9.useState)(false);
1968
- const validateEmail = (email2) => {
1969
- const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
1970
- return re.test(email2);
1971
- };
1972
- const handleSubmit = (e) => __async(this, null, function* () {
1973
- e.preventDefault();
1974
- if ((email == null ? void 0 : email.length) > 0 && !validateEmail(email)) {
1975
- setEmailError("Please enter a valid email address");
1976
- return;
1977
- }
1978
- setSubmitting(true);
1979
- yield fetch("https://api.segment.io/v1/track", {
1980
- method: "POST",
1981
- headers: {
1982
- "Content-Type": "application/json"
1983
- },
1984
- body: JSON.stringify({
1985
- event: "oss.dev-console.help",
1986
- anonymousId: window.crypto.randomUUID(),
1987
- properties: { email, text: issueDescription },
1988
- writeKey: "q0gQqvGYyw9pNyhIocNzefSYKGO1aiwW"
1989
- })
1990
- });
1991
- setEmailError("");
1992
- setEmail("");
1993
- setIssueDescription("");
1994
- setSubmitting(false);
1948
+ const handleSubmit = () => {
1995
1949
  setShowHelpModal(false);
1996
- });
1950
+ };
1997
1951
  const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1998
1952
  "button",
1999
1953
  {
2000
1954
  onClick: () => setShowHelpModal(true),
2001
- style: { width: "50px", height: "30px", marginRight: "0.25rem" },
2002
- className: "text-sm p-0 bg-transparent rounded border border-blue-500",
1955
+ className: "p-2 bg-transparent rounded-full shadow-lg hover:shadow-xl transition-shadow duration-300 focus:outline-none focus:ring-2 focus:ring-blue-500",
2003
1956
  "aria-label": "Open Help",
2004
- children: "Help"
1957
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LifeBuoyIcon, {})
2005
1958
  }
2006
1959
  );
2007
- const submitButtonDisabled = (0, import_react9.useMemo)(
2008
- () => submitting || !!emailError || issueDescription == null || (issueDescription == null ? void 0 : issueDescription.length) == 0,
2009
- [submitting, emailError, issueDescription]
2010
- );
2011
1960
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
2012
1961
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(HelpButton, {}),
2013
1962
  showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
@@ -2028,15 +1977,6 @@ function CopilotKitHelpModal() {
2028
1977
  ),
2029
1978
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w-full flex mb-6 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h2", { className: "text-2xl font-bold", children: "Help Options" }) }),
2030
1979
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-4 mb-4", children: [
2031
- /* @__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)(
2032
- "a",
2033
- {
2034
- href: "https://docs.copilotkit.ai/coagents/troubleshooting/common-issues",
2035
- target: "_blank",
2036
- rel: "noopener noreferrer",
2037
- children: "Visit the Troubleshooting and FAQ section in the docs"
2038
- }
2039
- ) }),
2040
1980
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "block w-full text-center py-2 px-4 bg-blue-500 text-white rounded hover:bg-blue-600 transition duration-150 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2041
1981
  "a",
2042
1982
  {
@@ -2055,52 +1995,6 @@ function CopilotKitHelpModal() {
2055
1995
  children: "Apply for Priority Direct Slack Support"
2056
1996
  }
2057
1997
  ) })
2058
- ] }),
2059
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("form", { onSubmit: handleSubmit, className: "flex flex-col space-y-2", children: [
2060
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
2061
- /* @__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:" }),
2062
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2063
- "textarea",
2064
- {
2065
- id: "feedback",
2066
- rows: 4,
2067
- className: "w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500",
2068
- placeholder: "A Loom link / screen recording is always great!",
2069
- onChange: (e) => setIssueDescription(e.target.value),
2070
- value: issueDescription,
2071
- required: true
2072
- }
2073
- )
2074
- ] }),
2075
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
2076
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { htmlFor: "email", className: "block text-sm font-medium text-gray-700 mb-1", children: "Email (optional):" }),
2077
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2078
- "input",
2079
- {
2080
- type: "email",
2081
- id: "email",
2082
- className: `w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500 ${emailError ? "border-red-500" : ""}`,
2083
- placeholder: "Enter your email for follow-up",
2084
- onChange: (e) => {
2085
- setEmail(e.target.value);
2086
- setEmailError("");
2087
- },
2088
- value: email
2089
- }
2090
- ),
2091
- emailError && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-red-500 text-sm mt-1", children: emailError })
2092
- ] }),
2093
- /* @__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)(
2094
- "button",
2095
- {
2096
- type: "submit",
2097
- onClick: handleSubmit,
2098
- disabled: submitButtonDisabled,
2099
- style: submitButtonDisabled ? { backgroundColor: "rgb(216, 216, 216)", color: "rgb(129, 129, 129)" } : void 0,
2100
- 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",
2101
- children: submitting ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LoadingSpinnerIcon, { color: "white" }) : "Submit"
2102
- }
2103
- ) })
2104
1998
  ] })
2105
1999
  ] })
2106
2000
  }
@@ -2311,7 +2205,6 @@ function DebugMenuButton({
2311
2205
  }
2312
2206
 
2313
2207
  // src/components/chat/Chat.tsx
2314
- var import_react_core9 = require("@copilotkit/react-core");
2315
2208
  var import_jsx_runtime21 = require("react/jsx-runtime");
2316
2209
  function CopilotChat({
2317
2210
  instructions,
@@ -2319,8 +2212,6 @@ function CopilotChat({
2319
2212
  makeSystemMessage,
2320
2213
  showResponseButton = true,
2321
2214
  onInProgress,
2322
- onStopGeneration,
2323
- onReloadMessages,
2324
2215
  Messages: Messages2 = Messages,
2325
2216
  RenderTextMessage: RenderTextMessage2 = RenderTextMessage,
2326
2217
  RenderActionExecutionMessage: RenderActionExecutionMessage2 = RenderActionExecutionMessage,
@@ -2343,13 +2234,7 @@ function CopilotChat({
2343
2234
  sendMessage,
2344
2235
  stopGeneration,
2345
2236
  reloadMessages
2346
- } = useCopilotChatLogic(
2347
- makeSystemMessage,
2348
- onInProgress,
2349
- onSubmitMessage,
2350
- onStopGeneration,
2351
- onReloadMessages
2352
- );
2237
+ } = useCopilotChatLogic(makeSystemMessage, onInProgress, onSubmitMessage);
2353
2238
  const chatContext = import_react12.default.useContext(ChatContext);
2354
2239
  const isVisible = chatContext ? chatContext.open : true;
2355
2240
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
@@ -2405,16 +2290,8 @@ function WrappedCopilotChat({
2405
2290
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children });
2406
2291
  }
2407
2292
  var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
2408
- var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
2409
- var _a;
2410
- const {
2411
- visibleMessages,
2412
- appendMessage,
2413
- reloadMessages: defaultReloadMessages,
2414
- stopGeneration: defaultStopGeneration,
2415
- runChatCompletion,
2416
- isLoading
2417
- } = (0, import_react_core8.useCopilotChat)({
2293
+ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
2294
+ const { visibleMessages, appendMessage, reloadMessages, stopGeneration, isLoading } = (0, import_react_core8.useCopilotChat)({
2418
2295
  id: (0, import_shared3.randomId)(),
2419
2296
  makeSystemMessage
2420
2297
  });
@@ -2422,8 +2299,8 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
2422
2299
  const suggestionsAbortControllerRef = (0, import_react12.useRef)(null);
2423
2300
  const debounceTimerRef = (0, import_react12.useRef)();
2424
2301
  const abortSuggestions = () => {
2425
- var _a2;
2426
- (_a2 = suggestionsAbortControllerRef.current) == null ? void 0 : _a2.abort();
2302
+ var _a;
2303
+ (_a = suggestionsAbortControllerRef.current) == null ? void 0 : _a.abort();
2427
2304
  suggestionsAbortControllerRef.current = null;
2428
2305
  };
2429
2306
  const generalContext = (0, import_react_core8.useCopilotContext)();
@@ -2449,13 +2326,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
2449
2326
  return () => {
2450
2327
  clearTimeout(debounceTimerRef.current);
2451
2328
  };
2452
- }, [
2453
- isLoading,
2454
- context.chatSuggestionConfiguration,
2455
- // hackish way to trigger suggestions reload on reset, but better than moving suggestions to the
2456
- // global context
2457
- visibleMessages.length == 0
2458
- ]);
2329
+ }, [isLoading, context.chatSuggestionConfiguration]);
2459
2330
  const sendMessage = (messageContent) => __async(void 0, null, function* () {
2460
2331
  abortSuggestions();
2461
2332
  setCurrentSuggestions([]);
@@ -2473,85 +2344,6 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
2473
2344
  appendMessage(message);
2474
2345
  return message;
2475
2346
  });
2476
- const messages = visibleMessages;
2477
- const { setMessages } = messagesContext;
2478
- const currentAgentName = (_a = generalContext.agentSession) == null ? void 0 : _a.agentName;
2479
- const restartCurrentAgent = (hint) => __async(void 0, null, function* () {
2480
- if (generalContext.agentSession) {
2481
- generalContext.setAgentSession(__spreadProps(__spreadValues({}, generalContext.agentSession), {
2482
- nodeName: void 0,
2483
- threadId: void 0
2484
- }));
2485
- generalContext.setCoagentStates((prevAgentStates) => {
2486
- return __spreadProps(__spreadValues({}, prevAgentStates), {
2487
- [generalContext.agentSession.agentName]: __spreadProps(__spreadValues({}, prevAgentStates[generalContext.agentSession.agentName]), {
2488
- threadId: void 0,
2489
- nodeName: void 0,
2490
- runId: void 0
2491
- })
2492
- });
2493
- });
2494
- }
2495
- });
2496
- const runCurrentAgent = (hint) => __async(void 0, null, function* () {
2497
- if (generalContext.agentSession) {
2498
- yield (0, import_react_core9.runAgent)(
2499
- generalContext.agentSession.agentName,
2500
- context,
2501
- appendMessage,
2502
- runChatCompletion,
2503
- hint
2504
- );
2505
- }
2506
- });
2507
- const stopCurrentAgent = () => {
2508
- if (generalContext.agentSession) {
2509
- (0, import_react_core9.stopAgent)(generalContext.agentSession.agentName, context);
2510
- }
2511
- };
2512
- const setCurrentAgentState = (state) => {
2513
- if (generalContext.agentSession) {
2514
- generalContext.setCoagentStates((prevAgentStates) => {
2515
- return __spreadProps(__spreadValues({}, prevAgentStates), {
2516
- [generalContext.agentSession.agentName]: {
2517
- state
2518
- }
2519
- });
2520
- });
2521
- }
2522
- };
2523
- function stopGeneration() {
2524
- if (onStopGeneration) {
2525
- onStopGeneration({
2526
- messages,
2527
- setMessages,
2528
- stopGeneration: defaultStopGeneration,
2529
- currentAgentName,
2530
- restartCurrentAgent,
2531
- stopCurrentAgent,
2532
- runCurrentAgent,
2533
- setCurrentAgentState
2534
- });
2535
- } else {
2536
- defaultStopGeneration();
2537
- }
2538
- }
2539
- function reloadMessages() {
2540
- if (onReloadMessages) {
2541
- onReloadMessages({
2542
- messages,
2543
- setMessages,
2544
- stopGeneration: defaultStopGeneration,
2545
- currentAgentName,
2546
- restartCurrentAgent,
2547
- stopCurrentAgent,
2548
- runCurrentAgent,
2549
- setCurrentAgentState
2550
- });
2551
- } else {
2552
- defaultReloadMessages();
2553
- }
2554
- }
2555
2347
  return {
2556
2348
  visibleMessages,
2557
2349
  isLoading,
@@ -2571,8 +2363,6 @@ var CopilotModal = ({
2571
2363
  hitEscapeToClose = true,
2572
2364
  onSetOpen,
2573
2365
  onSubmitMessage,
2574
- onStopGeneration,
2575
- onReloadMessages,
2576
2366
  shortcut = "/",
2577
2367
  icons,
2578
2368
  labels,
@@ -2610,8 +2400,6 @@ var CopilotModal = ({
2610
2400
  {
2611
2401
  instructions,
2612
2402
  onSubmitMessage,
2613
- onStopGeneration,
2614
- onReloadMessages,
2615
2403
  makeSystemMessage,
2616
2404
  showResponseButton,
2617
2405
  onInProgress,