tui: resolve default mini footer agent (#38315)

This commit is contained in:
Simon Klee 2026-07-22 15:42:12 +02:00 committed by GitHub
commit 5841b04fe7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 7 deletions

View file

@ -1,6 +1,6 @@
import { expect, test } from "bun:test"
import { coalesceProgressCommit } from "../../src/mini/footer"
import type { StreamCommit } from "../../src/mini/types"
import { coalesceProgressCommit, resolveRunAgent } from "../../src/mini/footer"
import type { RunAgent, StreamCommit } from "../../src/mini/types"
function progress(input: Partial<StreamCommit> = {}): StreamCommit {
return {
@ -23,3 +23,16 @@ test("coalesces progress only within the same message and tool state", () => {
progress({ text: "onetwo", directory: "/latest" }),
)
})
test("resolves the first selectable agent when none is selected", () => {
const agents: RunAgent[] = [
{ id: "task", name: "Task", mode: "subagent", hidden: false },
{ id: "secret", name: "Secret", mode: "primary", hidden: true },
{ id: "build", name: "Build", mode: "primary", hidden: false },
{ id: "plan", name: "Plan", mode: "primary", hidden: false },
]
expect(resolveRunAgent(agents, undefined)?.id).toBe("build")
expect(resolveRunAgent(agents, "plan")?.id).toBe("plan")
expect(resolveRunAgent(agents, "missing")?.id).toBe("build")
})