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")