@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.cjs CHANGED
@@ -6254,6 +6254,18 @@ function ItemActions({ className, ...props }) {
6254
6254
  }
6255
6255
  );
6256
6256
  }
6257
+
6258
+ // src/components/ui/skeleton.tsx
6259
+ init_utils();
6260
+ function Skeleton({ className, ...props }) {
6261
+ return /* @__PURE__ */ jsxRuntime.jsx(
6262
+ "div",
6263
+ {
6264
+ className: cn("animate-pulse rounded-md bg-muted", className),
6265
+ ...props
6266
+ }
6267
+ );
6268
+ }
6257
6269
  function ChatComposer(props) {
6258
6270
  return /* @__PURE__ */ jsxRuntime.jsx(PromptInputProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(ChatComposerInner, { ...props }) });
6259
6271
  }
@@ -6348,6 +6360,7 @@ function ChatComposerInner({
6348
6360
  const { textInput, attachments } = usePromptInputController();
6349
6361
  const status = isRunning ? "streaming" : disabled ? "error" : "ready";
6350
6362
  const [adapterCommands, setAdapterCommands] = react.useState([]);
6363
+ const [skillsLoading, setSkillsLoading] = react.useState(false);
6351
6364
  const [buttonMenuOpen, setButtonMenuOpen] = react.useState(false);
6352
6365
  const [menuMode, setMenuMode] = react.useState("all");
6353
6366
  const [addMenuOpen, setAddMenuOpen] = react.useState(false);
@@ -6364,10 +6377,24 @@ function ChatComposerInner({
6364
6377
  }
6365
6378
  }, [buttonMenuOpen, textInput.value]);
6366
6379
  react.useEffect(() => {
6367
- if (showSlashMenu && (menuMode === "skills" || menuMode === "all")) {
6368
- adapter.listSlashCommands?.().then((commands) => setAdapterCommands(commands.filter((c) => !c.isBuiltin))).catch(() => {
6369
- });
6380
+ if (!(showSlashMenu && (menuMode === "skills" || menuMode === "all"))) {
6381
+ return;
6370
6382
  }
6383
+ const pending = adapter.listSlashCommands?.();
6384
+ if (!pending) return;
6385
+ let cancelled = false;
6386
+ setSkillsLoading(true);
6387
+ pending.then((commands) => {
6388
+ if (!cancelled) {
6389
+ setAdapterCommands(commands.filter((c) => !c.isBuiltin));
6390
+ }
6391
+ }).catch(() => {
6392
+ }).finally(() => {
6393
+ if (!cancelled) setSkillsLoading(false);
6394
+ });
6395
+ return () => {
6396
+ cancelled = true;
6397
+ };
6371
6398
  }, [adapter, showSlashMenu, menuMode]);
6372
6399
  const builtinCommands = react.useMemo(
6373
6400
  () => {
@@ -6812,7 +6839,19 @@ function ChatComposerInner({
6812
6839
  }
6813
6840
  ),
6814
6841
  /* @__PURE__ */ jsxRuntime.jsxs(CommandList, { children: [
6815
- /* @__PURE__ */ jsxRuntime.jsx(CommandEmpty, { children: menuMode === "skills" ? "No skills found." : menuMode === "scheduled" ? "No scheduled tasks found." : "No commands found." }),
6842
+ !(skillsLoading && (menuMode === "skills" || menuMode === "all")) && /* @__PURE__ */ jsxRuntime.jsx(CommandEmpty, { children: menuMode === "skills" ? "No skills found." : menuMode === "scheduled" ? "No scheduled tasks found." : "No commands found." }),
6843
+ (menuMode === "skills" || menuMode === "all") && skillsLoading && adapterCommands.length === 0 && [0, 1, 2].map((i) => /* @__PURE__ */ jsxRuntime.jsxs(
6844
+ "div",
6845
+ {
6846
+ className: "grid grid-cols-[12rem_1fr] items-baseline gap-3 px-2 py-2",
6847
+ "aria-hidden": "true",
6848
+ children: [
6849
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-28" }),
6850
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-3 w-full max-w-[16rem]" })
6851
+ ]
6852
+ },
6853
+ `skill-skeleton-${i}`
6854
+ )),
6816
6855
  menuMode === "scheduled" && scheduledExamples.map((cmd) => /* @__PURE__ */ jsxRuntime.jsxs(
6817
6856
  CommandItem,
6818
6857
  {
@@ -8004,18 +8043,6 @@ var ErrorMessage = react.memo(function ErrorMessage2({
8004
8043
  );
8005
8044
  });
8006
8045
  init_utils();
8007
-
8008
- // src/components/ui/skeleton.tsx
8009
- init_utils();
8010
- function Skeleton({ className, ...props }) {
8011
- return /* @__PURE__ */ jsxRuntime.jsx(
8012
- "div",
8013
- {
8014
- className: cn("animate-pulse rounded-md bg-muted", className),
8015
- ...props
8016
- }
8017
- );
8018
- }
8019
8046
  var SKELETON_WIDTHS = [70, 85, 55, 90, 60, 78, 45, 82, 65, 72];
8020
8047
  var PDF_WORKER_SRC = new URL(
8021
8048
  "pdfjs-dist/legacy/build/pdf.worker.mjs",