context: the head's agent icon is 14px again, not the agent cards' 20px

The owner: Pi's icon in the context window's head was oversized. context.css
had two unscoped `.ctx-who` rules. The later one, for the Context tab's agent
cards (20px icon, 8px gap, display flex), overrode the head's 14px one by
source order. The card rules are now scoped to `.ctx-who-box`, where both
card renderers put their `.ctx-who`.

Run on mote, both engines, every language: ctx-route (52), context-window
(24), context-scripts (22), routing-ctx-fold (6), routing-context-fold (24),
routing-live-patch (10), all pass. These are every GUI file that renders
.ctx-who.
Broken by hand: with the old context.css, ctx-route's new width check fails
with "the agent icon is 14px wide (20)".
Not run: the rest of the GUI suite. Nothing outside context.js uses .ctx-who.
This commit is contained in:
yetone
2026-11-01 18:27:29 +08:00
parent d7b42fcf23
commit 34f51bbbca
2 changed files with 7 additions and 5 deletions
+3 -3
View File
@@ -167,9 +167,9 @@ i.dot.free { background: var(--k-free); box-shadow: inset 0 0 0 1px color-mix(in
.ctx-agent, .ctx-tune { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 12px; min-width: 0; font-variant-numeric: tabular-nums; }
.ctx-agent-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ctx-who-box { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ctx-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ctx-who .ic { width: 20px; height: 20px; flex: none; }
.ctx-who b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-who-box .ctx-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ctx-who-box .ctx-who .ic { width: 20px; height: 20px; flex: none; }
.ctx-who-box .ctx-who b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-who-sub { font-size: 11px; color: var(--muted); }
.ctx-grade { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; }
.ctx-grade-word { font-size: 10.5px; font-weight: 600; }
+4 -2
View File
@@ -3,7 +3,7 @@
// model it went to (the owner): the agent's icon and name, then the model's
// lab icon before its id. A model from a lab magpie doesn't know gets no
// icon, so a wrong logo never stands for it. In a narrow card the agent's
// name and the › go first and its icon stays; folded, the route is still in
// name and the › go first and its icon stays, at the head's 14px; folded, the route is still in
// the head. Nothing in the head runs past the card. Every GUI language,
// Chromium and WebKit.
const assert = require("node:assert/strict");
@@ -62,7 +62,7 @@ const look = (page) => page.evaluate(() => {
const past = [...head.querySelectorAll("*")].filter((e) => shown(e) && getComputedStyle(e).overflow !== "hidden" && e.getBoundingClientRect().right > hr.right + 0.5).map((e) => e.className);
return {
name: q(".ctx-who-n")?.textContent, nameShown: shown(q(".ctx-who-n")), sepShown: shown(q(".ctx-sep")),
agentIcon: q(".ctx-who .ic")?.dataset.icon, agentIconShown: shown(q(".ctx-who .ic")),
agentIcon: q(".ctx-who .ic")?.dataset.icon, agentIconShown: shown(q(".ctx-who .ic")), agentIconW: q(".ctx-who .ic")?.getBoundingClientRect().width,
labIcons: [...head.querySelectorAll(".ctx-what .ic")].map((e) => e.dataset.icon), model: q(".ctx-model")?.textContent, modelShown: shown(q(".ctx-model")),
routeShown: shown(q(".ctx-route")), stateShown: shown(q(".ctx-state")),
inCard: hr.right <= cr.right + 0.5, past, headH: hr.height,
@@ -100,6 +100,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal(lab$.name, "Claude Code");
assert.ok(lab$.nameShown && lab$.sepShown, "a wide card names the agent before the ›");
assert.equal(lab$.agentIcon, "claudecode-color");
// the head's 14px, not the Context tab's 20px agent cards (the owner: Pi's icon was oversized)
assert.ok(Math.abs(lab$.agentIconW - 14) < 0.5, `the agent icon is 14px wide (${lab$.agentIconW})`);
assert.deepEqual(lab$.labIcons, lab ? [lab] : [], "the model's lab icon, none when the lab isn't known");
assert.equal(lab$.model, model);
assert.ok(lab$.modelShown && lab$.stateShown && lab$.inCard, JSON.stringify(lab$));