The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): packaged installs show how to uninstall instead of an empty page
alt-glitch3d8ce003a40f
diff --git a/apps/desktop/electron/desktop-uninstall-ipc.test.ts b/apps/desktop/electron/desktop-uninstall-ipc.test.tsindex 79fee6235d0..4c11a223397 100644--- a/apps/desktop/electron/desktop-uninstall-ipc.test.ts+++ b/apps/desktop/electron/desktop-uninstall-ipc.test.ts@@ -4,7 +4,7 @@ import { registerDesktopUninstallIpc } from './desktop-uninstall'import type { DesktopUninstallIpcDeps, DesktopUninstallSummary } from './desktop-uninstall'import type { InstallStamp } from './install-stamp'-const fallbackSummary: Omit<DesktopUninstallSummary, 'code_removal_allowed'> = {+const fallbackSummary: Omit<DesktopUninstallSummary, 'code_removal_allowed' | 'native_removal_instructions'> = {hermes_home: '/test/.hermes',agent_installed: true,gui_installed: true,@@ -31,7 +31,8 @@ function captureIpc(stamp: DesktopUninstallIpcDeps['stamp']): CapturedIpc {const probeSummary: CapturedIpc['probeSummary'] = vi.fn(async (): Promise<DesktopUninstallSummary> => ({...fallbackSummary,probe: 'python',- code_removal_allowed: true+ code_removal_allowed: true,+ native_removal_instructions: null}))const runUninstall: CapturedIpc['runUninstall'] = vi.fn<DesktopUninstallIpcDeps['runUninstall']>(@@ -48,7 +49,15 @@ function captureIpc(stamp: DesktopUninstallIpcDeps['stamp']): CapturedIpc {}}- registerDesktopUninstallIpc({ ipcMain, stamp, fallbackSummary: localSummary, probeSummary, runUninstall })+ registerDesktopUninstallIpc({+ ipcMain,+ stamp,+ fallbackSummary: localSummary,+ probeSummary,+ runUninstall,+ removableAppPath: (): null => null,+ openAppsSettings: async (): Promise<void> => {}+ })return {probeSummary,@@ -78,9 +87,10 @@ test('excluded artifact owners block every uninstall IPC before a Python probe ofor (const stamp of stamps) {const ipc: CapturedIpc = captureIpc(stamp)- expect(await ipc.invoke('hermes:uninstall:summary')).toEqual({+ expect(await ipc.invoke('hermes:uninstall:summary')).toMatchObject({...fallbackSummary,- code_removal_allowed: false+ code_removal_allowed: false,+ native_removal_instructions: expect.any(String)})expect(ipc.probeSummary).not.toHaveBeenCalled()@@ -101,16 +111,22 @@ test('self-managed installs retain summary and uninstall IPC behavior under Elecfor (const stamp of [null, { payload: 'bootstrap', updateMechanism: 'self' }] as const) {const ipc: CapturedIpc = captureIpc(stamp)- ipc.probeSummary.mockResolvedValue({ ...fallbackSummary, probe: 'python', code_removal_allowed: false })+ ipc.probeSummary.mockResolvedValue({+ ...fallbackSummary,+ probe: 'python',+ code_removal_allowed: false,+ native_removal_instructions: null+ })expect(await ipc.invoke('hermes:uninstall:summary')).toEqual({...fallbackSummary,probe: 'python',- code_removal_allowed: true+ code_removal_allowed: true,+ native_removal_instructions: null})expect(ipc.probeSummary).toHaveBeenCalledOnce()expect(ipc.localSummary).not.toHaveBeenCalled()- ipc.probeSummary.mockResolvedValue({ ...fallbackSummary, code_removal_allowed: false })+ ipc.probeSummary.mockResolvedValue({ ...fallbackSummary, code_removal_allowed: false, native_removal_instructions: null })expect(await ipc.invoke('hermes:uninstall:summary')).toMatchObject({probe: 'fallback',code_removal_allowed: truediff --git a/apps/desktop/electron/desktop-uninstall.ts b/apps/desktop/electron/desktop-uninstall.tsindex ae51e549b02..452d8408e3d 100644--- a/apps/desktop/electron/desktop-uninstall.ts+++ b/apps/desktop/electron/desktop-uninstall.ts@@ -44,6 +44,8 @@ export interface UninstallSummaryDetails {export interface DesktopUninstallSummary extends UninstallSummaryDetails {code_removal_allowed: boolean+ /** Set only when the OS or package manager owns removal; the renderer shows it verbatim. */+ native_removal_instructions: string | null}export interface DesktopUninstallResult {@@ -63,6 +65,8 @@ export interface DesktopUninstallIpcDeps {fallbackSummary: () => UninstallSummaryDetailsprobeSummary: () => Promise<UninstallSummaryDetails>runUninstall: (mode: string) => Promise<DesktopUninstallResult>+ removableAppPath: () => string | null+ openAppsSettings: () => Promise<void>}export function registerDesktopUninstallIpc({@@ -70,7 +74,9 @@ export function registerDesktopUninstallIpc({stamp,fallbackSummary,probeSummary,- runUninstall+ runUninstall,+ removableAppPath,+ openAppsSettings}: DesktopUninstallIpcDeps): void {const kind: InstallKind = resolveInstallKind(stamp ?? {})const codeRemovalAllowed: boolean = installKindAllowsCodeRemoval(kind)@@ -78,8 +84,23 @@ export function registerDesktopUninstallIpc({ipcMain.handle('hermes:uninstall:summary', async (): Promise<DesktopUninstallSummary> => {const summary: UninstallSummaryDetails = codeRemovalAllowed ? await probeSummary() : fallbackSummary()- // The local artifact owns this decision, not the Python summary.- return { ...summary, code_removal_allowed: codeRemovalAllowed }+ // The local artifact owns this decision, not the Python summary. When+ // removal belongs to the OS, the main process also supplies the canonical+ // instructions so the renderer never guesses platform or install kind.+ return {+ ...summary,+ code_removal_allowed: codeRemovalAllowed,+ native_removal_instructions: codeRemovalAllowed+ ? null+ : nativeRemovalInstructions(kind, summary.platform, removableAppPath())+ }+ })+ ipcMain.handle('hermes:uninstall:openAppsSettings', async (): Promise<void> => {+ // The generic openExternal bridge admits web schemes only; this one+ // deep link is fixed here so the renderer cannot pass a URL.+ if (!codeRemovalAllowed && process.platform === 'win32') {+ await openAppsSettings()+ }})ipcMain.handle('hermes:uninstall:run',diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.tsindex e5ab3eae80b..b76a7e05887 100644--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@ -4957,10 +4957,6 @@ async function isSourceRuntimeUsable(root: string): Promise<boolean> {return (await resolveSourceInstallationBackend(root, [], { hermesHome: HERMES_HOME })) !== null}-function isActiveRuntimeUsable(): Promise<boolean> {- return isSourceRuntimeUsable(ACTIVE_HERMES_ROOT)-}-function activeRuntimeState(backend: SourceBackend | null): ActiveRuntimeState {// We DELIBERATELY do NOT verify that the checkout is currently at the// pinned commit -- users update via the in-app update path or `hermes@@ -19113,7 +19109,9 @@ registerDesktopUninstallIpc({stamp: INSTALL_STAMP,fallbackSummary: fallbackUninstallSummary,probeSummary: probeUninstallSummary,- runUninstall: runDesktopUninstall+ runUninstall: runDesktopUninstall,+ removableAppPath: () => resolveRemovableAppPath(process.execPath, process.platform, process.env),+ openAppsSettings: () => shell.openExternal('ms-settings:appsfeatures')})// Download a VS Code Marketplace extension and return the raw color-theme JSONdiff --git a/apps/desktop/electron/preload.ts b/apps/desktop/electron/preload.tsindex 7ab1fbf1beb..f82f48ea709 100644--- a/apps/desktop/electron/preload.ts+++ b/apps/desktop/electron/preload.ts@@ -659,7 +659,8 @@ contextBridge.exposeInMainWorld('hermesDesktop', {getRemoteDisplayReason: () => ipcRenderer.invoke('hermes:get-remote-display-reason'),uninstall: {summary: () => ipcRenderer.invoke('hermes:uninstall:summary'),- run: mode => ipcRenderer.invoke('hermes:uninstall:run', { mode })+ run: mode => ipcRenderer.invoke('hermes:uninstall:run', { mode }),+ openAppsSettings: () => ipcRenderer.invoke('hermes:uninstall:openAppsSettings')},updates: {check: opts => ipcRenderer.invoke('hermes:updates:check', opts),diff --git a/apps/desktop/electron/windows-hermes-path.ts b/apps/desktop/electron/windows-hermes-path.tsindex 6a9c2019244..a48541065be 100644--- a/apps/desktop/electron/windows-hermes-path.ts+++ b/apps/desktop/electron/windows-hermes-path.ts@@ -101,7 +101,7 @@ export interface ResolveVenvHermesCommandDeps {* install" re-resolves the same broken venv forever instead of falling* through to the bootstrap installer.*- * Mirrors isActiveRuntimeUsable(): probes with the checkout on PYTHONPATH so+ * Mirrors isSourceRuntimeUsable() in main.ts: probes with the checkout on PYTHONPATH so* a healthy source-tree venv passes.** Returns null when `command` is not a venv hermes shim, the underlyingdiff --git a/apps/desktop/src/app/settings/uninstall-section.test.tsx b/apps/desktop/src/app/settings/uninstall-section.test.tsxindex 68a7605380d..9f800ae0119 100644--- a/apps/desktop/src/app/settings/uninstall-section.test.tsx+++ b/apps/desktop/src/app/settings/uninstall-section.test.tsx@@ -18,6 +18,7 @@ function Surface(): React.JSX.Element {function summary(allowed: boolean): DesktopUninstallSummary {return {code_removal_allowed: allowed,+ native_removal_instructions: allowed ? null : 'Quit the app and drag Hermes.app from Applications to the Trash.',hermes_home: '/test/home',agent_installed: true,gui_installed: true,@@ -34,9 +35,9 @@ afterEach((): void => {vi.unstubAllGlobals()})-it.each(['external', 'missing-policy', 'probe-failed', 'loading'] as const)(+it.each(['missing-policy', 'probe-failed', 'loading'] as const)('does not offer uninstall actions when ownership is %s',- async (state: 'external' | 'missing-policy' | 'probe-failed' | 'loading'): Promise<void> => {+ async (state: 'missing-policy' | 'probe-failed' | 'loading'): Promise<void> => {const getSummary: ReturnType<typeof vi.fn> = vi.fn(async (): Promise<DesktopUninstallSummary> => {if (state === 'probe-failed') {throw new Error('IPC unavailable')@@ -107,3 +108,27 @@ it.each(['gui', 'lite', 'full'] as const)(expect(run).toHaveBeenCalledWith(mode)})++it('shows native removal steps, data location, and Apps settings on a managed Windows install', async (): Promise<void> => {+ const run: ReturnType<typeof vi.fn> = vi.fn()+ const openAppsSettings: ReturnType<typeof vi.fn> = vi.fn().mockResolvedValue(undefined)++ vi.stubGlobal('hermesDesktop', {+ uninstall: {+ summary: async (): Promise<DesktopUninstallSummary> => ({+ ...summary(false),+ platform: 'win32',+ native_removal_instructions: 'To uninstall, go to Windows Settings → Apps → Installed apps.'+ }),+ run,+ openAppsSettings+ }+ })+ render(<UninstallSection />)+ expect(await screen.findByText(/Installed apps/)).toBeTruthy()+ expect(screen.getByText(/\/test\/home/)).toBeTruthy()+ fireEvent.click(screen.getByRole('button', { name: 'Open Apps settings' }))+ expect(openAppsSettings).toHaveBeenCalledOnce()+ expect(run).not.toHaveBeenCalled()+ expect(screen.queryByRole('button', { name: /Uninstall/ })).toBeNull()+})diff --git a/apps/desktop/src/app/settings/uninstall-section.tsx b/apps/desktop/src/app/settings/uninstall-section.tsxindex dd7b5ded5d0..e632341eef0 100644--- a/apps/desktop/src/app/settings/uninstall-section.tsx+++ b/apps/desktop/src/app/settings/uninstall-section.tsx@@ -85,10 +85,35 @@ export function UninstallSection(): ReactElement | null {const bridge: Window['hermesDesktop']['uninstall'] | undefined = window.hermesDesktop?.uninstall- if (!bridge || summary?.code_removal_allowed !== true) {+ if (!bridge || !summary) {return null}+ if (!summary.code_removal_allowed) {+ // The OS or package manager owns removal; show how, never a destructive fallback.+ if (!summary.native_removal_instructions) {+ return null+ }++ return (+ <div className={cn('mx-auto w-full max-w-2xl', !hasBreadcrumb && 'mt-8')}>+ <SectionHeading icon={AlertTriangle} page title={u.uninstallHermes} />+ <div className="flex flex-col gap-2 rounded-xl border border-border/60 bg-background/40 px-4 py-3">+ <p className="text-xs text-muted-foreground">{u.managedBody}</p>+ <p className="text-sm font-medium">{summary.native_removal_instructions}</p>+ <p className="text-xs text-muted-foreground">{u.dataKept(summary.hermes_home)}</p>+ {summary.platform === 'win32' && (+ <div className="mt-1">+ <Button onClick={(): void => void bridge.openAppsSettings()} size="sm" variant="outline">+ {u.openAppsSettings}+ </Button>+ </div>+ )}+ </div>+ </div>+ )+ }+// An owned GUI can remain after its local agent has been removed.const agentInstalled: boolean = summary.agent_installedconst visibleOptions: ModeOption[] = options.filter((opt: ModeOption): boolean => agentInstalled || !opt.needsAgent)diff --git a/apps/desktop/src/global.d.ts b/apps/desktop/src/global.d.tsindex 007eb281d35..eaa267af672 100644--- a/apps/desktop/src/global.d.ts+++ b/apps/desktop/src/global.d.ts@@ -664,6 +664,7 @@ declare global {uninstall: {summary: () => Promise<DesktopUninstallSummary>run: (mode: DesktopUninstallMode) => Promise<DesktopUninstallResult>+ openAppsSettings: () => Promise<void>}themes: {// Download a VS Code Marketplace extension and return the raw color@@ -823,6 +824,8 @@ export type DesktopUninstallMode = 'full' | 'gui' | 'lite'export interface DesktopUninstallSummary {/** Local package ownership, resolved by Electron before offering removal. */code_removal_allowed: boolean+ /** Native removal steps when the OS or a package manager owns removal. */+ native_removal_instructions: null | stringhermes_home: stringagent_installed: booleangui_installed: booleandiff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 8667896d4a5..87af184eab2 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -7,6 +7,7 @@ import { enCatalogInstall } from './en_catalog_install'import { enModelMenu } from './en_model_menu'import { enNotices } from './en_notices'import { enSharedMetrics } from './en_shared_metrics'+import { enUninstallSection } from './en_uninstall_section'import type { Translations } from './types'export const en: Translations = {@@ -1161,37 +1162,7 @@ export const en: Translations = {},fieldLabels: FIELD_LABELS,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',- 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'- }- }- },+ uninstallSection: enUninstallSection,poolLimits: {warmBotBackendsAria: 'Warm bot backends',warmBotBackendsTitle: 'Warm Bot Backends',diff --git a/apps/desktop/src/i18n/en_uninstall_section.ts b/apps/desktop/src/i18n/en_uninstall_section.tsnew file mode 100644index 00000000000..9a53b205ad7--- /dev/null+++ b/apps/desktop/src/i18n/en_uninstall_section.ts@@ -0,0 +1,36 @@+import type { UninstallSectionTranslations } from './types_uninstall_section'++// Settings > About > Uninstall, composed by en.ts as `settings.uninstallSection`.+export const enUninstallSection: UninstallSectionTranslations = {+ dangerZone: 'Danger zone',+ checkingInstalled: 'Checking what’s installed…',+ uninstallHermes: 'Uninstall Hermes',+ managedBody: 'This install is managed by your system, so Hermes cannot remove itself.',+ dataKept: path => `Your config, chats, and secrets live in ${path}. Removing the app does not delete them.`,+ openAppsSettings: 'Open Apps settings',+ chooseHowMuch:+ 'Choose how much to remove. The app closes to finish the job; reopen the installer any time to come back.',+ confirmUninstall: 'Confirm uninstall',+ 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'+ }+ }+}diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 4e7130698b8..acb3ca209a6 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -15,6 +15,7 @@ import type { CatalogInstallTranslations } from './types_catalog_install'import type { ModelMenuTranslations } from './types_model_menu'import type { NoticeTranslations } from './types_notices'import type { SharedMetricsTranslations } from './types_shared_metrics'+import type { UninstallSectionTranslations } from './types_uninstall_section'/** The locales compiled into the app (`TRANSLATIONS`). */export type BundledLocale = 'en' | 'zh' | 'zh-hant' | 'ja' | 'ar' | 'ru' | 'fr' | 'de' | 'es'@@ -950,23 +951,7 @@ export interface Translations extends NoticeTranslations {}fieldLabels: Record<string, string>fieldDescriptions: Record<string, string>- uninstallSection: {- dangerZone: string- checkingInstalled: string- uninstallHermes: 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 }- }- }+ uninstallSection: UninstallSectionTranslationspoolLimits: {warmBotBackendsAria: stringwarmBotBackendsTitle: stringdiff --git a/apps/desktop/src/i18n/types_uninstall_section.ts b/apps/desktop/src/i18n/types_uninstall_section.tsnew file mode 100644index 00000000000..57c414d14a3--- /dev/null+++ b/apps/desktop/src/i18n/types_uninstall_section.ts@@ -0,0 +1,21 @@+// Settings > About > Uninstall; `Translations.settings.uninstallSection`.+export interface UninstallSectionTranslations {+ dangerZone: string+ checkingInstalled: string+ uninstallHermes: string+ managedBody: string+ dataKept: (path: string) => string+ openAppsSettings: 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 }+ }+}diff --git a/locales/_keys.desktop.json b/locales/_keys.desktop.jsonindex d3347411786..d27b856ddbe 100644--- a/locales/_keys.desktop.json+++ b/locales/_keys.desktop.json@@ -3845,6 +3845,9 @@"settings.uninstallSection.confirmUninstall","settings.uninstallSection.couldNotStart","settings.uninstallSection.dangerZone",+ "settings.uninstallSection.dataKept",+ "settings.uninstallSection.managedBody",+ "settings.uninstallSection.openAppsSettings","settings.uninstallSection.options.full.consequence","settings.uninstallSection.options.full.description","settings.uninstallSection.options.full.title",