fix(tui): remove redundant launch header details

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-29 14:34:01 +08:00
1 parent 509304f9bb
commit 3cf6ed60ce
3 files changed
+25 -11

No files matched your search

+23 -1
View File
@@ -240,6 +240,28 @@ describe("NanobotTui layout", () => {
expect(frame).toContain("Ready · 1.2s") expect(frame).toContain("Ready · 1.2s")
}) })
test("keeps model and access details in the composer controls only", async () => {
setup = await createRenderer({ width: 100, height: 24, screenMode: "alternate-screen" })
NanobotTui.mount(
setup.renderer,
{
...options,
model: "provider/resolved-model",
modelPreset: "selected-preset",
access: "full access",
},
client(),
new MockTreeSitterClient({ autoResolveTimeout: 0 }),
)
await setup.renderOnce()
const frame = setup.captureCharFrame()
expect(frame).not.toContain("provider/resolved-model")
expect(frame).toContain("selected-preset ▾")
expect(occurrences(frame, "full access")).toBe(1)
expect(frame).toContain(options.workspace)
})
test("uses the available transcript width before wrapping the workspace", async () => { test("uses the available transcript width before wrapping the workspace", async () => {
setup = await createRenderer({ width: 100, height: 24, screenMode: "alternate-screen" }) setup = await createRenderer({ width: 100, height: 24, screenMode: "alternate-screen" })
const workspace = String.raw`D:\Documents\GitHub\nanobot\.worktrees\responsive-header-fixture` const workspace = String.raw`D:\Documents\GitHub\nanobot\.worktrees\responsive-header-fixture`
@@ -3230,7 +3252,7 @@ describe("NanobotTui layout", () => {
expect((failure as TextRenderable).fg.toInts().slice(0, 3)).toEqual([ expect((failure as TextRenderable).fg.toInts().slice(0, 3)).toEqual([
1, 3, 5, 1, 3, 5,
].map((offset) => Number.parseInt(ui.palette.error.slice(offset, offset + 2), 16))) ].map((offset) => Number.parseInt(ui.palette.error.slice(offset, offset + 2), 16)))
ui.transcript.reset({ model: "model", workspace: "workspace", version: "test", access: "workspace" }) ui.transcript.reset({ workspace: "workspace", version: "test" })
app.accept({ event: "context_compaction", chat_id: "chat", compaction_id: "recent", phase: "started" }) app.accept({ event: "context_compaction", chat_id: "chat", compaction_id: "recent", phase: "started" })
await setup.renderOnce() await setup.renderOnce()
expect(setup.captureCharFrame()).toContain("Compacting conversation…") expect(setup.captureCharFrame()).toContain("Compacting conversation…")
+1 -3
View File
@@ -911,7 +911,7 @@ export class NanobotTui {
this.renderer.console.onCopySelection = (text) => void this.copySelection(text) this.renderer.console.onCopySelection = (text) => void this.copySelection(text)
this.handleResize() this.handleResize()
this.composer.focus() this.composer.focus()
this.transcript.header(options) this.transcript.header({ workspace: options.workspace, version: options.version })
} }
static async create(options: AppOptions): Promise<NanobotTui> { static async create(options: AppOptions): Promise<NanobotTui> {
@@ -1435,10 +1435,8 @@ export class NanobotTui {
this.historyHasMore = false this.historyHasMore = false
this.historyLoadingOlder = false this.historyLoadingOlder = false
this.transcript.reset({ this.transcript.reset({
model: this.modelName || this.modelPreset,
workspace: this.options.workspace, workspace: this.options.workspace,
version: this.options.version, version: this.options.version,
access: this.options.access,
}) })
} }
if (restoring || (!this.historyLoaded && this.options.chatId)) { if (restoring || (!this.historyLoaded && this.options.chatId)) {
+1 -7
View File
@@ -38,10 +38,8 @@ export interface TranscriptTheme {
} }
export interface TranscriptHeader { export interface TranscriptHeader {
model: string
workspace: string workspace: string
version: string version: string
access: string
} }
export interface TranscriptNavigation { export interface TranscriptNavigation {
@@ -215,11 +213,7 @@ export class Transcript {
paddingRight: 1, paddingRight: 1,
}) })
const title = this.createText(`>_ nanobot v${options.version}`, "text", true) const title = this.createText(`>_ nanobot v${options.version}`, "text", true)
const context = this.createText([ const context = this.createText(["", options.workspace].join("\n"), "muted")
"",
`${options.model} ${options.access}`,
options.workspace,
].join("\n"), "muted")
row.add(title) row.add(title)
row.add(context) row.add(context)
this.root.add(row) this.root.add(row)