Phase 004: remove the desktop shell, website tooling, and bundled hermes CLI

- Drop all desktop/Electron branches, scripts, and UI (title bar, pets,
  desktop bridge); LAN endpoint kind is now web/custom only
- Replace the bundled hermes CLI with user-side installation: add
  GET /api/hermes/cli-status plus a HermesMissingView onboarding guide
- Remove the version-management UI (snapshots handled by git) and prune
  dead website/mcu/claude scripts and lockfile entries
This commit is contained in:
2026-10-16 15:33:56 +08:00
parent 8c1ddf415f
commit 4701bf0ad0
49 changed files with 354 additions and 2403 deletions
-70
View File
@@ -11,12 +11,10 @@ import {
gatewayStateLooksRunningForProfile,
parseGatewayStatusesFromProfileListOutput,
prepareGatewayForProfileDelete,
recoverWindowsDesktopGatewayOrphans,
reconcileGatewayManagementTransition,
resolveGatewayTargetProfile,
selectGatewayProfilesForAutostart,
selectProfilesForGatewayAutostart,
shouldRecoverWindowsDesktopGatewayOrphans,
shouldUseUnifiedGatewayManagement,
shouldUseManagedGatewayRun,
shouldUseManagedGatewayRunForAutostart,
@@ -251,74 +249,6 @@ describe('gateway autostart status parsing', () => {
}
})
it('only recovers Windows desktop gateway orphans when enabled', () => {
expect(shouldRecoverWindowsDesktopGatewayOrphans('win32', { HERMES_DESKTOP: 'true' })).toBe(true)
expect(shouldRecoverWindowsDesktopGatewayOrphans('darwin', { HERMES_DESKTOP: 'true' })).toBe(false)
expect(shouldRecoverWindowsDesktopGatewayOrphans('win32', {})).toBe(false)
expect(shouldRecoverWindowsDesktopGatewayOrphans('win32', {
HERMES_DESKTOP: 'true',
HERMES_WEB_UI_DISABLE_GATEWAY_STARTUP_RECOVERY: '1',
})).toBe(false)
})
it('kills Windows desktop gateway runtime PIDs and removes stale runtime files', async () => {
const home = mkdtempSync(join(tmpdir(), 'hermes-gateway-recovery-'))
const workHome = join(home, 'profiles', 'work')
mkdirSync(workHome, { recursive: true })
const killed: number[] = []
const stopped: string[] = []
try {
writeFileSync(join(home, 'gateway.pid'), JSON.stringify({ pid: 11111 }), 'utf-8')
writeFileSync(join(home, 'gateway_state.json'), JSON.stringify({ pid: 99999, gateway_state: 'stopped' }), 'utf-8')
writeFileSync(join(workHome, 'gateway.lock'), JSON.stringify({ pid: '22222' }), 'utf-8')
writeFileSync(join(workHome, 'gateway_state.json'), JSON.stringify({ pid: 33333, gateway_state: 'running' }), 'utf-8')
const result = await recoverWindowsDesktopGatewayOrphans({
platform: 'win32',
env: { HERMES_DESKTOP: 'true' },
hermesHome: home,
isAlive: pid => pid !== 99999,
stopGateway: async profileDir => { stopped.push(profileDir) },
execTaskkill: async pid => { killed.push(pid) },
})
expect(result.attempted).toBe(true)
expect(stopped.sort()).toEqual([home, workHome].sort())
expect(result.stoppedProfileDirs.sort()).toEqual([home, workHome].sort())
expect(killed.sort((a, b) => a - b)).toEqual([11111, 22222, 33333])
expect(result.killedPids.sort((a, b) => a - b)).toEqual([11111, 22222, 33333])
expect(existsSync(join(home, 'gateway.pid'))).toBe(false)
expect(existsSync(join(home, 'gateway_state.json'))).toBe(false)
expect(existsSync(join(workHome, 'gateway.lock'))).toBe(false)
expect(existsSync(join(workHome, 'gateway_state.json'))).toBe(false)
} finally {
rmSync(home, { recursive: true, force: true })
}
})
it('skips recovery outside Windows desktop mode without deleting runtime files', async () => {
const home = mkdtempSync(join(tmpdir(), 'hermes-gateway-recovery-skip-'))
try {
const pidPath = join(home, 'gateway.pid')
writeFileSync(pidPath, JSON.stringify({ pid: 11111 }), 'utf-8')
const result = await recoverWindowsDesktopGatewayOrphans({
platform: 'linux',
env: { HERMES_DESKTOP: 'true' },
hermesHome: home,
isAlive: () => {
throw new Error('should not check liveness')
},
})
expect(result.attempted).toBe(false)
expect(existsSync(pidPath)).toBe(true)
} finally {
rmSync(home, { recursive: true, force: true })
}
})
it('detects managed gateway state files with a live pid', () => {
const dir = mkdtempSync(join(tmpdir(), 'hermes-gateway-state-'))
try {