Commit Graph
7 Commits
Author SHA1 Message Date
yetone 39569d5604 claude desktop: an optional Claude Magpie app beside your own Claude (#5671)
baranwang on X asked to keep Claude Desktop's own (1P, Anthropic) sign-in
while using magpie. Turning on "Separate app" in Claude Desktop's row on
the Agents page (or `magpie claude-desktop launcher add`) moves magpie's
3P wiring into ~/Library/Application Support/Claude-Magpie-3p and adds
~/Applications/Claude Magpie.app. That launcher opens Claude.app with
--user-data-dir on that folder, so it runs side by side with the user's
own Claude.app. Its icon is Claude's icon with a magpie badge. Off is the
default, and turning it off (`launcher remove`) moves the wiring back
and removes the app. It is macOS only: Desktop's packaged app strips
CLAUDE_USER_DATA_DIR, and on Windows it hardcodes LOCALAPPDATA\Claude-3p.
The folder ends in -3p because Desktop adds -3p to any other name.
Restarting the isolated app ends only its own process (pkill on its
--user-data-dir) and opens the launcher again.

Run at 1b25cda26 (this change on origin/main be9dbce02); rebased onto
fdabddeb4 (catalog only), then go build ./..., vet and the budget and
launcher tests again: ok. All
on mote:
- gofmt -l clean; go vet ./internal/...; GOOS=linux go vet -tags nogui
  and GOOS=windows go vet on agent, cli, desktopiso, desktopdir, gui.
- go test (whole packages) desktopiso, desktopdir, settings, settingsapi,
  proc: ok. -run Isolated|TestDesktopInstance|TestAddStartsDesktopOnTheFolder|
  TestScript|TestAddLeavesTheirs|ClaudeDesktop|Restart in agent;
  TestClaudeDesktopLauncher|TestEveryRouteHasACommandOrIsNamed|Help in cli;
  TestCoreScriptBudget|TestSettingsSaveKeepsWhatItDoesNotSend|Budget|Desktop
  in gui and gateway: ok.
- An earlier full `go test ./...` at fef23255f had four reds, all from
  this change and fixed here: the route without a command (now in
  notYet), settings_keep's DesktopIsolated, os/exec instead of proc, and
  the core script budget (paid by sharing the switch helper with the
  largest-window line and cutting comments; no raise). A second full run
  of the touched packages queued ~7h on mote's suite lock behind other
  sessions and was stopped; the targeted runs above replace it.
- GUI on mote, both engines: desktop-isolated (new; en, zh, zh-TW, ja,
  de; 1100 and 640; aria-checked, posts, status text, no scroll, no
  select, absent without `isolated`), desktop-longest, click-scroll,
  plain-names, i18n-keys: ok. page-width-steady, panel-fold and
  zero-priced-free are red, the same 33 tests at origin/main be9dbce02
  (diffed): #4541/#5013, #5796, #5262. i18n-keys' "a plugin's words are
  its own" is red on main too (#5332).
- Whole GUI suite on WSL at an older head: 400 of 22778 red across
  ~100 files of other pages, in line with #5559 (478 of 21666 on main
  there). Not rerun on mote.

Real use, on mote in a sandbox HOME with Claude.app 4.23118 linked in:
`claude-desktop magpie`, then `launcher add`, moved the wiring to
Claude-Magpie-3p (deploymentMode 3p, mcpServers and locale carried).
Opening Claude Magpie.app started Claude with
--user-data-dir=.../Claude-Magpie-3p; it wrote configLibrary and
model-catalog there (3P mode) and no -3p-3p folder. A second, 1P Claude
ran beside it on its own sandbox folder. Opening the launcher again
kept one instance; the pkill pattern matched only the isolated pid; both
quit on SIGTERM. `launcher remove` put the wiring back and removed the
app.

Broken by hand: a folder without -3p (Desktop made -3p-3p), the
CLAUDE_USER_DATA_DIR env route (ignored by the packaged app), os/exec in
the quit (TestNoCommandBypassesProc red).

