2ff85f8a2bc33f87aa1fdfefce580433afff76e3
1382
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
36d1541c6e |
provider: WorkBuddy's mover min is 0.1.43, the default effort and gzipped chats
troilus1011 on X: WorkBuddy's DeepSeek in OpenCode thought only at low or
high. OpenCode's default names no reasoning_effort and WorkBuddy doesn't
think without one (0 reasoning tokens, measured on www.workbuddy.ai);
WorkBuddy's client sends the model's reasoning.defaultEffort ("high").
workbuddy 0.1.43 (plugins f4d48ac) sends that default when a chat names
none; a named effort, none too, goes as it came.
runmiNeverstop on X: 2.89 GB up to copilot.tencent.com. WorkBuddy's client
gzips model-request bodies (RequestBodyGzip in both builds' product.json);
the plugin sent plain JSON. 0.1.43 gzips chat-completions bodies on both
builds.
keepMovedCurrent brings every moved user to 0.1.43.
Run (on mote, at this tree): go vet ./internal/provider, go test
-timeout 45m ./internal/provider: ok. npm view
@magpie-community/opencode-workbuddy-auth@0.1.43 --prefer-online: 0.1.43
(latest). The plugin's own record (197 pass, broken by hand, live runs on
www.workbuddy.ai) is in plugins f4d48ac.
Not tried: a live chat on the China build (401 to every token here), the
reporters' own OpenCode sessions, a moved account updated end to end.
|
||
|
|
60561129f8 |
codexcat: two entries Codex's picker would name the same are told apart by their provider's id (nb5p on Discord)
nb5p had GPT-6.1-Sol from two providers both called Codex, and Codex's
model picker showed two identical entries, the hover text identical too.
Now, only when two listed entries would have the same display_name,
each gets its provider's id after it ("GPT-6.1-Sol · Codex · codex-b"),
or its own model id where the provider's doesn't tell them apart (a
routing group, two of one provider). Every other entry is unchanged.
Only display_name changes. The description and catalog Model.Name are
as on main. Codex puts each of the first five catalog models'
description into spawn_agent's "Available model overrides" (codex-rs
multi_agents_spec.rs spawn_agent_models_description, and
context/world_state/model_catalog.rs with model_catalog_in_context),
which goes upstream on every request; the real Codex 0.162.1 bytes in
internal/redact/testdata/codex-0.162.1-request.json show "- `fake/m1`:
m1 · fake via magpie". magpie's own spawnChoices sends Name. So the
first try (provider/account in the description) was dropped: it would
have sent the account's email upstream. display_name: read in codex-rs
at 5d5e5c5 (cloned on mote), core builds no prompt or tool text from a
model's display_name (model_catalog.rs and spawn_agent_models_description
use slug + description + efforts + tiers only); in the captured Codex
requests the name appears only inside the description. The id is in the
slug already, which is sent anyway. Apart is in the Model's JSON, so it
is in the list's tag and Codex asks for the list again when it changes.
Run (mote, at the rebased head):
- TestCodexPickerNamesSameNamesApart (internal/provider) and
TestCodexApartInDisplayNameOnly (internal/codexcat): pass.
- Broken by hand: codexApart never marking a pair, and shownName
ignoring Apart (the old behaviour): both tests FAIL, e.g.
codex-b/gpt-6.1-sol shown as "GPT-6.1-Sol · Codex", want
"GPT-6.1-Sol · Codex · codex-b".
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: all ok (at base
|
||
|
|
51e3169fb7 |
qoder: the plugin's min is 0.2.46, so used-up credits leave the free models served (coeo91 on Discord)
coeo91: Qoder (and WorkBuddy) still serve free models once the paid
credits run out, but magpie treated such an account as spent for every
model. Qoder's docs say it: "When Credits run out, you can continue using
free basic models, subject to daily and monthly limits"
(docs.qoder.com/Credits; zh: "Credits 用尽后,仍可使用免费基础模型").
The cause was the plugin's usage: every credit window ("Total credits",
"Credits", "Add-on credits", and since 0.2.45 a free account's "0 credits
left") counted every model, so a window at 100% put the account last or
out for qfmodel / dfmodel too. The refusal side was already per model
(PaidBesideFree,
|
||
|
|
7c900f468f |
antigravity: a tier Google refuses in fetchAvailableModels is asked once a day and is no "Model list" row (ferock4669)
ferock4669 on Discord: with an Antigravity subscription, the Requests page filled with "Model list" (模型列表) rows for /v1internal:fetchAvailableModels, each answered 400. Cause. For an account loadCodeAssist gives a paid or non-free tier, magpie asks fetchAvailableModels first with entitlement.userTier named ( |
||
|
|
df9376592d |
routing: a group's member may offer several reasoning levels for the agent to pick among
Garydesu on X: "能不能让路由组里的模型设置多个可选推理强度,现在只能选一个或者整个 路由组的". A member was one fixed `:effort` or followed the group's levels. A member's suffix may now join several levels with "+", `provider/model:low+xhigh`, kept lowest first, each once. provider.MemberLevels splits it into Member.Levels and leaves Effort empty, so the member isn't fixed; one level is a fixed effort as before. The whole stays the member's id, so rules, fast, off, weights, share and the CLI key it as any member. The gateway fits the agent's ask to the member's own levels (groupLevels returns the candidate's levels first; ofMember, the quiet check and the trace see them), and the group lists them to agents (buildGroupEntries), intersected with the other members' as usual. In the Routing page's group editor the member's reasoning menu has "Several levels…", a menu that stays open with each level ticked or not; a fixed level picked from the first menu replaces the old one as before. i18n in zh, zh-TW, ja, de; CLI help and docs/subsystems/gateway-routing.md say it. Run on mote (mote-run). Rebased on |
||
|
|
48ae0884b6 |
provider: WorkBuddy's mover min is 0.1.42, a chat parsed once (plugins#461)
workbuddy 0.1.42 parses a chat once on its way to WorkBuddy instead of
once a step (system, tools, tool_choice, headers, model, system key),
and sends the bytes it got when nothing changed them. On jihuayu's
45 MiB chat that is 7 parses down to 2 and the plugin host's peak RSS
from about 1 GB to about 680 MiB, with the bytes sent the same
(plugins f2b0dac, its oneparse.test.mjs). keepMovedCurrent brings every
moved user up to it.
Run at this head (
|
||
|
|
ba37e78b4c |
provider: a plugin model's test is told a queue at once and warms its host first
mingxia_16024 on Discord (v0.1.1862): testing models on Qoder (CN and
international) and WorkBuddy always failed with "qfmodel: context deadline
exceeded", even though agents got answers from the same models.
Cause, checked with the owner's real Qoder account in a sandbox HOME:
- The test already takes the gateway's route: p.Do, then the plugin's
fetch in the host.
- The Qoder plugin waits out Qoder's free-plan queue (plan queue p3) for
up to 4 minutes, unless X-Magpie-Fallback is "1". magpie never sent
that header.
- The probe gives up after 20s. A raw request with no deadline got its
head after 3m49s.
- The probe's 20s also had to cover the plugin host's cold start and the
account loader's first run, which can renew the sign-in. A first
WorkBuddy AI test took 8.4s.
Changes:
- For a plugin provider, probe sends X-Magpie-Fallback: 1, so a queued
model answers at once with the plugin's queue message.
- It starts the host and runs the account's loader (warmPlugin, through
the account's proxy) under the caller's deadline, not the probe's.
- A plugin probe waits up to pluginTestWait (60s). The GUI gives a model
test 3 minutes.
- host.js lists x-magpie-fallback in MAGPIE_ONLY, so no vendor receives
it.
"Recent calls" lists only the gateway's own calls, for every provider. A
test is written to the Requests page as magpie's own test, timed-out
tries included, so that is unchanged.
The gateway still never sends the header when another candidate follows,
which Qoder 0.2.40 and CodeArts 0.2.3 expect: #4049.
Run (mote-run):
- New tests TestPluginModelTestSaysQueued and TestPluginModelTestColdHost.
They use the fake plugin's new $FAKE_QUEUE and $FAKE_LOAD_WAIT, with a
cold host from plugin.Restart.
- go test -tags nogui -timeout 45m ./... at
|
||
|
|
4391ff0f56 |
provider: asking a plugin for its model id replaces just the model (#4004)
When a plugin's model has an API id other than the one asked for, withModel decoded the whole request into a map and marshalled it again, which allocated 469 MiB for a 45 MiB body, about ten times the body. Now a body with one top-level "model" string gets just that string replaced, in one buffer of the body's size. Every other byte goes as it came. A body that isn't JSON, has no string model, or names "model" twice takes the old path. A body of null goes as it came; it was a panic, writing into a nil map. The gateway's own withModel (Codex backend) and rewriteModel are left as they are. TestCodexRewritesAsBefore pins the Codex backend's sorted bytes, and TestUpstreamBodiesUnchanged pins rewriteModel's handling of a duplicate model. Both went red when the splice was tried there. Run on mote at 3aa36bbea (since rebased onto main, which changed nothing in internal/provider or internal/gateway): - TestWithModelAsksForTheModel: a nested "model" is kept, spacing is kept, an escaped model is replaced, and a missing, numeric or duplicate model, a cut-off body and null are covered. - TestWithModelCopiesOnce: a 45 MiB body is copied once (45 MiB allocated). Against the old withModel, the test is red: 469 MiB allocated, and the body's < was escaped. - go vet ./internal/provider for darwin, linux and windows: ok. - go test ./internal/provider ./internal/gateway -timeout 45m: ok (106s, 495s), the plugin parity tests included. Not tried with a real account: none of the plugins signed in here (WorkBuddy, Devin, Cursor and others) has a model whose API id differs, so this path isn't reached by them today. |
||
|
|
25fc92d59a |
fallback: a model unchecked in its provider's list is not a fallback to go to (#3911)
The sibling of the group fix before this: a provider's Fallback list
resolved each entry with Resolve, so a fallback the user unchecked in
its own provider's list was still sent to, while the fallback editor
says "No provider serves {id} now; it is skipped". plan's fallbacks,
and the places that read the same list (carefulOf, native compaction's
carrier check, unredactedRoute, codexFallsBack), now resolve through
provider.ResolveRoute, which skips it. ResolveRoute scans the entries
once for the one model rather than building a map per request.
Test: fallback_unpicked_test.go, plan/m answering 429 with fallbacks
a/x (unchecked) and b/x goes to b and never to a.
Run (mote): red on the previous commit's tree ("from ka", a tried
[ka]); green with this one. Full suite as recorded in the previous
commit, which ran at this tree: 76 packages ok, internal/plugin's
TestGatewayHookMixedPiPackage red at load ~134 (#2865), passing alone.
go vet darwin/linux/windows clean.
Not tried: a real provider with a fallback in the app.
Co-authored-by: timonwong <timon86.wang@gmail.com>
|
||
|
|
f561cc5d9b |
groups: a model unchecked in its provider's list is not a member to route to (#3911)
timonwong (#3911, also on Discord #feedback): with a group of a/x and
b/x, unchecking x in provider a's model list struck a/x on the Routing
page, but group/<id> still sent requests to a. membersOff resolved each
member through resolveIn, whose provider/model step takes any model of
a provider that is on, so that a request can name a model its list
lacks.
membersOff now skips a member whose provider has picks and whose served
models lack it (unpicked), as timonwong's fork did (38615ca9). A
provider with no picks still routes a model its list lacks (#2642), a
decision model (never in the catalog) is still a decision group's, and
a request naming a/x itself still reaches a. Every route mode goes
through membersOff (ordered, weighted, rotate, manual, nested groups,
found groups, count_tokens' group lookup), so all of them get it. The
entries map is built only when a member's provider has picks.
The Routing card's memberInfo (gui/groups.go) used Resolve too, so a
manual group's pick row showed an unchecked member as ready; it now
asks provider.ResolveRoute, the same check, and the group is not ready
when its picked member was unchecked.
Tests: group_model_pick_test.go (ordered, weight, rotate; nested; a/x
named directly still served; checked again comes back; a decision
group keeps a picked decider) and gui's
TestGroupMemberUncheckedInItsProvider.
Run (mote, at this tree plus the next commit):
- Red on
|
||
|
|
6aa04f6e6a |
provider: a keyless relay on the user's own network imports and saves, as one on 127.0.0.1 does
iSnow_999 on X: their company's internal Codex relay is at
http://<LAN IP>:8080; imported from CC Switch, Codex couldn't reach it
through magpie. A CC Switch Codex entry with no key (requires_openai_auth
= false, auth {}) at a LAN address was listed as "it has no API key"
and left out, and the same provider couldn't be saved by hand ("needs an
API key"), while the same server at 127.0.0.1 was taken keyless.
keyOptional now also takes a host on the user's own network, read from
the URL alone (ownNetwork, no lookup since Ready asks often): a private,
link-local, loopback or carrier-grade NAT (Tailscale) address, or a
.local name, as netproxy's onLAN sends around a proxy. A keyless address
on the internet still needs its key. Every importer (CC Switch, Alma,
Codex, OpenCode) goes through imported(), and the editor, CLI and TUI
through Save, so the one rule covers them.
Ruled out against the code and on mote, sandbox HOME, fake relay on
mote's LAN address 10.0.0.116 at a free port, `magpie serve --web` built
from this tree, import through POST /api/importapps:
- a CC Switch Codex entry at http://10.0.0.116:<port>/v1 with a key
imports with port, path, key and Responses kept, and /v1/responses
through the gateway reaches the relay (Bearer sk-corp); with
HTTP_PROXY/HTTPS_PROXY/ALL_PROXY at a dead 127.0.0.1:9 too (onLAN);
- a request with Codex's User-Agent, originator and
x-codex-turn-metadata reaches the relay with them (sub2api's
codex_cli_only gate reads these; port 8080 is sub2api's default).
After the fix, the same run with a keyless entry: imported, served, the
relay sees no Authorization header.
Tests: TestKeylessRelayOnOwnNetwork (import of a keyless LAN entry,
Save + Ready at 192.168/10/172.16/100.64/.local/[fd00::] addresses, a
keyless internet address still refused) is red on the old provider.go
and green now.
Run on mote at
|
||
|
|
b01193ef97 |
provider: Cursor's plugin min is 0.2.29, whose HTTP/1.1 Run sends blobs 16 at once
ysm119 on Discord: Cursor 30 s+ to first token, 1-4 min a turn. 0.2.28's 16-at-once BidiAppends reached only the plugin's stateless fallback; every real request goes through its native session, which still sent each history message's blob one round trip at a time when the Run fell back to HTTP/1.1 (a proxy or network that blocks h2). 0.2.29 (plugins 8f81a8a) sends them 16 at a time there too. Real Cursor account, sandbox HOME, plugin driven directly, h2 forced to fail: a 30-step agent history went from 37-39 s to first token to 4.4-9.1 s; 100 steps from 117-130 s to 9.0-13.2 s, answers correct. Over HTTP/2 nothing changed and nothing was slow (2.9-7.3 s). Run: gofmt -l clean; go test -tags nogui ./internal/provider/ on mote, ok. npm view --prefer-online shows 0.2.29 as latest. Not tried: a sandbox magpie installing 0.2.29 through the mover; the reporter's network, so whether he is on HTTP/1.1 is not confirmed. |
||
|
|
3b2794cadd |
provider: a relay's 403 in markup says its words, not a bare "403 Forbidden"
maralica (Discord #help) sent WorkBuddy through a custom Chat relay,
"magpie-grok", that serves only some agents' clients, and WorkBuddy was
told only "magpie-grok: 403 Forbidden". apiError dropped any body that
starts with "<" and isn't a whole web page (a page's fragment such as
"<h1>Forbidden</h1><p>…</p>", an XML error), and WebPage said a page
with no <title> as "a web page, not an API reply" alone, so a relay's
reason in either never reached the agent.
Now such markup is said by its words (provider.MarkupText: scripts,
styles, comments and declarations out, tags out, entities read,
whitespace folded, 300 runes), and a page with no title by its words
(120 runes, as a title). Markup with no words still says the status
alone. JSON, plain text and empty bodies read as before. Every APIError
caller and WebPage's (Unsaid, errorSaid, vendorMessage, vendorSaid) get
it.
Checked on the way, unchanged: the relay is asked for "grok-4.7" by
model "magpie-grok/grok-4.7" and by a group of it, never a magpie-named
id; with "Send the agent's own User-Agent" on, it gets WorkBuddy's
User-Agent as sent, and none of the agent's X-Agent-*, Acp-Connection-Id
or Traceparent headers (only Codex's and Claude Code's own identity
headers are passed on to a relay).
Tests: TestChatRelayRefusalSaysWhy (custom Chat provider, WorkBuddy's
User-Agent, by provider/model and by group, streaming: the model and
User-Agent the relay got, and the message for plain text, JSON, an
untitled page, a fragment, XML and an empty body); TestAPIErrorShapes
updated (untitled page, script-only page, XML, a bare XML tag).
Broken by hand: MarkupText made to return "": TestAPIErrorShapes red,
and TestChatRelayRefusalSaysWhy red in untitled page, fragment and xml
(said "magpie-grok: 403 Forbidden", the reporter's words). Restored,
green.
Run (mote, go1.26.8, tree at origin/main
|
||
|
|
a57ec01683 |
provider: Cursor's plugin min is 0.2.28, which doesn't wait on a failed model list or send HTTP/1.1 appends one at a time
ysm119 on Discord: claude-opus-5-5 through the Cursor plugin takes 33-36 s to its first token and 83-253 s in all. Two waits on our side, both fixed in the plugin (magpie-community/plugins fc14571, d9c858c, 944610f): - A chat request picked its variant from AvailableModels (up to 30 s) before its Run, and a list Cursor couldn't give was asked again, and waited for, by every request. Now a stale list is used while a new one is asked for, requests at once share one ask, and after a failed ask requests go without it for 5 minutes. - Over HTTP/1.1 each history message's BidiAppend waited for the one before it. Now up to 16 go at once, as cursor-agent 2026.10.01 sends them; a native session's Run stays one at a time. 0.2.28 is on npm (npm view --prefer-online). 0.2.27 never reached npm on its own: its publish run went red on a test token collision, fixed in 944610f. Run: gofmt -l (clean); on mote go build -tags nogui ./... and go test -tags nogui ./internal/provider/ (ok). Plugin side: bun test packages/cursor 314 pass on mote and on Linux; the whole plugins suite 2997 pass; the publish run's test job green. Broken by hand (plugin): the old index.mjs turns all three listwait.test.mjs tests red; openH1 back to one at a time turns the new http1 test red. Not tried: a real Cursor account (its token is in the Keychain), so whether these are the time ysm119 sees, or Cursor's own, is not measured; not the full go suite (a one-string min change). |
||
|
|
a3ee00c05c |
codex: its own GPT models stay in Codex's list when kept for routing groups
士奇 (Discord, 10-28): with a routing group on, the Agents page's Codex list lost its Codex provider section and models, the model dropdown still offered GPT, but the Codex app had none; with the group off they came back. Cause: the codex provider's "Only through routing groups" (Provider.Unlisted, 只通过路由分组使用), or a group that lists itself alone (Group.Unlists), took the ChatGPT account's own models out of Catalog(), so out of Codex's own list too. With no Codex section, the own options were not magpie's, so the own-models switch showed and the picker kept offering GPT; meanwhile #1602 ( |
||
|
|
e9dd8e83ac |
provider: Devin's mover min is 0.1.25, a typed anyOf goes to its Gemini models in a shape they take (plugins#458)
Kimi Code's Read (line_offset: anyOf of two integers) made every
devin/gemini-4-argon request 400. The gateway's geminiToolTypes writes
the type the branches agree on beside an untyped anyOf, and Devin's
Gemini models refuse {type, anyOf} below a tool's root. The plugin's
geminiSchema now merges such an anyOf or sends it as a oneOf
(magpie-community/plugins 2c30818). npm view --prefer-online shows
0.1.25.
Run (mote): go build -tags nogui ./..., go vet ./internal/provider,
go test -run "Mover|Moved|Migrat|Min" ./internal/provider: ok. gofmt -l
clean. The plugin change was checked against a real Devin account
(gemini-4-argon: the typed shapes 400 on 0.1.24, all 17 probe shapes 200
on 0.1.25).
Not run: full suite.
Not changed: geminiToolTypes itself still writes a type beside an anyOf;
Devin's plugin is the only server seen refusing it.
|
||
|
|
71de6914af |
provider: the Qoder mover's min is 0.2.45, a free account with no credits shows none left
Qoder plugin 0.2.45 (magpie-community/plugins@c0a0fd1): an international free Qoder account (personal_standard) with no credits in any pool showed no credits at all (Ariel on Discord), since every 0-total pool was dropped. It now shows one "Credits" window, "0 credits left", as Qoder's client shows the account 0/0 and out of credits. Raising min updates every moved user's plugin (keepMovedCurrent). npm view --prefer-online --registry=https://registry.npmjs.org/ @magpie-community/opencode-qoder-auth version: 0.2.45 before this commit. Run: gofmt -l internal/provider (clean); go test -tags nogui ./internal/provider/ on mote via mote-run at this tree (ok, 124s). The plugin's own suite (bun test, 299 pass) ran on mote, with its new test red on the old index.mjs. Not run before the push: the full Go suite, as another session's ./... run held mote; it runs after, one suite at a time. |
||
|
|
a68f3ee45d |
provider: a signed-in account keeps its price rate (PaulT, Codex)
PaulT on Discord (#help): "v0.1.1805版本codex价格倍率有bug 无法保存". Save rebuilt a signed-in account (Codex, Copilot, Claude, a plugin's subscription, Kiro) from a fixed list of fields, and PriceRate wasn't on it; withPicks didn't read it back either. The editor's Save answered ok, nothing was written, and the field came back empty. Not a v0.1.1805 regression: it has been so since the rate was added ( |
||
|
|
5ed6669cec |
sync: the account an agent is kept signed in to stays each computer's own
YsiCing on X: with only the library and usage ticked, the default account of a subscription with several followed the other computer: a personal one at home, a work one at the office, set again every day. The providers part always syncs, and provider.Mirror took the other computer's Provider whole, KeepLogin, KeepLoginAs and SwitchOnly with it. Mirror now keeps this computer's three for a provider it has, and a new one comes without KeepLoginAs (an account signed in over there). davsync's hashes blank the three, so changing which account is kept uploads nothing and two computers that differ only in it don't trade the part. The sign-ins themselves (logins.json) were never synced. A backup Restore is left as it is: it is asked for, and brings the backup's choice. Run on mote at this tree: go test -count=1 ./internal/provider ./internal/davsync ./internal/backup ok; go vet for darwin, linux and windows on both packages ok. Broken by hand: with backup.go and davsync.go reverted, TestMirrorKeepsKeepLogin and TestKeepLoginIsNoChange both fail. Not tried: two real computers syncing through a real WebDAV folder. |
||
|
|
396e0e4638 |
usage: a deleted provider's requests merged into another, or named, from the Requests filter
CyberCaius on Discord: a deleted provider's requests sat under its old id
("<date> 已删除"), and the only way to put them under a provider they
have was renaming that provider onto the old id. Now, with a deleted
provider picked in Usage › Requests' Provider filter, a "…" beside it
offers Merge into… (an app menu of the providers there are now) and
Rename… (the filter's button turns into a name field; Enter or leaving
it saves, Escape keeps it). With the merged-into provider picked, the
same "…" lists Separate <name> for each, the undo.
Nothing in the log is rewritten. Both live on the deletion's own record
in providers.json (Deleted.Into/MergedAt, Deleted.Label), so a provider
added later under the old id inherits neither: it is a different
provider, and its record of its own is what it has. Renaming the target
carries the merge (Rename rewrites Into); deleting the target ends it.
Renames.Both(id, time) gives the id a call is shown under and the one it
was made to (Own). Listing, filtering, the summary and vias go by the
shown id; pricing (Record.priceID, block_price's as), window holds and
the gateway's loggedAnswers go by the own one, so a merge moves no cost
or token, only whose name they sit under. The target's face lists what
was merged into it (Named.Merged). Routes: GET /api/usage/deleted/into,
POST /api/usage/deleted {id, into?, name?}; a field not sent stays.
Run (mote, at this tree on
|
||
|
|
c3b0484a96 |
usage: keys of one account show its balance once (mimi)
mimi on Discord (#feedback): "同一个网站,添加多个key时,余额会重复展示" -
a site's keys 1-A031-Pro, 2-S009-Plus and 3-S010-Team-2 each showed the
account's $8.39 and its own curve.
KeyBalances still reads, keeps and charts every key on its own. What
changed is what the Usage page draws:
- balanceRead says whether the reading is the account's (balanceAccountWide),
going by the source, not the vendor's name:
- account-wide: a balance token (new-api /api/user/self, sub2api
/api/v1/user/profile, AiHubMix), a known host's account query
(DeepSeek, Moonshot, OpenRouter credits, SiliconFlow, StepFun, ...),
and sub2api /v1/usage when its mode is "unrestricted" (wallet or the
group's subscription, per sub2api's gateway_handler.go Usage);
- per key: AiHubMix's /dashboard/billing/remain, new-api's
/api/usage/token, sub2api in quota_limited mode, any other Balance
URL the user named.
- Two such keys of one provider with the same amount are one account only
when their balances moved together: the same latest change (from and
to), first read within balanceHistGap. Two accounts with the same
amount stay apart until one is spent from; keys whose amounts differ
are never one. SharedBalance (the first key's name) says so in
/api/usage/quotas, magpie quota --json and /v1/magpie/quotas.
- Refreshing a shared card reads every key it stands for (sharesAskedCard),
so it stays one card. The history is read outside the cache's lock.
- The Usage page draws them as one row, one balance, one curve, with
"+2 keys" beside the key and the keys on hover; the head's sum counts
the account once. The code is in plugins/usage/page.js, so app.js is 9
bytes smaller than before; no budget raised.
Run (mote-run, at the pre-rebase base
|
||
|
|
d50f84c9fc |
provider: Qoder's mover min is 0.2.44, a spent plan beside add-on credits (plugins #454)
0.2.44 counts the plan, add-on and shared pools Qoder spends in turn as one "Total credits" window, so an account whose plan is spent but has add-on credits left no longer reads 0% left in Routing (chansee97). npm view --prefer-online shows 0.2.44 before this change. Run on mote: go build -tags nogui ./..., go vet ./internal/provider, go test ./internal/provider ./internal/plugin (ok). The plugin's own run is in plugins 202ec68. Not run: the full suite (a one-line min). |
||
|
|
014bac1596 |
workbuddy: the mover's min is 0.1.41, a prepaid wallet as a balance (plugins #450)
workbuddy 0.1.41 (plugins #450, MYCF711) sends a package with no cycle total as a "Prepaid credits" balance window (#3950). npm view --prefer-online showed 0.1.41 before this change. Run on mote at this tree: gofmt -l internal/provider (clean), go vet ./internal/provider, go test -tags nogui -run 'Mover|Moved|Migrat| WorkBuddy|Min' ./internal/provider ok. Not run: the full suite (a one-line version string). |
||
|
|
69626580bc |
checkin: each account is checked in through its own proxy, not the global one (#2777)
zRain on Discord (Windows, 0.1.1788, Loomy plugin 0.1.4): the global proxy
is a residential entry, the Loomy provider is set to direct. The balance
read went direct, but every check-in, the loop's and a press, went out
through the global proxy and got ECONNRESET. The usage read wraps its ctx
in ViaLogin (loginQuota); no check-in did, so netproxy.Choice was empty
and the plugin host fell back to the global proxy.
The wrap is made once, where checkiner runs an account's do
(checkin.go): ViaLogin(ctx, a.provider, a.User). That covers every
check-in at once: a plugin's own (plugin.AccountCheckin) and magpie's
Trae CN, MiniMax, Qoder and WorkBuddy check-ins, which reach the vendor
through plugin.Fetch(req.Context()). a.provider is the card id the
proxies are kept under (PluginID, as loginProvider gives the usage read),
and a.User the account's label as the accounts list shows it.
Sibling found on the way: Provider.Origin asked the plugin's loader
(LoaderOptions, which can renew the sign-in) with the bare ctx, before
WorkBuddy's search and draw paths put p.Via on it. It now asks through
p.Via(ctx). The other plugin-host entries were read and already carry
the proxy: sign-in (signInFlow.via, Via in PluginAPIKey and the CLI),
the move's Check (ViaLogin), usage (loginQuota), model lists
(listingProxies) and the gateway's fetch (p.Via in the gateway).
The direction is the one #2777 lays out; skygunner's fork wired the same
wrap per runner.
Test: TestPluginCheckinGoesThroughItsProxy. The fake plugin's check-in
asks $FAKE_CHECKIN_URL (http://vendor.invalid/checkin/<key>); the global
proxy (settings.Proxy, set before the host starts) and the account's own
are recording proxies that answer for it. The provider is direct, one
account has its own proxy. The loop and then a press must leave the
global proxy unasked, claim through the account's proxy, and fail the
direct account (vendor.invalid is reachable by no one).
Broken by hand: a.do(ctx) back in checkin.go turns it red as reported:
the global proxy was asked for both accounts, the direct one claimed
through it, and the account's own proxy saw nothing.
Run (on mote, at this tree): go test -tags nogui -count=1 -run
'TestPluginCheckin|TestMovedLoginProxy|TestPluginSignInGoesThroughItsProxy'
./internal/provider ok; full suite
go test -tags nogui -timeout 45m ./...: every package ok (76), at base
|
||
|
|
a67da2dd36 |
qoder: the mover's min is 0.2.43, the check-in asked as 10:00 (UTC+8) opens
npm view --prefer-online --registry=https://registry.npmjs.org/ @magpie-community/opencode-qoder-auth version: 0.2.43 at 10:02 CST, before this change. 0.2.43 answers auth.checkin's until (plugins fd40b20), which |
||
|
|
a05b373538 |
checkin: a plugin's until is when its answer stops holding (Qoder's 10:00 UTC+8)
sdytman on Discord: Qoder's daily credits start at 10:00, can the plugin's check-in follow it? Qoder's /me/campaigns opens each day's CLAIM_BENEFIT campaign at 10:00 and closes it at 09:59 the next day, UTC+8 (startAt and endAt, read with a real account on 10-28; Qoder.app polls the list every 5 minutes). A check-in before 10:00 meets the day before's campaign. Since #2696 the Qoder plugins are asked again every 30 minutes, so today's was claimed somewhere between 10:00 and 10:30; a plain plugin was settled for the Beijing day. auth.checkin may now answer until (RFC 3339 or epoch ms); host.js passes it as RFC 3339 (plugin.Checkin.Until), kept as ValidUntil. settled holds an answer only until then, whatever its outcome; the loop wakes at it instead of its next 30-minute look; an early done that carries it is not provisional (#3326), as the vendor said when its day turns. Instants throughout, so the machine's zone doesn't matter. The Qoder plugins send until from 0.2.43 (plugins fd40b20): the check-in now lands at 10:01. Run (mote): TestPluginCheckinAsksAgainAtUntil, minute by minute from 09:27 Beijing to the next day's 10:30, with time.Local UTC, UTC-8 and Beijing: asks at 09:27, 10:01, 00:00 (the Beijing day), 10:01; a failure in the 09:59 gap asked at 10:01:00 only. GOOS=linux and windows go vet; go test -tags nogui -timeout 45m ./... all ok (76 packages). gofmt -l clean. Broken by hand, each red: settled ignoring ValidUntil (no 10:01 asks); tick not waking at it (10:27 instead); provisional ignoring it (asked every 30 minutes from 00:00 to 10:00); host.js dropping until (ValidUntil zero). Not tried: the Qoder plugin's recheck path with until (the fake plugin is fakeco; the tick and settled it goes through are the same); a GUI change (none: until isn't shown). |
||
|
|
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
|
||
|
|
8bade6c5e2 |
provider: a plugin's usage window can be a prepaid wallet's balance (#3950)
SuperMagic's accounts (mycf_711's magicrew plugin) are prepaid wallets of
points with no total. A plugin can now send a usage window as
{name, balance: 6291, unit: "积分"} with no used or limit.
- host.js passes a finite balance on (at least 0), anything else as null.
plugin.UsageWindow.Balance and provider.QuotaWindow.Balance are *float64.
- quotaOfPlugin keeps the figure and does not make the window Text or
Aside, so routing knows the account with no Used invented. allowanceOf
copies it into Limit.Balance; an empty wallet counts as used up.
Allowance.Left(model) is the least balance of the windows that count
the model.
- weighRouted fills routes.Seat.Left and Seat.LeftIn (the account's
provider and unit). Smart, pace and usage (least used) put the seat
with more left first where they would otherwise tie (byLeft), only
when every seat with a balance shares one LeftIn: balances in two
units or two providers are never compared. Tiers still come first.
- The Usage card, the Routing page (Weighed.Balance: the small row's
text, no bar, a why sentence, the account list), magpie accounts and
the status line show the figure, "6,291 积分 left", never a share.
- Docs: provider-plugins (new section), gateway-routing,
providers-accounts, plugin-runtime, host.js typings and the site's
plugins page (en, zh, ja).
Run, at base
|
||
|
|
ed49d1b38e |
provider: the shared-list tests count Codex's own ask of the list apart (#3854)
TestFetchAsksASharedBaseOnce, TestFetchAsksOneListOnceForTwoBasesOfIt and TestFetchUnionsProtocolListsWithoutChat are red on main since |
||
|
|
759b3b8c49 |
proc, provider: the env tests wait for their helper to be running (#3906)
TestEnvOfChild (internal/proc) and TestCodexAppServersOnHome (internal/provider) are red on Linux since |
||
|
|
490c0a4ad0 |
provider: Factory's plugin min is 0.1.38 (plugins #349)
npm has @magpie-community/opencode-factory-auth 0.1.38 since 10-24
(plugins b04cca3): the "Standard usage only" plugin option, which stops an
account once its Standard window is used up and moves on to the next. The
mover's min stayed 0.1.37, and keepMovedCurrent only installs min, so no
moved user could get the option.
Run on mote at this tree (origin/main
|
||
|
|
88466f8bf2 |
provider: a ChatGPT account whose usage read says OpenAI signed it out reads as signed out, with Sign in again (charliepu on Discord)
charliepu (#general): a ChatGPT account sometimes shows no allowance; OpenAI had signed it out, and it needed signing in again. The row said nothing of that. |
||
|
|
c752082e47 |
gateway: a turn's thinking goes back to Qoder's plugin; qoder min 0.2.42
uk.jent on Discord: Qoder dropped the model's earlier thinking. Qoder.app's
own client sends reasoning_content on every earlier assistant turn, and the
Qoder plugin left it out from its first version on; 0.2.42 sends it.
An Anthropic- or Responses-speaking agent's thinking reached the plugin
only when chatReplaysReasoning held, so qoder and qoder-cn are added
beside Command Code's plugin; a tool turn with no thinking gets the same
" " DeepSeek gets, which 0.2.42 reads as none. The qoder mover min is
0.2.42 (npm view --prefer-online: 0.2.42).
Run (mote): go build ./..., go vet -tags nogui on gateway and provider,
go test -tags nogui -timeout 45m ./internal/gateway/ (ok, 535s) and
./internal/provider/, which crashes in TestUnreadLoginsWriteErrorsKeepCredentials
on "close of synctest channel from outside bubble", #3632, open and not
this change. TestPluginStreamsPastTheBudgetWait, run alone, was red 2 of
3 with this change and 3 of 4 on clean
|
||
|
|
3e22123c9c |
usage: a deleted provider's calls stay apart from a new one under its id
cybercaius (Discord): after deleting a provider and adding a new one
that took the same id, the old provider's usage showed under the new one.
Delete now records the provider in providers.json ("deleted": id, name,
icon, when, its Was and Gave). UsageRenames gives a deleted id to
<id>~<when> only once something reuses it (a live provider, a later
deleted record, or a later Was), so a deleted provider nobody replaced
keeps its raw id and the existing probe/usage tests stay as they were.
/api/usage's provider faces name a deleted id from its record and set
Named.deleted; the Usage provider picker notes "Deleted {date}" (zh, zh-TW,
ja, de translated). Old deletes, made before this, have no record and
stay merged: nothing tells their calls apart now.
Run (mote): go test -tags nogui -run 'Deleted|Rename|NotSetUp|Probe'
./internal/usage ./internal/usageapi ./internal/provider ok; gofmt -l
clean; go vet -tags nogui ok.
Broken by hand: dropping the f.Deleted append turns
TestDeletedProviderKeepsItsCallsFromOneAddedUnderItsID and
TestDeletedProviderListedApartAndMarked red; restored, green.
Not tried: a real delete-and-re-add in the GUI app.
|
||
|
|
19fafad16f |
provider: a test holds a plugin model and a group of it to one window (#3654)
mycf_711 (#3654) saw loomy/DeepSeek-V4.1-Flash told 1000000 (the "*"
window typed on the provider) and its group told 1048576 (the plugin's
declaration), and dsh then sent two histories in one request.
On main the member's entry is already the typed window (WindowOf, since
#2112 and
|
||
|
|
8fff54dab7 |
routing: a group in a group left on Smart is routed as the outer one (#3847)
mycf_711 (#3847): an outer group set to Free first held a group whose routing was left blank (Smart); the inner group's free seat was tried after its paid one, as if Free first stopped at the inner group. provider.Group.Within: in membersOff's walk, a nested group with no routing of its own takes the outer group's when the outer one pools its members (Smart, Free first, Fastest, ... ; not In order, By weight or Manual, which try each member whole by its own order, #576). A group that sets a routing keeps it. The gateway, the trace's Subs and the Routing page all read membersOff, so they agree; GROUP_NEST's help sentence says so (zh, zh-TW, ja, de). Run (mote): go test -tags nogui -run 'FreeFirst|Group' ./internal/gateway ./internal/provider ok; GOOS=linux and GOOS=windows go vet -tags nogui on both packages ok; go build -tags nogui ./... ok; gofmt -l clean. Broken by hand: without the Within call TestFreeFirstReachesAGroupInItLeftOnTheDefault is red (paid seat first), green with it. Not tried: the reporter's own groups in the real app. |
||
|
|
74dcf40aac |
provider: WorkBuddy's mover asks plugin 0.1.40, which sends the current desktop client's headers
WorkBuddy accounts used through magpie are being restricted, and a report on X says WorkBuddy changed how it checks request-header fingerprints. The plugin sent WorkBuddy/5.5.6 as its User-Agent and IDE version. Each build's current desktop app (China 5.9.3 with CLI 2.165.0, WorkBuddy AI 5.8.4 with CLI 2.161.0, read from their update feeds, never run) sends "WorkBuddy/<app> <appName>/<app> CLI/<cli>", the app's version as X-IDE-Version, X-Agent-Type on both builds, X-Agent-Runtime: local-agent on 5.9, and the OpenAI SDK's X-Stainless-* headers. Plugin 0.1.40 (magpie-community/plugins b2fe48e) sends them; npm view --prefer-online gives 0.1.40. keepMovedCurrent brings every moved user up to it. Run at |
||
|
|
c2e3a057e9 |
provider: a pool's weekly window is reminded of its renewal too, as the alerts tell of it
What changed:
- dueReminders skipped every aside window, so an Antigravity account's
pool weekly ones ("Gemini · 7 days", aside since g.pools began) were
never reminded of their renewal, though #523 told the usage alerts of
exactly those: toldAside is that exemption now, shared by both, so a
week that renews with much of it left is said, and the pools' 5-hour
asides and the rest stay untold (a 5-hour window renews too often to
be news, #720).
Run:
- TestDueRemindersPoolWeekly is new: on the old condition it fails with
"got []", the account's 7-day pool at 40% renewing in 20h saying
nothing; with the change it is told once, its 5-hour pool still says
nothing, and a nearly spent week still does. TestDueAlertsPoolWindows
and TestDueReminders pass unchanged.
- go test -tags nogui -count=1 ./internal/provider passes; gofmt -l is
clean; go vet -tags nogui passes on darwin and GOOS=linux and
GOOS=windows; the three platforms' builds pass.
Reported by gua2100 (ggbdpq) on GitHub, #2197; the patch is theirs.
Run at this head on mote (review):
- go test -tags nogui -count=1 ./internal/provider ok, with the known
reds #3632 (TestUnreadLoginsWriteErrorsKeepCredentials) and #3854
(three TestFetch* tests) skipped.
- go vet -tags nogui ./internal/provider on darwin, GOOS=linux and
GOOS=windows clean; gofmt -l clean.
Broken by hand: with dueReminders' condition put back to `w.Aside ||`,
TestDueRemindersPoolWeekly fails with "got []".
Not tried: a real Antigravity account's notification; a full
go test ./....
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
|
||
|
|
eaa71168a2 |
import: OpenCode's ids for vendors magpie has a preset at the same address come in on it (#2405)
openCodePresets held 19 of OpenCode's provider ids. 15 more are at the
address of a magpie preset, and the import picker listed each as
skipped, "it has no base URL", which isn't so: zhipuai, zai, alibaba,
alibaba-cn, minimax, modelscope, kilo, cline-pass, kimi-code-plan-cn,
kimi-code-plan-global, stepfun-step-plan, stepfun-ai-step-plan,
volcengine-coding-plan, alibaba-token-plan-cn and tencent-token-plan.
Each now comes in on its preset, the way openai's key does.
Left out, where auth.json says nothing to pick a region by: the coding
plan ids of Zhipu, Z.ai, MiniMax and Tencent, the pay-as-you-go ids of
plan-first presets (stepfun, stepfun-ai, volcengine), and the Xiaomi
MiMo token plans, served by a plugin now.
Patch by ggbdpq (Discord gua2100), as posted in #2405. Review: each of
the 15 targets' default endpoints was printed from Preset() at this
tree and matches the host models.dev gives the id (zhipu and zai
default to the pay-as-you-go paas/v4, volcengine to api/coding/v3,
stepfun and stepfun-cn to step_plan, tencent-cloud to plan/v3), so no
key is sent to a host OpenCode wouldn't send it to. No preset added.
Run (sandbox HOME, at origin/main
|
||
|
|
ff7048dece |
provider: a Command Code plan key's Credits window renews at the plan's period end (#2454)
#2451 drew a plan key's month of credits as a Credits meter beside the 5-hour and weekly windows. Those two say when they start again; the Credits one said nothing, though cmdKeyPlanID already asks billing/subscriptions for the plan id and threw its currentPeriodEnd away. cmdKeyPlanID now keeps the period end beside the plan id (cached the same ten minutes, and the pair read before kept while the endpoint can't be read), and cmdQuotaOf puts it on the Credits window's ResetsAt. No new request. The signed-in subscription's card is the plugin's since be62bcf79; the plugin sets the same reset from commandcode-auth 0.1.13. Patch by ggbdpq (Discord gua2100), as rebased in #2454. Added in review: a period end already past is dropped, so a pair kept while the endpoint fails, or a renewal its reply doesn't show yet, never puts a reset in the past on the card; the test has a case for it. Run (sandbox HOME, at origin/main |
||
|
|
791e27ec34 |
agent: the Codex app's Restart restarts only its app-server, its window stays
yoshi037070 (Discord, 10-27): when magpie restarted Codex, a new Codex window opened. The switch paths (Connect, Disconnect, failover) already end only the app's own app-server (codexAppStep, proc.End: SIGTERM on macOS, exit 0 on Windows), and the app starts another and keeps its window. The Agents row's Restart beside a Codex app left on the old list did not: on macOS ReopenCodexApp ran osascript "quit" and then `open` on the bundle, and that open is what brought up a new window. Now ReopenCodexApp keeps its check (only a bundle the row lists as left on the old list) and calls provider.RestartCodexApp, which ends each process whose command line starts with <bundle>/Contents/ and is the app's own app-server (isCodexAppOwnServer: an app-server, not --listen), waits up to 10s for them to be gone, and errs when none ran. The app, its window and another program's --listen server are left alone. The confirm says only the app-server restarts and the window stays; the status says "Codex app-server restarted" (zh, zh-TW, ja, de). app.js stays under its budget, with no raise (1,310,458 of 1,310,460 after rebasing on |
||
|
|
d1436466a6 |
gui: Kimi Code's region picker says to pick by the account's region (Kimi)
Kimi (a sponsor) asked for two things on 10-27: start the partner card at the user's region, which |
||
|
|
59478916b7 |
provider: qoder's mover min is 0.2.41, for the chat headers Qoder's client sends (plugins#443)
unifilitence (plugins#443) saw a chat carry the machine UUID as
Cosy-ClientIp, -MachineId and -MachineToken. Checked against Qoder.app
0.4.3's worker and signer: its non-chat calls do send all three as the
machine id, and x86_64_win32 is its own Cosy-MachineOS, but its chat
sends no ClientIp, the native device identity's MachineToken and
MachineType or none, and a Cosy-MachineHostname. 0.2.41 (plugins
1a560ba) sends a chat so; npm shows 0.2.41 (npm view --prefer-online).
The min was 0.2.39, so this brings 0.2.40's queue change too.
Run: `go test -count=1 -timeout 45m ./internal/provider/` at this tree with
both min raises applied, skipping four reds that are red on origin/main
|
||
|
|
729d5d0c4c |
provider: zcode's mover min is 0.1.33, for a ZCode 3.16 sign-in's coding plan models (plugins#439)
dinghao-8 (plugins#439): a ZCode 3.16 sign-in that keeps only a
project-key-location record listed the Start Plan's models, without
GLM-5.3, since the plugin's models() read the sign-in without fetching
its key. 0.1.33 (plugins 2ef8b8b) reads the key first; npm shows 0.1.33
(npm view --prefer-online).
Run: `go test -count=1 -timeout 45m ./internal/provider/` at this tree with
both min raises applied, skipping four reds that are red on origin/main
|
||
|
|
22bc7a4477 |
usage: a probe at another host of a provider's site is listed under it (CyberCaius)
CyberCaius on Discord, on the latest release: the Usage page's provider
filter listed Leee and leee.baby, and leee.baby's rows were the model
lists ("模型列表", magpie 自身, 200) asked while Leee was being added.
In the first report the same shape was example on api.example.me with
example.me in the filter, which we had put down to another address typed.
The Add sheet's model list runs before the provider has an id, so
probelog records it under the host asked.
|
||
|
|
2b0387574e |
draw: an OpenAI-compatible plugin's image models draw (SenseNova's sensenova-u1.5-lite)
01huadalang (Discord, #feedback): SenseNova's sensenova-u1.5-lite can draw, but magpie's image generation picker doesn't list it. |
||
|
|
b103ed0582 |
provider: WorkBuddy's plugin min is 0.1.39, whose history keeps an earlier turn's thinking
uk.jent on Discord: through WorkBuddy, Grok Build's chat.completions history lost its thinking. magpie's gateway and the plugin pass an assistant message's reasoning_content on byte for byte (checked with a scratch gateway test posting Grok Build 1.0.67's literal second request to a fake plugin upstream); WorkBuddy itself drops reasoning_content, and its own client sends `reasoning`. Plugin 0.1.39 (magpie-community/plugins 7f99447) sends it that way. keepMovedCurrent brings every moved WorkBuddy user up to it. Run: npm view --prefer-online shows 0.1.39. internal/provider: gofmt -l clean; go vet for darwin, windows and linux; the mover tests (-run 'Mover|Moved|Migrat|Plugin|WorkBuddy|Min') ok; the whole package with -skip TestUnreadLoginsWriteErrorsKeepCredentials (crashes, #3632) red only on TestFetchAsksASharedBaseOnce and its two siblings, #3854, red on main before this change. Broken by hand: the plugin's new test, red on its old index.mjs (see the plugins commit). Nothing here to break: a one-line min. Not tried: the China build (copilot.tencent.com) live; Grok Build end to end through WorkBuddy. |
||
|
|
24fab123bb |
provider, gateway: a Remote magpie's model it offers Fast on can be picked fast
littlekk88 on Discord (#feedback): Claude Code on one computer, wired to
its magpie, which has another magpie as a Remote magpie. The remote's
/v1/models listed service_tiers [{id:"priority",name:"Fast"}] on
gateway/cursor/grok-4.6 (#1234), but the local picker showed no bolt on
it, SetFastPick refused it, and tier_sent was empty on both computers.
Two causes, both on the local magpie:
- provider.CanFast had no case for a Remote magpie, so it was false for
every remote model. It now reads the tiers the remote's list gives the
model (new provider.RemoteTiers) and is true where they hold priority.
UltraOn offers Ultrafast where they also hold ultrafast. The picker,
SetFastPick, routing groups and Codex's catalog all go through CanFast.
- A fast pick from an agent on Anthropic's Messages API carries Claude's
speed "fast". Translated to the remote's Chat Completions or Responses,
nothing turned that into service_tier. forwardTranslated now sets the
tier the remote offers (priority, or ultrafast for an Ultrafast pick
where offered) when the request is fast and names no tier. A request
that names a tier is sent as before.
The remote side already serves a Chat request's service_tier priority to
Codex and to the Cursor plugin (TestChatFastTier,
TestPluginServiceTierReachesFetch), so a remote on an older version works
once the local magpie is updated.
Docs: the remote magpie service tiers row in
docs/subsystems/providers-accounts.md.
Run at this tree (rebased on origin/main):
- New TestRemoteMagpieFastPick: two httptest servers (the remote gateway
and a Chat-only vendor, as the report's native_endpoints). Claude Code
on /v1/messages and a Chat client both reach the remote with priority,
and the remote sends its vendor priority. A model offered no tier
can't be picked, and another agent's request goes without a tier.
- go test ./internal/gateway -run 'Fast|Tier|RemoteMagpie|Remote': ok.
- go test ./internal/codexcat: ok.
- go test ./internal/provider, ./internal/agent, ./internal/gui: the only
reds are already filed and unrelated to this change:
- #3632: the synctest crash in TestUnreadLoginsWriteErrorsKeepCredentials.
Skipped on the rerun; everything else in provider passes except the
three below.
- #3854: TestFetchAsksOneListOnceForTwoBasesOfIt,
TestFetchUnionsProtocolListsWithoutChat and TestFetchAsksASharedBaseOnce.
Also red 3 of 3 at a fresh origin/main
|
||
|
|
ef155a5ca2 |
provider: a new partner provider starts at the region where the user is, Kimi Code's Global plan abroad (Kimi)
Kimi (a sponsor) reported: "伙伴卡编辑器默认区为 China,建议按用户区域分流".
A partner given only by regions started at its first one, and Kimi
Code's partner card lists China first, so a user abroad was offered the
China plan's endpoints, key page and catalog.
Now, when a partner's first region is China's or Global's and the other
is listed too, a new provider of it starts at the one where the user is:
China's in mainland China, Global's elsewhere. The place is read from
this computer's time zone: LocalZone ($TZ, /etc/localtime) on macOS and
Linux, the registry's TimeZoneKeyName on Windows. Asia/Shanghai,
Asia/Urumqi and their old names (Chongqing, Harbin, Kashgar, PRC) and
Windows' "China Standard Time" are mainland China; Hong Kong, Macau and
Taipei have zones of their own and get Global. Windows' China Standard
Time also covers Hong Kong, which Windows doesn't tell apart. A zone
that can't be read keeps the partner's first region, as before.
It is decided in validPartners, where the partner's default endpoints
are filled in, so every add path takes it: the GUI editor (its region
picker marks the region at the preset's endpoints, and Get a key and the
site link follow), the TUI's and CLI's add (FromPreset). The default
region's key page, site, siteHost and catalog become the preset's with
its endpoints, as atRegionOf does for a provider.
Which regions count: only one with id cn/china/global/intl or named
China, China Mainland, Mainland China, Global or International. Checked
against each partner in site/partners.js: Kimi (China, Global, "Pay as
you go · China", "Pay as you go · Global") switches between its two
plans only; APIKEY.FAN (Default, Direct) gives its own top-level
endpoints, so no region is defaulted; WandAPI, CoreCode, Sidrune and
FastAIToken have no regions. yylx (a built-in preset, not a partner)
lists Auto first and would stay at Auto anyway.
Providers already added keep their region: a provider stores its own
endpoints when it is added, and its region is read from them
(regionOf), so a user who moves keeps theirs. The list kept on disk
from before is fixed at the next fetch, which runs at start.
Tests:
- TestPartnerStartsAtTheUsersRegion, from usemagpie.ai/api/partners as
served on 2026-10-27 (testdata/partners-2026-10-27.json): abroad Kimi
Code starts at api.kimi.ai, keys /go/kimi/keys/global, site host
www.kimi.ai, catalog kimi-code-plan-global; in China and with no zone
at api.kimi.com and China's; a provider added in China stays there
after the user is abroad and the list is fetched again; APIKEY.FAN
starts at its own endpoints either way.
- TestHomeRegion: Kimi's four regions, yylx's Auto first, Global first,
plans only, no Global; chinaZone for Shanghai, Urumqi, PRC, China
Standard Time, Hong Kong, Taipei, Singapore, New York, UTC and "".
- Broken by hand: with the region back at p.Regions[0], the test fails
"abroad: a new Kimi Code provider is at {chat:https://api.kimi.com/
coding/v1 … catalog:kimi-code-plan-cn}, want {… api.kimi.ai …
kimi-code-plan-global}" and "the preset's endpoints … aren't its home
region's". With the key page/site/catalog line dropped, it fails on
keys https://usemagpie.ai/go/kimi/keys (not …/keys/cn) in China.
- go test -tags nogui -count=1 -timeout 45m ./internal/provider
./internal/cli ./internal/tui at
|
||
|
|
adf41acdd8 |
provider: the built-in Kimi presets' key pages and sites carry Kimi's referral (aff=magpie)
Kimi (a sponsor) asked for referral tracking on magpie's Kimi entry points. The four built-in Kimi presets now send "Get a key" and the editor's site link to Kimi's own pages with aff=magpie: - moonshot (Kimi, pay as you go, Global): platform.kimi.ai?aff=magpie, platform.kimi.ai/console/api-keys?aff=magpie - moonshot-cn (Kimi (China)): platform.kimi.com?aff=magpie, platform.kimi.com/console/api-keys?aff=magpie - kimi-code (Kimi Code, Global): www.kimi.ai/code?aff=magpie, www.kimi.ai/code/console?aff=magpie (was www.kimi.com, the China site, for both) - kimi-code-cn (Kimi Code (China)): www.kimi.com/code?aff=magpie, www.kimi.com/code/console?aff=magpie Endpoints (api.moonshot.*, api.kimi.*) are unchanged. The partner card (site/partners.js "kimi") already had aff=magpie and is untouched. What happens to providers added before: a provider keeps the Website and KeysURL it was saved with, so an already-added Kimi provider's own "Get a key" link (shown only while it has no key) stays the old page. The editor's site link for a preset without regions reads the preset's, so it shows the new one. Rewriting saved links was left out on purpose: a saved value may be the user's own (keys=/website= in the CLI). Run: - curl -sIL of each of the eight new URLs: all 200, no redirect (platform.kimi.com/.ai, their /console/api-keys, www.kimi.com/.ai/code and /code/console, each with ?aff=magpie). - The editor's link label is hostOf(url), the host only: platform.kimi.ai, platform.kimi.com, www.kimi.ai, www.kimi.com, no query shown. - git grep for the old URLs (platform.moonshot.*, www.kimi.com/code*): no test, doc, site page, i18n string or TUI text pins them; nothing treats these links specially (only models.go comments cite kimi docs). - go test ./internal/provider: see the next commit's record (run with it). Not tried: opening the links from the real app's editor. |