The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): confirm before switching to This device (#122046)
brooklyn!d45d6f0eb918
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.tsindex 56219dd67b2..b3edce31988 100644--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@ -15009,6 +15009,13 @@ ipcMain.handle('hermes:bootstrap:cancel', async () => {})ipcMain.handle('hermes:boot-progress:get', async () => bootProgressState)ipcMain.handle('hermes:bootstrap:get', async () => getBootstrapState())+ipcMain.handle('hermes:local-backend:probe', async () => {+ // Resolution only. ensureRuntime/runBootstrap must not start from a hover+ // or a click that has not confirmed the install.+ const backend = await resolveHermesBackend([])++ return { bootstrapNeeded: backend?.kind === 'bootstrap-needed' }+})ipcMain.handle('hermes:connection-config:get', async (_event, profile) =>sanitizeDesktopConnectionConfig(readDesktopConnectionConfig(), profile))diff --git a/apps/desktop/electron/preload.ts b/apps/desktop/electron/preload.tsindex 28631ce9e16..2988a7eb661 100644--- a/apps/desktop/electron/preload.ts+++ b/apps/desktop/electron/preload.ts@@ -610,6 +610,7 @@ contextBridge.exposeInMainWorld('hermesDesktop', {// current snapshot via getBootstrapState() to recover after a devtools// reload mid-bootstrap.getBootstrapState: () => ipcRenderer.invoke('hermes:bootstrap:get'),+ probeLocalBackend: () => ipcRenderer.invoke('hermes:local-backend:probe'),continueBootstrapLocal: () => ipcRenderer.invoke('hermes:bootstrap:continue-local'),recycleBackend: profile => ipcRenderer.invoke('hermes:backend:recycle', profile),resetBootstrap: () => ipcRenderer.invoke('hermes:bootstrap:reset'),diff --git a/apps/desktop/src/app/chat/sidebar/connection-switcher.tsx b/apps/desktop/src/app/chat/sidebar/connection-switcher.tsxindex a0ff8b47ed5..d847fc07b0f 100644--- a/apps/desktop/src/app/chat/sidebar/connection-switcher.tsx+++ b/apps/desktop/src/app/chat/sidebar/connection-switcher.tsx@@ -30,6 +30,7 @@ import { closeFindBar } from '@/store/find-in-page'import { notifyError } from '@/store/notifications'import { ConnectionGlyph } from './connection-glyph'+import { useLocalDeviceSwitch } from './local-device-switch'export function ConnectionSwitcher({ compact = false, onConnect }: { compact?: boolean; onConnect: () => void }) {const { t } = useI18n()@@ -40,6 +41,7 @@ export function ConnectionSwitcher({ compact = false, onConnect }: { compact?: bconst [menuOpen, setMenuOpen] = useState(false)const connectionListRef = useRef<HTMLDivElement>(null)const searchInputRef = useRef<HTMLInputElement>(null)+ const { dialog: localDeviceDialog, request: requestLocalDevice } = useLocalDeviceSwitch()const connections = useMemo(() => sortConnectionsForDisplay(registry?.connections ?? []), [registry?.connections])@@ -94,9 +96,23 @@ export function ConnectionSwitcher({ compact = false, onConnect }: { compact?: btriggerHaptic('selection')const connection = connections.find(candidate => candidate.id === connectionId)- void selectConnection(connectionId).catch(error =>- notifyError(error, t.profiles.switchConnectionFailed(connection?.label ?? connectionId))- )+ void (async () => {+ if (connection?.kind === 'local' && connectionId !== activeConnectionId) {+ const accepted = await requestLocalDevice({+ connectionId,+ label: connection.label,+ replaceCenter: true+ })++ if (!accepted) {+ return+ }+ }++ await selectConnection(connectionId).catch(error =>+ notifyError(error, t.profiles.switchConnectionFailed(connection?.label ?? connectionId))+ )+ })()}return (@@ -208,6 +224,7 @@ export function ConnectionSwitcher({ compact = false, onConnect }: { compact?: b</DropdownMenuItem></DropdownMenuContent></DropdownMenu>+ {localDeviceDialog}</div>)}diff --git a/apps/desktop/src/app/chat/sidebar/local-device-switch.tsx b/apps/desktop/src/app/chat/sidebar/local-device-switch.tsxnew file mode 100644index 00000000000..931932c5dfc--- /dev/null+++ b/apps/desktop/src/app/chat/sidebar/local-device-switch.tsx@@ -0,0 +1,118 @@+import { LOCAL_CONNECTION_ID } from '@hermes/shared'+import { useRef, useState } from 'react'++import { FirstRunRemoteSetup } from '@/components/remote-setup/first-run'+import { ConfirmDialog } from '@/components/ui/confirm-dialog'+import { useI18n } from '@/i18n'+import { notifyError } from '@/store/notifications'++/**+ * Resolve whether This device would install, without starting the installer.+ * Missing bridge fails closed: a click must not reach runBootstrap unseen.+ */+async function probeLocalBackend(): Promise<boolean> {+ const probe = window.hermesDesktop?.probeLocalBackend++ if (!probe) {+ return true+ }++ return (await probe()).bootstrapNeeded === true+}++export interface LocalDeviceTarget {+ connectionId: string+ label: string+ profile?: string+ /** The switch replaces the center with a fresh session, even when Hermes is already installed. */+ replaceCenter?: boolean+}++interface LocalDevicePrompt extends LocalDeviceTarget {+ kind: 'install' | 'switch'+}++/**+ * Gate a re-home onto This device. Bootstrap-needed always confirms, and offers+ * Connect to existing inline so the click cannot fall through into runBootstrap.+ * An already-installed runtime still confirms before a fresh session replaces+ * the center. Named profiles on an installed local runtime keep the existing+ * spinner path — they are not the Home-looking misclick.+ */+export function useLocalDeviceSwitch() {+ const { t } = useI18n()+ const [prompt, setPrompt] = useState<LocalDevicePrompt | null>(null)+ const [connectOpen, setConnectOpen] = useState(false)+ const waiter = useRef<((accepted: boolean) => void) | null>(null)++ const settle = (accepted: boolean) => {+ const resolve = waiter.current+ waiter.current = null+ setPrompt(null)+ resolve?.(accepted)+ }++ const request = async (target: LocalDeviceTarget): Promise<boolean> => {+ if (target.connectionId !== LOCAL_CONNECTION_ID) {+ return true+ }++ if (waiter.current) {+ return false+ }++ let bootstrapNeeded: boolean++ try {+ bootstrapNeeded = await probeLocalBackend()+ } catch (error) {+ notifyError(error, t.profiles.switchConnectionFailed(target.label))++ return false+ }++ const freshSession = target.replaceCenter === true || target.profile == null || target.profile === 'default'++ if (!bootstrapNeeded && !freshSession) {+ return true+ }++ return new Promise(resolve => {+ waiter.current = resolve+ setPrompt({ ...target, kind: bootstrapNeeded ? 'install' : 'switch' })+ })+ }++ const fleet = t.profiles.fleet+ const install = prompt?.kind === 'install'++ const dialog = (+ <>+ {prompt ? (+ <ConfirmDialog+ confirmLabel={install ? fleet.installDeviceConfirm : fleet.switchDeviceConfirm}+ description={install ? fleet.installDeviceDesc : fleet.switchDeviceDesc}+ dismissOnConfirm+ onClose={() => settle(false)}+ onConfirm={() => settle(true)}+ open+ secondaryAction={+ install+ ? {+ label: fleet.connectExistingInstead,+ onClick: () => {+ settle(false)+ setConnectOpen(true)+ }+ }+ : undefined+ }+ title={install ? fleet.installDeviceTitle : fleet.switchDeviceTitle}+ />+ ) : null}+ {connectOpen ? <FirstRunRemoteSetup onBack={() => setConnectOpen(false)} /> : null}+ </>+ )++ return { dialog, request }+}diff --git a/apps/desktop/src/app/chat/sidebar/profile-dropdown-switcher.tsx b/apps/desktop/src/app/chat/sidebar/profile-dropdown-switcher.tsxindex 737ee42b6be..baf373bd49f 100644--- a/apps/desktop/src/app/chat/sidebar/profile-dropdown-switcher.tsx+++ b/apps/desktop/src/app/chat/sidebar/profile-dropdown-switcher.tsx@@ -51,6 +51,7 @@ import { PROFILES_ROUTE } from '../../routes'import { ConnectionGlyph } from './connection-glyph'import { buildRestGroups, type FleetAgent, fleetRouteKey } from './fleet-rail'+import { useLocalDeviceSwitch } from './local-device-switch'import { useFleetRoster } from './use-fleet-roster'import { useProfilePrewarm } from './use-profile-prewarm'@@ -78,6 +79,7 @@ export function ProfileSwitcher({ compact = false }: { compact?: boolean }) {const roster = useStore($fleetRoster)const [createOpen, setCreateOpen] = useState(false)const [pendingRoute, setPendingRoute] = useState<null | string>(null)+ const { dialog: localDeviceDialog, request: requestLocalDevice } = useLocalDeviceSwitch()useFleetRoster(multipleConnections)@@ -126,7 +128,7 @@ export function ProfileSwitcher({ compact = false }: { compact?: boolean }) {}}- const switchToRest = (agent: FleetAgent) => {+ const commitRestSwitch = (agent: FleetAgent) => {const key = fleetRouteKey(agent.connectionId, agent.profile)triggerHaptic('selection')setPendingRoute(key)@@ -136,6 +138,30 @@ export function ProfileSwitcher({ compact = false }: { compact?: boolean }) {.finally(() => setPendingRoute(current => (current === key ? null : current)))}+ const switchToRest = (agent: FleetAgent) => {+ if (agent.connectionKind !== 'local') {+ commitRestSwitch(agent)++ return+ }++ const key = fleetRouteKey(agent.connectionId, agent.profile)+ setPendingRoute(key)++ void requestLocalDevice({+ connectionId: agent.connectionId,+ label: agent.connectionLabel,+ profile: agent.profile,+ replaceCenter: agent.profile === 'default'+ }).then(accepted => {+ setPendingRoute(current => (current === key ? null : current))++ if (accepted) {+ commitRestSwitch(agent)+ }+ })+ }+const triggerLabel = showAll ? p.allProfiles : active ? profileLabel(active) : p.titlereturn (@@ -209,24 +235,33 @@ export function ProfileSwitcher({ compact = false }: { compact?: boolean }) {<span aria-hidden="true" className="size-1.5 shrink-0 rounded-full bg-amber-500" />)}</DropdownMenuLabel>- {[group.defaultAgent, ...group.named].map(agent => (- <DropdownMenuItem- aria-label={p.fleet.onGateway(agent.profile, group.label)}- className="min-w-0"- key={agent.profile}- onSelect={() => switchToRest(agent)}- >- <span className="flex min-w-0 items-center gap-1.5">- <ProfileGlyph- aria-hidden="true"- color={resolveProfileColor(agent.profile, colors)}- isDefault={agent.isDefault}- name={agent.profile}- />- <span className="truncate">{agent.profile}</span>- </span>- </DropdownMenuItem>- ))}+ {[group.defaultAgent, ...group.named].map(agent => {+ const localDefault = agent.connectionKind === 'local' && agent.isDefault+ const label = localDefault ? p.fleet.localDevice : p.fleet.onGateway(agent.profile, group.label)++ return (+ <DropdownMenuItem+ aria-label={label}+ className="min-w-0"+ key={agent.profile}+ onSelect={() => switchToRest(agent)}+ >+ <span className="flex min-w-0 items-center gap-1.5">+ {localDefault ? (+ <Codicon aria-hidden="true" name="device-desktop" size="0.875rem" />+ ) : (+ <ProfileGlyph+ aria-hidden="true"+ color={resolveProfileColor(agent.profile, colors)}+ isDefault={agent.isDefault}+ name={agent.profile}+ />+ )}+ <span className="truncate">{agent.profile}</span>+ </span>+ </DropdownMenuItem>+ )+ })}</div>))}<DropdownMenuSeparator />@@ -254,6 +289,7 @@ export function ProfileSwitcher({ compact = false }: { compact?: boolean }) {open={createOpen}profiles={profiles}/>+ {localDeviceDialog}</div>)}diff --git a/apps/desktop/src/app/chat/sidebar/profile-rail-fleet.test.tsx b/apps/desktop/src/app/chat/sidebar/profile-rail-fleet.test.tsxindex e32acbaa7a8..5508b6b401b 100644--- a/apps/desktop/src/app/chat/sidebar/profile-rail-fleet.test.tsx+++ b/apps/desktop/src/app/chat/sidebar/profile-rail-fleet.test.tsx@@ -25,7 +25,8 @@ vi.mock('react-router', () => ({vi.mock('@/i18n', () => ({useI18n: () => ({t: {- common: { cancel: 'Cancel', delete: 'Delete' },+ common: { cancel: 'Cancel', confirm: 'Confirm', delete: 'Delete', done: 'Done', loading: 'Loading' },+ errors: { genericFailure: 'Something went wrong' },profiles: {actions: 'Actions',allProfiles: 'All profiles',@@ -41,10 +42,20 @@ vi.mock('@/i18n', () => ({failedSaveSoul: 'Failed to save SOUL.md',fleet: {allOnGateway: 'All profiles on this gateway',+ connectExistingInstead: 'Connect to existing instead',deleteOn: (gateway: string) => ` on ${gateway}`,gateway: (gateway: string) => `Profiles on ${gateway}`,gatewayUnreachable: (gateway: string) => `${gateway} · unreachable`,+ installDeviceConfirm: 'Install locally',+ installDeviceDesc:+ 'This will install Hermes locally, then open a fresh session on this computer. Nothing is installed until you confirm.',+ installDeviceTitle: 'Switch to This device?',+ localDevice: 'This device (local backend — installs Hermes if missing, otherwise opens a fresh session)',onGateway: (name: string, gateway: string) => `${name} · ${gateway}`,+ switchDeviceConfirm: 'Switch',+ switchDeviceDesc:+ 'This opens a fresh session on this computer. The conversation you are in stays on the other gateway.',+ switchDeviceTitle: 'Switch to This device?',switchTo: (name: string, gateway: string) => `Switch to ${name} on ${gateway}`},importProfile: 'Import profile…',@@ -114,6 +125,10 @@ vi.mock('./use-profile-rail-refresh-on-active', () => ({useProfileRailRefreshOnActive: () => undefined}))+vi.mock('@/components/remote-setup/first-run', () => ({+ FirstRunRemoteSetup: () => 'Connect to existing Hermes'+}))+vi.mock('@/hermes', () => ({getProfileSoul: vi.fn().mockResolvedValue({ content: '' }),updateProfileSoul: vi.fn()@@ -209,11 +224,14 @@ async function renderFleet() {return view.container}+const probeLocalBackend = vi.fn(async () => ({ bootstrapNeeded: false }))+beforeEach(() => {getAgentRoster.mockResolvedValue(roster)+ probeLocalBackend.mockResolvedValue({ bootstrapNeeded: false })selectConnection.mockResolvedValue(undefined)openWindow.mockResolvedValue({ ok: true })- ;(window as { hermesDesktop?: unknown }).hermesDesktop = { getAgentRoster, openWindow }+ ;(window as { hermesDesktop?: unknown }).hermesDesktop = { getAgentRoster, openWindow, probeLocalBackend }})afterEach(() => {@@ -351,9 +369,25 @@ describe('ProfileRail fleet mode', () => {expect(dividers).toEqual(['local', 'gateway-a', 'gateway-b'])const local = screen.getByRole('group', { name: 'Profiles on This device' })- expect(within(local).getByRole('button', { name: 'default · This device' })).toBeTruthy()++ const localDevice = within(local).getByRole('button', {+ name: 'This device (local backend — installs Hermes if missing, otherwise opens a fresh session)'+ })+expect(within(local).getByRole('button', { name: 'builder · This device' })).toBeTruthy()+ // This device is a backend switch that may install (#102826), so its+ // default pill must not share the home glyph other gateways' defaults use.+ expect(localDevice.querySelector('.codicon-device-desktop')).toBeTruthy()+ expect(localDevice.querySelector('.codicon-home')).toBeNull()++ const gatewayB = container.querySelector(+ '[data-slot="profile-rail-gateway"][data-connection-id="gateway-b"]'+ ) as HTMLElement++ const gatewayBHome = within(gatewayB).getByRole('button', { name: 'default · Gateway B' })+ expect(gatewayBHome.querySelector('.codicon-home')).toBeTruthy()+// The active gateway's own squares are unchanged and unqualified.expect(screen.getByRole('button', { name: 'scout' })).toBeTruthy()expect(screen.getByRole('button', { name: 'default' })).toBeTruthy()@@ -387,6 +421,10 @@ describe('ProfileRail fleet mode', () => {const builder = screen.getByRole('button', { name: 'builder · This device' })fireEvent.click(builder)+ await act(async () => {+ await Promise.resolve()+ })+expect(selectConnection).toHaveBeenCalledWith('local', { profile: 'builder' })expect(selectProfile).not.toHaveBeenCalled()// The dial spinner sits on the clicked square, not in the statusbar.@@ -400,15 +438,75 @@ describe('ProfileRail fleet mode', () => {expect(builder.getAttribute('aria-busy')).toBeNull()})- it('re-homes onto another gateway default from its home square', async () => {+ it('asks before a fresh session when This device is already installed', async () => {armFleet()await renderFleet()- fireEvent.click(screen.getByRole('button', { name: 'default · This device' }))+ fireEvent.click(+ screen.getByRole('button', {+ name: 'This device (local backend — installs Hermes if missing, otherwise opens a fresh session)'+ })+ )++ expect(selectConnection).not.toHaveBeenCalled()+ expect(await screen.findByRole('dialog', { name: 'Switch to This device?' })).toBeTruthy()+ expect(+ screen.getByText(+ 'This opens a fresh session on this computer. The conversation you are in stays on the other gateway.'+ )+ ).toBeTruthy()++ fireEvent.click(screen.getByRole('button', { name: 'Switch' }))++ await act(async () => {+ await Promise.resolve()+ })expect(selectConnection).toHaveBeenCalledWith('local', { profile: 'default' })})+ it('confirms before installing and offers connect-to-existing inline', async () => {+ armFleet()+ probeLocalBackend.mockResolvedValue({ bootstrapNeeded: true })+ await renderFleet()++ fireEvent.click(+ screen.getByRole('button', {+ name: 'This device (local backend — installs Hermes if missing, otherwise opens a fresh session)'+ })+ )++ expect(selectConnection).not.toHaveBeenCalled()+ expect(+ await screen.findByText(+ 'This will install Hermes locally, then open a fresh session on this computer. Nothing is installed until you confirm.'+ )+ ).toBeTruthy()++ fireEvent.click(screen.getByRole('button', { name: 'Connect to existing instead' }))++ expect(selectConnection).not.toHaveBeenCalled()+ expect(await screen.findByText('Connect to existing Hermes')).toBeTruthy()+ })++ it('does not switch when the fresh-session cue is cancelled', async () => {+ armFleet()+ await renderFleet()++ fireEvent.click(+ screen.getByRole('button', {+ name: 'This device (local backend — installs Hermes if missing, otherwise opens a fresh session)'+ })+ )+ fireEvent.click(await screen.findByRole('button', { name: 'Cancel' }))++ await act(async () => {+ await Promise.resolve()+ })++ expect(selectConnection).not.toHaveBeenCalled()+ })+it('keeps the active gateway click on the plain profile path', async () => {armFleet()await renderFleet()@@ -454,4 +552,25 @@ describe('ProfileRail fleet mode', () => {expect(screen.getByRole('button', { name: 'Profiles' })).toBeTruthy()expect(container.querySelector('[data-slot="profile-rail-rest-square"]')).toBeNull()})++ it('keeps the device glyph on the This device row once the rail condenses', async () => {+ armFleet()+ profiles.set([+ { is_default: true, name: 'default' },+ ...Array.from({ length: 11 }, (_, index) => ({ is_default: false, name: `p${index + 1}` }))+ ])+ await renderFleet()++ fireEvent.pointerDown(screen.getByRole('button', { name: 'Profiles' }), { button: 0, ctrlKey: false })++ const localDevice = await screen.findByRole('menuitem', {+ name: 'This device (local backend — installs Hermes if missing, otherwise opens a fresh session)'+ })++ expect(localDevice.querySelector('.codicon-device-desktop')).toBeTruthy()+ expect(localDevice.querySelector('.codicon-home')).toBeNull()++ const gatewayBHome = screen.getByRole('menuitem', { name: 'default · Gateway B' })+ expect(gatewayBHome.querySelector('.codicon-home')).toBeTruthy()+ })})diff --git a/apps/desktop/src/app/chat/sidebar/profile-switcher.tsx b/apps/desktop/src/app/chat/sidebar/profile-switcher.tsxindex 9da34305a6f..f6d512afc77 100644--- a/apps/desktop/src/app/chat/sidebar/profile-switcher.tsx+++ b/apps/desktop/src/app/chat/sidebar/profile-switcher.tsx@@ -106,6 +106,7 @@ import { PROFILES_ROUTE, SETTINGS_ROUTE } from '../../routes'import { ConnectionGlyph } from './connection-glyph'import { buildRestGroups, countRestAgents, type FleetAgent, type FleetGroup, fleetRouteKey } from './fleet-rail'+import { useLocalDeviceSwitch } from './local-device-switch'import { ProfileLaunchContextMenu, ProfileLaunchMenuSection } from './profile-launch-menu'import { ProfileRemoteOverrideDialog } from './profile-remote-override-dialog'import { useFleetRoster } from './use-fleet-roster'@@ -239,6 +240,7 @@ export function ProfileRail() {// square, not in the statusbar — the previous source stays painted).const [pendingRoute, setPendingRoute] = useState<null | string>(null)const scrollRef = useRef<HTMLDivElement>(null)+ const { dialog: localDeviceDialog, request: requestLocalDevice } = useLocalDeviceSwitch()useFleetRoster(multipleConnections)@@ -297,13 +299,39 @@ export function ProfileRail() {const condensed = profiles.length + countRestAgents(restGroups) > PROFILE_DROPDOWN_THRESHOLDconst switchToRest = (agent: FleetAgent) => {+ const commitRestSwitch = (target: FleetAgent) => {+ const key = fleetRouteKey(target.connectionId, target.profile)+ triggerHaptic('selection')+ setPendingRoute(key)++ void selectConnection(target.connectionId, { profile: target.profile })+ .catch((error: unknown) => notifyError(error, p.switchConnectionFailed(target.connectionLabel)))+ .finally(() => setPendingRoute(current => (current === key ? null : current)))+ }++ if (agent.connectionKind !== 'local') {+ commitRestSwitch(agent)++ return+ }++ // Probe spinner only. The dialog — install confirm or fresh-session cue —+ // must be on screen before selectConnection replaces the center.const key = fleetRouteKey(agent.connectionId, agent.profile)- triggerHaptic('selection')setPendingRoute(key)- void selectConnection(agent.connectionId, { profile: agent.profile })- .catch((error: unknown) => notifyError(error, p.switchConnectionFailed(agent.connectionLabel)))- .finally(() => setPendingRoute(current => (current === key ? null : current)))+ void requestLocalDevice({+ connectionId: agent.connectionId,+ label: agent.connectionLabel,+ profile: agent.profile,+ replaceCenter: agent.profile === 'default'+ }).then(accepted => {+ setPendingRoute(current => (current === key ? null : current))++ if (accepted) {+ commitRestSwitch(agent)+ }+ })}const restScope = (agent: FleetAgent): ProfileScope => ({ connectionId: agent.connectionId, profile: agent.profile })@@ -604,6 +632,8 @@ export function ProfileRail() {without first creating a throwaway second profile. */}<ProfilePill active={false} glyph="ellipsis" label={p.manageProfiles} onSelect={() => navigate(PROFILES_ROUTE)} />+ {localDeviceDialog}+{/* Multi-gateway discoverability: before a second source exists, a plugpinned beside Manage deep-links to the unified Gateways page. Oncethere are several sources, the same action lives in their selector. */}@@ -889,15 +919,35 @@ function ProfileDropdown({<span className="truncate">{group.label}</span>{!group.reachable && <span aria-hidden="true" className="size-1.5 shrink-0 rounded-full bg-amber-500" />}</DropdownMenuLabel>- {[group.defaultAgent, ...group.named].map(agent => (- <RestDropdownItem- agent={agent}- colors={colors}- gatewayLabel={group.label}- key={agent.profile}- onSelect={onSelectRest}- />- ))}+ {[group.defaultAgent, ...group.named].map(agent => {+ const localDefault = agent.connectionKind === 'local' && agent.isDefault+ const label = localDefault ? p.fleet.localDevice : p.fleet.onGateway(agent.profile, group.label)++ return (+ <ProfileLaunchContextMenu+ connectionId={agent.connectionId}+ key={agent.profile}+ label={label}+ profile={agent.profile}+ >+ <DropdownMenuItem aria-label={label} className="min-w-0" onSelect={() => onSelectRest(agent)}>+ <span className="flex min-w-0 items-center gap-1.5">+ {localDefault ? (+ <Codicon aria-hidden="true" name="device-desktop" size="0.875rem" />+ ) : (+ <ProfileGlyph+ aria-hidden="true"+ color={resolveProfileColor(agent.profile, colors)}+ isDefault={agent.isDefault}+ name={agent.profile}+ />+ )}+ <span className="truncate">{agent.profile}</span>+ </span>+ </DropdownMenuItem>+ </ProfileLaunchContextMenu>+ )+ })}</div>))}</DropdownMenuContent>@@ -1132,6 +1182,9 @@ function FleetRestGroup({const p = t.profilesconst dividerLabel = group.reachable ? p.fleet.gateway(group.label) : p.fleet.gatewayUnreachable(group.label)const defaultKey = fleetRouteKey(group.connectionId, group.defaultAgent.profile)+ // At rest, This device is a backend switch, not Home. The house glyph stays+ // on the active gateway's default profile.+ const localDefault = group.kind === 'local'return (<>@@ -1148,13 +1201,13 @@ function FleetRestGroup({<ProfilePillactive={false}connectionId={group.connectionId}- glyph="home"- label={p.fleet.onGateway(group.defaultAgent.profile, group.label)}+ glyph={localDefault ? 'device-desktop' : 'home'}+ label={localDefault ? p.fleet.localDevice : p.fleet.onGateway(group.defaultAgent.profile, group.label)}mutedonSelect={() => onSelect(group.defaultAgent)}pending={pendingRoute === defaultKey}profile={group.defaultAgent.profile}- slot="profile-rail-rest-home"+ slot={localDefault ? 'profile-rail-local-device' : 'profile-rail-rest-home'}/>{group.named.map(agent => (<RestSquarediff --git a/apps/desktop/src/global.d.ts b/apps/desktop/src/global.d.tsindex b526f150512..b42db8b2f70 100644--- a/apps/desktop/src/global.d.ts+++ b/apps/desktop/src/global.d.ts@@ -580,6 +580,8 @@ declare global {onBatteryChanged?: (callback: (onBattery: boolean) => void) => () => voidonBootProgress: (callback: (payload: DesktopBootProgress) => void) => () => voidgetBootstrapState: () => Promise<DesktopBootstrapState>+ /** Resolve This device without starting an install. Missing on an older preload. */+ probeLocalBackend?: () => Promise<{ bootstrapNeeded: boolean }>continueBootstrapLocal: () => Promise<{ ok: boolean }>recycleBackend?: (profile?: null | string) => Promise<{ ok: boolean }>resetBootstrap: () => Promise<{ ok: boolean }>diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.tsindex e103815f96c..d3a5f26cfde 100644--- a/apps/desktop/src/i18n/ar.ts+++ b/apps/desktop/src/i18n/ar.ts@@ -1700,6 +1700,16 @@ export const ar = defineLocale({switchToConnection: name => `التبديل إلى ${name}`,switchConnectionFailed: name => `تعذّر الاتصال بـ ${name}`,manageProfiles: 'إدارة الملفات الشخصية',+ fleet: {+ localDevice: 'هذا الجهاز (خلفية محلية — تثبّت Hermes إن كان مفقودًا، وإلا تفتح جلسة جديدة)',+ switchDeviceTitle: 'التبديل إلى هذا الجهاز؟',+ switchDeviceDesc: 'يفتح هذا جلسة جديدة على هذا الحاسوب. تبقى المحادثة الحالية على البوابة الأخرى.',+ switchDeviceConfirm: 'تبديل',+ installDeviceTitle: 'التبديل إلى هذا الجهاز؟',+ installDeviceDesc: 'سيُثبَّت Hermes محليًا ثم تُفتح جلسة جديدة على هذا الحاسوب. لا يبدأ التثبيت قبل التأكيد.',+ installDeviceConfirm: 'تثبيت محليًا',+ connectExistingInstead: 'الاتصال بموجود بدلًا من ذلك'+ },remoteOverride: {menuItem: 'الاتصال بمضيف بعيد…',badge: (host: string) => `يعمل على ${host}`,diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.tsindex 4d31fcc61d3..61b8f68f86e 100644--- a/apps/desktop/src/i18n/de.ts+++ b/apps/desktop/src/i18n/de.ts@@ -3529,7 +3529,18 @@ export const deOverrides = {gatewayUnreachable: gateway => `${gateway} · nicht erreichbar`,onGateway: (name, gateway) => `${name} · ${gateway}`,switchTo: (name, gateway) => `Zu ${name} auf ${gateway} wechseln`,- deleteOn: gateway => ` auf ${gateway}`+ deleteOn: gateway => ` auf ${gateway}`,+ localDevice:+ 'Dieses Gerät (lokales Backend — installiert Hermes, falls es fehlt, sonst öffnet es eine neue Sitzung)',+ switchDeviceTitle: 'Zu diesem Gerät wechseln?',+ switchDeviceDesc:+ 'Das öffnet eine neue Sitzung auf diesem Computer. Das aktuelle Gespräch bleibt auf dem anderen Gateway.',+ switchDeviceConfirm: 'Wechseln',+ installDeviceTitle: 'Zu diesem Gerät wechseln?',+ installDeviceDesc:+ 'Hermes wird lokal installiert und danach eine neue Sitzung auf diesem Computer geöffnet. Ohne Bestätigung startet keine Installation.',+ installDeviceConfirm: 'Lokal installieren',+ connectExistingInstead: 'Stattdessen vorhandenes verbinden'},status: {unread: (count: number) => (count === 1 ? '1 ungelesene Sitzung' : `${count} ungelesene Sitzungen`),diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 8c5e95e8ac0..433c0c00099 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -3087,7 +3087,17 @@ export const en: Translations = {gatewayUnreachable: gateway => `${gateway} · unreachable`,onGateway: (name, gateway) => `${name} · ${gateway}`,switchTo: (name, gateway) => `Switch to ${name} on ${gateway}`,- deleteOn: gateway => ` on ${gateway}`+ deleteOn: gateway => ` on ${gateway}`,+ localDevice: 'This device (local backend — installs Hermes if missing, otherwise opens a fresh session)',+ switchDeviceTitle: 'Switch to This device?',+ switchDeviceDesc:+ 'This opens a fresh session on this computer. The conversation you are in stays on the other gateway.',+ switchDeviceConfirm: 'Switch',+ installDeviceTitle: 'Switch to This device?',+ installDeviceDesc:+ 'This will install Hermes locally, then open a fresh session on this computer. Nothing is installed until you confirm.',+ installDeviceConfirm: 'Install locally',+ connectExistingInstead: 'Connect to existing instead'},status: {unread: (count: number) => (count === 1 ? '1 unread session' : `${count} unread sessions`),diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.tsindex a490cc9ae80..9c16eeaeffc 100644--- a/apps/desktop/src/i18n/es.ts+++ b/apps/desktop/src/i18n/es.ts@@ -3519,7 +3519,17 @@ export const esOverrides = {gatewayUnreachable: (gateway: string) => `${gateway} · inaccesible`,onGateway: (name: string, gateway: string) => `${name} · ${gateway}`,switchTo: (name: string, gateway: string) => `Cambiar a ${name} en ${gateway}`,- deleteOn: (gateway: string) => ` en ${gateway}`+ deleteOn: (gateway: string) => ` en ${gateway}`,+ localDevice: 'Este dispositivo (backend local: instala Hermes si falta; si no, abre una sesión nueva)',+ switchDeviceTitle: '¿Cambiar a este dispositivo?',+ switchDeviceDesc:+ 'Esto abre una sesión nueva en este equipo. La conversación actual permanece en el otro gateway.',+ switchDeviceConfirm: 'Cambiar',+ installDeviceTitle: '¿Cambiar a este dispositivo?',+ installDeviceDesc:+ 'Esto instalará Hermes localmente y luego abrirá una sesión nueva en este equipo. No se instala nada hasta que confirmes.',+ installDeviceConfirm: 'Instalar localmente',+ connectExistingInstead: 'Conectar uno existente en su lugar'},status: {unread: (count: number) => (count === 1 ? '1 sesión sin leer' : `${count} sesiones sin leer`),diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.tsindex 03f5378e30d..c414f18e017 100644--- a/apps/desktop/src/i18n/fr.ts+++ b/apps/desktop/src/i18n/fr.ts@@ -3536,7 +3536,17 @@ export const frOverrides = {gatewayUnreachable: gateway => `${gateway} · inaccessible`,onGateway: (name, gateway) => `${name} · ${gateway}`,switchTo: (name, gateway) => `Basculer vers ${name} sur ${gateway}`,- deleteOn: gateway => ` sur ${gateway}`+ deleteOn: gateway => ` sur ${gateway}`,+ localDevice: 'Cet appareil (backend local — installe Hermes s’il manque, sinon ouvre une nouvelle session)',+ switchDeviceTitle: 'Basculer vers cet appareil ?',+ switchDeviceDesc:+ 'Cela ouvre une nouvelle session sur cet ordinateur. La conversation en cours reste sur l’autre gateway.',+ switchDeviceConfirm: 'Basculer',+ installDeviceTitle: 'Basculer vers cet appareil ?',+ installDeviceDesc:+ 'Hermes sera installé localement, puis une nouvelle session s’ouvrira sur cet ordinateur. Rien n’est installé tant que vous ne confirmez pas.',+ installDeviceConfirm: 'Installer localement',+ connectExistingInstead: 'Connecter un existant à la place'},status: {unread: (count: number) => (count === 1 ? '1 session non lue' : `${count} sessions non lues`),diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex 99c945be0ae..9670bbe8e17 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -2039,6 +2039,18 @@ export const ja = defineLocale({switchToConnection: name => `${name} に切り替え`,switchConnectionFailed: name => `${name} に接続できませんでした`,manageProfiles: 'プロファイルを管理…',+ fleet: {+ localDevice:+ 'このデバイス(ローカルバックエンド — Hermes が無ければインストールし、あれば新しいセッションを開きます)',+ switchDeviceTitle: 'このデバイスに切り替えますか?',+ switchDeviceDesc: 'このコンピュータで新しいセッションを開きます。今の会話は別のゲートウェイに残ります。',+ switchDeviceConfirm: '切り替える',+ installDeviceTitle: 'このデバイスに切り替えますか?',+ installDeviceDesc:+ 'Hermes をローカルにインストールしてから、このコンピュータで新しいセッションを開きます。確認するまでインストールは始まりません。',+ installDeviceConfirm: 'ローカルにインストール',+ connectExistingInstead: '代わりに既存環境へ接続'+ },remoteOverride: {menuItem: 'リモートホストに接続…',badge: (host: string) => `${host} で実行中`,diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.tsindex d87068ad99c..9cb5e87ec77 100644--- a/apps/desktop/src/i18n/ru.ts+++ b/apps/desktop/src/i18n/ru.ts@@ -2269,6 +2269,17 @@ export const ru = defineLocale({switchConnectionFailed: name => `Не удалось подключиться к ${name}`,manageProfiles: 'Управлять профилями…',connectGateway: 'Управлять шлюзами…',+ fleet: {+ localDevice: 'Это устройство (локальный бэкенд — установит Hermes, если его нет, иначе откроет новую сессию)',+ switchDeviceTitle: 'Переключиться на это устройство?',+ switchDeviceDesc: 'Откроется новая сессия на этом компьютере. Текущий разговор останется на другом шлюзе.',+ switchDeviceConfirm: 'Переключить',+ installDeviceTitle: 'Переключиться на это устройство?',+ installDeviceDesc:+ 'Hermes будет установлен локально, затем откроется новая сессия на этом компьютере. Установка не начнётся, пока вы не подтвердите.',+ installDeviceConfirm: 'Установить локально',+ connectExistingInstead: 'Вместо этого подключить существующий'+ },actions: 'Действия',color: 'Цвет…',colorFor: 'Цвет',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex cd3242eb801..78242812f93 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -2584,6 +2584,15 @@ export interface Translations {onGateway: (name: string, gateway: string) => stringswitchTo: (name: string, gateway: string) => stringdeleteOn: (gateway: string) => string+ /** At-rest local default pill: device, not Home, and the click's consequence. */+ localDevice: string+ switchDeviceTitle: string+ switchDeviceDesc: string+ switchDeviceConfirm: string+ installDeviceTitle: string+ installDeviceDesc: string+ installDeviceConfirm: string+ connectExistingInstead: string}status: {unread: (count: number) => stringdiff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.tsindex 475f3bb339c..dc9fd09baf4 100644--- a/apps/desktop/src/i18n/zh-hant.ts+++ b/apps/desktop/src/i18n/zh-hant.ts@@ -2268,6 +2268,16 @@ export const zhHant = defineLocale({switchToConnection: name => `切換至 ${name}`,switchConnectionFailed: name => `無法連線至 ${name}`,manageProfiles: '管理設定檔…',+ fleet: {+ localDevice: '此裝置(本機後端——若未安裝 Hermes 則會安裝,否則開啟新的工作階段)',+ switchDeviceTitle: '切換到此裝置?',+ switchDeviceDesc: '這會在這台電腦上開啟新的工作階段。目前的對話仍留在另一個閘道。',+ switchDeviceConfirm: '切換',+ installDeviceTitle: '切換到此裝置?',+ installDeviceDesc: '這會在本機安裝 Hermes,然後在這台電腦上開啟新的工作階段。確認之前不會開始安裝。',+ installDeviceConfirm: '本機安裝',+ connectExistingInstead: '改為連線現有環境'+ },remoteOverride: {menuItem: '連線至遠端主機…',badge: (host: string) => `執行於 ${host}`,diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex bb4d81e38b7..59772a1b962 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -2903,7 +2903,15 @@ export const zh = defineLocale({gatewayUnreachable: gateway => `${gateway} · 无法连接`,onGateway: (name, gateway) => `${name} · ${gateway}`,switchTo: (name, gateway) => `切换到 ${gateway} 上的 ${name}`,- deleteOn: gateway => `(位于 ${gateway})`+ deleteOn: gateway => `(位于 ${gateway})`,+ localDevice: '此设备(本地后端——若未安装 Hermes 则会安装,否则打开一个新会话)',+ switchDeviceTitle: '切换到此设备?',+ switchDeviceDesc: '这会在这台电脑上打开一个新会话。当前对话仍留在另一个网关上。',+ switchDeviceConfirm: '切换',+ installDeviceTitle: '切换到此设备?',+ installDeviceDesc: '这将在本地安装 Hermes,然后在这台电脑上打开一个新会话。确认之前不会开始安装。',+ installDeviceConfirm: '本地安装',+ connectExistingInstead: '改为连接现有环境'},remoteOverride: {menuItem: '连接到远程主机…',