Skip to content

The agent that grows with you

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

hermes-seaeye[bot]973b27f5c82f
diff --git a/apps/desktop/electron/api-expected-404.ts b/apps/desktop/electron/api-expected-404.ts
index da6c1258613..91482c3024e 100644
--- a/apps/desktop/electron/api-expected-404.ts
+++ b/apps/desktop/electron/api-expected-404.ts
@@ -26,7 +26,11 @@ function isExpectedNotFoundSentinel(value: unknown): value is Record<string, str
const keys = Object.keys(value as Record<string, unknown>)
- return keys.length === 1 && keys[0] === HERMES_API_EXPECTED_404 && typeof (value as any)[HERMES_API_EXPECTED_404] === 'string'
+ return (
+ keys.length === 1 &&
+ keys[0] === HERMES_API_EXPECTED_404 &&
+ typeof (value as any)[HERMES_API_EXPECTED_404] === 'string'
+ )
}
// Restore the caller-visible contract: a sentinel becomes the rejection the
diff --git a/apps/desktop/electron/backend-command.test.ts b/apps/desktop/electron/backend-command.test.ts
index e9ed91de33c..9beca7de082 100644
--- a/apps/desktop/electron/backend-command.test.ts
+++ b/apps/desktop/electron/backend-command.test.ts
@@ -109,6 +109,14 @@ test('serveBackendArgs drops a profile value that is not a valid profile id', ()
test('serveBackendArgs keeps a valid profile id pinned, normalized like the CLI', () => {
assert.deepEqual(serveBackendArgs('worker'), ['--profile', 'worker', 'serve', '--host', '127.0.0.1', '--port', '0'])
assert.deepEqual(serveBackendArgs('a-1_b'), ['--profile', 'a-1_b', 'serve', '--host', '127.0.0.1', '--port', '0'])
- assert.deepEqual(serveBackendArgs(' Worker '), ['--profile', 'worker', 'serve', '--host', '127.0.0.1', '--port', '0'])
+ assert.deepEqual(serveBackendArgs(' Worker '), [
+ '--profile',
+ 'worker',
+ 'serve',
+ '--host',
+ '127.0.0.1',
+ '--port',
+ '0'
+ ])
assert.deepEqual(serveBackendArgs('default'), ['--profile', 'default', 'serve', '--host', '127.0.0.1', '--port', '0'])
})
diff --git a/apps/desktop/electron/dashboard-web-dist.test.ts b/apps/desktop/electron/dashboard-web-dist.test.ts
index 5c0c5c15e56..69832d548a1 100644
--- a/apps/desktop/electron/dashboard-web-dist.test.ts
+++ b/apps/desktop/electron/dashboard-web-dist.test.ts
@@ -14,6 +14,7 @@ function touchIndex(dir) {
function withTempRoot(fn) {
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'hermes-dashboard-web-dist-'))
+
try {
return fn(root)
} finally {
@@ -24,6 +25,7 @@ function withTempRoot(fn) {
test('desktop-spawned dashboard resolves hermes_cli/web_dist, not Desktop renderer dist', () => {
withTempRoot(root => {
const activeHermesRoot = path.join(root, 'hermes-agent')
+
const desktopDist = path.join(
activeHermesRoot,
'apps',
@@ -34,6 +36,7 @@ test('desktop-spawned dashboard resolves hermes_cli/web_dist, not Desktop render
'app.asar.unpacked',
'dist'
)
+
const dashboardDist = path.join(activeHermesRoot, 'hermes_cli', 'web_dist')
touchIndex(desktopDist)
touchIndex(dashboardDist)
diff --git a/apps/desktop/electron/dashboard-web-dist.ts b/apps/desktop/electron/dashboard-web-dist.ts
index 7576b3fc777..9ec9b62edd1 100644
--- a/apps/desktop/electron/dashboard-web-dist.ts
+++ b/apps/desktop/electron/dashboard-web-dist.ts
@@ -30,6 +30,7 @@ function hasDashboardBundle(dir) {
function resolveDashboardWebDist(options: any = {}) {
const env = options.env || process.env
const override = env.HERMES_DESKTOP_DASHBOARD_WEB_DIST
+
if (override && directoryExists(path.resolve(override))) {
return path.resolve(override)
}
diff --git a/apps/desktop/electron/embed-referer.test.ts b/apps/desktop/electron/embed-referer.test.ts
index aaa69e075ef..a71ba31aa5a 100644
--- a/apps/desktop/electron/embed-referer.test.ts
+++ b/apps/desktop/electron/embed-referer.test.ts
@@ -33,9 +33,7 @@ vi.mock('electron', () => ({
}
}))
-const { installEmbedReferer, stampEmbedRefererHeaders, withEmbedRefererStamp } = await import(
- './embed-referer'
-)
+const { installEmbedReferer, stampEmbedRefererHeaders, withEmbedRefererStamp } = await import('./embed-referer')
function partitionListener(name: string): PartitionListener {
const listener = partitionListeners.get(name)
@@ -90,14 +88,8 @@ test('stampEmbedRefererHeaders leaves non-YouTube hosts completely untouched', (
assert.equal(stampEmbedRefererHeaders('https://example.com/video', original), original)
// Substring matches must not fool the host test either.
- assert.equal(
- stampEmbedRefererHeaders('https://notyoutube.com/embed/x', original),
- original
- )
- assert.equal(
- stampEmbedRefererHeaders('https://youtube.com.evil.io/embed/x', original),
- original
- )
+ assert.equal(stampEmbedRefererHeaders('https://notyoutube.com/embed/x', original), original)
+ assert.equal(stampEmbedRefererHeaders('https://youtube.com.evil.io/embed/x', original), original)
})
test('stampEmbedRefererHeaders tolerates unparseable URLs', () => {
@@ -112,7 +104,7 @@ test('installEmbedRefererForSession stamps through the session listener', () =>
const listener = partitionListener('persist:hermes-embed')
let result: { requestHeaders?: Record<string, string> } = {}
- listener({ url: YOUTUBE_HOSTS[1], requestHeaders: { Accept: '*/*' } }, (r) => {
+ listener({ url: YOUTUBE_HOSTS[1], requestHeaders: { Accept: '*/*' } }, r => {
result = r
})
@@ -130,7 +122,7 @@ test('withEmbedRefererStamp applies the stamp after the wrapped listener', () =>
})
let result: { requestHeaders?: Record<string, string> } = {}
- wrapped({ url: YOUTUBE_HOSTS[1], requestHeaders: { Accept: '*/*' } }, (r) => {
+ wrapped({ url: YOUTUBE_HOSTS[1], requestHeaders: { Accept: '*/*' } }, r => {
result = r
})
@@ -145,7 +137,7 @@ test('withEmbedRefererStamp preserves headers merged by the wrapped listener', (
})
let result: { requestHeaders?: Record<string, string> } = {}
- wrapped({ url: YOUTUBE_HOSTS[1], requestHeaders: { Accept: '*/*' } }, (r) => {
+ wrapped({ url: YOUTUBE_HOSTS[1], requestHeaders: { Accept: '*/*' } }, r => {
result = r
})
@@ -159,7 +151,7 @@ test('withEmbedRefererStamp leaves non-YouTube requests to the wrapped listener
})
let result: { requestHeaders?: Record<string, string> } | undefined
- wrapped({ url: 'https://gateway.internal/api', requestHeaders: { Accept: '*/*' } }, (r) => {
+ wrapped({ url: 'https://gateway.internal/api', requestHeaders: { Accept: '*/*' } }, r => {
result = r
})
diff --git a/apps/desktop/electron/embed-referer.ts b/apps/desktop/electron/embed-referer.ts
index c2e09e9d57b..1d3294972ab 100644
--- a/apps/desktop/electron/embed-referer.ts
+++ b/apps/desktop/electron/embed-referer.ts
@@ -11,10 +11,7 @@ const YOUTUBE_REFERER_HOST_RE =
* (player error 153). Chat embeds are plain iframes in the window session, and
* the production renderer loads from a file:// URL, so the browser sends none.
*/
-function stampEmbedRefererHeaders(
- url: string,
- headers: Record<string, string>
-): Record<string, string> {
+function stampEmbedRefererHeaders(url: string, headers: Record<string, string>): Record<string, string> {
let host = ''
try {
@@ -49,10 +46,7 @@ function withEmbedRefererStamp(
callback: (result: { requestHeaders?: Record<string, string> }) => void
) => void
) {
- return (
- details: EmbedRequestDetails,
- callback: (result: { requestHeaders?: Record<string, string> }) => void
- ) => {
+ return (details: EmbedRequestDetails, callback: (result: { requestHeaders?: Record<string, string> }) => void) => {
listener(details, result => {
if (result.requestHeaders) {
callback({ requestHeaders: stampEmbedRefererHeaders(details.url, result.requestHeaders) })
diff --git a/apps/desktop/electron/linux-gpu-fallback.test.ts b/apps/desktop/electron/linux-gpu-fallback.test.ts
index 79426f63523..fb38f1dc4e3 100644
--- a/apps/desktop/electron/linux-gpu-fallback.test.ts
+++ b/apps/desktop/electron/linux-gpu-fallback.test.ts
@@ -23,9 +23,11 @@ const LINUX = {
describe('parseLinuxGpuMarker', () => {
it('accepts a well-formed fallback marker', () => {
- expect(
- parseLinuxGpuMarker({ state: 'fallback', reason: 'gpu-launch-failure', version: '0.21.5' })
- ).toEqual({ state: 'fallback', reason: 'gpu-launch-failure', version: '0.21.5' })
+ expect(parseLinuxGpuMarker({ state: 'fallback', reason: 'gpu-launch-failure', version: '0.21.5' })).toEqual({
+ state: 'fallback',
+ reason: 'gpu-launch-failure',
+ version: '0.21.5'
+ })
})
it('rejects garbage', () => {
@@ -120,9 +122,7 @@ describe('decideLinuxGpuLaunch', () => {
it('stays off when software rendering is already forced', () => {
expect(decideLinuxGpuLaunch({ ...LINUX, remoteDisplayReason: 'ssh-session' }).enable).toBe(false)
expect(decideLinuxGpuLaunch({ ...LINUX, nvidiaFallbackActive: true }).enable).toBe(false)
- expect(
- decideLinuxGpuLaunch({ ...LINUX, argv: ['--disable-gpu'] }).reason
- ).toBe('already-enabled')
+ expect(decideLinuxGpuLaunch({ ...LINUX, argv: ['--disable-gpu'] }).reason).toBe('already-enabled')
})
})
@@ -163,12 +163,8 @@ describe('shouldRelaunchForLinuxGpuCrash', () => {
it('ignores non-GPU deaths and clean exits', () => {
const base = { platform: 'linux' as const, alreadySoftware: false, relaunchAttempted: false }
- expect(
- shouldRelaunchForLinuxGpuCrash({ ...base, details: { type: 'renderer', reason: 'crashed' } })
- ).toBe(false)
- expect(
- shouldRelaunchForLinuxGpuCrash({ ...base, details: { type: 'GPU', reason: 'clean-exit' } })
- ).toBe(false)
+ expect(shouldRelaunchForLinuxGpuCrash({ ...base, details: { type: 'renderer', reason: 'crashed' } })).toBe(false)
+ expect(shouldRelaunchForLinuxGpuCrash({ ...base, details: { type: 'GPU', reason: 'clean-exit' } })).toBe(false)
expect(shouldRelaunchForLinuxGpuCrash({ ...base, details: null })).toBe(false)
})
@@ -198,9 +194,11 @@ describe('linuxGpuMarkerAfterSuccessfulBoot', () => {
})
it('keeps the sticky fallback after a software-rendered boot', () => {
- expect(
- linuxGpuMarkerAfterSuccessfulBoot({ fallbackActive: true, appVersion: '0.21.5' })
- ).toEqual({ state: 'fallback', reason: 'gpu-launch-failure', version: '0.21.5' })
+ expect(linuxGpuMarkerAfterSuccessfulBoot({ fallbackActive: true, appVersion: '0.21.5' })).toEqual({
+ state: 'fallback',
+ reason: 'gpu-launch-failure',
+ version: '0.21.5'
+ })
})
it('round-trips the fallback marker helper', () => {
@@ -267,9 +265,7 @@ describe('linuxGpuChildDeathPath', () => {
})
it('ignores non-GPU deaths and other platforms', () => {
- expect(
- linuxGpuChildDeathPath({ platform: 'linux', details: { type: 'Renderer', reason: 'crashed' } })
- ).toBeNull()
+ expect(linuxGpuChildDeathPath({ platform: 'linux', details: { type: 'Renderer', reason: 'crashed' } })).toBeNull()
expect(linuxGpuChildDeathPath({ platform: 'darwin', details: SIGTERM_DEATH })).toBeNull()
expect(linuxGpuChildDeathPath({ platform: 'linux' })).toBeNull()
})
@@ -305,15 +301,15 @@ describe('disableGpuSwitchNeededForReason', () => {
describe('shouldEngageSilentGpuRetryFallback', () => {
it('engages only on Linux, after the grace window, with no GPU child, not already software', () => {
- expect(
- shouldEngageSilentGpuRetryFallback({ platform: 'linux', gpuChildPresent: false, graceElapsed: true })
- ).toBe(true)
- expect(
- shouldEngageSilentGpuRetryFallback({ platform: 'linux', gpuChildPresent: true, graceElapsed: true })
- ).toBe(false)
- expect(
- shouldEngageSilentGpuRetryFallback({ platform: 'linux', gpuChildPresent: false, graceElapsed: false })
- ).toBe(false)
+ expect(shouldEngageSilentGpuRetryFallback({ platform: 'linux', gpuChildPresent: false, graceElapsed: true })).toBe(
+ true
+ )
+ expect(shouldEngageSilentGpuRetryFallback({ platform: 'linux', gpuChildPresent: true, graceElapsed: true })).toBe(
+ false
+ )
+ expect(shouldEngageSilentGpuRetryFallback({ platform: 'linux', gpuChildPresent: false, graceElapsed: false })).toBe(
+ false
+ )
expect(
shouldEngageSilentGpuRetryFallback({
platform: 'linux',
@@ -322,8 +318,8 @@ describe('shouldEngageSilentGpuRetryFallback', () => {
alreadySoftware: true
})
).toBe(false)
- expect(
- shouldEngageSilentGpuRetryFallback({ platform: 'darwin', gpuChildPresent: false, graceElapsed: true })
- ).toBe(false)
+ expect(shouldEngageSilentGpuRetryFallback({ platform: 'darwin', gpuChildPresent: false, graceElapsed: true })).toBe(
+ false
+ )
})
})
diff --git a/apps/desktop/electron/linux-gpu-fallback.ts b/apps/desktop/electron/linux-gpu-fallback.ts
index ba3a8c2db62..101c66bccdf 100644
--- a/apps/desktop/electron/linux-gpu-fallback.ts
+++ b/apps/desktop/electron/linux-gpu-fallback.ts
@@ -343,6 +343,7 @@ export function linuxGpuChildDeathPath(options: {
}
const reason = String(options.details?.reason || '').toLowerCase()
+
const sandboxSignature =
options.details?.exitCode === GPU_CHILD_SANDBOX_SIGTERM_EXIT &&
String(options.details?.signalName || '').toUpperCase() === 'SIGTERM'
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index f68db9a42c8..41ae617cb86 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -12345,11 +12345,13 @@ async function runPoolBackendStart(
backend.args = await getBackendArgsForRuntime(backend)
assertPoolEntryStillOwned(poolKey, entry, backendPool, localBackendLifecycle.signal)
const hermesCwd = resolveHermesCwd()
+
const webDist = resolveDashboardWebDist({
activeHermesRoot: ACTIVE_HERMES_ROOT,
appRoot: APP_ROOT,
env: process.env
})
+
const readyFile = backend.readyFile ? makeDashboardReadyFile() : null
// Guard BEFORE the "Starting" line: a profile that only exists on a remote
@@ -13257,11 +13259,13 @@ async function runHermesStart({ supervisorRecovery = false }: { supervisorRecove
backend.args = await getBackendArgsForRuntime(backend)
backendConnectionState.assertCurrentAttempt(connectionAttempt)
const hermesCwd = resolveHermesCwd()
+
const webDist = resolveDashboardWebDist({
activeHermesRoot: ACTIVE_HERMES_ROOT,
appRoot: APP_ROOT,
env: process.env
})
+
const readyFile = backend.readyFile ? makeDashboardReadyFile() : null
await advanceBootProgress('backend.spawn', `Starting Hermes backend via ${backend.label}`, 84)
@@ -15575,11 +15579,7 @@ function createWindow() {
reloadUrl: rendererBaseUrl()
})
} else {
- loadWindowUrl(
- mainWindow,
- rendererBaseUrl(),
- 'Renderer'
- )
+ loadWindowUrl(mainWindow, rendererBaseUrl(), 'Renderer')
}
// Start the Python backend NOW, in parallel with the renderer load — not on
diff --git a/apps/desktop/electron/profile-id-guard.ts b/apps/desktop/electron/profile-id-guard.ts
index 83c4e108386..938519220bb 100644
--- a/apps/desktop/electron/profile-id-guard.ts
+++ b/apps/desktop/electron/profile-id-guard.ts
@@ -17,10 +17,13 @@ export function backendProfileArg(profile: unknown): string | null {
if (typeof profile !== 'string') {
return null
}
+
const name = profile.trim().toLowerCase()
+
if (!name) {
return null
}
+
// `default` is the RE-legal alias for ~/.hermes itself; every other id is a slug.
return name === 'default' || PROFILE_ID_ARG_RE.test(name) ? name : null
}
diff --git a/apps/desktop/electron/remote-lifecycle.test.ts b/apps/desktop/electron/remote-lifecycle.test.ts
index 38db8856d8e..a2b1463a7f0 100644
--- a/apps/desktop/electron/remote-lifecycle.test.ts
+++ b/apps/desktop/electron/remote-lifecycle.test.ts
@@ -964,7 +964,9 @@ test('buildSpawnCommand never pins a non-slug profile into the remote argv', ()
// The roster/SSH bridge hands the profile verbatim; a numeric id or display
// label must never cross into the remote serve argv, where the CLI used to
// str()-coerce it into a phantom profiles/0/ directory (#88842).
- const bad = buildSpawnCommand('/x/hermes', 0 as unknown as string, { logPath: spawnLogPath(OWNERSHIP_ID, SPAWN_NONCE) })
+ const bad = buildSpawnCommand('/x/hermes', 0 as unknown as string, {
+ logPath: spawnLogPath(OWNERSHIP_ID, SPAWN_NONCE)
+ })
assert.ok(!bad.includes('--profile'), 'a non-string profile must not be pinned')
const empty = buildSpawnCommand('/x/hermes', '', { logPath: spawnLogPath(OWNERSHIP_ID, SPAWN_NONCE) })
diff --git a/apps/desktop/electron/remote-lifecycle.ts b/apps/desktop/electron/remote-lifecycle.ts
index 66893f1223e..ca601748830 100644
--- a/apps/desktop/electron/remote-lifecycle.ts
+++ b/apps/desktop/electron/remote-lifecycle.ts
@@ -1157,6 +1157,7 @@ function buildSpawnCommand(hermesPath, profile, opts: any = {}) {
// phantom profiles/0/ directory (#88842).
const pinned = backendProfileArg(profile)
const profileArgs = pinned ? `--profile ${shq(pinned)} ` : ''
+
// The lockfile the spawn script publishes must carry the SAME normalized
// profile as the argv: pidIsOurDashboard and the managed-update drain both
// prove ownership by comparing the live `--profile` value against
@@ -1164,6 +1165,7 @@ function buildSpawnCommand(hermesPath, profile, opts: any = {}) {
if (opts.lockMetadata && opts.lockMetadata.profile !== (pinned ?? '')) {
opts.lockMetadata = { ...opts.lockMetadata, profile: pinned ?? '' }
}
+
const logPath = expandRemotePath(opts.logPath)
const tokenFilePath = opts.tokenFilePath
const tokenArg = tokenFilePath ? ` --ssh-session-token-file ${expandRemotePath(tokenFilePath)}` : ''
diff --git a/apps/desktop/electron/translucency.ts b/apps/desktop/electron/translucency.ts
index 42e9e646ad4..c46466e769e 100644
--- a/apps/desktop/electron/translucency.ts
+++ b/apps/desktop/electron/translucency.ts
@@ -89,9 +89,7 @@ export function windowBackgroundMaterialOptions(
isWindows: boolean,
glassSupported: boolean
): { backgroundMaterial?: WindowsBackgroundMaterial } {
- return isWindows && glassSupported && glassActive(state)
- ? { backgroundMaterial: backgroundMaterialFor(state) }
- : {}
+ return isWindows && glassSupported && glassActive(state) ? { backgroundMaterial: backgroundMaterialFor(state) } : {}
}
/**
diff --git a/apps/desktop/electron/window-state.test.ts b/apps/desktop/electron/window-state.test.ts
index a2efa4e0b94..e6561f6d36e 100644
--- a/apps/desktop/electron/window-state.test.ts
+++ b/apps/desktop/electron/window-state.test.ts
@@ -70,7 +70,10 @@ test('sanitizeWindowState treats isMaximized strictly', () => {
})
test('sanitizeWindowState treats boundsCapturedFullScreen strictly and stays optional', () => {
- assert.equal(sanitizeWindowState({ width: 1400, height: 900, boundsCapturedFullScreen: true }).boundsCapturedFullScreen, true)
+ assert.equal(
+ sanitizeWindowState({ width: 1400, height: 900, boundsCapturedFullScreen: true }).boundsCapturedFullScreen,
+ true
+ )
assert.equal(
sanitizeWindowState({ width: 1400, height: 900, boundsCapturedFullScreen: 'yes' }).boundsCapturedFullScreen,
undefined
@@ -146,6 +149,7 @@ test('computeWindowOptions recovers stale fullscreen normal bounds to a centered
isMaximized: false,
boundsCapturedFullScreen: true
})
+
assert.deepEqual(computeWindowOptions(saved, PRIMARY, 'win32'), { width: 1536, height: 832 })
})
@@ -159,7 +163,9 @@ test('computeWindowOptions recovers a legacy exact-work-area snapshot written be
test('computeWindowOptions recovers a legacy snapshot matching the full display bounds', () => {
// A fullscreen window over a hidden taskbar reports the display's full
// bounds, not the work area. Still an exact match, so still recovered.
- const displays = [{ workArea: { x: 0, y: 0, width: 1920, height: 1040 }, bounds: { x: 0, y: 0, width: 1920, height: 1080 } }]
+ const displays = [
+ { workArea: { x: 0, y: 0, width: 1920, height: 1040 }, bounds: { x: 0, y: 0, width: 1920, height: 1080 } }
+ ]
const saved = sanitizeWindowState({ x: 0, y: 0, width: 1920, height: 1080, isMaximized: false })
assert.deepEqual(computeWindowOptions(saved, displays, 'win32'), { width: 1536, height: 832 })
})
diff --git a/apps/desktop/electron/window-state.ts b/apps/desktop/electron/window-state.ts
index 3ede99773ed..6a7497037e3 100644
--- a/apps/desktop/electron/window-state.ts
+++ b/apps/desktop/electron/window-state.ts
@@ -210,9 +210,11 @@ function computeWindowOptions(state: WindowOptions, displays, platform = process
// layouts from tiling WMs or user placement on macOS/Linux. This early return
// intentionally omits stale x/y so Electron centers the recovered window.
const staleWorkArea = platform === 'win32' ? staleFullscreenWorkArea(state, displays) : null
+
if (staleWorkArea) {
opts.width = clamp(Math.round(staleWorkArea.width * RECOVERED_WINDOW_RATIO), MIN_WIDTH, staleWorkArea.width)
opts.height = clamp(Math.round(staleWorkArea.height * RECOVERED_WINDOW_RATIO), MIN_HEIGHT, staleWorkArea.height)
+
return opts
}
diff --git a/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.ts b/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.ts
index aea92656040..47b42ee14fa 100644
--- a/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.ts
+++ b/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.ts
@@ -7,7 +7,12 @@ import { isSlashCommandText } from '@/lib/chat-runtime'
import { isSideTaskSlashCommand } from '@/lib/desktop-slash-commands'
import { triggerHaptic } from '@/lib/haptics'
import { hasClarifyRequest, skipClarifyRequest } from '@/store/clarify'
-import { clearSessionDraft, type ComposerAttachment, freezeComposerTransportPayload, isFreshDraftScope } from '@/store/composer'
+import {
+ clearSessionDraft,
+ type ComposerAttachment,
+ freezeComposerTransportPayload,
+ isFreshDraftScope
+} from '@/store/composer'
import { resetBrowseState } from '@/store/composer-input-history'
import { enqueueQueuedPrompt, type QueuedPromptEntry } from '@/store/composer-queue'
import { hasConnectionRequest, skipConnectionRequest } from '@/store/connection-request'
diff --git a/apps/desktop/src/app/chat/preview-tile.test.ts b/apps/desktop/src/app/chat/preview-tile.test.ts
index b19fe9c203c..b5fe50d494f 100644
--- a/apps/desktop/src/app/chat/preview-tile.test.ts
+++ b/apps/desktop/src/app/chat/preview-tile.test.ts
@@ -186,14 +186,15 @@ describe('preview tiles mirror the visible session tabs', () => {
return { model, preview, session, tree }
}
- const htmlTarget = (path: string) => ({
- kind: 'file',
- label: path.split('/').at(-1) ?? path,
- path,
- previewKind: 'html',
- source: path,
- url: `file://${path}`
- }) as const
+ const htmlTarget = (path: string) =>
+ ({
+ kind: 'file',
+ label: path.split('/').at(-1) ?? path,
+ path,
+ previewKind: 'html',
+ source: path,
+ url: `file://${path}`
+ }) as const
it('renders only the focused session previews, pinning spans sessions', async () => {
const { preview, session, tree } = await setup()
diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/desktop-bridge.reaction.test.ts b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/desktop-bridge.reaction.test.ts
index 8427499f8b9..80d7d5deaa9 100644
--- a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/desktop-bridge.reaction.test.ts
+++ b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/desktop-bridge.reaction.test.ts
@@ -68,13 +68,13 @@ describe('message.reaction bridge session scope', () => {
const updater = vi.mocked(setMessages).mock.calls[0][0]
- if (typeof updater !== 'function') {throw new Error('expected an updater function')}
+ if (typeof updater !== 'function') {
+ throw new Error('expected an updater function')
+ }
const optimistic = { id: 'm1', role: 'assistant', rowId: undefined }
const next = updater([optimistic] as never)
- expect(next).toEqual([
- { ...optimistic, rowId: 4242, reactions: AGENT_THUMBS_UP }
- ])
+ expect(next).toEqual([{ ...optimistic, rowId: 4242, reactions: AGENT_THUMBS_UP }])
expect(recordAgentReaction).toHaveBeenCalledWith(4242, AGENT_THUMBS_UP, 'conn:conn-a::default')
})
@@ -83,7 +83,9 @@ describe('message.reaction bridge session scope', () => {
const updater = vi.mocked(setMessages).mock.calls[0][0]
- if (typeof updater !== 'function') {throw new Error('expected an updater function')}
+ if (typeof updater !== 'function') {
+ throw new Error('expected an updater function')
+ }
const durable = { id: 'm1', role: 'assistant', rowId: 4242 }
const optimistic = { id: 'm2', role: 'assistant', rowId: undefined }
const next = updater([durable, optimistic] as never)
diff --git a/apps/desktop/src/app/session/hooks/use-session-actions/index.ts b/apps/desktop/src/app/session/hooks/use-session-actions/index.ts
index 72f75fe1cc6..2ec6f6a6f68 100644
--- a/apps/desktop/src/app/session/hooks/use-session-actions/index.ts
+++ b/apps/desktop/src/app/session/hooks/use-session-actions/index.ts
@@ -2954,7 +2954,16 @@ export function useSessionActions({
action: {
label: t.common.retry,
onClick: () => {
- void forkBranch(branchMessages, sourceSessionId, parentStoredId, cwd, profile, branchCount, ownerRoute, key)
+ void forkBranch(
+ branchMessages,
+ sourceSessionId,
+ parentStoredId,
+ cwd,
+ profile,
+ branchCount,
+ ownerRoute,
+ key
+ )
}
}
})
diff --git a/apps/desktop/src/app/shell/hooks/use-context-breakdown.test.ts b/apps/desktop/src/app/shell/hooks/use-context-breakdown.test.ts
index b68c9212f6b..dc3c734be4d 100644
--- a/apps/desktop/src/app/shell/hooks/use-context-breakdown.test.ts
+++ b/apps/desktop/src/app/shell/hooks/use-context-breakdown.test.ts
@@ -92,6 +92,7 @@ describe('useContextBreakdown (#94001)', () => {
const requestGatewaySlow = vi.fn(
(_method: string) => deferred<ContextBreakdown>().promise
) as unknown as GatewayRequester
+
rerender({ busy: false, enabled: true, requestGateway: requestGatewaySlow, sessionId: 's3' })
expect(result.current.breakdown).toBeNull()
@@ -177,6 +178,7 @@ describe('useContextBreakdown (#94001)', () => {
it('does not cache a zeroed breakdown (agentless window) and retries until a live agent answers', async () => {
let zeroed = true
+
const requestGateway = vi.fn(async () =>
zeroed ? ZEROED_BREAKDOWN : LIVE_BREAKDOWN
) as unknown as GatewayRequester
diff --git a/apps/desktop/src/components/assistant-ui/embeds/mermaid-render-cache.test.ts b/apps/desktop/src/components/assistant-ui/embeds/mermaid-render-cache.test.ts
index a28037340db..53e989e4fce 100644
--- a/apps/desktop/src/components/assistant-ui/embeds/mermaid-render-cache.test.ts
+++ b/apps/desktop/src/components/assistant-ui/embeds/mermaid-render-cache.test.ts
@@ -251,16 +251,19 @@ describe('nextPaint', () => {
const raf = globalThis.requestAnimationFrame
vi.stubGlobal('requestAnimationFrame', (callback: FrameRequestCallback) => {
frames.push(callback)
+
return frames.length
})
try {
let admitted = false
+
const cache = createMermaidRenderCache({
maxEntries: 2,
defer: nextPaint,
render: async () => {
admitted = true
+
return '<svg>ok</svg>'
}
})
@@ -272,6 +275,7 @@ describe('nextPaint', () => {
await expect(pending).resolves.toBe('<svg>ok</svg>')
} finally {
vi.unstubAllGlobals()
+
if (raf) {
globalThis.requestAnimationFrame = raf
}
diff --git a/apps/desktop/src/components/chat/shiki-highlighter.test.tsx b/apps/desktop/src/components/chat/shiki-highlighter.test.tsx
index cf5f57afd1b..27b8703a94c 100644
--- a/apps/desktop/src/components/chat/shiki-highlighter.test.tsx
+++ b/apps/desktop/src/components/chat/shiki-highlighter.test.tsx
@@ -35,11 +35,14 @@ import { LazyShiki } from './shiki-highlighter'
afterEach(cleanup)
const MESSAGE = [
- '# Deploy checklist', '',
- 'Run the migration before swapping traffic:', '',
+ '# Deploy checklist',
+ '',
+ 'Run the migration before swapping traffic:',
+ '',
'```bash',
'psql -f migrate.sql',
- '```', '',
+ '```',
+ '',
'Then watch the logs until the pool is warm.'
].join('\n')
@@ -92,9 +95,7 @@ describe('a reply survives a failed shiki-block chunk load (#95995)', () => {
const spy = vi.spyOn(console, 'error').mockImplementation(() => undefined)
try {
- expect(() => render(<LazyShiki code="const a = 1" language="typescript" />)).toThrow(
- 'grammar tokenizer exploded'
- )
+ expect(() => render(<LazyShiki code="const a = 1" language="typescript" />)).toThrow('grammar tokenizer exploded')
} finally {
spy.mockRestore()
chunkError.message =
diff --git a/apps/desktop/src/lib/inflight-turn-journal.test.ts b/apps/desktop/src/lib/inflight-turn-journal.test.ts
index 79deaa49e05..45f82b76bb7 100644
--- a/apps/desktop/src/lib/inflight-turn-journal.test.ts
+++ b/apps/desktop/src/lib/inflight-turn-journal.test.ts
@@ -832,7 +832,7 @@ describe('mid-turn redirect corrections', () => {
})
describe('purgeInFlightTurnJournals', () => {
- it('clears a busy session\'s journaled tail from localStorage (delete must reach the local copy)', () => {
+ it("clears a busy session's journaled tail from localStorage (delete must reach the local copy)", () => {
persistInFlightTurnState(journalState())
vi.advanceTimersByTime(400)
diff --git a/apps/desktop/src/lib/markdown-preprocess.ts b/apps/desktop/src/lib/markdown-preprocess.ts
index fa67ea2626f..203cd1df8ec 100644
--- a/apps/desktop/src/lib/markdown-preprocess.ts
+++ b/apps/desktop/src/lib/markdown-preprocess.ts
@@ -212,6 +212,7 @@ const SOURCE_LIST_ENTRY_RE = /^[ \t]*(?:[-*+][ \t]+)?\[((?:\d+(?:\s*,\s*\d+)*))\
// section — the same toggle the bundled skill uses to drop fenced code from
// a draft's prose.
const FENCE_TOGGLE_RE = /^[ \t]*(?:```|~~~)/
+
// Markdown links whose target is a filesystem path on the agent's machine:
// `[report](/home/user/report.md)`, `[notes](file:///srv/notes.txt)`,
// `[todo](~/todo.md)`, `[log](C:\logs\run.txt)`. Negative lookbehind keeps
diff --git a/apps/desktop/src/plugins/hermes-bots/group-chat-view.wrap.test.tsx b/apps/desktop/src/plugins/hermes-bots/group-chat-view.wrap.test.tsx
index 3c410493f79..9bc08a5c01a 100644
--- a/apps/desktop/src/plugins/hermes-bots/group-chat-view.wrap.test.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/group-chat-view.wrap.test.tsx
@@ -82,9 +82,7 @@ it('soft-wraps fenced code in room message bodies instead of scrolling sideways'
$groupChats.set({ Room: { log, watermarks: {}, sessions: {} } })
- const { container } = render(
- <GroupChatWorkspace group="Room" members={[{ name: 'builder' }] as never} />
- )
+ const { container } = render(<GroupChatWorkspace group="Room" members={[{ name: 'builder' }] as never} />)
const body = container.querySelector('[data-slot="group-chat-message-content"]')!
expect(body).toBeTruthy()
diff --git a/apps/desktop/src/store/preview.test.ts b/apps/desktop/src/store/preview.test.ts
index 1bac19bbb3a..19629e5edee 100644
--- a/apps/desktop/src/store/preview.test.ts
+++ b/apps/desktop/src/store/preview.test.ts
@@ -424,7 +424,12 @@ describe('preview session scoping', () => {
const aTab = $previewTabs.get().find(tab => tab.target.path === '/work/a.html')
setPreviewTabPinned(aTab!.id, true)
- expect($visiblePreviewTabs.get().map(tab => tab.target.path).sort()).toEqual(['/work/a.html', '/work/b.html'])
+ expect(
+ $visiblePreviewTabs
+ .get()
+ .map(tab => tab.target.path)
+ .sort()
+ ).toEqual(['/work/a.html', '/work/b.html'])
// Unpinning hides it from the other session again.
setPreviewTabPinned(aTab!.id, false)
diff --git a/apps/desktop/src/store/preview.ts b/apps/desktop/src/store/preview.ts
index e3c55b28091..e06e0570f4b 100644
--- a/apps/desktop/src/store/preview.ts
+++ b/apps/desktop/src/store/preview.ts
@@ -380,12 +380,8 @@ if (typeof window !== 'undefined') {
* layout-tree mirror renders only these, so a session switch swaps the drawer
* and pinned tabs are the explicit cross-session workspace. While no session
* exists (a fresh draft), ownerless tabs stay visible. */
-export const $visiblePreviewTabs = computed(
- [$previewTabs, $focusedStoredSessionId],
- (tabs, sessionId) =>
- tabs.filter(
- tab => tab.pinned || tab.sessionId === sessionId || (sessionId == null && tab.sessionId == null)
- )
+export const $visiblePreviewTabs = computed([$previewTabs, $focusedStoredSessionId], (tabs, sessionId) =>
+ tabs.filter(tab => tab.pinned || tab.sessionId === sessionId || (sessionId == null && tab.sessionId == null))
)
// A fresh draft has no session yet, so tabs opened there are ownerless — adopt
@@ -777,7 +773,7 @@ export function openPreview(target: PreviewTarget) {
// The id is derived from the FINAL session id so the two can never split.
const tabSessionId =
existing?.sessionId == null || existing.pinned || existing.sessionId === sessionId
- ? existing?.sessionId ?? sessionId
+ ? (existing?.sessionId ?? sessionId)
: sessionId
const tab: PreviewTab = {
@@ -789,7 +785,9 @@ export function openPreview(target: PreviewTarget) {
const replaceIndex = existing ? current.indexOf(existing) : -1
- $previewTabs.set(replaceIndex === -1 ? [...current, tab] : current.map((item, i) => (i === replaceIndex ? tab : item)))
+ $previewTabs.set(
+ replaceIndex === -1 ? [...current, tab] : current.map((item, i) => (i === replaceIndex ? tab : item))
+ )
noteExplicitPreviewOpen(tab.id)
// Select the row's FINAL id: when a pinned row is reused from another
// session, the id keeps the owner's session, so the pre-computed id would
diff --git a/apps/desktop/src/store/reactions-local.test.ts b/apps/desktop/src/store/reactions-local.test.ts
index ac4517011c6..82ab3906750 100644
--- a/apps/desktop/src/store/reactions-local.test.ts
+++ b/apps/desktop/src/store/reactions-local.test.ts
@@ -28,8 +28,7 @@ vi.mock('@/store/profile', async () => {
vi.mock('@/store/reactions', () => ({
QUICK_REACTIONS: ['❤️'],
- applyReaction: (_list: unknown, emoji: null | string, author: string) =>
- emoji ? [{ author, emoji }] : []
+ applyReaction: (_list: unknown, emoji: null | string, author: string) => (emoji ? [{ author, emoji }] : [])
}))
vi.mock('@/store/session', async () => {
@@ -136,9 +135,9 @@ describe('live reaction overlay scope', () => {
const persistedForB: MessageReaction[] = [{ at: 0, author: 'agent', emoji: '😴' }]
expect(agentLiveReactions($agentReactions.get(), 4242, SOURCE_B)).toBeUndefined()
- expect(
- mergeReactions(persistedForB, undefined, agentLiveReactions($agentReactions.get(), 4242, SOURCE_B))
- ).toEqual(persistedForB)
+ expect(mergeReactions(persistedForB, undefined, agentLiveReactions($agentReactions.get(), 4242, SOURCE_B))).toEqual(
+ persistedForB
+ )
// The owning source still sees its live overlay.
expect(agentLiveReactions($agentReactions.get(), 4242, SOURCE_A)).toEqual(AGENT_THUMBS_UP)
})
diff --git a/apps/desktop/src/store/session.ts b/apps/desktop/src/store/session.ts
index 2fc134d60fd..5a323aa89cb 100644
--- a/apps/desktop/src/store/session.ts
+++ b/apps/desktop/src/store/session.ts
@@ -659,11 +659,9 @@ export function mergeSessionPage(
// root so a mid-turn refresh can't drop a touchSessionActivity bump.
const prevByLineage = new Map(previous.map(session => [lineageIdentity(session), session]))
-
const merged = incoming
.filter(session => !session.is_internal_child)
.map(session => {
-
const prev = prevById.get(identity(session)) ?? prevByLineage.get(lineageIdentity(session))
// User-send stamps last_active before the DB flushes the user row
// (last_active = MAX(messages.timestamp)). Keep the fresher of the two.
diff --git a/apps/desktop/src/themes/backend-sync.ts b/apps/desktop/src/themes/backend-sync.ts
index b032ed09c23..b3189c15343 100644
--- a/apps/desktop/src/themes/backend-sync.ts
+++ b/apps/desktop/src/themes/backend-sync.ts
@@ -111,10 +111,7 @@ export function ingestBackendSkin(skin: HermesSkin | undefined | null, { apply }
? String((skin as HermesSkin).description).trim() || theme.description
: theme.description
- const label =
- name === 'default'
- ? 'Classic Hermes'
- : theme.label
+ const label = name === 'default' ? 'Classic Hermes' : theme.label
const registered = { ...theme, description, label }
diff --git a/apps/desktop/src/themes/context.test.tsx b/apps/desktop/src/themes/context.test.tsx
index 482dc35aba1..a14664f5a60 100644
--- a/apps/desktop/src/themes/context.test.tsx
+++ b/apps/desktop/src/themes/context.test.tsx
@@ -58,9 +58,11 @@ describe('ThemeProvider ← backend skin sync', () => {
render(
<ThemeProvider>
- <ThemeProbe onReady={api => {
- latest = api
- }} />
+ <ThemeProbe
+ onReady={api => {
+ latest = api
+ }}
+ />
</ThemeProvider>
)
@@ -80,9 +82,7 @@ describe('ThemeProvider ← backend skin sync', () => {
expect(latest!.themeName).toBe('default')
expect(latest!.themeName).not.toBe(DEFAULT_SKIN_NAME)
expect(latest!.theme.label.toLowerCase()).toContain('classic hermes')
- expect(latest!.availableThemes.some(t => t.name === 'default' && t.label === 'Classic Hermes')).toBe(
- true
- )
+ expect(latest!.availableThemes.some(t => t.name === 'default' && t.label === 'Classic Hermes')).toBe(true)
// Classic gold palette reaches CSS (ui_accent / ui_text → primary / foreground).
// Light-mode derivation may mix the navy background; accent/text stay gold.
expect(cssVar('--theme-foreground').toLowerCase()).toBe('#fff8dc')