Skip to content

The agent that grows with you

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

hermes-seaeye[bot]5458de948379
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index 61f8093aca9..9878938485d 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -16139,165 +16139,167 @@ async function enumerateRegistryAgentSources(registry = readDesktopConnectionsRe
}
}
- return withoutInteractiveOauthLogin(() => Promise.all(
- registry.connections.map(async connection => {
- let sourceFailureDetail = ''
-
- let raw: {
- connection: typeof connection
- error?: string
- needsSignIn?: boolean
- installId?: string
- profiles: null | string[]
- profileMetadata?: Record<string, RosterProfileMetadata>
- }
-
- try {
- // SSH roster listing must never spawn a dashboard. A stale
- // sshConnections key used to fall into ensureRegistryBackend and
- // respawn Spark/Mini every Bot Mode poll (~5s), then the mux died
- // (ECONNRESET / liveness probe drop).
- if (connection.kind === 'ssh') {
- await probeSshProfileInventory(connection)
- // The inventory probe learns the backend's install id on its own session; carrying it
- // here is what lets two ssh addresses for one machine collapse to one row.
- raw = {
- connection,
- profiles: null,
- error: 'connect-on-demand',
- installId: connectionInstallIds.get(connection.id)?.id
- }
- } else {
- // Same connect-on-demand courtesy for the forced-local path: when
- // the primary route is remote, enumerating "This device" would
- // SPAWN a local backend this user has never asked for — a phantom
- // `default` agent that also forces -device handle disambiguation
- // onto the real one (remote-gateway-only desktops showed their main
- // agent twice, Aug 17 2026). Enumerate the local source only when
- // it is the delegate route (local-primary desktops, unchanged
- // behavior) or a forced-local child is ALREADY pooled (the user
- // opened one).
- if (connection.kind === 'local') {
- const localRoute = resolveRegistryLocalRoute('default', {
- globalRemote: globalRemoteActive(),
- profileRemoteOverride: Boolean(profileHasRemoteOverride(primaryProfileKey()))
- })
+ return withoutInteractiveOauthLogin(() =>
+ Promise.all(
+ registry.connections.map(async connection => {
+ let sourceFailureDetail = ''
+
+ let raw: {
+ connection: typeof connection
+ error?: string
+ needsSignIn?: boolean
+ installId?: string
+ profiles: null | string[]
+ profileMetadata?: Record<string, RosterProfileMetadata>
+ }
- if (shouldDeferLocalEnumeration(localRoute, backendPool.keys(), connection.id)) {
- return { connection, profiles: null, error: 'connect-on-demand' }
+ try {
+ // SSH roster listing must never spawn a dashboard. A stale
+ // sshConnections key used to fall into ensureRegistryBackend and
+ // respawn Spark/Mini every Bot Mode poll (~5s), then the mux died
+ // (ECONNRESET / liveness probe drop).
+ if (connection.kind === 'ssh') {
+ await probeSshProfileInventory(connection)
+ // The inventory probe learns the backend's install id on its own session; carrying it
+ // here is what lets two ssh addresses for one machine collapse to one row.
+ raw = {
+ connection,
+ profiles: null,
+ error: 'connect-on-demand',
+ installId: connectionInstallIds.get(connection.id)?.id
+ }
+ } else {
+ // Same connect-on-demand courtesy for the forced-local path: when
+ // the primary route is remote, enumerating "This device" would
+ // SPAWN a local backend this user has never asked for — a phantom
+ // `default` agent that also forces -device handle disambiguation
+ // onto the real one (remote-gateway-only desktops showed their main
+ // agent twice, Aug 17 2026). Enumerate the local source only when
+ // it is the delegate route (local-primary desktops, unchanged
+ // behavior) or a forced-local child is ALREADY pooled (the user
+ // opened one).
+ if (connection.kind === 'local') {
+ const localRoute = resolveRegistryLocalRoute('default', {
+ globalRemote: globalRemoteActive(),
+ profileRemoteOverride: Boolean(profileHasRemoteOverride(primaryProfileKey()))
+ })
+
+ if (shouldDeferLocalEnumeration(localRoute, backendPool.keys(), connection.id)) {
+ return { connection, profiles: null, error: 'connect-on-demand' }
+ }
}
- }
- // Claim-guarded (#90812): this ~5s roster poll can race a renderer's
- // own reconnect dial for the same connection; coalescing avoids
- // bootstrapping a second SSH tunnel / remote dashboard.
- const descriptor: any = await withEnumerationDeadline(
- Promise.resolve(
- backendDialClaims.run(backendScopeKey(connection.id, null), () =>
- ensureRegistryBackend(connection.id, null)
- )
- ),
- rosterSourceEnumerationTimeoutMs(connection)
- )
+ // Claim-guarded (#90812): this ~5s roster poll can race a renderer's
+ // own reconnect dial for the same connection; coalescing avoids
+ // bootstrapping a second SSH tunnel / remote dashboard.
+ const descriptor: any = await withEnumerationDeadline(
+ Promise.resolve(
+ backendDialClaims.run(backendScopeKey(connection.id, null), () =>
+ ensureRegistryBackend(connection.id, null)
+ )
+ ),
+ rosterSourceEnumerationTimeoutMs(connection)
+ )
- const { body, installId } = await fetchRosterSourceData(
- () => getJsonForBackend(descriptor, '/api/profiles', { timeoutMs: 8_000 }),
- () => probeConnectionInstallId(connection.id, descriptor)
- )
+ const { body, installId } = await fetchRosterSourceData(
+ () => getJsonForBackend(descriptor, '/api/profiles', { timeoutMs: 8_000 }),
+ () => probeConnectionInstallId(connection.id, descriptor)
+ )
- // The install-id probe is TTL-cached, so the 5s roster poll usually
- // pays zero extra requests; on a miss it runs beside /api/profiles.
+ // The install-id probe is TTL-cached, so the 5s roster poll usually
+ // pays zero extra requests; on a miss it runs beside /api/profiles.
- const profiles = Array.isArray(body?.profiles)
- ? body.profiles.map(p => String(p?.name || '').trim()).filter(Boolean)
- : []
+ const profiles = Array.isArray(body?.profiles)
+ ? body.profiles.map(p => String(p?.name || '').trim()).filter(Boolean)
+ : []
- const profileMetadata = Array.isArray(body?.profiles)
- ? Object.fromEntries(
- body.profiles
- .map(profile => {
- const name = String(profile?.name || '').trim()
+ const profileMetadata = Array.isArray(body?.profiles)
+ ? Object.fromEntries(
+ body.profiles
+ .map(profile => {
+ const name = String(profile?.name || '').trim()
- if (!name) {
- return null
- }
+ if (!name) {
+ return null
+ }
- const metadata: RosterProfileMetadata = {}
+ const metadata: RosterProfileMetadata = {}
- if (typeof profile?.display_name === 'string' && profile.display_name.trim()) {
- metadata.display_name = profile.display_name.trim()
- }
+ if (typeof profile?.display_name === 'string' && profile.display_name.trim()) {
+ metadata.display_name = profile.display_name.trim()
+ }
- if (typeof profile?.title === 'string' && profile.title.trim()) {
- metadata.title = profile.title.trim()
- }
+ if (typeof profile?.title === 'string' && profile.title.trim()) {
+ metadata.title = profile.title.trim()
+ }
- if (profile?.ui_meta && typeof profile.ui_meta === 'object') {
- metadata.ui_meta = profile.ui_meta
- }
+ if (profile?.ui_meta && typeof profile.ui_meta === 'object') {
+ metadata.ui_meta = profile.ui_meta
+ }
- if (typeof profile?.has_avatar === 'boolean') {
- metadata.has_avatar = profile.has_avatar
- }
+ if (typeof profile?.has_avatar === 'boolean') {
+ metadata.has_avatar = profile.has_avatar
+ }
- return [name, metadata] as const
- })
- .filter((entry): entry is readonly [string, RosterProfileMetadata] => Boolean(entry))
- )
- : undefined
+ return [name, metadata] as const
+ })
+ .filter((entry): entry is readonly [string, RosterProfileMetadata] => Boolean(entry))
+ )
+ : undefined
- // The root HERMES_HOME is an agent too; enumerations that omit it
- // (older backends list only named profiles) still get a default row.
- if (!profiles.includes('default')) {
- profiles.unshift('default')
- }
+ // The root HERMES_HOME is an agent too; enumerations that omit it
+ // (older backends list only named profiles) still get a default row.
+ if (!profiles.includes('default')) {
+ profiles.unshift('default')
+ }
+ raw = {
+ connection,
+ profiles,
+ ...(installId ? { installId } : {}),
+ ...(profileMetadata ? { profileMetadata } : {})
+ }
+ }
+ } catch (error: any) {
+ sourceFailureDetail = [error?.statusCode, error?.cause?.message].filter(Boolean).join(' | ')
raw = {
connection,
- profiles,
- ...(installId ? { installId } : {}),
- ...(profileMetadata ? { profileMetadata } : {})
+ profiles: null,
+ error: redactSecrets(String(error?.message || error)),
+ needsSignIn:
+ isReauthRequiredError(error) || (connection.authMode === 'oauth' && isGatewayAuthRejection(error))
}
}
- } catch (error: any) {
- sourceFailureDetail = [error?.statusCode, error?.cause?.message].filter(Boolean).join(' | ')
- raw = {
- connection,
- profiles: null,
- error: redactSecrets(String(error?.message || error)),
- needsSignIn: isReauthRequiredError(error) ||
- (connection.authMode === 'oauth' && isGatewayAuthRejection(error))
- }
- }
- if (raw.error && raw.error !== 'connect-on-demand') {
- const diagnostic = redactSecrets([raw.error, sourceFailureDetail].filter(Boolean).join(' | '))
- .replace(/[\r\n]+/g, ' ')
- .slice(0, 800)
+ if (raw.error && raw.error !== 'connect-on-demand') {
+ const diagnostic = redactSecrets([raw.error, sourceFailureDetail].filter(Boolean).join(' | '))
+ .replace(/[\r\n]+/g, ' ')
+ .slice(0, 800)
- if (rosterSourceErrors.get(connection.id) !== diagnostic) {
- rememberLog(`[fleet-roster] ${connection.id}: ${diagnostic}`)
- rosterSourceErrors.set(connection.id, diagnostic)
+ if (rosterSourceErrors.get(connection.id) !== diagnostic) {
+ rememberLog(`[fleet-roster] ${connection.id}: ${diagnostic}`)
+ rosterSourceErrors.set(connection.id, diagnostic)
+ }
+ } else if (raw.profiles && rosterSourceErrors.delete(connection.id)) {
+ rememberLog(`[fleet-roster] ${connection.id}: connection recovered`)
}
- } else if (raw.profiles && rosterSourceErrors.delete(connection.id)) {
- rememberLog(`[fleet-roster] ${connection.id}: connection recovered`)
- }
- if (raw.profiles && raw.profiles.length > 0) {
- sshRosterCache.set(connection.id, raw.profiles)
- }
+ if (raw.profiles && raw.profiles.length > 0) {
+ sshRosterCache.set(connection.id, raw.profiles)
+ }
- const remembered = rememberSshEnumeration(raw, sshRosterCache.get(connection.id), connection.kind)
+ const remembered = rememberSshEnumeration(raw, sshRosterCache.get(connection.id), connection.kind)
- return {
- connection,
- ...remembered,
- ...(raw.needsSignIn ? { needsSignIn: true } : {}),
- ...(raw.installId ? { installId: raw.installId } : {}),
- ...(raw.profileMetadata ? { profileMetadata: raw.profileMetadata } : {})
- }
- })
- ))
+ return {
+ connection,
+ ...remembered,
+ ...(raw.needsSignIn ? { needsSignIn: true } : {}),
+ ...(raw.installId ? { installId: raw.installId } : {}),
+ ...(raw.profileMetadata ? { profileMetadata: raw.profileMetadata } : {})
+ }
+ })
+ )
+ )
}
ipcMain.handle('hermes:agents:roster', async () => {
diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/server-requests.ts b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/server-requests.ts
index bae5a6c81a3..fffacbce5f8 100644
--- a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/server-requests.ts
+++ b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/server-requests.ts
@@ -116,7 +116,9 @@ export function requestNamesActiveSession({
return $sessions
.get()
- .some(session => sessionMatchesStoredId(session, requestStoredId) && sessionMatchesStoredId(session, activeStoredId))
+ .some(
+ session => sessionMatchesStoredId(session, requestStoredId) && sessionMatchesStoredId(session, activeStoredId)
+ )
}
/** This window hosts the session: it is the primary view or an open session tile. */