diff --git a/docs/subsystems/agent-wiring.md b/docs/subsystems/agent-wiring.md index eda6e32b1..92cb0cebd 100644 --- a/docs/subsystems/agent-wiring.md +++ b/docs/subsystems/agent-wiring.md @@ -71,7 +71,7 @@ something else shows up as drift. - Hermes copies the launch profile's model into a new profile (`_seed_model_config`, or `--clone`'s `config.yaml`) and never reads it again. A model picked in magpie moves every other profile still on `magpie` with the model magpie had set (recorded in `stash.json` as `hermes::magpie.default`, or the connected config's model before that record) onto the new one; a profile on any other model was set by its user and stays (`hermesFollow` in [`hermes.go`](../../internal/agent/hermes.go); tjhhhh_84378 on Discord). - The config magpie connects is the profile `hermes` starts in: `HERMES_HOME` when it names a profile, else the one `hermes profile use` made sticky in `/active_profile` (a live profile folder; `hermes model` writes the same one), else `HERMES_HOME` or the default folder (`hermesActive`; `_apply_profile_override` in Hermes's `hermes_cli/main.py`). The root's config is then one more profile. A bot on the model the connected config is on through magpie follows too, besides one on the recorded model (`hermes model` there before the bot was made). - Disconnect moves a profile on magpie onto its own model from when magpie connected it, else the connected config's own model (with that provider's `providers` entry when the profile lacks it, as Hermes's `launch_model_seed` does); with neither, its model goes. What it was on is kept (`hermes::off`), and connecting again puts it back when nothing has changed it, and gives a profile with no model at all magpie's (`hermesBack`). The recorded model stays through Disconnect. Before, Off emptied every such profile and `hermes` there failed at start after Off and On (tjhhhh on Discord, `TestHermesOffAndOnKeepsEveryBotsModel`, `TestHermesStickyProfile`). - - With more than one profile, each profile other than the connected one has a field of its own, `profile:` (`default` for the root), drawn as a line of the opened row's Other profiles with `hermes -p ` beside it, never as a square of the row's (`hermesProfileFields`; `hermesBot` in app.js; dongshanfengdongshizhcn on Discord). A magpie model puts magpie's provider into that profile and stashes its own provider and model first; a model of its own is written as `model.default` and gives back the stashed provider. Default puts back the profile's model from before magpie, or keeps the one it has: Disconnect sends the same empty value. A bot picked there is recorded (`hermes::picked`) and doesn't follow the connected config's next model, and a sync keeps magpie's provider current in a bot on magpie while the connected config isn't (`TestHermesProfileModels`, `hermes-profiles.test.cjs`). + - With more than one profile, each profile other than the connected one has a field of its own, `profile:` (`default` for the root), kept in the API but drawn nowhere on the connected row (`hermesProfileFields`; `hermesBot` in app.js hides it): the profile's own row `hermes#`, below, is where its model is picked, so two controls never set one profile (dongshanfengdongshizhcn on Discord; Norethcy on X). A magpie model puts magpie's provider into that profile and stashes its own provider and model first; a model of its own is written as `model.default` and gives back the stashed provider. Default puts back the profile's model from before magpie, or keeps the one it has: Disconnect sends the same empty value. A bot picked there is recorded (`hermes::picked`) and doesn't follow the connected config's next model, and a sync keeps magpie's provider current in a bot on magpie while the connected config isn't (`TestHermesProfileModels`, `hermes-profiles.test.cjs`). - Each profile other than the connected one is also an agent row of its own, `hermes#` (`hermesProfileAgents`, named `Hermes · `; `default` for the root when a named profile is connected), the way omp's are `omp#`: its one field, `model`, is the same pick as the connected row's `profile:`, and the Library gives it skills and MCP servers apart from the other profiles, since Hermes reads `skills/` and `mcp_servers` from each profile's own home (`targetOf` in `internal/library/targets.go`; Norethcy on X). None is listed while Hermes itself is gone (`CLIMissing`). - Hermes's `api_key` may be a reference, `${VAR}` or `${env:VAR}`, which Hermes expands from the `.env` beside the config (its own or a profile's) and then the environment. `Check` and a sync read the key it names (`hermesKey`): one that holds (`keyHolds`) stays and isn't drift, and so does one naming a variable magpie can't see (only a shell profile sets it), which is unknown. One naming a key the gateway doesn't take is drift, and a sync keeps the reference and writes magpie's key into that `.env` under the variable, made `0600` when there is none (`hermesKeptKey`; PaulT on Discord, `TestHermesWithAKeyInItsEnvFile`). A value with more than the one reference in it is replaced by magpie's key, as before. - omp's `models.yml` keeps `modelOverrides`, `discovery`, `disableStrictTools`, headers and compat flags (`ompKept`). Its `auth` and `apiKey` are magpie's, or gone. diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index fef052922..b7cfd4311 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -2176,9 +2176,6 @@ function connectPanel(a, { fields, fieldBtn }) { } else if (AIR_KINDS.has(kindOf(a))) kv(t("In {agent}", { agent: a.name }), ...airSaid(a, line)); // Claude Magpie.app (#5671), macOS only if (a.id === "claude-desktop" && a.isolated) kv(t("Separate app"), desktopIsolatedLine(a.isolated)); - // Hermes' other profiles, each on its own model - const bots = a.fields.filter(hermesBot); - if (bots.length) kv(t("Other profiles"), ...bots.map((f) => line(el("span", "ag-tier", f.label), fieldBtn(f, "ag-pick"), el("span", "ag-hint", "hermes -p " + f.label)))); // Claude Code's tiers, each with the /model that picks it if (kindOf(a) === "claude") { const tiers = a.fields.filter((f) => TIERS.includes(f.label) && f.options.length); @@ -4753,7 +4750,7 @@ function openPicker(agent, field, anchor, ev, only) { : field.label === COMPACT_MODEL ? "each compaction on the session's model" : ompAgent(agent) && OMP_OWN_PICK.includes(field.label) ? OMP_UNSET[field.label] : asideAccount(agent, field) ? "the account active in {agent}" - : hermesBot(field) ? "put back what {agent} had before magpie" + : agent.id.startsWith("hermes#") ? "put back what {agent} had before magpie" : "what {agent} ships with"; options.unshift({ value: "", label: t("Default"), note: t(note, { agent: agent.name, field: t(field.label) }), icon: agent.icon, reset: true }); } @@ -4763,7 +4760,7 @@ function openPicker(agent, field, anchor, ev, only) { const at = options.findIndex((o) => !o.reset); options.splice(at < 0 ? options.length : at, 0, { value: "\0disconnect", label: t("Disconnect from magpie"), note: t("put back what {agent} had before magpie", { agent: agent.name }), svg: UNPLUG, reset: true, run: () => askDisconnect(agent) }); } - const modelPicker = (["model", "small", "large", MEMORIES, SUB_MODEL, AUTO_MODE, COMPACT_MODEL, "executor", "planner", ...ROLE_MODELS].includes(field.label) || hermesBot(field)) && !only; + const modelPicker = (["model", "small", "large", MEMORIES, SUB_MODEL, AUTO_MODE, COMPACT_MODEL, "executor", "planner", ...ROLE_MODELS].includes(field.label)) && !only; pick = { agent, field, options, groups, anchor, cursor: 0, free: !only && !field.menu, modelPicker, effortPicker, groupFilter: "all" }; if (modelPicker) { readSpeeds(); readLoads(); } anchor.classList.add("open"); diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js index da1e5555c..d94745a7c 100644 --- a/internal/gui/assets/i18n.js +++ b/internal/gui/assets/i18n.js @@ -877,7 +877,6 @@ const I18N = { "Connected · {n} models in {agent}'s {cmd}": "已接入 · {agent} 的 {cmd} 里有 {n} 个模型", "Collapse": "收起", "Tiers": "档位", - "Other profiles": "其他 profile", "Details": "详情", "Can't connect": "不能接入", "New sessions take it; switch the tiers in {cmd}.": "新开的会话生效,在 {cmd} 里切换档位。", @@ -5950,7 +5949,6 @@ const I18N = { "Connected · {n} models in {agent}'s {cmd}": "已接入 · {agent} 的 {cmd} 裡有 {n} 個模型", "Collapse": "收起", "Tiers": "檔位", - "Other profiles": "其他 profile", "Details": "詳情", "Can't connect": "不能接入", "New sessions take it; switch the tiers in {cmd}.": "新開的會話生效,在 {cmd} 裡切換檔位。", @@ -10988,7 +10986,6 @@ const I18N = { "Connected · {n} models in {agent}'s {cmd}": "接続済み · {agent} の {cmd} に {n} モデル", "Collapse": "折りたたむ", "Tiers": "階層", - "Other profiles": "ほかのプロファイル", "Details": "詳細", "Can't connect": "接続できません", "New sessions take it; switch the tiers in {cmd}.": "新しいセッションから反映されます。階層は {cmd} で切り替えます。", @@ -16044,7 +16041,6 @@ const I18N = { "Connected · {n} models in {agent}'s {cmd}": "Verbunden · {n} Modelle in {cmd} von {agent}", "Collapse": "Einklappen", "Tiers": "Stufen", - "Other profiles": "Weitere Profile", "Details": "Details", "Can't connect": "Verbinden nicht möglich", "New sessions take it; switch the tiers in {cmd}.": "Gilt für neue Sitzungen; Stufen in {cmd} wechseln.", diff --git a/internal/gui/tests/hermes-profiles.test.cjs b/internal/gui/tests/hermes-profiles.test.cjs index 2de1952e5..300586e2b 100644 --- a/internal/gui/tests/hermes-profiles.test.cjs +++ b/internal/gui/tests/hermes-profiles.test.cjs @@ -1,15 +1,11 @@ // Run with Node's test runner and Playwright on the module path; see README.md. -// Hermes keeps more than one profile (hermes -p ), each with its own -// config.yaml, and magpie's Hermes row picked the model of one of them only -// (dongshanfengdongshizhcn on Discord). Each other profile comes as a field -// keyed "profile:": connected, the opened row has an Other profiles -// section with one line per profile (its name, its model picker, the -// command that runs it), and no square of the row's own. A click opens the -// app's model picker with Default first, noted as putting back what the -// profile had before magpie; a model picked is posted for that profile -// alone. With one profile only there is no section. No click scrolls the -// page. In every language, at a normal and a narrow width, in both engines. -// No backend: the API is faked here. +// The connected Hermes row has no control for its other profiles: each is an +// agent row of its own (hermes#, hermes-profile-row.test.cjs), so two +// controls never pick one profile's model (Norethcy on X). The API still has +// the "profile:" fields (dongshanfengdongshizhcn on Discord); the row +// draws none, no "Other profiles" section and no "hermes -p" line. In every +// language, at a normal and a narrow width, in 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"); @@ -68,7 +64,7 @@ const one = '.row.agent[data-id="hermes-one"]'; for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) { for (const lang of Object.keys(W)) { for (const width of [1100, 560]) { - test(`${engine} ${lang} ${width}px: each Hermes profile picks its own model`, async (t) => { + test(`${engine} ${lang} ${width}px: the Hermes row has no control for its other profiles`, async (t) => { const w = W[lang]; const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" })); const page = await browser.newPage({ viewport: { width, height: 800 } }); @@ -95,32 +91,14 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(await page.locator(`${one} .ag-exp`).innerText().then((s) => s.includes(w.head)), false); assert.equal(await page.locator(`${one} .field[data-key^="profile:"]`).count(), 0); + // the connected row has no profile controls either: each other profile + // is its own row (hermes#), where its model is picked await page.locator(`${row} .ag-link`).click(); await page.locator(`${row} .ag-exp`).waitFor(); - assert.ok((await page.locator(`${row} .ag-exp`).innerText()).includes(w.head)); - const keys = await page.locator(`${row} .ag-exp .field.ag-pick[data-key^="profile:"]`).evaluateAll((es) => es.map((e) => e.dataset.key)); - assert.deepEqual(keys, ["profile:a-profile-with-a-long-name", "profile:coder"]); - const pick = page.locator(`${row} .ag-exp .field.ag-pick[data-key="profile:coder"]`); - const line = pick.locator("xpath=.."); - assert.equal(await line.locator(".ag-tier").textContent(), "coder"); - assert.equal(await line.locator(".ag-hint").textContent(), "hermes -p coder"); - assert.equal(await pick.locator(".v").textContent(), "kimi-k3.5"); - // a long name is cut short, not pushing its picker out - const long = page.locator(`${row} .ag-exp .field.ag-pick[data-key="profile:a-profile-with-a-long-name"]`).locator("xpath=..").locator(".ag-tier"); - assert.ok(await long.evaluate((e) => e.scrollWidth > e.clientWidth && getComputedStyle(e).textOverflow === "ellipsis")); + assert.equal((await page.locator(`${row} .ag-exp`).innerText()).includes(w.head), false); + assert.equal(await page.locator(`${row} .field[data-key^="profile:"]`).count(), 0); + assert.equal((await page.locator(`${row} .ag-exp`).innerText()).includes("hermes -p"), false); assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), "the Agents view overflows"); - - // the app's model picker, Default first, noted as putting back the profile's own - const y = await page.evaluate(() => scrollY); - await pick.click(); - await page.locator("#pop:not([hidden]) #list li").first().waitFor(); - assert.equal(await page.evaluate(() => scrollY), y, "the click scrolled the page"); - assert.equal(await page.locator("#pop").evaluate((e) => e.classList.contains("model-picker")), true); - const first = await page.locator("#pop #list li").first().innerText(); - assert.ok(first.includes(w.def) && first.includes(w.note), first); - await page.locator("#pop #list li", { hasText: "Flash" }).first().click(); - await page.waitForFunction(() => document.querySelector('.row.agent[data-id="hermes"] .ag-exp .field[data-key="profile:coder"] .v')?.textContent === "Flash"); - assert.deepEqual(sets, [{ agent: "hermes", field: "profile:coder", value: "magpie/v/flash" }]); assert.deepEqual(errors, []); }); }