Skip to content

The agent that grows with you

feat(desktop): restore approved catalog cards in Capabilities

brooklyn!26201480a97d
diff --git a/apps/desktop/DESIGN.md b/apps/desktop/DESIGN.md
index 97e325e6ef0..d1b3a6c09d3 100644
--- a/apps/desktop/DESIGN.md
+++ b/apps/desktop/DESIGN.md
@@ -252,7 +252,8 @@ blurred backdrop.
Empty lists hide their search field.
- **`SegmentedControl`** — the choice control for small mutually-exclusive sets
(color mode, tool-call display, usage period). Replaces radio piles and
- pill rows.
+ pill rows. `iconOnly` retains localized tooltips and accessible names for
+ compact layout switches; options without an icon keep their visible label.
- **`Switch`** (`size="xs"`) — bare, with `aria-label`. No bordered text wrapper.
- **`FanMenu`** (`src/components/ui/fan-menu.tsx`) — one hub control that
fans sibling toggles out on hover: `direction` `vertical` | `horizontal`
diff --git a/apps/desktop/src/app/capabilities/catalog/capability-tabs.tsx b/apps/desktop/src/app/capabilities/catalog/capability-tabs.tsx
new file mode 100644
index 00000000000..d227a7797a3
--- /dev/null
+++ b/apps/desktop/src/app/capabilities/catalog/capability-tabs.tsx
@@ -0,0 +1,33 @@
+import type { ReactNode } from 'react'
+
+import { TextTab } from '@/components/ui/text-tab'
+import { useI18n } from '@/i18n'
+
+export type CapabilityView = 'installed' | 'browse'
+
+interface CapabilityTabsProps {
+ value: CapabilityView
+ onChange: (value: CapabilityView) => void
+ actions?: ReactNode
+}
+
+/** Shared Installed / Browse navigation for Skills and Plugins. */
+export function CapabilityTabs({ value, onChange, actions }: CapabilityTabsProps) {
+ const { t } = useI18n()
+
+ return (
+ <div className="flex shrink-0 items-center gap-4 px-3 py-1" data-capability-tabs>
+ <TextTab
+ active={value === 'installed'}
+ aria-pressed={value === 'installed'}
+ onClick={() => onChange('installed')}
+ >
+ {t.catalog.installed}
+ </TextTab>
+ <TextTab active={value === 'browse'} aria-pressed={value === 'browse'} onClick={() => onChange('browse')}>
+ {t.catalog.browse}
+ </TextTab>
+ {actions && <div className="-my-0.5 -mr-2 ml-auto flex h-6 items-center gap-2">{actions}</div>}
+ </div>
+ )
+}
diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-browser.test.tsx b/apps/desktop/src/app/capabilities/catalog/catalog-browser.test.tsx
new file mode 100644
index 00000000000..f2bed3c2381
--- /dev/null
+++ b/apps/desktop/src/app/capabilities/catalog/catalog-browser.test.tsx
@@ -0,0 +1,147 @@
+import { QueryClientProvider } from '@tanstack/react-query'
+import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'
+import { useState } from 'react'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+
+import { queryClient } from '@/lib/query-client'
+
+import { PageSearchShell } from '../../page-search-shell'
+
+import { CatalogBrowser } from './catalog-browser'
+import { type CatalogKind, parseCatalog } from './catalog-data'
+import { $catalogCardView } from './store'
+
+beforeEach(() => {
+ $catalogCardView.set(true)
+})
+
+afterEach(() => {
+ cleanup()
+ queryClient.clear()
+ $catalogCardView.set(true)
+})
+
+function setup(kind: CatalogKind) {
+ const entries = parseCatalog(
+ kind,
+ ['alpha', 'beta'].map(name => ({
+ name,
+ identifier: `official/${name}`,
+ installIdentifier: `official/${name}`,
+ source: 'official',
+ tier: 'official',
+ category: 'research',
+ description: `${name} research workflow`,
+ repo: `https://github.com/example/${name}`,
+ sourceUrl: `https://github.com/example/${name}`,
+ docsUrl: `https://example.com/${name}`
+ }))
+ )
+
+ queryClient.setQueryData(['public-catalog', kind], entries)
+ const onInstall = vi.fn()
+
+ function Harness() {
+ const [query, setQuery] = useState('')
+
+ return (
+ <QueryClientProvider client={queryClient}>
+ <PageSearchShell onSearchChange={setQuery} searchPlaceholder="Search catalog" searchValue={query}>
+ <CatalogBrowser
+ isInstalled={entry => entry.name === 'beta'}
+ kind={kind}
+ onInstall={onInstall}
+ onQueryChange={setQuery}
+ query={query}
+ />
+ </PageSearchShell>
+ </QueryClientProvider>
+ )
+ }
+
+ return { entries, onInstall, ...render(<Harness />) }
+}
+
+describe.each(['skills', 'plugins'] as const)('%s catalog layouts', kind => {
+ it('defaults to cards with icon-only layout controls and whole-card hover', () => {
+ const { container } = setup(kind)
+ const cards = screen.getAllByRole('article')
+ const cardView = screen.getByRole('button', { name: 'Card view', pressed: true })
+
+ expect(cards).toHaveLength(2)
+ expect(cardView.textContent).toBe('')
+ expect(cardView.querySelector('.codicon-extensions')).not.toBeNull()
+ expect(screen.getByRole('button', { name: 'List view' }).querySelector('.codicon-list-unordered')).not.toBeNull()
+ expect(cards[0].classList.contains('row-hover')).toBe(true)
+ expect(within(cards[0]).getByRole('button', { name: 'alpha' }).classList.contains('row-hover')).toBe(false)
+ expect(container.querySelector('[data-catalog-list]')).toBeNull()
+ expect(within(cards[1]).getByRole<HTMLButtonElement>('button', { name: 'Installed' }).disabled).toBe(true)
+ })
+
+ it('offers installation directly on a card without opening its details', () => {
+ const { entries, onInstall } = setup(kind)
+ const card = screen.getAllByRole('article')[0]
+
+ fireEvent.click(within(card).getByRole('button', { name: 'Install' }))
+
+ expect(onInstall).toHaveBeenCalledExactlyOnceWith(entries[0])
+ expect(screen.queryByRole('dialog')).toBeNull()
+ })
+
+ it('opens the shared detail dialog with source links and the same install target', async () => {
+ const { entries, onInstall } = setup(kind)
+ fireEvent.click(screen.getByRole('button', { name: 'alpha' }))
+ const dialog = screen.getByRole('dialog', { name: 'alpha' })
+
+ expect(within(dialog).getByRole('heading', { name: 'alpha' })).toBeTruthy()
+ expect(within(dialog).getByRole('link', { name: 'Repository' }).getAttribute('href')).toBe(entries[0].sourceUrl)
+ expect(within(dialog).getByRole('link', { name: 'Documentation' }).getAttribute('href')).toBe(entries[0].docsUrl)
+ fireEvent.click(within(dialog).getByRole('button', { name: 'Install' }))
+ expect(onInstall).toHaveBeenCalledExactlyOnceWith(entries[0])
+
+ if (kind === 'plugins') {
+ // Release the inspector before the existing plugin installation dialog opens.
+ await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull())
+ } else {
+ fireEvent.click(within(dialog).getByRole('button', { name: 'Close' }))
+ await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull())
+ }
+ })
+
+ it('preserves the parent search and filter when switching to list and back', async () => {
+ const { container } = setup(kind)
+ const search = screen.getByRole<HTMLInputElement>('textbox', { name: 'Search catalog' })
+ fireEvent.change(search, { target: { value: 'alpha' } })
+ await waitFor(() => expect(screen.getAllByRole('article')).toHaveLength(1))
+ fireEvent.click(screen.getByRole('combobox', { name: 'Category' }))
+ fireEvent.click(screen.getByRole('option', { name: 'Research' }))
+ fireEvent.click(screen.getByRole('button', { name: 'List view' }))
+
+ expect(container.querySelector(`[data-catalog-list="${kind}"]`)).not.toBeNull()
+ expect(screen.queryByRole('article')).toBeNull()
+ expect(screen.getByRole('heading', { name: 'alpha' })).toBeTruthy()
+ expect(screen.getByRole('combobox', { name: 'Category' }).textContent).toContain('Research')
+ expect(screen.getByRole('textbox', { name: 'Search catalog' })).toBe(search)
+ expect(search.value).toBe('alpha')
+ expect(screen.getByRole('status').textContent).toBe('1 result')
+
+ fireEvent.click(screen.getByRole('button', { name: 'Card view' }))
+ expect(screen.getAllByRole('article')).toHaveLength(1)
+ expect(screen.getByRole('textbox', { name: 'Search catalog' })).toBe(search)
+ expect(screen.getByRole('combobox', { name: 'Category' }).textContent).toContain('Research')
+ expect(screen.queryByRole('dialog')).toBeNull()
+ })
+})
+
+it('shares the saved layout choice when moving between Skills and Plugins', () => {
+ setup('skills')
+ fireEvent.click(screen.getByRole('button', { name: 'List view' }))
+ expect($catalogCardView.get()).toBe(false)
+ cleanup()
+
+ const { container } = setup('plugins')
+ expect(screen.getByRole('button', { name: 'List view', pressed: true })).toBeTruthy()
+ expect(container.querySelector('[data-catalog-list="plugins"]')).not.toBeNull()
+ fireEvent.click(screen.getByRole('button', { name: 'Card view' }))
+ expect($catalogCardView.get()).toBe(true)
+})
diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-browser.tsx b/apps/desktop/src/app/capabilities/catalog/catalog-browser.tsx
new file mode 100644
index 00000000000..02eac5e0688
--- /dev/null
+++ b/apps/desktop/src/app/capabilities/catalog/catalog-browser.tsx
@@ -0,0 +1,468 @@
+import { useStore } from '@nanostores/react'
+import { memo, type ReactNode, useDeferredValue, useEffect, useMemo, useRef, useState } from 'react'
+
+import { PageLoader } from '@/components/page-loader'
+import { ActionStatus } from '@/components/ui/action-status'
+import { Badge } from '@/components/ui/badge'
+import { Button } from '@/components/ui/button'
+import { Codicon, codiconIcon } from '@/components/ui/codicon'
+import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog'
+import { ErrorState } from '@/components/ui/error-state'
+import { RowButton } from '@/components/ui/row-button'
+import { SegmentedControl } from '@/components/ui/segmented-control'
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
+import { useI18n } from '@/i18n'
+import { ExternalLink } from '@/lib/external-link'
+import { cn } from '@/lib/utils'
+
+import { DetailColumn, ListColumn, ListStrip, ListStripLabel, MasterDetail, ToolChip } from '../../master-detail'
+import { PanelEmpty } from '../../overlays/panel'
+import { prettyName } from '../../settings/helpers'
+
+import type { CapabilityView } from './capability-tabs'
+import { type CatalogEntry, type CatalogKind, useCatalog } from './catalog-data'
+import { $catalogCardView } from './store'
+
+interface CatalogBrowserProps {
+ kind: CatalogKind
+ query?: string
+ onQueryChange?: (value: string) => void
+ view?: CapabilityView
+ isInstalled: (entry: CatalogEntry) => boolean
+ onInstall: (entry: CatalogEntry) => void
+ isInstalling?: (entry: CatalogEntry) => boolean
+ installedEntries?: CatalogEntry[]
+ renderInstalledDetail?: (entry: CatalogEntry) => ReactNode
+ selectedEntryId?: string | null
+ onSelectEntry?: (id: string | null) => void
+}
+
+const PAGE_SIZE = 60
+const ListViewIcon = codiconIcon('list-unordered')
+const CardViewIcon = codiconIcon('extensions')
+
+export const CatalogBrowser = memo(function CatalogBrowser({
+ kind,
+ isInstalled,
+ onInstall,
+ isInstalling,
+ installedEntries,
+ renderInstalledDetail,
+ selectedEntryId,
+ onSelectEntry,
+ view = 'browse',
+ query = '',
+ onQueryChange
+}: CatalogBrowserProps) {
+ const { t } = useI18n()
+ const c = t.catalog
+ const cardView = useStore($catalogCardView)
+ const { data, isPending, error, refetch } = useCatalog(kind, view === 'browse')
+ const deferredQuery = useDeferredValue(query.trim().toLowerCase())
+ const [source, setSource] = useState('all')
+ const [category, setCategory] = useState('all')
+ const [localSelectedId, setLocalSelectedId] = useState<string | null>(null)
+ const selectedId = selectedEntryId === undefined ? localSelectedId : selectedEntryId
+
+ const setSelectedId = (id: string | null) => {
+ setLocalSelectedId(id)
+ onSelectEntry?.(id)
+ }
+
+ const [detailOpen, setDetailOpen] = useState(false)
+ const selectedCardRef = useRef<HTMLButtonElement | null>(null)
+ const [limit, setLimit] = useState(PAGE_SIZE)
+
+ const entries = useMemo(() => {
+ return view === 'installed' ? (installedEntries ?? []) : (data ?? [])
+ }, [data, installedEntries, view])
+
+ const sources = useMemo(() => [...new Set(entries.map(entry => entry.source))], [entries])
+
+ const categories = useMemo(() => {
+ const values = new Map<string, string>()
+
+ for (const entry of entries) {
+ if (source === 'all' || entry.source === source) {
+ values.set(entry.category, entry.categoryLabel)
+ }
+ }
+
+ return [...values].sort((a, b) => a[1].localeCompare(b[1]))
+ }, [entries, source])
+
+ const filtered = useMemo(
+ () =>
+ entries.filter(
+ entry =>
+ (view === 'installed' || source === 'all' || entry.source === source) &&
+ (view === 'installed' || category === 'all' || entry.category === category) &&
+ (!deferredQuery || entry.search.includes(deferredQuery))
+ ),
+ [entries, source, category, deferredQuery, view]
+ )
+
+ const selected = filtered.find(entry => entry.id === selectedId) ?? filtered[0]
+ const installedDetail = selected ? renderInstalledDetail?.(selected) : null
+
+ const resetSelection = () => {
+ setLimit(PAGE_SIZE)
+ setSelectedId(null)
+ setDetailOpen(false)
+ }
+
+ useEffect(() => {
+ setLimit(PAGE_SIZE)
+ setLocalSelectedId(null)
+ setDetailOpen(Boolean(selectedEntryId))
+ }, [deferredQuery, selectedEntryId])
+
+ const clearFilters = () => {
+ onQueryChange?.('')
+ setSource('all')
+ setCategory('all')
+ resetSelection()
+ }
+
+ const installButton = (entry: CatalogEntry) => {
+ const installed = isInstalled(entry)
+ const installing = isInstalling?.(entry) ?? false
+
+ return (
+ <Button
+ disabled={installed || installing || (kind === 'skills' && !entry.installIdentifier)}
+ onClick={() => {
+ if (kind === 'plugins') {
+ setDetailOpen(false)
+ }
+
+ onInstall(entry)
+ }}
+ size="sm"
+ variant={installed ? 'secondary' : 'default'}
+ >
+ <ActionStatus
+ busy={t.skills.hub.installing}
+ done={c.installed}
+ idle={t.skills.hub.install}
+ idleIcon={<Codicon name="cloud-download" />}
+ state={installed ? 'done' : installing ? 'saving' : 'idle'}
+ />
+ </Button>
+ )
+ }
+
+ const metadata = selected
+ ? ([
+ [c.author, selected.author],
+ [c.source, prettyName(selected.source)],
+ [c.category, prettyName(selected.categoryLabel)],
+ [c.version, selected.version],
+ [c.platforms, selected.platforms.join(', ')],
+ [c.requires, selected.requiresHermes ? `Hermes ${selected.requiresHermes}` : ''],
+ [c.pinned, selected.sha ? <code title={selected.sha}>{selected.sha.slice(0, 8)}</code> : '']
+ ] as [string, ReactNode][])
+ : []
+
+ const DetailTitle = view === 'browse' && cardView ? DialogTitle : 'h3'
+
+ const details = selected ? (
+ <>
+ <header className="space-y-3">
+ {selected.imageUrl && (
+ <img
+ alt=""
+ className="block aspect-[2/1] w-full rounded-md border border-(--ui-border) object-cover"
+ decoding="async"
+ loading="lazy"
+ onError={e => {
+ e.currentTarget.style.display = 'none'
+ }}
+ referrerPolicy="no-referrer"
+ src={selected.imageUrl}
+ />
+ )}
+ <div className="flex items-start gap-3">
+ <Codicon
+ className="mt-1 shrink-0 text-(--ui-text-tertiary)"
+ name={kind === 'plugins' ? 'extensions' : 'book'}
+ size="1.5rem"
+ />
+ <div className="min-w-0">
+ <DetailTitle className="break-words text-lg font-semibold tracking-tight">{selected.name}</DetailTitle>
+ <p className="mt-1 text-xs text-(--ui-text-tertiary)">{selected.author || prettyName(selected.source)}</p>
+ </div>
+ </div>
+ <div className="flex flex-wrap items-center gap-2">
+ {installButton(selected)}
+ <Badge variant="muted">{prettyName(selected.source)}</Badge>
+ {selected.stars !== null && (
+ <span className="text-xs text-(--ui-text-tertiary)">☆ {selected.stars.toLocaleString()}</span>
+ )}
+ </div>
+ </header>
+ <section className="space-y-2">
+ <h4 className="text-xs font-medium">{c.about}</h4>
+ <p className="whitespace-pre-wrap break-words text-[length:var(--conversation-caption-font-size)] leading-relaxed text-(--ui-text-secondary)">
+ {selected.description}
+ </p>
+ {selected.overview && selected.overview !== selected.description && (
+ <p className="whitespace-pre-wrap break-words text-[length:var(--conversation-caption-font-size)] leading-relaxed text-(--ui-text-tertiary)">
+ {selected.overview}
+ </p>
+ )}
+ </section>
+ <dl className="space-y-2 text-[length:var(--conversation-caption-font-size)]">
+ {metadata
+ .filter(([, value]) => Boolean(value))
+ .map(([label, value]) => (
+ <div className="grid grid-cols-[6rem_minmax(0,1fr)] gap-3" key={label}>
+ <dt className="text-(--ui-text-tertiary)">{label}</dt>
+ <dd className="m-0 break-words">{value}</dd>
+ </div>
+ ))}
+ </dl>
+ {[
+ [c.tools, selected.tools],
+ [c.hooks, selected.hooks],
+ [c.requires, selected.requirements]
+ ].map(
+ ([label, values]) =>
+ (values as string[]).length > 0 && (
+ <section className="space-y-2" key={label as string}>
+ <h4 className="text-xs font-medium">{label as string}</h4>
+ <div className="flex flex-wrap gap-1">
+ {(values as string[]).map(value => (
+ <ToolChip key={value}>{value}</ToolChip>
+ ))}
+ </div>
+ </section>
+ )
+ )}
+ <div className="flex flex-wrap gap-3 text-xs">
+ {selected.sourceUrl && <ExternalLink href={selected.sourceUrl}>{c.repository}</ExternalLink>}
+ {selected.docsUrl && <ExternalLink href={selected.docsUrl}>{c.documentation}</ExternalLink>}
+ </div>
+ <p className="text-[0.65rem] leading-relaxed text-(--ui-text-quaternary)">{c.installHint}</p>
+ </>
+ ) : null
+
+ return (
+ <div className="flex h-full min-h-0 min-w-0 flex-col" data-catalog={kind}>
+ {view === 'browse' && (
+ <div className="flex shrink-0 flex-wrap items-center gap-x-4 gap-y-2 px-3 py-2">
+ <div className="flex min-w-0 flex-wrap items-center gap-2">
+ <div className="w-36">
+ <Select
+ onValueChange={value => {
+ setSource(value)
+ setCategory('all')
+ resetSelection()
+ }}
+ value={source}
+ >
+ <SelectTrigger aria-label={c.source}>
+ <SelectValue placeholder={c.allSources} />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="all">{c.allSources}</SelectItem>
+ {sources.map(value => (
+ <SelectItem key={value} value={value}>
+ {prettyName(value)}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ <div className="w-40">
+ <Select
+ onValueChange={value => {
+ setCategory(value)
+ resetSelection()
+ }}
+ value={category}
+ >
+ <SelectTrigger aria-label={c.category}>
+ <SelectValue placeholder={c.allCategories} />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="all">{c.allCategories}</SelectItem>
+ {categories.map(([value, label]) => (
+ <SelectItem key={value} value={value || 'uncategorized'}>
+ {prettyName(label)}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ </div>
+ <SegmentedControl
+ className="ml-auto shrink-0"
+ iconOnly
+ onChange={layout => {
+ setDetailOpen(false)
+ $catalogCardView.set(layout === 'cards')
+ }}
+ options={[
+ { id: 'list', label: c.listView, icon: ListViewIcon },
+ { id: 'cards', label: c.cardView, icon: CardViewIcon }
+ ]}
+ value={cardView ? 'cards' : 'list'}
+ />
+ </div>
+ )}
+ <div className="min-h-0 flex-1">
+ {isPending && view === 'browse' && !entries.length ? (
+ <PageLoader label={t.skills.loading} />
+ ) : view === 'browse' && error && !entries.length ? (
+ <div className="grid h-full place-items-center p-5">
+ <ErrorState description={error.message} title={c.loadFailed}>
+ <Button onClick={() => void refetch()} size="sm" variant="secondary">
+ {c.retry}
+ </Button>
+ </ErrorState>
+ </div>
+ ) : !selected ? (
+ <PanelEmpty
+ action={
+ <Button onClick={clearFilters} size="sm" variant="secondary">
+ {c.clearFilters}
+ </Button>
+ }
+ description={c.tryAnother}
+ icon="search"
+ title={c.noResults}
+ />
+ ) : view === 'browse' && cardView ? (
+ <>
+ <div className="flex h-full min-h-0 flex-col px-3 pb-3" data-catalog-cards={kind}>
+ <ListStrip left={<ListStripLabel>{c.results(filtered.length)}</ListStripLabel>} />
+ <div
+ className="min-h-0 flex-1 overflow-y-auto overscroll-contain [scrollbar-gutter:stable]"
+ key={`${source}:${category}:${deferredQuery}`}
+ >
+ <div className="grid grid-cols-[repeat(auto-fill,minmax(min(100%,17rem),1fr))] gap-3 py-2">
+ {filtered.slice(0, limit).map(entry => (
+ <article
+ className="row-hover flex min-w-0 flex-col overflow-hidden rounded-lg border border-(--ui-stroke-tertiary) bg-(--ui-chat-bubble-background)"
+ data-catalog-card
+ key={entry.id}
+ >
+ <RowButton
+ aria-haspopup="dialog"
+ aria-label={entry.name}
+ className="flex min-w-0 flex-1 cursor-pointer flex-col gap-3 p-4 text-left focus-visible:outline-2 focus-visible:outline-primary focus-visible:-outline-offset-2"
+ onClick={event => {
+ selectedCardRef.current = event.currentTarget
+ setSelectedId(entry.id)
+ setDetailOpen(true)
+ }}
+ >
+ <span className="flex w-full items-center gap-2 text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)">
+ <Codicon name={kind === 'plugins' ? 'extensions' : 'book'} size="1.25rem" />
+ <span className="min-w-0 flex-1 truncate">{prettyName(entry.source)}</span>
+ {entry.stars !== null && <span className="shrink-0">☆ {entry.stars.toLocaleString()}</span>}
+ </span>
+ <span className="line-clamp-2 break-words text-[length:var(--conversation-text-font-size)] font-semibold leading-snug">
+ {entry.name}
+ </span>
+ <span className="line-clamp-3 text-[length:var(--conversation-caption-font-size)] leading-relaxed text-(--ui-text-secondary)">
+ {entry.description}
+ </span>
+ <span className="mt-auto w-full truncate pt-1 text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)">
+ {entry.author || prettyName(entry.source)}
+ </span>
+ </RowButton>
+ <div className="flex flex-wrap items-center justify-between gap-2 px-4 pb-4">
+ <Badge variant="muted">{prettyName(entry.categoryLabel)}</Badge>
+ {installButton(entry)}
+ </div>
+ </article>
+ ))}
+ </div>
+ {filtered.length > limit && (
+ <Button onClick={() => setLimit(value => value + PAGE_SIZE)} size="sm" variant="text">
+ {c.more}
+ </Button>
+ )}
+ </div>
+ </div>
+ <Dialog onOpenChange={setDetailOpen} open={detailOpen}>
+ <DialogContent
+ aria-describedby={undefined}
+ bodyClassName="gap-5"
+ className="max-w-2xl"
+ onCloseAutoFocus={event => {
+ event.preventDefault()
+ selectedCardRef.current?.focus()
+ }}
+ >
+ {details}
+ </DialogContent>
+ </Dialog>
+ </>
+ ) : (
+ <div
+ className={cn('h-full min-h-0', detailOpen ? '[&_aside]:max-sm:hidden' : '[&_main]:max-sm:hidden')}
+ data-catalog-list={kind}
+ >
+ <MasterDetail resizeId="capabilities-split" split="wide">
+ <ListColumn
+ header={<ListStrip left={<ListStripLabel>{c.results(filtered.length)}</ListStripLabel>} />}
+ key={`${source}:${category}:${deferredQuery}`}
+ >
+ {filtered.slice(0, limit).map(entry => (
+ <RowButton
+ aria-pressed={entry.id === selected.id}
+ className={cn(
+ 'row-hover flex w-full min-w-0 items-start gap-3 rounded-md px-2 py-2 text-left',
+ entry.id === selected.id && 'bg-(--ui-row-active-background)'
+ )}
+ key={entry.id}
+ onClick={() => {
+ setSelectedId(entry.id)
+ setDetailOpen(true)
+ }}
+ >
+ <Codicon
+ className="mt-0.5 shrink-0 text-(--ui-text-tertiary)"
+ name={kind === 'plugins' ? 'extensions' : 'book'}
+ size="1.1rem"
+ />
+ <span className="min-w-0 flex-1">
+ <span className="flex items-center gap-2">
+ <span className="truncate text-[0.78rem] font-medium">{entry.name}</span>
+ {isInstalled(entry) && <Codicon className="shrink-0 text-(--ui-text-tertiary)" name="check" />}
+ </span>
+ <span className="mt-1 line-clamp-2 text-[length:var(--conversation-caption-font-size)] leading-(--conversation-caption-line-height) text-(--ui-text-tertiary)">
+ {entry.description}
+ </span>
+ <span className="mt-1.5 flex items-center gap-2 text-[0.65rem] text-(--ui-text-quaternary)">
+ <span className="truncate">{entry.author || prettyName(entry.source)}</span>
+ {entry.stars !== null && <span className="shrink-0">☆ {entry.stars.toLocaleString()}</span>}
+ </span>
+ </span>
+ </RowButton>
+ ))}
+ {filtered.length > limit && (
+ <Button onClick={() => setLimit(value => value + PAGE_SIZE)} size="sm" variant="text">
+ {c.more}
+ </Button>
+ )}
+ </ListColumn>
+ <DetailColumn footer={c.snapshotHint}>
+ <div className="sm:hidden">
+ <Button onClick={() => setDetailOpen(false)} size="sm" variant="text">
+ <Codicon name="arrow-left" />
+ {c.back}
+ </Button>
+ </div>
+ {installedDetail || details}
+ </DetailColumn>
+ </MasterDetail>
+ </div>
+ )}
+ </div>
+ </div>
+ )
+})
diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-data.test.ts b/apps/desktop/src/app/capabilities/catalog/catalog-data.test.ts
new file mode 100644
index 00000000000..d4cf590f86d
--- /dev/null
+++ b/apps/desktop/src/app/capabilities/catalog/catalog-data.test.ts
@@ -0,0 +1,145 @@
+import { afterEach, describe, expect, it, vi } from 'vitest'
+
+import { fetchCatalog, parseCatalog } from './catalog-data'
+
+afterEach(() => vi.unstubAllGlobals())
+
+describe('public catalog data', () => {
+ it('preserves every source and distinct install identifier, including same-named skills', () => {
+ const rows = ['official', 'github', 'community', 'future-source'].map(source => ({
+ name: 'research',
+ identifier: `${source}/research`,
+ source,
+ author: `${source} maintainer`,
+ description: `Research from ${source}`,
+ category: 'research',
+ categoryLabel: 'Research',
+ tags: [`${source}-tag`],
+ envVars: [`${source.toUpperCase()}_KEY`]
+ }))
+
+ // Same source, different identifier is also a distinct install target.
+ rows.push({ ...rows[0], identifier: 'official/alternate/research' })
+
+ const entries = parseCatalog('skills', rows)
+
+ expect(entries).toHaveLength(rows.length)
+ expect(new Set(entries.map(entry => entry.id)).size).toBe(rows.length)
+ rows.forEach(row => {
+ const entry = entries.find(candidate => candidate.identifier === row.identifier)
+ expect(entry).toMatchObject({
+ name: row.name,
+ identifier: row.identifier,
+ source: row.source,
+ author: row.author,
+ description: row.description,
+ categoryLabel: row.categoryLabel,
+ tags: row.tags,
+ requirements: row.envVars
+ })
+ expect(entry?.search).toContain(row.source)
+ expect(entry?.search).toContain(row.tags[0])
+ })
+ })
+
+ it('keeps catalog identity separate from the source-qualified skill install target', () => {
+ const [entry] = parseCatalog('skills', [
+ {
+ name: 'Apple Design',
+ identifier: 'apple-design',
+ source: 'ClawHub',
+ installCmd: 'hermes skills install clawhub/apple-design'
+ }
+ ])
+
+ expect(entry.identifier).toBe('apple-design')
+ expect(entry.installIdentifier).toBe('clawhub/apple-design')
+ })
+
+ it('keeps each plugin tier, pinned install target, and published detail metadata together', () => {
+ const rows = ['official', 'community', 'future-tier'].map(tier => ({
+ name: `${tier}-plugin`,
+ tier,
+ repo: `https://github.com/example/${tier}-plugins`,
+ subdir: 'packages/weather',
+ sha: 'a'.repeat(40),
+ maintainer: `${tier} maintainer`,
+ overview: `Overview for ${tier}`,
+ version: '1.2.3',
+ requiresHermes: '>=0.17',
+ platforms: ['macos', 'linux'],
+ docsUrl: `https://example.com/${tier}/docs`,
+ capabilities: {
+ providesTools: [`${tier}_forecast`],
+ providesHooks: ['on_session_start'],
+ requiresEnv: ['WEATHER_KEY']
+ }
+ }))
+
+ const entries = parseCatalog('plugins', rows)
+
+ expect(entries).toHaveLength(rows.length)
+ rows.forEach(row => {
+ const entry = entries.find(candidate => candidate.name === row.name)
+ expect(entry).toMatchObject({
+ name: row.name,
+ source: row.tier,
+ repo: row.repo,
+ sha: row.sha,
+ subdir: row.subdir,
+ author: row.maintainer,
+ overview: row.overview,
+ version: row.version,
+ requiresHermes: row.requiresHermes,
+ platforms: row.platforms,
+ docsUrl: row.docsUrl,
+ sourceUrl: row.repo,
+ tools: row.capabilities.providesTools,
+ hooks: row.capabilities.providesHooks,
+ requirements: row.capabilities.requiresEnv
+ })
+ expect(entry?.search).toContain(row.capabilities.providesTools[0])
+ })
+ })
+
+ it.each(['skills', 'plugins'] as const)('fetches only the published %s snapshot and parses it', async kind => {
+ const rows = [
+ {
+ name: 'weather',
+ identifier: 'official/weather',
+ source: 'official',
+ tier: 'official',
+ repo: 'https://github.com/example/weather',
+ sourceUrl: 'https://github.com/example/weather/blob/main/SKILL.md'
+ }
+ ]
+
+ const fetch = vi.fn().mockResolvedValue({ ok: true, json: async () => rows })
+ vi.stubGlobal('fetch', fetch)
+
+ expect(await fetchCatalog(kind)).toEqual(parseCatalog(kind, rows))
+ expect(fetch).toHaveBeenCalledExactlyOnceWith(
+ `https://nousresearch.github.io/hermes-agent/docs/api/${kind}.json`,
+ expect.objectContaining({ credentials: 'omit', signal: expect.any(AbortSignal) })
+ )
+ })
+
+ it('only renders plugin images hosted on GitHub so the browser never fans out to third-party hosts', () => {
+ const base = { name: 'x', tier: 'community', repo: 'https://github.com/o/r', sha: 'a'.repeat(40), version: '1.4.0' }
+
+ const [github, offhost, http] = parseCatalog('plugins', [
+ { ...base, name: 'github', image: 'https://raw.githubusercontent.com/o/r/abc/banner.png' },
+ { ...base, name: 'offhost', image: 'https://cdn.example.com/banner.png' },
+ { ...base, name: 'http', image: 'http://github.com/o/r/banner.png' }
+ ])
+
+ expect(github.imageUrl).toBe('https://raw.githubusercontent.com/o/r/abc/banner.png')
+ expect(github.version).toBe('1.4.0')
+ expect(offhost.imageUrl).toBeNull()
+ expect(http.imageUrl).toBeNull()
+ })
+
+ it('rejects a non-catalog response instead of treating an error payload as an empty catalog', () => {
+ expect(() => parseCatalog('skills', { error: 'Service unavailable' })).toThrow('Invalid catalog response')
+ })
+})
diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-data.ts b/apps/desktop/src/app/capabilities/catalog/catalog-data.ts
new file mode 100644
index 00000000000..56a10d091ba
--- /dev/null
+++ b/apps/desktop/src/app/capabilities/catalog/catalog-data.ts
@@ -0,0 +1,167 @@
+import { skillCatalogInstallIdentifier } from '@hermes/shared'
+import { useQuery } from '@tanstack/react-query'
+
+export type CatalogKind = 'skills' | 'plugins'
+
+export interface CatalogEntry {
+ id: string
+ name: string
+ description: string
+ overview: string
+ category: string
+ categoryLabel: string
+ source: string
+ author: string
+ identifier: string
+ installIdentifier?: string | null
+ repo: string
+ sha: string
+ subdir: string
+ version: string
+ requiresHermes: string
+ tags: string[]
+ platforms: string[]
+ requirements: string[]
+ tools: string[]
+ hooks: string[]
+ sourceUrl: string | null
+ docsUrl: string | null
+ /** GitHub-hosted banner for plugin entries; the only third-party fetch the browser makes. */
+ imageUrl: string | null
+ stars: number | null
+ search: string
+}
+
+const DOCS_ORIGIN = 'https://hermes-agent.nousresearch.com'
+// The public domain redirects here without CORS headers on the redirect.
+// Use the docs' actual static host, not GitHub's API or repository endpoints.
+const CATALOG_BASE = 'https://nousresearch.github.io/hermes-agent/docs/api'
+const text = (value: unknown): string => (typeof value === 'string' ? value : '')
+const strings = (value: unknown): string[] => (Array.isArray(value) ? value.filter(v => typeof v === 'string') : [])
+
+const IMAGE_HOSTS = new Set(['raw.githubusercontent.com', 'github.com'])
+
+/** Mirrors scripts/validate_plugin_catalog.py: https on a GitHub host, else no image. */
+export function catalogImageUrl(value: unknown): string | null {
+ try {
+ const url = new URL(text(value))
+ const host = url.hostname.toLowerCase()
+
+ return url.protocol === 'https:' && (IMAGE_HOSTS.has(host) || host.endsWith('.githubusercontent.com'))
+ ? url.href
+ : null
+ } catch {
+ return null
+ }
+}
+
+function webUrl(value: unknown): string | null {
+ try {
+ const url = new URL(text(value))
+
+ return url.protocol === 'https:' || url.protocol === 'http:' ? url.href : null
+ } catch {
+ return null
+ }
+}
+
+export function parseCatalog(kind: CatalogKind, data: unknown): CatalogEntry[] {
+ if (!Array.isArray(data)) {
+ throw new Error('Invalid catalog response')
+ }
+
+ const entries = new Map<string, CatalogEntry>()
+
+ for (const row of data) {
+ if (!row || typeof row !== 'object' || !text(row.name)) {
+ continue
+ }
+
+ const name = text(row.name)
+ const source = text(kind === 'plugins' ? row.tier : row.source)
+ const identifier = text(row.identifier) || name
+ const id = `${source}:${identifier}`
+ const caps = row.capabilities ?? {}
+ const category = text(row.category) || 'uncategorized'
+ const tags = strings(row.tags)
+ const tools = strings(caps.providesTools)
+ const hooks = strings(caps.providesHooks)
+ const author = text(row.maintainer ?? row.author)
+ const description = text(row.description)
+
+ entries.set(id, {
+ id,
+ name,
+ description,
+ overview: text(row.overview),
+ category,
+ categoryLabel: text(row.categoryLabel) || category,
+ source,
+ author,
+ identifier,
+ installIdentifier:
+ kind === 'skills'
+ ? skillCatalogInstallIdentifier({
+ name,
+ source,
+ identifier: text(row.identifier),
+ installIdentifier: text(row.installIdentifier)
+ })
+ : null,
+ repo: text(row.repo),
+ sha: text(row.sha),
+ subdir: text(row.subdir),
+ version: text(row.version),
+ requiresHermes: text(row.requiresHermes),
+ tags,
+ tools,
+ hooks,
+ platforms: strings(row.platforms),
+ requirements: strings(kind === 'plugins' ? caps.requiresEnv : row.envVars),
+ sourceUrl: webUrl(row.repo || row.sourceUrl),
+ docsUrl:
+ webUrl(row.docsUrl) ||
+ (text(row.docsPath) ? `${DOCS_ORIGIN}/docs/user-guide/skills/${text(row.docsPath)}` : null),
+ imageUrl: kind === 'plugins' ? catalogImageUrl(row.image) : null,
+ stars: typeof row.stars === 'number' && Number.isFinite(row.stars) ? row.stars : null,
+ search: [name, description, author, category, row.categoryLabel, source, ...tags, ...tools, ...hooks]
+ .filter(Boolean)
+ .join(' ')
+ .toLowerCase()
+ })
+ }
+
+ return [...entries.values()]
+}
+
+export async function fetchCatalog(kind: CatalogKind): Promise<CatalogEntry[]> {
+ // These are the same published snapshots as the docs galleries. Never fan
+ // out to repositories, README previews, avatars, or live hub searches.
+ const response = await fetch(`${CATALOG_BASE}/${kind}.json`, {
+ credentials: 'omit',
+ signal: AbortSignal.timeout(60_000)
+ })
+
+ if (!response.ok) {
+ throw new Error(`Catalog HTTP ${response.status}`)
+ }
+
+ return parseCatalog(kind, await response.json())
+}
+
+export function useCatalog(kind: CatalogKind, enabled = true) {
+ return useQuery({
+ queryKey: ['public-catalog', kind],
+ // Re-enabling a mounted query retries errors even with retryOnMount off.
+ // Keep failures parked until the user explicitly chooses Try again.
+ enabled: query => enabled && query.state.status !== 'error',
+ queryFn: () => fetchCatalog(kind),
+ staleTime: 30 * 60_000,
+ gcTime: Infinity,
+ refetchOnWindowFocus: false,
+ refetchOnReconnect: false,
+ refetchOnMount: false,
+ retryOnMount: false,
+ retry: false
+ })
+}
diff --git a/apps/desktop/src/app/capabilities/catalog/skill-catalog.tsx b/apps/desktop/src/app/capabilities/catalog/skill-catalog.tsx
new file mode 100644
index 00000000000..e11a23b7b62
--- /dev/null
+++ b/apps/desktop/src/app/capabilities/catalog/skill-catalog.tsx
@@ -0,0 +1,50 @@
+import { useCallback, useState } from 'react'
+
+import type { ProfileScope } from '@/hermes'
+import { useI18n } from '@/i18n'
+import { installHubSkill, notifyHubActionFailed } from '@/store/hub-actions'
+import { notify } from '@/store/notifications'
+
+import { CatalogBrowser } from './catalog-browser'
+import type { CatalogEntry } from './catalog-data'
+
+interface SkillCatalogProps {
+ installedNames: ReadonlySet<string>
+ profile?: ProfileScope
+ query?: string
+ onQueryChange?: (value: string) => void
+}
+
+export function SkillCatalog({ installedNames, profile, query = '', onQueryChange }: SkillCatalogProps) {
+ const { t } = useI18n()
+ const h = t.skills.hub
+ const [installing, setInstalling] = useState<ReadonlySet<string>>(new Set())
+
+ const isInstalled = useCallback(
+ (entry: CatalogEntry) => installedNames.has(entry.name) || installedNames.has(entry.identifier),
+ [installedNames]
+ )
+
+ const install = (entry: CatalogEntry) => {
+ if (!entry.installIdentifier || isInstalled(entry) || installing.has(entry.id)) {
+ return
+ }
+
+ setInstalling(current => new Set(current).add(entry.id))
+ notify({ kind: 'success', title: h.installStarted(entry.name), message: h.actionLog })
+ void installHubSkill(entry.installIdentifier, profile)
+ .catch(err => notifyHubActionFailed(err, h.actionFailed, entry.name, profile))
+ .finally(() => setInstalling(current => new Set([...current].filter(id => id !== entry.id))))
+ }
+
+ return (
+ <CatalogBrowser
+ isInstalled={isInstalled}
+ isInstalling={entry => installing.has(entry.id)}
+ kind="skills"
+ onInstall={install}
+ onQueryChange={onQueryChange}
+ query={query}
+ />
+ )
+}
diff --git a/apps/desktop/src/app/capabilities/catalog/store.ts b/apps/desktop/src/app/capabilities/catalog/store.ts
new file mode 100644
index 00000000000..4581228039b
--- /dev/null
+++ b/apps/desktop/src/app/capabilities/catalog/store.ts
@@ -0,0 +1,4 @@
+import { Codecs, persistentAtom } from '@/lib/persisted'
+
+// One browsing layout across Skills and Plugins; Installed keeps its own list.
+export const $catalogCardView = persistentAtom('hermes.desktop.capabilities.catalogCardView', true, Codecs.bool)
diff --git a/apps/desktop/src/app/capabilities/catalog/update-skills-button.tsx b/apps/desktop/src/app/capabilities/catalog/update-skills-button.tsx
new file mode 100644
index 00000000000..d57f281b534
--- /dev/null
+++ b/apps/desktop/src/app/capabilities/catalog/update-skills-button.tsx
@@ -0,0 +1,26 @@
+import { Button } from '@/components/ui/button'
+import type { ProfileScope } from '@/hermes'
+import { useI18n } from '@/i18n'
+import { useStoreSelector } from '@/lib/use-session-slice'
+import { $hubActions, UPDATE_ALL_KEY, updateHubSkills } from '@/store/hub-actions'
+import { notify, notifyError } from '@/store/notifications'
+
+export function UpdateSkillsButton({ profile }: { profile?: ProfileScope }) {
+ const { t } = useI18n()
+ const h = t.skills.hub
+ const updating = useStoreSelector($hubActions, actions => actions[UPDATE_ALL_KEY]?.running ?? false)
+
+ return (
+ <Button
+ disabled={updating}
+ onClick={() => {
+ notify({ kind: 'success', title: h.updateStarted, message: h.actionLog })
+ void updateHubSkills(profile).catch(err => notifyError(err, h.actionFailed))
+ }}
+ size="xs"
+ variant="text"
+ >
+ {updating ? h.updating : h.updateAll}
+ </Button>
+ )
+}
diff --git a/apps/desktop/src/app/capabilities/index.test.tsx b/apps/desktop/src/app/capabilities/index.test.tsx
index 20a16c623a4..16b938ac515 100644
--- a/apps/desktop/src/app/capabilities/index.test.tsx
+++ b/apps/desktop/src/app/capabilities/index.test.tsx
@@ -1,6 +1,6 @@
// @vitest-environment jsdom
import { QueryClientProvider } from '@tanstack/react-query'
-import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
+import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'
import { MemoryRouter } from 'react-router'
import type * as ReactRouterDom from 'react-router'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
@@ -9,6 +9,9 @@ import type * as HermesApi from '@/hermes'
import { queryClient } from '@/lib/query-client'
import type * as HubActions from '@/store/hub-actions'
+import { parseCatalog } from './catalog/catalog-data'
+import { $catalogCardView } from './catalog/store'
+
const getSkills = vi.fn()
const getToolsets = vi.fn()
const setSkillEnabled = vi.fn()
@@ -97,6 +100,7 @@ async function renderSkills() {
}
beforeEach(() => {
+ $catalogCardView.set(true)
getSkills.mockResolvedValue([])
getToolsets.mockResolvedValue([toolset()])
setToolsetEnabled.mockResolvedValue({ ok: true, name: 'web', enabled: false })
@@ -261,65 +265,74 @@ describe('CapabilitiesView toolset management', { timeout: 60_000 }, () => {
expect(await screen.findByText(/Deep research steps/)).toBeTruthy()
})
- it('hub picker refuses to reinstall an already-installed skill', async () => {
- const { notify } = await import('@/store/notifications')
- const { EmbeddedHubPicker } = await import('./skills/embedded-hub-picker')
-
- render(<EmbeddedHubPicker installedNames={new Set(['web-research'])} profile={null} />)
-
- // The picker is expanded by default — the hub iframe is live on mount.
- expect(document.querySelector('iframe')).toBeTruthy()
+ it('keeps installed skills disabled in Browse and installs new cards into the pinned remote profile', async () => {
+ const { installHubSkill } = await import('@/store/hub-actions')
+ getSkills.mockResolvedValue([
+ { name: 'web-research', description: 'Research', enabled: true, category: 'research' }
+ ])
+ queryClient.setQueryData(
+ ['public-catalog', 'skills'],
+ parseCatalog('skills', [
+ { name: 'web-research', source: 'official', identifier: 'official/research/web-research' },
+ { name: 'gif-search', source: 'official', identifier: 'official/gifs/gif-search' }
+ ])
+ )
- await act(async () => {
- window.dispatchEvent(
- new MessageEvent('message', {
- data: { type: 'hermes-skill-pick', name: 'web-research', identifier: 'web-research' },
- origin: 'https://hermes-agent.nousresearch.com'
- })
- )
- })
+ render(
+ <QueryClientProvider client={queryClient}>
+ <MemoryRouter>
+ <CapabilitiesView embedded fixedConnection="homelab" fixedProfile="inbox-bot" />
+ </MemoryRouter>
+ </QueryClientProvider>
+ )
- // Refused with an informational toast, no install action spawned.
+ await screen.findByRole('switch', { name: 'web-research' })
+ const search = screen.getByRole('textbox', { name: 'Search skills' })
+ fireEvent.click(screen.getByRole('button', { name: 'Browse' }))
+ const installed = (await screen.findByRole('button', { name: 'web-research' })).closest('article')!
+ expect(within(installed).getByRole<HTMLButtonElement>('button', { name: 'Installed' }).disabled).toBe(true)
+ const available = screen.getByRole('button', { name: 'gif-search' }).closest('article')!
+ fireEvent.click(within(available).getByRole('button', { name: 'Install' }))
await waitFor(() =>
- expect(vi.mocked(notify)).toHaveBeenCalledWith(
- expect.objectContaining({ title: expect.stringContaining('web-research') })
- )
+ expect(installHubSkill).toHaveBeenCalledExactlyOnceWith('official/gifs/gif-search', {
+ connectionId: 'homelab',
+ profile: 'inbox-bot'
+ })
)
+ expect(screen.getByRole('textbox', { name: 'Search skills' })).toBe(search)
+ expect(document.querySelector('iframe')).toBeNull()
})
- it('mounts the hub iframe lazily and keeps it (hidden) across tab switches', async () => {
- // On a non-Skills tab the docs-site iframe must not exist at all — an
- // eagerly mounted hub is exactly the Capabilities lag bug.
- await renderSkills() // ?tab=toolsets
- await screen.findByRole('switch', { name: 'Turn Web Search toolset off' })
- expect(document.querySelector('iframe')).toBeNull()
- cleanup()
+ it('defers catalog requests until Browse and keeps one search input across management and browsing', async () => {
+ const fetch = vi.fn().mockResolvedValue({
+ ok: true,
+ json: async () => [{ name: 'example', source: 'official', identifier: 'official/example' }]
+ })
+ vi.stubGlobal('fetch', fetch)
- // Embedded mode drives tabs through local state (the route hooks are
- // mocked here), starting on Skills: the picker mounts with the tab.
- await act(async () => {
+ try {
render(
<QueryClientProvider client={queryClient}>
- <MemoryRouter initialEntries={['/capabilities']}>
- <CapabilitiesView embedded />
+ <MemoryRouter>
+ <CapabilitiesView embedded fixedProfile="default" />
</MemoryRouter>
</QueryClientProvider>
)
- })
-
- const iframe = document.querySelector('iframe')
- expect(iframe).toBeTruthy()
- expect(iframe!.closest('section')!.classList.contains('hidden')).toBe(false)
-
- // Switch to Tools → the iframe STAYS mounted (no docs-site reload on the
- // next visit) but its section is fully hidden, so nothing from the hub
- // can paint over the toolsets UI.
- await act(async () => {
- fireEvent.click(screen.getByRole('button', { name: /Tools/ }))
- })
- const kept = document.querySelector('iframe')
- expect(kept).toBeTruthy()
- expect(kept!.closest('section')!.classList.contains('hidden')).toBe(true)
+ await screen.findByText('No skills found')
+ const search = screen.getByRole('textbox', { name: 'Search skills' })
+ expect(fetch).not.toHaveBeenCalled()
+ fireEvent.click(screen.getByRole('button', { name: 'Browse' }))
+ await screen.findByRole('button', { name: 'example' })
+ expect(fetch).toHaveBeenCalledTimes(1)
+ fireEvent.click(screen.getByRole('button', { name: 'Installed' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Browse' }))
+ await screen.findByRole('button', { name: 'example' })
+ expect(fetch).toHaveBeenCalledTimes(1)
+ expect(screen.getByRole('textbox', { name: 'Search skills' })).toBe(search)
+ expect(document.querySelector('iframe')).toBeNull()
+ } finally {
+ vi.unstubAllGlobals()
+ }
})
it('shows a vision explainer that deep-links to Settings → Models', async () => {
diff --git a/apps/desktop/src/app/capabilities/index.tsx b/apps/desktop/src/app/capabilities/index.tsx
index d784218db2e..8c4fe5a5731 100644
--- a/apps/desktop/src/app/capabilities/index.tsx
+++ b/apps/desktop/src/app/capabilities/index.tsx
@@ -16,10 +16,12 @@ import { PanelEmpty } from '../overlays/panel'
import { PageSearchShell } from '../page-search-shell'
import type { SetStatusbarItemGroup } from '../shell/statusbar-controls'
+import { CapabilityTabs, type CapabilityView } from './catalog/capability-tabs'
+import { SkillCatalog } from './catalog/skill-catalog'
+import { UpdateSkillsButton } from './catalog/update-skills-button'
import { ConnectorsTab } from './connectors/connectors-tab'
-import { PluginsTab } from './plugins/plugins-tab'
+import { PluginActions, PluginsTab } from './plugins/plugins-tab'
import { CapabilityScopeSelector, useCapabilityScope } from './scope-selector'
-import { EmbeddedHubPicker } from './skills/embedded-hub-picker'
import { SKILLS_QUERY_KEY, skillSearchTerms, useSkillsQuery } from './skills/skills-data'
import { SkillsTab } from './skills/skills-tab'
import { refreshToolCalls } from './toolsets/tool-calls'
@@ -71,13 +73,8 @@ export function CapabilitiesView({
const gateway = useStoreSelector($gateway, g => (mode === 'connectors' ? g : null))
const [query, setQuery] = useState('')
-
- // Keep the docs iframe alive after the first Skills visit.
- const [hubMounted, setHubMounted] = useState(mode === 'skills')
-
- if (mode === 'skills' && !hubMounted) {
- setHubMounted(true)
- }
+ const [skillsView, setSkillsView] = useState<CapabilityView>('installed')
+ const [pluginsView, setPluginsView] = useState<CapabilityView>('installed')
const scope = useCapabilityScope({ fixedConnection, fixedProfile })
@@ -116,7 +113,7 @@ export function CapabilitiesView({
}, [mode, skills, t, toolsets])
// MCP and Plugins load independently of the installed Skills/Tools lists.
- const gated = mode === 'toolsets' || mode === 'skills'
+ const gated = mode === 'toolsets' || (mode === 'skills' && skillsView === 'installed')
const pending = gated && !(skills && toolsets)
const loadGate = !pending ? null : skillsFailed || toolsetsFailed ? (
@@ -145,25 +142,37 @@ export function CapabilitiesView({
profile={scope.profile}
/>
),
- // Agent plugins for the scoped profile (selector in the section header),
- // app-level desktop plugins, and the docs catalog picker underneath.
+ // Agent plugins for the scoped profile and app-level desktop plugins.
plugins: () => (
<PluginsTab
key={`plugins-${scope.key}`}
+ onQueryChange={setQuery}
+ onViewChange={setPluginsView}
profile={scope.profile}
+ query={query}
scopeLabel={scope.label}
scopeSelector={scope.options.length > 1 ? <CapabilityScopeSelector compact scope={scope} /> : undefined}
+ view={pluginsView}
/>
),
- skills: () => (
- <SkillsTab
- key={`skills-${scope.key}`}
- onRefresh={() => void refreshCapabilities()}
- profile={scope.profile}
- query={query}
- skills={skills ?? []}
- />
- ),
+ skills: () =>
+ skillsView === 'browse' ? (
+ <SkillCatalog
+ installedNames={installedSkillNames}
+ key={`catalog-${scope.key}`}
+ onQueryChange={setQuery}
+ profile={scope.profile}
+ query={query}
+ />
+ ) : (
+ <SkillsTab
+ key={`skills-${scope.key}`}
+ onRefresh={() => void refreshCapabilities()}
+ profile={scope.profile}
+ query={query}
+ skills={skills ?? []}
+ />
+ ),
toolsets: () => (
<ToolsetsTab key={`toolsets-${scope.key}`} profile={scope.profile} query={query} toolsets={toolsets ?? []} />
)
@@ -175,10 +184,16 @@ export function CapabilitiesView({
activeTab={mode}
onSearchChange={setQuery}
onTabChange={id => setMode(id as CapabilityMode)}
- // The Connectors directory owns its search field; plugins has its own list.
- searchHidden={mode === 'connectors' || mode === 'plugins'}
+ // The Connectors directory owns its search field.
+ searchHidden={mode === 'connectors'}
searchHints={searchHints}
- searchPlaceholder={mode === 'skills' ? t.skills.searchSkills : t.skills.searchToolsets}
+ searchPlaceholder={
+ mode === 'plugins'
+ ? t.catalog.searchPlugins
+ : mode === 'skills'
+ ? t.catalog.searchSkills
+ : t.skills.searchToolsets
+ }
searchValue={query}
tabs={[
{ id: 'skills', label: t.skills.tabSkills, meta: skills?.length ?? null },
@@ -189,18 +204,20 @@ export function CapabilitiesView({
>
<div className="flex h-full flex-col">
{mode !== 'plugins' && <CapabilityScopeSelector scope={scope} />}
- <div className="flex min-h-0 flex-1 flex-col">
- <div className={mode === 'skills' ? 'min-h-40 flex-1 overflow-hidden' : 'min-h-0 flex-1'}>
- {loadGate ?? tabContent[mode]()}
- </div>
- {hubMounted && (
- <EmbeddedHubPicker
- hidden={mode !== 'skills'}
- installedNames={installedSkillNames}
- profile={scope.profile}
- />
- )}
- </div>
+ {(mode === 'skills' || mode === 'plugins') && (
+ <CapabilityTabs
+ actions={
+ mode === 'skills' ? (
+ <UpdateSkillsButton profile={scope.profile} />
+ ) : (
+ <PluginActions profile={scope.profile} />
+ )
+ }
+ onChange={mode === 'skills' ? setSkillsView : setPluginsView}
+ value={mode === 'skills' ? skillsView : pluginsView}
+ />
+ )}
+ <div className="flex min-h-0 flex-1 flex-col">{loadGate ?? tabContent[mode]()}</div>
</div>
</PageSearchShell>
)
diff --git a/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx b/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx
index 8c1180d5919..cd13ca1fe14 100644
--- a/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx
+++ b/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx
@@ -1,16 +1,71 @@
-import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'
+import { QueryClientProvider } from '@tanstack/react-query'
+import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'
+import { type ComponentProps, useState } from 'react'
+import { MemoryRouter, useLocation } from 'react-router'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { $pluginRecords } from '@/contrib/plugins-store'
-import { $agentPlugins, $agentPluginsStatus } from '@/store/agent-plugins'
+import { queryClient } from '@/lib/query-client'
+import { $agentPlugins, $agentPluginsStatus, type AgentPluginRow } from '@/store/agent-plugins'
import { $confirmRequest, settleConfirm } from '@/store/confirm'
-import { $paneHeightOverride, setPaneHeightOverride } from '@/store/panes'
import { $pluginInstallRequest, closePluginInstallRequest } from '@/store/plugin-install-request'
import { $connection } from '@/store/session'
-import { PluginsTab } from './plugins-tab'
+import { PageSearchShell } from '../../page-search-shell'
+import { CapabilityTabs } from '../catalog/capability-tabs'
+import { parseCatalog } from '../catalog/catalog-data'
+import { $catalogCardView } from '../catalog/store'
-const requestGateway = vi.fn(async () => ({ plugins: [] }))
+import { PluginActions, PluginsTab } from './plugins-tab'
+
+const requestGateway = vi.fn(async (_method: string, _params?: Record<string, unknown>): Promise<unknown> => ({
+ plugins: $agentPlugins.get()
+}))
+
+// The shell owns search and navigation; exercise the same controlled composition.
+function PluginsHarness({
+ view: initialView = 'installed',
+ query: initialQuery = '',
+ ...props
+}: ComponentProps<typeof PluginsTab>) {
+ const [view, setView] = useState(initialView)
+ const [query, setQuery] = useState(initialQuery)
+
+ return (
+ <PageSearchShell onSearchChange={setQuery} searchPlaceholder="Search plugins" searchValue={query}>
+ <CapabilityTabs actions={<PluginActions profile={props.profile} />} onChange={setView} value={view} />
+ <PluginsTab {...props} onQueryChange={setQuery} onViewChange={setView} query={query} view={view} />
+ </PageSearchShell>
+ )
+}
+
+function renderPlugins(props: ComponentProps<typeof PluginsTab>) {
+ return render(
+ <QueryClientProvider client={queryClient}>
+ <PluginsHarness {...props} />
+ </QueryClientProvider>
+ )
+}
+
+const weatherEntry = {
+ name: 'weather-plugin',
+ repo: 'https://github.com/example/weather-plugin',
+ sha: 'a'.repeat(40),
+ subdir: '',
+ tier: 'community',
+ category: 'weather',
+ description: 'Local weather forecasts'
+}
+
+function seedCatalog(entries = [weatherEntry]) {
+ queryClient.setQueryData(['public-catalog', 'plugins'], parseCatalog('plugins', entries))
+}
+
+async function selectCatalogEntry(name: string) {
+ fireEvent.click(screen.getByRole('button', { name: 'Browse' }))
+ fireEvent.click(await screen.findByRole('button', { name: text => text.startsWith(name) }))
+ expect(screen.getByRole('heading', { name })).toBeTruthy()
+}
const connectionFixture = {
baseUrl: 'http://localhost',
@@ -27,24 +82,68 @@ vi.mock('@/app/gateway/hooks/use-gateway-request', () => ({
}))
const uninstallDiskPlugin = vi.fn(async (_id: string) => ({ ok: true }))
+const setEnvVar = vi.fn(async (..._args: unknown[]) => ({}))
+
+vi.mock('@/api/config', () => ({ setEnvVar: (...args: unknown[]) => setEnvVar(...args) }))
vi.mock('@/contrib/runtime-loader', async importOriginal => ({
...(await importOriginal<Record<string, unknown>>()),
uninstallDiskPlugin: (id: string) => uninstallDiskPlugin(id)
}))
-describe('PluginsTab', () => {
- beforeEach(() => {
- $pluginRecords.set({})
- $agentPlugins.set([])
- $agentPluginsStatus.set('ready')
- closePluginInstallRequest()
- requestGateway.mockClear()
- })
+beforeEach(() => {
+ $pluginRecords.set({})
+ $agentPlugins.set([])
+ $agentPluginsStatus.set('ready')
+ $catalogCardView.set(false)
+ closePluginInstallRequest()
+ requestGateway.mockReset()
+ requestGateway.mockImplementation(async () => ({ plugins: $agentPlugins.get() }))
+ setEnvVar.mockClear()
+})
+
+afterEach(() => {
+ cleanup()
+ settleConfirm(false)
+ $connection.set(null)
+ queryClient.clear()
+ vi.unstubAllGlobals()
+})
- afterEach(() => {
- cleanup()
- $connection.set(null)
+describe('PluginsTab', () => {
+ it('opens a non-first installed deep-link target from Browse and keeps that selection after consuming the link', async () => {
+ Element.prototype.scrollIntoView = vi.fn()
+ $agentPlugins.set(
+ ['alpha', 'omega'].map(name => ({
+ key: name,
+ name,
+ description: `${name} plugin`,
+ source: 'git',
+ status: 'enabled',
+ version: '1'
+ }))
+ )
+ seedCatalog()
+
+ function Location() {
+ return <output data-testid="route">{useLocation().search}</output>
+ }
+
+ render(
+ <QueryClientProvider client={queryClient}>
+ <MemoryRouter initialEntries={['/capabilities?tab=plugins&plugin=omega']}>
+ <Location />
+ <PluginsHarness profile="workbot" query="nothing-matches" view="browse" />
+ </MemoryRouter>
+ </QueryClientProvider>
+ )
+ await screen.findByRole('switch', { name: 'Agent: omega' })
+ await waitFor(() => expect(screen.getByTestId('route').textContent).toBe('?tab=plugins'))
+ expect(screen.getByRole('button', { name: 'Installed', pressed: true })).toBeTruthy()
+ expect(screen.getByRole<HTMLInputElement>('textbox', { name: 'Search plugins' }).value).toBe('')
+ expect(screen.getByRole('switch', { name: 'Agent: omega' })).toBeTruthy()
+ fireEvent.click(screen.getByRole('button', { name: /alpha/ }))
+ expect(screen.getByRole('switch', { name: 'Agent: alpha' })).toBeTruthy()
})
it('renders declared server pills and the unavailable sentence under the description', () => {
@@ -67,7 +166,7 @@ describe('PluginsTab', () => {
}
])
- render(<PluginsTab profile="workbot" />)
+ renderPlugins({ profile: 'workbot' })
expect(screen.getByTestId('server-pill-ready-server')).toBeTruthy()
expect(screen.getByTestId('server-pill-setup-server')).toBeTruthy()
@@ -87,10 +186,11 @@ describe('PluginsTab', () => {
}
])
- render(<PluginsTab profile={null} />)
+ renderPlugins({ profile: null })
expect(screen.queryByText('fal')).toBeNull()
- expect(screen.getByText(/No plugins yet/)).toBeTruthy()
+ expect(screen.queryByRole('row')).toBeNull()
+ expect(screen.getByText('No matches')).toBeTruthy()
})
// A desktop half can only be copied out of a backend that runs on THIS
@@ -110,7 +210,7 @@ describe('PluginsTab', () => {
}
])
- render(<PluginsTab profile={null} />)
+ renderPlugins({ profile: null })
const detail = within(screen.getByRole('row', { name: /^nous-prices/ }))
expect(detail.getByText('unavailable (remote backend)')).toBeTruthy()
@@ -130,7 +230,7 @@ describe('PluginsTab', () => {
}
])
- render(<PluginsTab profile={null} />)
+ renderPlugins({ profile: null })
const detail = within(screen.getByRole('row', { name: /^nous-prices/ }))
expect(detail.getByText('copying…')).toBeTruthy()
@@ -152,7 +252,7 @@ describe('PluginsTab', () => {
}
])
- render(<PluginsTab profile="workbot" scopeLabel="workbot" />)
+ renderPlugins({ profile: 'workbot', scopeLabel: 'workbot' })
expect(screen.getAllByTestId(/^plugin-row-/)).toHaveLength(1)
expect(screen.getByText('Agent + Desktop')).toBeTruthy()
@@ -173,7 +273,7 @@ describe('PluginsTab', () => {
}
})
- render(<PluginsTab profile="workbot" scopeLabel="workbot" />)
+ renderPlugins({ profile: 'workbot', scopeLabel: 'workbot' })
expect(screen.queryByRole('switch', { name: /^Agent:/ })).toBeNull()
screen.getByRole('button', { name: 'Install here' }).click()
@@ -193,13 +293,13 @@ describe('PluginsTab', () => {
media: { id: 'media', name: 'Media Studio', kind: 'disk', status: 'loaded', packageName: 'hermes-media-studio' }
})
- render(<PluginsTab profile="workbot" scopeLabel="workbot" />)
+ renderPlugins({ profile: 'workbot', scopeLabel: 'workbot' })
expect((screen.getByRole('button', { name: 'Install here' }) as HTMLButtonElement).disabled).toBe(true)
})
it('loads the plugin list scoped to the selected profile', () => {
- render(<PluginsTab profile="workbot" />)
+ renderPlugins({ profile: 'workbot' })
expect(requestGateway).toHaveBeenCalledWith(
'plugins.manage',
@@ -207,49 +307,43 @@ describe('PluginsTab', () => {
)
})
- it('opens the dual-target install modal from a catalog pick message', async () => {
- render(<PluginsTab profile="workbot" />)
-
- window.dispatchEvent(
- new MessageEvent('message', {
- data: {
- name: 'weather-plugin',
- repo: 'https://github.com/example/weather-plugin',
- sha: 'a'.repeat(40),
- subdir: '',
- tier: 'community',
- type: 'hermes-plugin-pick'
- },
- origin: 'https://hermes-agent.nousresearch.com'
- })
- )
+ it.each([false, true])('opens the scoped native install dialog from the selected entry (cards=%s)', async cards => {
+ $catalogCardView.set(cards)
+ seedCatalog([
+ { ...weatherEntry, name: 'other-plugin', repo: 'https://github.com/example/other-plugin' },
+ weatherEntry
+ ])
+ renderPlugins({ profile: 'workbot' })
- await waitFor(() => {
- const request = $pluginInstallRequest.get()
+ await selectCatalogEntry(weatherEntry.name)
+ expect($pluginInstallRequest.get()).toBeNull()
+ fireEvent.click(screen.getByRole('button', { name: 'Install' }))
- expect(request).not.toBeNull()
- expect(request?.catalogName).toBe('weather-plugin')
- expect(request?.repo).toBe('https://github.com/example/weather-plugin')
- expect(request?.profile).toBe('workbot')
- expect(request?.sha).toBe('a'.repeat(40))
+ expect($pluginInstallRequest.get()).toMatchObject({
+ catalogName: weatherEntry.name,
+ repo: weatherEntry.repo,
+ profile: 'workbot',
+ sha: weatherEntry.sha
})
})
- it('ignores pick messages from foreign origins', () => {
- render(<PluginsTab profile={null} />)
-
- window.dispatchEvent(
- new MessageEvent('message', {
- data: {
- name: 'evil-plugin',
- repo: 'https://github.com/evil/evil-plugin',
- type: 'hermes-plugin-pick'
- },
- origin: 'https://evil.example.com'
- })
- )
+ it('keeps Installed in list/detail mode and filters it through the parent search', () => {
+ $catalogCardView.set(true)
+ $pluginRecords.set({
+ clock: { id: 'clock', name: 'Clock', kind: 'disk', status: 'loaded' },
+ weather: { id: 'weather', name: 'Weather', kind: 'disk', status: 'loaded' }
+ })
+ renderPlugins({ profile: null })
- expect($pluginInstallRequest.get()).toBeNull()
+ expect(screen.getByRole('button', { name: /^Clock/, pressed: true })).toBeTruthy()
+ expect(screen.getByRole('switch', { name: 'Desktop: Clock' })).toBeTruthy()
+ fireEvent.click(screen.getByRole('button', { name: /^Weather/ }))
+ expect(screen.getByRole('switch', { name: 'Desktop: Weather' })).toBeTruthy()
+ expect(screen.queryByRole('dialog')).toBeNull()
+
+ fireEvent.change(screen.getByRole('textbox', { name: 'Search plugins' }), { target: { value: 'Clock' } })
+ expect(screen.queryByRole('button', { name: /^Weather/ })).toBeNull()
+ expect(screen.getByRole('switch', { name: 'Desktop: Clock' })).toBeTruthy()
})
it('toggles by canonical key through plugins.manage', async () => {
@@ -263,12 +357,13 @@ describe('PluginsTab', () => {
version: '0.20.0'
}
])
- requestGateway.mockResolvedValueOnce({
- ok: true,
- plugin: { key: 'image_gen/legacy', name: 'Legacy plugin', status: 'enabled' }
- } as never)
+ requestGateway.mockImplementation(async (_method, params) =>
+ params?.action === 'toggle'
+ ? { ok: true, plugin: { key: 'image_gen/legacy', name: 'Legacy plugin', status: 'enabled' } }
+ : { plugins: $agentPlugins.get() }
+ )
- render(<PluginsTab profile={null} />)
+ renderPlugins({ profile: null })
screen.getByRole('switch', { name: 'Agent: Legacy plugin' }).click()
@@ -293,7 +388,7 @@ describe('PluginsTab', () => {
}
])
- render(<PluginsTab profile={null} />)
+ renderPlugins({ profile: null })
const toggle = screen.getByRole('switch', { name: 'Agent: Legacy plugin' })
@@ -304,56 +399,195 @@ describe('PluginsTab', () => {
expect(requestGateway).not.toHaveBeenCalledWith('plugins.manage', expect.objectContaining({ action: 'toggle' }))
})
- it('appends the subdir fragment for multi-plugin repos', async () => {
- render(<PluginsTab profile={null} />)
-
- window.dispatchEvent(
- new MessageEvent('message', {
- data: {
- name: 'nested-plugin',
- repo: 'https://github.com/example/plugins-monorepo',
- subdir: 'nested-plugin',
- type: 'hermes-plugin-pick'
- },
- origin: 'https://hermes-agent.nousresearch.com'
- })
- )
-
- await waitFor(() => {
- expect($pluginInstallRequest.get()?.repo).toBe('https://github.com/example/plugins-monorepo#nested-plugin')
+ it('appends the selected subdir for multi-plugin repos without changing the catalog pin', async () => {
+ const entry = {
+ ...weatherEntry,
+ name: 'nested-plugin',
+ repo: 'https://github.com/example/plugins-monorepo',
+ subdir: 'packages/nested-plugin'
+ }
+
+ seedCatalog([entry])
+ renderPlugins({ profile: null })
+
+ await selectCatalogEntry(entry.name)
+ fireEvent.click(screen.getByRole('button', { name: 'Install' }))
+
+ expect($pluginInstallRequest.get()).toMatchObject({
+ catalogName: entry.name,
+ repo: `${entry.repo}#${entry.subdir}`,
+ profile: null,
+ sha: entry.sha
})
})
})
describe('PluginsTab catalog UX', () => {
- beforeEach(() => {
- $agentPlugins.set([])
- $agentPluginsStatus.set('ready')
- closePluginInstallRequest()
- requestGateway.mockClear()
- setPaneHeightOverride('capabilities-plugin-catalog', undefined)
+ it('saves declared settings from the installed detail with values and secrets on their scoped routes', async () => {
+ const row: AgentPluginRow = {
+ name: 'demo-settings',
+ key: 'category/demo-settings',
+ description: 'Configurable plugin',
+ source: 'git',
+ status: 'enabled',
+ version: '1',
+ settings_schema: [
+ { key: 'retries', label: 'Retries', type: 'number', description: '', required: true, value: 3 },
+ { key: 'api_key', label: 'API key', type: 'secret', description: '', required: true, env: 'DEMO_API_KEY' }
+ ]
+ }
+
+ $agentPlugins.set([row])
+ requestGateway.mockImplementation(async (_method, params) =>
+ params?.action === 'settings'
+ ? {
+ ok: true,
+ plugin: {
+ ...row,
+ settings_schema: row.settings_schema!.map(field =>
+ field.key === 'retries' ? { ...field, value: 9 } : field
+ )
+ }
+ }
+ : { plugins: $agentPlugins.get() }
+ )
+
+ const profile = { profile: 'workbot', connectionId: 'remote-work' }
+
+ await act(async () => {
+ renderPlugins({ profile })
+ })
+
+ fireEvent.click(screen.getByRole('button', { name: 'Settings: demo-settings' }))
+ fireEvent.change(screen.getByRole('spinbutton', { name: 'Retries' }), { target: { value: '9' } })
+ fireEvent.change(screen.getByLabelText('API key'), { target: { value: 'test-api-key' } })
+ fireEvent.click(screen.getByRole('button', { name: 'Save settings' }))
+
+ await waitFor(() => expect(setEnvVar).toHaveBeenCalledWith('DEMO_API_KEY', 'test-api-key', profile))
+ await waitFor(() =>
+ expect(requestGateway).toHaveBeenCalledWith('plugins.manage', {
+ action: 'settings',
+ key: row.key,
+ values: { retries: 9 },
+ profile: 'workbot'
+ })
+ )
+ await waitFor(() => expect(screen.getByLabelText<HTMLInputElement>('API key').value).toBe(''))
+ expect(screen.getByRole<HTMLButtonElement>('button', { name: 'Save settings' }).disabled).toBe(true)
})
- afterEach(cleanup)
+ it('requires widening consent before retrying an update, and leaves a declined update untouched', async () => {
+ $agentPlugins.set([
+ {
+ name: 'demo-weather',
+ key: 'demo-weather',
+ description: '',
+ source: 'git',
+ status: 'enabled',
+ version: '1',
+ catalog_sha: 'b'.repeat(40),
+ update_available: true
+ }
+ ])
+ requestGateway.mockImplementation(async (_method, params) => {
+ if (params?.action !== 'update') {
+ return { plugins: $agentPlugins.get() }
+ }
- it('grows the catalog when its top-edge sash is dragged up, and resets on double-click', () => {
- // jsdom has no layout: give the Capabilities column a real height so the
- // "never crush the lists above" clamp has something to clamp against.
- const clientHeight = vi.spyOn(HTMLElement.prototype, 'clientHeight', 'get').mockReturnValue(900)
- Object.defineProperty(window, 'innerHeight', { configurable: true, value: 1000 })
- render(<PluginsTab profile={null} />)
- const sash = screen.getByTestId('plugin-catalog-sash')
+ return params.accept_capabilities
+ ? { ok: true, unchanged: false }
+ : { consent_required: true, sha: 'b'.repeat(40), delta_lines: ['Tools: weather-alerts'] }
+ })
+ await act(async () => {
+ renderPlugins({ profile: 'workbot' })
+ })
+ fireEvent.click(screen.getByRole('button', { name: `Update to ${'b'.repeat(8)}` }))
+ await waitFor(() => expect($confirmRequest.get()?.description).toContain('Tools: weather-alerts'))
+ expect($confirmRequest.get()?.title).toBe('demo-weather asks for more')
+ await act(async () => {
+ settleConfirm(false)
+ })
+ expect(requestGateway).not.toHaveBeenCalledWith(
+ 'plugins.manage',
+ expect.objectContaining({ accept_capabilities: true })
+ )
+ expect(screen.getByRole('button', { name: `Update to ${'b'.repeat(8)}` })).toBeTruthy()
- fireEvent.pointerDown(sash, { button: 0, clientY: 600 })
- fireEvent.pointerMove(window, { clientY: 400 })
- fireEvent.pointerUp(window)
+ fireEvent.click(screen.getByRole('button', { name: `Update to ${'b'.repeat(8)}` }))
+ await waitFor(() => expect($confirmRequest.get()).not.toBeNull())
+ await act(async () => {
+ settleConfirm(true)
+ })
+ expect(requestGateway).toHaveBeenCalledWith('plugins.manage', {
+ action: 'update',
+ name: 'demo-weather',
+ profile: 'workbot',
+ accept_capabilities: true
+ })
+ })
- // Default 380px + 200px of upward drag (clamped only by window/column size).
- expect($paneHeightOverride('capabilities-plugin-catalog').get()).toBe(580)
+ it('fetches only on Browse, retaining parent search across selection and tab bounce', async () => {
+ const fetchCatalog = vi.fn().mockResolvedValue({
+ ok: true,
+ json: async () => [
+ weatherEntry,
+ { ...weatherEntry, name: 'garden-plugin', category: 'garden', description: 'Garden planning' }
+ ]
+ })
+
+ vi.stubGlobal('fetch', fetchCatalog)
+ await act(async () => {
+ renderPlugins({ profile: null })
+ })
+
+ expect(fetchCatalog).not.toHaveBeenCalled()
+ expect(screen.queryByRole('heading', { name: weatherEntry.name })).toBeNull()
+ await selectCatalogEntry('garden-plugin')
+
+ const search = screen.getByRole<HTMLInputElement>('textbox', { name: 'Search plugins' })
+
+ fireEvent.change(search, { target: { value: 'weather' } })
+ expect(await screen.findByRole('heading', { name: weatherEntry.name })).toBeTruthy()
+ expect(screen.queryByRole('button', { name: /^garden-plugin/ })).toBeNull()
+ fireEvent.click(screen.getByRole('button', { name: 'Installed', pressed: false }))
+ expect(screen.queryByRole('heading', { name: weatherEntry.name })).toBeNull()
+ expect(search.value).toBe('weather')
+ fireEvent.click(screen.getByRole('button', { name: 'Clear filters' }))
+ expect(search.value).toBe('')
+ await selectCatalogEntry('garden-plugin')
+
+ expect(fetchCatalog).toHaveBeenCalledTimes(1)
+ expect(fetchCatalog.mock.calls[0][0]).toMatch(/\/docs\/api\/plugins\.json$/)
+ expect(fetchCatalog.mock.calls[0][1]).toMatchObject({ credentials: 'omit' })
+ expect($pluginInstallRequest.get()).toBeNull()
+ })
+
+ it('retries a failed catalog only when asked, not on tab bounce', async () => {
+ const fetchCatalog = vi
+ .fn()
+ .mockResolvedValueOnce({ ok: false, status: 503 })
+ .mockResolvedValue({ ok: true, json: async () => [weatherEntry] })
+
+ vi.stubGlobal('fetch', fetchCatalog)
+ await act(async () => {
+ renderPlugins({ profile: null })
+ })
+ fireEvent.click(screen.getByRole('button', { name: 'Browse' }))
+
+ expect(await screen.findByText('Catalog HTTP 503')).toBeTruthy()
+ expect(fetchCatalog).toHaveBeenCalledTimes(1)
+ await act(async () => {
+ fireEvent.click(screen.getByRole('button', { name: /^Installed/ }))
+ })
+ await act(async () => {
+ fireEvent.click(screen.getByRole('button', { name: 'Browse' }))
+ })
+ expect(fetchCatalog).toHaveBeenCalledTimes(1)
+ expect(screen.getByText('Catalog HTTP 503')).toBeTruthy()
+ fireEvent.click(screen.getByRole('button', { name: 'Try again' }))
- fireEvent.doubleClick(sash)
- expect($paneHeightOverride('capabilities-plugin-catalog').get()).toBeUndefined()
- clientHeight.mockRestore()
+ expect(await screen.findByRole('heading', { name: weatherEntry.name })).toBeTruthy()
+ expect(fetchCatalog).toHaveBeenCalledTimes(2)
})
it('shows an Update chip when the catalog pin moved past the installed SHA', () => {
@@ -373,7 +607,7 @@ describe('PluginsTab catalog UX', () => {
}
])
- render(<PluginsTab profile={null} />)
+ renderPlugins({ profile: null })
expect(screen.getByRole('button', { name: `Update to ${'b'.repeat(8)}` })).toBeTruthy()
})
@@ -396,7 +630,7 @@ describe('PluginsTab catalog UX', () => {
])
requestGateway.mockResolvedValue({ ok: true, unchanged: false, plugins: [] } as never)
- render(<PluginsTab profile="workbot" />)
+ renderPlugins({ profile: 'workbot' })
screen.getByRole('button', { name: `Update to ${'b'.repeat(8)}` }).click()
@@ -419,14 +653,17 @@ describe('PluginsTab catalog UX', () => {
version: '1.0.0'
}
])
- requestGateway.mockResolvedValue({ ok: true, name: 'demo-weather', plugins: [] } as never)
+ requestGateway.mockImplementation(async (_method, params) =>
+ params?.action === 'remove' ? { ok: true, name: 'demo-weather' } : { plugins: $agentPlugins.get() }
+ )
- render(<PluginsTab profile="workbot" />)
+ renderPlugins({ profile: 'workbot' })
screen.getByRole('button', { name: 'Uninstall: demo-weather' }).click()
// The click only asks; nothing is deleted until the destructive confirm is answered.
await waitFor(() => expect($confirmRequest.get()?.title).toContain('demo-weather'))
+ expect(screen.getByRole('row', { name: /^demo-weather/ })).toBeTruthy()
expect(requestGateway).not.toHaveBeenCalledWith('plugins.manage', expect.objectContaining({ action: 'remove' }))
settleConfirm(true)
@@ -446,7 +683,7 @@ describe('PluginsTab catalog UX', () => {
})
uninstallDiskPlugin.mockClear()
- render(<PluginsTab profile={null} />)
+ renderPlugins({ profile: null })
screen.getByRole('button', { name: 'Uninstall: Clock' }).click()
@@ -466,10 +703,11 @@ describe('PluginsTab catalog UX', () => {
media: { id: 'media', name: 'Media Studio', kind: 'disk', status: 'loaded', packageName: 'hermes-media-studio' }
})
- render(<PluginsTab profile={null} />)
+ renderPlugins({ profile: null })
- expect(screen.getByText('Bot Mode')).toBeTruthy()
- expect(screen.getByText('Media Studio')).toBeTruthy()
+ fireEvent.click(screen.getByRole('button', { name: /^Bot Mode/ }))
+ expect(screen.queryByRole('button', { name: /^Uninstall:/ })).toBeNull()
+ fireEvent.click(screen.getByRole('button', { name: /^Media Studio/ }))
expect(screen.queryByRole('button', { name: /^Uninstall:/ })).toBeNull()
})
@@ -478,13 +716,13 @@ describe('PluginsTab catalog UX', () => {
{ description: '', key: 'demo-tool', name: 'demo-tool', source: 'entrypoint', status: 'enabled', version: '' }
])
- render(<PluginsTab profile={null} />)
+ renderPlugins({ profile: null })
- expect(screen.getByText('demo-tool')).toBeTruthy()
+ expect(screen.getByRole('row', { name: /^demo-tool/ })).toBeTruthy()
expect(screen.queryByRole('button', { name: 'Uninstall: demo-tool' })).toBeNull()
})
- it('refuses a catalog pick that is already installed and current', async () => {
+ it('disables native installation of a catalog entry that is already installed and current', async () => {
$agentPlugins.set([
{
catalog_name: 'demo-weather',
@@ -499,25 +737,19 @@ describe('PluginsTab catalog UX', () => {
}
])
- render(<PluginsTab profile={null} />)
-
- window.dispatchEvent(
- new MessageEvent('message', {
- data: {
- name: 'demo-weather',
- repo: 'https://github.com/example/demo-weather',
- type: 'hermes-plugin-pick'
- },
- origin: 'https://hermes-agent.nousresearch.com'
- })
- )
+ seedCatalog([{ ...weatherEntry, name: 'demo-weather' }])
+ await act(async () => {
+ renderPlugins({ profile: null })
+ })
+ await selectCatalogEntry('demo-weather')
- // The modal must NOT open — the pick is refused with a toast.
- await new Promise(resolve => setTimeout(resolve, 20))
+ const installed = within(screen.getByRole('main')).getByRole<HTMLButtonElement>('button', { name: 'Installed' })
+ expect(installed.disabled).toBe(true)
+ fireEvent.click(installed)
expect($pluginInstallRequest.get()).toBeNull()
})
- it('still opens the modal for an installed pick when an update is available', async () => {
+ it('offers native catalog installation when an update is available', async () => {
$agentPlugins.set([
{
catalog_name: 'demo-weather',
@@ -532,19 +764,20 @@ describe('PluginsTab catalog UX', () => {
}
])
- render(<PluginsTab profile={null} />)
+ const entry = { ...weatherEntry, name: 'demo-weather', sha: 'b'.repeat(40) }
- window.dispatchEvent(
- new MessageEvent('message', {
- data: {
- name: 'demo-weather',
- repo: 'https://github.com/example/demo-weather',
- type: 'hermes-plugin-pick'
- },
- origin: 'https://hermes-agent.nousresearch.com'
- })
- )
-
- await waitFor(() => expect($pluginInstallRequest.get()).not.toBeNull())
+ seedCatalog([entry])
+ await act(async () => {
+ renderPlugins({ profile: null })
+ })
+ await selectCatalogEntry(entry.name)
+ fireEvent.click(screen.getByRole('button', { name: 'Install' }))
+
+ expect($pluginInstallRequest.get()).toMatchObject({
+ catalogName: entry.name,
+ repo: entry.repo,
+ profile: null,
+ sha: entry.sha
+ })
})
})
diff --git a/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx b/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx
index cdce8d85e51..ffb6a0cfce2 100644
--- a/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx
+++ b/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx
@@ -1,16 +1,9 @@
import { useStore } from '@nanostores/react'
-import {
- memo,
- type ReactNode,
- type PointerEvent as ReactPointerEvent,
- useEffect,
- useMemo,
- useRef,
- useState
-} from 'react'
+import { memo, type ReactNode, useCallback, useEffect, useMemo, useState } from 'react'
import { setEnvVar } from '@/api/config'
import { useGatewayRequest } from '@/app/gateway/hooks/use-gateway-request'
+import { PageLoader } from '@/components/page-loader'
import { Button } from '@/components/ui/button'
import { Codicon } from '@/components/ui/codicon'
import { Switch } from '@/components/ui/switch'
@@ -21,7 +14,6 @@ import type { ProfileScope } from '@/hermes'
import { useI18n } from '@/i18n'
import { triggerHaptic } from '@/lib/haptics'
import { FolderOpen, Loader2, Monitor, Package, RefreshCw, Trash2 } from '@/lib/icons'
-import { CATALOG_ORIGIN, CATALOG_PICKER_URL } from '@/lib/plugin-catalog'
import { cn } from '@/lib/utils'
import {
$agentPluginBusy,
@@ -41,7 +33,6 @@ import {
} from '@/store/agent-plugins'
import { confirm } from '@/store/confirm'
import { notify, notifyError } from '@/store/notifications'
-import { $paneHeightOverride, setPaneHeightOverride } from '@/store/panes'
import { openCatalogPluginInstall } from '@/store/plugin-catalog-install'
import { openPluginInstallRequest } from '@/store/plugin-install-request'
import { $connection } from '@/store/session'
@@ -49,40 +40,13 @@ import { $connection } from '@/store/session'
import { PanelEmpty } from '../../overlays/panel'
import { Pill } from '../../settings/primitives'
import { useDeepLinkHighlight } from '../../settings/use-deep-link-highlight'
+import type { CapabilityView } from '../catalog/capability-tabs'
+import { CatalogBrowser } from '../catalog/catalog-browser'
+import { type CatalogEntry, parseCatalog } from '../catalog/catalog-data'
import { mergePluginPackages, type PackageKind, type PluginPackage } from './plugin-packages'
import { PluginSettingsForm } from './plugin-settings-form'
-// The REAL Plugin Catalog page (docs site) embedded as a one-click picker —
-// the same pattern as the Skills tab's EmbeddedHubPicker. `?embed=picker`
-// hides the docs chrome and adds "+ Add to this Agent" per card, which posts
-// { type: 'hermes-plugin-pick', name, repo, sha, subdir, tier, installCmd }
-// to the parent window. We validate the origin and open the shared
-// dual-target install modal (agent half → catalog-pinned install into the
-// scoped profile; desktop half → this app), so unified packages install both
-// halves in one flow. URLs live in `@/lib/plugin-catalog` so the
-// `hermes://plugin/install?catalog=` deep link resolves against the same feed.
-
-// Catalog viewport: persisted through the shared pane store, dragged from the
-// section's TOP edge ("pull the catalog up"), clamped so neither the catalog
-// nor the plugin list above can vanish. Same contract as EmbeddedHubPicker.
-const CATALOG_PANE_ID = 'capabilities-plugin-catalog'
-const CATALOG_DEFAULT_PX = 380
-const CATALOG_MIN_PX = 120
-const CATALOG_MAX_VH = 0.75
-const CATALOG_COLLAPSED_PX = 4
-const CATALOG_LIST_RESERVED_PX = 176
-
-interface PluginPickMessage {
- installCmd?: string
- name?: string
- repo?: string
- sha?: string
- subdir?: string
- tier?: string
- type?: string
-}
-
/** Deep-link anchor for a package row (`/capabilities?tab=plugins&plugin=<key>`).
* Accepts the agent key, the agent name, or the desktop record id. */
export const pluginElementId = (target: string) => `plugin-${target}`
@@ -211,15 +175,11 @@ function ProvenancePill({ pkg }: { pkg: PluginPackage }) {
return null
}
-/** Column widths shared by the header and every row so the two control
- * columns line up down the page like a table. */
-const HALF_COL = 'flex w-36 shrink-0 items-center gap-1.5'
-
-/** One control cell; `label` is the accessible name for screen readers only
- * (the visible column label lives once, in the header). */
-function HalfCell({ label, children }: { label: string; children: ReactNode }) {
+/** Controls for one installed plugin half in the detail pane. */
+function HalfCell({ label, labelContent, children }: { label: string; labelContent?: ReactNode; children: ReactNode }) {
return (
- <div aria-label={label} className={HALF_COL} role="cell">
+ <div aria-label={label} className="flex w-full items-center gap-3" role="cell">
+ <span className="min-w-0 flex-1 text-xs text-(--ui-text-tertiary)">{labelContent ?? label}</span>
{children}
</div>
)
@@ -238,6 +198,7 @@ function PackageRow({
scope,
profile,
scopeLabel,
+ scopeSelector,
busy,
request,
onAgentToggle,
@@ -249,6 +210,7 @@ function PackageRow({
scope: null | string
profile: ProfileScope
scopeLabel: string
+ scopeSelector?: ReactNode
busy: boolean
request: GatewayRequest
onAgentToggle: (row: AgentPluginRow, enable: boolean) => void
@@ -284,15 +246,12 @@ function PackageRow({
return (
<>
<div
- className={cn(
- 'flex items-center gap-3 border-b border-(--ui-stroke-tertiary) px-3 py-2.5',
- !settingsOpen && 'last:border-b-0'
- )}
+ className="flex flex-col gap-5"
data-testid={`plugin-row-${pkg.key}`}
id={pluginElementId(agent?.key ?? agent?.name ?? desktop?.id ?? pkg.key)}
role="row"
>
- <div className="flex min-w-0 flex-1 items-start gap-2" role="cell">
+ <div className="flex w-full min-w-0 flex-1 items-start gap-2" role="cell">
<div className="min-w-0 flex-1">
<div className="flex flex-wrap items-center gap-2 text-[length:var(--conversation-text-font-size)] font-medium text-foreground">
<span>{pkg.name}</span>
@@ -415,7 +374,7 @@ function PackageRow({
)}
</HalfCell>
- <HalfCell label={p.halfAgentIn(scopeLabel)}>
+ <HalfCell label={p.halfAgentIn(scopeLabel)} labelContent={scopeSelector}>
{agent ? (
<>
{agent.update_available && (
@@ -465,7 +424,7 @@ function PackageRow({
</HalfCell>
</div>
{hasSettings && settingsOpen && agent?.key && (
- <div className="border-b border-(--ui-stroke-tertiary) bg-(--ui-bg-secondary,transparent) px-3 py-3 last:border-b-0">
+ <div className="mt-5">
<PluginSettingsForm
disabled={busy}
fields={settingsFields}
@@ -493,25 +452,67 @@ function PackageRow({
)
}
-/** THE plugins surface: one row per package. Each row shows its Desktop half
- * (this app — the same for every profile, gateway, or machine) and its Agent
- * half (the selected profile's backend). Discovery sits underneath: the live
- * catalog picker plus Install from Git for anything not in the catalog. */
+export function PluginActions({ profile }: { profile: ProfileScope }) {
+ const { t } = useI18n()
+ const d = t.settings.plugins
+ const { requestGateway } = useGatewayRequest()
+ const scope = profileParam(profile)
+
+ return (
+ <>
+ <Button
+ className="underline"
+ onClick={() => openPluginInstallRequest({ profile: scope, repo: '' })}
+ size="xs"
+ variant="text"
+ >
+ {d.installModal.installFromGit}
+ </Button>
+ <Tip label={d.openFolder}>
+ <Button aria-label={d.openFolder} onClick={() => void revealPluginsDir()} size="icon-xs" variant="ghost">
+ <FolderOpen />
+ </Button>
+ </Tip>
+ <Tip label={d.rescan}>
+ <Button
+ aria-label={d.rescan}
+ onClick={() => {
+ triggerHaptic('selection')
+ void rescanAll(requestGateway, scope)
+ }}
+ size="icon-xs"
+ variant="ghost"
+ >
+ <RefreshCw />
+ </Button>
+ </Tip>
+ </>
+ )
+}
+
+/** Installed packages retain both halves' controls in the native detail pane.
+ * Browse shares the Skills catalog; navigation and search belong to the shell. */
export const PluginsTab = memo(function PluginsTab({
profile,
scopeSelector,
- scopeLabel
+ scopeLabel,
+ view = 'installed',
+ query = '',
+ onQueryChange,
+ onViewChange
}: {
profile: ProfileScope
- /** The Capabilities profile selector; rendered in the Agent column header so
- * it visibly governs only that column. */
+ query?: string
+ onQueryChange?: (value: string) => void
+ view?: CapabilityView
+ onViewChange?: (view: CapabilityView) => void
+ /** The profile selector governs only the Agent half, not the app-level Desktop half. */
scopeSelector?: ReactNode
- /** Display name of the selected profile for the Agent column label. */
+ /** Display name of the selected profile for the Agent half label. */
scopeLabel?: string
}) {
const { t } = useI18n()
const p = t.skills.plugins
- const d = t.settings.plugins
const { requestGateway } = useGatewayRequest()
const desktopRecords = useStore($pluginRecords)
@@ -532,168 +533,94 @@ export const PluginsTab = memo(function PluginsTab({
[agentRows, desktopRecords]
)
- useDeepLinkHighlight({ param: 'plugin', ready: () => true, elementId: pluginElementId })
-
- // Catalog picker viewport (persisted height, collapse toggle, top-edge sash).
- const heightOverride = useStore($paneHeightOverride(CATALOG_PANE_ID))
- const height = heightOverride ?? CATALOG_DEFAULT_PX
- const open = height > CATALOG_COLLAPSED_PX
- const [pickerMounted, setPickerMounted] = useState(open)
- const [dragging, setDragging] = useState(false)
- const sectionRef = useRef<HTMLElement>(null)
-
- if (open && !pickerMounted) {
- setPickerMounted(true)
- }
-
- const startDrag = (event: ReactPointerEvent<HTMLDivElement>) => {
- if (event.button !== 0) {
- return
- }
-
- event.preventDefault()
- const startY = event.clientY
- const startHeight = height
- const column = sectionRef.current?.parentElement
- const columnMax = column ? column.clientHeight - CATALOG_LIST_RESERVED_PX : Number.POSITIVE_INFINITY
- const max = Math.max(CATALOG_MIN_PX, Math.round(Math.min(window.innerHeight * CATALOG_MAX_VH, columnMax)))
- setDragging(true)
-
- const onMove = (move: globalThis.PointerEvent) => {
- setPaneHeightOverride(
- CATALOG_PANE_ID,
- Math.round(Math.min(max, Math.max(CATALOG_MIN_PX, startHeight + (startY - move.clientY))))
- )
- }
-
- const onUp = () => {
- window.removeEventListener('pointermove', onMove)
- setDragging(false)
- }
+ const [selectedEntryId, setSelectedEntryId] = useState<string | null>(null)
- window.addEventListener('pointermove', onMove)
- window.addEventListener('pointerup', onUp, { once: true })
- }
+ const packageForTarget = useCallback(
+ (target: string) =>
+ packages.find(pkg => [pkg.key, pkg.agent?.key, pkg.agent?.name, pkg.desktop?.id].includes(target)),
+ [packages]
+ )
- useEffect(() => {
- if (!open) {
- return undefined
- }
+ useDeepLinkHighlight({
+ param: 'plugin',
+ ready: target => Boolean(packageForTarget(target)),
+ elementId: target => {
+ const pkg = packageForTarget(target)
+
+ return pluginElementId(pkg?.agent?.key ?? pkg?.agent?.name ?? pkg?.desktop?.id ?? target)
+ },
+ onResolve: useCallback(
+ (target: string) => {
+ const pkg = packageForTarget(target)
+
+ if (pkg) {
+ onViewChange?.('installed')
+ onQueryChange?.('')
+ setSelectedEntryId(`installed:${pkg.key}`)
+ }
+ },
+ [onQueryChange, onViewChange, packageForTarget]
+ )
+ })
- const onMessage = (event: MessageEvent) => {
- if (event.origin !== CATALOG_ORIGIN) {
- return
- }
-
- const data = event.data as null | PluginPickMessage
-
- if (!data || data.type !== 'hermes-plugin-pick' || !data.name || !data.repo) {
- return
- }
-
- // Already-installed short-circuit + the dialog itself live in the shared
- // helper so a catalog deep link behaves identically to this pick.
- openCatalogPluginInstall(
- {
- name: String(data.name),
- repo: String(data.repo),
- sha: data.sha ? String(data.sha) : undefined,
- subdir: data.subdir ? String(data.subdir) : undefined
- },
- scope
- )
- }
+ const agentBusy = (row: AgentPluginRow) => busyKey === (row.key ?? row.name) || busyKey === row.name
- window.addEventListener('message', onMessage)
+ const installedEntries = useMemo(
+ () =>
+ parseCatalog(
+ 'plugins',
+ packages.map(pkg => ({
+ name: pkg.name,
+ identifier: pkg.key,
+ description: pkg.description,
+ category: pkg.kind === 'desktop' ? 'desktop' : 'general',
+ tier: pkg.agent?.catalog_tier ?? pkg.agent?.source ?? pkg.desktop?.kind ?? '',
+ repo: pkg.desktop?.packageOrigin?.repo ?? '',
+ sha: pkg.agent?.installed_sha ?? pkg.desktop?.packageOrigin?.sha ?? '',
+ version: pkg.agent?.version ?? ''
+ }))
+ ).map(entry => ({ ...entry, id: `installed:${entry.identifier}` })),
+ [packages]
+ )
- return () => window.removeEventListener('message', onMessage)
- }, [open, p, scope])
+ const packageById = useMemo(() => new Map(packages.map(pkg => [`installed:${pkg.key}`, pkg])), [packages])
- const agentBusy = (row: AgentPluginRow) => busyKey === (row.key ?? row.name) || busyKey === row.name
+ const isInstalled = (entry: CatalogEntry) =>
+ packageById.has(entry.id) ||
+ agentRows.some(row => (row.catalog_name === entry.name || row.name === entry.name) && !row.update_available)
return (
<div className="flex h-full min-h-0 flex-col">
- <div className="min-h-32 flex-1 overflow-y-auto">
- {/* Header: what the two columns mean, and the controls that act on
- the whole page (install, folder, rescan). */}
- <div className="flex flex-wrap items-start justify-between gap-3 px-3 pt-3 pb-2">
- <p className="min-w-0 flex-1 text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)">
- {p.pageBlurb}
- </p>
- <div className="flex shrink-0 items-center gap-1">
- <Button
- onClick={() => openPluginInstallRequest({ profile: scope, repo: '' })}
- size="sm"
- type="button"
- variant="secondary"
- >
- {d.installModal.installFromGit}
+ {view === 'installed' && status === 'error' ? (
+ <PanelEmpty
+ action={
+ <Button onClick={() => void loadAgentPlugins(requestGateway, scope)} size="sm">
+ {t.skills.refresh}
</Button>
- <Tip label={d.openFolder}>
- <Button
- aria-label={d.openFolder}
- onClick={() => void revealPluginsDir()}
- size="icon"
- type="button"
- variant="ghost"
- >
- <FolderOpen className="size-3.5" />
- </Button>
- </Tip>
- <Tip label={d.rescan}>
- <Button
- aria-label={d.rescan}
- onClick={() => {
- triggerHaptic('selection')
- void rescanAll(requestGateway, scope)
- }}
- size="icon"
- type="button"
- variant="ghost"
- >
- <RefreshCw className="size-3.5" />
- </Button>
- </Tip>
- </div>
- </div>
-
- {status === 'error' ? (
- <PanelEmpty
- action={
- <Button onClick={() => void loadAgentPlugins(requestGateway, scope)} size="sm">
- {t.skills.refresh}
- </Button>
+ }
+ description={error ?? undefined}
+ icon="error"
+ title={p.loadFailed}
+ />
+ ) : view === 'installed' && status === 'loading' && packages.length === 0 ? (
+ <PageLoader label={t.skills.loading} />
+ ) : (
+ <CatalogBrowser
+ installedEntries={installedEntries}
+ isInstalled={isInstalled}
+ kind="plugins"
+ onInstall={entry => openCatalogPluginInstall(entry, scope)}
+ onQueryChange={onQueryChange}
+ onSelectEntry={view === 'installed' ? setSelectedEntryId : undefined}
+ query={query}
+ renderInstalledDetail={entry => {
+ const pkg = packageById.get(entry.id)
+
+ if (!pkg) {
+ return null
}
- description={error ?? undefined}
- icon="error"
- title={p.loadFailed}
- />
- ) : packages.length === 0 && status === 'ready' ? (
- <p className="px-3 py-3 text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)">
- {p.emptyAll} {p.emptyHint}
- </p>
- ) : (
- <div className="flex flex-col" role="table">
- {/* Column header: the visible labels for the two control columns,
- aligned with the cells below. The profile selector sits INSIDE
- the Agent header so it visibly governs only that column. */}
- <div
- className="flex items-center gap-3 border-y border-(--ui-stroke-tertiary) bg-(--ui-bg-quinary) px-3 py-1.5 text-[0.68rem] text-(--ui-text-tertiary)"
- role="row"
- >
- <div className="min-w-0 flex-1" role="columnheader" />
- <div className={HALF_COL} role="columnheader">
- <Monitor aria-hidden className="size-3.5 shrink-0" />
- <Tip label={p.halfDesktopHint}>
- <span className="font-medium">{p.halfDesktop}</span>
- </Tip>
- </div>
- <div className={HALF_COL} role="columnheader">
- <Package aria-hidden className="size-3.5 shrink-0" />
- {scopeSelector ?? <span className="truncate font-medium">{p.halfAgentIn(label)}</span>}
- </div>
- </div>
- {packages.map(pkg => (
+
+ return (
<PackageRow
busy={pkg.agent ? agentBusy(pkg.agent) : false}
key={pkg.key}
@@ -777,71 +704,14 @@ export const PluginsTab = memo(function PluginsTab({
request={requestGateway}
scope={scope}
scopeLabel={label}
+ scopeSelector={scopeSelector}
/>
- ))}
- </div>
- )}
- </div>
-
- <section
- className="relative flex min-h-9 flex-col overflow-hidden border-t border-(--ui-stroke-secondary)"
- ref={sectionRef}
- >
- <div
- className="group/catsash absolute inset-x-0 top-0 z-10 h-1 -translate-y-1/2 cursor-row-resize"
- data-testid="plugin-catalog-sash"
- onDoubleClick={() => setPaneHeightOverride(CATALOG_PANE_ID, undefined)}
- onPointerDown={startDrag}
- >
- <div
- className={cn(
- 'absolute inset-x-0 top-1/2 h-px -translate-y-1/2 transition-colors',
- dragging ? 'bg-(--ui-stroke-secondary)' : 'group-hover/catsash:bg-(--ui-stroke-secondary)'
- )}
- />
- </div>
- <div className="flex shrink-0 items-center justify-between px-3 py-1.5">
- <span className="text-[0.62rem] font-medium tracking-wide uppercase text-(--ui-text-quaternary)">
- {p.catalogTitle}
- </span>
- <Button onClick={() => setPaneHeightOverride(CATALOG_PANE_ID, open ? 0 : undefined)} size="xs" variant="text">
- {open ? p.catalogHide : p.catalogBrowse}
- </Button>
- </div>
- {pickerMounted && (
- <div className={cn('flex min-h-0 flex-col gap-1 px-3 pb-2', !open && 'hidden')}>
- <div
- style={{
- border: '1px solid var(--ui-stroke-secondary)',
- borderRadius: 8,
- flex: `0 1 ${height}px`,
- maxWidth: '100%',
- minHeight: 0,
- minWidth: 320,
- overflow: 'hidden',
- position: 'relative',
- width: '100%'
- }}
- >
- <iframe
- sandbox="allow-scripts allow-same-origin"
- src={CATALOG_PICKER_URL}
- style={{
- background: 'transparent',
- border: 'none',
- height: '133.34%',
- pointerEvents: dragging ? 'none' : 'auto',
- transform: 'scale(0.75)',
- transformOrigin: 'top left',
- width: '133.34%'
- }}
- title={p.catalogTitle}
- />
- </div>
- <p className="shrink-0 px-1 text-[0.65rem] leading-4 text-(--ui-text-quaternary)">{p.catalogHint}</p>
- </div>
- )}
- </section>
+ )
+ }}
+ selectedEntryId={view === 'installed' ? selectedEntryId : undefined}
+ view={view}
+ />
+ )}
</div>
)
})
diff --git a/apps/desktop/src/app/capabilities/skills/embedded-hub-picker.tsx b/apps/desktop/src/app/capabilities/skills/embedded-hub-picker.tsx
deleted file mode 100644
index 7d9fdbe5351..00000000000
--- a/apps/desktop/src/app/capabilities/skills/embedded-hub-picker.tsx
+++ /dev/null
@@ -1,255 +0,0 @@
-import { useStore } from '@nanostores/react'
-import { memo, type PointerEvent as ReactPointerEvent, useEffect, useRef, useState } from 'react'
-
-import { Button } from '@/components/ui/button'
-import type { ProfileScope } from '@/hermes'
-import { useI18n } from '@/i18n'
-import { Loader2 } from '@/lib/icons'
-import { useStoreSelector } from '@/lib/use-session-slice'
-import { cn } from '@/lib/utils'
-import {
- $hubActions,
- installHubSkill,
- notifyHubActionFailed,
- UPDATE_ALL_KEY,
- updateHubSkills
-} from '@/store/hub-actions'
-import { notify, notifyError } from '@/store/notifications'
-import { $paneHeightOverride, setPaneHeightOverride } from '@/store/panes'
-
-// The REAL Skills Hub page (docs site) embedded as a one-click picker — the
-// same trick the Bot Mode agent editor uses. `?embed=picker` hides the docs
-// chrome and adds a "+ Add to this Agent" button per card, which posts
-// { type: 'hermes-skill-pick', name, identifier, installCmd, source }
-// to the parent window. We validate the origin and route the install through
-// the standard hub action pipeline (background action + tailed log + Skills
-// list invalidation), scoped to the Capabilities profile selector.
-const HUB_ORIGIN = 'https://hermes-agent.nousresearch.com'
-const HUB_PICKER_URL = `${HUB_ORIGIN}/docs/skills?embed=picker`
-
-// Hub viewport height: persisted through the shared pane store (same one the
-// terminal/editor panes use), dragged from the section's TOP edge — "pull the
-// hub up" — clamped so neither the hub nor the skills list above vanishes.
-const HUB_PANE_ID = 'capabilities-hub'
-const HUB_DEFAULT_PX = 380
-const HUB_MIN_PX = 120
-const HUB_MAX_VH = 0.75
-// Collapse threshold, mirroring DetailPane: a persisted height at/below this
-// reads as "collapsed to the header" (the toggle stores 0).
-const HUB_COLLAPSED_PX = 4
-// Room the sash must always leave for the content ABOVE the picker (the
-// installed-skills list plus its strip) so dragging the hub up can never
-// crush the list to zero and shove its chrome under the hub header.
-const HUB_LIST_RESERVED_PX = 176
-
-interface SkillPickMessage {
- identifier?: string
- installCmd?: string
- name?: string
- source?: string
- type?: string
-}
-
-interface EmbeddedHubPickerProps {
- /** Kept mounted but fully hidden (display:none). The Capabilities view uses
- * this to preserve the loaded hub iframe across tab switches — a plain
- * unmount would reload the whole docs site on every return to Skills. */
- hidden?: boolean
- /** Names of skills already installed in the scoped profile — a pick that
- * matches is refused with a toast instead of re-running the install. */
- installedNames: ReadonlySet<string>
- /** Capabilities profile-scope override — installs land in THIS profile;
- * undefined/null targets the app-wide active profile. */
- profile?: ProfileScope
-}
-
-/** The Skills Hub browser for the Skills tab: a resizable iframe of the live
- * hub where every card installs with one click. Expanded by default —
- * discovery IS the point — with a collapse toggle (persisted, like every
- * other pane) and an update-all action. Memoized: the iframe must not sit in
- * the parent's keystroke/re-render path. */
-export const EmbeddedHubPicker = memo(function EmbeddedHubPicker({
- hidden = false,
- installedNames,
- profile
-}: EmbeddedHubPickerProps) {
- const { t } = useI18n()
- const h = t.skills.hub
- // Subscribe to the ONE flag this header renders, not the whole action map —
- // $hubActions churns on every tailed log line during an install.
- const updating = useStoreSelector($hubActions, actions => actions[UPDATE_ALL_KEY]?.running ?? false)
- // Collapse state rides the same persisted height override the sash writes
- // (0 = collapsed to the header), so "Hide the hub browser" survives tab
- // switches and restarts instead of re-expanding — and re-loading the docs
- // site — on every visit. Same contract as DetailPane.
- const heightOverride = useStore($paneHeightOverride(HUB_PANE_ID))
- const height = heightOverride ?? HUB_DEFAULT_PX
- const open = height > HUB_COLLAPSED_PX
- const [dragging, setDragging] = useState(false)
- const sectionRef = useRef<HTMLElement>(null)
-
- // Top-edge sash: dragging UP grows the hub (shrinking the skills list above,
- // which is the flex-1 sibling). Same gesture as DetailPane / the shell's
- // bottom panes; double-click resets to the default height. The iframe gets
- // pointer-events disabled for the duration or it swallows the pointermoves.
- const startDrag = (event: ReactPointerEvent<HTMLDivElement>) => {
- if (event.button !== 0) {
- return
- }
-
- event.preventDefault()
- const startY = event.clientY
- const startHeight = height
- // Clamp against the actual Capabilities column, not just the window: the
- // hub may never grow past "column minus the list's reserved strip", so
- // the installed list always keeps real height and its header/footer can't
- // end up sharing pixels with the hub header.
- const column = sectionRef.current?.parentElement
- const columnMax = column ? column.clientHeight - HUB_LIST_RESERVED_PX : Number.POSITIVE_INFINITY
- const max = Math.max(HUB_MIN_PX, Math.round(Math.min(window.innerHeight * HUB_MAX_VH, columnMax)))
- setDragging(true)
-
- const onMove = (move: globalThis.PointerEvent) => {
- setPaneHeightOverride(
- HUB_PANE_ID,
- Math.round(Math.min(max, Math.max(HUB_MIN_PX, startHeight + (startY - move.clientY))))
- )
- }
-
- const onUp = () => {
- window.removeEventListener('pointermove', onMove)
- setDragging(false)
- }
-
- window.addEventListener('pointermove', onMove)
- window.addEventListener('pointerup', onUp, { once: true })
- }
-
- // Picker messages from the embedded hub page. Origin-checked; installs route
- // through the same store pipeline the hub rows use, so the action log,
- // optimistic flips, and Skills-list refresh all come for free.
- useEffect(() => {
- if (!open) {
- return undefined
- }
-
- const onMessage = (event: MessageEvent) => {
- if (event.origin !== HUB_ORIGIN) {
- return
- }
-
- const data = event.data as SkillPickMessage | null
-
- if (!data || data.type !== 'hermes-skill-pick' || !data.name) {
- return
- }
-
- const target = String(data.identifier || data.name)
- const label = String(data.name)
-
- // Already installed in this scope → tell the user, don't reinstall.
- if (installedNames.has(label) || installedNames.has(target)) {
- notify({ kind: 'success', title: h.alreadyInstalled(label), message: '' })
-
- return
- }
-
- notify({ kind: 'success', title: h.installStarted(label), message: h.actionLog })
- void installHubSkill(target, profile).catch(err => notifyHubActionFailed(err, h.actionFailed, label, profile))
- }
-
- window.addEventListener('message', onMessage)
-
- return () => window.removeEventListener('message', onMessage)
- }, [h, installedNames, open, profile])
-
- const updateAll = () => {
- notify({ kind: 'success', title: h.updateStarted, message: h.actionLog })
- void updateHubSkills(profile).catch(err => notifyError(err, h.actionFailed))
- }
-
- return (
- <section
- className={cn(
- // Shrinkable (no shrink-0) + overflow-hidden: the picker is a flex
- // child of the Capabilities column. Before, its fixed-height viewport
- // made the section's min-content height rigid, so a short window (or a
- // tall persisted drag height) starved the installed list to 0px and
- // the list's strip/footer painted straight over this header. Now the
- // section clips its own content and gives height back to the list;
- // min-h keeps the header row itself always visible.
- 'relative flex min-h-9 flex-col overflow-hidden border-t border-(--ui-stroke-secondary)',
- hidden && 'hidden'
- )}
- ref={sectionRef}
- >
- {/* Top-edge drag sash — pull the whole hub section up/down. */}
- <div
- className="group/hubsash absolute inset-x-0 top-0 z-10 h-1 -translate-y-1/2 cursor-row-resize"
- onDoubleClick={() => setPaneHeightOverride(HUB_PANE_ID, undefined)}
- onPointerDown={startDrag}
- >
- <div
- className={cn(
- 'absolute inset-x-0 top-1/2 h-px -translate-y-1/2 transition-colors',
- dragging ? 'bg-(--ui-stroke-secondary)' : 'group-hover/hubsash:bg-(--ui-stroke-secondary)'
- )}
- />
- </div>
- <div className="flex shrink-0 items-center justify-between px-3 py-1.5">
- <span className="text-[0.7rem] font-medium text-(--ui-text-tertiary)">{h.pickerTitle}</span>
- <div className="flex items-center gap-1">
- <Button disabled={updating} onClick={updateAll} size="xs" variant="text">
- {updating && <Loader2 className="size-3 animate-spin" />}
- {updating ? h.updating : h.updateAll}
- </Button>
- <Button onClick={() => setPaneHeightOverride(HUB_PANE_ID, open ? 0 : undefined)} size="xs" variant="text">
- {open ? h.pickerHide : h.pickerBrowse}
- </Button>
- </div>
- </div>
- {open && (
- <div className="flex min-h-0 flex-col gap-1 px-3 pb-2">
- {/* Resizable viewport: height comes from the top-edge drag sash
- above (persisted; double-click resets). flex-basis instead of a
- hard height so a short window shrinks the hub viewport rather
- than letting it spill over the list. The iframe is rendered
- oversized and scaled DOWN (133% × 0.75) so the hub page starts
- zoomed out — the cross-origin page itself can't be styled, but
- scaling the frame is ours. */}
- <div
- style={{
- border: '1px solid var(--ui-stroke-secondary)',
- borderRadius: 8,
- flex: `0 1 ${height}px`,
- maxWidth: '100%',
- minHeight: 0,
- minWidth: 320,
- overflow: 'hidden',
- position: 'relative',
- width: '100%'
- }}
- >
- <iframe
- sandbox="allow-scripts allow-same-origin"
- src={HUB_PICKER_URL}
- style={{
- background: 'transparent',
- border: 'none',
- height: '133.34%',
- // While the sash drags, the cross-origin iframe must not eat
- // the pointermove stream.
- pointerEvents: dragging ? 'none' : 'auto',
- transform: 'scale(0.75)',
- transformOrigin: 'top left',
- width: '133.34%'
- }}
- title={h.pickerTitle}
- />
- </div>
- <p className="shrink-0 px-1 text-[0.65rem] leading-4 text-(--ui-text-quaternary)">{h.pickerHint}</p>
- </div>
- )}
- </section>
- )
-})
diff --git a/apps/desktop/src/app/master-detail.tsx b/apps/desktop/src/app/master-detail.tsx
index 95e117697b9..660bac90372 100644
--- a/apps/desktop/src/app/master-detail.tsx
+++ b/apps/desktop/src/app/master-detail.tsx
@@ -391,6 +391,16 @@ export function ListStripMenu({
)
}
+const LIST_STRIP_LABEL_CLASS = 'text-[0.68rem] font-medium text-muted-foreground/70'
+
+export function ListStripLabel({ children }: { children: ReactNode }) {
+ return (
+ <span className={LIST_STRIP_LABEL_CLASS} role="status">
+ {children}
+ </span>
+ )
+}
+
export function ListStripButton({
active,
children,
@@ -405,7 +415,8 @@ export function ListStripButton({
return (
<button
className={cn(
- 'cursor-pointer text-[0.68rem] font-medium transition-colors disabled:opacity-40',
+ LIST_STRIP_LABEL_CLASS,
+ 'cursor-pointer transition-colors disabled:opacity-40',
active ? 'text-foreground' : 'text-muted-foreground/70 hover:text-foreground'
)}
disabled={disabled}
diff --git a/apps/desktop/src/app/settings/plugin-install-modal.test.tsx b/apps/desktop/src/app/settings/plugin-install-modal.test.tsx
index f5a7e614e7d..4e8ed0afba8 100644
--- a/apps/desktop/src/app/settings/plugin-install-modal.test.tsx
+++ b/apps/desktop/src/app/settings/plugin-install-modal.test.tsx
@@ -27,7 +27,8 @@ import {
import { $activeGatewayProfile, $profiles } from '@/store/profile'
import { $connection, $gatewayState } from '@/store/session'
-import { PluginsTab } from '../capabilities/plugins/plugins-tab'
+import { CapabilityTabs } from '../capabilities/catalog/capability-tabs'
+import { PluginActions } from '../capabilities/plugins/plugins-tab'
import { PluginInstallModal } from './plugin-install-modal'
@@ -38,7 +39,7 @@ const renderFlow = () =>
render(
<MemoryRouter initialEntries={['/capabilities?tab=plugins']}>
<QueryClientProvider client={queryClient}>
- <PluginsTab profile={null} />
+ <CapabilityTabs actions={<PluginActions profile={null} />} onChange={() => undefined} value="installed" />
<PluginInstallModal />
</QueryClientProvider>
</MemoryRouter>
diff --git a/apps/desktop/src/components/ui/segmented-control.test.tsx b/apps/desktop/src/components/ui/segmented-control.test.tsx
new file mode 100644
index 00000000000..110acbe9fa7
--- /dev/null
+++ b/apps/desktop/src/components/ui/segmented-control.test.tsx
@@ -0,0 +1,51 @@
+import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import { afterEach, describe, expect, it, vi } from 'vitest'
+
+import { codiconIcon } from './codicon'
+import { SegmentedControl } from './segmented-control'
+
+const options = [
+ { id: 'list', label: 'List view', icon: codiconIcon('list-unordered') },
+ { id: 'cards', label: 'Card view', icon: codiconIcon('extensions') }
+]
+
+afterEach(cleanup)
+
+describe('SegmentedControl', () => {
+ it('preserves visible labels by default', () => {
+ render(<SegmentedControl onChange={vi.fn()} options={options} value="cards" />)
+
+ expect(screen.getByRole('button', { name: 'Card view', pressed: true }).textContent).toBe('Card view')
+ expect(screen.getByRole('button', { name: 'List view', pressed: false }).textContent).toBe('List view')
+ })
+
+ it('keeps accessible labels and selection behavior for icon-only controls', () => {
+ const onChange = vi.fn()
+ render(<SegmentedControl iconOnly onChange={onChange} options={options} value="cards" />)
+ const list = screen.getByRole('button', { name: 'List view', pressed: false })
+ const cards = screen.getByRole('button', { name: 'Card view', pressed: true })
+
+ expect(list.textContent).toBe('')
+ expect(cards.textContent).toBe('')
+ expect(list.querySelector('.codicon-list-unordered')).not.toBeNull()
+ expect(cards.querySelector('.codicon-extensions')).not.toBeNull()
+ fireEvent.click(list)
+ expect(onChange).toHaveBeenCalledExactlyOnceWith('list')
+ })
+
+ it('retains a visible label when an icon-only option has no icon', () => {
+ render(<SegmentedControl iconOnly onChange={vi.fn()} options={[{ id: 'list', label: 'List view' }]} value="list" />)
+
+ expect(screen.getByRole('button', { name: 'List view' }).textContent).toBe('List view')
+ })
+
+ it('does not change a disabled icon-only control', () => {
+ const onChange = vi.fn()
+ render(<SegmentedControl disabled iconOnly onChange={onChange} options={options} value="cards" />)
+ const list = screen.getByRole<HTMLButtonElement>('button', { name: 'List view' })
+
+ expect(list.disabled).toBe(true)
+ fireEvent.click(list)
+ expect(onChange).not.toHaveBeenCalled()
+ })
+})
diff --git a/apps/desktop/src/components/ui/segmented-control.tsx b/apps/desktop/src/components/ui/segmented-control.tsx
index 45c854ecf2b..91cfbd6fa43 100644
--- a/apps/desktop/src/components/ui/segmented-control.tsx
+++ b/apps/desktop/src/components/ui/segmented-control.tsx
@@ -1,3 +1,4 @@
+import { Tip } from '@/components/ui/tooltip'
import type { IconComponent } from '@/lib/icons'
import { cn } from '@/lib/utils'
@@ -12,6 +13,8 @@ interface SegmentedControlProps<T extends string> {
value: T
onChange: (id: T) => void
className?: string
+ /** Icon buttons retain localized labels for tooltips and screen readers. */
+ iconOnly?: boolean
/** Dims the whole track and blocks selection (e.g. gated behind a prerequisite). */
disabled?: boolean
}
@@ -24,6 +27,7 @@ interface SegmentedControlProps<T extends string> {
export function SegmentedControl<T extends string>({
className,
disabled = false,
+ iconOnly = false,
onChange,
options,
value
@@ -39,12 +43,14 @@ export function SegmentedControl<T extends string>({
{options.map(({ id, label, icon: Icon }) => {
const active = value === id
- return (
+ const button = (
<button
+ aria-label={iconOnly ? label : undefined}
aria-pressed={active}
className={cn(
'flex items-center justify-center gap-1 rounded-[3px] px-2.5 py-0.5 text-[0.6875rem] font-medium transition-colors disabled:cursor-default',
- active ? 'bg-background text-foreground shadow-sm' : 'text-muted-foreground hover:text-foreground'
+ active ? 'bg-background text-foreground shadow-sm' : 'text-muted-foreground hover:text-foreground',
+ iconOnly && Icon && 'size-6 p-0 text-sm'
)}
disabled={disabled}
key={id}
@@ -52,9 +58,17 @@ export function SegmentedControl<T extends string>({
type="button"
>
{Icon && <Icon className="size-3" />}
- {label}
+ {(!iconOnly || !Icon) && label}
</button>
)
+
+ return iconOnly && Icon ? (
+ <Tip key={id} label={label}>
+ {button}
+ </Tip>
+ ) : (
+ button
+ )
})}
</div>
)
diff --git a/apps/desktop/src/lib/query-client.ts b/apps/desktop/src/lib/query-client.ts
index cfea4f1054f..18280415634 100644
--- a/apps/desktop/src/lib/query-client.ts
+++ b/apps/desktop/src/lib/query-client.ts
@@ -28,6 +28,7 @@ export const writeCache =
// previous profile's data (a bug).
const PROFILE_INDEPENDENT_QUERY_ROOTS = new Set<string>([
'billing',
+ 'public-catalog',
'marketplace-themes',
'marketplace-themes-settings',
'onboarding-model-options',