@copilotkit/react-ui 1.4.6 → 1.4.8-coagents-v0-3.1

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 +95 -8
  2. package/dist/{chunk-2B57NCBA.mjs → chunk-6GBOJUX4.mjs} +3 -3
  3. package/dist/{chunk-4T3TMQNJ.mjs → chunk-BH6PCAAL.mjs} +38 -2
  4. package/dist/chunk-BH6PCAAL.mjs.map +1 -0
  5. package/dist/{chunk-4LUMV4YO.mjs → chunk-EMQEEXUB.mjs} +8 -3
  6. package/dist/chunk-EMQEEXUB.mjs.map +1 -0
  7. package/dist/{chunk-63ZKP62F.mjs → chunk-H7UVF2NY.mjs} +3 -3
  8. package/dist/chunk-ICGZEGHQ.mjs +155 -0
  9. package/dist/chunk-ICGZEGHQ.mjs.map +1 -0
  10. package/dist/{chunk-DHGDU64D.mjs → chunk-M7MHMZ5O.mjs} +3 -3
  11. package/dist/{chunk-4FIGRRFS.mjs → chunk-PNQVKBPN.mjs} +2 -2
  12. package/dist/{chunk-4FIGRRFS.mjs.map → chunk-PNQVKBPN.mjs.map} +1 -1
  13. package/dist/{chunk-TKFQ7VQR.mjs → chunk-ROVHRIKR.mjs} +2 -2
  14. package/dist/{chunk-VYKDFXGS.mjs → chunk-VUK75M5B.mjs} +2 -2
  15. package/dist/components/chat/Chat.js +124 -5
  16. package/dist/components/chat/Chat.js.map +1 -1
  17. package/dist/components/chat/Chat.mjs +6 -6
  18. package/dist/components/chat/Input.js +7 -2
  19. package/dist/components/chat/Input.js.map +1 -1
  20. package/dist/components/chat/Input.mjs +1 -1
  21. package/dist/components/chat/Modal.js +124 -5
  22. package/dist/components/chat/Modal.js.map +1 -1
  23. package/dist/components/chat/Modal.mjs +7 -7
  24. package/dist/components/chat/Popup.js +124 -5
  25. package/dist/components/chat/Popup.js.map +1 -1
  26. package/dist/components/chat/Popup.mjs +8 -8
  27. package/dist/components/chat/Sidebar.js +124 -5
  28. package/dist/components/chat/Sidebar.js.map +1 -1
  29. package/dist/components/chat/Sidebar.mjs +8 -8
  30. package/dist/components/chat/index.js +124 -5
  31. package/dist/components/chat/index.js.map +1 -1
  32. package/dist/components/chat/index.mjs +9 -9
  33. package/dist/components/dev-console/console.js +117 -3
  34. package/dist/components/dev-console/console.js.map +1 -1
  35. package/dist/components/dev-console/console.mjs +4 -4
  36. package/dist/components/dev-console/index.js +117 -3
  37. package/dist/components/dev-console/index.js.map +1 -1
  38. package/dist/components/dev-console/index.mjs +4 -4
  39. package/dist/components/dev-console/utils.js +1 -1
  40. package/dist/components/dev-console/utils.js.map +1 -1
  41. package/dist/components/dev-console/utils.mjs +1 -1
  42. package/dist/components/help-modal/icons.d.ts +4 -1
  43. package/dist/components/help-modal/icons.js +39 -2
  44. package/dist/components/help-modal/icons.js.map +1 -1
  45. package/dist/components/help-modal/icons.mjs +5 -3
  46. package/dist/components/help-modal/index.js +136 -2
  47. package/dist/components/help-modal/index.js.map +1 -1
  48. package/dist/components/help-modal/index.mjs +2 -2
  49. package/dist/components/help-modal/modal.js +136 -2
  50. package/dist/components/help-modal/modal.js.map +1 -1
  51. package/dist/components/help-modal/modal.mjs +2 -2
  52. package/dist/components/index.js +124 -5
  53. package/dist/components/index.js.map +1 -1
  54. package/dist/components/index.mjs +9 -9
  55. package/dist/index.js +124 -5
  56. package/dist/index.js.map +1 -1
  57. package/dist/index.mjs +9 -9
  58. package/package.json +4 -4
  59. package/src/components/chat/Input.tsx +9 -2
  60. package/src/components/dev-console/utils.ts +1 -1
  61. package/src/components/help-modal/icons.tsx +28 -0
  62. package/src/components/help-modal/modal.tsx +90 -27
  63. package/dist/chunk-4LUMV4YO.mjs.map +0 -1
  64. package/dist/chunk-4T3TMQNJ.mjs.map +0 -1
  65. package/dist/chunk-WOUWNTAV.mjs +0 -72
  66. package/dist/chunk-WOUWNTAV.mjs.map +0 -1
  67. /package/dist/{chunk-2B57NCBA.mjs.map → chunk-6GBOJUX4.mjs.map} +0 -0
  68. /package/dist/{chunk-63ZKP62F.mjs.map → chunk-H7UVF2NY.mjs.map} +0 -0
  69. /package/dist/{chunk-DHGDU64D.mjs.map → chunk-M7MHMZ5O.mjs.map} +0 -0
  70. /package/dist/{chunk-TKFQ7VQR.mjs.map → chunk-ROVHRIKR.mjs.map} +0 -0
  71. /package/dist/{chunk-VYKDFXGS.mjs.map → chunk-VUK75M5B.mjs.map} +0 -0
