The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): browse skills and plugins in a shared native catalog
brooklyn!07c9088460ac
diff --git a/apps/desktop/src/app/master-detail.tsx b/apps/desktop/src/app/master-detail.tsxindex 95e117697b9..dddc87e4214 100644--- a/apps/desktop/src/app/master-detail.tsx+++ b/apps/desktop/src/app/master-detail.tsx@@ -391,6 +391,12 @@ 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 +411,8 @@ export function ListStripButton({return (<buttonclassName={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/skills/capability-tabs.tsx b/apps/desktop/src/app/skills/capability-tabs.tsxnew file mode 100644index 00000000000..13e2b808ef2--- /dev/null+++ b/apps/desktop/src/app/skills/capability-tabs.tsx@@ -0,0 +1,29 @@+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/skills/catalog-browser.tsx b/apps/desktop/src/app/skills/catalog-browser.tsxnew file mode 100644index 00000000000..bd9b24c408b--- /dev/null+++ b/apps/desktop/src/app/skills/catalog-browser.tsx@@ -0,0 +1,221 @@+import { memo, type ReactNode, useDeferredValue, useEffect, useMemo, useState } from 'react'++import { PageLoader } from '@/components/page-loader'+import { Badge } from '@/components/ui/badge'+import { Button } from '@/components/ui/button'+import { Codicon } from '@/components/ui/codicon'+import { ErrorState } from '@/components/ui/error-state'+import { RowButton } from '@/components/ui/row-button'+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'++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+}++const PAGE_SIZE = 60++export const CatalogBrowser = memo(function CatalogBrowser({+ kind,+ isInstalled,+ onInstall,+ isInstalling,+ installedEntries,+ renderInstalledDetail,+ view = 'browse',+ query = '',+ onQueryChange+}: CatalogBrowserProps) {+ const { t } = useI18n()+ const c = t.catalog+ 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 [selectedId, setSelectedId] = useState<string | null>(null)+ const [detailOpen, setDetailOpen] = useState(false)+ 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 =>+ (source === 'all' || entry.source === source) &&+ (category === 'all' || entry.category === category) &&+ (!deferredQuery || entry.search.includes(deferredQuery))+ ), [entries, source, category, deferredQuery])+ 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)+ setSelectedId(null)+ setDetailOpen(false)+ }, [deferredQuery])++ 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={() => onInstall(entry)} size="sm" variant={installed ? 'secondary' : 'default'}>+ <Codicon name={installed ? 'check' : 'cloud-download'} />+ {installed ? c.installed : installing ? t.skills.hub.installing : t.skills.hub.install}+ </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][] : []++ 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>+ </div>}+ <div className="min-h-0 flex-1">+ {isPending && view === 'browse' && !entries.length ? <PageLoader label={t.skills.loading} /> : 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} />+ ) : (+ <div className={cn('h-full min-h-0', detailOpen ? '[&_aside]:max-sm:hidden' : '[&_main]:max-sm:hidden')}>+ <MasterDetail resizeId="capabilities-split" split="wide">+ <ListColumn key={`${source}:${category}:${deferredQuery}`} header={<ListStrip left={<ListStripLabel>{c.results(filtered.length)}</ListStripLabel>} />}>+ {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 || <>+ <header className="space-y-3">+ <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">+ <h3 className="break-words text-lg font-semibold tracking-tight">{selected.name}</h3>+ <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>+ </>}+ </DetailColumn>+ </MasterDetail>+ </div>+ )}+ </div>+ </div>+ )+})diff --git a/apps/desktop/src/app/skills/catalog-data.test.ts b/apps/desktop/src/app/skills/catalog-data.test.tsnew file mode 100644index 00000000000..f46ec9f9954--- /dev/null+++ b/apps/desktop/src/app/skills/catalog-data.test.ts@@ -0,0 +1,122 @@+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('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/skills/catalog-data.ts b/apps/desktop/src/app/skills/catalog-data.tsnew file mode 100644index 00000000000..624e44c8c21--- /dev/null+++ b/apps/desktop/src/app/skills/catalog-data.ts@@ -0,0 +1,140 @@+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+ 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') : []++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),+ 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/skills/embedded-hub-picker.tsx b/apps/desktop/src/app/skills/embedded-hub-picker.tsxdeleted file mode 100644index 9139cecbe99..00000000000--- a/apps/desktop/src/app/skills/embedded-hub-picker.tsx+++ /dev/null@@ -1,249 +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/skills/index.test.tsx b/apps/desktop/src/app/skills/index.test.tsxindex daaa3224a01..e5cba3cc638 100644--- a/apps/desktop/src/app/skills/index.test.tsx+++ b/apps/desktop/src/app/skills/index.test.tsx@@ -1,6 +1,6 @@// @vitest-environment jsdomimport { 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-data'+import { SkillCatalog } from './skill-catalog'+const getSkills = vi.fn()const getToolsets = vi.fn()const setSkillEnabled = vi.fn()@@ -18,7 +21,6 @@ const selectToolsetProvider = vi.fn()const getUsageAnalytics = vi.fn()const getProfiles = vi.fn()const getSkillContent = vi.fn()-const getOfficialSkills = vi.fn()// Partial mock: keep the real module (SkillsView pulls in @/store/profile,// whose import-time subscription calls setApiRequestProfile) and stub only the@@ -35,8 +37,7 @@ vi.mock('@/hermes', async importOriginal => ({selectToolsetProvider: (toolset: string, provider: string) => selectToolsetProvider(toolset, provider),getUsageAnalytics: (days: number, profile?: null | string) => getUsageAnalytics(days, profile),getProfiles: () => getProfiles(),- getSkillContent: (name: string, profile?: null | string) => getSkillContent(name, profile),- getOfficialSkills: (profile?: null | string) => getOfficialSkills(profile)+ getSkillContent: (name: string, profile?: null | string) => getSkillContent(name, profile)}))// Notifications hit nanostores/timers we don't care about here.@@ -102,7 +103,6 @@ beforeEach(() => {setToolsetEnabled.mockResolvedValue({ ok: true, name: 'web', enabled: false })getToolsetConfig.mockResolvedValue({ has_category: true, active_provider: null, providers: [] })getUsageAnalytics.mockResolvedValue({ tools: [] })- getOfficialSkills.mockResolvedValue({ skills: [] })getSkillContent.mockResolvedValue({name: 'web-research',path: '/skills/web-research/SKILL.md',@@ -116,6 +116,7 @@ beforeEach(() => {afterEach(() => {cleanup()vi.clearAllMocks()+ vi.unstubAllGlobals()// Shared singleton client — drop cached skills/toolsets so each test refetches.queryClient.clear()})@@ -284,42 +285,162 @@ describe('SkillsView 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('./embedded-hub-picker')+ it.each(['web-research', 'official/research/web-research'])(+ 'disables catalog installation when the installed list contains %s',+ async installedName => {+ const { installHubSkill } = await import('@/store/hub-actions')+ queryClient.setQueryData(['public-catalog', 'skills'], parseCatalog('skills', [{+ name: 'web-research',+ identifier: 'official/research/web-research',+ source: 'official',+ category: 'research',+ description: 'Research the web'+ }]))- render(<EmbeddedHubPicker installedNames={new Set(['web-research'])} profile={null} />)+ render(+ <QueryClientProvider client={queryClient}>+ <SkillCatalog installedNames={new Set([installedName])} profile="researcher" />+ </QueryClientProvider>+ )- // The picker is expanded by default — the hub iframe is live on mount.- expect(document.querySelector('iframe')).toBeTruthy()+ fireEvent.click(screen.getByRole('button', { name: /^web-research/ }))+ const installed = screen.getByRole('button', { name: 'Installed' })+ expect((installed as HTMLButtonElement).disabled).toBe(true)+ fireEvent.click(installed)+ expect(installHubSkill).not.toHaveBeenCalled()+ }+ )++ it.each([+ {+ source: 'github',+ identifier: 'github:example/skills/research/community-research',+ expectedIdentifier: 'github:example/skills/research/community-research'+ },+ {+ source: 'clawhub',+ identifier: 'community-research',+ expectedIdentifier: 'clawhub/community-research'+ },+ {+ source: 'clawhub',+ identifier: 'clawhub/community-research',+ expectedIdentifier: 'clawhub/community-research'+ }+ ])('installs $identifier with its source-qualified target in the pinned connection and profile', async ({ source, identifier, expectedIdentifier }) => {+ const { installHubSkill } = await import('@/store/hub-actions')+ const entry = {+ name: 'community-research',+ identifier,+ source,+ category: 'research',+ description: 'Community research workflow'+ }+ queryClient.setQueryData(['public-catalog', 'skills'], parseCatalog('skills', [+ { ...entry, name: 'other-skill', source: 'github', identifier: 'github:example/skills/other-skill' },+ entry+ ]))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 initialEntries={['/skills']}>+ <SkillsView embedded fixedConnection="homelab" fixedProfile="researcher" />+ </MemoryRouter>+ </QueryClientProvider>)})- // Refused with an informational toast, no install action spawned.- await waitFor(() =>- expect(vi.mocked(notify)).toHaveBeenCalledWith(- expect.objectContaining({ title: '"web-research" is already installed' })- )+ fireEvent.click(screen.getByRole('button', { name: 'Browse' }))+ fireEvent.click(await screen.findByRole('button', { name: /^community-research/ }))+ expect(screen.getByRole('heading', { name: entry.name })).toBeTruthy()+ await act(async () => {+ fireEvent.click(screen.getByRole('button', { name: 'Install' }))+ })++ expect(installHubSkill).toHaveBeenCalledExactlyOnceWith(expectedIdentifier, {+ connectionId: 'homelab', profile: 'researcher'+ })+ })++ it('keeps a pending install tied to its entry and scope when the pinned target changes', async () => {+ const { installHubSkill } = await import('@/store/hub-actions')+ const identifier = 'clawhub/community-research'+ queryClient.setQueryData(['public-catalog', 'skills'], parseCatalog('skills', [+ { name: 'community-research', identifier: 'community-research', source: 'clawhub' },+ { name: 'other-skill', identifier: 'official/research/other-skill', source: 'optional' }+ ]))+ let finishFirst!: () => void+ let finishSecond!: () => void+ const firstInstall = new Promise<void>(resolve => { finishFirst = resolve })+ const secondInstall = new Promise<void>(resolve => { finishSecond = resolve })+ vi.mocked(installHubSkill)+ .mockReturnValueOnce(firstInstall)+ .mockReturnValueOnce(secondInstall)++ const scopedView = (connectionId: string, profile: string) => (+ <QueryClientProvider client={queryClient}>+ <MemoryRouter initialEntries={['/skills']}>+ <SkillsView embedded fixedConnection={connectionId} fixedProfile={profile} />+ </MemoryRouter>+ </QueryClientProvider>)+ const view = render(scopedView('homelab', 'researcher'))+ fireEvent.click(screen.getByRole('button', { name: 'Browse' }))+ fireEvent.click(await screen.findByRole('button', { name: /^community-research/ }))+ fireEvent.click(screen.getByRole('button', { name: 'Install' }))+ const pending = screen.getByRole<HTMLButtonElement>('button', { name: 'Installing...' })+ expect(pending.disabled).toBe(true)+ fireEvent.click(pending)+ expect(installHubSkill).toHaveBeenCalledExactlyOnceWith(identifier, {+ connectionId: 'homelab', profile: 'researcher'+ })++ fireEvent.click(screen.getByRole('button', { name: /^other-skill/ }))+ expect(screen.getByRole<HTMLButtonElement>('button', { name: 'Install' }).disabled).toBe(false)+ fireEvent.click(screen.getByRole('button', { name: /^community-research/ }))+ expect(screen.getByRole<HTMLButtonElement>('button', { name: 'Installing...' }).disabled).toBe(true)++ view.rerender(scopedView('other-gateway', 'writer'))+ fireEvent.click(await screen.findByRole('button', { name: /^community-research/ }))+ const nextInstall = screen.getByRole<HTMLButtonElement>('button', { name: 'Install' })+ expect(nextInstall.disabled).toBe(false)+ fireEvent.click(nextInstall)+ expect(installHubSkill).toHaveBeenNthCalledWith(2, identifier, {+ connectionId: 'other-gateway', profile: 'writer'+ })++ await act(async () => {+ finishFirst()+ await firstInstall+ })+ expect(screen.getByRole<HTMLButtonElement>('button', { name: 'Installing...' }).disabled).toBe(true)+ await act(async () => {+ finishSecond()+ await secondInstall+ })+ expect(screen.getByRole<HTMLButtonElement>('button', { name: 'Install' }).disabled).toBe(false)+ expect(installHubSkill).toHaveBeenCalledTimes(2)})- 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.+ it('loads the public catalog only on Browse and reuses it across skills and tools tab switches', async () => {+ const fetchCatalog = vi.fn().mockResolvedValue({+ ok: true,+ json: async () => [{+ name: 'catalog-research',+ identifier: 'official/research/catalog-research',+ source: 'official',+ category: 'research',+ description: 'Research from the public snapshot'+ }]+ })+ vi.stubGlobal('fetch', fetchCatalog)+await renderSkills() // ?tab=toolsetsawait screen.findByRole('switch', { name: 'Turn Web Search toolset off' })- expect(document.querySelector('iframe')).toBeNull()+ expect(fetchCatalog).not.toHaveBeenCalled()cleanup()- // 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 () => {render(<QueryClientProvider client={queryClient}>@@ -330,19 +451,23 @@ describe('SkillsView toolset management', { timeout: 60_000 }, () => {)})- 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)+ expect(screen.queryByRole('heading', { name: 'catalog-research' })).toBeNull()+ expect(fetchCatalog).not.toHaveBeenCalled()+ fireEvent.click(screen.getByRole('button', { name: 'Browse' }))+ expect(await screen.findByRole('heading', { name: 'catalog-research' })).toBeTruthy()+ expect(fetchCatalog).toHaveBeenCalledTimes(1)+ expect(fetchCatalog.mock.calls[0][0]).toMatch(/\/docs\/api\/skills\.json$/)++ fireEvent.click(screen.getByRole('button', { name: 'Installed' }))+ expect(screen.queryByRole('heading', { name: 'catalog-research' })).toBeNull()+ fireEvent.click(screen.getByRole('button', { name: 'Browse' }))+ expect(await screen.findByRole('heading', { name: 'catalog-research' })).toBeTruthy()+ fireEvent.click(screen.getByRole('button', { name: /^Tools/ }))+ await screen.findByRole('switch', { name: 'Turn Web Search toolset off' })+ expect(screen.queryByRole('heading', { name: 'catalog-research' })).toBeNull()+ fireEvent.click(screen.getByRole('button', { name: /^Skills/ }))+ expect(await screen.findByRole('heading', { name: 'catalog-research' })).toBeTruthy()+ expect(fetchCatalog).toHaveBeenCalledTimes(1)})it('shows a vision explainer that deep-links to Settings → Models', async () => {@@ -445,13 +570,8 @@ describe('SkillsView toolset management', { timeout: 60_000 }, () => {}})- it('lists the built-in optional-skills catalog with Install buttons that route through the hub pipeline', async () => {- // The full official catalog renders BELOW the installed list; each row- // carries an Install button (no toggle until installed) that routes- // through the standard hub action pipeline scoped to the Capabilities- // profile. Already-installed catalog entries are filtered out.+ it('offers optional skills through Browse and guards installed skills using the scoped installed list', async () => {const { installHubSkill } = await import('@/store/hub-actions')-getSkills.mockResolvedValue([{name: 'web-research',@@ -462,62 +582,54 @@ describe('SkillsView toolset management', { timeout: 60_000 }, () => {provenance: 'bundled'}])- getOfficialSkills.mockResolvedValue({- skills: [- {- name: 'gif-search',- description: 'Search GIFs',- identifier: 'official/gifs/gif-search',- category: 'gifs',- installed: false,- tags: ['gifs']- },- {- name: 'web-research',- description: 'already here under a different source',- identifier: 'official/research/web-research',- category: 'research',- installed: false,- tags: []- },- {- name: 'ascii-art',- description: 'ASCII art',- identifier: 'official/creative/ascii-art',- category: 'creative',- installed: true,- tags: []- }- ]- })+ queryClient.setQueryData(['public-catalog', 'skills'], parseCatalog('skills', [+ {+ name: 'gif-search',+ description: 'Search GIFs',+ source: 'optional',+ installIdentifier: 'official/gifs/gif-search',+ category: 'gifs',+ tags: ['gifs']+ },+ {+ name: 'web-research',+ description: 'Research the web',+ source: 'optional',+ identifier: 'official/research/web-research',+ category: 'research'+ }+ ]))await act(async () => {render(<QueryClientProvider client={queryClient}><MemoryRouter initialEntries={['/skills?tab=skills']}>- <SkillsView />+ <SkillsView fixedProfile="researcher" /></MemoryRouter></QueryClientProvider>)})- // Catalog section header + the one genuinely-available row. Rows already- // installed (lock flag OR name collision with the installed list) are gone.- expect(await screen.findByText('Available to install')).toBeTruthy()- expect(await screen.findByText('gif-search')).toBeTruthy()- expect(screen.queryByText('ascii-art')).toBeNull()-- // The installed skill still shows its toggle; the catalog row shows- // Install instead of a switch.- expect(screen.getByRole('switch', { name: 'web-research' })).toBeTruthy()- const install = screen.getByRole('button', { name: 'Install' })+ expect(await screen.findByRole('switch', { name: 'web-research' })).toBeTruthy()+ expect(screen.queryByRole('button', { name: /^gif-search/ })).toBeNull()+ expect(screen.queryByRole('button', { name: 'Install' })).toBeNull()+ fireEvent.click(screen.getByRole('button', { name: 'Browse' }))+ fireEvent.click(await screen.findByRole('button', { name: /^web-research/ }))++ // Browse keeps installed entries discoverable, but never reinstallable.+ const detail = within(screen.getByRole('main'))+ const installed = detail.getByRole<HTMLButtonElement>('button', { name: 'Installed' })+ expect(installed.disabled).toBe(true)+ fireEvent.click(installed)+ expect(installHubSkill).not.toHaveBeenCalled()+ fireEvent.click(screen.getByRole('button', { name: /^gif-search/ }))+ expect(detail.getByRole('heading', { name: 'gif-search' })).toBeTruthy()+ expect(screen.queryByRole('switch')).toBeNull()await act(async () => {- fireEvent.click(install)+ fireEvent.click(detail.getByRole('button', { name: 'Install' }))})- await waitFor(() =>- expect(vi.mocked(installHubSkill)).toHaveBeenCalledWith('official/gifs/gif-search', expect.anything())- )+ expect(installHubSkill).toHaveBeenCalledExactlyOnceWith('official/gifs/gif-search', 'researcher')})})diff --git a/apps/desktop/src/app/skills/index.tsx b/apps/desktop/src/app/skills/index.tsxindex 4a57291c58e..258cbb1ef60 100644--- a/apps/desktop/src/app/skills/index.tsx+++ b/apps/desktop/src/app/skills/index.tsx@@ -16,13 +16,11 @@ import type { DesktopRosterAgent } from '@/global'import {editLearningNode,getLearningNode,- getOfficialSkills,getProfiles,getSkillContent,getSkills,getToolsets,getUsageAnalytics,- previewSkillHub,type ProfileScope,profileScopeKey,setSkillEnabled,@@ -30,17 +28,15 @@ import {} from '@/hermes'import { useI18n } from '@/i18n'import { isDesktopToolsetVisible } from '@/lib/desktop-toolsets'-import { Loader2 } from '@/lib/icons'import { queryClient } from '@/lib/query-client'import { invalidateSlashCompletions } from '@/lib/slash-completion-cache'import { normalize } from '@/lib/text'import { useStoreSelector } from '@/lib/use-session-slice'import { cn } from '@/lib/utils'import { $gateway, activeGatewayConnectionId } from '@/store/gateway'-import { $hubActions, installHubSkill, notifyHubActionFailed, OFFICIAL_SKILLS_KEY } from '@/store/hub-actions'import { notify, notifyError } from '@/store/notifications'import { $activeGatewayProfile, normalizeProfileKey } from '@/store/profile'-import type { OfficialSkillInfo, SkillInfo, ToolsetInfo } from '@/types/hermes'+import type { SkillInfo, ToolsetInfo } from '@/types/hermes'import { useOnProfileSwitch } from '../hooks/use-on-profile-switch'import { useRefreshHotkey } from '../hooks/use-refresh-hotkey'@@ -67,14 +63,15 @@ import { TerminalBackendPanel } from '../settings/terminal-backend-panel'import { ToolsetConfigPanel } from '../settings/toolset-config-panel'import type { SetStatusbarItemGroup } from '../shell/statusbar-controls'-import { EmbeddedHubPicker } from './embedded-hub-picker'+import { CapabilityTabs, type CapabilityView } from './capability-tabs'import { McpTab } from './mcp-tab'-import { PluginsTab } from './plugins-tab'+import { PluginActions, PluginsTab } from './plugins-tab'+import { SkillCatalog } from './skill-catalog'import { $skillsSortDesc, $toolsetsSortDesc } from './store'+import { UpdateSkillsButton } from './update-skills-button'-// 'hub' is gone as a top-level tab — the Skills Hub browser lives inside the-// Skills tab now (EmbeddedHubPicker below the installed list). Legacy-// `?tab=hub` links fall back to 'skills' via useRouteEnumParam.+// Skills Hub browsing lives inside the Skills tab. Legacy `?tab=hub`+// links fall back to 'skills' via useRouteEnumParam.const SKILLS_MODES = ['skills', 'toolsets', 'mcp', 'plugins'] as const// Skills + toolsets live in the RQ cache so switching tabs/pages paints the@@ -153,23 +150,6 @@ function filteredSkills(skills: SkillInfo[], query: string, desc: boolean): Skil.sort((a, b) => sign * (usageOf(b) - usageOf(a)) || asText(a.name).localeCompare(asText(b.name)))}-// Catalog rows have no usage yet — plain A–Z, same query fields as installed-// rows plus tags (the catalog's frontmatter tags are its richest search text).-function filteredOfficial(skills: OfficialSkillInfo[], query: string): OfficialSkillInfo[] {- const q = normalize(query)-- return skills- .filter(- skill =>- !q ||- includesQuery(skill.name, q) ||- includesQuery(skill.description, q) ||- includesQuery(skill.category, q) ||- skill.tags.some(tag => includesQuery(tag, q))- )- .sort((a, b) => asText(a.name).localeCompare(asText(b.name)))-}-const toolsetCalls = (toolset: ToolsetInfo, toolCalls: Record<string, number>): number =>toolNames(toolset).reduce((sum, name) => sum + (toolCalls[name] ?? 0), 0)@@ -245,16 +225,7 @@ export function SkillsView({const [query, setQuery] = useState('')- // The hub picker hosts a full docs-site iframe — the single most expensive- // thing on this page. It mounts lazily (first time the Skills tab is shown)- // and then STAYS mounted but hidden across tab switches, so bouncing to- // Tools/MCP and back never reloads the site. Derived-state pattern: flips- // once, during render, never back.- const [hubMounted, setHubMounted] = useState(mode === 'skills')-- if (mode === 'skills' && !hubMounted) {- setHubMounted(true)- }+ const [capabilityView, setCapabilityView] = useState<CapabilityView>('installed')// Capabilities scope selector: which profile's Skills/Tools/MCP config we're// editing — and on WHICH gateway. A profile belongs to one gateway, so on a@@ -337,17 +308,6 @@ export function SkillsView({staleTime: 0})- // The built-in optional-skills catalog (optional-skills/ shipped with the- // repo) — rendered under the installed list with install buttons. Local- // checkout scan on the backend, so it's cheap; failures (older backend- // without the endpoint) just render no catalog rows.- const { data: officialData } = useQuery({- queryKey: [...OFFICIAL_SKILLS_KEY, scopeKey],- queryFn: () => getOfficialSkills(scopeProfile),- staleTime: 60_000,- retry: false- })-// Optimistic write-through against the scoped Skills key: toggles/bulk/// archive repaint instantly; the next background refetch reconciles.const setSkills = useCallback(@@ -366,16 +326,12 @@ export function SkillsView({const toolsetsSortDesc = useStore($toolsetsSortDesc)const [bulkBusy, setBulkBusy] = useState(false)const [selectedSkill, setSelectedSkill] = useState<string | null>(null)- // Catalog selection is separate from installed-skill selection: identifiers- // (official/<category>/<name>) vs names. Non-null wins the detail pane.- const [selectedOfficial, setSelectedOfficial] = useState<string | null>(null)const [selectedToolset, setSelectedToolset] = useState<string | null>(null)const refreshCapabilities = useCallback(async () => {await Promise.all([queryClient.invalidateQueries({ queryKey: SKILLS_QUERY_KEY }),- queryClient.invalidateQueries({ queryKey: TOOLSETS_QUERY_KEY }),- queryClient.invalidateQueries({ queryKey: OFFICIAL_SKILLS_KEY })+ queryClient.invalidateQueries({ queryKey: TOOLSETS_QUERY_KEY })])invalidateSlashCompletions()@@ -433,7 +389,6 @@ export function SkillsView({toolCallsEpoch.current += 1setToolCalls(null)setScopeOverride(null)- setSelectedOfficial(null)})const visibleSkills = useMemo(@@ -441,30 +396,10 @@ export function SkillsView({[query, skills, skillsSortDesc])- // Installed-name set for the hub picker's already-installed guard — the+ // Installed-name set for the catalog's already-installed guard — the// UNFILTERED list on purpose (search must not make a skill look absent).const installedSkillNames = useMemo(() => new Set((skills ?? []).map(s => s.name)), [skills])- // Catalog rows still available to install: drop entries whose lock says- // installed AND entries whose name already appears in the installed list- // (covers installs from before the lock existed, or by hand).- const visibleOfficial = useMemo(() => {- const catalog = (officialData?.skills ?? []).filter(s => !s.installed && !installedSkillNames.has(s.name))-- return filteredOfficial(catalog, query)- }, [installedSkillNames, officialData, query])-- // Identifiers with a hub install currently running — selected as a joined- // string so $hubActions' per-log-line churn doesn't re-render the list.- const runningInstallKey = useStoreSelector($hubActions, actions =>- Object.keys(actions)- .filter(key => actions[key]?.running)- .sort()- .join('|')- )-- const runningInstalls = useMemo(() => new Set(runningInstallKey.split('|').filter(Boolean)), [runningInstallKey])-const visibleToolsets = useMemo(() => (toolsets ? filteredToolsets(toolsets, query, toolCalls ?? {}, toolsetsSortDesc) : []),[query, toolCalls, toolsets, toolsetsSortDesc]@@ -510,13 +445,6 @@ export function SkillsView({[selectedSkill, visibleSkills])- // A selected catalog row wins the detail pane; it clears when filtered out- // (or when its install finishes and the row leaves the catalog list).- const activeOfficial = useMemo(- () => visibleOfficial.find(s => s.identifier === selectedOfficial) ?? null,- [selectedOfficial, visibleOfficial]- )-const activeToolset = useMemo(() => visibleToolsets.find(ts => ts.name === selectedToolset) ?? visibleToolsets[0] ?? null,[selectedToolset, visibleToolsets]@@ -541,18 +469,6 @@ export function SkillsView({}}- // Catalog install: routes through the standard hub action pipeline- // (background action + tailed log + query invalidation), same as the- // embedded hub picker — the row's button spins off ITS $hubActions entry- // and the finished install refetches both lists, flipping the row from the- // catalog section into the installed section with the normal toggle.- function handleInstallOfficial(skill: OfficialSkillInfo) {- notify({ kind: 'success', title: t.skills.hub.installStarted(skill.name), message: t.skills.hub.actionLog })- void installHubSkill(skill.identifier, scopeProfile).catch(err =>- notifyHubActionFailed(err, t.skills.hub.actionFailed, skill.name, scopeProfile)- )- }-async function handleToggleToolset(toolset: ToolsetInfo, enabled: boolean) {const scopedToolsetKey = [...TOOLSETS_QUERY_KEY, scopeKey]@@ -778,7 +694,6 @@ export function SkillsView({setSkillEditor(null)setSkillDraft('')setArchiveTarget(null)- setSelectedOfficial(null)}// Scope-selector rows. Multi-connection desktops list every reachable@@ -824,25 +739,18 @@ export function SkillsView({// Browse Hub). Lets the user configure ANY profile's capabilities — on any// registered gateway — without switching the whole app. Only meaningful// with >1 option; hidden otherwise to avoid clutter.- // Plugins embeds the selector in its Agent-column header (compact, no label,- // no border): desktop halves on that page are app-level and must not read as- // governed by "Configuring: <profile>".- const compactSelector = mode === 'plugins'+ // Keep the selector in the same slot across tabs. Plugins labels its scope+ // as Agent because desktop halves belong to the app, not this profile.const scopeLabel = scopeOptions.find(option => option.value === scopeSelectValue)?.labelconst profileScopeSelector =scopeOptions.length > 1 ? (<div- className={cn(- 'flex min-w-0 items-center gap-2',- compactSelector ? 'flex-1' : 'border-b border-(--ui-stroke-secondary) px-3 py-2'- )}+ className="flex min-w-0 items-center gap-2 border-b border-(--ui-stroke-secondary) px-3 py-2">- {!compactSelector && (- <span className="text-[0.7rem] font-medium text-(--ui-text-tertiary)">{t.skills.configuringProfile}</span>- )}+ <span className="text-[0.7rem] font-medium text-(--ui-text-tertiary)">{mode === 'plugins' ? t.skills.plugins.halfAgent : t.skills.configuringProfile}</span><Select onValueChange={changeScope} value={scopeSelectValue}>- <SelectTrigger className={cn('text-xs', compactSelector ? 'h-6 w-full max-w-64 px-2' : 'h-7 w-56')}>+ <SelectTrigger className="h-7 w-56 text-xs"><SelectValue /></SelectTrigger><SelectContent>@@ -864,9 +772,9 @@ export function SkillsView({onTabChange={id => setMode(id as (typeof SKILLS_MODES)[number])}// MCP manages a handful of entries with the editor right there —// searching it is noise.- searchHidden={mode === 'mcp' || mode === 'plugins'}+ searchHidden={mode === 'mcp'}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 },@@ -879,22 +787,28 @@ export function SkillsView({active, so Skills / Tools / MCP all read and write the SAME selectedprofile. */}<div className="flex h-full flex-col">- {/* Plugins renders the selector INSIDE its agent section: desktop- plugins on that page belong to the app, not to any profile, and- must not sit under a "Configuring: <profile>" header. */}- {mode !== 'plugins' && profileScopeSelector}+ {profileScopeSelector}+ {(mode === 'skills' || mode === 'plugins') && (+ <CapabilityTabs+ actions={mode === 'skills' ? <UpdateSkillsButton profile={scopeProfile} /> : <PluginActions profile={scopeProfile} />}+ onChange={setCapabilityView}+ value={capabilityView}+ />+ )}<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'}>+ <div className="min-h-0 flex-1 overflow-hidden">{mode === 'plugins' ? (// Agent plugins for the scoped profile (selector in the section- // header), app-level desktop plugins, the live catalog picker+ // header), app-level desktop plugins, and the native catalog// underneath. Keyed on scope so a profile/connection switch// reloads the agent list.<PluginsTabkey={`plugins-${scopeKey}`}profile={scopeProfile}scopeLabel={scopeLabel}- scopeSelector={profileScopeSelector}+ view={capabilityView}+ query={query}+ onQueryChange={setQuery}/>) : mode === 'mcp' ? (// The gateway instance backs ONLY the live `reload.mcp` RPC, and@@ -903,6 +817,8 @@ export function SkillsView({// machine's MCP servers, so it is withheld (config edits still// apply on that backend's next session).<McpTab gateway={crossBackendScope ? null : gateway} key={`mcp-${scopeKey}`} profile={scopeProfile} />+ ) : mode === 'skills' && capabilityView === 'browse' ? (+ <SkillCatalog installedNames={installedSkillNames} key={scopeKey} profile={scopeProfile} query={query} onQueryChange={setQuery} />) : (skillsFailed || toolsetsFailed) && (!skills || !toolsets) ? (<PanelEmptyaction={@@ -917,13 +833,7 @@ export function SkillsView({) : !skills || !toolsets ? (<PageLoader label={t.skills.loading} />) : mode === 'skills' ? (- // Installed skills on top, the Skills Hub browser underneath —- // discovery sits with management. The list region keeps a floor- // (min-h-40, on the wrapper above) so a tall hub viewport or a- // short window shrinks the HUB, never the list: the sort strip- // and "changes apply" footer can no longer be starved to 0px- // and painted over by the hub header.- visibleSkills.length === 0 && visibleOfficial.length === 0 ? (+ visibleSkills.length === 0 ? (capabilityEmpty('skills')) : (<MasterDetail pane={skillEditorPane} resizeId="capabilities-split" split="wide">@@ -949,73 +859,27 @@ export function SkillsView({>{visibleSkills.map(skill => (<CapRow- active={activeOfficial === null && activeSkill?.name === skill.name}+ active={activeSkill?.name === skill.name}busy={bulkBusy}enabled={skill.enabled}key={skill.name}meta={usageOf(skill) > 0 ? `×${compactNumber(usageOf(skill))}` : undefined}- onSelect={() => {- setSelectedSkill(skill.name)- setSelectedOfficial(null)- }}+ onSelect={() => setSelectedSkill(skill.name)}onToggle={enabled => void handleToggleSkill(skill, enabled)}subtitle={skillSubtitle(skill)}title={skill.name}toggleLabel={skill.name}/>))}- {/* The built-in optional-skills catalog, below the- installed list: every official skill Hermes ships but- hasn't installed yet, with a one-click install that- flips the row into the installed section above. */}- {visibleOfficial.length > 0 && (- <div className="flex h-7 shrink-0 items-end px-2 pb-1 text-[0.62rem] font-medium uppercase tracking-wide text-(--ui-text-quaternary)">- {t.skills.officialCatalog}- </div>- )}- {visibleOfficial.map(skill => {- const installing = runningInstalls.has(skill.identifier)-- return (- <CapRow- action={- <Button- disabled={installing}- onClick={() => handleInstallOfficial(skill)}- size="xs"- variant="text"- >- {installing && <Loader2 className="size-3 animate-spin" />}- {installing ? t.skills.hub.installing : t.skills.hub.install}- </Button>- }- active={activeOfficial?.identifier === skill.identifier}- enabled={false}- key={skill.identifier}- onSelect={() => setSelectedOfficial(skill.identifier)}- subtitle={prettyName(skill.category)}- title={skill.name}- />- )- })}</ListColumn><DetailColumn footer={t.skills.changesApplyNewSessions}>- {activeOfficial ? (- <OfficialSkillDetail- installing={runningInstalls.has(activeOfficial.identifier)}- onInstall={() => handleInstallOfficial(activeOfficial)}+ {activeSkill && (+ <SkillDetail+ onArchive={() => setArchiveTarget(activeSkill.name)}+ onEdit={() => void openSkillEditor(activeSkill.name)}profile={scopeProfile}- skill={activeOfficial}+ skill={activeSkill}/>- ) : (- activeSkill && (- <SkillDetail- onArchive={() => setArchiveTarget(activeSkill.name)}- onEdit={() => void openSkillEditor(activeSkill.name)}- profile={scopeProfile}- skill={activeSkill}- />- ))}</DetailColumn></MasterDetail>@@ -1073,15 +937,6 @@ export function SkillsView({</MasterDetail>)}</div>- {/* Hub picker OUTSIDE the tab ternary: it lazy-mounts the first time- Skills is shown, then stays mounted (hidden) across Tools/MCP so- the docs-site iframe never reloads on a tab bounce. No scope key- on purpose — the picker fetches nothing; scope rides the- `profile` prop into each install call, and remounting on scope- change would reload the whole site for no data benefit. */}- {hubMounted && (- <EmbeddedHubPicker hidden={mode !== 'skills'} installedNames={installedSkillNames} profile={scopeProfile} />- )}</div></div>{archiveTarget && (@@ -1263,76 +1118,6 @@ function SkillDetail({)}-// Detail pane for a not-yet-installed catalog skill: metadata + full SKILL.md-// via the hub preview endpoint (same resolver an install uses), plus the same-// install button as the row.-function OfficialSkillDetail({- installing,- onInstall,- profile,- skill-}: {- installing: boolean- onInstall: () => void- profile?: ProfileScope- skill: OfficialSkillInfo-}) {- const { t } = useI18n()-- const previewQuery = useQuery({- queryKey: ['official-skill-preview', skill.identifier, profileScopeKey(profile)],- queryFn: () => previewSkillHub(skill.identifier, profile),- staleTime: 5 * 60_000,- retry: false- })-- const parsed = useMemo(- () => (previewQuery.data?.skill_md ? parseFrontmatter(previewQuery.data.skill_md) : null),- [previewQuery.data]- )-- return (- <>- <DetailHeader- description={asText(skill.description) || t.skills.noDescription}- pills={- <>- <PanelPill>{prettyName(skill.category)}</PanelPill>- <PanelPill tone="muted">{t.skills.officialPill}</PanelPill>- </>- }- title={skill.name}- />- <div className="flex items-center gap-2">- <Button disabled={installing} onClick={onInstall} size="xs" variant="textStrong">- {installing && <Loader2 className="size-3 animate-spin" />}- {installing ? t.skills.hub.installing : t.skills.hub.install}- </Button>- </div>- {parsed && parsed.meta.length > 0 && (- <div className="grid gap-1 rounded-lg border border-(--ui-stroke-tertiary) bg-(--ui-bg-quinary) p-3">- {parsed.meta.map(([key, value]) => (- <div className="flex gap-2 text-[0.68rem] leading-4" key={key}>- <span className="w-24 shrink-0 font-medium text-(--ui-text-tertiary)">{key}</span>- <span className="min-w-0 whitespace-pre-wrap break-words text-(--ui-text-secondary)">{value}</span>- </div>- ))}- </div>- )}- {previewQuery.isLoading ? (- <CountSkeleton />- ) : parsed ? (- <pre- className="overflow-auto whitespace-pre-wrap wrap-break-word rounded-lg border border-(--ui-stroke-tertiary) bg-(--ui-bg-quinary) p-3 font-mono text-[0.68rem] leading-relaxed"- data-selectable-text="true"- >- {parsed.body.trim() || t.skills.noDescription}- </pre>- ) : null}- </>- )-}-function ToolsetDetail({toolset,toolCalls,diff --git a/apps/desktop/src/app/skills/plugins-tab.test.tsx b/apps/desktop/src/app/skills/plugins-tab.test.tsxindex 8b3c5b7e941..861b119457e 100644--- a/apps/desktop/src/app/skills/plugins-tab.test.tsx+++ b/apps/desktop/src/app/skills/plugins-tab.test.tsx@@ -1,14 +1,72 @@-import { cleanup, fireEvent, render, screen, waitFor } 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 { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'import { $pluginRecords } from '@/contrib/plugins-store'+import { queryClient } from '@/lib/query-client'import { $agentPlugins, $agentPluginsStatus } from '@/store/agent-plugins'-import { $paneHeightOverride, setPaneHeightOverride } from '@/store/panes'import { $pluginInstallRequest, closePluginInstallRequest } from '@/store/plugin-install-request'-import { PluginsTab } from './plugins-tab'--const requestGateway = vi.fn(async () => ({ plugins: [] }))+import { PageSearchShell } from '../page-search-shell'++import { CapabilityTabs } from './capability-tabs'+import { parseCatalog } from './catalog-data'+import { PluginActions, PluginsTab } from './plugins-tab'++const requestGateway = vi.fn(async () => ({ plugins: $agentPlugins.get() }))++// SkillsView owns navigation and search; exercise that controlled contract+// with the same primitives instead of giving PluginsTab private controls.+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} 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()+}++afterEach(() => {+ cleanup()+ queryClient.clear()+ vi.unstubAllGlobals()+})vi.mock('@/app/gateway/hooks/use-gateway-request', () => ({useGatewayRequest: () => ({ requestGateway })@@ -20,11 +78,10 @@ describe('PluginsTab', () => {$agentPlugins.set([])$agentPluginsStatus.set('ready')closePluginInstallRequest()- requestGateway.mockClear()+ requestGateway.mockReset()+ requestGateway.mockImplementation(async () => ({ plugins: $agentPlugins.get() }))})- afterEach(cleanup)-it('lists the scoped profile agent plugins with toggles', () => {$agentPlugins.set([{@@ -37,10 +94,11 @@ describe('PluginsTab', () => {}])- render(<PluginsTab profile="workbot" />)+ renderPlugins({ profile: 'workbot' })- expect(screen.getByText('demo-plugin')).toBeTruthy()- expect(screen.getByRole('switch', { name: 'Agent: demo-plugin' }).getAttribute('aria-checked')).toBe('true')+ expect(screen.getByRole('button', { name: /^demo-plugin/, pressed: true })).toBeTruthy()+ const detail = within(screen.getByRole('row', { name: /^demo-plugin/ }))+ expect(detail.getByRole('switch', { name: 'Agent: demo-plugin' }).getAttribute('aria-checked')).toBe('true')})it('hides bundled plugins (managed from their own surfaces)', () => {@@ -55,10 +113,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()})it('renders a unified package as ONE row with a Desktop switch and an Agent switch', () => {@@ -76,13 +135,15 @@ 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()- expect(screen.getByRole('switch', { name: 'Desktop: Media Studio' }).getAttribute('aria-checked')).toBe('true')- expect(screen.getByRole('switch', { name: 'Agent: Media Studio' }).getAttribute('aria-checked')).toBe('false')- expect(screen.getAllByText('Agent in workbot').length).toBeGreaterThan(0)+ expect(screen.getAllByRole('button', { name: /^Media Studio/ })).toHaveLength(1)+ expect(screen.getAllByRole('row')).toHaveLength(1)+ const detail = within(screen.getByRole('row', { name: /^Media Studio/ }))+ expect(detail.getByText('Agent + Desktop')).toBeTruthy()+ expect(detail.getByRole('switch', { name: 'Desktop: Media Studio' }).getAttribute('aria-checked')).toBe('true')+ expect(detail.getByRole('switch', { name: 'Agent: Media Studio' }).getAttribute('aria-checked')).toBe('false')+ expect(detail.getByRole('cell', { name: 'Agent in workbot' })).toBeTruthy()})it('offers "Install here" for a desktop half whose agent half is not in the selected profile', async () => {@@ -97,7 +158,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()@@ -117,13 +178,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',@@ -131,51 +192,25 @@ 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('opens the dual-target install modal for the selected catalog entry in the scoped profile', async () => {+ 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'- })- )-- expect($pluginInstallRequest.get()).toBeNull()- })-it('toggles by canonical key through plugins.manage', async () => {$agentPlugins.set([{@@ -192,7 +227,7 @@ describe('PluginsTab', () => {plugin: { key: 'image_gen/legacy', name: 'Legacy plugin', status: 'enabled' }} as never)- render(<PluginsTab profile={null} />)+ renderPlugins({ profile: null })screen.getByRole('switch', { name: 'Agent: Legacy plugin' }).click()@@ -217,7 +252,7 @@ describe('PluginsTab', () => {}])- render(<PluginsTab profile={null} />)+ renderPlugins({ profile: null })const toggle = screen.getByRole('switch', { name: 'Agent: Legacy plugin' })@@ -228,23 +263,24 @@ 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 its 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})})})@@ -254,30 +290,63 @@ describe('PluginsTab catalog UX', () => {$agentPlugins.set([])$agentPluginsStatus.set('ready')closePluginInstallRequest()- requestGateway.mockClear()- setPaneHeightOverride('capabilities-plugin-catalog', undefined)+ requestGateway.mockReset()+ requestGateway.mockImplementation(async () => ({ plugins: $agentPlugins.get() }))+ $pluginRecords.set({})})- afterEach(cleanup)-- 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')-- fireEvent.pointerDown(sash, { button: 0, clientY: 600 })- fireEvent.pointerMove(window, { clientY: 400 })- fireEvent.pointerUp(window)+ it('fetches only on Browse, with no extra requests for selection, search, or 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()+ // The parent retains the shared search across navigation. Clearing from+ // the empty state must propagate through onQueryChange, not local state.+ 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()+ })- // Default 380px + 200px of upward drag (clamped only by window/column size).- expect($paneHeightOverride('capabilities-plugin-catalog').get()).toBe(580)+ it('offers an explicit retry after a catalog failure rather than refetching 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', () => {@@ -297,7 +366,7 @@ describe('PluginsTab catalog UX', () => {}])- render(<PluginsTab profile={null} />)+ renderPlugins({ profile: null })expect(screen.getByRole('button', { name: `Update to ${'b'.repeat(8)}` })).toBeTruthy()})@@ -320,7 +389,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()@@ -332,7 +401,7 @@ describe('PluginsTab catalog UX', () => {)})- it('refuses a catalog pick that is already installed and current', async () => {+ it('disables installation of a catalog entry that is already installed and current', async () => {$agentPlugins.set([{catalog_name: 'demo-weather',@@ -347,25 +416,17 @@ describe('PluginsTab catalog UX', () => {}])- render(<PluginsTab profile={null} />)+ seedCatalog([{ ...weatherEntry, name: 'demo-weather' }])+ await act(async () => { renderPlugins({ profile: null }) })+ await selectCatalogEntry('demo-weather')- 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'- })- )-- // 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 catalog installation for an installed entry when an update is available', async () => {$agentPlugins.set([{catalog_name: 'demo-weather',@@ -380,19 +441,17 @@ 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'- })- )-- await waitFor(() => expect($pluginInstallRequest.get()).not.toBeNull())+ const entry = { ...weatherEntry, name: 'demo-weather', sha: 'b'.repeat(40) }+ 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/skills/plugins-tab.tsx b/apps/desktop/src/app/skills/plugins-tab.tsxindex 6b67c75bacb..01636a3f60e 100644--- a/apps/desktop/src/app/skills/plugins-tab.tsx+++ b/apps/desktop/src/app/skills/plugins-tab.tsx@@ -1,13 +1,5 @@import { useStore } from '@nanostores/react'-import {- memo,- type ReactNode,- type PointerEvent as ReactPointerEvent,- useEffect,- useMemo,- useRef,- useState-} from 'react'+import { memo, type ReactNode, useEffect, useMemo } from 'react'import { useGatewayRequest } from '@/app/gateway/hooks/use-gateway-request'import { Button } from '@/components/ui/button'@@ -24,8 +16,6 @@ import { cn } from '@/lib/utils'import {$agentPluginBusy,$agentPlugins,- $agentPluginsError,- $agentPluginsStatus,type AgentPluginRow,type GatewayRequest,isDesktopRelevantPlugin,@@ -34,46 +24,16 @@ import {updateAgentPlugin} from '@/store/agent-plugins'import { notify, notifyError } from '@/store/notifications'-import { $paneHeightOverride, setPaneHeightOverride } from '@/store/panes'import { openPluginInstallRequest } from '@/store/plugin-install-request'-import { PanelEmpty } from '../overlays/panel'import { Pill } from '../settings/primitives'import { useDeepLinkHighlight } from '../settings/use-deep-link-highlight'+import type { CapabilityView } from './capability-tabs'+import { CatalogBrowser } from './catalog-browser'+import { type CatalogEntry, parseCatalog } from './catalog-data'import { mergePluginPackages, type PackageKind, type PluginPackage } from './plugin-packages'-// 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.-const CATALOG_ORIGIN = 'https://hermes-agent.nousresearch.com'-const CATALOG_PICKER_URL = `${CATALOG_ORIGIN}/docs/plugins?embed=picker`--// 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 (`/skills?tab=plugins&plugin=<key>`).* Accepts the agent key, the agent name, or the desktop record id. */export const pluginElementId = (target: string) => `plugin-${target}`@@ -192,15 +152,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). */+/** Controls for one installed plugin half in the detail pane. */function HalfCell({ label, children }: { label: string; 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)">{label}</span>{children}</div>)@@ -240,12 +196,12 @@ function PackageRow({return (<div- className="flex items-center gap-3 border-b border-(--ui-stroke-tertiary) px-3 py-2.5 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>@@ -354,31 +310,49 @@ function PackageRow({)}+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={() => void rescanAll(requestGateway, scope)} size="icon-xs" variant="ghost"><RefreshCw /></Button>+ </Tip>+ </>+}+/** 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. */+ * half (the selected profile's backend). Browse uses the shared native+ * catalog; Install from Git remains available for unlisted packages. */export const PluginsTab = memo(function PluginsTab({profile,- scopeSelector,- scopeLabel+ scopeLabel,+ view = 'installed',+ query = '',+ onQueryChange}: {+ query?: string+ onQueryChange?: (value: string) => void+ view?: CapabilityViewprofile: ProfileScope- /** The Capabilities profile selector; rendered in the Agent column header so- * it visibly governs only that column. */- scopeSelector?: ReactNode/** Display name of the selected profile for the Agent column label. */scopeLabel?: string}) {const { t } = useI18n()const p = t.skills.plugins- const d = t.settings.pluginsconst { requestGateway } = useGatewayRequest()const desktopRecords = useStore($pluginRecords)const agentRows = useStore($agentPlugins)- const status = useStore($agentPluginsStatus)- const error = useStore($agentPluginsError)const busyKey = useStore($agentPluginBusy)const scope = profileParam(profile)@@ -395,255 +369,62 @@ export const PluginsTab = memo(function PluginsTab({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)- }-- window.addEventListener('pointermove', onMove)- window.addEventListener('pointerup', onUp, { once: true })- }-- useEffect(() => {- if (!open) {- return undefined- }-- 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- }-- const existing = $agentPlugins.get().find(row => row.catalog_name === data.name || row.name === data.name)-- if (existing && !existing.update_available) {- notify({ kind: 'success', message: p.alreadyInstalled(String(data.name)) })-- return- }-- openPluginInstallRequest({- catalogName: String(data.name),- profile: scope,- repo: data.subdir ? `${String(data.repo)}#${String(data.subdir)}` : String(data.repo),- sha: data.sha ? String(data.sha) : undefined- })- }-- window.addEventListener('message', onMessage)-- return () => window.removeEventListener('message', onMessage)- }, [open, p, scope])-const agentBusy = (row: AgentPluginRow) => busyKey === (row.key ?? row.name) || busyKey === row.name+ const installedEntries = useMemo(() => parseCatalog('plugins', packages.map(pkg => ({+ name: pkg.name,+ identifier: pkg.agent?.catalog_name ?? pkg.desktop?.packageOrigin?.catalogName ?? 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, index) => ({ ...entry, id: `installed:${packages[index].key}` })), [packages])+ const packageById = useMemo(() => new Map(packages.map(pkg => [`installed:${pkg.key}`, pkg])), [packages])+ const isInstalled = (entry: CatalogEntry) => packageById.has(entry.id) || agentRows.some(row =>+ (row.catalog_name === entry.name || row.name === entry.name) && !row.update_available+ )+ const install = (entry: CatalogEntry) => openPluginInstallRequest({+ catalogName: entry.name,+ profile: scope,+ repo: entry.subdir ? `${entry.repo}#${entry.subdir}` : entry.repo,+ sha: entry.sha+ })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}- </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')+ <CatalogBrowser+ installedEntries={installedEntries}+ view={view}+ query={query}+ onQueryChange={onQueryChange}+ isInstalled={isInstalled}+ kind="plugins"+ onInstall={install}+ renderInstalledDetail={entry => {+ const pkg = packageById.get(entry.id)+ if (!pkg) return null++ return <PackageRow+ busy={pkg.agent ? agentBusy(pkg.agent) : false}+ key={pkg.key}+ onAgentToggle={(row, enable) => {+ if (row.key) void toggleAgentPlugin(requestGateway, row.key, enable, p.toggleFailed(row.name), scope)+ }}+ onAgentUpdate={row => {+ void updateAgentPlugin(requestGateway, row.name, p.updateFailed(row.name), scope).then(applied => {+ if (applied) {+ notify({ kind: 'success', message: p.updated(row.name) })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}- />- ) : 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 => (- <PackageRow- busy={pkg.agent ? agentBusy(pkg.agent) : false}- key={pkg.key}- onAgentToggle={(row, enable) => {- if (!row.key) {- return- }-- void toggleAgentPlugin(requestGateway, row.key, enable, p.toggleFailed(row.name), scope)- }}- onAgentUpdate={row => {- void updateAgentPlugin(requestGateway, row.name, p.updateFailed(row.name), scope).then(applied => {- if (applied) {- notify({ kind: 'success', message: p.updated(row.name) })- void rescanAll(requestGateway, scope)- }- })- }}- pkg={pkg}- scope={scope}- scopeLabel={label}- />- ))}- </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)'- )}+ }+ })+ }}+ pkg={pkg}+ scope={scope}+ scopeLabel={label}/>- </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>+ }}+ /></div>)})diff --git a/apps/desktop/src/app/skills/skill-catalog.tsx b/apps/desktop/src/app/skills/skill-catalog.tsxnew file mode 100644index 00000000000..61bc62636f1--- /dev/null+++ b/apps/desktop/src/app/skills/skill-catalog.tsx@@ -0,0 +1,46 @@+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/skills/update-skills-button.tsx b/apps/desktop/src/app/skills/update-skills-button.tsxnew file mode 100644index 00000000000..56fa026c028--- /dev/null+++ b/apps/desktop/src/app/skills/update-skills-button.tsx@@ -0,0 +1,21 @@+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/i18n/ar.ts b/apps/desktop/src/i18n/ar.tsindex 70c7faff669..2c1421bbb02 100644--- a/apps/desktop/src/i18n/ar.ts+++ b/apps/desktop/src/i18n/ar.ts@@ -1,6 +1,36 @@import { defineLocale } from './define-locale'export const ar = defineLocale({+ catalog: {+ browse: 'تصفح',+ installed: 'المثبتة',+ searchSkills: 'البحث في المهارات',+ searchPlugins: 'البحث في الإضافات',+ allSources: 'كل المصادر',+ allCategories: 'كل الفئات',+ about: 'نبذة',+ author: 'المؤلف',+ source: 'المصدر',+ category: 'الفئة',+ version: 'الإصدار',+ platforms: 'المنصات',+ requires: 'المتطلبات',+ tools: 'الأدوات',+ hooks: 'الخطافات',+ repository: 'المستودع',+ documentation: 'التوثيق',+ noResults: 'لا توجد نتائج مطابقة',+ tryAnother: 'جرّب بحثًا آخر أو امسح عوامل التصفية.',+ clearFilters: 'مسح عوامل التصفية',+ loadFailed: 'تعذر تحميل الكتالوج',+ retry: 'حاول مرة أخرى',+ more: 'عرض المزيد',+ pinned: 'التزام تمت مراجعته',+ snapshotHint: 'من كتالوج Hermes. لا يتصل التصفح بمستودعات المصدر مطلقًا.',+ installHint: 'راجع المصدر قبل التثبيت. تسري التغييرات على الجلسات الجديدة.',+ results: (count: number) => `النتائج: ${count.toLocaleString('ar')}`,+ back: 'العودة إلى النتائج'+ },sessionImport: {title: 'المتابعة من تطبيق آخر',subtitle: 'انقل محادثة إلى Hermes وتابع من حيث توقفت.',diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 1d2ce023240..7e1183e3cbd 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -3,6 +3,36 @@ import { FIELD_DESCRIPTIONS, FIELD_LABELS } from '@/app/settings/constants'import type { Translations } from './types'export const en: Translations = {+ catalog: {+ browse: 'Browse',+ installed: 'Installed',+ searchSkills: 'Search skills',+ searchPlugins: 'Search plugins',+ allSources: 'All sources',+ allCategories: 'All categories',+ about: 'About',+ author: 'Author',+ source: 'Source',+ category: 'Category',+ version: 'Version',+ platforms: 'Platforms',+ requires: 'Requires',+ tools: 'Tools',+ hooks: 'Hooks',+ repository: 'Repository',+ documentation: 'Documentation',+ noResults: 'No matches',+ tryAnother: 'Try another search or clear your filters.',+ clearFilters: 'Clear filters',+ loadFailed: 'Could not load the catalog',+ retry: 'Try again',+ more: 'Show more',+ pinned: 'Reviewed commit',+ snapshotHint: 'From the Hermes catalog. Browsing never contacts source repositories.',+ installHint: 'Review the source before installing. Changes apply to new sessions.',+ results: (count: number) => `${count.toLocaleString()} result${count === 1 ? '' : 's'}`,+ back: 'Back to results'+ },connectors: {title: 'Connect your apps',connect: 'Connect',diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex 3d1b2473086..a2aa61677aa 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -3,6 +3,36 @@ import { defineFieldCopy } from '@/app/settings/field-copy'import { defineLocale } from './define-locale'export const ja = defineLocale({+ catalog: {+ browse: '閲覧',+ installed: 'インストール済み',+ searchSkills: 'スキルを検索',+ searchPlugins: 'プラグインを検索',+ allSources: 'すべての提供元',+ allCategories: 'すべてのカテゴリ',+ about: '概要',+ author: '作者',+ source: '提供元',+ category: 'カテゴリ',+ version: 'バージョン',+ platforms: '対応プラットフォーム',+ requires: '必要なもの',+ tools: 'ツール',+ hooks: 'フック',+ repository: 'リポジトリ',+ documentation: 'ドキュメント',+ noResults: '一致する項目がありません',+ tryAnother: '別の検索を試すか、フィルターをクリアしてください。',+ clearFilters: 'フィルターをクリア',+ loadFailed: 'カタログを読み込めませんでした',+ retry: '再試行',+ more: 'さらに表示',+ pinned: 'レビュー済みコミット',+ snapshotHint: 'Hermesカタログの情報です。閲覧時に提供元のリポジトリへ接続することはありません。',+ installHint: 'インストール前にソースを確認してください。変更は新しいセッションに適用されます。',+ results: (count: number) => `${count.toLocaleString('ja')}件の結果`,+ back: '結果に戻る'+ },sessionImport: {title: '別のアプリから続ける',subtitle: '会話をHermesに取り込み、続きを始めましょう。',diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.tsindex df21d80553a..643c8520610 100644--- a/apps/desktop/src/i18n/ru.ts+++ b/apps/desktop/src/i18n/ru.ts@@ -24,6 +24,37 @@ const RU_NOUN = (count: number | string, one: string, few: string, many: string)}export const ru = defineLocale({+ catalog: {+ browse: 'Обзор',+ installed: 'Установленные',+ searchSkills: 'Поиск навыков',+ searchPlugins: 'Поиск плагинов',+ allSources: 'Все источники',+ allCategories: 'Все категории',+ about: 'Описание',+ author: 'Автор',+ source: 'Источник',+ category: 'Категория',+ version: 'Версия',+ platforms: 'Платформы',+ requires: 'Требования',+ tools: 'Инструменты',+ hooks: 'Хуки',+ repository: 'Репозиторий',+ documentation: 'Документация',+ noResults: 'Совпадений нет',+ tryAnother: 'Попробуйте другой запрос или сбросьте фильтры.',+ clearFilters: 'Сбросить фильтры',+ loadFailed: 'Не удалось загрузить каталог',+ retry: 'Попробовать снова',+ more: 'Показать ещё',+ pinned: 'Проверенный коммит',+ snapshotHint: 'Из каталога Hermes. При просмотре нет обращений к исходным репозиториям.',+ installHint: 'Проверьте исходный код перед установкой. Изменения применяются к новым сессиям.',+ results: (count: number) =>+ `${count.toLocaleString('ru')} ${RU_PLURAL(count, 'результат', 'результата', 'результатов')}`,+ back: 'Назад к результатам'+ },sessionImport: {title: 'Продолжить из другого приложения',subtitle: 'Перенесите разговор в Hermes и продолжите с того места, где остановились.',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 536d29b0298..e7075541600 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -59,6 +59,36 @@ interface AuxTaskCopy {}export interface Translations {+ catalog: {+ browse: string+ installed: string+ searchSkills: string+ searchPlugins: string+ allSources: string+ allCategories: string+ about: string+ author: string+ source: string+ category: string+ version: string+ platforms: string+ requires: string+ tools: string+ hooks: string+ repository: string+ documentation: string+ noResults: string+ tryAnother: string+ clearFilters: string+ loadFailed: string+ retry: string+ more: string+ pinned: string+ snapshotHint: string+ installHint: string+ results: (count: number) => string+ back: string+ }connectors: {title: stringconnect: stringdiff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.tsindex c434702518b..041dbfad799 100644--- a/apps/desktop/src/i18n/zh-hant.ts+++ b/apps/desktop/src/i18n/zh-hant.ts@@ -3,6 +3,36 @@ import { defineFieldCopy } from '@/app/settings/field-copy'import { defineLocale } from './define-locale'export const zhHant = defineLocale({+ catalog: {+ browse: '瀏覽',+ installed: '已安裝',+ searchSkills: '搜尋技能',+ searchPlugins: '搜尋外掛',+ allSources: '所有來源',+ allCategories: '所有分類',+ about: '簡介',+ author: '作者',+ source: '來源',+ category: '分類',+ version: '版本',+ platforms: '支援的平台',+ requires: '相依項目',+ tools: '工具',+ hooks: '掛鉤',+ repository: '程式碼儲存庫',+ documentation: '文件',+ noResults: '沒有符合的項目',+ tryAnother: '請嘗試其他搜尋或清除篩選條件。',+ clearFilters: '清除篩選條件',+ loadFailed: '無法載入目錄',+ retry: '再試一次',+ more: '顯示更多',+ pinned: '已審核的提交',+ snapshotHint: '內容來自 Hermes 目錄。瀏覽時不會連線至來源程式碼儲存庫。',+ installHint: '安裝前請檢查原始碼。變更將於新的工作階段生效。',+ results: (count: number) => `${count.toLocaleString('zh-Hant')} 個結果`,+ back: '返回結果'+ },sessionImport: {title: '從其他應用程式繼續',subtitle: '將對話匯入 Hermes,接著上次的進度繼續。',diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex 1ab0cf0b686..2b0ba11add2 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -3,6 +3,36 @@ import { defineFieldCopy } from '@/app/settings/field-copy'import { defineLocale } from './define-locale'export const zh = defineLocale({+ catalog: {+ browse: '浏览',+ installed: '已安装',+ searchSkills: '搜索技能',+ searchPlugins: '搜索插件',+ allSources: '所有来源',+ allCategories: '所有分类',+ about: '简介',+ author: '作者',+ source: '来源',+ category: '分类',+ version: '版本',+ platforms: '支持的平台',+ requires: '依赖项',+ tools: '工具',+ hooks: '钩子',+ repository: '代码仓库',+ documentation: '文档',+ noResults: '没有匹配项',+ tryAnother: '请尝试其他搜索或清除筛选条件。',+ clearFilters: '清除筛选条件',+ loadFailed: '无法加载目录',+ retry: '重试',+ more: '显示更多',+ pinned: '已审核的提交',+ snapshotHint: '内容来自 Hermes 目录。浏览时不会连接来源代码仓库。',+ installHint: '安装前请检查源代码。更改将在新会话中生效。',+ results: (count: number) => `${count.toLocaleString('zh')} 个结果`,+ back: '返回结果'+ },connectors: {title: '连接你的应用',connect: '连接',diff --git a/apps/desktop/src/lib/query-client.ts b/apps/desktop/src/lib/query-client.tsindex 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',