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