From 66e20786d0be6252caf32f5f2f44f55273048a86 Mon Sep 17 00:00:00 2001 From: "hermes-seaeye[bot]" <307254004+hermes-seaeye[bot]@users.noreply.github.com> Date: Tue, 28 Jul 2026 21:55:38 +0000 Subject: [PATCH] fmt(js): `npm run fix` on merge (#73666) Co-authored-by: github-actions[bot] --- apps/desktop/electron/main.ts | 6 +-- .../electron/venv-blocker-scan.test.ts | 49 ++++++++++--------- apps/desktop/electron/venv-blocker-scan.ts | 32 ++++++------ .../composer/hooks/use-voice-conversation.ts | 3 +- .../hooks/use-prompt-actions/index.test.tsx | 2 +- apps/desktop/src/lib/speech-text.test.ts | 4 +- 6 files changed, 43 insertions(+), 53 deletions(-) diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts index 3fe047aa71c6..4111ed4721f6 100644 --- a/apps/desktop/electron/main.ts +++ b/apps/desktop/electron/main.ts @@ -190,11 +190,7 @@ import { } from './update-relaunch' import { isOfficialSshRemote, OFFICIAL_REPO_HTTPS_URL } from './update-remote' import { spawnUpdaterProcess } from './updater-process' -import { - formatBlockerMessage, - formatProbeFailedMessage, - scanVenvBlockers, -} from './venv-blocker-scan' +import { formatBlockerMessage, formatProbeFailedMessage, scanVenvBlockers } from './venv-blocker-scan' import { fetchMarketplaceThemes, searchMarketplaceThemes } from './vscode-marketplace' import { computeWindowOptions, diff --git a/apps/desktop/electron/venv-blocker-scan.test.ts b/apps/desktop/electron/venv-blocker-scan.test.ts index ec9c4d2f9590..161f308d3f9f 100644 --- a/apps/desktop/electron/venv-blocker-scan.test.ts +++ b/apps/desktop/electron/venv-blocker-scan.test.ts @@ -19,7 +19,7 @@ import { formatProbeFailedMessage, parseVenvBlockerScanOutput, resolveVenvPython, - scanVenvBlockers, + scanVenvBlockers } from './venv-blocker-scan' // --------------------------------------------------------------------------- @@ -56,9 +56,7 @@ describe('formatBlockerMessage', () => { it('includes PID, name, cmdline, remote-client warning, and retry suggestion', () => { const msg = formatBlockerMessage({ blocked: true, - processes: [ - { pid: 101, name: 'python.exe', cmdline: 'serve --host 10.0.0.1' }, - ], + processes: [{ pid: 101, name: 'python.exe', cmdline: 'serve --host 10.0.0.1' }] }) assert.ok(msg.includes('PID 101')) @@ -91,10 +89,12 @@ describe('parseVenvBlockerScanOutput', () => { }) it('valid blocked', () => { - const o = parseVenvBlockerScanOutput(ok({ - blocked: true, - processes: [{ pid: 1, name: 'p', cmdline: 'c' }], - })) + const o = parseVenvBlockerScanOutput( + ok({ + blocked: true, + processes: [{ pid: 1, name: 'p', cmdline: 'c' }] + }) + ) assert.equal(o.kind, 'blocked') }) @@ -106,49 +106,43 @@ describe('parseVenvBlockerScanOutput', () => { it('ok=false is rejected', () => { assert.equal( parseVenvBlockerScanOutput(JSON.stringify({ ok: false, blocked: false, processes: [] })).kind, - 'probe-failure', + 'probe-failure' ) }) it('blocked must be boolean', () => { - assert.equal( - parseVenvBlockerScanOutput(ok({ blocked: 'false' })).kind, - 'probe-failure', - ) + assert.equal(parseVenvBlockerScanOutput(ok({ blocked: 'false' })).kind, 'probe-failure') }) it('blocked=true with empty processes rejected', () => { - assert.equal( - parseVenvBlockerScanOutput(ok({ blocked: true, processes: [] })).kind, - 'probe-failure', - ) + assert.equal(parseVenvBlockerScanOutput(ok({ blocked: true, processes: [] })).kind, 'probe-failure') }) it('blocked=false with non-empty processes rejected', () => { assert.equal( parseVenvBlockerScanOutput(ok({ processes: [{ pid: 1, name: 'p', cmdline: 'c' }] })).kind, - 'probe-failure', + 'probe-failure' ) }) it('process pid must be positive integer', () => { assert.equal( parseVenvBlockerScanOutput(ok({ blocked: true, processes: [{ pid: 0, name: 'p', cmdline: 'c' }] })).kind, - 'probe-failure', + 'probe-failure' ) }) it('process name must be non-empty string', () => { assert.equal( parseVenvBlockerScanOutput(ok({ blocked: true, processes: [{ pid: 1, name: '', cmdline: 'c' }] })).kind, - 'probe-failure', + 'probe-failure' ) }) it('process missing cmdline is rejected', () => { assert.equal( parseVenvBlockerScanOutput(ok({ blocked: true, processes: [{ pid: 1, name: 'p' }] })).kind, - 'probe-failure', + 'probe-failure' ) }) }) @@ -162,7 +156,9 @@ describe('scanVenvBlockers', () => { const okJson = JSON.stringify({ ok: true, blocked: false, processes: [] }) const blockedJson = JSON.stringify({ - ok: true, blocked: true, processes: [{ pid: 1, name: 'p', cmdline: 'c' }], + ok: true, + blocked: true, + processes: [{ pid: 1, name: 'p', cmdline: 'c' }] }) function execReturn(json: string): any { @@ -170,7 +166,12 @@ describe('scanVenvBlockers', () => { } function execThrow(status: number, stderr: string): any { - return (async (...args: any[]) => { const e: any = new Error(); e.status = status; e.stderr = Buffer.from(stderr); throw e }) as any + return (async (...args: any[]) => { + const e: any = new Error() + e.status = status + e.stderr = Buffer.from(stderr) + throw e + }) as any } it('clear scan returns clear', async () => { @@ -214,4 +215,4 @@ describe('scanVenvBlockers', () => { assert.equal(typeof c.timeout, 'number') assert.ok(c.timeout > 0) }) -}) \ No newline at end of file +}) diff --git a/apps/desktop/electron/venv-blocker-scan.ts b/apps/desktop/electron/venv-blocker-scan.ts index 67a6c1f7ce1a..18c93e16fbee 100644 --- a/apps/desktop/electron/venv-blocker-scan.ts +++ b/apps/desktop/electron/venv-blocker-scan.ts @@ -117,7 +117,7 @@ export function parseVenvBlockerScanOutput(raw: string): ScanOutcome { export async function scanVenvBlockers( updateRoot: string, execOverride?: typeof execFileAsync, - resolveOverride?: typeof resolveVenvPython, + resolveOverride?: typeof resolveVenvPython ): Promise { const execFn = execOverride || execFileAsync const resolveFn = resolveOverride || resolveVenvPython @@ -130,22 +130,20 @@ export async function scanVenvBlockers( let stdout: string try { - const proc = await execFn( - venvPython, - ['-m', SCAN_MODULE], - { - cwd: updateRoot, - encoding: 'utf-8', - timeout: SCAN_TIMEOUT_MS, - windowsHide: true, - } as any, - ) + const proc = await execFn(venvPython, ['-m', SCAN_MODULE], { + cwd: updateRoot, + encoding: 'utf-8', + timeout: SCAN_TIMEOUT_MS, + windowsHide: true + } as any) stdout = String((proc as any).stdout ?? '') } catch (err: any) { const diag = [`exit code ${err.status ?? err.code ?? -1}`] - if (err.stderr) {diag.push(String(err.stderr).slice(0, 200))} + if (err.stderr) { + diag.push(String(err.stderr).slice(0, 200)) + } return { kind: 'probe-failure', error: diag.join('; ') } } @@ -182,7 +180,7 @@ export function formatBlockerMessage(result: VenvBlockerScanResult): string { 'Update aborted: another Hermes process is using this installation.', '', 'These processes must be stopped before updating:', - '', + '' ] for (const proc of result.processes.slice(0, 10)) { @@ -196,11 +194,9 @@ export function formatBlockerMessage(result: VenvBlockerScanResult): string { lines.push('') lines.push( 'Close the terminal, app, or service owning that process. If it is a ' + - 'remote backend, stopping it will disconnect remote clients.', - ) - lines.push( - 'Then retry the update.', + 'remote backend, stopping it will disconnect remote clients.' ) + lines.push('Then retry the update.') return lines.join('\n') } @@ -215,4 +211,4 @@ export function formatProbeFailedMessage(): string { 'Close other Hermes windows and terminals, then retry. If the problem\n' + 'persists, run `hermes update` in a terminal for detailed diagnostics.' ) -} \ No newline at end of file +} diff --git a/apps/desktop/src/app/chat/composer/hooks/use-voice-conversation.ts b/apps/desktop/src/app/chat/composer/hooks/use-voice-conversation.ts index ea40a5fc2cc1..64b1c86c0ae8 100644 --- a/apps/desktop/src/app/chat/composer/hooks/use-voice-conversation.ts +++ b/apps/desktop/src/app/chat/composer/hooks/use-voice-conversation.ts @@ -217,8 +217,7 @@ export function useVoiceConversation({ // voice-playback sequence has advanced past what we captured at speech // start — don't auto-start the next sentence, the user chose to stop. const stoppedByUser = - speechStartSequenceRef.current > 0 && - $voicePlayback.get().sequence > speechStartSequenceRef.current + speechStartSequenceRef.current > 0 && $voicePlayback.get().sequence > speechStartSequenceRef.current speechStartSequenceRef.current = 0 diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/index.test.tsx b/apps/desktop/src/app/session/hooks/use-prompt-actions/index.test.tsx index 290e631f4ee4..fb03f78ffd7f 100644 --- a/apps/desktop/src/app/session/hooks/use-prompt-actions/index.test.tsx +++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/index.test.tsx @@ -2192,7 +2192,6 @@ describe('usePromptActions file attachment sync', () => { }) }) - it('uploads Windows file bytes when local mode fronts a POSIX WSL/Docker backend', async () => { $connection.set({ mode: 'local' } as never) $currentCwd.set('/root') @@ -2207,6 +2206,7 @@ describe('usePromptActions file attachment sync', () => { path: 'C:\\Users\\alice\\Downloads\\report.txt', refText: '@file:`C:\\Users\\alice\\Downloads\\report.txt`' } + const calls: { method: string; params?: Record }[] = [] const requestGateway = vi.fn(async (method: string, params?: Record) => { diff --git a/apps/desktop/src/lib/speech-text.test.ts b/apps/desktop/src/lib/speech-text.test.ts index b09ee1175137..5af35ce4ce55 100644 --- a/apps/desktop/src/lib/speech-text.test.ts +++ b/apps/desktop/src/lib/speech-text.test.ts @@ -10,9 +10,7 @@ describe('sanitizeTextForSpeech', () => { }) it('still keeps normal prose and inline code readable', () => { - expect(sanitizeTextForSpeech('Use `git status` after the change.')).toBe( - 'Use git status after the change.' - ) + expect(sanitizeTextForSpeech('Use `git status` after the change.')).toBe('Use git status after the change.') }) it('skips markdown table data while preserving surrounding human text', () => {