Skip to content

The agent that grows with you

fmt(js): `npm run fix` on merge (#86876)

hermes-seaeye[bot]5b05e51f2e7e
diff --git a/apps/desktop/electron/find-in-page.test.ts b/apps/desktop/electron/find-in-page.test.ts
index c238847cdba..d1fc8c7feb8 100644
--- a/apps/desktop/electron/find-in-page.test.ts
+++ b/apps/desktop/electron/find-in-page.test.ts
@@ -266,7 +266,6 @@ describe('installFoundInPageForwarder', () => {
})
})
-
describe('installFindShortcut', () => {
// Minimal BrowserWindow stub: only `webContents` is touched.
function makeFakeWindow(wc: FakeWebContents) {
@@ -279,20 +278,23 @@ describe('installFindShortcut', () => {
const uninstall = installFindShortcut(win)
// Ctrl+F on Linux/Windows (no meta, no alt, no shift).
- const result = wc.emit('before-input-event', {}, {
- key: 'f',
- control: true,
- meta: false,
- alt: false,
- shift: false,
- })
+ const result = wc.emit(
+ 'before-input-event',
+ {},
+ {
+ key: 'f',
+ control: true,
+ meta: false,
+ alt: false,
+ shift: false
+ }
+ )
+
// The listener calls preventDefault on the event; the fake's emit returns
// truthy because the event fired — what matters is the side effects.
void result
- assert.deepEqual(wc.calls.send, [
- { channel: 'hermes:open-find-bar', payload: undefined }
- ])
+ assert.deepEqual(wc.calls.send, [{ channel: 'hermes:open-find-bar', payload: undefined }])
uninstall()
})
@@ -306,17 +308,19 @@ describe('installFindShortcut', () => {
const uninstall = installFindShortcut(win, () => true)
// Cmd+F on macOS: meta held, no control/alt/shift.
- wc.emit('before-input-event', {}, {
- key: 'f',
- control: false,
- meta: true,
- alt: false,
- shift: false,
- })
-
- assert.deepEqual(wc.calls.send, [
- { channel: 'hermes:open-find-bar', payload: undefined }
- ])
+ wc.emit(
+ 'before-input-event',
+ {},
+ {
+ key: 'f',
+ control: false,
+ meta: true,
+ alt: false,
+ shift: false
+ }
+ )
+
+ assert.deepEqual(wc.calls.send, [{ channel: 'hermes:open-find-bar', payload: undefined }])
uninstall()
})
@@ -330,17 +334,19 @@ describe('installFindShortcut', () => {
const uninstall = installFindShortcut(win, () => true)
// Ctrl+F with no meta on macOS still opens the FindBar.
- wc.emit('before-input-event', {}, {
- key: 'F',
- control: true,
- meta: false,
- alt: false,
- shift: false,
- })
-
- assert.deepEqual(wc.calls.send, [
- { channel: 'hermes:open-find-bar', payload: undefined }
- ])
+ wc.emit(
+ 'before-input-event',
+ {},
+ {
+ key: 'F',
+ control: true,
+ meta: false,
+ alt: false,
+ shift: false
+ }
+ )
+
+ assert.deepEqual(wc.calls.send, [{ channel: 'hermes:open-find-bar', payload: undefined }])
uninstall()
})
@@ -353,13 +359,17 @@ describe('installFindShortcut', () => {
const win = makeFakeWindow(wc)
const uninstall = installFindShortcut(win, () => false)
- wc.emit('before-input-event', {}, {
- key: 'f',
- control: false,
- meta: true,
- alt: false,
- shift: false,
- })
+ wc.emit(
+ 'before-input-event',
+ {},
+ {
+ key: 'f',
+ control: false,
+ meta: true,
+ alt: false,
+ shift: false
+ }
+ )
assert.equal(wc.calls.send.length, 0, 'meta (Cmd) is not a valid chord on non-macOS')
@@ -371,13 +381,17 @@ describe('installFindShortcut', () => {
const win = makeFakeWindow(wc)
const uninstall = installFindShortcut(win)
- wc.emit('before-input-event', {}, {
- key: 'f',
- control: false,
- meta: false,
- alt: false,
- shift: false,
- })
+ wc.emit(
+ 'before-input-event',
+ {},
+ {
+ key: 'f',
+ control: false,
+ meta: false,
+ alt: false,
+ shift: false
+ }
+ )
assert.equal(wc.calls.send.length, 0, 'plain F must not open the FindBar')
@@ -389,13 +403,17 @@ describe('installFindShortcut', () => {
const win = makeFakeWindow(wc)
const uninstall = installFindShortcut(win)
- wc.emit('before-input-event', {}, {
- key: 'f',
- control: true,
- meta: false,
- alt: false,
- shift: true,
- })
+ wc.emit(
+ 'before-input-event',
+ {},
+ {
+ key: 'f',
+ control: true,
+ meta: false,
+ alt: false,
+ shift: true
+ }
+ )
assert.equal(wc.calls.send.length, 0, 'Ctrl+Shift+F is reserved (session.focusSearch)')
@@ -407,13 +425,17 @@ describe('installFindShortcut', () => {
const win = makeFakeWindow(wc)
const uninstall = installFindShortcut(win)
- wc.emit('before-input-event', {}, {
- key: 'f',
- control: true,
- meta: false,
- alt: true,
- shift: false,
- })
+ wc.emit(
+ 'before-input-event',
+ {},
+ {
+ key: 'f',
+ control: true,
+ meta: false,
+ alt: true,
+ shift: false
+ }
+ )
assert.equal(wc.calls.send.length, 0)
@@ -426,13 +448,17 @@ describe('installFindShortcut', () => {
const uninstall = installFindShortcut(win)
uninstall()
- wc.emit('before-input-event', {}, {
- key: 'f',
- control: true,
- meta: false,
- alt: false,
- shift: false,
- })
+ wc.emit(
+ 'before-input-event',
+ {},
+ {
+ key: 'f',
+ control: true,
+ meta: false,
+ alt: false,
+ shift: false
+ }
+ )
assert.equal(wc.calls.send.length, 0, 'listener must be detached after uninstall()')
})
diff --git a/apps/desktop/electron/find-in-page.ts b/apps/desktop/electron/find-in-page.ts
index 57f3f901bf9..7b922bbc80b 100644
--- a/apps/desktop/electron/find-in-page.ts
+++ b/apps/desktop/electron/find-in-page.ts
@@ -190,6 +190,7 @@ const IS_MAC = () => process.platform === 'darwin'
export function installFindShortcut(window: Electron.BrowserWindow, isMac: () => boolean = IS_MAC): () => void {
const { webContents } = window
+
if (!webContents || webContents.isDestroyed()) {
return () => {}
}
@@ -198,6 +199,7 @@ export function installFindShortcut(window: Electron.BrowserWindow, isMac: () =>
if (!webContents || webContents.isDestroyed()) {
return
}
+
const key = String(input.key || '').toLowerCase()
// Accept the platform's primary accelerator (Cmd on macOS, Ctrl elsewhere)
// AND literal Ctrl on macOS so the chord still reaches us when the user
@@ -205,17 +207,17 @@ export function installFindShortcut(window: Electron.BrowserWindow, isMac: () =>
// Ctrl+F before the renderer's keydown fires — this main-process handler
// runs strictly before that (#81727).
const hasMod = isMac() ? input.meta || input.control : input.control
- const isFindChord =
- key === 'f' &&
- hasMod &&
- !input.alt &&
- !input.shift
+
+ const isFindChord = key === 'f' && hasMod && !input.alt && !input.shift
+
if (!isFindChord) {
return
}
+
if (typeof event.preventDefault === 'function') {
event.preventDefault()
}
+
webContents.send('hermes:open-find-bar')
}
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index 2aeb23c6cc0..e55adacb0c7 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -117,7 +117,12 @@ import {
tuiResumeArgs
} from './external-terminal'
import { findGitBash as _findGitBash } from './find-git-bash'
-import { installFindShortcut, installFoundInPageForwarder, performFindAfterIndexingStarted, stopFind } from './find-in-page'
+import {
+ installFindShortcut,
+ installFoundInPageForwarder,
+ performFindAfterIndexingStarted,
+ stopFind
+} from './find-in-page'
import { createFirstRunSetupGate } from './first-run-setup-gate'
import { readDirForIpc } from './fs-read-dir'
import {
@@ -8613,9 +8618,7 @@ function persistSshConnectionToken(profile, source, token) {
const entry = registry.connections.find(c => c.id === id)
if (entry && entry.kind === 'ssh') {
- writeDesktopConnectionsRegistry(
- upsertConnection(registry, { ...entry, token: encryptDesktopSecret(token) })
- )
+ writeDesktopConnectionsRegistry(upsertConnection(registry, { ...entry, token: encryptDesktopSecret(token) }))
}
return
@@ -9275,7 +9278,13 @@ async function connectRegistryBackend(source, profile, key, poolEntry) {
poolEntry.remoteBaseUrl = connection.baseUrl
- return { ...connection, profile: profileKey, connectionId: source.id, logs: hermesLog.slice(-80), ...getWindowState() }
+ return {
+ ...connection,
+ profile: profileKey,
+ connectionId: source.id,
+ logs: hermesLog.slice(-80),
+ ...getWindowState()
+ }
}
// remote / cloud: one gateway host serves every profile of that source,
@@ -10015,6 +10024,7 @@ async function startHermes() {
function wireCommonWindowHandlers(win, { zoom = true }: { zoom?: boolean } = {}) {
installPreviewShortcut(win)
installDevToolsShortcut(win)
+
// Claim Ctrl/Cmd+F in the main process — on Pop!_OS / GNOME-based Linux
// distros the Ctrl+F keydown does not reach the renderer's `view.findInPage`
// binding (#81727). Routing it through `before-input-event` forwards the
diff --git a/apps/desktop/electron/media-protocol.test.ts b/apps/desktop/electron/media-protocol.test.ts
index cae1956578d..02d6e7bfa0a 100644
--- a/apps/desktop/electron/media-protocol.test.ts
+++ b/apps/desktop/electron/media-protocol.test.ts
@@ -13,9 +13,7 @@ function dependencies(overrides: Partial<MediaProtocolDependencies> = {}) {
ensureRemoteBearer: vi.fn(async (_baseUrl: string) => null),
fetchLocal: vi.fn(async (_resolvedPath: string, _headers: Headers) => new Response('local', { status: 206 })),
fetchRemote: vi.fn(async (_url: string, _headers: Headers) => new Response('remote', { status: 206 })),
- fetchRemoteWithCookies: vi.fn(async (_url: string, _headers: Headers) =>
- new Response('cookie', { status: 206 })
- ),
+ fetchRemoteWithCookies: vi.fn(async (_url: string, _headers: Headers) => new Response('cookie', { status: 206 })),
resolveLocalFile: vi.fn(async (filePath: string) => filePath),
resolveRemoteConnection: vi.fn(async (_profile?: string) => ({
authMode: 'token' as const,
@@ -164,9 +162,7 @@ describe('createMediaProtocolHandler', () => {
}))
})
- const response = await createMediaProtocolHandler(deps)(
- request('hermes-media://remote/%2Ftmp%2Fclip.mp4')
- )
+ const response = await createMediaProtocolHandler(deps)(request('hermes-media://remote/%2Ftmp%2Fclip.mp4'))
expect(response.status).toBe(206)
expect(deps.fetchRemote).toHaveBeenCalledOnce()
@@ -210,9 +206,7 @@ describe('createMediaProtocolHandler', () => {
}))
})
- const response = await createMediaProtocolHandler(deps)(
- request('hermes-media://remote/%2Ftmp%2Fclip.mp4')
- )
+ const response = await createMediaProtocolHandler(deps)(request('hermes-media://remote/%2Ftmp%2Fclip.mp4'))
expect(response.status).toBe(206)
expect(deps.fetchRemote).not.toHaveBeenCalled()
diff --git a/apps/desktop/src/components/find-bar.test.tsx b/apps/desktop/src/components/find-bar.test.tsx
index e8c06bd56b6..eece4c73545 100644
--- a/apps/desktop/src/components/find-bar.test.tsx
+++ b/apps/desktop/src/components/find-bar.test.tsx
@@ -991,8 +991,7 @@ describe('FindBar files pane positioning', () => {
const aside = document.createElement('aside')
aside.setAttribute('aria-label', 'Right sidebar')
// jsdom has no layout — stub the rect the component measures.
- aside.getBoundingClientRect = () =>
- ({ left: window.innerWidth - width, width } as DOMRect)
+ aside.getBoundingClientRect = () => ({ left: window.innerWidth - width, width }) as DOMRect
// eslint-disable-next-line no-restricted-globals -- must land in the real DOM the component measures
document.body.appendChild(aside)
diff --git a/apps/desktop/src/components/find-bar.tsx b/apps/desktop/src/components/find-bar.tsx
index 6ae062430c3..bdfcfce0c34 100644
--- a/apps/desktop/src/components/find-bar.tsx
+++ b/apps/desktop/src/components/find-bar.tsx
@@ -92,8 +92,7 @@ export function FindBar() {
let rafId: null | number = null
let observedAside: Element | null = null
- const resizeObserver =
- typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(() => scheduleMeasure())
+ const resizeObserver = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(() => scheduleMeasure())
const measure = () => {
rafId = null
@@ -279,10 +278,7 @@ export function FindBar() {
const matchLabel = formatMatchLabel(query, matchOrdinal, matchCount)
- const barStyle =
- filesPaneRight != null
- ? { right: `calc(${filesPaneRight}px + 0.75rem)` }
- : undefined
+ const barStyle = filesPaneRight != null ? { right: `calc(${filesPaneRight}px + 0.75rem)` } : undefined
return (
<div
diff --git a/apps/desktop/src/global.d.ts b/apps/desktop/src/global.d.ts
index e2fdc0e17b4..def8874a34f 100644
--- a/apps/desktop/src/global.d.ts
+++ b/apps/desktop/src/global.d.ts
@@ -20,7 +20,10 @@ declare global {
getConnection: (profile?: string | null) => Promise<HermesConnection>
// Registry-scoped backend resolution: dial (connectionId, profile). An
// empty/local connectionId delegates to the legacy getConnection path.
- getConnectionFor?: (payload: { connectionId?: null | string; profile?: null | string }) => Promise<HermesConnection>
+ getConnectionFor?: (payload: {
+ connectionId?: null | string
+ profile?: null | string
+ }) => Promise<HermesConnection>
// Reconnect-after-wake recovery: liveness-probe the cached PRIMARY backend
// and drop it if a remote one has gone unreachable, so the next
// getConnection() rebuilds a reachable descriptor instead of the renderer
diff --git a/apps/desktop/src/lib/find-in-page-scope.test.ts b/apps/desktop/src/lib/find-in-page-scope.test.ts
index 6254991502e..6ed5f61c3b5 100644
--- a/apps/desktop/src/lib/find-in-page-scope.test.ts
+++ b/apps/desktop/src/lib/find-in-page-scope.test.ts
@@ -271,10 +271,8 @@ describe('performScopedFind', () => {
// a match used to null the walker's `current`, terminating the sibling
// traversal — `<div>needle<span>needle</span></div>` only matched the
// first occurrence. The sibling subtree must still be searched.
- const surface = plantSurface(
- 'surface',
- '<div>needle<span>needle</span></div><p>needle</p>'
- )
+ const surface = plantSurface('surface', '<div>needle<span>needle</span></div><p>needle</p>')
+
const result = performScopedFind(surface, 'needle', { forward: true, findNext: false })
expect(result.count).toBe(3)
diff --git a/apps/desktop/src/lib/find-in-page-scope.ts b/apps/desktop/src/lib/find-in-page-scope.ts
index 4dff9b53218..01bda8041d3 100644
--- a/apps/desktop/src/lib/find-in-page-scope.ts
+++ b/apps/desktop/src/lib/find-in-page-scope.ts
@@ -411,6 +411,7 @@ function setActiveMark(mark: HTMLElement | null): void {
}
mark.setAttribute(ACTIVE_ATTR, '')
+
// Block: 'nearest' so a match already on screen doesn't twitch, but a
// match below the fold scrolls into view instead of silently landing off-
// screen. Inline: 'nearest' for the same reason. Guarded: jsdom does not
@@ -443,11 +444,7 @@ const DEFAULT_RESULT: ScopedFindResult = { count: 0, activeOrdinal: 0 }
* plain object instead of pushing into the store keeps this helper testable
* without a nanostores harness — the store wires it up.
*/
-export function performScopedFind(
- root: Element,
- query: string,
- options: ScopedFindOptions
-): ScopedFindResult {
+export function performScopedFind(root: Element, query: string, options: ScopedFindOptions): ScopedFindResult {
if (!query) {
clearHighlights(root)
setActiveMark(null)
@@ -460,6 +457,7 @@ export function performScopedFind(
}
const existingMarks = [...root.querySelectorAll<HTMLElement>(`mark.${HIGHLIGHT_CLASS}`)]
+
// The marks store the ORIGINAL-CASE source slice (`highlightMatches`
// writes `mark.textContent = matchText`), so byte-equality against the
// typed query fails on the first match whose casing differs — 'Hermes'
diff --git a/apps/desktop/src/lib/media.remote.test.ts b/apps/desktop/src/lib/media.remote.test.ts
index 72b8eabb14e..3600172b351 100644
--- a/apps/desktop/src/lib/media.remote.test.ts
+++ b/apps/desktop/src/lib/media.remote.test.ts
@@ -89,9 +89,7 @@ describe('mediaGatewayStreamUrl', () => {
it('supports OAuth remotes with no renderer-visible token and scopes pool profiles', () => {
$connection.set({ authMode: 'oauth', mode: 'remote', profile: 'voice reviewer', token: null } as never)
- expect(mediaGatewayStreamUrl('/tmp/a.mp4')).toBe(
- 'hermes-media://remote/%2Ftmp%2Fa.mp4?profile=voice%20reviewer'
- )
+ expect(mediaGatewayStreamUrl('/tmp/a.mp4')).toBe('hermes-media://remote/%2Ftmp%2Fa.mp4?profile=voice%20reviewer')
})
})
diff --git a/apps/desktop/src/store/find-in-page.ts b/apps/desktop/src/store/find-in-page.ts
index 037d4daa30b..9f5a6e4ffb3 100644
--- a/apps/desktop/src/store/find-in-page.ts
+++ b/apps/desktop/src/store/find-in-page.ts
@@ -1,11 +1,6 @@
import { atom } from 'nanostores'
-import {
- captureFindScope,
- currentFindScope,
- performScopedFind,
- releaseFindScope
-} from '@/lib/find-in-page-scope'
+import { captureFindScope, currentFindScope, performScopedFind, releaseFindScope } from '@/lib/find-in-page-scope'
export interface FindInPageState {
active: boolean
diff --git a/apps/desktop/src/store/suggestion-providers/mcp.ts b/apps/desktop/src/store/suggestion-providers/mcp.ts
index 4cdc535066f..64a5b8a07bf 100644
--- a/apps/desktop/src/store/suggestion-providers/mcp.ts
+++ b/apps/desktop/src/store/suggestion-providers/mcp.ts
@@ -81,7 +81,9 @@ async function loadSuggestible(): Promise<SuggestibleServer[]> {
const { entries } = await getMcpCatalog()
const fromCatalog: SuggestibleServer[] = entries
- .filter(entry => entry.suggest && entry.url && (entry.suggest.keywords.length > 0 || entry.suggest.hosts.length > 0))
+ .filter(
+ entry => entry.suggest && entry.url && (entry.suggest.keywords.length > 0 || entry.suggest.hosts.length > 0)
+ )
.map(entry => ({
hosts: entry.suggest!.hosts,
keywords: entry.suggest!.keywords,