4794de398ea8337d223a91e207181c56fcf4ad76
186
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d6fd9b3a36 |
provider, agent, gui, cli: Codex can switch only its own sign-in between accounts, never through the gateway (#1907, foobra)
foobra wants Codex Desktop and the CLI kept on their own ChatGPT subscription, moved to the next saved account when the signed-in one is used up and back when it resets, without magpie's gateway in the way. magpie already did the switch (codex_switch.go: 98%, 100% In order, back under 90%, unknown usage never switches), but with more than one Codex account on it also wrote openai_base_url into config.toml so a refused request fails over through the gateway (codexFailover). There was no way to have the first without the second. Now Codex's subscription has SwitchOnly (providers.json "switchOnly", opt-in, off by default so nothing changes for anyone who doesn't tick it): - provider.SetSwitchOnly / provider.SwitchOnly; only Codex's own subscription takes it. An unreadable providers.json reads as on, so magpie's own failover is never written on a guess. - agent.codexFailover is false when it is on: no openai_base_url, no failover note, no magpie models in Codex's list. A base URL the user wrote stays. - The account Save copy keeps it. - GUI: "Only switch Codex's sign-in" tick under Providers > Codex's accounts (with more than one on), posting provider/switchonly; the Agents row's failover title points at it. zh, zh-TW, ja, de. - CLI: magpie accounts switch-only codex [on|off]. - docs/reference.md and providers-accounts.md say what it does and that an open Codex app or app-server stays on its account until reopened. Run (darwin, sandbox HOME, -tags nogui): - go test ./internal/provider -run 'TestCodexSwitchOnly|TestCodexSwitchedWhenUsedUp|KeepLogin' - go test ./internal/agent -run 'TestCodexSwitchOnly|TestCodexFailover|TestCodexOwnModelThroughMagpie|TestCodexHandWritten' - Broken by hand, each red: codexFailover guard removed (agent test), SwitchOnly dropped from the Save copy, SwitchOnly reading false on an unreadable file (provider test), the tick drawn unticked (GUI, 16/16). - GUI: switch-only (new), keep-login, agent-failover, gui-ja, gui-de, gui-zh-tw in Chromium and WebKit, en/zh/ja/de at 1100 and 420: 77 pass. - The built binary's `accounts switch-only` in an empty sandbox HOME: reads off, refuses on with no Codex provider, refuses claude. - gofmt -l clean; darwin go vet. Reviewed and rerun after rebasing onto |
||
|
|
1502433978 |
gui: a key's value can be changed in place, keeping its name, place and settings, and its rest is lifted (#1869)
A key rotated at its vendor had to be removed and added again, which lost its name, its place in the order, its weight, protocol, models, proxy and concurrency, and any gateway key restricted to it. As decided on #1869, in multi-key mode the row now has a Change key action, with a double-click on the row as a shortcut. - provider.ReplaceKey(id, ref, key) sets the key's new value and moves what providers.json keys by the key's fingerprint (AccountModels, AccountProxies, AccountConcurrency) to the new one. An empty value, an unknown key and a value another key of the provider already holds are refused. The same value is a no-op. - access.ReplaceAccount moves gateway keys' Accounts entries from provider/old to provider/new, under the caller-keys lock. - gateway.Server.UnrestAll lifts a rest key and every per-model rest under it. The GUI's keys/replace lifts the key's rest (provider#key, and the provider's own rest key when it is the only key on), so the new value is asked from the next request. - app.js: a pencil beside the key's copy button opens a password field in place of the masked value. Enter saves, Escape leaves it, and a double-click on the row away from its controls opens it too. The button has its own class (.key-edit) with the copy button's look. - i18n: four strings in zh, zh-TW, ja and de. - providers-accounts.md: ReplaceKey in the Keys table. Past requests keep the old fingerprint in history, under the same name. A rest is lifted only in the gateway this magpie serves. Run: - go test ./internal/gateway ./internal/provider ./internal/access ./internal/gui -count=1: ok. New TestReplaceKeyKeepsItsPlace, TestKeysReplaceKeepsTheKeyAndLiftsItsRest and TestUnrestAllLiftsAKeysModels each fail with their change taken out. - gofmt -l clean; go vet darwin, linux -tags nogui, windows. - key-replace.test.cjs (new): en/zh/zh-TW/ja/de, chromium and webkit, 1100 and 420px. Checks the post, order, note, no sideways scroll, and no scroll on change or on double-click plus Escape. - With key-copy, rest-try-now and key-import: 96/96. - 72 key*/routing*/rest* GUI files at concurrency 6: 863/871. The 8 reds were key-copy, whose button.copy locator matched the pencil; that's why it has its own class now, and key-copy passes. - Under load, about one run in 300 saw the editor body go back to the top after the copy button's double-click, with no script scrolling it. That is #1504 (findings added there). The test checks scroll before that step. |
||
|
|
248a68598c |
gateway, provider, gui, cli: a key+URL provider may be sent the agent's own User-Agent in place of magpie's (#1851)
Every forward went with User-Agent magpie/<version>. A coding plan that serves only the agents it names (pi, OpenCode, Claude Code…) knows them by their User-Agent, so it turned magpie away. What changed - provider: PassUserAgent (passUserAgent in providers.json), off by default. PassesUserAgent takes it only for a key+URL provider: never a signed-in account, a plugin's, or a vendor whose own client magpie goes as (OwnClient: OpenCode, Cline, Kilo, another magpie). A copy keeps it. - gateway: userAgentFor in forwardOnce (chat, Anthropic, Responses, Gemini, count_tokens) sends the inbound User-Agent unchanged where the provider passes it on. It sends magpie's where it doesn't, where the agent sent none, and on magpie's own requests (magpiesOwn: magpie/…, magpie-router/vision/search, the image tool's "<client> magpie-image/1", which is built from MCP clientInfo, not a User-Agent). magpie never invents another client's. The claude-cli/Codex header copies, the OpenCode/Cline/Kilo overrides and account signing run after it as before, and the user's header.User-Agent is put on at signing, so it wins. - gateway: embeddings, images and videos (retrieveFrom, sendWith, remoteVideoContent) now stamp the same for a key+URL provider through stampUA, from the caller's User-Agent kept on the request ctx (caller.ua, withCaller). Before, they went with Go's default (Go-http-client/1.1). Account and remote-magpie paths are untouched. - cli: `magpie provider set <id> user-agent=agent|magpie`, refused for a signed-in account; `magpie provider <id>` shows it. - gui: the provider editor's User-Agent row, "Send the agent's own User-Agent", with an explanation, for a provider with a key only (the JSON says ownClient for presets and providers); en/zh/zh-TW/ja/de. The TUI only adds presets, so it has no field for this. - docs: reference.md (provider set) and subsystems/gateway-routing.md. What was run - gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows. - go test -count=1 ./internal/gateway ./internal/provider ./internal/cli ./internal/gui: all ok (sandbox HOME, private GOCACHE). - TestUserAgentPassedOn covers 7 routes (messages, count_tokens, chat, responses, gemini, embeddings, images) x off / on / on with no UA / on with magpie-router/1 / on with the image tool's UA / the user's header with it on and off. TestUserAgentAccountUntouched: a Factory account with passUserAgent in providers.json is still asked as factory-cli/. Also TestUserAgentClaudeCodeAsBefore, TestUserAgentFor, TestPassesUserAgent, TestAddCopyPassUserAgent, TestProviderUserAgentPair. - Broken by hand, each went red: forwardOnce back to magpie's UA (5 routes red); stampUA removed from embeddings/draw (both red, seen as Go-http-client/1.1); PassesUserAgent ignoring accounts/OwnClient; magpiesOwn dropped (the internal UAs leaked on all 7 routes); the GUI row shown for OpenCode and Save not posting it. - provider-user-agent.test.cjs: 60/60 in chromium and webkit, en, zh, zh-TW, ja, de, at 900 and 440 wide. The provider/editor/add/i18n GUI tests in chromium: 244/244. Not run - Not tried against a real coding plan that checks User-Agent, nor with a real agent through a live gateway. Videos have no test of their own (they go through sendWith, which the images test covers). - The GUI suite was not run in full; the Windows box was not used. |
||
|
|
8792ee063d |
provider: a Volcengine or Tencent access key is kept through sync, restore, a stale editor and a copy, and a plan card without one says what to give (#1821, Edward4226)
The reporter's Volcengine Agent Plan card vanished: providers.json had
lost accessKeyID/secretAccessKey, and volcPlanQuotas skipped a provider
without them before building any card, so nothing said why.
Writers that dropped the access key, fixed at the cause:
- Sync and restore (Mirror, Restore, davsync take) kept this machine's
access key and balance token only when the incoming provider had no
key at all. A magpie before v0.1.1142 (
|
||
|
|
10d60b1899 |
provider: a provider saved with Select none serves no models, unlisted or not (#1818)
Select none saved `models: []`, which omitempty wrote as no models key at
all, so the provider read back as "no picks" and served the first 24 of
the vendor's list on /v1/models, in auto groups and on the card, while
the editor said none would be served.
What changed:
- Provider.NoModels (json noModels) records the choice; ServesNone() is
NoModels with no picks. A file with no models key still serves the
vendor's list as before.
- Exposed() is empty for it, so the catalog, /v1/models and auto groups
leave it out; resolveIn refuses an explicit pid/model to it; listedBy
and Deciders skip it (a decide-only provider is still a decider).
- SetModels and normalize clear NoModels once there are picks.
- GUI: the editor sends noModels on Save, an edit that omits it keeps it,
the card's exposed count is 0, the hint says nothing is served; with
unlisted the dashed chips explain they are only for groups. Strings in
en, zh, zh-TW, ja, de.
- CLI: `magpie provider models <id> none`.
- docs/subsystems/providers-accounts.md describes it.
Decision (owner delegated): Select none means none, whether or not
unlisted is on; unlisted keeps meaning "hide from the list, still
usable by groups that name it".
Run:
- go test ./internal/provider ./internal/gui ./internal/cli -count=1
(green; second pass ran too) with private GOCACHE and sandbox HOME.
- Broke Exposed's ServesNone check: TestSelectNoneServesNone red
("exposed 24"); broke resolveIn's: red ("watched/m0 resolved"); broke
the GUI keep line: TestProviderSaveSelectNone red ("exposed 24").
- GUI tests chromium + webkit, 5 languages: provider-none-picked 20/20,
provider-draft-picks 10/10 (red with noneChosen broken), plus 12
related model/group/editor tests green.
- gofmt -l clean; go vet darwin, linux -tags nogui, windows clean for the
three packages.
Not run: the gateway package; Codex native model narrowing is unchanged.
searcher-pick.test.cjs fails 3 webkit cases (hover timeout) identically
on the unmodified base
|
||
|
|
a3cd133845 |
provider, gui: Add another key on an OpenCode Zen provider says an empty field adds public, the key its free models answer, and adds it (#1795)
An OpenCode Zen provider added with no key asks with public, the key
OpenCode sends signed out (normalize). On a Zen provider that already had
a key of the user's own, Add another key said only "paste an API key", and
with nothing pasted AddKey refused before it knew which provider it was
("paste the key to add"), so there was no way to learn of public or add it
as the anonymous fallback behind the user's own key.
- provider: Provider.AnonymousKey is the key a provider is asked with when
the user has none (OpenCode Zen's public, by its preset, as normalize
already decided; "" for every other, Kilo included). AddKey looks the
provider up first; nothing pasted adds that key, and asked again says
"<name> already has public, the key its free models answer with none of
yours" rather than "already has this key". Every other provider still
wants a key pasted. normalize reads the same method.
- gui: /api/providers names anonKey on a provider that has such a key and
doesn't have it yet. Its Add another key field reads "paste an API key,
or leave empty for public: free models only" (title too, where a narrow
field cuts it short), and the row added is marked as any new key's is.
zh, zh-TW, ja and de translations.
Verified:
- TestZenAddKeyEmptyIsPublic (provider) fails on the old code with
"paste the key to add"; TestZenAddAnotherKeyEmptyAddsPublic (gui,
through /api/keys/add and /api/providers) fails with `Zen with its own
key offers ""`. Both pass with the change.
- zen-anon-key.test.cjs: 40 pass in chromium and webkit, en/zh/zh-TW/ja/de,
at 900 and 560px; on the old app.js the placeholder test fails
('paste an API key' vs the new hint).
- gui-de, gui-ja, gui-zh-tw, i18n-keys, key-import, provider-many-keys,
nokey-editor, key-copy: 46 pass.
- Not tried against Zen itself: whether a gateway falling from a spent key
to public on a paid model rests public is unchanged behavior, the same as
for public typed by hand.
|
||
|
|
af7d97fa2f |
gateway: a Responses provider set codex=as-sent gets Codex's requests as Codex sent them, for a relay that checks they are Codex's own (#1758)
A relay that checks a request is Codex's own answered magpie 400 "Codex 客户端请求特征无效" (10014). magpie fits every Codex request for a Responses backend that isn't OpenAI's: Responses Lite's additional_tools item is lifted into tools (#350), the tool search goes as a function, and OpenAI-only fields such as stream_options.reasoning_summary_delivery are left out. The reporter found that the relay takes the request when additional_tools is left as an input item, and that the lifted shape is what it refuses. The lifting stays the default, because backends that aren't OpenAI's refuse additional_tools or silently drop it (#350). A provider can now opt out: `magpie provider set <id> codex=as-sent` (`codexAsSent` in providers.json; `codex=default` turns it back off). With it on, a request from Codex (fromCodex: Codex's User-Agent or originator) goes as Codex sent it, with only its model name swapped. Codex's own headers go with it as before. A subscription account is never sent this way, and the GUI's provider save keeps the setting. What was run: - TestCodexAsSent: by default the request is still fitted; with codexAsSent the upstream gets exactly what Codex sent, with model m1, X-Codex-Turn-Metadata and the Responses Lite header. It fails on the old gateway.go and passes now. TestAdditionalTools and the gateway's Codex tests pass. Not verified: not tried against the reporter's relay. Their check was made by hand outside magpie, so which other fields that relay looks at is not known. There is no GUI control for the setting (CLI or providers.json only). |
||
|
|
ff930886a2 |
gateway: keys all out of their allowance are answered from their rests with a Retry-After, not asked again on every request, and a key listed twice is asked once (#1772)
A fleet on four Ollama Cloud keys, every one out of its weekly allowance:
each new request asked every key again (the first twice) and answered
429 with no Retry-After, so an agent that waits as told asked again at
once, and the vendor saw four refused requests a turn.
What changed:
- The first key twice: the reporter's providers.json named the first key
in "keys" as well as "key". KeysOn now lists a key once.
- When every key left for a request rests out of its allowance (a 429 or
402 that failure() calls quota or credit, keys only), the request is
answered from the rest without asking: the vendor's own words, "not
asked again before HH:MM", and Retry-After until the first of them is
back (quotaHeld, soonestBack). Accounts are left out, so autoReset
can still spend a reset for them; a 403 or 400 worded as quota is
asked as before.
- The last key out of its allowance now rests as the ones before it do
(before, the last one left was never rested), and a 429 the vendor gave
no Retry-After for gets the soonest rest's end as one.
- A provider can set how long its keys rest when the vendor says nothing
of when the allowance is back: quotaRest (minutes) in providers.json,
or `magpie provider quota-rest <id> 7d`; default stays 15 minutes, at
most 8 days. A time the vendor names (resets_at, Retry-After, a
window) still wins. A GUI save keeps it.
What was run:
- TestAllRestingAnswersFromRest, TestFirstKeyListedTwiceAskedOnce and
TestOwnQuotaRest fail on the old code (no Retry-After, keys re-asked;
"dead-1 dead-1 dead-2 ok-3", the reporter's log); they pass now, with
TestQuotaHeldOnlyForKeysOutOfAllowance, TestDeadChainWalksEachOnce and
TestRestMinutes. The mock answers with the reporter's literal 429 body.
- go test -tags nogui ./internal/provider ./internal/gui pass. A gateway
package run at load ~60 hit its 20m timeout mid-suite with only
TestMaxRPM* red; those pass 8/8 alone here and on origin/main
|
||
|
|
f8214ec972 |
provider: a third-party Anthropic API that refuses x-api-key and Authorization together is sent one, picked in the editor or learned from its 401 (Aloha on Discord)
magpie sends a user's own Anthropic-compatible provider its key in both
x-api-key and Authorization: Bearer. Some relays answer 401 "鉴权 header,
x-api-key 和 Authorization 不可以同时存在", so every request failed.
- Provider.AuthHeader ("" both, "x-api-key", "bearer") picks which
AuthHeaders sends on the Anthropic protocol. Anthropic's own API,
Bedrock, Azure, Vertex and subscription accounts are untouched: they
send x-api-key alone (or their own) whatever it says, and BothAuth()
is false for them.
- Left at both, a 401 whose body catalog.BothAuthRefused tells as that
refusal (names both headers and says they can't be together, Chinese or
English) is asked once more with x-api-key alone, then Bearer alone
(RetryOneAuth, in the gateway's forwardOnce and the provider test's
probe; the model-list fetch through catalog.fetchOne too). The first not
answered 401/403 is saved (LearnAuthHeader), never over a pick the user
made. A request carrying the user's own Authorization/x-api-key header
is never retried; any other 401 is passed on as it came, asked once.
- The editor has a "Key header" row (Both / x-api-key /
Authorization: Bearer, the app's segmented control) while the provider
has a third-party Anthropic URL; strings in zh, zh-TW, ja, de.
- docs/subsystems/providers-accounts.md: an "Anthropic key header" row.
Run (sandbox HOME, GOCACHE/GOMODCACHE pinned, set -o pipefail):
- gofmt -l; go vet ./...; GOOS=linux go vet -tags nogui ./...;
GOOS=windows go vet ./...; GOOS=linux/windows go build.
- go test -tags nogui ./...: 47 packages ok; agent and gateway timed out
at 10m under load average ~50-98 (other sessions' test runs), so rerun
with -p 1 -timeout 60m: agent ok; gateway ok but for
TestOTelWaterfallIncludesUnbilledFallback, a load flake unrelated to
this (it reads only the first 200ms OTel export; passes 5/5 alone),
filed as #1794.
- New tests: internal/provider/authheader_test.go (official Anthropic and
Bedrock unchanged for every pick; Aloha's 401 body retried with
x-api-key and kept; Bearer-only relay learns bearer; the model list
learns; another 401 and the user's own header aren't retried; a user's
pick isn't overwritten), internal/gateway/authheader_test.go (a
/v1/messages turn through the gateway to such a relay succeeds and the
next Chat Completions turn goes with one header first).
- Broken by hand: RetryOneAuth returning at once and AuthHeaders ignoring
the pick -> TestAuthHeaderChoice, TestRetryOneAuthLearns,
TestRetryOneAuthBearer, TestOneAuthHeaderRelay FAIL; the list retry off
in live.go -> TestListLearnsOneAuth FAIL.
- GUI: provider-auth-header.test.cjs 20/20 in chromium and webkit, en and
zh, 390px wide; the editor's other tests (provider-*, nokey-editor,
editor-short-window, segs-*, vertex-editor) 439/440, the one
(provider-discovery, chromium zh) passing 26/26 alone.
Not tried: a real relay of Aloha's; the retry is built from the body the
user quoted.
|
||
|
|
3a53d06d99 |
provider, plugin: a subscription's sign-in goes through the proxy its account's requests use, not always the global one (#1663, demystify0137)
What changed: every sign-in started in magpie now leaves through the
account's own proxy (ProxyOfLogin: the account's, else the
subscription's, else the global one). Before, the sign-in's token
exchange and checks went through the global proxy while the account's
later refresh and usage calls went through its own (ViaLogin), so the
vendor saw one account come from two exits.
- signin.go: SignInOptions{Site, Proxy, User}, StartSignInWith; the flow
picks its proxy (pickProxy, validated with settings.CheckProxy) and
every request goes through s.via. Each built-in sign-in (Claude,
Codex/ChatGPT, Grok, Zed, WorkBuddy, Copilot, ZCode, Factory, MiMo,
Qoder, Command Code, Kiro) uses s.via; Claude Code's own login gets the
proxy as *_PROXY (netproxy.EnvWith).
- proxy.go keepSignInProxy: a proxy picked for the sign-in is kept as
the subscription's when the account is its only one, else as that
account's own entry. "" (global) is refused while the subscription has
a proxy and other accounts, since nothing could keep it.
- plugin host: authorize and callback run under via.run(proxy), so a
plugin's sign-in fetches go through the same proxy; plugins_cli.go
does the same for `magpie plugins login`. PluginAPIKey goes through Via.
- gui: POST /api/signin and /api/plugin-signin take proxy and user.
What was run:
- go test -tags nogui ./... (sandbox HOME), all packages ok.
- gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui on the
touched packages.
- Red without the change (each broken by hand, then restored):
TestSignInGoesThroughItsProxy, TestDeviceSignInGoesThroughItsProxy,
TestPluginSignInGoesThroughItsProxy, TestClaudeSignInGoesThroughItsProxy
(internal/provider) and TestPluginSignInProxy (internal/plugin) each
fail with the s.via / EnvWith / via.run / keepSignInProxy removed.
Not tried: a real vendor account through a real proxy. The browser's own
leg of an OAuth sign-in goes through the browser's network, not magpie's.
Devin's CLI probes still use the global proxy.
|
||
|
|
863af7abc8 |
provider: a provider's Extra body adds JSON fields to every request's body, ${sessionId} as the session (#1604, Luc-xz)
What: a provider has an Extra body (extraBody in providers.json, a JSON
object, beside Headers; an "Extra body" box in the editor under Headers).
Its fields are added at the top level of every JSON body sent to that
provider, in the gateway's forwardOnce: Messages, Chat, Responses and
Gemini, relayed as they came or translated from another API. Test models
and Detect send them too (provider.tested), so a relay that
refuses a request without them can be tested before a Save.
- A field the request already has is kept; "!name" replaces it.
- ${sessionId}, in any string at any depth, becomes the session id: the
agent's session header (sessionOf), else the id conversationID derives
from the first user message (magpie-<hash>), stable through one
conversation. Test and Detect send magpie-test-<12 random letters>.
- model, stream and the conversation (messages, input, contents, system,
systemInstruction, system_instruction, instructions, tools) are never
set from it: Save refuses them (ExtraBodyOK), the editor says why as
they are typed and holds the Save, and one written by hand into
providers.json is dropped on read (cleanExtraBody).
- Not sent: count_tokens, embeddings, images, video, the decision model,
and signed-in accounts' requests. One object goes to every API;
per-API sections aren't done.
- A save that leaves extraBody out keeps the saved one; {} clears it.
Why: Luc-xz's relay turns Responses requests away without a
prompt_cache_key, and headers alone couldn't add one.
Docs: providers-accounts.md has an Extra body row and its tests.
Run:
- go test -tags nogui ./internal/provider ./internal/gateway ./internal/gui
-run ExtraBody: pass. The tests are TestExtraBodyResponsesRelayed,
ChatDerivedSession, Translated (messages→chat, chat→responses),
Anthropic (count_tokens left alone), Gemini (relayed and from chat),
TestExtraBodyTested/OK/ReadByHand, TestWithExtraBody and
TestProviderExtraBodySaved.
- Broken by hand, each FAIL recorded, then restored:
- WithExtraBody removed from forwardOnce: all 5 gateway tests FAIL.
- the countsTokens guard dropped: TestExtraBodyAnthropic FAIL.
- tested() without the extra body: TestExtraBodyTested FAIL.
- Save's ExtraBodyOK skipped: TestProviderExtraBodySaved FAIL.
- keep-when-omitted skipped: TestProviderExtraBodySaved FAIL.
- internal/gui/tests/extra-body.test.cjs: en, zh, ja and de, in Chromium
and WebKit, 8/8 pass. It covers live errors, Save held and focused, Test
sending the typed object, the 420px fit, Save as an object, and empty
saving {}.
- Also run: gui-de, gui-ja, gui-zh-tw, i18n-keys, provider-*, providers-*,
balance-fix, duplicate-pause, editor-short-window, ux-safety and
vertex-editor.
- gofmt -l clean; go vet -tags nogui for darwin, linux and windows on
provider, gateway and gui; the full go test ./... after the rebase.
Not tried: a real relay that needs prompt_cache_key; the fixtures are
httptest upstreams.
|
||
|
|
85089a2400 |
gui: a routing group whose plugin lists none of its models no longer blanks the Routing page; it shows as matching nothing, the rest as ever (#1585, dbydd)
The reporter's Routing page showed only "null is not an object
(evaluating 'g.members.map')" and no group, while every group still
routed. A group made of patterns only whose models a provider stops
listing (a plugin behind on updates) has no members, and Go's nil slice
went out of /api/groups as "members": null. groupRow, pickedRow, the
filter and the group editor (inGroups reads every group) all call
members.map/some/flatMap, so one such group threw out the whole list.
- groups.go: groupsState says a group's members as [] when it has none,
and an unmakeable template's too.
- providers.go: the Gateway's group entries say icons and providers as
[], never null (app.js gatewayModels joined g.providers).
- routing.js: every /api/groups response goes through groupsFrom, which
makes each list a list and leaves out an entry that isn't a group;
drawGroups draws a group that still throws as one flagged row
("This group can't be shown: …", zh/zh-TW/ja/de), never the whole list;
the filter shows such a group rather than throwing.
- app.js: gatewayModels reads null icons/providers as none.
Verified: a probe through provider.SaveGroup({Match: a/m*}) then the
provider listing other models gave "members":null on main; the Go test
TestGroupsNeverNullMembers goes red with groups.go reverted (group and
3 templates null) and green with it. GUI test group-null-members.test.cjs
uses that response's literal bytes: 12/12 red on the old assets, 12/12
green now (Chromium + WebKit, en + zh, 1100 and 420 wide, plus the
Gateway list). gui-de, gui-ja, i18n-keys, group-*, panel-routing,
gateway-model-info and the routing-manual/save/provider-off tests pass
(221/221). Which plugin the reporter has was not asked; the fix covers
any provider whose models a pattern group stops matching.
|
||
|
|
1d016ee3f3 |
provider, gui: Token Plan 企业版 shows its usage on the Usage page, read with the account's SecretId and SecretKey (#1574, undirectlookable)
#1574 asks for Tencent Cloud Token Plan's usage on the Usage page through TokenHub's cloud API (api/1823/132270). That API covers the enterprise plan only (Token Plan 企业版; the previous commit added its regions). The personal plan (api.lkeap.cloud.tencent.com/plan) has no usage API, only the console, so it has no card. The API takes the account's API key, a SecretId and SecretKey signed TC3-HMAC-SHA256, never the plan's sk- key. provider (tencent_usage.go): - A provider at /plan on tokenhub.tencentmaas.com (ap-guangzhou) or tokenhub-intl.tencentmaas.com (ap-singapore) with a SecretId and SecretKey gets a card per team plan in PlanQuotas (tencentPlanQuotas), each key and region asked once. - It asks DescribeTokenPlanList, then DescribeTokenPlan per plan (version 2026-03-22), all at tokenhub.tencentcloudapi.com. Where a reply leaves a part out, the list's copy of it is kept. - The window is TotalUsed of CycleQuota (else TotalQuota), in credits (专业套餐) or tokens (轻享套餐, enterprise-auto). It resets at TokenSummary.CycleEndTime. Without that, it counts months from StartTime and stops at ExpireTime. - The docs don't say whether TotalUsed is the cycle's or the package's. This reads it as the cycle's. - A plan that isn't enable shows its status beside the plan's name. - An AuthFailure or UnauthorizedOperation reply says to check the key and its CAM rights. No plan visible to the key says so (a sub-user sees only the plans it made). - The SecretId and SecretKey sit in the AccessKeyID and SecretAccessKey fields Volcengine's access key uses (#1427). They are stored, kept out of key-less backups and dropped from cached cards the same way. AccessKeyVendor tells the two vendors apart. gui: - The listing tells whose access key a provider or preset takes. presetAccessKey lists the regions that take one: Tencent Cloud's two Enterprise regions. - The editor names the fields SecretId and SecretKey, with Tencent's hint, and shows them only at those regions (or at an endpoint none of the regions has). - A SecretId with no SecretKey is refused only where the fields are shown. The new strings are in zh, zh-TW, ja and de. - docs/subsystems/providers-accounts.md and the GUI tests README describe it. Run: - TestTC3SignMatchesDoc pins the signing doc's worked example (payload hash 35e9c5b0…, Signature 10b1a37a…). - TestTencentPlanRegion, TestTencentPlanWindow and TestTencentPlanQuotas use the API docs' own response examples. The last is an httptest fake that rechecks each TC3 signature and the X-TC-* headers, and fails if the plan's key is ever sent. - TestProviderListTellsTencentAccessKey covers the listing, alongside TestVolc* and TestPlanQuotas. - Breaking the action's lowercasing in the signature, or dropping TokenSummary, turns them red. - GUI: tencent-access-key.test.cjs (new) 12/12 in Chromium and WebKit at 420px, en and zh. It goes red with the region hook or the vendor labels taken out. volc-access-key, tencent-cloud, i18n-keys, gui-ja and gui-de pass. - gofmt; go vet on darwin, linux and windows; the full go test ./... Not tried against the real API: we have no Tencent Cloud account. What is read is what the docs show, and the reporter is asked to try it. |
||
|
|
909d767472 |
gui: with MAGPIE_PUBLIC_URL set, Gateway's Connect starts at it until the user picks an address, and magpie web shows it as the gateway's address (#1551, everpcpc)
everpcpc runs magpie web in Docker behind a reverse proxy with
MAGPIE_PUBLIC_URL=https://magpie.example.com. The page is opened from
other machines, yet Connect's Base URL, the copied shell/curl/Python/Node
snippets and the gateway's address on the Gateway page started at
http://127.0.0.1:3425. v0.1.1174 kept a picked address; the public one
still had to be picked once on every browser.
- /api/providers' gateway carries publicURL: MAGPIE_PUBLIC_URL when it is
among the addresses Connect offers (shared, or MAGPIE_ADDR on the
network). With no address kept in magpie.connectAddress, Connect starts
there, so the snippets and the gateway key picked for it follow. An
address the user picked, this computer's included, still wins.
- The option is labelled "Public address" instead of "Local network".
- /api/settings carries publicURL under the same condition, and Settings >
About lists it beside the local Gateway URL, which stays the address
agents here are pointed at.
- In magpie web, a page served to other machines, the Gateway page's
address and Settings' web-search MCP server show the public URL; in the
app they stay local. Agents' own config wiring is unchanged (#373).
- New strings in zh, zh-TW, ja, de; docs/reference.md says where it shows.
Run: public-url-default.test.cjs (new) on chromium and webkit, en, zh,
zh-TW, ja, de, at 1100 and 420 wide, 26 pass; on the old app.js 12 of 13
chromium cases fail. Making the public URL override a kept pick turns it
red too. TestPublicURLInConsole and the new TestPublicURLOnlyWhereOffered
pass. Sibling GUI tests (connect-address-kept, the gateway-key-* and
gateway-connect/caller-keys tests, api-key-theme, public-url, lan-docker,
phone-web, search-mcp, settings-sections/groups, gui-ja/de/zh-tw): 192
pass; phone-web failed once under the parallel run and passes alone on
both engines. gofmt, GOOS=linux and GOOS=windows go vet -tags nogui
./internal/gui, go test -tags nogui ./... under the queue lock: its one red
is TestAccountDiscoveryOffReadsNoSignIn (internal/provider, from
|
||
|
|
7a9cf4dd4d |
gui, provider: Detect APIs and Each picked model ask with the form as it stands before any Save, and say what is missing in place (#1545, thedavidweng)
What the user saw: on a custom provider being added (or a Duplicate not
added yet), "Each picked model" said "Pick models first" although models
were typed in the Models field, and on a relay with no model list "Detect
APIs" said "no model to try" on every API. Both worked only after a Save,
when the models became the provider's own. A Duplicate not added sent no
key at all. Hints for a missing URL or models went to the toast at the top.
Why: chosenIds() reads a saved provider's chips only, not a new one's
draft.extra; Detect picked its model from the saved provider's list or the
vendor's, never from the form; an unsaved copy posted no id, so the server
had no key to fill in.
What changed:
- provider.Detect takes the form's picks (picked ...string) and tries one
of them per API before the saved list or the vendor's.
- /api/provider/detect takes `picked`, and for `new` + `copyOf` fills
what the draft left empty from the copied provider, as a saved edit
fills from its id. It still only reads: nothing is written, no provider
is added, no route or health check changes. No new route; magpie web's
key guard is the same.
- detectAPIs sends the add form's models (draft.extra) for a new
provider, copyOf for an unsaved copy, and says a missing URL, missing
models, a refusal, and "none answered, and no API key is typed" inline
under the buttons (amber/red text, no border). One new string in zh,
zh-TW, ja, de.
- docs/subsystems/providers-accounts.md: the detection row says so.
What was run:
- TestProviderDetectDraft (new): new draft with picked models on a relay
with no list, Each picked model, saved provider with a masked key and an
unsaved pick, an unsaved copy with no key typed and with a key typed,
config folder bytes unchanged, provider.All unchanged, magpie web without
its key -> 401 and the vendor never asked. Fails on the old detect.go /
providers.go ("no model to try").
- provider-detect-draft.test.cjs (new): chromium + webkit, en/zh/zh-TW/ja/
de, 900 and 360px, 20/20 pass; no scroll on click, no <select>, no
left-border, no sideways scroll, nothing but detect posted. Fails on the
old app.js (no inline hint).
- provider-detect, provider-detect-models, provider-add-models,
duplicate-pause, i18n-keys: 29/29, both engines.
- go test -tags nogui ./internal/gui/ ./internal/provider/ ok; gofmt -l
clean; GOOS=linux and GOOS=windows go vet -tags nogui ok.
- Real use: sandbox `magpie web` (nogui build) with a fake upstream. New
provider, relay with no model list: Detect APIs and Each picked model
answered with the typed key and models, no providers.json written. Saved
provider with its key masked plus a model typed in its add box: both
asked with the saved key. Duplicate not added: asked with the copied
key. providers.json bytes unchanged. Without the web key: 401, the
upstream got nothing.
|
||
|
|
cd93bbec0e |
provider, gui: a signed-in account can be given a name of the user's own, and a GLM seat's account card keeps the key plan's name and no longer flickers back to two cards (#1515, aindijrncom)
The same GLM Coding Plan team seat was added twice: as a key provider the
user had named, and as a ZCode plugin account. The Usage page kept only the
account's card, which read "31****36@qq.com" or just "ZCode", and whenever
either read failed ("BigModel API keys: not JSON") or a window had no reset
yet, the key's card came back beside it.
Seat (the flicker): the old check returned "different" on any error. It
now returns same, different or unknown (seatMatch). A match is remembered in
seats.json beside quotas.json; while the remembered account is signed in an
unknown check keeps the key card hidden, windows that disagree forget it,
and a signed-out account brings the key card back (seatCards, used by
quotas, Allotted and CachedCards). A failed read is "unknown", never "not
the same".
Names: providers.json gains accountNames (by the account in lower case,
like accountCaps), set by provider.SetAccountName. They are magpie's own
and never written into the vendor's or a plugin's sign-in. Built-in and
plugin accounts both take one; key providers are refused. Each card carries
Alias (the user's name, else the seat) and Seat (the key provider's name,
and the key's when it has several).
- GUI: the editor's account row shows the name with the address beside
it, or the address with "≡ <key plan>"; a click or Enter renames it in
place (posted once to provider/accountname; Escape leaves it, empty
clears it). The name stays selectable text: dragging across it renames
nothing.
The Usage page's cards and the tray panel name the account the same way.
Hide accounts hides the name too. Strings in zh, zh-TW, ja, de.
- The tray tooltip says "ZCode · <name>".
- CLI: `magpie accounts alias <agent> <email> [<name>|--clear]`.
`magpie accounts` and `magpie quota` show the name; quota also matches
on it.
- /v1/magpie/quotas carries alias and seat.
Run:
- account_seats_test TestSeatKeptThroughAFailedRead fails on the old code
("a failed read brought the key's card back") and passes now.
TestAccountNameOfAPluginAccount uses the fake plugin and checks that
plugin-auth.json and logins.json are byte-for-byte unchanged.
TestAccountsAlias checks that Codex's auth.json is unchanged.
TestTrayNamesTheAccountByItsAlias.
- account-alias.test.cjs: Chromium and WebKit; en, zh, zh-TW, ja, de;
900 and 360px; 20/20 pass. It covers no scroll on a click, keyboard,
selectable text, no select, no stripe, no sideways scroll and masking.
With the post-once guard removed it goes red. account-arrange (text
selection) passes in both engines.
- Sandbox HOME, built binary, vendors behind a dead proxy:
- `magpie accounts alias codex Me@Example.com 某某·GLM高级版`, then
`magpie accounts` and `magpie quota` showed the name.
- An unknown account was refused.
- `magpie web` on spare ports: POST /api/provider/accountname saved
"Team seat" (whitespace folded), and an unknown account got an error.
- Gateway /v1/magpie/quotas and /api/usage/quotas carried the alias.
- auth.json's sha was unchanged throughout.
- go test -tags nogui ./... (temp HOME, load ~200): all ok except
TestSetAnswersWhileDevinAndProvidersHang (15.5s under load), which
passes alone 3/3 at ~250ms.
- gofmt -l; GOOS=linux and GOOS=windows go vet on internal/provider,
internal/gui and the root package.
- The whole GUI suite in Chromium and WebKit, each failed file rerun
alone. These are red on the parent commit
|
||
|
|
3144868538 |
gui, gateway: the Providers and Gateway pages no longer download every recent call's bodies; an opened call reads its own (#1521, xiaohei-info)
GET /api/providers carried up to 40 recent gateway calls with their request and response previews (up to 256 KB each) in gateway.calls, and every provider write returned the same state. The Providers page never shows them; only an opened row on Gateway does. With 40 calls of ~300 KB each, /api/providers was 21,019,635 bytes on origin/main. Taken from xiaohei-info's patch (bb26b802, attached to #1521 as external PRs are closed): providersState drops the bodies from the calls it sends; GET /api/gateway/call returns one call's previews and truncation flags with Cache-Control: no-store, 404 once it has left the ring; the page fetches on open, dedupes a pending read, keeps loaded bodies across refreshes, drops them with their call, shows "Fetching…" and a "Try again" on a failed read; the strings in zh, zh-TW, ja and de; the Go and Playwright tests; the gui-shell note. Changed from the patch: a call is asked for by a number the gateway gives it in the ring (Call.ID, Server.RecentCall), not by time, agent and model, which two calls of one agent to one model can share. The page keys a row by that id too (callRow), so two such calls no longer open, or show the bodies of, each other. The tests ask with ids, and the Playwright fixture gives two calls the same time, agent and model. The route is on the same mux as the rest of the API, so magpie web's key guard covers it, and the gateway's own port doesn't serve it. The bodies are the ones the ring kept, masked as before (redacted runs before capture). Nothing else reads gateway.calls' bodies: Routing reads /api/gateway/trace, and the tray, TUI, CLI and /api/state don't read the ring. Run: - Real use: magpie web built from origin/main and from this commit, sandbox HOME, a local upstream answering 300 KB, 40 calls of 300 KB. /api/providers 21,019,635 bytes before, 45,525 after (calls: 14,503 bytes). Opening a row in Chromium and WebKit fetched /api/gateway/call once (524,412 bytes) and showed both bodies with their "first 256 KB" marks. Without the key: 401, also for a rebound Host; on the gateway port: 404; an evicted id: 404. - TestRecentCallBodiesOnDemand fails with the bodies left in providersState ("providers must keep call metadata without sending bodies"), and with RecentCall ignoring the id ("the second call's detail isn't its own"). - recent-call-bodies.test.cjs fails on main's app.js, and with callRow keyed by time|agent|model again. - GUI: gateway-fold, json-tree, phone-rows, recent-calls-more, request-archive, recent-call-bodies, sse-body: 24/24 in Chromium and 24/24 in WebKit (en, zh, zh-TW, ja, de). - gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui on internal/gui and internal/gateway. - Full GUI suite: 5225 tests, 71 failures under load ~200, none in a gateway or recent-call file. The 20 files with failures, rerun on this commit and on origin/main: 54 and 58 fail; what fails on one only (Sessions checkbox colour, Sessions paging scroll, account dragging, ZCode block) moves between runs on both. - go test -tags nogui ./...: every package ok on the rebased head. Co-authored-by: xiaohei-info <14011749+xiaohei-info@users.noreply.github.com> |
||
|
|
167f133166 |
gui: each of a provider's several keys has a Copy button on its row (#1480, IamMiao)
With one key, the provider editor has an API key field whose Show
reveals the key to copy. With more than one the field is gone and the
key rows had no way to copy a key, as IamMiao reported.
Each key's row now has the same Copy button the app uses elsewhere
(copy icon, tick on success, "<key name> copied"). It asks
provider/key for that row's key: the route takes the key's id in
"account" (as accountmodels already does) and answers through the new
provider.KeyOf, the first key included; without it, the provider's
first key as before; an id it has not is an error, never another key.
The route stays where Show's was, so nothing new is reachable.
Tests:
- gui TestEachKeyCopiesItsOwn: three keys, each row's id answers its
own key, none answers the first, an unknown id fails.
- key-copy.test.cjs: every row has Copy; team-b's and the off key's
copy their own key (asked with that id, /api/copy gets it), say so,
open no rename and move nothing; rows fit 420px. Red on origin/main
(no button) in all four; passes in Chromium and WebKit, en and zh,
420 and 900px. No new strings ("Copy", "{what} copied" exist in all
languages).
Run: go test -tags nogui ./internal/provider/ ./internal/gui/ (ok),
gofmt -l clean.
|
||
|
|
21d0066232 |
gui: Google Vertex AI is added and edited with its Google Cloud project, location, credentials file and service account in place of a key
The Add sheet's Google Vertex AI tile opens an editor with Project ID, Location, Credentials file and Service account where another provider's has API key. The project is focused first, and a Save without one is refused in the page's language. Endpoints shows the address the project and location make as they are typed (Gemini generateContent), with its Test, and is hidden until there is a project to make one of. Refresh and Test before a Save ask with the values typed, spelled as a Save keeps them (typed, Vertex.Normal); an edit that sends none keeps the saved ones. The Providers row's pill names the service account requests go as, else the credentials file, else "Google ADC", and "needs a project" until it has one, never "needs a key". Add another and Duplicate say they carry the project and credentials. zh, ja and de. |
||
|
|
66f920e3a3 |
provider: a Claude account whose user picked every model is served Haiku 5.5 once models.dev lists it, beside the picks (wakaka)
|
||
|
|
df2b44ef6c |
provider: a model's test can be asked as Codex or Claude Code asks, for a relay that serves only them (耍赖天都爱 on Discord)
A relay that serves only Codex or Claude Code tells them by their headers
("This account only allows Codex official clients"). The gateway already
lets those headers go on to a provider reached with a key, so the agents'
own requests were served, but the provider/model test is magpie's own
tiny request (Go's User-Agent), so it was turned away and said the
provider didn't work.
provider.TestAs(ctx, "codex"|"claude-code") asks Test and TestModels as
that agent asks. It goes to that agent's API (Codex: Responses, else Chat;
Claude Code: Anthropic Messages), streamed, store:false on Responses, and
with the headers the gateway last let through for it. The gateway notes
them with provider.SawClient beside the existing pass-through, without the
session, thread, turn, request id, subagent kind, anthropic-beta or
anything that signs. They are kept in client-shapes.json so the CLI has
them too.
Claude Code's headers are never made up. Until a Claude Code request has
come through magpie, the test says so. They are sent only to a relay,
never to anthropic.com, googleapis.com, Bedrock or Azure. A signed-in
account, a decision-only provider, and OpenCode/Cline/Kilo (which already
ask as their own client) are not offered it. Codex's fall back to the
headers a ChatGPT account's requests use (codexSign) until Codex has come
through.
Surfaces:
- CLI: magpie provider test <id> [--as codex|claude-code] [model…]
- GUI: a model chip's right-click has "Test as Codex" and "Test as Claude
Code" where the provider offers them (providerJSON.testsAs). An item that
can't run yet is off, with the reason shown. zh, zh-TW, ja, de strings.
Run:
- TestModelTestAsClient (internal/gateway). A fake relay 403s anything but
codex_*/claude-cli/. The plain test gives 403. As Codex it is OK on
/v1/responses with stream+store:false and codex_cli_rs headers. As
Claude Code it is refused before Claude Code came, then OK after one
Claude Code request through the gateway, with its UA/x-app/x-stainless
but no session id or beta. Anthropic's API is refused. With the beta
filter removed by hand the test goes red.
- model-test-as.test.cjs, Chromium and WebKit, en/zh/zh-TW/ja/de at
420px: 10/10. On the old app.js it fails (no such items). Siblings
model-test-one, model-copy-id, model-test-why, provider-typed: 28/28.
- Sandbox CLI (fake chat relay on :3571, sandbox HOME):
- provider test relaya --as codex deepseek-chat sent
codex_cli_rs/0.162.0 … with originator and version, stream:true.
- --as claude-code said the relay has no Anthropic endpoint.
- go test -tags nogui ./internal/{provider,gateway,gui} and the root
package under a temp HOME with pinned caches: ok. gofmt -l clean.
go vet darwin/linux/windows on those packages: ok.
|
||
|
|
4df1402d10 |
provider: Provider in model names Off names a remote magpie's models alone, not with the other magpie's provider or "routing group" after them (ARNO on Discord)
A remote magpie's list names each model by its label there (magpie_label),
which carries that magpie's provider, or "· routing group", by that
magpie's own setting. Here it was taken as the model's name, so turning
Provider in model names Off on this computer still left "DeepSeek Chat ·
Relay A" and "Fast · routing group" in every agent's list.
The list's display_name, the name there alone, is now kept beside it
(catalog.Model.Plain, Entry.Plain). provider.Labels names an entry by it
under Off, and under own for a name the user gave; two that would read the
same keep their labels as before. On is unchanged ("DeepSeek Chat · Relay A
· Remote magpie"). /v1/models' display_name is that name alone too, as it
is for every other model, so a magpie chained after this one gets it. The
provider editor's Names & levels line says the same ("plain" in the
provider's model JSON).
Reproduced in a sandbox: fake vendor on :3571, magpie A on :3572 with it
and a group, magpie B on :3573 with remote-magpie → A and `model suffix
off`: B's /v1/models said "DeepSeek Chat · Relay A", "Fast · routing
group". With the fix: "DeepSeek Chat", "Fast"; on: "DeepSeek Chat · Relay
A · Remote magpie".
Run:
- TestRemoteMagpieSuffixOff (internal/gateway, A's list bytes as served)
fails on the old code (off: "DeepSeek Chat · Relay A", "Fast · routing
group"), passes with the fix.
- name-suffix-remote.test.cjs, Chromium and WebKit, en/zh/zh-TW/ja/de at
420px: 10/10; on the old app.js it fails ("… · Relay A"). Sibling
name-suffix-*.test.cjs and names-fold: 86/86.
- go test -tags nogui ./internal/{catalog,provider,gui,agent,gateway}
under a temp HOME with pinned caches: ok. gofmt -l clean; go vet
darwin/linux/windows on the touched packages: ok. Full suite before push.
|
||
|
|
9e665491ec |
context: Tuned for you — each agent's settings worked out from the user's own calls, for the fewest tokens, put in on a click and undone on another
The Context tab now replays the period's calls of each agent against the
settings that decide what they cost, and shows, per agent and per model,
the value that would have used the fewest tokens for how this user works:
Claude Code's auto-compact window per model (modelSettings.<model>.
autoCompactWindow), its main and subagent prompt cache lifetimes
(promptCacheTtl, subagentPromptCacheTtl: 5m or 1h), and Codex's
model_auto_compact_token_limit. Each row says where the value comes from
now (the agent's default, the user's own setting, one magpie set, or a
variable that comes first and locks it), why (how fast conversations grow,
what a compaction leaves, how long the user pauses), the cost curve, and
the saving. Nothing is written until "Use …" is clicked; what was there is
stashed and Undo puts it back, unless the user changed it since. A window
the user set past the model's own is shown capped, as Claude Code caps it
(min(setting, model window)), so no saving is claimed that wouldn't happen.
Advice under a 3% saving is "already the leanest".
On the owner's 7 days (88K Claude Code calls, 956 Codex): opus keeps 200K
(their 500K is capped to it), fable 5.1 200K → 160K saves 5% (2.56M
tokens), both cache lifetimes and Codex's 272K are already the leanest.
Run: go vet ./... and go test ./... pass (internal/tune, internal/agent
TestTune*: user-set values kept, env locks, undo after a user edit, TOML
key order). context-tune.test.cjs passes in Chromium and WebKit, en/zh/
zh-TW/ja/de, at 360 and 1100px (22); context-window, context-scroll-end
pass. Full GUI suite: library-servers-bulk and market-have failed once
under load and pass alone; market-have fails on origin/main
|
||
|
|
4eb90b69f4 |
provider: after magpie switches Codex's account, Codex's accounts say the Codex app is still on the one before and to quit and reopen it (CavillZhang on X)
The Codex desktop app (ChatGPT.app 26.1007, bundled codex 0.162) reads auth.json once, as its app-server starts. codex-rs AuthManager only reloads it for the same account (reload_if_account_id_matches skips a different one; a full reload is the app's own login/logout). So after magpie's switch the running app keeps the spent account's token, its webview reads /wham/usage with it (straight to chatgpt.com, which magpie can't intercept), gets rate_limit.allowed=false, and hardBlocked stops the composer in every thread with "You're out of Codex and Work usage". Only quitting and reopening the app moves it. magpie now notes, like the managed daemon, the app's own app-server (…/CodexCLI.app/Contents/MacOS/codex … app-server, or the Windows Store app's codex.exe) running at a switch and the account it holds, until that process changes. Codex's accounts show "The Codex app is still signed in as …; quit it and open it again" with Got it; `magpie accounts` and the gateway log say the same. Run: go test ./internal/provider ./internal/gui (TestCodexAppStale goes red with the app not noted), the new GUI test in Chromium and WebKit, en zh zh-TW ja de, 900 and 480px; findCodexApp against the owner's running ChatGPT.app found its app-server; go vet darwin/linux(nogui)/windows, go build. |
||
|
|
e611fc65d6 |
codex: magpie restarts the codex app-server a change left on the old model list when no codex session is on it, and the Agents page offers Restart when one is (luci on Discord)
luci (Codex CLI 0.162, magpie 0.1.1150): after Codex was wired back to
magpie, codex in a new terminal listed Codex's own models although
config.toml was magpie's.
Cause, reproduced with real codex 0.162.0 in a sandbox CODEX_HOME:
codex sessions attach to a background app-server (the managed daemon)
that is per CODEX_HOME, not per terminal (socket under
$CODEX_HOME/app-server-control). It is detached, has no idle exit and
builds its model list once, at start. A daemon started while Codex was
off magpie keeps the official list for every later session, in this
terminal or a new one, until it restarts. magpie writes only PATH to
shell rc files and doesn't unwire Codex on quit, so nothing
per-terminal is involved. luci's "a new terminal fixed it" isn't
explained by the daemon. Codex's hourly updater restarting it is a
guess, not proven.
What changed:
- provider.KeepCodexDaemonCurrent(ctx, home, changed) compares the
daemon's start time with when magpie last changed what Codex reads at
start. The start time is the mtime of a pid file in that home that
names the running daemon's pid, so another home's daemon (ChatGPT.app,
other sandboxes) is never acted on.
- With no codex session attached, it runs
`codex app-server daemon restart` with CODEX_HOME set to that home.
- Otherwise it reports Behind and how many sessions are attached.
- isCodexClient leaves out apps' and editors' own codex, exec-server,
mcp-server and the daemon's own processes. It reads the whole ps line,
since ps leaves a path's spaces unquoted ("Codex Computer
Use.app/...").
- agent: Codex's Notice after a change runs this check first. It says
either that magpie restarted the daemon, or that the daemon is behind
and how to restart it (Agents page or the command).
- The GUI backend and `magpie serve` re-check every 15s. A session that
was open at the change is usually closed later, and that is when the
daemon can be restarted.
- Agents page: the stale "daemon" copy line has a Restart button that
POSTs /api/codex/daemon/restart (timeout now 2 min, as a running turn
is let finish). It reuses translated strings. On Windows, where
processes aren't listed on each look, the row shows the last check.
- Restarts are serialized by one mutex.
- WSL's Codex is not handled automatically. Its row keeps the advice
text, which names the restart command.
What was run:
- Real codex 0.162.0 in a sandbox CODEX_HOME, with a fake gateway, on
luci's sequence: the daemon started on the official config, then
magpie's config and catalog were written.
- With a TUI open, /model listed GPT-6.x. The check said Behind with
a session attached and did not restart.
- With the TUI quit, the check restarted the daemon. A new codex in
the same terminal listed Magpie Alpha and Beta.
- Earlier in the sandbox: a daemon restart under an idle attached 0.162
TUI reconnects, and /model then shows magpie's models. A running turn
is waited for up to 60s.
- New tests:
- TestKeepCodexDaemonCurrent(Fails), TestIsCodexClient (with the
space-in-path case from the real process list) and
TestCodexNoticeKeepsTheDaemonCurrent. They don't build or fail on
the old code. The space case failed before the ps-line fix.
- The GUI test "the daemon's line restarts it" times out on the old
app.js.
- Results:
- agent-stale-copies.test.cjs: 60/60 in Chromium and WebKit, in en,
zh, zh-TW, ja and de, at widths 980 and 440.
- go test (temp HOME) for ./internal/agent, ./internal/provider,
./internal/gui and the root package: ok.
- gofmt -l: clean.
- GOOS=linux and GOOS=windows go vet -tags nogui: ok.
- The Windows path is checked only by vet and not tried on a Windows
box.
|
||
|
|
83c963c466 |
gateway: a gateway MAGPIE_ADDR puts on the network asks callers from other machines, a container's host among them, for an enabled gateway key, as sharing does
What changed - lanGuard: a request whose peer isn't loopback (or that carries a forwarding header) is remote. While the gateway is shared, or MAGPIE_ADDR names a host other than loopback/localhost (OnNetwork: 0.0.0.0 in the Docker image, a server's address), a remote request is answered only with an enabled gateway key, on every route behind the guard; otherwise it is refused (403) as before. Before, a MAGPIE_ADDR on the network with sharing off took remote requests with any key. A remote request let in with a key is marked as shared-mode ones are, so quotas, quota cards, refresh and prices answer it. callerGuard follows the same condition. OpenToAnyone is replaced by OnNetwork. - Loopback is unchanged: any key still works on the gateway's own machine and inside the container (HEALTHCHECK included). - CLI keyNote and the console's Connect note no longer describe an open gateway; on the network they say other machines need a gateway key (`magpie gateway-key add <name>`). The console shows the Gateway keys block and network addresses when OnNetwork (gatewayJSON.onNetwork replaces open); the "Open to the network" strings are removed. - Docs: docker.html (en/zh/ja) and remote.html (en/zh/ja) say callers outside the container need a gateway key, how to make one, that sharing isn't needed for it, and what an upgrade means for agents that sent `magpie`; docs/reference.md and providers-accounts.md likewise. A MAGPIE_ADDR pinned to one interface's address now asks a key of this computer's agents calling that address too (documented). Tests - New TestNetworkGatewayGuardsEveryRoute: from 172.17.0.1 and 192.168.1.9 every registered route (model APIs, count_tokens, systemone, the Responses websocket GET, MCP, Codex backend and catalog, /v1/magpie/*, images, embeddings, rerank, videos, Gemini) gets 401 without a valid key; with one, models and quotas answer 200. - TestNetworkGatewayNeedsAKey (was TestExplicitOpenGatewayAccepts...), TestLANGuard, TestProxiedLoopbackNeedsTheKey, TestQuotasOverLAN, TestMCPProxyStaysHere, session route and remote prices tests, TestOnNetwork, serve_cli and gui public_url tests updated. With the old lanGuard restored, TestNetworkGatewayNeedsAKey, TestNetworkGatewayGuardsEveryRoute, TestLANGuard and TestProxiedLoopbackNeedsTheKey fail. Run - go test -tags nogui -count=1 ./internal/gateway ./internal/gui ./internal/provider . under a temp HOME: ok. - gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui on those packages: clean. - GUI: public-url and gateway-caller-keys tests, Chromium and WebKit: 22/22. - Locally built image (OrbStack), -p 127.0.0.1:3481:3425: from the host, /v1/models with no key, `magpie` and another made-up key -> 401; count_tokens and /mcp/x -> 401; a key from `docker exec ... magpie gateway-key add Host` -> models 200, quotas 200; inside the container wget /v1/models -> 200; healthcheck exits 0. `web --addr 0.0.0.0:3430`: /api/state 401 without the web key, 200 with its cookie. |
||
|
|
a998a36367 |
provider, gateway: remote magpie serves decision and retrieval APIs (#1282)
* provider, gateway: remote magpie serves decision and retrieval APIs Configure System One from the remote address and discover explicitly marked decision models, including Clef and custom names. Keep exposed retrieval models when importing the remote catalog, without treating decisions as chat or image generators. Refresh removes stale decisions and the editor receives an explicit empty decision list when none remain. Forward caller/session attribution for decision, retrieval and media APIs. Preserve TUI model-list errors for a remote that cannot be reached. Document the HTTP API surface and old-peer compatibility. Verified with the full nogui Go suite, focused race checks, go vet, native macOS and Linux/Windows cross-builds, and the Remote magpie browser tests in Chromium and WebKit in English and Chinese. The new System One integration test fails on the old code with an empty model list, and the retrieval test fails because the remote embedding model is filtered out. Integration tests exercise two gateways and simulated upstreams; live vendor accounts were not used. * gateway, provider: remote forwards keep official client headers Claude Code and Codex keep their User-Agent through both gateways, so a relay behind the remote that admits only official clients accepts their requests. Only decision, retrieval and media calls set magpie's User-Agent at their own call sites. The two-hop test covers Messages, Responses, Chat Completions and a Codex originator with another User-Agent. Keep entryFor limited to remote decision providers. Test rejection of unlisted remote decisions and remove the redundant resolveDecideModel early return: the explicit model marker and list-only Jev already exclude vendor aliases. Document retrieval entries remaining in the shared agent catalog and TUI list errors being shown for other mixed providers too. Verified with the Remote magpie provider/gateway tests. Before the fix, TestRemoteMagpieClientHeaders fails all four cases with the relay receiving magpie/dev and returning 403 official client required; all pass after it. Follow-up to yetone's review of #1282. * provider, gateway, gui: remote discovery reports only the decisions it lists (#1282) Show CLI list failures and catalog counts for mixed providers. Derive the remote decision endpoint from its one editable address, name custom decisions by their ids, and reuse successful discovery in endpoint tests without an empty decide OK row. Bare-provider decision selection is documented. Simplify decision classification around the explicit remote list and reuse model markers while building Available, Catalog and Deciders, avoiding a whole-list copy and scan for every model. Other providers keep their rules. The regression tests failed before the fixes on swallowed CLI errors, blank labels, extra endpoint fields, empty decide results and repeated discovery. Deliberately removing retrieval/video User-Agent or System One caller attribution makes all three receiving-side tests fail with lost agent/via. Verified with sandboxed Go tests, targeted race checks, Linux GUI/nogui and Windows vet/build, Chromium/WebKit en/zh browser tests and zh-TW/ja/de checks. The two-hop tests use real gateway handlers with simulated vendor replies; real vendor accounts and native Windows/macOS runs were not used. Co-authored-by: XYenon <register@xyenon.bid> Amp-Thread-ID: https://ampcode.com/threads/T-01a11cd6-93aa-767c-9d6e-f0db2a9c5bab * gui, gateway tests: remote decision refresh leaves only its current model choices (#1282) The empty-decision browser fixture cleared deciders but kept decision entries in models, so its screenshot still showed the same chips. Remove those entries and assert the visible choices in both states. Check the real providerInfo model list after refresh too, with Jev Router retained as chat, and verify an unnamed remote decision reaches the local picker with its id and provider label. No production code changes. Verified all Remote magpie tests in root, provider, gateway and gui under a sandbox HOME with -race; the new assertions in gateway/gui pass. Chromium and WebKit pass all six browser cases in English and Chinese; the corrected screenshot run passes 3/3. Targeted Linux and Windows nogui vet and gofmt are clean. Amp-Thread-ID: https://ampcode.com/threads/T-01a11cd6-93aa-767c-9d6e-f0db2a9c5bab Co-authored-by: XYenon <register@xyenon.bid> --------- Co-authored-by: Amp <amp@ampcode.com> |
||
|
|
7f62dbf3ed |
gateway, agents, gui: a model's reply limit is published within the window beside it, on /v1/models, Cursor's and Muse's lists, the Gateway page and magpie model output (#1438, yhong91)
#1438 (yhong91): GET /v1/models listed grok/grok-4.7 with context_window 256000 (the Grok backend's own) and max_output_tokens 500000 (models.dev's x-ai entry, which catalog.Decorate fills in when the backend gives no output). A client that reads both sizes its replies past what the window holds. The agents' files already kept output within the window (maxTokens, #338/#347), but the gateway's lists, the GUI and the CLI did not. What changed: - provider.OutputWithin(window, output) and Entry.PublishedOutput(): the output is kept within the window; an unknown window or output (0) is left as it is. - Every place that publishes the pair uses it: modelObject (/v1/models), cursorLocalModel (Cursor Private Inference), Muse Code's list, the Gateway page's models and groups (providerInfo, providersState), the agents' maxTokens, and `magpie model output` (which also says "500k, kept within its 200k window" when it lowers one). - Entry.Output stays the model's own limit. The request-path cap (outputLimit/withMaxOutput) and the user's Max output setting are unchanged, so no request is lowered further than before. This is why the clamp is not in replyLimit/entryFor as the issue suggests, and why the commenter's patch (modelObject only) was not taken as is: it was right but missed Cursor, Muse, the GUI and the CLI. - docs/subsystems/gateway-routing.md: the rule and its routes. Tests (each fails without the change): - gateway TestModelListsKeepOutputWithinTheWindow: models.dev 500000 over a backend 256000 window, plus output within the window, unknown window and unknown output, on /v1/models, Cursor's capabilities and Muse's limit; a group request with max_tokens 300000 still reaches upstream as 300000. - provider TestOutputWithin, gui TestProviderModelOutputWithinTheWindow, TestModelOutputCmdWithinTheWindow. Breaking it by hand: OutputWithin returning output unclamped turns all of them red, plus agent TestMaxTokensWithinContextWindow; gateway sites back on e.Output turn the gateway test red on all three lists; moving the clamp into Entry.Output turns the fixture and the group-request guard red. Real data: an offline dump of the owner's catalog (copies of ~/.config/magpie and its caches, 203 entries) has 3 models with output over their window, grok/grok-4.5, 4.6 and 4.7 (256000 vs 500000), now published as 256000; 0 are not Grok. The live gateway on 3425 was not running, so /v1/models itself was not read, and no real Grok request was made. Run: gofmt -l; go vet -tags nogui ./... on darwin, linux and windows; go test -tags nogui ./... -count=1: all green except TestLoopEndsWorkBuddysReply/plugin/anthropic ("let go only after 3207 lines", bound 2000) at load average ~35 with other suites running; it passes 5 of 5 alone and does not touch the output limit or request path. |
||
|
|
aa82288fb6 |
usage: Volcengine Ark's Coding Plan and Agent Plan windows, read with the account's access key (#1427, yayoinoyume)
Ark tells a Coding Plan's or Agent Plan's 5-hour, weekly and monthly
windows only to the account's control plane (GetCodingPlanUsage,
GetAFPUsage on open.volcengineapi.com), signed with the account's
AccessKey ID and Secret, never to the plan's inference key. An Ark
provider's editor now takes that access key, and the Usage page shows the
plan's windows as a card.
From yayoinoyume's feat/volcengine-usage, reviewed and reworked:
- Signing is volc-sdk-golang's (base/sign.go GetSignRequest, 06f9ef66):
signed headers sorted (content-type;host;x-content-sha256;x-date), only
Action and Version in the query. The branch signed them unsorted and put
Region in the query. TestVolcSignMatchesSDK pins two signatures the SDK
made.
- The card is in PlanQuotas beside the Step Plan's (its cache, last
reading, refresh and `magpie quota wait`), not in the subscription
cards. One per access key and plan.
- The plan is the endpoint's: /api/coding asks GetCodingPlanUsage,
/api/plan GetAFPUsage, pay-as-you-go none, in the host's region. The
branch asked both and showed whichever answered.
- Dropped guessed reply fields; the Coding Plan reply is the one
pi-ark-usage, dsh-ark-quota and ArkCodingPlanUsage read. AFP buckets are
read in the forms dsh-ark-quota and arkcli read (Used of Quota or Total,
or Percent), plus Tier; none was seen from a real account.
- An Ark provider is known by its host, not the preset id, so a copy or a
custom provider takes the key too.
- The Secret is never sent to the page (accessKey {id, secretSet}); a
blank Secret keeps it, a save without the ID keeps both, Remove
(clearAccessKey) drops both, an ID with no Secret is refused.
- The pair goes where keys go: AddCopy, Restore, Mirror, backups and
davsync carry it only with keys (withoutKeys), and a keyless restore or
sync keeps this machine's. CLI: access.key, access.secret.
- A changed access key drops the cached cards (ForgetPlanQuotas).
- UI strings in zh, zh-TW, ja and de.
Nothing was tried against the real Volcengine API: there was no access
key. A local fake checked the real request PlanQuotas makes against
volc-sdk-golang's own GetSignRequest (both actions, two regions); it
lives outside the repo, so go.mod is unchanged.
Run: gofmt -l; go vet (darwin), GOOS=linux and GOOS=windows go vet
-tags nogui on provider, gui, backup, davsync and the root; go test
-tags nogui ./internal/provider ./internal/gui ./internal/backup
./internal/davsync . under a temp HOME; node --test
volc-access-key, zhipu-team, gui-ja, gui-de, i18n-keys in Chromium and
WebKit. Fail without the change: TestVolcSignMatchesSDK (unsorted
headers), TestAddCopy, TestBackupBalanceToken, TestNoKeys,
TestTakeBalanceToken, TestSyncBalanceToken (pair not carried),
TestProviderSaveKeepsVolcengineSecret (blank Secret dropped),
volc-access-key (Remove not posted).
Co-authored-by: YAYOI27 <111715843+yayoinoyume@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
|
||
|
|
34a598372c |
providers, gateway, gui, cli: each usage window of an account can have a cap of its own beside the account's (willz on Discord)
willz asked for a cap per window: a friend's account should stop at 50%
of its five hours, while its week has its own 40%. Until now an account
had one usage cap, the same share of every window.
What the user sees: the account's pill still sets the cap for all its
windows and stays the default. Each window's meter on the account's row
is now a button: a click opens the app's own menu headed "Cap for
<window>" with the account's cap, No cap on this window, 50–90%, and
Other… typed in place. A window with its own cap says it beside its
figure ("Cap 50%", or "No cap"), its mark sits there, and the account's
pill says "Caps by window" when only windows have caps. The account is
held while any window is past its own cap, and the row's note, the
gateway's 429 and the Routing trace name that window's cap. CLI:
magpie provider account-cap <id> <account> --window "5 hours" 50
(none: no cap on that window; default: back to the account's), and
`account-cap <id>` lists the overrides.
How: Provider.AccountWindowCaps (providers.json, by account and the
window's capId, its name in lower case; 1–99, or 100 for none) beside
AccountCaps. provider.WindowCaps gives a window its share (its own, else
the account's); Allowance.CapHeld and capReached judge each window by
its own share and report the fullest holding window's cap.
provider.HoldShare becomes HoldCaps, used by gateway capHeld (plan and
group filtering, cappedError, trace) and codex_backend's route-or-relay
choice; codex_switch's NextLogin moves the agent off at per-window caps.
QuotaWindow carries capId; Limit.name is exported as Limit.Name. A
config with no window caps reads and routes exactly as before
(TestSetWindowCap reads an old one). The meter is a span with
role=button, Enter/Space: a <button> as a flex item of the wrapping
meter line kept WebKit's row at its one-line height until the next
layout, so the row grew under the pointer at the first click.
Verified:
- go test -tags nogui ./... in a sandbox HOME: all ok. New
TestWindowCapHeld and TestSetWindowCap (provider), TestWindowCapsHoldTheAccount
through the real gateway (5h 60%/cap 50 goes to the spare; 20/30 under
50/40 is used; 20/45 with the spare past its own cap is a 429 naming
"past its 40% cap"), TestAccountCapCmd --window cases.
- Break check: with WindowCaps.Of ignoring the window's own share,
TestWindowCapHeld fails ("5 hours at 60% of 50%: <nil>") and
TestWindowCapsHoldTheAccount fails (the request is answered 200 by the
capped account).
- internal/gui/tests/window-cap.test.cjs: Chromium and WebKit, 420 and
1100 wide, en, zh, zh-TW, ja, de (60 tests): held note per window,
marks, menu from the meter with no native select, keyboard, posts of
50, typed 45, 100 and 0, no page scroll on a click, no sideways scroll,
no left border stripes, every new string translated. With
windowOwnCapOf returning 0 it fails.
- account-cap, gui-zh-tw, gui-ja, gui-de, i18n-keys pass; full GUI suite
in both engines (483 files, concurrency 6): 4315 of 4323
pass; the 8 that failed (library-servers-bulk, purpose-filter,
routing-proxy, routing-zcode-blocked) touch no account row and all 32
of their tests pass when run alone
- gofmt -l clean; go vet -tags nogui ./... on darwin, linux and windows,
and windows without the tag for ., internal/gui, internal/provider,
internal/gateway; go build ./...
- Not tried in the real window with a live gateway or real accounts.
Docs: gateway-routing.md (HoldCaps, window caps, tests),
providers-accounts.md (AccountWindowCaps, tests), reference.md.
|
||
|
|
ff93c29224 |
gui, provider: Try again on a held move takes the models unticked in the editor, not only the saved ones (noting_ever on X: deep-model unticked, and WorkBuddy AI's move still failed on deep-model)
A move held back by a model the plugin doesn't serve says to untick it
under Models. The editor's model chips are a draft until Save, and the
Move / Try again button posted only {id}, then threw the draft away, so
the move checked the saved picks, which still had deep-model, and failed
on it again. This holds for every mover: they share renderMove and the
provider/move handler.
Now Try again sends the editor's picks when they differ from the saved
ones, and provider/move saves them first (provider.SetModels, through
agent.Reseat so an agent on a dropped model is moved off it), then moves.
A move that sends no models leaves the picks as they are (CLI, Plugins
page).
Run: TestMoveTakesEditorPicks (fails on the old handler: the move saw
[auto deep-model] each time) and plugin-move-unserved.test.cjs's new
"Try again takes the models unticked", en and zh, in Chromium and WebKit
(fail on the old app.js: no models posted); plugin-move*.test.cjs 20/20;
go test ./internal/provider ./internal/gui on HEAD plus this change;
go vet (darwin; linux provider; windows gui+provider); gofmt -l clean.
|
||
|
|
58ba737811 |
remote magpie: a remote magpie's model prices are this magpie's list prices for its models, so both Usage pages count a call at one cost (Sorghum on Discord: 希望本地 magpie 可以自动集成 remote magpie 手动设置的模型价格)
What changed
- The local magpie asks a remote magpie's /v1/models with a new header,
X-Magpie-Prices (provider.PricesHeader, beside the Drawers and
Videomakers headers in listHeaders).
- The remote answers each model's "magpie_price": what its own Usage page
counts the model at (provider.EntryPriceIn: the price its user set by
hand, else its provider's list price at its price rate; a routing group
only when every member costs the same). EntryPriceIn is agent/route.go's
entryPrice moved into provider unchanged, so the agents' cost and the
remote's price are one rule.
- It tells prices only to a request from its own computer or one let in
with a gateway key (local || sharedWith), and only when asked: a machine
let in without a key (MAGPIE_ADDR open, not shared) and an older magpie
or an agent that sends no header get nothing new.
- The local keeps the price with the fetched list (catalog.Model.Price; read
raw, so an odd value or a negative part drops the price and keeps the
model and the list) and uses it as that provider's list price
(ListPrice -> remotePrice). A price the local user set (provider/model,
provider/*, */model) still comes first, and the local provider's own
price rate still applies on top.
- Old remote <-> new local: no field, models priced as before.
Old local <-> new remote: no header, nothing new sent (and an unknown
field would be ignored by encoding/json anyway).
- The model editor's price tooltip and `magpie model price` say the greyed
price is what the other magpie counts the model at (remoteList; new
string in zh, zh-TW, ja, de).
- Side effect: smallModel/cheapest picks over a remote's models (image
description, web search) now see these prices, where every remote model
was unpriced before.
- docs/subsystems/providers-accounts.md: a row for it.
What was run
- New TestRemoteMagpiePrices (real gateway handler behind lanGuard as the
remote, a local remote-magpie provider fetching it): the remote's hand-set
price is the local's price; a real chat call through it costs $9 on both
the local's and the remote's usage records; the local's own price wins
and survives a refetch; an old remote's list leaves the model unpriced.
New TestRemoteMagpiePricesTold: priced for loopback asking, not without
the header, not for a keyless LAN caller with MAGPIE_ADDR open, priced
with a gateway key. New TestLiveMagpiePrice in catalog.
- Broken by hand, each red: no remotePrice in ListPrice (FAIL: priced
false); remote price over the user's (FAIL: remote's price won); the
local/sharedWith gate removed (FAIL: keyless machine priced); the header
gate removed (FAIL: told to a list that didn't ask); sane() always true
(FAIL: a/negative priced). A string-typed magpie_price first failed the
whole list ("not a model list"), hence the raw read.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: clean; go build, GOOS=linux -tags nogui and
GOOS=windows builds OK; go test -tags nogui ./... green under a temp HOME
with pinned caches.
- GUI: model-price-edit (new remote-title check), model-price-tiers,
provider-price-rate, gui-ja, gui-de, gui-zh-tw, i18n-keys: 18/18 in
Chromium and WebKit; the title check goes red with the remoteList branch
removed.
- Not tried between two real magpie binaries on two computers, nor in the
real window.
|
||
|
|
05b5965872 |
providers, gui: a partner listed since the add sheet last showed the partners puts a small dot on the "+ Add provider" button, its name in the title, until the sheet shows it (yetone: 有了新的合作伙伴的时候,这里能否有个小小的精致优雅的提醒吸引用户点击查看)
Ran: go test ./internal/provider ./internal/gui ./internal/tui .; partners.test.cjs (chromium + webkit, en/zh at 900 and 440), i18n-keys, gui-ja, gui-de; GOOS=linux -tags nogui and GOOS=windows builds. |
||
|
|
7d663a2769 |
providers, stats: count how often each partner is shown, opened, has its key page opened and is added, per day and capped, and send the days that have ended with the daily stats as "magpie partner" events; off with the stats or with what magpie is used with (yetone: 能否统计每个合作伙伴的展示数和点击数)
Ran: go test ./internal/provider ./internal/stats ./internal/gui ./internal/tui .; partners.test.cjs (chromium + webkit), privacy-usage-stats, i18n-keys, gui-ja, gui-de; GOOS=linux -tags nogui and GOOS=windows builds. |
||
|
|
844b9ca3ac |
provider, gateway, gui: a custom provider's Base URL can be a Gemini API (generateContent): …/v1beta, its models listed from it, the key sent in x-goog-api-key (#1346, NagaseMinato)
The custom provider editor's Base URL has a fifth API, "Gemini compatible"
(Gemini 兼容 / Gemini 互換 / Gemini-kompatibel), beside OpenAI, Anthropic and
Responses; More endpoints has a Gemini URL; the CLI takes gemini=. A
Gemini URL is kept as its base (…/v1beta, a relay's path prefix kept, a
pasted models/…:generateContent cut off). Every client's request, Chat,
Messages, Responses or Gemini, streamed or not, goes upstream to
models/{model}:streamGenerateContent?alt=sse under it, with no model in
the body and the key in x-goog-api-key; models are listed from its
/models, a page at a time, keeping those that serve generateContent.
Detect doesn't ask a Gemini API and is hidden while it is picked.
Factory's Gemini route and Bearer token are unchanged.
With five APIs the pick no longer fits a 900px editor in English and
German, so it wraps to a second row, and its thumb now follows the
picked option onto that row.
Verified against fake httptest upstreams only; no real Gemini key or
relay was tried:
- TestCustomGeminiUpstream (gateway): chat, chat stream, messages, a
Gemini client's stream and non-stream, behind /proxy/v1beta. Fails with
"chat: 404" without the gateway.go change.
- TestCustomGeminiProvider, TestGeminiBase, TestFactoryGeminiUnchanged
(provider).
- go vet, HOME=$(mktemp -d) go test -tags nogui ./... (44 packages ok),
GOOS=linux and GOOS=windows go vet on the touched packages.
- provider-gemini.test.cjs (new, en/zh/ja/de, Chromium + WebKit, 8 pass;
fails with "900px: the thumb is 22px off" without the slide() fix),
and in both engines: provider-base-api, provider-detect,
provider-detect-models, provider-add-models, provider-output-picks,
provider-search, provider-url-each-api, seg-contrast, settings-groups,
menu-scroll, click-scroll, ledger-hscroll, strip-scrollbar,
view-scrollbar, usage-ledger-chart, system-one, gui-ja, gui-de,
gui-zh-tw: all pass.
|
||
|
|
10578ce683 |
providers: the add sheet lists Partners first, above Subscriptions, under a heading that says they sponsor magpie; who they are comes from usemagpie.ai/api/partners (site/partners.js), so a paid listing changes with a deploy, not a release (yetone)
The app fetches the list behind the call every 6 hours (10 minutes after a failure), never waiting, and keeps it in the cache folder. Each entry is checked: its own id, never a built-in preset's; a name and an endpoint; https only; at most 12; no decision API, no-key or user endpoint. Its logo goes through FetchIcon. A partner is a preset to the rest of magpie, and one that has left still is to the providers added from it, unsponsored. The window lists a partner in the languages it names only, with its tagline in the page's language; `magpie presets` and the TUI list them first too. MAGPIE_PARTNERS moves the list, off lists none. Run: go test -tags nogui -race ./internal/provider ./internal/gui ./internal/tui . (ok); TestPartners* -race -count=3; node --test internal/gui/tests/partners.test.cjs add-sheet gui-ja gui-de i18n-keys in Chromium and WebKit (en/zh/ja/de, 900 and 440px); node --test site/worker.test.mjs site/install.test.mjs; the built binary in a sandbox HOME against a local feed: listed, an http entry left out, listed from the cache with the site down, `provider add` from it. |
||
|
|
0470411122 |
providers: a provider has a Requests per minute limit beside Concurrency: each key or account sends the vendor at most that many requests in any rolling minute, one more waits for room (coeo91 on Discord: OpenRouter's free models take 20 a minute, which Concurrency 1 can't keep to)
Set in the provider editor (under Concurrency; empty or 0 is no limit) or with `magpie provider rpm <id> [n|off]`; kept per provider as MaxRPM, a subscription's with its picks. Over the limit the gateway waits until the oldest request of the minute is a minute old, in the order they came, after the lane's slot and right before sending. A wait longer than 2 minutes (or the provider's Queue wait, when shorter) is turned away at once with a 429 and a Retry-After of when the minute has room; nothing rests for it. An agent gone while waiting gives its place back and is never sent. Every request that reaches the vendor counts: each try of the forward loop (retries, the next key, fallbacks) waits in serve, and requests a try makes on the way plus the gateway's own (count_tokens, System One decisions, embeddings, drawing/video, Kimi search) are counted by an rpmTransport on s.client. count_tokens never waits: a key with no room is skipped and the local estimate answers. A key or account with no room in its minute gives way to a ready one of the provider or the group, as a full lane does (laneMate). No wait happens under rpms.mu. Not counted: a plugin account's own extra requests (its own transport; its tries are). Verified (Go tests on Linux in Docker, golang:1.26.8, since new binaries hang at launch on this Mac while syspolicyd is pegged): - internal/gateway rpm_test.go through the real server stack (lanGuard(s.Handler())): limit 2, third request reaches the vendor a window after the first, all 200; past the bound a 429 with Retry-After and no rest; a cancelled waiter is never sent and gives its place back; a 503 retry and a count_tokens count, and a count with no room is estimated; a group member with no room gives way. With RPMLimit forced to 0, those five gateway tests fail. -race -count=5 passes. - internal/provider TestSetRPM (clamp, subscription picks reach each account), TestRPMCmd, internal/gui TestRPMSave. - go test -tags nogui ./... on Linux: all pass except internal/agent's TestAside* write-refusal tests, which fail only as root in Docker and pass as uid 1000. - go vet -tags nogui for linux, windows and darwin; gofmt -l clean. - GUI: new provider-rpm.test.cjs (en/zh/ja/de, 360 and 440px, Chromium and WebKit; 32 pass, and all 16 Chromium cases fail on the old app.js), plus gui-ja, gui-de, gui-zh-tw, i18n-keys, provider-concurrency, lane-limit, provider-price-rate and clinepass-pin in both engines. Not tried against the real OpenRouter. |
||
|
|
586f2bce8f |
context: magpie inspects the context window of every request, session and agent
The gateway reads each request's prompt into its parts (system prompt, tools and MCP servers, memory, files, tool results, chat), measured against the model's window and calibrated to the tokens the vendor counted. Routing shows a request's window as a card: a 400-cell grid by part, a hover naming what is largest in a cell, and the contents by part. The Usage page's Context tab scores each agent out of 100 (cache reuse, how lean it starts, how fast it grows, how reliably it answers), tags it (lean, cache-friendly, mcp-heavy, compacts, near-full…), and draws each session's growth with its latest request's card. Older Safari (15) gets media-query and solid-colour fallbacks for the card's container queries and color-mix. |
||
|
|
40ece3a0d1 |
gui: a provider's Save keeps the tag, website and key page set from the CLI or TUI, and on a preset's provider its Balance and Models URLs, which the editor doesn't show
Found while tracing 01huadalang's report (Discord, a Responses pick reopening as OpenAI compatible): POST /api/provider/save replaces the whole provider with what the editor sent, and the editor never sends family, website or keysUrl (nor balance, balancePath and modelsUrl for a preset's provider, whose editor has no field for them). So `magpie provider set x family=…` or the TUI's "f" was undone by the next Save in the GUI. A field the request leaves empty now keeps its saved value. Verified: TestProviderSaveKeepsWhatTheEditorDoesntShow (preset and custom cases) fails without the providers.go change and passes with it. In a sandbox HOME with the built binary: `provider set relay-a family=relays website=… keys=…`, then renamed and saved Relay A in the real GUI; providers.json kept all three and baseAPI "responses". |
||
|
|
54b4e36dcf |
providers, gui: a custom provider saved as OpenAI Responses opens as OpenAI Responses, not OpenAI compatible (01huadalang on Discord: 我选 response 保存了然后再打开一会就变成 openai 兼容了)
The editor never saved which API the Base URL was picked as; reopening showed the first API with a URL, chat first. A provider added as OpenAI compatible keeps its chat URL when Responses is picked (#105), so after Responses was picked, its URL typed and saved, it opened as OpenAI compatible again. Picked with no URL of its own, the Save sent nothing for it and the pick was gone without a word. Now the pick is saved with the provider (baseAPI), sent back to the editor and shown while it has a URL; a save that doesn't say keeps it, and one whose URL is cleared elsewhere drops it. A Save with the picked API's URL empty while another has one says so in the form. Requests are unchanged: they go by which URLs are set. Verified: reproduced on origin/main in a sandbox HOME with the built binary (magpie web, real GUI via Playwright, fake Responses-only upstream): a provider added as OpenAI compatible, then saved as Responses with and without its URL typed, reopened as OpenAI compatible. With the change it reopens as OpenAI Responses after a reload, a 65s wait and an app restart, and the empty Save shows the message. A provider added as Responses from the start was already kept and still is. TestProviderBaseAPIKept fails without the change ("added as OpenAI compatible, shown as \"\""); provider-base-api.test.cjs fails on the old app.js (actual 'OpenAI compatible', expected 'OpenAI Responses') and passes in Chromium and WebKit, en and zh. gui-ja, gui-de, i18n-keys and the provider*/system-one/azure/add-sheet/menu-scroll GUI tests pass in both engines. go vet, GOOS=linux/windows builds, go test -tags nogui ./... pass under a temp HOME. |
||
|
|
9db5753ba3 |
providers: a provider's model list reads the settings once, not three times per model (lml on Discord, Windows: 每次至少都得等五六秒…供应商或者额度列表还在加载) — each model's row asked for its image answer twice (ApplyImage, ImageOverride) and its reply limit once (ReplyLimit), and each ask parsed settings.json again, even inside a GET's hold, since filememo keeps its bytes, not the parse. providerInfo now reads the settings once and uses provider.ImageOverrideIn and Provider.ReplyLimitIn. This removes redundant work found while measuring lml's report; it does not explain the whole 5-6s, which needs their setup (see below).
Measured with a copy of the owner's config (23 providers, ~1500 models) under a sandbox HOME and the real server (magpie web, dead proxy): GET /api/providers on the Windows box 497-558ms → 148-214ms, on the Mac 442-525ms → 174-191ms; the JSON answer is byte-for-byte the same apart from the gateway port. Everything else the window waits on at open answered locally in under 0.6s on Windows, so the rest of a 5-6s wait is network (the usage cards wait for every vendor on a cold start, and on Usage's own open), not this. TestProviderListReadsSettingsOnce (300 models, a big settings file, held as a GET is) takes 5.3s without the change and 41ms with it, and checks an image answer and a reply limit the user set are still said. go vet, GOOS=windows go build, GOOS=linux go build -tags nogui and go test -tags nogui ./... under a temp HOME pass. |
||
|
|
698da36f31 |
gateway, providers, gui: a model on this computer or the local network can be set to get requests unmasked by Settings' redaction (lc on Discord: 本地模型可以不脱敏)
The provider editor has a Redaction row, "Send requests unmasked", while
every address of the provider is on this computer or the local network
(localhost, *.local, a loopback or private IP): Ollama, LM Studio, a vLLM
box. Ticked (provider.Unredacted; CLI `magpie provider set <id>
unmasked=yes`), a request whose provider and fallbacks, or whose routing
group's models, all skip redaction (provider.SkipsRedaction) goes to them
as the agent wrote it; anything that may reach another provider stays
masked for all of them. An address edited to a vendor's masks it again; a
signed-in account, a plugin's provider and another magpie never skip. The
log and recent calls keep the masked body. count_tokens and embeddings
follow the same rule.
It is a per-provider choice, not automatic for local addresses, because
a local address isn't a local model: a relay run locally (new-api,
CLIProxyAPI) or Ollama's cloud models pass the request on to a vendor.
Verified: TestLocalUnredactedProviderGetsTheRequestWhole (set, unset,
fallback to a vendor, fallback to another local one, a group of it alone,
a group with a vendor; chat and count_tokens) and TestLocalUnredactedEmbeddings
fail without the gateway change ("sent whole false, want true: … my key is
{{API_KEY_…}}"; count_tokens alone: "counted whole false"); TestSkipsRedaction;
TestProviderSaveKeepsUnredacted fails without the preset save line.
provider-unmasked.test.cjs (Chromium+WebKit, en/zh, 900 and 440 wide) 32/32,
3 of 4 fail on the old app.js; gui-ja, gui-de, i18n-keys, provider-search
and the other provider editor suites pass. go test -race on gateway,
provider, redact, gui; -race -count=10 on the new tests; go vet,
GOOS=linux/windows builds. Real: a sandbox gateway in front of the local
Ollama (llama3 8B) through a logging proxy: unset, Ollama was sent
{{API_KEY_…}}; with unmasked=yes it was sent the key as written, and
answered both times.
|
||
|
|
2a990175e5 | upstream: the vendors' own status pages say when their API is down (#971, emo172: an Anthropic or OpenAI outage looked like a sign-in or quota problem) — a provider that calls Anthropic's, OpenAI's or Moonshot's API (by its base URL's host: api.anthropic.com, which the Claude subscription calls too; api.openai.com and chatgpt.com, Codex's; api.moonshot.cn/.ai) carries "API outage" (red), "API degraded" or "API maintenance" beside its name on its Providers row and its Usage card while the vendor's page says so; its title names the parts and the open incidents, and a click opens the incident (or the page), not the row. internal/upstream reads each page's Statuspage-style summary.json (status.claude.com; status.openai.com, incident.io's; status.moonshot.cn), checked by hand on 2026-10-06, and only the API's own parts (Claude API and Claude Code, not claude.ai; Chat Completions, Responses, Codex, Codex CLI, not "Codex in ChatGPT Desktop", which was degraded that day); an incident naming no parts (OpenAI's) counts only while those parts are affected. Pages are read only when the Providers or Usage page asks (GET /api/upstream), at most once in five minutes, never on a request's way; a page that fails, isn't JSON or no longer lists the API's parts is unknown and marks nothing. A relay serving the same models is never marked. DeepSeek's page (Flashduty) has nothing readable and is only known for its link; OpenRouter, xAI, Mistral and z.ai have no page read. The gateway's failure messages, TUI, CLI and tray aren't changed. zh/ja/de added. upstream_test (fake pages from the real summaries: API down, claude.ai down isn't the API, Claude Code degraded, OpenAI's app isn't the API, 503/HTML/changed page unknown, read once in Fresh and Of never waits, hosts; -race -count=5) and gui's TestUpstreamRoute pass; upstream-status (Anthropic down: its provider and the Claude subscription marked, relay/OpenAI/unread Moonshot not, click opens the incident not the row, all well marks nothing; 900 and 440px, the badge whole, the name giving way) passes in Chromium and WebKit, en and zh, and fails 8/8 without the app.js change. i18n-keys, gui-ja, gui-de, click-scroll, account-return, account-models, usage-keys-fold, deprecated-subscriptions and add-sheet pass; go vet, go test ./internal/gui/, linux/windows/nogui builds pass. | ||
|
|
7a926dd3ce |
provider, gateway, gui: a ChatGPT plan can be signed in with OpenAI's Sign in with ChatGPT, as the ChatGPT API subscription, and asked on api.openai.com's Responses with the agent's own instructions (#933, knothhe)
OpenAI's Sign in with ChatGPT lets an open-source app on the user's machine use their ChatGPT plan through the public API: it registers itself on the way (client_id dynamic_agent_client, an ext_agent_host_id kept for this machine, agent_name_hint magpie), the callback brings the client id OpenAI issued, and the token (scope chatgpt.tokens.use.direct, resource https://api.openai.com/v1) is sent as a Bearer to api.openai.com/v1/responses. The new subscription, chatgpt-api ("ChatGPT API" in the add sheet, beside Codex's ChatGPT), signs in so in magpie (PKCE, a loopback callback on 1455 or any free port, the ID token's issuer, audience, nonce and expiry checked), keeps its accounts as the other in-magpie sign-ins do, refreshes under the issued client id (rotated refresh token, serialised; a refresh token OpenAI won't take again marks the account to sign in again), revokes it on sign-out, and lists the models /v1/models gives the token. Requests go with the agent's own instructions — no Codex prompt, no Codex headers; the Codex path is unchanged — stored nowhere and streamed, without the fields the API refuses for a ChatGPT token (max_output_tokens, temperature, prompt_cache_retention, …) and without hosted tools; a system message is a developer one. OpenAI's subscription_sharing_* refusals are said with what to do (the plan's usage at chatgpt.com/settings/usage, an ineligible account, a capability the token can't use). There is no usage meter: the token has no usage API. Tested against fake OpenAI auth and API servers (TestChatGPTAPISignIn, …Refused, …Refresh, …Body, …Explain; gateway TestChatGPTAPIRequests over chat completions, messages and responses) and the add sheet in Playwright on Chromium and WebKit (chatgpt-api-sub.test.cjs); the gateway and GUI tests fail without the change. Not yet signed in with a real ChatGPT account: the consent page needs the account's owner. go vet, go build (GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. |
||
|
|
852b61f9c4 |
provider, gui: a provider with hundreds of keys folds its Accounts list behind All N keys, with a filter and removing many at once, and several keys pasted into the API key field are saved as its accounts (361 on Discord)
361 imported hundreds of keys into one provider, and its Accounts list drew a row for each (sk-o…d3a2, Make first, Remove), filling the screen. A list of more than 8 keys now shows the first five and "All {n} keys" ("{n} in use · {m} failing"). Opened, it shows a filter over the name, the masked key and the state ("off", "resting", the reason: rate limited, sign-in required…), at most 50 rows with "{n} more — type to narrow them down", and Show fewer; Escape clears the filter, then closes. Above the rows, keys can be removed at once: those turned off, those failing for good (the gateway rests them for a refused sign-in or no credit), or, with something typed, those the filter matches. The first click asks ("Remove {n} keys? Click again"); the second posts keys/remove-many (provider.RemoveKeys: one save; the first key's place goes to the next key that is on and stays; removing every key in use is refused). Dragging or Alt+↑/↓ on a shown row sends every key's place, the folded ones where they were: provider/arrange needs the full order. Several keys pasted into a provider's API key field (one a line, or comma/space separated, de-duplicated, empties dropped) are kept comma separated and counted ("3 keys"). On save the first is the key and the others are added to its accounts (AddKeys; keys it has already are passed over), and a probe asks with the first. Paste several in Add another key (
|
||
|
|
39af4adda5 | gateway, gui, cli: each account or key can have its own limit on requests at once, with a bounded queue that turns requests away with a 429 (#892, margbug01) — a provider's Concurrency applied to every key and account alike, the queue past it had no bound and no wait, and nothing showed what ran or waited. A key or account now may have its own limit over the provider's (Provider.AccountConcurrency, by lowercased account or KeyID; 0 none; unset takes the provider's, as before), counted in one lane across every model, routing group and agent. A provider's Queue size bounds how many wait for each of its lanes (one more is turned away at once) and Queue wait how many seconds one waits (then it leaves the queue); both 0 by default, as before. A request turned away goes on to the next key, account or group member without resting anything, else gets a 429 in its API's own shape (Anthropic rate_limit_error, OpenAI's, Gemini's) with Retry-After: 1, saying the limit and the queue. A slot is given back when the reply is read to the end, fails or the agent goes away; a waiter that goes away leaves the queue, and one granted as it gave up hands the slot on. In a routing group, or among a provider's keys and accounts, a full one gives way once to another with a free slot now, so a group spreads before anyone waits; a fallback provider is never asked for want of a slot, and with all full the request waits for the one routing chose. The Claude subscription path and plugin providers take their slot the same way, around the attempt; a parked Claude Code tool turn has already answered and holds none. GUI: each account and key row has a pill — "1/1 running · 2 queued" while requests are out (GET /api/lanes, read every two seconds and written into the pill in place), else its limit; none set shows on hover only — opening the app's menu (provider's, no limit, 1/2/3/5/10, Other… typed in place), posting provider/accountconcurrency; the editor has Queue size and Queue wait under Concurrency. CLI: magpie provider account-concurrency <id> [account|key [n|off|default]] and magpie provider queue <id> [size [seconds]]. en/zh/ja/de. TestAccountLimitSharedAcrossGroups, TestQueueFullAndWaitedOut, TestLaneReleasedOnFailure and TestFullMemberGivesWay (pass with -race, with TestMaxConcurrency and TestLanesLimitLifted), TestLaneLimitRoutes and TestAccountConcurrencyCmd are new and fail without the change; lane-limit.test.cjs (WebKit, en and zh: a key's busy/queued pill updated in place from /api/lanes, set from the menu, provider's posts null, Other… typed, an account's own limit, none on hover only, queue fields saved and refused out of range, labels on one line, every string in zh/ja/de, no select, no scroll, no left border) fails without the change. key-weight-fit, account-cap, provider-concurrency, click-scroll, account-models and api-key-usage pass in WebKit; the other WebKit failures fail the same on main. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. | ||
|
|
4788cf2bbd | plugin, gui: a plugin's account whose model list failed says why, rather than listing Auto alone (gnayiab on X) — with magpie in WSL, Cursor's plugin account offered only Auto: the plugin's models hook couldn't get the account's list and magpie, with no list kept from before, showed the plugin's defaults with nothing saying so, its editor even calling them "vendor list", and Refresh answered "1 models". The host now keeps why a models hook fell back (what it threw, else how its last fetch failed) for the provider and each account; plugin.Cached carries it with the accounts it reads again from the sign-ins; provider.ListError gives it for a plugin's account. The editor says "<provider> couldn't list its models: <why>" under the models (amber, no left border) and no longer calls the defaults the vendor's list, and Refresh fails with it. A list kept from before, or one that comes in, says nothing. en/zh/ja/de. Tried with the real Cursor plugin (0.1.9) in a sandbox: a key Cursor refuses shows "Cursor couldn't list its models: Cursor didn't take this API key" and Refresh says it; the owner's real account lists 72 models with nothing said, and Claude Code -p through the gateway ran a Bash tool on cursor/auto, composer-2.5 and claude-opus-5-thinking. The plugin itself, in WSL (magpie-desktop), listed 254 models and streamed chats with tools. TestFallenBackListSaysWhy (hook returns its defaults, throws, or hands back its own) fails without the change; plugin-list-error.test.cjs (Chromium and WebKit, en and zh) too; TestFallenBackListKeepsTheLastOne, account-models, plugin-signin and click-scroll pass. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. | ||
|
|
1aaac93b52 |
provider, gui: Compact at — where Codex and Claude Code compact a long conversation, set per provider or per model in its editor and to any size in Settings → Long conversations (#876, hisiling)
Until now the only choice was 272K for every model or Full window for every model. The 272K default stays as it is (
|
||
|
|
6fc0afe817 |
gui, provider: a model's price is set in the provider editor's Names & levels, beside its name, with its list price shown (ITea312, #819)
ITea312 couldn't find a way to price one model in the window. Only the provider's Price rate was there; a model's own price could be set only by `magpie model price` on the command line.
Each row of Names & levels now has Price, $ / 1M tokens, with four boxes:
- input, output, cache read and cache write;
- each shows the model's list price in grey (its vendor's on models.dev, else its maker's, before the price rate), so the official table is right there.
How a price is given:
- A part typed and the others left empty takes the list's for them.
- A model with no list price needs its input and output given.
- Every box emptied, or Restore default, gives it its list price again.
It is staged and made with the provider's Save, as names and levels are. Behind it:
- ModelPref gains Price and OwnPrice, set by SetModelPrice: the same check and store as the CLI, and the agents aren't told.
- modelJSON carries the price set and the list price.
- A price set here is counted as given, not multiplied by the price rate. The tooltip says so.
- zh, ja, de strings.
Two other changes:
- Names & levels drawn again keeps the place it was scrolled to: the taller rows had the list scroll, and Ask on one API jumped it back to the top.
- models.go: the Named field of
|
||
|
|
dad4b98729 | gateway, gui: the Cline plugin's provider has ClinePass's Upstream tick too (ARNO on Discord: 这个功能可以也加到cline的插件里面吗) — "DeepSeek models only from DeepSeek's own API" was the built-in ClinePass's alone: the Cline plugin's provider (@magpie-community/opencode-cline-auth) is an account, whose editor had no such tick, whose save didn't keep pinUpstream and whose requests clinePin didn't touch. Now ClinePinnable is ClinePass, a cline.bot provider or the Cline plugin's; its editor shows the Upstream tick (one upstreamField for both editors), its save posts pinUpstream, the account keeps it (Save, allProviders), and a DeepSeek model's request reaches the plugin with "providerOptions":{"gateway":{"only":["deepseek"]}} on Chat and Anthropic Messages, as ClinePass's does. The plugin 0.1.3 has the same as an option of its own for OpenCode. TestClinePluginPinsDeepSeek (the fake plugin as cline, with a deepseek-v4-pro): unticked nothing is pinned; ticked and saved, the tick is kept and both DeepSeek requests are pinned, fake-1's not; it fails on the old code (not pinnable; the tick not kept). clinepass-pin.test.cjs: the plugin's editor shows the tick as saved and Save posts it off when unticked (WebKit, en and zh); it fails on the old app.js. model-first-pick, plugin-moved-signin, click-scroll, gui-ja and gui-de pass on WebKit. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. |