Skip to content

The agent that grows with you

feat(desktop): one search field and spacing rhythm across Capabilities

Brooklyn Nicholson80c1ab31e7f3
diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-browser.tsx b/apps/desktop/src/app/capabilities/catalog/catalog-browser.tsx
index 1cbca308ff1..92a1508f158 100644
--- a/apps/desktop/src/app/capabilities/catalog/catalog-browser.tsx
+++ b/apps/desktop/src/app/capabilities/catalog/catalog-browser.tsx
@@ -2,12 +2,10 @@ import { useStore } from '@nanostores/react'
import { memo, type ReactNode, useDeferredValue, useEffect, useRef, 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 { Masonry } from '@/components/ui/masonry'
-import { SearchField } from '@/components/ui/search-field'
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
import { Tip } from '@/components/ui/tooltip'
import { useI18n } from '@/i18n'
@@ -15,6 +13,7 @@ import { cn } from '@/lib/utils'
import { DetailColumn, ListColumn, MasterDetail } from '../../master-detail'
import { PanelEmpty } from '../../overlays/panel'
+import { CapabilitySearch } from '../ui/capability-search'
import { CatalogAlert } from './catalog-alert'
import { CatalogCard, type CatalogCardVariant } from './catalog-card'
@@ -43,6 +42,8 @@ interface CatalogBrowserProps {
kind: CatalogKind
query?: string
onQueryChange?: (value: string) => void
+ /** Data-derived "Try …" placeholder nudges for the search field. */
+ searchHints?: string[]
isInstalled: (entry: CatalogEntry) => boolean
onInstall: (entry: CatalogEntry) => void
isInstalling?: (entry: CatalogEntry) => boolean
@@ -122,7 +123,8 @@ export const CatalogBrowser = memo(function CatalogBrowser({
renderInstalledAction,
selectedEntryId,
query,
- onQueryChange
+ onQueryChange,
+ searchHints
}: CatalogBrowserProps) {
const { t } = useI18n()
const c = t.catalog
@@ -281,32 +283,28 @@ export const CatalogBrowser = memo(function CatalogBrowser({
className="catalog-search-header shrink-0"
data-catalog-header
>
- <SearchField
- containerClassName="w-full min-w-0 rounded-2xl bg-(--dt-card)"
- leadingContent={<Badge size="xs" variant="muted">{kind === 'plugins' ? t.skills.tabPlugins : t.skills.tabSkills}</Badge>}
+ <CapabilitySearch
+ actions={<>
+ {headerActions}
+ <Tip label={viewToggleLabel}>
+ <Button
+ aria-label={viewToggleLabel}
+ onClick={() => {
+ setDetailOpen(false)
+ $catalogCardView.set(!cardView)
+ }}
+ size="icon-xs"
+ variant="ghost"
+ >
+ <Codicon name={cardView ? 'list-unordered' : 'extensions'} />
+ </Button>
+ </Tip>
+ </>}
+ hints={searchHints}
onChange={value => onQueryChange?.(value)}
placeholder={kind === 'plugins' ? c.searchPlugins : c.searchSkills}
- trailingAction={<div
- className="flex min-w-0 flex-wrap items-center justify-end gap-3 justify-self-end"
- data-catalog-actions
- >
- {headerActions}
- <Tip label={viewToggleLabel}>
- <Button
- aria-label={viewToggleLabel}
- onClick={() => {
- setDetailOpen(false)
- $catalogCardView.set(!cardView)
- }}
- size="icon-xs"
- variant="ghost"
- >
- <Codicon name={cardView ? 'list-unordered' : 'extensions'} />
- </Button>
- </Tip>
- </div>}
+ scope={kind === 'plugins' ? t.skills.tabPlugins : t.skills.tabSkills}
value={query ?? ''}
- variant="box"
/>
</header>
<CatalogFilterBar
@@ -362,7 +360,7 @@ export const CatalogBrowser = memo(function CatalogBrowser({
{discover ? (
<CatalogDiscovery actions={actions} card={card} entries={filtered} kind={kind} onCategory={filters.chooseCategory} />
) : (
- <div className="catalog-filtered-results py-2">
+ <div className="catalog-filtered-results pt-(--capabilities-gap-lead) pb-2">
{CATALOG_MASONRY ? (
<Masonry data-catalog-hover-group>{filtered.slice(0, limit).map((entry, index) => card(entry, index))}</Masonry>
) : (
diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-discovery.css b/apps/desktop/src/app/capabilities/catalog/catalog-discovery.css
index e9a8af45dc2..555ed344f6e 100644
--- a/apps/desktop/src/app/capabilities/catalog/catalog-discovery.css
+++ b/apps/desktop/src/app/capabilities/catalog/catalog-discovery.css
@@ -14,18 +14,17 @@
[data-catalog-variant=compact] .catalog-card-footer { padding-bottom: 20px; }
[data-catalog-results] { container-type: inline-size; }
.catalog-search-header { padding-top: 20px; }
-.catalog-filter-bar { padding-block: 16px 8px; }
+.catalog-filter-bar { padding-block: var(--capabilities-gap-controls) 0; }
.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; overflow: visible; }
.catalog-filter-trigger { display: flex; flex: none; align-items: center; gap: 8px; }
.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: 20px; }
+.catalog-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: var(--capabilities-gap-section) 20px var(--capabilities-gap-heading); }
+:is(.catalog-discovery, .capabilities-sections) > section:first-child .catalog-section-heading { padding-top: var(--capabilities-gap-lead); }
.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-bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
diff --git a/apps/desktop/src/app/capabilities/catalog/skill-catalog.tsx b/apps/desktop/src/app/capabilities/catalog/skill-catalog.tsx
new file mode 100644
index 00000000000..1e1a6fed0f1
--- /dev/null
+++ b/apps/desktop/src/app/capabilities/catalog/skill-catalog.tsx
@@ -0,0 +1,324 @@
+import { useQuery } from '@tanstack/react-query'
+import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react'
+
+import { capabilityScoped } from '@/api/client'
+import { Loader } from '@/components/ui/loader'
+import { getOfficialSkills, type ProfileScope, profileScopeKey } from '@/hermes'
+import { useI18n } from '@/i18n'
+import { HUB_SOURCES_KEY, installHubSkill, notifyHubActionFailed, OFFICIAL_SKILLS_KEY } from '@/store/hub-actions'
+import { notify } from '@/store/notifications'
+import type { SkillHubSourcesResponse, SkillInfo } from '@/types/hermes'
+
+import { skillSearchTerms } from '../skills/skills-data'
+
+import { CatalogAlert } from './catalog-alert'
+import { CatalogBrowser } from './catalog-browser'
+import { type CatalogEntry, parseCatalog } from './catalog-data'
+
+interface SkillCatalogProps {
+ skills: SkillInfo[]
+ profile: ProfileScope
+ query?: string
+ onQueryChange?: (value: string) => void
+ actions?: ReactNode
+ installedPending?: boolean
+ notice?: ReactNode
+ renderInstalledDetail: (skill: SkillInfo) => ReactNode
+ renderInstalledAction?: (skill: SkillInfo) => ReactNode
+}
+
+/** Public discovery and the profile's local skills share one browser. Management
+ * stays in SkillsTab; catalog install actions have exactly one owner here. */
+export function SkillCatalog(props: SkillCatalogProps) {
+ return <ScopedSkillCatalog key={profileScopeKey(props.profile)} {...props} />
+}
+
+function ScopedSkillCatalog({
+ skills,
+ profile,
+ query,
+ onQueryChange,
+ actions,
+ installedPending,
+ notice,
+ renderInstalledDetail,
+ renderInstalledAction
+}: SkillCatalogProps) {
+ const { t } = useI18n()
+ const h = t.skills.hub
+ // "Try …" nudges from the user's own skills: search reads categories, not just names.
+ const searchHints = useMemo(() => (skills.length ? skillSearchTerms(skills).map(term => t.common.tryHint(term)) : undefined), [skills, t])
+ const mounted = useRef(true)
+ const pending = useRef(new Set<string>())
+ const [installing, setInstalling] = useState<ReadonlySet<string>>(new Set())
+
+ // eslint-disable-next-line no-restricted-syntax -- lifecycle guard drops stale async completions; it does not mirror an atom
+ useEffect(() => {
+ mounted.current = true
+
+ return () => {
+ mounted.current = false
+ }
+ }, [])
+
+ const {
+ data: officialData,
+ error: officialError,
+ refetch: refreshOfficial
+ } = useQuery({
+ queryKey: [...OFFICIAL_SKILLS_KEY, profileScopeKey(profile)],
+ queryFn: () => getOfficialSkills(profile),
+ staleTime: 60_000,
+ retry: false
+ })
+
+ const hasHubSkills = skills.some(skill => skill.provenance === 'hub')
+
+ const {
+ data: hubData,
+ isPending: hubPending,
+ error: hubError,
+ refetch: refreshHub
+ } = useQuery({
+ queryKey: [...HUB_SOURCES_KEY, profileScopeKey(profile)],
+ // SkillInfo has provenance, not a source identifier. Read the installed
+ // lock map rather than guessing identity from a community skill's name.
+ // The older getSkillHubSources helper cannot carry a connection pin.
+ queryFn: () =>
+ window.hermesDesktop.api<SkillHubSourcesResponse>({
+ ...capabilityScoped(profile),
+ path: '/api/skills/hub/sources',
+ timeoutMs: 45_000
+ }),
+ enabled: hasHubSkills,
+ staleTime: 60_000,
+ retry: false
+ })
+
+ const catalog = useMemo(() => {
+ const skillsById = new Map<string, SkillInfo>()
+ const skillsByName = new Map(skills.map(skill => [skill.name, skill]))
+ const installedByName = new Map<string, CatalogEntry>()
+ const installedByIdentifier = new Map<string, CatalogEntry>()
+ const installedIdentifiers = new Set(Object.keys(hubData?.installed ?? {}))
+
+ const localEntries = parseCatalog(
+ 'skills',
+ skills.map(skill => ({
+ name: skill.name,
+ description: skill.description,
+ category: skill.category,
+ source: skill.provenance === 'bundled' ? 'built-in' : skill.provenance === 'hub' ? 'hub' : 'local'
+ }))
+ ).map(entry => {
+ const skill = skillsByName.get(entry.name)!
+ const installed = { ...entry, id: `installed:${skill.name}`, installIdentifier: null }
+ skillsById.set(installed.id, skill)
+ installedByName.set(skill.name, installed)
+
+ return installed
+ })
+
+ for (const [identifier, record] of Object.entries(hubData?.installed ?? {})) {
+ const installed = record.name ? installedByName.get(record.name) : undefined
+
+ if (installed && skillsById.get(installed.id)?.provenance === 'hub') {
+ installedByIdentifier.set(identifier, installed)
+ }
+ }
+
+ const official = officialData?.skills ?? []
+
+ const officialEntries = parseCatalog(
+ 'skills',
+ official.map(skill => ({
+ ...skill,
+ source: 'optional',
+ installIdentifier: skill.identifier
+ }))
+ )
+
+ const officialByIdentifier = new Map(officialEntries.map(entry => [entry.identifier, entry]))
+
+ for (const skill of official) {
+ if (!skill.installed) {
+ continue
+ }
+
+ installedIdentifiers.add(skill.identifier)
+ const installed = installedByName.get(skill.name)
+
+ if (installed && skillsById.get(installed.id)?.provenance === 'hub') {
+ installedByIdentifier.set(skill.identifier, installed)
+ }
+ }
+
+ const officialFor = (entry: CatalogEntry) => {
+ if (entry.source !== 'optional') {
+ return undefined
+ }
+
+ const identifier = entry.installIdentifier ?? entry.identifier
+ const exact = officialByIdentifier.get(identifier)
+
+ if (exact) {
+ return exact
+ }
+
+ if (identifier !== entry.name && identifier !== `official/${entry.name}`) {
+ return undefined
+ }
+
+ // Old public snapshots omit optional identifiers. Only the official
+ // optional namespace can use this fallback, never community lookalikes.
+ return officialEntries.find(skill => skill.name === entry.name && skill.category === entry.category)
+ }
+
+ const matchInstalled = (entry: CatalogEntry): CatalogEntry | undefined => {
+ const exact = installedByIdentifier.get(entry.installIdentifier ?? entry.identifier)
+
+ if (exact) {
+ return exact
+ }
+
+ if (entry.source === 'built-in') {
+ const bundled = installedByName.get(entry.name)
+
+ if (bundled && skillsById.get(bundled.id)?.provenance === 'bundled') {
+ return bundled
+ }
+ }
+
+ const optional = officialFor(entry)
+
+ return optional ? (installedByIdentifier.get(optional.identifier) ?? optional) : undefined
+ }
+
+ // CatalogBrowser merges these supplemental rows with the public feed.
+ // Optional rows remain available even offline / ahead of the snapshot;
+ // membership here is NOT installation — isInstalled owns that decision.
+ const entries = [
+ ...localEntries,
+ ...officialEntries.filter(entry => !installedByIdentifier.has(entry.identifier) && !skillsByName.has(entry.name))
+ ]
+
+ return { entries, skillsById, skillsByName, installedIdentifiers, matchInstalled, officialFor }
+ }, [skills, hubData, officialData])
+
+ // Skills install by name, so a same-named entry can never be added beside the installed one.
+ const isInstalled = useCallback(
+ (entry: CatalogEntry) => {
+ if (catalog.skillsById.has(entry.id) || catalog.skillsByName.has(entry.name)) {
+ return true
+ }
+
+ const matched = catalog.matchInstalled(entry)
+
+ if (matched && catalog.skillsById.has(matched.id)) {
+ return true
+ }
+
+ const optional = catalog.officialFor(entry)
+
+ return catalog.installedIdentifiers.has(optional?.identifier ?? entry.installIdentifier ?? entry.identifier)
+ },
+ [catalog]
+ )
+
+ // The name guarantee above only holds for first-party namespaces, where a
+ // shared name is the same skill. Community feeds carry distinct skills that
+ // reuse popular names, so a community row whose name is taken by an installed
+ // skill is neither that skill nor installable beside it — hide it instead of
+ // showing it as installed. Rows already merged into an installed one (their
+ // id is the installed row's) stay visible.
+ const isSuperseded = useCallback(
+ (entry: CatalogEntry) =>
+ entry.source !== 'official' && !entry.id.startsWith('installed:') && catalog.skillsByName.has(entry.name),
+ [catalog]
+ )
+
+ const installIdentifier = (entry: CatalogEntry) => catalog.officialFor(entry)?.identifier ?? entry.installIdentifier
+
+ const identityPending = hasHubSkills && (hubPending || Boolean(hubError))
+
+ const install = (entry: CatalogEntry) => {
+ const identifier = installIdentifier(entry)
+
+ if (installedPending || identityPending || !identifier || isInstalled(entry) || pending.current.has(identifier)) {
+ return
+ }
+
+ pending.current.add(identifier)
+ setInstalling(new Set(pending.current))
+ notify({ kind: 'success', title: h.installStarted(entry.name), message: h.actionLog })
+ void installHubSkill(identifier, profile)
+ .catch(err => {
+ if (mounted.current) {
+ notifyHubActionFailed(err, h.actionFailed, entry.name, profile)
+ }
+ })
+ .finally(() => {
+ pending.current.delete(identifier)
+
+ if (mounted.current) {
+ setInstalling(new Set(pending.current))
+ }
+ })
+ }
+
+ return (
+ <CatalogBrowser
+ actions={actions}
+ installedEntries={catalog.entries}
+ installedPending={installedPending || identityPending}
+ isInstalled={isInstalled}
+ isInstalling={entry => installing.has(installIdentifier(entry) ?? '')}
+ isSuperseded={isSuperseded}
+ kind="skills"
+ matchInstalled={catalog.matchInstalled}
+ notice={
+ <>
+ {notice}
+ {(officialError || hubError) && (
+ <CatalogAlert
+ onRetry={() => {
+ if (officialError) {
+ void refreshOfficial()
+ }
+
+ if (hubError) {
+ void refreshHub()
+ }
+ }}
+ retryLabel={t.skills.refresh}
+ title={t.skills.skillsLoadFailed}
+ >
+ {(hubError ?? officialError)?.message}
+ </CatalogAlert>
+ )}
+ {hasHubSkills && hubPending && !installedPending && !notice && (
+ <Loader
+ className="mx-auto my-2 size-6 text-(--ui-text-tertiary)"
+ label={t.skills.loading}
+ type="rose-curve"
+ />
+ )}
+ </>
+ }
+ onInstall={install}
+ onQueryChange={onQueryChange}
+ query={query}
+ renderInstalledAction={entry => {
+ const skill = catalog.skillsById.get(entry.id)
+
+ return skill && renderInstalledAction ? renderInstalledAction(skill) : null
+ }}
+ renderInstalledDetail={entry => {
+ const skill = catalog.skillsById.get(entry.id)
+
+ return skill ? renderInstalledDetail(skill) : null
+ }}
+ searchHints={searchHints}
+ />
+ )
+}
diff --git a/apps/desktop/src/app/capabilities/connectors/connectors-directory.tsx b/apps/desktop/src/app/capabilities/connectors/connectors-directory.tsx
index beaebc95790..be7419fca38 100644
--- a/apps/desktop/src/app/capabilities/connectors/connectors-directory.tsx
+++ b/apps/desktop/src/app/capabilities/connectors/connectors-directory.tsx
@@ -3,10 +3,11 @@ import { type ReactNode } from 'react'
import { PanelEmpty } from '@/app/overlays/panel'
import { Button } from '@/components/ui/button'
import { ErrorBanner } from '@/components/ui/error-state'
-import { SearchField } from '@/components/ui/search-field'
import { SegmentedControl } from '@/components/ui/segmented-control'
import { useI18n } from '@/i18n'
+import { CapabilitySearch } from '../ui/capability-search'
+
import { ConnectorRowCard } from './connector-row-card'
import { cardKey, EMPTY_CONNECTORS_FILTER } from './derive'
import { derivePage, showsAttentionFirst } from './derive-page'
@@ -58,22 +59,19 @@ export function ConnectorsDirectory({
const segmentFellBack = segments.length > 0 && segment !== filter.segment
return (
- <div className="flex min-h-0 flex-1 flex-col gap-3" data-slot="connectors-directory">
+ <div className="flex min-h-0 flex-1 flex-col" data-slot="connectors-directory">
{cards.length === 0 ? null : (
<>
- <div className="flex shrink-0 items-center gap-3 border-b border-(--ui-stroke-tertiary) pb-1.5">
- <SearchField
- containerClassName="min-w-0 flex-1"
- inputClassName="flex-1"
- onChange={query => set({ query })}
- placeholder={copy.searchPlaceholder(cards.length)}
- value={filter.query}
- />
- {addYourOwn}
- </div>
+ <CapabilitySearch
+ actions={addYourOwn}
+ onChange={query => set({ query })}
+ placeholder={copy.searchPlaceholder(cards.length)}
+ scope={copy.title}
+ value={filter.query}
+ />
{showSegments || segmentFellBack || hiddenMatches > 0 ? (
- <div className="flex shrink-0 flex-wrap items-center gap-2">
+ <div className="mt-(--capabilities-gap-controls) flex shrink-0 flex-wrap items-center gap-2">
{showSegments ? (
<SegmentedControl
onChange={(next: ConnectorSegmentId) => set({ segment: next })}
@@ -81,6 +79,7 @@ export function ConnectorsDirectory({
id: option.id,
label: `${segmentLabel(option.id)} ${option.count}`
}))}
+ sizing="content"
value={segment}
/>
) : null}
@@ -104,10 +103,10 @@ export function ConnectorsDirectory({
</>
)}
- {notices}
+ {notices ? <div className="mt-(--capabilities-gap-controls) shrink-0 empty:hidden">{notices}</div> : null}
{hostedFailed && onRetryHosted ? (
- <ErrorBanner className="shrink-0 items-center">
+ <ErrorBanner className="mt-(--capabilities-gap-controls) shrink-0 items-center">
<span className="flex flex-wrap items-center gap-x-1.5 gap-y-1">
<span className="font-medium">{copy.page.hostedFailedTitle}</span>
<span className="opacity-80">{copy.page.hostedFailedBody}</span>
@@ -119,9 +118,9 @@ export function ConnectorsDirectory({
) : null}
{loading ? (
- <ToolsWash label={copy.page.loading} rows={10} />
+ <div className="mt-(--capabilities-gap-lead)"><ToolsWash label={copy.page.loading} rows={10} /></div>
) : groups.length > 0 ? (
- <div className="grid min-h-0 flex-1 content-start gap-6 overflow-y-auto overscroll-contain pb-4">
+ <div className="capabilities-sections min-h-0 flex-1 overflow-y-auto overscroll-contain pb-4">
{groups.map(group => (
<Group
busyKey={busyKey}
@@ -182,15 +181,16 @@ function Group({
const copy = t.connectorsPage.group
return (
- <section className="grid gap-2">
- <header className="flex items-center gap-2">
- <h3 className="text-xs font-semibold text-(--ui-text-primary)">
- {group.id === 'local' ? where : copy[group.id]}
- </h3>
- <span className="tabular-nums text-xs text-(--ui-text-tertiary)">{group.cards.length}</span>
-
- {group.id === 'connected' && showsAttentionFirst(group) ? <Note>{copy.connectedNote}</Note> : null}
- {group.id === 'off' ? <Note>{copy.offNote}</Note> : null}
+ <section>
+ <header className="catalog-section-heading">
+ <div>
+ <h2>
+ {group.id === 'local' ? where : copy[group.id]}
+ <span className="ml-2 font-normal tabular-nums text-(--ui-text-tertiary)">{group.cards.length}</span>
+ </h2>
+ {group.id === 'connected' && showsAttentionFirst(group) ? <p>{copy.connectedNote}</p> : null}
+ {group.id === 'off' ? <p>{copy.offNote}</p> : null}
+ </div>
</header>
<div className="grid gap-3 sm:grid-cols-2">
@@ -214,7 +214,3 @@ function Group({
</section>
)
}
-
-function Note({ children }: { children: ReactNode }) {
- return <span className="truncate text-[0.65rem] text-(--ui-text-tertiary)">{children}</span>
-}
diff --git a/apps/desktop/src/app/capabilities/index.tsx b/apps/desktop/src/app/capabilities/index.tsx
index 96fbce33dfa..035fa1619e1 100644
--- a/apps/desktop/src/app/capabilities/index.tsx
+++ b/apps/desktop/src/app/capabilities/index.tsx
@@ -23,7 +23,7 @@ import { prefetchCatalogWhenIdle } from './catalog/catalog-data'
import { ConnectorsTab } from './connectors/connectors-tab'
import { PluginsTab } from './plugins/plugins-tab'
import { CapabilityScopeSelector, useCapabilityScope } from './scope-selector'
-import { SKILLS_QUERY_KEY, skillSearchTerms, useSkillsQuery } from './skills/skills-data'
+import { SKILLS_QUERY_KEY, useSkillsQuery } from './skills/skills-data'
import { SkillsTab } from './skills/skills-tab'
import { refreshToolCalls } from './toolsets/tool-calls'
import { TOOLSETS_QUERY_KEY, toolsetSearchTerms, useToolsetsQuery, visibleToolsetCount } from './toolsets/toolsets-data'
@@ -102,18 +102,11 @@ export function CapabilitiesView({
useEffect(syncCatalogArcs, [])
// Rotating placeholder nudges from the user's own data — teach that search
- // understands categories and tool names, not just titles.
- const searchHints = useMemo(() => {
- if (mode === 'skills' && skills?.length) {
- return skillSearchTerms(skills).map(term => t.common.tryHint(term))
- }
-
- if (mode === 'toolsets' && toolsets?.length) {
- return toolsetSearchTerms(toolsets).map(term => t.common.tryHint(term))
- }
-
- return undefined
- }, [mode, skills, t, toolsets])
+ // understands tool names, not just titles.
+ const toolsetHints = useMemo(
+ () => (toolsets?.length ? toolsetSearchTerms(toolsets).map(term => t.common.tryHint(term)) : undefined),
+ [t, toolsets]
+ )
// MCP and Plugins load independently of the installed Skills/Tools lists.
const gated = mode === 'toolsets'
@@ -169,7 +162,7 @@ export function CapabilitiesView({
/>
),
toolsets: () => (
- <ToolsetsTab key={`toolsets-${scope.key}`} profile={scope.profile} query={query} toolsets={toolsets ?? []} />
+ <ToolsetsTab hints={toolsetHints} key={`toolsets-${scope.key}`} onQueryChange={setQuery} profile={scope.profile} query={query} toolsets={toolsets ?? []} />
)
} satisfies Record<CapabilityMode, () => React.ReactNode>
@@ -177,19 +170,9 @@ export function CapabilitiesView({
<PageSearchShell
{...props}
activeTab={mode}
- onSearchChange={setQuery}
onTabChange={id => setMode(id as CapabilityMode)}
- // Catalogs keep search beside their results; Connectors owns its field too.
- searchHidden={mode !== 'toolsets'}
- searchHints={searchHints}
- searchPlaceholder={
- mode === 'plugins'
- ? t.catalog.searchPlugins
- : mode === 'skills'
- ? t.catalog.searchSkills
- : t.skills.searchToolsets
- }
- searchValue={query}
+ // Every tab renders the shared CapabilitySearch beside its own results.
+ searchHidden
tabs={[
{ id: 'skills', label: t.skills.tabSkills, meta: skills?.length ?? null },
{ id: 'plugins', label: t.skills.tabPlugins },
diff --git a/apps/desktop/src/app/capabilities/toolsets/toolsets-tab.tsx b/apps/desktop/src/app/capabilities/toolsets/toolsets-tab.tsx
index 176c5c23d4b..b4eb583758e 100644
--- a/apps/desktop/src/app/capabilities/toolsets/toolsets-tab.tsx
+++ b/apps/desktop/src/app/capabilities/toolsets/toolsets-tab.tsx
@@ -13,6 +13,7 @@ import type { ToolsetInfo } from '@/types/hermes'
import { asText, toolNames, toolsetDisplayLabel } from '../../settings/helpers'
import { CatalogSwitch } from '../catalog/catalog-switch'
import { CapabilityEmpty } from '../primitives'
+import { CapabilitySearch } from '../ui/capability-search'
import { CatalogSurface, type CatalogSurfaceItem, type CatalogSurfaceSection } from '../ui/catalog-surface'
import { useToolCalls } from './tool-calls'
@@ -34,11 +35,14 @@ interface ToolsetsTabProps {
/** The (connection, profile) scope every read and write routes to. */
profile: ProfileScope
query: string
+ onQueryChange: (query: string) => void
+ /** Data-derived "Try …" placeholder nudges. */
+ hints?: string[]
}
/** 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) {
+export function ToolsetsTab({ hints, onQueryChange, profile, query, toolsets }: ToolsetsTabProps) {
const { t } = useI18n()
const toolCalls = useToolCalls(profile)
const [bulkBusy, setBulkBusy] = useState(false)
@@ -121,8 +125,22 @@ export function ToolsetsTab({ profile, query, toolsets }: ToolsetsTabProps) {
}
}
+ // Same search row as every other Capabilities tab; it stays put when a query
+ // empties the list.
+ const search = (
+ <header className="catalog-search-header shrink-0">
+ <CapabilitySearch
+ hints={hints}
+ onChange={onQueryChange}
+ placeholder={t.skills.searchToolsets}
+ scope={t.skills.tabToolsets}
+ value={query}
+ />
+ </header>
+ )
+
if (visibleToolsets.length === 0) {
- return <CapabilityEmpty noun="tools" query={query} />
+ return <div className="flex h-full min-h-0 flex-col">{search}<CapabilityEmpty noun="tools" query={query} /></div>
}
const item = (toolset: ToolsetInfo, layout: CatalogSurfaceSection['layout']): CatalogSurfaceItem => {
@@ -174,7 +192,8 @@ export function ToolsetsTab({ profile, query, toolsets }: ToolsetsTabProps) {
]
return (
- <>
+ <div className="flex h-full min-h-0 flex-col">
+ {search}
<CatalogSurface
actions={
<CatalogSwitch
@@ -195,6 +214,6 @@ export function ToolsetsTab({ profile, query, toolsets }: ToolsetsTabProps) {
)}
</DialogContent>
</Dialog>
- </>
+ </div>
)
}
diff --git a/apps/desktop/src/app/capabilities/ui/capability-search.tsx b/apps/desktop/src/app/capabilities/ui/capability-search.tsx
new file mode 100644
index 00000000000..93f5d4527fc
--- /dev/null
+++ b/apps/desktop/src/app/capabilities/ui/capability-search.tsx
@@ -0,0 +1,42 @@
+import type { ReactNode } from 'react'
+
+import { Badge } from '@/components/ui/badge'
+import { SearchField } from '@/components/ui/search-field'
+
+/** The one search field every Capabilities tab uses: the boxed SearchField
+ * with the tab's name as a scope badge and the tab's own actions (add, view
+ * toggle, …) at the end. Callers own the column it sits in and the query. */
+export function CapabilitySearch({
+ actions,
+ hints,
+ onChange,
+ placeholder,
+ scope,
+ value
+}: {
+ actions?: ReactNode
+ hints?: string[]
+ onChange: (value: string) => void
+ placeholder: string
+ scope: string
+ value: string
+}) {
+ return (
+ <SearchField
+ containerClassName="h-10 w-full min-w-0 rounded-2xl bg-(--dt-card) py-0"
+ hints={hints}
+ leadingContent={<Badge size="xs" variant="muted">{scope}</Badge>}
+ onChange={onChange}
+ placeholder={placeholder}
+ trailingAction={
+ actions ? (
+ <div className="flex min-w-0 flex-wrap items-center justify-end gap-3 justify-self-end" data-catalog-actions>
+ {actions}
+ </div>
+ ) : undefined
+ }
+ value={value}
+ variant="box"
+ />
+ )
+}
diff --git a/apps/desktop/src/app/capabilities/ui/page.css b/apps/desktop/src/app/capabilities/ui/page.css
index feb9c2f7515..ee21179f5c3 100644
--- a/apps/desktop/src/app/capabilities/ui/page.css
+++ b/apps/desktop/src/app/capabilities/ui/page.css
@@ -1,5 +1,13 @@
/* The one content column every Capabilities tab sits in: search, filters,
sections and directory rows all share these edges. */
+:root {
+ /* Shared vertical rhythm, the same on every tab. */
+ --capabilities-gap-controls: 16px; /* search → its filter / segment row */
+ --capabilities-gap-lead: 20px; /* last control row → first section heading */
+ --capabilities-gap-section: 48px; /* one section → the next section's heading */
+ --capabilities-gap-heading: 20px; /* section heading → its cards or rows */
+}
+
.capabilities-page,
.catalog-search-header,
.catalog-filter-bar,
diff --git a/apps/desktop/src/app/page-search-shell.tsx b/apps/desktop/src/app/page-search-shell.tsx
index c9235d78b0c..99456e993fd 100644
--- a/apps/desktop/src/app/page-search-shell.tsx
+++ b/apps/desktop/src/app/page-search-shell.tsx
@@ -21,11 +21,12 @@ interface PageSearchShellProps extends React.ComponentProps<'section'> {
onTabChange?: (id: string) => void
/** Secondary filters shown full-width on their own row below (expands). */
filters?: ReactNode
- onSearchChange: (value: string) => void
- searchPlaceholder: string
+ /** Header search; a shell that hides it (or whose tabs own their search) omits these. */
+ onSearchChange?: (value: string) => void
+ searchPlaceholder?: string
/** Data-derived rotating placeholder nudges (see SearchField.hints). */
searchHints?: string[]
- searchValue: string
+ searchValue?: string
/** Hide the search field when there's nothing to search (empty dataset). */
searchHidden?: boolean
tabsAlign?: 'center' | 'start'
@@ -97,13 +98,13 @@ export function PageSearchShell({
{(hasTabs || !searchHidden) && (
<div className={cn('grid items-center gap-3 px-3 pb-2 pt-[calc(var(--titlebar-height)+0.5rem)]', tabsAlign === 'start' ? 'grid-cols-[minmax(0,1fr)_auto_auto] px-6 pt-[calc(var(--titlebar-height)+1.5rem)]' : 'grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)]')}>
<div className={cn('flex min-w-0 items-center justify-start', tabsAlign === 'start' ? 'col-start-2 row-start-1 justify-end' : '', searchHidden && tabsAlign === 'start' && 'hidden')}>
- {!searchHidden && (
+ {!searchHidden && onSearchChange && (
<SearchField
containerClassName="max-w-[45vw]"
hints={searchHints}
onChange={onSearchChange}
- placeholder={searchPlaceholder}
- value={searchValue}
+ placeholder={searchPlaceholder ?? ''}
+ value={searchValue ?? ''}
/>
)}
</div>
diff --git a/apps/desktop/src/components/ui/segmented-control.tsx b/apps/desktop/src/components/ui/segmented-control.tsx
index 7bf54f27d51..7c162063fc2 100644
--- a/apps/desktop/src/components/ui/segmented-control.tsx
+++ b/apps/desktop/src/components/ui/segmented-control.tsx
@@ -14,6 +14,9 @@ interface SegmentedControlProps<T extends string> {
className?: string
/** Dims the whole track and blocks selection (e.g. gated behind a prerequisite). */
disabled?: boolean
+ /** `equal` (default) gives every option the widest option's width; `content`
+ * sizes each option to its own label, for filters with uneven labels/counts. */
+ sizing?: 'equal' | 'content'
}
/**
@@ -26,12 +29,14 @@ export function SegmentedControl<T extends string>({
disabled = false,
onChange,
options,
+ sizing = 'equal',
value
}: SegmentedControlProps<T>) {
return (
<div
className={cn(
- 'inline-grid w-fit auto-cols-fr grid-flow-col gap-0.5 rounded-[5px] bg-(--ui-bg-tertiary) p-0.5',
+ 'inline-grid w-fit grid-flow-col gap-0.5 rounded-[5px] bg-(--ui-bg-tertiary) p-0.5',
+ sizing === 'equal' ? 'auto-cols-fr' : 'auto-cols-max',
disabled && 'opacity-50',
className
)}
@@ -43,7 +48,7 @@ export function SegmentedControl<T extends string>({
<button
aria-pressed={active}
className={cn(
- 'flex min-w-0 items-center justify-center gap-1 rounded-[3px] px-2.5 py-0.5 text-[0.6875rem] font-medium whitespace-nowrap transition-colors disabled:cursor-default',
+ 'flex items-center justify-center gap-1 rounded-[3px] px-2.5 py-0.5 text-[0.6875rem] font-medium transition-colors hover:transition-none disabled:cursor-default',
active ? 'bg-background text-foreground shadow-sm' : 'text-muted-foreground hover:text-foreground'
)}
disabled={disabled}
@@ -51,10 +56,8 @@ export function SegmentedControl<T extends string>({
onClick={() => onChange(id)}
type="button"
>
- {Icon && <Icon className="size-3 shrink-0" />}
- {/* A squeezed track ellipsizes a label inside its own cell; it never
- wraps or paints across the neighbouring option. */}
- <span className="min-w-0 truncate">{label}</span>
+ {Icon && <Icon className="size-3" />}
+ {label}
</button>
)
})}