agents: Use Claude Magpie is its own button beside Claude Desktop's switch (xMopf7RF on X)

xMopf7RF read Claude Desktop's row as "connect Desktop first", and
connecting is what changes their own Desktop. They asked for one button
beside Claude Desktop that makes the clone and touches neither their
Desktop nor ~/.claude. The button that does this has been in the row
since v0.1.4029, but it was a quiet link at the end of a long status
line that warns about connecting. Their screenshot has no button at all,
so it was easy to miss or they were on an older version.

Now it is a real button (ag-add) beside the switch, where Claude Code's
model picker stands. The status line no longer holds it. What it does
is unchanged: Separate app on, then connect, which wires only
Claude-Magpie-3p (v0.1.4064 keeps ~/.claude out of it for a new twin).
It shows only while Desktop isn't on magpie and the twin isn't made yet,
on a Mac.

Run:
- At the pushed head, after the rebase: desktop-twin, desktop-isolated, desktop-isolated-claude and i18n-keys
  in Chromium and WebKit, every language, at 1100 and 640px: 38/38 per
  engine. desktop-twin now checks that the button isn't in .ag-st, sits
  level with the switch 8 to 28px left of it, and that the status ends
  before it. It waits for the fold's animations first.
- Every GUI file whose fixture has claude-desktop or isolated (38
  files), both engines: WebKit 345/345. Chromium 343/345: the two reds are
  desktop-tiers ("no tiers square"), red the same at origin/main
  6e03b746b and filed as #6475. Its fixture is wired with no isolated, so
  the button never draws there.
- TestCoreScriptBudget: ok.
- Sandbox HOME on mote with the real Claude.app, at this tree: CLI
  launcher add, then connect, then launcher remove. The original
  Desktop's config.json and claude_desktop_config.json, ~/.claude and
  ~/.claude.json were byte-identical after each step. The twin's script
  exports CLAUDE_CONFIG_DIR=~/.claude-magpie-desktop.

Broken by hand: with the button put back in the status line,
desktop-twin goes red ("in the status line").

