Skip to content

The agent that grows with you

fix(desktop): show local client version for source installs

jj56385218d132a04df44
diff --git a/apps/desktop/electron/app-version.test.ts b/apps/desktop/electron/app-version.test.ts
index ee0c0a49177..246c97bbbd6 100644
--- a/apps/desktop/electron/app-version.test.ts
+++ b/apps/desktop/electron/app-version.test.ts
@@ -83,6 +83,18 @@ describe('artifact version identity', (): void => {
expect((): void => assertSourceUpdateChannel(null)).not.toThrow()
})
+ it('uses the local bootstrap runtime version supplied by the desktop shell', (): void => {
+ const stamp: InstallStamp = {
+ payload: 'bootstrap',
+ displayVersion: null,
+ baseVersion: null,
+ source: 'local',
+ updateMechanism: 'self'
+ } as InstallStamp
+
+ expect(appVersionInfo(stamp, '0.21.5+6644.gb412ee9', '0.0.0').appVersion).toBe('0.21.5+6644.gb412ee9')
+ })
+
// #124581: the desktop package.json carries a 0.0.0 placeholder, so the
// About panel must never repeat it as the running version.
it('skips the 0.0.0 package placeholder for builds without a baked display version', (): void => {
diff --git a/apps/desktop/electron/local-runtime-version.test.ts b/apps/desktop/electron/local-runtime-version.test.ts
new file mode 100644
index 00000000000..190c1c77a3a
--- /dev/null
+++ b/apps/desktop/electron/local-runtime-version.test.ts
@@ -0,0 +1,48 @@
+import { describe, expect, it, vi } from 'vitest'
+
+import { PROBE_TIMEOUT_MS } from './backend-probes'
+import { parseLocalRuntimeVersion, resolveLocalRuntimeVersion, type VersionProbeRunner } from './local-runtime-version'
+
+describe('local client version source', (): void => {
+ it('parses the exact version line emitted by the local launcher', (): void => {
+ expect(parseLocalRuntimeVersion('Hermes Agent v0.21.5+6644.gb412ee9 (2026.9.24)\n')).toBe('0.21.5+6644.gb412ee9')
+ expect(parseLocalRuntimeVersion('gateway: v0.21.5+6634\n')).toBe('')
+ })
+
+ it('probes the installation launcher with a bounded command and ignores remote values', async (): Promise<void> => {
+ const run: VersionProbeRunner = vi.fn(async (_command, args, options) => {
+ expect(args).toEqual(['--version'])
+ expect(options.cwd).toBe('/isolated/hermes')
+ expect(options.timeout).toBe(PROBE_TIMEOUT_MS)
+ expect(options.maxBuffer).toBe(64 * 1024)
+ expect(options.env.HERMES_HOME).toBe('/isolated/home')
+
+ return 'Hermes Agent v0.21.5+6644.gb412ee9 (local)\n'
+ })
+
+ await expect(resolveLocalRuntimeVersion('/isolated/hermes', '/isolated/home', {
+ launcher: '/isolated/hermes/.hermes/bin/hermes',
+ run
+ })).resolves.toBe('0.21.5+6644.gb412ee9')
+ expect(run).toHaveBeenCalledTimes(1)
+ })
+
+ it('fails closed when the local launcher cannot answer', async (): Promise<void> => {
+ const run: VersionProbeRunner = vi.fn(async () => {
+ throw new Error('timeout')
+ })
+
+ await expect(resolveLocalRuntimeVersion('/isolated/hermes', '/isolated/home', {
+ launcher: '/isolated/hermes/.hermes/bin/hermes',
+ run
+ })).resolves.toBe('')
+ })
+
+ it('does not invoke a missing installation launcher', async (): Promise<void> => {
+ const run: VersionProbeRunner = vi.fn()
+
+ await expect(resolveLocalRuntimeVersion('/isolated/hermes', '/isolated/home', { launcher: null, run })).resolves.toBe('')
+ expect(run).not.toHaveBeenCalled()
+ })
+
+})
diff --git a/apps/desktop/electron/local-runtime-version.ts b/apps/desktop/electron/local-runtime-version.ts
new file mode 100644
index 00000000000..3568bf5fb5b
--- /dev/null
+++ b/apps/desktop/electron/local-runtime-version.ts
@@ -0,0 +1,138 @@
+import { execFile } from 'node:child_process'
+
+import { appVersionInfo } from './app-version'
+import { buildDesktopBackendEnv } from './backend-env'
+import { PROBE_TIMEOUT_MS } from './backend-probes'
+import type { InstallStamp } from './install-stamp'
+import { resolveInstallationLauncher } from './updater-process'
+import { windowsShellCommand } from './windows-child-options'
+
+export type VersionProbeRunner = (
+ command: string,
+ args: string[],
+ options: {
+ cwd: string
+ env: NodeJS.ProcessEnv
+ timeout: number
+ maxBuffer: number
+ shell: boolean
+ windowsHide: boolean
+ }
+) => Promise<string>
+
+const DEFAULT_CACHE_TTL_MS = 5_000
+let cached: { launcher: string; version: string; expiresAt: number } | null = null
+let inFlight: { launcher: string; promise: Promise<string> } | null = null
+
+/** Extract the client version printed by the exact local installation launcher. */
+export function parseLocalRuntimeVersion(output: string): string {
+ const match = output.match(/^\s*Hermes Agent\s+([^\s(]+)/m)
+
+ return match?.[1]?.replace(/^v/, '') ?? ''
+}
+
+function runVersionProbe(
+ command: string,
+ args: string[],
+ options: Parameters<VersionProbeRunner>[2]
+): Promise<string> {
+ return new Promise((resolve, reject) => {
+ execFile(command, args, { ...options, encoding: 'utf8' }, (error, stdout) => {
+ if (error) {
+ reject(error)
+
+ return
+ }
+
+ resolve(stdout)
+ })
+ })
+}
+
+/**
+ * Read the version from the local source installation without contacting a
+ * gateway or starting the full backend. The short cache prevents repeated
+ * About/status refreshes from spawning the launcher unnecessarily.
+ */
+export async function resolveLocalRuntimeVersion(
+ root: string,
+ hermesHome: string,
+ options: {
+ isWindows?: boolean
+ launcher?: string | null
+ run?: VersionProbeRunner
+ cacheTtlMs?: number
+ } = {}
+): Promise<string> {
+ const isWindows = options.isWindows ?? process.platform === 'win32'
+ let launcher: string | null
+
+ try {
+ launcher = options.launcher === undefined
+ ? resolveInstallationLauncher(root, isWindows, hermesHome)
+ : options.launcher
+ } catch {
+ return ''
+ }
+
+ if (!launcher) {
+ return ''
+ }
+
+ const run = options.run ?? runVersionProbe
+ const useCache = options.run === undefined
+ const now = Date.now()
+
+ if (useCache && cached?.launcher === launcher && cached.expiresAt > now) {
+ return cached.version
+ }
+
+ if (useCache && inFlight?.launcher === launcher) {
+ return inFlight.promise
+ }
+
+ const shell = isWindows && /\.(cmd|bat)$/i.test(launcher)
+ const command = windowsShellCommand(launcher, shell, isWindows)
+
+ const promise = run(command, ['--version'], {
+ cwd: root,
+ env: { ...process.env, ...buildDesktopBackendEnv({ currentEnv: process.env }), HERMES_HOME: hermesHome },
+ timeout: PROBE_TIMEOUT_MS,
+ maxBuffer: 64 * 1024,
+ shell,
+ windowsHide: true
+ })
+ .then(parseLocalRuntimeVersion)
+ .catch(() => '')
+
+ if (useCache) {
+ inFlight = { launcher, promise }
+ void promise.then(version => {
+ cached = { launcher, version, expiresAt: Date.now() + (options.cacheTtlMs ?? DEFAULT_CACHE_TTL_MS) }
+ }).finally(() => {
+ if (inFlight?.promise === promise) {
+ inFlight = null
+ }
+ })
+ }
+
+ return promise
+}
+
+/**
+ * This machine's install, whatever connection the window is on: the stamp for
+ * packaged artifacts, the install launcher's `--version` for source installs.
+ * The About page shows it beside the active connection's backend version.
+ */
+export async function resolveDesktopClientVersion(
+ stamp: Readonly<InstallStamp> | null,
+ root: string,
+ hermesHome: string,
+ packageVersion: string
+): Promise<string> {
+ if (stamp?.payload && stamp.payload !== 'bootstrap') {
+ return appVersionInfo(stamp, '', packageVersion).appVersion
+ }
+
+ return resolveLocalRuntimeVersion(root, hermesHome)
+}
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index f8bcd2e8a1b..880e2b03f7d 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -348,6 +348,7 @@ import { createNvidiaEglRecovery } from './linux-nvidia-egl-recovery'
import { relaunchIfNoSandboxCameTooLate } from './linux-sandbox-relaunch'
import { createLocalBackendLifecycle, waitForTeardown } from './local-backend-lifecycle'
import { resolveIpcFileReadPath, resolveMediaStreamFile, resolvePreviewTargetPath } from './local-read-path'
+import { resolveDesktopClientVersion } from './local-runtime-version'
import { localSkinProfileKey, readLocalSkinPayload } from './local-skin'
import { ACTIVE_LOG_POLL_MS, planLogRotation, reclaimActiveLogIfOversized } from './log-rotation'
import { registerMachineProfile } from './machine-profile'
@@ -17212,10 +17213,17 @@ function showAboutPanelFresh(): void {
}
ipcMain.handle('hermes:version', async (_event, scope?: { connectionId?: string; profile?: string }) => {
- const [skew, version] = await Promise.all([detectRendererSkew(), resolveHermesVersion(scope)])
+ const [skew, version, clientVersion] = await Promise.all([
+ detectRendererSkew(),
+ resolveHermesVersion(scope),
+ resolveDesktopClientVersion(INSTALL_STAMP, resolveUpdateRoot(), HERMES_HOME, app.getVersion())
+ ])
return {
...appVersionInfo(INSTALL_STAMP, version, app.getVersion()),
+ // Both sides, labelled: the backend the active connection runs, and this machine's install.
+ backendVersion: version,
+ clientVersion,
electronVersion: process.versions.electron,
nodeVersion: process.versions.node,
platform: process.platform,