Skip to content

Claude Code. Any Model. The most powerful AI coding agent now speaks every language.

feat(picker): $$$ in a cost colour, and a filter on the provider list

Jack Rudenko41e52443907b
diff --git a/ai-docs/architecture/theming.md b/ai-docs/architecture/theming.md
index e4d2c27b..ce2ae9d5 100644
--- a/ai-docs/architecture/theming.md
+++ b/ai-docs/architecture/theming.md
@@ -194,7 +194,7 @@ contrast on the block and then had to print white on it.
- **SIGNAL** (`pillKeyBg`, `pillOauthBg`, `tabActiveBg`, `red`) — 3:1 against its
own palette's reference page.
-- **QUIET** (`pillMutedBg`, both keycap segments) — a near-background fill, and
+- **QUIET** (`pillCostBg`, both keycap segments) — a near-background fill, and
the bar is a FLOOR *and a CEILING*: perceptible (≥ 1.10:1 off the page and off
the `bgAlt` panel) and never louder than 3:1. The ceiling is the gate nobody
had — a purple keycap at 5.04:1 on cream passed every earlier test, because
@@ -202,24 +202,68 @@ contrast on the block and then had to print white on it.
- **Ink** is text-grade (4.5:1) on every chip, under both constructions. That is
the one bar that did not move.
-Quiet fills are also in `SURFACE_TOKENS`: a near-background fill IS a surface, so
-it must be re-tinted onto a cream terminal exactly as `bgAlt` is. They joined that
-list only when they stopped being saturated blocks.
+The keycap segments are also in `SURFACE_TOKENS`: a near-background fill IS a
+surface, so it must be re-tinted onto a cream terminal exactly as `bgAlt` is.
+`pillCostBg` LEFT that list when its label became `$$$` — see below; a fill whose
+whole content is its hue cannot be re-expressed in the page's hue.
### Two fills still cannot be told apart by contrast ratio
-The picker's billing column fills every row — `SUB`/`local` signal, `$` quiet —
-so the design depends on the two reading as different, and under the tinted
-construction they sit within 0.1 of each other in luminance. The assertion is
-therefore perceptual and it matters MORE than before, not less: ΔE76 ≥ 20 (light
-measures 22.7, dark 54.6) and the quiet fill at under half the signal's chroma,
-in `theme-contrast.test.ts` alongside a CIELAB helper written out independently
-for the same reason the luminance formula is.
+The picker's billing column fills every row — `SUB`/`FREE`/`local` on `pillKeyBg`,
+`$$$` on `pillCostBg` — so the design depends on the two reading as different, and
+under the tinted construction they sit close in luminance. The assertion is
+therefore perceptual: ΔE76 ≥ 20 (light measures 44.9, dark 63.4), in
+`theme-contrast.test.ts` alongside a CIELAB helper written out independently for
+the same reason the luminance formula is.
A column of identical fills still fuses — unchanged, and why a scoped flat-rate
roster draws its repeated `SUB` as text (`priceVaries`). ALTERNATING fills do
not, provided the alternation is measured rather than assumed.
+### Reddish means TWO things now, and the second one had to buy its way in (2026-09-13)
+
+The owner's instruction was *"instead of $ it should be '$$$' with light reddish
+colour"*. Until then red was reserved for FAILURE — the `HTTP 401` badge fill, the
+discovery banner's border and its `bgError` wash — and the metered chip was a
+near-neutral slate, which is why the column read as "a claim (green) and the
+absence of one" rather than as the opposition it actually encodes: **green is free
+at the point of use, reddish costs you per token**.
+
+Two meanings on one hue is admissible only while the two cannot be confused, so
+the split is by REGISTER and the register is measured:
+
+| | fill | ink | off its page |
+|---|---|---|---|
+| failure | SATURATED `C.red` | white | ≥ 3:1 (signal bar) |
+| cost | QUIET tint `pillCostBg` | deep/pale rose | ≤ 3:1 (quiet ceiling) |
+
+`theme-contrast.test.ts` pins, per palette: ΔE76 ≥ 20 from BOTH failure fills
+(`C.red` **and** `C.bgError` — the wash is the panel, and a chip that matches the
+panel is the defect), the cost fill under half the chroma of `C.red`, and failure
+separating harder from the page than cost does. **If a future pass brings them
+together it is the COST tint that moves.**
+
+Hexes, both CIELAB hue ~11–13° (a warm rose, not a pink): light `#EDABB4` on
+`#881337` ink, dark `#6B3B42` on `#F0B2BC`. Measured with
+`validation/cost-chip-finalists.ts`: ΔE76 to `C.red` 65.4 / 73.7, to `C.bgError`
+22.4 / 20.8, to `pillKeyBg` 44.9 / 63.4.
+
+**The obvious literal was measured first and rejected.** madbench's `diffDelBg`
+(`#F8D2D5` light, `#2E1216` dark) sits opposite the `diffAddBg` family the green
+came from and is the natural pair — and it measures ΔE76 **6.3** and **9.7** from
+`C.bgError`. That is the same colour to a reader: the chips would have looked like
+fragments of the error panel. Clearing 20 without leaving the red arc costs two
+steps of LIGHTNESS, which is what makes these dusty rather than pale. (A sweep with
+no hue constraint answers with magenta and violet, because walking away from red
+entirely is the cheapest way to satisfy the distance — which is not what was asked
+for. The hue is a constraint; the quietness is what gets optimised inside it.)
+
+The two never share a frame — the banner is drawn only by the models view, `$$$`
+only by the provider list — but they are one keystroke apart, which is close
+enough to carry the first into the second. `validation/cost-vs-error-montage.sh`
+concatenates the two captures into one image so the comparison can actually be
+looked at.
+
### A keycap is a PILL of two segments
`[ esc ][ quit ]` — the key segment brighter, the label segment quieter, the two
diff --git a/packages/cli/src/picker/ModelPicker.test.tsx b/packages/cli/src/picker/ModelPicker.test.tsx
index 74f48537..818e6b4c 100644
--- a/packages/cli/src/picker/ModelPicker.test.tsx
+++ b/packages/cli/src/picker/ModelPicker.test.tsx
@@ -35,10 +35,10 @@ import type { ModelInfo, PickerDiscoveryOutcome } from "../model-selector.js";
import type { DescriptionIndex } from "../providers/model-descriptions.js";
import { C } from "../tui/theme.js";
import { ModelPicker } from "./ModelPicker.js";
+import type { PickerDataSource, PickerProviderChoice } from "./PickerDataSource.js";
import { type Hint, hintsWidth } from "./chrome.js";
import { MAX_DIALOG_ROWS, deriveDialogLayout } from "./layout.js";
import { CHIP_FILL_CELLS } from "./rows.js";
-import type { PickerDataSource, PickerProviderChoice } from "./PickerDataSource.js";
// ── a scriptable source ──────────────────────────────────────────────────────────
@@ -77,6 +77,8 @@ interface FakeOpts {
served?: ModelInfo[];
/** `modelId` → prose sentence, as the description index answers. */
descriptions?: Record<string, string>;
+ /** Built-in local providers the profile config has not opted into. */
+ notEnabledLocal?: string[];
/** Never settles — the in-flight states. */
hang?: boolean;
}
@@ -96,7 +98,7 @@ function fakeSource(opts: FakeOpts = {}): PickerDataSource & { calls: Calls } {
return {
calls,
providerRoster: () => roster,
- notEnabledLocalProviders: () => [],
+ notEnabledLocalProviders: () => opts.notEnabledLocal ?? [],
displayName: (p) => roster.find((r) => r.value === p)?.label ?? p,
async *probeCredentials(names) {
if (opts.hang) await never;
@@ -320,9 +322,15 @@ describe("the dialog", () => {
try {
// The hints row is the last PAINTED row above the bottom border.
const footer = (): string => painted(d.recapture().text).at(-2) ?? "";
- for (const hint of ["move", "open", "all models", "custom", "quit"]) {
+ // THE PROVIDER ROW DOES NOT SAY `move`, AND THAT IS THE ONE DELIBERATE
+ // DIFFERENCE BETWEEN THE TWO FOOTERS. Announcing `/ filter` cost 11 cells on a
+ // row that was already 70 against 72, and the arrows are the hint that repeats
+ // what every list in this program does. The budget half of that claim is the
+ // test below; this half is that the row still names every OTHER action.
+ for (const hint of ["open", "filter", "all models", "show", "custom", "quit"]) {
expect(footer()).toContain(hint);
}
+ expect(footer()).not.toContain("move");
await d.press(["a"]);
await d.until(listPainted);
for (const hint of ["move", "select", "filter", "custom", "back"]) {
@@ -374,8 +382,8 @@ describe("the dialog", () => {
const withLabel = (hints: Hint[], key: string, label: string): Hint[] =>
hints.map((h) => (h.key === key ? { ...h, label } : h));
const providerList: Hint[] = [
- { key: "↑↓", label: "move" },
{ key: "⏎", label: "open" },
+ { key: "/", label: "filter" },
{ key: "a", label: "all models" },
{ key: "k", label: "show" },
{ key: "c", label: "custom" },
@@ -391,14 +399,26 @@ describe("the dialog", () => {
];
expect({
providerRowFits: hintsWidth(providerList) <= inner,
+ // …in BOTH of its states: `esc` says `clear` while a filter is on, which is one
+ // cell more than `quit` and lands exactly on the budget.
+ providerRowFitsWhileFiltering: hintsWidth(withLabel(providerList, "esc", "clear")) <= inner,
scopedRowFits: hintsWidth(scopedList) <= inner,
needsKeyWouldNotFit: hintsWidth(withLabel(providerList, "k", "needs key")) > inner,
providersWouldNotFit: hintsWidth(withLabel(scopedList, "esc", "providers")) > inner,
+ // AND THE HINT THE PROVIDER ROW GAVE UP TO CARRY `/ filter` REALLY DOES NOT
+ // FIT. `↑↓ move` is on the model list's footer and not on this one; that asymmetry
+ // is a measurement, and this is the measurement.
+ arrowsWouldNotFit:
+ hintsWidth([{ key: "↑↓", label: "move" }, ...providerList]) > inner &&
+ hintsWidth([{ key: "↑↓", label: "move" }, ...withLabel(providerList, "esc", "clear")]) >
+ inner,
}).toEqual({
providerRowFits: true,
+ providerRowFitsWhileFiltering: true,
scopedRowFits: true,
needsKeyWouldNotFit: true,
providersWouldNotFit: true,
+ arrowsWouldNotFit: true,
});
});
});
@@ -440,27 +460,36 @@ describe("the billing and prefix CHIPS", () => {
}
});
- test("`$` IS A CHIP TOO, ON ITS OWN QUIETER FILL — and the two are not one band", async () => {
- // The owner's instruction, verbatim: "make sub badge not as bright, make it
- // softer and make $$$ the same width and badge as well". So the billing column
- // carries a fill on every row, which is only legible as a two-tone column if the
- // two fills are different — and `captureCharFrame` reads `$` and `SUB` the same
- // whatever colour they are, so the assertion has to be on the spans.
+ test("`$$$` IS A CHIP TOO, ON THE COST FILL — and it is not the failure red", async () => {
+ // The owner's instruction, verbatim: "instead of $ it should be '$$$' with light
+ // reddish colour". The LABEL is the half a character frame can see; the FILL is
+ // the half it cannot, and the fill is where this goes wrong expensively —
+ // reddish is the hue the `HTTP 401` badge and the discovery banner already own,
+ // so a cost chip that picked one of those up would paint a failure on every
+ // healthy metered row. Hence both assertions, on the spans.
const d = await draw(<ModelPicker source={fakeSource({ roster })} onDone={() => {}} />);
try {
await d.until(providerListPainted);
const f = d.recapture().frame;
- const dollars = labelled(f, "$");
+ const dollars = labelled(f, "$$$");
expect(dollars.length).toBeGreaterThan(0);
+ // And the label it REPLACED is gone from the column rather than merely joined
+ // by the new one: a lone `$` chip surviving here is the half-applied edit.
+ expect(labelled(f, "$")).toEqual([]);
for (const chip of dollars) {
- expect(bgOf(chip)).toBe(rgb(C.pillMutedBg));
- // Never the positive family's fill, and never a row background: a `$` that
+ expect(bgOf(chip)).toBe(rgb(C.pillCostBg));
+ // Never the no-charge family's fill, and never a row background: a `$$$` that
// picked up `pillKeyBg` would claim the route costs nothing.
expect(bgOf(chip)).not.toBe(rgb(C.pillKeyBg));
expect(bgOf(chip)).not.toBe(rgb(C.bgAlt));
- expect(chip.fg.toInts().slice(0, 3).join()).toBe(rgb(C.pillMutedFg));
+ // NEVER THE FAILURE FILLS. `theme-contrast.test.ts` measures how far apart
+ // they have to be; this pins that they are not literally the same object,
+ // which is the version of the mistake a hurried edit actually makes.
+ expect(bgOf(chip)).not.toBe(rgb(C.red));
+ expect(bgOf(chip)).not.toBe(rgb(C.bgError));
+ expect(chip.fg.toInts().slice(0, 3).join()).toBe(rgb(C.pillCostFg));
}
- expect(rgb(C.pillMutedBg)).not.toBe(rgb(C.pillKeyBg));
+ expect(rgb(C.pillCostBg)).not.toBe(rgb(C.pillKeyBg));
} finally {
d.destroy();
}
@@ -488,7 +517,7 @@ describe("the billing and prefix CHIPS", () => {
});
test("EVERY STATUS CHIP IS THE SAME WIDTH, and the cell's surplus stays unfilled", async () => {
- // ONE COLUMN, ONE FILL WIDTH — the owner asked for `$` and `SUB` at the same
+ // ONE COLUMN, ONE FILL WIDTH — the owner asked for `$$$` and `SUB` at the same
// width, and a 1-cell fill beside a 5-cell one is what he was looking at. The
// label is centred INSIDE the fill, which is the one sanctioned place for that
// (`rows.tsx` header): a column wants straight edges, and the rule it bends was
@@ -504,7 +533,7 @@ describe("the billing and prefix CHIPS", () => {
await d.until(providerListPainted);
const f = d.recapture().frame;
const status = spansOf(f).filter(
- (sp) => bgOf(sp) === rgb(C.pillKeyBg) || bgOf(sp) === rgb(C.pillMutedBg)
+ (sp) => bgOf(sp) === rgb(C.pillKeyBg) || bgOf(sp) === rgb(C.pillCostBg)
);
expect(status.length).toBeGreaterThan(0);
// Every fill in the column is CHIP_FILL_CELLS wide, whatever its label…
@@ -698,10 +727,17 @@ describe("the picker opens on the PROVIDER list", () => {
}
});
- test("a provider with NO credential is not on the list, and the omission is counted", async () => {
- // "we should not show unsetted providers, just active". Not deleted — counted,
- // with the key that brings them back, because an unexplained absence is the
- // defect class this feature exists to remove.
+ test("a provider with NO credential is off the list, and `k` reveals it WITH its reason", async () => {
+ // "we should not show unsetted providers, just active". Not deleted — reachable,
+ // because an unexplained absence is the defect class this feature exists to
+ // remove.
+ //
+ // THE SUMMARY LINE THAT USED TO COUNT THEM IS GONE, on the owner's instruction
+ // ("remove this, 5 lines which has no value"), and this test is where that has to
+ // be paid for: the whole explanation now lives on the REVEALED ROW, so `k` must
+ // still reach it and the row must still say why. A build that hid the count and
+ // also dropped the reason would have looked fine on a screenshot of the default
+ // state, which is the only state a screenshot was ever taken of.
const d = await draw(
<ModelPicker
source={fakeSource({ roster, ready: { openrouter: true, "kimi-coding": false } })}
@@ -713,13 +749,14 @@ describe("the picker opens on the PROVIDER list", () => {
expect(before).toContain("OpenRouter");
expect(before).not.toContain("Kimi Coding");
expect(before).not.toContain("MOONSHOT_API_KEY");
- expect(before).toContain("+1 more need a key");
+ // And the deleted line is really deleted, in the state that used to print it.
+ expect(before).not.toContain("more need a key");
await d.press(["k"]);
const after = joined(d.recapture().text);
expect(after).toContain("Kimi Coding");
// Revealed WITH the exact variable to inspect, which is the whole value of
- // showing them at all.
+ // showing them at all — and now the ONLY place that fact appears.
expect(after).toContain("MOONSHOT_API_KEY");
} finally {
d.destroy();
@@ -759,6 +796,237 @@ describe("the picker opens on the PROVIDER list", () => {
});
});
+// ── the two summary lines are gone, and their content moved onto the rows ───────
+
+describe("`k` reveals BOTH kinds of unavailable provider, each with its own reason", () => {
+ // The owner deleted the two lines under the list — *"remove this, 5 lines which has
+ // no value"* — and they were the only place the screen distinguished a provider
+ // missing a CREDENTIAL from a local one that is merely not ENABLED. The distinction
+ // is real (one sends you to find an API key, the other to a config flag), so it had
+ // to land somewhere: it is now each row's own tail.
+ const roster = [
+ provider({ value: "openrouter", label: "OpenRouter", shortcut: "or@", hasDiscovery: false }),
+ provider({ value: "kimi-coding", label: "Kimi Coding", shortcut: "kc@", hasDiscovery: false }),
+ provider({
+ value: "ollama",
+ label: "Ollama (local)",
+ shortcut: "ollama@",
+ billing: "local",
+ envVar: "",
+ hasDiscovery: true,
+ }),
+ ];
+
+ test("neither summary line is on the screen any more", async () => {
+ const d = await draw(
+ <ModelPicker
+ source={fakeSource({
+ roster,
+ ready: { openrouter: true, "kimi-coding": false, ollama: false },
+ notEnabledLocal: ["ollama"],
+ })}
+ onDone={() => {}}
+ />
+ );
+ try {
+ await d.until(providerListPainted);
+ const before = joined(d.recapture().text);
+ expect(before).not.toContain("more need a key");
+ expect(before).not.toContain("not enabled in your config");
+ // And the rows themselves are still hidden, which is what the lines described.
+ expect(before).not.toContain("Kimi Coding");
+ expect(before).not.toContain("Ollama");
+ } finally {
+ d.destroy();
+ }
+ });
+
+ test("and `k` brings both back, each saying WHY it cannot be used", async () => {
+ const d = await draw(
+ <ModelPicker
+ source={fakeSource({
+ roster,
+ ready: { openrouter: true, "kimi-coding": false, ollama: false },
+ notEnabledLocal: ["ollama"],
+ })}
+ onDone={() => {}}
+ />
+ );
+ try {
+ await d.until(providerListPainted);
+ await d.press(["k"]);
+ await d.until((t) => t.join("").includes("Ollama"));
+ const after = joined(d.recapture().text);
+ // A cloud provider names the credential — the actionable fact.
+ expect(after).toContain("Kimi Coding");
+ expect(after).toContain("MOONSHOT_API_KEY");
+ // A local one names the config, because nothing is missing: it is opt-in and
+ // has not been opted into. Sending this user to look for an API key would send
+ // him after something that does not exist.
+ expect(after).toContain("Ollama");
+ expect(after).toContain("not enabled in config");
+ expect(after).not.toContain("needs sign-in");
+ } finally {
+ d.destroy();
+ }
+ });
+});
+
+// ── the provider list filters, in the model list's own idiom ────────────────────
+
+describe("the PROVIDER list filters as you type", () => {
+ // The owner: *"we need inline search in list of providers as well"*. It was a
+ // deliberate omission — 17 named rows do not need narrowing — and the point of this
+ // block is that what was added is the SAME interaction as the model list, not a
+ // second one to learn.
+ const roster = [
+ provider({ value: "openrouter", label: "OpenRouter", shortcut: "or@", hasDiscovery: false }),
+ provider({ value: "kimi-coding", label: "Kimi Coding", shortcut: "kc@", hasDiscovery: false }),
+ provider({ value: "google", label: "Google Gemini", shortcut: "go@", hasDiscovery: false }),
+ ];
+
+ test("typing NARROWS the list, and the count on the right follows it", async () => {
+ const d = await draw(<ModelPicker source={fakeSource({ roster })} onDone={() => {}} />);
+ try {
+ await d.until(providerListPainted);
+ expect(joined(d.recapture().text)).toContain("OpenRouter");
+
+ // `im`, not `kimi`: `k` is a COMMAND while the filter is empty (see the test
+ // below), so a bare `k` would toggle the hidden providers instead of typing.
+ await d.press(["i", "m"]);
+ const after = joined(d.recapture().text);
+ expect(after).toContain("Kimi Coding");
+ expect(after).not.toContain("OpenRouter");
+ expect(after).not.toContain("Google Gemini");
+ // The same `matches of total` the model list prints, from the same component.
+ expect(after).toContain("1 of 3");
+ } finally {
+ d.destroy();
+ }
+ });
+
+ test("the SHORTCUT matches too, because `kc@` is what the row shows beside the name", async () => {
+ // Two vocabularies reach the same row — what it is called and how it is routed —
+ // and a user who knows the prefix should not have to remember the display name.
+ const d = await draw(<ModelPicker source={fakeSource({ roster })} onDone={() => {}} />);
+ try {
+ await d.until(providerListPainted);
+ // `/` first, because `kc@` starts with one of the three command letters — which
+ // is precisely the case the escape hatch exists for.
+ await d.press(["/"]);
+ await d.press(["k", "c"]);
+ const after = joined(d.recapture().text);
+ expect(after).toContain("Kimi Coding");
+ expect(after).not.toContain("OpenRouter");
+ } finally {
+ d.destroy();
+ }
+ });
+
+ test("`k` TYPES once the filter is live — it does not toggle the hidden providers", async () => {
+ // THE RULE THE MODEL LIST ALREADY HAD, AND THE REASON IT EXISTS. A letter that is
+ // a command while the filter is empty must become a letter once it is not, or
+ // narrowing to `kimi` fires `k` (reveal), `i`, `m`, `i` and the user watches the
+ // screen do something else entirely. `k` is the sharpest case here because its
+ // command is a VISIBLE toggle.
+ const d = await draw(
+ <ModelPicker
+ source={fakeSource({
+ roster,
+ ready: { openrouter: true, "kimi-coding": true, google: false },
+ })}
+ onDone={() => {}}
+ />
+ );
+ try {
+ await d.until(providerListPainted);
+ // First `k` is the command: the credential-less provider appears.
+ await d.press(["k"]);
+ expect(joined(d.recapture().text)).toContain("Google Gemini");
+ await d.press(["ESCAPE"]);
+ // `/` focuses the filter, so the NEXT `k` is a letter even though the filter is
+ // still empty — which is the whole point of the escape hatch.
+ await d.press(["/"]);
+ await d.press(["k"]);
+ const after = joined(d.recapture().text);
+ expect(after).toContain("Kimi Coding");
+ expect(after).not.toContain("OpenRouter");
+ } finally {
+ d.destroy();
+ }
+ });
+
+ test("`esc` CLEARS the filter first and only then quits — the model list's rule", async () => {
+ let got: string | null | undefined;
+ const d = await draw(
+ <ModelPicker
+ source={fakeSource({ roster })}
+ onDone={(spec) => {
+ got = spec;
+ }}
+ />
+ );
+ try {
+ await d.until(providerListPainted);
+ await d.press(["i", "m"]);
+ expect(joined(d.recapture().text)).not.toContain("OpenRouter");
+
+ await d.press(["ESCAPE"]);
+ await d.until((t) => t.join("").includes("OpenRouter"));
+ // Cleared, NOT cancelled: the whole list is back and the picker is still open.
+ expect(got).toBeUndefined();
+ const cleared = joined(d.recapture().text);
+ expect(cleared).toContain("OpenRouter");
+ expect(cleared).toContain("Google Gemini");
+
+ // And the second `esc`, with nothing to clear, is the landing view's cancel.
+ await d.press(["ESCAPE"]);
+ expect(got).toBeNull();
+ } finally {
+ d.destroy();
+ }
+ });
+
+ test("a filter that matches nothing SAYS SO, and says how to get out", async () => {
+ const d = await draw(<ModelPicker source={fakeSource({ roster })} onDone={() => {}} />);
+ try {
+ await d.until(providerListPainted);
+ await d.press(["z", "z"]);
+ const after = joined(d.recapture().text);
+ expect(after).toContain("no provider matches");
+ expect(after).toContain("esc clears the filter");
+ } finally {
+ d.destroy();
+ }
+ });
+
+ test("entering a provider does not carry the filter into its model list", async () => {
+ // One `filter` state serves both views, which is what keeps the two screens
+ // behaving identically — and it is only safe because every transition clears it.
+ // A leaked filter would open a provider onto `no model matches “kimi”`.
+ const d = await draw(
+ <ModelPicker
+ source={fakeSource({ roster, byProvider: { "kimi-coding": [model({ id: "kimi-k3" })] } })}
+ onDone={() => {}}
+ />
+ );
+ try {
+ await d.until(providerListPainted);
+ await d.press(["i", "m"]);
+ await d.press(["RETURN"]);
+ await d.until(listPainted);
+ const after = joined(d.recapture().text);
+ expect(after).toContain("kimi-k3");
+ expect(after).not.toContain("no model matches");
+ // `newest first` is the model list's idle caption — it is only drawn when the
+ // filter is empty, so its presence IS the assertion that nothing leaked.
+ expect(after).toContain("newest first");
+ } finally {
+ d.destroy();
+ }
+ });
+});
+
// ── entering a provider is what fetches it ───────────────────────────────────────
describe("entering a provider loads THAT provider, on demand", () => {
diff --git a/packages/cli/src/picker/ModelPicker.tsx b/packages/cli/src/picker/ModelPicker.tsx
index 74dc28fd..0df43720 100644
--- a/packages/cli/src/picker/ModelPicker.tsx
+++ b/packages/cli/src/picker/ModelPicker.tsx
@@ -255,9 +255,30 @@ export function ModelPicker({ source, onDone, onDiscoveryFailure }: ModelPickerP
* for every row that was already visible.
*/
const keyless = providers.missing;
- const providerRows: ProviderState[] = revealKeyless
+ /** Which local providers are opt-in-and-not-opted-into — `unavailableNote`'s oracle. */
+ const notEnabledLocal = useMemo(
+ () => new Set(providers.notEnabledLocal),
+ [providers.notEnabledLocal]
+ );
+ const providerPool: ProviderState[] = revealKeyless
? [...providers.ready, ...keyless]
: providers.ready;
+ /**
+ * The provider list's own filter — SAME IDIOM AS THE MODEL LIST, same state.
+ *
+ * It used to have none, on the grounds that 17 named rows do not need narrowing.
+ * The owner asked for it anyway — *"we need inline search in list of providers as
+ * well"* — and the reason it is the same `filter`/`typing` pair rather than a second
+ * one is that a picker with two search boxes has two sets of rules to learn. The
+ * state cannot leak between the views: every transition INTO a model list clears it
+ * explicitly, and `esc` out of a model list clears it before it goes back.
+ *
+ * IT MATCHES ON THE NAME AND THE SHORTCUT, which are the two things on the row that
+ * a user would type — `kimi` and `kc@` both have to reach Kimi Coding. The shortcut
+ * is matched by PREFIX (as the model list matches it) so `k` does not pull in every
+ * provider with a `k` somewhere in its slug.
+ */
+ const providerRows: ProviderState[] = matchProviders(providerPool, filter);
/**
* A MODEL COUNT ONLY WHERE ONE IS ACTUALLY KNOWN — the owner's rule: *"we could
@@ -446,9 +467,13 @@ export function ModelPicker({ source, onDone, onDiscoveryFailure }: ModelPickerP
// is typed they are letters again, because a user typing `codex` must get `codex`
// and not the custom-spec dialog.
//
- // THE PROVIDER LIST TAKES NO FILTER AND SO NEEDS NO ESCAPE HATCH: its letters
- // (`a`, `k`, `c`) are always commands, which is affordable because that list is
- // short and named, never hundreds of rows a user needs to narrow.
+ // THE PROVIDER LIST NOW TAKES THE SAME FILTER, UNDER THE SAME RULE. It used to
+ // have none — its letters (`a`, `k`, `c`) were always commands, which was
+ // affordable because 17 named rows do not need narrowing — and the owner asked for
+ // one anyway: *"we need inline search in list of providers as well"*. Making it a
+ // SECOND interaction would have been the mistake: one filter idiom, one set of
+ // rules, applied on both screens. So `a`/`k`/`c` are live only while the filter is
+ // empty, `/` is the escape hatch, and `esc` clears before it leaves.
useKeyboard((key) => {
const name = key.name;
if (key.ctrl && name === "c") {
@@ -475,9 +500,17 @@ export function ModelPicker({ source, onDone, onDiscoveryFailure }: ModelPickerP
}
if (view === "providers") {
- // THE LANDING VIEW OWNS CANCEL. `esc` goes one step back everywhere else in
- // this picker; here there is no step back, so it is what returns `null`.
+ // THE LANDING VIEW OWNS CANCEL — BUT THE FILTER COMES FIRST, which is the model
+ // list's rule applied unchanged. `esc` goes one step back everywhere else in
+ // this picker; here the step back is the filter while there is one, and only
+ // then does `esc` return `null`. Two screens, one meaning for the key.
if (name === "escape") {
+ if (filter !== "" || typing) {
+ setFilter("");
+ setTyping(false);
+ setProviderCursor(0);
+ return;
+ }
onDone(null);
return;
}
@@ -512,7 +545,17 @@ export function ModelPicker({ source, onDone, onDiscoveryFailure }: ModelPickerP
}
return;
}
- if (key.raw === "a") {
+ if (name === "backspace") {
+ setFilter((v) => v.slice(0, -1));
+ setProviderCursor(0);
+ return;
+ }
+ // THE THREE LETTER COMMANDS ARE LIVE ONLY WHILE THE FILTER IS EMPTY, which is
+ // the model list's rule and it is load-bearing here for the same reason: a user
+ // narrowing to `claude` must get `claude` and not the custom-spec dialog on the
+ // `c`. `/` is the escape hatch for a search that STARTS with one of them.
+ const providerCommands = filter === "" && !typing;
+ if (providerCommands && key.raw === "a") {
setScope(null);
setFilter("");
setTyping(false);
@@ -520,11 +563,24 @@ export function ModelPicker({ source, onDone, onDiscoveryFailure }: ModelPickerP
setView("models");
return;
}
- if (key.raw === "k") {
+ if (providerCommands && key.raw === "k") {
setRevealKeyless((v) => !v);
return;
}
- if (key.raw === "c") setView("custom");
+ if (providerCommands && key.raw === "c") {
+ setView("custom");
+ return;
+ }
+ if (key.raw === "/") {
+ // Not inserted: `/` FOCUSES the filter, which here means "stop treating
+ // a / k / c as commands". See `typing`.
+ setTyping(true);
+ return;
+ }
+ if (printable(key.raw)) {
+ setFilter((v) => v + key.raw);
+ setProviderCursor(0);
+ }
return;
}
@@ -636,11 +692,10 @@ export function ModelPicker({ source, onDone, onDiscoveryFailure }: ModelPickerP
if (view === "providers") {
const settled = !providers.probing;
- // One row taller than the model list's list: this dialog spends no column
- // header and no description block, and two of the three rows it spends
- // instead — the omitted-provider summary and the credential sweep — are
- // rendered blank rather than dropped, so the list does not shift under the
- // cursor when a sweep finishes or `k` is pressed.
+ // Taller than the model list's list: this dialog spends no column header and no
+ // description block, and the rows it spends instead — the scroll position and the
+ // credential sweep — are rendered blank rather than dropped, so the list does not
+ // shift under the cursor when a sweep finishes or `k` is pressed.
const windowRows = layout.listRows;
const providerTop = scrollWindow(providerCursor, providerRows.length, windowRows);
const providerWindow = providerRows.slice(providerTop, providerTop + windowRows);
@@ -658,6 +713,21 @@ export function ModelPicker({ source, onDone, onDiscoveryFailure }: ModelPickerP
width={layout.width}
marginLeft={0}
>
+ {/* THE SAME FILTER ROW THE MODEL LIST CARRIES, in the same place, with the
+ same `matches of total` on the right. It is always rendered, blank
+ prompt and all, because a search box that appears when you start typing
+ cannot be found by someone who does not know it is there.
+ `idle=""` — this list is not SORTED, it is in the curated picker order,
+ so there is no `newest first` to claim here. That the model list's
+ caption is the one string separating the two views in a frame capture
+ (`listPainted`) is a happy consequence, not the reason. */}
+ <FilterRow
+ value={filter}
+ matches={providerRows.length}
+ total={providerPool.length}
+ width={layout.inner}
+ idle=""
+ />
{/* TWO ROWS WHEN IT IS EMPTY, because `EmptyState` with a hint IS two
rows and a one-row box would overprint the second onto the row
below it. */}
@@ -673,11 +743,17 @@ export function ModelPicker({ source, onDone, onDiscoveryFailure }: ModelPickerP
{providerWindow.length === 0 ? (
<EmptyState
label={
- settled
- ? `no credential for any of the ${providers.total} providers`
- : "checking which providers you have credentials for…"
+ filter !== ""
+ ? `no provider matches “${filter}”`
+ : settled
+ ? `no credential for any of the ${providers.total} providers`
+ : "checking which providers you have credentials for…"
}
- {...(settled ? { hint: "k shows what each one needs" } : {})}
+ {...(filter !== ""
+ ? { hint: "esc clears the filter" }
+ : settled
+ ? { hint: "k shows what each one needs" }
+ : {})}
/>
) : (
providerWindow.map((r) => (
@@ -689,7 +765,7 @@ export function ModelPicker({ source, onDone, onDiscoveryFailure }: ModelPickerP
billing={r.billing}
count={counts.get(r.value) ?? null}
hasDiscovery={r.hasDiscovery}
- note={r.envVar === "" ? "needs sign-in" : `needs ${r.envVar}`}
+ note={unavailableNote(r, notEnabledLocal)}
cursor={r.value === here?.value}
inner={layout.inner}
/>
@@ -706,30 +782,19 @@ export function ModelPicker({ source, onDone, onDiscoveryFailure }: ModelPickerP
}
width={layout.inner}
/>
- {/* THE OMITTED PROVIDERS, COUNTED. They are off the list because the user
- cannot launch any of them, and stated here because "where did the other
- fourteen go" must have an answer on the screen that dropped them. */}
- <HintRow
- text={
- keyless.length === 0
- ? ""
- : revealKeyless
- ? `showing ${keyless.length} with no credential · k hides them again`
- : `+${keyless.length} more need a key · k`
- }
- width={layout.inner}
- />
- {/* A DIFFERENT REASON, ON ITS OWN LINE. These are not missing a key: they
- are opt-in in your config (`config.localProviders`) and were never
- probed for liveness. */}
- <HintRow
- text={
- providers.notEnabledLocal.length > 0
- ? `${providers.notEnabledLocal.join(", ")} — local, not enabled in your config`
- : ""
- }
- width={layout.inner}
- />
+ {/* THE TWO SUMMARY LINES THAT WERE HERE ARE GONE, on the owner's
+ instruction — *"remove this, 5 lines which has no value"*. They were
+ `+14 more need a key · k` and `ollama, lmstudio, vllm, mlx — local, not
+ enabled in your config`.
+ WHAT THEY WERE FOR SURVIVES, WHICH IS THE ONLY REASON THEY COULD GO.
+ They existed so a dropped provider was an EXPLAINED absence rather than
+ a silent one, and the explanation has simply moved somewhere better: the
+ footer's `[k][show]` is the way in, and each revealed row now states its
+ OWN reason in its tail — `needs MOONSHOT_API_KEY` for a missing
+ credential, `not enabled in config` for a local provider that is opt-in
+ (`unavailableNote`). A per-row reason is strictly more information than
+ one counted summary, and it costs no rows at all when nothing is hidden.
+ At 80×24 those two rows were 2 of the 13 the dialog has. */}
{/* THE ONE METER IN THE PICKER, on the one screen that waits for anything.
It is `done/total` over a roster derived synchronously — real progress
over countable work — and it disappears, leaving its row, when the last
@@ -755,8 +820,20 @@ export function ModelPicker({ source, onDone, onDiscoveryFailure }: ModelPickerP
/>
<Hints
hints={[
- { key: "↑↓", label: "move" },
+ // `↑↓ move` IS THE HINT THIS ROW GAVE UP TO ANNOUNCE THE FILTER, and
+ // the arithmetic is why rather than taste: MEASURED with `hintsWidth`,
+ // this row was 70 cells against the 72 the dialog has at 80 columns, and
+ // `/ filter` costs 11 more. `Hints` sets `overflow="hidden"`, so the
+ // overflow would have been a silently clipped `esc qu` — the exact
+ // failure the model list's footer already shipped once.
+ //
+ // Of the six, the arrows are the one hint that says what every list in
+ // the program already does, and the ONE thing on this screen a reader
+ // cannot guess is now the `/` prompt sitting above the list saying
+ // nothing about itself. A test pins that putting `↑↓ move` back
+ // overflows, so this stays a measurement and not a preference.
{ key: "⏎", label: "open", on: here !== null },
+ { key: "/", label: "filter" },
{ key: "a", label: "all models" },
// `show` / `hide`, NOT `needs key` — AND THE SHORTENING IS WHAT PAID FOR
// THE PILLS. A keycap is two filled segments now (`chrome.tsx`), which
@@ -764,15 +841,18 @@ export function ModelPicker({ source, onDone, onDiscoveryFailure }: ModelPickerP
// cells past the 72 the dialog has: `esc quit` rendered as `esc qu`.
//
// This is the label that could shrink without losing anything, because
- // `needs key` DUPLICATED the row directly above it — `+14 more need a
- // key · k` says the same thing one line up and says it in full. So the
- // reason lives where there is room for it and the footer says only what
- // the key does. (`keyless` was the label before that and said the
- // OPPOSITE of what it meant: these providers need a key, which is
- // precisely why they are hidden.)
+ // `needs key` DUPLICATED the row that used to sit directly above it.
+ // That row is gone now and the duplication argument with it — but the
+ // reason it names is not lost, it moved ONTO the revealed rows
+ // (`unavailableNote`), which say it per provider and say it precisely.
+ // (`keyless` was the label before that and said the OPPOSITE of what it
+ // meant: these providers need a key, which is precisely why they are
+ // hidden.)
{ key: "k", label: revealKeyless ? "hide" : "show", on: keyless.length > 0 },
{ key: "c", label: "custom" },
- { key: "esc", label: "quit" },
+ // `clear`, then `quit` — the model list's exact rule. `esc` is one step
+ // back and the filter is the first step there is.
+ { key: "esc", label: filter !== "" ? "clear" : "quit" },
]}
/>
</Dialog>
@@ -1019,6 +1099,33 @@ export function countModels(rows: readonly { model: ModelInfo }[]): number {
return new Set(rows.map((r) => r.model.id)).size;
}
+/**
+ * WHY A REVEALED PROVIDER CANNOT BE LAUNCHED — the row's own tail, now that the
+ * summary lines below the list are gone.
+ *
+ * TWO REASONS, AND THEY ARE NOT THE SAME REASON. A cloud provider is unavailable
+ * because claudish found no credential for it, and the actionable fact is WHICH
+ * credential — an env var name the user can go and set, or a sign-in for the
+ * OAuth-only ones that have no env var at all. A built-in LOCAL provider is
+ * unavailable for a different reason entirely: nothing is missing, it is opt-in in
+ * the profile config (`config.localProviders`) and has not been opted into. Telling
+ * that user to go and find an API key would send him looking for something that does
+ * not exist.
+ *
+ * `notEnabledLocalProviders()` IS THE ORACLE, not `billing === "local"`. It is the
+ * same derived list the deleted summary line printed, and it answers the precise
+ * question — enabled in THIS config or not — where the billing mode only says what
+ * kind of thing the provider is. An enabled-but-dead Ollama is a different state
+ * again, and it is not this one: the probe answers for liveness.
+ */
+export function unavailableNote(
+ provider: { value: string; envVar: string },
+ notEnabledLocal: ReadonlySet<string>
+): string {
+ if (notEnabledLocal.has(provider.value)) return "not enabled in config";
+ return provider.envVar === "" ? "needs sign-in" : `needs ${provider.envVar}`;
+}
+
/** A roster entry as the facts the detail line prints. Derived, never a table. */
function factsOf(choice: PickerProviderChoice): ProviderFacts {
return {
@@ -1057,6 +1164,34 @@ export function statusRow(
return "";
}
+/**
+ * Which providers a filter keeps. Pure, so the matching rules can be asserted
+ * without a renderer — and exported because they ARE the rules, not an aid to them.
+ *
+ * THREE THINGS MATCH, and the first two are what is printed on the row: the readable
+ * NAME (`Kimi / Moonshot`) and the routing SHORTCUT (`kc@`). The third is the
+ * provider's internal `value` (`kimi-coding`), which is on no screen here but is what
+ * the user types on argv and reads in `--debug` output, so a search for it finding
+ * nothing would be a false absence.
+ *
+ * THE SHORTCUT MATCHES BY PREFIX, THE NAMES BY SUBSTRING, exactly as the model list
+ * does it. A shortcut is a short token the user is spelling from the left; a display
+ * name is a phrase he may recall the middle of.
+ */
+export function matchProviders<T extends { label: string; shortcut: string; value: string }>(
+ rows: T[],
+ filter: string
+): T[] {
+ const needle = filter.trim().toLowerCase();
+ if (needle === "") return rows;
+ return rows.filter(
+ (r) =>
+ r.label.toLowerCase().includes(needle) ||
+ r.shortcut.toLowerCase().startsWith(needle) ||
+ r.value.toLowerCase().includes(needle)
+ );
+}
+
/** One row of the list, whichever list it is. */
type RowView = PickerRow;
diff --git a/packages/cli/src/picker/chrome.tsx b/packages/cli/src/picker/chrome.tsx
index f630506e..29beb74e 100644
--- a/packages/cli/src/picker/chrome.tsx
+++ b/packages/cli/src/picker/chrome.tsx
@@ -98,19 +98,31 @@ export function composeTitle(title: string, status: string, width: number): stri
*
* The right-hand group answers "why is this row at the top" while nothing is
* typed, and "how much did I just cut" once something is.
+ *
+ * `idle` IS THE FIRST HALF OF THAT AND IT IS NOT ALWAYS WORTH SAYING. `newest first`
+ * explains an ordering the user did not choose and would otherwise wonder about —
+ * why `gpt-5.2` sits above `gpt-5`. The PROVIDER list has no such puzzle: its order
+ * is the curated `PICKER_ORDER`, which reads as "the obvious ones first" and needs no
+ * caption, so it passes `""` and the row is just the prompt until something is typed.
+ * Inventing a phrase there would spend a row's right edge on nothing — and it would
+ * put a SORT claim on a screen that does not sort, which the reader has no reason to
+ * disbelieve.
*/
export function FilterRow({
value,
matches,
total,
width,
+ idle = "newest first",
}: {
value: string;
matches: number;
total: number;
width: number;
+ /** What the right edge says while nothing is typed. `""` says nothing. */
+ idle?: string;
}): ReactNode {
- const right = value === "" ? "newest first" : `${matches} of ${total}`;
+ const right = value === "" ? idle : `${matches} of ${total}`;
const room = Math.max(1, width - displayWidth(right) - 4);
return (
<box flexDirection="row" justifyContent="space-between" height={1} flexShrink={0}>
diff --git a/packages/cli/src/picker/row-semantics.test.ts b/packages/cli/src/picker/row-semantics.test.ts
index 809f413d..43617d68 100644
--- a/packages/cli/src/picker/row-semantics.test.ts
+++ b/packages/cli/src/picker/row-semantics.test.ts
@@ -32,6 +32,7 @@ import {
priceFg,
priceLabel,
priceVaries,
+ providerCountText,
readinessGlyph,
} from "./rows.js";
@@ -176,6 +177,70 @@ describe("CHIP_FILL_CELLS — one fill width for the whole status column", () =>
});
});
+describe("providerCountText — the tail says what you GET, never how it is fetched", () => {
+ test("a known count is a count, and one model is not `1 models`", () => {
+ expect(providerCountText({ count: 42, hasDiscovery: true, billing: "metered" })).toBe(
+ "42 models"
+ );
+ expect(providerCountText({ count: 1, hasDiscovery: false, billing: "sub" })).toBe("1 model");
+ // `null` is "nobody has counted this yet" and prints NOTHING — not `0`, not a dash.
+ expect(providerCountText({ count: null, hasDiscovery: true, billing: "sub" })).toBe("");
+ });
+
+ test("`asks its own roster` is gone — a subscription provider says `subscription models`", () => {
+ // The owner read the shipped row on a live run: `asks its own roster` describes
+ // claudish's fetch, not the user's plan. His replacement, verbatim: *"subscription
+ // models"*. This is the case he was looking at — Grok Build, Devin, Antigravity,
+ // OpenCode Zen Go: flat-rate, no catalog entries, a roster of their own.
+ expect(providerCountText({ count: 0, hasDiscovery: true, billing: "sub" })).toBe(
+ "subscription models"
+ );
+ for (const billing of ["sub", "metered", "local"] as const) {
+ expect(providerCountText({ count: 0, hasDiscovery: true, billing })).not.toContain("roster");
+ }
+ });
+
+ test("and a NON-subscription provider gets its own words, because the other would be false", () => {
+ // `hasDiscovery` is a property of the provider DEFINITION, not of its billing, so
+ // this branch is reachable by a metered or local provider with no catalog entries
+ // — a self-hosted vLLM, an Ollama daemon. "Subscription models" there would be the
+ // screen stating a plan the user does not have.
+ expect(providerCountText({ count: 0, hasDiscovery: true, billing: "metered" })).toBe(
+ "lists its own models"
+ );
+ expect(providerCountText({ count: 0, hasDiscovery: true, billing: "local" })).toBe(
+ "lists its own models"
+ );
+ expect(providerCountText({ count: 0, hasDiscovery: true, billing: "metered" })).not.toContain(
+ "subscription"
+ );
+ });
+
+ test("a REAL zero from a provider that does not discover is still a zero", () => {
+ // Without `hasDiscovery` there is nothing else to ask: the catalog is the answer
+ // and the answer is none. Saying "lists its own models" there would be the
+ // opposite lie to the one above.
+ expect(providerCountText({ count: 0, hasDiscovery: false, billing: "metered" })).toBe(
+ "0 models"
+ );
+ });
+
+ test("every phrasing fits the tail cell at 80 columns, where it is narrowest", () => {
+ // `deriveProviderRowLayout` gives the tail 25 cells at the narrowest supported
+ // width and grows it from there. A phrase longer than that would be truncated with
+ // an ellipsis and nothing would report it.
+ const tail = deriveProviderRowLayout(76).tail;
+ for (const billing of ["sub", "metered", "local"] as const) {
+ const text = providerCountText({ count: 0, hasDiscovery: true, billing });
+ expect({ billing, text, fits: displayWidth(text) <= tail }).toEqual({
+ billing,
+ text,
+ fits: true,
+ });
+ }
+ });
+});
+
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
@@ -196,28 +261,39 @@ describe("priceVaries — which view earns chips", () => {
describe("billingLabel / readinessGlyph", () => {
test("each billing mode has its own WORD, and ALL THREE carry a fill", () => {
const tags = (["sub", "local", "metered"] as const).map(billingLabel);
- expect(tags.map((t) => t.text)).toEqual(["SUB", "local", "$"]);
+ expect(tags.map((t) => t.text)).toEqual(["SUB", "local", "$$$"]);
// `$` USED TO BE `bg: null` — drawn as text, on the grounds that a fill on every
// row of the column is the banding defect. The owner read the shipped screen and
// asked for the opposite: "make $$$ the same width and badge as well", because a
// filled `SUB` beside a bare `$` is a column with no edges. What stops the column
- // banding is now the DISTANCE between the two fills (ΔE76 36.5, pinned in
- // `theme-contrast.test.ts`) rather than the absence of one of them.
- expect(tags.map((t) => t.bg)).toEqual([C.pillKeyBg, C.pillKeyBg, C.pillMutedBg]);
- expect(C.pillMutedBg).not.toBe(C.pillKeyBg);
- });
-
- 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.
- // Neutral is carried by the FILL — a near-background one, whose ink is the quiet
- // tier rather than the signal's.
- expect(billingLabel("metered").fg).toBe(C.pillMutedFg);
+ // banding is now the DISTANCE between the two fills (ΔE76 44.9 light / 63.4 dark,
+ // pinned in `theme-contrast.test.ts`) rather than the absence of one of them.
+ //
+ // THE LABEL IS `$$$`, WHICH IS THE OWNER'S NEXT INSTRUCTION AND NOT A TYPO FOR
+ // THE PRICE. Real prices are numerals (`$2.25`) built by `priceLabel`, and this
+ // chip is the provider's BILLING MODE. Three characters, the same as `SUB` — a
+ // coincidence the column is glad of and does not depend on, because
+ // `CHIP_FILL_CELLS` still derives from `local`.
+ expect(tags.map((t) => t.bg)).toEqual([C.pillKeyBg, C.pillKeyBg, C.pillCostBg]);
+ expect(C.pillCostBg).not.toBe(C.pillKeyBg);
+ });
+
+ test("METERED COSTS MONEY and SUB DOES NOT — but neither is a FAILURE", () => {
+ // `$$$` states that the route bills per token, in the hue that says so. What it
+ // must never become is the hue that says something BROKE: `tokens.error` is the
+ // `HTTP 401` badge and the discovery banner, and a chip wearing it would put a
+ // failure on 13 of 17 healthy rows. The register that keeps the two apart is
+ // measured in `theme-contrast.test.ts`; that they are not the literal same token
+ // is cheap to state here, and it is the check that fails first and reads clearest.
+ expect(billingLabel("metered").fg).toBe(C.pillCostFg);
+ expect(billingLabel("metered").bg).toBe(C.pillCostBg);
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);
+ expect(colour).not.toBe(C.red);
+ expect(colour).not.toBe(C.bgError);
}
}
});
@@ -240,10 +316,10 @@ describe("billingLabel / readinessGlyph", () => {
sub: billingLabel("sub").fg,
local: billingLabel("local").fg,
metered: billingLabel("metered").fg,
- }).toEqual({ mode, sub: C.pillKeyFg, local: C.pillKeyFg, metered: C.pillMutedFg });
- // The two tiers are never the same ink — that would erase the distinction the
- // quiet chip exists to make.
- expect(C.pillKeyFg).not.toBe(C.pillMutedFg);
+ }).toEqual({ mode, sub: C.pillKeyFg, local: C.pillKeyFg, metered: C.pillCostFg });
+ // The two halves never share an ink — that would erase the distinction the
+ // column exists to make.
+ expect(C.pillKeyFg).not.toBe(C.pillCostFg);
}
// And the flip actually MOVED them: a light-palette `SUB` painted in the dark
// palette's white ink is the module-level-const bug this repo has found six times.
diff --git a/packages/cli/src/picker/rows.tsx b/packages/cli/src/picker/rows.tsx
index 59e905da..13af79af 100644
--- a/packages/cli/src/picker/rows.tsx
+++ b/packages/cli/src/picker/rows.tsx
@@ -40,14 +40,14 @@
* block, the inactive one is plain muted text with no background at all.
*
* `or@` / `zengo@` subtle TEXT a routing IDENTIFIER, never a status
- * `$` QUIET chip, near-bg metered — the unremarkable default
+ * `$$$` QUIET chip, rose metered — this one costs you per token
* `FREE` / `SUB` SIGNAL chip, green no per-token charge — the SAME claim
* `local` SIGNAL chip, green 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
*
- * THE PREFIX KEEPS NO FILL AND `$` GOT ONE BACK — and the two are not the same
+ * THE PREFIX KEEPS NO FILL AND `$$$` GOT ONE — and the two are not the same
* question. A routing prefix is an IDENTIFIER: every row has one, they have no
* states, and a column with no notable member has nothing for a fill to mark. The
* billing cell is a STATUS with a closed vocabulary, and the owner's instruction
@@ -57,27 +57,31 @@
* of two fills.
*
* WHICH MEANS THE BANDING RISK IS REAL AND IS ANSWERED BY THE PAIR, NOT BY A GAP.
- * `$` and `SUB`/`local` partition the roster, so this is a fill on all 17 rows —
+ * `$$$` and `SUB`/`local` partition the roster, so this is a fill on all 17 rows —
* exactly the shape that fused into one grey band when the PREFIX was chipped. What
* failed there was that all 17 fills were the SAME colour; here they alternate, and
- * the two fills are held apart by measurement rather than by hope: ΔE76 22.7 on the
- * light palette (`#BCE5CD` vs `#E2E6F0`) and 54.6 on the dark one (`#2f8250` vs
- * `#2E323D`), where ~2.3 is a just-noticeable difference. Pinned by
+ * the two fills are held apart by measurement rather than by hope: ΔE76 44.9 on the
+ * light palette (`#BCE5CD` vs `#EDABB4`) and 63.4 on the dark one (`#2f8250` vs
+ * `#6B3B42`), where ~2.3 is a just-noticeable difference. Pinned by
* `theme-contrast.test.ts` so a future tweak that collapses them fails a test rather
- * than a screenshot. Verified on `dialog7-*` at 80x24 and 145x45, dark and light.
+ * than a screenshot. Verified on `dialog8-*` at 80x24 and 145x45, dark and light.
*
- * THE LIGHT PAIR IS THE TIGHT ONE, AND DELIBERATELY SO. Both light chips are TINTS
- * (see `theme.ts`), so they sit within 0.1 of each other in luminance and the whole
- * distinction is HUE — 22.7 ΔE, ten just-noticeable differences, but a tenth of the
- * headroom the dark pair has. That is why the banding gate matters MORE under this
- * construction than under the saturated one it replaces, not less.
+ * THE GATE IS OVER EVERY PAIR THE COLUMN CAN PAINT, NOT OVER THE TWO THAT CHANGED.
+ * `CHIP_COLUMN_LABELS` is the closed vocabulary and `billingLabel`/`priceChipBg` map
+ * it onto fills, so the test derives that map and measures every unordered pair of
+ * DISTINCT fills — which also pins the other half of the design: `FREE`, `SUB` and
+ * `local` must keep sharing ONE fill, because all three make the same claim, and a
+ * third fill appearing there would be caught as a pair that has to be 20 apart.
*
- * AND THE QUIET HALF IS QUIET BY MEASUREMENT TOO. ΔE alone would accept two equally
- * loud fills of different hue, which is what shipped: a mid-grey `#6b7280` slab at
- * 4.53:1 on a light page beside a green at 4.70:1 — the same weight, so the column
- * read as two competing claims. The gate now also pins that `$` carries less than
- * half the CHROMA of `SUB` in whichever palette is loaded — the axis that survives
- * both constructions, since on a light page the two tints barely differ in weight.
+ * THE REDDISH HALF IS QUIET BY MEASUREMENT, AND THAT IS NOW A GATE ABOUT FAILURE.
+ * The old measurement was that `$` carried less than half the CHROMA of `SUB` — the
+ * axis that said "metered is the absence of a claim". That is no longer the design:
+ * `$$$` is half of an opposition and carries a hue of its own (C* 25.9 light, 22.6
+ * dark). What replaced it is the register test against the colour reddish now has to
+ * coexist with: the cost fill stays under the QUIET CEILING off its own page while
+ * `C.red` clears 3:1, it carries under half the chroma of `C.red`, and it is ΔE76 ≥ 20
+ * from both `C.red` and `C.bgError`. Loud-versus-quiet is still the axis; the thing it
+ * is measured against moved from `SUB` to the error.
*
* ONE FILL WIDTH FOR THE WHOLE COLUMN, WHICH IS THE ONE PLACE PADDING GOES INSIDE A
* FILL. `aesthetics-and-color.md` forbids padding inside the label because 24 `UP`
@@ -87,15 +91,23 @@
* print (`local`, 5, + 2) and every chip paints exactly that, label centred inside —
* a hardcoded 5 would have clipped `local` and `FREE` by the two cells Yoga then
* steals from a neighbouring cell. Both columns that print these tokens use the same
- * number, so `$`, `SUB`, `FREE` and `local` line up in the provider list and in the
- * model list alike.
+ * number, so `$$$`, `SUB`, `FREE` and `local` line up in the provider list and in the
+ * model list alike. `$$$` happens to be three cells, the same as `SUB` — which is what
+ * the owner's earlier "same width" instruction asked for and this one delivers for
+ * free — but the width is still DERIVED, because the coincidence is not a rule.
*
- * `SUB` WAS `tokens.warn` UNTIL THIS PASS, AND THAT WAS A ONE-COLOUR-ONE-MEANING
+ * `SUB` WAS `tokens.warn` UNTIL A PASS AGO, 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.
+ * already pays for, free at the point of use.
+ *
+ * RED NOW MEANS TWO THINGS HERE AND THAT IS DELIBERATE, WHICH IS NOT THE SAME AS
+ * UNPRINCIPLED. Failure is SATURATED red — the `HTTP 4xx` badge, the discovery
+ * banner's border and wash. Cost is a QUIET rose TINT. Rule 1 forbids one COLOUR
+ * carrying two meanings; these are two registers of a hue, measured apart and pinned
+ * apart, and the reason it is worth spending is that "costs money" has no other
+ * natural colour — the alternative was the near-neutral nobody read as a claim.
*
* 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
@@ -144,7 +156,7 @@ export type Readiness = "pending" | "ready" | "missing";
* cell. The list is the vocabulary, not a sample of it: `billingLabel` and
* `priceChipBg` between them answer exactly these four words and nothing else.
*/
-export const CHIP_COLUMN_LABELS = ["$", "SUB", "FREE", "local"] as const;
+export const CHIP_COLUMN_LABELS = ["$$$", "SUB", "FREE", "local"] as const;
/**
* The fill EVERY chip in a status column paints, in cells.
@@ -240,23 +252,86 @@ export function readinessGlyph(r: Readiness): { glyph: string; fg: string } {
* `$` used to be drawn as muted text on the grounds that a fill on every row of the
* column is the banding defect; what the owner saw on the shipped screen was the
* other half of that trade — a 5-cell green chip beside a 1-cell word, so the column
- * had no edges. Two fills 55–67 ΔE apart alternate visibly, which a single fill on
+ * had no edges. Two fills 45–63 ΔE apart alternate visibly, which a single fill on
* every row could not.
*
- * THE TWO FILLS ARE NOT TWO SHADES OF ONE IDEA. `SUB`/`local` is a SIGNAL — it
- * separates hard from the page. `$` is a NEAR-BACKGROUND fill, a measured shade off
- * the page carrying body ink, because metered is what a route IS by default rather
- * than a caution about it and the number that matters is on the model row. That is
- * why each fill states its own ink: `C.pillKeyFg` on the signal, `C.pillMutedFg` on
- * the quiet one. On DARK that is white on a saturated green; on LIGHT it is deep
- * green on a pale green TINT, which is the inverted construction a white page needs.
- * All four are read at RENDER time — a module-level `const` now ships not just the
- * wrong hex but the wrong recipe to the other theme.
+ * `$$$`, NOT `$`, AND THE TWO FILLS ARE NOW A SEMANTIC PAIR. The owner's instruction:
+ * *"instead of $ it should be '$$$' with light reddish colour"*. It is three cells
+ * like `SUB`, so the two labels are the same width by construction rather than by
+ * padding — but `CHIP_FILL_CELLS` still derives from the longest label the column can
+ * print (`local`), because the coincidence is not a rule.
+ *
+ * The colour is the substantive half. `$` was a near-neutral because metered was
+ * framed as the UNREMARKABLE default; paired with a green `SUB` that made the column
+ * "a claim and the absence of one". It now reads as one opposition — GREEN is free at
+ * the point of use, REDDISH costs you per token — and a near-neutral cannot carry
+ * half of an opposition. Each fill still states its own ink (`C.pillKeyFg`,
+ * `C.pillCostFg`): on DARK, saturated/near-bg fills with light ink; on LIGHT, pale
+ * TINTS with deep ink of their own hue, which is the inverted construction a white
+ * page needs. All four are read at RENDER time — a module-level `const` ships not just
+ * the wrong hex but the wrong recipe to the other theme.
+ *
+ * REDDISH IS THE HUE FAILURE ALREADY OWNS, AND THAT IS SETTLED BY REGISTER, NOT BY
+ * AVOIDANCE. The `HTTP 401` badge and the discovery banner are SATURATED red with
+ * light ink; the cost chip is a QUIET tint with deep ink, held under a 3:1 ceiling off
+ * its own page. `theme-contrast.test.ts` pins ΔE76 ≥ 20 between the cost fill and BOTH
+ * failure fills (`C.red` and the banner's `C.bgError` wash), per palette — the same
+ * instrument and the same floor as the banding gate. Measured: 65.4 / 22.4 on light
+ * and 73.7 / 20.8 on dark. If a future tweak moves them together it is the COST tint
+ * that gives way; the error colour is the one that must not move.
+ *
+ * `$$$` IS THE CHIP AND NOTHING ELSE. The price column prints real numbers (`$2.25`,
+ * `$30.00`) and its header prints the unit (`$/1M`); the detail line says
+ * `metered — billed per token`. Those are values and words, not this token, and none
+ * of them became `$$$`.
*/
export function billingLabel(mode: BillingMode): { text: string; fg: string; bg: string } {
if (mode === "sub") return { text: "SUB", fg: C.pillKeyFg, bg: C.pillKeyBg };
if (mode === "local") return { text: "local", fg: C.pillKeyFg, bg: C.pillKeyBg };
- return { text: "$", fg: C.pillMutedFg, bg: C.pillMutedBg };
+ return { text: "$$$", fg: C.pillCostFg, bg: C.pillCostBg };
+}
+
+/**
+ * What a provider row says in its tail when it is not saying why it is unavailable.
+ *
+ * `null` PRINTS NOTHING — not `0`, not `—`, not a guess. See `ProviderRowProps.count`.
+ *
+ * `0 models` IS A DIFFERENT CLAIM FOR A DISCOVERY PROVIDER, and printing it there
+ * would be the original defect in miniature: Devin and Antigravity carry no catalog
+ * entries by design and ask their own endpoint the moment you scope to them, so
+ * "0 models" reads as "this provider has nothing" about a provider nothing has asked.
+ *
+ * AND IT SAYS WHAT THE USER GETS, NOT HOW CLAUDISH FETCHES IT. The words were
+ * `asks its own roster`, which the owner read on a live run and rejected. "Roster" is
+ * this codebase's word for a provider's model list and appears nowhere else in the
+ * UI, so the row described an implementation detail of the thing the reader was
+ * trying to choose between. His replacement, verbatim: *"subscription models"*.
+ *
+ * TWO PHRASINGS, BECAUSE ONE WOULD BE FALSE FOR HALF THE SET. Every provider that
+ * reaches this branch today is flat-rate — Devin, Antigravity, OpenCode Zen Go — and
+ * for those "subscription models" is exactly right: what you get is the model list
+ * your plan includes. But `hasDiscovery` is a property of the PROVIDER DEFINITION and
+ * not of its billing, so a metered or local provider with no catalog entries lands
+ * here too (a self-hosted vLLM, an Ollama daemon), and telling that user he has a
+ * subscription would be a lie the screen states as fact. So the billing mode picks the
+ * words, and the other phrasing names the provider's OWN list — which is the real
+ * distinction, since every counted row on this screen is counted from the shared
+ * catalog.
+ *
+ * Pure and exported so the wording is asserted directly. The state that produces it
+ * needs a warm catalog, a scoped visit and an empty count, which is three awaits away
+ * from a screenshot.
+ */
+export function providerCountText(row: {
+ count: number | null;
+ hasDiscovery: boolean;
+ billing: BillingMode;
+}): string {
+ if (row.count === null) return "";
+ if (row.count === 0 && row.hasDiscovery) {
+ return row.billing === "sub" ? "subscription models" : "lists its own models";
+ }
+ return `${row.count} model${row.count === 1 ? "" : "s"}`;
}
const SPACES = " ";
@@ -271,8 +346,8 @@ const gap = (n: number): string => SPACES.slice(0, Math.max(0, n));
* plain, unfilled space, emitted before the chip when the cell right-aligns
* (`badgePad` can only pad after it) and by `badgePad` when it left-aligns.
* This is the skill's rule and it is kept.
- * · the LABEL's surplus — `local` is 5 cells and `$` is 1 — is centred INSIDE the
- * fill, which is the sanctioned exception (file header). It is what makes one
+ * · the LABEL's surplus — `local` is 5 cells and `SUB`/`$$$` are 3 — is centred INSIDE
+ * the fill, which is the sanctioned exception (file header). It is what makes one
* straight-edged column out of four labels of different lengths, and a column is
* not the row of 24 identical chips the rule was measured on.
*
@@ -486,18 +561,10 @@ export function ProviderRow({
const { glyph, fg } = readinessGlyph(readiness);
const bill = billingLabel(billing);
const L = deriveProviderRowLayout(inner);
- // `0 models` IS A DIFFERENT CLAIM FOR A DISCOVERY PROVIDER, and printing it there
- // would be the original defect in miniature: Devin and Antigravity carry no catalog
- // entries by design and ask their own endpoint for a roster the moment you scope to
- // them, so "0 models" reads as "this provider has nothing" about a provider that
- // has not been asked yet.
- const countText =
- count === null
- ? ""
- : count === 0 && hasDiscovery
- ? "asks its own roster"
- : `${count} model${count === 1 ? "" : "s"}`;
- const tail = readiness === "missing" && note !== "" ? note : countText;
+ const tail =
+ readiness === "missing" && note !== ""
+ ? note
+ : providerCountText({ count, hasDiscovery, billing });
return (
<box height={1} flexShrink={0} backgroundColor={cursor ? C.bgHighlight : undefined}>
<text attributes={A.boldIf(cursor)}>
@@ -514,8 +581,8 @@ export function ProviderRow({
{/* BOTH STATES ARE CHIPS AND BOTH ARE `CHIP_FILL_CELLS` WIDE — the owner's
"make $$$ the same width and badge as well". What keeps the column from
reading as one band is the distance between the two fills, not a gap, and
- what keeps `$` from competing with `SUB` is that only one of them is a
- signal: `theme-contrast.test.ts` pins both. */}
+ what keeps `$$$` from being read as an ERROR is that only one of the two
+ reds is saturated: `theme-contrast.test.ts` pins both. */}
<ChipCell label={bill.text} bg={bill.bg} fg={bill.fg} width={L.billing} />
<span fg={readiness === "missing" ? tokens.dead : tokens.subtle}>
{padStartTo(truncate(tail, L.tail), L.tail)}
diff --git a/packages/cli/src/tui/theme-contrast.test.ts b/packages/cli/src/tui/theme-contrast.test.ts
index ca695ccf..a49ed77b 100644
--- a/packages/cli/src/tui/theme-contrast.test.ts
+++ b/packages/cli/src/tui/theme-contrast.test.ts
@@ -224,7 +224,10 @@ describe("chip gates: fill, ink, role and construction", () => {
*/
const CHIPS = [
{ what: "status SUB/FREE/local", bg: "pillKeyBg", fg: "pillKeyFg", role: "signal" },
- { what: "status $", bg: "pillMutedBg", fg: "pillMutedFg", role: "quiet" },
+ // `$$$` is a SIGNAL in meaning and a QUIET fill in register, and it is listed as
+ // quiet on purpose: the ceiling is the half of its contract that matters, because
+ // the hue it carries is the one failure already owns.
+ { what: "status $$$", bg: "pillCostBg", fg: "pillCostFg", role: "quiet" },
{ what: "keycap KEY segment", bg: "keycapKeyBg", fg: "keycapKeyFg", role: "quiet" },
{ what: "keycap LABEL segment", bg: "keycapLabelBg", fg: "keycapLabelFg", role: "quiet" },
] as const satisfies ReadonlyArray<{
@@ -357,30 +360,79 @@ describe("chip gates: fill, ink, role and construction", () => {
}
});
- it("HOLDS THE TWO HALVES OF THE STATUS COLUMN APART — the banding gate", () => {
- // The picker's billing column carries a fill on EVERY row: `SUB`/`local` on
- // `pillKeyBg`, `$` on `pillMutedBg`. That is the shape that fused into one solid
+ it("HOLDS EVERY PAIR OF STATUS-COLUMN FILLS APART — the banding gate", () => {
+ // The picker's billing column carries a fill on EVERY row: `SUB`/`FREE`/`local` on
+ // `pillKeyBg`, `$$$` on `pillCostBg`. That is the shape that fused into one solid
// vertical band when the prefix column was chipped — and what failed there was
// that all 17 fills were the SAME colour. Here they alternate, so the whole
- // design rests on these two being visibly different fills.
+ // design rests on the fills being visibly different.
//
- // THIS GATE MATTERS MORE UNDER THE TINTED CONSTRUCTION, NOT LESS. Two saturated
- // fills were 54.6 ΔE apart on the dark palette; two TINTS sit within 0.1 of each
- // other in luminance and are 22.7 apart, all of it hue. Ten just-noticeable
- // differences is plenty to read, and a tenth of the headroom — so the floor stays
- // at 20 and it is now a floor the light palette is genuinely near.
+ // THE COLUMN HAS FOUR LABELS AND TWO FILLS, SO EVERY PAIR IS MEASURED HERE IN
+ // TWO HALVES. `$$$` / `SUB` / `FREE` / `local` is the closed vocabulary
+ // (`CHIP_COLUMN_LABELS`); WHICH fill each word takes is pinned in
+ // `row-semantics.test.ts`, where the functions that decide it live —
+ // `FREE`, `SUB` and `local` share `pillKeyBg` because all three make the same
+ // claim, and only `$$$` takes `pillCostBg`. That leaves exactly one pair of
+ // DISTINCT fills, and this is it. A third fill appearing in that column without
+ // arriving here is the regression the two tests jointly catch: the mapping test
+ // would fail on the label, this one on the distance.
+ const COLUMN_FILLS = ["pillKeyBg", "pillCostBg"] as const;
for (const mode of ["light", "dark"] as const) {
setThemeMode(mode);
+ for (let i = 0; i < COLUMN_FILLS.length; i++) {
+ for (let j = i + 1; j < COLUMN_FILLS.length; j++) {
+ const pair = `${COLUMN_FILLS[i]} vs ${COLUMN_FILLS[j]}`;
+ const [a, b] = [C[COLUMN_FILLS[i]!], C[COLUMN_FILLS[j]!]];
+ expect({ mode, pair, distinct: a !== b, apart: deltaE76(a, b) >= 20 }).toEqual({
+ mode,
+ pair,
+ distinct: true,
+ apart: true,
+ });
+ }
+ }
+ }
+ });
+
+ it("KEEPS THE COST CHIP OUT OF THE FAILURE REGISTER — the cost-vs-error gate", () => {
+ // THE CONSTRAINT THIS FEATURE WAS ALLOWED UNDER. Red was reserved for FAILURE
+ // here — the `HTTP 401` badge fill, the discovery banner's border and its wash —
+ // and `$$$` introduces a second reddish meaning. That is admissible only while the
+ // two cannot be mistaken for each other, because if they can, the error panel
+ // stops reading as an error, which is a worse defect than the one being fixed.
+ //
+ // IT IS RESOLVED BY REGISTER AND MEASURED IN FOUR WAYS. Distance (ΔE76, the same
+ // instrument and the same floor as the banding gate above, against BOTH failure
+ // fills); loudness (the cost fill carries under half the chroma of the alarm hue);
+ // and separation (failure separates HARDER from the page than cost does, which is
+ // what "saturated versus tint" means in a number).
+ //
+ // IF A FUTURE PASS BRINGS THESE TOGETHER, THE COST TINT IS THE ONE THAT MOVES.
+ // The error colour is load-bearing for a state the user cannot afford to misread.
+ for (const mode of ["light", "dark"] as const) {
+ setThemeMode(mode);
+ const page = REFERENCE_FOR_MODE[mode];
+ for (const [what, failure] of [
+ ["badge fill / banner border", C.red],
+ ["banner wash", C.bgError],
+ ] as const) {
+ expect({
+ mode,
+ what,
+ apart: deltaE76(C.pillCostBg, failure) >= 20,
+ }).toEqual({ mode, what, apart: true });
+ }
expect({
mode,
- distinct: C.pillKeyBg !== C.pillMutedBg,
- deltaE: deltaE76(C.pillKeyBg, C.pillMutedBg) >= 20,
- // And the METERED one is the QUIET one: a near-neutral beside a green. CHROMA
- // is the axis that survives BOTH constructions — on a light page the two
- // tints barely differ in weight, so a luminance test would say nothing. If
- // this inverts, the column says the default state is the notable one.
- quieter: chroma(C.pillMutedBg) < chroma(C.pillKeyBg) / 2,
- }).toEqual({ mode, distinct: true, deltaE: true, quieter: true });
+ // A TINT, not the alarm hue at a different lightness.
+ quieterHue: chroma(C.pillCostBg) < chroma(C.red) / 2,
+ // The failure fill is the one that separates hard. `C.red` clears 3:1 on its
+ // own page (pinned above); the cost fill is under the quiet CEILING. Stating
+ // the comparison directly is what survives a future re-tune of either.
+ failureSeparatesHarder:
+ contrastRatio(C.red, page) > contrastRatio(C.pillCostBg, page) &&
+ contrastRatio(C.pillCostBg, page) <= QUIET_CEILING,
+ }).toEqual({ mode, quieterHue: true, failureSeparatesHarder: true });
}
});
diff --git a/packages/cli/src/tui/theme.ts b/packages/cli/src/tui/theme.ts
index 3c5b6ee4..c9ee1f80 100644
--- a/packages/cli/src/tui/theme.ts
+++ b/packages/cli/src/tui/theme.ts
@@ -60,7 +60,7 @@ export interface TuiPalette {
tabActiveFg: string;
tabInactiveFg: string;
/**
- * The SIGNAL half of the picker's status column — `SUB` / `FREE` / `local`.
+ * The FREE half of the picker's status column — `SUB` / `FREE` / `local`.
*
* ITS CONSTRUCTION DIFFERS BY PALETTE, WHICH IS THE WHOLE POINT OF THE PAIR. On
* DARK it is a saturated fill with light ink; on LIGHT it is a pale TINT of the
@@ -71,17 +71,33 @@ export interface TuiPalette {
pillKeyFg: string;
pillOauthBg: string;
/**
- * The QUIET half of the same column — the picker's metered `$`.
+ * The COST half of the same column — the picker's metered `$$$`.
*
- * A second fill exists because a status column with one fill and one bare word is
- * a ragged column, and the owner asked for both states chipped at one width. `$`
- * is the UNREMARKABLE state, so its chip is a NEAR-BACKGROUND fill — a measured
- * shade off the page carrying body ink — and it holds almost no hue, which is what
- * makes the green beside it read as the claim.
+ * IT IS A SEMANTIC PAIR WITH `pillKey*`, NOT A LOUD ONE AND A QUIET ONE. It was
+ * a near-neutral slate while its label was a bare `$`; the owner's instruction —
+ * *"instead of $ it should be '$$$' with light reddish colour"* — makes the two
+ * halves of the column read as one opposition: GREEN is free at the point of use,
+ * REDDISH costs you per token. A near-neutral cannot carry half of that.
+ *
+ * AND REDDISH IS THE HUE FAILURE ALREADY OWNS, WHICH IS THE CONSTRAINT THIS TOKEN
+ * IS DEFINED AGAINST. `C.red` is the `HTTP 401` badge fill and the discovery
+ * banner's border; `C.bgError` is that banner's wash. A second red MEANING is
+ * admissible only if the two cannot be mistaken for each other, so the two are
+ * separated by REGISTER and the register is measured: this is a QUIET TINT (a
+ * ceiling, not just a floor, on how far it may sit off its own page) carrying deep
+ * ink, and failure stays a SATURATED fill carrying light ink. `theme-contrast.test.ts`
+ * pins ΔE76 ≥ 20 from BOTH failure fills, per palette — the same instrument and the
+ * same number as the banding gate between this and `pillKeyBg`.
+ *
+ * The hue is warm rose in both palettes (CIELAB hue 11°/13°), which is where the
+ * error's own red is NOT: `C.bgError` is a pale warm red on light and a dark warm
+ * red on dark, so the cost tint buys its distance in LIGHTNESS while staying red
+ * rather than sliding into magenta — the first sweep's answer, and a pink chip is
+ * not what was asked for.
*/
- pillMutedBg: string;
- /** Ink on `pillMutedBg`. Dark on the light page, light on the dark one. */
- pillMutedFg: string;
+ pillCostBg: string;
+ /** Ink on `pillCostBg`. Deep rose on the light page, pale rose on the dark one. */
+ pillCostFg: string;
/**
* The picker footer's KEYCAP PILL — two abutting segments, not one block.
*
@@ -183,11 +199,17 @@ const DARK: TuiPalette = {
// against black and as glare against white".
//
// Within a palette there are then two ROLES. SIGNAL (`pillKeyBg`, `pillOauthBg`,
- // `tabActiveBg`) marks the notable member of a column. QUIET (`pillMutedBg`, both
- // keycap segments) is the unremarkable state and the keyboard affordance: a
- // NEAR-BACKGROUND fill, a measured shade off the page, carrying body ink — which
- // is why `retintSurfaces` treats those as surfaces rather than as accents. Which
- // way "off the page" points is itself per-palette: up on black, down on white.
+ // `tabActiveBg`) marks the notable member of a column. QUIET (both keycap segments)
+ // is the keyboard affordance: a NEAR-BACKGROUND fill, a measured shade off the page,
+ // carrying body ink — which is why `retintSurfaces` treats those as surfaces rather
+ // than as accents. Which way "off the page" points is itself per-palette: up on
+ // black, down on white.
+ //
+ // `pillCostBg` IS THE ONE FILL THAT SITS IN BOTH ROLES AND IS GATED AS SUCH. It is a
+ // SIGNAL in meaning — half of the free/costs-money opposition, so it carries a hue
+ // and is not re-tinted with the surfaces — and QUIET in register, held under the
+ // 3:1 ceiling, because the hue it carries is the one failure already owns and the
+ // saturated end of it is spoken for.
//
// `pillKeyBg` — the BRIGHTER sibling, now that it no longer has to survive a cream
// page as well. `#3f7752` was the both-pages compromise: 3.22:1 on near-black,
@@ -199,12 +221,22 @@ const DARK: TuiPalette = {
pillKeyBg: "#2f8250", // forest green, dark-page sibling
pillKeyFg: "#ffffff", // 4.74:1 on the fill
pillOauthBg: "#0e7490", // muted teal; white ink 5.02:1
- // NEAR-BG DARK (madbench `paramValBg`). 1.64:1 off true black and 1.47:1 off the
- // `bgAlt` panel — present as a block, absent as a claim. Its ink is a DIM one, not
- // white: `$` is what a route is by default and the number that matters is on the
- // model row. ΔE76 54.6 from `pillKeyBg`, so the alternating column cannot band.
- pillMutedBg: "#2E323D",
- pillMutedFg: "#A8B0C4", // 5.90:1 on the fill — legible, not loud
+ // THE COST CHIP — a muted brick rose, the dark-page sibling of the light palette's
+ // dusty one. It replaces the near-neutral `#2E323D`/`#A8B0C4` slate this token held
+ // while its label was a bare `$`.
+ //
+ // Every number measured with `validation/cost-chip-finalists.ts`: 1.89:1 off this
+ // page and 2.09:1 off the `bgAlt` panel — under the 3:1 QUIET CEILING, so it is a
+ // tint and not an alarm — C* 22.6 at CIELAB hue 13°, ΔE76 63.4 from `pillKeyBg`
+ // (the column cannot band), 73.7 from `C.red` and 20.8 from `C.bgError` (it cannot
+ // be read as the failure panel). Its ink is the pale rose that pairs with it, at
+ // 5.07:1 on the fill.
+ //
+ // madbench's literal `diffDelBg` (`#2E1216`) was measured FIRST and rejected: at
+ // ΔE76 9.7 from `C.bgError` it is very nearly the failure wash, which is exactly the
+ // collision this token exists to avoid.
+ pillCostBg: "#6B3B42",
+ pillCostFg: "#F0B2BC", // 5.07:1 on the fill
// THE KEYCAP PILL — two abutting near-bg segments, key brighter than label.
// It replaces a single saturated purple block (`#9333ea`, 3.90:1 off this page and
// 5.38:1 off the light one), which made the quietest row on the screen the loudest.
@@ -287,13 +319,19 @@ const LIGHT: TuiPalette = {
// column, not this dialog, and it has not been through the owner's review. Noted so
// the inconsistency is a decision rather than an oversight.
pillOauthBg: "#0e7490", // deep teal, 5.13:1 on the cream reference
- // QUIET — madbench's `paramKeyBg`, "near-bg light — still distinct on a cream or
- // grey page", with `slate` ink at 6.12:1. It carries almost no hue (C* 5.4 against
- // the green tint's 19.4), which is what makes `$` read as the absence of a claim.
- // This REPLACES `#6b7280`, a mid-grey slab at 4.53:1 on a light page — as heavy as
- // the `SUB` chip it was supposed to recede behind.
- pillMutedBg: "#E2E6F0",
- pillMutedFg: "#4E5364", // madbench `slate`; 6.12:1 on the fill
+ // COST — a dusty rose tint with Tailwind rose-900 ink, built to the same recipe as
+ // the green above it: the field only has to be perceptible, the INK is what is held
+ // to text grade. 1.77:1 off the cream reference and 1.72:1 off the `bgAlt` panel,
+ // under the 3:1 QUIET CEILING; C* 25.9 at CIELAB hue 11°; ink 5.05:1 on the fill.
+ //
+ // IT IS 22.4 ΔE76 FROM `bgError` AND 65.4 FROM `red`, AND THAT IS WHAT CHOSE IT.
+ // madbench's `diffDelBg` (`#F8D2D5`) is the natural literal — it sits opposite the
+ // `diffAddBg` family the green came from — and it measured 6.3 ΔE76 from the failure
+ // banner's `#fee2e2` wash: the same colour, to a reader. Two steps deeper in
+ // LIGHTNESS clears 20 without leaving the red arc, which is what keeps this a dusty
+ // ROSE rather than the bubblegum pink the first (hue-free) sweep answered with.
+ pillCostBg: "#EDABB4",
+ pillCostFg: "#881337", // Tailwind rose-900 — the deep sibling of the tint's own hue
// THE KEYCAP PILL — two abutting near-bg segments, key brighter than label.
// 1.79:1 and 1.25:1 off the page with 1.46:1 between them, against the single
// purple block's 5.38:1. The floor is the `#d1d5db` this file already measured as
@@ -518,18 +556,24 @@ export function registerPaletteRefresher(fn: () => void): void {
* from the page. When the page moves, these must move with it or the seam the
* page adoption removed simply reappears one box further in.
*
- * THE QUIET CHIP FILLS BELONG HERE, and that follows from what they now are. A
+ * THE KEYCAP SEGMENTS BELONG HERE, and that follows from what they are. A
* near-background fill IS a surface — its whole content is "a measured shade off the
- * page" — so on a cream terminal `pillMutedBg` and both keycap segments must become
- * deeper cream, exactly as `bgAlt` does, or a blue-grey `$` chip floats on cream and
- * the seam this function exists to remove reappears inside the status column. They
- * only joined the list when they stopped being saturated blocks.
+ * page" — so on a cream terminal both keycap segments must become deeper cream,
+ * exactly as `bgAlt` does, or a blue-grey keycap floats on cream and the seam this
+ * function exists to remove reappears inside the footer. They only joined the list
+ * when they stopped being saturated blocks.
+ *
+ * `pillCostBg` LEFT THIS LIST WHEN ITS LABEL BECAME `$$$`. It was a near-neutral
+ * slate and so was a surface; it is now a rose TINT whose whole content is its hue —
+ * the half of the column that says "this costs money" — and re-tinting it toward a
+ * cream page would drain exactly the signal it was just given. It moves for the same
+ * reason `pillKeyBg` never joined.
*
* Deliberately excluded: `bgHighlight` (blue selection wash) and `bgError` (red
- * failure wash) carry their meaning in their HUE, and so do `tabActiveBg` and the
- * SIGNAL pills (`pillKeyBg`, `pillOauthBg`) — including the light palette's pale
- * GREEN TINT, which is a tint OF a hue and not a neutral. Re-tinting those would
- * erase the signal they exist to send.
+ * failure wash) carry their meaning in their HUE, and so do `tabActiveBg` and both
+ * status pills (`pillKeyBg`, `pillCostBg`, `pillOauthBg`) — including the light
+ * palette's pale GREEN and ROSE TINTS, which are tints OF a hue and not neutrals.
+ * Re-tinting those would erase the signal they exist to send.
*/
const SURFACE_TOKENS = [
"bgAlt",
@@ -537,7 +581,6 @@ const SURFACE_TOKENS = [
"tabInactiveBg",
"chipKeyBg",
"chipLabelBg",
- "pillMutedBg",
"keycapKeyBg",
"keycapLabelBg",
] as const;