Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

gui: a logo solid to its edges is drawn at the size of a line logo beside it

yetonea5ce158e5480
diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css
index 5ce0899e5..e4949b00a 100644
--- a/internal/gui/assets/app.css
+++ b/internal/gui/assets/app.css
@@ -167,6 +167,11 @@ code { font: var(--code-style, normal) var(--code-weight, 400) 11.5px var(--code
.ic { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 16px; height: 16px; }
.ic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ic .mask { width: 100%; height: 100%; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
+/* logos solid to their edges, a tile or a disc: drawn to the box's edges
+ they read a size bigger than a line logo beside them, so they are drawn at
+ the size Alma's and Cindy's tiles have of their own. icon-tile.test.cjs
+ measures every file in icons/ and keeps this list whole. */
+.ic:is([data-icon="aihubmix-color"], [data-icon="atomcode"], [data-icon="cherryin-color"], [data-icon="codebuddy-color"], [data-icon="codex-color"], [data-icon="crush"], [data-icon="geminicli-color"], [data-icon="hanako"], [data-icon="hunyuan-color"], [data-icon="kilo"], [data-icon="kiro-color"], [data-icon="lody"], [data-icon="mistermorph-color"], [data-icon="mlx-serve"], [data-icon="monica-color"], [data-icon="phala-color"], [data-icon="pipellm-color"], [data-icon="qoder"], [data-icon="snow"], [data-icon="targon-color"], [data-icon="typesafe"], [data-icon="workbuddy-color"], [data-icon="yuanbao-color"], [data-icon="zcode"], [data-icon="zoo-code"]) > * { width: 82%; height: 82%; }
.ic.generic { color: var(--muted); }
/* maskSpan's shelf: a hidden user of every mask picture loaded, so a logo drawn again paints at once (#1847) */
.mask-shelf { position: fixed; top: 0; left: 0; width: 0; height: 0; overflow: hidden; visibility: hidden; pointer-events: none; }
diff --git a/internal/gui/tests/icon-tile.test.cjs b/internal/gui/tests/icon-tile.test.cjs
new file mode 100644
index 000000000..e91490d43
--- /dev/null
+++ b/internal/gui/tests/icon-tile.test.cjs
@@ -0,0 +1,132 @@
+// Run with Node's test runner and Playwright on the module path; see README.md.
+// A logo that is a solid tile or disc to its edges (Codex, WorkBuddy,
+// ZCode) read a size bigger than a line logo (Pi, OpenCode, Hermes) in the
+// row beside it: both filled the same box, the tile with ~96% of it inked
+// and the line logo with ~40%. A tile is now drawn at 82% of the box, the
+// size Alma's and Cindy's tiles have of their own. Every file in icons/ is
+// measured, so a new tile logo left out of app.css's list, or a line logo
+// put in it, fails here. In the Agents list the tile is drawn at 82% and the
+// line logo at full size, in Chromium and WebKit.
+const assert = require("node:assert/strict");
+const fs = require("node:fs/promises");
+const path = require("node:path");
+const { test } = require("node:test");
+const { chromium, webkit } = require("playwright");
+
+const assets = path.resolve(__dirname, "../assets");
+
+// inked to within 7% of every edge, and most of the box inked
+const isTile = (r) => Math.min(r.w, r.h) >= 0.93 && r.ink >= 0.7;
+
+async function tileList() {
+ const src = await fs.readFile(path.join(assets, "app.css"), "utf8");
+ const m = src.match(/\.ic:is\(([^)]*)\) > \* \{ width: 82%; height: 82%; \}/);
+ assert.ok(m, "app.css has the tile logos' rule");
+ return new Set([...m[1].matchAll(/\[data-icon="([^"]+)"\]/g)].map((x) => x[1]));
+}
+
+test("the tile logos' rule names every logo solid to its edges, and no other", async () => {
+ const listed = await tileList();
+ const files = (await fs.readdir(path.join(assets, "icons"))).filter((f) => /\.(svg|png)$/.test(f));
+ const browser = await chromium.launch();
+ try {
+ const page = await browser.newPage();
+ await page.setContent("<html></html>");
+ const found = new Set(), all = new Set();
+ for (const f of files) {
+ const name = f.replace(/\.(svg|png)$/, "");
+ all.add(name);
+ const mime = f.endsWith(".png") ? "image/png" : "image/svg+xml";
+ const url = `data:${mime};base64,` + (await fs.readFile(path.join(assets, "icons", f))).toString("base64");
+ const r = await page.evaluate(async (url) => {
+ const img = new Image();
+ img.src = url;
+ await img.decode();
+ const S = 256, c = document.createElement("canvas");
+ c.width = c.height = S;
+ const x = c.getContext("2d");
+ const nw = img.naturalWidth || S, nh = img.naturalHeight || S, k = Math.min(S / nw, S / nh);
+ x.drawImage(img, (S - nw * k) / 2, (S - nh * k) / 2, nw * k, nh * k);
+ const d = x.getImageData(0, 0, S, S).data;
+ let l = S, t = S, rt = -1, b = -1, ink = 0;
+ for (let y = 0; y < S; y++) for (let i = 0; i < S; i++) {
+ if (d[(y * S + i) * 4 + 3] <= 24) continue;
+ ink++; l = Math.min(l, i); rt = Math.max(rt, i); t = Math.min(t, y); b = Math.max(b, y);
+ }
+ return { w: (rt - l + 1) / S, h: (b - t + 1) / S, ink: ink / S / S };
+ }, url);
+ if (isTile(r)) found.add(name);
+ }
+ for (const n of found) assert.ok(listed.has(n), `${n} is solid to its edges but not in app.css's tile rule`);
+ for (const n of listed) {
+ assert.ok(all.has(n), `the tile rule names ${n}, which icons/ doesn't have`);
+ assert.ok(found.has(n), `the tile rule names ${n}, which is not solid to its edges`);
+ }
+ } finally {
+ await browser.close();
+ }
+});
+
+function serve() {
+ const agents = [
+ { id: "pi", name: "Pi", icon: "pi", path: "/test/pi", fields: [] },
+ { id: "codex", name: "Codex", icon: "codex-color", path: "/test/codex", fields: [] },
+ { id: "zcode", name: "ZCode", icon: "zcode", path: "/test/zcode", fields: [] },
+ ];
+ const state = { agents, profiles: [], settings: { lang: "en", theme: "dark" } };
+ return async (r) => {
+ const url = new URL(r.request().url());
+ const json = (data) => r.fulfill({ json: data });
+ if (url.pathname === "/boot.js") return r.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"en",theme:"dark",web:true};` });
+ if (url.pathname === "/wails/runtime.js") return r.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });
+ if (url.pathname === "/api/state") return json(state);
+ if (url.pathname === "/api/plugins") return json({ plugins: [] });
+ if (url.pathname === "/api/gateway/trace") {
+ if (url.searchParams.get("wait")) return new Promise(() => {});
+ return json({ mine: true, now: new Date().toISOString(), seq: 0, totals: { requests: 0, rerouted: 0, errors: 0 }, routes: [] });
+ }
+ if (url.pathname === "/api/providers") return json({ providers: [], presets: [], excluded: [], gateway: { running: true, window: true, url: "http://127.0.0.1:3999" } });
+ if (url.pathname.startsWith("/api/")) return json({});
+ const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname);
+ let body;
+ try { body = await fs.readFile(file); } catch { return r.fulfill({ status: 404, body: "" }); }
+ const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)];
+ await r.fulfill({ body, contentType, headers: { "Cache-Control": "no-cache" } });
+ };
+}
+
+for (const [engine, type] of [["chromium", chromium], ["webkit", webkit]]) {
+ test(`a tile logo is drawn at 82% of its box, a line logo whole (${engine})`, async () => {
+ const browser = await type.launch();
+ try {
+ const page = await browser.newPage({ viewport: { width: 900, height: 700 } });
+ await page.route("http://magpie.test/**", serve());
+ await page.goto("http://magpie.test/");
+ const size = (icon) => page.evaluate((icon) => {
+ const e = document.querySelector(`.ic[data-icon="${icon}"]`);
+ if (!e || !e.firstElementChild) return null;
+ const b = e.getBoundingClientRect(), p = e.firstElementChild.getBoundingClientRect();
+ return { box: b.width, pic: p.width, dx: p.left - b.left - (b.right - p.right), dy: p.top - b.top - (b.bottom - p.bottom) };
+ }, icon);
+ await page.waitForFunction(() => ["pi", "codex-color", "zcode"].every((i) => document.querySelector(`.ic[data-icon="${i}"] > *`)));
+ // a row's logo opens from nothing as it comes in: measured once it holds still
+ let last = "";
+ for (let i = 0; i < 40; i++) {
+ const now = JSON.stringify(await Promise.all(["pi", "codex-color", "zcode"].map(size)));
+ if (now === last) break;
+ last = now;
+ await page.waitForTimeout(100);
+ }
+ for (const icon of ["codex-color", "zcode"]) {
+ const s = await size(icon);
+ assert.ok(s.box > 0, `${icon} has a box`);
+ assert.ok(Math.abs(s.pic / s.box - 0.82) < 0.02, `${icon} is drawn at ${s.pic}/${s.box}`);
+ assert.ok(Math.abs(s.dx) < 0.6 && Math.abs(s.dy) < 0.6, `${icon} is centred in its box`);
+ }
+ const pi = await size("pi");
+ assert.equal(pi.pic, pi.box, "a line logo fills its box");
+ } finally {
+ await browser.close();
+ }
+ });
+}