Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
sessions: every agent in the Agent menu and in Continue in shows its icon
yetone117937b8d9a0
diff --git a/internal/gui/assets/plugins/sessions/client.js b/internal/gui/assets/plugins/sessions/client.jsindex eadc160e7..3d861a770 100644--- a/internal/gui/assets/plugins/sessions/client.js+++ b/internal/gui/assets/plugins/sessions/client.js@@ -359,11 +359,12 @@ magpie.plugin("sessions", (ctx) => {pick.onclick = (e) => {e.stopPropagation();if (pick.classList.contains("open")) return closeProtoMenu();- const opts = data.agents.map((x) => ({ v: x.agent, name: x.name, note: String(x.count), literalName: true }));+ const opts = data.agents.map((x) => ({ v: x.agent, name: x.name, icon: x.icon, note: String(x.count), literalName: true }));openProtoMenu(pick, opts, data.agent, (name) => {pick.focus({ preventScroll: true });chooseAgent(name);}, "Agent", "sm-agent-menu");+ iconItems(opts);};}wrap.append(tabs, pick);@@ -1081,6 +1082,8 @@ magpie.plugin("sessions", (ctx) => {// agentOf is an agent as the page names it: of those with sessions, else// by its id+ // iconItems gives each agent in the menu just opened its icon, as its button has+ const iconItems = (opts) => document.querySelectorAll(".proto-menu .pm-item").forEach((b, i) => opts[i]?.icon && b.firstChild.after(icon(opts[i].icon)));const agentOf = (id) => data?.agents.find((x) => x.agent === id) || { agent: id, name: id, icon: id };// carryPick is the other agents that can carry a session on from its@@ -1098,9 +1101,9 @@ magpie.plugin("sessions", (ctx) => {if (b.classList.contains("open")) return closeProtoMenu();const opts = [];for (const c of s.carry) {- const name = agentOf(c.agent).name;- opts.push({ v: "copy\x01" + c.agent, name, literalName: true, note: "Copy the command", title: c.command });- if (data.terminal) opts.push({ v: "term\x01" + c.agent, name, literalName: true, note: "Open in session terminal", title: c.command });+ const { name, icon: ic } = agentOf(c.agent);+ opts.push({ v: "copy\x01" + c.agent, name, icon: ic, literalName: true, note: "Copy the command", title: c.command });+ if (data.terminal) opts.push({ v: "term\x01" + c.agent, name, icon: ic, literalName: true, note: "Open in session terminal", title: c.command });}openProtoMenu(b, opts, "", (v) => {b.focus({ preventScroll: true });@@ -1110,6 +1113,7 @@ magpie.plugin("sessions", (ctx) => {if (how === "copy") copy(c.command, t("Command"));else api("sessions/terminal", { agent: s.agent, id: s.id, in: to }).then(() => status(t("Opening in session terminal"), "ok"), (err) => status(err.message, "err"));}, "Continue in another agent", "sess-carry-menu", "right");+ iconItems(opts);};return b;}diff --git a/internal/gui/assets/plugins/sessions/sessions.css b/internal/gui/assets/plugins/sessions/sessions.cssindex 86979dee3..df45cf950 100644--- a/internal/gui/assets/plugins/sessions/sessions.css+++ b/internal/gui/assets/plugins/sessions/sessions.css@@ -12,6 +12,7 @@.sm-agent-pick .ic { width: 13px; height: 13px; flex: none; }.sm-agent-pick em, .sm-agents em, .sm-trash-btn em { font-style: normal; font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }.pop.proto-menu.sm-agent-menu { width: min(280px, calc(100vw - 16px)); max-height: min(360px, 70vh); overflow-y: auto; background: var(--card); }+.sm-agent-menu .pm-item { align-items: center; }.sm-agent-menu .pm-words { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: 1; }.sm-agent-menu .pm-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.sm-agent-menu .pm-note { flex: none; font-variant-numeric: tabular-nums; }diff --git a/internal/gui/tests/sessions-talk.test.cjs b/internal/gui/tests/sessions-talk.test.cjsindex e831b337c..efb81d2c4 100644--- a/internal/gui/tests/sessions-talk.test.cjs+++ b/internal/gui/tests/sessions-talk.test.cjs@@ -127,6 +127,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",await menu.waitFor();assert.equal((await menu.locator(".pm-head").textContent()).trim(), w.head);assert.deepEqual(await menu.locator(".pm-item .pm-name").allTextContents(), ["omp", "omp"]);+ assert.deepEqual(await menu.locator(".pm-item > .ic").evaluateAll((l) => l.map((e) => e.dataset.icon)), ["omp", "omp"], "each agent to continue in shows its icon");assert.deepEqual(await menu.locator(".pm-item .pm-note").allTextContents(), [w.copyNote, w.termNote]);assert.equal(await page.locator("select").count(), 0, "no native select");assert.equal(await carry.getAttribute("aria-expanded"), "true");diff --git a/internal/gui/tests/sessions-toolbar.test.cjs b/internal/gui/tests/sessions-toolbar.test.cjsindex 64c16dc21..883554d13 100644--- a/internal/gui/tests/sessions-toolbar.test.cjs+++ b/internal/gui/tests/sessions-toolbar.test.cjs@@ -115,6 +115,14 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",await menu.waitFor();await menu.evaluate((e) => Promise.all(e.getAnimations().map((a) => a.finished.catch(() => {}))));assert.equal(await menu.getByRole("menuitemradio").count(), agents.length);+ // each agent in the menu shows its icon, as the picker does, level with its name+ const marks = await menu.locator(".pm-item").evaluateAll((items) => items.map((b) => {+ const ic = b.querySelector(":scope > .ic"), n = b.querySelector(".pm-name");+ const i = ic?.getBoundingClientRect(), r = n.getBoundingClientRect();+ return { icon: ic?.dataset.icon, w: i?.width, mid: i ? Math.abs(i.top + i.height / 2 - (r.top + r.height / 2)) : 99, before: i ? i.right <= r.left : false };+ }));+ assert.deepEqual(marks.map((m) => m.icon), agents.map((a) => a.icon), "every agent in the menu has its icon");+ assert(marks.every((m) => m.w === 16 && m.mid <= 1 && m.before), `icons sit 16px wide, level with and before the name: ${JSON.stringify(marks)}`);assert.equal(await picker.getAttribute("aria-expanded"), "true");const mb = await menu.boundingBox();assert(mb.x >= 0 && mb.x + mb.width <= 320, "the open menu fits a narrow window");