fix(tui): restore compaction model marker

This commit is contained in:
Kit Langton 2026-07-14 11:35:12 -04:00
commit 76f205d260
13 changed files with 105 additions and 19 deletions

View file

@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test"
import { formatRef, parse, switchLabel } from "../../src/util/model"
import { compactionMarker, formatRef, parse, switchLabel } from "../../src/util/model"
describe("util.model", () => {
test("splits provider from a nested model identifier", () => {
@ -12,6 +12,20 @@ describe("util.model", () => {
expect(formatRef({ providerID: "anthropic", id: "sonnet" })).toBe("anthropic/sonnet")
})
test("labels completed compactions with their actual model", () => {
const models = [{ providerID: "anthropic", id: "sonnet", name: "Claude Sonnet" }]
expect(compactionMarker({ providerID: "anthropic", id: "sonnet" }, models)).toEqual({
agent: "compaction",
model: "Claude Sonnet",
})
expect(compactionMarker({ providerID: "removed", id: "gone", variant: "high" }, models)).toEqual({
agent: "compaction",
model: "removed/gone/high",
})
expect(compactionMarker(undefined, models)).toBeUndefined()
})
test("includes the selected variant in model switch notices", () => {
expect(switchLabel({ providerID: "anthropic", id: "sonnet", variant: "thinking" })).toBe(
"Switched model to anthropic/sonnet/thinking",