mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
refactor(tui): /clean pass on tui-polish — data tables, tighter title
- normalizeStatusBar: replace Set + early-returns + cast with a single
alias lookup table. Handles legacy `false`, trims/lowercases strings,
maps `on` → `top` in one pass. One expression, no `as` hacks.
- Tab title block: drop the narrative comment, fold
blockedOnInput/titleStatus/cwdTag/terminalTitle into inline expressions
inside useTerminalTitle. Avoids shadowing the outer `cwd`.
- tui_gateway statusbar set branch: read `display` once instead of
`cfg0.get("display")` twice.
This commit is contained in:
parent
8410ac05a9
commit
103c71ac36
3 changed files with 20 additions and 28 deletions
|
|
@ -14,23 +14,16 @@ import type { StatusBarMode } from './interfaces.js'
|
|||
import { turnController } from './turnController.js'
|
||||
import { patchUiState } from './uiStore.js'
|
||||
|
||||
const STATUSBAR_MODES = new Set<StatusBarMode>(['bottom', 'off', 'top'])
|
||||
|
||||
export const normalizeStatusBar = (raw: unknown): StatusBarMode => {
|
||||
if (raw === false) {
|
||||
return 'off'
|
||||
}
|
||||
|
||||
if (typeof raw !== 'string') {
|
||||
return 'top'
|
||||
}
|
||||
|
||||
const v = raw.trim().toLowerCase()
|
||||
const mode = (v === 'on' ? 'top' : v) as StatusBarMode
|
||||
|
||||
return STATUSBAR_MODES.has(mode) ? mode : 'top'
|
||||
const STATUSBAR_ALIAS: Record<string, StatusBarMode> = {
|
||||
bottom: 'bottom',
|
||||
off: 'off',
|
||||
on: 'top',
|
||||
top: 'top'
|
||||
}
|
||||
|
||||
export const normalizeStatusBar = (raw: unknown): StatusBarMode =>
|
||||
raw === false ? 'off' : typeof raw === 'string' ? STATUSBAR_ALIAS[raw.trim().toLowerCase()] ?? 'top' : 'top'
|
||||
|
||||
const MTIME_POLL_MS = 5000
|
||||
|
||||
const quietRpc = async <T extends Record<string, any> = Record<string, any>>(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue