Skip to content

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

routing: with several routes on the stage, each route's rows hang under its own heading (hoobnn on Discord)

yetone8701eb35ea82
diff --git a/internal/gui/assets/plugins/routing/client.js b/internal/gui/assets/plugins/routing/client.js
index af2a5c47c..2934c9345 100644
--- a/internal/gui/assets/plugins/routing/client.js
+++ b/internal/gui/assets/plugins/routing/client.js
@@ -1986,6 +1986,25 @@ function routingPage(part) {
return r;
};
+ // wayOf is the route a request went by, as the stage heads it: its
+ // routing group, or the provider its model is of. A key of its own, no
+ // ">" in it, as a group in the group's way down is joined by them.
+ const wayOf = (r) => "\u0002" + (r.group ? "g:" + r.group.id : "p:" + r.provider).replace(/>/g, "\u0003");
+ let ways = null; // with more than one route on the stage, each one's heading: way → info
+ // wayInfos tells of each route on the stage as its latest request found
+ // it, and of the agents sending to it, by name
+ function wayInfos(rs) {
+ const out = new Map();
+ for (const r of rs) {
+ const key = wayOf(r), g = r.group, f = r.order.find((x) => !x.fallback) || r.order[0];
+ const agents = [...new Set([...(out.get(key)?.agents || []), agentName(r.agent)])];
+ out.set(key, g ? { id: key, route: true, pk: "route/group/" + g.id, name: g.name, ref: g.ref || "group/" + g.id, routing: g.routing || "", agents }
+ : { id: key, route: true, pk: "route/" + r.provider, name: f?.name || r.provider, ref: r.model, routing: f?.routing || "", icon: f ? f.icon || f.preset || "generic" : "",
+ lone: r.order.filter((x) => !x.fallback).length <= 1, agents });
+ }
+ return out;
+ }
+
// staged: the routes the stage shows — a picked one alone; else those
// playing, and each agent's latest while it lingers, a few agents at most
function staged() {
@@ -2046,7 +2065,9 @@ function routingPage(part) {
const li = el("li", "rt-sub"), name = el("b"), id = el("code", "mdl"), mode = el("i"), n = el("span", "n"), chev = el("span", "chev");
const st = el("em"), tg = el("span", "tag");
chev.append(svg(CHEV, 12, 1.7));
- li.append(svg(FAN, 14, 1.5), name, id, n, mode, chev, st, tg);
+ // a route's heading has its provider's logo, a group's the fan
+ li.append(info.route && info.icon ? icon(info.icon) : svg(FAN, 14, 1.5), name, id, n, mode, chev, st, tg);
+ li.classList.toggle("rt-route", !!info.route);
li.tabIndex = 0;
li.setAttribute("role", "button");
s = { li, name, id, mode, n, st, tg, wire: path(), key, sub: true };
@@ -2055,12 +2076,14 @@ function routingPage(part) {
subs.set(key, s);
}
s.up = d ? key.slice(0, key.lastIndexOf(">")) : null;
- s.pk = "group/" + info.id;
+ s.pk = info.route ? info.pk : "group/" + info.id;
s.li.style.setProperty("--depth", d);
- s.name.textContent = info.name || info.id;
- s.id.textContent = info.ref || "group/" + info.id;
- s.mode.textContent = t(modeOf(info.routing || "")[0]);
- s.rules = info.rules ? t(info.rules === 1 ? "1 rule" : "{n} rules", { n: info.rules }) : "";
+ setText(s.name, info.name || info.id);
+ setText(s.id, info.ref || "group/" + info.id);
+ // a provider with one key on routes nothing: no way to name
+ setText(s.mode, info.lone ? "" : t(modeOf(info.routing || "")[0]));
+ s.rules = info.route ? t("Sent by {agents}", { agents: info.agents.join(", ") })
+ : info.rules ? t(info.rules === 1 ? "1 rule" : "{n} rules", { n: info.rules }) : "";
return s;
}
// shut marks a heading or a fold open or folded, as the reader sees it
@@ -2086,7 +2109,7 @@ function routingPage(part) {
for (let d = 1; d <= via.length; d++) { const s = subs.get(via.slice(0, d).join(">")); if (s) out.push(s.wire); }
return out;
}
- const via = row.w.via || [];
+ const via = row.path || [];
for (let d = 1; d <= via.length; d++) { const s = subs.get(via.slice(0, d).join(">")); if (s) out.push(s.wire); }
const f = row.fold && folds.get(row.fold);
if (f?.open) out.push(f.wire);
@@ -2105,7 +2128,7 @@ function routingPage(part) {
// foldKey: keys or accounts side by side that fold together — one
// provider's, for one model at one effort, on one way down a group, all
// fallbacks or none
- const foldKey = (w) => [(w.via || []).join(">"), w.kind, w.provider, w.model || "", w.fixed || "", w.fallback ? 1 : 0, w.aside ? 1 : 0].join("\u0000");
+ const foldKey = (w, path = w.via || []) => [path.join(">"), w.kind, w.provider, w.model || "", w.fixed || "", w.fallback ? 1 : 0, w.aside ? 1 : 0].join("\u0000");
const folding = (w) => w.kind === "key" || w.kind === "account";
// what is remembered open: the provider and model, whichever request
const openKey = (w) => w.provider + "/" + (w.model || "") + (w.fixed ? ":" + w.fixed : "");
@@ -2220,9 +2243,17 @@ function routingPage(part) {
sets = [...sets.filter((k) => latest.has(k)), ...[...latest.keys()].filter((k) => !sets.includes(k))];
// a Set beside the list: hundreds of keys looked each other up (#3164)
const ids = [], has = new Set(), wOf = new Map(), rOf = new Map();
- for (const k of sets) {
- const r = latest.get(k);
- for (const w of seated(r)) { const id = seat(w); if (!has.has(id)) { has.add(id); ids.push(id); } }
+ // the routes the sets are of, each its sets together. With more than
+ // one on the stage, each route's rows hang under a heading naming it:
+ // under a header naming one route, the rows of the other agents'
+ // routes read as that one's (hoobnn on Discord: a group "3 on" over
+ // five rows, Pi's zcode and OpenCode's Kimi Code among them)
+ const byWay = new Map();
+ for (const k of sets) { const w = wayOf(latest.get(k)); byWay.has(w) ? byWay.get(w).push(k) : byWay.set(w, [k]); }
+ ways = byWay.size > 1 ? wayInfos(rs) : null;
+ const wayAt = new Map();
+ for (const [w, ks] of byWay) for (const k of ks) {
+ for (const x of seated(latest.get(k))) { const id = seat(x); if (!has.has(id)) { has.add(id); ids.push(id); wayAt.set(id, w); } }
}
for (const r of rs) for (const w of [...r.order, ...(r.left || [])]) { wOf.set(seat(w), w); rOf.set(seat(w), r.id); }
// where each was, of those on the stage: a key folded away was nowhere
@@ -2239,6 +2270,8 @@ function routingPage(part) {
}
row.w = wOf.get(id);
row.rid = rOf.get(id);
+ // its way down: its route's heading, then the groups in the group
+ row.path = ways ? [wayAt.get(id), ...(row.w.via || [])] : row.w.via || [];
}
// a group in the group heads its models, which it routes by its own
// routing, set in under it
@@ -2247,7 +2280,7 @@ function routingPage(part) {
let run = [];
const flush = () => {
if (run.length >= FOLD_AT) {
- const w = rows.get(run[0]).w, f = foldNode(foldKey(w), w), acct = w.kind === "account";
+ const w = rows.get(run[0]).w, f = foldNode(foldKey(w, rows.get(run[0]).path), w), acct = w.kind === "account";
f.ids = run;
shut(f, isOpen(f.pk, acct && run.length < LONG),
acct ? "Fold these accounts into one row" : "Fold these keys into one row", acct ? "Show each account" : "Show each key");
@@ -2257,19 +2290,19 @@ function routingPage(part) {
};
for (const id of ids) {
const w = rows.get(id).w;
- if (folding(w) && run.length && foldKey(rows.get(run[0]).w) === foldKey(w)) run.push(id);
+ if (folding(w) && run.length && foldKey(rows.get(run[0]).w, rows.get(run[0]).path) === foldKey(w, rows.get(id).path)) run.push(id);
else { flush(); if (folding(w)) run = [id]; }
}
flush();
// how many each group in the group routes to, which folds it when LONG
const under = new Map();
for (const id of ids) {
- const via = rows.get(id).w.via || [];
+ const via = rows.get(id).path;
for (let d = 1; d <= via.length; d++) { const k = via.slice(0, d).join(">"); under.set(k, (under.get(k) || 0) + 1); }
}
const els = [], want = new Set(), infos = rs.flatMap((r) => r.group?.subs || []);
for (const id of ids) {
- const row = rows.get(id), via = row.w.via || [], f = foldOf.get(id);
+ const row = rows.get(id), via = row.path, f = foldOf.get(id);
row.fold = f ? f.key : null;
const depth = String(via.length + (f ? 1 : 0));
if (row.li.style.getPropertyValue("--depth") !== depth) row.li.style.setProperty("--depth", depth);
@@ -2279,8 +2312,12 @@ function routingPage(part) {
const key = via.slice(0, d + 1).join(">");
if (!want.has(key)) {
want.add(key);
- const s = subNode(key, infos.find((x) => x.id === via[d]) || { id: via[d], name: via[d] }, d);
- shut(s, isOpen(s.pk, under.get(key) < LONG), "Fold this group into one row", "Show what this group routes to");
+ const way = !d && ways?.get(via[0]);
+ const s = subNode(key, way || infos.find((x) => x.id === via[d]) || { id: via[d], name: via[d] }, d);
+ // a route's heading starts open, whatever its length: a second
+ // agent coming shouldn't fold the first's rows away
+ if (way) shut(s, isOpen(s.pk, true), "Fold this route into one row", "Show where this route goes");
+ else shut(s, isOpen(s.pk, under.get(key) < LONG), "Fold this group into one row", "Show what this group routes to");
els.push(s.li);
}
// folded: what it routes to is its heading's
diff --git a/internal/gui/assets/plugins/routing/i18n.js b/internal/gui/assets/plugins/routing/i18n.js
index f12ffa05c..3964cef6f 100644
--- a/internal/gui/assets/plugins/routing/i18n.js
+++ b/internal/gui/assets/plugins/routing/i18n.js
@@ -54,6 +54,9 @@ magpie.strings({
"Fold these accounts into one row": "把这些账号合并成一行",
"Show what this group routes to": "展开这个组路由到的每一项",
"Fold this group into one row": "把这个组折叠成一行",
+ "Sent by {agents}": "{agents} 在发往这里",
+ "Fold this route into one row": "把这条路由折叠成一行",
+ "Show where this route goes": "显示这条路由发往哪里",
"Its week was used up, so one of {account}'s Codex resets was used by itself first.": "本周额度已用完,已先自动使用 {account} 的一张 Codex 重置卡。",
"{who} answered {status}: its week is used up and nobody else could take the request, so one of {account}'s Codex resets was used by itself and the request is asked again, before any of the reply reaches {agent}.": "{who} 返回 {status}:本周额度已用完且无其他账号可接手,已自动使用 {account} 的一张 Codex 重置卡并重发请求,{agent} 尚未收到任何回复。",
"held: its allowance used up, set not to spend credits": "额度已用尽,且设为不使用积分",
@@ -648,6 +651,9 @@ magpie.strings({
"Fold these accounts into one row": "把這些帳號合併成一列",
"Show what this group routes to": "展開這個組路由到的每一項",
"Fold this group into one row": "把這個組摺疊成一列",
+ "Sent by {agents}": "{agents} 正發往這裡",
+ "Fold this route into one row": "把這條路由摺疊成一列",
+ "Show where this route goes": "顯示這條路由發往哪裡",
"Its week was used up, so one of {account}'s Codex resets was used by itself first.": "本週額度已用完,已先自動使用 {account} 的一張 Codex 重置卡。",
"{who} answered {status}: its week is used up and nobody else could take the request, so one of {account}'s Codex resets was used by itself and the request is asked again, before any of the reply reaches {agent}.": "{who} 返回 {status}:本週額度已用完且無其他帳號可接手,已自動使用 {account} 的一張 Codex 重置卡並重發請求,{agent} 尚未收到任何回覆。",
"held: its allowance used up, set not to spend credits": "額度已用盡,且設為不使用積分",
@@ -1220,6 +1226,9 @@ magpie.strings({
"Fold these accounts into one row": "これらのアカウントを 1 行にまとめる",
"Show what this group routes to": "このグループのルーティング先を表示",
"Fold this group into one row": "このグループを 1 行に折りたたむ",
+ "Sent by {agents}": "{agents} が送信中",
+ "Fold this route into one row": "このルートを 1 行に折りたたむ",
+ "Show where this route goes": "このルートの送信先を表示",
"Its week was used up, so one of {account}'s Codex resets was used by itself first.": "週の枠を使い切ったため、先に {account} の Codex リセットを1回自動で使用しました。",
"{who} answered {status}: its week is used up and nobody else could take the request, so one of {account}'s Codex resets was used by itself and the request is asked again, before any of the reply reaches {agent}.": "{who} が {status} を返しました:週の枠を使い切り、他にリクエストを受けられるものがなかったため、{account} の Codex リセットを1回自動で使用し、応答が {agent} に届く前にリクエストを再送しました。",
"held: its allowance used up, set not to spend credits": "枠を使い切り、クレジット不使用のため停止中",
@@ -1804,6 +1813,9 @@ magpie.strings({
"Fold these accounts into one row": "Diese Konten in einer Zeile zusammenfassen",
"Show what this group routes to": "Zeigen, wohin diese Gruppe leitet",
"Fold this group into one row": "Diese Gruppe in einer Zeile zusammenfassen",
+ "Sent by {agents}": "Gesendet von {agents}",
+ "Fold this route into one row": "Diese Route in einer Zeile zusammenfassen",
+ "Show where this route goes": "Zeigen, wohin diese Route geht",
"Its week was used up, so one of {account}'s Codex resets was used by itself first.": "Die Woche war aufgebraucht, daher wurde zuerst automatisch einer der Codex-Resets von {account} eingelöst.",
"{who} answered {status}: its week is used up and nobody else could take the request, so one of {account}'s Codex resets was used by itself and the request is asked again, before any of the reply reaches {agent}.": "{who} antwortete {status}: Die Woche ist aufgebraucht und kein anderes Konto konnte die Anfrage übernehmen, daher wurde automatisch einer der Codex-Resets von {account} eingelöst und die Anfrage erneut gestellt, bevor ein Teil der Antwort {agent} erreicht.",
"held: its allowance used up, set not to spend credits": "angehalten: Kontingent aufgebraucht, keine Credits freigegeben",
diff --git a/internal/gui/assets/plugins/routing/routing.css b/internal/gui/assets/plugins/routing/routing.css
index 254aa5b67..fa0e54bf5 100644
--- a/internal/gui/assets/plugins/routing/routing.css
+++ b/internal/gui/assets/plugins/routing/routing.css
@@ -76,7 +76,9 @@
it routes to together on a line of its own */
.rt-accts li.rt-sub { flex-wrap: wrap; row-gap: 4px; cursor: pointer; user-select: none; }
.rt-accts li.rt-sub .n { white-space: nowrap; }
-.rt-accts li.rt-sub .n:empty, .rt-accts li.rt-sub em:empty { display: none; }
+.rt-accts li.rt-sub .n:empty, .rt-accts li.rt-sub em:empty, .rt-accts li.rt-sub i:empty { display: none; }
+/* a route's heading, when more than one route is on the stage: its provider's logo */
+.rt-accts li.rt-sub > .ic { flex: none; }
.rt-accts li.rt-sub .chev { display: inline-flex; color: var(--muted); transition: transform .2s; }
.rt-accts li.rt-sub .chev svg { color: inherit; }
.rt-accts li.rt-sub:hover .chev { color: var(--fg); }
diff --git a/internal/gui/tests/routing-stage-routes.test.cjs b/internal/gui/tests/routing-stage-routes.test.cjs
new file mode 100644
index 000000000..a1712fdb2
--- /dev/null
+++ b/internal/gui/tests/routing-stage-routes.test.cjs
@@ -0,0 +1,138 @@
+// Run with Node's test runner and Playwright on the module path; see README.md.
+// The Routing stage holds every agent sending at once, and each one's
+// route's accounts and keys. Several agents on several routes were drawn
+// in one column under a header naming one route alone (hoobnn on Discord:
+// "DeepSeek-V4.1-Flash · 路由组 · 启用 3 个 · 3 个 Agent 同时在发" over five
+// rows, two of them Pi's zcode and OpenCode's Kimi Code, "两个没有使用的路
+// 由"): nothing said those two were other agents' routes, not the group's.
+// With more than one route on the stage, each route's rows hang under a
+// heading naming it (the group, or the provider and the model asked for)
+// and who sends to it; the group's heading has its three members and no
+// other. One route alone has no heading, as before. Every row's tooltip is
+// its own id. At 420px nothing spills. Every language, both engines; 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(__dirname, "../assets");
+const iso = (s = 0) => new Date(Date.now() - s * 1e3).toISOString();
+// Pi on a Z.ai team account, OpenCode on Kimi Code's one key: neither in the group
+const zai = { id: "zcode@[email protected]", provider: "zcode", name: "ZCode", kind: "account", who: "[email protected]", plan: "Team Pro", model: "GLM-5.3-Flash", routing: "" };
+const kimi = { id: "kimi-code-cn", provider: "kimi-code-cn", name: "Kimi Code (China)", kind: "provider", model: "k3.1-pro", routing: "" };
+// DeepSeek Harness on the group magpie found for deepseek-v4.1-flash, in order
+const ark = { id: "volcengine", provider: "volcengine", name: "Volcengine Ark", kind: "provider", model: "deepseek-v4.1-flash", routing: "" };
+const ent = { id: "dfm@[email protected]", provider: "dfm", name: "DF Model", kind: "account", who: "[email protected]", plan: "Enterprise", model: "dfmodel", routing: "", known: true, used: 0 };
+const qwen = { id: "qwen-cn", provider: "qwen-cn", name: "Qwen (China)", kind: "provider", model: "vanchin/deepseek-v4.1-flash", routing: "" };
+const group = { id: "deepseek-v4.1-flash", ref: "auto/deepseek-v4.1-flash", name: "DeepSeek-V4.1-Flash", routing: "order", auto: true,
+ members: ["volcengine/deepseek-v4.1-flash", "dfm/dfmodel", "qwen-cn/vanchin/deepseek-v4.1-flash"] };
+const live = (w) => [{ id: w.id, model: w.model, start: iso(1), done: false }];
+const route = (id, agent, model, provider, order, extra = {}) => ({ id, seq: id, time: iso(2), agent, model, provider, order, tries: live(order[0]), done: false, ...extra });
+const pi = (id) => route(id, "pi", "zcode/GLM-5.3-Flash", "zcode", [zai]);
+const dsh = (id) => route(id, "dsh", "auto/deepseek-v4.1-flash", "volcengine", [ark, ent, qwen], { group });
+const oc = (id) => route(id, "opencode", "kimi-code-cn/k3.1-pro", "kimi-code-cn", [kimi]);
+
+function serve(lang, feed) {
+ 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: [["pi", "Pi"], ["dsh", "DeepSeek Harness"], ["opencode", "OpenCode"]].map(([id, name]) => ({ id, name, path: `/test/${id}.json`, fields: [] })), profiles: [], settings: { lang, theme: "light" } });
+ if (url.pathname === "/api/gateway/trace") {
+ if (url.searchParams.get("wait")) {
+ if (feed.queued.length) return json(feed.queued.shift());
+ feed.pending.push(request);
+ return;
+ }
+ return json({ mine: true, now: iso(), seq: 1, totals: { requests: 1, rerouted: 0, errors: 0 }, routes: [dsh(1)] });
+ }
+ 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 });
+ };
+}
+
+// what the stage lists, top to bottom: a heading ("§" its name, its
+// model or group, how many it routes to) or a row (its tooltip's first
+// line, which is its id, and how far in it hangs)
+const stage = (page) => page.locator(".rt-accts > li").evaluateAll((lis) => lis.map((li) => li.classList.contains("rt-sub")
+ ? "§" + li.querySelector("b").textContent + " " + li.querySelector("code").textContent
+ : (li.title || "").split("\n")[0] + "@" + (li.style.getPropertyValue("--depth") || "0")));
+
+const spills = (page, sel) => page.locator(sel).evaluateAll((els) => els.filter((e) => e.scrollWidth > e.clientWidth + 1 || e.getBoundingClientRect().right > document.documentElement.clientWidth)
+ .map((e) => e.className + ": " + e.textContent.trim().slice(0, 60)));
+
+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: three agents on three routes, each route's rows under its own heading`, 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" });
+ page.setDefaultTimeout(6000);
+ const errors = [];
+ page.on("pageerror", (e) => errors.push(e.message));
+ const feed = { pending: [], queued: [], seq: 1 };
+ await page.route("**/*", serve(lang, feed));
+ const send = (...routes) => {
+ const d = { mine: true, now: iso(), seq: ++feed.seq, totals: { requests: feed.seq }, routes };
+ const r = feed.pending.shift();
+ if (r) r.fulfill({ json: d }); else feed.queued.push(d);
+ };
+ const say = (key, vars = {}) => page.evaluate(([lang, key, vars]) => {
+ const s = (lang !== "en" && I18N[lang]?.[key]) || key;
+ return s.replace(/\{(\w+)\}/g, (_, k) => vars[k] ?? `{${k}}`);
+ }, [lang, key, vars]);
+ await page.goto("http://magpie.test/?view=routing");
+ await page.locator(".rt-accts > li[title]").nth(2).waitFor();
+
+ // DeepSeek Harness alone: its group's three, no heading
+ assert.deepEqual(await stage(page), ["volcengine@0", "dfm@[email protected]@0", "qwen-cn@0"]);
+
+ // Pi and OpenCode start sending to routes of their own, and
+ // DeepSeek Harness sends again: the stage of the report
+ send(pi(2), oc(3));
+ send(dsh(4));
+ await page.waitForFunction(() => document.querySelectorAll(".rt-accts > li.rt-sub").length === 3);
+ await page.waitForFunction(() => document.querySelectorAll(".rt-srcs .rt-node").length === 3);
+ // the header still tells of the latest request, the group's
+ await page.waitForFunction(() => document.querySelector(".rt-what b")?.textContent === "DeepSeek-V4.1-Flash");
+ assert.deepEqual(await stage(page), [
+ "§DeepSeek-V4.1-Flash auto/deepseek-v4.1-flash", "volcengine@1", "dfm@[email protected]@1", "qwen-cn@1",
+ "§ZCode zcode/GLM-5.3-Flash", "zcode@[email protected]@1",
+ "§Kimi Code (China) kimi-code-cn/k3.1-pro", "kimi-code-cn@1",
+ ]);
+ // each heading says who sends to it, and how the group routes
+ const heads = page.locator(".rt-accts > li.rt-sub");
+ assert.equal((await heads.nth(0).getAttribute("title")).split("\n")[0], await say("Sent by {agents}", { agents: "DeepSeek Harness" }));
+ assert.equal((await heads.nth(1).getAttribute("title")).split("\n")[0], await say("Sent by {agents}", { agents: "Pi" }));
+ assert.equal((await heads.nth(2).getAttribute("title")).split("\n")[0], await say("Sent by {agents}", { agents: "OpenCode" }));
+ assert.equal(await heads.nth(0).locator("i").textContent(), await say("In order"));
+ // a provider with one key routes nothing: its heading says no way
+ assert.equal(await heads.nth(2).locator("i").textContent(), "");
+ // each heading has a wire from magpie, and lights while its own answers
+ assert.equal(await page.locator(".rt-wires path[d]").count(), 3 + 3 + 5);
+ for (let i = 0; i < 3; i++) assert.equal(await heads.nth(i).evaluate((li) => li.classList.contains("on")), true);
+
+ // the pointer on Kimi Code's row is on Kimi Code's row
+ const k = page.locator(".rt-accts > li", { has: page.locator(".who", { hasText: /^Kimi Code \(China\)$/ }) });
+ // (tall enough that nothing scrolls: a scroll under the pointer is
+ // the test's, not the page's)
+ await page.setViewportSize({ width, height: 1600 });
+ await page.waitForFunction(() => document.querySelector(".rt-accts > li:last-child").getBoundingClientRect().bottom < innerHeight);
+ await k.hover();
+ await page.waitForFunction(() => document.querySelector(".rt-accts > li:hover")?.title.split("\n")[0] === "kimi-code-cn");
+
+ assert.deepEqual(await spills(page, ".rt-accts > li"), []);
+ assert.deepEqual(errors, []);
+ });
+ }
+ }
+}