Skip to content

The agent that grows with you

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

hermes-seaeye[bot]61304d59230e
diff --git a/apps/desktop/src/api/models.ts b/apps/desktop/src/api/models.ts
index 718bfad7ae7..744456db986 100644
--- a/apps/desktop/src/api/models.ts
+++ b/apps/desktop/src/api/models.ts
@@ -1,6 +1,13 @@
import type { ModelOptionsResponse } from '@hermes/shared'
-import type { AnalyticsResponse, AuxiliaryModelsResponse, MoaConfigResponse, ModelAssignmentRequest, ModelAssignmentResponse, ModelInfoResponse } from '@/types/hermes'
+import type {
+ AnalyticsResponse,
+ AuxiliaryModelsResponse,
+ MoaConfigResponse,
+ ModelAssignmentRequest,
+ ModelAssignmentResponse,
+ ModelInfoResponse
+} from '@/types/hermes'
import { capabilityScoped, hermesApi, type ProfileScope, profileScoped, STARTUP_REQUEST_TIMEOUT_MS } from './client'
diff --git a/apps/desktop/src/app/chat/composer/model-pill.tsx b/apps/desktop/src/app/chat/composer/model-pill.tsx
index 0e92932785b..0af80e198e1 100644
--- a/apps/desktop/src/app/chat/composer/model-pill.tsx
+++ b/apps/desktop/src/app/chat/composer/model-pill.tsx
@@ -129,9 +129,7 @@ export function ModelPill({
) : (
<>
{currentModel.trim() ? (
- <span className="truncate">
- {formatModelPillLabel(currentModel, { fastMode })}
- </span>
+ <span className="truncate">{formatModelPillLabel(currentModel, { fastMode })}</span>
) : (
<GlyphSpinner className="opacity-50" spinner="braille" />
)}
diff --git a/apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts b/apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts
index 4161359f15e..24b8783d121 100644
--- a/apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts
+++ b/apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts
@@ -1,4 +1,11 @@
-import { type GatewayEvent, isGatewayReauthRequired, isGatewayWebSocketUrl, JsonRpcGatewayError, reconnectBackoffDelayMs, resolveGatewayWsUrl } from '@hermes/shared'
+import {
+ type GatewayEvent,
+ isGatewayReauthRequired,
+ isGatewayWebSocketUrl,
+ JsonRpcGatewayError,
+ reconnectBackoffDelayMs,
+ resolveGatewayWsUrl
+} from '@hermes/shared'
import { useEffect, useRef } from 'react'
import { shouldApplyPostBootProgressError } from '@/components/boot-failure-reauth'
diff --git a/apps/desktop/src/app/messaging/index.tsx b/apps/desktop/src/app/messaging/index.tsx
index d653a269777..aed723a5817 100644
--- a/apps/desktop/src/app/messaging/index.tsx
+++ b/apps/desktop/src/app/messaging/index.tsx
@@ -171,6 +171,7 @@ export function MessagingView({ setStatusbarItemGroup: _setStatusbarItemGroup, .
const settleAfterUpdate = useCallback((hotServed: boolean | undefined) => {
if (hotServed) {
window.setTimeout(() => void refreshPlatformsRef.current(true), 4000)
+
return
}
diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/interim-sealing.test.tsx b/apps/desktop/src/app/session/hooks/use-message-stream/interim-sealing.test.tsx
index 8778836db98..934235cb590 100644
--- a/apps/desktop/src/app/session/hooks/use-message-stream/interim-sealing.test.tsx
+++ b/apps/desktop/src/app/session/hooks/use-message-stream/interim-sealing.test.tsx
@@ -319,7 +319,9 @@ describe('useMessageStream interim text sealing', () => {
// No payload at all
await act(() => stream.handleEvent({ type: 'message.interim' } as GatewayEvent))
// Empty text
- await act(() => stream.handleEvent({ payload: { text: '' }, session_id: SID, type: 'message.interim' } as GatewayEvent))
+ await act(() =>
+ stream.handleEvent({ payload: { text: '' }, session_id: SID, type: 'message.interim' } as GatewayEvent)
+ )
// Undefined text
await act(() =>
stream.handleEvent({ payload: { text: undefined }, session_id: SID, type: 'message.interim' } as GatewayEvent)
diff --git a/apps/desktop/src/app/session/hooks/use-model-controls.ts b/apps/desktop/src/app/session/hooks/use-model-controls.ts
index b10b868f812..cf0576e322a 100644
--- a/apps/desktop/src/app/session/hooks/use-model-controls.ts
+++ b/apps/desktop/src/app/session/hooks/use-model-controls.ts
@@ -110,63 +110,60 @@ export function useModelControls({
// only fills an EMPTY selection so a user's pick (plain UI state in
// $currentModel) survives the lifecycle refreshes that fire on boot / fresh
// draft / session events. A live session owns the footer, so skip entirely.
- const refreshCurrentModel = useCallback(
- async (force = false) => {
- // A forced profile swap opens a new intent epoch; an older in-flight
- // response for a previous profile must stand down when it resolves.
- if (force) {
- profileRefreshEpochRef.current += 1
+ const refreshCurrentModel = useCallback(async (force = false) => {
+ // A forced profile swap opens a new intent epoch; an older in-flight
+ // response for a previous profile must stand down when it resolves.
+ if (force) {
+ profileRefreshEpochRef.current += 1
+ }
+
+ const profileRefreshEpoch = profileRefreshEpochRef.current
+ const profile = $activeGatewayProfile.get()
+
+ try {
+ if ($activeSessionId.get()) {
+ return
}
- const profileRefreshEpoch = profileRefreshEpochRef.current
- const profile = $activeGatewayProfile.get()
+ // A manual pick is sticky. It is never diffed against the catalog: rows
+ // are hints, and a custom slug the row lacks is still the user's choice
+ // (the gateway validates it on switch).
+ const keepManualPick = () => !force && Boolean($currentModel.get()) && getCurrentModelSource() === 'manual'
- try {
- if ($activeSessionId.get()) {
- return
- }
-
- // A manual pick is sticky. It is never diffed against the catalog: rows
- // are hints, and a custom slug the row lacks is still the user's choice
- // (the gateway validates it on switch).
- const keepManualPick = () => !force && Boolean($currentModel.get()) && getCurrentModelSource() === 'manual'
-
- if (keepManualPick()) {
- return
- }
+ if (keepManualPick()) {
+ return
+ }
- // Snapshot the selection generation before awaiting so a picker click
- // that lands while getGlobalModelInfo is in flight wins over this older
- // default — value comparisons alone miss re-selecting the same row.
- const selectionGeneration = getComposerSelectionGeneration()
- const result = await getGlobalModelInfo(profile)
-
- if (
- profileRefreshEpochRef.current !== profileRefreshEpoch ||
- $activeSessionId.get() ||
- getComposerSelectionGeneration() !== selectionGeneration ||
- keepManualPick()
- ) {
- return
- }
+ // Snapshot the selection generation before awaiting so a picker click
+ // that lands while getGlobalModelInfo is in flight wins over this older
+ // default — value comparisons alone miss re-selecting the same row.
+ const selectionGeneration = getComposerSelectionGeneration()
+ const result = await getGlobalModelInfo(profile)
+
+ if (
+ profileRefreshEpochRef.current !== profileRefreshEpoch ||
+ $activeSessionId.get() ||
+ getComposerSelectionGeneration() !== selectionGeneration ||
+ keepManualPick()
+ ) {
+ return
+ }
- if (typeof result.model === 'string') {
- setCurrentModel(result.model)
- }
+ if (typeof result.model === 'string') {
+ setCurrentModel(result.model)
+ }
- if (typeof result.provider === 'string') {
- setCurrentProvider(result.provider)
- }
+ if (typeof result.provider === 'string') {
+ setCurrentProvider(result.provider)
+ }
- if (typeof result.model === 'string' || typeof result.provider === 'string') {
- setCurrentModelSource('default')
- }
- } catch {
- // The delayed session.info event still updates this once the agent is ready.
+ if (typeof result.model === 'string' || typeof result.provider === 'string') {
+ setCurrentModelSource('default')
}
- },
- []
- )
+ } catch {
+ // The delayed session.info event still updates this once the agent is ready.
+ }
+ }, [])
// Returns whether the switch was applied so callers can await it before
// applying follow-up changes. `true` means applied (or deferred/busy-queued
diff --git a/apps/desktop/src/app/skills/index.test.tsx b/apps/desktop/src/app/skills/index.test.tsx
index e96bc071797..daaa3224a01 100644
--- a/apps/desktop/src/app/skills/index.test.tsx
+++ b/apps/desktop/src/app/skills/index.test.tsx
@@ -177,7 +177,7 @@ describe('SkillsView toolset management', { timeout: 60_000 }, () => {
]
})
- await act(async () => {
+ await act(async () => {
render(
<QueryClientProvider client={queryClient}>
<MemoryRouter initialEntries={['/skills?tab=toolsets']}>
@@ -222,7 +222,7 @@ describe('SkillsView toolset management', { timeout: 60_000 }, () => {
}
])
- await act(async () => {
+ await act(async () => {
render(
<QueryClientProvider client={queryClient}>
<MemoryRouter initialEntries={['/skills?tab=skills']}>
@@ -265,7 +265,7 @@ describe('SkillsView toolset management', { timeout: 60_000 }, () => {
}
])
- await act(async () => {
+ await act(async () => {
render(
<QueryClientProvider client={queryClient}>
<MemoryRouter initialEntries={['/skills?tab=skills']}>
@@ -320,7 +320,7 @@ describe('SkillsView toolset management', { timeout: 60_000 }, () => {
// Embedded mode drives tabs through local state (the route hooks are
// mocked here), starting on Skills: the picker mounts with the tab.
- await act(async () => {
+ await act(async () => {
render(
<QueryClientProvider client={queryClient}>
<MemoryRouter initialEntries={['/skills']}>
@@ -378,7 +378,7 @@ describe('SkillsView toolset management', { timeout: 60_000 }, () => {
// the live surface pointed at ITS backend — the reads must carry the
// (connection, profile) pin, not a bare profile name that would resolve
// against the ACTIVE gateway (the wrong-machine bug).
- await act(async () => {
+ await act(async () => {
render(
<QueryClientProvider client={queryClient}>
<MemoryRouter initialEntries={['/skills']}>
@@ -491,7 +491,7 @@ describe('SkillsView toolset management', { timeout: 60_000 }, () => {
]
})
- await act(async () => {
+ await act(async () => {
render(
<QueryClientProvider client={queryClient}>
<MemoryRouter initialEntries={['/skills?tab=skills']}>
diff --git a/apps/desktop/src/i18n/define-locale.ts b/apps/desktop/src/i18n/define-locale.ts
index 5bedee72e4a..82f56b92374 100644
--- a/apps/desktop/src/i18n/define-locale.ts
+++ b/apps/desktop/src/i18n/define-locale.ts
@@ -5,4 +5,5 @@ import type { Translations } from './types'
export type TranslationOverrides = TranslationOverride<Translations>
-export const defineLocale = (overrides: TranslationOverrides): Translations => mergeTranslations<Translations>(en, overrides)
+export const defineLocale = (overrides: TranslationOverrides): Translations =>
+ mergeTranslations<Translations>(en, overrides)
diff --git a/apps/desktop/src/lib/shared-gateway-restart.ts b/apps/desktop/src/lib/shared-gateway-restart.ts
index 17a49c336f1..820d13b1412 100644
--- a/apps/desktop/src/lib/shared-gateway-restart.ts
+++ b/apps/desktop/src/lib/shared-gateway-restart.ts
@@ -4,7 +4,9 @@ import type { StatusResponse } from '@/types/hermes'
* multiplexer, in display order (default first, then as recorded). `null` for a standalone
* gateway or an older backend that does not report `gateway_shared_with` — those keep the
* plain no-dialog restart. A record naming only one profile is not shared either. */
-export function sharedGatewayProfiles(status: Pick<StatusResponse, 'gateway_shared_with'> | null | undefined): null | string[] {
+export function sharedGatewayProfiles(
+ status: Pick<StatusResponse, 'gateway_shared_with'> | null | undefined
+): null | string[] {
const shared = status?.gateway_shared_with
if (!Array.isArray(shared)) {
diff --git a/apps/desktop/src/store/gateway.ts b/apps/desktop/src/store/gateway.ts
index 07d835b4532..63b5031f3f4 100644
--- a/apps/desktop/src/store/gateway.ts
+++ b/apps/desktop/src/store/gateway.ts
@@ -1,4 +1,10 @@
-import { type ConnectionState, type GatewayEvent, reconnectBackoffDelayMs, registryBackendScopeKey, resolveGatewayWsUrl } from '@hermes/shared'
+import {
+ type ConnectionState,
+ type GatewayEvent,
+ reconnectBackoffDelayMs,
+ registryBackendScopeKey,
+ resolveGatewayWsUrl
+} from '@hermes/shared'
import { atom } from 'nanostores'
import type { HermesConnection } from '@/global'
diff --git a/apps/desktop/src/store/pet-generate.ts b/apps/desktop/src/store/pet-generate.ts
index 3ad6ac3c33e..fc8f18335d9 100644
--- a/apps/desktop/src/store/pet-generate.ts
+++ b/apps/desktop/src/store/pet-generate.ts
@@ -491,28 +491,26 @@ export async function hatchSelected(request: GatewayRequest, options: HatchOptio
// Stream the hatch steps (which row is drawing, then compose/save) to the egg
// screen so a multi-minute hatch shows live progress instead of a black box.
const offProgress =
- $gateway
- .get()
- ?.on('pet.hatch.progress', event => {
- const p = event.payload as { done?: string; event: string; state?: string; total?: string } | undefined
+ $gateway.get()?.on('pet.hatch.progress', event => {
+ const p = event.payload as { done?: string; event: string; state?: string; total?: string } | undefined
- if (!p || !hatch.isCurrent(hatchRunId) || $petGenStatus.get() !== 'hatching') {
- return
- }
+ if (!p || !hatch.isCurrent(hatchRunId) || $petGenStatus.get() !== 'hatching') {
+ return
+ }
- if (p.event === 'row' && p.state) {
- $petGenStage.set({
- phase: 'row',
- state: p.state,
- done: Number(p.done) || undefined,
- total: Number(p.total) || undefined
- })
- } else if (p.event === 'compose') {
- $petGenStage.set({ phase: 'compose' })
- } else if (p.event === 'save') {
- $petGenStage.set({ phase: 'save' })
- }
- }) ?? (() => {})
+ if (p.event === 'row' && p.state) {
+ $petGenStage.set({
+ phase: 'row',
+ state: p.state,
+ done: Number(p.done) || undefined,
+ total: Number(p.total) || undefined
+ })
+ } else if (p.event === 'compose') {
+ $petGenStage.set({ phase: 'compose' })
+ } else if (p.event === 'save') {
+ $petGenStage.set({ phase: 'save' })
+ }
+ }) ?? (() => {})
try {
const result = await request<{ ok: boolean; slug: string; displayName: string; pet?: PetInfo }>(
diff --git a/apps/desktop/src/themes/context.test.tsx b/apps/desktop/src/themes/context.test.tsx
index cb87c997510..0236fa853a3 100644
--- a/apps/desktop/src/themes/context.test.tsx
+++ b/apps/desktop/src/themes/context.test.tsx
@@ -173,13 +173,23 @@ describe('ThemeProvider --dt-primary-solid preset parity', () => {
[0, 2, 4].map(i => parseInt(hex.replace(/^#/, '').slice(i, i + 2), 16)) as [number, number, number]
const rgbToHex = (rgb: [number, number, number]) =>
- `#${rgb.map(n => Math.round(Math.min(255, Math.max(0, n))).toString(16).padStart(2, '0')).join('')}`
+ `#${rgb
+ .map(n =>
+ Math.round(Math.min(255, Math.max(0, n)))
+ .toString(16)
+ .padStart(2, '0')
+ )
+ .join('')}`
const oldMix = (a: string, b: string, amount: number) => {
const ar = hexToRgb(a)
const br = hexToRgb(b)
- return rgbToHex([ar[0] + (br[0] - ar[0]) * amount, ar[1] + (br[1] - ar[1]) * amount, ar[2] + (br[2] - ar[2]) * amount])
+ return rgbToHex([
+ ar[0] + (br[0] - ar[0]) * amount,
+ ar[1] + (br[1] - ar[1]) * amount,
+ ar[2] + (br[2] - ar[2]) * amount
+ ])
}
const linearize = (c: number) => (c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4)
@@ -231,7 +241,9 @@ describe('ThemeProvider --dt-primary-solid preset parity', () => {
return null
}
- const cases = BUILTIN_THEME_LIST.flatMap(theme => (['light', 'dark'] as const).map(mode => [theme.name, mode] as const))
+ const cases = BUILTIN_THEME_LIST.flatMap(theme =>
+ (['light', 'dark'] as const).map(mode => [theme.name, mode] as const)
+ )
it.each(cases)('%s/%s keeps the pre-refactor loud fill', (name, mode) => {
render(
diff --git a/apps/desktop/vite.config.ts b/apps/desktop/vite.config.ts
index 25269efb0be..28ca0d797ab 100644
--- a/apps/desktop/vite.config.ts
+++ b/apps/desktop/vite.config.ts
@@ -84,9 +84,13 @@ const emojibaseAssets = () => ({
server.middlewares.use('/emojibase', (req, res, next) => {
const rel = (req.url ?? '').split('?')[0].replace(/^\/+/, '')
- if (!emojibaseDir || !EMOJIBASE_PATH.test(rel)) {return next()}
+ if (!emojibaseDir || !EMOJIBASE_PATH.test(rel)) {
+ return next()
+ }
fs.readFile(path.join(emojibaseDir, rel), (err: unknown, buf: Buffer) => {
- if (err) {return next()}
+ if (err) {
+ return next()
+ }
res.setHeader('Content-Type', 'application/json')
res.setHeader('Cache-Control', 'public, max-age=31536000, immutable')
res.end(buf)
@@ -94,7 +98,9 @@ const emojibaseAssets = () => ({
})
},
generateBundle(this: { emitFile: (asset: { type: 'asset'; fileName: string; source: Uint8Array }) => void }) {
- if (!emojibaseDir) {return}
+ if (!emojibaseDir) {
+ return
+ }
for (const rel of ['en/data.json', 'en/messages.json', 'en/shortcodes/emojibase.json']) {
this.emitFile({
diff --git a/ui-tui/src/app/turnController.ts b/ui-tui/src/app/turnController.ts
index 06d10fe7015..afc9f3f6cf5 100644
--- a/ui-tui/src/app/turnController.ts
+++ b/ui-tui/src/app/turnController.ts
@@ -813,7 +813,13 @@ class TurnController {
this.publishToolState()
}
- recordInlineDiffToolComplete(diffText: string, toolId: string, fallbackName?: string, duration?: number, resultText?: string) {
+ recordInlineDiffToolComplete(
+ diffText: string,
+ toolId: string,
+ fallbackName?: string,
+ duration?: number,
+ resultText?: string
+ ) {
if (this.interrupted) {
return
}
@@ -825,7 +831,13 @@ class TurnController {
// `tool.complete` carries no error flag on the wire (tui_gateway/tool_progress.py::_on_tool_complete);
// a failed tool surfaces through its result text, so every trail line renders as non-error.
- private completeTool(toolId: string, fallbackName?: string, summary?: string, duration?: number, resultText?: string) {
+ private completeTool(
+ toolId: string,
+ fallbackName?: string,
+ summary?: string,
+ duration?: number,
+ resultText?: string
+ ) {
const done = this.activeTools.find(tool => tool.id === toolId)
const name = done?.name ?? fallbackName ?? 'tool'
const label = toolTrailLabel(name)