Skip to content

The agent that grows with you

feat(desktop): About ▸ Updates picks stable releases or every commit for source installs

Teknium9287719a65e3
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index fcc49e5c4b4..bed75167ced 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -644,8 +644,8 @@ import { ChannelResolver, type ChannelTarget } from './updater/channel'
import { inspectRunningChannelApp } from './updater/channel-native'
import { ChannelStrategy } from './updater/channel-strategy'
import { verifyPreparedChannelInstaller } from './updater/channel-windows-host'
-import { createCheckoutStrategy } from './updater/checkout'
-import { readSourceUpdate, type SourceUpdate } from './updater/checkout-source'
+import { type CheckoutStrategy, createCheckoutStrategy } from './updater/checkout'
+import { readSourceUpdate, sourceChannelName, type SourceUpdate } from './updater/checkout-source'
import { ExternalStrategy } from './updater/external'
import { readUpdatesFeedBaseFromConfig, resolveFeedBaseUrl } from './updater/feed-config'
import { createChannelMacStrategy, createMacStrategy } from './updater/mac-client'
@@ -3602,11 +3602,6 @@ function writeFileAtomic(targetPath, data, encoding?: BufferEncoding) {
fs.renameSync(tmp, targetPath)
}
-function writeDesktopUpdateConfig(config) {
- fs.mkdirSync(path.dirname(DESKTOP_UPDATE_CONFIG_PATH), { recursive: true })
- writeFileAtomic(DESKTOP_UPDATE_CONFIG_PATH, JSON.stringify(config, null, 2))
-}
-
// ─── Main-window geometry persistence (window-state.json) ──────────────────
function readWindowState() {
@@ -3903,21 +3898,25 @@ function requireBundledPayload(mechanism: UpdaterStrategy['mechanism']): Payload
* entrypoints dispatch only through this strategy — there is no other
* production path to the checkout arms.
*/
-function resolveCheckoutUpdateStrategy(): UpdaterStrategy {
+function resolveCheckoutUpdateStrategy(): CheckoutStrategy {
return createCheckoutStrategy({
hermesHome: HERMES_HOME,
isWindows: IS_WINDOWS,
isMac: IS_MAC,
defaultUpdateBranch: DEFAULT_UPDATE_BRANCH,
updateHandoffDwellMs: UPDATE_HANDOFF_DWELL_MS,
- readSourceUpdate: async (updateRoot: string, opts: { force?: boolean }): Promise<SourceUpdate | null> =>
+ readSourceUpdate: async (
+ updateRoot: string,
+ opts: { force?: boolean; setChannel?: 'main' | 'stable' }
+ ): Promise<SourceUpdate | null> =>
readSourceUpdate({
python: await findPythonForRoot(updateRoot),
git: resolveGitBinary(),
updateRoot,
hermesHome: HERMES_HOME,
branchConfigPath: DESKTOP_UPDATE_CONFIG_PATH,
- force: opts.force
+ force: opts.force,
+ setChannel: opts.setChannel
}),
resolveUpdateRoot,
resolveUpdaterBinary,
@@ -18663,18 +18662,12 @@ ipcMain.handle('hermes:updates:apply', async (_event, payload) =>
}))
)
-ipcMain.handle('hermes:updates:branch:get', async () => readDesktopUpdateConfig())
-
-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_BRANCH
- writeDesktopUpdateConfig({ branch })
+// About ▸ Updates channel selector; source checkouts only (packages bake their channel).
+ipcMain.handle('hermes:updates:channel:set', async (_event, name: unknown): Promise<UpdaterStatusWire> => {
+ assertSourceUpdateChannel(INSTALL_STAMP)
- return { branch }
- }
-)
+ return resolveCheckoutUpdateStrategy().check({ force: true, setChannel: sourceChannelName(name) })
+})
function resolveHermesVersion(scope: { connectionId?: string; profile?: string } = {}): Promise<string> {
return resolveGatewayVersion(path => handleHermesApiRequest({ ...scope, path, timeoutMs: 5000 }))
diff --git a/apps/desktop/electron/preload.ts b/apps/desktop/electron/preload.ts
index a91c96de6ad..b385b14fe10 100644
--- a/apps/desktop/electron/preload.ts
+++ b/apps/desktop/electron/preload.ts
@@ -664,8 +664,7 @@ contextBridge.exposeInMainWorld('hermesDesktop', {
updates: {
check: opts => ipcRenderer.invoke('hermes:updates:check', opts),
apply: opts => ipcRenderer.invoke('hermes:updates:apply', opts),
- getBranch: () => ipcRenderer.invoke('hermes:updates:branch:get'),
- setBranch: name => ipcRenderer.invoke('hermes:updates:branch:set', name),
+ setChannel: name => ipcRenderer.invoke('hermes:updates:channel:set', name),
onProgress: callback => {
const listener = (_event, payload) => callback(payload)
ipcRenderer.on('hermes:updates:progress', listener)
diff --git a/apps/desktop/electron/updater/checkout-source.ts b/apps/desktop/electron/updater/checkout-source.ts
index 19c100ad2f4..c93a53e4192 100644
--- a/apps/desktop/electron/updater/checkout-source.ts
+++ b/apps/desktop/electron/updater/checkout-source.ts
@@ -18,6 +18,8 @@ export interface SourceUpdateProbe {
hermesHome: string
branch?: string
channel?: 'main' | 'stable' | 'canary'
+ /** Persist this install's channel first (the About selector); the check then reports it. */
+ setChannel?: 'main' | 'stable'
force?: boolean
cachePath?: string
branchConfigPath?: string
@@ -25,6 +27,31 @@ export interface SourceUpdateProbe {
const execute: typeof execFile.__promisify__ = promisify(execFile)
+/** The two channels a source checkout can select from Settings. */
+export function sourceChannelName(name: unknown): 'main' | 'stable' {
+ if (name !== 'stable' && name !== 'main') {
+ throw new Error('The update channel must be stable or main.')
+ }
+
+ return name
+}
+
+/** The probe's optional arguments, in the order source_check parses them. */
+function probeFlags(probe: SourceUpdateProbe): string[] {
+ const flags: [string, string | undefined][] = [
+ ['--branch', probe.branch],
+ ['--channel', probe.channel],
+ ['--set-channel', probe.setChannel],
+ ['--cache-path', probe.cachePath],
+ ['--branch-config-path', probe.branchConfigPath]
+ ]
+
+ return [
+ ...flags.flatMap(([flag, value]): string[] => (value ? [flag, value] : [])),
+ ...(probe.force ? ['--force'] : [])
+ ]
+}
+
export function sourceUpdateEnvironment(updateRoot: string, hermesHome: string): NodeJS.ProcessEnv {
const env: NodeJS.ProcessEnv = {
...process.env,
@@ -71,11 +98,7 @@ export async function readSourceUpdate(probe: SourceUpdateProbe): Promise<Source
probe.hermesHome,
'--git',
probe.git,
- ...(probe.branch ? ['--branch', probe.branch] : []),
- ...(probe.channel ? ['--channel', probe.channel] : []),
- ...(probe.force ? ['--force'] : []),
- ...(probe.cachePath ? ['--cache-path', probe.cachePath] : []),
- ...(probe.branchConfigPath ? ['--branch-config-path', probe.branchConfigPath] : [])
+ ...probeFlags(probe)
]
const command: string = (managed ? launcher : probe.python)!
diff --git a/apps/desktop/electron/updater/checkout.ts b/apps/desktop/electron/updater/checkout.ts
index 5029f436e5e..544d72e8502 100644
--- a/apps/desktop/electron/updater/checkout.ts
+++ b/apps/desktop/electron/updater/checkout.ts
@@ -38,7 +38,10 @@ import type { UpdaterApplyResultWire, UpdaterMechanism, UpdaterStatusWire, Updat
*/
export interface CheckoutStrategyDeps {
resolveUpdateRoot: () => string
- readSourceUpdate: (root: string, opts: { force?: boolean }) => Promise<SourceUpdate | null>
+ readSourceUpdate: (
+ root: string,
+ opts: { force?: boolean; setChannel?: 'main' | 'stable' }
+ ) => Promise<SourceUpdate | null>
hermesHome: string
isWindows: boolean
isMac: boolean
@@ -130,7 +133,11 @@ export function readStampedCommit(root: string): string | null {
* The bodies are the production update flow; the mechanism stamp rides on
* every result the way the wire contract expects.
*/
-export function createCheckoutStrategy(deps: CheckoutStrategyDeps): UpdaterStrategy {
+export interface CheckoutStrategy extends UpdaterStrategy {
+ check(opts?: { force?: boolean; setChannel?: 'main' | 'stable' }): Promise<UpdaterStatusWire>
+}
+
+export function createCheckoutStrategy(deps: CheckoutStrategyDeps): CheckoutStrategy {
function markerHelper(op: MarkerHelperOp, runId: string | null): Promise<MarkerHelperVerdict> {
return (deps.markerHelper ?? runMarkerHelper)(op, {
updateRoot: deps.resolveUpdateRoot(),
@@ -294,7 +301,7 @@ export function createCheckoutStrategy(deps: CheckoutStrategyDeps): UpdaterStrat
const mechanism: UpdaterMechanism = deps.isWindows ? 'windows-handoff' : 'posix-handoff'
- async function check(opts: { force?: boolean } = {}): Promise<UpdaterStatusWire> {
+ async function check(opts: { force?: boolean; setChannel?: 'main' | 'stable' } = {}): Promise<UpdaterStatusWire> {
const root: string = deps.resolveUpdateRoot()
// A checkout without the source probe predates source channels, so it can
diff --git a/apps/desktop/src/app/settings/about-settings.test.tsx b/apps/desktop/src/app/settings/about-settings.test.tsx
index b442616ec11..a54c260f7af 100644
--- a/apps/desktop/src/app/settings/about-settings.test.tsx
+++ b/apps/desktop/src/app/settings/about-settings.test.tsx
@@ -3,8 +3,10 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type { DesktopUpdateStatus, DesktopVersionInfo, HermesConnection } from '@/global'
import { en } from '@/i18n/en'
+import { $confirmRequest, settleConfirm } from '@/store/confirm'
import type * as SessionStore from '@/store/session'
import { $connection } from '@/store/session'
+import type * as UpdatesStore from '@/store/updates'
import {
$backendUpdateStatus,
$desktopVersion,
@@ -12,6 +14,7 @@ import {
checkBackendUpdates,
checkUpdates,
refreshDesktopVersion,
+ setUpdateChannel,
startActiveUpdate,
type UpdateApplyState
} from '@/store/updates'
@@ -49,6 +52,8 @@ vi.mock('@/store/updates', async (): Promise<Record<string, unknown>> => {
checkBackendUpdates: vi.fn<() => Promise<DesktopUpdateStatus | null>>().mockResolvedValue(null),
checkUpdates: vi.fn<() => Promise<DesktopUpdateStatus | null>>().mockResolvedValue(null),
refreshDesktopVersion: vi.fn<() => Promise<DesktopVersionInfo | null>>().mockResolvedValue(null),
+ setUpdateChannel: vi.fn<() => Promise<DesktopUpdateStatus | null>>().mockResolvedValue(null),
+ sourceUpdateChannel: (await vi.importActual<typeof UpdatesStore>('@/store/updates')).sourceUpdateChannel,
openUpdateOverlayFor: vi.fn(),
openUpdatesWindow: vi.fn(),
startActiveUpdate: vi.fn()
@@ -119,6 +124,40 @@ describe('AboutSettings', (): void => {
expect(screen.queryByRole('combobox')).toBeNull()
})
+ it('lets a source checkout pick its channel and confirms the move to stable releases', async (): Promise<void> => {
+ const about = en.settings.about.channel
+ $updateStatus.set({ supported: true, behind: 0, mechanism: 'posix-handoff', branch: 'main' })
+ render(<AboutSettings />)
+ expect(screen.getByRole('button', { name: about.main }).getAttribute('aria-pressed')).toBe('true')
+
+ fireEvent.click(screen.getByRole('button', { name: about.stable }))
+ await waitFor((): void => {
+ expect($confirmRequest.get()?.title).toBe(about.stableConfirmTitle)
+ })
+ expect(setUpdateChannel).not.toHaveBeenCalled()
+ settleConfirm(true)
+ await waitFor((): void => {
+ expect(setUpdateChannel).toHaveBeenCalledWith('stable')
+ })
+
+ // Back to every commit is never older code, so it needs no confirmation.
+ $updateStatus.set({ supported: true, behind: 0, mechanism: 'posix-handoff', channel: 'stable' })
+ await waitFor((): void => {
+ expect(screen.getByRole('button', { name: about.stable }).getAttribute('aria-pressed')).toBe('true')
+ })
+ fireEvent.click(screen.getByRole('button', { name: about.main }))
+ await waitFor((): void => {
+ expect(setUpdateChannel).toHaveBeenCalledWith('main')
+ })
+ expect($confirmRequest.get()).toBeNull()
+
+ // Packaged installs own their channel.
+ $updateStatus.set({ supported: true, behind: 0, mechanism: 'electron-updater', channel: 'stable' })
+ await waitFor((): void => {
+ expect(screen.queryByText(about.title)).toBeNull()
+ })
+ })
+
it('a commit client refuses updates without hiding an unrelated backend update', (): void => {
const message: string = "This build doesn't get updates. Ask the developer who gave it to you for a new build."
$connection.set(connection('remote'))
diff --git a/apps/desktop/src/app/settings/about-settings.tsx b/apps/desktop/src/app/settings/about-settings.tsx
index 458add687e5..8e2fd7809d2 100644
--- a/apps/desktop/src/app/settings/about-settings.tsx
+++ b/apps/desktop/src/app/settings/about-settings.tsx
@@ -11,6 +11,7 @@ import { $desktopVersion, checkBackendUpdates, refreshDesktopVersion } from '@/s
import { SectionHeading, SettingsContent } from './primitives'
import { SETTING_IDS, settingElementId } from './settings-manifest'
import { UninstallSection } from './uninstall-section'
+import { UpdateChannelRow } from './update-channel-row'
import { useSettingDeepLink } from './use-setting-deep-link'
interface AboutSettingsProps {
@@ -57,6 +58,7 @@ function AppUpdatesSettings({ includeUninstall }: AppUpdatesSettingsProps): Reac
<SectionHeading icon={RefreshCw} title={t.settings.about.updates} />
<div className="grid gap-3" id={settingElementId(SETTING_IDS.about.updates)}>
<UpdateStatusCard target="client" />
+ <UpdateChannelRow />
{/* Client and remote backend updates are independent. Only the client has release notes. */}
{remote && <UpdateStatusCard showReleaseNotes={false} target="backend" />}
</div>
diff --git a/apps/desktop/src/app/settings/update-channel-row.tsx b/apps/desktop/src/app/settings/update-channel-row.tsx
new file mode 100644
index 00000000000..bc6820c0fe9
--- /dev/null
+++ b/apps/desktop/src/app/settings/update-channel-row.tsx
@@ -0,0 +1,71 @@
+import { useStore } from '@nanostores/react'
+import type { ReactElement } from 'react'
+
+import { SegmentedControl } from '@/components/ui/segmented-control'
+import { useI18n } from '@/i18n'
+import { triggerHaptic } from '@/lib/haptics'
+import { confirm } from '@/store/confirm'
+import { notifyError } from '@/store/notifications'
+import { $updateChecking, $updateStatus, setUpdateChannel, type SourceUpdateChannel, sourceUpdateChannel } from '@/store/updates'
+
+import { ListRow } from './primitives'
+
+/**
+ * Stable releases vs every commit on main, for a source checkout. Packaged
+ * installs (Store, MSIX, bundled) bake their channel and never render this.
+ */
+export function UpdateChannelRow(): ReactElement | null {
+ const { t } = useI18n()
+ const a = t.settings.about.channel
+ const status = useStore($updateStatus)
+ const checking = useStore($updateChecking)
+ const channel = sourceUpdateChannel(status)
+
+ if (channel === null) {
+ return null
+ }
+
+ const change = async (next: SourceUpdateChannel): Promise<void> => {
+ if (next === channel) {
+ return
+ }
+
+ // Main → stable can land on an older commit than the one running now.
+ if (
+ next === 'stable' &&
+ !(await confirm({
+ title: a.stableConfirmTitle,
+ description: a.stableConfirmBody,
+ confirmLabel: a.stableConfirm
+ }))
+ ) {
+ return
+ }
+
+ triggerHaptic('crisp')
+
+ try {
+ await setUpdateChannel(next)
+ } catch (error) {
+ notifyError(error, a.failed)
+ }
+ }
+
+ return (
+ <ListRow
+ action={
+ <SegmentedControl
+ disabled={checking}
+ onChange={id => void change(id)}
+ options={[
+ { id: 'stable', label: a.stable },
+ { id: 'main', label: a.main }
+ ]}
+ value={channel}
+ />
+ }
+ description={a.description}
+ title={a.title}
+ />
+ )
+}
diff --git a/apps/desktop/src/global.d.ts b/apps/desktop/src/global.d.ts
index 1dfb8799fac..0fc4fda550e 100644
--- a/apps/desktop/src/global.d.ts
+++ b/apps/desktop/src/global.d.ts
@@ -643,8 +643,8 @@ declare global {
updates: {
check: (opts?: { force?: boolean }) => Promise<DesktopUpdateStatus>
apply: (opts?: DesktopUpdateApplyOptions) => Promise<DesktopUpdateApplyResult>
- getBranch: () => Promise<{ branch: string }>
- setBranch: (name: string) => Promise<{ branch: string }>
+ /** Persist this source install's update channel and return the fresh check. */
+ setChannel?: (name: 'main' | 'stable') => Promise<DesktopUpdateStatus>
onProgress: (callback: (payload: DesktopUpdateProgress) => void) => () => void
/** Claim the pending packaged self-update run (null when none or already claimed). */
takePendingRun?: () => Promise<UpdateRunReport | null>
diff --git a/apps/desktop/src/i18n/ar_settings.ts b/apps/desktop/src/i18n/ar_settings.ts
index b1e28e5ebc2..56f0a2b7e25 100644
--- a/apps/desktop/src/i18n/ar_settings.ts
+++ b/apps/desktop/src/i18n/ar_settings.ts
@@ -1,3 +1,4 @@
+import { arUpdateChannel } from './ar_update_channel'
import type { TranslationOverrides } from './define-locale'
export const arSettings = {
@@ -506,7 +507,8 @@ export const arSettings = {
'عندما يحدّث Hermes نفسه من التطبيق دون موجه طرفية، احتفظ بتعديلات المصدر المحلية أو تجاهلها.'
},
about: {
- updates: 'التحديثات'
+ updates: 'التحديثات',
+ channel: arUpdateChannel
},
config: {
diff --git a/apps/desktop/src/i18n/ar_update_channel.ts b/apps/desktop/src/i18n/ar_update_channel.ts
new file mode 100644
index 00000000000..83ab6906031
--- /dev/null
+++ b/apps/desktop/src/i18n/ar_update_channel.ts
@@ -0,0 +1,10 @@
+export const arUpdateChannel = {
+ title: 'قناة التحديث',
+ description: 'المستقر يثبّت الإصدارات المنشورة فقط. «كل التزام» يتبع فرع main مع وصول التغييرات.',
+ stable: 'الإصدارات المستقرة',
+ main: 'كل التزام',
+ stableConfirmTitle: 'التبديل إلى الإصدارات المستقرة؟',
+ stableConfirmBody: 'سينتقل Hermes إلى أحدث إصدار منشور، وقد يكون أقدم من الكود الذي تشغّله الآن. قد لا تُقرأ البيانات التي كتبها كود أحدث بشكل صحيح، لذا انسخها احتياطيًا أولًا.',
+ stableConfirm: 'التبديل إلى المستقر',
+ failed: 'تعذّر تغيير قناة التحديث'
+}
diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.ts
index 21066d8e8e1..d8525d8c1c5 100644
--- a/apps/desktop/src/i18n/de.ts
+++ b/apps/desktop/src/i18n/de.ts
@@ -8,6 +8,7 @@ import { deNotices } from './de_notices'
import { deOnboarding } from './de_onboarding'
import { deProjects } from './de_projects'
import { deSharedMetrics } from './de_shared_metrics'
+import { deUpdateChannel } from './de_update_channel'
import { defineLocale, type TranslationOverrides } from './define-locale'
import { introDe } from './intro-de'
@@ -1558,9 +1559,7 @@ export const deOverrides = {
screenRecording: 'Bildschirmaufnahme',
driverHealth: 'Treiberstatus'
},
- about: {
- updates: 'Updates'
- },
+ about: { updates: 'Updates', channel: deUpdateChannel },
config: {
minimizeToTrayTitle: 'In den Infobereich minimieren',
minimizeToTrayDesc:
diff --git a/apps/desktop/src/i18n/de_update_channel.ts b/apps/desktop/src/i18n/de_update_channel.ts
new file mode 100644
index 00000000000..cd1e775400e
--- /dev/null
+++ b/apps/desktop/src/i18n/de_update_channel.ts
@@ -0,0 +1,10 @@
+export const deUpdateChannel = {
+ title: 'Update-Kanal',
+ description: 'Stabil installiert nur veröffentlichte Releases. Jeder Commit folgt dem main-Branch, sobald Änderungen eintreffen.',
+ stable: 'Stabile Releases',
+ main: 'Jeder Commit',
+ stableConfirmTitle: 'Zu stabilen Releases wechseln?',
+ stableConfirmBody: 'Hermes wechselt zum neuesten veröffentlichten Release, das älter sein kann als der Code, den du gerade nutzt. Von neuerem Code geschriebene Daten werden eventuell nicht korrekt gelesen – sichere sie vorher.',
+ stableConfirm: 'Zu Stabil wechseln',
+ failed: 'Update-Kanal konnte nicht geändert werden'
+}
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 7e6ed980c36..5d47bb45c78 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -12,6 +12,7 @@ import { enOnboarding } from './en_onboarding'
import { enProjects } from './en_projects'
import { enSharedMetrics } from './en_shared_metrics'
import { enUninstallSection } from './en_uninstall_section'
+import { enUpdateChannel } from './en_update_channel'
import type { Translations } from './types'
export const en: Translations = {
@@ -1212,9 +1213,7 @@ export const en: Translations = {
screenRecording: 'Screen Recording',
driverHealth: 'Driver health'
},
- about: {
- updates: 'Updates'
- },
+ about: { updates: 'Updates', channel: enUpdateChannel },
config: {
minimizeToTrayTitle: 'Minimize to tray',
minimizeToTrayDesc:
diff --git a/apps/desktop/src/i18n/en_update_channel.ts b/apps/desktop/src/i18n/en_update_channel.ts
new file mode 100644
index 00000000000..0e8a2790eae
--- /dev/null
+++ b/apps/desktop/src/i18n/en_update_channel.ts
@@ -0,0 +1,12 @@
+import type { UpdateChannelCopy } from './types_update_channel'
+
+export const enUpdateChannel: UpdateChannelCopy = {
+ title: 'Update channel',
+ description: 'Stable installs published releases only. Every commit follows the main branch as changes land.',
+ stable: 'Stable releases',
+ main: 'Every commit',
+ stableConfirmTitle: 'Switch to stable releases?',
+ stableConfirmBody: 'Hermes will move to the latest published release, which can be older than the code you run now. Data written by newer code may not read correctly, so back it up first.',
+ stableConfirm: 'Switch to stable',
+ failed: 'Could not change the update channel'
+}
diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.ts
index 4e4f1a20852..f790ecdfed7 100644
--- a/apps/desktop/src/i18n/es.ts
+++ b/apps/desktop/src/i18n/es.ts
@@ -9,6 +9,7 @@ import { esNotices } from './es_notices'
import { esOnboarding } from './es_onboarding'
import { esProjects } from './es_projects'
import { esSharedMetrics } from './es_shared_metrics'
+import { esUpdateChannel } from './es_update_channel'
import { introEs } from './intro-es'
export const esOverrides = {
@@ -1561,9 +1562,7 @@ export const esOverrides = {
screenRecording: 'Grabación de pantalla',
driverHealth: 'Estado del controlador'
},
- about: {
- updates: 'Actualizaciones'
- },
+ about: { updates: 'Actualizaciones', channel: esUpdateChannel },
config: {
minimizeToTrayTitle: 'Minimizar a la bandeja',
minimizeToTrayDesc:
diff --git a/apps/desktop/src/i18n/es_update_channel.ts b/apps/desktop/src/i18n/es_update_channel.ts
new file mode 100644
index 00000000000..8159347bc98
--- /dev/null
+++ b/apps/desktop/src/i18n/es_update_channel.ts
@@ -0,0 +1,10 @@
+export const esUpdateChannel = {
+ title: 'Canal de actualizaciones',
+ description: 'Estable instala solo versiones publicadas. Cada commit sigue la rama main a medida que llegan cambios.',
+ stable: 'Versiones estables',
+ main: 'Cada commit',
+ stableConfirmTitle: '¿Cambiar a versiones estables?',
+ stableConfirmBody: 'Hermes pasará a la última versión publicada, que puede ser más antigua que el código que usas ahora. Los datos escritos por código más nuevo podrían no leerse bien, así que haz una copia antes.',
+ stableConfirm: 'Cambiar a estable',
+ failed: 'No se pudo cambiar el canal de actualizaciones'
+}
diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.ts
index 6d1f7719b21..b9f7914cc56 100644
--- a/apps/desktop/src/i18n/fr.ts
+++ b/apps/desktop/src/i18n/fr.ts
@@ -9,6 +9,7 @@ import { frNotices } from './fr_notices'
import { frOnboarding } from './fr_onboarding'
import { frProjects } from './fr_projects'
import { frSharedMetrics } from './fr_shared_metrics'
+import { frUpdateChannel } from './fr_update_channel'
import { introFr } from './intro-fr'
export const frOverrides = {
@@ -1565,9 +1566,7 @@ export const frOverrides = {
screenRecording: "Enregistrement de l'écran",
driverHealth: 'État du pilote'
},
- about: {
- updates: 'Mises à jour'
- },
+ about: { updates: 'Mises à jour', channel: frUpdateChannel },
config: {
minimizeToTrayTitle: 'Réduire dans la barre d’état',
minimizeToTrayDesc:
diff --git a/apps/desktop/src/i18n/fr_update_channel.ts b/apps/desktop/src/i18n/fr_update_channel.ts
new file mode 100644
index 00000000000..c5f65748fa6
--- /dev/null
+++ b/apps/desktop/src/i18n/fr_update_channel.ts
@@ -0,0 +1,10 @@
+export const frUpdateChannel = {
+ title: 'Canal de mise à jour',
+ description: 'Stable installe uniquement les versions publiées. Chaque commit suit la branche main au fil des changements.',
+ stable: 'Versions stables',
+ main: 'Chaque commit',
+ stableConfirmTitle: 'Passer aux versions stables ?',
+ stableConfirmBody: 'Hermes passera à la dernière version publiée, qui peut être plus ancienne que le code que vous utilisez. Les données écrites par un code plus récent risquent de mal se lire : sauvegardez-les d’abord.',
+ stableConfirm: 'Passer en stable',
+ failed: 'Impossible de changer le canal de mise à jour'
+}
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index 94e182431af..18895f2a8e4 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -10,6 +10,7 @@ import { jaOnboarding } from './ja_onboarding'
import { jaPluginSettings } from './ja_plugins'
import { jaProjects } from './ja_projects'
import { jaSharedMetrics } from './ja_shared_metrics'
+import { jaUpdateChannel } from './ja_update_channel'
export const jaOverrides = {
externalOpenFailed: {
@@ -983,9 +984,7 @@ export const jaOverrides = {
'アプリから Hermes 自身を更新するとき、ローカルのソース変更を保持するか破棄するかを選びます。ターミナル更新では常に確認されます。'
}
}),
- about: {
- updates: '更新'
- },
+ about: { updates: '更新', channel: jaUpdateChannel },
config: {
minimizeToTrayTitle: 'トレイに最小化',
minimizeToTrayDesc:
diff --git a/apps/desktop/src/i18n/ja_update_channel.ts b/apps/desktop/src/i18n/ja_update_channel.ts
new file mode 100644
index 00000000000..51269888ffb
--- /dev/null
+++ b/apps/desktop/src/i18n/ja_update_channel.ts
@@ -0,0 +1,10 @@
+export const jaUpdateChannel = {
+ title: 'アップデートチャンネル',
+ description: '安定版は公開済みのリリースのみをインストールします。すべてのコミットは main ブランチの変更に追従します。',
+ stable: '安定版リリース',
+ main: 'すべてのコミット',
+ stableConfirmTitle: '安定版リリースに切り替えますか?',
+ stableConfirmBody: 'Hermes は最新の公開リリースに移動します。現在のコードより古い場合があります。新しいコードが書き込んだデータは正しく読めない可能性があるため、先にバックアップしてください。',
+ stableConfirm: '安定版に切り替え',
+ failed: 'アップデートチャンネルを変更できませんでした'
+}
diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.ts
index 75c96b3cabc..6151c050782 100644
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@ -8,6 +8,7 @@ import { ruOnboarding } from './ru_onboarding'
import { ruPluginSettings } from './ru_plugins'
import { ruProjects } from './ru_projects'
import { ruSharedMetrics } from './ru_shared_metrics'
+import { ruUpdateChannel } from './ru_update_channel'
// RU_PLURAL: (count, one, few, many) — русские формы сущ. падежа
// RU_NOUN: (count, one, few, many) — формы род. множественного
@@ -991,9 +992,7 @@ export const ruOverrides = {
'Когда Hermes обновляет себя из приложения (без запроса в терминале), сохранять локальные правки исходников (stash) или выбрасывать (discard). Обновления из терминала всегда спрашивают.'
}
}),
- about: {
- updates: 'Обновления'
- },
+ about: { updates: 'Обновления', channel: ruUpdateChannel },
config: {
minimizeToTrayTitle: 'Сворачивать в трей',
minimizeToTrayDesc:
diff --git a/apps/desktop/src/i18n/ru_update_channel.ts b/apps/desktop/src/i18n/ru_update_channel.ts
new file mode 100644
index 00000000000..1801ee070b2
--- /dev/null
+++ b/apps/desktop/src/i18n/ru_update_channel.ts
@@ -0,0 +1,10 @@
+export const ruUpdateChannel = {
+ title: 'Канал обновлений',
+ description: 'Стабильный устанавливает только опубликованные релизы. «Каждый коммит» следует за веткой main по мере изменений.',
+ stable: 'Стабильные релизы',
+ main: 'Каждый коммит',
+ stableConfirmTitle: 'Перейти на стабильные релизы?',
+ stableConfirmBody: 'Hermes перейдёт на последний опубликованный релиз, который может быть старше текущего кода. Данные, записанные более новым кодом, могут читаться неправильно, поэтому сначала сделайте резервную копию.',
+ stableConfirm: 'Перейти на стабильный',
+ failed: 'Не удалось изменить канал обновлений'
+}
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index bbce444d5fa..d789f91afd4 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -19,6 +19,7 @@ import type { OnboardingTranslations } from './types_onboarding'
import type { SidebarProjectsTranslations } from './types_projects'
import type { SharedMetricsTranslations } from './types_shared_metrics'
import type { UninstallSectionTranslations } from './types_uninstall_section'
+import type { UpdateChannelCopy } from './types_update_channel'
/** The locales compiled into the app (`TRANSLATIONS`). */
export type BundledLocale = 'en' | 'zh' | 'zh-hant' | 'ja' | 'ar' | 'ru' | 'fr' | 'de' | 'es'
@@ -1002,9 +1003,7 @@ export interface Translations extends NoticeTranslations {
screenRecording: string
driverHealth: string
}
- about: {
- updates: string
- }
+ about: { updates: string; channel: UpdateChannelCopy }
config: {
minimizeToTrayTitle: string
minimizeToTrayDesc: string
diff --git a/apps/desktop/src/i18n/types_update_channel.ts b/apps/desktop/src/i18n/types_update_channel.ts
new file mode 100644
index 00000000000..97ea7192c6c
--- /dev/null
+++ b/apps/desktop/src/i18n/types_update_channel.ts
@@ -0,0 +1,11 @@
+/** About ▸ Updates: the source checkout's update channel selector. */
+export interface UpdateChannelCopy {
+ title: string
+ description: string
+ stable: string
+ main: string
+ stableConfirmTitle: string
+ stableConfirmBody: string
+ stableConfirm: string
+ failed: string
+}
diff --git a/apps/desktop/src/i18n/zh-hant_settings.ts b/apps/desktop/src/i18n/zh-hant_settings.ts
index f8d8bee14e9..2c1f36a5489 100644
--- a/apps/desktop/src/i18n/zh-hant_settings.ts
+++ b/apps/desktop/src/i18n/zh-hant_settings.ts
@@ -1,6 +1,7 @@
import { defineFieldCopy } from '@/app/settings/field-copy'
import type { TranslationOverrides } from './define-locale'
+import { zhHantUpdateChannel } from './zh-hant_update_channel'
export const zhHantSettings = {
language: {
@@ -762,7 +763,8 @@ export const zhHantSettings = {
driverHealth: '驅動程式健康狀態'
},
about: {
- updates: '更新'
+ updates: '更新',
+ channel: zhHantUpdateChannel
},
config: {
minimizeToTrayTitle: '最小化至系統匣',
diff --git a/apps/desktop/src/i18n/zh-hant_update_channel.ts b/apps/desktop/src/i18n/zh-hant_update_channel.ts
new file mode 100644
index 00000000000..a78e48eeecc
--- /dev/null
+++ b/apps/desktop/src/i18n/zh-hant_update_channel.ts
@@ -0,0 +1,10 @@
+export const zhHantUpdateChannel = {
+ title: '更新頻道',
+ description: '穩定版只安裝已發布的版本。每個提交會隨 main 分支的變更持續更新。',
+ stable: '穩定版發布',
+ main: '每個提交',
+ stableConfirmTitle: '切換到穩定版發布?',
+ stableConfirmBody: 'Hermes 將切換到最新的已發布版本,它可能比你目前執行的程式碼更舊。較新程式碼寫入的資料可能無法正確讀取,請先備份。',
+ stableConfirm: '切換到穩定版',
+ failed: '無法變更更新頻道'
+}
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index 447a34f8609..b6aab686e08 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -9,6 +9,7 @@ import { zhNotices } from './zh_notices'
import { zhOnboarding } from './zh_onboarding'
import { zhProjects } from './zh_projects'
import { zhSharedMetrics } from './zh_shared_metrics'
+import { zhUpdateChannel } from './zh_update_channel'
export const zhOverrides = {
externalOpenFailed: {
@@ -1269,9 +1270,7 @@ export const zhOverrides = {
screenRecording: '屏幕录制',
driverHealth: '驱动健康状态'
},
- about: {
- updates: '更新'
- },
+ about: { updates: '更新', channel: zhUpdateChannel },
config: {
minimizeToTrayTitle: '最小化到托盘',
minimizeToTrayDesc:
diff --git a/apps/desktop/src/i18n/zh_update_channel.ts b/apps/desktop/src/i18n/zh_update_channel.ts
new file mode 100644
index 00000000000..3f69ff234fd
--- /dev/null
+++ b/apps/desktop/src/i18n/zh_update_channel.ts
@@ -0,0 +1,10 @@
+export const zhUpdateChannel = {
+ title: '更新渠道',
+ description: '稳定版只安装已发布的版本。每个提交会随 main 分支的变更持续更新。',
+ stable: '稳定版发布',
+ main: '每个提交',
+ stableConfirmTitle: '切换到稳定版发布?',
+ stableConfirmBody: 'Hermes 将切换到最新的已发布版本,它可能比你当前运行的代码更旧。较新代码写入的数据可能无法正确读取,请先备份。',
+ stableConfirm: '切换到稳定版',
+ failed: '无法更改更新渠道'
+}
diff --git a/apps/desktop/src/store/updates-channel.test.ts b/apps/desktop/src/store/updates-channel.test.ts
new file mode 100644
index 00000000000..28bec22d25d
--- /dev/null
+++ b/apps/desktop/src/store/updates-channel.test.ts
@@ -0,0 +1,23 @@
+import { describe, expect, it } from 'vitest'
+
+import type { DesktopUpdateStatus } from '@/global'
+
+import { sourceUpdateChannel } from './updates'
+
+const status = (fields: Partial<DesktopUpdateStatus>): DesktopUpdateStatus => ({ supported: true, ...fields })
+
+describe('sourceUpdateChannel', () => {
+ it('offers the selector only to source checkouts on stable or main', () => {
+ expect(sourceUpdateChannel(status({ mechanism: 'posix-handoff', channel: 'stable' }))).toBe('stable')
+ expect(sourceUpdateChannel(status({ mechanism: 'windows-handoff', branch: 'main' }))).toBe('main')
+
+ // Packages bake their channel; a preview channel is not the user's to flip here.
+ for (const mechanism of ['electron-updater', 'app-installer', 'microsoft-store', 'external'] as const) {
+ expect(sourceUpdateChannel(status({ mechanism, channel: 'stable' }))).toBeNull()
+ }
+
+ expect(sourceUpdateChannel(status({ mechanism: 'posix-handoff', channel: 'pm-preview' }))).toBeNull()
+ expect(sourceUpdateChannel(status({ mechanism: 'posix-handoff', supported: false }))).toBeNull()
+ expect(sourceUpdateChannel(null)).toBeNull()
+ })
+})
diff --git a/apps/desktop/src/store/updates.ts b/apps/desktop/src/store/updates.ts
index bd6a705487d..05ad8d803c8 100644
--- a/apps/desktop/src/store/updates.ts
+++ b/apps/desktop/src/store/updates.ts
@@ -630,6 +630,38 @@ export async function checkUpdates({ force = false }: UpdateCheckOptions = {}):
}
}
+export type SourceUpdateChannel = 'main' | 'stable'
+
+/** The selectable channel of a source checkout, or null where the package owns it. */
+export function sourceUpdateChannel(status: DesktopUpdateStatus | null): SourceUpdateChannel | null {
+ if (!status?.supported || (status.mechanism !== 'posix-handoff' && status.mechanism !== 'windows-handoff')) {
+ return null
+ }
+
+ return status.channel === undefined ? 'main' : status.channel === 'stable' ? 'stable' : null
+}
+
+/** Persist the source checkout's channel; the reply is a fresh check against it. */
+export async function setUpdateChannel(channel: SourceUpdateChannel): Promise<DesktopUpdateStatus | null> {
+ const setChannel = window.hermesDesktop?.updates?.setChannel
+
+ if (!setChannel || $updateChecking.get()) {
+ return null
+ }
+
+ $updateChecking.set(true)
+
+ try {
+ const status = await setChannel(channel)
+ $updateStatus.set(status)
+ maybeNotifyUpdateAvailable(status, 'client')
+
+ return status
+ } finally {
+ $updateChecking.set(false)
+ }
+}
+
export async function applyUpdates(opts: DesktopUpdateApplyOptions = {}): Promise<DesktopUpdateApplyResult> {
if ($updateStatus.get()?.retirement) {
openUpdateOverlayFor('client')
diff --git a/hermes_cli/source_check.py b/hermes_cli/source_check.py
index e491122ec4f..b610f2815a3 100644
--- a/hermes_cli/source_check.py
+++ b/hermes_cli/source_check.py
@@ -448,9 +448,19 @@ def main() -> None:
parser.add_argument("--cache-path", type=Path)
parser.add_argument("--branch-config-path", type=Path)
parser.add_argument("--force", action="store_true")
+ parser.add_argument("--set-channel", type=validate_name,
+ help="Persist this install's channel (the Desktop selector), then report as usual.")
args = parser.parse_args()
with contextlib.redirect_stdout(sys.stderr):
- result = check_for_updates(**vars(args))
+ if args.set_channel:
+ from hermes_constants import set_hermes_home_override
+ from hermes_cli.update_channel import set_install_channel
+
+ # The record belongs in the --home profile's config.yaml, as the check reads it.
+ set_hermes_home_override(args.home)
+ set_install_channel(args.set_channel, args.install_root)
+ args.force = True
+ result = check_for_updates(**{k: v for k, v in vars(args).items() if k != "set_channel"})
print(json.dumps(result))
diff --git a/locales/_keys.desktop.json b/locales/_keys.desktop.json
index d28cbc0277c..17d03575b88 100644
--- a/locales/_keys.desktop.json
+++ b/locales/_keys.desktop.json
@@ -2507,6 +2507,14 @@
"sessionImport.subtitle",
"sessionImport.title",
"sessionImport.you",
+ "settings.about.channel.description",
+ "settings.about.channel.failed",
+ "settings.about.channel.main",
+ "settings.about.channel.stable",
+ "settings.about.channel.stableConfirm",
+ "settings.about.channel.stableConfirmBody",
+ "settings.about.channel.stableConfirmTitle",
+ "settings.about.channel.title",
"settings.about.updates",
"settings.appearance.appActionsDesc",
"settings.appearance.appActionsLeft",