Not tried: a screenshot of the running app (screencapture fails over
ssh); a model request through a gateway from the isolated app; Windows
and Linux (not offered there). Known: the Dock shows Claude's own icon
for the running isolated app, and Chrome pairing is off in a moved
userData folder.
2026-11-09 22:31:16 +08:00
yetone fccf86d62e agents: Claude Code found only inside Claude Desktop says so
cybercaius (Discord, Windows): with Claude Code uninstalled and only
Claude Desktop installed again, the Agents page still listed Claude Code
by its ~\.claude, with nothing saying why. Desktop 2.7032 fetches its own
Claude Code for its Code tab (<userData>\claude-code\<version>\claude.exe,
Claude-3p's folder in its gateway mode), which reads the same
~/.claude/settings.json, so the card is right to stay. desktopdir finds
that copy and its newest version; with no Claude Code of its own, the CLI
reports InDesktop (and DesktopVersion once Desktop fetched one), and the
card carries an "In Claude Desktop" tag (en, zh, zh-TW, ja, de) whose
tooltip names the version and settings path and says Desktop's Code
sessions in WSL use the WSL card. A Claude Code of its own still wins.

Run:
- TestClaudeCodeInDesktop and the desktopdir tests: ok. Broken by hand:
  red with the change taken out.
- node --test internal/gui/tests/claude-in-desktop.test.cjs (en, zh,
  zh-TW, ja, de; 980 and 560 wide): mote Chromium 10 of 10 ok; WSL box
  (magpie-desktop) Chromium 18 of 18 and WebKit 28 of 28 ok with
  i18n-keys and agent-app-version beside it. On the old app.js the 10
  Chromium cases are red (that run ended without its summary line).
- i18n-keys: ok.
Not run on macOS WebKit: a bare WebKit launch on mote hangs at 60s with
no test involved. agent-app-version's Chromium closed mid-run on mote
(display link error under load ~60); it passes on Linux.
2026-10-29 12:42:52 +08:00
yetone 612b759d21 agent: Claude Desktop installed on Windows and not yet opened is listed (#1482, edussss)
Claude Desktop was listed by its data folders (%APPDATA%\Claude,
%LOCALAPPDATA%\Claude, the MSIX LocalCache), which it makes when first
opened. desktopdir.Installed now also counts Squirrel's
%LOCALAPPDATA%\AnthropicClaude\claude.exe and the MSIX's package folder;
an AnthropicClaude folder left without claude.exe doesn't count.

Run: TestClaudeDesktopInstalledNotOpened (red without Installed) on
macOS and on the Windows box, the existing TestClaudeDesktop* tests, the
full suite, gofmt -l, go vet -tags nogui on darwin, linux and windows.
2026-10-11 08:18:27 +08:00
yetone a5114d931f agent: Claude Desktop from its MSIX isn't said to be off magpie when the package's copy is emptied, and Reconnect puts its gateway back (dumplings)
dumplings (Windows, Desktop 2.31226.0 from the MSIX) saw "Claude Desktop
已不经过 magpie:配置已变更" while Desktop ran on magpie, and Reconnect
didn't clear it; switching Desktop's provider off magpie and back did.
Two causes:

- Check went over both sets of folders magpie writes for a packaged
  Desktop (the package's LocalCache and the real ones, as which build
  is installed can't be told) and failed when either was off magpie.
  2.31226 reads the real %LOCALAPPDATA%\Claude-3p (bg5eau, already in
  desktopdir), so the package's copy, emptied, isn't Desktop off
  magpie. desktopRead now judges only the set whose Claude-3p Desktop
  ran in last ("Local State", desktopdir.LastRun), every set when it
  ran in none, as before.
- Reapply on an unwired drift re-set the field drift shows on and
  fields on magpie's models. Desktop's drift shows on a tier (sonnet,
  on a magpie model), and its provider field ("magpie") isn't a model,
  so the gateway was never written back. Reapply now also re-sets a
  field whose value is magpie itself, as Wired already counts it.

The reporter's analysis said 2.31226's AppxManifest excludes
Claude-3p from virtualization; that manifest wasn't seen here (the
Windows box has no MSIX Desktop), the fix rests on Desktop reading the
real Claude-3p, which bg5eau's case showed.

Run: TestClaudeDesktopMSIXChecksTheFoldersDesktopRuns (MSIX layout:
package Roaming\Claude and Local\Claude-3p with an older Local State,
the real Claude-3p newer); red with Check over every set, and red
with Reapply without the magpie-valued field. go test -tags nogui for
internal/agent, internal/desktopdir, internal/gui, internal/library;
the agent package's TestClaudeDesktop* built for windows/amd64 and run
on the Windows box, all pass; gofmt -l; go vet -tags nogui on darwin,
GOOS=linux and GOOS=windows for internal/agent, internal/desktopdir.
2026-10-10 19:01:11 +08:00
yetone 494dedcf8f desktopdir: Claude Desktop installed from the Microsoft Store (package AnthropicPBC.Claude_*) has its folders found, as the setup.exe's Claude_* package's are
Desktop 2.31226.1's own code knows two MSIX package families, Claude_pzs8sxrjxfjjc
and AnthropicPBC.Claude_fnn82j28hfe8t (hze/_ze in index.chunk-Cyt2WTko.js).
packageDir only globbed Packages\Claude_*, so a Store install's LocalCache
was never found: magpie wrote Claude Desktop's gateway, MCP servers and
read its sessions and skills in the unpackaged folders instead.

Checked while following up v0.1.1156: the same bundle has a
%LOCALAPPDATA%\Claude-Data folder for 1p userData, but in 2.31226.1 it is
dormant. globalThis.userDataMoved is only read, never set, and the
Claude-Data dir is chosen only when %APPDATA% is a network share, while
relocateUncUserData does nothing in index.pre.js. So 1p userData is still
%APPDATA%\Claude (or the package's copy), and desktopdir is left as it is for
that.

Run: go test ./internal/desktopdir ./internal/library ./internal/agent
(macOS); TestFindMSIX fails on the old packageDir for the Store family;
desktopdir's Windows test binary passes on the Windows box; go vet for
linux, windows and darwin.
2026-10-10 14:55:16 +08:00
yetone 282c9feb23 agent: a packaged Claude Desktop gets magpie's gateway in the real %LOCALAPPDATA%\Claude-3p too, which 2.31226 reads, not only the package's (bg5eau on X)
bg5eau on X: Claude Desktop 2.31226.1, installed as an MSIX package on
Windows, never reached magpie. magpie wrote deploymentMode and its
configLibrary profile only into the package's
LocalCache\Local\Claude-3p, and that build reads the real
%LOCALAPPDATA%\Claude-3p. Copying configLibrary there and setting
deploymentMode 3p fixed it for them.

What the build does: 2.31226.1's asar (index.chunk-Cyt2WTko.js) resolves
the 3p userData with Ou() = path.join(LOCALAPPDATA, "Claude-3p"). 2.7032.0
has the same code (GY()). It reads deploymentMode from
Ou()/claude_desktop_config.json and the gateway from Ou()/configLibrary.
The path didn't change; the package stopped redirecting it into
LocalCache. An install's folders don't say which build it is, so:

- desktopdir.Sets returns every set of folders: Find's choice first, then
  the other one for an MSIX install. Everywhere lists every set's folders.
- Claude Desktop's switch writes and removes deploymentMode, the profile
  and _meta.json in each set. The package's set keeps its own stash keys
  (".package"). A stash that an older magpie wrote for the package's
  folders moves onto those keys, so turning it off still restores them.
- The check runs on each set, names the folder when there are two, and
  checks Claude-3p's deploymentMode as well.
- The siblings: the library's MCP servers go into every Claude-3p file
  that exists, and Cowork skills and Desktop sessions are read from every
  set.

Run:
- go test ./internal/{desktopdir,agent,library,sessions,usage}: green.
- The new tests (TestClaudeDesktopMSIX, TestClaudeDesktopMSIXStashBefore,
  TestClaudeDesktopMSIXBoth3p) and TestCallsCoworkMSIX are red against
  the old code. StashBefore also goes red with desktopAdoptStash disabled.
- gofmt; go vet for darwin, linux and windows.
- On the Windows box, Windows test binaries for the four packages:
  - desktopdir and library pass.
  - agent and sessions fail exactly the set that main's binaries fail
    there (#1388, and newly filed #1468).
  - Every Desktop test passes.
2026-10-10 14:13:05 +08:00
yetone 5d0c1dcad7 agent, library, sessions: a Claude Desktop installed as an MSIX package on Windows is found, wired, given MCP servers and skills, and its Cowork calls read, in the package's folders (Kilig on Discord, Windows 10 LTSC 21H2)
Desktop from its setup.exe there runs packaged, so Windows keeps what it
writes under %APPDATA% and %LOCALAPPDATA% in
%LOCALAPPDATA%\Packages\Claude_<publisher>\LocalCache\{Roaming,Local}.
Nothing was in %APPDATA%\Claude or %LOCALAPPDATA%\Claude*, so magpie didn't
recognise Desktop at all. The packaged app reads its own copy before the
real folder's, so writing the usual folders wouldn't reach it either.

New internal/desktopdir is the one resolver for Desktop's folders: Data
(its own userData: %APPDATA%\Claude, the package's LocalCache\Roaming\Claude),
Mode (the Claude folder deploymentMode goes into, %LOCALAPPDATA%\Claude as
before) and ThreeP (Claude-3p). The package is found by globbing
Packages\Claude_* (the publisher id isn't assumed) and used unless Desktop
runs in the usual folders: it has run there (Chromium's "Local State"; an
%APPDATA%\Claude holding only another tool's claude_desktop_config.json
doesn't count) and not later in the package's. Every place that built
these paths goes through it:

- agent: desktopDirs (its 3p switch's writes, DesktopConfig3p, Claude
  Code's desktop check in claude.go) and detection, which also looks at
  Data (replacing the separate %APPDATA%\Claude check). windowsDesktopDir
  moved into desktopdir unchanged.
- library: apps() (Desktop's MCP file, was os.UserConfigDir) and
  desktopSkillRoots (Cowork's skills-plugin).
- sessions: desktopDataDirs, a copy of agent's resolver, now desktopdir's
  All(); it also adds %APPDATA%\Claude on a usual Windows install, where
  Desktop keeps 1p Cowork sessions (only %LOCALAPPDATA%'s were read). usage's
  request_page and session_provider read it through sessions.DesktopDataDirs.

Tests: TestFindMSIX/TestFindWindowsClassic/TestFindOthers (desktopdir),
TestClaudeDesktopMSIX (agent: detected, switch writes LocalCache\Local\Claude
and Claude-3p, nothing in the usual folders), TestClaudeDesktopMSIXLibrary
(MCP file and skills-plugin in LocalCache\Roaming\Claude),
TestCallsCoworkMSIX (sessions). With the call sites put back to origin/main
the last three fail: "an MSIX Claude Desktop isn't detected", "no Claude
Desktop target: <nil>", "dirs: [.../Claude .../Claude-3p]".

Run: go test -tags nogui ./... under a temp HOME with pinned caches (all
ok); GOOS=darwin|linux|windows go vet -tags nogui on desktopdir, agent,
library, sessions, usage; GOOS=windows go build, GOOS=linux go build -tags
nogui. On the Windows 11 box (Squirrel install, no MSIX package): the
windows test binaries pass every Desktop/MSIX/Cowork test; the full agent
and sessions binaries fail the same 16 and 76 tests (run outside their
testdata) as origin/main's; a read-only probe of desktopdir.Here() gives
the usual %APPDATA%\Claude, %LOCALAPPDATA%\Claude and Claude-3p, Package "".
Not tried against a real MSIX Desktop: none on the box, and Claude-3p's
place in the package (LocalCache\Local, as Local\Claude is in Kilig's
listing) is inferred, not seen.
2026-10-08 12:47:48 +08:00