The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): disambiguate Distribution labels across install shapes
ethernet324d98433a4a
diff --git a/apps/desktop/electron/app-version.ts b/apps/desktop/electron/app-version.tsindex 65fed21e4ca..2c4a29ca14a 100644--- a/apps/desktop/electron/app-version.ts+++ b/apps/desktop/electron/app-version.ts@@ -14,6 +14,14 @@ export interface AppVersionInfo {source?: InstallStamp['source']distribution?: stringupdateMechanism?: InstallStamp['updateMechanism']+ /** The artifact kind of the app carrying this version info ('bootstrap' |+ * 'bundled' | 'light'). The Distribution label keys on it: a bootstrap+ * artifact is the old-style installer shell over a managed checkout. */+ payload?: InstallStamp['payload']+ /** True when the runtime checkout carries the bootstrap installers'+ * `.hermes-bootstrap-complete` receipt — install.sh / install.ps1 (or the+ * desktop bootstrap) created it, as opposed to a manual git clone. */+ installedByScript?: booleandirty?: boolean}@@ -43,6 +51,7 @@ export function appVersionInfo(stamp: Readonly<InstallStamp> | null, runtimeVerssource: stamp.source ?? undefined,distribution: stamp.distribution ?? undefined,updateMechanism: stamp.updateMechanism,+ payload: stamp.payload,dirty: stamp.dirty}}diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.tsindex 845167fbfd2..f677193ad37 100644--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@ -16920,10 +16920,15 @@ ipcMain.handle('hermes:version', async (_event, scope?: { connectionId?: string;bundleOutOfSync: skew.outOfSync,bundleCommitsBehind: skew.desktopCommitsBehind,// The install id: sha16 of the canonical install-root path — the key of- // this install's per-install channel record and its installs/<sha16>/ state- // folder. Same value `hermes update --install-id` prints; About renders it- // as `sha16 (path)`.+ // this install's per-install channel record and its installs/<sha16>/+ // state folder. Same value `hermes update --install-id` prints; About+ // renders it as `sha16 (path)`.installId: installIdForRoot(resolveUpdateRoot(), canonicalizeInstallPath),+ // The artifact kind of THIS app plus whether the runtime checkout came+ // from a bootstrap installer script — About's Distribution row+ // disambiguates installer shells, bundles, and script installs from these.+ payload: INSTALL_STAMP?.payload,+ installedByScript: isInstallerCreatedCheckout(),// What this build carries and where an external backend runs from.// Bundled artifacts always run their payload; light artifacts have no// runtime and only reach remote backends. External builds classify from@@ -16988,6 +16993,21 @@ function canonicalizeInstallPath(p: string): string {}}+/** True when the runtime checkout was created by a bootstrap installer+ * (install.sh / install.ps1 / the desktop first-launch bootstrap): those all+ * finish by writing `.hermes-bootstrap-complete` into the checkout root, and+ * `hermes update` preserves the file, so a manual clone never grows one. A+ * missing checkout (sealed bundled payloads, remote backends) is not+ * installer-created. */+export function isInstallerCreatedCheckout(root: string | null = ACTIVE_HERMES_ROOT): boolean {+ if (!root) { return false }+ try {+ return fs.existsSync(path.join(root, path.basename(BOOTSTRAP_COMPLETE_MARKER)))+ } catch {+ return false+ }+}+/** Classify what this build carries (embedded / light / external). The stamp's* `payload` decides the first two; an external build classifies its root via* the canonical-root install stamp (desktop-bootstrapped) or the app stamp'sdiff --git a/apps/desktop/src/components/version-details.test.tsx b/apps/desktop/src/components/version-details.test.tsxindex 49b621b492e..ec27a29b05d 100644--- a/apps/desktop/src/components/version-details.test.tsx+++ b/apps/desktop/src/components/version-details.test.tsx@@ -35,10 +35,22 @@ describe('VersionDetails', () => {{ version: { hermesRuntime: { type: 'external' } }, visible: ['Runtime', 'External (uses the machine runtime)'] },{ version: { distribution: 'desktop-app', updateMechanism: 'microsoft-store' },visible: ['Distribution', 'Microsoft Store'], absent: ['Desktop app (MSIX)'] },- { version: { distribution: 'desktop-app', updateMechanism: 'app-installer' },+ { version: { distribution: 'desktop-app', updateMechanism: 'app-installer', payload: 'bundled' },visible: ['Desktop app (MSIX)'], absent: ['Microsoft Store'] },- { version: { distribution: 'desktop-app', updateMechanism: 'electron-updater' },- visible: ['Desktop app'], absent: ['Desktop app (MSIX)'] }+ { version: { distribution: 'desktop-app', updateMechanism: 'electron-updater', payload: 'bundled' },+ visible: ['Desktop app'], absent: ['Desktop app (MSIX)'] },+ // Old-style installer shell (bootstrap artifact over a managed checkout —+ // e.g. iris's v0.17.6 .app): named as the installer, never as MSIX.+ { version: { distribution: 'desktop-app', updateMechanism: 'self', payload: 'bootstrap' },+ visible: ['Desktop app (installer)'], absent: ['Desktop app (MSIX)', 'Microsoft Store'] },+ // install.sh / install.ps1 checkout (receipt present) vs a manual git+ // clone (live provenance, no receipt): both honestly say Source.+ { version: { installedByScript: true },+ visible: ['Source (install script)'] },+ { version: { source: 'git' },+ visible: ['Distribution', 'Source'], absent: ['Source (install script)'] },+ { version: {},+ visible: ['Version'], absent: ['Distribution'] }]it.each(cases)('renders $version', ({ version, visible, absent = [] }: VersionCase): void => {diff --git a/apps/desktop/src/components/version-details.tsx b/apps/desktop/src/components/version-details.tsxindex 994b67eb132..3189ffd0daf 100644--- a/apps/desktop/src/components/version-details.tsx+++ b/apps/desktop/src/components/version-details.tsx@@ -1,6 +1,7 @@import type { DesktopVersionInfo, RuntimeSource } from '@/global'import { useI18n } from '@/i18n'import { ExternalLink } from '@/lib/external-link'+import { distributionLabelKey } from '@/lib/distribution-label'/*** Human label for an external build's runtime source: the resolution rung@@ -26,21 +27,18 @@ export function VersionDetails({ version }: { version: DesktopVersionInfo }) {const source =version.source === 'ci' ? 'CI' : version.source ? version.source[0].toUpperCase() + version.source.slice(1) : null- // The stamp distinguishes Store builds from sideloaded MSIX builds; MSIX is- // Windows packaging, so only the app-installer (out-of-store MSIX) mechanism- // earns the "(MSIX)" copy — macOS/Linux desktop builds are plain "Desktop app".+ // The Distribution row: one resolver owns the label policy — see+ // distribution-label.ts. Nix and Docker are product names, rendered+ // verbatim; every other shape comes from the stamp via i18n.+ const distributionKey = distributionLabelKey(version)const distribution =version.distribution === 'nix'? 'Nix': version.distribution === 'docker'? 'Docker'- : version.updateMechanism === 'microsoft-store'- ? u.versionDetailsDistributionStore- : version.distribution === 'desktop-app'- ? version.updateMechanism === 'app-installer'- ? u.versionDetailsDistributionDesktopMsix- : u.versionDetailsDistributionDesktop- : null+ : distributionKey+ ? u[distributionKey]+ : nullconst runtime =version.hermesRuntime?.type === 'embedded'diff --git a/apps/desktop/src/global.d.ts b/apps/desktop/src/global.d.tsindex 9fa64fd431a..d85880102ef 100644--- a/apps/desktop/src/global.d.ts+++ b/apps/desktop/src/global.d.ts@@ -687,6 +687,14 @@ export interface DesktopVersionInfo {* Store-identity build — the Settings label keys off this, never* process.windowsStore (which also matches sideloaded MSIX). */updateMechanism?: 'self' | 'app-installer' | 'electron-updater' | 'external' | 'microsoft-store'+ /** The artifact kind of the desktop app carrying this info ('bootstrap' |+ * 'bundled' | 'light'). 'bootstrap' is the old-style installer shell over+ * a managed checkout; the Distribution label keys on it. */+ payload?: 'bootstrap' | 'bundled' | 'light'+ /** True when the runtime checkout carries the bootstrap installers'+ * `.hermes-bootstrap-complete` receipt — install.sh / install.ps1 (or the+ * desktop first-launch bootstrap) created it, a manual clone did not. */+ installedByScript?: boolean/** sha16 of the canonical install-root path — the per-install channel key and* the shape `hermes update --install-id` prints. */installId?: stringdiff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.tsindex 6fa5dc664d3..70ef0881041 100644--- a/apps/desktop/src/i18n/ar.ts+++ b/apps/desktop/src/i18n/ar.ts@@ -2384,6 +2384,9 @@ export const ar = defineLocale({versionDetailsDistribution: 'التوزيع',versionDetailsDistributionDesktop: 'تطبيق سطح المكتب',versionDetailsDistributionDesktopMsix: 'تطبيق سطح المكتب (MSIX)',+ versionDetailsDistributionDesktopInstaller: 'تطبيق سطح المكتب (المُثبِّت)',+ versionDetailsDistributionSourceInstaller: 'المصدر (سكربت التثبيت)',+ versionDetailsDistributionSource: 'المصدر',versionDetailsDistributionStore: 'Microsoft Store',versionDetailsRuntimeEmbedded: 'وقت تشغيل مضمّن',versionDetailsRuntimeExternal: 'خارجي (يستخدم وقت تشغيل الجهاز)',diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 18c682c1205..fe7639f8850 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -3380,6 +3380,9 @@ export const en: Translations = {versionDetailsDistribution: 'Distribution',versionDetailsDistributionDesktop: 'Desktop app',versionDetailsDistributionDesktopMsix: 'Desktop app (MSIX)',+ versionDetailsDistributionDesktopInstaller: 'Desktop app (installer)',+ versionDetailsDistributionSourceInstaller: 'Source (install script)',+ versionDetailsDistributionSource: 'Source',versionDetailsDistributionStore: 'Microsoft Store',versionDetailsRuntime: 'Runtime',versionDetailsRuntimeEmbedded: 'Embedded runtime',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 6b3f472a6af..8d3dce76774 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -2928,6 +2928,9 @@ export interface Translations {versionDetailsDistribution: stringversionDetailsDistributionDesktop: stringversionDetailsDistributionDesktopMsix: string+ versionDetailsDistributionDesktopInstaller: string+ versionDetailsDistributionSourceInstaller: string+ versionDetailsDistributionSource: stringversionDetailsDistributionStore: stringversionDetailsRuntime: stringversionDetailsRuntimeEmbedded: stringdiff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex bc497d26d31..e4a84d52c0c 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -3508,6 +3508,9 @@ export const zh = defineLocale({versionDetailsDistribution: '发行版',versionDetailsDistributionDesktop: '桌面应用',versionDetailsDistributionDesktopMsix: '桌面应用 (MSIX)',+ versionDetailsDistributionDesktopInstaller: '桌面应用(安装器)',+ versionDetailsDistributionSourceInstaller: '源码(安装脚本)',+ versionDetailsDistributionSource: '源码',versionDetailsDistributionStore: 'Microsoft Store',versionDetailsRuntime: '运行时',versionDetailsRuntimeEmbedded: '嵌入式(捆绑)',diff --git a/apps/desktop/src/lib/distribution-label.ts b/apps/desktop/src/lib/distribution-label.tsnew file mode 100644index 00000000000..f51c8f29d4d--- /dev/null+++ b/apps/desktop/src/lib/distribution-label.ts@@ -0,0 +1,76 @@+import type { DesktopVersionInfo } from '@/global'++/**+ * Pure distribution-label selection for the version-details "Distribution"+ * row, shared by every surface that names an install's provenance.+ *+ * The install stamp carries three independent facts and the label keys on the+ * pair that answers "what did the user install":+ * - `distribution` the steward of a sealed tree (`desktop-app`) — gates the+ * desktop-app rows below.+ * - `payload` the artifact kind of the app itself: `bootstrap` is the+ * old-style installer shell (a .app/.exe over a managed+ * checkout), `bundled` ships the runtime in the artifact,+ * `light` carries no runtime.+ * - `updateMechanism` who applies the next update (Store, App Installer,+ * electron-updater, …). `self` on a `bootstrap` artifact is+ * truthful forever: the shell never updates itself, the+ * managed checkout underneath does.+ * `installedByScript` refines an external/git install into "installed by+ * install.sh / install.ps1" vs a manual clone — those checkouts carry the+ * bootstrap installers' `.hermes-bootstrap-complete` receipt.+ */++/** Keys of the updates i18n section this resolver may return. */+export type DistributionLabelKey =+ | 'versionDetailsDistributionStore'+ | 'versionDetailsDistributionDesktopMsix'+ | 'versionDetailsDistributionDesktop'+ | 'versionDetailsDistributionDesktopInstaller'+ | 'versionDetailsDistributionSourceInstaller'+ | 'versionDetailsDistributionSource'++export interface DistributionLabelInput {+ distribution?: DesktopVersionInfo['distribution']+ updateMechanism?: DesktopVersionInfo['updateMechanism']+ payload?: DesktopVersionInfo['payload']+ installedByScript?: boolean+ /** Live provenance for non-stamped installs (git/unknown/…). A manual+ * clone reports git; nothing known means no Distribution row. */+ source?: DesktopVersionInfo['source']+}++/**+ * The i18n key for the Distribution row, or null when nothing is known well+ * enough to show a row (no distribution stamp at all).+ */+export function distributionLabelKey(version: DistributionLabelInput): DistributionLabelKey | null {+ if (version.distribution === 'nix' || version.distribution === 'docker') {+ // Not localized facts; the component renders them verbatim.+ return null+ }++ if (version.updateMechanism === 'microsoft-store') {+ return 'versionDetailsDistributionStore'+ }++ if (version.distribution !== 'desktop-app') {+ // A plain source install: the bootstrap receipt separates the script+ // installers from a manual clone. No provenance at all shows no row —+ // an unproven build must not claim "Source".+ if (version.installedByScript) {+ return 'versionDetailsDistributionSourceInstaller'+ }+ return version.source && version.source !== 'unknown' ? 'versionDetailsDistributionSource' : null+ }++ if (version.payload === 'bootstrap') {+ return 'versionDetailsDistributionDesktopInstaller'+ }++ if (version.updateMechanism === 'app-installer') {+ return 'versionDetailsDistributionDesktopMsix'+ }++ return 'versionDetailsDistributionDesktop'+}diff --git a/hermes_cli/banner.py b/hermes_cli/banner.pyindex a63f7177e35..5b64e4873cd 100644--- a/hermes_cli/banner.py+++ b/hermes_cli/banner.py@@ -216,6 +216,11 @@ def format_banner_version_label() -> str:if stamp.get("tag"):channel = "canary" if is_canary_tag(stamp["tag"]) else "stable"return f"{label} · {channel}"+ if stamp.get("payload") == "bootstrap":+ # The old installer shell's CLI backend: the shell never updates+ # itself (`self`), the managed checkout under it does. Name the+ # shell so it doesn't read as a plain packaged build.+ return f"{label} · installer"return labelbase = f"Hermes Agent v{VERSION} ({RELEASE_DATE})"diff --git a/tests/hermes_cli/test_banner_distribution_label.py b/tests/hermes_cli/test_banner_distribution_label.pynew file mode 100644index 00000000000..4b6c572013e--- /dev/null+++ b/tests/hermes_cli/test_banner_distribution_label.py@@ -0,0 +1,49 @@+"""The banner names the desktop shell shape, not just "desktop-app".++An old-style installer artifact (payload ``bootstrap``, mechanism ``self``)+runs its CLI backend from the same stamp as a bundled release build; the+banner must not present both as identical packaged builds — the installer+shell never updates itself, the managed checkout under it does.+"""++import json++import pytest+++def desktop_stamp(tmp_path, monkeypatch):+ def _stamp(payload, update_mechanism, tag=None):+ root = tmp_path / f"app-{payload}-{update_mechanism}"+ root.mkdir()+ (root / "install-stamp.json").write_text(json.dumps({+ "source": "local", "distribution": "desktop-app", "payload": payload,+ "updateMechanism": update_mechanism, "commit": "a" * 40,+ "displayVersion": "0.17.6", "baseVersion": "0.17.6", "tag": tag,+ }))+ monkeypatch.setattr("hermes_cli.config.get_project_root", lambda: root)+ monkeypatch.setattr("hermes_cli.version_info._CODE_ROOT", root)+ monkeypatch.delenv("HERMES_INSTALL_ROOT", raising=False)+ from hermes_cli.version_info import _reset_version_info_cache+ _reset_version_info_cache()+ return root++ yield _stamp+ from hermes_cli.version_info import _reset_version_info_cache+ _reset_version_info_cache()+++def test_bootstrap_shell_banner_says_installer(desktop_stamp):+ from hermes_cli import banner++ desktop_stamp("bootstrap", "self")+ label = banner.format_banner_version_label()+ assert "0.17.6" in label+ assert "installer" in label+++def test_bundled_release_banner_does_not_say_installer(desktop_stamp):+ from hermes_cli import banner++ desktop_stamp("bundled", "electron-updater")+ assert "installer" not in banner.format_banner_version_label()