mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(tui): address copilot review on #14103
- normalizeStatusBar: trim/lowercase + 'on' → 'top' alias so user-edited YAML variants (Top, " bottom ", on) coerce correctly - shift-tab yolo: no-op with sys note when no live session; success-gated echo and catch fallback so RPC failures don't report as 'yolo off' - tui_gateway config.set/get statusbar: isinstance(display, dict) guards mirroring the compact branch so a malformed display scalar in config.yaml can't raise Tests: +1 vitest for trim/case/on, +2 pytest for non-dict display survival.
This commit is contained in:
parent
48f2ac3352
commit
6fb98f343a
5 changed files with 399 additions and 112 deletions
|
|
@ -16,12 +16,20 @@ import { patchUiState } from './uiStore.js'
|
|||
|
||||
const STATUSBAR_MODES = new Set<StatusBarMode>(['bottom', 'off', 'top'])
|
||||
|
||||
export const normalizeStatusBar = (raw: unknown): StatusBarMode =>
|
||||
raw === false
|
||||
? 'off'
|
||||
: typeof raw === 'string' && STATUSBAR_MODES.has(raw as StatusBarMode)
|
||||
? (raw as StatusBarMode)
|
||||
: '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 MTIME_POLL_MS = 5000
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue