chore(tui): remove dead branch cleanup code

- drop unused TUI helpers, test-only layout scaffolding, and stale public debug exports
- remove an unused profiler import and trim test-only coverage for deleted helpers
This commit is contained in:
Brooklyn Nicholson
2026-04-26 21:54:24 -05:00
parent 635948d0e0
commit ffa33e53f6
16 changed files with 9 additions and 57 deletions

View File

@@ -30,7 +30,6 @@ import pty
import select
import signal
import sqlite3
import statistics
import sys
import time
from pathlib import Path

View File

@@ -4,7 +4,7 @@ export type { StderrHandle } from './src/hooks/use-stderr.ts'
export { default as useStdout } from './src/hooks/use-stdout.ts'
export type { StdoutHandle } from './src/hooks/use-stdout.ts'
export { Ansi } from './src/ink/Ansi.tsx'
export { evictInkCaches, inkCacheSizes } from './src/ink/cache-eviction.ts'
export { evictInkCaches } from './src/ink/cache-eviction.ts'
export type { EvictLevel, InkCacheSizes } from './src/ink/cache-eviction.ts'
export { AlternateScreen } from './src/ink/components/AlternateScreen.tsx'
export { default as Box } from './src/ink/components/Box.tsx'

View File

@@ -1,7 +1,7 @@
export { default as useStderr } from './hooks/use-stderr.js'
export { default as useStdout } from './hooks/use-stdout.js'
export { Ansi } from './ink/Ansi.js'
export { evictInkCaches, type EvictLevel, type InkCacheSizes, inkCacheSizes } from './ink/cache-eviction.js'
export { evictInkCaches, type EvictLevel, type InkCacheSizes } from './ink/cache-eviction.js'
export { AlternateScreen } from './ink/components/AlternateScreen.js'
export { default as Box } from './ink/components/Box.js'
export { default as Link } from './ink/components/Link.js'
@@ -22,7 +22,7 @@ export { useTerminalFocus } from './ink/hooks/use-terminal-focus.js'
export { useTerminalTitle } from './ink/hooks/use-terminal-title.js'
export { useTerminalViewport } from './ink/hooks/use-terminal-viewport.js'
export { default as measureElement } from './ink/measure-element.js'
export { resetScrollFastPathStats, scrollFastPathStats, type ScrollFastPathStats } from './ink/render-node-to-output.js'
export { scrollFastPathStats, type ScrollFastPathStats } from './ink/render-node-to-output.js'
export { createRoot, default as render, renderSync } from './ink/root.js'
export { stringWidth } from './ink/stringWidth.js'
export { isXtermJs } from './ink/terminal.js'

View File

