The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): isolate canary and commit package identities
ethernetc4e2d937f784
diff --git a/.github/workflows/desktop-bundled-release.yml b/.github/workflows/desktop-bundled-release.ymlindex 12af1db0b0d..4381bd7dcce 100644--- a/.github/workflows/desktop-bundled-release.yml+++ b/.github/workflows/desktop-bundled-release.yml@@ -20,9 +20,7 @@ name: Desktop Bundled Release# publish-win32-store → Windows Store submission# (needs build-win32, PARALLEL with the updater feed): bundle the two# Store-*.msix into one universal Store .msixbundle and submit via the-# MSStore CLI. Stable → production; canary → package flight ring-# (delete-then-replace, newest always wins). Gated on MS_STORE_PRODUCT_ID-# (+ MS_STORE_CANARY_FLIGHT_ID for the canary arm).+# MSStore CLI. Only stable is eligible, gated on MS_STORE_PRODUCT_ID.# publish-darwin-updater → macOS electron-updater feed# (needs BOTH darwin legs): scripts.releases.r2 finalize merges the per-arch# ymls into releases/darwin/<channel>/<channel>-mac.yml — the feed@@ -66,11 +64,9 @@ name: Desktop Bundled Release# release-signing environment:# secrets: MS_STORE_TENANT_ID, MS_STORE_SELLER_ID, MS_STORE_CLIENT_ID,# MS_STORE_CLIENT_SECRET-# vars: MS_STORE_PRODUCT_ID (the Partner Center product ID),-# MS_STORE_CANARY_FLIGHT_ID (package flight for canaries —-# optional; without it canaries skip the store)+# vars: MS_STORE_PRODUCT_ID (the Partner Center product ID)# msstore reconfigure → (delete pending) → msstore publish-# <Store-*.msixbundle> (-f <flightId> for canaries) -id <productId>+# <Store-*.msixbundle> -id <productId># The Store bundle is UNSIGNED on purpose — Partner Center re-signs on# ingestion (see sign-msix.mjs).@@ -486,12 +482,13 @@ jobs:run: |if [ -n "$HERMES_BUILD_COMMIT" ]; thenpython scripts/bundles/desktop.py --commit="$HERMES_BUILD_COMMIT" --variant=bundled- python scripts/bundles/desktop.py --commit="$HERMES_BUILD_COMMIT" --variant=storeelsepython scripts/bundles/desktop.py --tag="$HERMES_PAYLOAD_TAG" --variant=bundled- # Repack the payload with the Partner Center identity.- # Store packages enter the tag archive, never an updater feed.- python scripts/bundles/desktop.py --tag="$HERMES_PAYLOAD_TAG" --variant=store+ # The official Store identity is stable-only. Canary must never+ # replace it, even in a Store flight ring.+ if [[ "$HERMES_PAYLOAD_TAG" != *-canary.* ]]; then+ python scripts/bundles/desktop.py --tag="$HERMES_PAYLOAD_TAG" --variant=store+ fifi- name: Save warmed Python dependencies even after a packaging failure@@ -993,10 +990,9 @@ jobs:run: |# Candidate mode builds the bundles without writing a feed.# Canary mode publishes the App Installer bundle and pointer.- # Commit mode assembles both products without publishing feeds.+ # Commit mode assembles only the sideload product, without a feed.if [ -n "$HERMES_BUILD_COMMIT" ]; thennode scripts/stage-msixbundle.mjs --commit "$HERMES_BUILD_COMMIT" --version "$HERMES_PAYLOAD_VERSION" --variant bundled --no-upload- node scripts/bundle-store-msixbundle.mjs --commit "$HERMES_BUILD_COMMIT" --version "$HERMES_PAYLOAD_VERSION"exit 0fiargs=()@@ -1025,24 +1021,16 @@ jobs:# Bundles the two Store-*.msix into one universal Store .msixbundle and# submits it to the Windows Store via the MSStore CLI.#- # stable tags → production submission (msstore publish -id)- # canary tags → package flight ring (msstore publish -f <flightId>),- # delete-then-replace: any pending flight submission is- # deleted first so the newest canary always wins the- # single-slot submission queue (chosen over skip-if-pending- # — always ship the newest, at the cost of cert churn).- #- # Gating: runs for stable whenever MS_STORE_PRODUCT_ID is set; runs for- # canary only when MS_STORE_CANARY_FLIGHT_ID is ALSO set (so the flight- # ring stays off until the flight exists in Partner Center).+ # Only stable releases can claim the official Partner Center identity.+ # Canary and commit builds are sideload-only, even when a flight exists.publish-win32-store:- name: Publish the Windows Store submission (production + canary flight)+ name: Publish the stable Windows Store submissionneeds: [validate, build-win32]if: |inputs.build_commit == ''&& inputs.upload_release == true&& vars.MS_STORE_PRODUCT_ID != ''- && (contains(inputs.tag, '-canary.') == false || vars.MS_STORE_CANARY_FLIGHT_ID != '')+ && contains(inputs.tag, '-canary.') == falseruns-on: windows-2025environment: release-signingtimeout-minutes: 60@@ -1059,7 +1047,6 @@ jobs:MS_STORE_CLIENT_ID: ${{ secrets.MS_STORE_CLIENT_ID }}MS_STORE_CLIENT_SECRET: ${{ secrets.MS_STORE_CLIENT_SECRET }}MS_STORE_PRODUCT_ID: ${{ vars.MS_STORE_PRODUCT_ID }}- MS_STORE_CANARY_FLIGHT_ID: ${{ vars.MS_STORE_CANARY_FLIGHT_ID }}steps:- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2with:@@ -1165,23 +1152,12 @@ jobs:# publish (PackageFilesExtensionInclude: .msix/.msixbundle/.msixupload).# Partner Center signs on ingestion — no signing here.#- # delete-then-replace (chosen over skip-if-pending): Partner Center- # allows ONE pending submission per app/flight at a time, so clear- # any in-flight draft before publishing — the newest canary always- # wins the queue. A missing pending submission errors the delete,- # which is fine (nothing to clear) — only the publish gates the job.+ # Partner Center allows one pending submission. Clear that draft+ # before publishing. Only the publish result gates this step.bundle="${{ steps.storebundle.outputs.bundle }}"- if [[ "$HERMES_PAYLOAD_TAG" == *-canary.* ]]; then- echo "canary tag → package flight '$MS_STORE_CANARY_FLIGHT_ID'"- msstore flights submission delete "$MS_STORE_PRODUCT_ID" "$MS_STORE_CANARY_FLIGHT_ID" --no-confirm \- || echo "no pending flight submission to clear"- msstore publish "$bundle" -f "$MS_STORE_CANARY_FLIGHT_ID" -id "$MS_STORE_PRODUCT_ID"- else- echo "stable tag → production submission"- msstore submission delete "$MS_STORE_PRODUCT_ID" --no-confirm \- || echo "no pending submission to clear"- msstore publish "$bundle" -id "$MS_STORE_PRODUCT_ID"- fi+ msstore submission delete "$MS_STORE_PRODUCT_ID" --no-confirm \+ || echo "no pending submission to clear"+ msstore publish "$bundle" -id "$MS_STORE_PRODUCT_ID"# ── macOS updater channel (REAL) ───────────────────────────────────────────# Merges the per-arch feed ymls (arm64-stable-mac.yml / x64-stable-mac.ymldiff --git a/apps/desktop/electron-builder.config.cjs b/apps/desktop/electron-builder.config.cjsindex 55a7e65f573..8dc8b7dbde4 100644--- a/apps/desktop/electron-builder.config.cjs+++ b/apps/desktop/electron-builder.config.cjs@@ -22,6 +22,8 @@ const {displayName,appId,appNamePascal,+ artifactNamePascal,+ windowsExecutableName,channel,msixAppIdWithOrg} = require('./product-identity.cjs')@@ -78,7 +80,7 @@ module.exports = {// A store build is archived, never served to a feed — prefix its artifact// so it can't collide with the out-of-store MSIX of the same tag/arch, and// the release pipeline can keep the two apart.- artifactName: `${store ? 'Store-' : ''}${appNamePascal}-\${version}-\${os}-\${arch}.\${ext}`,+ artifactName: `${store ? 'Store-' : ''}${artifactNamePascal}-\${version}-\${os}-\${arch}.\${ext}`,icon: 'assets/icon',// The electron-updater feed. CI builds set CLOUDFLARE_R2_PUBLIC_URL (the R2// public bucket / custom domain) and publish there — the feed yml, blockmaps@@ -87,7 +89,7 @@ module.exports = {// var (local, or a fork without the R2 vars) keep the github provider, which// is exactly today's behavior. The store build has no feed at all (the Store// owns its distribution and updates).- publish: store+ publish: !channel? null: [process.env.CLOUDFLARE_R2_PUBLIC_URL@@ -96,6 +98,9 @@ module.exports = {],extraMetadata: {name: appNamePascal,+ // Electron bootstrap reads package.productName before main.ts. Keep the+ // shipped stable default, but isolate nonstable userData from first access.+ ...(appNamePascal !== artifactNamePascal ? { productName: displayName } : {}),desktopName: appId},directories: {@@ -126,7 +131,7 @@ module.exports = {// The afterSign hook owns notarization, including keychain-profile builds.notarize: false,// The packaged client reads this generated app-update.yml by default.- publish: publicUrl && !store+ publish: publicUrl && channel? [{ provider: 'generic', url: `${publicUrl}/${macFeed.directory}/`, channel: macFeed.channel }]: null,category: 'public.app-category.developer-tools',@@ -186,6 +191,7 @@ module.exports = {]},win: {+ executableName: windowsExecutableName,legalTrademarks: displayName,target: ['msix'],...windowsSigning()@@ -220,7 +226,8 @@ module.exports = {// build time (see the comment on the hook) — never at config require// time, so typecheck/test imports don't touch the filesystem.customExtensionsPath: 'build/msix-extensions.xml',- customManifestPath: store ? 'build/store-msix-manifest.xml' : 'assets/msix-manifest.xml',+ customManifestPath: store ? 'build/store-msix-manifest.xml'+ : appNamePascal !== artifactNamePascal ? 'build/msix-manifest.xml' : 'assets/msix-manifest.xml',// Hermes state is deliberately shared with unpackaged CLI/gateway// processes. Pair the manifest's disabled virtualization properties with// the restricted capability that permits unvirtualized AppData/HKCU writes.diff --git a/apps/desktop/electron/cli-provision.test.ts b/apps/desktop/electron/cli-provision.test.tsindex 2c902e6aa25..c1eada80c37 100644--- a/apps/desktop/electron/cli-provision.test.ts+++ b/apps/desktop/electron/cli-provision.test.ts@@ -68,6 +68,41 @@ test('repairs owned dangling CLI links without changing foreign or live entries'}})+test('qualified CLI paths expose their filenames, not shared canonical command keys', context => {+ const { root, binDir, source } = fixture()++ try {+ const plain = path.join(binDir, 'hermes')+ fs.writeFileSync(plain, 'stable command')++ try {+ fs.symlinkSync(source, path.join(binDir, 'probe'))+ fs.unlinkSync(path.join(binDir, 'probe'))+ } catch (error) {+ if (process.platform === 'win32' && (error as NodeJS.ErrnoException).code === 'EPERM') {+ context.skip('Windows symlinks require Developer Mode or elevation')+ }++ throw error+ }++ for (const name of ['hermes-canary', 'hermes-abcdef1', 'hermes-1234567']) {+ const cli = path.join(path.dirname(source), name)+ const acp = `${cli}-acp`+ fs.writeFileSync(cli, name)+ fs.writeFileSync(acp, `${name}-acp`)+ provisionCliLinks({ hermes: cli, 'hermes-acp': acp }, binDir, () => {})+ assert.equal(fs.readlinkSync(path.join(binDir, name)), cli)+ assert.equal(fs.readlinkSync(path.join(binDir, `${name}-acp`)), acp)+ }++ assert.equal(fs.readFileSync(plain, 'utf8'), 'stable command')+ assert.equal(fs.existsSync(path.join(binDir, 'hermes-acp')), false)+ } finally {+ fs.rmSync(root, { recursive: true, force: true })+ }+})+test('a failed link swap preserves its source and target, then provisions later commands', context => {const { root, binDir, source } = fixture()const target = path.join(binDir, 'hermes')diff --git a/apps/desktop/electron/cli-provision.ts b/apps/desktop/electron/cli-provision.tsindex 5308641dab1..a47fd7eb31b 100644--- a/apps/desktop/electron/cli-provision.ts+++ b/apps/desktop/electron/cli-provision.ts@@ -20,7 +20,9 @@ export function provisionCliLinks(let linked = 0- for (const [name, source] of Object.entries(commands)) {+ for (const source of Object.values(commands)) {+ // The map keys are backend entrypoint identities, not public shell names.+ const name = path.basename(source)const target = path.join(binDir, name)try {diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.tsindex eeeb01e97be..225e233e1b3 100644--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@ -35,6 +35,7 @@ import { classifyActiveRuntime } from './active-runtime-state'import { destroyKeepaliveAgents, downloadAgentFor, jsonAgentFor, withRetry } from './api-transport'import { appIconCandidates, resolveAppIcon } from './app-icon'import { stageAppInstallerFile } from './app-installer-file'+import { appVersionInfo, type AppVersionInfo, assertSourceUpdateChannel, packagedReleaseChannel } from './app-version'import { runAppInstallerChecker } from './appinstaller-checker'import { stopBackendChild as stopBackendChildImpl, stopBackendTreesForUpdate, waitForBackendExit as waitForBackendExitImpl } from './backend-child'import {@@ -187,7 +188,7 @@ import {tuiResumeArgs} from './external-terminal'import { type FaviconIo, resolveFavicon } from './favicon'-import { isCanaryTag, resolveFeatureFlags } from './feature-flags'+import { resolveFeatureFlags } from './feature-flags'import {installFindShortcut,installFoundInPageForwarder,@@ -321,7 +322,7 @@ import {runPrimaryBackendStartup} from './primary-backend-startup'import { rehomePrimaryConnection } from './primary-connection-rehome'-import { PRODUCT_IDENTITY } from './product-identity'+import { applyDesktopIdentity, PRODUCT_IDENTITY } from './product-identity'import {assertLocalProfileCanStart,decideProfileDeleteAction,@@ -479,6 +480,7 @@ import { isPackagedInstallPath as isPackagedInstallPathUnderRoots } from './workimport { readWslWindowsClipboardImage } from './wsl-clipboard-image'import { resolvePickerDefaultPath, setActiveGatewayProfile, setWslBridgeProfileState } from './wsl-path-bridge'+const IDENTITY_APP_NAME: string | null = applyDesktopIdentity(app)const USER_DATA_OVERRIDE: string | undefined = process.env.HERMES_DESKTOP_USER_DATA_DIRif (USER_DATA_OVERRIDE || process.env.HERMES_DATA_DIR_SUFFIX) {@@ -821,7 +823,7 @@ const BOOT_FAKE_STEP_MS = (() => {return Math.max(120, raw)})()-const APP_NAME = process.env.HERMES_DESKTOP_APP_NAME || 'Hermes'+const APP_NAME: string = IDENTITY_APP_NAME || process.env.HERMES_DESKTOP_APP_NAME || 'Hermes'const HUD_WINDOW_TITLE = `${APP_NAME} HUD`const TITLEBAR_HEIGHT = 34const MACOS_TRAFFIC_LIGHTS_HEIGHT = 14@@ -1234,7 +1236,7 @@ app.setName(APP_NAME)// need this, so gate it on Windows. (Fixes: desktop approval/turn notifications// never firing on Windows.)if (IS_WINDOWS) {- app.setAppUserModelId('com.nousresearch.hermes')+ app.setAppUserModelId(IDENTITY_APP_NAME ? PRODUCT_IDENTITY.appId : 'com.nousresearch.hermes')}// The gateway version is unknown until the backend connects.@@ -3069,7 +3071,8 @@ let packagedUpdateStrategy: UpdaterStrategy | undefinedfunction resolvePackagedUpdateStrategy(): UpdaterStrategy | null {const mechanism = resolveUpdaterMechanism({platform: process.platform,- updateMechanism: INSTALL_STAMP?.updateMechanism+ updateMechanism: INSTALL_STAMP?.updateMechanism,+ source: INSTALL_STAMP?.source})if (mechanism === 'windows-handoff' || mechanism === 'posix-handoff') { return null }@@ -3171,7 +3174,7 @@ function resolvePackagedUpdateStrategy(): UpdaterStrategy | null {return packagedUpdateStrategy}- return new ExternalStrategy()+ return new ExternalStrategy(INSTALL_STAMP)}/**@@ -3254,7 +3257,7 @@ function readUpdatesFeedBaseFromConfig(): string {/** The updater channel from the baked install stamp ('canary' vs 'stable'). */function resolveUpdaterChannelFromStamp(): 'stable' | 'canary' {- return isCanaryTag(INSTALL_STAMP?.tag) ? 'canary' : 'stable'+ return packagedReleaseChannel(INSTALL_STAMP) ?? 'stable'}/** True when this artifact is the light (remote-only) variant. */@@ -17169,8 +17172,9 @@ ipcMain.handle('hermes:updates:apply', async (_event, payload) =>ipcMain.handle('hermes:updates:branch:get', async () => readDesktopUpdateConfig())-ipcMain.handle('hermes:updates:branch:set', async (_event, name) => {- const branch = typeof name === 'string' && name.trim() ? name.trim() : DEFAULT_UPDATE_BRANCH+ipcMain.handle('hermes:updates:branch:set', async (_event: Electron.IpcMainInvokeEvent, name: unknown): Promise<{ branch: string }> => {+ assertSourceUpdateChannel(INSTALL_STAMP)+ const branch: string = typeof name === 'string' && name.trim() ? name.trim() : DEFAULT_UPDATE_BRANCHwriteDesktopUpdateConfig({ branch })return { branch }@@ -17197,13 +17201,15 @@ async function detectRendererSkew() {// just before showing it, so an in-place `hermes update` is reflected without// an app restart. macOS only — `showAboutPanel()` is a no-op elsewhere, and the// other platforms don't use this menu item.-function showAboutPanelFresh() {+function showAboutPanelFresh(): void {void Promise.all([detectRendererSkew(), resolveHermesVersion()]).then(([skew, version]) => {+ const info: AppVersionInfo = appVersionInfo(INSTALL_STAMP, version, app.getVersion())+ const display: string = info.channel ? `${info.appVersion} (${info.channel})` : info.appVersionapp.setAboutPanelOptions({applicationName: APP_NAME,applicationVersion: skew.outOfSync- ? `${version} — app build out of date, update the desktop app`- : version,+ ? `${display} — app build out of date, update the desktop app`+ : display,copyright: 'Copyright © 2026 Nous Research'})app.showAboutPanel()@@ -17214,7 +17220,7 @@ ipcMain.handle('hermes:version', async (_event, scope?: { connectionId?: string;const [skew, version] = await Promise.all([detectRendererSkew(), resolveHermesVersion(scope)])return {- ...resolveHermesVersionInfo(version),+ ...appVersionInfo(INSTALL_STAMP, version, app.getVersion()),electronVersion: process.versions.electron,nodeVersion: process.versions.node,platform: process.platform,@@ -17278,30 +17284,6 @@ function readLatestSyncReceipt(): Record<string, unknown> | null {ipcMain.handle('hermes:sync-status', () => readLatestSyncReceipt())-/** Runtime version comes from the gateway; build provenance stays with the app stamp. */-function resolveHermesVersionInfo(version: string) {- // The baked build-time constant is typed more narrowly than a full stamp- // loaded from disk; cast to the full shape so every provenance field is- // readable on either source.- const stamp = INSTALL_STAMP as InstallStamp | null-- if (stamp) {- return {- appVersion: version,- baseVersion: stamp.baseVersion ?? undefined,- distance: stamp.distance ?? undefined,- commit: stamp.commit,- branch: stamp.branch,- source: stamp.source ?? undefined,- distribution: stamp.distribution ?? undefined,- updateMechanism: stamp.updateMechanism,- dirty: stamp.dirty- }- }-- return { appVersion: version, baseVersion: app.getVersion() }-}-// Python's Path.resolve() equivalent for install-id derivation: realpath when// the path exists, plain resolve otherwise. Must stay byte-compatible with// boot_bootstrap._install_key or the CLI and the app would compute twodiff --git a/apps/desktop/electron/product-identity.test.ts b/apps/desktop/electron/product-identity.test.tsindex f9cbed7c88a..885ace2ce09 100644--- a/apps/desktop/electron/product-identity.test.ts+++ b/apps/desktop/electron/product-identity.test.ts@@ -4,8 +4,14 @@// the two variants disagree on every OS-visible marker (side-by-side// installs must not collide).import assert from 'node:assert/strict'+import { execFileSync } from 'node:child_process'+import fs from 'node:fs'import { createRequire } from 'node:module'+import os from 'node:os'+import path from 'node:path'+import { fileURLToPath } from 'node:url'+import { build } from 'esbuild'import { afterEach, beforeEach, test, vi } from 'vitest'const require = createRequire(import.meta.url)@@ -18,6 +24,7 @@ afterEach(() => {delete process.env.HERMES_DESKTOP_VARIANTdelete process.env.HERMES_PAYLOAD_TAGdelete process.env.HERMES_BUILD_COMMIT+ delete process.env.HERMES_PAYLOAD_VERSIONvi.resetModules()})@@ -34,6 +41,57 @@ async function identityForVariant(variant: string | undefined) {return (await import('./product-identity')).PRODUCT_IDENTITY}+test('baked runtime identity never evaluates ambient build selectors', async () => {+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'baked-identity-'))++ try {+ const identity = await identityForVariant('bundled')++ const result = await build({+ stdin: { contents: "import {PRODUCT_IDENTITY} from './product-identity'; console.log(JSON.stringify(PRODUCT_IDENTITY))", resolveDir: import.meta.dirname },+ bundle: true, platform: 'node', format: 'esm', write: false,+ define: { __HERMES_PRODUCT_IDENTITY__: JSON.stringify(identity) }+ })++ const file = path.join(dir, 'identity.mjs')+ fs.writeFileSync(file, result.outputFiles[0].text)++ const actual = JSON.parse(execFileSync(process.execPath, [file], {+ encoding: 'utf8', env: { ...process.env, HERMES_DESKTOP_VARIANT: 'store', HERMES_BUILD_COMMIT: 'a'.repeat(40) }+ }))++ assert.deepEqual(actual, identity)+ } finally {+ fs.rmSync(dir, { recursive: true, force: true })+ }+})++test('nonstable runtime pins userData before the app name can change', async () => {+ const stable = await identityForVariant('bundled')+ process.env.HERMES_PAYLOAD_TAG = 'v0.28.0-canary.20260818'+ const canary = await identityForVariant('bundled')+ const runtime = await import('./product-identity')+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'identity-userdata-'))+ const paths: Record<string, string> = { appData: root, userData: path.join(root, 'Hermes') }+ let name = 'Hermes'++ const app = {+ getPath: (key: string) => paths[key],+ setPath: (key: string, value: string) => { assert.ok(fs.statSync(value).isDirectory()); paths[key] = value },+ setName: (value: string) => { name = value }+ }++ try {+ assert.equal(runtime.applyDesktopIdentity(app, stable), null)+ assert.equal(paths.userData, path.join(root, 'Hermes'))+ assert.equal(runtime.applyDesktopIdentity(app, canary), canary.displayName)+ assert.equal(paths.userData, path.join(paths.appData, canary.appNamePascal))+ assert.equal(name, canary.displayName)+ } finally {+ fs.rmSync(root, { recursive: true, force: true })+ }+})+test('light identity is fully distinct from the full identity', async () => {const full = await identityForVariant(undefined)const light = await identityForVariant('light')@@ -59,20 +117,49 @@ test('a canary payload tag moves BOTH variants onto their canary feed channel',assert.equal(light.channel, 'light-canary')})-test('a canary tag renames the DISPLAY name only, keeping machine identity intact', async () => {- const stable = await identityForVariant(undefined)- process.env.HERMES_PAYLOAD_TAG = 'v0.28.0-canary.20260818'- const canaryIdentity = await identityForVariant(undefined)-- assert.equal(canaryIdentity.displayName, 'Hermes Canary')- // Machine identity is shared with stable so the canary MSIX still updates- // in place over stable and userData/single-instance stay shared.- assert.equal(canaryIdentity.appId, stable.appId)- assert.equal(canaryIdentity.appNamePascal, stable.appNamePascal)- assert.equal(canaryIdentity.msixAppIdWithOrg, stable.msixAppIdWithOrg)+test('canary installs alongside stable with its own GUI and CLI names', async () => {+ for (const variant of [undefined, 'bundled', 'light']) {+ delete process.env.HERMES_PAYLOAD_TAG+ const stable = await identityForVariant(variant)+ process.env.HERMES_PAYLOAD_TAG = 'v0.28.0-canary.20260818'+ const canary = await identityForVariant(variant)++ for (const prop of ['displayName', 'appId', 'appNamePascal', 'msixAppIdWithOrg', 'windowsExecutableName', 'cliName'] as const) {+ assert.notEqual(canary[prop], stable[prop], `${prop} must isolate canary`)+ }++ assert.equal(canary.artifactNamePascal, stable.artifactNamePascal)+ assert.equal(canary.cliName, variant === 'light' ? 'hermes-light-canary' : 'hermes-canary')+ assert.equal(canary.windowsExecutableName, canary.cliName)+ }})-test('a commit build names the SHA in the display name, machine identity intact', async () => {+test('each commit owns a deterministic identity and has no release channel', async () => {+ const firstSha = 'abcdef1234567890abcdef1234567890abcdef12'+ const secondSha = '1234567890abcdef1234567890abcdef12345678'++ for (const variant of [undefined, 'bundled', 'light']) {+ delete process.env.HERMES_BUILD_COMMIT+ const stable = await identityForVariant(variant)+ process.env.HERMES_BUILD_COMMIT = firstSha+ const first = await identityForVariant(variant)+ assert.deepEqual(first, await identityForVariant(variant))+ process.env.HERMES_BUILD_COMMIT = secondSha+ const second = await identityForVariant(variant)++ for (const prop of ['displayName', 'appId', 'appNamePascal', 'msixAppIdWithOrg', 'windowsExecutableName', 'cliName'] as const) {+ assert.notEqual(first[prop], stable[prop], `${prop} must isolate commit from stable`)+ assert.notEqual(first[prop], second[prop], `${prop} must isolate two commits`)+ assert.ok(first[prop].includes(firstSha.slice(0, 7)))+ }++ assert.equal(first.channel, null)+ assert.equal(first.cliName, `${variant === 'light' ? 'hermes-light' : 'hermes'}-${firstSha.slice(0, 7)}`)+ assert.equal(first.artifactNamePascal, stable.artifactNamePascal)+ }+})++test('a commit build names the SHA in the display name', async () => {process.env.HERMES_BUILD_COMMIT = 'abcdef1234567890abcdef1234567890abcdef12'const full = await identityForVariant(undefined)assert.equal(full.displayName, 'Hermes abcdef1')@@ -91,6 +178,51 @@ test('a commit build names the SHA in the display name, machine identity intact'assert.equal(malformed.displayName, 'Hermes')})+test('packaging isolates boot metadata and executable names without renaming release artifacts', async () => {+ const pkg = require('../package.json')++ const load = () => {+ delete require.cache[require.resolve('../electron-builder.config.cjs')]++ return require('../electron-builder.config.cjs')+ }++ const stableIdentity = await identityForVariant('bundled')+ const stable = load()+ assert.equal(stable.extraMetadata.productName || pkg.productName, pkg.productName)++ for (const build of ['canary', 'abcdef1234567890abcdef1234567890abcdef12']) {+ process.env.HERMES_PAYLOAD_TAG = build === 'canary' ? 'v0.28.0-canary.20260818' : ''+ process.env.HERMES_BUILD_COMMIT = build === 'canary' ? '' : build+ const identity = await identityForVariant('bundled')+ const config = load()+ // Electron bootstrap gives productName precedence over name. appId alone+ // changes neither its early userData lookup nor its single-instance lock.+ assert.equal(config.extraMetadata.productName, identity.displayName)+ assert.equal(config.extraMetadata.name, identity.appNamePascal)+ assert.notEqual(config.extraMetadata.name, stableIdentity.appNamePascal)+ assert.equal(config.win.executableName, identity.windowsExecutableName)+ const { AppInfo } = require('../../../node_modules/app-builder-lib/dist/appInfo.js')+ const appInfo = new AppInfo({ config, metadata: { ...pkg, ...config.extraMetadata } }, null, config.win)+ // Windows packaging, afterPack, rollback preservation and final signing+ // all consume this resolved name, not the display name.+ assert.equal(appInfo.productFilename, identity.windowsExecutableName)+ assert.equal(config.mac.extendInfo.CFBundleExecutable, config.executableName)+ assert.equal(config.artifactName, stable.artifactName)+ const { appIdentity } = require('../../../scripts/msix-shared.mjs')+ process.env.HERMES_PAYLOAD_VERSION = '0.28.0'+ const artifact = appIdentity(fileURLToPath(new URL('../', import.meta.url)))+ assert.equal(artifact.name, identity.artifactNamePascal)+ assert.equal(artifact.identity.msixAppIdWithOrg, config.msix.identityName)+ assert.deepEqual(config.protocols[0].schemes, ['hermes'])++ if (build !== 'canary') {+ assert.equal(config.publish, null)+ assert.equal(config.mac.publish, null)+ }+ }+})+test('stable tags and tagless dev builds publish to the stable channels', async () => {process.env.HERMES_PAYLOAD_TAG = 'v0.28.0'assert.equal((await identityForVariant(undefined)).channel, 'latest')@@ -126,6 +258,14 @@ test('store inherits the bundled app identity (shared userData) but swaps the MSassert.equal(store.channel, null)})+test('nonstable builds cannot claim the official Store package', async () => {+ process.env.HERMES_PAYLOAD_TAG = 'v0.28.0-canary.20260818'+ await assert.rejects(identityForVariant('store'), /Store.*stable/)+ delete process.env.HERMES_PAYLOAD_TAG+ process.env.HERMES_BUILD_COMMIT = 'abcdef1234567890abcdef1234567890abcdef12'+ await assert.rejects(identityForVariant('store'), /Store.*stable/)+})+test('store carries the Partner Center MSIX identity and no other variant does', async () => {const store = await identityForVariant('store')assert.deepEqual(store.storeMsix, {diff --git a/apps/desktop/electron/product-identity.ts b/apps/desktop/electron/product-identity.tsindex a722c6e88d5..fe8a08281a9 100644--- a/apps/desktop/electron/product-identity.ts+++ b/apps/desktop/electron/product-identity.ts@@ -5,7 +5,11 @@// test runs import the .cjs itself so the derivation exists in exactly// one place.-import devIdentity from '../product-identity.cjs'+import { mkdirSync } from 'node:fs'+import { createRequire } from 'node:module'+import path from 'node:path'++import type devIdentity from '../product-identity.cjs'/** Mirrors product-identity.cjs (see product-identity.d.cts). */export type ProductIdentity = typeof devIdentity@@ -15,5 +19,22 @@ declare const __HERMES_PRODUCT_IDENTITY__: ProductIdentity/** The baked identity of this artifact (dev bundles derive it live). */export const PRODUCT_IDENTITY: Readonly<ProductIdentity> =typeof __HERMES_PRODUCT_IDENTITY__ === 'undefined'- ? Object.freeze(devIdentity)+ ? Object.freeze(createRequire(import.meta.url)('../product-identity.cjs') as ProductIdentity): Object.freeze(__HERMES_PRODUCT_IDENTITY__)++/** Pin before the first userData lookup and single-instance lock. Electron's+ * later display-name changes must not redirect an installed build's state.+ * Stable keeps its historical userData and runtime naming behavior.+ */+export function applyDesktopIdentity(+ app: { getPath(name: 'appData'): string; setPath(name: 'userData', value: string): void; setName(name: string): void },+ identity: Readonly<ProductIdentity> = PRODUCT_IDENTITY+): string | null {+ if (identity.appNamePascal === identity.artifactNamePascal) {return null}+ const userData: string = path.join(app.getPath('appData'), identity.appNamePascal)+ mkdirSync(userData, { recursive: true })+ app.setPath('userData', userData)+ app.setName(identity.displayName)++ return identity.displayName+}diff --git a/apps/desktop/product-identity.cjs b/apps/desktop/product-identity.cjsindex 1fb070733dd..69841c90929 100644--- a/apps/desktop/product-identity.cjs+++ b/apps/desktop/product-identity.cjs@@ -42,11 +42,8 @@ const name = variants[store ? 'bundled' : (variant || '')]// never overwrite the stable feed file, and vice versa.const canary = /-canary\.20\d{6}(?:\d{6})?$/.test(process.env.HERMES_PAYLOAD_TAG || '')-// Display-name qualifiers, display-only by design: appId/appNamePascal/-// msixAppIdWithOrg stay fixed so a canary MSIX still updates in place-// over stable and userData/single-instance sharing is unaffected. A-// commit build names the exact SHA it was built from (Hermes Agent abc1234);-// a canary tags itself so side-by-side installs are readable at a glance.+// Nonstable installs own their package family and local desktop state. The+// seven-character commit suffix also names the CLI and fits MSIX's name cap.const buildCommitEnv = process.env.HERMES_BUILD_COMMIT || ''const buildCommit = /^[a-f0-9]{40}$/.test(buildCommitEnv) ? buildCommitEnv.slice(0, 7) : nullconst displayName = buildCommit@@ -55,6 +52,13 @@ const displayName = buildCommit? `${name.display} Canary`: name.display+const kebabSuffix = buildCommit ? `-${buildCommit}` : canary ? '-canary' : ''+const pascalSuffix = buildCommit ? `Commit${buildCommit}` : canary ? 'Canary' : ''+const cliName = `${light ? 'hermes-light' : 'hermes'}${kebabSuffix}`+if (store && (canary || buildCommit)) {+ throw new Error('Store packaging is only eligible for stable releases')+}+/** @typedef {import("./product-identity.d.cts")} ProductIdentity *//** @type {ProductIdentity} */@@ -62,12 +66,14 @@ const identity = {store,light,displayName,- appId: `com.nousresearch.${name.kebab}`,- // The store build never publishes to a release feed (the Store owns its- // updates); null means "no feed" for its publish config.- channel: store ? null : light ? (canary ? 'light-canary' : 'light') : (canary ? 'canary' : 'latest'),- appNamePascal: name.pascal,- msixAppIdWithOrg: `NousResearch.${name.pascal}`,+ appId: `com.nousresearch.${name.kebab}${kebabSuffix}`,+ // Store and commit builds do not publish a release feed.+ channel: store || buildCommit ? null : light ? (canary ? 'light-canary' : 'light') : (canary ? 'canary' : 'latest'),+ appNamePascal: `${name.pascal}${pascalSuffix}`,+ artifactNamePascal: name.pascal,+ windowsExecutableName: kebabSuffix ? cliName : displayName,+ cliName,+ msixAppIdWithOrg: `NousResearch.${name.pascal}${pascalSuffix}`,...(store? {storeMsix: {diff --git a/apps/desktop/product-identity.d.cts b/apps/desktop/product-identity.d.ctsindex c57bb3269ea..2051375993f 100644--- a/apps/desktop/product-identity.d.cts+++ b/apps/desktop/product-identity.d.cts@@ -9,12 +9,18 @@ interface ProductIdentity {appId: string/** app name in pascal case. e.g. "HermesLight" */appNamePascal: string+ /** Artifact prefix stays compatible with release archive consumers. */+ artifactNamePascal: string+ /** Windows GUI executable stem; not the payload CLI launcher path. */+ windowsExecutableName: string+ /** Exposed payload CLI command. */+ cliName: string/** OS-level app identity w/ org prefix. e.g. "NousResearch.HermesLight" */msixAppIdWithOrg: string/** electron-updater feed channel this build publishes to. Stable tags:* "latest" | "light"; canary tags: "canary" | "light-canary". Null- * for a store build (the Store owns its updates; no release feed). */- channel: string | null+ * for Store and commit builds (no release feed). */+ readonly channel: string | null/** Store-submission MSIX packaging identity. Present only when `store`. */storeMsix?: {identityName: stringdiff --git a/apps/desktop/scripts/before-build.mjs b/apps/desktop/scripts/before-build.mjsindex 01b1f6cdad0..21b6691a2a6 100644--- a/apps/desktop/scripts/before-build.mjs+++ b/apps/desktop/scripts/before-build.mjs@@ -23,7 +23,8 @@ const {light,store,displayName,- appNamePascal+ appNamePascal,+ artifactNamePascal} = require('../product-identity.cjs')export default async function beforeBuild() {@@ -72,7 +73,15 @@ function writeMsixExtensions() {const launchers = ['bundled', 'store'].includes(process.env.HERMES_DESKTOP_VARIANT || '')? JSON.parse(fs.readFileSync(manifest, 'utf8')).launchers : []if (!Array.isArray(launchers)) throw new Error('Bundled payload has no declared launchers')- const aliases = appExecutionAliasExtensions(launchers)+ const nonstable = appNamePascal !== artifactNamePascal+ const aliases = nonstable ? '' : appExecutionAliasExtensions(launchers)+ if (nonstable) {+ const template = fs.readFileSync(path.join(desktop, 'assets/msix-manifest.xml'), 'utf8')+ const applications = appExecutionAliasApplications(launchers, { appNamePascal, displayName })+ fs.mkdirSync(path.join(desktop, 'build'), { recursive: true })+ fs.writeFileSync(path.join(desktop, 'build/msix-manifest.xml'),+ template.replace('</Applications>', `${applications}\n </Applications>`))+ }// The uap3:AppExtension fragment that registers the app as a Windows// Copilot hardware key provider. The press activates hermes://copilot-key/start.//@@ -88,7 +97,7 @@ function writeMsixExtensions() {Category="windows.appExtension"><uap3:AppExtensionName="com.microsoft.windows.copilotkeyprovider"- Id="${appNamePascal}CopilotKeyProvider"+ Id="${artifactNamePascal}CopilotKeyProvider"DisplayName="${displayName}"Description="Launch ${displayName} with the Copilot key"PublicFolder="Public">@@ -110,14 +119,28 @@ ${aliases}`* Exported pure for tests.* @param {string[]} launchers exe stems under bin/*/+export function appExecutionAliasApplications(launchers, identity) {+ // Each distlib launcher has a different embedded Python entrypoint. A single+ // multi-alias extension executes only its first launcher (including for ACP).+ // Give each CLI its own hidden application, with one extension per app.+ return launchers.map((name, index) => {+ const executable = ['app', 'resources', 'agent-payload', 'bin', `${name}.exe`].join(String.fromCharCode(92))+ return `<Application Id="${identity.appNamePascal}Cli${index}" Executable="${executable}" EntryPoint="Windows.FullTrustApplication">+ <uap:VisualElements DisplayName="${identity.displayName}" Description="${identity.displayName} CLI"+ Square150x150Logo="assets\\Square150x150Logo.png" Square44x44Logo="assets\\Square44x44Logo.png"+ BackgroundColor="transparent" AppListEntry="none" />+ <Extensions>${appExecutionAliasExtensions([name])}</Extensions>+ </Application>`+ }).join('\n')+}+export function appExecutionAliasExtensions(launchers) {if (launchers.length === 0) return ''const bs = String.fromCharCode(92)const executable = (name) => ['app', 'resources', 'agent-payload', 'bin', `${name}.exe`].join(bs)- // ONE windows.appExecutionAlias extension per package — makeappx rejects a- // second one with the opaque 0x80080204 (A/B-verified against the 26100- // kit). Every launcher alias rides in the same extension's AppExecutionAlias;- // the Executable attribute names the exe that serves the aliases.+ // One windows.appExecutionAlias extension per application. The Executable+ // attribute serves every alias in that extension. Separate distlib entrypoints+ // use separate hidden applications (validated with Windows SDK 26100).return `<uap5:Extensionxmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"Category="windows.appExecutionAlias"diff --git a/apps/desktop/scripts/commit-bundles.windows.test.mjs b/apps/desktop/scripts/commit-bundles.windows.test.mjsindex cd4a94e8745..d4847e9453b 100644--- a/apps/desktop/scripts/commit-bundles.windows.test.mjs+++ b/apps/desktop/scripts/commit-bundles.windows.test.mjs@@ -74,74 +74,64 @@ function makePackage(makeappx, root, release, metadata, variant, arch, env) {return file}-test.runIf(process.platform === 'win32')('commit assembly preserves per-arch packages and produces two isolated SDK bundles', { timeout: 180_000 }, async () => {+test.runIf(process.platform === 'win32')('commit assembly preserves per-arch packages and rejects Store bundles', { timeout: 180_000 }, async () => {const tools = await ensureWindowsBundleTools()const { root, env, commit, release } = fixture(path.dirname(path.dirname(tools.makeappx)))try {- const metadata = Object.fromEntries(['bundled', 'store'].map(variant => [variant, identity(root, env, variant)]))+ const info = identity(root, env, 'bundled')+ assert.throws(() => identity(root, env, 'store'), /Store.*stable/)const inputs = {}- for (const variant of ['bundled', 'store']) {- for (const arch of ['x64', 'arm64']) {- const file = makePackage(tools.makeappx, root, release, metadata[variant], variant, arch, env)- inputs[file] = sha256(file)- }+ for (const arch of ['x64', 'arm64']) {+ const file = makePackage(tools.makeappx, root, release, info, 'bundled', arch, env)+ inputs[file] = sha256(file)}- const scripts = { bundled: 'stage-msixbundle.mjs', store: 'bundle-store-msixbundle.mjs' }- for (const variant of ['bundled', 'store']) {- const args = ['--commit', commit, '--version', '0.21.1']- if (variant === 'bundled') args.push('--variant', variant, '--no-upload')- const outputFile = path.join(root, 'store-output')- if (variant === 'store') args.push('--output-file', outputFile)- const result = spawnSync(process.execPath, [path.join(root, 'scripts', scripts[variant]), ...args], { cwd: root, env, encoding: 'utf8', timeout: 60_000 })- assert.equal(result.status, 0, result.stdout + result.stderr)- const info = metadata[variant]- const bundle = path.join(release, `${variant === 'store' ? 'Store-' : ''}${info.name}-${info.version}-win.msixbundle`)- assert.ok(fs.statSync(bundle).size > 0)- if (variant === 'store') assert.equal(fs.readFileSync(outputFile, 'utf8').trim(), bundle)- const expanded = path.join(root, `expanded-${variant}`)- run(tools.makeappx, ['unbundle', '/o', '/p', bundle, '/d', expanded], root, env)- const xml = fs.readFileSync(path.join(expanded, 'AppxMetadata/AppxBundleManifest.xml'), 'utf8')- const identityTag = /<Identity\b[^>]*>/.exec(xml)[0]- assert.ok(identityTag.includes(`Version="${info.version}"`), xml)- const bundledNames = [...xml.matchAll(/FileName="([^"]+\.msix)"/g)].map(match => match[1]).sort()- const expected = Object.keys(inputs).filter(file => path.basename(file).startsWith('Store-') === (variant === 'store')).map(file => path.basename(file)).sort()- assert.deepEqual(bundledNames, expected)- for (const name of expected) assert.equal(sha256(path.join(expanded, name)), inputs[path.join(release, name)])- const digest = sha256(bundle)- const modified = fs.statSync(bundle).mtimeMs- const invalid = [- [...args, '--candidate'], [...args, '--tag', 'v0.21.1'], [...args, '--unknown'],- ['--commit', commit.slice(0, 8), '--version', '0.21.1', ...(variant === 'bundled' ? ['--no-upload'] : [])],- ['--commit', commit, '--version', '1.65536.0', ...(variant === 'bundled' ? ['--no-upload'] : [])],- ]- if (variant === 'bundled') invalid.push(args.filter(value => value !== '--no-upload'))- for (const badArgs of invalid) {- const rejected = spawnSync(process.execPath, [path.join(root, 'scripts', scripts[variant]), ...badArgs], { cwd: root, env, encoding: 'utf8', timeout: 30_000 })- assert.notEqual(rejected.status, 0, `${scripts[variant]} accepted ${badArgs.join(' ')}\n${rejected.stdout}${rejected.stderr}`)- assert.equal(sha256(bundle), digest)- assert.equal(fs.statSync(bundle).mtimeMs, modified)- }- const missing = path.join(release, expected[0])- fs.renameSync(missing, `${missing}.held`)- try {- const refused = spawnSync(process.execPath, [path.join(root, 'scripts', scripts[variant]), ...args], { cwd: root, env, encoding: 'utf8', timeout: 30_000 })- assert.notEqual(refused.status, 0)- assert.match(refused.stdout + refused.stderr, /need both per-arch/)- assert.equal(sha256(bundle), digest)- assert.equal(fs.statSync(bundle).mtimeMs, modified)- } finally {- fs.renameSync(`${missing}.held`, missing)- }- if (variant === 'store') {- run('git', ['tag', 'v0.21.1'], root, env)- const tagEnv = { ...env, HERMES_BUILD_COMMIT: '', HERMES_PAYLOAD_VERSION: '', HERMES_PAYLOAD_TAG: 'v0.21.1' }- const tagged = spawnSync(process.execPath, [path.join(root, 'scripts', scripts.store), '--tag', 'v0.21.1', '--output-file', outputFile], { cwd: root, env: tagEnv, encoding: 'utf8', timeout: 60_000 })- assert.equal(tagged.status, 0, tagged.stdout + tagged.stderr)- assert.equal(fs.readFileSync(outputFile, 'utf8').trim(), bundle)- }+ const script = path.join(root, 'scripts/stage-msixbundle.mjs')+ const args = ['--commit', commit, '--version', '0.21.1', '--variant', 'bundled', '--no-upload']+ const result = spawnSync(process.execPath, [script, ...args], { cwd: root, env, encoding: 'utf8', timeout: 60_000 })+ assert.equal(result.status, 0, result.stdout + result.stderr)+ const bundle = path.join(release, `${info.name}-${info.version}-win.msixbundle`)+ assert.ok(fs.statSync(bundle).size > 0)+ const expanded = path.join(root, 'expanded')+ run(tools.makeappx, ['unbundle', '/o', '/p', bundle, '/d', expanded], root, env)+ const xml = fs.readFileSync(path.join(expanded, 'AppxMetadata/AppxBundleManifest.xml'), 'utf8')+ const identityTag = /<Identity\b[^>]*>/.exec(xml)[0]+ assert.ok(identityTag.includes(`Version="${info.version}"`), xml)+ const bundledNames = [...xml.matchAll(/FileName="([^"]+\.msix)"/g)].map(match => match[1]).sort()+ const expected = Object.keys(inputs).map(file => path.basename(file)).sort()+ assert.deepEqual(bundledNames, expected)+ for (const name of expected) assert.equal(sha256(path.join(expanded, name)), inputs[path.join(release, name)])+ const digest = sha256(bundle)+ const modified = fs.statSync(bundle).mtimeMs+ const invalid = [+ [...args, '--candidate'], [...args, '--tag', 'v0.21.1'], [...args, '--unknown'],+ ['--commit', commit.slice(0, 8), '--version', '0.21.1', '--no-upload'],+ ['--commit', commit, '--version', '1.65536.0', '--no-upload'],+ args.filter(value => value !== '--no-upload'),+ ]+ for (const badArgs of invalid) {+ const rejected = spawnSync(process.execPath, [script, ...badArgs], { cwd: root, env, encoding: 'utf8', timeout: 30_000 })+ assert.notEqual(rejected.status, 0, `accepted ${badArgs.join(' ')}\n${rejected.stdout}${rejected.stderr}`)+ assert.equal(sha256(bundle), digest)+ assert.equal(fs.statSync(bundle).mtimeMs, modified)+ }+ const before = fs.readdirSync(release).sort()+ const store = spawnSync(process.execPath, [path.join(root, 'scripts/bundle-store-msixbundle.mjs'), '--commit', commit], { cwd: root, env, encoding: 'utf8' })+ assert.notEqual(store.status, 0)+ assert.match(store.stderr, /Unknown option.*commit/)+ assert.deepEqual(fs.readdirSync(release).sort(), before)+ const missing = path.join(release, expected[0])+ fs.renameSync(missing, `${missing}.held`)+ try {+ const refused = spawnSync(process.execPath, [script, ...args], { cwd: root, env, encoding: 'utf8', timeout: 30_000 })+ assert.notEqual(refused.status, 0)+ assert.match(refused.stdout + refused.stderr, /need both per-arch/)+ assert.equal(sha256(bundle), digest)+ assert.equal(fs.statSync(bundle).mtimeMs, modified)+ } finally {+ fs.renameSync(`${missing}.held`, missing)}assert.equal(fs.readdirSync(release).some(name => name.endsWith('.appinstaller')), false)- for (const [file, digest] of Object.entries(inputs)) assert.equal(sha256(file), digest)+ for (const [file, inputDigest] of Object.entries(inputs)) assert.equal(sha256(file), inputDigest)} finally {fs.rmSync(root, { recursive: true, force: true })}diff --git a/apps/desktop/scripts/commit-stamp-identity.test.mjs b/apps/desktop/scripts/commit-stamp-identity.test.mjsindex e26f3a5d6cf..72d13ccfc8a 100644--- a/apps/desktop/scripts/commit-stamp-identity.test.mjs+++ b/apps/desktop/scripts/commit-stamp-identity.test.mjs@@ -16,6 +16,7 @@ test('desktop stamp uses the admitted checkout rather than the dispatch SHA', ()try {fs.mkdirSync(scripts, { recursive: true })for (const name of ['write-build-stamp.mjs', 'utils.mjs']) fs.copyFileSync(path.join(root, 'apps/desktop/scripts', name), path.join(scripts, name))+ fs.copyFileSync(path.join(root, 'apps/desktop/product-identity.cjs'), path.join(repo, 'apps/desktop/product-identity.cjs'))git('init', '-q', '-b', 'main')git('config', 'user.name', 'Fixture')git('config', 'user.email', '[email protected]')@@ -29,8 +30,10 @@ test('desktop stamp uses the admitted checkout rather than the dispatch SHA', ()const feature = git('rev-parse', 'HEAD')const runtime = { repoDir: 'app', toolsDir: 'tools', storePython: 'tools/python/bin/python3', sitePackages: 'venv/site-packages', commands: { hermes: 'bin/hermes' } }const build = path.join(repo, 'apps/desktop/build')- fs.mkdirSync(path.join(build, 'agent-payload'), { recursive: true })- fs.writeFileSync(path.join(build, 'agent-payload/manifest.json'), JSON.stringify({ runtime }))+ fs.mkdirSync(path.join(build, 'agent-payload/app'), { recursive: true })+ fs.mkdirSync(path.join(build, 'agent-payload/bin'), { recursive: true })+ fs.writeFileSync(path.join(build, 'agent-payload/bin/hermes'), 'launcher fixture')+ fs.writeFileSync(path.join(build, 'agent-payload/manifest.json'), JSON.stringify({ target: 'darwin-arm64', launchers: ['hermes'], runtime }))const out = path.join(build, 'install-stamp.json')const env = Object.fromEntries(Object.entries(process.env).filter(([key]) => !key.startsWith('GITHUB_') && !key.startsWith('HERMES_PAYLOAD_') && !key.startsWith('HERMES_BUILD_')))Object.assign(env, { GITHUB_SHA: main, GITHUB_REF_NAME: 'main', HERMES_BUILD_COMMIT: feature, HERMES_DESKTOP_VARIANT: 'bundled' })@@ -43,7 +46,8 @@ test('desktop stamp uses the admitted checkout rather than the dispatch SHA', ()assert.equal(stamp.source, 'commit-build')assert.equal(stamp.tag, null)assert.equal(stamp.updateMechanism, 'external')- assert.deepEqual(stamp.runtime, runtime)+ assert.deepEqual(stamp.runtime, { ...runtime, commands: { hermes: `bin/hermes-${feature.slice(0, 7)}` } })+ assert.deepEqual(JSON.parse(fs.readFileSync(path.join(build, 'agent-payload/app/install-stamp.json'), 'utf8')), stamp)const before = fs.readFileSync(out)git('checkout', '-q', 'main')assert.notEqual(run({}).status, 0)@@ -55,6 +59,7 @@ test('desktop stamp uses the admitted checkout rather than the dispatch SHA', ()}assert.equal(run({ HERMES_BUILD_COMMIT: '', HERMES_PAYLOAD_TAG: 'v1.2.3', GITHUB_SHA: feature }).status, 0)assert.equal(JSON.parse(fs.readFileSync(out, 'utf8')).tag, 'v1.2.3')+ assert.deepEqual(JSON.parse(fs.readFileSync(out, 'utf8')).runtime, runtime)} finally {fs.rmSync(temp, { recursive: true, force: true })}diff --git a/apps/desktop/scripts/gen-appinstaller.mjs b/apps/desktop/scripts/gen-appinstaller.mjsindex 18e6b911996..078d88fbc00 100644--- a/apps/desktop/scripts/gen-appinstaller.mjs+++ b/apps/desktop/scripts/gen-appinstaller.mjs@@ -47,8 +47,8 @@ if (isCli) {}const { identity, version, name } = appIdentity(desktop, process.env.HERMES_PAYLOAD_TAG)- if (identity.store) {- console.error('[gen-appinstaller] a store build has no App Installer feed (the Store owns distribution)')+ if (!identity.channel) {+ console.error('[gen-appinstaller] Store and commit builds have no App Installer feed')process.exit(1)}diff --git a/apps/desktop/scripts/gen-msix-manifest.mjs b/apps/desktop/scripts/gen-msix-manifest.mjsindex 1a5e5373261..a3cfbbe37a8 100644--- a/apps/desktop/scripts/gen-msix-manifest.mjs+++ b/apps/desktop/scripts/gen-msix-manifest.mjs@@ -45,11 +45,11 @@ const config = require(path.join(desktop, "electron-builder.config.cjs"))const pkg = require(path.join(desktop, "package.json"))const options = config.msix-// The payload CLI launcher (hermes.exe, the minted distlib launcher) is the-// MSIX entry point; the alias and AppExtension fragments in the config-// reference the same path. The launcher is self-relative and sets the-// payload's own PYTHONPATH.-const executable = `app\\resources\\agent-payload\\bin\\hermes.exe`+// The main application launches Electron. CLI aliases have separate payload+// entrypoints; use the same AppInfo derivation as MsixTarget and signing hooks.+const { AppInfo } = require('../../../node_modules/app-builder-lib/dist/appInfo.js')+const appInfo = new AppInfo({ config, metadata: { ...pkg, ...config.extraMetadata } }, null, config.win)+const executable = `app\\${appInfo.productFilename}.exe`const displayName = options.displayName || config.productName// appInfo.name honours extraMetadata.name the way packager merging does.const appInfoName = config.extraMetadata?.name || pkg.namediff --git a/apps/desktop/scripts/msix-manifest-roundtrip.test.mjs b/apps/desktop/scripts/msix-manifest-roundtrip.test.mjsindex ad8ab7a7985..0b6847ad3d4 100644--- a/apps/desktop/scripts/msix-manifest-roundtrip.test.mjs+++ b/apps/desktop/scripts/msix-manifest-roundtrip.test.mjs@@ -39,7 +39,7 @@ function makeFakeDesktop(version) {const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'msix-roundtrip-'))fs.writeFileSync(path.join(dir, 'product-identity.cjs'),- "module.exports = { store: false, light: false, displayName: 'Hermes', appId: 'com.nousresearch.hermes-bundled', channel: 'latest', appNamePascal: 'HermesBundled', msixAppIdWithOrg: 'NousResearch.HermesBundled' }\n"+ "module.exports = { store: false, light: false, displayName: 'Hermes', appId: 'com.nousresearch.hermes-bundled', channel: 'latest', artifactNamePascal: 'HermesBundled', msixAppIdWithOrg: 'NousResearch.HermesBundled' }\n")fs.writeFileSync(path.join(dir, 'package.json'), JSON.stringify({ name: 'hermes-desktop', version }))return dirdiff --git a/apps/desktop/scripts/msix-shared.test.mjs b/apps/desktop/scripts/msix-shared.test.mjsindex 4f34bf4832a..fceddc18cf0 100644--- a/apps/desktop/scripts/msix-shared.test.mjs+++ b/apps/desktop/scripts/msix-shared.test.mjs@@ -22,7 +22,7 @@ function makeFakeDesktop(version) {const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'msix-ident-'))fs.writeFileSync(path.join(dir, 'product-identity.cjs'),- "module.exports = { store: false, light: false, displayName: 'Hermes', appId: 'com.nousresearch.hermes-bundled', channel: 'latest', appNamePascal: 'HermesBundled', msixAppIdWithOrg: 'NousResearch.HermesBundled' }\n"+ "module.exports = { store: false, light: false, displayName: 'Hermes', appId: 'com.nousresearch.hermes-bundled', channel: 'latest', artifactNamePascal: 'HermesBundled', msixAppIdWithOrg: 'NousResearch.HermesBundled' }\n")fs.writeFileSync(path.join(dir, 'package.json'), JSON.stringify({ name: 'hermes-desktop', version }))return dirdiff --git a/apps/desktop/scripts/side-by-side-launchers.test.mjs b/apps/desktop/scripts/side-by-side-launchers.test.mjsnew file mode 100644index 00000000000..3a98f181447--- /dev/null+++ b/apps/desktop/scripts/side-by-side-launchers.test.mjs@@ -0,0 +1,86 @@+import assert from 'node:assert/strict'+import fs from 'node:fs'+import os from 'node:os'+import path from 'node:path'+import { test } from 'vitest'+import { spawnSync } from 'node:child_process'+import * as stamps from './write-build-stamp.mjs'+import * as msix from './before-build.mjs'+const { appExecutionAliasExtensions } = msix++test('the Store bundler rejects nonstable selectors before platform tools or staging', () => {+ for (const args of [['--commit', 'a'.repeat(40)], ['--tag', 'v0.28.0-canary.20260818']]) {+ const result = spawnSync(process.execPath, [path.resolve(import.meta.dirname, '../../../scripts/bundle-store-msixbundle.mjs'), ...args], {+ encoding: 'utf8', env: { ...process.env, HERMES_BUILD_COMMIT: '', HERMES_PAYLOAD_TAG: '' }+ })+ assert.notEqual(result.status, 0)+ assert.match(result.stderr, /Unknown option.*commit|requires a stable release tag/)+ }+})++test('the embedded Python checkout receives the same commit provenance as Electron', () => {+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'desktop-stamp-'))+ try {+ const commit = 'a'.repeat(40)+ const repo = path.join(root, 'agent-payload/hermes-agent')+ fs.mkdirSync(repo, { recursive: true })+ const built = stamps.buildStampPayload({ commit, source: 'local', branch: 'main' }, {+ HERMES_DESKTOP_VARIANT: 'bundled', HERMES_BUILD_COMMIT: commit, HERMES_PAYLOAD_VERSION: '0.28.0'+ }, 'win32', { runtime: { repoDir: 'hermes-agent', commands: { hermes: 'bin/hermes-aaaaaaa.exe' } } })+ stamps.writeDesktopStamp(root, built)+ const pythonStamp = JSON.parse(fs.readFileSync(path.join(repo, 'install-stamp.json'), 'utf8'))+ assert.deepEqual(pythonStamp, JSON.parse(fs.readFileSync(path.join(root, 'install-stamp.json'), 'utf8')))+ assert.equal(pythonStamp.source, 'commit-build')+ assert.equal(pythonStamp.commit, commit)+ assert.equal(pythonStamp.tag, null)+ assert.equal(pythonStamp.baseVersion, '0.28.0')+ assert.equal(pythonStamp.displayVersion, '0.28.0')+ } finally {+ fs.rmSync(root, { recursive: true, force: true })+ }+})++test('nonstable MSIX CLI aliases each activate their own entrypoint, never the GUI', () => {+ const launchers = ['hermes-canary', 'hermes-canary-acp']+ const applications = msix.appExecutionAliasApplications(launchers, {+ appNamePascal: 'HermesBundledCanary', displayName: 'Hermes Agent Canary'+ })+ const apps = applications.match(/<Application[\s\S]*?<\/Application>/g)+ assert.equal(apps.length, launchers.length)+ for (const [index, name] of launchers.entries()) {+ assert.ok(apps[index].includes(`Executable="app\\resources\\agent-payload\\bin\\${name}.exe"`))+ assert.ok(apps[index].includes(`Alias="${name}.exe"`))+ assert.equal((apps[index].match(/<uap5:ExecutionAlias /g) || []).length, 1)+ assert.ok(apps[index].includes('AppListEntry="none"'))+ }+})++test('desktop payload exposes only identity-qualified launchers while preserving canonical command keys', () => {+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'desktop-launchers-'))+ try {+ for (const cliName of ['hermes-canary', 'hermes-abcdef1', 'hermes-1234567']) {+ const payload = path.join(root, cliName)+ fs.mkdirSync(path.join(payload, 'bin'), { recursive: true })+ const commands = { hermes: 'bin/hermes.exe', 'hermes-acp': 'bin/hermes-acp.exe' }+ for (const [name, file] of Object.entries(commands)) fs.writeFileSync(path.join(payload, file), `PE bytes for ${name}`)+ fs.writeFileSync(path.join(payload, 'manifest.json'), JSON.stringify({+ target: 'win32-x64', launchers: Object.keys(commands), runtime: { commands }+ }))+ const manifest = stamps.stageDesktopLaunchers(payload, { cliName })+ assert.deepEqual(manifest.launchers, [cliName, `${cliName}-acp`])+ assert.deepEqual(Object.keys(manifest.runtime.commands), Object.keys(commands))+ for (const [name, file] of Object.entries(manifest.runtime.commands)) {+ assert.equal(fs.readFileSync(path.join(payload, file), 'utf8'), `PE bytes for ${name}`)+ assert.ok(file.includes(cliName))+ }+ assert.equal(fs.existsSync(path.join(payload, 'bin/hermes.exe')), false)+ assert.equal(fs.existsSync(path.join(payload, 'bin/hermes-acp.exe')), false)+ assert.deepEqual(stamps.stageDesktopLaunchers(payload, { cliName }), manifest)+ const xml = appExecutionAliasExtensions(manifest.launchers)+ assert.ok(xml.includes(`Alias="${cliName}.exe"`))+ assert.ok(!xml.includes('Alias="hermes.exe"'))+ }+ } finally {+ fs.rmSync(root, { recursive: true, force: true })+ }+})diff --git a/apps/desktop/scripts/store-package-version.test.mjs b/apps/desktop/scripts/store-package-version.test.mjsindex 6598ef78473..adee2e2fe92 100644--- a/apps/desktop/scripts/store-package-version.test.mjs+++ b/apps/desktop/scripts/store-package-version.test.mjs@@ -19,7 +19,7 @@ function fixture() {const app = path.join(root, 'apps', 'desktop')fs.mkdirSync(path.join(app, 'assets'), { recursive: true })fs.copyFileSync(path.join(desktop, 'assets/msix-manifest.xml'), path.join(app, 'assets/msix-manifest.xml'))- fs.writeFileSync(path.join(app, 'product-identity.cjs'), "module.exports={store:true,appNamePascal:'HermesBundled'}\n")+ fs.writeFileSync(path.join(app, 'product-identity.cjs'), "module.exports={store:true,artifactNamePascal:'HermesBundled'}\n")fs.writeFileSync(path.join(app, 'package.json'), JSON.stringify({ name: 'hermes', version: '0.27.1' }))const env = { ...process.env, GIT_AUTHOR_NAME: 'Test', GIT_AUTHOR_EMAIL: '[email protected]',GIT_COMMITTER_NAME: 'Test', GIT_COMMITTER_EMAIL: '[email protected]',@@ -68,38 +68,17 @@ test('Store calendar ordering survives minute, hour, day and year boundaries andexpect(() => storePackageVersion('v0.27.1-canary.20260231000000', '.')).toThrow('Invalid canary')})-test('commit builds use the commit time for Store identity without changing the app version', () => {+test('commit builds cannot stage a Store manifest', () => {const { root, app } = fixture()const commit = execFileSync('git', ['rev-parse', 'HEAD'], { cwd: root, encoding: 'utf8' }).trim()- const timestamp = Number(execFileSync('git', ['log', '-1', '--format=%ct', commit], { cwd: root, encoding: 'utf8' }).trim())vi.stubEnv('HERMES_PAYLOAD_TAG', '')vi.stubEnv('HERMES_BUILD_COMMIT', commit)vi.stubEnv('HERMES_PAYLOAD_VERSION', '0.21.1')- vi.useFakeTimers()try {- vi.setSystemTime(new Date('2030-01-01T00:00:00Z'))- const identity = appIdentity(app)- const xml = fs.readFileSync(stageStoreManifest(app, ''), 'utf8')- expect(identity.version).toBe(storePackageVersionAt(timestamp))- expect(/<Identity\b[^>]*Version="([^"]+)"/.exec(xml)[1]).toBe(identity.version)- expect(identity.fileVersion).toBe('0.21.1')- vi.setSystemTime(new Date('2031-01-01T00:00:00Z'))- expect(appIdentity(app).version).toBe(identity.version)- const prior = fs.readFileSync(path.join(app, 'build/store-msix-manifest.xml'))- for (const bad of ['short', 'a'.repeat(40)]) {- vi.stubEnv('HERMES_BUILD_COMMIT', bad)- expect(() => stageStoreManifest(app, '')).toThrow()- expect(fs.readFileSync(path.join(app, 'build/store-msix-manifest.xml'))).toEqual(prior)- }- vi.stubEnv('HERMES_BUILD_COMMIT', commit)- for (const version of ['01.2.3', '1.65536.0', '1.2.3-canary.123', '']) {- vi.stubEnv('HERMES_PAYLOAD_VERSION', version)- expect(() => appIdentity(app)).toThrow()- }- vi.stubEnv('HERMES_PAYLOAD_VERSION', '0.21.1')- expect(() => appIdentity(app, 'v0.21.1')).toThrow()+ expect(() => appIdentity(app)).toThrow('Store packaging requires a stable release tag')+ expect(() => stageStoreManifest(app, '')).toThrow('Store packaging requires a stable release tag')+ expect(fs.existsSync(path.join(app, 'build/store-msix-manifest.xml'))).toBe(false)} finally {- vi.useRealTimers()vi.unstubAllEnvs()}})diff --git a/apps/desktop/scripts/write-build-stamp.mjs b/apps/desktop/scripts/write-build-stamp.mjsindex fc4f42a33fa..ed92cf7a60d 100644--- a/apps/desktop/scripts/write-build-stamp.mjs+++ b/apps/desktop/scripts/write-build-stamp.mjs@@ -6,8 +6,9 @@* Provenance comes from CI, local git, or an explicit unknown-source stamp.*/-import { mkdirSync, readFileSync, writeFileSync } from "fs"-import { resolve, join, relative } from "path"+import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "fs"+import { resolve, join, relative, posix } from "path"+import productIdentity from "../product-identity.cjs"import { execFileSync } from "child_process"import { isMain } from "./utils.mjs"@@ -104,6 +105,42 @@ export function isFallbackCommit(commit) {return typeof commit === "string" && /^0{7,40}$/.test(commit)}+/** Qualify desktop CLI files before the immutable runtime paths are baked.+ * Canonical command keys remain stable for backend consumers; public aliases+ * come from the declared filenames, never those internal keys.+ */+export function stageDesktopLaunchers(root, identity = productIdentity) {+ const file = join(root, 'manifest.json')+ const manifest = JSON.parse(readFileSync(file, 'utf8'))+ const windows = manifest.target.startsWith('win32')+ const commands = {}+ const launchers = []+ for (const [name, source] of Object.entries(manifest.runtime.commands)) {+ const alias = name.replace(/^hermes(?=-|$)/, identity.cliName)+ const destination = posix.join(posix.dirname(source), `${alias}${windows ? '.exe' : ''}`)+ if (source !== destination && existsSync(join(root, source))) {+ renameSync(join(root, source), join(root, destination))+ }+ if (!existsSync(join(root, destination))) throw new Error(`Missing desktop launcher: ${destination}`)+ commands[name] = destination+ launchers.push(alias)+ }+ manifest.runtime.commands = commands+ manifest.launchers = launchers+ writeFileSync(file, JSON.stringify(manifest, null, 2) + '\n')+ return manifest+}++/** Electron and the embedded CLI must see the same immutable provenance. */+export function writeDesktopStamp(outDir, built) {+ const json = JSON.stringify(built, null, 2) + "\n"+ mkdirSync(outDir, { recursive: true })+ if (built.payload === 'bundled') {+ writeFileSync(join(outDir, 'agent-payload', built.runtime.repoDir, 'install-stamp.json'), json, 'utf8')+ }+ writeFileSync(join(outDir, 'install-stamp.json'), json, 'utf8')+}+function main() {const stamp = resolveStamp()if (!stamp || !stamp.commit) {@@ -141,11 +178,10 @@ function main() {const bundled = ['bundled', 'store'].includes(process.env.HERMES_DESKTOP_VARIANT)const payload = bundled- ? JSON.parse(readFileSync(join(OUT_DIR, 'agent-payload', 'manifest.json'), 'utf8'))+ ? stageDesktopLaunchers(join(OUT_DIR, 'agent-payload')): nullconst built = buildStampPayload(stamp, process.env, process.platform, payload)- mkdirSync(OUT_DIR, { recursive: true })- writeFileSync(OUT_FILE, JSON.stringify(built, null, 2) + "\n", "utf8")+ writeDesktopStamp(OUT_DIR, built)console.log("[write-build-stamp] wrote " +relative(REPO_ROOT, OUT_FILE) +@@ -169,6 +205,7 @@ export function buildStampPayload(stamp, env = process.env, platform = process.pif (commitBuild && env.HERMES_PAYLOAD_TAG) {throw new Error('Commit builds cannot also set a release tag')}+ const version = env.HERMES_PAYLOAD_VERSION || (env.HERMES_PAYLOAD_TAG || '').replace(/^v/, '') || nullconst base = {schemaVersion: STAMP_SCHEMA_VERSION,commit: stamp.commit,@@ -177,8 +214,8 @@ export function buildStampPayload(stamp, env = process.env, platform = process.pdirty: stamp.dirty,source: commitBuild ? 'commit-build' : stamp.source,commitDate: stamp.commitDate ?? null,- baseVersion: stamp.baseVersion ?? null,- displayVersion: stamp.displayVersion ?? null,+ baseVersion: stamp.baseVersion ?? version?.split('-')[0] ?? null,+ displayVersion: stamp.displayVersion ?? version,distance: stamp.distance ?? null}diff --git a/scripts/bundle-store-msixbundle.mjs b/scripts/bundle-store-msixbundle.mjsindex 9df125bf842..887d7228fa1 100644--- a/scripts/bundle-store-msixbundle.mjs+++ b/scripts/bundle-store-msixbundle.mjs@@ -27,22 +27,14 @@ import { ensureWindowsBundleTools } from '../apps/desktop/scripts/windows-bundleconst REPO_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')const { values } = parseArgs({ options: {- tag: { type: 'string' }, commit: { type: 'string' }, version: { type: 'string' },+ tag: { type: 'string' },'output-file': { type: 'string' },} })const tag = values.tag || process.env.HERMES_PAYLOAD_TAG-const commitBuild = values.commit-if (commitBuild) {- if (tag) throw new Error('Commit builds cannot select a release tag')- process.env.HERMES_BUILD_COMMIT = commitBuild- process.env.HERMES_PAYLOAD_VERSION = values.version || ''-} else if (values.version !== undefined) {- throw new Error('--version requires --commit')-}-if (!tag && !commitBuild) {- console.error('[bundle-store] --tag or --commit is required')- process.exit(1)+if (!/^v\d+\.\d+\.\d+$/.test(tag || '') || process.env.HERMES_BUILD_COMMIT) {+ throw new Error('Store packaging requires a stable release tag')}+process.env.HERMES_PAYLOAD_TAG = tagif (process.platform !== 'win32') {console.error('[bundle-store] this job must run on a Windows runner (makeappx)')process.exit(1)diff --git a/scripts/msix-shared.mjs b/scripts/msix-shared.mjsindex faf101db9de..70a31f3da00 100644--- a/scripts/msix-shared.mjs+++ b/scripts/msix-shared.mjs@@ -249,14 +249,12 @@ export function appIdentity(desktopDir, tag = process.env.HERMES_PAYLOAD_TAG |||| version.split('.').some(part => Number(part) > 65535)) {throw new Error('Commit builds require HERMES_PAYLOAD_VERSION=X.Y.Z with 16-bit fields')}- const packageVersion = identity.store- ? storePackageVersionAt(gitTagCommitTime(repoRoot, commit))- : `${version}.0`- return { identity, version: packageVersion, fileVersion: version, name: identity.appNamePascal }+ if (identity.store) throw new Error('Store packaging requires a stable release tag')+ return { identity, version: `${version}.0`, fileVersion: version, name: identity.artifactNamePascal }}if (identity.store) {return { identity, version: storePackageVersion(String(tag), repoRoot),- fileVersion: String(tag).slice(1), name: identity.appNamePascal }+ fileVersion: String(tag).slice(1), name: identity.artifactNamePascal }}const canary = CANARY_TAG_RE.exec(String(tag))if (canary) {@@ -268,7 +266,7 @@ export function appIdentity(desktopDir, tag = process.env.HERMES_PAYLOAD_TAG ||identity,version: `${canary[1]}.${canaryBuildMinutes(String(tag), repoRoot)}`,fileVersion: String(tag).slice(1),- name: identity.appNamePascal,+ name: identity.artifactNamePascal,}}if (tag && !STABLE_TAG_RE.test(tag)) throw new Error(`Invalid release tag: ${tag}`)@@ -278,6 +276,6 @@ export function appIdentity(desktopDir, tag = process.env.HERMES_PAYLOAD_TAG ||identity,version: `${version}.0`,fileVersion: version,- name: identity.appNamePascal,+ name: identity.artifactNamePascal,}}diff --git a/scripts/render-builds-table.py b/scripts/render-builds-table.pyindex 21f0898cc77..200f594e150 100644--- a/scripts/render-builds-table.py+++ b/scripts/render-builds-table.py@@ -167,14 +167,8 @@ _COMMIT_EXPECTED = [r"^HermesBundled-[^-]+(?:-canary\.\d+)?-win-x64\.msix$"),("Windows ARM64 (MSIX)", "win32-arm64",r"^HermesBundled-[^-]+(?:-canary\.\d+)?-win-arm64\.msix$"),- ("Windows x64 (Store MSIX)", "win32-x64",- r"^Store-HermesBundled-[^-]+(?:-canary\.\d+)?-win-x64\.msix$"),- ("Windows ARM64 (Store MSIX)", "win32-arm64",- r"^Store-HermesBundled-[^-]+(?:-canary\.\d+)?-win-arm64\.msix$"),("Windows universal bundle (MSIXBUNDLE)", "windows-universal",r"^HermesBundled-[^-]+(?:-canary\.\d+)?-win\.msixbundle$"),- ("Windows universal Store bundle (MSIXBUNDLE)", "windows-universal",- r"^Store-HermesBundled-[^-]+(?:-canary\.\d+)?-win\.msixbundle$"),("macOS Apple Silicon (DMG)", "darwin-arm64",r"^HermesBundled-[^-]+(?:-canary\.\d+)?-mac-arm64\.dmg$"),("macOS Intel (DMG)", "darwin-x64",diff --git a/scripts/stage-msixbundle.mjs b/scripts/stage-msixbundle.mjsindex 62628140f9b..aa1734907e6 100644--- a/scripts/stage-msixbundle.mjs+++ b/scripts/stage-msixbundle.mjs@@ -58,6 +58,7 @@ if (!commitBuild && (values.version !== undefined || noUpload)) {// identity, so the env var MUST match the variant or the msix lookup// fails. Set it before anything requires the identity.process.env.HERMES_DESKTOP_VARIANT = variant+if (tag) process.env.HERMES_PAYLOAD_TAG = tagif (commitBuild) {if (!/^[a-f0-9]{40}$/.test(commitBuild)) {diff --git a/tests/ci/test_commit_build_staging.py b/tests/ci/test_commit_build_staging.pyindex 0e8b4fcab26..0cc1480f9ac 100644--- a/tests/ci/test_commit_build_staging.py+++ b/tests/ci/test_commit_build_staging.py@@ -65,9 +65,9 @@ def test_commit_staging_and_summary_bind_every_produced_file_without_channels(tmrelease.mkdir(parents=True)producers = [('build-win32', 'Stage Windows packages to R2', 'win32-x64', [- 'HermesBundled-0.33.0-win-x64.msix', 'Store-HermesBundled-0.33.0-win-x64.msix']),+ 'HermesBundled-0.33.0-win-x64.msix']),('build-win32', 'Stage Windows packages to R2', 'win32-arm64', [- 'HermesBundled-0.33.0-win-arm64.msix', 'Store-HermesBundled-0.33.0-win-arm64.msix']),+ 'HermesBundled-0.33.0-win-arm64.msix']),('build-darwin', 'Stage macOS packages and feed inputs to R2', 'darwin-arm64', ['HermesBundled-0.33.0-mac-arm64.dmg', 'HermesBundled-0.33.0-mac-arm64.zip','HermesBundled-0.33.0-mac-arm64.zip.blockmap']),@@ -75,7 +75,7 @@ def test_commit_staging_and_summary_bind_every_produced_file_without_channels(tm'HermesBundled-0.33.0-mac-x64.dmg', 'HermesBundled-0.33.0-mac-x64.zip','HermesBundled-0.33.0-mac-x64.zip.blockmap']),('publish-win32-updater', 'Stage universal bundles to R2', 'windows-universal', [- 'HermesBundled-0.33.0.0-win.msixbundle', 'Store-HermesBundled-0.33.0.0-win.msixbundle']),+ 'HermesBundled-0.33.0.0-win.msixbundle']),]artifact_keys = set()for job, name, target, names in producers:diff --git a/tests/ci/test_desktop_store_eligibility.py b/tests/ci/test_desktop_store_eligibility.pynew file mode 100644index 00000000000..490ec9da15d--- /dev/null+++ b/tests/ci/test_desktop_store_eligibility.py@@ -0,0 +1,45 @@+"""Execute the packaging workflow branches; nonstable never builds Store identities."""+import json+import os+import shlex+import subprocess+import sys++import pytest++from tests.ci.test_desktop_release_tag_admission import _BASH, _child_env, _workflow++[email protected]('tag,commit,store', [+ ('v0.28.0', '', True),+ ('v0.28.0-canary.20260818', '', False),+ ('', 'a' * 40, False),+])+def test_windows_build_and_bundle_only_request_store_for_stable(tmp_path, tag, commit, store):+ helper = tmp_path / 'bin'+ helper.mkdir()+ log = tmp_path / 'calls.jsonl'+ recorder = helper / 'record.py'+ recorder.write_text(+ 'import json,os,sys\n'+ 'with open(os.environ["CALL_LOG"],"a") as file: file.write(json.dumps(sys.argv[1:])+"\\n")\n',+ encoding='utf-8',+ )+ for tool in ['python', 'node']:+ wrapper = helper / tool+ wrapper.write_text(f'#!/bin/sh\nexec {shlex.quote(sys.executable)} {shlex.quote(str(recorder))} "$@"\n', encoding='utf-8')+ wrapper.chmod(0o755)+ jobs = _workflow()['jobs']+ env = _child_env(HERMES_PAYLOAD_TAG=tag, HERMES_BUILD_COMMIT=commit,+ HERMES_PAYLOAD_VERSION='0.28.0', RELEASE_PHASE='candidate' if store else '', CALL_LOG=str(log))+ env['PATH'] = str(helper) + os.pathsep + env['PATH']+ for job, name in [('build-win32', 'Build and package'),+ ('publish-win32-updater', 'Bundle + stage the MSIX feeds')]:+ script = next(step['run'] for step in jobs[job]['steps'] if step.get('name') == name)+ result = subprocess.run([_BASH, '-e', '-o', 'pipefail', '-c', script], env=env, cwd=tmp_path,+ capture_output=True, text=True, timeout=15)+ assert result.returncode == 0, result.stdout + result.stderr+ calls = [json.loads(line) for line in log.read_text().splitlines()]+ assert any('--variant=bundled' in call for call in calls)+ assert any('--variant=store' in call for call in calls) is store+ assert any('scripts/bundle-store-msixbundle.mjs' in call for call in calls) is storediff --git a/tests/scripts/test_render_builds_table_commit.py b/tests/scripts/test_render_builds_table_commit.pyindex 1ba358ee015..dc8bc2d3f5a 100644--- a/tests/scripts/test_render_builds_table_commit.py+++ b/tests/scripts/test_render_builds_table_commit.py@@ -40,10 +40,7 @@ def _leg_for(basename: str) -> str:_ALL_BASENAMES = ["HermesBundled-0.28.0-win-x64.msix","HermesBundled-0.28.0-win-arm64.msix",- "Store-HermesBundled-0.28.0-win-x64.msix",- "Store-HermesBundled-0.28.0-win-arm64.msix","HermesBundled-0.28.0-win.msixbundle",- "Store-HermesBundled-0.28.0.0-win.msixbundle","HermesBundled-0.28.0-mac-arm64.dmg","HermesBundled-0.28.0-mac-x64.dmg","HermesBundled-0.28.0-mac-arm64.zip",@@ -80,13 +77,13 @@ def test_every_expected_binary_gets_a_row_built_or_not():assert row["state"] == "built", rowsummary = rbt.render_commit_summary(_all_built_names(), BASE, COMMIT, receipts)assert summary.count("✅ Built") == len(rbt._COMMIT_EXPECTED)- # zip/Termux/Store rows exist in the COMMIT summary (the release-body+ # zip/Termux rows exist in the COMMIT summary (the release-body# table hides zips on purpose; the commit summary shows every binary).assert any("ZIP" in row["label"] for row in rows)assert any("Termux" in row["label"] for row in rows)- assert any("Store MSIX" in row["label"] for row in rows)+ assert not any("Store" in row["label"] for row in rows)assert any("MSIXBUNDLE" in row["label"] for row in rows)- # The universal Store MSIXBUNDLE is commit-native now and links correctly.+ # The universal sideload bundle links correctly.bundle = next(row for row in rows if "MSIXBUNDLE" in row["label"])assert bundle["key"].endswith(".msixbundle")@@ -196,13 +193,12 @@ def test_failed_legs_from_release_needs_seam():assert rbt.failed_legs_from_release_needs("not json") == []-def test_summary_uses_exact_nested_keys_and_lists_both_universal_bundles():+def test_summary_uses_exact_nested_keys_and_lists_the_sideload_bundle():from scripts.releases import handoffpaths = {"windows-universal": ["HermesBundled-0.28.0.0-win.msixbundle",- "Store-HermesBundled-0.28.0.0-win.msixbundle",],"termux": ["deb/pool build/hermes-agent_0.28.0_aarch64.deb"],}@@ -221,7 +217,7 @@ def test_summary_uses_exact_nested_keys_and_lists_both_universal_bundles():assert f"]({BASE}/downloads/{quote(key, safe='/')})" in summarybuilt = [line for line in summary.splitlines() if "✅ Built" in line]assert len(built) == len(names)- assert any("Store" in line and "MSIXBUNDLE" in line for line in built)+ assert not any("Store" in line for line in built)assert "Linux x64" in summary and "Linux ARM64" in summary