Commit Graph
7 Commits
Author SHA1 Message Date
yetone bf05291e2c provider: a Claude sign-in with no Claude Code downloads it first (Kabubu01)
Kabubu01 (X, 2117435171205259713) added a Claude account in the GUI on a
computer with no Claude Code: the card ended "登录未完成" with the English
"install Claude Code first, the `claude` command line … magpie signs in to
Claude through it; … `magpie claude-code install`". Every other
subscription used through its vendor's CLI (Devin, Cursor, Grok) installs
it when its sign-in starts; Claude's only said how.

cliFor("claude") is now Claude Code: found by findClaudeCLI (this
computer's, magpie's download, or WSL's), installed by
downloadClaudeCode, which is what `magpie claude-code install` does:
claudecode.Latest, then claudecode.Install, Anthropic's own build checked
against its manifest's SHA-256 and size, into magpie's cache, not on
PATH. claudeExecutable (claudecode.Find) finds it there, so the sign-in
goes on as before. The card shows the existing "Installing Claude Code…"
state (strings already translated). runInstaller uses a CLI's native
installer on every OS when it has no shell one-liner, and a failed
download's error names `magpie claude-code install` as the manual way.

What was run:
- TestClaudeSignInDownloadsClaudeCode (installing → paste page → done
  after the fake download) and TestClaudeSignInDownloadFails (the error
  carries the cause and `magpie claude-code install`), new, plus every
  -run 'SignIn' test, on mote: ok. isolate() fakes the download, so no
  test reaches downloads.claude.ai.
- Broken by hand: with cliFor's claude case renamed, both new tests red.
- go test ./internal/provider on mote: ok (160s).
- Windows (win-run, xiaomi-gpu): TestClaudeSignInDownloadFails,
  TestSignInInstallFails, TestSignInCanceledWhileInstalling,
  TestWindowsInstallerNotOnCommandLine ok; the download-then-sign-in test
  skips there, as every fake-claude sign-in test does (shell fakes).
- GOOS=linux go vet -tags nogui and GOOS=windows go vet of
  ./internal/provider on mote: ok. gofmt -l clean.
- Real download in a sandbox HOME on mote, PATH=/usr/bin:/bin:
  `magpie claude-code install --yes` (the same Latest+Install calls)
  fetched and checked Claude Code 2.1.317 into .cache/magpie/claude-code,
  and it ran (`2.1.317 (Claude Code)`).
- Rebased on a92e85ab2 (two provider commits): go test ./internal/provider
  on mote again: ok (138s).

Not changed: the gateway's "Claude Code is not installed" (a request
path; a 240MB download doesn't belong under a request).
Not tried: the GUI sign-in end to end with a real download, and a
download slower than installTimeout's 10 minutes (it fails with the
manual command).
2026-11-03 10:44:15 +08:00
bbornandClaude Opus 5.5 ae7dc10ae2 docker: the image is Debian 12 slim, so the Cursor and Devin CLIs magpie installs at sign-in run in it (#2834, bborn2)
magpie installs a subscription's CLI at sign-in with its vendor's
`curl … | bash` (internal/provider/install.go: Cursor, Devin, Grok
Build). The distroless image had no curl and no /usr/bin/env (the
installers' shebang), so that install couldn't run there, and only
Grok Build had a native fallback. bborn2 reported that a Cursor CLI
installed by hand failed with "cannot execute: required file not
found". The image is now debian:12-slim with ca-certificates and
curl. It keeps the nonroot user at uid/gid 65532, HOME and XDG under
/config, the healthcheck, and magpie on PATH. Size: 157MB against
82MB for origin/main's image, both built here on arm64. Running a
feature magpie offers is worth the 75MB.

Changed in review: dropped the branch's GOPROXY build arg, a separate
goal. The comments in install.go and install_test.go that said the
image has no curl now say "had". docs/reference.md and the site's
Docker page (en, zh, ja) say Debian with bash and curl instead of
distroless with busybox.

Run, with OrbStack's docker:
- docker build of this tree and of d783df46c's Dockerfile: 157MB vs
  82MB.
- docker run of the new image: health "healthy", user nonroot (id
  65532). `curl https://cursor.com/install -fsS | bash` exit 0, then
  `~/.local/bin/cursor-agent --version` printed 2026.10.16-e3cb207.
  Devin's install.sh installed devin v3000.11.92 (its trailing
  `devin setup` said "Login canceled" with no terminal, as on any
  host). `devin --version` printed 3000.11.92. bash and `magpie
  version` run.
- Old image: `which curl` finds none, and /usr/bin/env doesn't exist.
- A volume written by the old image (file owned 65532) was read and
  written by the new image.
- gofmt -l clean; go vet darwin, linux (nogui) and windows clean.
- Full `go test -tags nogui -timeout 45m ./...`: every package ok
  except internal/agent and internal/gateway, which timed out at 45m
  mid-test (TestConnectSaysHow, TestLargeRequestEndpoints) under a
  load average of about 200 from parallel suites. This commit changes
  no code those packages build, only comments in internal/provider,
  which passed (992s), so they weren't rerun.
Not tried: a Grok Build install inside the image, and a full
in-magpie Cursor/Devin sign-in with a real account in the container.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 00:19:53 +08:00
yetone 522da8f2e7 provider: Grok and Devin install in the Docker image again: a vendor's shell one-liner needs curl, which the image (bash and busybox wget since 7bfe3137) doesn't have, so the native installer runs there
ghcr.io/yetone/magpie:latest has /bin/bash and /bin/wget but no curl, so
shellInstallerRuns said yes and `curl … | bash` failed. TestShellInstallerNeedsCurl
fails on the old check.
2026-10-08 09:01:23 +08:00
hisilingandSiling 84d2d75205 provider: Windows 上 Devin 的登录装得上 Devin CLI 了:安装命令从 stdin 进 PowerShell,devin setup 不再卡住登录 (#1225) (#1226)
* provider: a sign-in on Windows installs its CLI past Microsoft Defender, which stopped the installer's command line as a Trojan (#1225)

On Windows the sign-in ran the vendor's installer as `powershell -NoProfile -ExecutionPolicy Bypass -Command irm https://static.devin.ai/cli/setup.ps1 | iex`, and Microsoft Defender takes that command line for Trojan:Win32/Commando.A!ml. It stopped PowerShell before it ran, so Devin's sign-in failed with "installing Devin CLI failed (fork/exec C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe: Access is denied.)" while Windows Security said it found a threat (hisiling, Windows 11, v0.1.1106, three tries, three detections). The one-liner now reaches `powershell -NoProfile -ExecutionPolicy Bypass -Command -` on stdin, as one typed into PowerShell does, so no command line carries it. Cursor's and Grok's installers go the same way. The installer's output and exit code come back as before, and one that would ask something still reads nothing.

TestWindowsInstallerNotOnCommandLine fails without the change on Windows 11 (PowerShell's command line carries the installer: powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Output ([Environment]::CommandLine); exit 7") and passes with it. On the same machine, with Defender's real-time protection on, Devin's sign-in started the way the window's button starts it (provider.StartSignIn, from a program with no console) ran the real setup.ps1 with no detection and installed Devin CLI 3000.11.3. go vet ./internal/provider and go test -run 'Install|SignIn' ./internal/provider pass on Windows; go vet -tags nogui ./..., go build -tags nogui ./..., GOOS=windows go build ./... and the windowsgui build pass on Linux.

* provider: Devin's sign-in on Windows goes on once the Devin CLI is in place, where its installer's `devin setup` held it for ten minutes and was left running (#1225)

Devin's setup.ps1 ends in `devin setup`, whose menu asking how to sign in waits for a key on the console. The console an installer gets from magpie has no window (the app has none, so its children get CREATE_NO_WINDOW) and magpie keeps its output, so no one can answer it: the sign-in stayed "installing" until installTimeout ended the installer ten minutes later, and `devin setup` went on running. It waits the same way with stdin from NUL, and CI=true or TERM=dumb don't change it; `devin setup` has no option but --force-manual-token-flow. On Windows, the installer of a CLI marked setup (Devin's) now runs as a proc.Tree. Once the CLI is in place, read with the user PATH the installer wrote, it has installerTail (5s) to end by itself, then it is ended with everything it started, as it is when the sign-in is canceled or times out. magpie's own sign-in follows as before. Cursor's and Grok's installers, and every installer off Windows, run as they did.

TestWindowsDevinSetupDoesNotHoldTheSignIn fails without the change on Windows 11 (the sign-in waited 47s for the installer after the CLI was in place, installTimeout set to 45s) and passes with it in 6s, its setup ended. On the same machine the real Devin sign-in went from installing to Devin's sign-in page in 18s, with no devin.exe or PowerShell left running and setup.ps1's distribution marker and user PATH written; with the first change alone it took ten minutes and left `devin.exe setup` running. go vet ./internal/provider and go test -run 'Install|SignIn|NotOnCommandLine|DevinSetup' ./internal/provider pass on Windows; GOOS=windows go vet ./internal/provider ./internal/proc passes on Linux.

---------

Co-authored-by: Siling <179151647+hisiling@users.noreply.github.com>
2026-10-08 08:58:15 +08:00
yetone 38f184ae0e signin: Grok and Command Code sign in from magpie in Docker (xugui on Discord: docker版登不上grok和command code) — Grok's sign-in first installs Grok Build with its installer, curl … | bash, and the image has neither bash nor curl, so it stopped at "installing Grok Build failed (exec: "bash": executable file not found)"; the community Grok plugin, beside the built-in rather than moved onto, wasn't given the CLI at all and said "install Grok Build first". Where no shell and curl/wget can run, Grok Build is now installed as its installer does, from the same x.ai/cli (then its storage bucket) address: the stable version, its binary for the platform, checked with --version, linked as ~/.grok/bin/grok and agent, installer = "internal" noted in its config.toml; the plugin's sign-in installs it first too. The device sign-in itself needs nothing back from the browser and was fine. Command Code's Studio posts the key to magpie's 127.0.0.1 port in the background, which a browser outside the container can't reach and no address carries; while it waits, its sign-in now takes an API key made on commandcode.ai/settings/keys and pasted (as Command Code's own CLI offers), checked with whoami and its plan as Studio's was, and a plugin's browser sign-in offers "Use an API key instead", its own api way (the Command Code plugin has one). No identity, header or prompt changes. TestGrokInstallsWithoutShell, TestCommandCodeSignInPastedKey and TestGrokPluginSignInInstallsCLI fail without the change, signin-paste-key.test.cjs too. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass; signin-paste-key, signin-paste-codex, plugin-signin, signin-callback, commandcode-risk, plugin-key-hint, signin-link, click-scroll, old-webkit pass. 2026-10-01 22:25:39 +08:00
yetone f7112a9e9d agents: Grok Build — xAI's grok CLI — is an agent: its model is set in ~/.grok/config.toml ($GROK_HOME), and a model through magpie adds the catalog there as [model."magpie/…"] tables pointed at the gateway with magpie's own key, so a request never carries the user's xAI sign-in and the catalog joins Grok's own models in /model; its effort is [models] default_reasoning_effort, its requests are known by grok-shell; the Grok subscription is called Grok Build too 2026-09-25 18:26:50 +08:00
yetone e072af501d provider: a subscription used through its vendor's CLI — Devin's, Cursor's, Grok's — installs that CLI when its sign-in starts, if this machine lacks it, rather than leaving the sign-in to fail or, as Devin's did, to say "signed in" and show nothing: Devin's sign-in wrote credentials.toml, but magpie sees the account only through devin auth status, so with no devin CLI no provider ever came and nothing said why. The sign-in is now "installing" while the vendor's own installer runs (curl … | bash, or its PowerShell one on Windows, with magpie's proxy), then opens the vendor's page as before; the window says what it is installing and why, can cancel it, and a failed install says the installer's last line and the command to run by hand. What counts is the CLI being there afterwards — Devin's installer ends in devin setup, whose sign-in gives up without a terminal and fails the script after it installed everything — and on Windows the PATH the installer wrote is taken up so the running app finds it. A Devin sign-in the CLI then can't see fails, where it said done with no one; the tests no longer see this machine's own devin 2026-09-25 16:30:00 +08:00