diff --git a/internal/gui/assets/plugins/routing/client.js b/internal/gui/assets/plugins/routing/client.js index 7774c38fe..8f69088b4 100644 --- a/internal/gui/assets/plugins/routing/client.js +++ b/internal/gui/assets/plugins/routing/client.js @@ -2117,22 +2117,37 @@ function routingPage(part) { } // hueOf is the colour an agent's requests and answers fly in, and it is - // marked with: its maker's own where it has one, else one of the rest - // picked by its id, so it stays the same from one request to the next. - // None is red: red on this page is a failure, and an agent marked in it - // read as one (zhouatie on X: "openai" drew rose, its dot and wire red). + // marked with. PALETTE is twelve quiet colours of one lightness and + // chroma around the wheel, Claude's clay first; an agent asks for its + // maker's (HUES, a place in it) or one by its id, and is given the first + // from there no other agent has had, kept for as long as the page is + // open. Picked by id alone, 49 of 59 agents shared 8 colours and two + // on the stage at once were often marked alike (Pkh on Discord). The + // agents shown together (hues) are kept apart when more than twelve + // have come. None is red: red on this page is a failure, and an agent + // marked in it read as one (zhouatie on X: "openai" drew rose). // routing-agent-hue-not-red.test.cjs holds every colour here away from it. + const PALETTE = ["#d97757", "#bd8638", "#a59234", "#849e4a", "#5aa66c", "#25a98f", "#00a6b0", "#2e9fc9", "#5e95d7", "#858ad7", "#a47fca", "#bb77b1"]; const HUES = { - claude: "#d97757", codex: "#6366f1", gemini: "#0ea5e9", copilot: "#a855f7", cursor: "#14b8a6", opencode: "#eab308", - crush: "#ec4899", goose: "#84cc16", pi: "#10b981", omp: "#d946ef", omo: "#7c3aed", dsh: "#06b6d4", commandcode: "#f97316", - mimocode: "#3b82f6", deveco: "#3c99cc", + claude: 0, codex: 9, gemini: 7, copilot: 10, cursor: 5, opencode: 2, crush: 11, goose: 3, pi: 4, omp: 11, omo: 10, dsh: 6, + commandcode: 1, mimocode: 8, deveco: 7, }; - const SPARE = ["#8b5cf6", "#22c55e", "#0d9488", "#0891b2", "#ca8a04", "#db2777", "#2563eb", "#65a30d"]; - function hueOf(id) { - if (HUES[id]) return HUES[id]; - let h = 0; - for (const c of String(id || "")) h = (h * 31 + c.charCodeAt(0)) >>> 0; - return SPARE[h % SPARE.length]; + const given = new Map(); // agent → its colour + function hueOf(id, near) { + let c = given.get(id); + if (c && !near?.has(c)) return c; + let h = HUES[id]; + if (h == null) { h = 0; for (const ch of String(id || "")) h = (h * 31 + ch.charCodeAt(0)) >>> 0; } + const had = new Set(given.values()), from = (k) => PALETTE[(h + k) % PALETTE.length]; + const ks = [...PALETTE.keys()]; + c = from(ks.find((k) => !had.has(from(k)) && !near?.has(from(k))) ?? ks.find((k) => !near?.has(from(k))) ?? 0); + given.set(id, c); + return c; + } + // hues: the agents shown together, each its own colour + function hues(ids) { + const near = new Set(); + for (const id of ids) near.add(hueOf(id, near)); } // foldersOf: the folders routes say, each once, in their order; @@ -2329,8 +2344,10 @@ function routingPage(part) { const nodes = [...keep, ...ags.filter((a) => !keep.includes(a))].map((id) => agentNode(id).node); if (nodes.some((x, i) => srcs.children[i] !== x) || srcs.children.length !== nodes.length) srcs.replaceChildren(...nodes); srcs.classList.toggle("many", ags.length > 1); + hues(ags); for (const id of ags) { const a = agents.get(id), r = rs.filter((x) => x.agent === id).pop(), ag = agentOf(id); + for (const n of [a.node, a.wire]) n.style.setProperty("--agent", hueOf(id)); if (a.icon !== (ag?.icon || "generic")) { a.icon = ag?.icon || "generic"; a.ic.replaceChildren(icon(a.icon)); } setText(a.name, agentName(id)); // one agent working in more than one folder at once: which, by @@ -2565,6 +2582,12 @@ function routingPage(part) { // lightRow lights a row and its wire: on for the one answering or that // answered the request shown, now and a flowing wire only while a // request is with it (#2386) + // tint: a fold's or a group's wire in the colour of the row lit under + // it, or in none + function tint(wire, from) { + const c = from?.style.getPropertyValue("--agent"); + if (c) wire.style.setProperty("--agent", c); else wire.style.removeProperty("--agent"); + } function lightRow(li, wire, on, now) { li.classList.toggle("on", on); li.classList.toggle("now", on && now); @@ -2580,8 +2603,8 @@ function routingPage(part) { const trying = new Map(), busy = new Set(); // a seat → the request it answers now for (const r of rs) for (const tr of r.tries) if (!tr.done) { trying.set(tryseat(r, tr), r); busy.add(r.agent); } askUnnamed(rs); - const onWire = new Set(); - for (const f of flying.values()) { onWire.add(f.id); busy.add(f.agent); } + const onWire = new Map(); // a seat → the agent whose magpie is at it + for (const f of flying.values()) { onWire.set(f.id, f.agent); busy.add(f.agent); } // what each request found, read once a pass: hundreds of a route's // keys each read their route's whole list again (#3164) const found = new Map(); @@ -2695,7 +2718,12 @@ function routingPage(part) { row.li.classList.toggle("low", !!(!w.routing && w.known && w.used >= 90)); row.li.classList.toggle("rest", !!resting || gave.has(id)); row.li.classList.toggle("left", !!w.unlisted || !!w.window); - if (on) row.wire.style.setProperty("--agent", hueOf(r.agent)); + // in the colour of the agent whose request is on it: the one it + // answers now, the one whose magpie is at it, else the request it + // answered, and none once it is off, so a row kept from before + // never shows the last agent's colour (Pkh on Discord) + const by = trying.get(id)?.agent ?? onWire.get(id) ?? r.agent; + if (on) row.wire.style.setProperty("--agent", hueOf(by)); else row.wire.style.removeProperty("--agent"); row.wire.classList.toggle("rest", !!resting || !!w.unlisted || !!w.window); } // a fold tells of its keys together: the one answering or that @@ -2715,7 +2743,7 @@ function routingPage(part) { const tip = on?.st.title ? f.st.textContent : ""; if (f.st.title !== tip) { if (tip) f.st.title = tip; else f.st.removeAttribute("title"); } lightRow(f.li, f.wire, !!on, ms.some((m) => has(m, "now"))); - if (on) f.wire.style.setProperty("--agent", on.wire.style.getPropertyValue("--agent")); + tint(f.wire, on?.wire); return !!ms.length && resting + held === ms.length; }; for (const f of folds.values()) { @@ -2740,7 +2768,7 @@ function routingPage(part) { s.li.classList.remove("rest"); const lit = ms.find((row) => row.li.classList.contains("now")) || ms.find((row) => row.li.classList.contains("on")); lightRow(s.li, s.wire, !!lit, ms.some((row) => row.li.classList.contains("now"))); - if (lit) s.wire.style.setProperty("--agent", lit.wire.style.getPropertyValue("--agent")); + tint(s.wire, lit?.wire); } for (const [id, a] of agents) a.wire.classList.toggle("live", busy.has(id)); flowSoon(); @@ -7577,6 +7605,7 @@ function routingPage(part) { } } pAg = pPlace(pAg, ags.slice(0, P_SIDE)); + hues(pAg); pDst = pPlace(pDst, [...dst.keys()].slice(0, P_SIDE)); const keep = new Set(); pFrom.replaceChildren(...pAg.map((id) => { @@ -7640,7 +7669,7 @@ function routingPage(part) { return new Promise((res) => { pTrips.push({ dot, n, back, t0: performance.now(), ms, res }); if (!pRaf) pRaf = requestAnimationFrame(pTick); - }).finally(() => { if (!--n.lit) n.wire.classList.remove("on"); }); + }).finally(() => { if (!--n.lit) { n.wire.classList.remove("on"); if (n.wire.classList.contains("ps-out")) n.wire.style.removeProperty("--agent"); } }); } function pTick(ts) { pRaf = 0; diff --git a/internal/gui/tests/routing-agent-hue-not-red.test.cjs b/internal/gui/tests/routing-agent-hue-not-red.test.cjs index 54a612286..ff7cbd082 100644 --- a/internal/gui/tests/routing-agent-hue-not-red.test.cjs +++ b/internal/gui/tests/routing-agent-hue-not-red.test.cjs @@ -6,7 +6,7 @@ // on X saw a red dot on its node and a red dotted wire from magpie and read // them as something wrong ("这个红色颜色,让人以为是状态异常"). Red on this // page means a failure (an answer ringed red, a request that failed), so no -// agent's colour may look like it: every colour hueOf can give sits well +// agent's colour may look like it: every colour hueOf can give (PALETTE) sits well // away from --red, in the light theme and the dark, and the reporter's // agent, drawn on the stage in the dark theme, is marked in one of them. // Every language and narrow windows; the API is faked. @@ -51,11 +51,9 @@ async function redsOf() { test("no colour an agent can be marked with reads as the failure red", async () => { const reds = await redsOf(); const js = await fs.readFile(path.join(assets, "plugins/routing/client.js"), "utf8"); - const hues = js.match(/const HUES = \{([\s\S]*?)\};/); - const spare = js.match(/const SPARE = \[([^\]]*)\]/); - assert(hues && spare, "hueOf's palette not found in routing/client.js"); - const all = [...hues[1].matchAll(/(\w+):\s*"(#[0-9a-f]{6})"/gi)].map((m) => [m[1], m[2]]) - .concat([...spare[1].matchAll(/"(#[0-9a-f]{6})"/gi)].map((m) => ["spare", m[1]])); + const palette = js.match(/const PALETTE = \[([^\]]*)\]/); + assert(palette, "hueOf's palette not found in routing/client.js"); + const all = [...palette[1].matchAll(/"(#[0-9a-f]{6})"/gi)].map((m, i) => [i, m[1]]); assert(all.length > 10, "palette too small: " + JSON.stringify(all)); const red = all.filter(([, c]) => reads(c, reds)); assert.deepEqual(red, [], "agent colours that read as --red " + reds.join("/")); diff --git a/internal/gui/tests/routing-agents-apart.test.cjs b/internal/gui/tests/routing-agents-apart.test.cjs new file mode 100644 index 000000000..269392c6c --- /dev/null +++ b/internal/gui/tests/routing-agents-apart.test.cjs @@ -0,0 +1,111 @@ +// Run with Node's test runner and Playwright on the module path; see README.md. +// The agents on the Routing stage together are each marked in a colour of +// their own (Pkh on Discord: trails in the same colour, or the wrong one). +// An agent with no maker's colour was given one of eight by its id, and 49 +// of magpie's 59 agents have none: QwenPaw, ZCode, Qwen Code and AstrBot all +// drew #65a30d, and Gemini's and DevEco's own blues sat 8 degrees of hue +// apart. Four agents with requests at once each get a colour at least 20 +// degrees of OKLCH hue from every other's, and an agent's colour stays its +// own from one request to the next. English, Chinese (simplified and traditional), Japanese and +// German, at 1100px and 420px, in the light and the dark; the API is faked. +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(process.env.MAGPIE_ROUTING_ASSETS || path.join(__dirname, "../assets")); + +// OKLCH hue of an sRGB colour, #rrggbb or rgb() +function hueOf(css) { + const hex = css.match(/^#([0-9a-f]{6})$/i); + let [r, g, b] = hex ? [0, 2, 4].map((i) => parseInt(hex[1].slice(i, i + 2), 16)) : css.match(/[\d.]+/g).map(Number); + const lin = (v) => { v /= 255; return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4; }; + [r, g, b] = [r, g, b].map(lin); + const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b); + const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b); + const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b); + const A = 1.9779984951 * l - 2.4285922050 * m + 0.4505937099 * s; + const B = 0.0259040371 * l + 0.7827717662 * m - 0.8086757660 * s; + return (Math.atan2(B, A) * 180 / Math.PI + 360) % 360; +} +const apart = (a, b) => { const d = Math.abs(hueOf(a) - hueOf(b)) % 360; return Math.min(d, 360 - d); }; + +const AGENTS = [["qwenpaw", "QwenPaw"], ["zcode", "ZCode"], ["gemini", "Gemini CLI"], ["deveco", "DevEco"]]; +const ago = (s) => new Date(Date.now() - s * 1e3).toISOString(); +const route = (id, agent) => { + const seat = { id: `p${id}#k`, provider: `p${id}`, name: `Provider ${id}`, who: `key-${id}`, kind: "key", model: "glm-5.1" }; + return { id, seq: id, time: ago(5 - id), agent, model: "glm-5.1", provider: seat.provider, done: false, order: [seat], + tries: [{ id: seat.id, model: seat.model, start: ago(4), done: false }] }; +}; + +function serve(lang, theme, live) { + return async (request) => { + const url = new URL(request.request().url()); + const json = (data) => request.fulfill({ json: data }); + if (url.pathname === "/boot.js") return request.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"${theme}",web:true};` }); + if (url.pathname === "/wails/runtime.js") return request.fulfill({ contentType: "text/javascript", body: "export const Window = {};" }); + if (url.pathname === "/api/state") return json({ agents: AGENTS.map(([id, name]) => ({ id, name, path: "", fields: [] })), profiles: [], settings: { lang, theme } }); + if (url.pathname === "/api/gateway/trace") { + if (url.searchParams.get("wait")) { + if (live.queued.length) return json(live.queued.shift()); + live.pending.push(request); + return; + } + return json({ mine: true, now: new Date().toISOString(), seq: 1, totals: { requests: 4, rerouted: 0, errors: 0 }, routes: AGENTS.map(([id], i) => route(i + 1, id)) }); + } + if (url.pathname === "/api/gateway/history") return json({ cut: false, days: [], routes: [] }); + if (url.pathname === "/api/groups") return json({ groups: [], pools: [] }); + if (url.pathname === "/api/providers") return json({ providers: [], excluded: [], gateway: { running: true, window: true } }); + if (url.pathname.startsWith("/api/")) return json({}); + const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname); + const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)]; + await request.fulfill({ body: await fs.readFile(file), contentType }); + }; +} + +for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) { + for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) { + for (const [width, theme] of [[1100, "light"], [420, "dark"]]) { + test(`${engine} ${lang} ${width}px ${theme}: the agents on the stage together are each in a colour of their own`, async (t) => { + const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" })); + t.after(() => browser.close()); + const page = await browser.newPage({ viewport: { width, height: 900 }, reducedMotion: "reduce", colorScheme: theme }); + page.setDefaultTimeout(5000); + page.setDefaultNavigationTimeout(60000); + const errors = []; + page.on("pageerror", (error) => errors.push(error.message)); + const live = { pending: [], queued: [], seq: 1 }; + await page.route("**/*", serve(lang, theme, live)); + const colours = () => page.evaluate(() => Object.fromEntries([...document.querySelectorAll(".rt-src")] + .map((n) => [n.querySelector("b").textContent, getComputedStyle(n.querySelector("b"), "::before").backgroundColor]))); + await page.goto("http://magpie.test/?view=routing"); + await page.waitForFunction(() => document.querySelectorAll(".rt-src").length === 4); + const got = await colours(); + assert.deepEqual(Object.keys(got).sort(), AGENTS.map(([, n]) => n).sort()); + const names = Object.keys(got); + for (let i = 0; i < names.length; i++) { + for (let j = i + 1; j < names.length; j++) { + const [a, b] = [names[i], names[j]]; + assert(apart(got[a], got[b]) >= 20, `${a} ${got[a]} and ${b} ${got[b]} are ${apart(got[a], got[b]).toFixed(1)}° apart`); + } + } + // each agent's wire is its node's colour + const wired = await page.evaluate(() => [...document.querySelectorAll(".rt-src")].map((n) => n.style.getPropertyValue("--agent").trim())); + assert.equal(new Set(wired).size, 4, "agents' colours: " + wired); + + // QwenPaw sends again: every agent keeps the colour it had + send(live, AGENTS.map(([id], i) => route(i + 1, id)).concat(route(5, "qwenpaw"))); + await page.waitForFunction(() => [...document.querySelectorAll(".rt-accts .who")].some((w) => w.textContent === "key-5")); + assert.deepEqual(await colours(), got); + assert.deepEqual(errors, []); + }); + } + } +} + +function send(live, routes) { + const d = { mine: true, now: new Date().toISOString(), seq: ++live.seq, totals: { requests: live.seq }, routes }; + const r = live.pending.shift(); + if (r) r.fulfill({ json: d }); else live.queued.push(d); +} diff --git a/internal/gui/tests/routing-reused-row-hue.test.cjs b/internal/gui/tests/routing-reused-row-hue.test.cjs new file mode 100644 index 000000000..615ce7068 --- /dev/null +++ b/internal/gui/tests/routing-reused-row-hue.test.cjs @@ -0,0 +1,116 @@ +// Run with Node's test runner and Playwright on the module path; see README.md. +// A lit row's wire is drawn in the colour of the agent whose request is +// on it, and a row kept from one update to the next never keeps another +// agent's colour (Pkh on Discord, QwenPaw and others on one stage: trails +// in the wrong agent's colour). An account's row is kept while any staged +// request weighed it, and its wire took the colour of the latest request +// that weighed it, not of the one it was answering: Codex's request at an +// account, then ZCode's weighing it and going to another, drew Codex's +// trail in ZCode's colour, in the flows layer too, which copies it. Once +// the row is off, its wire is left with no agent's colour at all. +// English, Chinese (simplified and traditional), Japanese and German, at +// 1100px and 420px; no backend, the API is faked here. +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(process.env.MAGPIE_ROUTING_ASSETS || path.join(__dirname, "../assets")); +const M = "glm-5.1"; +const order = [ + { id: "solo#s1", provider: "solo", name: "Solo", who: "solo-1", kind: "key", model: M }, + { id: "ag#a1", provider: "ag", name: "Other", who: "ag-1", kind: "key", model: M }, +]; +const ago = (s) => new Date(Date.now() - s * 1e3).toISOString(); +const route = (id, agent, tries) => ({ id, seq: id, time: ago(3 - id), agent, model: M, provider: tries[0].id.split("#")[0], + done: tries.every((x) => x.done), status: 200, ms: 900, tokens: 1200, order, tries }); +const at = (seat, done) => ({ id: seat, model: M, start: ago(2), done, ...(done ? { status: 200, ms: 900 } : {}) }); + +function serve(lang, live) { + return async (request) => { + const url = new URL(request.request().url()); + const json = (data) => request.fulfill({ json: data }); + if (url.pathname === "/boot.js") return request.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:true};` }); + if (url.pathname === "/wails/runtime.js") return request.fulfill({ contentType: "text/javascript", body: "export const Window = {};" }); + if (url.pathname === "/api/state") return json({ agents: [{ id: "codex", name: "Codex", path: "", fields: [] }, { id: "zcode", name: "ZCode", path: "", fields: [] }], profiles: [], settings: { lang, theme: "light" } }); + if (url.pathname === "/api/gateway/trace") { + if (url.searchParams.get("wait")) { + if (live.queued.length) return json(live.queued.shift()); + live.pending.push(request); + return; + } + return json({ mine: true, now: new Date().toISOString(), seq: 1, totals: { requests: 1, rerouted: 0, errors: 0 }, routes: [route(1, "codex", [at("solo#s1", false)])] }); + } + if (url.pathname === "/api/gateway/history") return json({ cut: false, days: [], routes: [] }); + if (url.pathname === "/api/groups") return json({ groups: [], pools: [] }); + if (url.pathname === "/api/providers") return json({ providers: [], excluded: [], gateway: { running: true, window: true } }); + if (url.pathname.startsWith("/api/")) return json({}); + const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname); + const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)]; + await request.fulfill({ body: await fs.readFile(file), contentType }); + }; +} + +for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) { + for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) { + for (const width of [1100, 420]) { + test(`${engine} ${lang} ${width}px: a kept row's wire is in the colour of the agent on it, and in none once off`, async (t) => { + const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" })); + t.after(() => browser.close()); + // motion on: the flows layer draws a flowing wire's copy + const page = await browser.newPage({ viewport: { width, height: 900 } }); + page.setDefaultTimeout(5000); + page.setDefaultNavigationTimeout(60000); + const errors = []; + page.on("pageerror", (error) => errors.push(error.message)); + const live = { pending: [], queued: [], seq: 1 }; + await page.route("**/*", serve(lang, live)); + const send = (...routes) => { + const d = { mine: true, now: new Date().toISOString(), seq: ++live.seq, totals: { requests: live.seq }, routes }; + const r = live.pending.shift(); + if (r) r.fulfill({ json: d }); else live.queued.push(d); + }; + const hue = (name) => page.locator(".rt-src", { hasText: name }).evaluate((n) => n.style.getPropertyValue("--agent").trim()); + // each drawn wire's colour, lit or flowing, and the flows layer's + const wires = () => page.evaluate(() => { + const c = (p) => p.style.getPropertyValue("--agent").trim(); + const ps = [...document.querySelectorAll(".rt-wires path[d]")]; + return { + on: ps.filter((p) => p.matches(".lit, .live")).map(c).sort(), + off: ps.filter((p) => !p.matches(".lit, .live")).map(c).filter(Boolean), + flows: [...document.querySelectorAll(".rt-flows path[d]")].map(c).sort(), + }; + }); + const row = (who) => page.locator(".rt-accts li", { has: page.locator(".who", { hasText: new RegExp(`^${who}$`) }) }); + await page.goto("http://magpie.test/?view=routing"); + await row("solo-1").waitFor(); + await page.waitForFunction(() => document.querySelector(".rt-accts li.now")); + const codex = await hue("Codex"); + assert(codex, "Codex's node has no colour"); + + // ZCode's request weighs the account Codex's is at, and goes to the + // other: the account's row is kept, and it still answers Codex + send(route(1, "codex", [at("solo#s1", false)]), route(2, "zcode", [at("ag#a1", false)])); + await page.locator(".rt-src", { hasText: "ZCode" }).waitFor(); + await page.waitForFunction(() => document.querySelectorAll(".rt-accts li.now").length === 2); + const zcode = await hue("ZCode"); + assert(zcode && zcode !== codex, `Codex and ZCode marked alike: ${codex} ${zcode}`); + const want = [codex, codex, zcode, zcode].sort(); // each agent's wire and its account's + await page.waitForFunction((n) => document.querySelectorAll(".rt-flows path[d]").length === n, want.length).catch(() => {}); + const w = await wires(); + assert.deepEqual(w.on, want, `the lit wires' colours: Codex ${codex}, ZCode ${zcode}`); + assert.deepEqual(w.flows, want, `the flows layer's colours: Codex ${codex}, ZCode ${zcode}`); + + // Codex's is answered; ZCode's, the latest to weigh the account, + // didn't go to it: its row is off, and so is its colour + send(route(1, "codex", [at("solo#s1", true)]), route(2, "zcode", [at("ag#a1", false)])); + await page.waitForFunction(() => document.querySelectorAll(".rt-accts li.now").length === 1); + assert.equal(await row("solo-1").evaluate((li) => li.classList.contains("on")), false); + // Codex's own wire is its colour always; no other wire that is off has one + assert.deepEqual((await wires()).off, [codex]); + assert.deepEqual(errors, []); + }); + } + } +}