Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(extensions): Skills, Plugins & MCPs as one settings surface — tables and detail pages

rubenluetke10-beep90271a96a43c
diff --git a/jarvis/ui/web/frontend/src/components/extensions/primitives.tsx b/jarvis/ui/web/frontend/src/components/extensions/primitives.tsx
new file mode 100644
index 0000000000..0a0edc6d1e
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/extensions/primitives.tsx
@@ -0,0 +1,648 @@
+/**
+ * Shared building blocks for the "Skills, Plugins & MCPs" section.
+ *
+ * The section follows one quiet pattern across its three views — a title row
+ * with a few actions on the right, a plain table underneath, and a detail page
+ * that replaces the table with a "← Back" link at the top. These primitives
+ * carry that pattern so the three views cannot drift apart visually: the same
+ * row height, the same hairlines, the same muted header, the same menu.
+ *
+ * Everything here is theme-token based (border-border, bg-card, text-muted-
+ * foreground …) so it reads the same in light and dark mode.
+ */
+import {
+ type ReactNode,
+ useCallback,
+ useEffect,
+ useId,
+ useRef,
+ useState,
+} from "react";
+import { ArrowLeft, ChevronDown, Loader2 } from "lucide-react";
+import { cn } from "@/lib/utils";
+
+// ---------------------------------------------------------------------------
+// Panel header — title + right-aligned actions
+// ---------------------------------------------------------------------------
+
+export function PanelHeader({
+ title,
+ subtitle,
+ actions,
+ className,
+}: {
+ title: ReactNode;
+ subtitle?: ReactNode;
+ actions?: ReactNode;
+ className?: string;
+}) {
+ return (
+ <div className={cn("flex items-start justify-between gap-4", className)}>
+ <div className="min-w-0">
+ <h2 className="font-display text-[15px] font-semibold tracking-tight text-foreground">
+ {title}
+ </h2>
+ {subtitle ? (
+ <p className="mt-0.5 text-xs text-muted-foreground">{subtitle}</p>
+ ) : null}
+ </div>
+ {actions ? (
+ <div className="flex shrink-0 items-center gap-1">{actions}</div>
+ ) : null}
+ </div>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Icon button — the small round-cornered buttons in the header row
+// ---------------------------------------------------------------------------
+
+export function IconButton({
+ label,
+ onClick,
+ children,
+ active,
+ disabled,
+ busy,
+ className,
+}: {
+ label: string;
+ onClick?: () => void;
+ children: ReactNode;
+ active?: boolean;
+ disabled?: boolean;
+ busy?: boolean;
+ className?: string;
+}) {
+ return (
+ <button
+ type="button"
+ onClick={onClick}
+ disabled={disabled || busy}
+ aria-label={label}
+ aria-pressed={active}
+ title={label}
+ className={cn(
+ "grid h-8 w-8 place-items-center rounded-md text-muted-foreground transition-colors",
+ "hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",
+ active && "bg-accent text-foreground",
+ className,
+ )}
+ >
+ {busy ? <Loader2 className="h-4 w-4 animate-spin" /> : children}
+ </button>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Soft button — the quiet "Browse" / "Add ▾" pills in the header row
+// ---------------------------------------------------------------------------
+
+export function SoftButton({
+ children,
+ onClick,
+ disabled,
+ primary,
+ className,
+ ariaLabel,
+ ariaExpanded,
+ ariaHasPopup,
+}: {
+ children: ReactNode;
+ onClick?: () => void;
+ disabled?: boolean;
+ primary?: boolean;
+ className?: string;
+ ariaLabel?: string;
+ ariaExpanded?: boolean;
+ ariaHasPopup?: boolean | "menu";
+}) {
+ return (
+ <button
+ type="button"
+ onClick={onClick}
+ disabled={disabled}
+ aria-label={ariaLabel}
+ aria-expanded={ariaExpanded}
+ aria-haspopup={ariaHasPopup}
+ className={cn(
+ "inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs font-medium transition-colors",
+ "disabled:cursor-not-allowed disabled:opacity-50",
+ primary
+ ? "bg-primary text-primary-foreground hover:bg-primary/90"
+ : "bg-sheen/[0.06] text-foreground hover:bg-sheen/[0.12]",
+ className,
+ )}
+ >
+ {children}
+ </button>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Action menu — a button that opens a small list of actions
+// ---------------------------------------------------------------------------
+
+export interface MenuAction {
+ id: string;
+ label: string;
+ icon?: ReactNode;
+ onSelect: () => void;
+ disabled?: boolean;
+ destructive?: boolean;
+ /** A thin rule above this entry, for grouping. */
+ separatorAbove?: boolean;
+}
+
+/**
+ * Dropdown menu anchored to its trigger. Dismisses on outside click and Escape.
+ * `trigger` receives the open state so the caller can render any button shape
+ * (the "Add ▾" pill or a bare "⋯" icon).
+ */
+export function ActionMenu({
+ actions,
+ trigger,
+ align = "end",
+ label,
+}: {
+ actions: MenuAction[];
+ trigger: (opts: { open: boolean; toggle: () => void }) => ReactNode;
+ align?: "start" | "end";
+ label: string;
+}) {
+ const [open, setOpen] = useState(false);
+ const rootRef = useRef<HTMLDivElement>(null);
+ const menuId = useId();
+
+ const close = useCallback(() => setOpen(false), []);
+ const toggle = useCallback(() => setOpen((v) => !v), []);
+
+ useEffect(() => {
+ if (!open) return;
+ const onDown = (e: MouseEvent) => {
+ if (!rootRef.current?.contains(e.target as Node)) close();
+ };
+ const onKey = (e: KeyboardEvent) => {
+ if (e.key === "Escape") close();
+ };
+ document.addEventListener("mousedown", onDown);
+ document.addEventListener("keydown", onKey);
+ return () => {
+ document.removeEventListener("mousedown", onDown);
+ document.removeEventListener("keydown", onKey);
+ };
+ }, [open, close]);
+
+ return (
+ <div ref={rootRef} className="relative">
+ {trigger({ open, toggle })}
+ {open && (
+ <div
+ id={menuId}
+ role="menu"
+ aria-label={label}
+ className={cn(
+ "absolute z-40 mt-1 min-w-[200px] overflow-hidden rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-lg",
+ align === "end" ? "right-0" : "left-0",
+ )}
+ >
+ {actions.map((a) => (
+ <div key={a.id}>
+ {a.separatorAbove && <div className="my-1 h-px bg-border" />}
+ <button
+ type="button"
+ role="menuitem"
+ disabled={a.disabled}
+ onClick={() => {
+ close();
+ a.onSelect();
+ }}
+ className={cn(
+ "flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-xs transition-colors",
+ "hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50",
+ a.destructive && "text-destructive hover:bg-destructive/10",
+ )}
+ >
+ {a.icon ? (
+ <span className="grid h-4 w-4 place-items-center text-muted-foreground">
+ {a.icon}
+ </span>
+ ) : null}
+ <span className="flex-1 truncate">{a.label}</span>
+ </button>
+ </div>
+ ))}
+ </div>
+ )}
+ </div>
+ );
+}
+
+/** The "Add ▾" pill — the most common trigger shape for `ActionMenu`. */
+export function MenuPill({
+ children,
+ open,
+ toggle,
+ primary,
+}: {
+ children: ReactNode;
+ open: boolean;
+ toggle: () => void;
+ primary?: boolean;
+}) {
+ return (
+ <SoftButton onClick={toggle} primary={primary} ariaExpanded={open} ariaHasPopup="menu">
+ {children}
+ <ChevronDown className={cn("h-3.5 w-3.5 transition-transform", open && "rotate-180")} />
+ </SoftButton>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Table — header row, body rows, cells
+// ---------------------------------------------------------------------------
+
+export function Table({ children, className, label }: { children: ReactNode; className?: string; label?: string }) {
+ return (
+ <div role="table" aria-label={label} className={cn("w-full text-sm", className)}>
+ {children}
+ </div>
+ );
+}
+
+/** Column spec for `TableHead` + `TableRow`; `width` is any CSS grid track. */
+export interface Column {
+ id: string;
+ label: ReactNode;
+ width?: string;
+ align?: "left" | "right" | "center";
+ /** Screen-reader only header (e.g. the toggle column). */
+ srOnly?: boolean;
+}
+
+export function gridTemplate(columns: Column[]): string {
+ return columns.map((c) => c.width ?? "minmax(0, 1fr)").join(" ");
+}
+
+export function TableHead({ columns }: { columns: Column[] }) {
+ return (
+ <div
+ role="row"
+ className="grid items-center gap-x-4 border-b border-border px-3 py-2 text-xs text-muted-foreground"
+ style={{ gridTemplateColumns: gridTemplate(columns) }}
+ >
+ {columns.map((c) => (
+ <div
+ key={c.id}
+ role="columnheader"
+ className={cn(
+ "truncate",
+ c.align === "right" && "text-right",
+ c.align === "center" && "text-center",
+ c.srOnly && "sr-only",
+ )}
+ >
+ {c.label}
+ </div>
+ ))}
+ </div>
+ );
+}
+
+export function TableRow({
+ columns,
+ children,
+ onClick,
+ id,
+ className,
+ selected,
+ ariaLabel,
+}: {
+ columns: Column[];
+ children: ReactNode;
+ onClick?: () => void;
+ id?: string;
+ className?: string;
+ selected?: boolean;
+ ariaLabel?: string;
+}) {
+ const clickable = typeof onClick === "function";
+ return (
+ <div
+ id={id}
+ role="row"
+ aria-label={ariaLabel}
+ aria-selected={selected}
+ tabIndex={clickable ? 0 : undefined}
+ onClick={onClick}
+ onKeyDown={
+ clickable
+ ? (e) => {
+ if (e.target !== e.currentTarget) return;
+ if (e.key === "Enter" || e.key === " ") {
+ e.preventDefault();
+ onClick?.();
+ }
+ }
+ : undefined
+ }
+ className={cn(
+ "group grid min-h-[44px] items-center gap-x-4 border-b border-border/70 px-3 py-2 transition-colors last:border-b-0",
+ clickable &&
+ "cursor-pointer hover:bg-sheen/[0.05] focus:outline-none focus-visible:bg-sheen/[0.06]",
+ selected && "bg-sheen/[0.06]",
+ className,
+ )}
+ style={{ gridTemplateColumns: gridTemplate(columns) }}
+ >
+ {children}
+ </div>
+ );
+}
+
+export function Cell({
+ children,
+ align,
+ className,
+ muted,
+ stop,
+}: {
+ children?: ReactNode;
+ align?: "left" | "right" | "center";
+ className?: string;
+ muted?: boolean;
+ /** Clicks inside this cell must not open the row (switches, buttons). */
+ stop?: boolean;
+}) {
+ return (
+ <div
+ role="cell"
+ onClick={stop ? (e) => e.stopPropagation() : undefined}
+ onKeyDown={stop ? (e) => e.stopPropagation() : undefined}
+ className={cn(
+ "min-w-0",
+ align === "right" && "flex justify-end text-right",
+ align === "center" && "flex justify-center text-center",
+ muted && "text-xs text-muted-foreground",
+ className,
+ )}
+ >
+ {children}
+ </div>
+ );
+}
+
+/** The empty-state block under a table: short, centred, dashed frame. */
+export function EmptyRow({ children }: { children: ReactNode }) {
+ return (
+ <div className="rounded-lg border border-dashed border-border px-6 py-10 text-center text-sm text-muted-foreground">
+ {children}
+ </div>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Detail page scaffolding
+// ---------------------------------------------------------------------------
+
+export function BackLink({ label, onClick }: { label: string; onClick: () => void }) {
+ return (
+ <button
+ type="button"
+ onClick={onClick}
+ className="inline-flex items-center gap-1.5 text-sm font-medium text-foreground/90 transition-colors hover:text-foreground"
+ >
+ <ArrowLeft className="h-4 w-4" />
+ {label}
+ </button>
+ );
+}
+
+export function DetailHeader({
+ leading,
+ title,
+ titleAccessory,
+ byline,
+ actions,
+}: {
+ leading?: ReactNode;
+ title: ReactNode;
+ titleAccessory?: ReactNode;
+ byline?: ReactNode;
+ actions?: ReactNode;
+}) {
+ return (
+ <div className="flex items-start justify-between gap-4">
+ <div className="flex min-w-0 items-start gap-3">
+ {leading}
+ <div className="min-w-0">
+ <div className="flex items-center gap-2">
+ <h3 className="truncate text-base font-semibold leading-tight">{title}</h3>
+ {titleAccessory}
+ </div>
+ {byline ? <p className="mt-0.5 text-xs text-muted-foreground">{byline}</p> : null}
+ </div>
+ </div>
+ {actions ? <div className="flex shrink-0 items-center gap-2">{actions}</div> : null}
+ </div>
+ );
+}
+
+/** A description that clamps to two lines with a "See more" toggle. */
+export function ClampedText({
+ text,
+ moreLabel,
+ lessLabel,
+ className,
+}: {
+ text: string;
+ moreLabel: string;
+ lessLabel: string;
+ className?: string;
+}) {
+ const [expanded, setExpanded] = useState(false);
+ const [overflows, setOverflows] = useState(false);
+ const ref = useRef<HTMLParagraphElement>(null);
+
+ useEffect(() => {
+ const el = ref.current;
+ if (!el) return;
+ // Measure once clamped; a text that fits needs no toggle.
+ setOverflows(el.scrollHeight > el.clientHeight + 1);
+ }, [text]);
+
+ if (!text) return null;
+ return (
+ <div className={cn("text-[13px] leading-relaxed text-foreground/85", className)}>
+ <p ref={ref} className={cn(!expanded && "line-clamp-2")}>
+ {text}
+ {expanded && overflows && (
+ <>
+ {" "}
+ <button
+ type="button"
+ onClick={() => setExpanded(false)}
+ className="text-primary hover:underline"
+ >
+ {lessLabel}
+ </button>
+ </>
+ )}
+ </p>
+ {!expanded && overflows && (
+ <button
+ type="button"
+ onClick={() => setExpanded(true)}
+ className="mt-0.5 text-xs text-primary hover:underline"
+ >
+ {moreLabel}
+ </button>
+ )}
+ </div>
+ );
+}
+
+/** Rounded card used for the file viewer and the fact sheets. */
+export function Panel({ children, className }: { children: ReactNode; className?: string }) {
+ return (
+ <div
+ className={cn(
+ "overflow-hidden rounded-xl border border-border bg-card/50",
+ className,
+ )}
+ >
+ {children}
+ </div>
+ );
+}
+
+/** Label/value rows — "License MIT", "Version 2.11.2". */
+export function FactRows({
+ rows,
+ className,
+}: {
+ rows: { label: string; value: ReactNode }[];
+ className?: string;
+}) {
+ const visible = rows.filter((r) => r.value !== null && r.value !== undefined && r.value !== "");
+ if (visible.length === 0) return null;
+ return (
+ <dl className={cn("grid grid-cols-[max-content_minmax(0,1fr)] gap-x-6 gap-y-2 text-sm", className)}>
+ {visible.map((r) => (
+ <div key={r.label} className="contents">
+ <dt className="text-xs leading-5 text-muted-foreground">{r.label}</dt>
+ <dd className="min-w-0 break-words leading-5">{r.value}</dd>
+ </div>
+ ))}
+ </dl>
+ );
+}
+
+/** Tiny coloured status dot + label. */
+export function StatusDot({
+ tone,
+ label,
+ pulse,
+}: {
+ tone: "ok" | "off" | "warn" | "error" | "busy";
+ label: ReactNode;
+ pulse?: boolean;
+}) {
+ const color = {
+ ok: "bg-emerald-500",
+ off: "bg-muted-foreground/40",
+ warn: "bg-amber-500",
+ error: "bg-destructive",
+ busy: "bg-primary",
+ }[tone];
+ return (
+ <span className="inline-flex items-center gap-2 text-xs text-muted-foreground">
+ <span className={cn("h-1.5 w-1.5 shrink-0 rounded-full", color, pulse && "animate-pulse")} />
+ <span className="truncate">{label}</span>
+ </span>
+ );
+}
+
+/** Short relative/absolute date for the "Last updated" column. */
+export function formatShortDate(iso: string | null | undefined, locale?: string): string {
+ if (!iso) return "—";
+ const d = new Date(iso);
+ if (Number.isNaN(d.getTime())) return "—";
+ try {
+ return new Intl.DateTimeFormat(locale, {
+ year: "2-digit",
+ month: "numeric",
+ day: "numeric",
+ }).format(d);
+ } catch {
+ return d.toISOString().slice(0, 10);
+ }
+}
+
+/** Inline search field that expands from the header's search icon. */
+export function InlineSearch({
+ value,
+ onChange,
+ placeholder,
+ autoFocus,
+}: {
+ value: string;
+ onChange: (v: string) => void;
+ placeholder: string;
+ autoFocus?: boolean;
+}) {
+ return (
+ <input
+ type="text"
+ value={value}
+ autoFocus={autoFocus}
+ onChange={(e) => onChange(e.target.value)}
+ placeholder={placeholder}
+ aria-label={placeholder}
+ className="h-8 w-full rounded-md border border-border bg-background/60 px-3 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary"
+ />
+ );
+}
+
+/** Segmented text filter — "All · Installed · Needs attention". */
+export function SegmentedFilter<T extends string>({
+ value,
+ onChange,
+ options,
+ label,
+}: {
+ value: T;
+ onChange: (v: T) => void;
+ options: { id: T; label: string; count?: number }[];
+ label: string;
+}) {
+ return (
+ <div role="tablist" aria-label={label} className="flex items-center gap-1">
+ {options.map((o) => {
+ const active = o.id === value;
+ return (
+ <button
+ key={o.id}
+ type="button"
+ role="tab"
+ aria-selected={active}
+ onClick={() => onChange(o.id)}
+ className={cn(
+ "inline-flex h-7 items-center gap-1.5 rounded-md px-2.5 text-xs transition-colors",
+ active
+ ? "bg-sheen/[0.08] font-medium text-foreground"
+ : "text-muted-foreground hover:text-foreground",
+ )}
+ >
+ {o.label}
+ {typeof o.count === "number" && (
+ <span className={cn("tabular-nums", active ? "text-muted-foreground" : "text-muted-foreground/60")}>
+ {o.count}
+ </span>
+ )}
+ </button>
+ );
+ })}
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/hooks/useSkills.ts b/jarvis/ui/web/frontend/src/hooks/useSkills.ts
index bcca530d2e..e7c2af33a3 100644
--- a/jarvis/ui/web/frontend/src/hooks/useSkills.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useSkills.ts
@@ -56,6 +56,9 @@ export interface SkillSummary {
portable?: boolean;
/** The frontmatter keys that adapter did not read. */
ignored_fields?: string[];
+ /** ISO stamp of the last SKILL.md write — the "Last updated" column. Absent
+ * on an older backend. */
+ updated_at?: string | null;
}
export interface SkillDetail extends SkillSummary {
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index ec05ec69ea..93636c0817 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -128,6 +128,8 @@
"applies_next_turn": "Gilt ab der nächsten Antwort deines Assistenten — kein Neustart nötig."
},
"extensions": {
+ "group_label": "Anpassen",
+ "attention_dot": "Ein Plugin muss neu verbunden werden",
"tab_skills": "Skills",
"tab_tools": "Tools"
},
@@ -724,7 +726,85 @@
"in_prefix": "in",
"due_now": "fällig"
},
+ "plugins_view": {
+ "title": "Plugins",
+ "count": "{n} verfügbar · {connected} verbunden",
+ "loading": "Katalog wird geladen…",
+ "unreachable": "Backend nicht erreichbar",
+ "search_placeholder": "Plugins suchen…",
+ "refresh": "Katalog aktualisieren",
+ "browse": "Durchsuchen",
+ "add": "Hinzufügen",
+ "add_upload": "Eigenes Plugin hochladen",
+ "add_community": "Aus dem Community-Marketplace",
+ "add_marketplace": "Marketplace öffnen",
+ "filter_label": "Anzeigen",
+ "filter_all": "Alle",
+ "filter_installed": "Installiert",
+ "filter_attention": "Braucht Aufmerksamkeit",
+ "all_categories": "Alle Kategorien",
+ "matches": "{n} Treffer",
+ "clear_filters": "Filter zurücksetzen",
+ "show_all": "Alle Plugins anzeigen",
+ "no_hits": "Kein Plugin passt zu den aktuellen Filtern.",
+ "empty": "Noch keine Plugins im Katalog.",
+ "not_found": "Dieses Plugin ist nicht mehr im Katalog.",
+ "col_plugin": "Plugin",
+ "col_category": "Kategorie",
+ "col_status": "Status",
+ "col_action": "Aktion",
+ "status_connected": "Verbunden",
+ "status_live": "Live",
+ "status_not_connected": "Nicht verbunden",
+ "status_reauth": "Neu verbinden nötig",
+ "status_error": "Fehler",
+ "connect": "Verbinden",
+ "reconnect": "Neu verbinden",
+ "disconnect": "Trennen",
+ "more_actions": "Weitere Aktionen",
+ "view_source": "Quelle ansehen",
+ "by": "von {publisher}",
+ "fact_signin": "Anmeldung",
+ "fact_connection": "Verbindung",
+ "fact_oauth_client": "OAuth-Client",
+ "oauth_client_own": "Dein eigener {family}-Client",
+ "oauth_client_placeholder": "Platzhalter-{family}-Client — beim Verbinden eigenen hinterlegen",
+ "fact_publisher": "Herausgeber",
+ "fact_source": "Quelle"
+ },
"skills_view": {
+ "count": "{n} Skills",
+ "col_skill": "Skill",
+ "col_updated": "Zuletzt geändert",
+ "col_author": "Autor",
+ "col_enabled": "Aktiv",
+ "col_actions": "Aktionen",
+ "author_you": "Du",
+ "author_builtin": "Integriert",
+ "by": "von {author}",
+ "browse": "Durchsuchen",
+ "add": "Hinzufügen",
+ "add_create": "Neuen Skill erstellen",
+ "add_upload": "Ordner oder Archiv hochladen",
+ "add_import": "Aus einem Link importieren",
+ "reload": "Skills neu laden",
+ "more_actions": "Weitere Aktionen",
+ "copy_path": "Pfad kopieren",
+ "path_copied": "Pfad kopiert",
+ "files_menu": "Dateien",
+ "file_one": "1 Datei",
+ "files": "{n} Dateien",
+ "view_mode": "Ansicht",
+ "view_preview": "Vorschau",
+ "view_source": "Quelltext",
+ "fact_state": "Status",
+ "fact_version": "Version",
+ "fact_category": "Kategorie",
+ "fact_license": "Lizenz",
+ "fact_tags": "Tags",
+ "fact_triggers": "Auslöser",
+ "searching": "Suche…",
+ "search_failed": "Suche fehlgeschlagen",
"title": "Skills",
"subtitle": "Eingebaute und User-Skills mit Voice- und Event-Triggern.",
"search_placeholder": "Skills durchsuchen…",
@@ -873,6 +953,37 @@
"no_results": "Keine Dokumente gefunden."
},
"mcps_view": {
+ "count": "{running} verbunden · {total} Server",
+ "search_placeholder": "Server suchen…",
+ "search_no_hits": "Kein Server passt.",
+ "add": "Hinzufügen",
+ "add_edit": "mcp.json bearbeiten",
+ "col_server": "Server",
+ "col_transport": "Transport",
+ "col_status": "Status",
+ "col_enabled": "Aktiv",
+ "tool_one": "1 Tool",
+ "tools": "{n} Tools",
+ "tools_heading": "Tools",
+ "no_tools": "Noch keine Tools aufgelistet — aktiviere den Server, um sie zu laden.",
+ "more_actions": "Weitere Aktionen",
+ "check": "Verbindung prüfen",
+ "check_ok": "Verbindung OK — {n} Tools",
+ "check_failed": "Verbindungsprüfung fehlgeschlagen",
+ "remove": "Server entfernen",
+ "remove_title": "MCP-Server entfernen?",
+ "remove_body": "Der Eintrag wird aus mcp.json entfernt. Ein integrierter Server fällt auf seinen Standard zurück und kann wieder aktiviert werden.",
+ "remove_confirm": "Entfernen",
+ "removed": "{name} entfernt",
+ "command": "Befehl",
+ "credentials": "Zugangsdaten",
+ "credentials_missing": "Fehlt: {list}",
+ "credentials_ok": "Vollständig",
+ "platform_notes": "Hinweise",
+ "origin": "Definiert in",
+ "origin_bootstrap": "Integrierter Standard",
+ "origin_config": "mcp.json",
+ "not_found": "Dieser Server wird nicht mehr aufgeführt.",
"title": "MCPs",
"subtitle": "Model-Context-Protocol-Server — externe Tools, die {name} aufrufen kann.",
"empty": "Keine MCP-Server konfiguriert.",
@@ -2105,6 +2216,8 @@
"reveal_in_folder": "Im Ordner anzeigen"
},
"common": {
+ "see_more": "Mehr anzeigen",
+ "see_less": "Weniger anzeigen",
"save": "Save",
"cancel": "Abbrechen",
"loading": "Lädt…",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index d732345f02..cfa39b4d57 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -128,6 +128,8 @@
"applies_next_turn": "Applies on your assistant's next message — no restart needed."
},
"extensions": {
+ "group_label": "Customize",
+ "attention_dot": "A plugin needs reconnecting",
"tab_skills": "Skills",
"tab_tools": "Tools"
},
@@ -724,7 +726,85 @@
"in_prefix": "in",
"due_now": "due"
},
+ "plugins_view": {
+ "title": "Plugins",
+ "count": "{n} available · {connected} connected",
+ "loading": "Loading catalog…",
+ "unreachable": "Backend unreachable",
+ "search_placeholder": "Search plugins…",
+ "refresh": "Refresh catalog",
+ "browse": "Browse",
+ "add": "Add",
+ "add_upload": "Upload your own plugin",
+ "add_community": "From the community marketplace",
+ "add_marketplace": "Open the Marketplace",
+ "filter_label": "Show",
+ "filter_all": "All",
+ "filter_installed": "Installed",
+ "filter_attention": "Needs attention",
+ "all_categories": "All categories",
+ "matches": "{n} matches",
+ "clear_filters": "Clear filters",
+ "show_all": "Show all plugins",
+ "no_hits": "No plugin matches the current filters.",
+ "empty": "No plugins in the catalog yet.",
+ "not_found": "This plugin is no longer in the catalog.",
+ "col_plugin": "Plugin",
+ "col_category": "Category",
+ "col_status": "Status",
+ "col_action": "Action",
+ "status_connected": "Connected",
+ "status_live": "Live",
+ "status_not_connected": "Not connected",
+ "status_reauth": "Reconnect needed",
+ "status_error": "Error",
+ "connect": "Connect",
+ "reconnect": "Reconnect",
+ "disconnect": "Disconnect",
+ "more_actions": "More actions",
+ "view_source": "View source",
+ "by": "by {publisher}",
+ "fact_signin": "Sign-in",
+ "fact_connection": "Connection",
+ "fact_oauth_client": "OAuth client",
+ "oauth_client_own": "Your own {family} client",
+ "oauth_client_placeholder": "Placeholder {family} client — add your own when connecting",
+ "fact_publisher": "Publisher",
+ "fact_source": "Source"
+ },
"skills_view": {
+ "count": "{n} skills",
+ "col_skill": "Skill",
+ "col_updated": "Last updated",
+ "col_author": "Author",
+ "col_enabled": "Enabled",
+ "col_actions": "Actions",
+ "author_you": "You",
+ "author_builtin": "Built-in",
+ "by": "by {author}",
+ "browse": "Browse",
+ "add": "Add",
+ "add_create": "Create a new skill",
+ "add_upload": "Upload a folder or archive",
+ "add_import": "Import from a link",
+ "reload": "Reload skills",
+ "more_actions": "More actions",
+ "copy_path": "Copy path",
+ "path_copied": "Path copied",
+ "files_menu": "Files",
+ "file_one": "1 file",
+ "files": "{n} files",
+ "view_mode": "View",
+ "view_preview": "Preview",
+ "view_source": "Source",
+ "fact_state": "Status",
+ "fact_version": "Version",
+ "fact_category": "Category",
+ "fact_license": "License",
+ "fact_tags": "Tags",
+ "fact_triggers": "Triggers",
+ "searching": "Searching…",
+ "search_failed": "Search failed",
"title": "Skills",
"subtitle": "Built-in and user skills with voice and event triggers.",
"search_placeholder": "Search skills…",
@@ -873,6 +953,37 @@
"no_results": "No documents found."
},
"mcps_view": {
+ "count": "{running} connected · {total} servers",
+ "search_placeholder": "Search servers…",
+ "search_no_hits": "No server matches.",
+ "add": "Add",
+ "add_edit": "Edit mcp.json",
+ "col_server": "Server",
+ "col_transport": "Transport",
+ "col_status": "Status",
+ "col_enabled": "Enabled",
+ "tool_one": "1 tool",
+ "tools": "{n} tools",
+ "tools_heading": "Tools",
+ "no_tools": "No tools listed yet — enable the server to load them.",
+ "more_actions": "More actions",
+ "check": "Check connection",
+ "check_ok": "connection OK — {n} tools",
+ "check_failed": "connection check failed",
+ "remove": "Remove server",
+ "remove_title": "Remove MCP server?",
+ "remove_body": "The entry is removed from mcp.json. A built-in server falls back to its default and can be enabled again.",
+ "remove_confirm": "Remove",
+ "removed": "{name} removed",
+ "command": "Command",
+ "credentials": "Credentials",
+ "credentials_missing": "Missing: {list}",
+ "credentials_ok": "Complete",
+ "platform_notes": "Notes",
+ "origin": "Defined in",
+ "origin_bootstrap": "Built-in default",
+ "origin_config": "mcp.json",
+ "not_found": "This server is no longer listed.",
"title": "MCPs",
"subtitle": "Model Context Protocol servers — external tools {name} can call.",
"empty": "No MCP servers configured.",
@@ -2105,6 +2216,8 @@
"reveal_in_folder": "Reveal in folder"
},
"common": {
+ "see_more": "See more",
+ "see_less": "See less",
"save": "Save",
"cancel": "Cancel",
"loading": "Loading…",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index b215904794..543c870ad4 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -128,6 +128,8 @@
"applies_next_turn": "Se aplica en el próximo mensaje de tu asistente — sin reinicio."
},
"extensions": {
+ "group_label": "Personalizar",
+ "attention_dot": "Un plugin necesita reconectarse",
"tab_skills": "Habilidades",
"tab_tools": "Herramientas"
},
@@ -724,7 +726,85 @@
"in_prefix": "en",
"due_now": "pendiente"
},
+ "plugins_view": {
+ "title": "Plugins",
+ "count": "{n} disponibles · {connected} conectados",
+ "loading": "Cargando el catálogo…",
+ "unreachable": "Backend no disponible",
+ "search_placeholder": "Buscar plugins…",
+ "refresh": "Actualizar catálogo",
+ "browse": "Explorar",
+ "add": "Añadir",
+ "add_upload": "Subir tu propio plugin",
+ "add_community": "Desde el marketplace de la comunidad",
+ "add_marketplace": "Abrir el Marketplace",
+ "filter_label": "Mostrar",
+ "filter_all": "Todos",
+ "filter_installed": "Instalados",
+ "filter_attention": "Requieren atención",
+ "all_categories": "Todas las categorías",
+ "matches": "{n} coincidencias",
+ "clear_filters": "Quitar filtros",
+ "show_all": "Mostrar todos los plugins",
+ "no_hits": "Ningún plugin coincide con los filtros actuales.",
+ "empty": "Aún no hay plugins en el catálogo.",
+ "not_found": "Este plugin ya no está en el catálogo.",
+ "col_plugin": "Plugin",
+ "col_category": "Categoría",
+ "col_status": "Estado",
+ "col_action": "Acción",
+ "status_connected": "Conectado",
+ "status_live": "En vivo",
+ "status_not_connected": "No conectado",
+ "status_reauth": "Requiere reconexión",
+ "status_error": "Error",
+ "connect": "Conectar",
+ "reconnect": "Reconectar",
+ "disconnect": "Desconectar",
+ "more_actions": "Más acciones",
+ "view_source": "Ver fuente",
+ "by": "de {publisher}",
+ "fact_signin": "Inicio de sesión",
+ "fact_connection": "Conexión",
+ "fact_oauth_client": "Cliente OAuth",
+ "oauth_client_own": "Tu propio cliente de {family}",
+ "oauth_client_placeholder": "Cliente de {family} provisional — añade el tuyo al conectar",
+ "fact_publisher": "Editor",
+ "fact_source": "Origen"
+ },
"skills_view": {
+ "count": "{n} skills",
+ "col_skill": "Skill",
+ "col_updated": "Última modificación",
+ "col_author": "Autor",
+ "col_enabled": "Activo",
+ "col_actions": "Acciones",
+ "author_you": "Tú",
+ "author_builtin": "Integrado",
+ "by": "de {author}",
+ "browse": "Explorar",
+ "add": "Añadir",
+ "add_create": "Crear un skill nuevo",
+ "add_upload": "Subir una carpeta o un archivo",
+ "add_import": "Importar desde un enlace",
+ "reload": "Recargar skills",
+ "more_actions": "Más acciones",
+ "copy_path": "Copiar ruta",
+ "path_copied": "Ruta copiada",
+ "files_menu": "Archivos",
+ "file_one": "1 archivo",
+ "files": "{n} archivos",
+ "view_mode": "Vista",
+ "view_preview": "Vista previa",
+ "view_source": "Código",
+ "fact_state": "Estado",
+ "fact_version": "Versión",
+ "fact_category": "Categoría",
+ "fact_license": "Licencia",
+ "fact_tags": "Etiquetas",
+ "fact_triggers": "Disparadores",
+ "searching": "Buscando…",
+ "search_failed": "La búsqueda falló",
"title": "Habilidades",
"subtitle": "Habilidades incorporadas y de usuario con disparadores de voz y eventos.",
"search_placeholder": "Buscar habilidades…",
@@ -873,6 +953,37 @@
"no_results": "No se encontraron documentos."
},
"mcps_view": {
+ "count": "{running} conectados · {total} servidores",
+ "search_placeholder": "Buscar servidores…",
+ "search_no_hits": "Ningún servidor coincide.",
+ "add": "Añadir",
+ "add_edit": "Editar mcp.json",
+ "col_server": "Servidor",
+ "col_transport": "Transporte",
+ "col_status": "Estado",
+ "col_enabled": "Activo",
+ "tool_one": "1 herramienta",
+ "tools": "{n} herramientas",
+ "tools_heading": "Herramientas",
+ "no_tools": "Aún no hay herramientas — activa el servidor para cargarlas.",
+ "more_actions": "Más acciones",
+ "check": "Comprobar conexión",
+ "check_ok": "conexión correcta — {n} herramientas",
+ "check_failed": "la comprobación falló",
+ "remove": "Eliminar servidor",
+ "remove_title": "¿Eliminar el servidor MCP?",
+ "remove_body": "La entrada se elimina de mcp.json. Un servidor integrado vuelve a su valor por defecto y puede activarse de nuevo.",
+ "remove_confirm": "Eliminar",
+ "removed": "{name} eliminado",
+ "command": "Comando",
+ "credentials": "Credenciales",
+ "credentials_missing": "Faltan: {list}",
+ "credentials_ok": "Completas",
+ "platform_notes": "Notas",
+ "origin": "Definido en",
+ "origin_bootstrap": "Valor integrado",
+ "origin_config": "mcp.json",
+ "not_found": "Este servidor ya no aparece en la lista.",
"title": "MCPs",
"subtitle": "Servidores Model Context Protocol — herramientas externas que {name} puede invocar.",
"empty": "Ningún servidor MCP configurado.",
@@ -2105,6 +2216,8 @@
"reveal_in_folder": "Mostrar en la carpeta"
},
"common": {
+ "see_more": "Ver más",
+ "see_less": "Ver menos",
"save": "Guardar",
"cancel": "Cancelar",
"loading": "Cargando…",
diff --git a/jarvis/ui/web/frontend/src/views/ExtensionsView.tsx b/jarvis/ui/web/frontend/src/views/ExtensionsView.tsx
index 579e843416..c1a52f6334 100644
--- a/jarvis/ui/web/frontend/src/views/ExtensionsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/ExtensionsView.tsx
@@ -1,52 +1,100 @@
-import { useEventStore } from "@/store/events";
-import { SectionTabBar, type SectionTab } from "@/components/layout/SectionTabBar";
+import { Blocks, Cable, Sparkles, type LucideIcon } from "lucide-react";
+import { useEventStore, type SectionId } from "@/store/events";
+import { usePluginAttention } from "@/hooks/usePluginAttention";
+import { useT } from "@/i18n";
+import { cn } from "@/lib/utils";
import { SkillsView } from "@/views/SkillsView";
import { PluginsView } from "@/views/PluginsView";
import { McpsView } from "@/views/McpsView";
/**
- * Combined "Skills & Tools" section (sidebar label "Skills & Tools").
+ * Combined "Skills, Plugins & MCPs" section.
*
- * Merges the three sidebar entries — Skills, Plugins and MCPs — behind a single
- * sidebar entry with one flat top tab bar:
- *
- * [ Skills ] [ Plugins ] [ MCPs ]
- *
- * CLIs were split out into their own "CLIs" section (see ClisHubView), which
- * pairs the CLIs list with the CLI Test Hub.
+ * One settings-style surface: a narrow navigation column on the left (the
+ * three areas under one "Customize" heading) and the chosen area on the right.
+ * Each area is a quiet table — name, a couple of facts, an on/off switch — and
+ * opens a detail page in place when a row is clicked.
*
* Design note — why this is a thin wrapper, not a rewrite:
* The active sidebar section id (`activeSection` in the event store) *is* the
- * tab state. We deliberately keep the section ids (`skills`, `plugins`, `mcps`)
- * alive in the five-layer nav enum — see `jarvis/plugins/tool/navigate.py` +
- * `store/events.ts` + the parity test `tests/unit/plugins/tool/test_navigate.py`.
- * Only the *sidebar presentation* collapses to one entry; routing, deep-links
- * and voice navigation ("öffne Plugins") keep working unchanged and land on the i18n-allow
- * right tab. The child views are embedded verbatim — they rehydrate their own
- * state from React Query / the store, so the unmount/remount on tab switch is
- * harmless.
+ * navigation state. We deliberately keep the section ids (`skills`, `plugins`,
+ * `mcps`) alive in the five-layer nav enum — see `jarvis/plugins/tool/navigate.py`
+ * + `store/events.ts` + the parity test `tests/unit/plugins/tool/test_navigate.py`.
+ * Only the *presentation* collapses to one entry; routing, deep-links and voice
+ * navigation ("öffne Plugins") keep working unchanged and land on the i18n-allow
+ * right area. The child views rehydrate their own state from React Query / the
+ * store, so the unmount/remount on a switch is harmless.
*
- * The file/component name stays `ExtensionsView` for continuity; only the
- * user-facing label is "Skills & Tools".
+ * The file/component name stays `ExtensionsView` for continuity.
*/
-const TABS = [
- { id: "skills", labelKey: "nav.skills" },
- { id: "plugins", labelKey: "nav.plugins" },
- { id: "mcps", labelKey: "nav.mcps" },
-] as const satisfies readonly SectionTab[];
+interface AreaSpec {
+ id: SectionId;
+ labelKey: string;
+ icon: LucideIcon;
+}
+
+const AREAS = [
+ { id: "skills", labelKey: "nav.skills", icon: Sparkles },
+ { id: "plugins", labelKey: "nav.plugins", icon: Blocks },
+ { id: "mcps", labelKey: "nav.mcps", icon: Cable },
+] as const satisfies readonly AreaSpec[];
+
+type AreaId = (typeof AREAS)[number]["id"];
export function ExtensionsView() {
+ const t = useT();
const active = useEventStore((s) => s.activeSection);
+ const setActive = useEventStore((s) => s.setActiveSection);
+ const attention = usePluginAttention();
// The router only mounts us for skills/plugins/mcps; any other value is
- // unexpected — fall back to the Skills tab defensively.
- const current = TABS.some((tab) => tab.id === active) ? active : "skills";
+ // unexpected — fall back to Skills defensively.
+ const current: AreaId = AREAS.some((a) => a.id === active) ? (active as AreaId) : "skills";
return (
- <div className="flex h-full flex-col">
- <SectionTabBar tabs={TABS} />
- <div className="min-h-0 flex-1 overflow-hidden">
+ <div className="flex h-full min-h-0">
+ <nav
+ aria-label={t("extensions.group_label")}
+ className="flex w-[200px] shrink-0 flex-col border-r border-border px-3 py-5"
+ >
+ <p className="px-2.5 pb-2 text-[11px] font-medium text-muted-foreground">
+ {t("extensions.group_label")}
+ </p>
+ <ul className="space-y-0.5">
+ {AREAS.map((area) => {
+ const Icon = area.icon;
+ const isActive = area.id === current;
+ const dot = area.id === "plugins" && attention.count > 0;
+ return (
+ <li key={area.id}>
+ <button
+ type="button"
+ onClick={() => setActive(area.id)}
+ aria-current={isActive ? "page" : undefined}
+ className={cn(
+ "flex w-full items-center gap-2.5 rounded-md px-2.5 py-1.5 text-left text-[13px] transition-colors",
+ isActive
+ ? "bg-sheen/[0.08] font-medium text-foreground"
+ : "text-foreground/75 hover:bg-sheen/[0.05] hover:text-foreground",
+ )}
+ >
+ <Icon className={cn("h-4 w-4 shrink-0", isActive ? "text-foreground" : "text-muted-foreground")} />
+ <span className="flex-1 truncate">{t(area.labelKey)}</span>
+ {dot && (
+ <span
+ aria-label={t("extensions.attention_dot")}
+ title={t("extensions.attention_dot")}
+ className="h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500"
+ />
+ )}
+ </button>
+ </li>
+ );
+ })}
+ </ul>
+ </nav>
+ <div className="min-h-0 min-w-0 flex-1">
{current === "skills" && <SkillsView />}
{current === "plugins" && <PluginsView />}
{current === "mcps" && <McpsView />}
diff --git a/jarvis/ui/web/frontend/src/views/MarketplaceOrigin.test.tsx b/jarvis/ui/web/frontend/src/views/MarketplaceOrigin.test.tsx
index 3dcd660ea2..bf99b38b15 100644
--- a/jarvis/ui/web/frontend/src/views/MarketplaceOrigin.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/MarketplaceOrigin.test.tsx
@@ -82,9 +82,9 @@ describe("an installed community plugin is findable", () => {
);
// The shipped catalog is always "available", so a community plugin that
- // only showed up in Browse was indistinguishable from the ones the app
- // came with — Installed is where somebody looks for what they added.
- const installedTab = await screen.findByRole("button", { name: /^Installed\b/i });
+ // only showed up in the full list was indistinguishable from the ones the
+ // app came with — Installed is where somebody looks for what they added.
+ const installedTab = await screen.findByRole("tab", { name: /^Installed\b/i });
await waitFor(() => {
expect(installedTab.textContent).toContain("1");
});
diff --git a/jarvis/ui/web/frontend/src/views/McpsView.test.tsx b/jarvis/ui/web/frontend/src/views/McpsView.test.tsx
new file mode 100644
index 0000000000..6c7b59d5bf
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/McpsView.test.tsx
@@ -0,0 +1,163 @@
+/**
+ * Component tests for the MCPs area: a table of servers with an on/off switch
+ * per row, and a detail page (opened from a row) that lists the server's tools
+ * and offers the connection check.
+ */
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+
+import { McpsView } from "@/views/McpsView";
+import { setUiLanguage } from "@/i18n";
+
+interface Call {
+ url: string;
+ method: string;
+}
+
+const SERVERS = {
+ servers: [
+ {
+ name: "notebooklm-mcp",
+ display: "NotebookLM",
+ description: "Notebooks, sources and overviews.",
+ transport: "stdio",
+ mandatory: false,
+ required_auth: [],
+ credentials_status: {},
+ credentials_complete: true,
+ platform_notes: "",
+ install_command: ["python", "-m", "notebooklm_mcp.server"],
+ is_bootstrap: false,
+ enabled: true,
+ status: "running",
+ tools: [
+ { name: "notebook_list", description: "List all notebooks." },
+ { name: "notebook_get", description: "Get one notebook." },
+ ],
+ error: null,
+ },
+ {
+ name: "context7",
+ display: "Context7",
+ description: "Library docs.",
+ transport: "stdio",
+ mandatory: false,
+ required_auth: [],
+ credentials_status: {},
+ credentials_complete: true,
+ platform_notes: "",
+ install_command: ["npx", "context7"],
+ is_bootstrap: true,
+ enabled: false,
+ status: "stopped",
+ tools: [],
+ error: null,
+ },
+ ],
+ total: 2,
+ running: 1,
+ registry_ready: true,
+};
+
+function installFetchMock(): Call[] {
+ const calls: Call[] = [];
+ const fetchMock = vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => {
+ const url = String(input);
+ const method = (init?.method ?? "GET").toUpperCase();
+ calls.push({ url, method });
+ const respond = (body: unknown) =>
+ ({
+ ok: true,
+ status: 200,
+ json: async () => body,
+ text: async () => JSON.stringify(body),
+ }) as Response;
+ if (method === "GET" && url === "/api/mcps") return respond(SERVERS);
+ if (method === "POST" && url.endsWith("/disable")) return respond({ ok: true, enabled: false });
+ if (method === "POST" && url.endsWith("/enable")) return respond({ ok: true, enabled: true });
+ if (method === "POST" && url.endsWith("/check")) {
+ return respond({ ok: true, tools_count: 2, error: null });
+ }
+ throw new Error(`unexpected fetch ${method} ${url}`);
+ });
+ (globalThis as unknown as { fetch: typeof fetch }).fetch =
+ fetchMock as unknown as typeof fetch;
+ return calls;
+}
+
+function renderView() {
+ const qc = new QueryClient({
+ defaultOptions: { queries: { retry: false }, mutations: { retry: false } },
+ });
+ return render(
+ <QueryClientProvider client={qc}>
+ <McpsView />
+ </QueryClientProvider>,
+ );
+}
+
+beforeEach(() => setUiLanguage("en"));
+afterEach(() => {
+ cleanup();
+ vi.restoreAllMocks();
+});
+
+describe("McpsView — table", () => {
+ it("lists every server as a row with its switch state", async () => {
+ installFetchMock();
+ renderView();
+
+ await screen.findByRole("row", { name: "notebooklm-mcp" });
+ expect(screen.getByRole("row", { name: "context7" })).toBeTruthy();
+
+ const switches = screen.getAllByRole("switch");
+ expect(switches).toHaveLength(2);
+ expect(switches[0].getAttribute("aria-checked")).toBe("true");
+ expect(switches[1].getAttribute("aria-checked")).toBe("false");
+ // The running server states its tool count right in the row.
+ expect(screen.getByText("2 tools")).toBeTruthy();
+ });
+
+ it("flipping a switch calls the enable/disable endpoint", async () => {
+ const calls = installFetchMock();
+ renderView();
+
+ await screen.findByRole("row", { name: "notebooklm-mcp" });
+ fireEvent.click(screen.getAllByRole("switch")[0]);
+
+ await waitFor(() => {
+ expect(
+ calls.some((c) => c.method === "POST" && c.url.endsWith("/api/mcps/notebooklm-mcp/disable")),
+ ).toBe(true);
+ });
+ });
+});
+
+describe("McpsView — detail page", () => {
+ it("opens from a row, lists the tools and runs the connection check", async () => {
+ const calls = installFetchMock();
+ renderView();
+
+ fireEvent.click(await screen.findByRole("row", { name: "notebooklm-mcp" }));
+
+ // Back link + the tool list from the wire payload.
+ await screen.findByRole("button", { name: "MCPs" });
+ expect(screen.getByText("notebook_list")).toBeTruthy();
+ expect(screen.getByText("notebook_get")).toBeTruthy();
+ expect(screen.getByText("python -m notebooklm_mcp.server")).toBeTruthy();
+
+ // The overflow menu carries the connection check.
+ fireEvent.click(screen.getByRole("button", { name: "More actions" }));
+ fireEvent.click(screen.getByRole("menuitem", { name: "Check connection" }));
+ await waitFor(() => {
+ expect(
+ calls.some((c) => c.method === "POST" && c.url.endsWith("/api/mcps/notebooklm-mcp/check")),
+ ).toBe(true);
+ });
+
+ // Back returns to the table.
+ fireEvent.click(screen.getByRole("button", { name: "MCPs" }));
+ await screen.findByRole("row", { name: "context7" });
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/views/McpsView.tsx b/jarvis/ui/web/frontend/src/views/McpsView.tsx
index 934b5d9bfc..be665f7612 100644
--- a/jarvis/ui/web/frontend/src/views/McpsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/McpsView.tsx
@@ -1,29 +1,67 @@
-import { useState } from "react";
+import { useMemo, useState } from "react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import {
- Plug,
FileJson,
X,
Copy,
RefreshCw,
+ Search,
+ Download,
+ MoreHorizontal,
+ Trash2,
+ Activity,
+ Cable,
} from "lucide-react";
-import { ViewHeader } from "@/views/ChatsView";
import { ScrollArea } from "@/components/ui/scroll-area";
import { Switch } from "@/components/ui/switch";
import { Button } from "@/components/ui/button";
+import {
+ ActionMenu,
+ BackLink,
+ Cell,
+ ClampedText,
+ DetailHeader,
+ EmptyRow,
+ FactRows,
+ IconButton,
+ InlineSearch,
+ MenuPill,
+ Panel,
+ PanelHeader,
+ StatusDot,
+ Table,
+ TableHead,
+ TableRow,
+ type Column,
+} from "@/components/extensions/primitives";
import { useEventStore } from "@/store/events";
import { robustCopy } from "@/lib/clipboard";
-import { cn } from "@/lib/utils";
-import { useT } from "@/i18n";
+import { fill, useT } from "@/i18n";
+
+// ---------------------------------------------------------------------------
+// Wire types — mirror /api/mcps
+// ---------------------------------------------------------------------------
+
+interface McpTool {
+ name: string;
+ description: string;
+}
interface McpServer {
name: string;
display: string;
+ description?: string;
+ transport?: string;
+ mandatory?: boolean;
+ platform_notes?: string;
+ install_command?: string[];
+ is_bootstrap?: boolean;
enabled: boolean;
status: "running" | "stopped" | "not-initialized";
error: string | null;
- tools: { name: string; description: string }[];
+ tools: McpTool[];
credentials_complete: boolean;
+ credentials_status?: Record<string, boolean>;
required_auth: string[];
}
@@ -57,49 +95,44 @@ async function postJson<T>(
return res.json();
}
-type StatusLabel = string;
-
-function statusOf(server: McpServer, pending: boolean, t: (k: string) => string): {
- label: StatusLabel;
- color: string;
- dotClass: string;
-} {
- if (pending) {
- return {
- label: t("mcps_view.status.checking"),
- color: "text-muted-foreground",
- dotClass: "bg-muted-foreground animate-jarvis-pulse",
- };
- }
- if (server.error) {
- return {
- label: t("mcps_view.status.error"),
- color: "text-destructive",
- dotClass: "bg-destructive",
- };
- }
+type Tone = "ok" | "off" | "warn" | "error" | "busy";
+
+function statusOf(
+ server: McpServer,
+ pending: boolean,
+ t: (k: string) => string,
+): { label: string; tone: Tone } {
+ if (pending) return { label: t("mcps_view.status.checking"), tone: "busy" };
+ if (server.error) return { label: t("common.error"), tone: "error" };
if (server.status === "running" && server.enabled) {
- return {
- label: t("mcps_view.status.connected"),
- color: "text-primary",
- dotClass: "bg-primary shadow-[0_0_8px_rgba(255,214,10,0.6)]",
- };
+ return { label: t("mcps_view.connected"), tone: "ok" };
}
- return {
- label: t("mcps_view.status.disconnected"),
- color: "text-muted-foreground",
- dotClass: "bg-muted-foreground/40",
- };
+ if (!server.credentials_complete) {
+ return { label: t("mcps_view.credentials_incomplete"), tone: "warn" };
+ }
+ return { label: t("mcps_view.disconnected"), tone: "off" };
}
+function toolCountLabel(n: number, t: (k: string) => string): string {
+ return n === 1 ? t("mcps_view.tool_one") : fill(t("mcps_view.tools"), { n });
+}
+
+// ---------------------------------------------------------------------------
+// View
+// ---------------------------------------------------------------------------
+
export function McpsView() {
const t = useT();
const qc = useQueryClient();
const pushToast = useEventStore((s) => s.pushToast);
const [showConfig, setShowConfig] = useState(false);
const [checkingName, setCheckingName] = useState<string | null>(null);
+ const [selected, setSelected] = useState<string | null>(null);
+ const [searchOpen, setSearchOpen] = useState(false);
+ const [query, setQuery] = useState("");
+ const [confirmRemove, setConfirmRemove] = useState<McpServer | null>(null);
- const { data, isLoading, error, refetch } = useQuery({
+ const { data, isLoading, error, refetch, isFetching } = useQuery({
queryKey: ["mcps"],
queryFn: fetchMcps,
refetchInterval: 5_000,
@@ -133,7 +166,9 @@ export function McpsView() {
if (res.ok) {
pushToast(
"success",
- vars.enable ? t("mcps_toast.connected").replace("{0}", vars.name) : `${vars.name} ${t("mcps_view.disconnected").toLowerCase()}`,
+ vars.enable
+ ? t("mcps_toast.connected").replace("{0}", vars.name)
+ : `${vars.name} ${t("mcps_view.disconnected").toLowerCase()}`,
);
} else if (res.error) {
pushToast("error", `${vars.name}: ${res.error}`);
@@ -144,179 +179,482 @@ export function McpsView() {
},
});
+ const check = useMutation({
+ mutationFn: async (name: string) => {
+ setCheckingName(name);
+ return postJson<{ ok: boolean; tools_count: number; error: string | null }>(
+ `/api/mcps/${name}/check`,
+ );
+ },
+ onSettled: () => setCheckingName(null),
+ onSuccess: (res, name) => {
+ qc.invalidateQueries({ queryKey: ["mcps"] });
+ if (res.ok) {
+ pushToast("success", `${name}: ${fill(t("mcps_view.check_ok"), { n: res.tools_count })}`);
+ } else {
+ pushToast("error", `${name}: ${res.error ?? t("mcps_view.check_failed")}`);
+ }
+ },
+ onError: (err, name) => {
+ pushToast("error", `${name}: ${(err as Error).message}`);
+ },
+ });
+
+ const remove = useMutation({
+ mutationFn: async (name: string) =>
+ postJson<{ ok: boolean; removed?: boolean }>(`/api/mcps/${name}`, undefined, "DELETE"),
+ onSuccess: (_res, name) => {
+ qc.invalidateQueries({ queryKey: ["mcps"] });
+ setConfirmRemove(null);
+ if (selected === name) setSelected(null);
+ pushToast("success", fill(t("mcps_view.removed"), { name }));
+ },
+ onError: (err, name) => {
+ pushToast("error", `${name}: ${(err as Error).message}`);
+ },
+ });
+
const servers = data?.servers ?? [];
+ const visible = useMemo(() => {
+ const q = query.trim().toLowerCase();
+ if (!q) return servers;
+ return servers.filter((s) =>
+ [s.name, s.display, s.description ?? "", s.transport ?? ""].join(" ").toLowerCase().includes(q),
+ );
+ }, [servers, query]);
- return (
- <div className="flex h-full flex-col">
- <ViewHeader
- icon={<Plug className="h-4 w-4 text-primary" />}
- title={t("mcps_view.title")}
- subtitle={
- data
- ? `${data.running} ${t("mcps_view.connected")} · ${data.total}`
- : t("common.loading")
- }
- right={
- <div className="flex items-center gap-1">
- <Button
- size="sm"
- variant="ghost"
- onClick={() => setShowConfig(true)}
- title={t("mcps_view.edit_tooltip")}
- >
- <FileJson className="h-3.5 w-3.5" />
- <span className="ml-1.5 text-xs">mcp.json</span>
- </Button>
- <Button
- size="sm"
- variant="ghost"
- onClick={() => refetch()}
- title={t("mcps_view.reload_tooltip")}
- >
- <RefreshCw className="h-3.5 w-3.5" />
- </Button>
+ const closeSearch = () => {
+ setQuery("");
+ setSearchOpen(false);
+ };
+
+ const dialogs = (
+ <>
+ {showConfig && <ConfigModal onClose={() => setShowConfig(false)} />}
+ {confirmRemove && (
+ <RemoveConfirmDialog
+ server={confirmRemove}
+ pending={remove.isPending}
+ onCancel={() => setConfirmRemove(null)}
+ onConfirm={() => remove.mutate(confirmRemove.name)}
+ />
+ )}
+ </>
+ );
+
+ // ---- Detail page -------------------------------------------------------
+ const current = selected ? servers.find((s) => s.name === selected) ?? null : null;
+ if (selected) {
+ return (
+ <div className="flex h-full min-h-0 flex-col">
+ <ScrollArea className="flex-1">
+ <div className="mx-auto w-full max-w-4xl px-8 py-6">
+ <BackLink label={t("mcps_view.title")} onClick={() => setSelected(null)} />
+ {current ? (
+ <McpDetail
+ server={current}
+ pending={checkingName === current.name}
+ onToggle={(enable) => toggle.mutate({ name: current.name, enable })}
+ onCheck={() => check.mutate(current.name)}
+ onRemove={() => setConfirmRemove(current)}
+ onEditConfig={() => setShowConfig(true)}
+ />
+ ) : (
+ <div className="mt-6 text-sm text-muted-foreground">
+ {isLoading ? t("common.loading") : t("mcps_view.not_found")}
+ </div>
+ )}
</div>
- }
- />
+ </ScrollArea>
+ {dialogs}
+ </div>
+ );
+ }
+
+ // ---- List page ---------------------------------------------------------
+ const columns: Column[] = [
+ { id: "name", label: t("mcps_view.col_server") },
+ { id: "transport", label: t("mcps_view.col_transport"), width: "96px" },
+ { id: "status", label: t("mcps_view.col_status"), width: "150px" },
+ { id: "enabled", label: t("mcps_view.col_enabled"), width: "44px", srOnly: true, align: "right" },
+ ];
+
+ const subtitle =
+ !isLoading && !error
+ ? fill(t("mcps_view.count"), { running: data?.running ?? 0, total: data?.total ?? 0 })
+ : undefined;
+ return (
+ <div className="flex h-full min-h-0 flex-col">
<ScrollArea className="flex-1">
- <div className="p-6">
- {isLoading && (
- <div className="text-sm text-muted-foreground">{t("common.loading")}</div>
- )}
+ <div className="mx-auto w-full max-w-4xl px-8 py-6">
+ <PanelHeader
+ title={t("mcps_view.title")}
+ subtitle={subtitle}
+ actions={
+ <>
+ <IconButton
+ label={t("mcps_view.search_placeholder")}
+ active={searchOpen}
+ onClick={() => (searchOpen ? closeSearch() : setSearchOpen(true))}
+ >
+ <Search className="h-4 w-4" />
+ </IconButton>
+ <IconButton
+ label={t("mcps_view.reload_tooltip")}
+ onClick={() => void refetch()}
+ busy={isFetching && !data}
+ >
+ <RefreshCw className="h-4 w-4" />
+ </IconButton>
+ <IconButton label={t("mcps_view.edit_tooltip")} onClick={() => setShowConfig(true)} className="ml-1">
+ <FileJson className="h-4 w-4" />
+ </IconButton>
+ <ActionMenu
+ label={t("mcps_view.add")}
+ actions={[
+ {
+ id: "import",
+ label: t("mcps_view.import_claude"),
+ icon: <Download className="h-3.5 w-3.5" />,
+ disabled: importClaude.isPending,
+ onSelect: () => importClaude.mutate(),
+ },
+ {
+ id: "edit",
+ label: t("mcps_view.add_edit"),
+ icon: <FileJson className="h-3.5 w-3.5" />,
+ onSelect: () => setShowConfig(true),
+ },
+ ]}
+ trigger={({ open, toggle: toggleMenu }) => (
+ <MenuPill open={open} toggle={toggleMenu}>
+ {t("mcps_view.add")}
+ </MenuPill>
+ )}
+ />
+ </>
+ }
+ />
- {error && (
- <div className="rounded-lg border border-destructive/40 bg-destructive/10 p-4 text-sm text-destructive">
- {(error as Error).message}
+ {searchOpen && (
+ <div className="mt-4 flex items-center gap-2">
+ <div className="flex-1">
+ <InlineSearch
+ value={query}
+ onChange={setQuery}
+ placeholder={t("mcps_view.search_placeholder")}
+ autoFocus
+ />
+ </div>
+ <IconButton label={t("common.close")} onClick={closeSearch}>
+ <X className="h-4 w-4" />
+ </IconButton>
</div>
)}
- {!isLoading && !error && servers.length === 0 && (
- <EmptyState
- onOpenConfig={() => setShowConfig(true)}
- onImportClaude={() => importClaude.mutate()}
- importPending={importClaude.isPending}
- />
- )}
-
- {servers.length > 0 && (
- <>
- <p className="mb-4 max-w-xl text-xs leading-relaxed text-muted-foreground">
- {t("mcps_view.intro")}
- </p>
- <ul className="space-y-1.5">
- {servers.map((s) => (
- <ServerRow
- key={s.name}
- server={s}
- pending={checkingName === s.name}
- onToggle={(enable) => toggle.mutate({ name: s.name, enable })}
- />
- ))}
- </ul>
- </>
- )}
+ <div className="mt-4">
+ {isLoading && (
+ <div className="py-8 text-center text-sm text-muted-foreground">{t("common.loading")}</div>
+ )}
+ {error && (
+ <div className="rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive">
+ {t("common.error")}: {(error as Error).message}
+ </div>
+ )}
+ {!isLoading && !error && servers.length === 0 && (
+ <EmptyState
+ onOpenConfig={() => setShowConfig(true)}
+ onImport={() => importClaude.mutate()}
+ importing={importClaude.isPending}
+ />
+ )}
+ {!isLoading && !error && servers.length > 0 && (
+ <Table label={t("mcps_view.title")}>
+ <TableHead columns={columns} />
+ {visible.map((s) => {
+ const pending = checkingName === s.name;
+ const st = statusOf(s, pending, t);
+ return (
+ <TableRow
+ key={s.name}
+ columns={columns}
+ onClick={() => setSelected(s.name)}
+ ariaLabel={s.name}
+ >
+ <Cell>
+ <div className="flex items-center gap-2">
+ <span className="truncate text-[13px] font-medium">{s.name}</span>
+ {s.tools.length > 0 && (
+ <span className="shrink-0 text-[11px] text-muted-foreground">
+ {toolCountLabel(s.tools.length, t)}
+ </span>
+ )}
+ </div>
+ {s.description && (
+ <p className="mt-0.5 truncate text-[11px] text-muted-foreground" title={s.description}>
+ {s.description}
+ </p>
+ )}
+ </Cell>
+ <Cell muted>
+ <span className="font-mono text-[11px]">{s.transport ?? "—"}</span>
+ </Cell>
+ <Cell>
+ <span title={s.error ?? undefined}>
+ <StatusDot tone={st.tone} label={st.label} pulse={pending} />
+ </span>
+ </Cell>
+ <Cell align="right" stop>
+ <Switch
+ checked={s.enabled}
+ disabled={pending}
+ onCheckedChange={(next) => toggle.mutate({ name: s.name, enable: next })}
+ aria-label={`${s.name}: ${s.enabled ? t("mcps_view.status.connected") : t("mcps_view.status.disconnected")}`}
+ />
+ </Cell>
+ </TableRow>
+ );
+ })}
+ {visible.length === 0 && <EmptyRow>{t("mcps_view.search_no_hits")}</EmptyRow>}
+ </Table>
+ )}
+ </div>
</div>
</ScrollArea>
-
- {showConfig && <ConfigModal onClose={() => setShowConfig(false)} />}
+ {dialogs}
</div>
);
}
-function ServerRow({
+// ---------------------------------------------------------------------------
+// Detail page
+// ---------------------------------------------------------------------------
+
+function McpDetail({
server,
pending,
onToggle,
+ onCheck,
+ onRemove,
+ onEditConfig,
}: {
server: McpServer;
pending: boolean;
onToggle: (enable: boolean) => void;
+ onCheck: () => void;
+ onRemove: () => void;
+ onEditConfig: () => void;
}) {
const t = useT();
- const status = statusOf(server, pending, t);
- const tooltip = server.error
- ? server.error
- : server.required_auth.length > 0 && !server.credentials_complete
- ? `${t("mcps_view.credentials_incomplete")}: ${server.required_auth.join(", ")}`
- : "";
+ const st = statusOf(server, pending, t);
+ const missing = (server.required_auth ?? []).filter(
+ (k) => server.credentials_status && server.credentials_status[k] === false,
+ );
+ const command = (server.install_command ?? []).join(" ");
return (
- <li
- className={cn(
- "flex items-center gap-4 rounded-lg border border-border bg-card/40 px-4 py-2.5 transition-colors",
- server.status === "running" && server.enabled && "border-primary/30 bg-card/60",
- server.error && "border-destructive/30 bg-destructive/5",
+ <div className="mt-5">
+ <DetailHeader
+ leading={
+ <span className="grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-border bg-sheen/[0.05]">
+ <Cable className="h-4 w-4 text-muted-foreground" />
+ </span>
+ }
+ title={server.name}
+ byline={
+ <span className="inline-flex items-center gap-2">
+ <StatusDot tone={st.tone} label={st.label} pulse={pending} />
+ {server.tools.length > 0 && <span>· {toolCountLabel(server.tools.length, t)}</span>}
+ </span>
+ }
+ actions={
+ <>
+ <Switch
+ checked={server.enabled}
+ disabled={pending}
+ onCheckedChange={onToggle}
+ aria-label={`${server.name}: ${server.enabled ? t("mcps_view.status.connected") : t("mcps_view.status.disconnected")}`}
+ />
+ <ActionMenu
+ label={t("mcps_view.more_actions")}
+ actions={[
+ {
+ id: "check",
+ label: t("mcps_view.check"),
+ icon: <Activity className="h-3.5 w-3.5" />,
+ disabled: pending,
+ onSelect: onCheck,
+ },
+ {
+ id: "edit",
+ label: t("mcps_view.add_edit"),
+ icon: <FileJson className="h-3.5 w-3.5" />,
+ onSelect: onEditConfig,
+ },
+ {
+ id: "remove",
+ label: t("mcps_view.remove"),
+ icon: <Trash2 className="h-3.5 w-3.5" />,
+ destructive: true,
+ separatorAbove: true,
+ disabled: Boolean(server.mandatory),
+ onSelect: onRemove,
+ },
+ ]}
+ trigger={({ open, toggle }) => (
+ <IconButton label={t("mcps_view.more_actions")} onClick={toggle} active={open}>
+ <MoreHorizontal className="h-4 w-4" />
+ </IconButton>
+ )}
+ />
+ </>
+ }
+ />
+
+ {server.description && (
+ <ClampedText
+ className="mt-4"
+ text={server.description}
+ moreLabel={t("common.see_more")}
+ lessLabel={t("common.see_less")}
+ />
)}
+
+ {server.error && (
+ <div className="mt-4 rounded-md border border-destructive/40 bg-destructive/10 p-2.5 text-xs text-destructive">
+ {server.error}
+ </div>
+ )}
+
+ <Panel className="mt-4">
+ <div className="px-5 py-4">
+ <FactRows
+ rows={[
+ { label: t("mcps_view.col_status"), value: st.label },
+ { label: t("mcps_view.col_transport"), value: server.transport ?? null },
+ {
+ label: t("mcps_view.command"),
+ value: command ? <code className="font-mono text-xs">{command}</code> : null,
+ },
+ {
+ label: t("mcps_view.credentials"),
+ value:
+ (server.required_auth ?? []).length === 0
+ ? null
+ : missing.length > 0
+ ? fill(t("mcps_view.credentials_missing"), { list: missing.join(", ") })
+ : t("mcps_view.credentials_ok"),
+ },
+ { label: t("mcps_view.platform_notes"), value: server.platform_notes || null },
+ {
+ label: t("mcps_view.origin"),
+ value: server.is_bootstrap ? t("mcps_view.origin_bootstrap") : t("mcps_view.origin_config"),
+ },
+ ]}
+ />
+ </div>
+ </Panel>
+
+ <Panel className="mt-4">
+ <div className="flex items-center gap-2 border-b border-border/70 px-5 py-2.5">
+ <span className="text-xs font-medium">{t("mcps_view.tools_heading")}</span>
+ <span className="text-xs text-muted-foreground">{server.tools.length}</span>
+ </div>
+ {server.tools.length === 0 ? (
+ <p className="px-5 py-4 text-xs text-muted-foreground">{t("mcps_view.no_tools")}</p>
+ ) : (
+ <ul className="divide-y divide-border/70">
+ {server.tools.map((tool) => (
+ <li key={tool.name} className="px-5 py-2.5">
+ <p className="font-mono text-xs">{tool.name}</p>
+ {tool.description && (
+ <p className="mt-0.5 line-clamp-2 text-[11px] text-muted-foreground" title={tool.description}>
+ {tool.description}
+ </p>
+ )}
+ </li>
+ ))}
+ </ul>
+ )}
+ </Panel>
+ </div>
+ );
+}
+
+function RemoveConfirmDialog({
+ server,
+ pending,
+ onCancel,
+ onConfirm,
+}: {
+ server: McpServer;
+ pending: boolean;
+ onCancel: () => void;
+ onConfirm: () => void;
+}) {
+ const t = useT();
+ return (
+ <div
+ className="fixed inset-0 z-50 flex items-center justify-center bg-scrim/60"
+ role="dialog"
+ aria-label={t("mcps_view.remove_title")}
>
- <span
- className={cn("h-2 w-2 shrink-0 rounded-full", status.dotClass)}
- aria-hidden
- />
- <div className="min-w-0 flex-1">
- <div className="truncate text-sm font-medium">{server.name}</div>
+ <div className="w-[420px] rounded-lg border border-border bg-card p-6 shadow-xl">
+ <h3 className="flex items-center gap-2 text-base font-semibold">
+ <Trash2 className="h-4 w-4 text-destructive" />
+ {t("mcps_view.remove_title")}
+ </h3>
+ <p className="mt-2 text-sm text-muted-foreground">{t("mcps_view.remove_body")}</p>
+ <p className="mt-1 font-mono text-sm font-medium">{server.name}</p>
+ <div className="mt-5 flex justify-end gap-2">
+ <Button size="sm" variant="ghost" onClick={onCancel} disabled={pending}>
+ {t("common.cancel")}
+ </Button>
+ <Button size="sm" variant="destructive" onClick={onConfirm} disabled={pending}>
+ {t("mcps_view.remove_confirm")}
+ </Button>
+ </div>
</div>
- <span
- className={cn("text-xs tabular-nums", status.color)}
- title={tooltip}
- >
- {status.label}
- </span>
- <Switch
- checked={server.enabled}
- disabled={pending}
- onCheckedChange={(v) => onToggle(Boolean(v))}
- />
- </li>
+ </div>
);
}
+// ------------------------------------------------------------------
+// Empty state
+// ------------------------------------------------------------------
+
function EmptyState({
onOpenConfig,
- onImportClaude,
- importPending,
+ onImport,
+ importing,
}: {
onOpenConfig: () => void;
- onImportClaude: () => void;
- importPending: boolean;
+ onImport: () => void;
+ importing: boolean;
}) {
const t = useT();
return (
- <div className="flex flex-col items-center justify-center gap-5 py-16 text-center">
- <div className="flex h-16 w-16 items-center justify-center rounded-2xl border border-border bg-card/60">
- <Plug className="h-7 w-7 text-muted-foreground" />
- </div>
- <div className="max-w-lg space-y-3">
- <h3 className="font-display text-xl font-semibold tracking-tight">
- {t("mcps_view.empty_title")}
- </h3>
- <p className="text-sm leading-relaxed text-muted-foreground">
- {t("mcps_view.empty_description")}
- </p>
- <p className="text-xs italic text-muted-foreground/70">
- {t("mcps_view.empty_tip")}
- </p>
- </div>
- <div className="flex flex-wrap items-center justify-center gap-2">
- <Button onClick={onOpenConfig} className="btn-primary px-5 py-2">
- <FileJson className="h-4 w-4" />
- <span className="ml-1.5">{t("mcps_view.open_config")}</span>
+ <EmptyRow>
+ <p className="font-medium text-foreground">{t("mcps_view.empty_title")}</p>
+ <p className="mx-auto mt-2 max-w-md text-xs">{t("mcps_view.empty_description")}</p>
+ <div className="mt-4 flex justify-center gap-2">
+ <Button size="sm" variant="outline" onClick={onOpenConfig} className="gap-1.5">
+ <FileJson className="h-3.5 w-3.5" />
+ {t("mcps_view.open_config")}
</Button>
- <Button
- variant="ghost"
- onClick={onImportClaude}
- disabled={importPending}
- className="px-4 py-2"
- >
- {importPending ? t("mcps_view.importing") : t("mcps_view.import_claude")}
+ <Button size="sm" onClick={onImport} disabled={importing} className="gap-1.5">
+ <Download className="h-3.5 w-3.5" />
+ {importing ? t("mcps_view.importing") : t("mcps_view.import_claude")}
</Button>
</div>
- </div>
+ <p className="mt-4 text-[11px] text-muted-foreground/80">{t("mcps_view.empty_tip")}</p>
+ </EmptyRow>
);
}
// ------------------------------------------------------------------
-// Config-Editor-Modal
+// Config editor modal
// ------------------------------------------------------------------
function ConfigModal({ onClose }: { onClose: () => void }) {
@@ -344,7 +682,7 @@ function ConfigModal({ onClose }: { onClose: () => void }) {
try {
parsed = JSON.parse(editing);
} catch (err) {
- throw new Error(`JSON-Syntax: ${(err as Error).message}`);
+ throw new Error(`JSON syntax: ${(err as Error).message}`);
}
return postJson<{ ok: boolean; servers: number }>(
"/api/mcps/config/raw",
@@ -375,7 +713,7 @@ function ConfigModal({ onClose }: { onClose: () => void }) {
return (
<div className="fixed inset-0 z-50 flex items-center justify-center bg-scrim/60 backdrop-blur-sm">
- <div className="flex w-full max-w-3xl flex-col rounded-xl border border-border bg-card shadow-[0_0_60px_rgba(255,214,10,0.1)]">
+ <div className="flex w-full max-w-3xl flex-col rounded-xl border border-border bg-card shadow-xl">
<div className="flex items-start justify-between gap-4 border-b border-border p-6">
<div className="min-w-0 flex-1">
<div className="flex items-center gap-2">
@@ -399,6 +737,7 @@ function ConfigModal({ onClose }: { onClose: () => void }) {
<button
type="button"
onClick={onClose}
+ aria-label={t("common.close")}
className="shrink-0 text-muted-foreground hover:text-foreground"
>
<X className="h-4 w-4" />
@@ -424,7 +763,6 @@ function ConfigModal({ onClose }: { onClose: () => void }) {
</Button>
<Button
type="button"
- className="btn-primary"
onClick={() => save.mutate()}
disabled={save.isPending}
>
diff --git a/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx b/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx
index b42b1e5176..053cd92198 100644
--- a/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx
@@ -80,30 +80,32 @@ afterEach(() => {
vi.restoreAllMocks();
});
-describe("PluginsView has no roadmap tab", () => {
- it("exposes only Browse and Installed tabs and drops the hardcoded Codex list", async () => {
+describe("PluginsView lists the catalog as a table", () => {
+ it("shows one row per plugin, a Browse button and the All/Installed filter", async () => {
installCatalogFetchMock();
renderPluginsView();
+ // One row per catalog entry, named after the plugin.
await waitFor(() => {
- expect(screen.getByRole("button", { name: /^Browse\b/i })).toBeDefined();
+ expect(screen.getByRole("row", { name: "GitHub" })).toBeDefined();
});
-
+ expect(screen.getByRole("row", { name: "Vercel" })).toBeDefined();
+ expect(screen.getByRole("button", { name: /^Browse\b/i })).toBeDefined();
+ // The status filter is a small tab strip, not a second page.
+ expect(screen.getByRole("tab", { name: /^All\b/ })).toBeDefined();
+ expect(screen.getByRole("tab", { name: /^Installed\b/ })).toBeDefined();
+ // Nothing needs attention in this catalog, so that tab stays hidden.
+ expect(screen.queryByRole("tab", { name: /Needs attention/ })).toBeNull();
// The roadmap tab carried a static "AVAILABLE" list of Codex plugins that
// were never installable in Jarvis — it has been removed entirely.
- expect(screen.getByRole("button", { name: /^Installed\b/i })).toBeDefined();
expect(screen.queryByRole("button", { name: /^Roadmap\b/i })).toBeNull();
- expect(screen.queryByRole("button", { name: /Vote on the roadmap/i })).toBeNull();
expect(screen.queryByText("ChatGPT Codex plugins")).toBeNull();
- expect(screen.queryByText("Planned Jarvis integrations")).toBeNull();
- expect(screen.queryByText("OpenAI Developers")).toBeNull();
- expect(screen.queryByText("Documents")).toBeNull();
});
});
describe("PluginsView live badge", () => {
- it("shows the Live badge for a connected plugin with live_callable: true", async () => {
+ it("shows the Live state for a connected plugin with live_callable: true", async () => {
installCatalogFetchMock();
renderPluginsView();
@@ -114,8 +116,10 @@ describe("PluginsView live badge", () => {
expect(screen.getByText(/available.*connected/i)).toBeDefined();
});
- // GitHub is connected + live_callable: true → the Live badge must appear
- expect(screen.getByText("· Live")).toBeDefined();
+ // GitHub is connected + live_callable: true → the status column says so.
+ expect(screen.getByText("Connected · Live")).toBeDefined();
+ // Vercel is not connected and must not carry the Live mark.
+ expect(screen.getByText("Not connected")).toBeDefined();
});
});
@@ -213,26 +217,31 @@ describe("ConnectIconButton reconnect state", () => {
// Hitting a 28px "+" is the wrong ask for "I want this plugin". The whole card
// starts the same connect flow — except a connected one, where a stray click
// must never disconnect anything.
-describe("plugin card click", () => {
- it("starts the connect flow when the card body is clicked", async () => {
+describe("plugin row click", () => {
+ it("opens the detail page, whose Connect button starts the connect flow", async () => {
installCatalogFetchMock();
renderPluginsView();
await waitFor(() => {
- expect(
- screen.getByText("Deployments, runtime logs, domains and env-vars"),
- ).toBeDefined();
+ expect(screen.getByRole("row", { name: "Vercel" })).toBeDefined();
});
expect(screen.queryByRole("dialog")).toBeNull();
- // Vercel is not_connected + pat_paste → the paste dialog IS its connect flow.
+ // A row opens the detail page — it never starts a flow by itself.
await act(async () => {
- fireEvent.click(
- screen.getByText("Deployments, runtime logs, domains and env-vars"),
- );
+ fireEvent.click(screen.getByRole("row", { name: "Vercel" }));
});
+ await waitFor(() => {
+ expect(screen.getByRole("button", { name: "Plugins" })).toBeDefined();
+ });
+ expect(screen.queryByRole("dialog")).toBeNull();
+ expect(screen.getByText("Deployments, runtime logs, domains and env-vars")).toBeDefined();
+ // Vercel is not_connected + pat_paste → the paste dialog IS its connect flow.
+ await act(async () => {
+ fireEvent.click(screen.getByRole("button", { name: "Connect" }));
+ });
await waitFor(() => expect(screen.getByRole("dialog")).toBeDefined());
});
@@ -242,17 +251,18 @@ describe("plugin card click", () => {
renderPluginsView();
await waitFor(() => {
- expect(
- screen.getByText("Repos, issues, pull requests and Actions runs"),
- ).toBeDefined();
+ expect(screen.getByRole("row", { name: "GitHub" })).toBeDefined();
});
await act(async () => {
- fireEvent.click(
- screen.getByText("Repos, issues, pull requests and Actions runs"),
- );
+ fireEvent.click(screen.getByRole("row", { name: "GitHub" }));
});
+ // The detail page states the connection; nothing destructive fires.
+ await waitFor(() => {
+ expect(screen.getByRole("button", { name: "Plugins" })).toBeDefined();
+ });
+ expect(screen.queryByRole("button", { name: "Connect" })).toBeNull();
expect(screen.queryByRole("dialog")).toBeNull();
const urls = (
globalThis.fetch as unknown as ReturnType<typeof vi.fn>
@@ -261,9 +271,6 @@ describe("plugin card click", () => {
});
});
-// The PKCE pre-connect dialog is the in-app path to run your OWN production
-// OAuth client (the durable fix for the 7-day Google revocation) without env
-// vars, plus the honest provider-side hint.
describe("PkceConnectDialog own-client + production hint", () => {
const gmail = {
id: "gmail",
@@ -665,12 +672,14 @@ describe("PluginsView keeps revoked plugins visible", () => {
renderPluginsView();
- // Open the Installed tab — the revoked plugin must be there, not hidden in
- // Browse as if never connected.
+ // Open the Installed filter — the revoked plugin must be there, not hidden
+ // in the full list as if never connected.
await waitFor(() => {
- expect(screen.getByRole("button", { name: /^Installed\b/i })).toBeDefined();
+ expect(screen.getByRole("tab", { name: /^Installed\b/i })).toBeDefined();
});
- fireEvent.click(screen.getByRole("button", { name: /^Installed\b/i }));
+ fireEvent.click(screen.getByRole("tab", { name: /^Installed\b/i }));
+ // The attention filter appears as soon as something needs reconnecting.
+ expect(screen.getByRole("tab", { name: /Needs attention/ })).toBeDefined();
await waitFor(() => {
expect(screen.getByText("Gmail")).toBeDefined();
@@ -778,24 +787,25 @@ describe("PluginsView category sections are data-driven", () => {
// The previous fixed record threw on `byCat[category].push(...)`, which
// blanked the entire view behind its error boundary. A backend-only
// taxonomy change must not be able to do that.
- catalogWith([row("mystery", "Something Brand New")], ["Developer"]);
+ catalogWith(
+ [row("mystery", "Something Brand New"), row("known", "Developer")],
+ ["Developer"],
+ );
renderPluginsView();
await waitFor(() => {
- expect(
- screen.getByRole("heading", { name: "Something Brand New", level: 2 }),
- ).toBeDefined();
+ expect(screen.getByRole("row", { name: "mystery" })).toBeDefined();
});
- expect(screen.getByText("mystery")).toBeDefined();
- // The filter menu is fed by the same data, so it offers the new category too.
- fireEvent.click(screen.getByRole("combobox", { name: "Plugin category" }));
+ expect(screen.getByText("Something Brand New")).toBeDefined();
+ // The category menu is fed by the same data, so it offers the new one too.
+ fireEvent.click(screen.getByRole("combobox", { name: "Category" }));
expect(
screen.getByRole("option", { name: "Something Brand New" }),
).toBeDefined();
});
- it("orders sections by the catalog's category_order", async () => {
+ it("orders rows by the catalog's category_order", async () => {
catalogWith(
[row("b", "Second"), row("a", "First")],
["First", "Second"],
@@ -804,12 +814,13 @@ describe("PluginsView category sections are data-driven", () => {
renderPluginsView();
await waitFor(() => {
- expect(screen.getByRole("heading", { name: "First", level: 2 })).toBeDefined();
+ expect(screen.getByRole("row", { name: "a" })).toBeDefined();
});
- const headings = screen
- .getAllByRole("heading", { level: 2 })
- .map((h) => h.textContent);
- expect(headings.indexOf("First")).toBeLessThan(headings.indexOf("Second"));
+ const names = screen
+ .getAllByRole("row")
+ .map((r) => r.getAttribute("aria-label"))
+ .filter(Boolean);
+ expect(names.indexOf("a")).toBeLessThan(names.indexOf("b"));
});
it("states how long the connection lasts before the user connects", async () => {
@@ -823,10 +834,21 @@ describe("PluginsView category sections are data-driven", () => {
renderPluginsView();
+ await waitFor(() => {
+ expect(screen.getByRole("row", { name: "limited" })).toBeDefined();
+ });
+ // The detail page carries the longevity fact sheet.
+ fireEvent.click(screen.getByRole("row", { name: "limited" }));
+ await waitFor(() => {
+ expect(screen.getByText("Sign in again periodically")).toBeDefined();
+ });
+ expect(screen.getByText("Google asks again every 7 days in Testing mode.")).toBeDefined();
+
+ fireEvent.click(screen.getByRole("button", { name: "Plugins" }));
+ fireEvent.click(await screen.findByRole("row", { name: "forever" }));
await waitFor(() => {
expect(screen.getByText("Stays connected")).toBeDefined();
});
- expect(screen.getByText("Sign in again periodically")).toBeDefined();
});
});
@@ -936,16 +958,20 @@ describe("plugin status filter", () => {
});
describe("PluginsView search and filter controls", () => {
- it("offers a connection-status menu next to the category menu", async () => {
+ function openSearch() {
+ fireEvent.click(screen.getByRole("button", { name: "Search plugins…" }));
+ return screen.getByPlaceholderText("Search plugins…");
+ }
+
+ it("offers the status filter as tabs next to the search", async () => {
installCatalogFetchMock();
renderPluginsView();
await waitFor(() => {
- expect(screen.getByRole("combobox", { name: "Connection status" })).toBeDefined();
+ expect(screen.getByRole("tablist", { name: "Show" })).toBeDefined();
});
- fireEvent.click(screen.getByRole("combobox", { name: "Connection status" }));
- for (const label of ["Any status", "Connected", "Not connected", "Needs attention"]) {
- expect(screen.getByRole("option", { name: label })).toBeDefined();
+ for (const label of [/^All\b/, /^Installed\b/]) {
+ expect(screen.getByRole("tab", { name: label })).toBeDefined();
}
});
@@ -957,18 +983,16 @@ describe("PluginsView search and filter controls", () => {
expect(screen.getByRole("button", { name: "Disconnect plugin" })).toBeDefined();
});
expect(screen.queryByRole("button", { name: "Clear filters" })).toBeNull();
- expect(screen.queryByText(/plugins?$/)).toBeNull();
+ expect(screen.queryByText(/matches$/)).toBeNull();
- fireEvent.change(screen.getByPlaceholderText("Search plugins"), {
- target: { value: "deployments" },
- });
+ fireEvent.change(openSearch(), { target: { value: "deployments" } });
// Vercel's description carries "Deployments"; GitHub's does not.
await waitFor(() => {
- expect(screen.getByText("1 plugin")).toBeDefined();
+ expect(screen.getByText("1 matches")).toBeDefined();
});
- expect(screen.getByText("Vercel")).toBeDefined();
- expect(screen.queryByText("GitHub")).toBeNull();
+ expect(screen.getByRole("row", { name: "Vercel" })).toBeDefined();
+ expect(screen.queryByRole("row", { name: "GitHub" })).toBeNull();
expect(screen.getByRole("button", { name: "Clear filters" })).toBeDefined();
});
@@ -979,11 +1003,9 @@ describe("PluginsView search and filter controls", () => {
await waitFor(() => {
expect(screen.getByRole("button", { name: "Disconnect plugin" })).toBeDefined();
});
- fireEvent.change(screen.getByPlaceholderText("Search plugins"), {
- target: { value: "kubernetes" },
- });
+ fireEvent.change(openSearch(), { target: { value: "kubernetes" } });
await waitFor(() => {
- expect(screen.getByText("0 plugins")).toBeDefined();
+ expect(screen.getByText("0 matches")).toBeDefined();
});
fireEvent.click(screen.getByRole("button", { name: "Clear filters" }));
@@ -992,21 +1014,39 @@ describe("PluginsView search and filter controls", () => {
expect(screen.queryByRole("button", { name: "Clear filters" })).toBeNull();
});
expect(screen.getByRole("button", { name: "Disconnect plugin" })).toBeDefined();
- expect(screen.getAllByText("Vercel").length).toBeGreaterThan(0);
+ expect(screen.getByRole("row", { name: "Vercel" })).toBeDefined();
});
it("explains an empty result from a non-text filter instead of blanking", async () => {
// Filtering by connection state alone can empty the list. That path used
// to render nothing at all — no message, no way back.
- installCatalogFetchMock();
+ const fetchMock = vi.fn(async (input: RequestInfo | URL) => {
+ if (String(input) === "/api/marketplace/plugins") {
+ return {
+ ok: true,
+ status: 200,
+ json: async () => ({
+ ...CATALOG,
+ connected: 0,
+ plugins: CATALOG.plugins.map((p) => ({
+ ...p,
+ status: "not_connected",
+ live_callable: false,
+ })),
+ }),
+ } as Response;
+ }
+ throw new Error(`unexpected fetch ${String(input)}`);
+ });
+ (globalThis as unknown as { fetch: typeof fetch }).fetch =
+ fetchMock as unknown as typeof fetch;
renderPluginsView();
await waitFor(() => {
- expect(screen.getByRole("button", { name: "Disconnect plugin" })).toBeDefined();
+ expect(screen.getByRole("row", { name: "GitHub" })).toBeDefined();
});
- fireEvent.click(screen.getByRole("combobox", { name: "Connection status" }));
- fireEvent.click(screen.getByRole("option", { name: "Needs attention" }));
+ fireEvent.click(screen.getByRole("tab", { name: /^Installed\b/ }));
await waitFor(() => {
expect(screen.getByText("No plugin matches the current filters.")).toBeDefined();
@@ -1014,7 +1054,7 @@ describe("PluginsView search and filter controls", () => {
fireEvent.click(screen.getByRole("button", { name: "Show all plugins" }));
await waitFor(() => {
- expect(screen.getByRole("button", { name: "Disconnect plugin" })).toBeDefined();
+ expect(screen.getByRole("row", { name: "GitHub" })).toBeDefined();
});
});
@@ -1025,10 +1065,8 @@ describe("PluginsView search and filter controls", () => {
await waitFor(() => {
expect(screen.getByRole("button", { name: "Disconnect plugin" })).toBeDefined();
});
- fireEvent.click(screen.getByRole("button", { name: /Installed/ }));
- fireEvent.change(screen.getByPlaceholderText("Search plugins"), {
- target: { value: "kubernetes" },
- });
+ fireEvent.click(screen.getByRole("tab", { name: /^Installed\b/ }));
+ fireEvent.change(openSearch(), { target: { value: "kubernetes" } });
await waitFor(() => {
expect(screen.getByText(/No plugin matches/)).toBeDefined();
@@ -1036,34 +1074,16 @@ describe("PluginsView search and filter controls", () => {
expect(screen.queryByText("Nothing connected yet")).toBeNull();
});
- it("hides the promo carousel while a filter narrows the list", async () => {
- // The carousel is a fixed promo strip: leaving it up during a search put
- // GitHub on screen while the list below held only Vercel.
- installCatalogFetchMock();
- renderPluginsView();
-
- await waitFor(() => {
- expect(screen.getAllByText("GitHub").length).toBeGreaterThan(1);
- });
-
- fireEvent.change(screen.getByPlaceholderText("Search plugins"), {
- target: { value: "deployments" },
- });
-
- await waitFor(() => {
- expect(screen.queryByText("GitHub")).toBeNull();
- });
- });
-
- it("drops the dead Coming-soon strip", async () => {
- // Every name the strip listed now has a real catalog entry, so it could
- // never render again. It stayed as a decoy for the next connector.
+ it("lists every plugin exactly once — no promo strip, no Coming-soon decoy", async () => {
+ // The carousel used to put GitHub on screen a second time, and the
+ // Coming-soon strip listed names that had long had real catalog entries.
installCatalogFetchMock();
renderPluginsView();
await waitFor(() => {
- expect(screen.getByText("GitHub")).toBeDefined();
+ expect(screen.getByRole("row", { name: "GitHub" })).toBeDefined();
});
+ expect(screen.getAllByText("GitHub")).toHaveLength(1);
expect(screen.queryByText("Coming soon")).toBeNull();
});
});
diff --git a/jarvis/ui/web/frontend/src/views/PluginsView.tsx b/jarvis/ui/web/frontend/src/views/PluginsView.tsx
index d63c9188fc..6dfb309a81 100644
--- a/jarvis/ui/web/frontend/src/views/PluginsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/PluginsView.tsx
@@ -7,8 +7,6 @@ import {
} from "@tanstack/react-query";
import { useEventStore } from "@/store/events";
import {
- Blocks,
- ArrowRight,
ExternalLink,
Search,
RefreshCw,
@@ -16,33 +14,46 @@ import {
Plus,
Check,
Copy,
- Sparkles,
X,
Loader2,
AlertTriangle,
Upload,
+ Store,
+ MoreHorizontal,
+ ArrowRight,
} from "lucide-react";
-import { ViewHeader } from "@/views/ChatsView";
import { CommunityTab } from "@/views/PluginsCommunity";
import { PluginUploadDialog } from "@/views/PluginUploadDialog";
-import { translate } from "@/i18n";
+import { fill, translate } from "@/i18n";
import { ScrollArea } from "@/components/ui/scroll-area";
-import { Button } from "@/components/ui/button";
import { BrandedSelect } from "@/components/ui/select";
+import {
+ ActionMenu,
+ BackLink,
+ Cell,
+ ClampedText,
+ DetailHeader,
+ EmptyRow,
+ FactRows,
+ IconButton,
+ InlineSearch,
+ MenuPill,
+ Panel,
+ PanelHeader,
+ SegmentedFilter,
+ SoftButton,
+ StatusDot,
+ Table,
+ TableHead,
+ TableRow,
+ type Column,
+} from "@/components/extensions/primitives";
import { cn } from "@/lib/utils";
import { MarketplaceBadge } from "@/components/MarketplaceBadge";
import { openExternalUrl } from "@/lib/openExternal";
import { robustCopy } from "@/lib/clipboard";
import { PRODUCT_NAME } from "@/lib/branding";
-// Wave hero image restored. The previous "kill image entirely" attempt
-// felt too flat; the CSS-only gradient lacked atmospheric depth. Edge
-// artefacts are killed by a brutal pair of inset shadows on the section
-// (see CarouselBanner): an almost-black 180px shadow eats the visible
-// rim, then a faint gold 140px shadow restores premium glow. The wave
-// stays vivid in the centre.
-const CAROUSEL_BG_URL = "/plugin-assets/carousel-hero.png";
-
// ---------------------------------------------------------------------------
// Wire types — mirror the JSON shape served by /api/marketplace/plugins.
// ---------------------------------------------------------------------------
@@ -420,17 +431,9 @@ function loopbackRedirectUri(plugin: Plugin): string | undefined {
return `http://127.0.0.1:${port}${path}`;
}
-type TabId = "browse" | "installed" | "community";
type FilterId = "all" | Category;
export type StatusFilterId = "all" | "connected" | "not_connected" | "attention";
-const STATUS_FILTER_LABEL: Record<StatusFilterId, string> = {
- all: "Any status",
- connected: "Connected",
- not_connected: "Not connected",
- attention: "Needs attention",
-};
-
/** Section order for the store, straight from the catalog. Any category the
* backend serves that the order does not mention is appended, so a new
* category needs no frontend release. */
@@ -484,20 +487,24 @@ export function matchesStatus(plugin: Plugin, status: StatusFilterId): boolean {
}
}
+export type ListFilter = "all" | "installed" | "attention";
+
export function PluginsView() {
const qc = useQueryClient();
- const [tab, setTab] = useState<TabId>("browse");
+ const setActiveSection = useEventStore((s) => s.setActiveSection);
+ const [view, setView] = useState<"list" | "community">("list");
+ const [selectedId, setSelectedId] = useState<string | null>(null);
+ const [listFilter, setListFilter] = useState<ListFilter>("all");
const [uploadOpen, setUploadOpen] = useState(false);
+ const [searchOpen, setSearchOpen] = useState(false);
const [query, setQuery] = useState("");
const [filter, setFilter] = useState<FilterId>("all");
- const [statusFilter, setStatusFilter] = useState<StatusFilterId>("all");
const [connectingPlugin, setConnectingPlugin] = useState<Plugin | null>(null);
// PKCE plugin awaiting the pre-connect dialog (own-client + keep-connected hint).
const [pkceSetupPlugin, setPkceSetupPlugin] = useState<Plugin | null>(null);
// Plugin awaiting a "really disconnect?" confirmation. Removing a plugin is
// destructive (tokens dropped, brain tools re-expanded), so it must ask first.
const [disconnectingPlugin, setDisconnectingPlugin] = useState<Plugin | null>(null);
-
const { data, isLoading, error, refetch, isFetching } = useQuery({
queryKey: ["marketplace-plugins"],
queryFn: fetchCatalog,
@@ -698,19 +705,21 @@ export function PluginsView() {
() => data?.plugins.map(adapt) ?? [],
[data],
);
+ const handleDisconnect = (id: string) =>
+ setDisconnectingPlugin(allPlugins.find((p) => p.id === id) ?? null);
const categoryOrder = useMemo(
() => orderedCategories(data, allPlugins),
[data, allPlugins],
);
// "Installed" keeps every plugin the user ever connected — including a revoked
// (needs_reauth) or errored one — so a dead token surfaces a Reconnect prompt
- // here instead of silently dropping back into Browse as a plain "+".
+ // here instead of silently dropping back into the full list as a plain "+".
//
// A plugin installed from the marketplace belongs here from the moment it is
// installed, connected or not: the shipped catalog is always "available", so
- // a community plugin that only appeared in Browse was indistinguishable from
- // the twenty the app came with — somebody who had just installed one had no
- // place to look for it.
+ // a community plugin that only appeared in the full list was indistinguishable
+ // from the twenty the app came with — somebody who had just installed one had
+ // no place to look for it.
const installed = useMemo(
() =>
allPlugins.filter(
@@ -726,181 +735,57 @@ export function PluginsView() {
() => allPlugins.filter((p) => p.status === "connected").length,
[allPlugins],
);
- const needsAttentionCount = useMemo(
+ // Every plugin that needs a reconnect (revoked/expired token) or errored —
+ // the ones the "needs attention" banner names and the attention filter shows.
+ const attentionPlugins = useMemo(
() =>
allPlugins.filter(
(p) => p.status === "needs_reauth" || p.status === "error",
- ).length,
+ ),
[allPlugins],
);
const visible = useMemo(() => {
- const base = tab === "installed" ? installed : allPlugins;
- return base.filter((p) => {
+ const base =
+ listFilter === "installed"
+ ? installed
+ : listFilter === "attention"
+ ? attentionPlugins
+ : allPlugins;
+ const ranked = [...base].sort(
+ (a, b) => categoryOrder.indexOf(a.category) - categoryOrder.indexOf(b.category),
+ );
+ return ranked.filter((p) => {
if (filter !== "all" && p.category !== filter) return false;
- if (!matchesStatus(p, statusFilter)) return false;
return matchesQuery(p, query);
});
- }, [tab, query, filter, statusFilter, allPlugins, installed]);
+ }, [listFilter, query, filter, allPlugins, installed, attentionPlugins, categoryOrder]);
- const filtersActive =
- query.trim() !== "" || filter !== "all" || statusFilter !== "all";
+ const filtersActive = query.trim() !== "" || filter !== "all";
const resetFilters = () => {
setQuery("");
setFilter("all");
- setStatusFilter("all");
- };
-
- const searchControls: SearchControlsProps = {
- query,
- setQuery,
- filter,
- setFilter,
- statusFilter,
- setStatusFilter,
- matchCount: visible.length,
- filtersActive,
- onReset: resetFilters,
};
-
- // Every plugin that needs a reconnect (revoked/expired token) or errored —
- // the ones the "needs attention" banner names and the "Jump to it" button
- // scrolls to.
- const attentionPlugins = useMemo(
- () =>
- allPlugins.filter(
- (p) => p.status === "needs_reauth" || p.status === "error",
- ),
- [allPlugins],
- );
-
- // "Jump to it": clear any active search/filter so the target row is
- // guaranteed rendered, then hand its id to the effect below, which scrolls to
- // it once React has painted it. Two-step (state + effect) rather than an
- // inline scroll because the row may not exist in the DOM until the filter
- // reset re-renders the list.
- const [scrollTarget, setScrollTarget] = useState<string | null>(null);
- const jumpToFirstProblem = () => {
- const target = attentionPlugins[0];
- if (!target) return;
+ const closeSearch = () => {
resetFilters();
- setScrollTarget(target.id);
+ setSearchOpen(false);
};
- useEffect(() => {
- if (!scrollTarget) return;
- const el = document.getElementById(`plugin-row-${scrollTarget}`);
- // Not painted yet — a later render (after the filter reset) re-runs this
- // effect via the `visible` dependency and finds the row then.
- if (!el) return;
- el.scrollIntoView({ behavior: "smooth", block: "center" });
- // Brief amber flash so the eye lands on the right card.
- const flash = ["ring-2", "ring-amber-500/70", "ring-offset-2", "ring-offset-background"];
- el.classList.add(...flash);
- const timer = window.setTimeout(() => el.classList.remove(...flash), 2000);
- setScrollTarget(null);
- return () => window.clearTimeout(timer);
- }, [scrollTarget, visible]);
-
- return (
- <div className="flex h-full flex-col bg-transparent">
- <ViewHeader
- icon={<Blocks className="h-4 w-4 text-primary" />}
- title="Plugins"
- subtitle={
- isLoading
- ? "Loading catalog…"
- : error
- ? "Backend unreachable"
- : `${allPlugins.length} available · ${connectedCount} connected${
- needsAttentionCount > 0
- ? ` · ${needsAttentionCount} need reconnect`
- : ""
- }`
- }
- right={
- <div className="flex items-center gap-1">
- <Button
- size="sm"
- variant="outline"
- onClick={() => setUploadOpen(true)}
- className="gap-1.5"
- >
- <Upload className="h-3.5 w-3.5" />
- {translate("plugin_upload.button")}
- </Button>
- <Button
- size="sm"
- variant="ghost"
- onClick={() => refetch()}
- disabled={isFetching}
- title="Refresh catalog"
- >
- <RefreshCw className={cn("h-3.5 w-3.5", isFetching && "animate-spin")} />
- </Button>
- </div>
- }
- />
+ const selectedPlugin = selectedId
+ ? allPlugins.find((p) => p.id === selectedId) ?? null
+ : null;
+ const dialogs = (
+ <>
<PluginUploadDialog
open={uploadOpen}
onClose={() => setUploadOpen(false)}
onInstalled={() => {
- setTab("installed");
+ setListFilter("installed");
void refetch();
}}
/>
- <div className="flex items-center gap-6 border-b border-border px-6">
- <Tab
- label="Browse"
- count={allPlugins.length}
- active={tab === "browse"}
- onClick={() => setTab("browse")}
- />
- <Tab
- label="Installed"
- count={installed.length}
- active={tab === "installed"}
- onClick={() => setTab("installed")}
- />
- <Tab
- label="Community"
- active={tab === "community"}
- onClick={() => setTab("community")}
- />
- </div>
-
- <ScrollArea className="flex-1">
- <div className="relative mx-auto max-w-3xl px-6 pb-20 pt-14">
- <AttentionBanner plugins={attentionPlugins} onJump={jumpToFirstProblem} />
- {tab === "community" ? (
- <CommunityTab />
- ) : tab === "browse" ? (
- <BrowseLayout
- plugins={visible}
- categoryOrder={categoryOrder}
- {...searchControls}
- onConnect={handleConnect}
- onDisconnect={(id) =>
- setDisconnectingPlugin(allPlugins.find((p) => p.id === id) ?? null)
- }
- />
- ) : (
- <InstalledLayout
- plugins={visible}
- totalAvailable={allPlugins.length}
- categoryOrder={categoryOrder}
- {...searchControls}
- onConnect={handleConnect}
- onDisconnect={(id) =>
- setDisconnectingPlugin(allPlugins.find((p) => p.id === id) ?? null)
- }
- />
- )}
- </div>
- </ScrollArea>
-
{connectingPlugin && (
<PatConnectDialog
plugin={connectingPlugin}
@@ -984,6 +869,526 @@ export function PluginsView() {
}}
/>
)}
+ </>
+ );
+
+ const shell = (content: React.ReactNode) => (
+ <div className="flex h-full min-h-0 flex-col bg-transparent">
+ <ScrollArea className="flex-1">
+ <div className="mx-auto w-full max-w-4xl px-8 py-6">{content}</div>
+ </ScrollArea>
+ {dialogs}
+ </div>
+ );
+
+ // ---- Community marketplace (the "Browse" page) --------------------------
+ if (view === "community") {
+ return shell(
+ <>
+ <BackLink label={translate("plugins_view.title")} onClick={() => setView("list")} />
+ <div className="mt-5">
+ <CommunityTab />
+ </div>
+ </>,
+ );
+ }
+
+ // ---- Detail page -------------------------------------------------------
+ if (selectedId) {
+ return shell(
+ <>
+ <BackLink label={translate("plugins_view.title")} onClick={() => setSelectedId(null)} />
+ {selectedPlugin ? (
+ <PluginDetail
+ plugin={selectedPlugin}
+ onConnect={handleConnect}
+ onDisconnect={handleDisconnect}
+ />
+ ) : (
+ <p className="mt-6 text-sm text-muted-foreground">
+ {isLoading ? translate("plugins_view.loading") : translate("plugins_view.not_found")}
+ </p>
+ )}
+ </>,
+ );
+ }
+
+ // ---- List page ---------------------------------------------------------
+ const subtitle = isLoading
+ ? translate("plugins_view.loading")
+ : error
+ ? translate("plugins_view.unreachable")
+ : fill(translate("plugins_view.count"), {
+ n: allPlugins.length,
+ connected: connectedCount,
+ });
+
+ return shell(
+ <>
+ <PanelHeader
+ title={translate("plugins_view.title")}
+ subtitle={subtitle}
+ actions={
+ <>
+ <IconButton
+ label={translate("plugins_view.search_placeholder")}
+ active={searchOpen}
+ onClick={() => (searchOpen ? closeSearch() : setSearchOpen(true))}
+ >
+ <Search className="h-4 w-4" />
+ </IconButton>
+ <IconButton
+ label={translate("plugins_view.refresh")}
+ onClick={() => void refetch()}
+ busy={isFetching && !data}
+ >
+ <RefreshCw className="h-4 w-4" />
+ </IconButton>
+ <SoftButton onClick={() => setView("community")} className="ml-1">
+ {translate("plugins_view.browse")}
+ </SoftButton>
+ <ActionMenu
+ label={translate("plugins_view.add")}
+ actions={[
+ {
+ id: "upload",
+ label: translate("plugins_view.add_upload"),
+ icon: <Upload className="h-3.5 w-3.5" />,
+ onSelect: () => setUploadOpen(true),
+ },
+ {
+ id: "community",
+ label: translate("plugins_view.add_community"),
+ icon: <Store className="h-3.5 w-3.5" />,
+ onSelect: () => setView("community"),
+ },
+ {
+ id: "marketplace",
+ label: translate("plugins_view.add_marketplace"),
+ icon: <ExternalLink className="h-3.5 w-3.5" />,
+ separatorAbove: true,
+ onSelect: () => setActiveSection("marketplace"),
+ },
+ ]}
+ trigger={({ open, toggle }) => (
+ <MenuPill open={open} toggle={toggle}>
+ {translate("plugins_view.add")}
+ </MenuPill>
+ )}
+ />
+ </>
+ }
+ />
+
+ {searchOpen && (
+ <div className="mt-4 flex items-center gap-2">
+ <div className="flex-1">
+ <InlineSearch
+ value={query}
+ onChange={setQuery}
+ placeholder={translate("plugins_view.search_placeholder")}
+ autoFocus
+ />
+ </div>
+ <IconButton label={translate("common.close")} onClick={closeSearch}>
+ <X className="h-4 w-4" />
+ </IconButton>
+ </div>
+ )}
+
+ <div className="mt-4 flex flex-wrap items-center gap-2">
+ <SegmentedFilter<ListFilter>
+ label={translate("plugins_view.filter_label")}
+ value={listFilter}
+ onChange={setListFilter}
+ options={[
+ { id: "all", label: translate("plugins_view.filter_all"), count: allPlugins.length },
+ { id: "installed", label: translate("plugins_view.filter_installed"), count: installed.length },
+ ...(attentionPlugins.length > 0
+ ? [{ id: "attention" as const, label: translate("plugins_view.filter_attention"), count: attentionPlugins.length }]
+ : []),
+ ]}
+ />
+ <div className="ml-auto flex items-center gap-2">
+ {filtersActive && (
+ <>
+ <span className="text-[11px] text-muted-foreground">
+ {fill(translate("plugins_view.matches"), { n: visible.length })}
+ </span>
+ <button
+ type="button"
+ onClick={resetFilters}
+ className="text-[11px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline"
+ >
+ {translate("plugins_view.clear_filters")}
+ </button>
+ </>
+ )}
+ {categoryOrder.length > 1 && (
+ <BrandedSelect
+ value={filter}
+ onValueChange={(v) => setFilter((v || "all") as FilterId)}
+ ariaLabel={translate("plugins_view.col_category")}
+ className="h-7 w-auto rounded-md px-2 py-0 text-[11px]"
+ options={[
+ { value: "all", label: translate("plugins_view.all_categories") },
+ ...categoryOrder.map((c) => ({ value: c, label: c })),
+ ]}
+ />
+ )}
+ </div>
+ </div>
+
+ <div className="mt-4">
+ <AttentionBanner
+ plugins={attentionPlugins}
+ onJump={() => {
+ const target = attentionPlugins[0];
+ if (target) setSelectedId(target.id);
+ }}
+ />
+ {error && (
+ <div className="rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive">
+ {(error as Error).message}
+ </div>
+ )}
+ {!error && (
+ <PluginTable
+ plugins={visible}
+ loading={isLoading}
+ filtersActive={filtersActive || listFilter !== "all"}
+ onOpen={(id) => setSelectedId(id)}
+ onConnect={handleConnect}
+ onDisconnect={handleDisconnect}
+ onReset={() => {
+ resetFilters();
+ setListFilter("all");
+ }}
+ />
+ )}
+ </div>
+ </>,
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Status vocabulary shared by the table and the detail page
+// ---------------------------------------------------------------------------
+
+function statusTone(status: PluginStatus): "ok" | "off" | "warn" | "error" {
+ switch (status) {
+ case "connected":
+ return "ok";
+ case "needs_reauth":
+ return "warn";
+ case "error":
+ return "error";
+ default:
+ return "off";
+ }
+}
+
+function statusLabel(plugin: Plugin): string {
+ switch (plugin.status) {
+ case "connected":
+ return plugin.liveCallable
+ ? `${translate("plugins_view.status_connected")} · ${translate("plugins_view.status_live")}`
+ : translate("plugins_view.status_connected");
+ case "needs_reauth":
+ return translate("plugins_view.status_reauth");
+ case "error":
+ return translate("plugins_view.status_error");
+ default:
+ return translate("plugins_view.status_not_connected");
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Table
+// ---------------------------------------------------------------------------
+
+function PluginTable({
+ plugins,
+ loading,
+ filtersActive,
+ onOpen,
+ onConnect,
+ onDisconnect,
+ onReset,
+}: {
+ plugins: Plugin[];
+ loading: boolean;
+ filtersActive: boolean;
+ onOpen: (id: string) => void;
+ onReset: () => void;
+} & ConnectHandlers) {
+ const columns: Column[] = [
+ { id: "plugin", label: translate("plugins_view.col_plugin") },
+ { id: "category", label: translate("plugins_view.col_category"), width: "130px" },
+ { id: "status", label: translate("plugins_view.col_status"), width: "170px" },
+ { id: "action", label: translate("plugins_view.col_action"), width: "36px", srOnly: true, align: "right" },
+ ];
+
+ if (loading) {
+ return (
+ <div className="py-8 text-center text-sm text-muted-foreground">
+ {translate("plugins_view.loading")}
+ </div>
+ );
+ }
+
+ return (
+ <Table label={translate("plugins_view.title")}>
+ <TableHead columns={columns} />
+ {plugins.map((plugin) => (
+ <PluginTableRow
+ key={plugin.id}
+ plugin={plugin}
+ columns={columns}
+ onOpen={() => onOpen(plugin.id)}
+ onConnect={onConnect}
+ onDisconnect={onDisconnect}
+ />
+ ))}
+ {plugins.length === 0 && (
+ <EmptyRow>
+ <p>
+ {filtersActive
+ ? translate("plugins_view.no_hits")
+ : translate("plugins_view.empty")}
+ </p>
+ {filtersActive && (
+ <button
+ type="button"
+ onClick={onReset}
+ className="mt-3 text-xs text-primary hover:underline"
+ >
+ {translate("plugins_view.show_all")}
+ </button>
+ )}
+ </EmptyRow>
+ )}
+ </Table>
+ );
+}
+
+function PluginTableRow({
+ plugin,
+ columns,
+ onOpen,
+ onConnect,
+ onDisconnect,
+}: { plugin: Plugin; columns: Column[]; onOpen: () => void } & ConnectHandlers) {
+ return (
+ <TableRow
+ id={`plugin-row-${plugin.id}`}
+ columns={columns}
+ onClick={onOpen}
+ ariaLabel={plugin.name}
+ >
+ <Cell>
+ <div className="flex items-center gap-3">
+ <BrandTile plugin={plugin} size="sm" />
+ <div className="min-w-0">
+ <div className="flex items-center gap-1.5">
+ <span className="truncate text-[13px] font-medium">{plugin.name}</span>
+ {plugin.fromMarketplace && <MarketplaceBadge publisher={plugin.publisher} />}
+ {plugin.selfUploaded && (
+ <span
+ className="rounded-full border border-amber-500/40 bg-amber-500/10 px-1.5 text-[9px] font-medium uppercase tracking-wider text-amber-500"
+ title={translate("plugin_upload.unreviewed")}
+ >
+ {translate("plugin_upload.self_badge")}
+ </span>
+ )}
+ </div>
+ <p className="mt-0.5 truncate text-[11px] text-muted-foreground" title={plugin.description}>
+ {plugin.status === "needs_reauth" ? (
+ <ReauthExplanation plugin={plugin} inline />
+ ) : (
+ plugin.description
+ )}
+ </p>
+ </div>
+ </div>
+ </Cell>
+ <Cell muted>
+ <span className="truncate">{plugin.category}</span>
+ </Cell>
+ <Cell>
+ <StatusDot tone={statusTone(plugin.status)} label={statusLabel(plugin)} />
+ </Cell>
+ <Cell align="right" stop>
+ <ConnectIconButton
+ status={plugin.status}
+ onConnect={() => onConnect(plugin)}
+ onDisconnect={() => onDisconnect(plugin.id)}
+ />
+ </Cell>
+ </TableRow>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Detail page
+// ---------------------------------------------------------------------------
+
+function PluginDetail({ plugin, onConnect, onDisconnect }: { plugin: Plugin } & ConnectHandlers) {
+ const { busy, run } = useConnectLock(() => onConnect(plugin));
+ const connected = plugin.status === "connected";
+ const needsReconnect = plugin.status === "needs_reauth" || plugin.status === "error";
+ const family = oauthClientFamily(plugin);
+
+ const menuActions = [
+ ...(plugin.sourceUrl
+ ? [
+ {
+ id: "source",
+ label: translate("plugins_view.view_source"),
+ icon: <ExternalLink className="h-3.5 w-3.5" />,
+ onSelect: () => void openExternalUrl(plugin.sourceUrl ?? ""),
+ },
+ ]
+ : []),
+ ...(connected || needsReconnect
+ ? [
+ {
+ id: "disconnect",
+ label: translate("plugins_view.disconnect"),
+ icon: <X className="h-3.5 w-3.5" />,
+ destructive: true,
+ separatorAbove: Boolean(plugin.sourceUrl),
+ onSelect: () => onDisconnect(plugin.id),
+ },
+ ]
+ : []),
+ ];
+
+ return (
+ <div className="mt-5">
+ <DetailHeader
+ leading={<BrandTile plugin={plugin} />}
+ title={plugin.name}
+ titleAccessory={
+ <>
+ {plugin.fromMarketplace && <MarketplaceBadge publisher={plugin.publisher} />}
+ {plugin.selfUploaded && (
+ <span
+ className="rounded-full border border-amber-500/40 bg-amber-500/10 px-1.5 text-[9px] font-medium uppercase tracking-wider text-amber-500"
+ title={translate("plugin_upload.unreviewed")}
+ >
+ {translate("plugin_upload.self_badge")}
+ </span>
+ )}
+ </>
+ }
+ byline={
+ <span className="inline-flex items-center gap-2">
+ <StatusDot tone={statusTone(plugin.status)} label={statusLabel(plugin)} />
+ <span>· {plugin.category}</span>
+ {plugin.publisher && (
+ <span>· {fill(translate("plugins_view.by"), { publisher: plugin.publisher })}</span>
+ )}
+ </span>
+ }
+ actions={
+ <>
+ {connected ? (
+ <span className="inline-flex h-8 items-center gap-1.5 rounded-md bg-primary/15 px-3 text-xs font-medium text-primary">
+ <Check className="h-3.5 w-3.5" />
+ {translate("plugins_view.status_connected")}
+ </span>
+ ) : (
+ <button
+ type="button"
+ onClick={() => void run()}
+ disabled={busy}
+ aria-busy={busy}
+ className={cn(
+ "inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-60",
+ needsReconnect
+ ? "border border-amber-500/50 bg-amber-500/10 text-amber-500 hover:bg-amber-500/20"
+ : "bg-primary text-primary-foreground hover:bg-primary/90",
+ )}
+ >
+ {busy ? (
+ <Loader2 className="h-3.5 w-3.5 animate-spin" />
+ ) : needsReconnect ? (
+ <RotateCw className="h-3.5 w-3.5" />
+ ) : (
+ <Plus className="h-3.5 w-3.5" />
+ )}
+ {needsReconnect ? translate("plugins_view.reconnect") : translate("plugins_view.connect")}
+ </button>
+ )}
+ {menuActions.length > 0 && (
+ <ActionMenu
+ label={translate("plugins_view.more_actions")}
+ actions={menuActions}
+ trigger={({ open, toggle }) => (
+ <IconButton label={translate("plugins_view.more_actions")} onClick={toggle} active={open}>
+ <MoreHorizontal className="h-4 w-4" />
+ </IconButton>
+ )}
+ />
+ )}
+ </>
+ }
+ />
+
+ {plugin.status === "needs_reauth" ? (
+ <div className="mt-4 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2.5 text-xs">
+ <ReauthExplanation plugin={plugin} />
+ </div>
+ ) : null}
+
+ {plugin.description && (
+ <ClampedText
+ className="mt-4"
+ text={plugin.description}
+ moreLabel={translate("common.see_more")}
+ lessLabel={translate("common.see_less")}
+ />
+ )}
+
+ <Panel className="mt-4">
+ <div className="px-5 py-4">
+ <FactRows
+ rows={[
+ { label: translate("plugins_view.col_status"), value: statusLabel(plugin) },
+ { label: translate("plugins_view.fact_signin"), value: AUTH_LABELS[plugin.authMode] },
+ {
+ label: translate("plugins_view.fact_connection"),
+ value: (
+ <span className={cn(plugin.longevity === "provider_limited" && "text-amber-500")}>
+ {LONGEVITY_LABEL[plugin.longevity]}
+ {plugin.longevityNote ? (
+ <span className="block text-xs text-muted-foreground">{plugin.longevityNote}</span>
+ ) : null}
+ </span>
+ ),
+ },
+ {
+ label: translate("plugins_view.fact_oauth_client"),
+ value: family
+ ? plugin.oauthClientConfigured
+ ? fill(translate("plugins_view.oauth_client_own"), { family: family.label })
+ : fill(translate("plugins_view.oauth_client_placeholder"), { family: family.label })
+ : null,
+ },
+ { label: translate("plugins_view.fact_publisher"), value: plugin.publisher ?? null },
+ {
+ label: translate("plugins_view.fact_source"),
+ value: plugin.selfUploaded
+ ? translate("plugin_upload.unreviewed")
+ : plugin.fromMarketplace
+ ? translate("marketplace_origin.tooltip")
+ : null,
+ },
+ ]}
+ />
+ </div>
+ </Panel>
</div>
);
}
@@ -1011,10 +1416,10 @@ function AttentionBanner({
: `${plugins.length} connections need reconnecting`;
return (
- <div className="mb-8 flex items-center gap-3 rounded-xl border border-amber-500/40 bg-amber-500/10 px-4 py-3">
+ <div className="mb-4 flex items-center gap-3 rounded-lg border border-amber-500/30 bg-amber-500/[0.07] px-3 py-2">
<AlertTriangle className="h-4 w-4 shrink-0 text-amber-500" />
<div className="min-w-0 flex-1">
- <p className="truncate text-sm font-medium text-foreground">{headline}</p>
+ <p className="truncate text-[13px] font-medium text-foreground">{headline}</p>
<p className="truncate text-xs text-muted-foreground">
{one
? // The banner is the first thing the user reads, so it states the
@@ -1032,7 +1437,7 @@ function AttentionBanner({
<button
type="button"
onClick={onJump}
- className="inline-flex shrink-0 items-center gap-1.5 rounded-full border border-amber-500/50 bg-amber-500/10 px-3 py-1.5 text-xs font-semibold text-amber-500 transition-colors hover:bg-amber-500/20"
+ className="inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-amber-500/40 bg-amber-500/10 px-2.5 text-xs font-medium text-amber-500 transition-colors hover:bg-amber-500/20"
>
{one ? "Jump to it" : "Jump to first"}
<ArrowRight className="h-3.5 w-3.5" />
@@ -1053,512 +1458,18 @@ interface ConnectHandlers {
onDisconnect: (id: string) => void;
}
-// ---------------------------------------------------------------------------
-// Layout shells
-// ---------------------------------------------------------------------------
-
-interface SearchControlsProps {
- query: string;
- setQuery: (v: string) => void;
- filter: FilterId;
- setFilter: (f: FilterId) => void;
- statusFilter: StatusFilterId;
- setStatusFilter: (s: StatusFilterId) => void;
- /** How many plugins survived the filters — shown next to the reset button so
- * a narrow result set never reads as "the catalog shrank". */
- matchCount: number;
- filtersActive: boolean;
- onReset: () => void;
-}
-
-function BrowseLayout({
- plugins,
- categoryOrder,
- onConnect,
- onDisconnect,
- ...controls
-}: { plugins: Plugin[]; categoryOrder: string[] } & SearchControlsProps &
- ConnectHandlers) {
- const { query, filtersActive, onReset } = controls;
- return (
- <>
- <Hero {...controls} />
- {/* The carousel promotes a fixed set of plugins regardless of the
- filters. Once the user is searching, that is noise at best and
- actively misleading at worst — it showed GitHub while the list below
- held only Vercel. Hide it whenever a filter narrows the view. */}
- {!filtersActive && <CarouselBanner />}
- <CategorizedList
- plugins={plugins}
- query={query}
- filtersActive={filtersActive}
- onReset={onReset}
- categoryOrder={categoryOrder}
- onConnect={onConnect}
- onDisconnect={onDisconnect}
- />
- </>
- );
-}
-
-function InstalledLayout({
- plugins,
- totalAvailable,
- categoryOrder,
- onConnect,
- onDisconnect,
- ...controls
-}: {
- plugins: Plugin[];
- totalAvailable: number;
- categoryOrder: string[];
-} & SearchControlsProps &
- ConnectHandlers) {
- const { query, filtersActive, onReset } = controls;
- // "Nothing connected yet" is only true when nothing is connected. With a
- // filter narrowing the tab, an empty list means the filter excluded the
- // user's plugins — saying they have none would be a lie they cannot undo.
- const emptyBecauseOfFilters = plugins.length === 0 && filtersActive;
- return (
- <>
- <Hero
- // Not "connected" any more: a plugin installed from the marketplace
- // belongs here before it is connected, and a heading that claims
- // otherwise is wrong about the very row underneath it.
- title="What you have added"
- subtitle="Connect one before it can do anything. Disconnect or remove it from its own row when you no longer need it."
- {...controls}
- />
- {plugins.length === 0 && !emptyBecauseOfFilters ? (
- <EmptyInstalled totalAvailable={totalAvailable} />
- ) : (
- <CategorizedList
- plugins={plugins}
- query={query}
- filtersActive={filtersActive}
- onReset={onReset}
- categoryOrder={categoryOrder}
- onConnect={onConnect}
- onDisconnect={onDisconnect}
- />
- )}
- </>
- );
-}
-
-function Hero({
- title = "Connect your assistant to your services",
- subtitle,
- query,
- setQuery,
- filter,
- setFilter,
- statusFilter,
- setStatusFilter,
- matchCount,
- filtersActive,
- onReset,
-}: { title?: string; subtitle?: string } & SearchControlsProps) {
- return (
- <header className="mb-10 text-center">
- <h1 className="font-display text-2xl font-semibold tracking-tight sm:text-3xl">{title}</h1>
- {subtitle && (
- <p className="mx-auto mt-2 max-w-md text-xs leading-relaxed text-muted-foreground">
- {subtitle}
- </p>
- )}
- <div className="mx-auto mt-6 flex max-w-2xl flex-wrap items-center justify-center gap-2">
- <SearchInput value={query} onChange={setQuery} />
- <FilterMenu filter={filter} setFilter={setFilter} />
- <StatusFilterMenu statusFilter={statusFilter} setStatusFilter={setStatusFilter} />
- </div>
- {filtersActive && (
- <div className="mx-auto mt-3 flex items-center justify-center gap-3 text-xs text-muted-foreground">
- <span aria-live="polite" className="tabular-nums">
- {matchCount === 1 ? "1 plugin" : `${matchCount} plugins`}
- </span>
- <button
- type="button"
- onClick={onReset}
- className="rounded-full border border-border/60 px-3 py-1 font-medium transition-colors hover:border-primary/40 hover:text-foreground focus:outline-none focus:ring-1 focus:ring-primary/30"
- >
- Clear filters
- </button>
- </div>
- )}
- </header>
- );
-}
-
-function SearchInput({ value, onChange }: { value: string; onChange: (v: string) => void }) {
- return (
- <div className="relative flex-1">
- <Search className="pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
- <input
- type="text"
- value={value}
- onChange={(e) => onChange(e.target.value)}
- placeholder="Search plugins"
- className="h-9 w-full rounded-full border border-border bg-card/60 pl-9 pr-3 text-xs text-foreground placeholder:text-muted-foreground/60 focus:border-primary/40 focus:outline-none focus:ring-1 focus:ring-primary/30"
- />
- </div>
- );
-}
-
-function FilterMenu({ filter, setFilter }: { filter: FilterId; setFilter: (f: FilterId) => void }) {
- // Reads the already-cached catalog rather than taking the categories through
- // three intermediate components. React Query dedupes on the shared key, so
- // this subscribes to existing data and issues no extra request.
- const { data } = useQuery({ queryKey: ["marketplace-plugins"], queryFn: fetchCatalog });
- const categories = orderedCategories(data, (data?.plugins ?? []).map(adapt));
- return (
- <div>
- <BrandedSelect
- value={filter}
- onValueChange={(value) => setFilter(value as FilterId)}
- ariaLabel="Plugin category"
- className="h-9 w-auto rounded-full bg-card/60 px-4 text-xs font-medium"
- options={[
- { value: "all", label: "All" },
- ...categories.map((category) => ({
- value: category,
- label: category,
- })),
- ]}
- />
- </div>
- );
-}
-
-/** Filters by connection state. Sits next to the category menu because the two
- * questions a user arrives with are "what kind of thing is it" and "is it
- * already hooked up" — the second one had no answer before. */
-function StatusFilterMenu({
- statusFilter,
- setStatusFilter,
-}: {
- statusFilter: StatusFilterId;
- setStatusFilter: (s: StatusFilterId) => void;
-}) {
- return (
- <div>
- <BrandedSelect
- value={statusFilter}
- onValueChange={(value) => setStatusFilter(value as StatusFilterId)}
- ariaLabel="Connection status"
- className="h-9 w-auto rounded-full bg-card/60 px-4 text-xs font-medium"
- options={(Object.keys(STATUS_FILTER_LABEL) as StatusFilterId[]).map((id) => ({
- value: id,
- label: STATUS_FILTER_LABEL[id],
- }))}
- />
- </div>
- );
-}
-
-function Tab({
- label,
- count,
- active,
- onClick,
-}: { label: string; count?: number; active: boolean; onClick: () => void }) {
- return (
- <button
- type="button"
- onClick={onClick}
- className={cn(
- "relative py-3 text-sm font-medium transition-colors",
- active ? "text-foreground" : "text-muted-foreground hover:text-foreground",
- )}
- >
- <span className="flex items-center gap-2">
- {label}
- {count !== undefined && (
- <span
- className={cn(
- "rounded-full px-1.5 py-0.5 text-[10px] font-semibold tabular-nums",
- active ? "bg-primary/20 text-primary" : "bg-muted text-muted-foreground",
- )}
- >
- {count}
- </span>
- )}
- </span>
- {active && (
- <span
- aria-hidden
- className="absolute inset-x-0 bottom-0 h-0.5 rounded-full bg-primary shadow-[0_0_8px_rgba(255,214,10,0.6)]"
- />
- )}
- </button>
- );
-}
-
-// ---------------------------------------------------------------------------
-// Auto-rotating hero carousel
-// ---------------------------------------------------------------------------
-
-interface CarouselSlide {
- pluginId: string;
- pluginName: string;
- example: string;
- iconUrl: string;
- iconBoost?: boolean;
- accent: string;
-}
-
-const SLIDES: CarouselSlide[] = [
- {
- pluginId: "google_calendar",
- pluginName: "Google Calendar",
- example: "Schedule a meeting for tomorrow at 3pm",
- iconUrl: "https://cdn.simpleicons.org/googlecalendar/F4F4F5",
- accent: "border-blue-400/40",
- },
- {
- pluginId: "github",
- pluginName: "GitHub",
- example: "Triage open issues on my main repo",
- iconUrl: "https://cdn.simpleicons.org/github/F4F4F5",
- accent: "border-zinc-400/40",
- },
- {
- pluginId: "vercel",
- pluginName: "Vercel",
- example: "Deploy my project to production",
- iconUrl: "https://cdn.simpleicons.org/vercel/F4F4F5",
- accent: "border-primary/50",
- },
- {
- pluginId: "supabase",
- pluginName: "Supabase",
- example: "Snapshot all my Supabase projects",
- iconUrl: "https://cdn.simpleicons.org/supabase",
- accent: "border-emerald-400/40",
- },
- {
- pluginId: "notion",
- pluginName: "Notion",
- example: "Find pages mentioning the Q3 plan",
- iconUrl: "https://cdn.simpleicons.org/notion/F4F4F5",
- accent: "border-zinc-300/40",
- },
- {
- pluginId: "slack",
- pluginName: "Slack",
- example: "Search messages mentioning the launch plan",
- iconUrl: "/plugin-assets/slack-logo.svg",
- iconBoost: true,
- accent: "border-purple-400/40",
- },
-];
-
-const SLIDE_INTERVAL_MS = 3500;
-
-function CarouselBanner() {
- const [active, setActive] = useState(0);
- const [manualOverride, setManualOverride] = useState(false);
- const timerRef = useRef<number | null>(null);
-
- useEffect(() => {
- if (manualOverride) {
- const t = window.setTimeout(() => setManualOverride(false), SLIDE_INTERVAL_MS * 2);
- return () => window.clearTimeout(t);
- }
- timerRef.current = window.setInterval(() => {
- setActive((i) => (i + 1) % SLIDES.length);
- }, SLIDE_INTERVAL_MS);
- return () => {
- if (timerRef.current !== null) window.clearInterval(timerRef.current);
- };
- }, [manualOverride]);
-
- return (
- <section
- // Wave hero restored. Two stacked inset shadows do the edge-kill:
- // - 180px black-92% inset → eats the rounded-3xl rim, the wave's
- // hard edges are gone before they reach the visible boundary.
- // - 140px gold-10% inset → faint warm glow so the rim doesn't
- // read as a dead frame.
- // bg-size 180% over-zooms the image deeply so only the brightest
- // mid-band is visible; whatever rim survives the zoom is then
- // swallowed by the black inset. This combo proved the only one
- // that actually kills the artefact — radial gradients alone left
- // a visible diagonal cut, the flat-only version felt sloppy.
- className="relative mb-12 aspect-[16/7] w-full overflow-hidden rounded-3xl shadow-[inset_0_0_180px_rgba(0,0,0,0.92),inset_0_0_140px_rgba(255,214,10,0.10)]"
- aria-roledescription="carousel"
- style={{
- backgroundImage: `url(${CAROUSEL_BG_URL})`,
- backgroundSize: "180%",
- backgroundPosition: "center 60%",
- backgroundRepeat: "no-repeat",
- backgroundColor: "#0a0a0a",
- }}
- >
- {SLIDES.map((slide, i) => (
- <CarouselSlideView key={slide.pluginId} slide={slide} active={active === i} />
- ))}
- <div className="absolute right-3 top-1/2 z-20 flex -translate-y-1/2 flex-col gap-2">
- {SLIDES.map((s, i) => (
- <button
- key={s.pluginId}
- type="button"
- onClick={() => {
- setActive(i);
- setManualOverride(true);
- }}
- aria-label={`Show ${s.pluginName} example`}
- className={cn(
- "h-1.5 w-1.5 rounded-full transition-all duration-300",
- active === i
- ? "scale-125 bg-primary shadow-[0_0_8px_rgba(255,214,10,0.7)]"
- : "bg-sheen/30 hover:bg-sheen/60",
- )}
- />
- ))}
- </div>
- </section>
- );
-}
-
-function CarouselSlideView({ slide, active }: { slide: CarouselSlide; active: boolean }) {
- return (
- <div
- className={cn(
- "absolute inset-0 flex items-center justify-center",
- "transition-[opacity,transform] duration-500 ease-out",
- active
- ? "translate-y-0 scale-100 opacity-100 z-10"
- : "translate-y-2 scale-[0.96] opacity-0 z-0",
- )}
- aria-hidden={!active}
- >
- <div
- className={cn(
- "flex items-center gap-2 rounded-full border bg-scrim/55 px-4 py-2 text-xs shadow-[0_8px_24px_rgba(0,0,0,0.45)] backdrop-blur-md",
- slide.accent,
- )}
- >
- <img
- src={slide.iconUrl}
- alt=""
- className={cn(slide.iconBoost ? "h-5 w-5" : "h-3.5 w-3.5")}
- loading="lazy"
- />
- <span className="font-medium text-foreground">{slide.pluginName}</span>
- <span className="text-muted-foreground">·</span>
- <span className="text-muted-foreground">{slide.example}</span>
- </div>
- </div>
- );
-}
-
-// ---------------------------------------------------------------------------
-// Categorized list
-// ---------------------------------------------------------------------------
-
-function CategorizedList({
- plugins,
- query,
- filtersActive,
- onReset,
- categoryOrder,
- onConnect,
- onDisconnect,
-}: {
- plugins: Plugin[];
- query: string;
- filtersActive: boolean;
- onReset: () => void;
- categoryOrder: string[];
-} & ConnectHandlers) {
- if (plugins.length === 0) {
- // Keyed on the filters, not on the query alone: narrowing by category or
- // connection state can empty the list just as easily, and that used to
- // render nothing at all — a blank page with no way back.
- if (!filtersActive) return null;
- return <EmptyHits query={query} onReset={onReset} />;
- }
-
- const featured = plugins.filter((p) => p.featured);
- // Built from the data, not from a fixed record. The previous fixed record
- // meant a category the backend added but the UI did not know threw on
- // `byCat[p.category].push(...)` and blanked the whole view behind its error
- // boundary.
- const byCat = new Map<string, Plugin[]>();
- for (const p of plugins) {
- if (p.featured) continue;
- const bucket = byCat.get(p.category);
- if (bucket) bucket.push(p);
- else byCat.set(p.category, [p]);
- }
- const sections = [
- ...categoryOrder.filter((c) => byCat.has(c)),
- ...[...byCat.keys()].filter((c) => !categoryOrder.includes(c)).sort(),
- ];
-
- return (
- <div className="space-y-10">
- {featured.length > 0 && (
- <Section title="Featured">
- {featured.map((p) => (
- <PluginRow
- key={p.id}
- plugin={p}
- onConnect={onConnect}
- onDisconnect={onDisconnect}
- />
- ))}
- </Section>
- )}
- {sections.map((c) => (
- <Section key={c} title={c}>
- {(byCat.get(c) ?? []).map((p) => (
- <PluginRow
- key={p.id}
- plugin={p}
- onConnect={onConnect}
- onDisconnect={onDisconnect}
- />
- ))}
- </Section>
- ))}
- </div>
- );
-}
-
-function Section({ title, children }: { title: string; children: React.ReactNode }) {
- return (
- <section>
- <h2 className="mb-3 font-display text-xs font-semibold uppercase tracking-[0.18em] text-muted-foreground">
- {title}
- </h2>
- <div className="grid gap-2 sm:grid-cols-2">{children}</div>
- </section>
- );
-}
-
-/** The card's brand mark.
- *
- * A full-colour asset carries the brand itself and sits on a neutral surface.
- * A single-colour glyph sits ON the brand's own colour — that inversion is
- * what makes the store read as a product catalog rather than a settings list;
- * a dark glyph on a white square reads as a placeholder.
- *
- * When the mark cannot load at all — offline, a locked-down network, or an
- * icon the CDN has dropped — the tile falls back to a monogram instead of a
- * broken image, so a card is never blank.
- */
-export function BrandTile({ plugin }: { plugin: Plugin }) {
+export function BrandTile({ plugin, size = "md" }: { plugin: Plugin; size?: "sm" | "md" }) {
const [failed, setFailed] = useState(false);
const tile = brandTile(plugin);
const fullColour = isFullColourMark(plugin);
const showMonogram = failed || !plugin.logoSlug;
+ const small = size === "sm";
return (
<div
className={cn(
- "grid h-10 w-10 shrink-0 place-items-center overflow-hidden rounded-lg border",
+ "grid shrink-0 place-items-center overflow-hidden rounded-lg border",
+ small ? "h-7 w-7 rounded-md" : "h-10 w-10",
// A bundled mark sits on a dark plate, not a white one: a row of white
// squares reads as pasted-in on this UI. The plate is a touch lighter
// than the card so the mark still has something to sit on. Brands whose
@@ -1572,7 +1483,7 @@ export function BrandTile({ plugin }: { plugin: Plugin }) {
>
{showMonogram ? (
<span
- className="text-sm font-semibold"
+ className={cn("font-semibold", small ? "text-xs" : "text-sm")}
style={{ color: `#${glyphColor(tile)}` }}
>
{plugin.name.slice(0, 1).toUpperCase()}
@@ -1581,7 +1492,9 @@ export function BrandTile({ plugin }: { plugin: Plugin }) {
<img
src={resolveLogoUrl(plugin)}
alt=""
- className={cn(fullColour ? "h-7 w-7" : "h-5 w-5")}
+ className={cn(
+ fullColour ? (small ? "h-5 w-5" : "h-7 w-7") : small ? "h-3.5 w-3.5" : "h-5 w-5",
+ )}
loading="lazy"
onError={() => setFailed(true)}
/>
@@ -1594,9 +1507,9 @@ export function BrandTile({ plugin }: { plugin: Plugin }) {
*
* Most providers keep a connection alive indefinitely; a few force a periodic
* re-login and no amount of engineering on our side can extend that. Saying so
- * on the card is the difference between an informed choice and a connection
- * that quietly dies weeks later. `provider_limited` carries a note explaining
- * how often — a warning without an answer would be worse than none.
+ * is the difference between an informed choice and a connection that quietly
+ * dies weeks later. `provider_limited` carries a note explaining how often — a
+ * warning without an answer would be worse than none.
*/
export function LongevityBadge({ plugin }: { plugin: Plugin }) {
const limited = plugin.longevity === "provider_limited";
@@ -1614,7 +1527,7 @@ export function LongevityBadge({ plugin }: { plugin: Plugin }) {
}
// ---------------------------------------------------------------------------
-// PluginRow — brand tile + status and longevity badges
+// Reauth explanation — why a connection died, in the user's terms
// ---------------------------------------------------------------------------
/** Why this connection died, in place of the description it replaces.
@@ -1625,7 +1538,7 @@ export function LongevityBadge({ plugin }: { plugin: Plugin }) {
* carries the actual fix (publish the OAuth app so Google stops expiring the
* grant every 7 days) — buried in a tooltip it never reached anyone.
*/
-export function ReauthExplanation({ plugin }: { plugin: Plugin }) {
+export function ReauthExplanation({ plugin, inline }: { plugin: Plugin; inline?: boolean }) {
const reason = plugin.reauthReason;
const explanation =
reason && reason in REAUTH_EXPLANATION
@@ -1638,6 +1551,10 @@ export function ReauthExplanation({ plugin }: { plugin: Plugin }) {
const retrying = retriesItself(reason);
const fix = plugin.longevity === "provider_limited" ? plugin.longevityNote : undefined;
+ if (inline) {
+ return <span className="text-amber-500/90">{headline}</span>;
+ }
+
return (
<>
<p
@@ -1655,119 +1572,6 @@ export function ReauthExplanation({ plugin }: { plugin: Plugin }) {
);
}
-function PluginRow({
- plugin,
- onConnect,
- onDisconnect,
-}: { plugin: Plugin } & ConnectHandlers) {
- const isConnected = plugin.status === "connected";
- const needsReauth = plugin.status === "needs_reauth";
- const isError = plugin.status === "error";
-
- // "I want this plugin" should not require hitting a 28px "+". The whole card
- // starts the same flow. A CONNECTED card stays inert on purpose: disconnecting
- // is destructive and must remain a deliberate click on the check.
- const { busy, run } = useConnectLock(() => onConnect(plugin));
- const cardStartsConnect = !isConnected;
-
- return (
- <article
- // Stable DOM id so the "Jump to it" affordance in AttentionBanner can
- // scrollIntoView + flash this exact row. `scroll-mt-24` leaves headroom
- // under the sticky tab bar so the scrolled-to row isn't hidden beneath it.
- id={`plugin-row-${plugin.id}`}
- onClick={cardStartsConnect ? () => void run() : undefined}
- className={cn(
- "group flex items-center gap-3 rounded-lg border bg-card/40 px-3 py-2.5 transition-[colors,box-shadow] scroll-mt-24",
- isConnected && "border-primary/30",
- needsReauth && "border-amber-500/40",
- isError && "border-destructive/40",
- !isConnected &&
- !needsReauth &&
- !isError &&
- "border-border hover:border-primary/40 hover:bg-card/70",
- cardStartsConnect && "cursor-pointer",
- busy && "cursor-wait",
- )}
- >
- <BrandTile plugin={plugin} />
-
- <div className="min-w-0 flex-1">
- {/* `flex-wrap` + `shrink-0` badges: when a connected plugin's
- "· Connected · Live" badges don't fit beside the name, they wrap to
- the next line instead of squeezing the (truncating) name down to
- "GitH…"/"Gm…". The name keeps priority and only truncates on a
- genuinely long name. */}
- <div className="flex flex-wrap items-center gap-x-2 gap-y-0.5">
- <h3 className="min-w-0 max-w-full truncate text-sm font-semibold tracking-tight text-foreground">
- {plugin.name}
- </h3>
- {isConnected && (
- <span className="shrink-0 text-[9px] font-medium uppercase tracking-wider text-primary">
- · Connected
- </span>
- )}
- {isConnected && plugin.liveCallable && (
- <span className="shrink-0 text-[9px] font-medium uppercase tracking-wider text-emerald-400">
- · Live
- </span>
- )}
- {needsReauth && (
- <span className="inline-flex shrink-0 items-center gap-1 text-[9px] font-medium uppercase tracking-wider text-amber-500">
- <AlertTriangle className="h-2.5 w-2.5" />
- <span>Reconnect needed</span>
- </span>
- )}
- {isError && (
- <span className="inline-flex shrink-0 items-center gap-1 text-[9px] font-medium uppercase tracking-wider text-destructive">
- <AlertTriangle className="h-2.5 w-2.5" />
- <span>Error</span>
- </span>
- )}
- {plugin.fromMarketplace && (
- <MarketplaceBadge publisher={plugin.publisher} />
- )}
- {plugin.selfUploaded && (
- // Without this a plugin the owner dropped in themselves would
- // read exactly like one the app ships — same card, same absence
- // of a badge. The mark is what keeps "reviewed by nobody"
- // visible after the install dialog is long gone.
- <span
- title={translate("plugin_upload.unreviewed")}
- className="inline-flex shrink-0 items-center gap-1 rounded-full border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-amber-700 dark:text-amber-300"
- >
- <Upload className="h-3 w-3" aria-hidden />
- {translate("plugin_upload.self_badge")}
- </span>
- )}
- </div>
- {needsReauth ? (
- <ReauthExplanation plugin={plugin} />
- ) : (
- <p className="truncate text-xs text-muted-foreground">{plugin.description}</p>
- )}
- </div>
-
- <div className="hidden shrink-0 flex-col items-end gap-0.5 sm:flex">
- <span
- className="text-[9px] font-medium uppercase tracking-wider text-muted-foreground/70"
- title={plugin.category}
- >
- {AUTH_LABELS[plugin.authMode]}
- </span>
- <LongevityBadge plugin={plugin} />
- </div>
-
- <ConnectIconButton
- status={plugin.status}
- onConnect={run}
- busy={busy}
- onDisconnect={() => onDisconnect(plugin.id)}
- />
- </article>
- );
-}
-
/** One in-flight connect per plugin, no matter what started it.
*
* `/connect/start` (DCR registration) takes ~0.6s with no other feedback, so
@@ -1885,47 +1689,6 @@ export function ConnectIconButton({
);
}
-function EmptyHits({ query, onReset }: { query: string; onReset: () => void }) {
- return (
- <div className="rounded-xl border border-dashed border-border bg-card/40 px-6 py-12 text-center">
- <p className="text-sm text-muted-foreground">
- {query.trim() ? (
- <>
- No plugin matches <span className="font-mono text-foreground">"{query}"</span>.
- </>
- ) : (
- "No plugin matches the current filters."
- )}
- </p>
- <button
- type="button"
- onClick={onReset}
- className="mt-4 rounded-full border border-border/60 px-3 py-1 text-xs font-medium text-muted-foreground transition-colors hover:border-primary/40 hover:text-foreground focus:outline-none focus:ring-1 focus:ring-primary/30"
- >
- Show all plugins
- </button>
- </div>
- );
-}
-
-function EmptyInstalled({ totalAvailable }: { totalAvailable: number }) {
- const assistantName = useEventStore((s) => s.assistantName);
- return (
- <div className="flex flex-col items-center justify-center rounded-xl border border-dashed border-border bg-card/40 px-8 py-14 text-center">
- <div className="mb-4 grid h-11 w-11 place-items-center rounded-full bg-primary/10 text-primary">
- <Sparkles className="h-5 w-5" />
- </div>
- <h3 className="font-display text-base font-semibold tracking-tight">
- Nothing connected yet
- </h3>
- <p className="mt-2 max-w-xs text-xs leading-relaxed text-muted-foreground">
- Pick one of the {totalAvailable} services in the Browse tab to give {assistantName} hands beyond
- your local machine.
- </p>
- </div>
- );
-}
-
// ---------------------------------------------------------------------------
// OAuth Redirect Dialog — used by Notion (and any future hosted-MCP plugin
// with DCR + PKCE). The browser tab is already opened by the caller; this
diff --git a/jarvis/ui/web/frontend/src/views/SkillUploadDialog.tsx b/jarvis/ui/web/frontend/src/views/SkillUploadDialog.tsx
index 5ef8132ba6..774876d5c2 100644
--- a/jarvis/ui/web/frontend/src/views/SkillUploadDialog.tsx
+++ b/jarvis/ui/web/frontend/src/views/SkillUploadDialog.tsx
@@ -50,10 +50,14 @@ export function SkillUploadDialog({
open,
onClose,
onInstalled,
+ initialMode = "choose",
}: {
open: boolean;
onClose: () => void;
onInstalled?: (name: string) => void;
+ /** Which step the dialog opens on — the "Add ▾" menu jumps straight to the
+ * link importer; the default lets the owner choose. */
+ initialMode?: Mode;
}) {
const t = useT();
const qc = useQueryClient();
@@ -80,7 +84,8 @@ export function SkillUploadDialog({
useEffect(() => {
if (!open) reset();
- }, [open, reset]);
+ else setMode(initialMode);
+ }, [open, reset, initialMode]);
const inspect = useCallback(
async (files: PickedFile[]) => {
diff --git a/jarvis/ui/web/frontend/src/views/SkillsView.tsx b/jarvis/ui/web/frontend/src/views/SkillsView.tsx
index c0bfa0262a..13f3dacd63 100644
--- a/jarvis/ui/web/frontend/src/views/SkillsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/SkillsView.tsx
@@ -1,7 +1,7 @@
-import { useMemo, useState, useEffect, useCallback, useRef } from "react";
-import { Reorder, useDragControls } from "framer-motion";
+import { useMemo, useState, useEffect, useCallback } from "react";
+import ReactMarkdown from "react-markdown";
+import remarkGfm from "remark-gfm";
import {
- Puzzle,
RefreshCw,
Lock,
AlertTriangle,
@@ -9,15 +9,10 @@ import {
Keyboard,
Clock,
Save,
- FolderOpen,
- ChevronRight,
- ChevronDown,
FileText,
FileCode,
FileBox,
UserSquare,
- X,
- Sparkles,
Plus,
Search,
X as XIcon,
@@ -27,23 +22,49 @@ import {
BookOpen,
Github,
Trash2,
- GripVertical,
ListChecks,
Check,
Upload,
+ Link2,
+ Eye,
+ Code2,
+ ChevronDown,
+ MoreHorizontal,
+ Info,
+ Copy,
} from "lucide-react";
import { SkillFinderDialog } from "@/views/SkillFinderDialog";
import { SkillCreateDialog } from "@/views/SkillCreateDialog";
import { SkillUploadDialog } from "@/views/SkillUploadDialog";
-import { ViewHeader } from "@/views/ChatsView";
import { ScrollArea } from "@/components/ui/scroll-area";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import { MarketplaceBadge } from "@/components/MarketplaceBadge";
import { Switch } from "@/components/ui/switch";
import { BrandedSelect } from "@/components/ui/select";
+import {
+ ActionMenu,
+ BackLink,
+ Cell,
+ ClampedText,
+ DetailHeader,
+ EmptyRow,
+ FactRows,
+ IconButton,
+ InlineSearch,
+ MenuPill,
+ Panel,
+ PanelHeader,
+ SoftButton,
+ Table,
+ TableHead,
+ TableRow,
+ formatShortDate,
+ type Column,
+} from "@/components/extensions/primitives";
import { cn } from "@/lib/utils";
-import { translate, useT } from "@/i18n";
+import { robustCopy } from "@/lib/clipboard";
+import { fill, translate, useT, useUiLanguage } from "@/i18n";
import {
useSkillsList,
useSkillDetail,
@@ -55,7 +76,6 @@ import {
useSkillLinkHealth,
useDeleteSkill,
useBulkDeleteSkills,
- useReorderSkills,
RESOURCE_KINDS,
RESOURCE_LABELS,
type SkillSummary,
@@ -83,16 +103,6 @@ function stateLabel(state: SkillState): string {
}
}
-const STATE_VARIANT: Record<
- SkillState,
- "default" | "secondary" | "destructive" | "outline"
-> = {
- active: "default",
- validated: "secondary",
- draft: "secondary",
- disabled: "outline",
-};
-
const TRIGGER_ICON: Record<SkillTrigger["type"], typeof Mic> = {
voice: Mic,
hotkey: Keyboard,
@@ -116,6 +126,15 @@ function isBrokenDraft(skill: {
return skill.state === "draft" && Boolean(skill.error);
}
+/** "You" / "Built-in" / the marketplace publisher — the Author column. */
+function authorLabel(skill: Pick<SkillSummary, "is_builtin" | "origin">): string {
+ if (skill.is_builtin) return translate("skills_view.author_builtin");
+ if (skill.origin?.source === "marketplace") {
+ return skill.origin.publisher || translate("marketplace_origin.badge");
+ }
+ return translate("skills_view.author_you");
+}
+
// In-memory admin pass — holds the pass for the session so the user doesn't
// have to re-enter it on every edit. Deliberately not localStorage: whoever
// closes the app has to re-enter the pass on the next start.
@@ -126,45 +145,38 @@ export function SkillsView() {
const { data, isLoading, error, refetch, isRefetching } = useSkillsList();
const reload = useReloadSkills();
const setEnabled = useSetSkillEnabled();
- const reorder = useReorderSkills();
const del = useDeleteSkill();
const bulkDel = useBulkDeleteSkills();
const [selected, setSelected] = useState<string | null>(null);
const [finderOpen, setFinderOpen] = useState(false);
const [createOpen, setCreateOpen] = useState(false);
const [uploadOpen, setUploadOpen] = useState(false);
+ const [uploadMode, setUploadMode] = useState<"choose" | "link">("choose");
const [confirmDelete, setConfirmDelete] = useState<SkillSummary | null>(null);
- // Multi-select: a "selection mode" turns the per-row drag handle into a
- // checkbox so the user can tick several skills and delete them in ONE
- // confirmed batch (instead of repeating the single-delete flow per skill).
- // Built-ins are never selectable — they can't be deleted anyway.
+ // Multi-select: a "selection mode" adds a checkbox column so the user can
+ // tick several skills and delete them in ONE confirmed batch (instead of
+ // repeating the single-delete flow per skill). Built-ins are never
+ // selectable — they can't be deleted anyway.
const [selectionMode, setSelectionMode] = useState(false);
const [checked, setChecked] = useState<Set<string>>(new Set());
const [confirmBulk, setConfirmBulk] = useState(false);
+ const [searchOpen, setSearchOpen] = useState(false);
const [queryInput, setQueryInput] = useState("");
const [debouncedQuery, setDebouncedQuery] = useState("");
const [ownerFilter, setOwnerFilter] = useState<"all" | "user" | "builtin">("all");
const [categoryFilter, setCategoryFilter] = useState<string | null>(null);
- // Local, drag-reorderable copy of the server list. The server already returns
- // skills in the user's saved order; we mirror it so a drag updates instantly
- // and the persisted order (PUT /order) confirms it on drop.
+ // Local copy of the server list so a switch flips instantly; the refetch
+ // confirms.
const [items, setItems] = useState<SkillSummary[]>([]);
useEffect(() => {
if (data?.skills) setItems(data.skills);
}, [data]);
- const itemsRef = useRef<SkillSummary[]>([]);
- itemsRef.current = items;
- const persistOrder = useCallback(() => {
- reorder.mutate(itemsRef.current.map((s) => s.name));
- }, [reorder]);
-
const onToggle = useCallback(
(name: string, on: boolean) => {
- // Optimistic flip so the switch responds instantly; the refetch confirms.
setItems((prev) =>
prev.map((it) =>
it.name === name ? { ...it, state: on ? "active" : "disabled" } : it,
@@ -222,7 +234,7 @@ export function SkillsView() {
});
}, [checked, bulkDel, selected, exitSelection]);
- // Debounce: 250ms nach letztem Tastendruck
+ // Debounce: 250 ms after the last keystroke.
useEffect(() => {
const tmr = setTimeout(() => setDebouncedQuery(queryInput.trim()), 250);
return () => clearTimeout(tmr);
@@ -233,8 +245,8 @@ export function SkillsView() {
ownerFilter !== "all" ||
categoryFilter !== null;
- // Search and selection don't mix (selection acts on the ordered full list),
- // so a search starting mid-selection drops us back out of selection mode.
+ // Search and selection don't mix (selection acts on the full list), so a
+ // search starting mid-selection drops us back out of selection mode.
useEffect(() => {
if (searchActive) exitSelection();
}, [searchActive, exitSelection]);
@@ -272,88 +284,30 @@ export function SkillsView() {
setCategoryFilter(null);
};
- return (
- <div className="flex h-full min-h-0 flex-col">
- <ViewHeader
- icon={<Puzzle className="h-4 w-4 text-primary" />}
- title={t("skills_view.title")}
- subtitle={t("skills_view.subtitle")}
- right={
- <div className="flex items-center gap-1">
- <Button
- size="sm"
- variant="default"
- onClick={() => setCreateOpen(true)}
- className="gap-1.5"
- >
- <Plus className="h-3.5 w-3.5" />
- Neuer Skill
- </Button>
- <Button
- size="sm"
- variant="outline"
- onClick={() => setUploadOpen(true)}
- className="gap-1.5"
- >
- <Upload className="h-3.5 w-3.5" />
- {t("skill_upload.button")}
- </Button>
- <Button
- size="sm"
- variant="outline"
- onClick={() => setFinderOpen(true)}
- className="gap-1.5"
- >
- <Sparkles className="h-3.5 w-3.5" />
- Skill suchen
- </Button>
- {!searchActive && items.length > 0 && (
- <Button
- size="sm"
- variant={selectionMode ? "secondary" : "ghost"}
- onClick={() => (selectionMode ? exitSelection() : setSelectionMode(true))}
- className="gap-1.5"
- >
- <ListChecks className="h-3.5 w-3.5" />
- {selectionMode
- ? t("skills_view.delete_cancel")
- : t("skills_view.select")}
- </Button>
- )}
- <Button
- size="sm"
- variant="ghost"
- onClick={handleRefresh}
- disabled={isRefetching || reload.isPending}
- >
- <RefreshCw
- className={cn(
- "h-4 w-4",
- (isRefetching || reload.isPending) && "animate-spin",
- )}
- />
- </Button>
- </div>
- }
- />
+ const closeSearch = () => {
+ clearFilters();
+ setSearchOpen(false);
+ };
- <SkillFinderDialog
- open={finderOpen}
- onClose={() => setFinderOpen(false)}
- />
+ const openUpload = (mode: "choose" | "link") => {
+ setUploadMode(mode);
+ setUploadOpen(true);
+ };
+ const dialogs = (
+ <>
+ <SkillFinderDialog open={finderOpen} onClose={() => setFinderOpen(false)} />
<SkillCreateDialog
open={createOpen}
onClose={() => setCreateOpen(false)}
onCreated={(name) => setSelected(name)}
/>
-
<SkillUploadDialog
open={uploadOpen}
+ initialMode={uploadMode}
onClose={() => setUploadOpen(false)}
onInstalled={(name) => setSelected(name)}
/>
-
{confirmDelete && (
<DeleteConfirmDialog
skill={confirmDelete}
@@ -372,7 +326,6 @@ export function SkillsView() {
}
/>
)}
-
{confirmBulk && (
<BulkDeleteConfirmDialog
names={Array.from(checked)}
@@ -381,90 +334,177 @@ export function SkillsView() {
onConfirm={handleBulkDelete}
/>
)}
+ </>
+ );
- <div className="flex min-h-0 flex-1">
- {/* Left column: list */}
- <div className="flex w-[340px] flex-col border-r border-border">
- {/* Search bar + filter chips */}
- <div className="space-y-2 border-b border-border bg-muted/20 px-3 py-2.5">
- <div className="relative">
- <Search className="absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
- <input
- type="text"
- value={queryInput}
- onChange={(e) => setQueryInput(e.target.value)}
- placeholder={t("skills_view.search_placeholder")}
- className="w-full rounded-md border border-border bg-background py-1.5 pl-7 pr-7 text-xs focus:outline-none focus:ring-1 focus:ring-primary"
- />
- {queryInput && (
- <button
- type="button"
- onClick={() => setQueryInput("")}
- className="absolute right-1.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground"
- aria-label={t("skills_view.clear_search")}
+ // ---- Detail page -------------------------------------------------------
+ if (selected) {
+ const summary = items.find((s) => s.name === selected) ?? null;
+ return (
+ <div className="flex h-full min-h-0 flex-col">
+ <ScrollArea className="flex-1">
+ <div className="mx-auto w-full max-w-4xl px-8 py-6">
+ <SkillDetailPage
+ name={selected}
+ summary={summary}
+ onBack={() => setSelected(null)}
+ onDelete={() => {
+ if (summary) setConfirmDelete(summary);
+ }}
+ />
+ </div>
+ </ScrollArea>
+ {dialogs}
+ </div>
+ );
+ }
+
+ // ---- List page ---------------------------------------------------------
+ const columns: Column[] = [
+ ...(selectionMode
+ ? [{ id: "check", label: t("skills_view.select"), width: "20px", srOnly: true }]
+ : []),
+ { id: "name", label: t("skills_view.col_skill") },
+ { id: "updated", label: t("skills_view.col_updated"), width: "110px" },
+ { id: "author", label: t("skills_view.col_author"), width: "130px" },
+ { id: "enabled", label: t("skills_view.col_enabled"), width: "44px", srOnly: true, align: "right" },
+ { id: "actions", label: t("skills_view.col_actions"), width: "28px", srOnly: true, align: "right" },
+ ];
+
+ const rows: (SkillSummary | LocalSkillHit)[] = searchActive
+ ? (search.data?.skills ?? [])
+ : items;
+
+ const countLabel = fill(t("skills_view.count"), { n: items.length });
+
+ return (
+ <div className="flex h-full min-h-0 flex-col">
+ <ScrollArea className="flex-1">
+ <div className="mx-auto w-full max-w-4xl px-8 py-6">
+ <PanelHeader
+ title={t("skills_view.title")}
+ subtitle={!isLoading && !error ? countLabel : undefined}
+ actions={
+ <>
+ <IconButton
+ label={t("skills_view.search_placeholder")}
+ active={searchOpen}
+ onClick={() => (searchOpen ? closeSearch() : setSearchOpen(true))}
>
- <XIcon className="h-3 w-3" />
- </button>
- )}
- </div>
- <div className="flex flex-wrap gap-1">
- <FilterChip
- label={t("skills_view.filter_all")}
- active={ownerFilter === "all"}
- onClick={() => setOwnerFilter("all")}
- />
- <FilterChip
- label={t("skills_view.filter_mine")}
- active={ownerFilter === "user"}
- onClick={() => setOwnerFilter("user")}
- />
- <FilterChip
- label="Builtin"
- active={ownerFilter === "builtin"}
- onClick={() => setOwnerFilter("builtin")}
- />
- {categoryOptions.length > 0 && (
- <BrandedSelect
- value={categoryFilter ?? ""}
- onValueChange={(value) => setCategoryFilter(value || null)}
- ariaLabel={t("skills_view.all_categories")}
- className="w-auto rounded-full px-2 py-0.5 text-[10px]"
- options={[
+ <Search className="h-4 w-4" />
+ </IconButton>
+ {!searchActive && items.length > 0 && (
+ <IconButton
+ label={selectionMode ? t("skills_view.delete_cancel") : t("skills_view.select")}
+ active={selectionMode}
+ onClick={() => (selectionMode ? exitSelection() : setSelectionMode(true))}
+ >
+ <ListChecks className="h-4 w-4" />
+ </IconButton>
+ )}
+ <IconButton
+ label={t("skills_view.reload")}
+ onClick={handleRefresh}
+ busy={isRefetching || reload.isPending}
+ >
+ <RefreshCw className="h-4 w-4" />
+ </IconButton>
+ <SoftButton onClick={() => setFinderOpen(true)} className="ml-1">
+ {t("skills_view.browse")}
+ </SoftButton>
+ <ActionMenu
+ label={t("skills_view.add")}
+ actions={[
+ {
+ id: "create",
+ label: t("skills_view.add_create"),
+ icon: <Plus className="h-3.5 w-3.5" />,
+ onSelect: () => setCreateOpen(true),
+ },
+ {
+ id: "upload",
+ label: t("skills_view.add_upload"),
+ icon: <Upload className="h-3.5 w-3.5" />,
+ onSelect: () => openUpload("choose"),
+ },
{
- value: "",
- label: t("skills_view.all_categories"),
+ id: "import",
+ label: t("skills_view.add_import"),
+ icon: <Link2 className="h-3.5 w-3.5" />,
+ onSelect: () => openUpload("link"),
},
- ...categoryOptions.map((category) => ({
- value: category,
- label: category,
- })),
]}
+ trigger={({ open, toggle }) => (
+ <MenuPill open={open} toggle={toggle}>
+ {t("skills_view.add")}
+ </MenuPill>
+ )}
/>
- )}
- {searchActive && (
- <button
- type="button"
- onClick={clearFilters}
- className="ml-auto text-[10px] text-muted-foreground underline hover:text-foreground"
- >
- {t("skills_view.reset_filters")}
- </button>
- )}
- </div>
- {searchActive && search.data && (
- <div className="flex items-center justify-between text-[10px] text-muted-foreground">
- <span>
- {search.data.total} {t("skills_view.matches")}
- </span>
- {search.data.brain_used && (
- <span className="flex items-center gap-1">
- <Sparkle className="h-2.5 w-2.5" />
- {t("skills_view.ai_ranked")}
+ </>
+ }
+ />
+
+ {searchOpen && (
+ <div className="mt-4 space-y-2">
+ <div className="flex items-center gap-2">
+ <div className="flex-1">
+ <InlineSearch
+ value={queryInput}
+ onChange={setQueryInput}
+ placeholder={t("skills_view.search_placeholder")}
+ autoFocus
+ />
+ </div>
+ <IconButton label={t("skills_view.clear_search")} onClick={closeSearch}>
+ <XIcon className="h-4 w-4" />
+ </IconButton>
+ </div>
+ <div className="flex flex-wrap items-center gap-1.5">
+ <FilterChip
+ label={t("skills_view.filter_all")}
+ active={ownerFilter === "all"}
+ onClick={() => setOwnerFilter("all")}
+ />
+ <FilterChip
+ label={t("skills_view.filter_mine")}
+ active={ownerFilter === "user"}
+ onClick={() => setOwnerFilter("user")}
+ />
+ <FilterChip
+ label={t("skills_view.author_builtin")}
+ active={ownerFilter === "builtin"}
+ onClick={() => setOwnerFilter("builtin")}
+ />
+ {categoryOptions.length > 0 && (
+ <BrandedSelect
+ value={categoryFilter ?? ""}
+ onValueChange={(value) => setCategoryFilter(value || null)}
+ ariaLabel={t("skills_view.all_categories")}
+ className="w-auto rounded-full px-2 py-0.5 text-[11px]"
+ options={[
+ { value: "", label: t("skills_view.all_categories") },
+ ...categoryOptions.map((category) => ({
+ value: category,
+ label: category,
+ })),
+ ]}
+ />
+ )}
+ {searchActive && search.data && (
+ <span className="ml-auto flex items-center gap-2 text-[11px] text-muted-foreground">
+ {search.data.total} {t("skills_view.matches")}
+ {search.data.brain_used && (
+ <span className="flex items-center gap-1">
+ <Sparkle className="h-2.5 w-2.5" />
+ {t("skills_view.ai_ranked")}
+ </span>
+ )}
</span>
)}
</div>
- )}
- </div>
+ </div>
+ )}
+
{selectionMode && (
<SelectionToolbar
total={deletableNames.length}
@@ -474,240 +514,168 @@ export function SkillsView() {
onDelete={() => setConfirmBulk(true)}
/>
)}
- <ScrollArea className="flex-1">
- <div className="space-y-3 p-4">
- {isLoading && (
- <div className="text-sm text-muted-foreground">{t("skills_view.loading")}</div>
- )}
- {error && (
- <div className="rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive">
- {t("skills_view.load_error")}: {(error as Error).message}
- </div>
- )}
- {searchActive ? (
- <SearchResults
- isPending={search.isPending || search.isFetching}
- error={search.error as Error | null}
- results={search.data?.skills ?? []}
- selected={selected}
- onSelect={setSelected}
- />
- ) : (
- <>
- {!isLoading && !error && items.length === 0 && <EmptyList />}
- <Reorder.Group
- axis="y"
- values={items}
- onReorder={setItems}
- as="ul"
- className="space-y-1.5"
- >
- {items.map((s) => (
- <SkillRowDraggable
- key={s.name}
- skill={s}
- selected={selected === s.name}
- selectionMode={selectionMode}
- checked={checked.has(s.name)}
- onCheckChange={() => toggleChecked(s.name)}
- onSelect={() => setSelected(s.name)}
- onToggle={(on) => onToggle(s.name, on)}
- onDelete={() => setConfirmDelete(s)}
- onDragEnd={persistOrder}
- />
- ))}
- </Reorder.Group>
- </>
- )}
- </div>
- </ScrollArea>
- </div>
- {/* Right column: detail panel */}
- <div className="flex min-w-0 flex-1 flex-col">
- {selected ? (
- <SkillDetailPanel name={selected} />
- ) : (
- <div className="flex h-full items-center justify-center text-sm text-muted-foreground">
- {t("skills_view.select_from_list")}
- </div>
- )}
+ <div className="mt-4">
+ {isLoading && (
+ <div className="py-8 text-center text-sm text-muted-foreground">
+ {t("skills_view.loading")}
+ </div>
+ )}
+ {error && (
+ <div className="rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive">
+ {t("skills_view.load_error")}: {(error as Error).message}
+ </div>
+ )}
+ {!isLoading && !error && (
+ <Table label={t("skills_view.title")}>
+ <TableHead columns={columns} />
+ {searchActive && (search.isPending || search.isFetching) && rows.length === 0 && (
+ <div className="px-3 py-6 text-center text-xs text-muted-foreground">
+ {t("skills_view.searching")}
+ </div>
+ )}
+ {searchActive && search.error && (
+ <div className="m-3 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-xs text-destructive">
+ {t("skills_view.search_failed")}: {(search.error as Error).message}
+ </div>
+ )}
+ {rows.map((s) => (
+ <SkillRow
+ key={s.name}
+ skill={s}
+ columns={columns}
+ selectionMode={selectionMode}
+ checked={checked.has(s.name)}
+ onCheckChange={() => toggleChecked(s.name)}
+ onOpen={() => setSelected(s.name)}
+ onToggle={(on) => onToggle(s.name, on)}
+ onDelete={() => setConfirmDelete(s)}
+ />
+ ))}
+ {rows.length === 0 && !searchActive && <EmptyList />}
+ {rows.length === 0 &&
+ searchActive &&
+ !search.isPending &&
+ !search.isFetching &&
+ !search.error && (
+ <EmptyRow>{t("skills_view.search_no_hits")}</EmptyRow>
+ )}
+ </Table>
+ )}
+ </div>
</div>
- </div>
+ </ScrollArea>
+ {dialogs}
</div>
);
}
// ----------------------------------------------------------------------
-// Left column — draggable list row (On/Off switch + delete)
+// Table row
// ----------------------------------------------------------------------
-function SkillRowDraggable({
+function SkillRow({
skill,
- selected,
+ columns,
selectionMode,
checked,
onCheckChange,
- onSelect,
+ onOpen,
onToggle,
onDelete,
- onDragEnd,
}: {
- skill: SkillSummary;
- selected: boolean;
+ skill: SkillSummary | LocalSkillHit;
+ columns: Column[];
selectionMode: boolean;
checked: boolean;
onCheckChange: () => void;
- onSelect: () => void;
+ onOpen: () => void;
onToggle: (on: boolean) => void;
onDelete: () => void;
- onDragEnd: () => void;
}) {
const t = useT();
- const controls = useDragControls();
+ const locale = useUiLanguage();
const broken = isBrokenDraft(skill);
const on = isSkillOn(skill.state);
- // In selection mode the whole row body toggles the checkbox (built-ins are
- // protected and stay inert); otherwise it opens the detail panel.
const selectable = selectionMode && !skill.is_builtin;
- const onBodyClick = selectionMode
- ? selectable
- ? onCheckChange
- : () => {}
- : onSelect;
+ const reason = "reason" in skill ? skill.reason : undefined;
return (
- <Reorder.Item
- value={skill}
- dragListener={false}
- dragControls={controls}
- onDragEnd={onDragEnd}
- as="li"
+ <TableRow
+ columns={columns}
+ onClick={selectionMode ? (selectable ? onCheckChange : undefined) : onOpen}
+ className={cn(selectionMode && skill.is_builtin && "opacity-50")}
+ selected={checked}
+ ariaLabel={skill.name}
>
- <div
- className={cn(
- "flex items-start gap-1.5 rounded-md border p-2.5 transition-colors",
- selected
- ? "border-primary/60 bg-primary/5"
- : checked
- ? "border-primary/60 bg-primary/10"
- : "border-border hover:bg-muted/40",
- // Built-ins can't be deleted — recede them visually in selection mode.
- selectionMode && skill.is_builtin && "opacity-50",
- )}
- >
- {selectionMode ? (
- /* Selection mode: a styled checkbox replaces the drag handle. Built-ins
- can't be deleted, so they get an inert spacer (the lock next to the
- name already marks them protected) instead of a second lock icon. */
- skill.is_builtin ? (
- <span className="mt-0.5 h-4 w-4 flex-shrink-0" aria-hidden="true" />
+ {selectionMode && (
+ <Cell stop>
+ {skill.is_builtin ? (
+ <span className="block h-4 w-4" aria-hidden="true" />
) : (
<SelectBox
checked={checked}
onChange={onCheckChange}
label={`${t("skills_view.select")} ${skill.name}`}
- className="mt-0.5"
/>
- )
+ )}
+ </Cell>
+ )}
+ <Cell>
+ <div className="flex items-center gap-1.5">
+ <span className="truncate text-[13px] font-medium">{skill.name}</span>
+ {skill.is_builtin && (
+ <Lock className="h-3 w-3 shrink-0 text-muted-foreground/70" aria-label={t("skills_view.author_builtin")} />
+ )}
+ {skill.origin?.source === "marketplace" && (
+ <MarketplaceBadge compact publisher={skill.origin.publisher} />
+ )}
+ {skill.triggers.map((tr, i) => {
+ const Icon = TRIGGER_ICON[tr.type];
+ return <Icon key={i} className="h-3 w-3 shrink-0 text-muted-foreground/60" aria-label={tr.type} />;
+ })}
+ </div>
+ {(skill.description || reason) && (
+ <p className="mt-0.5 truncate text-[11px] text-muted-foreground" title={skill.description}>
+ {reason ? <span className="italic">{reason}</span> : skill.description}
+ </p>
+ )}
+ </Cell>
+ <Cell muted>{formatShortDate(skill.updated_at, locale)}</Cell>
+ <Cell muted>
+ <span className="truncate">{authorLabel(skill)}</span>
+ </Cell>
+ <Cell align="right" stop>
+ {broken ? (
+ <span
+ className="flex items-center gap-1 text-[11px] font-medium text-destructive"
+ title={skill.error ?? undefined}
+ >
+ <AlertTriangle className="h-3.5 w-3.5" />
+ {t("skills_view.error")}
+ </span>
) : (
- /* Drag handle — only this starts a reorder (dragListener is off). */
+ <Switch
+ checked={on}
+ onCheckedChange={onToggle}
+ aria-label={`${skill.name}: ${on ? t("skills_view.on") : t("skills_view.off")}`}
+ />
+ )}
+ </Cell>
+ <Cell align="right" stop>
+ {!skill.is_builtin && !selectionMode && (
<button
type="button"
- onPointerDown={(e) => controls.start(e)}
- className="mt-0.5 cursor-grab touch-none text-muted-foreground/50 hover:text-muted-foreground active:cursor-grabbing"
- title={t("skills_view.drag_hint")}
- aria-label={t("skills_view.drag_hint")}
+ onClick={onDelete}
+ aria-label={t("skills_view.delete")}
+ title={t("skills_view.delete")}
+ className="rounded p-1 text-muted-foreground/0 transition-colors hover:bg-destructive/10 hover:text-destructive group-hover:text-muted-foreground/70 focus-visible:text-muted-foreground"
>
- <GripVertical className="h-3.5 w-3.5" />
+ <Trash2 className="h-3.5 w-3.5" />
</button>
)}
-
- {/* Select area */}
- <button
- type="button"
- onClick={onBodyClick}
- className="min-w-0 flex-1 text-left"
- >
- <div className="flex items-center gap-1.5">
- <span className="truncate text-sm font-medium">{skill.name}</span>
- {skill.is_builtin && (
- <Lock
- className="h-3 w-3 flex-shrink-0 text-muted-foreground"
- aria-label="Builtin"
- />
- )}
- {skill.origin?.source === "marketplace" && (
- <MarketplaceBadge
- compact
- publisher={skill.origin.publisher}
- />
- )}
- </div>
- {skill.description && (
- <p className="mt-1 line-clamp-2 text-xs text-muted-foreground">
- {skill.description}
- </p>
- )}
- <div className="mt-2 flex items-center gap-1.5">
- {skill.triggers.map((tr, i) => {
- const Icon = TRIGGER_ICON[tr.type];
- return (
- <Icon
- key={i}
- className="h-3 w-3 text-muted-foreground"
- aria-label={tr.type}
- />
- );
- })}
- {skill.triggers.length === 0 && (
- <span className="text-[10px] text-muted-foreground">
- no auto-trigger
- </span>
- )}
- </div>
- </button>
-
- {/* Right rail: On/Off switch (or error lock) + delete. Hidden in
- selection mode — the bulk toolbar owns deletion there. A healthy
- draft still gets a switch (off) so the user can promote it. */}
- {!selectionMode && (
- <div className="flex flex-shrink-0 items-center gap-1.5">
- {broken ? (
- <span
- className="flex items-center gap-1 text-[10px] font-medium text-destructive"
- title={skill.error ?? undefined}
- >
- <AlertTriangle className="h-3.5 w-3.5" />
- {t("skills_view.error")}
- </span>
- ) : (
- <Switch
- checked={on}
- onCheckedChange={onToggle}
- aria-label={`${skill.name}: ${on ? t("skills_view.on") : t("skills_view.off")}`}
- />
- )}
- {skill.is_builtin ? (
- <Lock
- className="h-3.5 w-3.5 text-muted-foreground/40"
- aria-label={t("skills_view.builtin_protected")}
- />
- ) : (
- <button
- type="button"
- onClick={onDelete}
- aria-label={t("skills_view.delete")}
- title={t("skills_view.delete")}
- className="rounded p-1 text-muted-foreground/60 hover:bg-destructive/10 hover:text-destructive"
- >
- <Trash2 className="h-3.5 w-3.5" />
- </button>
- )}
- </div>
- )}
- </div>
- </Reorder.Item>
+ </Cell>
+ </TableRow>
);
}
@@ -772,7 +740,7 @@ function SelectionToolbar({
const t = useT();
const hasSelection = checkedCount > 0;
return (
- <div className="flex items-center gap-2.5 border-b border-border bg-muted/20 px-3 py-2">
+ <div className="mt-4 flex items-center gap-2.5 rounded-lg border border-border bg-sheen/[0.04] px-3 py-2">
<SelectBox
checked={allChecked}
onChange={onToggleAll}
@@ -905,13 +873,29 @@ function DeleteConfirmDialog({
}
// ----------------------------------------------------------------------
-// Right column — detail panel
+// Detail page — header, description, file card (preview / source)
// ----------------------------------------------------------------------
-function SkillDetailPanel({ name }: { name: string }) {
+type ViewMode = "preview" | "source";
+
+/** The file currently shown in the card: SKILL.md itself or a bundle resource. */
+type OpenFile = { kind: "skill" } | { kind: ResourceKind; filename: string };
+
+function SkillDetailPage({
+ name,
+ summary,
+ onBack,
+ onDelete,
+}: {
+ name: string;
+ summary: SkillSummary | null;
+ onBack: () => void;
+ onDelete: () => void;
+}) {
const { data, isLoading, error, refetch } = useSkillDetail(name);
const save = useSaveSkill();
const setEnabled = useSetSkillEnabled();
+ const pushToast = useEventStore((s) => s.pushToast);
// Only load link health when the frontmatter actually contains URLs —
// otherwise the endpoint would fire on every skill opening, which
@@ -929,18 +913,16 @@ function SkillDetailPanel({ name }: { name: string }) {
const [showAdminDialog, setShowAdminDialog] = useState(false);
const [adminPassInput, setAdminPassInput] = useState("");
const [saveError, setSaveError] = useState<string | null>(null);
- const [openResource, setOpenResource] = useState<{
- kind: ResourceKind;
- filename: string;
- } | null>(null);
+ const [mode, setMode] = useState<ViewMode>("preview");
+ const [openFile, setOpenFile] = useState<OpenFile>({ kind: "skill" });
useEffect(() => {
- // Reset the draft + resource viewer when the loaded skill changes
+ // Reset the draft + file viewer when the loaded skill changes
if (data) {
setDraft(buildSkillMdText(data));
setDirty(false);
setSaveError(null);
- setOpenResource(null);
+ setOpenFile({ kind: "skill" });
}
}, [data]);
@@ -981,73 +963,101 @@ function SkillDetailPanel({ name }: { name: string }) {
void handleSave();
};
- if (isLoading || !data) {
+ const copyPath = async () => {
+ if (!data) return;
+ const ok = await robustCopy(data.path);
+ pushToast(ok ? "success" : "error", ok ? t("skills_view.path_copied") : t("common.error"));
+ };
+
+ if (error) {
return (
- <div className="flex h-full items-center justify-center text-sm text-muted-foreground">
- {t("skills_view.loading_skill")}
- </div>
+ <>
+ <BackLink label={t("skills_view.title")} onClick={onBack} />
+ <div className="mt-6 text-sm text-destructive">
+ {t("common.error")}: {(error as Error).message}
+ </div>
+ </>
);
}
- if (error) {
+ if (isLoading || !data) {
return (
- <div className="p-6 text-sm text-destructive">
- {t("common.error")}: {(error as Error).message}
- </div>
+ <>
+ <BackLink label={t("skills_view.title")} onClick={onBack} />
+ <div className="mt-6 text-sm text-muted-foreground">{t("skills_view.loading_skill")}</div>
+ </>
);
}
const broken = isBrokenDraft(data);
const on = isSkillOn(data.state);
+ const fm = (data.frontmatter ?? {}) as Record<string, unknown>;
+ const resourceFiles: { kind: ResourceKind; filename: string }[] = RESOURCE_KINDS.flatMap(
+ (kind) => (data.resources[kind] ?? []).map((filename) => ({ kind, filename })),
+ );
+ const fileCount = 1 + resourceFiles.length;
+ const openLabel =
+ openFile.kind === "skill" ? "SKILL.md" : `${openFile.kind}/${openFile.filename}`;
+
+ const menuActions = [
+ {
+ id: "copy-path",
+ label: t("skills_view.copy_path"),
+ icon: <Copy className="h-3.5 w-3.5" />,
+ onSelect: () => void copyPath(),
+ },
+ ...(data.origin?.source === "marketplace" && data.origin.source_url
+ ? [
+ {
+ id: "listing",
+ label: t("marketplace_origin.view_source"),
+ icon: <ExternalLink className="h-3.5 w-3.5" />,
+ onSelect: () => window.open(data.origin?.source_url ?? "", "_blank", "noopener,noreferrer"),
+ },
+ ]
+ : []),
+ ...(!data.is_builtin
+ ? [
+ {
+ id: "delete",
+ label: t("skills_view.delete"),
+ icon: <Trash2 className="h-3.5 w-3.5" />,
+ destructive: true,
+ separatorAbove: true,
+ onSelect: onDelete,
+ },
+ ]
+ : []),
+ ];
return (
- <div className="flex h-full min-h-0 flex-col">
- <div className="border-b border-border px-6 py-4">
- <div className="flex items-start justify-between gap-4">
- <div className="min-w-0 flex-1">
- <div className="flex items-center gap-2">
- <h2 className="truncate text-lg font-semibold">{data.name}</h2>
- <Badge variant={STATE_VARIANT[data.state]}>
- {stateLabel(data.state)}
- </Badge>
- {data.is_builtin && (
- <Badge variant="outline" className="gap-1">
- <Lock className="h-3 w-3" />
- builtin
- </Badge>
- )}
+ <>
+ <BackLink label={t("skills_view.title")} onClick={onBack} />
+
+ <div className="mt-5">
+ <DetailHeader
+ title={data.name}
+ titleAccessory={
+ <span
+ className="grid h-5 w-5 place-items-center text-muted-foreground"
+ title={`${stateLabel(data.state)} · v${data.version} · ${data.category}\n${data.path}`}
+ aria-label={`${stateLabel(data.state)} · v${data.version} · ${data.category} · ${data.path}`}
+ >
+ <Info className="h-3.5 w-3.5" />
+ </span>
+ }
+ byline={
+ <span className="inline-flex items-center gap-2">
+ {data.is_builtin
+ ? t("skills_view.author_builtin")
+ : fill(t("skills_view.by"), { author: authorLabel(summary ?? data) })}
{data.origin?.source === "marketplace" && (
- <MarketplaceBadge publisher={data.origin.publisher} />
+ <MarketplaceBadge compact publisher={data.origin.publisher} />
)}
- </div>
- <p className="mt-1 text-xs text-muted-foreground">
- v{data.version} · {data.category} · {data.path}
- </p>
- {data.origin?.source === "marketplace" && (
- <p className="mt-1 text-xs text-muted-foreground">
- {t("marketplace_origin.tooltip")}
- {data.origin.publisher ? ` · ${data.origin.publisher}` : ""}
- {data.origin.source_url ? (
- <>
- {" · "}
- <a
- href={data.origin.source_url}
- target="_blank"
- rel="noreferrer"
- className="underline underline-offset-2 hover:text-foreground"
- >
- {t("marketplace_origin.view_source")}
- </a>
- </>
- ) : null}
- </p>
- )}
- </div>
- <div className="flex items-center gap-3">
- {!broken && (
- <div className="flex items-center gap-2">
- <span className="text-xs text-muted-foreground">
- {on ? t("skills_view.on") : t("skills_view.off")}
- </span>
+ </span>
+ }
+ actions={
+ <>
+ {!broken && (
<Switch
checked={on}
disabled={setEnabled.isPending}
@@ -1059,21 +1069,31 @@ function SkillDetailPanel({ name }: { name: string }) {
}
aria-label={`${data.name}: ${on ? t("skills_view.on") : t("skills_view.off")}`}
/>
- </div>
- )}
- <Button
- size="sm"
- onClick={handleSaveClick}
- disabled={!dirty || save.isPending}
- >
- <Save className="mr-1.5 h-3.5 w-3.5" />
- {save.isPending ? t("common.saving") : t("common.save")}
- </Button>
- </div>
- </div>
+ )}
+ <ActionMenu
+ label={t("skills_view.more_actions")}
+ actions={menuActions}
+ trigger={({ open, toggle }) => (
+ <IconButton label={t("skills_view.more_actions")} onClick={toggle} active={open}>
+ <MoreHorizontal className="h-4 w-4" />
+ </IconButton>
+ )}
+ />
+ </>
+ }
+ />
+
+ {data.description && (
+ <ClampedText
+ className="mt-4"
+ text={data.description}
+ moreLabel={t("common.see_more")}
+ lessLabel={t("common.see_less")}
+ />
+ )}
{data.error && (
- <div className="mt-3 rounded-md border border-destructive/40 bg-destructive/10 p-2.5 text-xs text-destructive">
+ <div className="mt-4 rounded-md border border-destructive/40 bg-destructive/10 p-2.5 text-xs text-destructive">
{t("skills_view.validation_error")}: {data.error}
</div>
)}
@@ -1082,7 +1102,7 @@ function SkillDetailPanel({ name }: { name: string }) {
the dropped keys, because the owner of the file has to be able to
see what this app did not read. */}
{data.portable && (
- <div className="mt-3 rounded-md border border-border bg-muted/40 p-2.5 text-xs text-muted-foreground">
+ <div className="mt-4 rounded-md border border-border bg-muted/40 p-2.5 text-xs text-muted-foreground">
{t("skills_view.portable_notice")}
{data.ignored_fields && data.ignored_fields.length > 0 && (
<span className="mt-1 block font-mono text-[11px]">
@@ -1093,7 +1113,7 @@ function SkillDetailPanel({ name }: { name: string }) {
</div>
)}
{saveError && !showAdminDialog && (
- <div className="mt-3 rounded-md border border-destructive/40 bg-destructive/10 p-2.5 text-xs text-destructive">
+ <div className="mt-4 rounded-md border border-destructive/40 bg-destructive/10 p-2.5 text-xs text-destructive">
{saveError}
</div>
)}
@@ -1103,53 +1123,140 @@ function SkillDetailPanel({ name }: { name: string }) {
health={linkHealth.data?.fields ?? null}
/>
)}
- </div>
- <div className="flex min-h-0 flex-1">
- {/* Left sub-column: editor */}
- <div className="flex min-w-0 flex-1 flex-col">
- <div className="flex items-center justify-between border-b border-border px-6 py-2">
- <span className="text-[10px] uppercase tracking-wider text-muted-foreground">
- SKILL.md
+ <Panel className="mt-4">
+ <div className="flex items-center gap-3 border-b border-border/70 px-3 py-2">
+ <ActionMenu
+ label={t("skills_view.files_menu")}
+ align="start"
+ actions={[
+ {
+ id: "skill-md",
+ label: "SKILL.md",
+ icon: <FileText className="h-3.5 w-3.5" />,
+ onSelect: () => setOpenFile({ kind: "skill" }),
+ },
+ ...resourceFiles.map((f, i) => {
+ const Icon = KIND_ICON[f.kind];
+ return {
+ id: `${f.kind}/${f.filename}`,
+ label: `${RESOURCE_LABELS[f.kind]} / ${f.filename}`,
+ icon: <Icon className="h-3.5 w-3.5" />,
+ separatorAbove: i === 0,
+ onSelect: () => setOpenFile({ kind: f.kind, filename: f.filename }),
+ };
+ }),
+ ]}
+ trigger={({ open, toggle }) => (
+ <button
+ type="button"
+ onClick={toggle}
+ aria-expanded={open}
+ aria-haspopup="menu"
+ className="inline-flex h-7 max-w-[320px] items-center gap-1.5 rounded-md bg-sheen/[0.07] px-2.5 font-mono text-xs text-foreground hover:bg-sheen/[0.12]"
+ >
+ <span className="truncate">{openLabel}</span>
+ <ChevronDown className={cn("h-3.5 w-3.5 shrink-0 transition-transform", open && "rotate-180")} />
+ </button>
+ )}
+ />
+ <span className="text-xs text-muted-foreground">
+ {fileCount === 1 ? t("skills_view.file_one") : fill(t("skills_view.files"), { n: fileCount })}
</span>
- {data.is_builtin && (
- <span className="text-[10px] text-muted-foreground">
- {t("skills_view.builtin_admin_needed")}
- </span>
- )}
+ <div className="ml-auto flex items-center gap-1">
+ {data.is_builtin && mode === "source" && (
+ <span className="mr-2 hidden text-[11px] text-muted-foreground sm:inline">
+ {t("skills_view.builtin_admin_needed")}
+ </span>
+ )}
+ {dirty && (
+ <Button
+ size="sm"
+ className="mr-1 h-7 gap-1.5"
+ onClick={handleSaveClick}
+ disabled={save.isPending}
+ >
+ <Save className="h-3.5 w-3.5" />
+ {save.isPending ? t("common.saving") : t("common.save")}
+ </Button>
+ )}
+ <div className="flex items-center rounded-md bg-sheen/[0.05] p-0.5" role="tablist" aria-label={t("skills_view.view_mode")}>
+ <ModeButton
+ active={mode === "preview"}
+ label={t("skills_view.view_preview")}
+ onClick={() => setMode("preview")}
+ >
+ <Eye className="h-3.5 w-3.5" />
+ </ModeButton>
+ <ModeButton
+ active={mode === "source"}
+ label={t("skills_view.view_source")}
+ onClick={() => setMode("source")}
+ >
+ <Code2 className="h-3.5 w-3.5" />
+ </ModeButton>
+ </div>
+ </div>
</div>
- <textarea
- className={cn(
- "flex-1 resize-none bg-background p-6 font-mono text-xs",
- "focus:outline-none",
- )}
- value={draft}
- onChange={(e) => {
- setDraft(e.target.value);
- setDirty(e.target.value !== buildSkillMdText(data));
- }}
- spellCheck={false}
- />
- </div>
- {/* Right sub-column: bundle tree + optional resource viewer */}
- {data.resource_count > 0 && (
- <div className="flex w-[320px] flex-col border-l border-border">
- {openResource ? (
- <ResourceViewer
- skillName={data.name}
- kind={openResource.kind}
- filename={openResource.filename}
- onClose={() => setOpenResource(null)}
- />
+ {openFile.kind === "skill" ? (
+ mode === "preview" ? (
+ <div className="max-h-[60vh] overflow-auto px-6 py-5">
+ <FactRows
+ className="mb-6"
+ rows={[
+ { label: t("skills_view.fact_state"), value: stateLabel(data.state) },
+ { label: t("skills_view.fact_version"), value: data.version },
+ { label: t("skills_view.fact_category"), value: data.category },
+ {
+ label: t("skills_view.fact_license"),
+ value: typeof fm.license === "string" ? fm.license : null,
+ },
+ {
+ label: t("skills_view.fact_tags"),
+ value:
+ data.tags.length > 0 ? (
+ <span className="flex flex-wrap gap-1">
+ {data.tags.map((tag) => (
+ <Badge key={tag} variant="outline" className="font-normal">
+ {tag}
+ </Badge>
+ ))}
+ </span>
+ ) : null,
+ },
+ {
+ label: t("skills_view.fact_triggers"),
+ value: data.triggers.length > 0 ? <TriggerList triggers={data.triggers} /> : null,
+ },
+ ]}
+ />
+ <MarkdownBody text={data.body} />
+ </div>
) : (
- <ResourceTree
- resources={data.resources}
- onOpen={(kind, filename) => setOpenResource({ kind, filename })}
+ <textarea
+ className={cn(
+ "block min-h-[420px] w-full resize-y bg-transparent px-6 py-5 font-mono text-xs leading-relaxed",
+ "focus:outline-none",
+ )}
+ aria-label="SKILL.md"
+ value={draft}
+ onChange={(e) => {
+ setDraft(e.target.value);
+ setDirty(e.target.value !== buildSkillMdText(data));
+ }}
+ spellCheck={false}
/>
- )}
- </div>
- )}
+ )
+ ) : (
+ <ResourceBody
+ skillName={data.name}
+ kind={openFile.kind}
+ filename={openFile.filename}
+ mode={mode}
+ />
+ )}
+ </Panel>
</div>
{showAdminDialog && (
@@ -1168,7 +1275,112 @@ function SkillDetailPanel({ name }: { name: string }) {
errorHint={saveError}
/>
)}
- </div>
+ </>
+ );
+}
+
+function ModeButton({
+ active,
+ label,
+ onClick,
+ children,
+}: {
+ active: boolean;
+ label: string;
+ onClick: () => void;
+ children: React.ReactNode;
+}) {
+ return (
+ <button
+ type="button"
+ role="tab"
+ aria-selected={active}
+ aria-label={label}
+ title={label}
+ onClick={onClick}
+ className={cn(
+ "grid h-6 w-7 place-items-center rounded transition-colors",
+ active ? "bg-sheen/[0.12] text-foreground" : "text-muted-foreground hover:text-foreground",
+ )}
+ >
+ {children}
+ </button>
+ );
+}
+
+function TriggerList({ triggers }: { triggers: SkillTrigger[] }) {
+ return (
+ <ul className="space-y-0.5">
+ {triggers.map((tr, i) => {
+ const Icon = TRIGGER_ICON[tr.type];
+ const detail = tr.pattern ?? tr.combo ?? tr.cron ?? "";
+ return (
+ <li key={i} className="flex items-center gap-2 text-sm">
+ <Icon className="h-3.5 w-3.5 text-muted-foreground" aria-label={tr.type} />
+ <span className="font-mono text-xs">{detail || tr.type}</span>
+ {tr.language && tr.language.length > 0 && (
+ <span className="text-[11px] text-muted-foreground">{tr.language.join(", ")}</span>
+ )}
+ </li>
+ );
+ })}
+ </ul>
+ );
+}
+
+/** Rendered markdown — the body of SKILL.md or a bundled .md resource. */
+function MarkdownBody({ text }: { text: string }) {
+ return (
+ <article className="prose prose-neutral max-w-none text-sm dark:prose-invert prose-headings:font-display prose-headings:tracking-tight prose-h1:text-xl prose-h2:text-lg prose-h3:text-base prose-a:text-primary prose-code:text-foreground prose-pre:border prose-pre:border-border prose-pre:bg-card/80">
+ <ReactMarkdown
+ remarkPlugins={[remarkGfm]}
+ components={{
+ a: ({ href, children, ...props }) => (
+ <a href={href} target="_blank" rel="noreferrer noopener" {...props}>
+ {children}
+ </a>
+ ),
+ }}
+ >
+ {text}
+ </ReactMarkdown>
+ </article>
+ );
+}
+
+function ResourceBody({
+ skillName,
+ kind,
+ filename,
+ mode,
+}: {
+ skillName: string;
+ kind: ResourceKind;
+ filename: string;
+ mode: ViewMode;
+}) {
+ const t = useT();
+ const { data, isLoading, error } = useSkillResource(skillName, kind, filename);
+ const isMarkdown = /\.(md|markdown)$/i.test(filename);
+
+ if (isLoading) {
+ return <div className="px-6 py-5 text-xs text-muted-foreground">{t("skills_view.loading_skill")}</div>;
+ }
+ if (error) {
+ return <div className="px-6 py-5 text-xs text-destructive">{(error as Error).message}</div>;
+ }
+ if (data == null) return null;
+ if (mode === "preview" && isMarkdown) {
+ return (
+ <div className="max-h-[60vh] overflow-auto px-6 py-5">
+ <MarkdownBody text={data} />
+ </div>
+ );
+ }
+ return (
+ <pre className="max-h-[60vh] overflow-auto whitespace-pre-wrap break-words px-6 py-5 font-mono text-[11px] leading-relaxed">
+ {data}
+ </pre>
);
}
@@ -1328,10 +1540,6 @@ function formatScalar(val: unknown): string {
return str;
}
-// ----------------------------------------------------------------------
-// Bundle-Resource-Tree + Viewer
-// ----------------------------------------------------------------------
-
const KIND_ICON: Record<ResourceKind, typeof FileText> = {
references: FileText,
scripts: FileCode,
@@ -1339,151 +1547,25 @@ const KIND_ICON: Record<ResourceKind, typeof FileText> = {
agents: UserSquare,
};
-function ResourceTree({
- resources,
- onOpen,
-}: {
- resources: Record<ResourceKind, string[]>;
- onOpen: (kind: ResourceKind, filename: string) => void;
-}) {
- const [expanded, setExpanded] = useState<Record<ResourceKind, boolean>>({
- references: true,
- scripts: false,
- assets: false,
- agents: false,
- });
-
- return (
- <>
- <div className="flex items-center gap-2 border-b border-border px-4 py-2.5">
- <FolderOpen className="h-3.5 w-3.5 text-muted-foreground" />
- <span className="text-[10px] uppercase tracking-wider text-muted-foreground">
- Bundle
- </span>
- </div>
- <ScrollArea className="flex-1">
- <div className="px-3 py-2">
- {RESOURCE_KINDS.map((kind) => {
- const files = resources[kind];
- if (!files || files.length === 0) return null;
- const isOpen = expanded[kind];
- const Icon = KIND_ICON[kind];
- return (
- <div key={kind} className="mb-1">
- <button
- type="button"
- onClick={() =>
- setExpanded((p) => ({ ...p, [kind]: !p[kind] }))
- }
- className="flex w-full items-center gap-1.5 rounded px-2 py-1 text-xs hover:bg-muted/50"
- >
- {isOpen ? (
- <ChevronDown className="h-3 w-3 text-muted-foreground" />
- ) : (
- <ChevronRight className="h-3 w-3 text-muted-foreground" />
- )}
- <Icon className="h-3 w-3 text-muted-foreground" />
- <span className="font-medium">
- {RESOURCE_LABELS[kind]}
- </span>
- <span className="ml-auto text-[10px] text-muted-foreground">
- {files.length}
- </span>
- </button>
- {isOpen && (
- <ul className="mt-0.5 ml-5 space-y-0.5">
- {files.map((f) => (
- <li key={f}>
- <button
- type="button"
- onClick={() => onOpen(kind, f)}
- className="w-full truncate rounded px-2 py-0.5 text-left text-[11px] font-mono hover:bg-muted/50"
- >
- {f}
- </button>
- </li>
- ))}
- </ul>
- )}
- </div>
- );
- })}
- </div>
- </ScrollArea>
- </>
- );
-}
-
-function ResourceViewer({
- skillName,
- kind,
- filename,
- onClose,
-}: {
- skillName: string;
- kind: ResourceKind;
- filename: string;
- onClose: () => void;
-}) {
- const t = useT();
- const { data, isLoading, error } = useSkillResource(skillName, kind, filename);
- const Icon = KIND_ICON[kind];
-
- return (
- <>
- <div className="flex items-center gap-2 border-b border-border px-3 py-2">
- <Icon className="h-3.5 w-3.5 flex-shrink-0 text-muted-foreground" />
- <span className="truncate text-xs font-mono" title={`${kind}/${filename}`}>
- {kind}/{filename}
- </span>
- <Button
- size="sm"
- variant="ghost"
- className="ml-auto h-6 w-6 p-0"
- onClick={onClose}
- title={t("skills_toast.back_to_list")}
- >
- <X className="h-3.5 w-3.5" />
- </Button>
- </div>
- {isLoading && (
- <div className="p-4 text-xs text-muted-foreground">{t("skills_view.loading_skill")}</div>
- )}
- {error && (
- <div className="p-4 text-xs text-destructive">
- {(error as Error).message}
- </div>
- )}
- {data && (
- <ScrollArea className="flex-1">
- <pre className="whitespace-pre-wrap break-words p-4 font-mono text-[11px] leading-relaxed">
- {data}
- </pre>
- </ScrollArea>
- )}
- </>
- );
-}
-
function EmptyList() {
const t = useT();
const assistantName = useEventStore((s) => s.assistantName);
return (
- <div className="space-y-3 text-sm text-muted-foreground">
+ <EmptyRow>
<p>{t("skills_view.empty_list_title")}</p>
- <p className="text-xs">
+ <p className="mt-2 text-xs">
{t("skills_view.empty_list_body_a")} {assistantName}{" "}
{t("skills_view.empty_list_body_b")}
<br />
<code>%LOCALAPPDATA%\Jarvis\skills</code>.{" "}
{t("skills_view.empty_list_body_c")}
</p>
- </div>
+ </EmptyRow>
);
}
// ----------------------------------------------------------------------
-// Skill-Links (homepage / source / docs) mit Health-Chip
+// Skill links (homepage / source / docs) with health chip
// ----------------------------------------------------------------------
interface LinkFieldSpec {
@@ -1509,7 +1591,7 @@ function SkillLinks({
const visible = LINK_FIELDS.filter((f) => Boolean(frontmatter[f.key]));
if (visible.length === 0) return null;
return (
- <div className="mt-3 flex flex-wrap items-center gap-3">
+ <div className="mt-4 flex flex-wrap items-center gap-2">
{visible.map((f) => {
const url = String(frontmatter[f.key]);
const h = health?.[f.key] ?? null;
@@ -1520,7 +1602,7 @@ function SkillLinks({
href={url}
target="_blank"
rel="noopener noreferrer"
- className="group flex items-center gap-1.5 rounded-md border border-border bg-background px-2 py-1 text-xs text-foreground hover:bg-muted/40"
+ className="group flex items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-foreground hover:bg-muted/40"
title={url}
>
<Icon className="h-3 w-3 text-muted-foreground" />
@@ -1557,7 +1639,7 @@ function LinkHealthChip({ entry }: { entry: LinkHealthEntry | null }) {
}
// ----------------------------------------------------------------------
-// Search-Ergebnis-Liste (flach, mit Score-Reason)
+// Small bits
// ----------------------------------------------------------------------
function FilterChip({
@@ -1574,110 +1656,13 @@ function FilterChip({
type="button"
onClick={onClick}
className={cn(
- "rounded-full border px-2 py-0.5 text-[10px] transition-colors",
+ "rounded-full border px-2 py-0.5 text-[11px] transition-colors",
active
? "border-primary/60 bg-primary/10 text-primary"
- : "border-border bg-background hover:bg-muted/40",
+ : "border-border bg-background/60 hover:bg-muted/40",
)}
>
{label}
</button>
);
}
-
-function SearchResults({
- isPending,
- error,
- results,
- selected,
- onSelect,
-}: {
- isPending: boolean;
- error: Error | null;
- results: LocalSkillHit[];
- selected: string | null;
- onSelect: (name: string) => void;
-}) {
- const t = useT();
- if (isPending && results.length === 0) {
- return <div className="text-xs text-muted-foreground">Searching…</div>;
- }
- if (error) {
- return (
- <div className="rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-xs text-destructive">
- Search failed: {error.message}
- </div>
- );
- }
- if (results.length === 0) {
- return (
- <div className="rounded-lg border border-border p-3 text-xs text-muted-foreground">
- {t("skills_view.search_no_hits")}
- </div>
- );
- }
- return (
- <ul className="space-y-1.5">
- {results.map((s) => (
- <SkillRowWithScore
- key={s.name}
- skill={s}
- selected={selected === s.name}
- onClick={() => onSelect(s.name)}
- />
- ))}
- </ul>
- );
-}
-
-function SkillRowWithScore({
- skill,
- selected,
- onClick,
-}: {
- skill: LocalSkillHit;
- selected: boolean;
- onClick: () => void;
-}) {
- return (
- <li>
- <button
- type="button"
- onClick={onClick}
- className={cn(
- "w-full rounded-md border p-2.5 text-left transition-colors",
- selected
- ? "border-primary/60 bg-primary/5"
- : "border-border hover:bg-muted/40",
- )}
- >
- <div className="flex items-start justify-between gap-2">
- <div className="min-w-0 flex-1">
- <div className="flex items-center gap-1.5">
- <span className="truncate text-sm font-medium">{skill.name}</span>
- {skill.is_builtin && (
- <Lock
- className="h-3 w-3 flex-shrink-0 text-muted-foreground"
- aria-label="Builtin"
- />
- )}
- </div>
- {skill.description && (
- <p className="mt-1 line-clamp-2 text-xs text-muted-foreground">
- {skill.description}
- </p>
- )}
- {skill.reason && (
- <p className="mt-1 truncate text-[10px] italic text-muted-foreground/70">
- {skill.reason}
- </p>
- )}
- </div>
- <Badge variant="outline" className="flex-shrink-0 text-[10px]">
- {Math.round(skill.score * 100)}
- </Badge>
- </div>
- </button>
- </li>
- );
-}
diff --git a/jarvis/ui/web/skills_routes.py b/jarvis/ui/web/skills_routes.py
index 54a9c2935e..9e515f9a5f 100644
--- a/jarvis/ui/web/skills_routes.py
+++ b/jarvis/ui/web/skills_routes.py
@@ -116,9 +116,27 @@ def _skill_to_summary(s: Skill) -> dict[str, Any]:
# it, which is the whole difference between tolerant and sloppy.
"portable": s.portable,
"ignored_fields": list(s.ignored_fields),
+ # When SKILL.md was last written, for the "Last updated" column of the
+ # desktop list. Null when the file cannot be stat-ed (a skill parsed
+ # from memory in tests, or one deleted between list and stat).
+ "updated_at": _skill_updated_at(s),
}
+def _skill_updated_at(s: Skill) -> str | None:
+ """ISO-8601 UTC stamp of the SKILL.md mtime, or None when unavailable."""
+ from datetime import UTC, datetime
+
+ path = getattr(s, "path", None)
+ if path is None:
+ return None
+ try:
+ mtime = Path(path).stat().st_mtime
+ except OSError:
+ return None
+ return datetime.fromtimestamp(mtime, tz=UTC).isoformat(timespec="seconds")
+
+
def _skill_to_detail(s: Skill) -> dict[str, Any]:
"""Full detail incl. body + frontmatter dump."""
out = _skill_to_summary(s)