Skip to content

The agent that grows with you

feat(desktop): lay out Tools as a catalog page

Brooklyn Nicholsonabb80a454471
diff --git a/apps/desktop/src/app/capabilities/index.test.tsx b/apps/desktop/src/app/capabilities/index.test.tsx
index 825b7f9a23e..f288c4bce83 100644
--- a/apps/desktop/src/app/capabilities/index.test.tsx
+++ b/apps/desktop/src/app/capabilities/index.test.tsx
@@ -349,6 +349,11 @@ describe('CapabilitiesView toolset management', { timeout: 60_000 }, () => {
await renderSkills()
+ // Toolset settings open in a dialog from the toolset's card.
+ await act(async () => {
+ fireEvent.click(await screen.findByRole('button', { name: 'Vision / Image Analysis' }))
+ })
+
const link = await screen.findByRole('button', { name: /Choose vision model in Settings/ })
await act(async () => {
diff --git a/apps/desktop/src/app/capabilities/toolsets/toolsets-data.ts b/apps/desktop/src/app/capabilities/toolsets/toolsets-data.ts
index 568e74a6328..e789a557bde 100644
--- a/apps/desktop/src/app/capabilities/toolsets/toolsets-data.ts
+++ b/apps/desktop/src/app/capabilities/toolsets/toolsets-data.ts
@@ -29,6 +29,42 @@ export function useToolsetsQuery(profile: ProfileScope) {
export const toolsetCalls = (toolset: ToolsetInfo, toolCalls: Record<string, number>): number =>
toolNames(toolset).reduce((sum, name) => sum + (toolCalls[name] ?? 0), 0)
+/** Browsing groups for the Tools page, by what a toolset lets the agent do.
+ * Toolsets not named here land in the trailing "More tools" group. */
+export const TOOLSET_THEMES: ReadonlyArray<{ id: string; label: string; blurb: string; names: readonly string[] }> = [
+ {
+ id: 'work',
+ label: 'Browse, work and automate',
+ blurb: 'Drive the browser and desktop, edit files, run code and schedule work.',
+ names: ['browser', 'computer_use', 'web', 'terminal', 'file', 'code_execution', 'cronjob', 'kanban', 'delegation', 'todo', 'clarify']
+ },
+ {
+ id: 'create',
+ label: 'See, hear and create',
+ blurb: 'Look at images and video, transcribe voice and generate media.',
+ names: ['vision', 'video', 'stt', 'tts', 'image_gen', 'video_gen']
+ },
+ {
+ id: 'recall',
+ label: 'Memory and knowledge',
+ blurb: 'What Hermes remembers, and the skills and history it can search.',
+ names: ['memory', 'session_search', 'skills']
+ },
+ {
+ id: 'connect',
+ label: 'Connect and reach out',
+ blurb: 'Accounts, other agents, the smart home and search beyond the web.',
+ names: ['connections', 'a2a', 'homeassistant', 'x_search', 'messaging', 'spotify']
+ }
+]
+
+export const TOOLSET_MORE_THEME = { id: 'more', label: 'More tools', blurb: 'Everything else this profile can switch on.' }
+
+/** The feature row before there's usage to rank by. */
+export const TOOLSET_ESSENTIALS: readonly string[] = ['browser', 'file', 'code_execution', 'memory']
+
+export const toolsetTheme = (name: string) => TOOLSET_THEMES.find(theme => theme.names.includes(name)) ?? TOOLSET_MORE_THEME
+
export function filteredToolsets(
toolsets: ToolsetInfo[],
query: string,
diff --git a/apps/desktop/src/app/capabilities/toolsets/toolsets-tab.tsx b/apps/desktop/src/app/capabilities/toolsets/toolsets-tab.tsx
index cb978c5981e..32663cbab76 100644
--- a/apps/desktop/src/app/capabilities/toolsets/toolsets-tab.tsx
+++ b/apps/desktop/src/app/capabilities/toolsets/toolsets-tab.tsx
@@ -1,36 +1,32 @@
import { compactNumber } from '@hermes/shared'
-import { useStore } from '@nanostores/react'
import { useCallback, useMemo, useState } from 'react'
-import { CountSkeleton } from '@/components/ui/skeleton'
+import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog'
import { type ProfileScope, setToolsetEnabled } from '@/hermes'
import { useI18n } from '@/i18n'
import { isDesktopToolsetVisible } from '@/lib/desktop-toolsets'
-import { Codecs, persistentAtom } from '@/lib/persisted'
import { queryClient } from '@/lib/query-client'
import { invalidateSlashCompletions } from '@/lib/slash-completion-cache'
import { notify, notifyError } from '@/store/notifications'
import type { ToolsetInfo } from '@/types/hermes'
-import {
- CapRow,
- DetailColumn,
- ListColumn,
- ListStrip,
- ListStripMenu,
- type ListStripMenuToggle,
- MasterDetail
-} from '../../master-detail'
import { asText, toolNames, toolsetDisplayLabel } from '../../settings/helpers'
-import { CapabilityEmpty, SortButton } from '../primitives'
+import { CatalogSwitch } from '../catalog/catalog-switch'
+import { CapabilityEmpty } from '../primitives'
+import { CatalogSurface, type CatalogSurfaceItem, type CatalogSurfaceSection } from '../ui/catalog-surface'
import { useToolCalls } from './tool-calls'
import { ToolsetDetail } from './toolset-detail'
-import { filteredToolsets, toolsetCalls, TOOLSETS_QUERY_KEY, toolsetsQueryKey } from './toolsets-data'
-
-// Sort direction for the Tools list — persisted so the tab remembers
-// most/least-used across navigations and restarts.
-const $toolsetsSortDesc = persistentAtom('hermes.desktop.capabilities.toolsetsSortDesc', true, Codecs.bool)
+import {
+ filteredToolsets,
+ TOOLSET_ESSENTIALS,
+ TOOLSET_MORE_THEME,
+ TOOLSET_THEMES,
+ toolsetCalls,
+ toolsetTheme,
+ TOOLSETS_QUERY_KEY,
+ toolsetsQueryKey
+} from './toolsets-data'
interface ToolsetsTabProps {
/** The scope's toolset list, straight from the shell's query. */
@@ -40,11 +36,10 @@ interface ToolsetsTabProps {
query: string
}
-/** THE Tools tab: the toolset list with its usage badges, and the inspector
- * that mounts each toolset's settings panels. */
+/** THE Tools tab: toolsets as a catalog (feature row, themed lists, developer
+ * banner) with each toolset's settings in a dialog. */
export function ToolsetsTab({ profile, query, toolsets }: ToolsetsTabProps) {
const { t } = useI18n()
- const toolsetsSortDesc = useStore($toolsetsSortDesc)
const toolCalls = useToolCalls(profile)
const [bulkBusy, setBulkBusy] = useState(false)
const [selectedToolset, setSelectedToolset] = useState<string | null>(null)
@@ -61,10 +56,10 @@ export function ToolsetsTab({ profile, query, toolsets }: ToolsetsTabProps) {
void queryClient.invalidateQueries({ queryKey: TOOLSETS_QUERY_KEY })
}, [])
- // Absent counts sort the list A–Z until the analytics scan lands.
+ // Most-used first; absent counts sort A–Z until the analytics scan lands.
const visibleToolsets = useMemo(
- () => filteredToolsets(toolsets, query, toolCalls ?? {}, toolsetsSortDesc),
- [query, toolCalls, toolsets, toolsetsSortDesc]
+ () => filteredToolsets(toolsets, query, toolCalls ?? {}, true),
+ [query, toolCalls, toolsets]
)
// Bulk actions and the master-switch state target the WHOLE tab, never the
@@ -72,10 +67,9 @@ export function ToolsetsTab({ profile, query, toolsets }: ToolsetsTabProps) {
// current query would be a lie.
const bulkToolsets = useMemo(() => toolsets.filter(ts => isDesktopToolsetVisible(ts.name)), [toolsets])
- // Keep a valid selection: fall back to the first visible row when the
- // current selection is filtered out (or nothing is selected yet).
+ // The dialog's toolset; null when closed or when search filters it out.
const activeToolset = useMemo(
- () => visibleToolsets.find(ts => ts.name === selectedToolset) ?? visibleToolsets[0] ?? null,
+ () => visibleToolsets.find(ts => ts.name === selectedToolset) ?? null,
[selectedToolset, visibleToolsets]
)
@@ -127,70 +121,80 @@ export function ToolsetsTab({ profile, query, toolsets }: ToolsetsTabProps) {
}
}
- // One switch line covering enable-all/disable-all.
- const bulkSwitch: ListStripMenuToggle = {
- checked: bulkToolsets.length > 0 && bulkToolsets.every(ts => ts.enabled),
- disabled: bulkBusy,
- label: t.skills.all,
- onToggle: checked =>
- void bulkApply(
- bulkToolsets.filter(row => row.enabled !== checked),
- checked
- )
- }
-
if (visibleToolsets.length === 0) {
return <CapabilityEmpty noun="tools" query={query} />
}
+ const item = (toolset: ToolsetInfo, layout: CatalogSurfaceSection['layout']): CatalogSurfaceItem => {
+ const calls = toolCalls ? toolsetCalls(toolset, toolCalls) : 0
+ const count = toolNames(toolset).length
+ const tools = `${count} ${count === 1 ? 'tool' : 'tools'}`
+ const label = toolsetDisplayLabel(toolset)
+
+ return {
+ id: toolset.name,
+ name: label,
+ description: asText(toolset.description),
+ eyebrow: count ? tools : undefined,
+ badge: calls > 0 ? `${compactNumber(calls)} ${calls === 1 ? 'call' : 'calls'}` : layout === 'list' && count ? tools : undefined,
+ action: (
+ <CatalogSwitch
+ aria-label={t.skills.toggleToolset(label, !toolset.enabled)}
+ checked={toolset.enabled}
+ disabled={bulkBusy}
+ onCheckedChange={checked => void handleToggleToolset(toolset, checked)}
+ />
+ ),
+ onOpen: () => setSelectedToolset(toolset.name)
+ }
+ }
+
+ // The feature row is the four most-used toolsets once there is real usage to
+ // rank by; before that it's the essentials. Everything else sits under what it does.
+ const used = visibleToolsets.slice(0, 4)
+ const ranked = !!toolCalls && used.length === 4 && used.every(toolset => toolsetCalls(toolset, toolCalls) > 0)
+ const featured = query || visibleToolsets.length <= 8 ? [] : ranked ? used : visibleToolsets.filter(toolset => TOOLSET_ESSENTIALS.includes(toolset.name))
+ const rest = visibleToolsets.filter(toolset => !featured.includes(toolset))
+
+ const sections: CatalogSurfaceSection[] = [
+ {
+ id: 'featured',
+ label: ranked ? 'Most used' : 'Essentials',
+ blurb: ranked ? 'The toolsets Hermes reaches for most on this profile.' : 'What most Hermes work runs on.',
+ layout: 'feature',
+ items: featured.map(toolset => item(toolset, 'feature'))
+ },
+ ...[...TOOLSET_THEMES, TOOLSET_MORE_THEME].map(theme => ({
+ id: theme.id,
+ label: theme.label,
+ blurb: theme.blurb,
+ layout: 'list' as const,
+ items: rest.filter(toolset => toolsetTheme(toolset.name).id === theme.id).map(toolset => item(toolset, 'list'))
+ }))
+ ]
+
return (
- <MasterDetail resizeId="capabilities-split" split="wide">
- <ListColumn
- header={
- <ListStrip
- left={<SortButton desc={toolsetsSortDesc} onFlip={() => $toolsetsSortDesc.set(!$toolsetsSortDesc.get())} />}
- right={<ListStripMenu label={t.skills.tabToolsets} toggle={bulkSwitch} />}
+ <>
+ <CatalogSurface
+ actions={
+ <CatalogSwitch
+ aria-label={t.skills.all}
+ checked={bulkToolsets.length > 0 && bulkToolsets.every(ts => ts.enabled)}
+ disabled={bulkBusy}
+ onCheckedChange={checked => void bulkApply(bulkToolsets.filter(row => row.enabled !== checked), checked)}
/>
}
- >
- {visibleToolsets.map(toolset => {
- const label = toolsetDisplayLabel(toolset)
- const calls = toolCalls ? toolsetCalls(toolset, toolCalls) : null
-
- return (
- <CapRow
- active={activeToolset?.name === toolset.name}
- busy={bulkBusy}
- enabled={toolset.enabled}
- key={toolset.name}
- meta={
- calls === null ? (
- <CountSkeleton />
- ) : calls > 0 ? (
- `×${compactNumber(calls)}`
- ) : (
- `${toolNames(toolset).length} tools`
- )
- }
- onSelect={() => setSelectedToolset(toolset.name)}
- onToggle={checked => void handleToggleToolset(toolset, checked)}
- subtitle={asText(toolset.description)}
- title={label}
- toggleLabel={t.skills.toggleToolset(label, !toolset.enabled)}
- />
- )
- })}
- </ListColumn>
- <DetailColumn footer={t.skills.changesApplyNewSessions}>
- {activeToolset && (
- <ToolsetDetail
- onConfiguredChange={refreshToolsets}
- profile={profile}
- toolCalls={toolCalls ?? {}}
- toolset={activeToolset}
- />
- )}
- </DetailColumn>
- </MasterDetail>
+ kind="plugins"
+ sections={sections}
+ />
+ <Dialog open={selectedToolset !== null} onOpenChange={open => { if (!open) setSelectedToolset(null) }}>
+ <DialogContent className="max-w-2xl">
+ <DialogTitle className="sr-only">{activeToolset ? toolsetDisplayLabel(activeToolset) : t.skills.tabToolsets}</DialogTitle>
+ {activeToolset && (
+ <ToolsetDetail onConfiguredChange={refreshToolsets} profile={profile} toolCalls={toolCalls ?? {}} toolset={activeToolset} />
+ )}
+ </DialogContent>
+ </Dialog>
+ </>
)
}
diff --git a/apps/desktop/src/app/capabilities/ui/catalog-surface.tsx b/apps/desktop/src/app/capabilities/ui/catalog-surface.tsx
new file mode 100644
index 00000000000..ea1ee7b9a3b
--- /dev/null
+++ b/apps/desktop/src/app/capabilities/ui/catalog-surface.tsx
@@ -0,0 +1,97 @@
+import type { ReactNode } from 'react'
+
+import { CatalogCard, type CatalogCardVariant } from '../catalog/catalog-card'
+import type { CatalogEntry, CatalogKind } from '../catalog/catalog-data'
+import { CatalogDeveloper } from '../catalog/catalog-developer'
+
+import '../catalog/catalog-discovery.css'
+
+export interface CatalogSurfaceItem {
+ id: string
+ name: string
+ description: string
+ /** Topline label: who or what the item belongs to. */
+ eyebrow?: string
+ /** Footer badge: the one piece of meta the item carries. */
+ badge?: string
+ action?: ReactNode
+ onOpen: () => void
+}
+
+export interface CatalogSurfaceSection {
+ id: string
+ label: string
+ blurb?: string
+ /** `feature` is the tall-card row; `list` is the two-up small-banner list. */
+ layout: 'feature' | 'list'
+ items: CatalogSurfaceItem[]
+}
+
+const VARIANT: Record<CatalogSurfaceSection['layout'], CatalogCardVariant> = { feature: 'compact', list: 'horizontal' }
+
+const entryFor = (item: CatalogSurfaceItem, category: string): CatalogEntry => ({
+ id: item.id,
+ name: item.name,
+ description: item.description,
+ overview: item.description,
+ category,
+ categoryLabel: category,
+ source: item.badge ?? '',
+ author: item.eyebrow ?? '',
+ identifier: item.id,
+ repo: '',
+ sha: '',
+ subdir: '',
+ version: '',
+ requiresHermes: '',
+ tags: [],
+ platforms: [],
+ requirements: [],
+ tools: [],
+ hooks: [],
+ sourceUrl: null,
+ docsUrl: null,
+ imageUrl: null,
+ stars: null,
+ search: ''
+})
+
+const noop = () => {}
+
+/** The catalog page for a capability that isn't a registry feed: the same
+ * headings, cards and developer banner, laid out as the board's feature row
+ * and small-banner lists. State and actions stay with the caller. */
+export function CatalogSurface({ sections, kind, actions }: { sections: CatalogSurfaceSection[]; kind: CatalogKind; actions?: ReactNode }) {
+ return (
+ <div className="capabilities-scroll">
+ <div className="catalog-discovery">
+ {sections.filter(section => section.items.length).map(section => (
+ <section data-catalog-section={section.id} key={section.id}>
+ <header className="catalog-section-heading">
+ <div>
+ <h2>{section.label}</h2>
+ {section.blurb && <p>{section.blurb}</p>}
+ </div>
+ </header>
+ <div className={section.layout === 'feature' ? 'catalog-feature-row' : 'catalog-banner-list'}>
+ {section.items.map((item, index) => (
+ <CatalogCard
+ accentIndex={index}
+ action={item.action}
+ entry={entryFor(item, section.id)}
+ key={item.id}
+ onCategory={noop}
+ onOpen={item.onOpen}
+ onSearch={noop}
+ onTag={noop}
+ variant={VARIANT[section.layout]}
+ />
+ ))}
+ </div>
+ </section>
+ ))}
+ <CatalogDeveloper actions={actions} kind={kind} />
+ </div>
+ </div>
+ )
+}