Not tried: a click in the real GUI app. The backend calls are the same as
v0.1.4064's, which the sandbox covers.
This commit is contained in:
yetone
2026-11-13 23:21:56 +08:00
parent 55327848bb
commit 5b0572ae3b
5 changed files with 21 additions and 4 deletions
+1 -1
View File
@@ -196,7 +196,7 @@ something else shows up as drift.
- Claude Desktop's sessions (Code and Cowork, `claude-code-sessions` and `local-agent-mode-sessions`) are kept in the userData Desktop runs in, keyed by account and organization (the claude.ai login signed in; in 3p the install id in `ant-did` and the profile's organization, both stable). So on magpie, in `Claude-3p`, the sessions made signed in with Anthropic are out of sight but untouched in `Claude`, and they show again when Desktop is switched back (lambdua on X: "切换账号,对话都不见"); claude.ai chats live on Anthropic's servers and 3p never shows them as they are. magpie never writes or removes a session. Desktop imports them itself (Settings → Import: the signed-in userData, `~/.claude/projects`, other `Claude*` folders, and Claude.ai's own chats and projects, through a Claude.ai sign-in in the importer (`arm: "direct"`, `remotePull` in 4.16336's `getImportCapabilities`) or its data export zip), copying under new ids that go on on the gateway and leaving the originals, but in 3p only when the profile's policy `claudeAiImport.enabled` is true (off by default, 3p only, from 1.28929.0). magpie's profile gets `"claudeAiImport":{"enabled":true,"bannerBehavior":"detect"}` once per folder set (`desktopSeedImport`, marked in the stash as `claude-desktop.import`): on the switch on and, for a Desktop already on magpie, from `Sync` at magpie's start. A `claudeAiImport` already there is kept, and one the user removes is not written again (`TestClaudeDesktopOffersItsSessionImport`). The opened row and the notice after On point there (`noticeClaudedesktop5`; Jacky_yyyyyyyy on X asked to go on with the earlier chats on magpie).
- Claude Desktop's 3p mode reads its MCP servers (Settings → Developer, its connector list) from `Claude-3p/claude_desktop_config.json`, a file of its own, so on magpie the servers the user added signed in with Anthropic, in `Claude/claude_desktop_config.json`, were gone from the list (aa86222 on Discord: connectors didn't sync). Turning Desktop onto magpie copies each of those `mcpServers` entries that `Claude-3p` has none of the same name for (`desktopCarryMCP` in [`claudedesktop.go`](../../internal/agent/claudedesktop.go)); one of that name already there, the user's or the Library's (which writes both files), stays. `Sync` does it once for a Desktop already on magpie (`claude-desktop.mcp-seen`), so a server the user takes out in 3p isn't brought back. What was copied is stashed (`claude-desktop.mcp`), and off takes back each one still as copied; one the user changed since stays (`TestClaudeDesktopCarriesTheMCPServers`, `TestClaudeDesktopMCPKeepsThe3pServers`, `TestClaudeDesktopSyncCarriesTheMCPServersOnce`). Claude's file is never written. A claude.ai account's connectors can't come along: Desktop calls them through claude.ai with that account (`/api/organizations/<org>/mcp/servers/<id>/tools/call`, refused with `no_active_org` without one, Desktop 2.7032), and 3p mode has no account; Anthropic's docs say "Made by Anthropic" connectors are only in standard Desktop, and others reach 3p through `managedMcpServers` or plugins (claude.com/docs/third-party/claude-desktop/extensions).
- On a Mac, Claude Desktop on magpie can run beside the user's own Claude Desktop signed in with Anthropic (#5671, baranwang on X): off by default (`settings.DesktopIsolated`); turned on by the "Separate app" switch in Claude Desktop's opened row (`POST /api/settings/desktop-isolated`) or `magpie claude-desktop launcher add`, both `SetDesktopIsolated` in [`claudedesktop_isolated.go`](../../internal/agent/claudedesktop_isolated.go). It makes `~/Applications/Claude Magpie.app` ([`desktopiso`](../../internal/desktopiso/desktopiso.go): Claude's own icon with a magpie badge, an `sh` executable that runs Claude.app's executable with `--user-data-dir=~/Library/Application Support/Claude-Magpie-3p` and opens no second one while it runs) and moves a Desktop on magpie there: the usual sets are put back as before magpie (`desktopOff`) and the isolated set (`desktopIsolatedSet`, stash key `.isolated`, MCP servers and language read from the user's own Desktop) gets the 3p mode. Turned off, the app goes and Claude-Magpie-3p goes off magpie; the wiring goes back to the usual sets only when it came from them (stash `claude-desktop.isolated-from-own`), so a twin made beside a Desktop not on magpie never puts the user's own Desktop on magpie (xMopf7RF on X). One turned on before that mark existed leaves the user's own Desktop off magpie too. While on, `desktopSets` is that set alone; the row's file stays the user's own. The folder ends in `-3p` because Desktop (`GY()` in 4.4212's app.asar) adds `-3p` to a userData that doesn't, and `CLAUDE_USER_DATA_DIR` is dropped by the packaged app, so only the flag works. Windows hardcodes `%LOCALAPPDATA%\Claude-3p`, so it is macOS only (`desktopdir.Isolated` is "" elsewhere). Two Claude.app processes then run: `desktopInstance` (`restartable.macCmd`) keeps Restart and "running on the old settings" on the wired one, and Restart quits the isolated one by `pkill -TERM` on its command line (`desktopIsoQuit`) and opens the app again. The gateway's model selector reads Claude-Magpie-3p first (`desktopSelectorRoots`). Not done: the Dock shows Claude's own icon for the running isolated Desktop, and Desktop turns its Chrome pairing off in a moved userData.
- Claude Magpie's Code tab can have a Claude Code folder of its own (#6459, xMopf7RF on X): `settings.DesktopIsolatedClaude`, on for a Claude Magpie made new and off for one made before. Made new is the app off and no Claude-Magpie-3p folder yet, and the user never set it (`DesktopIsolatedClaudeChosen`, which the fold and the CLI set): then `desktopIsoClaudeDefault` turns it on before the app is made, so the twin's Code tab writes nothing of `~/.claude`, like a phone's app clone. One with chats in Claude-Magpie-3p already, or one the user turned off, keeps `~/.claude`. Set under the Separate app's Advanced fold (`POST /api/settings/desktop-isolated-claude`, drawn by `claudemagpie.js`) or `magpie claude-desktop launcher claude-dir on|off`, both `SetDesktopIsolatedClaude`. While on, and the Separate app is on, the app's script exports `CLAUDE_CONFIG_DIR=~/.claude-magpie-desktop` (`desktopiso.Script`'s `claudeDir`), which Desktop passes to its bundled Claude Code, and `desktopOn` in [`claude.go`](../../internal/agent/claude.go) writes Desktop's model windows, caps and explore entries into that folder's `settings.json` instead of `~/.claude`'s (`desktopCodeDir`, `desktopClaudeSync`); off moves them back. The folder stays when it is turned off, and it is a `claude#` row named "Claude Code · Claude Magpie" (`claudeDirAgents`). A change remakes the app; a running Claude Magpie keeps the old environment until it is quit and opened again. Its Library has no targets yet. The "Use Claude Magpie" button on Claude Desktop's row while it isn't on magpie turns the Separate app on and then connects Desktop (`desktopTwinBtn`, also `claudemagpie.js`), so only Claude-Magpie-3p is wired and the user's own Desktop is left as it was. `TestClaudeDesktopIsolatedClaudeDir`, `TestClaudeMagpieTwinLeavesTheOriginal`, `TestClaudeMagpieOwnFolderKeepsWhatWasSet`, `TestScriptClaudeConfigDir`, `desktop-isolated-claude.test.cjs`, `desktop-twin.test.cjs`.
- Claude Magpie's Code tab can have a Claude Code folder of its own (#6459, xMopf7RF on X): `settings.DesktopIsolatedClaude`, on for a Claude Magpie made new and off for one made before. Made new is the app off and no Claude-Magpie-3p folder yet, and the user never set it (`DesktopIsolatedClaudeChosen`, which the fold and the CLI set): then `desktopIsoClaudeDefault` turns it on before the app is made, so the twin's Code tab writes nothing of `~/.claude`, like a phone's app clone. One with chats in Claude-Magpie-3p already, or one the user turned off, keeps `~/.claude`. Set under the Separate app's Advanced fold (`POST /api/settings/desktop-isolated-claude`, drawn by `claudemagpie.js`) or `magpie claude-desktop launcher claude-dir on|off`, both `SetDesktopIsolatedClaude`. While on, and the Separate app is on, the app's script exports `CLAUDE_CONFIG_DIR=~/.claude-magpie-desktop` (`desktopiso.Script`'s `claudeDir`), which Desktop passes to its bundled Claude Code, and `desktopOn` in [`claude.go`](../../internal/agent/claude.go) writes Desktop's model windows, caps and explore entries into that folder's `settings.json` instead of `~/.claude`'s (`desktopCodeDir`, `desktopClaudeSync`); off moves them back. The folder stays when it is turned off, and it is a `claude#` row named "Claude Code · Claude Magpie" (`claudeDirAgents`). A change remakes the app; a running Claude Magpie keeps the old environment until it is quit and opened again. Its Library has no targets yet. The "Use Claude Magpie" button, beside Claude Desktop's switch while it isn't on magpie (its own button there, not words in the status line, so it reads as a way that doesn't connect the user's own Desktop), turns the Separate app on and then connects Desktop (`desktopTwinBtn`, also `claudemagpie.js`), so only Claude-Magpie-3p is wired and the user's own Desktop is left as it was. `TestClaudeDesktopIsolatedClaudeDir`, `TestClaudeMagpieTwinLeavesTheOriginal`, `TestClaudeMagpieOwnFolderKeepsWhatWasSet`, `TestScriptClaudeConfigDir`, `desktop-isolated-claude.test.cjs`, `desktop-twin.test.cjs`.
- Claude Desktop names a Claude model with reasoning levels after its own catalog ("Opus 5.5"), not by the `display_name` magpie lists, because magpie lists it as `magpie-<number>.anthropic.<model>` to keep its effort picker (`claudeLooking` in [`desktop.go`](../../internal/gateway/desktop.go)). Desktop 4.4212 labels a picker row by its catalog's name before `display_name` (only an admin's `inferenceModels` list carries the `labelOverride` that beats it; magpie writes one, with each row's `display_name`, only while a tier is picked), so two providers' rows of one model read alike and Desktop adds the tail of the id, "Opus 5.5 (…7922287072.anthropic.claude-opus-5-5)". Desktop shows the gateway's `description` under the name, before the catalog's, so such a row's description names its provider when the Provider in model names setting puts it after the name (`desktopSaidBy`: on, every one; off, only two of one name), and a 1M row listed by its `[1m]` id says "1M context window · <provider>" (4 v5 on Discord, `TestClaudeDesktopCatalogNamedSaysProvider`). The id stays as it was. The provider editor shows the number too on the model's chip (`gateway.DesktopNumber`, `desktopNumbers` in [`providers.go`](../../internal/gui/providers.go), #2578). The chip shows it only while Claude Desktop is installed and is shown that model. Every other model Desktop is shown carries no number on the chip: Desktop names it by `display_name`, which already says the provider, or by its own id.
- Codex's `spawn_agent` tool names only the first five models of its catalog to the lead (codex-rs `MAX_SPAWN_AGENT_MODEL_OVERRIDES` in `child_config.rs`, `spawn_agent_models_description`), Codex's own ahead of magpie's, though it takes any catalog model by name (`find_spawn_agent_model_name`). So a lead could put its subagents on none of magpie's models (Gearclickist on Discord). The gateway adds the rest of the catalog Codex was handed to that tool's description, after Codex's own list, at most 200 (`spawnAgentModels` in [`codex_spawn_models.go`](../../internal/gateway/codex_spawn_models.go)). A model that can search tools (`supports_search_tool`) isn't handed it in the request's tools: Codex defers its multi-agent V1 tools behind `tool_search` (codex-rs `core/src/tools/spec_plan.rs`), and the lead gets `spawn_agent` in the `tool_search_output` Codex puts in the conversation and sends again every turn, so that one is widened too. That text goes upstream with the prompt, to OpenAI too for a ChatGPT lead, so its header (`spawnMore`) stays neutral: it names neither magpie nor Codex's limit. At `CodexPath` that is Codex's own listed models less the hidden ones, then `CodexListed` unless Codex is held to its own. At `/v1` it is `CodexCatalog` under the key's allowance. A lead the ChatGPT backend answers in multi-agent V2 seals its subagents' tasks for a ChatGPT account (#619), so it gets Codex's own only. The model catalog Codex puts in context under `model_catalog_in_context` (under development, off by default) is capped at five too, and isn't widened.
- Snow CLI runs on one profile at a time (`profiles/<name>.json` in `~/.snow` or `$SNOW_CONFIG_DIR`, named in `active-profile.json`) and copies the active one over `config.json` at every start, `snow --ask` too ([`snow.go`](../../internal/agent/snow.go)). magpie writes a `magpie` profile, makes it the active one, and copies it to `config.json` itself, so a Snow already running and Snow App's "Sync Snow CLI API config" see the same. It is made from the profile the user was on, their settings kept and its OAuth sign-in left out. A vision model of that profile comes along only with an endpoint and key of its own (`snowOwnVision`), since one on the profile's would now go to the gateway. `maxContextTokens`, `maxTokens` and `supportsVision` follow the model from the catalog (`snowSynced`; `supportsVision` as every agent is told, true while magpie's Vision describes images); what magpie last wrote of them is stashed, and one the user changed since in Snow's own settings is kept through later picks and syncs. The small field is magpie's profile's `basicModel`, Snow's light model for summaries, compaction and file search: empty while it follows the main model, a model through magpie of its own kept through new main models and syncs; on a profile of the user's it offers nothing and is hidden. The thinking field is magpie's profile's `chatThinking` (`{enabled: true, reasoning_effort}`), the only thinking setting Snow reads on the chat protocol; empty deletes it, Snow's default, which sends thinking disabled. A chatThinking the user brought from their profile is shown, not written over. The profile they were on (or that there was no `active-profile.json`) and a `magpie.json` of their own are stashed and put back by Disconnect. A Snow from before profiles (`config.json` alone) gets the `default.json` Snow itself would have made of it, so its next start doesn't take magpie's for the user's. Picking a model of another of the user's profiles switches Snow to that profile. On magpie's profile, a value that is neither a model through magpie nor the model of one of the user's profiles is refused and changes nothing (#1457: `magpie snow --help` used to take magpie out and write `--help` as the model of the profile it went back to). Gemini CLI's auth field refuses an auth it doesn't know before it unroutes, for the same reason. On the CLI, `-h`/`--help` after any command or agent only prints its usage, before `run` reads or moves anything, and any other flag given to `magpie <agent> …` is refused (`help_cli.go`; `TestHelpOnEveryCommandDoesNothing` walks `run`'s switch and every agent).
+4
View File
@@ -5131,6 +5131,10 @@ body.window .row + .row.agent.conn > .who { min-height: 41px; } /* the line abov
.row.agent.conn > .ag-conn { margin-left: 4px; align-self: center; cursor: pointer; }
.row.agent.conn > .ag-link + .ag-conn { margin-left: 4px; }
.row.agent.conn > .who + .ag-conn, .row.agent.conn > .who + .ag-add, .row.agent.conn > .who + .ag-cant { margin-left: auto; }
.row.agent.conn > .who + span[hidden] + .ag-conn { margin-left: auto; }
.row.agent.conn > .ag-twin { margin-left: 8px; align-self: center; }
.row.agent.conn > .ag-twin + .ag-conn { margin-left: 10px; }
.row.agent.conn > .who + .ag-twin { margin-left: auto; }
.row.agent.conn > .ag-conn:disabled { opacity: .4; cursor: default; }
/* the model it starts on, beside the switch: one width down the list, so
the pickers and the switches line up */
+2 -1
View File
@@ -1414,7 +1414,6 @@ function connectLine(a, kind) {
else say(t("Not connected · {agent} uses its own settings", { agent: a.name }));
if (sw) line.append(sw.button);
if (a.appRestart) line.append(appRestart(a));
if (a.isolated && !a.isolated.on) line.append(isoLazy("desktopTwinBtn", a));
return line;
}
if (a.native) {
@@ -1581,6 +1580,8 @@ function connectRow(a, row, who, { fields, extras, fieldBtn, sw, kind }) {
if (start) row.append(startButton(a, start, fieldBtn));
// Claude Desktop's: which models its own menu lists
else if (menuFromList(a)) row.append(menuButton(a));
// Use Claude Magpie, beside the switch: the twin, made without the user's own Desktop (xMopf7RF on X)
if (!a.wired && a.isolated && !a.isolated.on) row.append(isoLazy("desktopTwinBtn", a));
row.append(sw);
} else if (kind === "empty") {
const add = el("button", "ag-add", t("Add a provider"));
+1 -1
View File
@@ -6,7 +6,7 @@
// user's own Claude Desktop left as it is (xMopf7RF on X, #6459), like a
// phone's app twin: its own app, its own folder
window.desktopTwinBtn = function (a) {
const b = el("button", "ag-quiet ag-twin", t("Use Claude Magpie"));
const b = el("button", "ag-add ag-twin", t("Use Claude Magpie"));
b.type = "button";
b.title = t("A second Claude Desktop, on magpie, in Applications. Your own Claude Desktop isn't changed. macOS only.");
b.onclick = async (e) => {
+13 -1
View File
@@ -1,6 +1,7 @@
// Run with Node's test runner and Playwright on the module path; see README.md.
// Claude Magpie as a twin (xMopf7RF on X, #6459): Claude Desktop's row,
// not on magpie, has a "Use Claude Magpie" button on a Mac. It turns the
// not on magpie, has a "Use Claude Magpie" button beside its switch on a
// Mac, not in its status line. It turns the
// Claude Magpie app on and then connects Desktop, which puts only that
// app on magpie; the user's own Desktop isn't wired. The button is gone
// once the app is on, and isn't there off a Mac (no isolated in the state).
@@ -100,6 +101,17 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal(await b.getAttribute("title"), w.tip);
const box = await b.boundingBox();
assert.ok(box.x + box.width <= width && box.height > 0, JSON.stringify(box));
// its own button beside the row's switch, not words in the status
// line (xMopf7RF on X: "在 Claude Desktop 旁边单独加一个按钮")
assert.equal(await page.locator(`${cd} .ag-st .ag-twin`).count(), 0, "in the status line");
// the fold's rows still moving in measure nothing
await page.waitForFunction(() => !document.getAnimations().some((x) => x.playState === "running"));
const sw = await page.locator(`${cd} > .ag-conn`).boundingBox(), at = await b.boundingBox();
assert.ok(Math.abs(sw.y + sw.height / 2 - (at.y + at.height / 2)) < 2, `not level with the switch: ${JSON.stringify([sw, at])}`);
const gap = sw.x - (at.x + at.width);
assert.ok(gap >= 8 && gap <= 28, `not beside the switch: ${gap}`);
const st = await page.locator(`${cd} .ag-st`).boundingBox();
assert.ok(st.x + st.width <= at.x + 1, "status runs under the button");
const y = await page.evaluate(() => scrollY);
await b.click();