refactor(ui): replace middle-dot separators with clearer hierarchy (#6087)

* refactor(ui): replace middle-dot separators with clearer hierarchy

* refactor(ui): use layout instead of punctuation separators
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-07 15:19:55 +08:00
1 parent d6ddceed99
commit 7cb396788c
82 files changed
+433 -462

No files matched your search

+24 -24
View File
@@ -548,7 +548,7 @@ export class NanobotTui {
}
const command = this.commandMenu.resolve(visibleContent)
if ((command || visibleContent.startsWith("!")) && this.draft.media(visibleContent).length) {
this.status.content = "Images cannot be used with commands · remove the image first"
this.status.content = "Remove the image before running a command."
return
}
if (command?.source === "tui") {
@@ -969,8 +969,8 @@ export class NanobotTui {
this.setActive(false)
this.recoveryNotice.show(state)
this.status.content = state.can_continue === false
? "Interrupted · dismiss to start a new message"
: "Interrupted · continue or dismiss"
? "Interrupted. Dismiss to start a new message."
: "Interrupted. Continue or dismiss."
this.composer.focus()
return
}
@@ -1072,7 +1072,7 @@ export class NanobotTui {
private applyStatus(status: ConnectionStatus, info?: ConnectionStatusInfo): void {
this.connectionMessage = connectionStatusText(status, info)
if (this.options.desktopGatewayId && status === "error") {
this.connectionMessage = "Desktop disconnected or incompatible · exit and run nanobot to reconnect"
this.connectionMessage = "Desktop disconnected or incompatible. Exit and run nanobot to reconnect."
}
if (status === "connected") {
this.ready = false
@@ -1100,14 +1100,14 @@ export class NanobotTui {
private renderConnectionMessage(): void {
this.status.content = this.unsentSubmit
? `Not sent · press Enter to retry when ready · ${this.connectionMessage}`
? `Not sent. ${this.connectionMessage} Press Enter to retry when ready.`
: this.connectionMessage
}
private markSubmitUnsent(sendFailed = false): void {
this.unsentSubmit = true
if (sendFailed) {
this.status.content = "Not sent · send failed; press Enter to retry when ready"
this.status.content = "Send failed. Press Enter to retry when ready."
return
}
this.renderConnectionMessage()
@@ -1140,14 +1140,14 @@ export class NanobotTui {
private renderActiveStatus(): void {
if (this.sessionLoading || this.sessionMenu.visible) return
if (this.retryStatus) {
const navigation = this.transcriptNavigation.awayFromBottom ? " · Ctrl+End latest" : ""
const queued = this.promptQueue.length ? ` · ${this.promptQueue.length} queued` : ""
const navigation = this.transcriptNavigation.awayFromBottom ? " Ctrl+End latest" : ""
const queued = this.promptQueue.length ? ` ${this.promptQueue.length} queued` : ""
this.status.content = `${retryStatusLine(this.retryStatus)}${queued}${navigation}`
return
}
const elapsed = formatElapsed(Date.now() - this.activeStartedAt)
const navigation = this.transcriptNavigation.awayFromBottom ? " · Ctrl+End latest" : ""
const queued = this.promptQueue.length ? ` · ${this.promptQueue.length} queued` : ""
const navigation = this.transcriptNavigation.awayFromBottom ? " Ctrl+End latest" : ""
const queued = this.promptQueue.length ? ` ${this.promptQueue.length} queued` : ""
this.status.content = shimmerStatus(
this.activeLabel,
` ${elapsed}${queued}${navigation}`,
@@ -1157,14 +1157,14 @@ export class NanobotTui {
}
private readyStatus(detail = this.readyDetail): string {
if (this.unsentSubmit) return "Not sent · press Enter to retry"
if (this.unsentSubmit) return "Not sent. Press Enter to retry."
if (this.transcriptNavigation.awayFromBottom) {
return this.transcriptNavigation.unseenOutput
? "New output · Ctrl+End latest"
: "History · Ctrl+End latest"
? "New output Ctrl+End latest"
: "History Ctrl+End latest"
}
if (detail) return `Ready · ${detail}`
return this.historyHasMore ? "Ready · PageUp for earlier history" : "Ready"
if (detail) return `Ready ${detail}`
return this.historyHasMore ? "Ready PageUp for earlier history" : "Ready"
}
private sendNextFollowUp(): void {
@@ -1211,7 +1211,7 @@ export class NanobotTui {
private canSendPrompt(prompt: QueuedPrompt): boolean {
if (this.draft.hasImageLabelConflict(this.composer.plainText)) {
this.status.content = "Duplicate image placeholder text · rename or remove it before sending"
this.status.content = "Duplicate image placeholder. Rename or remove it before sending."
return false
}
if (!this.hasPrompt(prompt)) return false
@@ -1232,11 +1232,11 @@ export class NanobotTui {
if (!this.activeTurn || !this.ready) return
const visibleContent = this.composer.plainText.trim()
if (this.draft.media(visibleContent).length) {
this.status.content = "Images cannot be queued · press Enter to send now"
this.status.content = "Images cannot be queued. Press Enter to send now."
return
}
if (this.commandMenu.resolve(visibleContent)?.source === "tui") {
this.status.content = "Local commands cannot be queued · press Enter to run"
this.status.content = "Local commands cannot be queued. Press Enter to run."
return
}
const content = this.draft.expand(visibleContent).trim()
@@ -1916,7 +1916,7 @@ export class NanobotTui {
return
}
this.composer.insertText(insertion.text)
this.status.content = `Pasted ${insertion.description} · review before sending`
this.status.content = `Pasted ${insertion.description}. Review before sending.`
} catch (error) {
if (
this.quitting
@@ -1940,7 +1940,7 @@ export class NanobotTui {
if (!insertion.text) return
this.composer.insertText(insertion.text)
if (insertion.compacted) {
this.status.content = `Pasted ${insertion.description} · review before sending`
this.status.content = `Pasted ${insertion.description}. Review before sending.`
}
}
@@ -2068,7 +2068,7 @@ export class NanobotTui {
this.ready = false
this.clearPromptQueue()
this.sessionMetadataId += 1
this.sessionTitle = `Fork · ${preview.slice(0, 48)}`
this.sessionTitle = `Fork: ${preview.slice(0, 48)}`
this.host.reportTitle(preview)
this.contextTokens = null
this.lastUsage = null
@@ -2381,7 +2381,7 @@ export class NanobotTui {
this.usagePanel.show(snapshot)
} catch {
if (!current() || this.usageRefreshPending) return
this.usagePanel.showMessage("Usage unavailable · reopen /usage to retry")
this.usagePanel.showMessage("Usage unavailable. Reopen /usage to retry.")
} finally {
// A dismissed request must not clear a reopened panel's request or queued refresh.
if (request === this.usageRequest) {
@@ -2411,7 +2411,7 @@ export class NanobotTui {
this.apiReauthenticator,
)
if (!context) {
this.status.content = "Context unavailable · new session or older gateway"
this.status.content = "Context unavailable for this session or gateway."
return
}
this.contextTokens = context.estimatedSessionTokens
@@ -2510,7 +2510,7 @@ export class NanobotTui {
this.historyBeforeCursor = history.beforeCursor
this.historyHasMore = history.hasMoreBefore
this.status.content = history.hasMoreBefore
? `${history.messages.length} earlier messages · PageUp for more`
? `${history.messages.length} earlier messages PageUp for more`
: "Start of session"
} catch (error) {
if (hydrationId !== this.hydrationId) return
+3 -3
View File
@@ -371,7 +371,7 @@ describe("NanobotTui composer", () => {
setup.mockInput.pressKey("v", { ctrl: true })
await waitUntil(() => ui.composer.plainText === "/model [Image #1] ")
ui.composer.submit()
await waitUntil(() => ui.status.plainText.includes("Images cannot be used with commands"))
await waitUntil(() => ui.status.plainText.includes("Remove the image before running a command."))
expect(sent).toEqual([])
expect(ui.composer.plainText).toBe("/model [Image #1] ")
@@ -485,7 +485,7 @@ describe("NanobotTui composer", () => {
ui.composer.setText("first")
ui.composer.submit()
await waitUntil(() => sent.length === 1)
expect(ui.composer.placeholder).toBe("Enter send now · Tab send next")
expect(ui.composer.placeholder).toBe("Enter send now Tab send next")
ui.composer.setText("one more detail")
await setup.flush()
@@ -495,7 +495,7 @@ describe("NanobotTui composer", () => {
ui.composer.submit()
await waitUntil(() => sent.length === 2)
expect(ui.status.plainText).not.toContain("Steering")
expect(ui.composer.placeholder).toBe("Enter send now · Tab send next")
expect(ui.composer.placeholder).toBe("Enter send now Tab send next")
expect(sentOptions[1]).toEqual({
cliApps: [{ name: "github" }],
mcpPresets: [],
+1 -1
View File
@@ -75,7 +75,7 @@ describe("NanobotTui with a Herdr pane title reporter", () => {
expect(activeFrame).toContain("default ▾")
expect(occurrences(activeFrame, "› Ship the Herdr integration")).toBe(1)
expect(occurrences(activeFrame, "app.ts")).toBe(1)
expect(ui.composer.placeholder).toBe("Enter send now · Tab send next")
expect(ui.composer.placeholder).toBe("Enter send now Tab send next")
expect(ui.composerFrame.height).toBe(3)
expect(titles).toEqual(["Ship the Herdr integration"])
+5 -5
View File
@@ -103,7 +103,7 @@ describe("NanobotTui layout and themes", () => {
expect(frame).toContain("✓ Read config.json")
expect(frame).not.toContain("› Read")
expect(frame).not.toContain("private chain of thought")
expect(frame).toContain("Ready · 1.2s")
expect(frame).toContain("Ready 1.2s")
})
test("keeps model and access details in the composer controls only", async () => {
@@ -191,9 +191,9 @@ describe("NanobotTui layout and themes", () => {
expect(frame).not.toContain("Steer this turn…")
expect(frame).not.toContain("Ask a follow-up…")
if (width >= 40 && height >= 9) {
expect(occurrences(frame, "Enter send now · Tab send next")).toBe(1)
expect(occurrences(frame, "Enter send now Tab send next")).toBe(1)
} else if (width >= 28 && height >= 9) {
expect(occurrences(frame, "Enter now · Tab next")).toBe(1)
expect(occurrences(frame, "Enter now Tab next")).toBe(1)
}
expect(occurrences(frame, "default ▾")).toBe(height >= 14 ? 1 : 0)
}
@@ -616,8 +616,8 @@ describe("NanobotTui layout and themes", () => {
})
await setup.flush()
const footer = setup.captureCharFrame().split("\n").find((line) => line.includes("Ready · 1.7s")) || ""
expect(footer).toContain("Ready · 1.7s")
const footer = setup.captureCharFrame().split("\n").find((line) => line.includes("Ready 1.7s")) || ""
expect(footer).toContain("Ready 1.7s")
expect(footer).toContain("11% context")
})
+2 -2
View File
@@ -23,8 +23,8 @@ import type { UsagePanel } from "../views/usage-panel"
import type { Palette } from "./theme"
export const COMPOSER_PLACEHOLDER = "Ask nanobot anything"
export const ACTIVE_COMPOSER_PLACEHOLDER = "Enter send now · Tab send next"
export const COMPACT_ACTIVE_COMPOSER_PLACEHOLDER = "Enter now · Tab next"
export const ACTIVE_COMPOSER_PLACEHOLDER = "Enter send now Tab send next"
export const COMPACT_ACTIVE_COMPOSER_PLACEHOLDER = "Enter now Tab next"
const TRANSCRIPT_EDGE_INSET = 1
const TRANSCRIPT_TEXT_INSET = TRANSCRIPT_EDGE_INSET + 2
+4 -3
View File
@@ -114,7 +114,7 @@ describe("NanobotTui lifecycle", () => {
attempt: 9,
elapsedMs: 3_800,
})
expect(ui.status.plainText).toBe("Nanobot unavailable · restart nanobot")
expect(ui.status.plainText).toBe("Nanobot unavailable. Restart nanobot.")
expect(ui.status.plainText).not.toContain("gateway")
expect(ui.status.plainText).not.toContain("127.0.0.1")
expect(ui.status.plainText).not.toContain("HTTP")
@@ -328,7 +328,8 @@ describe("NanobotTui lifecycle", () => {
expect(sent).toEqual([])
expect(composer.plainText).toBe("sent during reconnect")
expect(ui.status.plainText).toContain("Not sent · press Enter to retry when ready")
expect(ui.status.plainText).toContain("Not sent.")
expect(ui.status.plainText).toContain("Press Enter to retry when ready.")
resolveReconnect(new Response(JSON.stringify({
schemaVersion: 3, projection: "events",
@@ -336,7 +337,7 @@ describe("NanobotTui lifecycle", () => {
page: { has_more_before: false },
})))
await waitUntil(() => ui.ready)
expect(ui.status.plainText).toBe("Not sent · press Enter to retry")
expect(ui.status.plainText).toBe("Not sent. Press Enter to retry.")
composer.submit()
await waitUntil(() => sent.length === 1)
await setup.flush()
+7 -7
View File
@@ -628,7 +628,7 @@ describe("NanobotTui session navigation", () => {
await setup.renderOnce()
expect(setup.captureCharFrame()).toContain("⚠ Task interrupted")
expect(setup.captureCharFrame()).toContain("Tools will not replay automatically")
expect(ui.status.plainText).toContain("continue or dismiss")
expect(ui.status.plainText).toContain("Continue or dismiss.")
expect(ui.activeTurn).toBe(false)
expect(ui.composer.focused).toBe(true)
@@ -675,7 +675,7 @@ describe("NanobotTui session navigation", () => {
const unavailableFrame = setup.captureCharFrame()
expect(unavailableFrame).toContain("can’t be resumed safely")
expect(unavailableFrame).not.toContain("Continue")
expect(ui.status.plainText).toContain("dismiss to start a new message")
expect(ui.status.plainText).toContain("Dismiss to start a new message.")
app.accept({
event: "recovery_state",
@@ -886,7 +886,7 @@ describe("NanobotTui session navigation", () => {
expect(ui.runtimeControls.contextText.plainText).toContain("~2.2k ctx")
const frame = setup.captureCharFrame()
expect(frame).toContain("~2.2k tokens · 10 replay · 16 archived")
expect(frame).toContain("~2.2k tokens 10 replay 16 archived")
expect(frame).toContain("The earlier turns agreed on a release plan.")
expect(frame).not.toContain("Agent context")
expect(frame).not.toContain("summary active")
@@ -966,8 +966,8 @@ describe("NanobotTui session navigation", () => {
await waitUntil(() => ui.diffViewer.visible)
await setup.flush()
let frame = setup.captureCharFrame()
expect(frame).toContain("Diff · Last turn · 2 changes · +3 -1")
expect(frame).toContain("1/2 · src/first.ts · +2 -1")
expect(frame).toContain("Last turn changes 2 changes +3 -1")
expect(frame).toContain("1/2 src/first.ts +2 -1")
expect(frame).toContain("const newValue = 2")
expect(frame).toContain("Diff truncated by the gateway")
expect(frame).not.toContain("Ask nanobot anything")
@@ -975,7 +975,7 @@ describe("NanobotTui session navigation", () => {
setup.mockInput.pressArrow("right")
await setup.flush()
frame = setup.captureCharFrame()
expect(frame).toContain("2/2 · src/second.py · +1 -0")
expect(frame).toContain("2/2 src/second.py +1 -0")
expect(frame).toContain("print('hello')")
setup.renderer.emit(CliRenderEvents.THEME_MODE, "light")
@@ -985,7 +985,7 @@ describe("NanobotTui session navigation", () => {
setup.resize(52, 18)
await setup.renderOnce()
expect(setup.captureCharFrame()).toContain("←/→ file · pgup/pgdn · esc")
expect(setup.captureCharFrame()).toContain("←/→ file pgup/pgdn esc")
setup.mockInput.pressEscape()
await waitUntil(() => !ui.diffViewer.visible)
+3 -3
View File
@@ -17,7 +17,7 @@ export function connectionStatusText(
? "Still getting ready…"
: "Nanobot is taking longer to respond…"
}
if (status === "error") return "Nanobot unavailable · restart nanobot"
if (status === "error") return "Nanobot unavailable. Restart nanobot."
return "Session ended"
}
@@ -47,7 +47,7 @@ export interface RenderedRetryStatus extends RetryStatus {
export function retryStatusLine(status: RenderedRetryStatus, nowMs = Date.now()): string {
const label = retryFailureLabel(status.error_kind)
if (status.state === "exhausted") return `${label} · ending turn`
if (status.state === "exhausted") return `${label}. Ending turn.`
if (status.state === "recovered") return "Connection restored"
if (status.state === "cleared") return "Retry status cleared"
const remaining = Math.max(
@@ -57,7 +57,7 @@ export function retryStatusLine(status: RenderedRetryStatus, nowMs = Date.now())
const attempt = status.max_attempts
? `${status.attempt}/${status.max_attempts}`
: String(status.attempt)
return `${label} · retrying in ${remaining}s · attempt ${attempt}`
return `${label}. Retrying in ${remaining}s (attempt ${attempt}).`
}
export function sessionExitMessage(chatId: string): string {
+4 -4
View File
@@ -206,7 +206,7 @@ describe("NanobotTui transcript", () => {
}
const status = ui.status
expect(status.plainText).toMatch(/^Thinking\s+0s/u)
expect(ui.composer.placeholder).toBe("Enter send now · Tab send next")
expect(ui.composer.placeholder).toBe("Enter send now Tab send next")
expect(ui.composerFrame.height).toBe(3)
const shimmerColors = new Set(
status.content.chunks
@@ -260,7 +260,7 @@ describe("NanobotTui transcript", () => {
retry_after_s: 5,
})
expect(ui.status.plainText).toMatch(
/^Could not connect to the model provider · retrying in [45]s · attempt 1\/4/u,
/^Could not connect to the model provider\. Retrying in [45]s \(attempt 1\/4\)\./u,
)
app.accept({
@@ -325,7 +325,7 @@ describe("NanobotTui transcript", () => {
await setup.renderOnce()
let frame = setup.captureCharFrame()
expect(frame).toContain("7 earlier steps · Ctrl+O expand")
expect(frame).toContain("7 earlier steps Ctrl+O expand")
expect(frame).not.toContain("tool_0")
expect(frame).toContain("tool_7")
expect(frame).toContain("tool_9")
@@ -381,7 +381,7 @@ describe("NanobotTui transcript", () => {
await setup.renderOnce()
let frame = setup.captureCharFrame()
expect(frame).toContain("6 steps · Ctrl+O expand")
expect(frame).toContain("6 steps Ctrl+O expand")
expect(frame).toContain("✓ Read 6 files")
expect(frame).not.toContain("src/file-0.ts")
+4 -4
View File
@@ -90,12 +90,12 @@ describe("TUI /usage", () => {
await setup!.flush()
let frame = setup!.captureCharFrame()
expect(frame).toContain("Context 9k / 262k")
expect(frame).toContain("Round 2/2 · In 9,000 · Out 200")
expect(frame).toContain("Round 2/2 In 9,000 Out 200")
expect(frame).toContain("←→ round")
expect(sent).toEqual([])
setup!.mockInput.pressArrow("left")
await setup!.renderOnce()
expect(setup!.captureCharFrame()).toContain("Round 1/2 · In 3,000 · Out 100")
expect(setup!.captureCharFrame()).toContain("Round 1/2 In 3,000 Out 100")
expect(setup!.captureCharFrame()).toContain("Cache 0%")
for (const [width, height] of [[56, 18], [40, 10], [80, 30]] as const) {
setup!.resize(width, height)
@@ -140,7 +140,7 @@ describe("TUI /usage", () => {
await waitUntil(() => requests === 2)
await setup!.flush()
const frame = setup!.captureCharFrame()
expect(frame).toContain("Round 2/2 · In 12,000 · Out 200")
expect(frame).toContain("Round 2/2 In 12,000 Out 200")
expect(frame).not.toContain("Round 4/4")
expect(sent).toEqual([])
})
@@ -287,7 +287,7 @@ describe("TUI /usage", () => {
await close(ui)
fail = true
await open(ui)
expect(setup!.captureCharFrame()).toContain("Usage unavailable · reopen /usage to retry")
expect(setup!.captureCharFrame()).toContain("Usage unavailable. Reopen /usage to retry.")
await setup!.mockInput.typeText("hello")
expect(ui.usagePanel.visible).toBe(false)
expect(ui.composer.plainText).toBe("hello")
+1 -1
View File
@@ -70,7 +70,7 @@ export class QueuePreview {
this.header.content = new StyledText([
chunk("Queued next", this.theme.accent, true),
chunk(` ${messages.length}`, this.theme.faint),
chunk(` · ${this.editKey} edit last`, this.theme.faint),
chunk(` ${this.editKey} edit last`, this.theme.faint),
])
this.rows.forEach((row, index) => {
const message = visible[index]
+1 -1
View File
@@ -57,7 +57,7 @@ export class MentionMenu {
this.picker = new PickerMenu(renderer, theme, {
id: "nanobot-tui-mention-menu",
searchText: (item) => `${item.name} ${item.displayName} ${item.description}`,
render: (item) => `${item.displayName} @${item.name} · ${item.kind}`,
render: (item) => `${item.displayName} @${item.name} ${item.kind}`,
emptyText: "No matching sessions or tools",
})
this.root = this.picker.root
+2 -2
View File
@@ -189,7 +189,7 @@ describe("SessionMenu", () => {
menu.open(scoped, "one", 6)
await setup.renderOnce()
expect(setup.captureCharFrame()).not.toContain("nanobot · Codex")
expect(setup.captureCharFrame()).not.toContain("nanobot Codex")
menu.open([
scoped[0]!,
@@ -204,7 +204,7 @@ describe("SessionMenu", () => {
], "one", 6)
await setup.renderOnce()
const frame = setup.captureCharFrame()
expect(frame).toContain("nanobot · Codex")
expect(frame).toContain("nanobot Codex")
expect(frame).toContain("desktop")
menu.update("desktop", 6)
+1 -1
View File
@@ -64,7 +64,7 @@ export class SessionMenu {
this.modelOverride(session),
]
.filter(Boolean)
.join(" · ")
.join(" ")
const marker = this.marker(session)
const foreground = this.interrupted(session)
? this.theme.warning || this.theme.accent || this.theme.text
+4 -4
View File
@@ -321,7 +321,7 @@ export class Transcript {
notice(content: string, error = false): void {
this.noteOutput()
this.finishActivity()
this.writeRole(error ? "×" : "·", content, error ? "error" : "muted")
this.writeRole(error ? "×" : "", content, error ? "error" : "muted")
}
compaction(compaction: ContextCompaction, index?: number): boolean {
@@ -348,7 +348,7 @@ export class Transcript {
: compaction.phase === "succeeded"
? " ✓ Conversation compacted"
: compaction.phase === "cancelled"
? " · Conversation compaction cancelled"
? " Conversation compaction cancelled"
: " × Could not compact conversation"
entry.text.fg = compaction.phase === "failed" ? this.theme.error : this.theme.muted
return added
@@ -572,7 +572,7 @@ export class Transcript {
const hidden = activity.lines.length - visibleSteps
const disclosure = hidden > 0 ? `${hidden} earlier steps` : `${activity.lines.length} steps`
activity.text.content = [
` … ${disclosure} · Ctrl+O expand`,
` … ${disclosure} Ctrl+O expand`,
...visible.map((item) => item.text),
].join("\n")
}
@@ -757,7 +757,7 @@ export class Transcript {
function cleanProgress(value: string): string {
const text = value.trim().replace(/^\*\*(.*?)\*\*$/u, "$1").replace(/\s+/gu, " ")
return text ? ` · ${text}` : ""
return text ? ` ${text}` : ""
}
function activityPreview(lines: readonly string[]): ActivityPreviewItem[] {
+1 -1
View File
@@ -36,7 +36,7 @@ describe("ContextPanel", () => {
await setup.renderOnce()
const frame = setup.captureCharFrame()
expect(frame).toContain("~950 tokens · 8 replay · 0 archived")
expect(frame).toContain("~950 tokens 8 replay 0 archived")
expect(frame).not.toContain("Agent context")
expect(frame).not.toContain("no compacted summary")
})
+1 -1
View File
@@ -63,7 +63,7 @@ export class ContextPanel {
}
show(context: SessionContextSnapshot): void {
this.stats.content = `~${formatTokenCount(context.estimatedSessionTokens)} tokens · ${context.replayMessages} replay · ${context.archivedMessages} archived`
this.stats.content = `~${formatTokenCount(context.estimatedSessionTokens)} tokens ${context.replayMessages} replay ${context.archivedMessages} archived`
this.summary.content = context.archivedSummary ?? ""
this.root.visible = true
}
+9 -9
View File
@@ -124,7 +124,7 @@ export class DiffViewer {
})
this.header = new TextRenderable(renderer, {
id: "nanobot-tui-diff-header",
content: "Diff · Last turn",
content: "Last turn changes",
width: "100%",
height: 1,
flexShrink: 0,
@@ -160,7 +160,7 @@ export class DiffViewer {
hideScrollbars(this.scroll)
this.footer = new TextRenderable(renderer, {
id: "nanobot-tui-diff-footer",
content: "←/→ file · pgup/pgdn scroll · esc close",
content: "←/→ file pgup/pgdn scroll esc close",
width: "100%",
height: 1,
flexShrink: 0,
@@ -223,8 +223,8 @@ export class DiffViewer {
resize(width: number): void {
this.footer.content = width >= 58
? "←/→ file · pgup/pgdn scroll · home/end · esc close"
: "←/→ file · pgup/pgdn · esc"
? "←/→ file pgup/pgdn scroll home/end esc close"
: "←/→ file pgup/pgdn esc"
}
setTheme(theme: DiffViewerTheme): void {
@@ -256,8 +256,8 @@ export class DiffViewer {
const totalDeleted = this.items.reduce((sum, item) => sum + Math.max(0, item.edit.deleted || 0), 0)
const count = this.items.length
this.header.content = count
? `Diff · Last turn · ${count} ${count === 1 ? "change" : "changes"} · +${totalAdded} -${totalDeleted}`
: "Diff · Last turn"
? `Last turn changes ${count} ${count === 1 ? "change" : "changes"} +${totalAdded} -${totalDeleted}`
: "Last turn changes"
const item = this.items[this.selected]
if (!item) {
this.fileHeader.content = "No file changes in the last turn."
@@ -265,9 +265,9 @@ export class DiffViewer {
return
}
const edit = item.edit
const index = this.items.length > 1 ? `${this.selected + 1}/${this.items.length} · ` : ""
const state = edit.status === "editing" ? " · editing" : edit.status === "error" ? " · failed" : ""
this.fileHeader.content = `${index}${edit.path || "Unknown file"} · ${stat(edit)}${state}`
const index = this.items.length > 1 ? `${this.selected + 1}/${this.items.length} ` : ""
const state = edit.status === "editing" ? " editing" : edit.status === "error" ? " failed" : ""
this.fileHeader.content = `${index}${edit.path || "Unknown file"} ${stat(edit)}${state}`
const text = edit.diff?.format === "unified" ? edit.diff.text?.trimEnd() : ""
if (text) {
this.scroll.add(new DiffRenderable(this.renderer, {
+1 -1
View File
@@ -16,7 +16,7 @@ describe("footerHints", () => {
{ key: "ctrl+c", label: "stop", tone: "danger" },
], theme)
expect(result.chunks.map(({ text }) => text).join("")).toBe("enter steer · ctrl+c stop")
expect(result.chunks.map(({ text }) => text).join("")).toBe("enter steer ctrl+c stop")
expect(result.chunks[0]?.fg?.toInts().slice(0, 3)).toEqual([239, 142, 48])
expect(result.chunks[3]?.fg?.toInts().slice(0, 3)).toEqual([248, 113, 113])
})
+1 -1
View File
@@ -60,7 +60,7 @@ export function footerTelemetry(
export function footerHints(hints: readonly FooterHint[], theme: FooterHintTheme): StyledText {
const chunks: TextChunk[] = []
hints.forEach((hint, index) => {
if (index) chunks.push(chunk(" · ", theme.separator))
if (index) chunks.push(chunk(" ", theme.muted))
const color = hint.tone === "danger" ? theme.danger : theme.accent
chunks.push(chunk(hint.key, color, true))
chunks.push(chunk(` ${hint.label}`, theme.muted))
+6 -6
View File
@@ -35,9 +35,9 @@ describe("UsagePanel", () => {
const frame = setup.captureCharFrame()
expect(frame).toContain("Context 9k / 262k")
expect(frame).toContain("3%")
expect(frame).toContain("Input tokens · max 9k")
expect(frame).toContain("Round 3/3 · In 9,000 · Out 800")
expect(frame).toContain("Cache 67% · 1.5s · includes estimated usage")
expect(frame).toContain("Input tokens (max 9k)")
expect(frame).toContain("Round 3/3 In 9,000 Out 800")
expect(frame).toContain("Cache 67% 1.5s includes estimated usage")
expect(frame).toContain("Uncached")
expect(frame).toContain("Unknown cache")
expect(frame).toContain("███")
@@ -50,7 +50,7 @@ describe("UsagePanel", () => {
panel.move(-1)
panel.move(-1)
await setup.renderOnce()
expect(setup.captureCharFrame()).toContain("Round 1/3 · In 3,000 · Out 200")
expect(setup.captureCharFrame()).toContain("Round 1/3 In 3,000 Out 200")
expect(setup.captureCharFrame()).toContain("Cache ?")
})
@@ -189,7 +189,7 @@ describe("UsagePanel", () => {
const frame = setup.captureCharFrame()
expect(frame).toContain("Context 2k / 1k")
expect(frame).toContain("100%")
expect(frame).toContain("In 2,000 · Out ?")
expect(frame).toContain("In 2,000 Out ?")
expect(frame).toContain("Cache 100%")
})
@@ -235,7 +235,7 @@ describe("UsagePanel", () => {
panel.resize(80, 30)
panel.setTheme({ ...theme, text: "#18181B", border: "#D4D4D8" })
await setup.renderOnce()
expect(setup.captureCharFrame()).toContain("Round 3/3 · In 9,000 · Out 800")
expect(setup.captureCharFrame()).toContain("Round 3/3 In 9,000 Out 800")
panel.hide()
await setup.renderOnce()
expect(setup.captureCharFrame()).not.toContain("Context")
+4 -4
View File
@@ -148,7 +148,7 @@ export class UsagePanel {
if (!compact) line("")
const inputs = rounds.map((round) => round.prompt_tokens ?? 0)
const max = Math.max(1, ...inputs)
if (!tiny) heading(width < 48 ? "Rounds" : "Recent rounds", `Input tokens · max ${formatTokenCount(max)}`)
if (!tiny) heading(width < 48 ? "Rounds" : "Recent rounds", `Input tokens (max ${formatTokenCount(max)})`)
const chartHeight = Math.max(1, Math.min(6, this.height - 18))
const slot = Math.max(1, Math.floor(width / rounds.length))
const barWidth = Math.min(3, Math.max(1, slot - 1))
@@ -187,13 +187,13 @@ export class UsagePanel {
if (round && !tiny) {
const input = round.prompt_tokens ?? 0
const count = (value: number | undefined) => known(value) ? value.toLocaleString("en-US") : "?"
line(`${width < 48 ? "" : "Round "}${this.selected + 1}/${rounds.length} · In ${count(input)} · Out ${count(round.completion_tokens)}`)
line(`${width < 48 ? "" : "Round "}${this.selected + 1}/${rounds.length} In ${count(input)} Out ${count(round.completion_tokens)}`)
const cache = known(round.cached_tokens)
? `${Math.round(Math.min(input, round.cached_tokens) / input * 100)}%` : "?"
const time = known(round.generation_ms) ? ` · ${(round.generation_ms / 1000).toFixed(1)}s` : ""
const time = known(round.generation_ms) ? ` ${(round.generation_ms / 1000).toFixed(1)}s` : ""
if (!compact) {
const estimated = known(round.estimated_tokens) && round.estimated_tokens > 0
line(`Cache ${cache}${time}${estimated && width >= 48 ? " · includes estimated usage" : ""}`, theme.muted)
line(`Cache ${cache}${time}${estimated && width >= 48 ? " includes estimated usage" : ""}`, theme.muted)
if (estimated && width < 48) line("Includes estimated usage", theme.muted)
}
}