@@ -739,7 +739,10 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
739
739
  });
740
740
  const sendIcon = inProgress || pushToTalkState === "transcribing" ? context.icons.activityIcon : context.icons.sendIcon;
741
741
  const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
742
- const sendDisabled = inProgress || text.length === 0 || pushToTalkState !== "idle";
742
+ const canSend = () => {
743
+ return !inProgress && text.trim().length > 0 && pushToTalkState === "idle";
744
+ };
745
+ const sendDisabled = !canSend();
743
746
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
744
747
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
745
748
  Textarea_default,
@@ -753,7 +756,9 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
753
756
  onKeyDown: (event) => {
754
757
  if (event.key === "Enter" && !event.shiftKey) {
755
758
  event.preventDefault();
756
- send();
759
+ if (canSend()) {
760
+ send();
761
+ }
757
762
  }
758
763
  }
759
764
  }
@@ -1636,7 +1641,7 @@ function logMessages(context) {
1636
1641
  type: "ActionExecutionMessage",
1637
1642
  role: void 0,
1638
1643
  name: message.name,
1639
- scope: message.scope,
1644
+ scope: message.parentMessageId,
1640
1645
  content: message.arguments
1641
1646
  };
1642
1647
  } else if (message.isResultMessage()) {
@@ -1796,15 +1801,79 @@ var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1796
1801
  children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
1797
1802
  }
1798
1803
  );
1804
+ var LoadingSpinnerIcon = ({ color = "rgb(107 114 128)" }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1805
+ "svg",
1806
+ {
1807
+ style: {
1808
+ animation: "copilotKitSpinAnimation 1s linear infinite",
1809
+ color
1810
+ },
1811
+ width: "24",
1812
+ height: "24",
1813
+ xmlns: "http://www.w3.org/2000/svg",
1814
+ fill: "none",
1815
+ viewBox: "0 0 24 24",
1816
+ children: [
1817
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1818
+ "circle",
1819
+ {
1820
+ style: { opacity: 0.25 },
1821
+ cx: "12",
1822
+ cy: "12",
1823
+ r: "10",
1824
+ stroke: "currentColor",
1825
+ strokeWidth: "4"
1826
+ }
1827
+ ),
1828
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1829
+ "path",
1830
+ {
1831
+ style: { opacity: 0.75 },
1832
+ fill: "currentColor",
1833
+ 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"
1834
+ }
1835
+ )
1836
+ ]
1837
+ }
1838
+ );
1799
1839
 
1800
1840
  // src/components/help-modal/modal.tsx
1801
1841
  var import_jsx_runtime16 = require("react/jsx-runtime");
