ac4af582301a4e8a29245dbba767eba31334ddf9
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
541102eba2 |
claude: a saved account's .claude.json gets the onboarding mark when it lacks it (Jaxxxxnn on X)
Jaxxxxnn on X (magpie 0.1.2669, Claude Code 2.1.316, macOS arm64): a saved Claude account's config directory had a .claude.json without hasCompletedOnboarding. Claude Code's interactive mode then asked for a login method beside a sign-in that works, the run ended on it, and both requests and the usage read failed as if signed out. Adding the mark by hand fixed it with the same token. magpie wrote the mark only when it made .claude.json itself, so a directory -p ran in (before the interactive mode was the default) or one an earlier magpie made kept a file without it. claudeOnboarded now adds the mark to the file that is there, every other key kept (numbers read with UseNumber), on both paths of claudeSavedDir (sign-in put in, or there already) and in claudeTokenDir. A file that can't be read or parsed, which Claude Code may be writing, is left as it is. Run (mote, at this tree): - go test -count=1 ./internal/provider ./internal/claudetui: ok - go vet ./internal/provider, GOOS=linux and GOOS=windows: ok - gofmt -l: clean Broken by hand: with claude_dirs.go and claude_setup_token.go at origin/main, TestClaudeSavedDirMarksOnboardingDone and TestClaudeTokenDirMarksOnboardingDone are red. Not tried: a real Claude Code 2.1.316 run in a directory without the mark; the reporter's own fix (the same mark) is the evidence. Not the full suite. |
||
|
|
8ebf9cbea9 |
claude: add an account from a setup-token (CLAUDE_CODE_OAUTH_TOKEN)
sfss5362 on X asked "支持 CLAUDE_CODE_OAUTH_TOKEN 吗". It didn't work
before: cleanClaudeEnv strips the variable everywhere, and the import
flow needs a refresh token and an email.
A Claude account can now be added from the token `claude setup-token`
prints. In the window: the sign-in's "Use a setup-token instead…" and
the accounts list's "Add an account by setup-token…", which post to
POST /api/signin/claude-token.
The token is kept in logins.json as {"setupToken":…}. The real Claude
Code gets it in CLAUDE_CODE_OAUTH_TOKEN, and only for runs in that
account's own config directory (inClaudeDir via
provider.ClaudeDirToken). It never goes on the command line or into a
log. magpie never asks Anthropic anything with it. The bridge, the
sdk-cli entrypoint and the weighting are unchanged.
What such a token can't do: it has the inference scope only.
- Claude Code's `auth status` gives no email or plan. The account is
named "Claude setup-token <6 hex of its hash>".
- Its /usage prints the API cost view. /usage is never run for it, so
its allowance is unknown (errClaudeSetupToken, which `passing` keeps
as saying nothing about the account), not zero. Windows heard on
real replies still fill it in.
- Its config directory holds no .credentials.json, so Claude Code has
no sign-in to fall back to if the token is refused.
- Claude Code itself is never signed in to it. addLogin, switchLogin,
putClaudeLogin, SetKeepLoginAs, NextLogin and signInToFirst all pass
it over. Its row shows Remove and "magpie only", and the switch menu
leaves it out.
New strings are in zh, zh-TW, ja and de. Docs: providers-accounts.md
and claude-subscription-bridge.md.
Run:
- mote: gofmt -l (clean); go vet ./internal/...; GOOS=linux go vet
-tags nogui and GOOS=windows go vet of provider, gateway and gui; go
build ./...
- mote: go test of provider and gateway, -run on SetupToken, Claude
usage, warm-up, saved, account, logins, switch and keep-login: ok.
- New tests, with a fake claude binary in a sandbox HOME:
- TestClaudeSetupTokenAccount, TestClaudeSetupTokenSignsClaudeCodeInToNothing,
TestClaudeSetupTokenAllowanceUnknown and TestCheckClaudeSetupToken
in provider;
- TestClaudeSetupTokenReachesItsOwnRunsOnly in gateway: the token
reaches only its account's run, not "" or another dir, even with
the shell's CLAUDE_CODE_OAUTH_TOKEN=leaked, and never in args;
- claude-setup-token.test.cjs: Chromium on mote and WebKit on
xiaomi-gpu, each in en, zh, zh-TW, ja and de.
- GUI files the change reaches (signin-link, signin-web-blocked,
signin-closes-sheet, revoked-signin-account, account-eye,
account-row-line, i18n-keys and the new one): 73/73 on xiaomi-gpu
Chromium.
- On mote, 33 account, sign-in and i18n files had 96 reds. mote was
overloaded by another session's full GUI suite. Six of those files
fail 58 of 64 the same way at origin/main
|