Skip to content

The agent that grows with you

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

hermes-seaeye[bot]7ee52894a7bd
diff --git a/ui-tui/src/__tests__/agentControls.test.ts b/ui-tui/src/__tests__/agentControls.test.ts
index 439b5dd0a74..812a8638c3e 100644
--- a/ui-tui/src/__tests__/agentControls.test.ts
+++ b/ui-tui/src/__tests__/agentControls.test.ts
@@ -24,11 +24,12 @@ it('reports queued acceptance rather than claiming delivery and preserves reject
})
it('keeps every roster selection in the visible viewport including short terminals', () => {
- for (const height of [10, 14, 24, 40])
- {for (const cursor of [0, 9, 19]) {
+ for (const height of [10, 14, 24, 40]) {
+ for (const cursor of [0, 9, 19]) {
const view = rosterViewport(height, 20, cursor)
expect(view.start).toBeLessThanOrEqual(cursor)
expect(view.start + view.rows).toBeGreaterThan(cursor)
expect(view.rows + (view.timelineRows ? view.timelineRows + 4 : 0) + 7).toBeLessThanOrEqual(height)
- }}
+ }
+ }
})
diff --git a/ui-tui/src/__tests__/agentRoster.test.ts b/ui-tui/src/__tests__/agentRoster.test.ts
index a492a027428..ae9f4c43d75 100644
--- a/ui-tui/src/__tests__/agentRoster.test.ts
+++ b/ui-tui/src/__tests__/agentRoster.test.ts
@@ -6,9 +6,17 @@ import type { SubagentProgress } from '../types.js'
it('never rolls event progress back when an older live snapshot arrives', () => {
const event: SubagentProgress = {
- id: 'child', goal: 'inspect', depth: 0, index: 0, parentId: null,
- notes: [], thinking: [], tools: ['read_file'], taskCount: 1,
- status: 'running', toolCount: 5
+ id: 'child',
+ goal: 'inspect',
+ depth: 0,
+ index: 0,
+ parentId: null,
+ notes: [],
+ thinking: [],
+ tools: ['read_file'],
+ taskCount: 1,
+ status: 'running',
+ toolCount: 5
}
const stale = {
diff --git a/ui-tui/src/__tests__/agentsDock.test.tsx b/ui-tui/src/__tests__/agentsDock.test.tsx
index c210bce63cc..66ab13a3c76 100644
--- a/ui-tui/src/__tests__/agentsDock.test.tsx
+++ b/ui-tui/src/__tests__/agentsDock.test.tsx
@@ -15,8 +15,12 @@ import type { SubagentProgress } from '../types.js'
const colorLevel = chalk.level
-beforeEach(() => { chalk.level = 3 })
-afterEach(() => { chalk.level = colorLevel })
+beforeEach(() => {
+ chalk.level = 3
+})
+afterEach(() => {
+ chalk.level = colorLevel
+})
const agent = (id: string): SubagentProgress => ({
id,
diff --git a/ui-tui/src/__tests__/agentsHydration.test.tsx b/ui-tui/src/__tests__/agentsHydration.test.tsx
index 88ed88b27f5..adf56a79ab8 100644
--- a/ui-tui/src/__tests__/agentsHydration.test.tsx
+++ b/ui-tui/src/__tests__/agentsHydration.test.tsx
@@ -12,17 +12,24 @@ import { DEFAULT_THEME } from '../theme.js'
it('does not undo an acknowledged pause when opening status resolves late', async () => {
resetDelegationState()
let resolveStatus!: (value: unknown) => void
- const status = new Promise(resolve => { resolveStatus = resolve })
- const request = vi.fn(async (method: string) => method === 'delegation.status' ? status : { paused: true })
+ const status = new Promise(resolve => {
+ resolveStatus = resolve
+ })
+ const request = vi.fn(async (method: string) => (method === 'delegation.status' ? status : { paused: true }))
const stdout = Object.assign(new PassThrough(), { columns: 80, rows: 16, isTTY: false })
const stdin = Object.assign(new PassThrough(), { isTTY: true, setRawMode: () => {}, ref: () => {}, unref: () => {} })
- const view = renderSync(<Box height={16}><AgentsOverlay gw={{ request } as unknown as GatewayClient} onClose={() => {}} t={DEFAULT_THEME} /></Box>, {
- stdout: stdout as unknown as NodeJS.WriteStream,
- stdin: stdin as unknown as NodeJS.ReadStream,
- stderr: new PassThrough() as unknown as NodeJS.WriteStream,
- patchConsole: false
- })
+ const view = renderSync(
+ <Box height={16}>
+ <AgentsOverlay gw={{ request } as unknown as GatewayClient} onClose={() => {}} t={DEFAULT_THEME} />
+ </Box>,
+ {
+ stdout: stdout as unknown as NodeJS.WriteStream,
+ stdin: stdin as unknown as NodeJS.ReadStream,
+ stderr: new PassThrough() as unknown as NodeJS.WriteStream,
+ patchConsole: false
+ }
+ )
try {
await vi.waitFor(() => expect(request).toHaveBeenCalledWith('delegation.status', {}))
diff --git a/ui-tui/src/app/agentRoster.ts b/ui-tui/src/app/agentRoster.ts
index f30ba1c1d57..43715d0bed0 100644
--- a/ui-tui/src/app/agentRoster.ts
+++ b/ui-tui/src/app/agentRoster.ts
@@ -14,7 +14,9 @@ export const $agentSnapshot = atom<{ sid: string | null; data: SubagentListRespo
export function applyAgentSnapshot(sid: string | null, data: SubagentListResponse = EMPTY) {
const previous = $agentSnapshot.get()
- if (previous.sid !== sid || JSON.stringify(previous.data) !== JSON.stringify(data)) {$agentSnapshot.set({ sid, data })}
+ if (previous.sid !== sid || JSON.stringify(previous.data) !== JSON.stringify(data)) {
+ $agentSnapshot.set({ sid, data })
+ }
}
export function mergeAgentRoster(events: SubagentProgress[], data: SubagentListResponse): SubagentProgress[] {
diff --git a/ui-tui/src/app/useMainApp.ts b/ui-tui/src/app/useMainApp.ts
index 23aabe97626..59c81427f45 100644
--- a/ui-tui/src/app/useMainApp.ts
+++ b/ui-tui/src/app/useMainApp.ts
@@ -596,11 +596,15 @@ export function useMainApp(gw: GatewayClient) {
const refresh = () => {
const sid = ui.sid
- gw.request<SubagentListResponse>('subagent.list', { session_id: sid }).then(raw => {
- const result = asRpcResult<SubagentListResponse>(raw)
+ gw.request<SubagentListResponse>('subagent.list', { session_id: sid })
+ .then(raw => {
+ const result = asRpcResult<SubagentListResponse>(raw)
- if (!stopped && result && getUiState().sid === sid) {applyAgentSnapshot(sid, result)}
- }).catch(() => {})
+ if (!stopped && result && getUiState().sid === sid) {
+ applyAgentSnapshot(sid, result)
+ }
+ })
+ .catch(() => {})
gw.request<SessionActiveListResponse>('session.active_list', { current_session_id: getUiState().sid })
.then(raw => {
const result = asRpcResult<SessionActiveListResponse>(raw)
diff --git a/ui-tui/src/components/agentControls.tsx b/ui-tui/src/components/agentControls.tsx
index e3523d02797..7235c6373ed 100644
--- a/ui-tui/src/components/agentControls.tsx
+++ b/ui-tui/src/components/agentControls.tsx
@@ -49,18 +49,24 @@ export function AgentSteerForm({
const [feedback, setFeedback] = useState('')
const [pending, setPending] = useState(false)
useInput((_ch, key) => {
- if (key.escape && !pending) {onClose()}
+ if (key.escape && !pending) {
+ onClose()
+ }
})
const submit = async () => {
- if (!text.trim() || pending) {return}
+ if (!text.trim() || pending) {
+ return
+ }
setPending(true)
try {
const result = await sendAgentSteer(gw, sid, id, text)
setFeedback(result.message)
- if (result.accepted) {setText('')}
+ if (result.accepted) {
+ setText('')
+ }
} catch (error) {
setFeedback(`Not queued: ${error instanceof Error ? error.message : String(error)}`)
} finally {
@@ -98,7 +104,9 @@ export function AgentLiveTail({ gw, sid, id, t }: ControlProps) {
let pending = false
const refresh = async () => {
- if (pending) {return}
+ if (pending) {
+ return
+ }
pending = true
try {
@@ -106,14 +114,17 @@ export function AgentLiveTail({ gw, sid, id, t }: ControlProps) {
await gw.request('subagent.tail', { session_id: sid, subagent_id: id })
)
- if (active)
- {setTail(
+ if (active) {
+ setTail(
result?.available
? `${result.truncated ? '[last 16 KiB]\n' : ''}${result.text}`
: 'Live transcript unavailable; child may have finished. Progress and output remain below.'
- )}
+ )
+ }
} catch {
- if (active) {setTail('Could not refresh live transcript.')}
+ if (active) {
+ setTail('Could not refresh live transcript.')
+ }
} finally {
pending = false
}
diff --git a/ui-tui/src/components/agentsOverlay.tsx b/ui-tui/src/components/agentsOverlay.tsx
index be5505e33ee..e2d3beb6d1e 100644
--- a/ui-tui/src/components/agentsOverlay.tsx
+++ b/ui-tui/src/components/agentsOverlay.tsx
@@ -628,7 +628,11 @@ export function AgentsOverlay({ gw, initialHistoryIndex = 0, onClose, t }: Agent
const selected = rows[cursor] ?? null
const cols = stdout?.columns ?? 80
- const { rows: rowsH, start: listWindowStart, timelineRows } = rosterViewport((stdout?.rows ?? 24) - (flash ? 1 : 0), rows.length, cursor)
+ const {
+ rows: rowsH,
+ start: listWindowStart,
+ timelineRows
+ } = rosterViewport((stdout?.rows ?? 24) - (flash ? 1 : 0), rows.length, cursor)
// ── Effects ────────────────────────────────────────────────────────
@@ -673,11 +677,15 @@ export function AgentsOverlay({ gw, initialHistoryIndex = 0, onClose, t }: Agent
let active = true
gw.request<DelegationStatusResponse>('delegation.status', {})
.then(r => {
- if (active && $delegationState.get() === initial) {applyDelegationStatus(asRpcResult<DelegationStatusResponse>(r))}
+ if (active && $delegationState.get() === initial) {
+ applyDelegationStatus(asRpcResult<DelegationStatusResponse>(r))
+ }
})
.catch(() => {})
- return () => { active = false }
+ return () => {
+ active = false
+ }
}, [gw])
useEffect(() => {
@@ -696,7 +704,8 @@ export function AgentsOverlay({ gw, initialHistoryIndex = 0, onClose, t }: Agent
}
}
- const interrupt = (id: string) => gw.request<SubagentInterruptResponse>('subagent.interrupt', { session_id: sid, subagent_id: id })
+ const interrupt = (id: string) =>
+ gw.request<SubagentInterruptResponse>('subagent.interrupt', { session_id: sid, subagent_id: id })
const killOne = (id: string) =>
guardLive(() => {
@@ -750,13 +759,21 @@ export function AgentsOverlay({ gw, initialHistoryIndex = 0, onClose, t }: Agent
const scrollDetail = (dy: number) => detailScrollRef.current?.scrollBy(dy)
useInput((ch, key) => {
- if (mode === 'steer') {return}
+ if (mode === 'steer') {
+ return
+ }
- if (key.ctrl && ch === 't') {return closeWithCleanup()}
+ if (key.ctrl && ch === 't') {
+ return closeWithCleanup()
+ }
- if (ch === 'e' && selected && sid && !replayMode) {return setMode('steer')}
+ if (ch === 'e' && selected && sid && !replayMode) {
+ return setMode('steer')
+ }
- if (ch === 't' && selected) {return setMode('tail')}
+ if (ch === 't' && selected) {
+ return setMode('tail')
+ }
if (ch === 'q') {
return closeWithCleanup()
@@ -911,13 +928,17 @@ export function AgentsOverlay({ gw, initialHistoryIndex = 0, onClose, t }: Agent
</Text>
</Box>
- {mode === 'steer' && selected && sid ? <AgentSteerForm cols={cols} gw={gw} id={selected.item.id} onClose={() => setMode('detail')} sid={sid} t={t} /> : rows.length === 0 ? (
+ {mode === 'steer' && selected && sid ? (
+ <AgentSteerForm cols={cols} gw={gw} id={selected.item.id} onClose={() => setMode('detail')} sid={sid} t={t} />
+ ) : rows.length === 0 ? (
<Box flexDirection="column" flexGrow={1}>
<Text color={t.color.muted}>No subagents this turn. Trigger delegate_task to populate the tree.</Text>
</Box>
) : mode === 'list' ? (
<Box flexDirection="column" flexGrow={1} flexShrink={1} minHeight={0}>
- {timelineRows > 0 ? <GanttStrip cols={cols - 2} cursor={cursor} flatNodes={rows} maxRows={timelineRows} now={now} t={t} /> : null}
+ {timelineRows > 0 ? (
+ <GanttStrip cols={cols - 2} cursor={cursor} flatNodes={rows} maxRows={timelineRows} now={now} t={t} />
+ ) : null}
<Box flexDirection="column" flexGrow={0} flexShrink={0} overflow="hidden">
{rows.slice(listWindowStart, listWindowStart + rowsH).map((node, i) => (
@@ -935,9 +956,19 @@ export function AgentsOverlay({ gw, initialHistoryIndex = 0, onClose, t }: Agent
</Box>
) : (
<Box flexDirection="row" flexGrow={1} flexShrink={1} minHeight={0}>
- <ScrollBox flexDirection="column" flexGrow={1} flexShrink={1} ref={detailScrollRef} stickyScroll={mode === 'tail'}>
+ <ScrollBox
+ flexDirection="column"
+ flexGrow={1}
+ flexShrink={1}
+ ref={detailScrollRef}
+ stickyScroll={mode === 'tail'}
+ >
<Box flexDirection="column" paddingBottom={4} paddingRight={1}>
- {selected && mode === 'tail' && sid && !replayMode ? <AgentLiveTail gw={gw} id={selected.item.id} key={selected.item.id} sid={sid} t={t} /> : selected ? <Detail id={selected.item.id} node={selected} t={t} /> : null}
+ {selected && mode === 'tail' && sid && !replayMode ? (
+ <AgentLiveTail gw={gw} id={selected.item.id} key={selected.item.id} sid={sid} t={t} />
+ ) : selected ? (
+ <Detail id={selected.item.id} node={selected} t={t} />
+ ) : null}
</Box>
</ScrollBox>
@@ -948,8 +979,14 @@ export function AgentsOverlay({ gw, initialHistoryIndex = 0, onClose, t }: Agent
)}
<Box flexDirection="column" marginTop={1}>
- <Text color={t.color.accent} wrap="truncate-end">Enter detail · e steer · t tail · x stop · Esc back</Text>
- {flash ? <Text color={t.color.accent} wrap="truncate-end">{flash}</Text> : null}
+ <Text color={t.color.accent} wrap="truncate-end">
+ Enter detail · e steer · t tail · x stop · Esc back
+ </Text>
+ {flash ? (
+ <Text color={t.color.accent} wrap="truncate-end">
+ {flash}
+ </Text>
+ ) : null}
{mode === 'list' ? (
<Text color={t.color.muted} wrap="truncate-end">
diff --git a/ui-tui/src/components/agentsPanel.tsx b/ui-tui/src/components/agentsPanel.tsx
index 0f0ab2f0023..b503f3e50e0 100644
--- a/ui-tui/src/components/agentsPanel.tsx
+++ b/ui-tui/src/components/agentsPanel.tsx
@@ -12,10 +12,17 @@ import { compactPreview } from '../lib/text.js'
import type { Theme } from '../theme.js'
export function AgentsPanelView({ cols, hidden, rows, running, t }: AgentRows & { cols: number; t: Theme }) {
- if (!running) {return null}
+ if (!running) {
+ return null
+ }
return (
- <Box backgroundColor={mix(t.color.statusBg, t.color.shellDollar, 0.12)} flexDirection="column" flexShrink={0} width={cols}>
+ <Box
+ backgroundColor={mix(t.color.statusBg, t.color.shellDollar, 0.12)}
+ flexDirection="column"
+ flexShrink={0}
+ width={cols}
+ >
<Text bold color={t.color.accent} wrap="truncate-end">
{`▾ ${running} live agents${hidden ? ` · +${hidden} more` : ''} · Ctrl+T expand`}
</Text>
@@ -40,7 +47,9 @@ export function LiveAgentsPanel({ cols }: { cols: number }) {
const live = subagents.some(s => s.status === 'running' || s.status === 'queued')
const [now, setNow] = useState(Date.now)
useEffect(() => {
- if (!live) {return}
+ if (!live) {
+ return
+ }
const timer = setInterval(() => setNow(Date.now()), 1000)
return () => clearInterval(timer)
diff --git a/ui-tui/src/lib/agentRows.ts b/ui-tui/src/lib/agentRows.ts
index 718769fb813..7510393f715 100644
--- a/ui-tui/src/lib/agentRows.ts
+++ b/ui-tui/src/lib/agentRows.ts
@@ -133,7 +133,9 @@ export const buildAgentRows = (
running += 1
active.push(row)
} else {
- if (RESULT_READY.has(s.status)) {done += 1}
+ if (RESULT_READY.has(s.status)) {
+ done += 1
+ }
}
}