The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): every Appearance row is a command-palette hit
brooklyn!0fb230b82e62
diff --git a/apps/desktop/src/app/settings/appearance-subpages.ts b/apps/desktop/src/app/settings/appearance-subpages.tsindex ca1c67a484b..390f41bd75a 100644--- a/apps/desktop/src/app/settings/appearance-subpages.ts+++ b/apps/desktop/src/app/settings/appearance-subpages.ts@@ -1,3 +1,6 @@+import type { Translations } from '@/i18n'+import { TRANSLUCENCY_SUPPORTED } from '@/store/translucency'+export const APPEARANCE_SUBPAGES = [{ id: 'general', labelKey: 'appearanceGeneral' },{ id: 'theme', labelKey: 'appearanceTheme' },@@ -9,28 +12,177 @@ export const APPEARANCE_SUBPAGES = [export type AppearanceSubpageId = (typeof APPEARANCE_SUBPAGES)[number]['id']-// Keep routing metadata independent of settings-search, which consumes it.+interface AppearanceSettingCopy {+ description?: string+ label: string+}++interface AppearanceSetting {+ /** Rows that only exist on some platforms stay out of search, where a hit would scroll to nothing. */+ available?: () => boolean+ copy: (t: Translations) => AppearanceSettingCopy+ keywords: readonly string[]+ subpage: AppearanceSubpageId+}++type AppearanceCopy = Translations['settings']['appearance']+type TitledKey = { [K in keyof AppearanceCopy]: K extends `${infer Base}Title` ? Base : never }[keyof AppearanceCopy]++// Most rows read `<key>Title` / `<key>Desc` straight from the appearance+// catalog; a Desc that is a formatter (uiScale) is left to the row itself.+const appearanceCopy =+ <K extends TitledKey>(key: K) =>+ (t: Translations): AppearanceSettingCopy => {+ const catalog: Record<string, unknown> = t.settings.appearance+ const description = catalog[`${key}Desc`]++ return {+ label: t.settings.appearance[`${key}Title`],+ description: typeof description === 'string' ? description : undefined+ }+ }++/**+ * The manifest of every hand-built Appearance row. A key becomes the row's+ * deep-link id (`appearance.<kebab-case>`), its subpage routes that id, and its+ * copy + keywords feed the command palette — so a row cannot exist without+ * being searchable, and search cannot point at a row that is not there.+ * Schema-driven rows (`desktop.font_family`) are indexed from the schema and+ * only need a subpage here.+ */+export const APPEARANCE_SETTINGS = {+ language: {+ subpage: 'general',+ keywords: ['locale'],+ copy: t => ({ label: t.language.label, description: t.language.description })+ },+ introSplash: {+ subpage: 'general',+ keywords: ['splash', 'wordmark', 'empty chat', 'new chat'],+ copy: appearanceCopy('introSplash')+ },+ resumeLastSession: {+ subpage: 'general',+ keywords: ['resume', 'reopen', 'launch', 'startup', 'last chat', 'session'],+ copy: appearanceCopy('resumeLastSession')+ },+ tips: {+ subpage: 'general',+ keywords: ['tips', 'hints', 'coach marks', 'onboarding', 'help'],+ copy: appearanceCopy('tips')+ },+ tours: {+ subpage: 'general',+ keywords: ['tour', 'walkthrough', 'guide', 'onboarding', 'help'],+ copy: appearanceCopy('tours')+ },+ theme: { subpage: 'theme', keywords: ['color mode', 'skin', 'light', 'dark'], copy: appearanceCopy('theme') },+ uiScale: { subpage: 'typography', keywords: ['zoom', 'size'], copy: appearanceCopy('uiScale') },+ interfaceMode: {+ subpage: 'window-layout',+ keywords: ['simple', 'advanced', 'mode', 'interface', 'chrome', 'minimal', 'focus'],+ copy: t => ({ label: t.interfaceMode.title, description: t.interfaceMode.hint })+ },+ sessionDensity: {+ subpage: 'window-layout',+ keywords: ['sidebar', 'sessions', 'compact', 'comfortable', 'density'],+ copy: appearanceCopy('sessionDensity')+ },+ tabStrip: { subpage: 'window-layout', keywords: ['tabs', 'tab bar', 'strip'], copy: appearanceCopy('tabStrip') },+ appActions: {+ subpage: 'window-layout',+ keywords: ['titlebar', 'settings gear', 'layout', 'HUD', 'left', 'right', 'tabs'],+ copy: appearanceCopy('appActions')+ },+ minimizeToTray: {+ subpage: 'window-layout',+ keywords: ['tray', 'background', 'minimize', 'dock', 'taskbar', 'menu bar'],+ available: () => Boolean(window.hermesDesktop?.minimizeToTray),+ copy: t => ({ label: t.settings.config.minimizeToTrayTitle, description: t.settings.config.minimizeToTrayDesc })+ },+ translucency: {+ subpage: 'window-layout',+ keywords: ['opacity', 'transparent', 'glass', 'blur'],+ available: () => TRANSLUCENCY_SUPPORTED,+ copy: appearanceCopy('translucency')+ },+ backdrop: { subpage: 'window-layout', keywords: ['background', 'blur'], copy: appearanceCopy('backdrop') },+ composerPopout: {+ subpage: 'window-layout',+ keywords: ['composer', 'floating', 'drag', 'popout', 'dock', 'input'],+ copy: appearanceCopy('composerPopout')+ },+ userBubble: {+ subpage: 'chat-display',+ keywords: ['opacity', 'transparent', 'message', 'bubble'],+ copy: appearanceCopy('userBubble')+ },+ textDirection: {+ subpage: 'chat-display',+ keywords: ['rtl', 'ltr', 'right to left', 'left to right', 'bidi', 'arabic', 'hebrew', 'persian', 'align'],+ copy: appearanceCopy('textDirection')+ },+ hideThreadTimeline: {+ subpage: 'chat-display',+ keywords: ['thread', 'conversation', 'timeline', 'bars', 'rail', 'navigation', 'hide'],+ copy: appearanceCopy('hideThreadTimeline')+ },+ reactions: {+ subpage: 'chat-display',+ keywords: ['emoji', 'tapback', 'react', 'reactions'],+ copy: appearanceCopy('reactions')+ },+ vibeHearts: {+ subpage: 'chat-display',+ keywords: ['hearts', 'vibe', 'celebrate', 'confetti', 'fun'],+ copy: appearanceCopy('vibeHearts')+ },+ toolView: { subpage: 'chat-display', keywords: ['tool display', 'technical'], copy: appearanceCopy('toolView') },+ hideCodeDiffs: {+ subpage: 'chat-display',+ keywords: ['code', 'diff', 'patch', 'file edits', 'inline', 'added', 'removed'],+ copy: appearanceCopy('hideCodeDiffs')+ },+ reasoningCollapsed: {+ subpage: 'chat-display',+ keywords: ['thinking', 'reasoning', 'collapse', 'expand', 'chain of thought'],+ copy: appearanceCopy('reasoningCollapsed')+ },+ embeds: { subpage: 'chat-display', keywords: ['external content', 'privacy'], copy: appearanceCopy('embeds') },+ pet: {+ subpage: 'pet',+ keywords: ['pet', 'mascot', 'petdex', 'companion', 'buddy'],+ copy: t => ({ label: t.settings.appearance.pet.chooseTitle, description: t.settings.appearance.pet.chooseDesc })+ }+} as const satisfies Record<string, AppearanceSetting>++export type AppearanceSettingKey = keyof typeof APPEARANCE_SETTINGS++const APPEARANCE_SETTING_KEYS = Object.keys(APPEARANCE_SETTINGS) as AppearanceSettingKey[]+const appearanceSetting = (key: AppearanceSettingKey): AppearanceSetting => APPEARANCE_SETTINGS[key]++const kebab = (key: string) => key.replace(/[A-Z]/g, c => `-${c.toLowerCase()}`)++export const APPEARANCE_SETTING_IDS = Object.fromEntries(+ APPEARANCE_SETTING_KEYS.map(key => [key, `appearance.${kebab(key)}`])+) as Readonly<Record<AppearanceSettingKey, string>>+const SETTING_SUBPAGES: Readonly<Record<string, AppearanceSubpageId>> = {- 'appearance.app-actions': 'window-layout',- 'appearance.backdrop': 'window-layout',- 'appearance.embeds': 'chat-display',- 'appearance.hide-code-diffs': 'chat-display',- 'appearance.hide-thread-timeline': 'chat-display',- 'appearance.intro-splash': 'general',- 'appearance.language': 'general',- 'appearance.minimize-to-tray': 'window-layout',- 'appearance.pet': 'pet',- 'appearance.text-direction': 'chat-display',- 'appearance.theme': 'theme',- 'appearance.tool-view': 'chat-display',- 'appearance.interface-mode': 'window-layout',- 'appearance.translucency': 'window-layout',- 'appearance.ui-scale': 'typography',- 'appearance.user-bubble': 'chat-display',+ // Schema-driven rows that render on an Appearance subpage.'desktop.font_family': 'typography',- 'terminal.font_family': 'typography'+ 'terminal.font_family': 'typography',+ ...Object.fromEntries(+ APPEARANCE_SETTING_KEYS.map(key => [APPEARANCE_SETTING_IDS[key], appearanceSetting(key).subpage])+ )}export function appearanceSubpageForSetting(setting: string): AppearanceSubpageId | undefined {return Object.hasOwn(SETTING_SUBPAGES, setting) ? SETTING_SUBPAGES[setting] : undefined}++/** The Appearance rows the command palette can land on right now, with their copy resolved. */+export function appearanceSearchTargets(t: Translations) {+ return APPEARANCE_SETTING_KEYS.map(key => [key, appearanceSetting(key)] as const)+ .filter(([, setting]) => setting.available?.() ?? true)+ .map(([key, setting]) => ({ id: APPEARANCE_SETTING_IDS[key], keywords: [...setting.keywords], ...setting.copy(t) }))+}diff --git a/apps/desktop/src/app/settings/settings-search.ts b/apps/desktop/src/app/settings/settings-search.tsindex 3e768e1b204..a04863e2dad 100644--- a/apps/desktop/src/app/settings/settings-search.ts+++ b/apps/desktop/src/app/settings/settings-search.ts@@ -11,24 +11,6 @@ import type { DesktopConfigSection, SettingsView } from './types'export type CredentialSettingsView = 'settings' | 'tools'-export const APPEARANCE_SETTING_IDS = {- appActions: 'appearance.app-actions',- backdrop: 'appearance.backdrop',- embeds: 'appearance.embeds',- hideCodeDiffs: 'appearance.hide-code-diffs',- hideThreadTimeline: 'appearance.hide-thread-timeline',- introSplash: 'appearance.intro-splash',- language: 'appearance.language',- minimizeToTray: 'appearance.minimize-to-tray',- textDirection: 'appearance.text-direction',- theme: 'appearance.theme',- toolView: 'appearance.tool-view',- interfaceMode: 'appearance.interface-mode',- translucency: 'appearance.translucency',- uiScale: 'appearance.ui-scale',- userBubble: 'appearance.user-bubble'-} as const-export interface SettingsSearchTarget {subpage?: stringfield?: stringdiff --git a/apps/desktop/src/app/settings/subpages.test.ts b/apps/desktop/src/app/settings/subpages.test.tsindex b176bc2c16d..3307da34ce3 100644--- a/apps/desktop/src/app/settings/subpages.test.ts+++ b/apps/desktop/src/app/settings/subpages.test.ts@@ -2,6 +2,13 @@ import { describe, expect, it } from 'vitest'import { TRANSLATIONS } from '@/i18n'+import {+ APPEARANCE_SETTING_IDS,+ APPEARANCE_SETTINGS,+ APPEARANCE_SUBPAGES,+ appearanceSearchTargets,+ appearanceSubpageForSetting+} from './appearance-subpages'import { CONFIG_SUBPAGES, configSubpageForField } from './config-subpages'import { SECTIONS } from './constants'import { OTHER_SUBPAGES } from './other-subpages'@@ -63,4 +70,32 @@ describe('settings subpage routing', () => {expect(resolveSettingsSubpage(view, new URLSearchParams(search))).toBe(expected)}})++ it('makes every Appearance row a routed, translated palette hit', () => {+ const subpages = APPEARANCE_SUBPAGES.map(page => page.id)++ for (const [key, setting] of Object.entries(APPEARANCE_SETTINGS)) {+ const id = APPEARANCE_SETTING_IDS[key as keyof typeof APPEARANCE_SETTING_IDS]+ expect(id).toMatch(/^appearance\.[a-z-]+$/)+ expect(subpages).toContain(setting.subpage)+ expect(appearanceSubpageForSetting(id)).toBe(setting.subpage)+ expect(+ resolveSettingsSubpage(+ 'config:appearance',+ new URLSearchParams(settingsSearchTargetQuery({ view: 'config:appearance', setting: id }))+ )+ ).toBe(setting.subpage)+ expect(setting.keywords.length).toBeGreaterThan(0)++ for (const locale of Object.values(TRANSLATIONS)) {+ expect(setting.copy(locale).label).toBeTruthy()+ }+ }++ // Platform-gated rows aside, the whole manifest reaches the palette.+ const targets = appearanceSearchTargets(TRANSLATIONS.en)+ const gated = Object.values(APPEARANCE_SETTINGS).filter(setting => 'available' in setting).length+ expect(targets.length).toBeGreaterThanOrEqual(Object.keys(APPEARANCE_SETTINGS).length - gated)+ expect(targets.map(target => target.label)).toEqual(expect.arrayContaining(['In-App Tips', 'Guided Tours']))+ })})diff --git a/apps/desktop/src/app/settings/use-settings-search.ts b/apps/desktop/src/app/settings/use-settings-search.tsindex fbf0d928365..afa21893a04 100644--- a/apps/desktop/src/app/settings/use-settings-search.ts+++ b/apps/desktop/src/app/settings/use-settings-search.ts@@ -9,19 +9,14 @@ import { useI18n } from '@/i18n'import { type IconComponent, Monitor, Package, Palette, Settings2, Wrench } from '@/lib/icons'import { $agentPlugins, isDesktopRelevantPlugin, loadAgentPlugins } from '@/store/agent-plugins'import { $gatewayState } from '@/store/session'-import { TRANSLUCENCY_SUPPORTED } from '@/store/translucency'import { useHermesConfigRecord } from '../hooks/use-config-record'import { useOnProfileSwitch } from '../hooks/use-on-profile-switch'+import { appearanceSearchTargets } from './appearance-subpages'import { SECTIONS } from './constants'import { OTHER_SUBPAGES } from './other-subpages'-import {- APPEARANCE_SETTING_IDS,- buildConfigSearchEntries,- buildCredentialSearchEntries,- type SettingsSearchEntry-} from './settings-search'+import { buildConfigSearchEntries, buildCredentialSearchEntries, type SettingsSearchEntry } from './settings-search'import { settingsSubpages } from './subpages'import type { SettingsView } from './types'@@ -122,154 +117,16 @@ export function useSettingsSearchCatalog(enabled: boolean) {})const appearanceContext = t.settings.sections.appearance- const appearance = t.settings.appearance- const appearanceEntries: SettingsSearchEntry[] = [- ...(window.hermesDesktop?.minimizeToTray- ? [- {- context: appearanceContext,- description: t.settings.config.minimizeToTrayDesc,- icon: Monitor,- id: `setting:${APPEARANCE_SETTING_IDS.minimizeToTray}`,- keywords: ['tray', 'background', 'minimize', 'dock', 'taskbar', 'menu bar'],- label: t.settings.config.minimizeToTrayTitle,- target: { view: 'config:appearance' as const, setting: APPEARANCE_SETTING_IDS.minimizeToTray }- }- ]- : []),- {- context: appearanceContext,- description: t.language.description,- icon: Palette,- id: `setting:${APPEARANCE_SETTING_IDS.language}`,- keywords: ['locale'],- label: t.language.label,- target: { setting: APPEARANCE_SETTING_IDS.language, view: 'config:appearance' }- },- {- context: appearanceContext,- description: appearance.themeDesc,- icon: Palette,- id: `setting:${APPEARANCE_SETTING_IDS.theme}`,- keywords: ['color mode', 'skin'],- label: appearance.themeTitle,- target: { setting: APPEARANCE_SETTING_IDS.theme, view: 'config:appearance' }- },- {- context: appearanceContext,- icon: Palette,- id: `setting:${APPEARANCE_SETTING_IDS.uiScale}`,- keywords: ['zoom', 'size'],- label: appearance.uiScaleTitle,- target: { setting: APPEARANCE_SETTING_IDS.uiScale, view: 'config:appearance' }- },- // Linux has no translucency row to land on, and a palette hit that scrolls- // to nothing is worse than no hit.- ...(TRANSLUCENCY_SUPPORTED- ? [- {- context: appearanceContext,- description: appearance.translucencyDesc,- icon: Palette,- id: `setting:${APPEARANCE_SETTING_IDS.translucency}`,- keywords: ['opacity', 'transparent'],- label: appearance.translucencyTitle,- target: { setting: APPEARANCE_SETTING_IDS.translucency, view: 'config:appearance' as const }- }- ]- : []),- {- context: appearanceContext,- description: appearance.userBubbleDesc,- icon: Palette,- id: `setting:${APPEARANCE_SETTING_IDS.userBubble}`,- keywords: ['opacity', 'transparent', 'message', 'bubble'],- label: appearance.userBubbleTitle,- target: { setting: APPEARANCE_SETTING_IDS.userBubble, view: 'config:appearance' }- },- {- context: appearanceContext,- description: appearance.textDirectionDesc,- icon: Palette,- id: `setting:${APPEARANCE_SETTING_IDS.textDirection}`,- keywords: ['rtl', 'ltr', 'right to left', 'left to right', 'bidi', 'arabic', 'hebrew', 'persian', 'align'],- label: appearance.textDirectionTitle,- target: { setting: APPEARANCE_SETTING_IDS.textDirection, view: 'config:appearance' }- },- {- context: appearanceContext,- description: appearance.backdropDesc,- icon: Palette,- id: `setting:${APPEARANCE_SETTING_IDS.backdrop}`,- keywords: ['background', 'blur'],- label: appearance.backdropTitle,- target: { setting: APPEARANCE_SETTING_IDS.backdrop, view: 'config:appearance' }- },- {- context: appearanceContext,- description: appearance.introSplashDesc,- icon: Palette,- id: `setting:${APPEARANCE_SETTING_IDS.introSplash}`,- keywords: ['splash', 'wordmark', 'empty chat', 'new chat'],- label: appearance.introSplashTitle,- target: { setting: APPEARANCE_SETTING_IDS.introSplash, view: 'config:appearance' }- },- {- context: appearanceContext,- description: t.interfaceMode.hint,- icon: Palette,- id: `setting:${APPEARANCE_SETTING_IDS.interfaceMode}`,- keywords: ['simple', 'advanced', 'mode', 'interface', 'chrome', 'minimal', 'focus'],- label: t.interfaceMode.title,- target: { setting: APPEARANCE_SETTING_IDS.interfaceMode, view: 'config:appearance' }- },- {- context: appearanceContext,- description: appearance.toolViewDesc,- icon: Palette,- id: `setting:${APPEARANCE_SETTING_IDS.toolView}`,- keywords: ['tool display', 'technical'],- label: appearance.toolViewTitle,- target: { setting: APPEARANCE_SETTING_IDS.toolView, view: 'config:appearance' }- },- {- context: appearanceContext,- description: appearance.hideCodeDiffsDesc,- icon: Palette,- id: `setting:${APPEARANCE_SETTING_IDS.hideCodeDiffs}`,- keywords: ['code', 'diff', 'patch', 'file edits', 'inline', 'added', 'removed'],- label: appearance.hideCodeDiffsTitle,- target: { setting: APPEARANCE_SETTING_IDS.hideCodeDiffs, view: 'config:appearance' }- },- {- context: appearanceContext,- description: appearance.hideThreadTimelineDesc,- icon: Palette,- id: `setting:${APPEARANCE_SETTING_IDS.hideThreadTimeline}`,- keywords: ['thread', 'conversation', 'timeline', 'bars', 'rail', 'navigation', 'hide'],- label: appearance.hideThreadTimelineTitle,- target: { setting: APPEARANCE_SETTING_IDS.hideThreadTimeline, view: 'config:appearance' }- },- {- context: appearanceContext,- description: appearance.appActionsDesc,- icon: Palette,- id: `setting:${APPEARANCE_SETTING_IDS.appActions}`,- keywords: ['titlebar', 'settings gear', 'layout', 'HUD', 'left', 'right', 'tabs'],- label: appearance.appActionsTitle,- target: { setting: APPEARANCE_SETTING_IDS.appActions, view: 'config:appearance' }- },- {- context: appearanceContext,- description: appearance.embedsDesc,- icon: Palette,- id: `setting:${APPEARANCE_SETTING_IDS.embeds}`,- keywords: ['external content', 'privacy'],- label: appearance.embedsTitle,- target: { setting: APPEARANCE_SETTING_IDS.embeds, view: 'config:appearance' }- }- ]+ // Every hand-built Appearance row, straight from the manifest that also+ // routes and ids them — the palette cannot drift from the page.+ const appearanceEntries: SettingsSearchEntry[] = appearanceSearchTargets(t).map(({ id, ...entry }) => ({+ ...entry,+ context: appearanceContext,+ icon: Palette,+ id: `setting:${id}`,+ target: { setting: id, view: 'config:appearance' }+ }))const credentialEntries = buildCredentialSearchEntries(envVarsFetching || envVarsError ? null : envVars,@@ -285,6 +142,10 @@ export function useSettingsSearchCatalog(enabled: boolean) {sessions: t.settings.nav.archivedChats}+ // A page named after its one setting (Appearance › Theme) would show up as+ // two identical rows; the setting wins because it lands on the row itself.+ const settingLabels = new Set(appearanceEntries.map(entry => `${entry.context}\u0000${entry.label}`))+const subpageEntries: SettingsSearchEntry[] = [...SECTIONS.map(section => ({view: `config:${section.id}` as SettingsView,@@ -296,16 +157,18 @@ export function useSettingsSearchCatalog(enabled: boolean) {label: pageLabels[view],icon: Settings2}))- ].flatMap(parent =>- settingsSubpages(parent.view).map(page => ({- context: parent.label,- icon: parent.icon,- id: `settings-page:${parent.view}:${page.id}`,- keywords: [parent.label, page.id],- label: t.settings.subpages[page.labelKey],- target: { view: parent.view, subpage: page.id }- }))- )+ ]+ .flatMap(parent =>+ settingsSubpages(parent.view).map(page => ({+ context: parent.label,+ icon: parent.icon,+ id: `settings-page:${parent.view}:${page.id}`,+ keywords: [parent.label, page.id],+ label: t.settings.subpages[page.labelKey],+ target: { view: parent.view, subpage: page.id }+ }))+ )+ .filter(entry => !settingLabels.has(`${entry.context}\u0000${entry.label}`))return {subpageEntries: [