1802
1842
  function CopilotKitHelpModal() {
1803
1843
  const [showHelpModal, setShowHelpModal] = (0, import_react8.useState)(false);
1804
1844
  const [issueDescription, setIssueDescription] = (0, import_react8.useState)("");
1805
- const handleSubmit = () => {
1806
- setShowHelpModal(false);
1845
+ const [email, setEmail] = (0, import_react8.useState)("");
1846
+ const [emailError, setEmailError] = (0, import_react8.useState)("");
1847
+ const [submitting, setSubmitting] = (0, import_react8.useState)(false);
1848
+ const validateEmail = (email2) => {
1849
+ const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
1850
+ return re.test(email2);
1807
1851
  };
1852
+ const handleSubmit = (e) => __async(this, null, function* () {
1853
+ e.preventDefault();
1854
+ if ((email == null ? void 0 : email.length) > 0 && !validateEmail(email)) {
1855
+ setEmailError("Please enter a valid email address");
1856
+ return;
1857
+ }
1858
+ setSubmitting(true);
1859
+ yield fetch("https://api.segment.io/v1/track", {
1860
+ method: "POST",
1861
+ headers: {
1862
+ "Content-Type": "application/json"
1863
+ },
1864
+ body: JSON.stringify({
1865
+ event: "oss.dev-console.help",
1866
+ anonymousId: window.crypto.randomUUID(),
1867
+ properties: { email, text: issueDescription },
1868
+ writeKey: "q0gQqvGYyw9pNyhIocNzefSYKGO1aiwW"
1869
+ })
1870
+ });
1871
+ setEmailError("");
1872
+ setEmail("");
1873
+ setIssueDescription("");
1874
+ setSubmitting(false);
1875
+ setShowHelpModal(false);
1876
+ });
1808
1877
  const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1809
1878
  "button",
1810
1879
  {
@@ -1814,6 +1883,10 @@ function CopilotKitHelpModal() {
1814
1883
  children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LifeBuoyIcon, {})
1815
1884
  }
1816
1885
  );
1886
+ const submitButtonDisabled = (0, import_react8.useMemo)(
1887
+ () => submitting || !!emailError || issueDescription == null || (issueDescription == null ? void 0 : issueDescription.length) == 0,
1888
+ [submitting, emailError, issueDescription]
1889
+ );
1817
1890
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
1818
1891
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(HelpButton, {}),
1819
1892
  showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
@@ -1852,6 +1925,52 @@ function CopilotKitHelpModal() {
1852
1925
  children: "Apply for Priority Direct Slack Support"
1853
1926
  }
1854
1927
  ) })
1928
+ ] }),
1929
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("form", { onSubmit: handleSubmit, className: "flex flex-col space-y-2", children: [
1930
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
1931
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { htmlFor: "feedback", className: "block text-sm font-medium text-gray-700 mb-1", children: "Let us know what your issue is:" }),
1932
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1933
+ "textarea",
1934
+ {
1935
+ id: "feedback",
1936
+ rows: 4,
1937
+ className: "w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500",
1938
+ placeholder: "A Loom link / screen recording is always great!",
1939
+ onChange: (e) => setIssueDescription(e.target.value),
1940
+ value: issueDescription,
1941
+ required: true
1942
+ }
1943
+ )
1944
+ ] }),
1945
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
1946
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { htmlFor: "email", className: "block text-sm font-medium text-gray-700 mb-1", children: "Email (optional):" }),
1947
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1948
+ "input",
1949
+ {
1950
+ type: "email",
1951
+ id: "email",
1952
+ className: `w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500 ${emailError ? "border-red-500" : ""}`,
1953
+ placeholder: "Enter your email for follow-up",
1954
+ onChange: (e) => {
1955
+ setEmail(e.target.value);
1956
+ setEmailError("");
1957
+ },
1958
+ value: email
1959
+ }
1960
+ ),
1961
+ emailError && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-red-500 text-sm mt-1", children: emailError })
1962
+ ] }),
1963
+ /* @__PURE__ */ (0, import_jsx_runtime16.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_runtime16.jsx)(
1964
+ "button",
1965
+ {
1966
+ type: "submit",
1967
+ onClick: handleSubmit,
1968
+ disabled: submitButtonDisabled,
1969
+ style: submitButtonDisabled ? { backgroundColor: "rgb(216, 216, 216)", color: "rgb(129, 129, 129)" } : void 0,
1970
+ 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",
1971
+ children: submitting ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LoadingSpinnerIcon, { color: "white" }) : "Submit"
1972
+ }
1973
+ ) })
1855
1974
  ] })
1856
1975
  ] })
1857
1976
  }