@@ -22,7 +22,7 @@ export interface InkCacheSizes {
wrap: number
}
export function inkCacheSizes(): InkCacheSizes {
function inkCacheSizes(): InkCacheSizes {
return {
lineWidth: lineWidthCacheSize(),
slice: sliceCacheSize(),

View File

@@ -98,19 +98,6 @@ export const scrollFastPathStats: ScrollFastPathStats = {
}
}
export function resetScrollFastPathStats(): void {
scrollFastPathStats.captured = 0
scrollFastPathStats.taken = 0
scrollFastPathStats.declined.noPrevScreen = 0
scrollFastPathStats.declined.heightDeltaMismatch = 0
scrollFastPathStats.declined.other = 0
scrollFastPathStats.lastDeclineReason = undefined
scrollFastPathStats.lastHeightDelta = undefined
scrollFastPathStats.lastHintDelta = undefined
scrollFastPathStats.lastScrollHeight = undefined
scrollFastPathStats.lastPrevHeight = undefined
}
export function getScrollHint(): ScrollHint | null {
return scrollHint
}

View File

@@ -1,7 +1,6 @@
import { beforeEach, describe, expect, it } from 'vitest'
import {
appendTurnSegment,
archiveDoneTodos,
archiveTodosAtTurnEnd,
getTurnState,
@@ -64,13 +63,4 @@ describe('turnStore live progress helpers', () => {
toggleTodoCollapsed()
expect(getTurnState().todoCollapsed).toBe(false)
})
it('merges adjacent live tool shelves before rendering', () => {
appendTurnSegment({ kind: 'trail', role: 'system', text: '', tools: ['one ✓'] })
appendTurnSegment({ kind: 'trail', role: 'system', text: '', tools: ['two ✓'] })
expect(getTurnState().streamSegments).toEqual([
{ kind: 'trail', role: 'system', text: '', tools: ['one ✓', 'two ✓'] }
])
})
})

View File

@@ -220,7 +220,7 @@ export const opsCommands: SlashCommand[] = [
const [sub, ...rest] = text.split(/\s+/)
const query = rest.join(' ').trim()
const { rpc } = ctx.gateway
const { page, panel, sys } = ctx.transcript
const { panel, sys } = ctx.transcript
if (sub === 'list') {
rpc<SkillsListResponse>('skills.manage', { action: 'list' })

View File

@@ -1,7 +1,7 @@
import { atom } from 'nanostores'
import { useSyncExternalStore } from 'react'
import { appendToolShelfMessage, isTodoDone } from '../lib/liveProgress.js'
import { isTodoDone } from '../lib/liveProgress.js'
import type { ActiveTool, ActivityItem, Msg, SubagentProgress, TodoItem } from '../types.js'
const buildTurnState = (): TurnState => ({
@@ -64,9 +64,6 @@ export const archiveTodosAtTurnEnd = () => {
return [msg]
}
export const appendTurnSegment = (msg: Msg) =>
patchTurnState(state => ({ ...state, streamSegments: appendToolShelfMessage(state.streamSegments, msg) }))
export const resetTurnState = () => $turnState.set(buildTurnState())
export interface TurnState {

View File

@@ -442,7 +442,7 @@ export function useMainApp(gw: GatewayClient) {
clipboardPasteRef.current = paste
const { dispatchSubmission, send, sendQueued, shellExec, submit } = useSubmission({
const { dispatchSubmission, send, sendQueued, submit } = useSubmission({
appendMessage,
composerActions,
composerRefs,

View File

@@ -331,7 +331,7 @@ export function useSubmission(opts: UseSubmissionOptions) {
submitRef.current = submit
return { dispatchSubmission, send, sendQueued, shellExec, submit }
return { dispatchSubmission, send, sendQueued, submit }
}
export interface UseSubmissionOptions {

View File

@@ -394,10 +394,6 @@ function SubagentAccordion({
const hasTools = item.tools.length > 0
const noteRows = [...(summary ? [summary] : []), ...item.notes]
const hasNotes = noteRows.length > 0
// `showChildren` only seeds the recursive `expanded` prop for nested
// subagents — it MUST NOT be OR-ed into the local section toggles, or
// expand-all permanently locks the inner chevrons open.
const showChildren = expanded || deep
const noteColor = statusTone === 'error' ? t.color.error : statusTone === 'warn' ? t.color.warn : t.color.dim
const sections: {

View File

@@ -364,11 +364,6 @@ export interface SpawnTreeLoadResponse {
subagents?: unknown[]
}
export interface SpawnTreeSaveResponse {
path?: string
session_id?: string
}
export type GatewayEvent =
| { payload?: { skin?: GatewaySkin }; session_id?: string; type: 'gateway.ready' }
| { payload?: GatewaySkin; session_id?: string; type: 'skin.changed' }

View File

@@ -1,9 +0,0 @@
import { describe, expect, it } from 'vitest'
import { liveTailOrder } from './liveLayout.js'
describe('liveTailOrder', () => {
it('anchors live todo after scroll history and assistant output', () => {
expect(liveTailOrder()).toEqual(['scroll-history', 'assistant', 'live-todo'])
})
})

View File

@@ -1 +0,0 @@
export const liveTailOrder = () => ['scroll-history', 'assistant', 'live-todo'] as const

View File

@@ -2,7 +2,7 @@ import type { Msg } from '../types.js'
import { boundedHistoryRenderText } from './text.js'
export const hashText = (text: string) => {
const hashText = (text: string) => {
let h = 5381
for (let i = 0; i < text.length; i++) {

View File

@@ -121,7 +121,6 @@ declare module '@hermes/ink' {
lastPrevHeight?: number
}
export const scrollFastPathStats: ScrollFastPathStats
export function resetScrollFastPathStats(): void
export type EvictLevel = 'all' | 'half'
export type InkCacheSizes = {
@@ -131,7 +130,6 @@ declare module '@hermes/ink' {
readonly wrap: number
}
export function evictInkCaches(level?: EvictLevel): InkCacheSizes
export function inkCacheSizes(): InkCacheSizes
export function render(node: React.ReactNode, options?: NodeJS.WriteStream | RenderOptions): Instance