diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css index 25d688884..3a2aa9a94 100644 --- a/internal/gui/assets/app.css +++ b/internal/gui/assets/app.css @@ -210,6 +210,10 @@ body.window .row .ic { width: 22px; height: 22px; } .empty-state { padding: 36px 20px; text-align: center; color: var(--muted); } .empty-state b { display: block; color: var(--fg); font-weight: 500; margin-bottom: 4px; } +/* the last row of the list: the agents nothing is set on, folded away */ +.agent-more { display: block; width: 100%; border: 0; border-top: 1px solid var(--line-2); background: none; font: inherit; font-size: 12px; color: var(--muted); padding: 9px; cursor: pointer; } +.agent-more:hover { color: var(--fg); background: var(--card-2); } + /* an agent row: logo, name, then one pop-up button per setting */ /* two columns: the model, then the smaller setting; single controls sit at the end. Fixed widths keep every chevron on the same vertical line down the list. */ diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index e86fcf42a..a76e304aa 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -16,6 +16,7 @@ let state = { agents: [], profiles: [], catalog: "", settings: {} }; let prefs = null; // the settings page: theme, lang, version, dir, gateway let providers = null; // { providers, presets, gateway } let view = "agents"; +let showAllAgents = false; // the agents no one has set anything on, folded away let period = "30d"; // usage window let usage = null; // last usage summary let pick = null; // { agent, field, options, items, cursor, anchor } @@ -131,7 +132,11 @@ function renderAgents() { e.append(el("b", "", t("No agents found")), el("span", "", t("Install Claude Code, Codex, Gemini CLI, OpenCode… and magpie will list them here."))); list.append(e); } - for (const a of state.agents) { + // An agent no one has set anything on is noise in a picker: fold it away, + // unless that is all of them (a fresh magpie has nothing to show otherwise). + const used = state.agents.filter((a) => a.fields.some((f) => f.value)); + const rows = showAllAgents || !used.length ? state.agents : used; + for (const a of rows) { const row = el("div", "row agent"); row.dataset.id = a.id; row.title = a.path; @@ -164,6 +169,12 @@ function renderAgents() { row.append(icon(a.icon), who, fields); list.append(row); } + if (used.length && used.length < state.agents.length) { + const n = state.agents.length - used.length; + const more = el("button", "agent-more", showAllAgents ? t("Show less") : t("Show {n} more", { n })); + more.onclick = () => { showAllAgents = !showAllAgents; renderAgents(); }; + list.append(more); + } const chips = $("#profiles"); chips.replaceChildren(); diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js index 57c4aa2c8..5e76e5762 100644 --- a/internal/gui/assets/i18n.js +++ b/internal/gui/assets/i18n.js @@ -19,6 +19,8 @@ const I18N = { // agents "No agents found": "没有找到 Agent", "Install Claude Code, Codex, Gemini CLI, OpenCode… and magpie will list them here.": "安装 Claude Code、Codex、Gemini CLI、OpenCode…… 之后,magpie 会在这里列出它们。", + "Show {n} more": "显示其余 {n} 个", + "Show less": "收起", "model": "模型", "effort": "推理强度", "thinking": "思考",