Skip to content

The agent that grows with you

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

hermes-seaeye[bot]e2c4793efa59
diff --git a/apps/desktop/electron/backend-ownership.test.ts b/apps/desktop/electron/backend-ownership.test.ts
index 194f06d6e1e..7910478a679 100644
--- a/apps/desktop/electron/backend-ownership.test.ts
+++ b/apps/desktop/electron/backend-ownership.test.ts
@@ -285,7 +285,6 @@ test('shutdown coordinator returns one promise and awaits teardown exactly once'
assert.equal(coordinator.run(), first)
})
-
// #89298: a corrupt ownership file must never be silently rewritten as [] —
// that permanently erases the only record of still-running backends. The reap
// sweep quarantines the file and skips; a later healthy write recreates it.
@@ -321,6 +320,7 @@ test('reapOrphans on a corrupt file quarantines and does not rewrite', async ()
test('reapOrphans on a corrupt file without a quarantine hook still skips the rewrite', async () => {
const writes: string[] = []
+
const store = {
read: () => 'garbage{{{',
value: () => 'garbage{{{',
@@ -337,6 +337,7 @@ test('reapOrphans on a corrupt file without a quarantine hook still skips the re
test('an empty or missing ownership file is NOT corrupt — reap sweeps normally', async () => {
const writes: string[] = []
+
const store = {
read: () => '',
value: () => '',
diff --git a/apps/desktop/src/app/chat/right-rail/preview-act.test.ts b/apps/desktop/src/app/chat/right-rail/preview-act.test.ts
index 2b68b1eb994..2da0d2cecd9 100644
--- a/apps/desktop/src/app/chat/right-rail/preview-act.test.ts
+++ b/apps/desktop/src/app/chat/right-rail/preview-act.test.ts
@@ -238,7 +238,9 @@ describe('actOnActivePreview (drive_preview tool)', () => {
)
cleanups.push(registerPreviewInput(tabId, { focus: vi.fn(), send: vi.fn() }))
- expect(await actOnActivePreview({ kind: 'scroll' })).toMatchObject({ note: expect.stringContaining('nothing to scroll') })
+ expect(await actOnActivePreview({ kind: 'scroll' })).toMatchObject({
+ note: expect.stringContaining('nothing to scroll')
+ })
})
it('fails loudly when the pointer input never reaches the page', async () => {
diff --git a/apps/desktop/src/app/chat/right-rail/preview-act.ts b/apps/desktop/src/app/chat/right-rail/preview-act.ts
index ee092466434..959e06927b0 100644
--- a/apps/desktop/src/app/chat/right-rail/preview-act.ts
+++ b/apps/desktop/src/app/chat/right-rail/preview-act.ts
@@ -63,7 +63,8 @@ const CLICKS: readonly string[] = ['click', 'type']
const NOTHING_OPEN = 'No live page is open in the in-app browser — open one with open_preview first.'
-const NAVIGATED = 'The page stopped answering right after — it is probably navigating. Call elements to see where you landed.'
+const NAVIGATED =
+ 'The page stopped answering right after — it is probably navigating. Call elements to see where you landed.'
/** A fingerprint of the overlay's source, so the guest page can tell that the
* code it is running has changed underneath it.
@@ -265,11 +266,7 @@ function buildScriptedScript(action: PreviewActAction, settleMs: number): string
return `(function () {
${preamble()}
var result = act(${JSON.stringify(action)});
- ${
- action.kind === 'elements'
- ? "if (result.success) { watch('strobe'); }"
- : ''
- }
+ ${action.kind === 'elements' ? "if (result.success) { watch('strobe'); }" : ''}
if (!result.success || ${settleMs} <= 0) { return Promise.resolve(JSON.stringify(result)); }
return wait(${settleMs}).then(function () {
try {
@@ -421,9 +418,7 @@ async function driveAction(
/** Flag a click the overlay intercepted, which would otherwise look like a page
* that simply ignored it. */
function hitNote(hit?: { tag: string; trusted: boolean } | null): string | undefined {
- return hit && hit.tag === 'HERMES-WATCH'
- ? 'The action overlay intercepted the click instead of the page.'
- : undefined
+ return hit && hit.tag === 'HERMES-WATCH' ? 'The action overlay intercepted the click instead of the page.' : undefined
}
/** How far a screenful is, whether there is anywhere to go, and a spot to wheel
@@ -449,14 +444,11 @@ ${preamble()}
async function driveScroll(
run: PreviewScriptRunner,
input: PreviewInputHandle,
- action: PreviewActAction,
+ action: PreviewActAction
): Promise<PreviewActResult> {
const far = action.amount ?? 0
- const trip = await runJson(
- run,
- buildScrollAnchorScript()
- )
+ const trip = await runJson(run, buildScrollAnchorScript())
if (trip.kind === 'failed') {
return { error: trip.error, success: false }
diff --git a/apps/desktop/src/lib/preview-act/act-in-page.ts b/apps/desktop/src/lib/preview-act/act-in-page.ts
index 20b3637dd4c..8fb4b6b1128 100644
--- a/apps/desktop/src/lib/preview-act/act-in-page.ts
+++ b/apps/desktop/src/lib/preview-act/act-in-page.ts
@@ -102,7 +102,6 @@ export function actInPageCore(
const still = !!(win && win.matchMedia && win.matchMedia('(prefers-reduced-motion: reduce)').matches)
const glide: ScrollBehavior = still ? 'auto' : 'smooth'
-
/** Walk the page and hand back what is interactable, in document order. The
* handles are assigned afterwards, by `survey`. */
const sight = (max: number) => {
@@ -139,7 +138,8 @@ export function actInPageCore(
}
const tag = el.tagName.toLowerCase()
- const role = el.getAttribute('role') || (tag === 'input' ? 'input:' + ((el as HTMLInputElement).type || 'text') : tag)
+ const role =
+ el.getAttribute('role') || (tag === 'input' ? 'input:' + ((el as HTMLInputElement).type || 'text') : tag)
const label = labelOf(el)
const value = valueOf(el)
@@ -184,7 +184,6 @@ export function actInPageCore(
return { elements, nodes }
}
-
/** Look at the page and say what is there — or, once there is something to
* compare against, only what moved.
*
@@ -374,7 +373,10 @@ export function actInPageCore(
if (ref) {
if (holder.url !== here) {
- return { error: 'The page navigated since the last snapshot, so ' + ref + ' no longer points anywhere. Call elements again.' }
+ return {
+ error:
+ 'The page navigated since the last snapshot, so ' + ref + ' no longer points anywhere. Call elements again.'
+ }
}
const bound = (holder.book || []).filter(entry => entry.ref === ref)[0]
diff --git a/apps/desktop/src/lib/preview-act/naming.ts b/apps/desktop/src/lib/preview-act/naming.ts
index 8c5a018564e..48bcbb2f5b6 100644
--- a/apps/desktop/src/lib/preview-act/naming.ts
+++ b/apps/desktop/src/lib/preview-act/naming.ts
@@ -73,11 +73,7 @@ export function namingKit(doc: Document): NamingKit {
/** The strongest identity signal the page offers, if it offers one. Nothing a
* re-render does to the surrounding markup disturbs these. */
const stableOf = (el: Element): string =>
- el.id ||
- el.getAttribute('data-testid') ||
- el.getAttribute('name') ||
- el.getAttribute('aria-label') ||
- ''
+ el.id || el.getAttribute('data-testid') || el.getAttribute('name') || el.getAttribute('aria-label') || ''
/** Handle stems by role, so a handle says what it is before it says which
* one. Anything unrecognised is `el`. */
diff --git a/apps/desktop/src/lib/preview-act/types.ts b/apps/desktop/src/lib/preview-act/types.ts
index cbbc59f1ecf..b87b5255ab7 100644
--- a/apps/desktop/src/lib/preview-act/types.ts
+++ b/apps/desktop/src/lib/preview-act/types.ts
@@ -66,18 +66,7 @@ export interface PreviewActAction {
/** `pin`/`unpin`/`hold` never reach the engine — they resolve their targets
* through `locate`/`elements` and then talk to the overlay — but they arrive
* on the same wire. */
- kind:
- | 'click'
- | 'elements'
- | 'hold'
- | 'hover'
- | 'locate'
- | 'pin'
- | 'press'
- | 'scroll'
- | 'strobe'
- | 'type'
- | 'unpin'
+ kind: 'click' | 'elements' | 'hold' | 'hover' | 'locate' | 'pin' | 'press' | 'scroll' | 'strobe' | 'type' | 'unpin'
/** locate: also give the target keyboard focus, for a key press that must not
* be preceded by a click (which would activate the control instead). */
focus?: boolean
diff --git a/apps/desktop/src/lib/preview-act/visibility.ts b/apps/desktop/src/lib/preview-act/visibility.ts
index d1a3ffe697b..45d0f074586 100644
--- a/apps/desktop/src/lib/preview-act/visibility.ts
+++ b/apps/desktop/src/lib/preview-act/visibility.ts
@@ -123,8 +123,7 @@ export function visibilityKit(doc: Document, win: null | Window): VisibilityKit
const midX = rect.left + rect.width / 2
const midY = rect.top + rect.height / 2
- const under = (doc as Document & { elementFromPoint?: (x: number, y: number) => Element | null })
- .elementFromPoint
+ const under = (doc as Document & { elementFromPoint?: (x: number, y: number) => Element | null }).elementFromPoint
if (
typeof under === 'function' &&
diff --git a/apps/desktop/src/lib/preview-act/watch-in-page.test.ts b/apps/desktop/src/lib/preview-act/watch-in-page.test.ts
index b51c62b7f07..9d26f5df1d4 100644
--- a/apps/desktop/src/lib/preview-act/watch-in-page.test.ts
+++ b/apps/desktop/src/lib/preview-act/watch-in-page.test.ts
@@ -239,11 +239,31 @@ describe('watchInPage', () => {
const huge = document.createElement('button')
flush.getBoundingClientRect = () =>
- ({ bottom: 40, height: 40, left: 100, right: 300, toJSON: () => ({}), top: 0, width: 200, x: 100, y: 0 }) as DOMRect
+ ({
+ bottom: 40,
+ height: 40,
+ left: 100,
+ right: 300,
+ toJSON: () => ({}),
+ top: 0,
+ width: 200,
+ x: 100,
+ y: 0
+ }) as DOMRect
// Taller than the viewport: no room above it and none below it either, so
// the tab has nowhere left to go but inside.
huge.getBoundingClientRect = () =>
- ({ bottom: 900, height: 900, left: 100, right: 300, toJSON: () => ({}), top: 0, width: 200, x: 100, y: 0 }) as DOMRect
+ ({
+ bottom: 900,
+ height: 900,
+ left: 100,
+ right: 300,
+ toJSON: () => ({}),
+ top: 0,
+ width: 200,
+ x: 100,
+ y: 0
+ }) as DOMRect
document.body.append(roomy, flush, huge)
watchInPage(document, { field: [roomy, flush, huge] }, 'sweep')
@@ -266,7 +286,17 @@ describe('watchInPage', () => {
const edge = document.createElement('button')
edge.getBoundingClientRect = () =>
- ({ bottom: 140, height: 40, left: 990, right: 1020, toJSON: () => ({}), top: 100, width: 30, x: 990, y: 100 }) as DOMRect
+ ({
+ bottom: 140,
+ height: 40,
+ left: 990,
+ right: 1020,
+ toJSON: () => ({}),
+ top: 100,
+ width: 30,
+ x: 990,
+ y: 100
+ }) as DOMRect
document.body.append(inboard, edge)
watchInPage(document, { field: [inboard, edge] }, 'sweep')
diff --git a/apps/desktop/src/lib/preview-act/watch-in-page.ts b/apps/desktop/src/lib/preview-act/watch-in-page.ts
index 0395548d0db..0e1f8b1a8bc 100644
--- a/apps/desktop/src/lib/preview-act/watch-in-page.ts
+++ b/apps/desktop/src/lib/preview-act/watch-in-page.ts
@@ -71,17 +71,7 @@ export interface WatchHolder {
* - `hold` — promote the whole field to pins, so the scan stops decaying.
*/
export type WatchStage =
- | 'aim'
- | 'clear'
- | 'hold'
- | 'pin'
- | 'read'
- | 'rest'
- | 'strike'
- | 'strobe'
- | 'sweep'
- | 'think'
- | 'unpin'
+ 'aim' | 'clear' | 'hold' | 'pin' | 'read' | 'rest' | 'strike' | 'strobe' | 'sweep' | 'think' | 'unpin'
/** What a mark means. Everything else about it is shared. */
type WatchKind = 'candidate' | 'flash' | 'held' | 'hit' | 'lock'
@@ -607,10 +597,16 @@ export function watchInPage(doc: Document, holder: WatchHolder, stage: WatchStag
const beam = spec.kind === 'lock' ? (skin.firstElementChild as HTMLElement | null) : null
if (beam && typeof beam.animate === 'function') {
- beam.animate([{ opacity: 1, top: '-2px' }, { opacity: 1, top: '100%' }], {
- duration: dwell,
- easing: 'linear'
- })
+ beam.animate(
+ [
+ { opacity: 1, top: '-2px' },
+ { opacity: 1, top: '100%' }
+ ],
+ {
+ duration: dwell,
+ easing: 'linear'
+ }
+ )
}
}
@@ -774,6 +770,7 @@ export function watchInPage(doc: Document, holder: WatchHolder, stage: WatchStag
for (let node = el.firstChild; node; node = node.nextSibling) {
if (node.nodeType === 3 && (node.nodeValue || '').trim()) {
words = true
+
break
}
}
@@ -788,6 +785,7 @@ export function watchInPage(doc: Document, holder: WatchHolder, stage: WatchStag
while (up) {
if (bag.has(up)) {
inside = true
+
break
}
@@ -1013,6 +1011,7 @@ export function watchInPage(doc: Document, holder: WatchHolder, stage: WatchStag
// clump sizes and the picks are independent of each other. Read in a fixed
// order below: reordering these calls changes the sequence.
let seed = 0
+
const roll = () => {
const noise = Math.sin(++seed * 78.233) * 43758.5453
@@ -1026,7 +1025,7 @@ export function watchInPage(doc: Document, holder: WatchHolder, stage: WatchStag
// field it was going to rattle through instead.
outline(field, 'candidate', () => 0)
} else {
- for (let at = 0; at < burst; ) {
+ for (let at = 0; at < burst;) {
const clump = roll() < 0.62 ? 1 : roll() < 0.7 ? 2 : 3
for (let k = 0; k < clump; k++) {