Skip to content

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

agents: Install another agent says Plugins has more agents, and opens them

yetonee8e9245ecf8d
diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css
index 343b575b1..2ee34e8ff 100644
--- a/internal/gui/assets/app.css
+++ b/internal/gui/assets/app.css
@@ -720,8 +720,17 @@ body.window .row.agent .who .ag-cli { flex: 0 1 auto; overflow: hidden; }
.ag-install-cmd { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ag-install-via { flex: 0 0 84px; font-size: 11.5px; color: var(--muted); }
.ag-install-cmd code { flex: 1 1 auto; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: 11.5px; padding: 2px 6px; border-radius: 5px; background: var(--pill); color: var(--fg-2); }
+/* the agents plugins add: one row, its way to Plugins */
+.ag-install-plugins { width: 100%; align-items: center; font: inherit; color: var(--accent); text-align: left; cursor: pointer; transition: background .2s; }
+.ag-install-plugins:hover { background: var(--accent-soft); }
+.ag-install-plugins:focus-visible { outline: 1.5px solid var(--fg-2); outline-offset: 1px; }
+.ag-install-plugins .ag-install-who { flex: none; padding-top: 0; }
+.ag-install-plugins .puzzle { flex: none; width: 18px; height: 18px; display: grid; place-items: center; }
+.ag-install-pnames { flex: 1 1 auto; min-width: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.ag-install-plugins > .chev { flex: none; display: inline-flex; opacity: .7; }
@media (max-width: 600px) {
.ag-install-row { flex-direction: column; gap: 6px; }
+ .ag-install-plugins { flex-direction: row; }
.ag-install-who { flex: none; }
}
/* the panel's name column has no room for it: there it is a badge on the
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js
index 14e339f91..a9ae5e934 100644
--- a/internal/gui/assets/app.js
+++ b/internal/gui/assets/app.js
@@ -2548,8 +2548,13 @@ function goneSaid(a) {
let installsOpen = null; // null: as the list has it (open with no agents)
const VIA = { script: "Installer", powershell: "PowerShell", brew: "Homebrew", npm: "npm" };
+let pluginAgents = []; // the names of the agents a suggested plugin adds, not installed
+
async function loadInstalls() {
if (mode === "panel") return;
+ // the plugins' agents come from the market, which may be fetched: the
+ // commands aren't held for them
+ api("plugins/agents").then((r) => { pluginAgents = Array.isArray(r) ? r : []; paintInstalls(); }, () => {});
let r;
try { r = await api("agents/install"); } catch { return; } // it just isn't shown
installInfo = Array.isArray(r) ? r : [];
@@ -2586,7 +2591,7 @@ function paintInstalls() {
// one listed above by its settings alone, its CLI gone (#843), is
// offered again too
const items = installInfo.filter((x) => x.missing || !here.has(x.id));
- if (!items.length) { box?.remove(); return; }
+ if (!items.length && !pluginAgents.length) { box?.remove(); return; }
if (!box) {
box = el("section", "ag-install");
box.id = "agentsInstall";
@@ -2597,7 +2602,7 @@ function paintInstalls() {
head.type = "button";
head.setAttribute("aria-expanded", String(open));
head.dataset.unrolls = ""; // it stays put, and its commands open beneath it
- head.append(el("span", "", t("Install another agent ({n})", { n: items.length })), el("span", "chev", svg(CHEV, 10, 1.8)));
+ head.append(el("span", "", t("Install another agent ({n})", { n: items.length + pluginAgents.length })), el("span", "chev", svg(CHEV, 10, 1.8)));
head.onclick = (e) => {
e.stopPropagation();
installsOpen = !open;
@@ -2606,7 +2611,7 @@ function paintInstalls() {
};
const parts = [head];
if (open) {
- parts.push(el("p", "ag-install-note", installNote(items)));
+ if (items.length) parts.push(el("p", "ag-install-note", installNote(items)));
for (const x of items) {
const r = el("div", "ag-install-row");
r.dataset.id = x.id;
@@ -2629,10 +2634,35 @@ function paintInstalls() {
r.append(who, cmds);
parts.push(r);
}
+ // the agents plugins add, installed from Plugins as every plugin is
+ if (pluginAgents.length) parts.push(pluginAgentsRow());
}
box.replaceChildren(...parts);
}
+function pluginAgentsRow() {
+ const r = el("button", "ag-install-row ag-install-plugins");
+ r.type = "button";
+ const who = el("div", "ag-install-who");
+ const ic = el("span", "puzzle");
+ ic.append(svg(PUZZLE, 15, 1.4));
+ const name = el("span", "ag-install-name");
+ name.append(el("b", "", t("More in Plugins")));
+ who.append(ic, name);
+ const names = el("span", "ag-install-pnames", pluginAgents.join(t(", ")));
+ r.append(who, names, el("span", "chev", svg(CHEV_R, 11, 1.6)));
+ r.title = t("Agents magpie has no setup of its own for: install a plugin for one in the Plugins tab, and it is listed here");
+ r.onclick = (e) => openPluginAgents(e);
+ return r;
+}
+
+// openPluginAgents: the Plugins tab, at its Agents
+async function openPluginAgents(e) {
+ if (mode !== "window") { api("window/main?view=plugins", {}).catch(() => {}); return; }
+ if (!await show("plugins")) return;
+ window.pluginAgentsTo?.(e);
+}
+
// ---------- the agents' order, and the ones put away ----------
// Kept in magpie's own settings (agentOrder, agentsHidden, agentsShown),
// never in an agent's files. An agent the order doesn't name — one
diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js
index 6d0a1ab9e..9895488db 100644
--- a/internal/gui/assets/i18n.js
+++ b/internal/gui/assets/i18n.js
@@ -3814,6 +3814,7 @@ const I18N = {
"Couldn't read the folder's README: {error}": "无法读取该文件夹的 README:{error}",
"More in Plugins": "插件中还有更多",
"Subscriptions magpie doesn't sign in to itself: install a plugin for one in the Plugins tab": "magpie 未内置的订阅:在「插件」页安装对应插件即可",
+ "Agents magpie has no setup of its own for: install a plugin for one in the Plugins tab, and it is listed here": "magpie 未内置的 Agent:在「插件」页安装对应插件,它就会出现在这里",
"look for a plugin": "找找插件",
", or ": ",或",
"credits": "积分",
@@ -7830,6 +7831,7 @@ const I18N = {
"Couldn't read the folder's README: {error}": "無法讀取該資料夾的 README:{error}",
"More in Plugins": "外掛中還有更多",
"Subscriptions magpie doesn't sign in to itself: install a plugin for one in the Plugins tab": "magpie 未內建的訂閱:在「外掛」頁安裝對應外掛即可",
+ "Agents magpie has no setup of its own for: install a plugin for one in the Plugins tab, and it is listed here": "magpie 未內建的 Agent:在「外掛」頁安裝對應外掛,它就會出現在這裡",
"look for a plugin": "找找外掛",
", or ": ",或",
"credits": "積分",
@@ -11868,6 +11870,7 @@ const I18N = {
"Couldn't read the folder's README: {error}": "フォルダの README を読めませんでした:{error}",
"More in Plugins": "プラグインにもっとあります",
"Subscriptions magpie doesn't sign in to itself: install a plugin for one in the Plugins tab": "magpie が自分ではサインインしないサブスクリプション:「プラグイン」タブで対応するプラグインをインストールしてください",
+ "Agents magpie has no setup of its own for: install a plugin for one in the Plugins tab, and it is listed here": "magpie に設定が組み込まれていないエージェント:「プラグイン」タブで対応するプラグインをインストールすると、ここに表示されます",
"look for a plugin": "プラグインを探す",
", or ": "、または",
"credits": "クレジット",
@@ -15919,6 +15922,7 @@ const I18N = {
"Couldn't read the folder's README: {error}": "README des Ordners konnte nicht gelesen werden: {error}",
"More in Plugins": "Mehr unter Erweiterungen",
"Subscriptions magpie doesn't sign in to itself: install a plugin for one in the Plugins tab": "Abos, bei denen sich magpie nicht selbst anmeldet: Installieren Sie dafür eine Erweiterung im Tab Erweiterungen",
+ "Agents magpie has no setup of its own for: install a plugin for one in the Plugins tab, and it is listed here": "Agents, für die magpie keine eigene Einrichtung hat: Installieren Sie dafür eine Erweiterung im Tab Erweiterungen, dann erscheint er hier",
"look for a plugin": "nach einer Erweiterung suchen",
", or ": ", oder ",
"credits": "Credits",
diff --git a/internal/gui/assets/plugins.js b/internal/gui/assets/plugins.js
index 2752396ad..cb1b7a10a 100644
--- a/internal/gui/assets/plugins.js
+++ b/internal/gui/assets/plugins.js
@@ -258,6 +258,20 @@
draw();
};
+ // pluginAgentsTo: Discover, at its Agents (the Agents page's More in
+ // Plugins). The scroll is the reader's click's, so it is made only while
+ // the click is fresh: Agents drawn later, the listings slow, is left
+ // where the page is.
+ let agentsFor = null; // the click that asked for Agents, till they are drawn
+ window.pluginAgentsTo = (ev) => {
+ query = "";
+ tab = "discover";
+ clearTimeout(searchTimer);
+ hits = null;
+ agentsFor = ev;
+ draw();
+ };
+
async function refresh() {
// a plugin installed, switched on or off, or removed brings its
// page's tab, or takes it, now: not on the Plugins page's next load
@@ -914,7 +928,8 @@
const pgs = ls.filter((l) => l.community && kindOf(l) === "pg");
if (ours.length) out.push(section(t("Subscriptions"), t("written for magpie, checked against its own sign-ins"), ours));
if (mws.length) out.push(section(t("Gateway middleware"), t("runs in magpie's gateway on what every agent sends and gets back, whichever provider serves it"), mws));
- if (ags.length) out.push(section(t("Agents"), t("agents magpie has no setup of its own for, connected to it as its own are"), ags));
+ const agSec = ags.length ? section(t("Agents"), t("agents magpie has no setup of its own for, connected to it as its own are"), ags) : null;
+ if (agSec) { agSec.classList.add("pm-agents"); out.push(agSec); }
if (tls.length) out.push(section(t("Tools for agents"), t("tools every agent can call, through magpie's MCP server"), tls));
if (pgs.length) out.push(section(t("Pages"), t("pages of their own in magpie's window, each shut off from the rest and reading only what it lists"), pgs));
if (gh.length) out.push(ghSection(gh));
@@ -922,6 +937,13 @@
else if (taggedErr && !tagged.length) out.push(ghFailed());
out.push(manual());
replaceKeeping(body, out);
+ if (agentsFor && agSec) {
+ // after the view is put back where the reader was, as showing it
+ // does; the section then is the one drawn last (npm's answers draw
+ // it again)
+ if (window.scrollOnPurpose?.(agentsFor)) requestAnimationFrame(() => { body.querySelector(".pm-agents")?.scrollIntoView({ block: "start" }); window.arrived?.(page); });
+ agentsFor = null;
+ }
return;
}
if (ls.length) out.push(section(t("Suggested"), "", ls));
diff --git a/internal/gui/core_budget_test.go b/internal/gui/core_budget_test.go
index b8874dce0..1eea1fed2 100644
--- a/internal/gui/core_budget_test.go
+++ b/internal/gui/core_budget_test.go
@@ -15,8 +15,8 @@ import (
// so a page can't quietly grow back into the core; a change that needs more
// raises them and says why in its commit.
const (
- appScriptBudget = 1_310_460 // app.js: 1,198,239 after Usage left (P2); 1,218,098 with the 10-15 fixes to pages still in the core; 1,232,466 with the provider editor's Advanced fold and every dialog holding its place, the core's own (10-16); 1,250,533 with the quota refresh kept through redraws, the core's own since the tray panel draws it too, plus 1.5% (#2397); 1,269,083 with Free first's option in the provider editor's ROUTINGS, which the Routing page reads too, plus 1.5%; 1,272,726 with the Providers page drawing its last list at once (#1519), the core's page, and the Routing trace's account names read without Object.entries (#1481), plus 1.5%; a dialog growing out of the row that opened it and folding back into it, the core's own since every page's dialogs open through it (10-20); Codex's and Claude Code's own settings moved from Settings into the agent's row on the Agents page, the core's own since the tray panel and the window both draw them (10-20); 1,314,432 with Settings › Privacy's record of what was masked (its summary, the records view and the local model's controls), which belongs to Settings, the core's own, plus 1.5%; 1,336,481 with a provider's Names & levels saying Provider in model names is Settings' and opening it there (joe), and Settings' Image recognition saying where a custom provider's model is marked (nexnull), both in the core's own pages, with no room added (10-23); 1,337,633 with Settings › Models › Replies' Intent classifier timeout (#2934, reyoung), Settings' own row, drawn by waitRow, which the Image generation timeout's row now shares, with no room added; 1,337,735 with the provider editor's link naming a partner's page by its own host (siteHost) instead of usemagpie.ai's /go link, the core's own editor, with no room added (10-23); 1,338,084 with Check in now saying what the press came to (claimed +credits, already today, not available yet) where it said "refreshed" (#3326), the check-in row the tray panel draws too, the core's own, with no room added (10-23); 1,338,929 with a new partner's tile keeping a small dot until it is opened, in the add sheet, the core's own, with no room added (10-23); 1,343,324 with the sidebar's open-page row marked by one shape that moves on a spring (navTopGo), the window's own shell, which every page sits beside, with no room added (10-23); 1,343,465 with a dialog kept centred while its content comes in, until it is pressed (holdModal, every page's dialogs), the core's own, with no room added (10-24); 1,317,486 with what masking did moved out to Insights › Masking (plugins/redact), the budget lowered to it (10-24); 1,321,336 with Codex's one subagent model, its card's square saying plainly what each choice does and a row with a name in its sheet, where two squares read alike (the owner), the Agents page's, which the tray panel draws too, the core's own, with no room added (10-24); 1,321,424 with Settings › Models' Image generation MCP server row beside Image recognition's (JonahFu on X), the two drawn by one helper (mcpRow), Settings' own, with no room added (10-25); 1,321,994 with a provider of the user's set never to rest for a limit (zoecats), the provider editor's Advanced row, the core's own editor, with no room added (10-25); 1,322,289 with Settings › Privacy's Keep a key's form under Mask secrets (Charles Cao on X), Settings' own row, with no room added (10-25); 1,322,537 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,323,401 with the tray panel drawing its last allowances at once and asking for them beside the state (#3160, #3134), the tray panel's, the core's own, and the 4 bytes 84c50f032 added, with no room added (10-25); 1,326,105 with many releases' notes merged into one list by kind, each line with its version (the owner), in the update sheet and What's new, with no room added (10-25); 1,321,319 with Settings › Observability moved out to its plugin (plugins/otel/page.js) and its Langfuse setup there (an X user), the budget lowered to it (10-26); a quota card whose window is used but names no reset no longer saying "Not used yet" (windy on Discord) raised it to 1,321,347, and back to 1,321,319 with Settings' model pickers sharing one row helper (modelOpt) where six kept their own copy, no raise (10-26); 1,325,845 with every slow page's skeletons getting magpie's bird hopping bar to bar (skelBird, the owner after the Plugins page's README), one bird for the window over whatever page or dialog is loading, the core's own, with no room added (10-26); 1,310,129 with Settings › Network and sharing's gateway rows (its port, bare ids, local network, allowed addresses, web pages) moved out to the gateway plugin (plugins/gateway/settings.js), the budget lowered to it (10-27); 1,310,269 with Test models naming the first model that failed and its error in the status line, where it said only how many (ysm119 on Discord), the provider editor's, the core's own, with no room added (10-27); 1,310,460 with Settings › About's Website row linking usemagpie.ai (the owner), Settings' own row, with no room added (10-27); 1,309,669 with a pool's Stop at the caps and Check usage near a cap ticks under a provider's accounts (plugins#349), the core's own editor, its account rows' Remove and add rows each drawn by one helper (forgetOf, addRow), with no room added (10-28)
- coreScriptBudget = 1_528_076 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it; 1,472,589 with the dialog that grows out of its row and the agents' own settings in their rows, on main's 10-20 core work (the Providers page's last list, the Routing trace's names), plus 1.5% (10-20); 1,506,192 with Settings › Privacy's record of what was masked, plus 1.5%; 1,529,393 with the Intent classifier timeout row (#2934), with no room added; 1,529,495 with the editor's partner link host, with no room added; 1,529,844 with Check in now's press summary (#3326), with no room added; 1,530,689 with the new partner tile's dot, with no room added; 1,535,084 with the sidebar's spring, with no room added; 1,549,478 with the context window card's map (tiles by tokens, the default look, the block grid a switch away) and its text view showing an inline image, in context.js, which the Routing page draws as well as Usage, so the core's own, with no room added (10-24); 1,550,768 with a usage card's refresh opening after its text (#840's card, which the tray panel draws too), the Add key spinner, and a dialog kept centred while its content comes in, with no room added (10-24); 1,524,789 with what masking did moved out to Insights › Masking, lowered to it; 1,528,525 with Codex's one subagent model, with no room added (10-24); 1,528,972 with the Image generation MCP server row (JonahFu on X), with no room added (10-25); 1,529,542 with the limit-rest row (zoecats), with no room added (10-25); 1,529,837 with Keep a key's form (Charles Cao on X), with no room added (10-25); 1,530,050 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,530,631 with a plugin's page growing to its README on the dialog's spring instead of in one jump (the owner), the Plugins page's, in plugins.js, with no room added (10-25); 1,533,445 with the context map counting its tokens on as a live request grows, a tile pointed at keeping its tip, a tool's gathered results saying how many and the small files their folder (the owner, after flohoeller's map on X), in context.js, which the Routing page draws as well as Usage, and the 4 bytes 84c50f032 added to app.js (Settings' Version row) without a raise, with no room added (10-25); 1,534,312 with the tray panel's last allowances drawn at once (#3160, #3134), with no room added (10-25); 1,537,016 with many releases' notes merged into one list by kind (the owner), in app.js, with no room added (10-25); 1,542,244 with a plugin's README loading under magpie's bird bouncing down its lines instead of pulsing bars (the owner), the Plugins page's, in plugins.js, with no room added (10-26); 1,542,418 with a page plugin's sidebar tab coming and going as it is installed, switched on or off, or removed, instead of on the Plugins page's next load (the owner), in plugins.js, with no room added (10-26); 1,537,645 with Settings › Observability moved out to plugins/otel, lowered to it (10-26); 1,537,673 with a used window with no reset not "Not used yet" (windy on Discord), and back to 1,537,645 with Settings' model pickers sharing modelOpt (10-26); 1,541,967 with every slow page's skeletons getting magpie's bird (skelBird, the owner), in app.js, the README's bird sharing its drawing and styles, with no room added (10-26); 1,526,251 with Settings' gateway rows moved out to plugins/gateway/settings.js, lowered to it (10-27); 1,526,391 with Test models naming the first failed model and its error (ysm119 on Discord), in app.js, with no room added (10-27); 1,526,556 with About's Website row (the owner), in app.js, with no room added (10-27); 1,526,500 with a pool's cap ticks (plugins#349), in app.js, with no room added (10-28); 1,527,245 with About's Open-source licenses row and dialog (the owner), in app.js, with no room added (10-28); 1,528,076 with the Partners heading's light (the owner), in app.js, with no room added (10-28)
+ appScriptBudget = 1_311_681 // app.js: 1,198,239 after Usage left (P2); 1,218,098 with the 10-15 fixes to pages still in the core; 1,232,466 with the provider editor's Advanced fold and every dialog holding its place, the core's own (10-16); 1,250,533 with the quota refresh kept through redraws, the core's own since the tray panel draws it too, plus 1.5% (#2397); 1,269,083 with Free first's option in the provider editor's ROUTINGS, which the Routing page reads too, plus 1.5%; 1,272,726 with the Providers page drawing its last list at once (#1519), the core's page, and the Routing trace's account names read without Object.entries (#1481), plus 1.5%; a dialog growing out of the row that opened it and folding back into it, the core's own since every page's dialogs open through it (10-20); Codex's and Claude Code's own settings moved from Settings into the agent's row on the Agents page, the core's own since the tray panel and the window both draw them (10-20); 1,314,432 with Settings › Privacy's record of what was masked (its summary, the records view and the local model's controls), which belongs to Settings, the core's own, plus 1.5%; 1,336,481 with a provider's Names & levels saying Provider in model names is Settings' and opening it there (joe), and Settings' Image recognition saying where a custom provider's model is marked (nexnull), both in the core's own pages, with no room added (10-23); 1,337,633 with Settings › Models › Replies' Intent classifier timeout (#2934, reyoung), Settings' own row, drawn by waitRow, which the Image generation timeout's row now shares, with no room added; 1,337,735 with the provider editor's link naming a partner's page by its own host (siteHost) instead of usemagpie.ai's /go link, the core's own editor, with no room added (10-23); 1,338,084 with Check in now saying what the press came to (claimed +credits, already today, not available yet) where it said "refreshed" (#3326), the check-in row the tray panel draws too, the core's own, with no room added (10-23); 1,338,929 with a new partner's tile keeping a small dot until it is opened, in the add sheet, the core's own, with no room added (10-23); 1,343,324 with the sidebar's open-page row marked by one shape that moves on a spring (navTopGo), the window's own shell, which every page sits beside, with no room added (10-23); 1,343,465 with a dialog kept centred while its content comes in, until it is pressed (holdModal, every page's dialogs), the core's own, with no room added (10-24); 1,317,486 with what masking did moved out to Insights › Masking (plugins/redact), the budget lowered to it (10-24); 1,321,336 with Codex's one subagent model, its card's square saying plainly what each choice does and a row with a name in its sheet, where two squares read alike (the owner), the Agents page's, which the tray panel draws too, the core's own, with no room added (10-24); 1,321,424 with Settings › Models' Image generation MCP server row beside Image recognition's (JonahFu on X), the two drawn by one helper (mcpRow), Settings' own, with no room added (10-25); 1,321,994 with a provider of the user's set never to rest for a limit (zoecats), the provider editor's Advanced row, the core's own editor, with no room added (10-25); 1,322,289 with Settings › Privacy's Keep a key's form under Mask secrets (Charles Cao on X), Settings' own row, with no room added (10-25); 1,322,537 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,323,401 with the tray panel drawing its last allowances at once and asking for them beside the state (#3160, #3134), the tray panel's, the core's own, and the 4 bytes 84c50f032 added, with no room added (10-25); 1,326,105 with many releases' notes merged into one list by kind, each line with its version (the owner), in the update sheet and What's new, with no room added (10-25); 1,321,319 with Settings › Observability moved out to its plugin (plugins/otel/page.js) and its Langfuse setup there (an X user), the budget lowered to it (10-26); a quota card whose window is used but names no reset no longer saying "Not used yet" (windy on Discord) raised it to 1,321,347, and back to 1,321,319 with Settings' model pickers sharing one row helper (modelOpt) where six kept their own copy, no raise (10-26); 1,325,845 with every slow page's skeletons getting magpie's bird hopping bar to bar (skelBird, the owner after the Plugins page's README), one bird for the window over whatever page or dialog is loading, the core's own, with no room added (10-26); 1,310,129 with Settings › Network and sharing's gateway rows (its port, bare ids, local network, allowed addresses, web pages) moved out to the gateway plugin (plugins/gateway/settings.js), the budget lowered to it (10-27); 1,310,269 with Test models naming the first model that failed and its error in the status line, where it said only how many (ysm119 on Discord), the provider editor's, the core's own, with no room added (10-27); 1,310,460 with Settings › About's Website row linking usemagpie.ai (the owner), Settings' own row, with no room added (10-27); 1,309,669 with a pool's Stop at the caps and Check usage near a cap ticks under a provider's accounts (plugins#349), the core's own editor, its account rows' Remove and add rows each drawn by one helper (forgetOf, addRow), with no room added (10-28); 1,311,681 with Install another agent on the Agents page naming the agents Plugins has (More in Plugins) and opening Plugins at its Agents (the owner), the Agents page's, the core's own, with no room added (10-28)
+ coreScriptBudget = 1_530_449 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it; 1,472,589 with the dialog that grows out of its row and the agents' own settings in their rows, on main's 10-20 core work (the Providers page's last list, the Routing trace's names), plus 1.5% (10-20); 1,506,192 with Settings › Privacy's record of what was masked, plus 1.5%; 1,529,393 with the Intent classifier timeout row (#2934), with no room added; 1,529,495 with the editor's partner link host, with no room added; 1,529,844 with Check in now's press summary (#3326), with no room added; 1,530,689 with the new partner tile's dot, with no room added; 1,535,084 with the sidebar's spring, with no room added; 1,549,478 with the context window card's map (tiles by tokens, the default look, the block grid a switch away) and its text view showing an inline image, in context.js, which the Routing page draws as well as Usage, so the core's own, with no room added (10-24); 1,550,768 with a usage card's refresh opening after its text (#840's card, which the tray panel draws too), the Add key spinner, and a dialog kept centred while its content comes in, with no room added (10-24); 1,524,789 with what masking did moved out to Insights › Masking, lowered to it; 1,528,525 with Codex's one subagent model, with no room added (10-24); 1,528,972 with the Image generation MCP server row (JonahFu on X), with no room added (10-25); 1,529,542 with the limit-rest row (zoecats), with no room added (10-25); 1,529,837 with Keep a key's form (Charles Cao on X), with no room added (10-25); 1,530,050 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,530,631 with a plugin's page growing to its README on the dialog's spring instead of in one jump (the owner), the Plugins page's, in plugins.js, with no room added (10-25); 1,533,445 with the context map counting its tokens on as a live request grows, a tile pointed at keeping its tip, a tool's gathered results saying how many and the small files their folder (the owner, after flohoeller's map on X), in context.js, which the Routing page draws as well as Usage, and the 4 bytes 84c50f032 added to app.js (Settings' Version row) without a raise, with no room added (10-25); 1,534,312 with the tray panel's last allowances drawn at once (#3160, #3134), with no room added (10-25); 1,537,016 with many releases' notes merged into one list by kind (the owner), in app.js, with no room added (10-25); 1,542,244 with a plugin's README loading under magpie's bird bouncing down its lines instead of pulsing bars (the owner), the Plugins page's, in plugins.js, with no room added (10-26); 1,542,418 with a page plugin's sidebar tab coming and going as it is installed, switched on or off, or removed, instead of on the Plugins page's next load (the owner), in plugins.js, with no room added (10-26); 1,537,645 with Settings › Observability moved out to plugins/otel, lowered to it (10-26); 1,537,673 with a used window with no reset not "Not used yet" (windy on Discord), and back to 1,537,645 with Settings' model pickers sharing modelOpt (10-26); 1,541,967 with every slow page's skeletons getting magpie's bird (skelBird, the owner), in app.js, the README's bird sharing its drawing and styles, with no room added (10-26); 1,526,251 with Settings' gateway rows moved out to plugins/gateway/settings.js, lowered to it (10-27); 1,526,391 with Test models naming the first failed model and its error (ysm119 on Discord), in app.js, with no room added (10-27); 1,526,556 with About's Website row (the owner), in app.js, with no room added (10-27); 1,526,500 with a pool's cap ticks (plugins#349), in app.js, with no room added (10-28); 1,527,245 with About's Open-source licenses row and dialog (the owner), in app.js, with no room added (10-28); 1,528,076 with the Partners heading's light (the owner), in app.js, with no room added (10-28); 1,530,449 with Install another agent's More in Plugins row (the owner), in app.js, and Plugins opening at its Agents, in plugins.js, with no room added (10-28)
)
func TestCoreScriptBudget(t *testing.T) {
diff --git a/internal/gui/plugins.go b/internal/gui/plugins.go
index 069617a80..ffa20fe51 100644
--- a/internal/gui/plugins.go
+++ b/internal/gui/plugins.go
@@ -445,6 +445,22 @@ func pluginListings(ctx context.Context) []pluginListingJSON {
return out
}
+// pluginAgents are the suggested agent plugins not installed, by name.
+// One installed and turned off is installed: Plugins turns it on.
+func pluginAgents(ctx context.Context) []string {
+ have := map[string]bool{}
+ for _, e := range plugin.Load().Plugins {
+ have[plugin.Name(e.Spec)] = true
+ }
+ out := []string{}
+ for _, l := range plugin.Market(ctx) {
+ if l.Kind == "agent" && !have[l.Package] {
+ out = append(out, l.Name)
+ }
+ }
+ return out
+}
+
// npmIcons puts the picture each package gives (magpie.icon) as the page
// can show it, kept here as a GitHub-tagged plugin's is: a data URI or an
// https URL isn't sent on to the page. One not kept by wait is left out.
@@ -528,6 +544,11 @@ func pluginRoutes(mux *http.ServeMux, w Windows) {
mux.HandleFunc("GET /api/plugins/listings", func(rw http.ResponseWriter, r *http.Request) {
writeJSON(rw, map[string]any{"listings": pluginListings(r.Context())})
})
+ // the agents a suggested plugin adds that aren't installed here: the
+ // Agents page's Install another agent says Plugins has them
+ mux.HandleFunc("GET /api/plugins/agents", func(rw http.ResponseWriter, r *http.Request) {
+ writeJSON(rw, pluginAgents(r.Context()))
+ })
// repositories on GitHub tagged magpie-plugin: nobody's list, shown
// apart as not reviewed, installed from the repository
mux.HandleFunc("GET /api/plugins/github", func(rw http.ResponseWriter, r *http.Request) {
diff --git a/internal/gui/plugins_agents_test.go b/internal/gui/plugins_agents_test.go
new file mode 100644
index 000000000..d4b351397
--- /dev/null
+++ b/internal/gui/plugins_agents_test.go
@@ -0,0 +1,72 @@
+package gui
+
+import (
+ "encoding/json"
+ "net/http"
+ "net/http/httptest"
+ "os"
+ "path/filepath"
+ "slices"
+ "testing"
+
+ "github.com/yetone/magpie/internal/plugin"
+ "github.com/yetone/magpie/internal/settings"
+)
+
+// The Agents page's Install another agent says Plugins has more agents
+// (the owner: 因为我们支持Agent插件了,这里是不是也应该显示插件中有更多?):
+// /api/plugins/agents names the agents a suggested plugin adds, leaving
+// out every other kind and one installed here, turned off or pinned to a
+// version too.
+func TestPluginAgentsNotInstalled(t *testing.T) {
+ t.Setenv("XDG_CACHE_HOME", t.TempDir())
+ t.Setenv("XDG_CONFIG_HOME", t.TempDir())
+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Write([]byte(`{"version":1,"plugins":[
+ {"package":"@magpie-community/opencode-x-auth","name":"X","community":true},
+ {"package":"@magpie-community/middleware-guard","name":"Guard","kind":"middleware","community":true},
+ {"package":"@magpie-community/agent-kilo","name":"Kilo Code","kind":"agent","community":true},
+ {"package":"@magpie-community/agent-aider","name":"Aider","kind":"agent","community":true},
+ {"package":"@magpie-community/agent-pig","name":"PiG","kind":"agent","community":true},
+ {"package":"@magpie-community/agent-bub","name":"Bub","kind":"agent","community":true},
+ {"package":"agent-elsewhere","name":"Elsewhere","kind":"agent"}
+ ]}`))
+ }))
+ defer srv.Close()
+ t.Setenv("MAGPIE_PLUGIN_MARKET", srv.URL)
+ plugin.RefreshMarket()
+ t.Cleanup(plugin.RefreshMarket)
+ dir := settings.Dir()
+ if err := os.MkdirAll(dir, 0o755); err != nil {
+ t.Fatal(err)
+ }
+ installed := `{"plugins":[{"spec":"@magpie-community/[email protected]"},{"spec":"@magpie-community/agent-bub","off":true}]}`
+ if err := os.WriteFile(filepath.Join(dir, "plugins.json"), []byte(installed), 0o644); err != nil {
+ t.Fatal(err)
+ }
+
+ mux := http.NewServeMux()
+ pluginRoutes(mux, nil)
+ rec := httptest.NewRecorder()
+ mux.ServeHTTP(rec, httptest.NewRequest("GET", "/api/plugins/agents", nil))
+ if rec.Code != 200 {
+ t.Fatalf("%d %s", rec.Code, rec.Body)
+ }
+ var got []string
+ if err := json.Unmarshal(rec.Body.Bytes(), &got); err != nil {
+ t.Fatal(err)
+ }
+ if want := []string{"Kilo Code", "PiG"}; !slices.Equal(got, want) {
+ t.Errorf("got %q, want %q", got, want)
+ }
+
+ // every one installed: the page gets an empty list, never null
+ if err := os.WriteFile(filepath.Join(dir, "plugins.json"), []byte(`{"plugins":[{"spec":"@magpie-community/agent-kilo"},{"spec":"@magpie-community/agent-aider"},{"spec":"@magpie-community/agent-pig"},{"spec":"@magpie-community/agent-bub"}]}`), 0o644); err != nil {
+ t.Fatal(err)
+ }
+ rec = httptest.NewRecorder()
+ mux.ServeHTTP(rec, httptest.NewRequest("GET", "/api/plugins/agents", nil))
+ if body := rec.Body.String(); body != "[]\n" && body != "[]" {
+ t.Errorf("all installed: %q, want []", body)
+ }
+}
diff --git a/internal/gui/tests/agent-plugin-agents.test.cjs b/internal/gui/tests/agent-plugin-agents.test.cjs
new file mode 100644
index 000000000..bc1e703c5
--- /dev/null
+++ b/internal/gui/tests/agent-plugin-agents.test.cjs
@@ -0,0 +1,146 @@
+// Run with Node's test runner and Playwright on the module path; see README.md.
+// The owner: 因为我们支持Agent插件了,这里是不是也应该显示插件中有更多?
+// Install another agent counts the agents a suggested plugin adds, not
+// installed here, beside the ones with an install command, and ends with
+// one row naming them that opens Plugins at its Agents. With no install
+// command left, the section is there for the plugins' agents alone; with
+// no plugin agent left, it has no such row. In the window, wide and
+// narrow, in every language, both engines. No backend: 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 = process.env.MAGPIE_GUI_ASSETS || path.resolve(__dirname, "../assets");
+const INSTALLS = [
+ { id: "opencode", name: "OpenCode", icon: "opencode", commands: [{ via: "npm", command: "npm install -g opencode-ai" }] },
+ { id: "crush", name: "Crush", icon: "crush", commands: [{ via: "brew", command: "brew install crush" }] },
+];
+const AGENTS = ["Kilo Code", "Aider", "PiG"];
+// enough subscriptions above that Plugins' Agents start below the fold,
+const listings = [
+ ...Array.from({ length: 12 }, (_, i) => ({ package: `@magpie-community/opencode-p${i}-auth`, name: `Plan ${i}`, community: true, providers: ["p" + i], summary: { en: "Signs in" }, npm: { version: "0.1.0" } })),
+ // and tools below, so Agents can come to the top
+ ...Array.from({ length: 12 }, (_, i) => ({ package: `@magpie-community/tools-t${i}`, name: `Tools ${i}`, kind: "tools", community: true, summary: { en: "Tools" }, npm: { version: "0.1.0" } })),
+ ...AGENTS.map((name) => ({ package: "@magpie-community/agent-" + name.toLowerCase().replace(/\W/g, ""), name, kind: "agent", community: true, summary: { en: "An agent" }, npm: { version: "0.1.0" } })),
+];
+
+function server(lang, ctl) {
+ return async (route) => {
+ const url = new URL(route.request().url());
+ const json = (data) => route.fulfill({ json: data });
+ if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:true};` });
+ if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });
+ if (url.pathname === "/api/state") return json({ agents: [{ id: "pi", name: "Pi", path: "~/.pi", fields: [] }], profiles: [], settings: { lang, theme: "light" } });
+ if (url.pathname === "/api/agents/cli") return json({ agents: {}, pending: false });
+ if (url.pathname === "/api/agents/install") return json(ctl.installs);
+ if (url.pathname === "/api/plugins/agents") return json(ctl.agents);
+ if (url.pathname === "/api/plugins") return json({ bun: true, plugins: [] });
+ if (url.pathname === "/api/plugins/listings") return json({ listings });
+ if (url.pathname === "/api/plugins/github") return json({ repos: [] });
+ if (url.pathname === "/api/providers") return json({ providers: [], presets: [], excluded: [], gateway: { running: true }, plugins: [] });
+ if (url.pathname === "/api/groups") return json({ groups: [], pools: [] });
+ 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)];
+ try { await route.fulfill({ body: await fs.readFile(file), contentType }); } catch { await route.fulfill({ status: 404, body: "" }); }
+ };
+}
+
+// the language's own words for an English key, failing for one it hasn't
+const said = (page, lang, key, vars = {}) => page.evaluate(([lang, key, vars]) => {
+ const s = lang === "en" ? key : I18N[lang]?.[key];
+ if (!s) return null;
+ return s.replace(/\{(\w+)\}/g, (_, k) => vars[k]);
+}, [lang, key, vars]);
+const noSideScroll = (page) => page.evaluate(() => document.documentElement.scrollWidth <= document.documentElement.clientWidth + 1);
+
+for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
+ test(engine + ": Install another agent says Plugins has more agents, and opens them", async (t) => {
+ assert(["chromium", "webkit"].includes(engine), "BROWSER must be chromium or webkit");
+ const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
+ t.after(() => browser.close());
+ for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) for (const width of [1100, 420]) {
+ await t.test(`${lang} ${width}`, async () => {
+ const ctl = { installs: INSTALLS, agents: AGENTS };
+ const page = await (await browser.newContext({ viewport: { width, height: 760 } })).newPage();
+ page.setDefaultTimeout(5000);
+ const errors = [];
+ page.on("pageerror", (e) => errors.push(e.message));
+ await page.route("**/*", server(lang, ctl));
+ await page.goto("http://magpie.test/");
+ const inst = page.locator("#agentsInstall");
+ const head = inst.locator(".ag-install-head");
+ const count = (n) => said(page, lang, "Install another agent ({n})", { n });
+ await page.waitForFunction((want) => document.querySelector("#agentsInstall .ag-install-head")?.textContent === want, await count(5));
+ await head.click();
+ // the commands first, then one row for the plugins' agents
+ const rows = inst.locator(".ag-install-row");
+ assert.equal(await rows.count(), 3);
+ assert.equal(await inst.locator(".ag-install-row:last-child.ag-install-plugins").count(), 1, "the plugins' row isn't last");
+ const more = inst.locator(".ag-install-plugins");
+ const word = await said(page, lang, "More in Plugins");
+ assert(word, "More in Plugins has no " + lang);
+ assert.equal(await more.locator("b").textContent(), word);
+ assert.equal(await more.locator(".ag-install-pnames").textContent(), AGENTS.join(await said(page, lang, ", ")));
+ const tip = await said(page, lang, "Agents magpie has no setup of its own for: install a plugin for one in the Plugins tab, and it is listed here");
+ assert(tip, "the tip has no " + lang);
+ assert.equal(await more.getAttribute("title"), tip);
+ // on one line, its words inside it
+ const box = (l) => l.evaluate((e) => { const r = e.getBoundingClientRect(); return { l: r.left, r: r.right, t: r.top, b: r.bottom }; });
+ const r = await box(more), n = await box(more.locator("b")), c = await box(more.locator(".chev"));
+ assert(c.r <= r.r + 0.5 && n.l >= r.l, "off its row");
+ assert(c.t < n.b && c.b > n.t, "the chevron is not on the name's line");
+ assert(await more.locator("b").evaluate((b) => b.scrollWidth <= b.clientWidth + 1), "the name cut");
+ assert(await noSideScroll(page), "the page scrolls sideways");
+ await page.screenshot({ path: path.join(process.env.SHOTS || "/tmp", `plugin-agents-${engine}-${lang}-${width}.png`), fullPage: true }).catch(() => {});
+
+ // to Plugins, Discover, its Agents in sight at the top
+ await more.click();
+ const view = page.locator("#view-plugins");
+ await view.waitFor();
+ const agents = view.locator(".pm-sec").filter({ has: page.locator(".pm-sechead h3", { hasText: new RegExp("^" + await said(page, lang, "Agents") + "$") }) });
+ await agents.waitFor();
+ await page.waitForFunction(() => {
+ const v = document.querySelector("#view-plugins");
+ const s = [...v.querySelectorAll(".pm-sec")].find((x) => x.querySelector(".pm-card .pm-chip.kind.ag"));
+ return v.scrollTop > 0 && s && Math.abs(s.getBoundingClientRect().top - v.getBoundingClientRect().top) < 80;
+ });
+ assert.equal(await agents.locator(".pm-card").count(), AGENTS.length);
+ // it stays there once the page has what it loads
+ await page.waitForTimeout(300);
+ const top = await agents.evaluate((s) => s.getBoundingClientRect().top - document.querySelector("#view-plugins").getBoundingClientRect().top);
+ assert(Math.abs(top) < 80, "Agents moved away: " + top);
+ await page.context().close();
+
+ // no install command left: the section is there for the plugins' agents
+ ctl.installs = [];
+ const p2 = await (await browser.newContext({ viewport: { width, height: 760 } })).newPage();
+ p2.setDefaultTimeout(5000);
+ p2.on("pageerror", (e) => errors.push(e.message));
+ await p2.route("**/*", server(lang, ctl));
+ await p2.goto("http://magpie.test/");
+ await p2.waitForFunction((want) => document.querySelector("#agentsInstall .ag-install-head")?.textContent === want, await said(p2, lang, "Install another agent ({n})", { n: 3 }));
+ await p2.locator("#agentsInstall .ag-install-head").click();
+ assert.equal(await p2.locator("#agentsInstall .ag-install-row").count(), 1);
+ assert.equal(await p2.locator("#agentsInstall .ag-install-note").count(), 0, "a note about commands with none");
+ await p2.context().close();
+
+ // no plugin agent left: no such row, the count the commands'
+ Object.assign(ctl, { installs: INSTALLS, agents: [] });
+ const p3 = await (await browser.newContext({ viewport: { width, height: 760 } })).newPage();
+ p3.setDefaultTimeout(5000);
+ p3.on("pageerror", (e) => errors.push(e.message));
+ await p3.route("**/*", server(lang, ctl));
+ await p3.goto("http://magpie.test/");
+ await p3.waitForFunction((want) => document.querySelector("#agentsInstall .ag-install-head")?.textContent === want, await said(p3, lang, "Install another agent ({n})", { n: 2 }));
+ await p3.locator("#agentsInstall .ag-install-head").click();
+ assert.equal(await p3.locator("#agentsInstall .ag-install-row").count(), 2);
+ assert.equal(await p3.locator("#agentsInstall .ag-install-plugins").count(), 0);
+ await p3.context().close();
+ assert.deepEqual(errors, []);
+ });
+ }
+ });
+}
diff --git a/internal/gui/tests/menu-scroll.test.cjs b/internal/gui/tests/menu-scroll.test.cjs
index d3af86b24..a843a1567 100644
--- a/internal/gui/tests/menu-scroll.test.cjs
+++ b/internal/gui/tests/menu-scroll.test.cjs
@@ -39,7 +39,7 @@ async function serve(route) {
if (url.pathname === "/api/groups") return json({ groups: [] });
if (url.pathname === "/api/gateway/trace") return json({ mine: false, now: date, totals: { requests: 0, rerouted: 0, errors: 0 } });
if (url.pathname === "/api/plugins/updates") return json({ waiting: [] });
- if (url.pathname === "/api/usage/quotas" || url.pathname === "/api/usage/quotas/history" || url.pathname === "/api/agents/install") return json([]);
+ if (url.pathname === "/api/usage/quotas" || url.pathname === "/api/usage/quotas/history" || url.pathname === "/api/agents/install" || url.pathname === "/api/plugins/agents") return json([]);
if (url.pathname === "/api/whatsnew") return json({});
if (url.pathname === "/api/upstream") return json({ vendors: [], providers: {} });
// the sidebar's plugin pages, and plugin panels in magpie's pages: none