Claude Code. Any Model. The most powerful AI coding agent now speaks every language.
feat(picker): fill the notable state only, and measure every chip against both terminals
Jack Rudenkof1f09a353281
diff --git a/packages/cli/src/picker/ModelPicker.test.tsx b/packages/cli/src/picker/ModelPicker.test.tsxindex 7899c915..d162f53b 100644--- a/packages/cli/src/picker/ModelPicker.test.tsx+++ b/packages/cli/src/picker/ModelPicker.test.tsx@@ -194,6 +194,14 @@ const rgb = (hex: string): string =>* keystroke just left, so a predicate on it is satisfied before anything has* happened and waits for nothing.*/+/** Every span in the frame, flattened — chips are spans, not rows. */+const spansOf = (f: CapturedFrame): CapturedFrame["lines"][number]["spans"] =>+ f.lines.flatMap((l) => l.spans);+/** The spans whose LABEL is `label`, whatever fill they carry. */+const labelled = (f: CapturedFrame, label: string): CapturedFrame["lines"][number]["spans"] =>+ spansOf(f).filter((sp) => sp.text.trim() === label);+const bgOf = (sp: CapturedFrame["lines"][number]["spans"][number]): string =>+ sp.bg.toInts().slice(0, 3).join();const listPainted = (t: string[]): boolean => t.join("").includes("newest first");const providerListPainted = (t: string[]): boolean => t.join("").includes("choose a provider");/** Rows that carry painted content — the dialog's actual footprint. */@@ -324,6 +332,189 @@ describe("the dialog", () => {});});+// ── the chips: a fill is invisible to a character frame ──────────────────────────++describe("the billing and prefix CHIPS", () => {+ const roster = [+ provider({ value: "cx", label: "OpenAI Codex", shortcut: "cx@", billing: "sub" }),+ provider({ value: "or", label: "OpenRouter", shortcut: "or@", billing: "metered" }),+ ];++ test("NO COLUMN IS A BAND: the prefix and `$` carry no fill at all", async () => {+ // THE REJECTED PASS CHIPPED BOTH, and `captureCharFrame` was blind to the+ // result: every one of the 17 provider rows had a fill in the prefix cell and a+ // fill in the billing cell, with no blank row between them, so the two columns+ // fused into a solid grey vertical band and a solid green one with the labels+ // floating inside. The owner's verdict was "that is super ugly". A fill marks+ // the NOTABLE member of a column; a column where every row qualifies has none.+ const d = await draw(<ModelPicker source={fakeSource({ roster })} onDone={() => {}} />);+ try {+ await d.until(providerListPainted);+ const f = d.recapture().frame;+ for (const token of ["cx@", "or@", "$"]) {+ // `includes`, not an exact match: unfilled cells that share a foreground+ // MERGE into one span, and `or@` sharing the muted hue with the `$` beside+ // it is itself evidence that neither of them is carrying a fill.+ const spans = spansOf(f).filter((sp) => sp.text.includes(token));+ expect({ token, found: spans.length > 0 }).toEqual({ token, found: true });+ for (const sp of spans) {+ // The row's own background — the panel, or the selection wash on the row+ // under the cursor — and never a fill of the cell's own.+ expect({ token, bg: bgOf(sp) }).toEqual({+ token,+ bg: bgOf(sp) === rgb(C.bgHighlight) ? rgb(C.bgHighlight) : rgb(C.bgAlt),+ });+ }+ }+ } finally {+ d.destroy();+ }+ });++ test("`SUB` IS PAINTED ON THE POSITIVE FILL, AND NEVER ON THE FAILURE ONE", async () => {+ // THE DEFECT THIS PINS SHIPPED, AND `captureCharFrame` IS BLIND TO IT. The frame+ // reads `SUB` either way; only the FILL says whether the user is being told+ // "you already pay for this" or "something went wrong". It was `tokens.warn` —+ // `C.orange`, the hue this dialog spends on a failure — under a label that means+ // the opposite of a failure.+ const d = await draw(<ModelPicker source={fakeSource({ roster })} onDone={() => {}} />);+ try {+ await d.until(providerListPainted);+ const chips = labelled(d.recapture().frame, "SUB");+ expect(chips.length).toBeGreaterThan(0);+ for (const chip of chips) {+ expect(bgOf(chip)).toBe(rgb(C.pillKeyBg));+ expect(bgOf(chip)).not.toBe(rgb(C.red));+ expect(bgOf(chip)).not.toBe(rgb(C.orange));+ }+ } finally {+ d.destroy();+ }+ });++ test("a chip's FILL is exactly `label + 2` cells — the padding is OUTSIDE it", async () => {+ // THE MEASURED FAILURE THIS GUARDS: `label={padTo("SUB", 6)}` looks identical and+ // is not — the padding lands inside `bg`, and 24 chips padded that way fused into+ // one solid rectangle running down the panel with the labels floating in it. An+ // earlier pass in this very project reverted chips to coloured text three times+ // over it. The column is aligned by a plain filler span AFTER the chip, so the+ // fill stays a chip however wide the cell is.+ const d = await draw(<ModelPicker source={fakeSource({ roster })} onDone={() => {}} />);+ try {+ await d.until(providerListPainted);+ const f = d.recapture().frame;+ const filled = spansOf(f).filter(+ (sp) => bgOf(sp) === rgb(C.pillKeyBg) || bgOf(sp) === rgb(C.chipKeycapBg)+ );+ expect(filled.length).toBeGreaterThan(0);+ for (const sp of filled) {+ expect({ text: sp.text, cells: sp.text.length }).toEqual({+ text: ` ${sp.text.trim()} `,+ cells: sp.text.trim().length + 2,+ });+ }+ } finally {+ d.destroy();+ }+ });++ test("A FOOTER KEYCAP IS A VIVID BLOCK WITH WHITE INK, never a grey word", async () => {+ // Grey was measured and rejected once per palette — 1.50:1 on a dark page,+ // 2.38:1 on a light one — so on whichever terminal it was not tuned for the key+ // melted into the background. `captureCharFrame` reads ` k ` either way; only+ // the fill says whether it reads as a key you press.+ const d = await draw(<ModelPicker source={fakeSource({ roster })} onDone={() => {}} />);+ try {+ await d.until(providerListPainted);+ const caps = labelled(d.recapture().frame, "esc");+ expect(caps.length).toBeGreaterThan(0);+ for (const cap of caps) {+ expect(bgOf(cap)).toBe(rgb(C.chipKeycapBg));+ expect(bgOf(cap)).not.toBe(rgb(C.chipKeyBg));+ expect(cap.fg.toInts().slice(0, 3).join()).toBe(rgb(C.ink));+ }+ } finally {+ d.destroy();+ }+ });++ test("NO CHIP COLUMN FUSES: a flat-rate roster prints words, not a green slab", async () => {+ // A scoped subscription provider answers `SUB` for EVERY row, so a chipped price+ // column there is the rectangle by construction — and no amount of correct+ // padding prevents it, because the padding is not what makes the fills identical.+ // `kimi-coding` is a real `SUBSCRIPTION_PROVIDERS` uid, so the price resolver+ // answers `SUB` here exactly as it does on the live screen the owner was reading.+ const d = await draw(+ <ModelPicker+ source={fakeSource({+ roster: [+ provider({+ value: "kimi-coding",+ label: "Kimi Coding",+ shortcut: "kc@",+ billing: "sub",+ hasDiscovery: false,+ }),+ ],+ served: Array.from({ length: 8 }, (_, i) => model({ id: `m-${i}` })),+ byProvider: {+ "kimi-coding": Array.from({ length: 8 }, (_, i) => model({ id: `m-${i}` })),+ },+ })}+ onDone={() => {}}+ />,+ 145,+ 45+ );+ try {+ await d.press(["RETURN"]);+ await d.until(listPainted);+ const shot = d.recapture();+ // Every row says SUB in words…+ expect(shot.text.filter((l) => /\bm-\d\b/.test(l) && l.includes("SUB")).length).toBe(8);+ // …and not one of them carries a FILL, so there is no column to fuse.+ expect(spansOf(shot.frame).filter((sp) => bgOf(sp) === rgb(C.pillKeyBg))).toEqual([]);+ } finally {+ d.destroy();+ }+ });++ test("INSIDE A PROVIDER THE PROVIDER COLUMN IS GONE, and the id takes its cells", async () => {+ // `OpenAI Codex` printed 49 times under a dialog titled `OpenAI Codex`. The header+ // must lose the label with the cells, or it points at a column that is not there.+ const d = await draw(+ <ModelPicker+ source={fakeSource({+ roster: [provider({ value: "openrouter", label: "OpenRouter", hasDiscovery: false })],+ byProvider: { openrouter: [model({ id: "gpt-6-astra" })] },+ })}+ onDone={() => {}}+ />,+ 145,+ 45+ );+ try {+ await d.press(["RETURN"]);+ await d.until(listPainted);+ const scoped = d.recapture().text;+ const header = scoped.find((l) => l.includes("ctx") && l.includes("$/1M")) ?? "";+ expect(header).not.toContain("provider");+ expect(scoped.filter((l) => /gpt-6-astra\s{2,}/.test(l) && l.includes("OpenRouter"))).toEqual(+ []+ );+ // It is still the whole point of the CROSS-PROVIDER list, so it stays there.+ await d.press(["ESCAPE"]);+ await d.until(providerListPainted);+ await d.press(["a"]);+ await d.until(listPainted);+ const flat = d.recapture().text;+ expect(flat.find((l) => l.includes("ctx") && l.includes("$/1M")) ?? "").toContain("provider");+ } finally {+ d.destroy();+ }+ });+});+// ── the landing screen, and everything it does NOT do ────────────────────────────describe("the picker opens on the PROVIDER list", () => {@@ -485,9 +676,13 @@ describe("entering a provider loads THAT provider, on demand", () => {try {await d.press(["RETURN"]);await d.until(listPainted);- const rows = d.recapture().text.filter((l) => l.includes("gpt-6-astra"));- // One list row, plus the detail line under the list that prints the spec.- expect(rows.filter((l) => l.includes("OpenRouter")).length).toBe(1);+ // ONE LIST ROW. The provider column is no longer drawn inside a provider — it+ // said `OpenRouter` 49 times under a dialog titled `OpenRouter` — so the row is+ // identified by its padded id cell instead: the id followed by the gap before+ // `ctx`. The detail line below prints `openrouter@gpt-6-astra · tools`, one+ // space and a `·`, and is not counted by that shape.+ const rows = d.recapture().text.filter((l) => /gpt-6-astra\s{2,}/.test(l));+ expect(rows.length).toBe(1);} finally {d.destroy();}diff --git a/packages/cli/src/picker/ModelPicker.tsx b/packages/cli/src/picker/ModelPicker.tsxindex f3304503..b4934f89 100644--- a/packages/cli/src/picker/ModelPicker.tsx+++ b/packages/cli/src/picker/ModelPicker.tsx@@ -101,7 +101,7 @@ import {providerColumn,scrollWindow,} from "./layout.js";-import { ColumnHeader, HintRow, ModelRow, ProviderRow } from "./rows.js";+import { ColumnHeader, HintRow, ModelRow, ProviderRow, priceVaries } from "./rows.js";/*** WHICH AFFORDANCE EACH IN-FLIGHT TASK EARNS — the honesty contract, as one pure@@ -391,12 +391,29 @@ export function ModelPicker({ source, onDone, onDiscoveryFailure }: ModelPickerP? 0: noticeRows(notice, Math.max(8, base.inner - 2), MAX_BANNER_ROWS).lines.length;const layout = deriveDialogLayout(width, height, bannerRows);+ /**+ * IS THE PROVIDER COLUMN WORTH ITS CELLS HERE?+ *+ * In the cross-provider list it is the whole point — the same model id appears on+ * three providers and the column is what tells them apart. Inside a provider it+ * prints one repeated name under a dialog titled with that same name: 49 rows of+ * `OpenAI Codex` under `OpenAI Codex`, eating the columns the model id wants. The+ * owner said so from a live run. One flag through `deriveRowLayout`, so the header+ * and the rows cannot disagree about whether the cell exists.+ */+ const showProviderColumn = scope === null;+ /**+ * DOES THE PRICE COLUMN EARN CHIPS? Only where it VARIES — see `rows.tsx`. A+ * flat-rate or local provider answers the same word for every row, and a column of+ * identical fills is the solid rectangle the skill measured.+ */+ const chipPrices = priceVaries(scope === null ? null : (scopedChoice?.billing ?? null));// `column.cells`, not `providerCells`: a collision may have WIDENED the column// past what the row budgeted, and the header and the rows must agree whichever// number won.const rowLayout = deriveRowLayout(layout.inner, {mark: list.fallback,- providerCells: column.cells,+ ...(showProviderColumn ? { providerCells: column.cells } : { provider: false }),});// The cursor can outlive the list it indexed — a filter keystroke, or a scope@@ -741,7 +758,11 @@ export function ModelPicker({ source, onDone, onDiscoveryFailure }: ModelPickerP{ key: "↑↓", label: "move" },{ key: "⏎", label: "open", on: here !== null },{ key: "a", label: "all models" },- { key: "k", label: revealKeyless ? "hide" : "keyless", on: keyless.length > 0 },+ // `keyless` SAID THE OPPOSITE OF WHAT IT MEANT. These providers need a+ // key — that is precisely why they are hidden — and "keyless" reads as+ // "no key required". The hint row above already says `need a key`, so+ // the footer now says it too, in 9 of the 76 columns 80 gives us.+ { key: "k", label: revealKeyless ? "hide" : "needs key", on: keyless.length > 0 },{ key: "c", label: "custom" },{ key: "esc", label: "quit" },]}@@ -854,6 +875,7 @@ export function ModelPicker({ source, onDone, onDiscoveryFailure }: ModelPickerPlayout={rowLayout}cursor={top + i === cursor}origin={list.fallback ? "catalog" : "roster"}+ chip={chipPrices}/>)))}@@ -870,6 +892,9 @@ export function ModelPicker({ source, onDone, onDiscoveryFailure }: ModelPickerP/><Rule />+ {/* THREE ROWS ON THE PANEL'S OWN BACKGROUND. They recede by their INK — a+ fill here was rejected on sight, and `Rule` above is already the+ separator a fill would have been a second copy of (`detail.tsx`). */}<SelectionLinemodel={selected?.model ?? null}spec={selected?.spec ?? null}diff --git a/packages/cli/src/picker/chrome.tsx b/packages/cli/src/picker/chrome.tsxindex a3417465..365b159f 100644--- a/packages/cli/src/picker/chrome.tsx+++ b/packages/cli/src/picker/chrome.tsx@@ -168,19 +168,25 @@ export interface Hint {* `BadgeSpan`, NOT `Badge`: one `<text>` per hint carries both the chip and its* label, and a `<text>` cannot nest in a `<text>`.*- * ONE FILL FOR EVERY KEYCAP, AND IT IS THE ONE THIS PROGRAM ALREADY USES.- * `C.chipKeyBg` is the config TUI's footer chip (`Footer.tsx:186-190` — neutral- * grey, `C.fg` ink, bold, one space each side), so the picker's footer is the same- * object as every other footer in claudish rather than a second invention. It is- * deliberately NOT a saturated hue: every hue in this dialog already means one- * thing — `FREE` success, `SUB` warn, `catalog` warn, errors red, focus accent —- * and borrowing one for the footer would put the quietest row on screen in- * competition with the failure banner. A keycap reads as a key because of its- * SHAPE, a filled chip with padding; the fill's job is to be neutral.+ * ONE FILL FOR EVERY KEYCAP, AND IT IS VIVID — NEUTRAL GREY WAS MEASURED AND+ * REJECTED, TWICE, ONCE PER PALETTE. The argument for grey was that every hue in+ * this dialog already means something, so the quietest row should borrow none of+ * them. What that produced is a chip that is not a chip: `C.chipKeyBg` measures+ * 1.50:1 against a dark page and 2.38:1 against a light one, so on whichever+ * terminal it was not tuned for it melts into the background and the key reads as a+ * faintly tinted word. The owner reported exactly that from a live light-theme run,+ * and claudeup records the same measurement and the same conclusion — "the previous+ * neutral-grey chip melted into a light page", with dark slates rejected for+ * dropping to ~2.2 on a dark terminal.*- * `pickInk` chooses the ink from the fill rather than hardcoding white, which is- * what keeps the chip legible in the light palette, where `chipKeyBg` is `#d1d5db`- * and white ink would vanish.+ * `C.chipKeycapBg` is purple, and purple is spent on nothing else in this program:+ * the accent is blue, failure is red, the positive family is green. So a keycap+ * cannot be mistaken for a focus ring, a status or an error, and it clears 3:1+ * against BOTH reference pages (`theme-contrast.test.ts`).+ *+ * `fg={C.ink}` — WHITE, explicitly, rather than `pickInk`'s answer. We choose this+ * fill, so we own its ink too, and a chip whose ink flips with the user's palette is+ * a chip with two different contrast ratios.** AN UNAVAILABLE ACTION LOSES THE CHIP RATHER THAN BEING HIDDEN — dim text, no* fill, so "there is a key here but not now" is visibly different from both a live@@ -194,7 +200,7 @@ export function Hints({ hints }: { hints: Hint[] }): ReactNode {{h.on === false ? (<span fg={tokens.trace}>{` ${h.key} `}</span>) : (- <BadgeSpan label={h.key} bg={C.chipKeyBg} />+ <BadgeSpan label={h.key} bg={C.chipKeycapBg} fg={C.ink} />)}<span fg={h.on === false ? tokens.trace : tokens.subtle}>{` ${h.label}`}</span></text>diff --git a/packages/cli/src/picker/detail.tsx b/packages/cli/src/picker/detail.tsxindex 5a851688..5cda0b52 100644--- a/packages/cli/src/picker/detail.tsx+++ b/packages/cli/src/picker/detail.tsx@@ -29,6 +29,29 @@* and the rows are rendered blank until it does — never collapsed, or every* row below would jump when it lands.*+ * THE WHOLE PANE IS CHROME, AND IT RECEDES BY ITS INK — NEVER BY A FILL. Rule 6 of+ * `aesthetics-and-color.md` is "dim the chrome, saturate the signal": the list rows+ * are the signal — they are what the cursor moves through and what Enter returns —+ * and this pane is the footnote under them. It used to open with a BOLD ACCENT-BLUE+ * spec line, the loudest text on the screen, under a list drawn in body ink, and the+ * owner asked for the detail to be less prominent.+ *+ * A PASS THAT ANSWERED THAT WITH A BACKGROUND FILL WAS REJECTED, and the rule it+ * broke is the first one claudeup's theme states: panels sit on the terminal's own+ * background and are separated by their border, never by an absolute fill that+ * fights the user's theme. Here the separator already exists — `Rule` draws it one+ * row above — so a fill was a second separator that also painted three rows in a+ * colour the terminal never asked for. The owner's words: "all text in description+ * has different background colours. please bring it back... please remove that+ * different background colours."+ *+ * So the recession is entirely in the INK, three weights, brightest first: the spec+ * and the provider name in `debug` (`C.fgMuted` — a full tier under the body ink the+ * rows above use), everything qualifying them in `subtle`, and the catalog sentence+ * in `subtle` too, which is the dimmest tier there is, because it is the only part a+ * reader can skip without losing a fact. The footer keycaps below stay bright: they+ * are affordances, not prose.+ ** CAPABILITIES ARE EXCEPTION-ONLY AND THEY LIVE HERE, NOT ON EVERY ROW. The* previous build printed `[TRV]` on all 21 rows of a roster where every model had* all three — a column with no variance, in the place a reader is scanning names.@@ -37,7 +60,6 @@import type { ReactNode } from "react";import type { ModelInfo } from "../model-selector.js";-import { A } from "../tui/theme.js";import { truncate } from "../tui/viz/text.js";import { tokens } from "../tui/viz/tokens.js";import { wrapWords } from "./DiscoveryNotice.js";@@ -142,9 +164,10 @@ export function SelectionLine({return (<box height={1} flexShrink={0}><text>- <span fg={tokens.accent} attributes={A.bold}>- {truncate(text, room)}- </span>+ {/* `debug`, NOT bold accent. This line is a restatement of the row the+ cursor is already on; it earns its place by being EXACT, not by being+ loud, and the accent hue belongs to focus and titles. */}+ <span fg={tokens.debug}>{truncate(text, room)}</span>{warn === "" ? null : (<><span fg={tokens.subtle}>{" · "}</span>@@ -184,9 +207,13 @@ export function ProviderLine({);}const { billing, billingShort, auth } = providerFactsText(facts);+ // `flat-rate subscription — no per-token charge` WAS PAINTED IN THE FAILURE HUE.+ // It is the most positive fact on the screen — the user pays nothing to run this+ // route — and `tokens.warn` is `C.orange`, a rust red on the light palette. Same+ // inversion as the `SUB` chip, same fix: the positive tier. Red is for failure.const billingFg =facts.billing === "sub"- ? tokens.warn+ ? tokens.success: facts.billing === "local"? tokens.trace: tokens.subtle;@@ -206,7 +233,7 @@ export function ProviderLine({return (<box height={1} flexShrink={0}><text>- <span fg={tokens.text}>{name}</span>+ <span fg={tokens.debug}>{name}</span><span fg={tokens.trace}>{` ${facts.shortcut}`}</span><span fg={tokens.subtle}>{" · "}</span><span fg={billingFg}>{clause}</span>diff --git a/packages/cli/src/picker/layout.test.ts b/packages/cli/src/picker/layout.test.tsindex 1073ae97..b2bb61a3 100644--- a/packages/cli/src/picker/layout.test.ts+++ b/packages/cli/src/picker/layout.test.ts@@ -18,6 +18,7 @@ import { describe, expect, test } from "bun:test";*/import {CHROME_ROWS,+ GAPS,MAX_DIALOG_ROWS,MAX_DIALOG_WIDTH,MAX_LIST_ROWS,@@ -76,6 +77,41 @@ describe("deriveRowLayout", () => {expect(fallback.id).toBeLessThan(live.id);});+ test("`provider: false` sums EXACTLY too — the dropped cell takes its GAP with it", () => {+ // THE FAILURE THIS EXISTS FOR IS INVISIBLE TO A SUM THAT STOPS AT THE CELLS.+ // Dropping the provider column while leaving `GAP_AFTER_PROVIDER` in the budget+ // still totals `inner`, so a cell-only assertion passes — and every model id in+ // every provider-scoped list is indented two columns for a column that is not+ // drawn. The gap is part of `rowLayoutTotal`, so this catches it.+ const wrong = WIDTHS.map((w) => ({+ w,+ sum: rowLayoutTotal(deriveRowLayout(w, { provider: false })),+ })).filter(({ w, sum }) => sum !== w);+ expect(wrong).toEqual([]);+ expect(deriveRowLayout(80, { provider: false }).provider).toBe(0);+ expect(deriveRowLayout(80, { provider: false }).gaps).toBe(+ deriveRowLayout(80).gaps - GAPS.afterProvider+ );+ });++ test("EVERY column the provider cell gave up goes to the model id", () => {+ // The owner's complaint was that `OpenAI Codex` printed 49 times under a dialog+ // titled `OpenAI Codex` was eating the id column. If the cells went anywhere+ // else — a wider price, a wider ctx — the change would have bought nothing.+ const withCol = deriveRowLayout(96, { providerCells: 18 });+ const without = deriveRowLayout(96, { provider: false });+ expect(without.id - withCol.id).toBe(withCol.provider + GAPS.afterProvider);+ expect(without.ctx).toBe(withCol.ctx);+ expect(without.price).toBe(withCol.price);+ });++ test("`provider: false` stays non-negative at absurd widths", () => {+ const bad = WIDTHS.concat([0, 10, 20]).flatMap((w) =>+ Object.entries(deriveRowLayout(w, { provider: false })).filter(([, v]) => (v as number) < 0)+ );+ expect(bad).toEqual([]);+ });+test("a non-finite or negative width yields finite columns, never NaN", () => {for (const w of [Number.NaN, Number.POSITIVE_INFINITY, -10]) {const l = deriveRowLayout(w);diff --git a/packages/cli/src/picker/layout.ts b/packages/cli/src/picker/layout.tsindex fd0aca73..a0345f4e 100644--- a/packages/cli/src/picker/layout.ts+++ b/packages/cli/src/picker/layout.ts@@ -104,15 +104,20 @@ export interface RowLayout {*/export function deriveRowLayout(inner: number,- opts: { mark?: boolean; providerCells?: number } = {}+ opts: { mark?: boolean; providerCells?: number; provider?: boolean } = {}): RowLayout {const cells = Number.isFinite(inner) ? Math.max(0, Math.floor(inner)) : 0;const mark = opts.mark === true ? MARK_CELLS : 0;- const gaps = GAP_AFTER_PROVIDER + GAP_AFTER_ID + GAP_AFTER_CTX;+ // A DROPPED COLUMN TAKES ITS SEPARATOR WITH IT. `provider: false` that left+ // `GAP_AFTER_PROVIDER` in the sum would indent every model id by two columns+ // for a cell that is no longer drawn — the row would still total `inner`, so+ // the sum test would pass over it and only a screenshot would show the gutter.+ const showProvider = opts.provider !== false;+ const gaps = (showProvider ? GAP_AFTER_PROVIDER : 0) + GAP_AFTER_ID + GAP_AFTER_CTX;// Everything except the elastic id. The mark carries no separator of its own —// the price column is right-aligned, so the gap is already inside it.- let provider = clampProviderCells(opts.providerCells ?? MIN_PROVIDER_CELLS);+ let provider = showProvider ? clampProviderCells(opts.providerCells ?? MIN_PROVIDER_CELLS) : 0;let ctx = CTX_CELLS;let price = PRICE_CELLS;let id = cells - (CURSOR_CELLS + provider + ctx + price + mark + gaps);@@ -124,7 +129,8 @@ export function deriveRowLayout(// two are the row — and the provider never goes below the floor, because a// provider that cannot be told apart from another one is worse than absent.const shortfall = MIN_ID_CELLS - id;- const takeFromProvider = Math.min(Math.max(0, provider - MIN_PROVIDER_CELLS), shortfall);+ const floor = showProvider ? MIN_PROVIDER_CELLS : 0;+ const takeFromProvider = Math.min(Math.max(0, provider - floor), shortfall);provider -= takeFromProvider;const stillShort = shortfall - takeFromProvider;const takeFromPrice = Math.min(Math.max(0, price - 4), stillShort);@@ -247,7 +253,8 @@ export function providerColumn(* MOONSHOT_API_KEY`, 22 cells), and a truncated variable name is worse than* useless — `needs MOON…` sends the reader looking for a variable that does not* exist. Keyless providers are hidden by default now, but `k` reveals them in- * this same list, so the cell is still theirs to fit.+ * this same list, so the cell is still theirs to fit. It fits the NAMED case and+ * not the longest one: see `PROVIDER_TAIL_CELLS`.*/export interface ProviderRowLayout {inner: number;@@ -268,9 +275,39 @@ export interface ProviderRowLayout {}const PROVIDER_GLYPH_CELLS = 2;+/**+ * `zengo@` AS A WORD, so 8 + 1 separator.+ *+ * Longest shortcut in the roster is `mistral@` at 8 — `native-anthropic@` is longer+ * and is not on this list, having no credential store. It was briefly 10, sized for+ * a CHIP's `displayWidth(label) + 2` fill, and the chip is gone: 17 filled prefixes+ * in a column fused into one grey band (`rows.tsx` header). Text needs only its own+ * width plus the separator.+ */const PROVIDER_SHORTCUT_CELLS = 9;-const PROVIDER_BILLING_CELLS = 6;-const PROVIDER_TAIL_CELLS = 26;+/**+ * `local` is the longest billing word: 5 + 2 for the fill it may carry.+ *+ * SIZED FOR THE CHIP EVEN THOUGH ONLY TWO OF THE THREE STATES TAKE ONE. A cell that+ * fitted the word and not the fill would clip `local`'s chip by exactly two cells,+ * and Yoga claws those out of a NEIGHBOURING cell rather than reporting anything —+ * `widgets.tsx` measured the result as a 1-column stub of background under the next+ * column's first letter, which `captureCharFrame` cannot see. The metered `$` is+ * drawn as text in the same cell and simply leaves it mostly empty. No separator+ * column: the chip carries one padded space of its own on each side, and the text+ * form indents by one to line up with it.+ */+const PROVIDER_BILLING_CELLS = 7;+/**+ * 25, DOWN FROM 26 — and the header's claim above needs the correction it implies.+ *+ * "Sized for the env var" was already aspirational: MEASURED over the roster, the+ * longest is `needs SAKANA_SUBSCRIPTION_API_KEY` at 33 cells, so 26 truncated it too.+ * What 25 buys is the one cell the billing chip's fill needs without touching the+ * NAME, which at 80 columns sits exactly on its 26-cell cap — and `needs+ * MOONSHOT_API_KEY`, the case the header names, is 22 and still fits whole.+ */+const PROVIDER_TAIL_CELLS = 25;const PROVIDER_GAP_AFTER_NAME = 1;/** Below this a provider name is no longer a name. */const MIN_PROVIDER_NAME_CELLS = 6;diff --git a/packages/cli/src/picker/row-semantics.test.ts b/packages/cli/src/picker/row-semantics.test.tsindex 0b700260..2dcc53c0 100644--- a/packages/cli/src/picker/row-semantics.test.ts+++ b/packages/cli/src/picker/row-semantics.test.ts@@ -11,17 +11,27 @@ import type { ModelInfo, PickerDiscoveryOutcome } from "../model-selector.js";* rendered as absent; and no rendered notice may contain the substring `undefined`.*/import type { DiscoveryFailure } from "../providers/model-discovery.js";+import { resetThemeModeForTests, setThemeMode } from "../theme/theme-mode.js";+import { C } from "../tui/theme.js";+import { truncate } from "../tui/viz/text.js";+import { tokens } from "../tui/viz/tokens.js";import {discoveryNoticeContent,mergeCredentialLines,noticeRows,wrapWords,} from "./DiscoveryNotice.js";-import { truncate } from "../tui/viz/text.js";import { capabilityWords, descriptionLines, detailText, providerFactsText } from "./detail.js";import { type PickerRow, dedupeByModelId, dedupeByProviderModel } from "./hooks/usePickerModels.js";import { providerColumn } from "./layout.js";-import { billingLabel, priceFg, priceLabel, readinessGlyph } from "./rows.js";+import {+ billingLabel,+ priceChipBg,+ priceFg,+ priceLabel,+ priceVaries,+ readinessGlyph,+} from "./rows.js";const model = (over: Partial<ModelInfo> = {}): ModelInfo => ({id: "m",@@ -53,20 +63,61 @@ describe("priceLabel", () => {});});-describe("priceFg", () => {- test("the three labels that are ABOUT MONEY are three distinct colours", () => {- // `FREE` (costs nothing), `SUB` (a flat-rate plan, so no per-token number- // exists) and a rate are three different financial claims, and a reader- // scanning for a cheap model separates them by hue before reading the word.- expect(new Set(["FREE", "SUB", "$2.25"].map(priceFg)).size).toBe(3);+describe("priceFg / priceChipBg", () => {+ test("`SUB` IS NEVER THE FAILURE HUE — in either form, in either theme", () => {+ // THE DEFECT THIS PINS SHIPPED. `SUB` was `tokens.warn`, which is `C.orange`:+ // `#ff8800` on dark and a rust `#c2410c` on light. Red-orange is what this app+ // spends on a failure, and `SUB` is the opposite of one — it is the route the+ // user already pays for, free at the point of use. Three reviewers read the old+ // colour as correct, so the rule is asserted rather than described.+ for (const mode of ["dark", "light"] as const) {+ setThemeMode(mode);+ expect(priceFg("SUB")).not.toBe(tokens.warn);+ expect(priceFg("SUB")).not.toBe(tokens.error);+ expect(priceChipBg("SUB")).not.toBe(tokens.warn);+ expect(priceChipBg("SUB")).not.toBe(tokens.error);+ }+ resetThemeModeForTests();+ });++ test("`FREE`, `SUB` and `local` share ONE POSITIVE tier, because they make one claim", () => {+ // All three say "running this costs you no per-token money"; the label says by+ // which mechanism. Three hues for one claim is rule 1 read backwards, and the+ // owner asked for them as one family in as many words.+ expect(priceFg("SUB")).toBe(priceFg("FREE"));+ expect(priceFg("SUB")).toBe(priceFg("local"));+ expect(priceFg("SUB")).toBe(tokens.success);+ expect(priceChipBg("SUB")).toBe(priceChipBg("FREE"));+ expect(priceChipBg("SUB")).toBe(priceChipBg("local"));});- test("the two labels that are NOT prices share the dim tier, deliberately", () => {- // `local` and `N/A` are both "there is no number here". Giving them separate- // hues would put two more meanings into a column that already carries three,- // and neither is a fact the reader acts on.- expect(priceFg("local")).toBe(priceFg("N/A"));- expect(priceFg("local")).not.toBe(priceFg("$2.25"));+ test("a chip FILL is a muted pill, never the neon foreground", () => {+ // `aesthetics-and-color.md`: a colour tuned to read as text is harsh as a solid+ // block. `C.pillKeyBg` is already the `FREE` chip on the session summary card,+ // so the picker borrows that object rather than inventing a second green.+ expect(priceChipBg("FREE")).toBe(C.pillKeyBg);+ expect(priceChipBg("FREE")).not.toBe(C.green);+ });++ test("A VALUE IS NOT A TOKEN, so a price numeral gets no chip at all", () => {+ // A chip is for a fixed, small vocabulary. Chipping `$0.75` would put a fill+ // behind every row of the column — the rectangle — and would claim the numeral+ // is one of a handful of states rather than a measured amount.+ expect(priceChipBg("$2.25")).toBeNull();+ expect(priceChipBg("$30.00")).toBeNull();+ // `N/A` is the ABSENCE of the fact, not a state of it.+ expect(priceChipBg("N/A")).toBeNull();+ });++ test("`N/A` is the ABSENCE of the fact, so it stays in the dim tier alone", () => {+ // `local` used to share this tier on the grounds that both mean "there is no+ // number here". They do not mean the same thing: `local` is a positive claim the+ // reader acts on — this route costs nothing and needs no network — while `N/A`+ // is the catalog declining to answer. So `local` joined the positive family and+ // `N/A` kept the dim tier, which is where an unanswered question belongs.+ expect(priceFg("N/A")).toBe(tokens.dead);+ expect(priceFg("N/A")).not.toBe(priceFg("local"));+ expect(priceFg("N/A")).not.toBe(priceFg("$2.25"));});test("AN EXPENSIVE PRICE IS NOT PAINTED AS AN ALARM — one colour, one meaning", () => {@@ -80,15 +131,56 @@ describe("priceFg", () => {});});+describe("priceVaries — which view earns chips", () => {+ test("a flat-rate or local provider FIXES the column, so it gets no chips", () => {+ // `resolveProviderDisplayPrice` answers `SUB` for every row of a subscription+ // roster. 49 identical fills stacked with no gap between rows is the failure the+ // skill MEASURED — chips fusing into one solid rectangle with the labels+ // floating in it — and no amount of correct padding prevents it, because the+ // padding is not what makes them identical.+ expect(priceVaries("sub")).toBe(false);+ expect(priceVaries("local")).toBe(false);+ });++ test("the cross-provider list and a METERED provider vary, so they do", () => {+ expect(priceVaries(null)).toBe(true);+ expect(priceVaries("metered")).toBe(true);+ });+});+describe("billingLabel / readinessGlyph", () => {- test("each billing mode has its own WORD, and only the flat-rate one is coloured", () => {+ test("each billing mode has its own WORD; only the two positive ones have a FILL", () => {const tags = (["sub", "local", "metered"] as const).map(billingLabel);expect(tags.map((t) => t.text)).toEqual(["SUB", "local", "$"]);- // `SUB` is the one that changes what a launch COSTS, so it is the one that- // gets a hue; the other two recede. Colour spent evenly is colour spent on- // nothing.- expect(tags[0]?.fg).not.toBe(tags[1]?.fg);- expect(tags[0]?.fg).not.toBe(tags[2]?.fg);+ // THE `null` IS THE WHOLE FIX. Filling `$` too would put a fill on every row of+ // the column — metered and flat-rate partition the roster — and 17 adjacent+ // fills fuse into one vertical band, which is what the owner rejected.+ expect(tags.map((t) => t.bg)).toEqual([C.pillKeyBg, C.pillKeyBg, null]);+ });++ test("METERED IS NEUTRAL and SUB IS POSITIVE — neither is a warning", () => {+ // `$` states that the route bills per token. That is information about the+ // route, not a caution about it: the number that matters is on the model row.+ expect(billingLabel("metered").fg).toBe(tokens.subtle);+ for (const mode of ["sub", "local", "metered"] as const) {+ const tag = billingLabel(mode);+ for (const colour of [tag.bg, tag.fg]) {+ expect(colour).not.toBe(tokens.error);+ expect(colour).not.toBe(tokens.warn);+ }+ }+ });++ test("A FILLED CHIP CARRIES WHITE INK, in both palettes", () => {+ // We choose the fill, so we own the ink: `pickInk` would answer white on the+ // dark palette and BLACK on the light one for the same `#15803d` chip — one chip+ // with two inks, and the worse ratio (4.02 vs 5.02) on the lighter page.+ for (const mode of ["dark", "light"] as const) {+ setThemeMode(mode);+ expect(billingLabel("sub").fg).toBe(C.ink);+ expect(C.ink).toBe("#ffffff");+ }+ resetThemeModeForTests();});test("readiness has three states, not two — pending is not missing", () => {@@ -96,6 +188,13 @@ describe("billingLabel / readinessGlyph", () => {expect(new Set(g.map((x) => x.glyph)).size).toBe(3);expect(new Set(g.map((x) => x.fg)).size).toBe(3);});++ test("A PROBE IN FLIGHT IS NOT A WARNING — `◌` is `running`, not `warn`", () => {+ // The same call `chrome.tsx` already made for the catalog shimmer. Spending the+ // failure hue on "still checking" teaches the reader to discount it everywhere.+ expect(readinessGlyph("pending").fg).toBe(tokens.running);+ expect(readinessGlyph("pending").fg).not.toBe(tokens.warn);+ });});describe("capabilityWords", () => {diff --git a/packages/cli/src/picker/rows.tsx b/packages/cli/src/picker/rows.tsxindex b11a75d6..5d85cb53 100644--- a/packages/cli/src/picker/rows.tsx+++ b/packages/cli/src/picker/rows.tsx@@ -3,14 +3,15 @@* picker/rows.tsx — one model row, one provider row, one column header, and the* pure label arithmetic behind them.*- * PLAIN ALIGNED TEXT. NO METERS, NO GRADIENTS, NO PER-ROW CHIPS. The build this- * replaces drew a context meter and a price meter on every row, and the reason it- * had to is written down: a whole-frame graphics-density gate counts a list row- * carrying a bar as a graphics row, so on a screen whose content IS a list there is- * no way to pass it without decorating every row. The result was measured — of 32- * visible rows, 19 read `1M`, and their bars were indistinguishable. Two full- * columns of gradient encoding one repeated value, beside the numerals that already- * said it.+ * ALIGNED TEXT AND CHIPS. NO METERS, NO GRADIENTS. The build this replaces drew a+ * context meter and a price meter on every row, and the reason it had to is written+ * down: a whole-frame graphics-density gate counts a list row carrying a bar as a+ * graphics row, so on a screen whose content IS a list there is no way to pass it+ * without decorating every row. The result was measured — of 32 visible rows, 19+ * read `1M`, and their bars were indistinguishable. Two full columns of gradient+ * encoding one repeated value, beside the numerals that already said it. A CHIP IS+ * NOT A METER: it draws no magnitude and takes `displayWidth(label) + 2` cells, so+ * it costs the row nothing a padded word did not already cost.** A meter belongs where a bounded value VARIES and where a reader is comparing* magnitudes rather than reading names. In this file there is exactly one such@@ -28,18 +29,54 @@* not lost: it sits beside the full name in the `p` dialog, and inside the exact* `provider@model` spec on the detail line.*- * COLOUR ENCODES MEANING, ONE MEANING EACH, APP-WIDE:+ * A FILL IS FOR THE NOTABLE STATE, NOT FOR EVERY ROW — THE RULE THAT SHIPPED+ * BACKWARDS ONCE. A previous pass chipped the routing prefix and the billing mode on+ * EVERY provider row. Both columns then had a fill on all 17 rows, and with no blank+ * row between them the fills fused: the prefix column read as one solid grey vertical+ * band and the billing column as one solid green one, with the labels floating inside+ * them. That is the failure `widgets.tsx` already measured for 24 `UP` chips, and+ * correct padding does not prevent it — padding is not what makes the fills identical.+ * `ScopeTabs.tsx` in claudeup states the surviving rule: the ACTIVE tab is a filled+ * block, the inactive one is plain muted text with no background at all.*- * `FREE` success costs nothing- * `SUB` warn a flat-rate plan, so no per-token number exists- * `local` trace runs on this machine- * `catalog` warn NOT this provider's live roster — see `DiscoveryNotice`- * `N/A` dead the catalog does not say- * selection accent + `C.bgHighlight`, and a `▶` so it survives greyscale+ * `or@` / `zengo@` subtle TEXT a routing IDENTIFIER, never a status+ * `$` subtle TEXT metered — information, not a warning+ * `FREE` / `SUB` chip on `C.pillKeyBg` no per-token charge — the SAME claim+ * `local` chip on `C.pillKeyBg` no charge either, by another mechanism+ * `catalog` warn text NOT the live roster — `DiscoveryNotice`+ * `N/A` dead text the catalog does not say+ * selection accent + `C.bgHighlight`, and a `▶` so it survives greyscale*- * Anything else is body ink. In particular the price NUMERAL is not colour-coded:- * a value takes discrete buckets or nothing at all, and three buckets of dollars- * would put a third meaning on `success` in a column already carrying `FREE`.+ * THE PREFIX AND `$` ARE THE TWO THAT LOST THEIR FILL, and the reason is the same+ * for both: a column whose EVERY row carries the token cannot use a fill to mark it.+ * Every provider has a prefix, and `$` plus `SUB`/`local` partition the roster, so a+ * fill on the metered half plus a fill on the flat-rate half is a fill on all of it.+ * Leaving `$` as muted text makes `SUB` alternate down the column, which is what+ * stops it banding and is also the honest reading: metered is the default state.+ *+ * `SUB` WAS `tokens.warn` UNTIL THIS PASS, AND THAT WAS A ONE-COLOUR-ONE-MEANING+ * VIOLATION IN THE SHIPPED BUILD, not in a prototype. `warn` is `C.orange` —+ * `#ff8800` on dark and a rust `#c2410c` on light — which is the hue this app+ * spends on failure. `SUB` is the opposite of a failure: it is the route the user+ * already pays for, free at the point of use. Red now means only failure here: the+ * `HTTP 4xx` badge and the discovery-failure panel, and nothing else.+ *+ * THREE CHIPS THAT LOOK THE SAME MEAN THE SAME THING. `FREE`, `SUB` and `local` share+ * one positive fill on purpose — all three say "running this costs you no per-token+ * money" — and the LABEL says by which mechanism. Splitting the hue would put three+ * meanings on one claim, which is rule 1 read backwards.+ *+ * A CHIP MARKS A TOKEN THAT VARIES DOWN ITS COLUMN. The price column varies in the+ * cross-provider list and inside a METERED provider (numerals, with the odd+ * `FREE`); inside a flat-rate or local provider every row carries the same word,+ * and identical fills stacked with no gap between rows is the failure the skill+ * MEASURED — 24 `UP` chips fusing into one solid rectangle with the labels floating+ * in it. There the word is drawn as coloured text instead. `chip` is that one+ * decision, taken by the caller that knows the scope.+ *+ * In particular the price NUMERAL is never colour-coded: a value takes discrete+ * buckets or nothing at all, and three buckets of dollars would put a third+ * meaning on `success` in a column already carrying `FREE`.** ONE `<text>` PER ROW, ALWAYS. Yoga claws columns back from the LAST `<text>`* child of a row, which is how a branch name once rendered as `mai` with thirty@@ -56,8 +93,9 @@import type { ReactNode } from "react";import type { ModelInfo } from "../model-selector.js";import { A, C } from "../tui/theme.js";-import { padStartTo, padTo, truncate } from "../tui/viz/text.js";+import { displayWidth, padStartTo, padTo, truncate } from "../tui/viz/text.js";import { tokens } from "../tui/viz/tokens.js";+import { BadgeSpan } from "../tui/viz/widgets.js";import type { BillingMode } from "./PickerDataSource.js";import { GAPS, type RowLayout, deriveProviderRowLayout } from "./layout.js";@@ -86,32 +124,139 @@ export function priceLabel(display: string, billing: BillingMode): string {return s.replace(/\s*\/\s*1M$/i, "");}-/** The one colour each price label is allowed to have. */+/**+ * The FILL a discrete price token is chipped on, or `null` for a value rather+ * than a token.+ *+ * A NEON FOREGROUND IS NOT A FILL. `tokens.success` is `C.green`, `#39ff14`, and+ * the skill is explicit that a colour tuned to read as text is harsh as a solid+ * block. `C.pillKeyBg` (`#15803d`) is this repo's already contrast-tuned muted+ * green, shared verbatim by both palettes and measured against BOTH reference pages+ * (`theme-contrast.test.ts`) — and it is ALREADY the `FREE` chip on the session+ * summary card (`session-summary.ts:176`), so this is the same object, not a second+ * invention.+ */+export function priceChipBg(label: string): string | null {+ if (label === "FREE" || label === "SUB" || label === "local") return C.pillKeyBg;+ return null;+}++/** The one colour each price label is allowed to have when it is NOT chipped. */export function priceFg(label: string): string {- if (label === "FREE") return tokens.success;- if (label === "SUB") return tokens.warn;- if (label === "local") return tokens.trace;+ // `FREE`, `SUB` and `local` make the same claim — no per-token charge — so they+ // take the same positive tier. NEVER `tokens.warn`; see the file header.+ if (label === "FREE" || label === "SUB" || label === "local") return tokens.success;if (label === "N/A") return tokens.dead;return tokens.text;}-/** `●` ready · `○` needs a key · `◌` probe in flight — `ProvidersContent.tsx:225`. */+/**+ * Does the price column VARY in this view, and so earn chips?+ *+ * `null` is the cross-provider list. A scoped provider FIXES the column when it+ * bills flat-rate or runs locally — `resolveProviderDisplayPrice` answers `SUB` for+ * every row of a subscription roster — and a column of one repeated fill is the+ * rectangle the skill measured.+ */+export function priceVaries(scopeBilling: BillingMode | null): boolean {+ return scopeBilling === null || scopeBilling === "metered";+}++/**+ * `●` ready · `○` needs a key · `◌` probe in flight — `ProvidersContent.tsx:225`.+ *+ * PENDING IS `running`, NOT `warn`, for the reason `chrome.tsx` already gives for+ * the catalog shimmer: a probe in flight is not a warning, and spending the+ * failure hue on it teaches the reader to discount that hue everywhere else.+ */export function readinessGlyph(r: Readiness): { glyph: string; fg: string } {if (r === "ready") return { glyph: "●", fg: tokens.success };if (r === "missing") return { glyph: "○", fg: tokens.dead };- return { glyph: "◌", fg: tokens.warn };+ return { glyph: "◌", fg: tokens.running };}-/** The provider view's billing word, in the same colours a model row uses. */-export function billingLabel(mode: BillingMode): { text: string; fg: string } {- if (mode === "sub") return { text: "SUB", fg: tokens.warn };- if (mode === "local") return { text: "local", fg: tokens.trace };- return { text: "$", fg: tokens.subtle };+/**+ * The provider view's billing token — the vocabulary a model row prices with.+ *+ * `bg === null` MEANS "DRAW ME AS TEXT", and only `$` takes it. Metered is the+ * DEFAULT state of a route: `$` says the route bills per token, which is a fact+ * about it rather than a caution about it, and the number that matters is on the+ * model row. Filling it too would put a fill on every row of the column and fuse+ * the two halves into one band — the defect the file header describes.+ */+export function billingLabel(mode: BillingMode): { text: string; fg: string; bg: string | null } {+ if (mode === "sub") return { text: "SUB", fg: C.ink, bg: C.pillKeyBg };+ if (mode === "local") return { text: "local", fg: C.ink, bg: C.pillKeyBg };+ return { text: "$", fg: tokens.subtle, bg: null };}const SPACES = " ";const gap = (n: number): string => SPACES.slice(0, Math.max(0, n));+/**+ * A chip that has to sit inside a fixed COLUMN, with the padding OUTSIDE the fill.+ *+ * `BadgeSpan` already pads outside (`badgePad`), which is the rule the skill states+ * verbatim and the reason an earlier pass in this file kept reverting chips to+ * coloured text. This adds only what a CELL needs and a chip does not:+ *+ * · it fits the LABEL to the column before the fill is drawn — `width - 2`,+ * because the fill is `displayWidth(label) + 2` and a column sized to the label+ * overflows by exactly those two cells, which Yoga then claws out of a+ * neighbouring cell (`widgets.tsx` measured a 1-column stub of background under+ * the next column’s first letter, invisible to `captureCharFrame`);+ * · it right-aligns by emitting the filler BEFORE the chip, since `badgePad` can+ * only pad after it;+ * · and it declines to draw below three columns, where a chip could only ever be+ * part of a fill.+ */+function ChipCell({+ label,+ bg,+ width,+ align = "left",+}: {+ label: string;+ bg: string;+ width: number;+ align?: "left" | "right";+}): ReactNode {+ const cells = Math.max(0, Math.floor(width));+ if (cells < 3 || label === "") return cells > 0 ? <span>{gap(cells)}</span> : null;+ const fitted = truncate(label, cells - 2);+ const lead = align === "right" ? Math.max(0, cells - displayWidth(fitted) - 2) : 0;+ return (+ <>+ {lead > 0 ? <span>{gap(lead)}</span> : null}+ {/* `fg={C.ink}` — WHITE, not `pickInk`'s answer. We chose this fill, so we own+ both sides of it and its ink should not change with the user's palette:+ MEASURED on `#15803d`, `pickInk` returns white on the dark palette and+ BLACK on the light one, which is the same chip wearing two inks and the+ worse ratio (4.02 vs 5.02) on the page more likely to be squinted at. */}+ <BadgeSpan+ label={fitted}+ bg={bg}+ fg={C.ink}+ {...(align === "right" ? {} : { width: cells })}+ />+ </>+ );+}++/**+ * The same CELL, drawn as plain coloured text — the form a column uses when every+ * row would otherwise carry a fill.+ *+ * The label is indented by one so it lands under a chip's first letter rather than+ * under the chip's own padding, which is what keeps `$` aligned with `SUB` in the+ * column above and below it.+ */+function TextCell({ label, fg, width }: { label: string; fg: string; width: number }): ReactNode {+ const cells = Math.max(0, Math.floor(width));+ if (cells === 0) return null;+ return <span fg={fg}>{padTo(truncate(` ${label}`, cells), cells)}</span>;+}+/*** The column header. It exists so the four fixed cells are NAMED rather than* guessed at, which is the cheapest possible answer to "what is happening here":@@ -122,8 +267,16 @@ export function ColumnHeader({ layout }: { layout: RowLayout }): ReactNode {<box height={1} flexShrink={0}><text><span fg={tokens.trace}>{" "}</span>- <span fg={tokens.trace}>{padTo("provider", layout.provider)}</span>- <span>{gap(GAPS.afterProvider)}</span>+ {/* THE HEADER FOLLOWS THE LAYOUT, it never re-decides it. `provider === 0`+ is the scoped view, where the dialog title already names the provider —+ a header cell for a column with no cells under it would be a label+ pointing at nothing, and the gutter would indent every id by two. */}+ {layout.provider > 0 ? (+ <>+ <span fg={tokens.trace}>{padTo("provider", layout.provider)}</span>+ <span>{gap(GAPS.afterProvider)}</span>+ </>+ ) : null}<span fg={tokens.trace}>{padTo("model", layout.id)}</span><span>{gap(GAPS.afterId)}</span><span fg={tokens.trace}>{padStartTo("ctx", layout.ctx)}</span>@@ -154,6 +307,14 @@ export interface ModelRowProps {cursor: boolean;/** `catalog` marks a row that is NOT from the provider's live roster. */origin: ListOrigin;+ /**+ * Draw a discrete price label as a CHIP rather than as coloured text.+ *+ * The caller decides because only the caller knows the scope — see `priceVaries`+ * and the file header. Default `false`: a chip is the exception a view opts into,+ * so a new call site cannot accidentally paint a rectangle.+ */+ chip?: boolean;}export function ModelRow({@@ -163,9 +324,11 @@ export function ModelRow({layout,cursor,origin,+ chip = false,}: ModelRowProps): ReactNode {// Render-time reads — see the file header.const idFg = cursor ? C.strong : tokens.text;+ const chipBg = chip ? priceChipBg(price) : null;return (// THE WASH LIVES ON THE BOX, not on the `<text>`: a text node is only as wide// as its content, so a row highlighted that way stops at its last glyph and@@ -174,15 +337,28 @@ export function ModelRow({<box height={1} flexShrink={0} backgroundColor={cursor ? C.bgHighlight : undefined}><text attributes={A.boldIf(cursor)}><span fg={cursor ? tokens.accent : tokens.trace}>{cursor ? "▶ " : " "}</span>- <span fg={cursor ? C.strong : tokens.subtle}>- {padTo(truncate(providerLabel, layout.provider), layout.provider)}- </span>- <span>{gap(GAPS.afterProvider)}</span>+ {/* DROPPED ENTIRELY INSIDE A PROVIDER, not blanked. `OpenAI Codex` printed+ 49 times under a dialog titled `OpenAI Codex` is the column with the+ least information on the screen, and it was eating the cells the model+ id wants. It is the whole point of the cross-provider list, so it stays+ there — one flag, one layout, no second row component. */}+ {layout.provider > 0 ? (+ <>+ <span fg={cursor ? C.strong : tokens.subtle}>+ {padTo(truncate(providerLabel, layout.provider), layout.provider)}+ </span>+ <span>{gap(GAPS.afterProvider)}</span>+ </>+ ) : null}<span fg={idFg}>{padTo(model.id, layout.id)}</span><span>{gap(GAPS.afterId)}</span><span fg={tokens.subtle}>{padStartTo(model.context || "N/A", layout.ctx)}</span><span>{gap(GAPS.afterCtx)}</span>- <span fg={priceFg(price)}>{padStartTo(price, layout.price)}</span>+ {chipBg === null ? (+ <span fg={priceFg(price)}>{padStartTo(price, layout.price)}</span>+ ) : (+ <ChipCell label={price} bg={chipBg} width={layout.price} align="right" />+ )}{layout.mark > 0 ? (<span fg={tokens.warn}>{padStartTo(origin === "catalog" ? "catalog" : "", layout.mark)}@@ -268,8 +444,17 @@ export function ProviderRow({<span fg={fg}>{padTo(glyph, L.glyph)}</span><span fg={cursor ? C.strong : tokens.text}>{padTo(truncate(label, L.name), L.name)}</span><span>{gap(L.gaps)}</span>+ {/* THE PREFIX IS AN IDENTIFIER AND EVERY ROW HAS ONE, so it is the muted+ hue AS TEXT. Chipped, it put a fill on all 17 rows of a column with no+ gap between them and the column fused into one grey band — the owner's+ word was "super ugly". A fill marks the notable member of a column; here+ there is no notable member, only a name. */}<span fg={tokens.subtle}>{padTo(truncate(shortcut, L.shortcut), L.shortcut)}</span>- <span fg={bill.fg}>{padTo(bill.text, L.billing)}</span>+ {bill.bg === null ? (+ <TextCell label={bill.text} fg={bill.fg} width={L.billing} />+ ) : (+ <ChipCell label={bill.text} bg={bill.bg} width={L.billing} />+ )}<span fg={readiness === "missing" ? tokens.dead : tokens.subtle}>{padStartTo(truncate(tail, L.tail), L.tail)}</span>diff --git a/packages/cli/src/providers/transport/probe-discovery.test.ts b/packages/cli/src/providers/transport/probe-discovery.test.tsindex 3d31ae23..b980b115 100644--- a/packages/cli/src/providers/transport/probe-discovery.test.ts+++ b/packages/cli/src/providers/transport/probe-discovery.test.ts@@ -14,6 +14,7 @@ import {discoverViaOllama,discoverViaOpenAIModels,invalidateProbeDiscovery,+ isChatCapable,rankProbeCandidates,} from "./probe-discovery.js";@@ -64,6 +65,49 @@ describe("rankProbeCandidates", () => {expect(ranked).toEqual(["claude-haiku-4", "gpt-4o-mini"]);});+ test("drops the REALTIME/VOICE family — observed leaking into the Codex roster", () => {+ // All five were on screen in a live provider-scoped list, offered as launchable+ // coding models. The selected row's own catalog sentence disqualified it: "a+ // distilled reasoning model for faster, lower-cost realtime VOICE interactions...+ // audio and text inputs over WebRTC, WebSocket, or SIP".+ for (const id of [+ "gpt-live-1",+ "gpt-realtime-2",+ "gpt-realtime-2.1",+ "gpt-realtime-2.1-mini",+ "gpt-realtime-translate",+ ]) {+ expect({ id, chat: isChatCapable(id) }).toEqual({ id, chat: false });+ }+ });++ test("`live` IS A BOUNDED TOKEN — a substring would eat four plausible ids", () => {+ // `-` is a non-word character, so `\blive\b` matches `gpt-live-1` and does NOT+ // match any of these. A bare `/live/` would drop all four, and each of them is a+ // shape a real roster produces: a benchmark-tuned fine-tune, a deployment slug,+ // a vendor codename, a probe endpoint.+ for (const id of [+ "livecodebench-qwen-32b",+ "mistral-delivery-agent",+ "olive-7b",+ "liveness-probe-1",+ ]) {+ expect({ id, chat: isChatCapable(id) }).toEqual({ id, chat: true });+ }+ });++ test("`realtime` and `translate` are bounded too, and keep their near-misses", () => {+ expect(isChatCapable("gemini-live-2.5-flash")).toBe(false);+ expect(isChatCapable("seed-translate-1")).toBe(false);+ // Pins that the patterns are not `/real/` and `/trans/`, which would have been+ // the obvious sloppy spelling and would have dropped both of these.+ expect(isChatCapable("unreal-coder-7b")).toBe(true);+ expect(isChatCapable("trans-coder-7b")).toBe(true);+ // And the ids the whole list exists to keep.+ expect(isChatCapable("gpt-5-codex")).toBe(true);+ expect(isChatCapable("kimi-k2.7-code-highspeed")).toBe(true);+ });+test("returns empty when all candidates are non-chat", () => {const ranked = rankProbeCandidates(["text-embedding-3-large", "whisper-1", "tts-1-hd"]);expect(ranked).toEqual([]);diff --git a/packages/cli/src/providers/transport/probe-discovery.ts b/packages/cli/src/providers/transport/probe-discovery.tsindex 98d3d00a..84091e46 100644--- a/packages/cli/src/providers/transport/probe-discovery.ts+++ b/packages/cli/src/providers/transport/probe-discovery.ts@@ -55,6 +55,11 @@ const SMALL_MODEL_PATTERNS = [* here without a vendor-family blacklist, which is the workaround this file has* already paid for three times (`:498`, then `pplx-embed`, then `bge`).*+ * THE SAME BOUNDARY HELD FOR THE REALTIME FAMILY. `gpt-live-1` and the four+ * `gpt-realtime-*` entries say what they are in their names, so they are excluded+ * here; an id that carries no modality signal at all is still LOGGED by name+ * (`toPickerRows`) for the models-index bug report rather than guessed at.+ ** The complete fix is a modality field on the catalog document — `ModelDoc`* already carries `capabilities.imageGeneration` / `audioInput` / `audioOutput`* / `embedding`, but the SLIM payload every aggregator list is built from@@ -91,7 +96,23 @@ const NON_CHAT_PATTERNS = [// listing a generator as a coding target — fails at launch instead of in the// list./\bvideo\b/i,- /-(image|tts|audio|embedding|vision-only|transcribe|voice|video|speech)(-|$)/i,+ // REALTIME / LIVE / TRANSLATE — observed leaking into the OpenAI Codex roster as+ // `gpt-live-1`, `gpt-realtime-2`, `gpt-realtime-2.1`, `gpt-realtime-2.1-mini` and+ // `gpt-realtime-translate`, all five offered as launchable coding models. The+ // selected row's own catalog sentence disqualified it: "a distilled reasoning+ // model for faster, lower-cost realtime VOICE interactions... audio and text+ // inputs over WebRTC, WebSocket, or SIP". None of them speaks+ // `/v1/chat/completions` the way an agent needs.+ /\brealtime\b/i,+ // `\b` IS THE WHOLE POINT ON THIS ONE. `-` is a non-word character, so `\blive\b`+ // matches `gpt-live-1` and `x-live-2` and does NOT match `delivery`, `olive`,+ // `livecodebench` or `liveness` — every one of which is a plausible model id and+ // none of which is a realtime endpoint. A bare substring `/live/` would eat all+ // four.+ /\blive\b/i,+ /\btranslate\b/i,+ /\btranslation\b/i,+ /-(image|tts|audio|embedding|vision-only|transcribe|voice|video|speech|realtime|live|translate)(-|$)/i,];function isSmallName(name: string): boolean {diff --git a/packages/cli/src/tui/theme-contrast.test.ts b/packages/cli/src/tui/theme-contrast.test.tsindex 0ad2851f..427a5c43 100644--- a/packages/cli/src/tui/theme-contrast.test.ts+++ b/packages/cli/src/tui/theme-contrast.test.ts@@ -1,6 +1,6 @@import { afterEach, describe, expect, it } from "bun:test";import { resetThemeModeForTests, setThemeMode } from "../theme/theme-mode.js";-import { C, STAGE_BG, STAGE_FG, latencyBg, latencyFg } from "./theme.js";+import { C, CONTRAST_REFERENCE, STAGE_BG, STAGE_FG, latencyBg, latencyFg } from "./theme.js";import type { TuiPalette } from "./theme.js";import { ramps, tokens } from "./viz/tokens.js";@@ -115,6 +115,21 @@ describe("light TUI palette contrast", () => {expect(contrastRatio(C.chipKeyBg, C.bgAlt)).toBeGreaterThanOrEqual(1.7);});+ it("keeps the detail pane's dim tiers legible on the PANEL — there is no band", () => {+ // The detail rows sit on the dialog's own `bgAlt`, with no fill of their own: a+ // pane separated by an absolute fill fights whichever theme we guessed, and the+ // owner rejected exactly that ("all text in description has different background+ // colours... please remove"). Receding is the TEXT's job, so the two tiers that+ // do the receding still have to clear a text-grade ratio on the panel itself.+ for (const mode of ["light", "dark"] as const) {+ setThemeMode(mode);+ expect({ mode, ratio: contrastRatio(C.fgMuted, C.bgAlt) >= 4.5 }).toEqual({+ mode,+ ratio: true,+ });+ }+ });+it("re-snapshots semantic tokens and ramps", () => {setThemeMode("light");expect(tokens.success).toBe(C.green);@@ -123,6 +138,89 @@ describe("light TUI palette contrast", () => {});});+/**+ * Every fill WE paint, measured against BOTH reference terminals — the rule claudeup+ * enforces in `theme-adaptive-colors.test.ts` and the one this repo was breaking.+ *+ * A chip lands on a page we do not control. `theme-mode.ts` detects light vs dark and+ * we tune two palettes, but detection can fail (an unknown answer resolves to DARK),+ * tmux can lie about `COLORFGBG`, and a cream or solarized page is neither of our two+ * references. So a fill has to separate from BOTH or it is invisible somewhere real:+ * the rejected keycap grey measured 1.50:1 on the dark reference, which is a chip that+ * is not a chip.+ *+ * 3:1, NOT 4.5:1, AND THAT IS NOT A RELAXATION. No single colour can clear 4.5:1+ * against both a cream and a near-black page — the luminance bands do not overlap —+ * and 3:1 is WCAG's own bar for a UI component, which is what a chip is. The ink ON+ * the chip is held to 4.5:1 separately, and it is plain white, because we own both+ * sides of a fill and its contrast should not be a function of the user's theme.+ */+describe("owned chip fills clear 3:1 on BOTH reference terminals", () => {+ const chipFills = [+ "pillKeyBg", // FREE / SUB / local — the positive family+ "pillOauthBg", // oauth pills in the config TUI's AUTH column+ "chipKeycapBg", // footer keycaps+ "tabActiveBg", // the active tab pill+ "red", // the `HTTP 401` chip and the discovery-failure rule+ ] as const satisfies ReadonlyArray<keyof TuiPalette>;++ for (const mode of ["light", "dark"] as const) {+ for (const fill of chipFills) {+ it(`separates ${fill} from both pages in the ${mode} palette`, () => {+ setThemeMode(mode);+ for (const page of Object.values(CONTRAST_REFERENCE)) {+ expect({ fill, page, ok: contrastRatio(C[fill], page) >= 3 }).toEqual({+ fill,+ page,+ ok: true,+ });+ }+ });+ }+ }++ it("keeps WHITE ink legible on every fill that carries a label", () => {+ // `C.ink` is `#ffffff` in both palettes for exactly this reason: where we choose+ // the fill we choose the ink, so the ratio is deterministic instead of a function+ // of the user's page. TWO fills are excluded and each for its own reason: `C.red`+ // is a NEON on dark (`#ff003c`), bright enough that `pickInk` correctly puts DARK+ // ink on it, and `tabActiveBg` carries its own `tabActiveFg` rather than `C.ink`.+ for (const mode of ["light", "dark"] as const) {+ setThemeMode(mode);+ for (const fill of ["pillKeyBg", "pillOauthBg", "chipKeycapBg"] as const) {+ expect({ mode, fill, ok: contrastRatio(C.ink, C[fill]) >= 4.5 }).toEqual({+ mode,+ fill,+ ok: true,+ });+ }+ }+ });++ it("A KEYCAP IS NEVER THE NEUTRAL GREY AGAIN, in either palette", () => {+ // The regression this exists for shipped twice, once per palette: a grey keycap+ // reads as a faintly tinted word rather than as a key you press, and the owner+ // reported it from a live light-theme run. `chipKeyBg` survives as the config+ // TUI's two-tone footer segment, whose ink is theme-following `C.fg` and which is+ // measured against `bgAlt` above — a different object with a different contract.+ for (const mode of ["light", "dark"] as const) {+ setThemeMode(mode);+ expect({ mode, same: C.chipKeycapBg === C.chipKeyBg }).toEqual({ mode, same: false });+ }+ });++ it("holds the POSITIVE family apart from the FAILURE hue", () => {+ // `SUB` shipped in `tokens.warn`, the hue this app spends on failure, under a+ // label that means the opposite of a failure. Three reviewers read it as correct,+ // so the separation is asserted rather than described.+ for (const mode of ["light", "dark"] as const) {+ setThemeMode(mode);+ expect(C.pillKeyBg).not.toBe(C.red);+ expect(C.pillKeyBg).not.toBe(C.orange);+ }+ });+});+describe("dark TUI palette identity", () => {it("pins the shipped dark values", () => {resetThemeModeForTests();diff --git a/packages/cli/src/tui/theme.ts b/packages/cli/src/tui/theme.tsindex 30c6d995..b2c60b08 100644--- a/packages/cli/src/tui/theme.ts+++ b/packages/cli/src/tui/theme.ts@@ -57,10 +57,28 @@ export interface TuiPalette {tabInactiveFg: string;pillKeyBg: string;pillOauthBg: string;+ /** Footer KEYCAP fill. Vivid, white ink, the same hex in both palettes. */+ chipKeycapBg: string;chipKeyBg: string;chipLabelBg: string;}+/**+ * The two backgrounds every OWNED FILL is measured against — `theme-contrast.test.ts`.+ *+ * A chip we paint lands on a terminal whose page we do not control, so a fill that+ * only separates from one of them is invisible on the other. A single colour CANNOT+ * reach 4.5:1 against both: clearing it on cream needs relative luminance <= ~0.17,+ * clearing it on near-black needs >= ~0.22, and those do not overlap. So the bar for+ * a fill is 3:1 — WCAG's threshold for UI components — which admits exactly the band+ * of mid-dark saturated colours the chips below live in. Borrowed, with the hexes,+ * from claudeup's `src/ui/theme.ts`, whose own test enforces the same rule.+ */+export const CONTRAST_REFERENCE = {+ light: "#FAFAD2",+ dark: "#1C1C1E",+} as const;+const DARK: TuiPalette = {bg: "#000000",bgAlt: "#111111",@@ -94,11 +112,26 @@ const DARK: TuiPalette = {tabActiveFg: "#ffffff",tabInactiveFg: "#0088ff",- // Muted pill backgrounds for AUTH column tags. The standard `green` / `cyan`- // are neon-bright and cause eye strain when used as a solid fill. These- // are lower-saturation forest/teal versions, contrast-tuned for white text.- pillKeyBg: "#2d6e3e", // forest green; white text reads cleanly- pillOauthBg: "#1f6d75", // muted teal; white text reads cleanly+ // Muted pill backgrounds for AUTH column tags and the picker's state chips. The+ // standard `green` / `cyan` are neon-bright and cause eye strain as a solid fill,+ // so these are lower-saturation forest/teal versions carrying white ink.+ //+ // RAISED FROM `#2d6e3e` / `#1f6d75` TO THE MEASURED PAIR. The old forest green+ // cleared 5.77:1 on a cream page and only 2.76:1 on a near-black one — under the+ // 3:1 a UI component needs — so a `SUB` chip on a dark terminal was a fill that+ // barely separated from the page it sat on. These two clear 3:1 against BOTH+ // reference backgrounds (4.70/3.39 and 5.02/3.18) and keep white ink at 5.0+.+ // Same hexes as claudeup's `success` / `info`, and shared verbatim by both+ // palettes: a fill measured against both pages needs no per-theme variant.+ pillKeyBg: "#15803d", // forest green; white ink reads cleanly on both pages+ pillOauthBg: "#0e7490", // muted teal; white ink reads cleanly on both pages+ // A KEYCAP IS A VIVID BLOCK WITH WHITE INK, in both palettes and at the same hex.+ // Neutral grey was measured and rejected twice: `#3a3a3a` is 1.50:1 on a dark page+ // and `#9ca3af` 2.38:1 on a light one, so whichever way it is tuned the chip melts+ // into one of the two terminals. Purple clears 5.04/3.16 and is spent on nothing+ // else in this program — the accent is blue, so a keycap cannot be mistaken for a+ // focus ring, a status or a failure.+ chipKeycapBg: "#9333ea",// Monochrome two-tone footer chip. The key sits on the LIGHTER segment and// the label on the DARKER segment; the two abut into one connected pill.@@ -144,18 +177,19 @@ const LIGHT: TuiPalette = {tabActiveFg: "#ffffff",tabInactiveFg: "#374151",- // The forest/teal pills are mid-lightness fills with white ink — they clear- // contrast on BOTH pages, so they are shared verbatim with DARK.- pillKeyBg: "#2d6e3e",- pillOauthBg: "#1f6d75",-- // A KEYCAP HAS TO READ AS A KEY, which means it has to be visibly RAISED off- // the panel it sits on — and `#d1d5db` was not. MEASURED against the panel- // band it is drawn on (`bgAlt`, `#f3f4f6`): 1.32:1, below the 1.7:1 this file- // already requires of every stage block, so the picker's footer chips read as- // faintly tinted words rather than as keys. The owner said so from a live run.- // `#9ca3af` keeps 5.4:1 under `C.fg` — still past the 4.5:1 the footer's own- // contrast test demands — while sitting 2.3:1 off the band.+ // The forest/teal pills and the keycap are mid-lightness fills with white ink —+ // they clear 3:1 on BOTH reference pages, so they are shared verbatim with DARK.+ pillKeyBg: "#15803d",+ pillOauthBg: "#0e7490",+ chipKeycapBg: "#9333ea",++ // The config TUI's TWO-TONE footer chip (`Footer.tsx`), and no longer the+ // picker's keycap — that one is `chipKeycapBg`, because a neutral grey cannot+ // clear 3:1 on both pages at once. This pair keeps the two-tone contract it was+ // tuned for: theme-following `C.fg` ink on the key segment, `C.fgMuted` on the+ // label, measured against the `bgAlt` band both are drawn on rather than against+ // the two reference terminals. `#d1d5db` came before it and was 1.32:1 off that+ // band; `#9ca3af` keeps 5.4:1 under `C.fg` while sitting 2.3:1 off it.chipKeyBg: "#9ca3af", // key segment — theme text (`C.fg`) rides on topchipLabelBg: "#e5e7eb", // label segment};diff --git a/packages/cli/src/tui/viz/tokens.ts b/packages/cli/src/tui/viz/tokens.tsindex 9e545251..861c0d47 100644--- a/packages/cli/src/tui/viz/tokens.ts+++ b/packages/cli/src/tui/viz/tokens.ts@@ -5,10 +5,11 @@* deliberate deviations from the shipped file. Everything else — the token NAMES, the* `Ramp` type and its non-empty bound, the ramp STRUCTURE (an explicit midtone stop so* `blendStops` never desaturates through the middle) — is unchanged. `color.ts` and- * `text.ts` beside it are byte-identical copies; `widgets.tsx` carries three ADDITIVE+ * `text.ts` beside it are byte-identical copies; `widgets.tsx` carries four ADDITIVE* changes, each documented at its own definition and none altering shipped behaviour:- * `Panel`'s `flush` prop, and the `<span>` twins `MeterSpan` / `SparklineSpan` (with- * `sparkGlyphs` extracted so the twin cannot drift from `Sparkline`). The twins exist for+ * `Panel`'s `flush` prop, the `<span>` twins `MeterSpan` / `SparklineSpan` (with+ * `sparkGlyphs` extracted so the twin cannot drift from `Sparkline`), and `BadgeChip`'s+ * optional `fg`, for a chip whose fill WE chose and whose ink is therefore ours too. The twins exist for* the reason the file already gives for `BadgeSpan` — a `<text>` cannot nest in a `<text>`,* so every ONE-`<text>` widget is un-composable in a mixed row, and the alternative, flex* `<text>` siblings, is the arrangement Yoga silently shrinks. Never scatter hexdiff --git a/packages/cli/src/tui/viz/widgets.tsx b/packages/cli/src/tui/viz/widgets.tsxindex 4b4747b2..f4e8c5b1 100644--- a/packages/cli/src/tui/viz/widgets.tsx+++ b/packages/cli/src/tui/viz/widgets.tsx@@ -440,8 +440,18 @@ export function StackedBar({}/** A status chip: `label` and `bg` are the chip itself; `width` is the COLUMN it sits- * in. See `badgePad` — the padding to `width` goes OUTSIDE the fill. */-export type BadgeChip = { label: string; bg: ColorInput; width?: number };+ * in. See `badgePad` — the padding to `width` goes OUTSIDE the fill.+ *+ * `fg` IS THE FOURTH ADDITIVE DEVIATION FROM THE SKILL'S SHIPPED FILE, and it exists+ * because `pickInk` answers a DIFFERENT question from the one a chip we own is asking.+ * `pickInk` picks the more legible of the two THEME inks, which is right for a fill+ * whose colour it cannot predict; but a chip whose fill we chose owns BOTH sides, so+ * its ink should be deterministic rather than a function of the user's palette.+ * MEASURED on `#15803d`: dark mode picks white (5.02:1), light mode picks black+ * (4.02:1) — the same chip, two inks, and the worse ratio on the page where a reader+ * is most likely to be squinting. Omit `fg` and nothing changes; pass `C.ink` and the+ * chip reads the same in both themes. */+export type BadgeChip = { label: string; bg: ColorInput; width?: number; fg?: ColorInput };/*** Filler columns so a badge can hold a fixed-width COLUMN without growing its fill.@@ -470,12 +480,13 @@ export function Badge({label,bg,width,+ fg,style,...layout}: WidgetLayout & BadgeChip & { style?: WidgetLayout }): ReactNode {return (<text flexShrink={0} {...layout} style={style}>- <span fg={pickInk(bg)} bg={bg} attributes={BOLD}>{` ${label} `}</span>+ <span fg={fg ?? pickInk(bg)} bg={bg} attributes={BOLD}>{` ${label} `}</span>{badgePad(label, width)}</text>);@@ -496,10 +507,10 @@ export function Badge({* `Badge`. The pair is spelled out twice rather than shared through a helper so each* form reads as one line of JSX; change one, change the other. No layout props: a* `<span>` is not a flex item, so its row's `<text>` owns the layout for both. */-export function BadgeSpan({ label, bg, width }: BadgeChip): ReactNode {+export function BadgeSpan({ label, bg, width, fg }: BadgeChip): ReactNode {return (<>- <span fg={pickInk(bg)} bg={bg} attributes={BOLD}>{` ${label} `}</span>+ <span fg={fg ?? pickInk(bg)} bg={bg} attributes={BOLD}>{` ${label} `}</span>{badgePad(label, width)}</>);