The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): eslint --fix merge artifacts (import sort + curly from conflict resolution)
ethernet9c859a6ba6c9
diff --git a/apps/desktop/electron/app-updater.test.ts b/apps/desktop/electron/app-updater.test.tsindex 325f98d6a10..987d638f9a2 100644--- a/apps/desktop/electron/app-updater.test.ts+++ b/apps/desktop/electron/app-updater.test.ts@@ -28,12 +28,14 @@ test('win32 App Installer feed paths are per-channel and per-variant', () => {function fakePayloadRunner(stdout: string, code = 0) {const calls: string[] = []+return {runner: {python: 'C:\\payload\\tools\\cpython\\python.exe',script: 'C:\\payload\\scripts\\check-appinstaller-update.py',run: async (python: string, script: string) => {calls.push(`${python} ${script}`)+return { code, stdout }}} as any,@@ -66,6 +68,7 @@ test('win32 check surfaces an unknown verdict (missing winrt) without crashing',test('win32 trigger opens ms-appinstaller with the channel .appinstaller after teardown', async () => {const calls: string[] = []+const shell = {openExternal: async (url: string) => void calls.push(`open:${url}`)}@@ -87,6 +90,7 @@ test('win32 trigger opens ms-appinstaller with the channel .appinstaller after ttest('win32 trigger light+canary targets the light canary feed dir', async () => {const calls: string[] = []+const shell = {openExternal: async (url: string) => void calls.push(url)}diff --git a/apps/desktop/electron/app-updater.ts b/apps/desktop/electron/app-updater.tsindex b7fede7efe9..cd6380f35f2 100644--- a/apps/desktop/electron/app-updater.ts+++ b/apps/desktop/electron/app-updater.ts@@ -54,6 +54,7 @@ export function win32AppInstallerFeedPath(light: boolean): string {const variant = light ? 'light/' : ''+return `win32/${variant}${channel}/`}@@ -93,6 +94,7 @@ export async function checkAppInstallerUpdate(const { code, stdout } = await runner.run(runner.python, runner.script)const text = stdout.trim()let parsed: { available?: boolean | null; availability?: string; error?: string; reason?: string } | null = null+try {parsed = text ? JSON.parse(text) : null} catch {@@ -102,12 +104,15 @@ export async function checkAppInstallerUpdate(if (parsed && typeof parsed.available === 'boolean') {return { available: parsed.available, availability: parsed.availability, error: parsed.error }}+if (parsed && parsed.available === null) {return { available: null, error: parsed.error || 'checker returned unknown' }}+if (code !== 0) {return { available: null, error: parsed?.error || `checker exited ${code}` }}+return { available: null, error: 'checker returned no availability' }}@@ -131,6 +136,7 @@ export async function triggerAppInstallerUpdate(const appinstallerUrl =`${feedBaseUrl.replace(/\/+$/, '')}/${win32AppInstallerFeedPath(channel, light)}${channel}.appinstaller`+await shell.openExternal(`ms-appinstaller:?source=${encodeURIComponent(appinstallerUrl)}`)return { ok: true }diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.tsindex 22fa5eb40f3..a3479b887e4 100644--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@ -33,6 +33,7 @@ import {import { classifyActiveRuntime } from './active-runtime-state'import { destroyKeepaliveAgents, downloadAgentFor, jsonAgentFor, withRetry } from './api-transport'import { appIconCandidates, resolveAppIcon } from './app-icon'+import { PLACEHOLDER_FEED_BASE_URL } from './app-updater'import { stopBackendChild as stopBackendChildImpl, stopBackendTreesForUpdate } from './backend-child'import {type BackendOutputTail,@@ -275,14 +276,9 @@ import { runNativeLogin } from './native-oauth-login'import { loadNativeTokenSet, type NativeTokenStoreIo, persistNativeTokenSet } from './native-token-store'import { serializeJsonBody, setJsonRequestHeaders } from './oauth-net-request'import { LEGACY_OAUTH_PARTITION, resolveOauthPartition } from './oauth-partition'-import { createParentStartMarkerResolver, parentWatchdogEnv } from './parent-process-identity'-import { adoptPayloadVenv, installIdForRoot, isBundledInstall, resolvePayload, type PayloadInfo } from './payload-backend'import { listWindowsProcesses, reapPackageRootedProcesses } from './package-process-reap'-import { PLACEHOLDER_FEED_BASE_URL } from './app-updater'-import { AppInstallerStrategy } from './updater/app-installer'-import { ExternalStrategy } from './updater/external'-import { resolveUpdaterMechanism } from './updater'-import { writePendingRelaunch, consumePendingRelaunch } from './updater/relaunch'+import { createParentStartMarkerResolver, parentWatchdogEnv } from './parent-process-identity'+import { adoptPayloadVenv, installIdForRoot, isBundledInstall, type PayloadInfo, resolvePayload } from './payload-backend'import { registerPetOverlayIpc } from './pet-overlay-ipc'import {buildRegistryProfileRoutes,@@ -397,6 +393,7 @@ import { waitForUpdateClearance } from './update-gate'import { readLiveUpdateMarker, updateHandoffConflict, writeUpdateMarker } from './update-marker'import { isOfficialSshRemote, OFFICIAL_REPO_HTTPS_URL } from './update-remote'import { classifyUpdateRoot } from './update-root-policy'+import { resolveUpdaterMechanism } from './updater'import {collectRelaunchArgs,observeUpdaterHandoff,@@ -408,6 +405,9 @@ import {stagedUpdaterSupportsPrewrittenMarker,wrapHandoffForDetachedConsole} from './updater-process'+import { AppInstallerStrategy } from './updater/app-installer'+import { ExternalStrategy } from './updater/external'+import { consumePendingRelaunch, writePendingRelaunch } from './updater/relaunch'import {formatBlockerMessage,formatProbeFailedMessage,@@ -3031,6 +3031,7 @@ async function checkUpdates() {// newer package is on the registered .appinstaller source; Store installs// report unsupported (the steward owns their update loop).const bundledPayload = resolvePayload(process.resourcesPath, { fileExists, directoryExists, isWindows: IS_WINDOWS })+if (bundledPayload) {const strategy = resolveBundledUpdateStrategy(bundledPayload)@@ -3063,10 +3064,12 @@ async function checkUpdates() {// territory. A steward-owned tree (external / electron-updater) must not be// pulled into from the desktop.const rootStamp = readCanonicalInstallStamp()+const rootPolicy = classifyUpdateRoot({isGitTree: true,updateMechanism: (rootStamp?.updateMechanism as any) ?? null})+if (!rootPolicy.updatable) {return {supported: false,@@ -3350,9 +3353,12 @@ function isWindowsStore(): boolean {*/function resolveDesktopFeedBaseUrl(): string {const configured = readUpdatesFeedBaseFromConfig()- if (configured) return configured++ if (configured) {return configured}const env = process.env.HERMES_DESKTOP_FEED_BASE_URL- if (env) return env++ if (env) {return env}+return PLACEHOLDER_FEED_BASE_URL}@@ -3360,11 +3366,14 @@ function resolveDesktopFeedBaseUrl(): string {function readUpdatesFeedBaseFromConfig(): string {try {const configPath = path.join(HERMES_HOME, 'config.yaml')- if (!fileExists(configPath)) return ''++ if (!fileExists(configPath)) {return ''}const raw = fs.readFileSync(configPath, 'utf8')const match = raw.match(/^\s*desktop_feed_base_url\s*:\s*(.+)\s*$/m)- if (!match) return ''++ if (!match) {return ''}const value = match[1].trim().replace(/^['"]|['"]$/g, '')+return value} catch {return ''@@ -3391,6 +3400,7 @@ function isLightVariant(): boolean {async function runPayloadPython(python: string, script: string): Promise<{ code: number; stdout: string }> {const payload = resolvePayload(process.resourcesPath, { fileExists, directoryExists, isWindows: IS_WINDOWS })const env = { ...process.env }+if (payload?.sitePackages) {env.PYTHONPATH = payload.sitePackages}@@ -3401,13 +3411,14 @@ async function runPayloadPython(python: string, script: string): Promise<{ code:stdio: ['ignore', 'pipe', 'pipe'],env})+let stdout = ''let stderr = ''child.stdout.on('data', chunk => { stdout += chunk.toString() })child.stderr.on('data', chunk => { stderr += chunk.toString() })child.on('error', (error) => resolve({ code: 1, stdout: JSON.stringify({ available: null, error: error.message }) }))child.on('close', (code) => {- if (stderr) console.error(`[app-installer] checker stderr: ${stderr.slice(0, 400)}`)+ if (stderr) {console.error(`[app-installer] checker stderr: ${stderr.slice(0, 400)}`)}resolve({ code: code ?? 1, stdout })})})@@ -3421,6 +3432,7 @@ async function runPayloadPython(python: string, script: string): Promise<{ code:*/async function teardownBundledBackend(): Promise<void> {const hermesProcess = backendConnectionState.getProcess()+if (hermesProcess || backendPool.size > 0) {stopBackendTreesForUpdate(hermesProcess, {forceKillProcessTree,@@ -5113,21 +5125,26 @@ function createActiveBackend(backendArgs) {*/function provisionPosixCliOnPath(payload: PayloadInfo): void {const names = ['hermes', 'hermes-agent', 'hermes-acp']+try {const binDir = path.join(os.homedir(), '.local', 'bin')fs.mkdirSync(binDir, { recursive: true })let linked = 0+for (const name of names) {const source = path.join(payload.root, 'bin', name)const target = path.join(binDir, name)+// lstat, not exists: a DANGLING symlink from a previous install (the// .app moved/uninstalled) is exactly the case we want to replace.if (fs.lstatSync(target, { throwIfNoEntry: false })) {continue}+fs.symlinkSync(source, target)linked += 1}+if (linked > 0) {rememberLog(`[payload] linked ${linked} CLI trampoline(s) into ${binDir}`)}@@ -17913,10 +17930,12 @@ function readLatestSyncReceipt(): Record<string, unknown> | null {'update_receipts','latest.json')+try {const text = fs.readFileSync(receiptPath, 'utf8')// tolerate a BOM (hermes writes plain, but editors touch configs)const stripped = text.charCodeAt(0) === 0xfeff ? text.slice(1) : text+return JSON.parse(stripped)} catch {return nulldiff --git a/apps/desktop/electron/payload-backend.test.ts b/apps/desktop/electron/payload-backend.test.tsindex 0e650dd8d2f..5783a96671c 100644--- a/apps/desktop/electron/payload-backend.test.ts+++ b/apps/desktop/electron/payload-backend.test.ts@@ -1,12 +1,11 @@import assert from 'node:assert/strict'+import { createHash } from 'node:crypto'import fs from 'node:fs'import os from 'node:os'import path from 'node:path'import { test } from 'vitest'-import { createHash } from 'node:crypto'-import { adoptPayloadVenv, installIdForRoot, isBundledInstall, resolvePayload } from './payload-backend'function tmpdir() {@@ -37,6 +36,7 @@ function writePayload(const sp = isWindows? path.join(dir, 'venv', 'Lib', 'site-packages'): path.join(dir, 'venv', 'lib', 'python3.11', 'site-packages')+fs.mkdirSync(sp, { recursive: true })// The self-relative CLI entrypoint (minted launcher exe on win32, bashdiff --git a/apps/desktop/electron/payload-backend.ts b/apps/desktop/electron/payload-backend.tsindex 6120c524d05..1b46512c9c9 100644--- a/apps/desktop/electron/payload-backend.ts+++ b/apps/desktop/electron/payload-backend.ts@@ -82,9 +82,11 @@ export function resolvePayload(// bundled builds.let storePython = ''let sitePackages = ''+try {const facts = JSON.parse(fs.readFileSync(path.join(toolsDir, 'facts.json'), 'utf8'))const entry = facts?.packages?.python?.entry+if (typeof entry === 'string') {storePython = path.join(toolsDir, entry, deps.isWindows ? 'python.exe' : 'bin', deps.isWindows ? '' : 'python3')sitePackages = deps.isWindows@@ -145,8 +147,10 @@ export function adoptPayloadVenv(): boolean {if (!payload.storePython || !payload.sitePackages) {deps.log?.('[payload] missing store python or site-packages')+return false}+return true}diff --git a/apps/desktop/electron/updater/app-installer-strategy.test.ts b/apps/desktop/electron/updater/app-installer-strategy.test.tsindex 023325a30de..fcd1b4c223f 100644--- a/apps/desktop/electron/updater/app-installer-strategy.test.ts+++ b/apps/desktop/electron/updater/app-installer-strategy.test.ts@@ -9,6 +9,7 @@ import type { AppInstallerStrategyDeps } from './app-installer'function makeDeps(over: Partial<AppInstallerStrategyDeps> = {}) {const calls: string[] = []+const deps: AppInstallerStrategyDeps = {python: 'python.exe',script: 'check.py',@@ -21,9 +22,12 @@ function makeDeps(over: Partial<AppInstallerStrategyDeps> = {}) {emitUpdateProgress: () => {},appVersion: '0.18.2',quit: () => { calls.push('quit') },- registerPendingRelaunch: () => { calls.push('relaunch-marker'); return true },+ registerPendingRelaunch: () => { calls.push('relaunch-marker');++ return true },...over}+return { deps, calls }}diff --git a/apps/desktop/electron/updater/app-installer.ts b/apps/desktop/electron/updater/app-installer.tsindex 84b9b297d26..f2917b8dfdc 100644--- a/apps/desktop/electron/updater/app-installer.ts+++ b/apps/desktop/electron/updater/app-installer.ts@@ -12,12 +12,12 @@// marker) are injected, so vitest covers the arm without a payload.import {- checkAppInstallerUpdate,type AppInstallerCheck,type PayloadPythonRunner,triggerAppInstallerUpdate,win32AppInstallerFeedPath} from '../app-updater'+import type { UpdaterApplyResultWire, UpdaterStatusWire } from './index'export interface AppInstallerStrategyDeps {diff --git a/apps/desktop/electron/updater/checkout.ts b/apps/desktop/electron/updater/checkout.tsindex 384d35028e5..6ccd066e80b 100644--- a/apps/desktop/electron/updater/checkout.ts+++ b/apps/desktop/electron/updater/checkout.ts@@ -27,12 +27,14 @@ export class CheckoutStrategy {async check(): Promise<UpdaterStatusWire> {const status = await this.deps.checkBody()status.mechanism = this.mechanism+return status}async apply(opts: { stopSafeBlockers?: boolean }): Promise<UpdaterApplyResultWire> {const result = await this.deps.applyBody(opts)result.mechanism = this.mechanism+return result}}diff --git a/apps/desktop/electron/updater/updater.test.ts b/apps/desktop/electron/updater/updater.test.tsindex d94f31af89e..e1218851889 100644--- a/apps/desktop/electron/updater/updater.test.ts+++ b/apps/desktop/electron/updater/updater.test.ts@@ -3,10 +3,11 @@import { describe, expect, it } from 'vitest'-import { resolveUpdaterMechanism } from './index'import { appInstallerCheckToStatus, parseCheckOutput } from './app-installer'import { buildManualUpdateCommand } from './checkout'-import { writePendingRelaunch, consumePendingRelaunch, PENDING_RELAUNCH_FILENAME } from './relaunch'+import { consumePendingRelaunch, PENDING_RELAUNCH_FILENAME, writePendingRelaunch } from './relaunch'++import { resolveUpdaterMechanism } from './index'describe('resolveUpdaterMechanism — precedence', () => {it('bundled win32 out-of-store → app-installer', () => {@@ -101,12 +102,14 @@ describe('pending relaunch marker', () => {function fakeFs(files: Record<string, string>) {const has = (f: string) => f.replace(/\\/g, '/').endsWith(`/${KEY}`) || f === KEY+return {existsSync: (f: string) => has(f),readFileSync: (f: string) => files[Object.keys(files).find(k => k.replace(/\\/g, '/') === f.replace(/\\/g, '/')) ?? f],unlinkSync: (f: string) => {const key = Object.keys(files).find(k => k.replace(/\\/g, '/') === f.replace(/\\/g, '/'))- if (key) delete files[key]++ if (key) {delete files[key]}}}}@@ -139,8 +142,9 @@ describe('pending relaunch marker', () => {it('corrupt marker is consumed and treated as unknown', () => {const files: Record<string, string> = {}writePendingRelaunch('/home', '0.18.2', (f, c) => { files[f] = c as string })+// corrupt the contents under the same key- for (const k of Object.keys(files)) files[k] = 'not json'+ for (const k of Object.keys(files)) {files[k] = 'not json'}const r = consumePendingRelaunch('/home', '0.18.3', fakeFs(files))expect(r.wasUpdateRelaunch).toBe(false)diff --git a/apps/desktop/src/app/updates-overlay.tsx b/apps/desktop/src/app/updates-overlay.tsxindex 49fee008d08..7f91260b929 100644--- a/apps/desktop/src/app/updates-overlay.tsx+++ b/apps/desktop/src/app/updates-overlay.tsx@@ -431,11 +431,13 @@ function ApplyingView({const u = t.updatesconst label = u.stages[apply.stage as DesktopUpdateStage] ?? u.stages.idleconst isAppInstaller = statusMechanism === 'app-installer'+const body = isAppInstaller? u.applyingBodyAppInstaller: isBackend? u.applyingBodyBackend: u.applyingBody+const currentMessage = apply.message.trim()const recentLog = apply.log.slice(-4)diff --git a/apps/desktop/src/components/sync-status.test.ts b/apps/desktop/src/components/sync-status.test.tsindex e75fda0de6d..a78d97d765f 100644--- a/apps/desktop/src/components/sync-status.test.ts+++ b/apps/desktop/src/components/sync-status.test.ts@@ -23,6 +23,7 @@ describe('deriveSyncStatusSummary', () => {outcome: 'failed',venv_rebuild: { ok: false, reason: 'uv sync exited 1: unsatisfiable' }}+const summary = deriveSyncStatusSummary(receipt)expect(summary.level).toBe('error')expect(summary.headline).toContain('rebuild failed')@@ -37,6 +38,7 @@ describe('deriveSyncStatusSummary', () => {{ plugin: 'kept-plug', action: 'kept', reason: '' }]}+const summary = deriveSyncStatusSummary(receipt)expect(summary.level).toBe('warn')expect(summary.disabledPlugins).toEqual([@@ -57,6 +59,7 @@ describe('deriveSyncStatusSummary', () => {{ name: 'other', update_available: true, current: '1.0', latest: '2.0' }]}+const summary = deriveSyncStatusSummary(receipt)expect(summary.level).toBe('warn')expect(summary.headline).toContain('update-url')@@ -72,6 +75,7 @@ describe('deriveSyncStatusSummary', () => {outcome: 'updates-available',plugin_checks: [{ name: 'plug', update_available: true, current: '1.0', latest: '1.1' }]}+const summary = deriveSyncStatusSummary(receipt)expect(summary.level).toBe('info')expect(summary.headline).toContain('updates available')@@ -82,6 +86,7 @@ describe('deriveSyncStatusSummary', () => {kind: 'plugin-check',plugin_checks: [{ name: 'mystery', update_available: null, reason: 'not on PyPI' }]}+const summary = deriveSyncStatusSummary(receipt)expect(summary.updatesAvailable).toEqual([])expect(summary.headline).toBeNull()diff --git a/apps/desktop/src/components/sync-status.ts b/apps/desktop/src/components/sync-status.tsindex 402895007a3..e0e7cd8a864 100644--- a/apps/desktop/src/components/sync-status.ts+++ b/apps/desktop/src/components/sync-status.ts@@ -30,16 +30,19 @@ export function deriveSyncStatusSummary(needsFixing: [],updatesAvailable: []}- if (!receipt) return empty++ if (!receipt) {return empty}const disabledPlugins = (receipt.plugin_bisect ?? []).filter(d => d.action === 'disabled').map(d => ({ plugin: d.plugin, reason: d.reason }))const checks = receipt.plugin_checks ?? []+const needsFixing = checks.filter(c => c.needs_fixing).map(c => ({ plugin: c.name, reason: c.needs_fixing as string }))+const updatesAvailable = checks.filter(c => c.update_available === true).map(c => ({ name: c.name, current: c.current ?? null, latest: c.latest ?? null }))@@ -49,6 +52,7 @@ export function deriveSyncStatusSummary(let headline: string | null = nulllet level: SyncStatusSummary['level'] = 'ok'+if (rebuildFailed) {headline = 'Dependency rebuild failed — some plugins may be missing packages'level = 'error'diff --git a/apps/desktop/src/i18n/key-parity.test.ts b/apps/desktop/src/i18n/key-parity.test.tsindex 9021c5c669e..98a2a7b3667 100644--- a/apps/desktop/src/i18n/key-parity.test.ts+++ b/apps/desktop/src/i18n/key-parity.test.ts@@ -1,11 +1,11 @@import { describe, expect, it } from 'vitest'+import { ar } from './ar'import { en } from './en'-import { zh } from './zh'-import { zhHant } from './zh-hant'import { ja } from './ja'-import { ar } from './ar'import { ru } from './ru'+import { zh } from './zh'+import { zhHant } from './zh-hant'/*** Locale key-parity guard — the class-fix for the recurring "missed locale"@@ -39,14 +39,18 @@ function asObj(value: unknown): Obj | null {function leafEntries(value: unknown, prefix = ''): LeafKey[] {const obj = asObj(value)+if (obj === null) {return prefix ? [prefix] : []}+const out: LeafKey[] = []+for (const [key, child] of Object.entries(obj)) {const path = prefix ? `${prefix}.${key}` : keyout.push(...leafEntries(child, path))}+return out}@@ -57,12 +61,16 @@ function keySet(obj: unknown): Set<LeafKey> {/** Value at a dot-path in the en tree, or undefined. */function enAt(path: string): unknown {let node: unknown = en+for (const part of path.split('.')) {const obj = asObj(node)- if (obj === null) return undefined++ if (obj === null) {return undefined}node = obj[part]- if (node === undefined) return undefined++ if (node === undefined) {return undefined}}+return node}@@ -80,19 +88,25 @@ function enAt(path: string): unknown {*/function staleUnderLiveParents(locale: unknown): LeafKey[] {const enKeys = keySet(en)+return [...keySet(locale)].filter((k) => {- if (enKeys.has(k)) return false+ if (enKeys.has(k)) {return false}const parts = k.split('.')+for (let i = parts.length - 1; i >= 1; i -= 1) {const parent = parts.slice(0, i).join('.')const enValue = enAt(parent)- if (enValue === undefined) continue // keep walking up++ if (enValue === undefined) {continue} // keep walking upconst obj = asObj(enValue)+if (obj !== null && Object.keys(obj).length === 0) {return false // en emptied this whole section → locale extras are legit}+return true // live section (or scalar) → leaf should still exist in en}+return false}).sort()}@@ -121,13 +135,16 @@ describe('desktop i18n key parity with en', () => {// counts into CI output so a locale quietly losing coverage shows up.const enKeys = keySet(en)const missing: string[] = []+for (const [name, locale] of LOCALES) {const localeSet = keySet(locale)const absent = [...enKeys].filter((k) => !localeSet.has(k))+if (absent.length > 0) {missing.push(`${name}: ${absent.length} keys fall back to English (${absent.slice(0, 3).join(', ')}…)`)}}+if (missing.length > 0) {console.info(`[i18n key-parity] partial-locale coverage:\n${missing.join('\n')}`)}diff --git a/apps/desktop/src/lib/update-copy.test.ts b/apps/desktop/src/lib/update-copy.test.tsindex b6100630e39..0bac332aa02 100644--- a/apps/desktop/src/lib/update-copy.test.ts+++ b/apps/desktop/src/lib/update-copy.test.ts@@ -69,6 +69,7 @@ describe('resolveUpdateCopy', () => {latestTag: 'v0.18.3',copy})+expect(r.body).toBe('Hermes v0.18.3 is ready to install.')})