Skip to content

The agent that grows with you

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

hermes-seaeye[bot]36b0a96dcb8b
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index a59d4629b88..4b339db9b29 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -1401,6 +1401,7 @@ const profileDeletionGate = new ProfileDeletionGate()
// exist while a non-primary profile is actively being chatted through.
const POOL_MAX_BACKENDS = Math.max(1, Number(process.env.HERMES_DESKTOP_POOL_MAX) || 3)
const POOL_IDLE_MS = Math.max(60_000, Number(process.env.HERMES_DESKTOP_POOL_IDLE_MS) || 10 * 60_000)
+
// A backend touched within this window has a live renderer socket (the keepalive
// pings every 60s for every open profile). LRU eviction must spare these — a
// concurrent multi-profile session keeps several backends "fresh" at once, and
@@ -1426,6 +1427,7 @@ const POOL_KEEPALIVE_FRESH_MS = Math.max(
120_000,
Number(process.env.HERMES_DESKTOP_POOL_KEEPALIVE_FRESH_MS) || 4 * 60_000
)
+
let poolIdleReaper = null
let backendOrphanReapPromise = null
// Auto-reload budget for renderer crashes, shared by EVERY window (primary,
diff --git a/apps/desktop/src/app/gateway/hooks/use-gateway-request.test.ts b/apps/desktop/src/app/gateway/hooks/use-gateway-request.test.ts
index 54954034100..5173a500149 100644
--- a/apps/desktop/src/app/gateway/hooks/use-gateway-request.test.ts
+++ b/apps/desktop/src/app/gateway/hooks/use-gateway-request.test.ts
@@ -372,6 +372,7 @@ describe('useGatewayRequest', () => {
connectionState: 'closed',
request: vi.fn().mockRejectedValue(new Error('connection closed'))
} as unknown as HermesGateway
+
const getConnection = vi.fn(() => new Promise(() => undefined))
;(window as unknown as { hermesDesktop: unknown }).hermesDesktop = { getConnection }
diff --git a/apps/desktop/src/app/gateway/hooks/use-gateway-request.ts b/apps/desktop/src/app/gateway/hooks/use-gateway-request.ts
index 448e1903546..e2da17bc347 100644
--- a/apps/desktop/src/app/gateway/hooks/use-gateway-request.ts
+++ b/apps/desktop/src/app/gateway/hooks/use-gateway-request.ts
@@ -84,8 +84,10 @@ export function useGatewayRequest() {
RECONNECT_ATTEMPT_TIMEOUT_MS,
'Timed out reconnecting to Hermes backend'
)
+
connectionRef.current = conn
setConnection(conn)
+
// Re-mint the WS URL before reconnecting. OAuth tickets are single-use
// and short-lived, so the cached conn.wsUrl ticket is dead here;
// resolveGatewayWsUrl() never connects with a stale ticket. An explicit
@@ -97,6 +99,7 @@ export function useGatewayRequest() {
RECONNECT_ATTEMPT_TIMEOUT_MS,
'Timed out re-minting the gateway WebSocket URL'
)
+
await existing.connect(wsUrl)
return existing
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index 3ac7ca162b6..1bbe575888a 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -1015,7 +1015,8 @@ export const zh: Translations = {
},
managedUpdates: {
title: '托管更新',
- intro: '以事务方式更新由桌面端托管的 SSH 安装:先排空会话,再更新远端检出,最后恢复每个 profile,并生成关联回执。',
+ intro:
+ '以事务方式更新由桌面端托管的 SSH 安装:先排空会话,再更新远端检出,最后恢复每个 profile,并生成关联回执。',
sshConnection: '桌面端托管的 SSH 安装',
update: '更新',
updating: '更新中…',
diff --git a/apps/desktop/src/lib/model-options.test.ts b/apps/desktop/src/lib/model-options.test.ts
index 41a634feae1..7c46948571c 100644
--- a/apps/desktop/src/lib/model-options.test.ts
+++ b/apps/desktop/src/lib/model-options.test.ts
@@ -222,11 +222,13 @@ describe('manualPickRemoved', () => {
describe('reconcileSelectionAfterCatalogRefresh', () => {
const zhipu = { name: '智谱2', slug: 'zhipu', models: ['glm-4.5-air', 'glm-5-turbo'] }
+
const bytea = {
name: '字节A',
slug: 'byteplus',
models: ['deepseek-v4-flash', 'doubao-seed-2.0-pro']
}
+
const moa = { name: 'Mixture of Agents', slug: 'moa', models: ['default'] }
it('switches to the first new-group model when the current pick is gone', () => {
diff --git a/apps/desktop/src/lib/voice-playback.ts b/apps/desktop/src/lib/voice-playback.ts
index 02814b678ff..0efb99c631f 100644
--- a/apps/desktop/src/lib/voice-playback.ts
+++ b/apps/desktop/src/lib/voice-playback.ts
@@ -156,6 +156,7 @@ export async function resolveSpeakStreamUrl(): Promise<null | string> {
RECONNECT_ATTEMPT_TIMEOUT_MS,
`Timed out re-minting the gateway WebSocket URL for profile "${profile}"`
)
+
const url = new URL(wsUrl)
if (!url.pathname.endsWith('/api/ws')) {
diff --git a/apps/desktop/src/sdk/profile-routing.test.ts b/apps/desktop/src/sdk/profile-routing.test.ts
index a06df3cbb9d..72f906cc016 100644
--- a/apps/desktop/src/sdk/profile-routing.test.ts
+++ b/apps/desktop/src/sdk/profile-routing.test.ts
@@ -104,8 +104,7 @@ vi.mock('@/store/gateway', async () => {
}
})
-const { BOT_CHAT_SESSION_HYDRATION_TIMEOUT_MS, DEFAULT_SESSION_HYDRATION_TIMEOUT_MS, host } =
- await import('./index')
+const { BOT_CHAT_SESSION_HYDRATION_TIMEOUT_MS, DEFAULT_SESSION_HYDRATION_TIMEOUT_MS, host } = await import('./index')
const { openSession: openSessionCore } = await import('@/app/open-session')
const { deleteProfile, hermesApi } = await import('@/hermes')
diff --git a/apps/desktop/src/store/gateway-activation-prune-lease.test.ts b/apps/desktop/src/store/gateway-activation-prune-lease.test.ts
index d2fc190d8b6..184f75f5ed9 100644
--- a/apps/desktop/src/store/gateway-activation-prune-lease.test.ts
+++ b/apps/desktop/src/store/gateway-activation-prune-lease.test.ts
@@ -94,7 +94,6 @@ afterEach(() => {
delete (window as unknown as { hermesDesktop?: unknown }).hermesDesktop
})
-
// Flush microtasks until the dial registers its secondary (or bail). The dial
// path's hop count is an implementation detail — #95343's withTimeout wrapper
// added an await hop and broke the previous exactly-two-Promise.resolve flush.
diff --git a/apps/desktop/src/store/gateway.test.ts b/apps/desktop/src/store/gateway.test.ts
index f92dec3b0b4..ae30501d001 100644
--- a/apps/desktop/src/store/gateway.test.ts
+++ b/apps/desktop/src/store/gateway.test.ts
@@ -288,6 +288,7 @@ describe('secondary connection timeout (#93454)', () => {
vi.useFakeTimers()
let callCount = 0
+
const getConnection = vi.fn(({ profile }: { profile: string }) => {
callCount += 1
@@ -319,6 +320,7 @@ describe('secondary connection timeout (#93454)', () => {
vi.useFakeTimers()
let callCount = 0
+
const getConnection = vi.fn(({ profile }: { profile: string }) => {
callCount += 1