The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): localize uninstall confirmation and options
brooklyn!4fd3f02a3f6d
diff --git a/apps/desktop/src/app/settings/uninstall-section.test.tsx b/apps/desktop/src/app/settings/uninstall-section.test.tsxnew file mode 100644index 00000000000..7c5f00196b8--- /dev/null+++ b/apps/desktop/src/app/settings/uninstall-section.test.tsx@@ -0,0 +1,44 @@+import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'+import { afterEach, expect, it, vi } from 'vitest'++import { I18nProvider, TRANSLATIONS, useI18n } from '@/i18n'+import type { I18nContextValue } from '@/i18n'++import { UninstallSection } from './uninstall-section'++let i18n: I18nContextValue++function Surface() {+ i18n = useI18n()++ return <UninstallSection />+}++afterEach(() => {+ cleanup()+ vi.unstubAllGlobals()+})+it.each(['gui', 'lite', 'full'] as const)(+ 'localizes confirmation for %s without changing mode or running before confirmation',+ async mode => {+ const run = vi.fn().mockResolvedValue({ ok: false })+ vi.stubGlobal('hermesDesktop', {+ uninstall: { summary: async () => ({ agent_installed: true, running_app_path: '/fixture/Hermes.app' }), run }+ })+ render(+ <I18nProvider configClient={null} initialLocale="zh">+ <Surface />+ </I18nProvider>+ )+ const zh = TRANSLATIONS.zh.settings.uninstallSection+ await screen.findByText(zh.uninstallHermes)+ fireEvent.click(screen.getByRole('button', { name: new RegExp(zh.options[mode].title) }))+ expect(screen.getByText(zh.confirmBody(zh.options[mode].consequence))).toBeTruthy()+ expect(run).not.toHaveBeenCalled()+ await act(() => i18n.setLocale('ja'))+ const ja = TRANSLATIONS.ja.settings.uninstallSection+ expect(screen.getByText(ja.confirmBody(ja.options[mode].consequence))).toBeTruthy()+ fireEvent.click(screen.getByRole('button', { name: ja.yesUninstall }))+ expect(run).toHaveBeenCalledWith(mode)+ }+)diff --git a/apps/desktop/src/app/settings/uninstall-section.tsx b/apps/desktop/src/app/settings/uninstall-section.tsxindex dc60b3cc2cb..abdb27a7db2 100644--- a/apps/desktop/src/app/settings/uninstall-section.tsx+++ b/apps/desktop/src/app/settings/uninstall-section.tsx@@ -18,37 +18,39 @@ interface ModeOption {needsAgent: boolean}-const OPTIONS: ModeOption[] = [- {- mode: 'gui',- title: 'Uninstall Chat GUI only',- description: 'Remove this desktop app. The Hermes agent, your config, and chats all stay.',- consequence: 'the desktop Chat GUI (this app and its data)',- needsAgent: false- },- {- mode: 'lite',- title: 'Uninstall GUI + agent, keep my data',- description: 'Remove the app and the Hermes agent, but keep config, chats, and secrets for a future reinstall.',- consequence: 'the Chat GUI and the Hermes agent (config, chats, and secrets are kept)',- needsAgent: true- },- {- mode: 'full',- title: 'Uninstall everything',- description: 'Remove the app, the agent, and all user data — config, chats, scheduled jobs, secrets, logs.',- consequence: 'EVERYTHING — the Chat GUI, the Hermes agent, and all of your config, chats, secrets, and logs',- // full removes the agent (and user data), so it's an agent-removing option:- // hide it on a lite client with no local agent, same as lite. A lite client- // connecting to a remote backend has no local agent OR local user data the- // GUI installed, so gui-only is the correct (and only) option there.- needsAgent: true- }-]-export function UninstallSection() {const hasBreadcrumb = useContext(SettingsBreadcrumbContext)const { t } = useI18n()+ const u = t.settings.uninstallSection++ const options: ModeOption[] = [+ {+ mode: 'gui',+ title: u.options.gui.title,+ description: u.options.gui.description,+ consequence: u.options.gui.consequence,+ needsAgent: false+ },+ {+ mode: 'lite',+ title: u.options.lite.title,+ description: u.options.lite.description,+ consequence: u.options.lite.consequence,+ needsAgent: true+ },+ {+ mode: 'full',+ title: u.options.full.title,+ description: u.options.full.description,+ consequence: u.options.full.consequence,+ // full removes the agent (and user data), so it's an agent-removing option:+ // hide it on a lite client with no local agent, same as lite. A lite client+ // connecting to a remote backend has no local agent OR local user data the+ // GUI installed, so gui-only is the correct (and only) option there.+ needsAgent: true+ }+ ]+const [summary, setSummary] = useState<DesktopUninstallSummary | null>(null)const [loading, setLoading] = useState(true)const [pending, setPending] = useState<DesktopUninstallMode | null>(null)@@ -95,7 +97,7 @@ export function UninstallSection() {// Gate the agent-removing options on whether an agent is actually present.// A future lite client that ships without the bundled agent shows GUI-only.const agentInstalled = summary?.agent_installed ?? false- const visibleOptions = OPTIONS.filter(opt => agentInstalled || !opt.needsAgent)+ const visibleOptions = options.filter(opt => agentInstalled || !opt.needsAgent)const handleConfirm = async () => {if (!pending) {@@ -109,7 +111,7 @@ export function UninstallSection() {const result = await bridge.run(pending)if (!result.ok) {- setError(result.message || result.error || 'Uninstall could not start.')+ setError(result.message || result.error || u.couldNotStart)setRunning(false)setPending(null)}@@ -121,7 +123,7 @@ export function UninstallSection() {}}- const pendingOption = OPTIONS.find(opt => opt.mode === pending) ?? null+ const pendingOption = options.find(opt => opt.mode === pending) ?? nullreturn (<div className={cn('mx-auto w-full max-w-2xl', !hasBreadcrumb && 'mt-8')}>@@ -131,34 +133,32 @@ export function UninstallSection() {{loading ? (<div className="flex items-center gap-2 py-2 text-sm text-muted-foreground"><Loader2 className="size-3.5 animate-spin" />- Checking what's installed…+ {u.checkingInstalled}</div>) : pendingOption ? (<div><p className="text-sm font-medium text-destructive">{t.settings.uninstallSection.confirmUninstall}</p>- <p className="mt-1 text-xs text-muted-foreground">- This removes {pendingOption.consequence}. This can't be undone.- </p>+ <p className="mt-1 text-xs text-muted-foreground">{u.confirmBody(pendingOption.consequence)}</p>{summary?.running_app_path && (- <p className="mt-1 font-mono text-[0.68rem] text-muted-foreground/60">App: {summary.running_app_path}</p>+ <p className="mt-1 font-mono text-[0.68rem] text-muted-foreground/60">+ {u.appLabel} {summary.running_app_path}+ </p>)}{error && <p className="mt-2 text-xs text-destructive">{error}</p>}<div className="mt-3 flex flex-wrap items-center gap-3"><Button disabled={running} onClick={() => void handleConfirm()} size="sm" variant="destructive">{running && <Loader2 className="size-3 animate-spin" />}- {running ? 'Uninstalling…' : 'Yes, uninstall'}+ {running ? u.uninstalling : u.yesUninstall}</Button><Button disabled={running} onClick={() => setPending(null)} size="sm" variant="text">- Cancel+ {t.common.cancel}</Button></div></div>) : (<div className="flex flex-col gap-2"><p className="text-sm font-medium">{t.settings.uninstallSection.uninstallHermes}</p>- <p className="text-xs text-muted-foreground">- Choose how much to remove. The app closes to finish the job; reopen the installer any time to come back.- </p>+ <p className="text-xs text-muted-foreground">{u.chooseHowMuch}</p><div className="mt-1 flex flex-col gap-2">{visibleOptions.map(opt => (<buttondiff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex a000ea08a00..e9e27301d29 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -1185,8 +1185,34 @@ export const en: Translations = {fieldDescriptions: FIELD_DESCRIPTIONS,uninstallSection: {dangerZone: 'Danger zone',+ checkingInstalled: 'Checking what’s installed…',+ uninstallHermes: 'Uninstall Hermes',+ chooseHowMuch:+ 'Choose how much to remove. The app closes to finish the job; reopen the installer any time to come back.',confirmUninstall: 'Confirm uninstall',- uninstallHermes: 'Uninstall Hermes'+ confirmBody: what => `This removes ${what}. This can’t be undone.`,+ appLabel: 'App:',+ couldNotStart: 'Uninstall could not start.',+ uninstalling: 'Uninstalling…',+ yesUninstall: 'Yes, uninstall',+ options: {+ gui: {+ title: 'Uninstall Chat GUI only',+ description: 'Remove this desktop app. The Hermes agent, your config, and chats all stay.',+ consequence: 'the desktop Chat GUI (this app and its data)'+ },+ lite: {+ title: 'Uninstall GUI + agent, keep my data',+ description:+ 'Remove the app and the Hermes agent, but keep config, chats, and secrets for a future reinstall.',+ consequence: 'the Chat GUI and the Hermes agent (config, chats, and secrets are kept)'+ },+ full: {+ title: 'Uninstall everything',+ description: 'Remove the app, the agent, and all user data — config, chats, scheduled jobs, secrets, logs.',+ consequence: 'EVERYTHING — the Chat GUI, the Hermes agent, and all of your config, chats, secrets, and logs'+ }+ }},poolLimits: {warmBotBackendsAria: 'Warm bot backends',diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex fe3808830d2..c729401c464 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -305,6 +305,38 @@ export const ja = defineLocale({},settings: {+ uninstallSection: {+ dangerZone: '危険ゾーン',+ checkingInstalled: 'インストール内容を確認中…',+ uninstallHermes: 'Hermes をアンインストール',+ chooseHowMuch:+ '削除する範囲を選択してください。完了するためにアプリが閉じます。インストーラーを開き直せばいつでも戻れます。',+ confirmUninstall: 'アンインストールの確認',+ confirmBody: what => `${what} が削除されます。この操作は取り消せません。`,+ appLabel: 'アプリ:',+ couldNotStart: 'アンインストールを開始できませんでした。',+ uninstalling: 'アンインストール中…',+ yesUninstall: 'はい、アンインストール',+ options: {+ gui: {+ title: 'Chat GUI のみアンインストール',+ description: 'このデスクトップアプリを削除します。Hermes エージェント、設定、チャットはすべて残ります。',+ consequence: 'デスクトップ Chat GUI(このアプリとそのデータ)'+ },+ lite: {+ title: 'GUI とエージェントをアンインストール、データは保持',+ description:+ 'アプリと Hermes エージェントを削除しますが、将来の再インストールに備えて設定・チャット・シークレットは保持します。',+ consequence: 'Chat GUI と Hermes エージェント(設定・チャット・シークレットは保持)'+ },+ full: {+ title: 'すべてアンインストール',+ description:+ 'アプリ、エージェント、すべてのユーザーデータ(設定、チャット、定期ジョブ、シークレット、ログ)を削除します。',+ consequence: 'すべて——Chat GUI、Hermes エージェント、およびすべての設定・チャット・シークレット・ログ'+ }+ }+ },subpages: {appearanceTheme: 'テーマ',appearanceTypography: 'フォントと表示倍率',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 9a5fee2dcc7..105324b20ba 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -983,8 +983,20 @@ export interface Translations {fieldDescriptions: Record<string, string>uninstallSection: {dangerZone: string- confirmUninstall: string+ checkingInstalled: stringuninstallHermes: string+ chooseHowMuch: string+ confirmUninstall: string+ confirmBody: (what: string) => string+ appLabel: string+ couldNotStart: string+ uninstalling: string+ yesUninstall: string+ options: {+ gui: { title: string; description: string; consequence: string }+ lite: { title: string; description: string; consequence: string }+ full: { title: string; description: string; consequence: string }+ }}poolLimits: {warmBotBackendsAria: stringdiff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.tsindex 2de4ca5dbdd..ac300898fd0 100644--- a/apps/desktop/src/i18n/zh-hant.ts+++ b/apps/desktop/src/i18n/zh-hant.ts@@ -945,8 +945,32 @@ export const zhHant = defineLocale({}),uninstallSection: {dangerZone: '危險操作',+ checkingInstalled: '正在檢查已安裝內容…',+ uninstallHermes: '解除安裝 Hermes',+ chooseHowMuch: '選擇要移除的內容。應用程式會關閉以完成作業;隨時重新開啟安裝程式即可返回。',confirmUninstall: '確認解除安裝',- uninstallHermes: '解除安裝 Hermes'+ confirmBody: what => `這將移除${what}。此操作無法復原。`,+ appLabel: '應用程式:',+ couldNotStart: '無法開始解除安裝。',+ uninstalling: '正在解除安裝…',+ yesUninstall: '是,解除安裝',+ options: {+ gui: {+ title: '僅解除安裝聊天 GUI',+ description: '移除此桌面應用程式。Hermes 代理、你的設定和聊天記錄都會保留。',+ consequence: '桌面聊天 GUI(此應用程式及其資料)'+ },+ lite: {+ title: '解除安裝 GUI 與代理,保留資料',+ description: '移除應用程式和 Hermes 代理,但保留設定、聊天記錄和機密,以便日後重新安裝。',+ consequence: '聊天 GUI 和 Hermes 代理(設定、聊天記錄和機密會保留)'+ },+ full: {+ title: '解除安裝全部',+ description: '移除應用程式、代理和所有使用者資料——設定、聊天記錄、排程工作、機密和日誌。',+ consequence: '全部內容——聊天 GUI、Hermes 代理,以及你的所有設定、聊天記錄、機密和日誌'+ }+ }},poolLimits: {warmBotBackendsAria: '預熱機器人後端',diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex ea1ae4f9354..b6daca7bbd6 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -1155,8 +1155,32 @@ export const zh = defineLocale({}),uninstallSection: {dangerZone: '危险操作',+ checkingInstalled: '正在检查已安装内容…',+ uninstallHermes: '卸载 Hermes',+ chooseHowMuch: '选择要删除的内容。应用会关闭以完成卸载;随时重新打开安装程序即可恢复。',confirmUninstall: '确认卸载',- uninstallHermes: '卸载 Hermes'+ confirmBody: what => `这将删除${what}。此操作无法撤销。`,+ appLabel: '应用:',+ couldNotStart: '无法开始卸载。',+ uninstalling: '正在卸载…',+ yesUninstall: '是,卸载',+ options: {+ gui: {+ title: '仅卸载聊天图形界面',+ description: '仅移除此桌面应用。Hermes 智能体、你的配置和聊天记录都会保留。',+ consequence: '桌面聊天图形界面(此应用及其数据)'+ },+ lite: {+ title: '卸载图形界面和智能体,保留数据',+ description: '移除应用和 Hermes 智能体,但保留配置、聊天记录和密钥,以便将来重新安装。',+ consequence: '聊天图形界面和 Hermes 智能体(配置、聊天记录和密钥会保留)'+ },+ full: {+ title: '全部卸载',+ description: '移除应用、智能体和所有用户数据——配置、聊天记录、定时任务、密钥和日志。',+ consequence: '全部内容——聊天图形界面、Hermes 智能体以及你的所有配置、聊天记录、密钥和日志'+ }+ }},poolLimits: {warmBotBackendsAria: '预热机器人后端',