The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): each terminal tab owns the gateway it was opened on
Teknium0d521cd3831c
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.tsindex 63841621227..e2c27075567 100644--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@ -572,6 +572,7 @@ import { createSshIsolatedKeepaliveRegistry } from './ssh-isolated-keepalive'import { createSshTeardownTracker } from './ssh-teardown'import { createStreamThrottle } from './stream-throttle'import { installSystemCaTrust } from './system-ca'+import { terminalGatewayTarget } from './terminal-gateway-target'import { registerTerminalIpc } from './terminal-ipc'import { nativeOverlayWidth as computeNativeOverlayWidth, titleBarOverlayOptions } from './titlebar-overlay-width'import {@@ -659,12 +660,7 @@ import { guardedWatch } from './watch-storm-breaker'import { windowAcceleratorAction } from './window-accelerator'import { enumerateWindowsFrontToBack, enumerationFailed, readWindowBelow } from './window-below'import { bindWindowChromeEvents } from './window-chrome-events'-import {- appliedPrimaryWindowRoute,- registrySshPoolScopeByConnectionId,- registrySshScopeForWindowRoute,- WindowConnectionRouteRegistry-} from './window-connection-route'+import { appliedPrimaryWindowRoute, WindowConnectionRouteRegistry } from './window-connection-route'import { registerWindowControlIpc, windowControlState } from './window-controls'import { revealAction, shouldFocusToTakeKeyboard } from './window-focus-policy'import { isAppSized, registerWindowSizing } from './window-growth'@@ -9456,26 +9452,13 @@ function activeSshTerminalTarget(webContentsId?: number) {const windowRoute = typeof webContentsId === 'number' ? windowConnectionRoutes.get(webContentsId) : nullif (windowRoute?.registryScoped && windowRoute.connectionId) {- const scope = registrySshScopeForWindowRoute(windowRoute, readDesktopConnectionsRegistry())-- if (!scope) {- return null- }-- const state = sshConnections.get(scope)-- if (state && state.ssh) {- return { ssh: state.ssh, scope }- }-- // The pool's single writer publishes under the per-profile bootstrap key- // while stamping the entry with its registry connection id (#97345), so a- // composite-key miss must still resolve the live tunnel by that identity- // instead of reporting 'pending' forever.- const pooledScope = registrySshPoolScopeByConnectionId(sshConnections, windowRoute.connectionId)- const pooledState = pooledScope === null ? null : sshConnections.get(pooledScope)+ const target = terminalGatewayTarget(+ { connectionId: windowRoute.connectionId, profile: windowRoute.profile },+ readDesktopConnectionsRegistry(),+ sshConnections+ )- return pooledState && pooledState.ssh ? { ssh: pooledState.ssh, scope: pooledScope } : 'pending'+ return typeof target === 'string' && target !== 'pending' ? null : target}const profile = windowRoute?.profile ?? primaryProfileKey()@@ -9502,37 +9485,6 @@ function activeSshTerminalTarget(webContentsId?: number) {return state && state.ssh ? { ssh: state.ssh, scope } : 'pending'}-// Sessions-active gateway → SSH tunnel for a NEW terminal tab. Same lookup as-// the window-route path, but keyed by the (connectionId, profile) the renderer-// was looking at when it spawned the tab — a Sessions switch doesn't re-point-// the window-backend route, so the window-route lookup alone keeps spawning a-// local shell after a live switch back to SSH.-function resolveSshScopeForConnectionId(connectionId: string, profile?: string) {- const id = String(connectionId || '').trim()-- if (!id) {- return null- }-- const route = { connectionId: id, profile: String(profile || '').trim() || 'default', registryScoped: true as const }- const scope = registrySshScopeForWindowRoute(route, readDesktopConnectionsRegistry())-- if (!scope) {- return null- }-- const state = sshConnections.get(scope)-- if (state && state.ssh) {- return { ssh: state.ssh, scope }- }-- const pooledScope = registrySshPoolScopeByConnectionId(sshConnections, id)- const pooledState = pooledScope === null ? null : sshConnections.get(pooledScope)-- return pooledState && pooledState.ssh ? { ssh: pooledState.ssh, scope: pooledScope } : 'pending'-}-async function ensureTerminalBackend(webContentsId: number) {const windowRoute = windowConnectionRoutes.get(webContentsId)@@ -17152,8 +17104,11 @@ const terminalIpc = registerTerminalIpc({sshBinary: desktopSshBinary,ensureBackend: webContentsId => ensureTerminalBackend(webContentsId),getSshConnectionState: scope => sshConnections.get(scope),- resolveSshScopeForConnection: (connectionId, profile) => resolveSshScopeForConnectionId(connectionId, profile),- ensureConnectionBackend: (connectionId, profile) => ensureRegistryBackend(connectionId, profile)+ gatewayTarget: owner => terminalGatewayTarget(owner, readDesktopConnectionsRegistry(), sshConnections),+ ensureGatewayBackend: owner =>+ backendDialClaims.run(backendScopeKey(owner.connectionId, owner.profile), () =>+ ensureRegistryBackend(owner.connectionId, owner.profile)+ )})const disposeTerminalSession = terminalIpc.disposeTerminalSessiondiff --git a/apps/desktop/electron/terminal-gateway-owner.test.ts b/apps/desktop/electron/terminal-gateway-owner.test.tsnew file mode 100644index 00000000000..4efa10efa4f--- /dev/null+++ b/apps/desktop/electron/terminal-gateway-owner.test.ts@@ -0,0 +1,142 @@+import assert from 'node:assert/strict'++import { test, vi } from 'vitest'++// terminal-ipc.ts loads Electron and the native PTY at module scope; both are+// stubbed, and the ssh argv builder is replaced so a remote spawn is visible.+const handles = vi.hoisted(() => ({ map: new Map<string, (...args: never[]) => unknown>() }))+const spawnMock = vi.hoisted(() => ({ fn: vi.fn() }))++vi.mock('electron', () => ({+ app: { getPath: () => '/tmp', getVersion: () => '0.0.0-test' },+ ipcMain: {+ handle: (channel: string, listener: (...args: never[]) => unknown) => {+ handles.map.set(channel, listener)+ }+ }+}))+vi.mock('node-pty', () => ({ default: { spawn: (...args: unknown[]) => spawnMock.fn(...args) } }))+vi.mock('./ssh-connection', async importOriginal => ({+ ...(await importOriginal<object>()),+ buildInteractiveSshArgs: (ssh: { host: string }) => [`ssh-to-${ssh.host}`]+}))++import type { ConnectionRegistry } from './connection-registry'+import { terminalGatewayTarget } from './terminal-gateway-target'+import { registerTerminalIpc } from './terminal-ipc'++const registry = {+ connections: [+ { id: 'local', kind: 'local', label: 'This device' },+ { id: 'nas', kind: 'ssh', label: 'NAS' },+ { id: 'cloudbox', kind: 'remote', label: 'Cloud box' }+ ],+ primary: 'local',+ version: 2+} as unknown as ConnectionRegistry++const nasTunnel = { registryConnectionId: 'nas', ssh: { host: 'nas.lan' } }++type Start = (+ event: { sender: ReturnType<typeof makeSender> },+ payload: Record<string, unknown>+) => Promise<{ connectionId?: null | string; id: string; shell: string; unavailable?: string }>++function makeSender(id: number) {+ return { id, isDestroyed: () => false, once: vi.fn(), send: vi.fn() }+}++function fakePty() {+ const listeners: { exit: null | ((event: { exitCode: number | null; signal: null | string }) => void) } = {+ exit: null+ }++ return {+ listeners,+ pty: {+ kill: vi.fn(() => listeners.exit?.({ exitCode: null, signal: '1' })),+ onData: vi.fn(),+ onExit: vi.fn((callback: typeof listeners.exit) => {+ listeners.exit = callback+ }),+ pid: 4242,+ resize: vi.fn(),+ write: vi.fn()+ }+ }+}++/** Register the IPC with the window route pointing at `windowTarget`. */+function register(windowTarget: unknown) {+ const pool = new Map([['conn:nas::default', nasTunnel]])++ const api = registerTerminalIpc({+ activeSshTerminalTarget: () => windowTarget,+ ensureBackend: async () => undefined,+ ensureGatewayBackend: async () => undefined,+ findOnPath: () => null,+ gatewayTarget: owner => terminalGatewayTarget(owner, registry, pool),+ getSshConnectionState: scope => pool.get(scope),+ isWindows: false,+ rememberLog: () => {},+ sshBinary: () => '/usr/bin/ssh'+ })++ return { api, start: handles.map.get('hermes:terminal:start') as Start }+}++async function spawnFor(start: Start, payload: Record<string, unknown>) {+ const fake = fakePty()+ spawnMock.fn.mockReset().mockReturnValueOnce(fake.pty)+ const sender = makeSender(7)+ const session = await start({ sender }, payload)++ return { argv: spawnMock.fn.mock.calls[0] as [string, string[]] | undefined, fake, sender, session }+}++test('a tab runs on the gateway it recorded, not the one the window shows', async () => {+ // Window on This device: the NAS tab still opens its shell on the NAS.+ const onLocal = register(null)+ const nas = await spawnFor(onLocal.start, { connectionId: 'nas', profile: 'default' })++ assert.deepEqual(nas.argv?.slice(0, 2), ['/usr/bin/ssh', ['ssh-to-nas.lan']])+ assert.equal(nas.session.connectionId, 'nas')++ // Window on the NAS: a This device tab stays a local shell.+ const onNas = register({ scope: 'conn:nas::default', ssh: nasTunnel.ssh })+ const local = await spawnFor(onNas.start, { connectionId: 'local' })++ assert.notEqual(local.argv?.[0], '/usr/bin/ssh')+ assert.equal(local.session.connectionId, 'local')+})++test('a removed or shell-less gateway is reported, never answered with a local shell', async () => {+ const { start } = register(null)++ for (const [connectionId, unavailable] of [+ ['gone', 'missing'],+ ['cloudbox', 'no-shell']+ ]) {+ const result = await spawnFor(start, { connectionId })++ assert.equal(result.session.unavailable, unavailable)+ assert.equal(result.argv, undefined, `${connectionId} must not spawn anything`)+ }+})++test('an SSH teardown leaves the tab disconnected instead of closing it', async () => {+ const { api, start } = register(null)+ const nas = await spawnFor(start, { connectionId: 'nas', profile: 'default' })+ const attach = handles.map.get('hermes:terminal:attach') as (event: unknown, id: string) => boolean++ assert.equal(attach({ sender: nas.sender }, nas.session.id), true)+ api.disposeTerminalSessionsForSshScope('conn:nas::default')++ const exits = nas.sender.send.mock.calls.filter(([channel]) => String(channel).endsWith(':exit'))++ // The kill's own exit (signal 1) would close the tab; the first verdict wins.+ assert.deepEqual(+ exits.map(([, payload]) => payload),+ [{ code: null, signal: 'disconnected' }]+ )+})diff --git a/apps/desktop/electron/terminal-gateway-target.ts b/apps/desktop/electron/terminal-gateway-target.tsnew file mode 100644index 00000000000..67e6e74b49b--- /dev/null+++ b/apps/desktop/electron/terminal-gateway-target.ts@@ -0,0 +1,75 @@+// Where a terminal tab's shell runs. A tab records the gateway it was opened+// on; this resolves that record against the registry and the live SSH pool so+// the PTY spawns on THAT host no matter which gateway the window shows later.+import { backendScopeKey, type ConnectionRegistry, LOCAL_CONNECTION_ID } from './connection-registry'+import { type RegistrySshPoolEntry, registrySshPoolScopeByConnectionId } from './window-connection-route'++export interface SshTerminalTarget {+ scope: string+ ssh: unknown+}++/** `missing`: the gateway was removed. `no-shell`: a URL/token or cloud+ * gateway, which has no shell transport; never answered with a local shell+ * under the remote's name. `pending`: SSH gateway whose tunnel is not up yet. */+export type TerminalGatewayTarget = 'local' | 'missing' | 'no-shell' | 'pending' | SshTerminalTarget++export interface TerminalGatewayOwner {+ connectionId: string+ profile?: string+}++export function terminalGatewayTarget(+ owner: TerminalGatewayOwner,+ registry: ConnectionRegistry,+ pool: ReadonlyMap<string, RegistrySshPoolEntry | undefined>+): TerminalGatewayTarget {+ const id = owner.connectionId.trim()++ if (!id || id === LOCAL_CONNECTION_ID) {+ return 'local'+ }++ const source = registry.connections.find(connection => connection.id === id)++ if (!source) {+ return 'missing'+ }++ if (source.kind === 'local') {+ return 'local'+ }++ if (source.kind !== 'ssh') {+ return 'no-shell'+ }++ const scope = backendScopeKey(id, owner.profile)+ const state = pool.get(scope)++ if (state?.ssh) {+ return { scope, ssh: state.ssh }+ }++ // The pool's single writer publishes under its per-profile bootstrap key+ // while stamping the entry with the registry connection id (#97345).+ const pooledScope = registrySshPoolScopeByConnectionId(pool, id)+ const pooled = pooledScope === null ? undefined : pool.get(pooledScope)++ return pooledScope !== null && pooled?.ssh ? { scope: pooledScope, ssh: pooled.ssh } : 'pending'+}++/** The gateway a start payload names, or null for a tab that recorded none+ * (an older Desktop's tab, or a host without a gateway registry). */+export function requestedTerminalGateway(payload: unknown): null | TerminalGatewayOwner {+ const record = payload && typeof payload === 'object' ? (payload as Record<string, unknown>) : {}+ const connectionId = typeof record.connectionId === 'string' ? record.connectionId.trim() : ''++ if (!connectionId) {+ return null+ }++ const profile = typeof record.profile === 'string' && record.profile.trim() ? record.profile.trim() : undefined++ return { connectionId, ...(profile ? { profile } : {}) }+}diff --git a/apps/desktop/electron/terminal-ipc.ts b/apps/desktop/electron/terminal-ipc.tsindex e44da05a292..7736f8196af 100644--- a/apps/desktop/electron/terminal-ipc.ts+++ b/apps/desktop/electron/terminal-ipc.ts@@ -13,6 +13,12 @@ import nodePty from 'node-pty'import { resolveTerminalConnection, resolveTerminalConnectionForSender } from './connection-apply'import { ensureSpawnHelperExecutable } from './spawn-helper-perms'import { buildInteractiveSshArgs } from './ssh-connection'+import {+ requestedTerminalGateway,+ type SshTerminalTarget,+ type TerminalGatewayOwner,+ type TerminalGatewayTarget+} from './terminal-gateway-target'import { createTerminalOutputGate } from './terminal-output-gate'import { applyWindowsMsysBashEnvDefaults } from './windows-msys-bash-env'import { buildWindowsInteractiveCommand } from './windows-remote-lifecycle'@@ -25,12 +31,12 @@ export interface TerminalIpcDeps {/** The ssh client to spawn for remote terminals (resolveSshBinary). */sshBinary: () => stringensureBackend: (webContentsId: number) => Promise<unknown>- getSshConnectionState: (scope: string) => undefined | { remotePlatform?: string }- /** Sessions-active (gateway, profile) → live SSH tunnel, if that gateway is SSH.- * Lets a new PTY follow the Sessions switcher instead of the window-backend- * route (which a Sessions-switch leaves pointing at the previous backend). */- resolveSshScopeForConnection?: (connectionId: string, profile?: string) => unknown- ensureConnectionBackend?: (connectionId: string, profile?: string) => Promise<unknown>+ getSshConnectionState: (scope: string) => undefined | { registryConnectionId?: null | string; remotePlatform?: string }+ /** The host of the gateway a tab was opened on. A tab owns its gateway: the+ * window-backend route (which a Sessions pick never re-points) only serves+ * tabs that recorded none. */+ gatewayTarget: (owner: TerminalGatewayOwner) => TerminalGatewayTarget+ ensureGatewayBackend: (owner: TerminalGatewayOwner) => Promise<unknown>}export interface TerminalIpcApi {@@ -62,8 +68,8 @@ export function registerTerminalIpc({sshBinary,ensureBackend,getSshConnectionState,- resolveSshScopeForConnection,- ensureConnectionBackend+ gatewayTarget,+ ensureGatewayBackend}: TerminalIpcDeps): TerminalIpcApi {const terminalSessions = new Map()@@ -262,10 +268,13 @@ export function registerTerminalIpc({return true}- // SSH teardown: close every pane whose PTY rode the disconnected tunnel.+ // SSH teardown: end every pane whose PTY rode the disconnected tunnel.+ // The tab survives as disconnected: Enter re-resolves its gateway, so an+ // edited gateway reconnects and a removed one says so.function disposeTerminalSessionsForSshScope(scope: string) {for (const [id, info] of [...terminalSessions.entries()]) {if (info.sshScope === scope) {+ info.outputGate.exit({ code: null, signal: 'disconnected' })disposeTerminalSession(id)}}@@ -310,6 +319,37 @@ export function registerTerminalIpc({}}+ // The tab's recorded gateway decides the host; only a tab that recorded none+ // follows the window-backend route.+ async function resolveStartTarget(+ owner: null | TerminalGatewayOwner,+ webContentsId: number+ ): Promise<{ sshTarget: null | SshTerminalTarget } | { unavailable: 'missing' | 'no-shell' }> {+ if (!owner) {+ return { sshTarget: await resolveTerminalConnectionForSender(webContentsId, activeSshTerminalTarget, ensureBackend) }+ }++ const target = await resolveTerminalConnection(+ () => gatewayTarget(owner),+ () => ensureGatewayBackend(owner)+ )++ if (target === 'missing' || target === 'no-shell') {+ return { unavailable: target }+ }++ return { sshTarget: target === 'local' ? null : target }+ }++ // Where the shell runs, so a tab that recorded no gateway adopts this one.+ function spawnedOn(owner: null | TerminalGatewayOwner, sshTarget: null | SshTerminalTarget): null | string {+ if (owner) {+ return owner.connectionId+ }++ return sshTarget ? getSshConnectionState(sshTarget.scope)?.registryConnectionId || null : 'local'+ }+ipcMain.handle('hermes:terminal:start', async (event, payload = {}) => {ensureNodePtySpawnHelper()@@ -319,26 +359,16 @@ export function registerTerminalIpc({const cols = Math.max(2, Number.parseInt(String(payload?.cols || 80), 10) || 80)const rows = Math.max(2, Number.parseInt(String(payload?.rows || 24), 10) || 24)- const requestedConnectionId = typeof payload?.connectionId === 'string' ? payload.connectionId.trim() : ''- const requestedProfile = typeof payload?.profile === 'string' ? payload.profile : undefined+ const owner = requestedTerminalGateway(payload)+ const resolved = await resolveStartTarget(owner, event.sender.id)- // Prefer the Sessions-active gateway the renderer was looking at. The- // window-backend route isn't re-pointed by a Sessions switch, so without- // this a live switch back to SSH keeps spawning a local shell.- let sessionTarget = null as null | { scope: string; ssh: unknown } | string- if (requestedConnectionId && resolveSshScopeForConnection) {- try {- sessionTarget = (await resolveTerminalConnection(- () => resolveSshScopeForConnection(requestedConnectionId, requestedProfile),- () => (ensureConnectionBackend ? ensureConnectionBackend(requestedConnectionId, requestedProfile) : Promise.resolve())- )) as null | { scope: string; ssh: unknown } | string- } catch {- sessionTarget = null- }+ // Removed gateway, or one with no shell transport: report it instead of+ // spawning a local shell the tab would label with the remote's name.+ if ('unavailable' in resolved) {+ return { connectionId: owner?.connectionId ?? null, cwd: null, id: '', shell: '', unavailable: resolved.unavailable }}- const sshTarget = sessionTarget || (await resolveTerminalConnectionForSender(event.sender.id, activeSshTerminalTarget, ensureBackend))-+ const { sshTarget } = resolvedconst remote = Boolean(sshTarget)const remoteState = remote ? getSshConnectionState(sshTarget.scope) : null@@ -393,7 +423,7 @@ export function registerTerminalIpc({})event.sender.once('destroyed', () => disposeTerminalSession(id))- return { cwd: remote ? null : cwd, id, shell: remote ? 'ssh' : name }+ return { connectionId: spawnedOn(owner, sshTarget), cwd: remote ? null : cwd, id, shell: remote ? 'ssh' : name }})ipcMain.handle('hermes:terminal:attach', (event, id) => {diff --git a/apps/desktop/electron/terminal-output-gate.ts b/apps/desktop/electron/terminal-output-gate.tsindex 4cbf5a13f6b..eb81a0f62be 100644--- a/apps/desktop/electron/terminal-output-gate.ts+++ b/apps/desktop/electron/terminal-output-gate.ts@@ -15,6 +15,7 @@ export function createTerminalOutputGate({ onExitFlushed, sendData, sendExit }:let attached = falselet pendingData = ''let pendingExit: TerminalExitPayload | null = null+ let exited = falseconst flushExit = (payload: TerminalExitPayload) => {sendExit(payload)@@ -50,6 +51,14 @@ export function createTerminalOutputGate({ onExitFlushed, sendData, sendExit }:pendingData = `${pendingData}${chunk}`.slice(-MAX_PENDING_OUTPUT)},exit(payload: TerminalExitPayload): void {+ // The first exit is the verdict: a teardown's `disconnected` must not be+ // overwritten by the kill's own exit that follows it.+ if (exited) {+ return+ }++ exited = true+if (attached) {flushExit(payload)diff --git a/apps/desktop/electron/terminal-pty-dispose.test.ts b/apps/desktop/electron/terminal-pty-dispose.test.tsindex 67c89abf03a..c1034db6ecb 100644--- a/apps/desktop/electron/terminal-pty-dispose.test.ts+++ b/apps/desktop/electron/terminal-pty-dispose.test.ts@@ -67,7 +67,9 @@ async function startSession() {activeSshTerminalTarget: () => null,sshBinary: () => '/usr/bin/ssh',ensureBackend: async () => undefined,- getSshConnectionState: () => undefined+ getSshConnectionState: () => undefined,+ gatewayTarget: () => 'local',+ ensureGatewayBackend: async () => undefined})const sender = makeSender(7)diff --git a/apps/desktop/src/app/right-sidebar/terminal/rail-new-terminal.tsx b/apps/desktop/src/app/right-sidebar/terminal/rail-new-terminal.tsxnew file mode 100644index 00000000000..3dbe36c7149--- /dev/null+++ b/apps/desktop/src/app/right-sidebar/terminal/rail-new-terminal.tsx@@ -0,0 +1,106 @@+import { useStore } from '@nanostores/react'+import type { ReactNode } from 'react'++import { ConnectionGlyph } from '@/app/chat/sidebar/connection-glyph'+import { Codicon } from '@/components/ui/codicon'+import {+ ContextMenu,+ ContextMenuContent,+ ContextMenuItem,+ ContextMenuLabel,+ ContextMenuTrigger+} from '@/components/ui/context-menu'+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuLabel,+ DropdownMenuTrigger+} from '@/components/ui/dropdown-menu'+import { Tip, TipHintLabel } from '@/components/ui/tooltip'+import type { DesktopRegistryConnection } from '@/global'+import { useI18n } from '@/i18n'+import { formatCombo } from '@/lib/keybinds/combo'+import { cn } from '@/lib/utils'+import { $bindings } from '@/store/keybinds'++import { $localGateway, $terminalShellGateways } from './terminal-gateway'+import { createTerminal } from './terminals'++type GatewayChoice = Pick<DesktopRegistryConnection, 'id' | 'kind' | 'label'>++const openOn = (choice: GatewayChoice) => createTerminal(undefined, { connectionId: choice.id })++/** The rail's new-terminal control. Click opens on the gateway picked in+ * Sessions; with an SSH gateway registered, the chevron (or a right-click on+ * +) opens one on any shell-capable gateway, so hosts sit side by side. */+export function NewTerminalButton({ className }: { className: string }) {+ const { t } = useI18n()+ const bindings = useStore($bindings)+ const local = useStore($localGateway)+ const sshGateways = useStore($terminalShellGateways)+ const newHint = bindings['view.newTerminal']?.[0]+ const choices: GatewayChoice[] = sshGateways.length ? [...(local ? [local] : []), ...sshGateways] : []++ const button = (+ <button+ aria-label={t.rightSidebar.terminalNew}+ className={cn(className, 'size-7 text-(--ui-text-quaternary)')}+ onClick={() => createTerminal()}+ type="button"+ >+ <Codicon name="add" size="0.8125rem" />+ </button>+ )++ const tipped = (+ <Tip+ label={<TipHintLabel hint={newHint && formatCombo(newHint)} text={t.rightSidebar.terminalNew} />}+ placement="right-rail"+ >+ {button}+ </Tip>+ )++ if (!choices.length) {+ return <li className="flex w-full justify-center">{tipped}</li>+ }++ const items = (Item: typeof ContextMenuItem | typeof DropdownMenuItem): ReactNode =>+ choices.map(choice => (+ <Item data-terminal-gateway={choice.id} key={choice.id} onSelect={() => openOn(choice)}>+ <ConnectionGlyph connection={choice} />+ {choice.label}+ </Item>+ ))++ return (+ <li className="flex w-full flex-col items-center">+ <ContextMenu>+ <ContextMenuTrigger asChild>{tipped}</ContextMenuTrigger>+ <ContextMenuContent>+ <ContextMenuLabel>{t.rightSidebar.terminalNewOn}</ContextMenuLabel>+ {items(ContextMenuItem)}+ </ContextMenuContent>+ </ContextMenu>+ <DropdownMenu>+ <Tip label={t.rightSidebar.terminalNewOn} placement="right-rail">+ <DropdownMenuTrigger asChild>+ <button+ aria-label={t.rightSidebar.terminalNewOn}+ className={cn(className, 'h-3.5 w-7 text-(--ui-text-quaternary)')}+ data-slot="terminal-new-on"+ type="button"+ >+ <Codicon name="chevron-down" size="0.625rem" />+ </button>+ </DropdownMenuTrigger>+ </Tip>+ <DropdownMenuContent align="start" side="left">+ <DropdownMenuLabel>{t.rightSidebar.terminalNewOn}</DropdownMenuLabel>+ {items(DropdownMenuItem)}+ </DropdownMenuContent>+ </DropdownMenu>+ </li>+ )+}diff --git a/apps/desktop/src/app/right-sidebar/terminal/rail.tsx b/apps/desktop/src/app/right-sidebar/terminal/rail.tsxindex cb27f6d9714..e7d87e88e41 100644--- a/apps/desktop/src/app/right-sidebar/terminal/rail.tsx+++ b/apps/desktop/src/app/right-sidebar/terminal/rail.tsx@@ -1,5 +1,6 @@import { useStore } from '@nanostores/react'+import { ConnectionGlyph } from '@/app/chat/sidebar/connection-glyph'import { Codicon } from '@/components/ui/codicon'import {ContextMenu,@@ -13,17 +14,20 @@ import { useI18n } from '@/i18n'import { formatCombo } from '@/lib/keybinds/combo'import { isMetaClose, middleClickHandlers } from '@/lib/middle-click'import { cn } from '@/lib/utils'+import { $connectionsRegistry } from '@/store/connections'import { $bindings } from '@/store/keybinds'import { setTerminalTakeover } from '../store'+import { NewTerminalButton } from './rail-new-terminal'+import { terminalHost } from './terminal-gateway'import {$activeTerminalId,+ $terminalHostsMixed,$terminals,closeAllTerminals,closeOtherTerminals,closeTerminal,- createTerminal,selectTerminal,type TerminalEntry} from './terminals'@@ -40,7 +44,6 @@ export function TerminalRail() {const activeId = useStore($activeTerminalId)const bindings = useStore($bindings)const toggleHint = bindings['view.showTerminal']?.[0]- const newHint = bindings['view.newTerminal']?.[0]return (<div@@ -66,21 +69,7 @@ export function TerminalRail() {toggleHint={toggleHint}/>))}- <li className="flex w-full justify-center">- <Tip- label={<TipHintLabel hint={newHint && formatCombo(newHint)} text={t.rightSidebar.terminalNew} />}- placement="right-rail"- >- <button- aria-label={t.rightSidebar.terminalNew}- className={cn(RAIL_ACTION, 'size-7 text-(--ui-text-quaternary)')}- onClick={() => createTerminal()}- type="button"- >- <Codicon name="add" size="0.8125rem" />- </button>- </Tip>- </li>+ <NewTerminalButton className={RAIL_ACTION} /></ul><div className="flex shrink-0 flex-col items-center pb-1.5">@@ -109,7 +98,13 @@ interface TerminalRailItemProps {function TerminalRailItem({ active, canCloseOthers, index, term, toggleHint }: TerminalRailItemProps) {const { t } = useI18n()- const label = `${index + 1}. ${term.title}`+ const registry = useStore($connectionsRegistry)+ const mixed = useStore($terminalHostsMixed)+ const host = terminalHost(term, registry)+ // Where the shell runs. This device stays unlabeled until a tab runs elsewhere.+ const shown = host === 'removed' || (host && (mixed || host.connection.kind !== 'local')) ? host : null+ const hostLabel = shown === 'removed' ? t.rightSidebar.terminalGatewayRemoved : shown?.connection.label+ const label = `${index + 1}. ${term.title}${hostLabel ? ` · ${hostLabel}` : ''}`return (<ContextMenu>@@ -129,7 +124,7 @@ function TerminalRailItem({ active, canCloseOthers, index, term, toggleHint }: Taria-label={label}aria-selected={active}className={cn(- 'grid size-7 place-items-center rounded-md transition-colors',+ 'relative grid size-7 place-items-center rounded-md transition-colors',active? 'bg-(--chrome-action-hover) text-foreground': 'text-(--ui-text-tertiary) hover:bg-(--chrome-action-hover) hover:text-foreground'@@ -145,6 +140,18 @@ function TerminalRailItem({ active, canCloseOthers, index, term, toggleHint }: Tname={term.kind === 'agent' ? 'agent' : 'terminal'}size="0.875rem"/>+ {shown && (+ <span+ className="pointer-events-none absolute bottom-0 right-0.5 grid place-items-center rounded-sm bg-(--ui-terminal-surface-background)"+ data-terminal-host={shown === 'removed' ? 'removed' : shown.connection.id}+ >+ {shown === 'removed' ? (+ <Codicon className="text-(--ui-text-quaternary)" name="debug-disconnect" size="0.625rem" />+ ) : (+ <ConnectionGlyph className="size-2.5 [&_svg]:size-2.5" connection={shown.connection} />+ )}+ </span>+ )}</button></Tip></li>diff --git a/apps/desktop/src/app/right-sidebar/terminal/terminal-gateway.ts b/apps/desktop/src/app/right-sidebar/terminal/terminal-gateway.tsnew file mode 100644index 00000000000..624633190f6--- /dev/null+++ b/apps/desktop/src/app/right-sidebar/terminal/terminal-gateway.ts@@ -0,0 +1,66 @@+import { LOCAL_CONNECTION_ID } from '@hermes/shared'+import { computed } from 'nanostores'++import type { DesktopConnectionsRegistry, DesktopRegistryConnection } from '@/global'+import { $activeConnectionId, $connectionsRegistry } from '@/store/connections'+import { $activeGatewayProfile, normalizeProfileKey } from '@/store/profile'++import type { TerminalEntry } from './terminals'++/** The gateway a terminal tab was opened on. Only This device and SSH gateways+ * carry a shell; the SSH tunnel is keyed by (connection, profile). */+export interface TerminalGateway {+ connectionId: string+ profile?: string+}++/** Where a shell for `connectionId` runs: an SSH gateway runs it on its own+ * host; This device, URL/token and cloud gateways (no shell transport) run it+ * here and say so. Undefined while the registry is unknown (or on a host with+ * none, like the Webapp), so main keeps routing by the window. */+export function shellGatewayFor(+ connectionId: null | string | undefined,+ profile: null | string | undefined,+ registry: DesktopConnectionsRegistry | null | undefined+): TerminalGateway | undefined {+ const source = connectionId ? registry?.connections.find(connection => connection.id === connectionId) : undefined++ if (!source) {+ return undefined+ }++ return source.kind === 'ssh'+ ? { connectionId: source.id, profile: normalizeProfileKey(profile) }+ : { connectionId: LOCAL_CONNECTION_ID }+}++/** A new terminal opens on the gateway picked in Sessions. */+export const defaultTerminalGateway = () =>+ shellGatewayFor($activeConnectionId.get(), $activeGatewayProfile.get(), $connectionsRegistry.get())++export const terminalGatewayOf = (term: TerminalEntry | undefined): TerminalGateway | undefined =>+ term?.connectionId ? { connectionId: term.connectionId, ...(term.profile ? { profile: term.profile } : {}) } : undefined++/** SSH gateways a terminal can be opened on, beside This device. */+export const $terminalShellGateways = computed($connectionsRegistry, registry =>+ (registry?.connections ?? []).filter(connection => connection.kind === 'ssh')+)++export const $localGateway = computed(+ $connectionsRegistry,+ registry => registry?.connections.find(connection => connection.id === LOCAL_CONNECTION_ID) ?? null+)++/** What a tab's label says about its host: the registry entry, `removed` when+ * the gateway is gone, or null when the tab recorded none. */+export type TerminalHost = { connection: Pick<DesktopRegistryConnection, 'id' | 'kind' | 'label'> } | 'removed' | null++export function terminalHost(term: TerminalEntry, registry: DesktopConnectionsRegistry | null): TerminalHost {+ if (term.kind !== 'user' || !term.connectionId || !registry) {+ return null+ }++ const connection = registry.connections.find(entry => entry.id === term.connectionId)++ return connection ? { connection } : 'removed'+}diff --git a/apps/desktop/src/app/right-sidebar/terminal/terminal-session-attempt.ts b/apps/desktop/src/app/right-sidebar/terminal/terminal-session-attempt.tsindex e300aa9b0a0..1c55fb00031 100644--- a/apps/desktop/src/app/right-sidebar/terminal/terminal-session-attempt.ts+++ b/apps/desktop/src/app/right-sidebar/terminal/terminal-session-attempt.ts@@ -2,11 +2,11 @@ import type { Terminal } from '@xterm/xterm'import type { RefObject } from 'react'import type { HermesTerminalSession } from '@/global'+import { translateNow } from '@/i18n'import { hostHas } from '@/lib/host-capabilities'-import { $activeConnectionId } from '@/store/connections'-import { $activeGatewayProfile } from '@/store/profile'-import { $terminals, markTerminalPersistent, removeExitedTerminal } from './terminals'+import { defaultTerminalGateway, terminalGatewayOf } from './terminal-gateway'+import { $terminals, adoptTerminalGateway, markTerminalPersistent, removeExitedTerminal } from './terminals'type TerminalApi = Window['hermesDesktop']['terminal']@@ -22,6 +22,11 @@ const TERMINAL_EXIT_MESSAGES: Record<string, string> = {'signed-out': 'Signed out of Hermes. Sign this browser in again, then press Enter to reconnect.'}+const TERMINAL_UNAVAILABLE_KEYS = {+ missing: 'rightSidebar.terminalGatewayRemovedBody',+ 'no-shell': 'rightSidebar.terminalGatewayNoShellBody'+} as const+// True once the page/app is tearing down (Cmd+Q, Alt+F4, window close, reload).// App quit kills the PTYs from the main process, which fires onExit in the// renderer — but React skips effect cleanups on teardown, so the per-instance@@ -130,21 +135,33 @@ export function createSessionAttemptController(term.write(`${message}\r\n`)}+ // The tab's own gateway; a tab from an older Desktop takes the one picked+ // in Sessions (never the window-backend route, which a pick doesn't move).+ const tab = $terminals.get().find(entry => entry.id === id)+ const gateway = terminalGatewayOf(tab) ?? defaultTerminalGateway()+void terminalApi// Prefer the last observed cwd so retry/relaunch stays in the same directory.- // Carry the Sessions active (gateway, profile) so a new PTY resolves- // the SSH tunnel for the gateway the user is LOOKING at — not the- // window-backend route, which a Sessions-switch doesn't re-point.- .start({- cols: term.cols,- connectionId: $activeConnectionId.get() ?? null,- cwd: resolveCwd(),- profile: $activeGatewayProfile.get(),- restoreKey: id,- resumeOnly,- rows: term.rows- })+ .start({ cols: term.cols, cwd: resolveCwd(), restoreKey: id, resumeOnly, rows: term.rows, ...gateway }).then(async session => {+ const ranOn = gateway ?? (session.connectionId ? { connectionId: session.connectionId } : undefined)++ if (ranOn) {+ adoptTerminalGateway(id, ranOn)+ }++ if (session.unavailable) {+ // The gateway is gone or has no shell: an exited tab, never a+ // local shell under the remote's name.+ if (!isDisposed() && current) {+ restoreHistory()+ setStatus('closed')+ term.write(`\r\n${translateNow(TERMINAL_UNAVAILABLE_KEYS[session.unavailable])}\r\n`)+ }++ return+ }+persistent = Boolean(session.persistent)resumeOnly = persistentdiff --git a/apps/desktop/src/app/right-sidebar/terminal/terminals.ts b/apps/desktop/src/app/right-sidebar/terminal/terminals.tsindex 854240a3a84..07cc7ffc0a1 100644--- a/apps/desktop/src/app/right-sidebar/terminal/terminals.ts+++ b/apps/desktop/src/app/right-sidebar/terminal/terminals.ts@@ -10,6 +10,7 @@ import { $currentCwd } from '@/store/session'import { setTerminalTakeover } from '../store'import { seedAgentTerminalCommand } from './agent-terminal-stream'+import type { TerminalGateway } from './terminal-gateway'// xterm WebGL terminals that share one glyph atlas (same font/theme/DPR) keep// per-terminal render models over a SHARED texture. Clearing one terminal's@@ -134,16 +135,24 @@ export interface TerminalEntry {* background process (`terminal(background=true)`), keyed by `procId`. */kind: 'user' | 'agent'procId?: string+ /** The gateway this tab was opened on (`local` = This device). The shell+ * runs on that host whichever gateway the window shows later; absent on a+ * tab from an older Desktop until its first start reports where it ran. */+ connectionId?: string+ /** Gateway profile the SSH tunnel is keyed by (with `connectionId`). */+ profile?: string}interface PersistedTerminalEntry {auto: boolean+ connectionId?: stringcwd: stringid: stringrestoreCwd?: stringreviveBuffer?: string/** A server shell was created for this tab; restoration must never respawn it. */persistent?: boolean+ profile?: stringtitle: string}@@ -159,6 +168,13 @@ const TERMINALS_STORAGE_KEY = 'hermes.desktop.terminals.v1'// default (100 lines) once the serialized escape codes are counted in.const MAX_REVIVE_BUFFER_CHARS = 48_000+function persistedGateway(record: Record<string, unknown>): Pick<PersistedTerminalEntry, 'connectionId' | 'profile'> {+ const connectionId = typeof record.connectionId === 'string' ? record.connectionId.trim() : ''+ const profile = typeof record.profile === 'string' ? record.profile.trim() : ''++ return connectionId ? { connectionId, ...(profile ? { profile } : {}) } : {}+}+function sanitizePersistedTerminal(value: unknown): PersistedTerminalEntry | null {if (!value || typeof value !== 'object' || Array.isArray(value)) {return null@@ -177,6 +193,7 @@ function sanitizePersistedTerminal(value: unknown): PersistedTerminalEntry | nulreturn {auto: typeof record.auto === 'boolean' ? record.auto : true,+ ...persistedGateway(record),cwd,id,...(restoreCwd ? { restoreCwd } : {}),@@ -226,8 +243,10 @@ function persistTerminals(list: readonly TerminalEntry[], activeTerminalId: null.filter(term => term.kind === 'user').map(term => ({auto: term.auto,+ ...(term.connectionId ? { connectionId: term.connectionId } : {}),cwd: term.cwd,id: term.id,+ ...(term.profile ? { profile: term.profile } : {}),...(term.restoreCwd ? { restoreCwd: term.restoreCwd } : {}),...(term.reviveBuffer ? { reviveBuffer: term.reviveBuffer } : {}),...(term.persistent ? { persistent: true } : {}),@@ -262,15 +281,33 @@ export const $activeTerminal = computed(const newId = () => randomUuid()/** Append a fresh terminal and focus it. Captures the current cwd once (its only- * tie to session/project state); pass an explicit cwd to override. Returns the id. */-export function createTerminal(cwd: string = $currentCwd.get()): string {+ * tie to session/project state). Without an explicit gateway the tab takes the+ * one picked in Sessions when its shell first starts. Returns the id. */+export function createTerminal(cwd: string = $currentCwd.get(), gateway?: TerminalGateway): string {const id = newId()- $terminals.set([...$terminals.get(), { id, title: 'Terminal', auto: true, cwd, kind: 'user' }])+ $terminals.set([...$terminals.get(), { id, title: 'Terminal', auto: true, cwd, kind: 'user', ...gateway }])$activeTerminalId.set(id)return id}+/** Record where a tab that had no gateway first ran. A recorded gateway never+ * changes: a later Sessions pick must not move a shell to another host. */+export function adoptTerminalGateway(id: string, gateway: TerminalGateway): void {+ $terminals.set(+ $terminals.get().map(term =>+ term.id === id && term.kind === 'user' && !term.connectionId ? { ...term, ...gateway } : term+ )+ )+}++/** True once user tabs run on more than one host: only then do This device+ * tabs need a label too. */+export const $terminalHostsMixed = computed(+ $terminals,+ list => new Set(list.filter(term => term.kind === 'user' && term.connectionId).map(term => term.connectionId)).size > 1+)+// Procs we've already surfaced a tab for — so closing an agent tab doesn't// resurrect it on the next poll while the process is still running.const surfacedProcs = new Set<string>()diff --git a/apps/desktop/src/global.d.ts b/apps/desktop/src/global.d.tsindex 331799726b5..467f7d3556d 100644--- a/apps/desktop/src/global.d.ts+++ b/apps/desktop/src/global.d.ts@@ -812,9 +812,14 @@ export interface DesktopMarketplaceThemeResult {export type HermesTerminalState = 'open' | 'reconnecting' | 'disconnected'export interface HermesTerminalSession {+ /** Gateway the shell runs on (`local` = This device); Electron only. */+ connectionId?: null | stringcwd: stringid: stringshell: string+ /** No shell was started: the tab's gateway was removed (`missing`) or has+ * no shell transport (`no-shell`). */+ unavailable?: 'missing' | 'no-shell'/** Server-owned process and replay; do not restore renderer scrollback. */persistent?: boolean}diff --git a/apps/desktop/src/i18n/ar_chrome.ts b/apps/desktop/src/i18n/ar_chrome.tsindex d2da35d9886..815bd2f5cb5 100644--- a/apps/desktop/src/i18n/ar_chrome.ts+++ b/apps/desktop/src/i18n/ar_chrome.ts@@ -515,6 +515,12 @@ export const arChrome = {loadingTree: 'جار تحميل الشجرة...',loadingFiles: 'جار تحميل الملفات...',terminalHide: 'إخفاء الطرفية',+ terminalNewOn: 'طرفية جديدة على…',+ terminalGatewayRemoved: 'بوابة محذوفة',+ terminalGatewayRemovedBody:+ 'حُذفت البوابة التي كانت تعمل عليها هذه الطرفية، لذا لا يمكن إعادة فتحها. أغلق علامة التبويب هذه.',+ terminalGatewayNoShellBody:+ 'لا توفر هذه البوابة وصولاً إلى الصدفة، لذا لا يمكن إعادة فتح هذه الطرفية. أغلق علامة التبويب هذه.',addToChat: 'إضافة للمحادثة'},zones: {diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.tsindex aff00e17f90..6a6453c7fe5 100644--- a/apps/desktop/src/i18n/de.ts+++ b/apps/desktop/src/i18n/de.ts@@ -4676,6 +4676,12 @@ export const deOverrides = {terminalNew: 'Neues Terminal',terminalCloseOthers: 'Andere schließen',terminalCloseAll: 'Alle schließen',+ terminalNewOn: 'Neues Terminal auf…',+ terminalGatewayRemoved: 'Entfernter Gateway',+ terminalGatewayRemovedBody:+ 'Der Gateway, auf dem dieses Terminal lief, wurde entfernt; es kann nicht wieder geöffnet werden. Schließe diesen Tab.',+ terminalGatewayNoShellBody:+ 'Dieser Gateway bietet keinen Shell-Zugang; dieses Terminal kann nicht wieder geöffnet werden. Schließe diesen Tab.',addToChat: 'Zum Chat hinzufügen'},preview: {diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 548d7e7b8ad..e102f9faf85 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -4247,6 +4247,12 @@ export const en: Translations = {terminalNew: 'New terminal',terminalCloseOthers: 'Close others',terminalCloseAll: 'Close all',+ terminalNewOn: 'New terminal on…',+ terminalGatewayRemoved: 'Removed gateway',+ terminalGatewayRemovedBody:+ 'The gateway this terminal ran on was removed, so it can\'t reopen. Close this tab.',+ terminalGatewayNoShellBody:+ 'This gateway has no shell access, so this terminal can\'t reopen. Close this tab.',terminalDropUploadFailed: name => `Could not upload ${name}`,terminalDropTooLargeTitle: 'Too large to upload',terminalDropTooLarge: (names, limit) => `Each file can be up to ${limit}. Not uploaded: ${names}`,diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.tsindex 38a296ee59a..93195d6477b 100644--- a/apps/desktop/src/i18n/es.ts+++ b/apps/desktop/src/i18n/es.ts@@ -4660,6 +4660,12 @@ export const esOverrides = {terminalNew: 'Nueva terminal',terminalCloseOthers: 'Cerrar las demás',terminalCloseAll: 'Cerrar todo',+ terminalNewOn: 'Nueva terminal en…',+ terminalGatewayRemoved: 'Gateway eliminado',+ terminalGatewayRemovedBody:+ 'Se eliminó el gateway donde se ejecutaba esta terminal, así que no puede reabrirse. Cierra esta pestaña.',+ terminalGatewayNoShellBody:+ 'Este gateway no ofrece acceso a shell, así que esta terminal no puede reabrirse. Cierra esta pestaña.',addToChat: 'Añadir al chat'},preview: {diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.tsindex 535b7c1a465..33ee03e3b54 100644--- a/apps/desktop/src/i18n/fr.ts+++ b/apps/desktop/src/i18n/fr.ts@@ -4686,6 +4686,12 @@ export const frOverrides = {terminalNew: 'Nouveau terminal',terminalCloseOthers: 'Fermer les autres',terminalCloseAll: 'Tout fermer',+ terminalNewOn: 'Nouveau terminal sur…',+ terminalGatewayRemoved: 'Passerelle supprimée',+ terminalGatewayRemovedBody:+ 'La passerelle sur laquelle ce terminal tournait a été supprimée ; il ne peut pas être rouvert. Fermez cet onglet.',+ terminalGatewayNoShellBody:+ 'Cette passerelle n’offre pas d’accès shell ; ce terminal ne peut pas être rouvert. Fermez cet onglet.',addToChat: 'Ajouter à la conversation'},preview: {diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex 56124d19e30..f68448b7df5 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -3085,6 +3085,12 @@ export const jaOverrides = {terminalNew: '新しいターミナル',terminalCloseOthers: '他を閉じる',terminalCloseAll: 'すべて閉じる',+ terminalNewOn: '新しいターミナルを開く場所…',+ terminalGatewayRemoved: '削除されたゲートウェイ',+ terminalGatewayRemovedBody:+ 'このターミナルが動作していたゲートウェイは削除されたため、再度開けません。このタブを閉じてください。',+ terminalGatewayNoShellBody:+ 'このゲートウェイにはシェルアクセスがないため、このターミナルは再度開けません。このタブを閉じてください。',addToChat: 'チャットに追加'},diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.tsindex 853b2798c99..06049a99b29 100644--- a/apps/desktop/src/i18n/ru.ts+++ b/apps/desktop/src/i18n/ru.ts@@ -3337,6 +3337,12 @@ export const ruOverrides = {terminalNew: 'Новый терминал',terminalCloseOthers: 'Закрыть другие',terminalCloseAll: 'Закрыть все',+ terminalNewOn: 'Новый терминал на…',+ terminalGatewayRemoved: 'Удалённый шлюз',+ terminalGatewayRemovedBody:+ 'Шлюз, на котором работал этот терминал, удалён, поэтому его нельзя открыть снова. Закройте эту вкладку.',+ terminalGatewayNoShellBody:+ 'У этого шлюза нет доступа к оболочке, поэтому терминал нельзя открыть снова. Закройте эту вкладку.',addToChat: 'Добавить в чат'},preview: {diff --git a/apps/desktop/src/i18n/types_right_sidebar.ts b/apps/desktop/src/i18n/types_right_sidebar.tsindex 083901ea1da..3d48ae6f4e8 100644--- a/apps/desktop/src/i18n/types_right_sidebar.ts+++ b/apps/desktop/src/i18n/types_right_sidebar.ts@@ -43,6 +43,10 @@ export interface RightSidebarTranslations {terminalOpenInteractive: stringterminalCloseOthers: stringterminalCloseAll: string+ terminalNewOn: string+ terminalGatewayRemoved: string+ terminalGatewayRemovedBody: string+ terminalGatewayNoShellBody: stringterminalDropUploadFailed: (name: string) => stringterminalDropTooLargeTitle: stringterminalDropTooLarge: (names: string, limit: string) => stringdiff --git a/apps/desktop/src/i18n/zh-hant_chrome.ts b/apps/desktop/src/i18n/zh-hant_chrome.tsindex fb64274f44d..147a0b00654 100644--- a/apps/desktop/src/i18n/zh-hant_chrome.ts+++ b/apps/desktop/src/i18n/zh-hant_chrome.ts@@ -466,6 +466,12 @@ export const zhHantChrome = {terminalNew: '新增終端機',terminalCloseOthers: '關閉其他',terminalCloseAll: '全部關閉',+ terminalNewOn: '新增終端機於…',+ terminalGatewayRemoved: '已移除的閘道',+ terminalGatewayRemovedBody:+ '此終端機所在的閘道已被移除,無法重新開啟。請關閉此分頁。',+ terminalGatewayNoShellBody:+ '此閘道不提供 Shell 存取,此終端機無法重新開啟。請關閉此分頁。',addToChat: '新增至聊天'},diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex b43c662e520..6b9f1c06c7f 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -4089,6 +4089,12 @@ export const zhOverrides = {terminalNew: '新建终端',terminalCloseOthers: '关闭其他',terminalCloseAll: '关闭全部',+ terminalNewOn: '新建终端于…',+ terminalGatewayRemoved: '已移除的网关',+ terminalGatewayRemovedBody:+ '此终端所在的网关已被移除,无法重新打开。请关闭此标签页。',+ terminalGatewayNoShellBody:+ '此网关不提供 Shell 访问,此终端无法重新打开。请关闭此标签页。',addToChat: '添加到对话'},diff --git a/locales/_keys.desktop.json b/locales/_keys.desktop.jsonindex ea7e991d714..6b7e174c4c8 100644--- a/locales/_keys.desktop.json+++ b/locales/_keys.desktop.json@@ -2714,8 +2714,12 @@"rightSidebar.terminalDropTooLargeTitle","rightSidebar.terminalDropUnquotable","rightSidebar.terminalDropUploadFailed",+ "rightSidebar.terminalGatewayNoShellBody",+ "rightSidebar.terminalGatewayRemoved",+ "rightSidebar.terminalGatewayRemovedBody","rightSidebar.terminalHide","rightSidebar.terminalNew",+ "rightSidebar.terminalNewOn","rightSidebar.terminalOpenInteractive","rightSidebar.terminalReadOnly","rightSidebar.terminalReadOnlyHelp",