The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): pack catalog shelves into an exact-fill bento
Brooklyn Nicholson47057a9e4dad
diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-bento.ts b/apps/desktop/src/app/capabilities/catalog/catalog-bento.tsnew file mode 100644index 00000000000..46899d909cb--- /dev/null+++ b/apps/desktop/src/app/capabilities/catalog/catalog-bento.ts@@ -0,0 +1,89 @@+import type { CatalogCardVariant } from './catalog-card'+import type { CatalogEntry } from './catalog-data'++export const BENTO_COLUMNS = 4++export interface BentoTile {+ entry: CatalogEntry+ variant: CatalogCardVariant+ column: number+ row: number+ w: number+ h: number+}++const weight = (entry: CatalogEntry) =>+ (entry.imageUrl ? 8 : 0) + Math.min(entry.stars ?? 0, 1000) / 1000 + (entry.description ? 0.2 : 0)++/** Pack a section into a `columns`-wide grid that always closes: no holes and+ * no full-width filler.+ *+ * The mix is solved up front rather than discovered by trial placement. Over+ * R rows there are N = columns * R cells, and k cards cover them with s 2x2+ * showcases (pictured cards only), w two-wide cards and c single cells:+ *+ * 4s + 2w + c = N and s + w + c = k => w = N - 3s - k+ *+ * R is the fewest rows that hold every card, up to `maxRows`. Each two-row+ * band can anchor one showcase when the spare cells pay for it (3 each); a+ * section with more cards than cells trades cards for showcases instead and+ * leaves the rest to "See all". Showcases sit on alternating edges, so every+ * row's free run is contiguous and even; filling it wides-first then singles+ * lands exactly on the edge. */+export function packBento(items: CatalogEntry[], columns = BENTO_COLUMNS, maxRows = 3, flip = false): BentoTile[] {+ const ranked = [...items].sort((a, b) => weight(b) - weight(a) || a.name.localeCompare(b.name))++ if (ranked.length < 2) {+ return ranked.map(entry => ({ entry, variant: 'compact', column: 0, row: 0, w: Math.min(2, columns), h: 1 }))+ }++ const rows = Math.min(maxRows, Math.ceil(ranked.length / columns))+ const cells = columns * rows+ const pictured = ranked.filter(entry => entry.imageUrl).length+ const bands = columns >= 4 ? Math.floor(rows / 2) : 0+ const spare = Math.max(0, cells - ranked.length)+ const showcases = Math.min(pictured, bands, ranked.length > cells ? bands : Math.floor(spare / 3))+ const shown = Math.min(ranked.length, cells - 3 * showcases)+ let wides = cells - 3 * showcases - shown++ const queue = ranked.slice(0, shown)+ const heroes = queue.filter(entry => entry.imageUrl).slice(0, showcases)+ const rest = queue.filter(entry => !heroes.includes(entry))+ const occupied = new Set<string>()+ const taken = (column: number, row: number) => occupied.has(`${column},${row}`)++ const claim = (column: number, row: number, w: number, h: number) => {+ for (let y = row; y < row + h; y++) {for (let x = column; x < column + w; x++) {occupied.add(`${x},${y}`)}}+ }++ const tiles: BentoTile[] = heroes.map((entry, band) => {+ const column = (band % 2 === 1) !== flip ? columns - 2 : 0+ claim(column, band * 2, 2, 2)++ return { entry, variant: 'showcase', column, row: band * 2, w: 2, h: 2 }+ })++ for (let row = 0; row < rows; row++) {+ for (let column = 0; column < columns && rest.length; ) {+ if (taken(column, row)) {+ column++++ continue+ }++ let run = 0++ while (column + run < columns && !taken(column + run, row)) {run++}++ const w = wides > 0 && run >= 2 ? 2 : 1+ const entry = rest.shift()!++ if (w === 2) {wides--}+ claim(column, row, w, 1)+ tiles.push({ entry, variant: 'compact', column, row, w, h: 1 })+ column += w+ }+ }++ return tiles.sort((a, b) => a.row - b.row || a.column - b.column)+}diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-browser.tsx b/apps/desktop/src/app/capabilities/catalog/catalog-browser.tsxindex 65f0bddc08d..1cbca308ff1 100644--- a/apps/desktop/src/app/capabilities/catalog/catalog-browser.tsx+++ b/apps/desktop/src/app/capabilities/catalog/catalog-browser.tsx@@ -216,7 +216,7 @@ export const CatalogBrowser = memo(function CatalogBrowser({)}- const card = (entry: CatalogEntry, accentIndex: number, variant: CatalogCardVariant = 'default') => (+ const card = (entry: CatalogEntry, accentIndex: number, variant: CatalogCardVariant = 'default', placement?: React.CSSProperties) => (<CatalogCardaccentIndex={accentIndex}action={entryAction(entry)}@@ -226,6 +226,7 @@ export const CatalogBrowser = memo(function CatalogBrowser({onOpen={openEntry}onSearch={searchFor}onTag={filters.toggleTag}+ style={placement}variant={variant}/>)@@ -310,7 +311,7 @@ export const CatalogBrowser = memo(function CatalogBrowser({</header><CatalogFilterBaractions={actions}- categories={catalogCategories(visible, kind)}+ categories={catalogCategories(visible)}facets={facets}onCategory={filters.toggleCategory}onClear={clearFilters}@@ -354,7 +355,7 @@ export const CatalogBrowser = memo(function CatalogBrowser({<><div className="flex h-full min-h-0 flex-col" data-catalog-cards={kind}><div- className="min-h-0 flex-1 overflow-y-auto overscroll-contain [scrollbar-gutter:stable]"+ className="capabilities-scroll"data-catalog-scrollkey={`${filterKey}:${sort}:${deferredQuery}:${facets.installedOnly}`}>diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-card.tsx b/apps/desktop/src/app/capabilities/catalog/catalog-card.tsxindex 111e60026dd..34589dc124e 100644--- a/apps/desktop/src/app/capabilities/catalog/catalog-card.tsx+++ b/apps/desktop/src/app/capabilities/catalog/catalog-card.tsx@@ -1,12 +1,12 @@import './catalog.css'-import { type ReactNode, useState } from 'react'+import { type CSSProperties, type ReactNode, useState } from 'react'import { RowButton } from '@/components/ui/row-button'import { cn } from '@/lib/utils'import { type CatalogEntry, catalogLabel } from './catalog-data'-import { CatalogDates, CatalogHeaderMeta, CatalogMetadata } from './catalog-metadata'+import { CatalogDates, CatalogHeaderMeta, CatalogMetadata, CatalogRating } from './catalog-metadata'export function catalogIcon(category: string) {const icons: Record<string, string> = {@@ -71,9 +71,10 @@ interface CatalogCardProps {onCategory: (category: string) => voidonTag: (tag: string) => voidonSearch: (value: string) => void+ style?: CSSProperties}-export function CatalogCard({ entry, action, accentIndex, onOpen, onCategory, onTag, onSearch, variant = 'default' }: CatalogCardProps) {+export function CatalogCard({ entry, action, accentIndex, onOpen, onCategory, onTag, onSearch, variant = 'default', style }: CatalogCardProps) {return (<articleclassName={cn(@@ -84,13 +85,14 @@ export function CatalogCard({ entry, action, accentIndex, onOpen, onCategory, ondata-catalog-editorial-art={(variant !== 'hero' && entry.imageUrl?.includes("official-art")) || undefined}data-catalog-variant={variant}data-entry-id={entry.id}+ style={style}>{variant !== 'hero' && entry.imageUrl && ((variant !== 'compact' && variant !== 'showcase') || entry.imageUrl.includes('official-art')) && <CatalogImage className="catalog-card-image aspect-[2/1]" key={entry.imageUrl} src={entry.imageUrl} />}{variant !== 'default' && <div className="catalog-card-topline"><span className="min-w-0 truncate" title={entry.author || catalogLabel(entry.source)}>{entry.author || catalogLabel(entry.source)}</span>{variant !== 'hero' && <span className="relative shrink-0">{action}</span>}</div>}- <div className="catalog-card-copy flex min-h-0 w-full flex-1 flex-col gap-2 p-3">+ <div className="catalog-card-copy flex min-h-0 w-full flex-col gap-2 p-3"><div className="flex min-w-0 items-center gap-2.5">{/* Its ::after stretches over the whole card, so any empty spot opens thedetail; real controls sit above it (`relative`). One focus stop per card. */}@@ -113,6 +115,7 @@ export function CatalogCard({ entry, action, accentIndex, onOpen, onCategory, on{variant === 'default' && <span className="flex w-full items-center gap-2 text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)"><span className="min-w-0 flex-1 truncate">{entry.author || catalogLabel(entry.source)}</span><CatalogHeaderMeta entry={entry} />+ <CatalogRating entry={entry} /></span>}<span className="catalog-card-description line-clamp-4 min-h-0 text-[length:var(--conversation-caption-font-size)] leading-relaxed text-(--ui-text-secondary)">{entry.description}@@ -128,7 +131,15 @@ export function CatalogCard({ entry, action, accentIndex, onOpen, onCategory, ononTag={onTag}/></div>}- {variant !== 'default' && <div className="catalog-card-footer"><CatalogHeaderMeta entry={entry} />{variant === 'hero' && <span className="catalog-hero-action relative shrink-0">{action}</span>}</div>}+ {variant !== 'default' && (+ <div className="catalog-card-footer">+ <CatalogHeaderMeta entry={entry} />+ <span className="flex shrink-0 items-center gap-3">+ <CatalogRating entry={entry} />+ {variant === 'hero' && <span className="catalog-hero-action relative shrink-0">{action}</span>}+ </span>+ </div>+ )}{variant === 'default' && <div className="catalog-card-dates mt-auto px-3 pb-3"><CatalogDates entry={entry} /></div>}diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-data.ts b/apps/desktop/src/app/capabilities/catalog/catalog-data.tsindex 75282320ca8..b806c89d2c1 100644--- a/apps/desktop/src/app/capabilities/catalog/catalog-data.ts+++ b/apps/desktop/src/app/capabilities/catalog/catalog-data.ts@@ -88,9 +88,12 @@ export function parseCatalog(kind: CatalogKind, data: unknown): CatalogEntry[] {continue}- const name = text(row.name)+ const rawName = text(row.name)+ // Registry rows occasionally carry a stray front-matter delimiter ("---")+ // as their name; show the slug instead of a blank title.+ const name = /[\p{L}\p{N}]/u.test(rawName) ? rawName : text(row.identifier) || rawNameconst source = text(kind === 'plugins' ? row.tier : row.source)- const identifier = text(row.identifier) || name+ const identifier = text(row.identifier) || rawNameconst id = `${source}:${identifier}`const caps = row.capabilities ?? {}const category = text(row.category) || 'uncategorized'@@ -118,7 +121,7 @@ export function parseCatalog(kind: CatalogKind, data: unknown): CatalogEntry[] {installIdentifier:kind === 'skills'? skillCatalogInstallIdentifier({- name,+ name: rawName,source,identifier: text(row.identifier),installIdentifier: text(row.installIdentifier)diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-developer.tsx b/apps/desktop/src/app/capabilities/catalog/catalog-developer.tsxnew file mode 100644index 00000000000..4a71146397a--- /dev/null+++ b/apps/desktop/src/app/capabilities/catalog/catalog-developer.tsx@@ -0,0 +1,33 @@+import type { ReactNode } from 'react'++import { Button } from '@/components/ui/button'+import { Codicon } from '@/components/ui/codicon'+import { openExternalLink } from '@/lib/external-link'++import type { CatalogKind } from './catalog-data'++/** One banner for every catalog. The wing, copy and docs links are shared; the page supplies its own management actions. */+export function CatalogDeveloper({ kind, actions }: { kind: CatalogKind; actions?: ReactNode }) {+ return (+ <section data-catalog-section="developer">+ <header className="catalog-section-heading"><h2>Developer Mode</h2></header>+ <div className="catalog-developer">+ <div aria-hidden className="catalog-developer-art" />+ <div className="catalog-developer-content">+ <span aria-hidden className="catalog-developer-mark" />+ <h3>Build for Hermes</h3>+ <p className="text-sm text-(--ui-text-secondary)">Built a tool, connector, plugin, or Mod?<br />Want to but don’t know how?</p>+ <div className="catalog-developer-ctas">+ <Button onClick={() => void openExternalLink('https://github.com/NousResearch/hermes-agent/compare')} size="sm" variant="default">+ Submit Mod<Codicon name="arrow-up-right" />+ </Button>+ <Button onClick={() => void openExternalLink(kind === 'plugins' ? 'https://hermes-agent.nousresearch.com/docs/user-guide/features/plugin-catalog' : 'https://hermes-agent.nousresearch.com/docs/skills/')} size="sm" variant="secondary">+ Developer Docs<Codicon name="arrow-up-right" />+ </Button>+ </div>+ </div>+ </div>+ {actions && <div className="catalog-developer-management">{actions}</div>}+ </section>+ )+}diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-discovery.css b/apps/desktop/src/app/capabilities/catalog/catalog-discovery.cssindex 67f594ebf37..55559ea8c3f 100644--- a/apps/desktop/src/app/capabilities/catalog/catalog-discovery.css+++ b/apps/desktop/src/app/capabilities/catalog/catalog-discovery.css@@ -1,6 +1,6 @@/* Figma Frame 330's geometry, with the existing desktop card and theme surfaces. *//* Reference 121:5782: full-card hard-light artwork, no alpha-mask strip. */-[data-catalog-card][data-catalog-variant] { background: var(--ui-chat-bubble-background); border-color: var(--ui-stroke-tertiary); }+[data-catalog-card][data-catalog-variant] { background: var(--ui-chat-bubble-background); border-color: transparent; }[data-catalog-editorial-art] .catalog-card-description { color: var(--ui-text-primary); }:root:not(.dark) [data-catalog-editorial-art] { --catalog-art-shade: 65%; }[data-catalog-hover-group]:has([data-catalog-card]:hover) [data-catalog-card]:not(:hover) { filter: none; }@@ -8,74 +8,73 @@[data-catalog-card][data-catalog-editorial-art] .catalog-card-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; opacity: 1; filter: grayscale(1); mix-blend-mode: luminosity; }[data-catalog-editorial-art] { --catalog-art-shade: 50%; }:root.dark [data-catalog-editorial-art] { --catalog-art-shade: 72%; }-[data-catalog-editorial-art]::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(to bottom left, color-mix(in srgb, var(--ui-chat-bubble-background) var(--catalog-art-shade), transparent), var(--ui-chat-bubble-background) 78.79%); }-[data-catalog-card][data-catalog-editorial-art][data-catalog-variant=default] { height: auto; min-height: 320px; }-[data-catalog-card][data-catalog-editorial-art] .catalog-card-copy { flex: none; margin-top: auto; background: none; }-[data-catalog-editorial-art] .catalog-card-topline { margin-bottom: 72px; }-[data-catalog-card][data-catalog-editorial-art][data-catalog-variant=horizontal] .catalog-card-image { display: none; }-[data-catalog-editorial-art][data-catalog-variant=horizontal]::before { display: none; }-[data-catalog-editorial-art][data-catalog-variant=horizontal] .catalog-card-copy { margin-top: 0; }-[data-catalog-variant=compact] .catalog-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 20px; }-[data-catalog-variant=compact] .catalog-card-footer > span { width: auto; }+[data-catalog-editorial-art]::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(to bottom, transparent 8%, color-mix(in srgb, var(--ui-chat-bubble-background) var(--catalog-art-shade), transparent) 42%, var(--ui-chat-bubble-background) 92%); }+[data-catalog-card][data-catalog-editorial-art] .catalog-card-copy { flex: none; background: none; }+[data-catalog-card][data-catalog-editorial-art][data-catalog-variant=showcase] .catalog-card-topline { margin-bottom: 72px; }+[data-catalog-variant=compact] .catalog-card-footer { padding-bottom: 20px; }[data-catalog-results] { container-type: inline-size; }-.catalog-search-header { width: 100%; max-width: 1228px; margin-inline: auto; padding: 20px 24px 0; }-.catalog-filter-bar { width: 100%; max-width: 1228px; margin-inline: auto; padding: 16px 24px 8px; }+.catalog-search-header { padding-top: 20px; }+.catalog-filter-bar { padding-block: 16px 8px; }.catalog-filter-row { display: flex; align-items: center; gap: 15px; min-width: 0; }.catalog-filter-chips { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; overflow-x: auto; padding-block: 4px; }.catalog-filter-row > :first-child { flex-shrink: 0; }-.catalog-filter-chips[data-expanded=true] { flex-wrap: wrap; max-height: 24vh; overflow-y: auto; }+.catalog-filter-chips[data-expanded=true] { flex-wrap: wrap; overflow: visible; }.catalog-filter-trigger { display: flex; flex: none; align-items: center; gap: 8px; }-.catalog-card-footer { padding: 0 20px 12px; }-.catalog-card-footer > span { flex-wrap: wrap; width: 100%; }-.catalog-card-footer > span > span:last-child { margin-left: auto; }-.catalog-card-footer [data-slot=badge] { max-width: 55%; }-.catalog-filtered-results { width: 100%; max-width: 1228px; margin-inline: auto; padding-inline: 24px; }-.catalog-discovery { max-width: 1228px; margin-inline: auto; padding: 0 24px 48px; }+.catalog-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px 12px; }+.catalog-card-footer > span:first-child { min-width: 0; width: auto; flex: 1; justify-content: flex-start; }+.catalog-card-footer [data-slot=badge] { max-width: none; }+.catalog-discovery { padding-bottom: 48px; }.catalog-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 48px 20px 20px; }-.catalog-discovery > section:first-child .catalog-section-heading { padding-top: 16px; }+.catalog-discovery > section:first-child .catalog-section-heading { padding-top: 20px; }.catalog-section-heading h2 { margin: 0; font-size: 1.4rem; font-weight: 600; letter-spacing: -.025em; }.catalog-section-heading p { margin: 6px 0 0; font-size: .8125rem; color: var(--ui-text-tertiary); }-.catalog-collection { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }+.catalog-bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; align-items: stretch; }+.catalog-bento > [data-catalog-card] { height: 100%; grid-column: var(--bento-x, auto) / span var(--bento-w, 1); grid-row: var(--bento-y, auto) / span var(--bento-h, 1); }+.catalog-bento > [data-catalog-card] .catalog-card-footer { margin-top: auto; }.catalog-filtered-results > :is(.masonry, .catalog-grid) { grid-template-columns: repeat(4, minmax(0, 1fr)); }-.catalog-collection.catalog-collection-showcase { grid-template-columns: repeat(4, minmax(0, 1fr)); }-.catalog-collection-showcase > * { scroll-snap-align: start; }-.catalog-collection-horizontal { grid-template-columns: repeat(2, minmax(0, 1fr)); }-[data-catalog-card]:not([data-catalog-variant=default]) { min-height: 220px; }+[data-catalog-card]:not([data-catalog-variant=default]) { height: auto; }.catalog-card-topline { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px; font-size: .75rem; color: var(--ui-text-tertiary); }[data-catalog-card]:not([data-catalog-variant=default]) .catalog-card-copy { padding: 0 20px 16px; }[data-catalog-card]:not([data-catalog-variant=default]) .catalog-card-metadata { padding: 0 20px 16px; }[data-catalog-card]:not([data-catalog-variant=default]) .catalog-card-dates { padding: 0 20px 16px; }-[data-catalog-variant=hero] { min-height: 240px !important; isolation: isolate; justify-content: flex-start; padding: 20px; gap: 12px; }+[data-catalog-variant=hero] { isolation: isolate; justify-content: flex-start; padding: 20px; gap: 12px; }[data-catalog-variant=hero] .catalog-card-topline { padding: 0; margin: 0; }[data-catalog-card][data-catalog-variant=hero] .catalog-card-copy { padding: 0; }-[data-catalog-variant=hero] .catalog-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0; margin-top: auto; }-[data-catalog-variant=hero] .catalog-card-footer > span:first-child { width: auto; }+[data-catalog-variant=hero] .catalog-card-footer { padding: 0; }[data-catalog-variant=hero] .catalog-card-footer > .catalog-hero-action { width: auto; margin-left: auto; }[data-catalog-variant=hero]:not([data-catalog-editorial-art]) .catalog-card-image { position: absolute; inset: 0 0 0 auto; width: 42%; height: 100%; object-fit: contain; z-index: -1; }[data-catalog-variant=hero] .catalog-card-copy { flex: none; max-width: 58%; }[data-catalog-variant=hero] .catalog-card-copy button > span { font-size: 2rem; }[data-catalog-variant=hero] .catalog-card-dates { margin-top: 0; }-[data-catalog-card][data-catalog-variant=showcase] { height: 380px; min-height: 380px; display: flex; flex-direction: column; }+[data-catalog-card][data-catalog-variant=showcase] { display: flex; flex-direction: column; }[data-catalog-card] > * { min-width: 0; max-width: 100%; }-[data-catalog-variant=showcase] .catalog-card-topline { padding: 20px; margin-bottom: auto; }-[data-catalog-variant=showcase] .catalog-card-copy { flex: none; margin: 0; padding: 0 20px 16px; }-[data-catalog-variant=showcase] .catalog-card-description { min-height: 3em; -webkit-line-clamp: 2; }-[data-catalog-variant=showcase] .catalog-card-metadata { margin-bottom: auto; }+[data-catalog-variant=showcase] .catalog-card-topline { padding: 20px; }+.catalog-bento:has([data-catalog-editorial-art]) > [data-catalog-card]:not([data-catalog-editorial-art]) .catalog-card-copy { margin-top: auto; }+[data-catalog-variant=showcase] .catalog-card-copy { padding: 0 20px 16px; }+[data-catalog-variant=showcase] .catalog-card-description { -webkit-line-clamp: 2; }+[data-catalog-variant=showcase] .catalog-card-metadata { margin: 0; }[data-catalog-variant=showcase] [data-catalog-metadata] { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; }-[data-catalog-variant=showcase] .catalog-card-footer { grid-row: 4; align-self: end; }+[data-catalog-variant=showcase] .catalog-card-footer { align-self: stretch; }[data-catalog-variant=showcase] .catalog-card-title { font-size: 1.125rem; line-height: 1.4; }[data-catalog-variant=showcase] .catalog-card-metadata { padding-inline: 24px; }[data-catalog-card]:not([data-catalog-variant=default]) .catalog-card-description { -webkit-line-clamp: 3; }-[data-catalog-card][data-catalog-variant=compact] { height: 220px; min-height: 220px; }+[data-catalog-card][data-catalog-variant=compact] { height: auto; }[data-catalog-variant=compact] .catalog-card-topline { margin-bottom: 0; }-[data-catalog-variant=compact] .catalog-card-copy { margin-top: 0; }.catalog-card-topline { flex-shrink: 0; }-[data-catalog-variant=horizontal] { height: 120px; min-height: 120px !important; padding-top: 20px; }-[data-catalog-variant=horizontal] .catalog-card-topline { position: absolute; right: 20px; top: 20px; padding: 0; }+.catalog-feature-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; align-items: stretch; }+.catalog-feature-row > [data-catalog-card] { height: 100%; }+.catalog-feature-row > [data-catalog-card] .catalog-card-copy { margin-top: auto; }+.catalog-feature-row > [data-catalog-card] .catalog-card-description { -webkit-line-clamp: 2; min-height: calc(2lh); }+.catalog-banner-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }+/* Small banner: title and one line of copy left; meta then the switch right. */+[data-catalog-card][data-catalog-variant=horizontal] { flex-direction: row; align-items: center; gap: 12px; min-height: 90px; padding: 0 20px; }+[data-catalog-variant=horizontal] .catalog-card-copy { flex: 1; order: 0; padding: 16px 0; }+[data-catalog-card][data-catalog-variant=horizontal] .catalog-card-copy { padding: 16px 0; }+[data-catalog-variant=horizontal] .catalog-card-title { font-size: 1rem; }+[data-catalog-card][data-catalog-variant=horizontal] .catalog-card-description { -webkit-line-clamp: 1; }+[data-catalog-variant=horizontal] .catalog-card-footer { order: 1; padding: 0; }+[data-catalog-variant=horizontal] .catalog-card-topline { order: 2; padding: 0; }[data-catalog-variant=horizontal] .catalog-card-topline > span:first-child { display: none; }-[data-catalog-variant=horizontal] .catalog-card-copy { padding-right: 40%; }-[data-catalog-variant=horizontal] .catalog-card-footer { position: absolute; right: 20px; bottom: 20px; padding: 0; }-[data-catalog-variant=horizontal] .catalog-card-footer [data-slot=badge] { display: none; }[data-catalog-variant=horizontal] .catalog-card-image { display: none; }.catalog-developer { position: relative; isolation: isolate; aspect-ratio: 3 / 1; min-height: 280px; overflow: hidden; border-radius: var(--radius-lg); background: var(--ui-chat-bubble-background); padding: 32px; }.catalog-developer-art { position: absolute; width: 42%; height: 225%; right: 13%; top: -58%; transform: rotate(48deg); pointer-events: none; background: color-mix(in srgb, var(--color-primary) 70%, transparent); mask: url('../../../assets/catalog-wing-retro.svg') center / contain no-repeat; mask-mode: luminance; mix-blend-mode: multiply; }@@ -87,6 +86,6 @@.catalog-developer-ctas { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 28px; }.catalog-developer-management { display: flex; justify-content: flex-end; gap: 8px; padding-top: 12px; }@container (max-width: 540px) { .catalog-developer { aspect-ratio: auto; padding: 24px; } .catalog-developer-art { right: -15%; background: color-mix(in srgb, var(--color-primary) 30%, transparent); } }-@container (max-width: 960px) { .catalog-collection.catalog-collection-showcase, .catalog-filtered-results > :is(.masonry, .catalog-grid), .catalog-collection { grid-template-columns: repeat(3, minmax(0, 1fr)); } .catalog-collection-horizontal { grid-template-columns: repeat(2, minmax(0, 1fr)); } }-@container (max-width: 720px) { .catalog-collection.catalog-collection-showcase, .catalog-filtered-results > :is(.masonry, .catalog-grid), .catalog-collection { grid-template-columns: repeat(2, minmax(0, 1fr)); } .catalog-section-heading { padding-top: 32px; } .catalog-filter-bar > div:first-child { flex-wrap: wrap; } }-@container (max-width: 440px) { .catalog-collection.catalog-collection-showcase, .catalog-filtered-results > :is(.masonry, .catalog-grid), .catalog-collection { grid-template-columns: minmax(0, 1fr); } .catalog-discovery { padding-inline: 12px; } .catalog-search-header, .catalog-filter-bar { padding-inline: 12px; } [data-catalog-variant=hero] .catalog-card-copy { max-width: 100%; } }+@container (max-width: 960px) { .catalog-bento, .catalog-feature-row, .catalog-filtered-results > :is(.masonry, .catalog-grid) { grid-template-columns: repeat(2, minmax(0, 1fr)); } .catalog-bento { grid-auto-flow: row dense; } .catalog-bento > [data-catalog-card] { grid-column: auto / span var(--bento-w, 1); grid-row: auto / span var(--bento-h, 1); } }+@container (max-width: 720px) { .catalog-bento, .catalog-filtered-results > :is(.masonry, .catalog-grid) { grid-template-columns: repeat(2, minmax(0, 1fr)); } .catalog-banner-list { grid-template-columns: minmax(0, 1fr); } .catalog-section-heading { padding-top: 32px; } .catalog-filter-bar > div:first-child { flex-wrap: wrap; } }+@container (max-width: 440px) { .catalog-bento, .catalog-feature-row, .catalog-filtered-results > :is(.masonry, .catalog-grid) { grid-template-columns: minmax(0, 1fr); } .catalog-bento > [data-catalog-card] { grid-column: auto; grid-row: auto; } [data-catalog-variant=hero] .catalog-card-copy { max-width: 100%; } }diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-discovery.tsx b/apps/desktop/src/app/capabilities/catalog/catalog-discovery.tsxindex 0214b030449..ab50cf0bb3d 100644--- a/apps/desktop/src/app/capabilities/catalog/catalog-discovery.tsx+++ b/apps/desktop/src/app/capabilities/catalog/catalog-discovery.tsx@@ -6,24 +6,29 @@ import { type ReactNode, useState } from 'react'import { Button } from '@/components/ui/button'import { Codicon } from '@/components/ui/codicon'import { useI18n } from '@/i18n'-import { openExternalLink } from '@/lib/external-link'+import { BENTO_COLUMNS, packBento } from './catalog-bento'import type { CatalogCardVariant } from './catalog-card'import { type CatalogEntry, type CatalogKind, catalogLabel } from './catalog-data'+import { CatalogDeveloper } from './catalog-developer'import { catalogCategories } from './catalog-query'// Reviewed catalog identifiers, not an inferred recommendation or download metric.const FEATURED = { plugins: 'hindsight', skills: 'claude-code' } as const+/** Fewest cards a category needs for its own shelf; smaller ones share "More to explore". */+const MIN_SHELF = 3+export function CatalogDiscovery({ entries, kind, card, onCategory, actions }: {entries: CatalogEntry[]kind: CatalogKind- card: (entry: CatalogEntry, index: number, variant: CatalogCardVariant) => ReactNode+ card: (entry: CatalogEntry, index: number, variant: CatalogCardVariant, placement?: React.CSSProperties) => ReactNodeonCategory: (category: string) => voidactions?: ReactNode}) {const { t } = useI18n()const [categoryLimit, setCategoryLimit] = useState(8)+ const [looseRows, setLooseRows] = useState(3)const title = kind === 'plugins' ? t.skills.tabPlugins : t.skills.tabSkillsconst featured = entries.find(entry => entry.identifier === FEATURED[kind])@@ -32,14 +37,27 @@ export function CatalogDiscovery({ entries, kind, card, onCategory, actions }: {const remaining = entries.filter(entry => entry !== featured)// Plugins with an unlisted category land in `general`, as in every other plugin grouping.- const sections: [string, string, CatalogEntry[]][] =+ const sections: [string, string, CatalogEntry[]][] = (kind === 'plugins'- ? groupCatalogPlugins(remaining).map(([key, items]) => [key, PLUGIN_CATEGORIES[key].label, items])- : catalogCategories(remaining, kind).map(([key, meta]) => [- key,- meta.label,- remaining.filter(entry => entry.category === key)- ])+ ? groupCatalogPlugins(remaining).map(([key, items]) => [key, PLUGIN_CATEGORIES[key].label, items] as [string, string, CatalogEntry[]])+ : catalogCategories(remaining).map(([key, meta]) => [key, meta.label, remaining.filter(entry => entry.category === key)] as [string, string, CatalogEntry[]])+ ).sort((a, b) => Number(b[2].some(entry => entry.imageUrl)) - Number(a[2].some(entry => entry.imageUrl)))++ // A category too small to fill a row reads as a stray full-width strip; those+ // fold into one mixed shelf at the end instead.+ const shelves = sections.filter(([, , items]) => items.length >= MIN_SHELF)+ const loose = sections.filter(([, , items]) => items.length < MIN_SHELF).flatMap(([, , items]) => items)++ const bento = (items: CatalogEntry[], rows?: number, flip = false) => (+ <div className="catalog-bento" data-catalog-hover-group>+ {packBento(items, BENTO_COLUMNS, rows, flip).map(tile => card(tile.entry, tile.row, tile.variant, {+ '--bento-x': tile.column + 1,+ '--bento-y': tile.row + 1,+ '--bento-w': tile.w,+ '--bento-h': tile.h+ } as React.CSSProperties))}+ </div>+ )return (<div className="catalog-discovery">@@ -47,40 +65,30 @@ export function CatalogDiscovery({ entries, kind, card, onCategory, actions }: {<header className="catalog-section-heading"><h2>{t.catalog.discover} {title}</h2></header>{card(featured, 0, 'hero')}</section>}- {sections.slice(0, categoryLimit).map(([category, label, items], sectionIndex) => {- const variant: CatalogCardVariant = items.slice(0, 4).some(entry => entry.imageUrl) || sectionIndex % 3 === 0 ? 'showcase' : sectionIndex % 3 === 2 ? 'horizontal' : 'compact'-+ {shelves.slice(0, categoryLimit).map(([category, label, items], index) => {return <section data-catalog-section={category} key={category}><header className="catalog-section-heading">- <div><h2>{catalogLabel(label)}</h2><p>{kind === 'plugins' ? PLUGIN_CATEGORIES[category]?.blurb : `Skills for ${catalogLabel(label).toLowerCase()}.`}</p></div>- <Button onClick={() => onCategory(category)} size="inline" variant="text">{t.catalog.seeAll}<Codicon name="arrow-right" /></Button>+ <div>+ <h2><Button className="text-[length:inherit] font-[inherit] text-(--ui-text-primary) hover:text-(--ui-text-primary)" onClick={() => onCategory(category)} size="inline" variant="text">{catalogLabel(label)}</Button></h2>+ <p>{kind === 'plugins' ? PLUGIN_CATEGORIES[category]?.blurb : `Skills for ${catalogLabel(label).toLowerCase()}.`}</p>+ </div>+ {items.length > packBento(items).length && <Button onClick={() => onCategory(category)} size="inline" variant="text">{t.catalog.seeAll}<Codicon name="arrow-right" /></Button>}</header>- <div className={`catalog-collection catalog-collection-${variant}`} data-catalog-hover-group>- {items.slice(0, variant === 'showcase' ? 4 : variant === 'horizontal' ? 6 : kind === 'plugins' ? 12 : 8).map((entry, index) => card(entry, sectionIndex + index, variant))}- </div>+ {bento(items, undefined, index % 2 === 1)}</section>})}- {sections.length > categoryLimit && <Button onClick={() => setCategoryLimit(value => value + 8)} size="sm" variant="text">{t.catalog.more}</Button>}- <section data-catalog-section="developer">- <header className="catalog-section-heading"><h2>Developer Mode</h2></header>- <div className="catalog-developer">- <div aria-hidden className="catalog-developer-art" />- <div className="catalog-developer-content">- <span aria-hidden className="catalog-developer-mark" />- <h3>Build for Hermes</h3>- <p className="text-sm text-(--ui-text-secondary)">Built a tool, connector, plugin, or Mod?<br />Want to but don’t know how?</p>- <div className="catalog-developer-ctas">- <Button onClick={() => void openExternalLink('https://github.com/NousResearch/hermes-agent/compare')} size="sm" variant="default">- Submit Mod<Codicon name="arrow-up-right" />- </Button>- <Button onClick={() => void openExternalLink(kind === 'plugins' ? 'https://hermes-agent.nousresearch.com/docs/user-guide/features/plugin-catalog' : 'https://hermes-agent.nousresearch.com/docs/skills/')} size="sm" variant="secondary">- Developer Docs<Codicon name="arrow-up-right" />- </Button>- </div>+ {shelves.length > categoryLimit && <Button onClick={() => setCategoryLimit(value => value + 8)} size="sm" variant="text">{t.catalog.more}</Button>}+ {loose.length > 0 && shelves.length <= categoryLimit && <section data-catalog-section="more">+ <header className="catalog-section-heading">+ <div>+ <h2>More to explore</h2>+ <p>Smaller corners of the catalog, all in one place.</p></div>- </div>- {actions && <div className="catalog-developer-management">{actions}</div>}- </section>+ </header>+ {bento(loose, looseRows)}+ {loose.length > packBento(loose, BENTO_COLUMNS, looseRows).length && <Button className="mt-4" onClick={() => setLooseRows(value => value + 3)} size="sm" variant="text">{t.catalog.more}</Button>}+ </section>}+ <CatalogDeveloper actions={actions} kind={kind} /></div>)}diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-filter-bar.tsx b/apps/desktop/src/app/capabilities/catalog/catalog-filter-bar.tsxindex 34cd45d2ab3..253855b3d1b 100644--- a/apps/desktop/src/app/capabilities/catalog/catalog-filter-bar.tsx+++ b/apps/desktop/src/app/capabilities/catalog/catalog-filter-bar.tsx@@ -31,7 +31,7 @@ export function CatalogFilterBar(props: CatalogFilterBarProps) {const panelId = useId()const [mode, setMode] = useState<'categories' | 'sources'>('categories')const [expanded, setExpanded] = useState(false)- const [more, setMore] = useState(false)+ const [allChips, setAllChips] = useState(false)const rows = mode === 'categories'? props.categories.map(([value, meta]) => ({ value, label: catalogLabel(meta.label) }))@@ -47,16 +47,11 @@ export function CatalogFilterBar(props: CatalogFilterBarProps) {<div className="catalog-filter-bar" data-catalog-filters><div className="catalog-filter-row"><SegmentedControl onChange={setMode} options={[{ id: 'categories', label: c.category, icon: IconCategory }, { id: 'sources', label: c.source, icon: IconDatabase }]} value={mode} />- <div className="catalog-filter-chips" data-expanded={false}>+ <div className="catalog-filter-chips" data-expanded={allChips}><Button aria-pressed={!selected.length} onClick={() => onSelect(null)} size="xs" variant={!selected.length ? 'default' : 'outline'}>{t.skills.all}</Button><span aria-hidden className="px-1 text-(--ui-text-quaternary)">/</span>- {visible.map(row => <Button aria-pressed={selected.includes(row.value)} key={row.value} onClick={() => onSelect(row.value)} size="xs" variant={selected.includes(row.value) ? 'default' : 'outline'}>{row.label}</Button>)}- {overflow.length > 0 && <Popover onOpenChange={setMore} open={more}>- <PopoverTrigger asChild><Button aria-label={c.more} size="xs" variant="secondary">{`+${overflow.length}`}</Button></PopoverTrigger>- <PopoverContent align="start" className="w-72 max-h-80 overflow-y-auto p-2" variant="menu">- <div className="flex flex-wrap gap-1.5">{overflow.map(row => <Button aria-pressed={selected.includes(row.value)} key={row.value} onClick={() => onSelect(row.value)} size="xs" variant={selected.includes(row.value) ? 'default' : 'outline'}>{row.label}</Button>)}</div>- </PopoverContent>- </Popover>}+ {(allChips ? rows : visible).map(row => <Button aria-pressed={selected.includes(row.value)} key={row.value} onClick={() => onSelect(row.value)} size="xs" variant={selected.includes(row.value) ? 'default' : 'outline'}>{row.label}</Button>)}+ {!allChips && overflow.length > 0 && <Button aria-expanded={false} aria-label={c.more} onClick={() => setAllChips(true)} size="xs" variant="secondary">{`+${overflow.length}`}</Button>}</div><div className="catalog-filter-trigger"><span className="text-[0.625rem] font-medium uppercase tracking-wider text-(--ui-text-tertiary)" id={`${panelId}-label`}>{c.filters}{activeCount > 0 && ` · ${activeCount}`}</span>diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-metadata.tsx b/apps/desktop/src/app/capabilities/catalog/catalog-metadata.tsxnew file mode 100644index 00000000000..75ad6bbd2ab--- /dev/null+++ b/apps/desktop/src/app/capabilities/catalog/catalog-metadata.tsx@@ -0,0 +1,194 @@+import { compactNumber } from '@hermes/shared'+import { useState } from 'react'++import { Badge } from '@/components/ui/badge'+import { Button } from '@/components/ui/button'+import { Codicon } from '@/components/ui/codicon'+import { Tip } from '@/components/ui/tooltip'+import { useI18n } from '@/i18n'+import { fmtDateTime, relativeTime } from '@/lib/time'++import { type CatalogEntry, catalogLabel } from './catalog-data'++interface CatalogMetadataProps {+ entry: CatalogEntry+ onCategory?: (category: string) => void+ onTag?: (tag: string) => void+ /** Values without a facet (platforms, tools, env vars) browse by search. */+ onSearch?: (value: string) => void+ /** Capability counts open the entry, where each value is listed. */+ onOpen?: () => void+ /** Details show everything; cards can disclose the rest without opening. */+ limit?: number+}++interface CatalogChip {+ id: string+ label: string+ hint?: string+ quiet?: boolean+ onClick?: () => void+}++/** Source and version, leading the card footer. Stars sit opposite them. */+export function CatalogHeaderMeta({ entry }: { entry: CatalogEntry }) {+ return (+ <span className="flex min-w-0 items-center justify-start gap-1">+ {entry.source && (+ <Badge className="max-w-full" size="xs" variant="muted">+ <span className="truncate">{catalogLabel(entry.source)}</span>+ </Badge>+ )}+ {entry.version && (+ <Badge size="xs" variant="muted">+ v{entry.version}+ </Badge>+ )}+ </span>+ )+}++export function CatalogRating({ entry }: { entry: CatalogEntry }) {+ if (entry.stars === null || entry.stars <= 0) {return null}++ return (+ <span className="flex shrink-0 items-center gap-0.5 text-[0.65rem] text-(--ui-text-tertiary)">+ <Codicon name="star-full" size="0.65rem" />+ {compactNumber(entry.stars)}+ </span>+ )+}++/** One metadata projection for Skills and Plugins, in cards, lists and details. */+export function CatalogMetadata({ entry, onCategory, onTag, onSearch, onOpen, limit }: CatalogMetadataProps) {+ const { t } = useI18n()+ const c = t.catalog+ const [expanded, setExpanded] = useState(false)+ const interactive = Boolean(onCategory || onTag)+ const tags = [...new Set(entry.tags)]+ const search = (value: string) => (onSearch ? () => onSearch(value) : undefined)++ const primary: CatalogChip[] = [+ {+ id: 'category',+ label: catalogLabel(entry.categoryLabel),+ onClick: onCategory ? () => onCategory(entry.category) : undefined+ },+ ...entry.platforms.map(value => ({+ id: `platform:${value}`,+ label: value === 'macos' ? 'macOS' : catalogLabel(value),+ quiet: true,+ onClick: search(value)+ }))+ ]++ const capabilities = [+ { id: 'tools', label: c.tools, values: entry.tools },+ { id: 'hooks', label: c.hooks, values: entry.hooks },+ { id: 'middleware', label: c.middleware, values: entry.middleware ?? [] }+ ]++ const primaryLabels = new Set(primary.map(chip => chip.label.trim().toLowerCase()))++ for (const chip of primary) {+ const matchingTag = tags.find(tag => tag.trim().toLowerCase() === chip.label.trim().toLowerCase())++ if (matchingTag && onTag && (chip.quiet || !chip.onClick)) {+ chip.onClick = () => onTag(matchingTag)+ }+ }++ const secondary: CatalogChip[] = [+ ...capabilities+ .filter(group => group.values.length)+ .map(group => ({ id: group.id, label: `${group.label} ${group.values.length}`, quiet: true, onClick: onOpen })),+ ...tags+ .filter(value => !primaryLabels.has(value.trim().toLowerCase()))+ .map(value => ({ id: `tag:${value}`, label: value, onClick: onTag ? () => onTag(value) : undefined })),+ ...entry.requirements.map(value => ({+ id: `env:${value}`,+ label: value,+ hint: c.requires,+ quiet: true,+ onClick: search(value)+ }))+ ]++ const commands = (entry.commands ?? []).map(value => `/${value.replace(/^\//, '')}`)+ const visible = expanded ? secondary : secondary.slice(0, limit ?? 1)+ const remaining = secondary.length - visible.length++ const chip = ({ id, label, hint, quiet, onClick }: CatalogChip) => {+ const content = onClick ? (+ <Button className="max-w-full" onClick={onClick} size="xs" variant={quiet ? 'ghost' : 'chip'}>+ <span className="truncate">{label}</span>+ </Button>+ ) : (+ <Badge className="max-w-full" variant="muted">+ <span className="truncate">{label}</span>+ </Badge>+ )++ return hint ? (+ <Tip key={id} label={hint}>+ {content}+ </Tip>+ ) : (+ <span className="inline-flex max-w-full" key={id}>+ {content}+ </span>+ )+ }++ return (+ <span className="flex flex-col gap-2" data-catalog-metadata>+ <span className="flex flex-wrap items-center gap-1">{primary.filter(item => item.label).map(chip)}</span>+ {secondary.length > 0 && (+ <span className="flex flex-wrap items-center gap-1" data-catalog-tags>+ {visible.map(chip)}+ {remaining > 0 &&+ (interactive ? (+ <Button+ aria-label={`${c.more} (${remaining})`}+ onClick={() => setExpanded(true)}+ size="xs"+ variant="ghost"+ >+ +{remaining}+ </Button>+ ) : (+ <Badge variant="muted">+{remaining}</Badge>+ ))}+ </span>+ )}+ {commands.length > 0 && (+ <span className="truncate font-mono text-[0.65rem] text-(--ui-text-tertiary)" data-catalog-commands>+ {commands.join(' ')}+ </span>+ )}+ </span>+ )+}++export function CatalogDates({ entry }: { entry: CatalogEntry }) {+ const { t } = useI18n()++ const dates = [+ { label: t.catalog.addedDate, value: entry.addedAt },+ { label: t.catalog.updatedDate, value: entry.updatedAt !== entry.addedAt ? entry.updatedAt : undefined }+ ].filter((date): date is { label: string; value: string } => Boolean(date.value))++ if (!dates.length) {+ return null+ }++ return (+ <span className="flex flex-wrap gap-x-2 gap-y-1 text-[0.65rem] text-(--ui-text-tertiary)">+ {dates.map(({ label, value }) => (+ <time dateTime={value} key={label} title={fmtDateTime.format(Date.parse(value))}>+ {label} {relativeTime(Date.parse(value))}+ </time>+ ))}+ </span>+ )+}diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-query.ts b/apps/desktop/src/app/capabilities/catalog/catalog-query.tsnew file mode 100644index 00000000000..4d446fea664--- /dev/null+++ b/apps/desktop/src/app/capabilities/catalog/catalog-query.ts@@ -0,0 +1,123 @@+import { sortCatalogPlugins } from '@hermes/shared'++import type { CatalogEntry, CatalogKind } from './catalog-data'+import type { FacetRow } from './catalog-filters'++export type CatalogSort = 'discover' | 'stars' | 'newest' | 'updated' | 'name'++export interface CatalogFacets {+ sources: string[]+ categories: string[]+ tags: string[]+ installedOnly: boolean+}++export const EMPTY_FACETS: CatalogFacets = { sources: [], categories: [], tags: [], installedOnly: false }++export const catalogSources = (entries: CatalogEntry[]) => [...new Set(entries.map(entry => entry.source))]++/** Category facet rows with counts, A–Z with "Other" last. */+export function catalogCategories(entries: CatalogEntry[]) {+ const values = new Map<string, { label: string; count: number }>()++ for (const entry of entries) {+ values.set(entry.category, { label: entry.categoryLabel, count: (values.get(entry.category)?.count ?? 0) + 1 })+ }++ return [...values].sort((a, b) => categoryRank(a) - categoryRank(b) || a[1].label.localeCompare(b[1].label))+}++const categoryRank = (row: [string, { label: string }]) => (row[0] === 'other' || row[1].label.toLowerCase() === 'other' ? 1 : 0)++/** The most common tags plus whatever is selected; search covers the long tail. */+export function catalogTags(entries: CatalogEntry[], selected: string[], limit: number): FacetRow[] {+ const counts = new Map<string, number>()++ for (const entry of entries) {+ for (const value of new Set(entry.tags)) {+ counts.set(value, (counts.get(value) ?? 0) + 1)+ }+ }++ const ranked = [...counts].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))+ const shown = new Set([...ranked.slice(0, limit).map(([value]) => value), ...selected])++ return ranked.filter(([value]) => shown.has(value)).map(([value, count]) => ({ value, label: value, count }))+}++/** Facets combine as AND across groups and OR within one. */+export function filterCatalog(+ entries: CatalogEntry[],+ facets: CatalogFacets,+ query: string,+ isInstalled: (entry: CatalogEntry) => boolean+) {+ const { sources, categories, tags, installedOnly } = facets++ return entries.filter(+ entry =>+ (!sources.length || sources.includes(entry.source)) &&+ (!categories.length || categories.includes(entry.category)) &&+ (!tags.length || tags.some(tag => entry.tags.includes(tag))) &&+ (!installedOnly || isInstalled(entry)) &&+ (!query || entry.search.includes(query))+ )+}++/** Returns a new array; `discover` keeps the feed's curated order. */+export function sortCatalog(entries: CatalogEntry[], sort: CatalogSort, kind: CatalogKind) {+ if (sort === 'discover') {+ return entries+ }++ if (kind === 'plugins' && sort !== 'name') {+ return sortCatalogPlugins(entries, sort)+ }++ if (sort === 'name') {+ return [...entries].sort((a, b) => a.name.localeCompare(b.name))+ }++ if (sort === 'stars') {+ return [...entries].sort((a, b) => (b.stars ?? -1) - (a.stars ?? -1) || a.name.localeCompare(b.name))+ }++ const field = sort === 'newest' ? 'addedAt' : 'updatedAt'+ const time = new Map(entries.map(entry => [entry.id, Date.parse(entry[field] ?? '') || 0]))++ return [...entries].sort((a, b) => time.get(b.id)! - time.get(a.id)! || a.name.localeCompare(b.name))+}++/** First `limit` entries sharing a category or tag with `entry`; stops early on large feeds. */+export function relatedEntries(entries: CatalogEntry[], entry: CatalogEntry, limit: number) {+ const matches: CatalogEntry[] = []++ for (const candidate of entries) {+ if (matches.length === limit) {+ break+ }++ if (+ candidate.id !== entry.id &&+ (candidate.category === entry.category || candidate.tags.some(tag => entry.tags.includes(tag)))+ ) {+ matches.push(candidate)+ }+ }++ return matches+}++export function catalogSortOptions(entries: CatalogEntry[], kind: CatalogKind, labels: Record<CatalogSort, string>) {+ const available: Record<CatalogSort, boolean> = {+ discover: kind === 'skills',+ stars: entries.some(entry => entry.stars !== null),+ newest: entries.some(entry => entry.addedAt),+ updated: entries.some(entry => entry.updatedAt),+ name: kind === 'skills'+ }++ return (Object.keys(available) as CatalogSort[])+ .filter(value => available[value])+ .map(value => ({ value, label: labels[value] }))+}diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-switch.tsx b/apps/desktop/src/app/capabilities/catalog/catalog-switch.tsxindex adffdd15cc2..0934dfec480 100644--- a/apps/desktop/src/app/capabilities/catalog/catalog-switch.tsx+++ b/apps/desktop/src/app/capabilities/catalog/catalog-switch.tsx@@ -3,13 +3,17 @@ import { type ComponentProps, useId } from 'react'import { Switch } from '@/components/ui/switch'import { useI18n } from '@/i18n'-/** Visible action copy stays attached to the actual controlled switch. */+/** Visible action copy stays attached to the actual controlled switch. Both+ * labels share one grid cell so the control never shifts when it flips. */export function CatalogSwitch(props: ComponentProps<typeof Switch>) {const id = useId()const { t } = useI18n()return <label className="catalog-switch relative inline-flex shrink-0 items-center gap-2 text-xs text-(--ui-text-secondary)" htmlFor={id}>- <span>{props.checked ? t.settings.plugins.disable : t.settings.plugins.enable}</span>+ <span className="grid justify-items-end [&>*]:col-start-1 [&>*]:row-start-1">+ <span className={props.checked ? undefined : 'invisible'}>{t.settings.plugins.disable}</span>+ <span className={props.checked ? 'invisible' : undefined}>{t.settings.plugins.enable}</span>+ </span><Switch {...props} id={id} /></label>}