e4e9eb0928becfa4e48484dde85ef5032671d582
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
149e763e9e |
accounts: a name you gave an account picks it wherever an email does (#4532)
StringKe (#4532): `magpie accounts switch claude work` failed when "work" was the alias; accountNamed matched the email only. provider.AccountByName resolves a name (magpie accounts alias) among an agent's accounts. It refuses a name two accounts share, and a name that is another account's email or email part, so a name never picks the wrong account. It is used by: - accountNamed: accounts switch/on/off/remove/alias/cap and the rest that take <email>; - provider pool --accounts; - accountRef (GUI and account-cap): the exact email first, then a name, so another account's alias never shadows an email; - account-cap's display, through AccountRefOf (it filtered by email). Run (mote, at this commit): - go test -timeout 45m -count=1 ./internal/provider ./internal/cli: ok (104.9s, 33.2s). - TestAccountsAliasPicksTheAccount, new: switch, alias, pool --accounts and account-cap by name; a shared name and another account's email refused. Red with each part removed by hand: the accountNamed call, pool's resolution, the clash check, the shared-name check, accountRef's name step. Not run: the GUI suite (no GUI file changed); real accounts. |
||
|
|
08b02cf18c |
providers: a pool stops at its caps and reads usage again near them (plugins#349)
What was adopted on magpie-community/plugins#349 (1939869736luosi): one
place, in the GUI and the CLI, for a subscription's account pool, and an
opt-in conservative mode.
- Stop at the caps (Provider.CapStop, off by default): once every account
in use is held at its cap, the request is answered 429 rather than going
on to the provider's fallbacks (plan returns restLast). Off, as before.
- Check usage again near a cap (Provider.CapCareful, off by default,
internal/gateway/cap_careful.go): before planning, a capped account's
usage is read again when its reading is over 15s old within 5 points of
a cap, or over 5m old at all; the request waits at most 10s, and a
failed account is asked again at most every 15s. An account whose usage
was never read, whose last read failed, or whose reading is still that
old is then held as one at its cap is (capHold "unread", traced as
Weighed.Unread, named in the 429 with "--careful off"). Generic: it
goes by provider.UsageRead/ReadUsageNow, so every subscription that
reports usage windows (Codex, Claude, plugins) gets it.
- provider: usedCache records each account's read state; a failed read
keeps the last good reading's time. ReadUsageNow no longer reports
false when the read had already finished on the first ask.
- GUI: under the provider's account list, once an account has a cap (or
either is on), two ticks for the above, and a note naming the accounts
in use with no cap ("used to 100% of each window"). Accounts, order and
caps stay where they were in that list. zh, zh-TW, ja, de added.
app.js 1,309,658 within its 1,310,460 budget, unraised: addRow and a
per-row forgetOf replace 3 add-button and 5 Remove-button builds.
- CLI: magpie provider pool <id> [--accounts a,b,…] [--cap percent|off]
[--stop on|off] [--careful on|off] shows and sets the whole pool.
- docs: gateway-routing.md and providers-accounts.md.
Run (mote, before the rebase at
|