Owner round 4 (2026-10-05):
- THE RAIL IS THE MISSING CHARACTER: rail + padding = exactly 1ch of
the mono heading font. 'YOUR THINKING' (13ch) + rail == 'AGENT
THINKING' (14ch) flush — the chevrons line up vertically, no fixed
columns. The YOU heading joins the rail (label inside, like the
thinking rows) — one quote geometry everywhere.
- HEADING REGISTER: YOUR THINKING / AGENT THINKING / YOU all use the
card eyebrows' small mono caps (text-xs = the 11px rung, font-medium
uppercase tracking-wide) — the app chrome is JetBrains Mono.
- SUBMIT THINKING: the practice button is now literally the question
dock's Button (h-9, px-3.5) in one p-1 row with the hint left
('↵ submits · ⇧↵ newline') — the keyboard hints are back. Corner
radii concentric in both docks: shell 16 − 6 = field 10 − 4 = button 6
(rounded-[10px] fields, rounded-[6px] buttons — the old rounded-xl/12
was the 'too large' culprit).
- MODEL NAMES: prettyModel no longer auto-capitalizes — names render
exactly as their providers write them ('glm 5.3 flash').
- Quiz explanations pulled closer (mt-3 → mt-2).
46 lines
2.0 KiB
TypeScript
46 lines
2.0 KiB
TypeScript
/**
|
|
* Money/token presentation helpers (wave-4 observability UI) — shared by the
|
|
* activity dock and the stats bar. Pure; exported for tests.
|
|
*/
|
|
|
|
/** USD for cent-scale money: >= $1 keeps two decimals, smaller keeps four. */
|
|
export function formatUsd(c: number): string {
|
|
return c >= 1 ? `$${c.toFixed(2)}` : `$${c.toFixed(4)}`;
|
|
}
|
|
|
|
/** 38000 → "38k", 1234567 → "1.2M" — trimmed, never "38.0k". */
|
|
export function formatTokens(n: number): string {
|
|
if (n >= 1e6) return `${+(n / 1e6).toFixed(1)}M`;
|
|
if (n >= 1e3) return `${+(n / 1e3).toFixed(1)}k`;
|
|
return String(n);
|
|
}
|
|
|
|
/** Split a provider-qualified stamp "provider:id" (the usage contracts'
|
|
* qualification, model-slots wave 2026-09-20) into its two coordinates.
|
|
* No colon = no provider qualification (a bare catalog id). */
|
|
export function splitQualified(id: string): { provider: string | null; id: string } {
|
|
const colon = id.indexOf(":");
|
|
if (colon === -1) return { provider: null, id };
|
|
return { provider: id.slice(0, colon), id: id.slice(colon + 1) };
|
|
}
|
|
|
|
/**
|
|
* "z-ai/glm-5.3-flash" → "Glm 5.3 Flash" — vendor prefix dropped, dashes to
|
|
* spaces, capitalized; a trailing all-digit segment (OpenRouter's date
|
|
* suffix, "qwen3.8-max-0902") is dropped. Quiet-chip friendly.
|
|
*
|
|
* With `qualified` (usage stamps are "provider:id", model-slots wave):
|
|
* the provider rides as a quiet suffix — "Glm 5.3 Flash · openrouter" —
|
|
* because with federation the same model via two providers is genuinely
|
|
* different bookkeeping. Bare catalog ids are unchanged.
|
|
*/
|
|
export function prettyModel(id: string, qualified = false): string {
|
|
const { provider, id: bare } = splitQualified(id);
|
|
const short = bare.includes("/") ? bare.slice(bare.lastIndexOf("/") + 1) : bare;
|
|
const parts = short.split("-");
|
|
const trimmed = /^\d+$/.test(parts[parts.length - 1] ?? "") ? parts.slice(0, -1) : parts;
|
|
// No auto-capitalization (owner round 4, 2026-10-05): model names
|
|
// render exactly as their providers write them.
|
|
const pretty = trimmed.join(" ");
|
|
return qualified && provider ? `${pretty} · ${provider}` : pretty;
|
|
} |