@invergent/agent-chat-react 2.6.4 → 2.6.6

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.
package/dist/index.js CHANGED
@@ -5971,6 +5971,15 @@ function ItemActions({ className, ...props }) {
5971
5971
  }
5972
5972
  );
5973
5973
  }
5974
+ function Skeleton({ className, ...props }) {
5975
+ return /* @__PURE__ */ jsx(
5976
+ "div",
5977
+ {
5978
+ className: cn("animate-pulse rounded-md bg-muted", className),
5979
+ ...props
5980
+ }
5981
+ );
5982
+ }
5974
5983
  function ChatComposer(props) {
5975
5984
  return /* @__PURE__ */ jsx(PromptInputProvider, { children: /* @__PURE__ */ jsx(ChatComposerInner, { ...props }) });
5976
5985
  }
@@ -6065,6 +6074,7 @@ function ChatComposerInner({
6065
6074
  const { textInput, attachments } = usePromptInputController();
6066
6075
  const status = isRunning ? "streaming" : disabled ? "error" : "ready";
6067
6076
  const [adapterCommands, setAdapterCommands] = useState([]);
6077
+ const [skillsLoading, setSkillsLoading] = useState(false);
6068
6078
  const [buttonMenuOpen, setButtonMenuOpen] = useState(false);
6069
6079
  const [menuMode, setMenuMode] = useState("all");
6070
6080
  const [addMenuOpen, setAddMenuOpen] = useState(false);
@@ -6081,10 +6091,24 @@ function ChatComposerInner({
6081
6091
  }
6082
6092
  }, [buttonMenuOpen, textInput.value]);
6083
6093
  useEffect(() => {
6084
- if (showSlashMenu && (menuMode === "skills" || menuMode === "all")) {
6085
- adapter.listSlashCommands?.().then((commands) => setAdapterCommands(commands.filter((c) => !c.isBuiltin))).catch(() => {
6086
- });
6094
+ if (!(showSlashMenu && (menuMode === "skills" || menuMode === "all"))) {
6095
+ return;
6087
6096
  }
6097
+ const pending = adapter.listSlashCommands?.();
6098
+ if (!pending) return;
6099
+ let cancelled = false;
6100
+ setSkillsLoading(true);
6101
+ pending.then((commands) => {
6102
+ if (!cancelled) {
6103
+ setAdapterCommands(commands.filter((c) => !c.isBuiltin));
6104
+ }
6105
+ }).catch(() => {
6106
+ }).finally(() => {
6107
+ if (!cancelled) setSkillsLoading(false);
6108
+ });
6109
+ return () => {
6110
+ cancelled = true;
6111
+ };
6088
6112
  }, [adapter, showSlashMenu, menuMode]);
6089
6113
  const builtinCommands = useMemo(
6090
6114
  () => {
@@ -6529,7 +6553,19 @@ function ChatComposerInner({
6529
6553
  }
6530
6554
  ),
6531
6555
  /* @__PURE__ */ jsxs(CommandList, { children: [
6532
- /* @__PURE__ */ jsx(CommandEmpty, { children: menuMode === "skills" ? "No skills found." : menuMode === "scheduled" ? "No scheduled tasks found." : "No commands found." }),
6556
+ !(skillsLoading && (menuMode === "skills" || menuMode === "all")) && /* @__PURE__ */ jsx(CommandEmpty, { children: menuMode === "skills" ? "No skills found." : menuMode === "scheduled" ? "No scheduled tasks found." : "No commands found." }),
6557
+ (menuMode === "skills" || menuMode === "all") && skillsLoading && adapterCommands.length === 0 && [0, 1, 2].map((i) => /* @__PURE__ */ jsxs(
6558
+ "div",
6559
+ {
6560
+ className: "grid grid-cols-[12rem_1fr] items-baseline gap-3 px-2 py-2",
6561
+ "aria-hidden": "true",
6562
+ children: [
6563
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-28" }),
6564
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-full max-w-[16rem]" })
6565
+ ]
6566
+ },
6567
+ `skill-skeleton-${i}`
6568
+ )),
6533
6569
  menuMode === "scheduled" && scheduledExamples.map((cmd) => /* @__PURE__ */ jsxs(
6534
6570
  CommandItem,
6535
6571
  {
@@ -7703,15 +7739,6 @@ var ErrorMessage = memo(function ErrorMessage2({
7703
7739
  }
7704
7740
  );
7705
7741
  });
7706
- function Skeleton({ className, ...props }) {
7707
- return /* @__PURE__ */ jsx(
7708
- "div",
7709
- {
7710
- className: cn("animate-pulse rounded-md bg-muted", className),
7711
- ...props
7712
- }
7713
- );
7714
- }
7715
7742
  var SKELETON_WIDTHS = [70, 85, 55, 90, 60, 78, 45, 82, 65, 72];
7716
7743
  var PDF_WORKER_SRC = new URL(
7717
7744
  "pdfjs-dist/legacy/build/pdf.worker.mjs",