From bbc7316007fb24151e2e9eff610a77552070bf84 Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Mon, 13 Apr 2026 21:46:08 -0500 Subject: [PATCH] feat: add cur cwd --- ui-tui/src/app.tsx | 59 ++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/ui-tui/src/app.tsx b/ui-tui/src/app.tsx index af8f6078..b6cb03cb 100644 --- a/ui-tui/src/app.tsx +++ b/ui-tui/src/app.tsx @@ -91,6 +91,12 @@ const nextDetailsMode = (m: DetailsMode): DetailsMode => const introMsg = (info: SessionInfo): Msg => ({ role: 'system', text: '', kind: 'intro', info }) +const shortCwd = (cwd: string, max = 28) => { + const home = process.env.HOME + const path = home && cwd.startsWith(home) ? `~${cwd.slice(home.length)}` : cwd + return path.length <= max ? path : `…${path.slice(-(max - 1))}` +} + const imageTokenMeta = (info: { height?: number; token_estimate?: number; width?: number } | null | undefined) => { const dims = info?.width && info?.height ? `${info.width}x${info.height}` : '' @@ -207,6 +213,7 @@ function fmtDuration(ms: number) { } function StatusRule({ + cwdLabel, cols, status, statusColor, @@ -217,6 +224,7 @@ function StatusRule({ voiceLabel, t }: { + cwdLabel: string cols: number status: string statusColor: string @@ -239,37 +247,30 @@ function StatusRule({ const pctLabel = pct != null ? `${pct}%` : '' const bar = usage.context_max ? ctxBar(pct) : '' - const segs = [ - status, - model, - ctxLabel, - bar ? `[${bar}]` : '', - pctLabel, - durationLabel || '', - voiceLabel || '', - bgCount > 0 ? `${bgCount} bg` : '' - ].filter(Boolean) - - const inner = segs.join(' │ ') - const pad = Math.max(0, cols - inner.length - 5) + const leftWidth = Math.max(12, cols - cwdLabel.length - 3) return ( - - {'─ '} - {status} - │ {model} - {ctxLabel ? │ {ctxLabel} : null} - {bar ? ( - - {' │ '} - [{bar}] {pctLabel} + + + + {'─ '} + {status} + │ {model} + {ctxLabel ? │ {ctxLabel} : null} + {bar ? ( + + {' │ '} + [{bar}] {pctLabel} + + ) : null} + {durationLabel ? │ {durationLabel} : null} + {voiceLabel ? │ {voiceLabel} : null} + {bgCount > 0 ? │ {bgCount} bg : null} - ) : null} - {durationLabel ? │ {durationLabel} : null} - {voiceLabel ? │ {voiceLabel} : null} - {bgCount > 0 ? │ {bgCount} bg : null} - {' ' + '─'.repeat(pad)} - + + + {cwdLabel} + ) } @@ -2821,6 +2822,7 @@ export function App({ gw }: { gw: GatewayClient }) { const durationLabel = sid ? fmtDuration(clockNow - sessionStartedAt) : '' const voiceLabel = voiceRecording ? 'REC' : voiceProcessing ? 'STT' : `voice ${voiceEnabled ? 'on' : 'off'}` + const cwdLabel = shortCwd(info?.cwd || process.env.HERMES_CWD || process.cwd()) const hasReasoning = Boolean(reasoning.trim()) const showProgressArea = @@ -2998,6 +3000,7 @@ export function App({ gw }: { gw: GatewayClient }) {