The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): "Open containing folder" is offered only for a session on this computer, and says so when a path is not here
teknium100c0ea6cbe58
diff --git a/apps/desktop/electron/fs-ipc.test.ts b/apps/desktop/electron/fs-ipc.test.tsindex 34b788096f2..d985612caf8 100644--- a/apps/desktop/electron/fs-ipc.test.ts+++ b/apps/desktop/electron/fs-ipc.test.ts@@ -1,3 +1,9 @@+/**+ * `hermes:fs:reveal` answers what it did (#115167). `shell.showItemInFolder`+ * selects an existing item and silently no-ops on a missing one, and a remote+ * backend's paths are missing on this computer by construction — a `true` for+ * them left the renderer nothing to say.+ */import fs from 'node:fs'import os from 'node:os'import path from 'node:path'@@ -34,7 +40,8 @@ const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'hermes-fs-ipc-'))registerFsIpc({hermesHome: scratch,readActiveDesktopProfile: () => null,- expandUserPath: value => value,+ // `~/` resolves under the scratch dir so tilde paths can be exercised.+ expandUserPath: value => (value.startsWith('~/') ? path.join(scratch, value.slice(2)) : value),resolveRequestedPathForIpc: value => value,directoryExists: value => fs.existsSync(value),resolveGitBinary: () => 'git'@@ -61,4 +68,28 @@ describe('hermes:fs:reveal', () => {await expect(reveal(path.join(scratch, 'not-here'))).resolves.toBe(false)expect(electron.showItemInFolder).not.toHaveBeenCalled()})++ it('reports false for a path that is not on this computer, and only shows one that is', async () => {+ const here = path.join(scratch, 'notes.md')++ fs.writeFileSync(here, 'x')++ await expect(reveal('/home/hermes/.hermes/attachments/report.zip')).resolves.toBe(false)+ expect(electron.showItemInFolder).not.toHaveBeenCalled()++ await expect(reveal(here)).resolves.toBe(true)+ expect(electron.showItemInFolder).toHaveBeenCalledTimes(1)+ expect(electron.showItemInFolder).toHaveBeenCalledWith(here)+ })++ // The renderer may hand over a tilde path; the existence check runs on the+ // expanded path, and the expanded path is what the file manager is shown.+ it('expands a tilde path before checking and revealing it', async () => {+ const here = path.join(scratch, 'tilde.md')++ fs.writeFileSync(here, 'x')++ await expect(reveal('~/tilde.md')).resolves.toBe(true)+ expect(electron.showItemInFolder).toHaveBeenCalledWith(here)+ })})diff --git a/apps/desktop/electron/fs-ipc.ts b/apps/desktop/electron/fs-ipc.tsindex 60dc7280fd2..59ac08d8029 100644--- a/apps/desktop/electron/fs-ipc.ts+++ b/apps/desktop/electron/fs-ipc.ts@@ -39,18 +39,26 @@ export function registerFsIpc({ipcMain.handle('hermes:fs:gitRoot', async (_event, startPath) => gitRootForIpc(startPath))// Reveal a path in the OS file manager (Finder / Explorer / Files).+ // `showItemInFolder` silently no-ops on a missing item, and a remote+ // backend's paths are missing here by construction — answer `false` so+ // the renderer can say so instead of reporting a click that showed nothing.ipcMain.handle('hermes:fs:reveal', async (_event, targetPath) => {const target = String(targetPath || '').trim()- // `showItemInFolder` silently no-ops on a missing path, so a remote- // backend's workspace (not on this computer) would report success for a- // click that showed nothing. Report the miss so the renderer can toast.- if (!target || !fs.existsSync(target)) {+ if (!target) {return false}try {- shell.showItemInFolder(target)+ // Existence is checked on the tilde-expanded path — the one the file+ // manager is shown — so `~/…` from the renderer is not a false miss.+ const local = expandUserPath(target)++ if (!fs.existsSync(local)) {+ return false+ }++ shell.showItemInFolder(local)return true} catch {diff --git a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsxindex c7d941cdb02..3cc77a99b21 100644--- a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx+++ b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx@@ -34,7 +34,7 @@ import { cacheHitLabel, contextBarLabel, LiveDuration, tokensPerSecondLabel, usaimport { useStoreSelector } from '@/lib/use-session-slice'import { cn } from '@/lib/utils'import { resolveVersionStatus } from '@/lib/version-status'-import { copyFilePath, revealFile } from '@/store/file-actions'+import { copyFilePath, revealFile, shouldOfferLocalReveal } from '@/store/file-actions'import { $freeTierStatus, FREE_TIER_MODEL } from '@/store/free-tier'import { openFreeTierSignIn } from '@/store/free-tier-sign-in'import { revealFileInTree } from '@/store/layout'@@ -224,6 +224,17 @@ export function useStatusbarItems({return row?.cwd?.trim() || ''})+ // Which backend the focused row runs on: a Connections-tagged row names its+ // gateway; an untagged one is the window's primary. Decides whether the OS+ // file manager on this computer can show its workspace at all.+ const focusedRowConnectionId = useStoreSelector($sessions, sessions =>+ focusedStoredSessionId+ ? (sessions.find(s => sessionMatchesStoredId(s, focusedStoredSessionId))?.connection_id?.trim() || '')+ : ''+ )++ const offerLocalReveal = shouldOfferLocalReveal(focusedRowConnectionId, connection?.mode === 'remote')+// Live runtime cwd is authoritative once it belongs to the focused chat// (agent can relocate mid-turn). Until then — cold tabs, mid-switch lag —// the stored session row is the selection's project. Primary drafts fall@@ -534,8 +545,9 @@ export function useStatusbarItems({},// The OS file manager needs the local filesystem; a remote// backend's workspace is not on this computer (the sidebar- // trees already hide reveal the same way).- ...(focusedWorkspaceRemote+ // trees already hide reveal the same way), and a row tagged+ // with another gateway is never local either.+ ...(focusedWorkspaceRemote || !offerLocalReveal? []: [{@@ -611,6 +623,7 @@ export function useStatusbarItems({fileMenu.copyPath,fileMenu.revealFileManager,fileMenu.revealInSidebar,+ offerLocalReveal,freeTier?.available,freeTier?.model,guideOwnsSignIn,diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex be8b450be12..26a225d6cf1 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -130,7 +130,8 @@ export const en: Translations = {deleteTitle: name => `Delete ${name}?`,deleteBody: 'It will be moved to the Trash — you can restore it from there.',pathCopied: 'Path copied',- revealMissing: 'That folder is not on this computer'+ revealMissing: 'That folder is not on this computer',+ revealUnavailable: 'That path is not on this computer — it lives on the backend machine. Use “Reveal in filetree”.'},boot: {diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex b558de7937f..9795733f69f 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -185,6 +185,7 @@ export interface Translations {deleteBody: stringpathCopied: stringrevealMissing: string+ revealUnavailable: string}boot: {diff --git a/apps/desktop/src/store/file-actions.test.ts b/apps/desktop/src/store/file-actions.test.tsindex d78780c5d21..808e05c3db9 100644--- a/apps/desktop/src/store/file-actions.test.ts+++ b/apps/desktop/src/store/file-actions.test.ts@@ -9,7 +9,7 @@ vi.mock('@/lib/media', () => ({const media = await import('@/lib/media')const downloadGatewayMediaFile = vi.mocked(media.downloadGatewayMediaFile)-const { downloadRemoteFile, shouldOfferRemoteFileDownload } = await import('./file-actions')+const { downloadRemoteFile, shouldOfferLocalReveal, shouldOfferRemoteFileDownload } = await import('./file-actions')describe('shouldOfferRemoteFileDownload', () => {it('is only for files on a remote backend', () => {@@ -20,6 +20,20 @@ describe('shouldOfferRemoteFileDownload', () => {})})+describe('shouldOfferLocalReveal', () => {+ // The OS file manager can only show what is on this computer (#115167): the+ // focused row's backend decides; the primary's mode only when it is untagged.+ it.each([+ ['', false, true],+ ['', true, false],+ ['local', true, true],+ ['mini', false, false],+ [undefined, true, false]+ ])('connection %s with primaryRemote=%s -> %s', (connectionId, primaryRemote, expected) => {+ expect(shouldOfferLocalReveal(connectionId, primaryRemote)).toBe(expected)+ })+})+describe('downloadRemoteFile', () => {beforeEach(() => {clearNotifications()diff --git a/apps/desktop/src/store/file-actions.ts b/apps/desktop/src/store/file-actions.tsindex efd3f219eff..9588a1e7d7a 100644--- a/apps/desktop/src/store/file-actions.ts+++ b/apps/desktop/src/store/file-actions.ts@@ -1,3 +1,4 @@+import { LOCAL_CONNECTION_ID } from '@hermes/shared'import { atom } from 'nanostores'import { translateNow } from '@/i18n'@@ -73,6 +74,16 @@ export async function copyFilePath(path: string): Promise<void> {}}+/** Whether "Open containing folder" can work for a session's workspace: only+ * when that session's backend is this computer. A row tagged with a Connections+ * gateway other than `local` runs there; an untagged row runs on the window's+ * primary, remote or not (the rule the sidebar menus already apply). */+export function shouldOfferLocalReveal(connectionId: null | string | undefined, primaryRemote = isDesktopFsRemoteMode()): boolean {+ const tagged = String(connectionId || '').trim()++ return tagged ? tagged === LOCAL_CONNECTION_ID : !primaryRemote+}+/** Remote Files panel can list gateway files but Reveal/Rename/Delete are local-only.* Download is the local-copy affordance. Folders stay out — `/api/fs/download`* streams a single file. */diff --git a/website/docs/user-guide/desktop.md b/website/docs/user-guide/desktop.mdindex 835d874e4c2..4f5c884d931 100644--- a/website/docs/user-guide/desktop.md+++ b/website/docs/user-guide/desktop.md@@ -67,7 +67,7 @@ The bar along the bottom of the chat shows live session state and exposes quick- **Per-session YOLO toggle** — flip YOLO on or off for just this session (matching the TUI). YOLO bypasses the dangerous-command approval prompts, so know what you're turning off — see [Security → YOLO Mode](./security.md#yolo-mode).- **Context-usage meter** — a live "% full" meter of the session's context window. Click it to open the **Context Usage** popover with a token breakdown by category (system prompt, tool definitions, skills, memory, rules, MCP, subagent definitions, and the conversation itself) so you can see exactly what's eating the window before compression kicks in.- **Cache hit rate and tokens per second** — off by default; turn them on from the right-click menu. Cache hit rate is the share of this session's prompt tokens served from the provider's prompt cache (cached tokens cost less, so higher is cheaper — you can watch a session get cheaper as it warms up). Tokens per second is output throughput averaged over the last 10 model calls. Both update live during a turn.-- **Customizable items** — right-click the status bar (**Show in status bar**) to choose what appears: the context meter, cache hit rate, tokens per second, workspace, model, approvals, turn/session timers, terminal, Command Center, backend version, and more — or hide the bar entirely (**Cmd/Ctrl+Shift+S** toggles it).+- **Customizable items** — right-click the status bar (**Show in status bar**) to choose what appears: the context meter, cache hit rate, tokens per second, workspace, model, approvals, turn/session timers, terminal, Command Center, backend version, and more — or hide the bar entirely (**Cmd/Ctrl+Shift+S** toggles it). The workspace item's menu offers **Open containing folder** only when the focused session runs on this computer; a session on a remote gateway keeps its folder on that machine, so use **Reveal in filetree** instead. When the OS file manager cannot find a path, the app says so instead of doing nothing.Chatting against a Hermes instance on another machine instead of the bundled local backend? See [Connecting to a remote backend](#connecting-to-a-remote-backend) below — and for the full picture of how the remote-hosted dashboard connection works (the auth gate, the `/api/ws` chat socket, and WebSocket close-code triage), see [Web Dashboard → Connecting Hermes Desktop to a remote backend](./features/web-dashboard.md#connecting-hermes-desktop-to-a-remote-backend).