From dc6f3d496c7812ef2bbbda7c9dbe63409a3c5a2d Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 25 Oct 2026 19:14:43 +0800 Subject: [PATCH] masking: the flow's logos sit on one disc each, before the name on both sides MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Insights › Masking's flow card showed each agent's and provider's logo bare in a 16px box. A logo's own drawing fills that box or not (Pi's edge to edge, Codex's a small tile, Alma's a picture), so three logos of one box read as three sizes (the owner's screenshot). And an agent's logo came after its right-aligned name, so the logos and the names on that side lined up with nothing. - Every logo sits 14px on a 24px disc (card fill, hairline ring), the disc the app's agent stacks use. - Both sides read logo, then name over count, left-aligned. The agents' nodes are one block against the lines (a grid track as wide as the widest), so their logos make one column and their names one edge, as the providers' do. Run (rebased on origin/main of 19:00, 10-25): - masking-records.test.cjs: 52/52, Chromium and WebKit, 5 languages, 1100px and 640px. Its flow check now asserts logo before name on both sides, a 24px round disc for every logo, and one column of logos and one edge of names per side. - Screenshots with the owner's case (Pi, Codex, Alma → OpenRouter, Codex, OpenCode Zen), dark, 1x and 2x, looked at. Broken by hand: the agent's logo back after its name turns masking-records red ("the logo before the name"). Not tried: the light theme by eye (the disc is drawn from theme tokens), the real app on WebKitGTK or Windows. Budgets untouched: plugins/redact isn't in the core. --- internal/gui/assets/plugins/redact/page.js | 6 +++--- internal/gui/assets/plugins/redact/redact.css | 15 +++++++++---- internal/gui/tests/masking-records.test.cjs | 21 +++++++++++++++---- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/internal/gui/assets/plugins/redact/page.js b/internal/gui/assets/plugins/redact/page.js index 3d54de88e..b9c96716a 100644 --- a/internal/gui/assets/plugins/redact/page.js +++ b/internal/gui/assets/plugins/redact/page.js @@ -251,12 +251,12 @@ function maskFlow(sum, move) { for (const r of rows) { const b = el("button", "mo-node" + (r.id && maskL[kind] === r.id ? " on" : "")); b.type = "button"; - // its logo on the side the lines are: an agent's after its name, a - // provider's before it; "N more" keeps the room so the names line up + // its logo first, then its name, on both sides; "N more" keeps the + // logo's room so the names line up const ic = r.id ? icon(r.icon || "generic") : el("span", "ic"); const tx = el("span", "tx"); tx.append(el("span", "nm", r.name), el("span", "ct", fmtN(r.n))); - b.append(...(kind === "agent" ? [tx, ic] : [ic, tx])); + b.append(ic, tx); if (r.id) { b.title = t("Show what {name} sent masked", { name: r.name }); b.onclick = () => maskNarrow({ [kind]: maskL[kind] === r.id ? "" : r.id }); diff --git a/internal/gui/assets/plugins/redact/redact.css b/internal/gui/assets/plugins/redact/redact.css index 7d4d6c888..130187ba2 100644 --- a/internal/gui/assets/plugins/redact/redact.css +++ b/internal/gui/assets/plugins/redact/redact.css @@ -38,10 +38,17 @@ .msk-fl { min-width: 0; } .mo-flow { position: relative; display: grid; grid-template-columns: minmax(0, 140px) minmax(80px, 1fr) minmax(0, 140px); gap: 14px; } .mo-col { display: flex; flex-direction: column; justify-content: center; min-width: 0; } -.mo-node { display: flex; align-items: center; justify-content: flex-end; gap: 8px; height: 34px; min-width: 0; padding: 0 10px; border: 0; border-radius: 9px; background: none; color: var(--fg); font: inherit; cursor: default; } -.mo-col.provider .mo-node { justify-content: flex-start; } -.mo-node .tx { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; } -.mo-col.provider .mo-node .tx { align-items: flex-start; } +/* the agents' nodes as one block against the lines, as wide as the widest, + so their logos make one column and their names one edge, as the + providers' do */ +.mo-col.agent { display: grid; grid-template-columns: minmax(0, max-content); justify-content: end; align-content: center; } +.mo-node { display: flex; align-items: center; gap: 8px; height: 34px; min-width: 0; padding: 0 10px 0 6px; border: 0; border-radius: 9px; background: none; color: var(--fg); font: inherit; text-align: left; cursor: default; } +.mo-node .tx { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; } +/* each logo on the same disc: a logo's own drawing fills its box or not + (Pi's edge to edge, Codex's a tile of its own), and bare they read as + three sizes */ +.mo-node .ic { box-sizing: border-box; width: 24px; height: 24px; padding: 5px; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 1px var(--line); } +.mo-node .ic > svg { width: 14px; height: 14px; } .mo-node:disabled .ic { visibility: hidden; } .mo-node:not(:disabled):hover { background: var(--pill); } .mo-node:disabled { color: var(--muted); } diff --git a/internal/gui/tests/masking-records.test.cjs b/internal/gui/tests/masking-records.test.cjs index 8ed2897a7..94ad4dcfe 100644 --- a/internal/gui/tests/masking-records.test.cjs +++ b/internal/gui/tests/masking-records.test.cjs @@ -188,11 +188,24 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", // to the ring's top left) const bird = await card.locator(".msk-hub svg").boundingBox(); assert(Math.abs(bird.x + bird.width / 2 - (hub.x + hub.width / 2)) < 1 && Math.abs(bird.y + bird.height / 2 - (hub.y + hub.height / 2)) < 1, "the bird in the middle of its ring"); - // each agent and provider with its logo, on the side the lines are + // each agent and provider with its logo assert.deepEqual(await card.locator(".mo-node .ic").evaluateAll((ns) => ns.map((n) => n.dataset.icon)), ["claudecode-color", "codex-color", "anthropic", "openai"]); - const agentNode = card.locator(".mo-col.agent .mo-node").first(), provNode = card.locator(".mo-col.provider .mo-node").first(); - assert((await agentNode.locator(".ic").boundingBox()).x > (await agentNode.locator(".nm").boundingBox()).x, "an agent's logo after its name"); - assert((await provNode.locator(".ic").boundingBox()).x < (await provNode.locator(".nm").boundingBox()).x, "a provider's logo before its name"); + // on both sides the logo first, then the name; a side's logos in one + // column and its names on one edge; every logo on a disc of one size + // (bare, a logo that fills its box and one that doesn't read as two + // sizes) + const nodes = await card.locator(".mo-node:not(:disabled)").evaluateAll((ns) => ns.map((b) => { + const ic = b.querySelector(".ic").getBoundingClientRect(), nm = b.querySelector(".nm").getBoundingClientRect(); + return { side: b.parentElement.classList.contains("agent") ? "agent" : "provider", ic: { x: ic.x, w: ic.width, h: ic.height, r: getComputedStyle(b.querySelector(".ic")).borderRadius }, nm: nm.x }; + })); + for (const n of nodes) { + assert(n.ic.x + n.ic.w <= n.nm, `the logo before the name: ${JSON.stringify(n)}`); + assert.deepEqual([n.ic.w, n.ic.h, n.ic.r], [24, 24, "50%"], `one disc for every logo: ${JSON.stringify(n)}`); + } + for (const side of ["agent", "provider"]) { + const of = nodes.filter((n) => n.side === side); + assert(of.every((n) => Math.abs(n.ic.x - of[0].ic.x) < 0.5 && Math.abs(n.nm - of[0].nm) < 0.5), `${side}s' logos in one column, names on one edge: ${JSON.stringify(of)}`); + } assert.match(await card.locator(".mo-cap").textContent(), /magpie/); assert.equal(await page.evaluate(() => [...document.querySelectorAll("#maskCard, #maskCard *")].some((n) => /gradient/.test(getComputedStyle(n).backgroundImage))), false, "flat: no gradient"); // short: the list starts in the first screen