chore(tui): drop unreachable return + prettier pass

- createGatewayEventHandler: remove dead `return` after a block that
  always returns (tool.complete case).  The inner block exits via
  both branches so the outer statement was never reachable.  Was
  pre-existing on main; fixed here because it was the only thing
  blocking `npm run fix` on this branch.
- agentsOverlay + ops: prettier reformatting.

`npm run fix` / `npm run type-check` / `npm test` all clean.
This commit is contained in:
Brooklyn Nicholson 2026-04-22 10:43:59 -05:00
parent 06ebe34b40
commit f06adcc1ae
3 changed files with 33 additions and 49 deletions

View file

@ -1,11 +1,6 @@
import { STREAM_BATCH_MS } from '../config/timing.js'
import { buildSetupRequiredSections, SETUP_REQUIRED_TITLE } from '../content/setup.js'
import type {
CommandsCatalogResponse,
DelegationStatusResponse,
GatewayEvent,
GatewaySkin
} from '../gatewayTypes.js'
import type { CommandsCatalogResponse, DelegationStatusResponse, GatewayEvent, GatewaySkin } from '../gatewayTypes.js'
import { rpcErrorMessage } from '../lib/rpc.js'
import { formatToolCall, stripAnsi } from '../lib/text.js'
import { fromSkin } from '../theme.js'
@ -74,7 +69,11 @@ export function createGatewayEventHandler(ctx: GatewayEventHandlerContext): (ev:
const top = subagents.filter(s => !s.parentId).slice(0, 2)
const label = top.length
? top.map(s => s.goal).filter(Boolean).slice(0, 2).join(' · ')
? top
.map(s => s.goal)
.filter(Boolean)
.slice(0, 2)
.join(' · ')
: `${subagents.length} subagents`
await rpc('spawn_tree.save', {
@ -314,32 +313,28 @@ export function createGatewayEventHandler(ctx: GatewayEventHandlerContext): (ev:
turnController.recordToolStart(ev.payload.tool_id, ev.payload.name ?? 'tool', ev.payload.context ?? '')
return
case 'tool.complete': {
const inlineDiffText =
ev.payload.inline_diff && getUiState().inlineDiffs ? stripAnsi(String(ev.payload.inline_diff)).trim() : ''
case 'tool.complete':
{
const inlineDiffText =
ev.payload.inline_diff && getUiState().inlineDiffs ? stripAnsi(String(ev.payload.inline_diff)).trim() : ''
turnController.recordToolComplete(
ev.payload.tool_id,
ev.payload.name,
ev.payload.error,
inlineDiffText ? '' : ev.payload.summary
)
if (!inlineDiffText) {
return
}
// Keep inline diffs attached to the assistant completion body so
// they render in the same message flow, not as a standalone system
// artifact that can look out-of-place around tool rows.
turnController.queueInlineDiff(inlineDiffText)
turnController.recordToolComplete(
ev.payload.tool_id,
ev.payload.name,
ev.payload.error,
inlineDiffText ? '' : ev.payload.summary
)
if (!inlineDiffText) {
return
}
// Keep inline diffs attached to the assistant completion body so
// they render in the same message flow, not as a standalone system
// artifact that can look out-of-place around tool rows.
turnController.queueInlineDiff(inlineDiffText)
return
}
case 'clarify.request':
patchOverlayState({
@ -386,9 +381,7 @@ export function createGatewayEventHandler(ctx: GatewayEventHandlerContext): (ev:
case 'subagent.spawn_requested':
// Child built but not yet running (waiting on ThreadPoolExecutor slot).
// Preserve completed state if a later event races in before this one.
turnController.upsertSubagent(ev.payload, c =>
c.status === 'completed' ? {} : { status: 'queued' }
)
turnController.upsertSubagent(ev.payload, c => (c.status === 'completed' ? {} : { status: 'queued' }))
// Prime the status-bar HUD: fetch caps (once every 5s) so we can
// warn as depth/concurrency approaches the configured ceiling.
@ -401,9 +394,7 @@ export function createGatewayEventHandler(ctx: GatewayEventHandlerContext): (ev:
return
case 'subagent.start':
turnController.upsertSubagent(ev.payload, c =>
c.status === 'completed' ? {} : { status: 'running' }
)
turnController.upsertSubagent(ev.payload, c => (c.status === 'completed' ? {} : { status: 'running' }))
return
case 'subagent.thinking': {

View file

@ -8,12 +8,7 @@ import type {
import type { PanelSection } from '../../../types.js'
import { applyDelegationStatus, getDelegationState } from '../../delegationStore.js'
import { patchOverlayState } from '../../overlayStore.js'
import {
getSpawnHistory,
pushDiskSnapshot,
setDiffPair,
type SpawnSnapshot
} from '../../spawnHistoryStore.js'
import { getSpawnHistory, pushDiskSnapshot, setDiffPair, type SpawnSnapshot } from '../../spawnHistoryStore.js'
import type { SlashCommand } from '../types.js'
interface SkillInfo {
@ -101,10 +96,11 @@ export const opsCommands: SlashCommand[] = [
// ── Disk-backed listing ─────────────────────────────────────
if (lower === 'list' || lower === 'ls') {
ctx.gateway.rpc<SpawnTreeListResponse>('spawn_tree.list', {
limit: 30,
session_id: ctx.sid ?? 'default'
})
ctx.gateway
.rpc<SpawnTreeListResponse>('spawn_tree.list', {
limit: 30,
session_id: ctx.sid ?? 'default'
})
.then(
ctx.guarded<SpawnTreeListResponse>(r => {
const entries = r.entries ?? []
@ -136,7 +132,8 @@ export const opsCommands: SlashCommand[] = [
return ctx.transcript.sys('usage: /replay load <path>')
}
ctx.gateway.rpc<SpawnTreeLoadResponse>('spawn_tree.load', { path })
ctx.gateway
.rpc<SpawnTreeLoadResponse>('spawn_tree.load', { path })
.then(
ctx.guarded<SpawnTreeLoadResponse>(r => {
if (!r.subagents?.length) {
@ -202,9 +199,7 @@ export const opsCommands: SlashCommand[] = [
const candidate = resolve(b!)
if (!baseline || !candidate) {
return ctx.transcript.sys(
`replay-diff: could not resolve indices · history has ${history.length} entries`
)
return ctx.transcript.sys(`replay-diff: could not resolve indices · history has ${history.length} entries`)
}
setDiffPair({ baseline, candidate })

View file

@ -206,7 +206,6 @@ function GanttStrip({
now: number
t: Theme
}) {
const spans = flatNodes
.map((node, idx) => {
const started = node.item.startedAt ?? now
@ -273,7 +272,6 @@ function GanttStrip({
</Text>
{shown.map(({ endAt, idx, node, startAt }) => {
const active = idx === cursor
const { color } = statusGlyph(node.item, t)
const accent = active ? t.color.amber : t.color.dim