65cb76ca2e2b59892ecb41fd3fcf6dbe07dde1c3
357
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
727e236378 |
gateway: a management API for providers, accounts and gateway keys, for a key set to manage (ljayic on X)
ljayic asked for a complete, stable management API so nothing needs a hand-edited file. /v1/magpie/admin/ now serves the app's own /api handlers (providers and their keys and accounts, OAuth sign-in start/poll/cancel, gateway keys, account groups) to a gateway key set with `magpie gateway-key admin <id> local|any`. Routes and actions not in gui/admin.go's adminRoutes are 404, so a provider's saved key, a gateway key's secret, sign-in export and actions on this computer's apps are not served; "admin-key" is not served either, so the API can't raise its own caller. Sign-in returns the vendor's page and code, opens nothing, takes no password. Guard (gateway/admin.go), in order: any Origin or Sec-Fetch-Site/-Mode is 403 with or without a key (Origin null, foreign, listed, *.localhost, an app scheme); no key 401; a key without Key.Admin 403; from loopback the Host must be ownHost (a rebound page's GET has no Origin); from the network the key must be "any"; a proxied request counts as remote. Key.Admin is dropped (adminOf) for a read-only, Browser, issued, expiring or default key, and setting read-only clears it. The route is in readOnlyRefused and keySlotFree. Docs: docs/reference.md "Management API", gateway-routing.md, and the remote page in en, zh and ja. Routing Groups, sign-in export and a GUI switch for the level are left to #6307. Run (mica, the worktree before the rebase onto 9 newer commits): go vet of access, cli, gateway, gui (darwin), GOOS=windows vet of the same four, GOOS=linux -tags nogui vet of access, cli, gateway; gofmt -l empty; go test -count=1 -timeout 45m ./internal/access ./internal/cli ./internal/gateway ./internal/gui: all ok but TestKeySlotEveryRoute, which named the new route and is fixed here, then it and the read-only, admin and guard tests pass again. After the rebase the same tests ran again. Broken by hand, each red in TestAdminAPIGuards: browser check off (a browser case served), Admin check off (a key without it served), Host check off (a rebound name served), the "any" requirement off (a local-only key from the network served, and a proxied request). Tests: TestAdminAPIGuards (no key, unknown key, non-admin, read-only, local/any, x-api-key, 8 browser headers x 3 callers, rebound Host, proxy, no handler), TestAdminKey (access: levels, read-only, Browser, issued), TestGatewayKeyCLIAdmin, TestAdminAPIGatewayKeys / Providers (a canary key is never told) / SignIn, TestAdminRoutesEveryAPIRoute. Not tried: a real sign-in against a vendor through the API, a request from a second computer on the LAN, the GUI suite (no page or app.js changed), a Linux/Windows run of the new tests. |
||
|
|
04e38e6045 |
gateway: a reorder moves only its own provider's conversations, and tests forget it (#6249, #6262)
|
||
|
|
b70563ec6b |
gateway: a reorder of the pool counts at a conversation's next turn (Richyisaflower on X)
Auto affinity kept a conversation on the account that answered it by its cache, so an account moved down (or another made First) still took the next turn. SetAccountOrder, the login switch and the CLI switch now call provider.NoteReordered; affine drops a stick last answered before it, in Auto and not within a turn (Session and Strict keep it). Run on mote: TestReorderedAccountsTakeTheConversationAtItsNextTurn red with the check off (k1 k1 k1), green with it; go test internal/provider, internal/cli ok; internal/gateway -run Affinity|Ordered|Stick|Reorder|Strict|Conversation|Fallback ok; go vet darwin, windows, linux nogui ok; gofmt clean. Not tried: a real Codex account; GUI tests (no GUI file touched beyond the switch handler); the full suite (started after the tag). The image-quota half of the report is not fixed: no real refusal body was available. |
||
|
|
698ed4adb5 |
gateway: a busy port names the program holding it, and Tailscale's serve gets its fix (pluoki on X)
The Gateway page, `magpie serve` and the app log said only "port N is held by another program". pluoki's was `tailscale serve` on the same port number. proc.PortHolder reads the holder (lsof on the Mac, /proc on Linux, Get-NetTCPConnection on Windows). Tailscale's daemon is root's and often unreadable, so `tailscale serve status --json` is the fallback for the port. gateway.NoteHeld / PortHeld.Sentence say who holds it, and for Tailscale give `tailscale serve --https=<other> http://127.0.0.1:<port>`. Shown in the `magpie serve` standby line and bind error, the app log, `gatewayHeld` in /api/state (Gateway page) and Start's "taken" answer, in en, zh, zh-TW, ja, de. A holder that can't be read says nothing; the old wording stands. Nothing is killed or touched. Run: gofmt clean; go vet darwin, linux nogui, windows (mica); go test ./internal/proc ok; targeted holder/gateway tests on macOS (mica), Windows (win-run) and Linux (wsl-run); parser tests with real lsof output; GUI gateway-port-holder, gateway-takeover, gateway-older, gateway-skew, gateway-port, i18n-keys, i18n-en-no-cjk in chromium and webkit. Real run on WSL: a holder named tailscaled on the LAN address with magpie on 0.0.0.0 gives the Tailscale sentence at the bind error; a Python holder on loopback gives "held by python3.12 (pid N)". Broken by hand: each fix reverted in turn, its test went red. gateway-card.test.cjs is red on origin/main too (#6029). internal/gateway, gui and cli package runs were still going at push; the full suite follows the tag. Not tried: a real `tailscale serve` (changes live config), a real Windows holder end to end, the bind-error path on macOS (a wildcard bind coexists with a specific one there). |
||
|
|
5a36e46d67 |
cli: name POST /api/library/mcp-account as not yet a command
|
||
|
|
a5e805f574 |
Codex: Ultrafast beside Fast in a group member, and a Fast/Ultrafast setting per model (kdajenks on X)
kdajenks (magpie 0.1.3739, Codex on ChatGPT Pro) could set Fast only from a
routing group's member row and had no Ultrafast there, and no way to set the
speed in the model's own settings. Ultrafast exists: Codex's catalog lists
the `ultrafast` service tier, the code already sent it for agent picks and
Codex's service-tier row, and the live account's service_tiers hold it.
- Group member: the button steps Standard speed, Fast, Ultrafast (where an
account offers it, `ultraOK`), back to Standard. `Group.Ultra` is a subset of
`Fast`, kept through rename, fold, share, gone-filter and the CLI
(`magpie group ... ultra=`). The gateway marks the candidate `ultra`.
- Per model: `settings.ModelTiers` ("<provider>/<model>" to priority or
ultrafast), `provider.SetModelTier` (refused where CanFast/CanUltra say no),
`ModelPref.Tier` in Model settings (Standard speed / Fast / Ultrafast, in
modellimits.js), and `magpie model tier <provider/model> [fast|ultrafast|usual]`.
The gateway sends it on a direct pick for an agent with no fast pick of its
own, through fastPick, so an account without Ultrafast gets priority. A group
member goes as the group says.
- Docs: gateway-routing, providers-accounts, reference.
Run (mica, at the rebased head over
|
||
|
|
319753d892 |
gateway: a key can follow, force on or force off masking (y0ngb1n on X)
A gateway key now carries Redact: "" follows the global setting, "on" masks that key's requests even when masking is off, "off" sends them as written. Trusted devices turn it off, external ones are forced on. - access: Key.Redact, CleanRedact and the redact-key action; an issued key inherits "on" from its issuer and can't turn it off; the default key takes the same values. - gateway: maskingFor(ctx) decides per request; every route that masked (chat, native, text hits, the Masked-As header) asks it. A local request with no key keeps the global setting. masking.WithForced carries "on" into the masker; the redact plugin's InUse counts keys set on. - CLI: magpie gateway keys redact <key> follow|on|off. - GUI: key-row badge and an app menu; 7 strings in zh, zh-TW, ja, de. - docs/subsystems/gateway-routing.md: the Redact paragraph. Note: "on" with global masking off masks secrets and personal data by the defaults. An off key is still masked on a Remote magpie hop, which sends no Masked-As header. Run (mote-run): go test for access, masking, redact, cli, gui and plugins/redact packages and the new gateway key_redact tests; gofmt -l and go vet on darwin, windows and linux nogui, all clean; the new GUI test. Broken by hand: maskingFor returning the global value goes red in key_redact_test.go. Not tried: a real remote-to-remote hop with two keys; the full suite runs after the tag. |
||
|
|
1c95c87c25 |
cli: POST /api/plugin-pages/arrange is named as the window's own (#6162)
|
||
|
|
ab5824aeea |
gateway keys: a limit in total never resets by the period, only by Reset usage (Cyrus_4433 on X)
The Limit window menu gains "in total" (period "total", CLI: gateway-key limit <id> total). It counts from when it is set or last reset and ends a century off (access.Limit.Window), so only Reset usage starts it again; its 429 says it stays refused until reset or raised, the row reads "$0.00 / $300 · 总额" with no reset time, and a remote key's window is "Tokens/Spend in total" with no reset. Old settings files read the same (new period only). i18n in zh, zh-TW, ja, de; reference.md and gateway-routing.md say it.
Run: TestLimitTotal and TestTotalLimitNeverResetsByThePeriod, red on the old code (Valid refuses "total"); gateway-key-total.test.cjs red without the keys.js change (5 of 5). Not tried: a real key through a live gateway; full suite follows after the tag.
Run (before this push):
- gofmt -l clean; go vet darwin, linux (nogui), windows clean.
- go test: internal/access, internal/budget, internal/cli, internal/provider ok.
- Go tests for the total period are red on the old code (Valid refuses "total"); the GUI test is 0 of 5 languages passing without the keys.js change.
- gateway-key-total.test.cjs and i18n-keys: 9 pass in chromium and in webkit (zh, zh-TW, ja, de, en; 500px width; no native select).
- Full GUI suite on mica, chromium: 46 reds in files this change does not touch (accounts, Pi/OpenCode Go, panel sheet, check-in, Aside provider, API key theme, allowed addresses); none is a key-limit test. Webkit pass still running; reds are to be compared with origin/main and filed after.
- TestCoreScriptBudget is red on origin/main
|
||
|
|
e3e774be7a |
agents: Claude Code's Co-Authored-By commit signature on or off from its settings (9_bishi on X)
Claude Code's row in Agents > Settings gets a "Commit signature" On/Off menu. Off writes Claude Code's own key attribution.commit = "" in settings.json; On takes out only what hid it (attribution.commit "" , attribution false, includeCoAuthoredBy false), so the default comes back. A custom attribution text is the user's own: the row shows "Your own text", is disabled, and is never written over. attribution.pr is untouched. Route POST /api/settings/claude-attribution, S2 in the settings parity test. Run at the rebased head (on |
||
|
|
967fefcec6 |
gateway: a key can be set to a service tier (JackyFill on X)
A gateway key now carries ServiceTier: follow the request (unset), standard, Fast (priority) or Ultrafast. keyTiered sets the Responses and Chat request's service_tier to it, over the client's ask and Codex's own setting; standard takes the tier off and Ultrafast on a bare model no account lists it on goes as priority. What is sent upstream stays the providers' own rule (fits, takesTier, fallback), so a vendor with no service tier is sent none; Anthropic-protocol requests are untouched. Set with the tier-key action, `magpie gateway-key tier <id> ...`, or the key row's badge (zh, zh-TW, ja, de strings). Run (wsl-run, Linux): TestGatewayKeyServiceTier, TestKeyTieredChat, TestKeyServiceTier, TestGatewayKeyTierCLI green; internal/gui -run Key|Tier|Caller|Access ok; gateway-key-tier and gateway-key-concurrency GUI files 40 of 40 in chromium and webkit (serial); go vet nogui for linux, windows and darwin; gofmt clean. Broken by hand: with the keyTiered call removed TestGatewayKeyServiceTier fails on 4 rows. A parallel run of all gateway-key and i18n GUI files had 8 unrelated timeouts that pass serially (load). The whole internal/cli package hit the default 10m timeout on this box; the key tests in it pass. Not tried: a real ChatGPT account, the Windows box, the full suite. |
||
|
|
8af7c27fff |
library: mcp add takes header=, env= and timeout= as settings, mcp set and mcp show (Abandon332 on X, #6111)
`magpie library mcp add` handed env=A=B and timeout=30 to the program as arguments (exit 0, written into the agent), and refused header= on a URL, so a token-bearing remote MCP needed a hand edit of library.json. SplitServerWords takes header=K=V (or K: V), env=K=V, timeout=SECS, agents= and --local out of the line; words after -- are the program's. A setting-looking word magpie doesn't know (headers=, envs=) is refused; header= on a command or env= on a URL is an error. New: mcp set <name> header=|header-=|env=|env-=|timeout= keeps the rest of the server, and mcp show <name> prints it as JSON. Header names match without case and keep the stored spelling. Run (wsl-run, -tags nogui): TestSplitServerWords, TestSetServerKeepsTheRest, TestLibraryMCPHeadersEnvTimeout, all of internal/cli and internal/library ok; GOOS=windows and darwin go vet of both packages; gofmt clean. The new CLI test fails on the old code by construction (env/timeout in Args). Not broken by hand separately. Not tried: win-run, the GUI (its save already sends headers; a stale open editor over a hand edit isn't addressed), the TUI line (still ServerOf), the other agents' encoders for timeout. Not run: full suite. |
||
|
|
4999cef657 |
cli, gui tests: context-cap's usage line lines up, and ContextCapAll is kept (#6103, #6104)
|
||
|
|
5c02be05b8 |
agent: agy moves onto the community agent-agy plugin
The built-in agy agent (Antigravity CLI) is the first built-in agent a community agent plugin serves, as the retired subscriptions moved onto provider plugins. While @magpie-community/agent-agy is installed and on, magpie's agy is the plugin's: the built-in leaves the list (here and in WSL), its id and aliases are the plugin's, and what the built-in wired is handed over. Turned off or removed, the built-in is back. Nothing is forced yet; the forced install and the built-in's retirement come once the plugin is on npm and a real run with it is on record. The plugin (plugins ebcff866, 0.2.0) follows the built-in since |
||
|
|
150646bd0d |
cli tests: context-cap-mode and the memory review routes are named
TestEveryRouteHasACommandOrIsNamed was red on main again: |
||
|
|
7a8346099c |
cli tests: Settings › Models' Quick check route is named in notYet, as proxy/check is
|
||
|
|
f5e1b10913 |
settings: longest context can hold a model's own window too (WJaunita45604 on X)
v0.1.3681's Longest context left a window the user set for a model, or "*"
on its provider, alone even when longer. Settings > Models > Routing now has
a menu beside the field: "Models without their own" (the default, as before)
or "Every model". In both modes the shorter of the cap and the user's own
window is told; they differ only when the user's own is longer (own keeps it,
every model brings it down). Settings.ContextCapAll, Settings.CappedOwn,
POST /api/settings/context-cap-mode {all}, magpie model context-cap all|own.
Applied in provider.windowIn (so /v1/models, catalogs, compaction), Codex's
CodexNativeWindow/CodexWindow (the list's ETag tag carries the mode) and the
gateway fallback window. i18n in zh, zh-TW, ja, de.
Run (wsl-run, mote's disk was full): provider (full), settings, settingsapi,
codexcat packages; cli -run ContextCap; gateway -run ContextCap|ModelsList;
GUI context-cap, i18n-keys, model-load, settings-places, settings-general in
chromium and webkit; TestCoreScriptBudget; gofmt; go vet nogui and
GOOS=windows vet. Broken by hand: windowIn's CappedOwn removed turns
TestContextCapAllHoldsTheUsersOwnWindowsToo red.
Not tried: the whole Go and GUI suites, a real Codex reading the list, macOS
or Windows runs, GUI in zh-TW/ja/de beyond the i18n-keys check.
|
||
|
|
4a7d222dc8 |
providers: an OpenCode Go key takes the usage cap an account does (@wanggenjidev on X)
Backend only; GUI follows. Tests: provider TestKeyTakesUsageCap, gateway TestKeyUsageCapPassesTheKeyOver (red with the hold removed by hand). |
||
|
|
1315ac7d99 |
update: the first update finds a magpie without gateway.json, and a restart waits a bounded time (ljlwlcz on X)
Two edges of v0.1.3687's gateway.json:
1. The first update from a magpie older than the record found no gateway.json,
asked 3425, said "isn't running" and left a service on MAGPIE_ADDR=0.0.0.0:10100
on the old version. With no record, no MAGPIE_ADDR and no answer at the usual
address, `magpie update` now tries the installed service's MAGPIE_ADDR (read
from its unit or launch agent, daemon.Addr), the port in Settings and 3425,
and takes the first that answers as magpie. --addr and MAGPIE_ADDR stay the
user's word.
2. A restart asked by `magpie update` waited on "N requests" with no end (Windows
hands nothing over, long streams never finish). The app and magpie serve now
wait at most 10 minutes for that ask, then restart; the output says so
("or in 10 min at the latest, which cuts what is still running"). `magpie
update --force` restarts at once (gateway.SetForceRestarter), and says if the
running magpie is too old to know --force. The app's own look at the disk
(followReplaced) and autonomous serve follow still never cut a request.
Run (mote refused SSH; win-run on xiaomi-gpu): go vet cli/gui/gateway/daemon
(windows), linux nogui vet; go test -run TestUpdate|TestServeFollow|
TestTerminalUpdate|TestRestart over cli, gui, gateway, daemon: ok except
TestUpdateThatWontStart, red on origin/main on the same box too (#6059).
Broken by hand: drain bound off, record fallback off, serve bound off: the new
tests TestTerminalUpdateWaitIsBoundedAndCanBeForced, TestUpdateFindsAMagpieThatWroteNoRecord,
TestServeFollowDrainIsBounded go red.
Not tried: a real systemd service upgrade; darwin cross vet (cgo) and the full
suite (started after the tag if mote is back).
|
||
|
|
dd3c9042c5 |
tests: the saved proxies' routes and settings are named in the guards
|
||
|
|
c1a0726369 |
tests: context-cap and the catalog's model list are named in the route and settings guards
|
||
|
|
5399c33728 |
healthcheck, update and status find the running gateway by its own record (ljlwlcz on X)
The gateway now writes gateway.json (addr, pid, role, version) in magpie's config folder while it serves; healthcheck, update, status and the other CLI clients read it when MAGPIE_ADDR is unset, trusting it only if the pid on GET / matches. --addr overrides. New: magpie status [--json] for watchdogs (role, pid, listen address). Run: new gateway and cli tests on Windows via win-run (pass); broken by hand (record disabled): they go red; gofmt; vet windows and linux nogui. Not run: mote/Linux (SSH down, WSL broken), darwin vet, a real systemd service. TestEveryRouteHasACommandOrIsNamed is red on the base for two GUI routes, unrelated to this change. |
||
|
|
7476328901 |
settings: one longest context for every model (WJaunita45604 on X)
Settings > Models > Routing has a Longest context field (magpie model context-cap [<size>|off], POST /api/settings/context-cap). It lowers every model's window to it, so a user need not set each model. A window the user set on a model, or on its provider with "*", wins and is not capped; a model whose window is unknown stays unknown. It is applied where the window is derived, provider.windowIn, so /v1/models, every agent's catalog, group windows and the compaction thresholds that follow the window all agree. Codex's own models take it through CodexNativeWindow, CodexWindow and codexcat.Cap on the list the gateway serves; the list's ETag carries the cap so Codex asks again. The provider editor's Listed value stays the vendor's. Run (mote): provider, codexcat, cli, settings, settingsapi, gateway tests; GUI context-cap, model-load, settings-places, i18n-keys, settings-general in chromium and webkit (en, zh); TestCoreScriptBudget; gofmt; vet on darwin, linux nogui and windows. Broken by hand: windowIn without the cap turns TestContextCapHoldsEveryModelButTheOnesTheUserSet and TestModelsListContextCap red. Not tried: the whole GUI suite (one row added to an existing list, no new API read on page load), a real Codex reading the capped list, Windows run. Not covered: Claude Code's own [1m] choice (claudeRunName) and agent/claude.go's fallback when a ref has no window. |
||
|
|
0cc91af3db |
agy: magpie's models go in a settings file of its own, so agy's remote control works (baysonfox on X)
magpie wrote modelProvider gemini, the model and its custom models into agy's settings.json. That made every agy an API-key session: no Google account, so no remote control (needs the sign-in plus Google's server-side flag), and a plain agy asked for GEMINI_API_KEY too. Now they go in ~/.gemini/antigravity-cli/magpie-settings.json, handed to agy as --settings for the one session (the launch command, magpie agy run, and the function in a shell or a WSL distro). settings.json stays the user's. An older wiring is given back (stashed model and provider) at the next Sync or pick. agy remote-control and --remote-control run plain, on the sign-in. Run (mote): go vet, GOOS=windows and linux nogui vet, agent/cli/sessions/update packages (see push note). Real agy 1.5.3 in a sandbox HOME: plain agy with the user's untouched settings.json now asks for sign-in (no GEMINI_API_KEY error); the new launch reached a stub gateway at /v1beta/models/<m>:streamGenerateContent. Broken by hand: remote-control bypass removed, TestAgyRun red; TestAgy red on the old code (settings.json written). Not tried: real remote control (needs a Google sign-in, none in the sandbox); signed-in BYOM custom models; Windows PowerShell function run. |
||
|
|
4d9b798d50 |
web: a LazyCat box's administrators open the page with the box's sign-in (MAGPIE_WEB_SIGN_IN=lazycat) (#5987)
magpie in a LazyCat app (懒猫微服) is opened from the box's app list by someone signed in to the box already, and asks for a key they never saw: it is in the container's log. A package can only hand the key to every browser that reaches the app, or put a proxy in front that adds the key's cookie to what the box signed in. The box's ingress, lzc-ingress, sends a browser that isn't signed in to the box's login page, and puts on every request it passes the app the box account (X-HC-User-ID), its role (X-HC-User-Role, ADMIN or NORMAL) and what sent it (X-HC-Source, client for a browser), in place of what the caller sent. With MAGPIE_WEB_SIGN_IN=lazycat webGuard takes that sign-in besides the key: lazyCatSignIn lets in an ADMIN account sent by a browser, each of the three named once, and tells anyone else the box's reason. The box's sign-in is a cookie of the box's, and the box's apps are one site, so a browser sends it with another app's page's requests too: an earlier build of this change let another app's page on the box include /boot.js and read window.bootPrefs. So it is taken only for what the page itself or the user asked for (boxFetched, the Fetch Metadata: Sec-Fetch-Site same-origin or none, or a GET or HEAD navigation to a document from another page), never for another page's script, frame, fetch or form POST, nor from a browser that sends no Fetch Metadata. It sets no cookie of the page's own, so signing out of the box signs out of the page. The key's link and cookie work as before, /api still answers the page alone (webOwnPage), and the gateway's client routes on the page's port go to the gateway first (onePort), which asks for a gateway key. StartWeb refuses another value, and lazycat where LAZYCAT_APP_DOMAIN, which LazyCat sets in an app's containers, isn't set: all magpie can check, so the setting is the package's word that the box's ingress is the only way to the page's port. magpie web prints the box's address beside the link. Docs: reference.md's new LazyCat section, with a manifest and what must never reach the page's port, and gui-shell.md's Browser mode row. On a box (lzcos 1.6.2+fix.4), a probe app that echoes its request headers: a signed-in browser's request carries X-HC-User-ID, X-HC-User-Role ADMIN and X-HC-Source client, forged ones replaced; not signed in, / goes to the login page and a public path gets none of the three (forged ones taken off, repeated or in lower case too), while X-HC-User-Groups passes on as the caller wrote it, so it is never read; a TCP ingress passes every header as sent. Another app's container reaches the app through the ingress alone (straight to the app's container it times out); the box itself, and a container in its network (network_mode: host, which a manifest may set), reach the port. A test app made from the docs' manifest, running a build of this change on |
||
|
|
bf4d8f3e5d |
gateway keys: a model may be a re: pattern, and a key may rename a model (tsingchao on X)
Access layer, CLI and gateway; GUI and docs follow. Tests: access pattern and alias tests; gateway TestGatewayKeyModelPatternHoldsEveryRoute and TestGatewayKeyAliasRenamesAModel, each red with the pattern match or aliasRequest switched off by hand. |
||
|
|
966ddff209 |
cli tests: Discover's plugin counts and likes routes are named in notYet
|
||
|
|
91d4eaa70a |
cli tests: plugins/probe and Bark's two routes are named in notYet
TestEveryRouteHasACommandOrIsNamed was red on origin/main: |
||
|
|
d77eb6d236 |
memory: search by meaning, on a small model on this computer
A memory search now finds what means the same in other words or another
language ("什么时候上线" finds "Releases go out on Tuesdays"), for the
MCP server's memory_search and the Library's Memory tab alike. It is off
until switched on under Memory → Search by meaning, since it downloads
paraphrase-multilingual-MiniLM-L12-v2 (Xenova's int8 ONNX, ~135 MB,
pinned revision, size and sha256 checked); switched off, the model is
deleted.
- internal/pii/guard: the BERT code runs the embedder too (LoadEmbedder,
mean pooling; the tokenizer reads 250,002 pieces and WhitespaceSplit).
Its vectors match ONNX Runtime's int8 to cosine >= 0.995 and are no
further from fp32 than ORT's own; testdata carries both.
- internal/memembed: the switch, the download, vectors.bin keyed by each
memory's sha256 (read once, again when the text changes, a cut-short
file read as none), Keep reading in the backend, the model let go after
10 minutes unused.
- internal/memory: memory.Semantic fuses the meaning ranking with the word
ranking by reciprocal rank; a tie goes to the nearer in meaning, since
a first word hit may hold one common word ("when do we release" had
"Never delete images when..." first). Near 0.30 / Within 0.15 come from
97 real memories and 16 queries, half Chinese for English memories:
12 of 16 sought found with ~4 others each. Rank searches without noting
memories used.
- GUI: the Search by meaning row (download %, memories read, failures),
and the tab's search lists what the backend ranked first
(POST /api/memory/rank), then word matches. zh, zh-TW, ja, de.
- docs/subsystems/memory.md: the section, out of "Not built yet".
Why not multilingual-e5-small, which this was built on first: run for
real, its cosines sat at 0.78-0.89 for everything, and a Chinese search
ranked Chinese memories over the English one it meant. e5-small, e5-base
and MiniLM were compared in ONNX Runtime on the same 97 memories; MiniLM
put the sought one first 9 of 16 and in the top 3 12 of 16, with the
rest at a median cosine of 0.16.
Run before the rebases (mote, on origin/main as of the work):
- gofmt -l internal/ clean; go vet of memembed, memory, pii/..., gui,
library; GOOS=linux and GOOS=windows vet of memembed and pii/guard.
- MAGPIE_EMBED_DIR=~/models/pml go test -run Embedder ./internal/pii/guard:
7 texts (CJK, full width, emoji, digits before runs of spaces) at
0.9962-1.0000 with ORT int8.
- go test memembed, memory, memdistill, pii/..., library, browsermcp.
- Linux (magpie-desktop, -tags nogui, mote's disk was full): go test
memembed, memory, pii/guard, gui (461s), cli (1228s, past the default
10m timeout, so -timeout 30m); gateway -run 'MemoryMCP|OwnMCP'.
- Rebased on origin/main
|
||
|
|
36b02474e0 | cli: the parity table names POST /api/signin/export | ||
|
|
b9f8548d22 |
accounts: export ChatGPT and Claude accounts as Sub2API or CLIProxyAPI files (heyiwei5 and Rk1ngggg on X)
WIP commit before the full checks; body rewritten at ship. |
||
|
|
696556e26c |
provider: Google Vertex AI takes an API key (express mode) and a base URL (Langanpaibian on X)
Vertex AI could only be signed with gcloud credentials and a project id. A provider now takes one API key instead: a Key with no project is Vertex express mode, asked at https://aiplatform.googleapis.com/v1/publishers/ google/models/<model>:streamGenerateContent with the key in x-goog-api-key (Google's docs), no project, no token minted. Express serves Gemini models only, so Base(Chat)/Base(Anthropic) are empty and the models list drops partner and Claude models. A key with a project is asked at the project's address, signed by the key. Vertex.BaseURL (optional, /v1 stripped) replaces Google's host for a keyed provider, such as a proxy. Security: a Google token or gcloud credentials go only to Google's own address. A BaseURL is honoured only with a key, and the key is the only credential sent there; without a key Save refuses it and a providers.json holding one has it dropped on load. Wired through: provider.Save/normalize/Sign/Base/planModels, `magpie provider add google-vertex <key>`, `provider key`, `provider set ... url=`, `provider <id>` and the list, the editor's API key and Base URL fields (app.js, 4 translations each), the Providers row pill, and the providers-accounts subsystem page. Run (mote-run): gofmt -l clean; go vet for darwin, linux -tags nogui and windows over ./...; go test -run Vertex for provider, cli, gui, gateway and tui, all green, with new tests TestVertexExpressKey, TestVertexExpressBaseURL, TestVertexExpressEditor (fake server) and the gateway's TestVertexExpressStreams (chat, streamed and whole, asks /v1/publishers/google/models/... with the key header, no token minted); vertex-editor, i18n-keys and ledger-protocol GUI files in chromium and webkit (en and zh editor flows; the i18n check covers zh, zh-TW, ja, de). Broken by hand: Sign without x-goog-api-key turns the provider, gui and gateway express tests red. The existing tests that pinned "a key is refused" now pin the new rules. Not tried: a real Vertex AI key (no account on hand; the endpoint and header are from Google's express-mode docs, the tests use fakes), the full GUI suite in webkit, Windows and Linux runs of the tests. |
||
|
|
5df062f0f2 |
provider, gui: a Claude account with its provider switched off shows its last reading, or says it is switched off, not "No allowance reported" (Kunlin03 on X)
Kunlin03 (Pro subscription, "Claude Code" switch off): the account's card
said "暂无额度数据". LoginUsage returns nothing for a provider magpie leaves
alone (switched off or removed, leftAlone), so /api/login/usage answered {}
and the card had neither a reading nor an error, although left_alone.go says
what was last known is still shown. Pro versus Max is not the cause: the
read itself (Claude Code's /usage) is the same for both.
LoginUsageShown, used by /api/login/usage and `magpie accounts`, answers such
an account from keepLast (its last reading, readDeferred, "not refreshed this
time") and, with none kept, errLeftAlone, which the card words as "Switched
off, so no allowance is read — switch it on and refresh" (4 languages).
LoginUsage itself is unchanged: warm-ups and switching act on it and must
not take a kept reading for a fresh one. Nothing is requested for a provider
left alone.
Not changed: the Usage page and a card refresh for an off provider (they
read through loginReading as before). Not tried with a real Claude Pro
account; the sandbox has none.
Run (mote): TestLoginUsageShownOfSwitchedOffClaude (red without errLeftAlone
in readDeferred), claude-off-usage-card.test.cjs in chromium and webkit, 5
languages, 2 widths (red with the quotaError branch removed), gofmt, vet
darwin/linux nogui/windows, the provider, cli and gui packages, i18n and
account/usage GUI files.
|
||
|
|
1d41799f2a |
agent: turn off every agent's telemetry from Settings › Privacy (OipsAnthony on X)
OipsAnthony on X: "magpie 设置 - 隐私,支持统一关闭所有 Agent 的遥测功能, 这个统一管理的地方优先级最高". v0.1.3562 gave Codex, Claude Code, Gemini CLI and Qwen Code a Telemetry row each; there was no one switch for all. Settings › Privacy now has "Turn off telemetry for all agents" (settings.AgentTelemetryOff, POST /api/settings/agent-telemetry, agent.SetTelemetryAll in internal/agent/telemetry_all.go): - On: every agent found here with a telemetry switch is turned off through its own switch and that switch's rules (only keys the file lacks are written; a value of the user's own that keeps telemetry on is never written over: the agent stays on and the reply's "refused" names it and why). Each agent the switch turned off gets a stash marker, <id>.telemetry.all. An agent found later is turned off on the next state the window reads and by a one-minute gateway loop (KeepTelemetryAllOff, in WhileServing). - While on, each agent's own Telemetry row shows off, says "Off for all agents in Settings › Privacy" and its buttons are disabled; the API refuses it too (ErrTelemetryAllOff). - Off: only the marked agents are turned back on, which takes out only magpie's keys. An agent off by its own row or the user's own config before stays off. - An unreadable settings.json is unknown: nothing is written. - The setting is per computer (KeepOwn) and the generic settings POST can't change it (settingsapi.Merge carries it). app.js pays for its ~650 bytes with ten Privacy-section comments cut (core 1,533,550, under its 1,533,802 budget, no raise). Run (mote, first on |
||
|
|
418bb6c9e1 |
codex: Show Codex's own models off leaves them out of Codex's own picker (iiiiiimone on X)
The switch (#1642) only narrowed the Agents page's pickers. Codex's own list, which the gateway hands it beside its sign-in and as the Codex app's list file, kept every model of the ChatGPT account, also with the Codex provider switched off. codexMerged now leaves the sign-in's visible models out when the switch is off (provider.CodexOwnLeftOut); the model Codex is set to, models magpie serves on a ChatGPT account and hidden jobs stay, and the list's ETag carries the switch so Codex asks again. Codex has one openai_base_url for every model, so one it is still set to goes through the gateway to OpenAI on its own sign-in; a model of it can't be sent direct beside magpie's models. Run: TestCodexListWithOwnModelsOff, red with the filter turned off (own models all listed, ETag unchanged); gateway, provider tests at this tree. Not tried: a real Codex app against the list. |
||
|
|
025123431c |
library: add and remove a project's skills from the CLI (Sephiro_Lan on X, #5193)
magpie library project … does what the window's Library › Projects page
does, through the same library calls its page makes (AddProject,
RemoveProject, ProjectSkills, ProjectSkill, ProjectCopy):
magpie library project [--json] the projects and their skills
magpie library project add <dir>
magpie library project rm <dir> [--keep-files]
magpie library project skills <dir> [--json]
magpie library project skill add <dir> <skill…> [agents=a,b…]
magpie library project skill rm <dir> <skill…>
magpie library project skill agents <dir> <skill> <a,b…|none>
magpie library project copy <dir> on|off
<dir> may be relative or "." (library.ProjectPath / ProjectAt find the
listed project, through a link too). A skill added with no agents= goes
to the agents the page's Skills menu picks: those the project's skills
are for already, else every agent here with a project skills folder.
Each skill added says where it was placed; one that wasn't (a folder
there that isn't magpie's, left as it is) is named with why, and the
command exits 1, so a script tells "installed" from "left as it is" by
the status. --help prints the project usage; an unknown flag, command,
skill, agent or on/off value is refused, and so is rm of a skill the
project doesn't have.
Docs: the Projects row of docs/subsystems/library.md, and the site's
library page in en/zh/ja. site/public/llms-full.txt rebuilt with
`node llms-full.mjs`; it also picks up a line (Alma, Shelley) another
docs change left out of it.
Run (mote, at this tree):
- go test -count=1 -run TestLibraryProject ./internal/cli: ok; the same
on Windows (win-run, xiaomi-gpu): ok.
- go vet ./internal/cli ./internal/library for darwin, linux (-tags nogui)
and windows: ok. go test -count=1 ./internal/cli ./internal/library:
ok (45s, 99s), at this head after the rebase. site: node --test worker.test.mjs: 38 pass. gofmt -l:
clean.
- A sandbox HOME end to end with the built binary: claude and codex
installed, three library skills, a git project. add ., skill add with
no agents= (links in .claude/skills and .agents/skills, listed
in .git/info/exclude, the .gitignore left as it is), a folder of the user's in .claude/skills/pdf (named,
exit 1, untouched), agents=codex, skill agents, unknown
skill/agent/flag/command refused, skills --json, skill rm, rm .: the
links, magpie's folders and the exclude block gone, the user's
folder kept.
Broken by hand: with the not-placed exit taken out, TestLibraryProjectCmd
goes red ("a folder of the user's in the way: <nil>").
Not tried: a project's MCP servers from the CLI (the issue asks for
skills; servers stay on the page), WSL agents, and a real Linux box.
|
||
|
|
20aff50d4f |
cli: name the join and HTTPS settings routes
|
||
|
|
4623f54190 |
gateway: HTTPS for other computers, from magpie's CA or an imported certificate (zhangly1 on X)
zhangly1 on X: Claude on another computer on the LAN needed magpie at https://. Settings → Network and sharing → HTTPS (magpie https on) serves other computers TLS on the gateway's own port, with a certificate magpie's CA (the mTLS one, in ~/.config/magpie/mtls) signs for this computer's names and addresses; this computer keeps plain http://. The switch is read per connection, so no restart. - Certificate row: Import… takes the user's own PEM certificate (with chain) and unencrypted key, in any files and order; a pair that can't be served (no key, no cert, a stranger key, a passphrase, run out, nothing PEM) is refused with the reason in the page's language and leaves nothing behind. Remove goes back to magpie's CA. --tls-cert still comes first. - magpie's CA row: SHA-256 shown, Save puts magpie-ca.crt in Downloads; the gateway serves it without a key at /magpie-ca.crt to any address the share lets in. Rows under it give curl -kO, macOS, Windows, Linux and NODE_EXTRA_CA_CERTS steps with Copy. - A page open from another computer can't turn HTTPS on or off under itself (it would lose its own address). - magpie https status|on|off|import|remove|ca --out; the serve banner names magpie's CA or the imported file instead of "(mTLS)". - docs/reference.md and gateway-routing.md say all of it, and that Windows' curl.exe needs --ssl-no-revoke for any private CA. Run: - gofmt -l clean; go vet linux -tags nogui ./internal/..., GOOS=windows and GOOS=darwin -tags nogui vet of the touched packages (WSL, mote refused ssh all evening). - WSL: go test -tags nogui gateway -run HTTPS|MTLS|ClientCert|CAFile|TLS|LAN ok; gui -run HTTPS|MTLS|Keep ok; settings, settingsapi, mtls ok; cli -run Help|HTTPS|TLS|Serve|Banner|Flag|Unknown ok. The whole cli package hit its 40m timeout in TestEveryAgentFieldNameWritesNothing (#5234, #4247, not this change). - GUI (WSL Playwright, chromium + webkit): https-settings (en, zh, 390px, strings in all four languages) ok, plus mtls-settings, allow-ips, browser-access, cors-origins, gui-de/ja/zh-tw, i18n-keys, i18n-en-no-cjk, lan-*, public-url*, api-key-theme, connect-address-kept, gateway-connect-keys, gateway-caller-keys, side-gateway-lan, menu-scroll. Reds at load ~130: api-key-theme (#5044), connect-address-kept (#5972), gateway-caller-keys (#2572), gui-ja (#5943), lan-docker (#4692), all red the same at base |
||
|
|
72e804d2b5 |
gateway: a provider set Never a fallback takes no other model's request (sonnnnnnnnnnnna on X)
sonnnnnnnnnnnna asked that a request a local uncensored model was given
never falls back to an online provider (Anthropic, OpenAI) when the local
model is full (kv slots) or down, where it could get the account banned.
A provider now has Never a fallback (NoStandIn), off by default: the
Providers page's right-click, under Use first, ticks it; the CLI's
`magpie provider set <id> fallback-for-others=no` sets it. Its keys and
accounts are dropped from a request's plan once a candidate of an
unmarked provider was planned before them (standInsOut, run in planPaused
and in planGroup before restLast and sinkPlanned, so a local model that
failed and is resting still counts as first; a primary with nothing
planned counts too). A request that goes to a marked provider first still
moves on as before, and a weighed group (Smart, Cheapest) that picks a
marked member first sends it there. The dropped rows go to the trace's
left-out list as StandIn; the Routing page says why ("it is set never to
be a fallback for another model"), and the cap, held and barred refusal
checks ignore them so a refusal keeps its old status.
No classifier was built: the model that would judge the request is the
local one that is down, and any other would send the text somewhere the
user didn't choose.
Run on mote (macOS 27) at this tree on
|
||
|
|
7e1858515b |
remote magpie: name its models by the provider serving them there (lcc580 on X)
lcc580 asked for a pass-through on the Remote magpie provider: show the
upstream magpie's own provider beside each model, so an agent can tell the
same model from two of its providers apart. Before, the names followed
both magpies' Provider in model names: with either one Off, both relays'
DeepSeek Chat reached the agents as "DeepSeek Chat · Office" (or plain
"DeepSeek Chat").
- The list a magpie gives another magpie (X-Magpie-Drawers) now names,
as magpie_by, the provider serving each model there (Entry.ServedBy):
"routing group" for a group, and for a model of its own Remote magpie
the provider at the start of that chain. The fetch keeps it as the
model's By (catalog/live.go).
- A Remote magpie provider gets upstreamProviders: the editor's "Model
names" tick ("With the provider serving it there"), or
`magpie provider set <id> upstream-providers=on`. With it on, each of
its models is labelled "DeepSeek Chat · Office › Relay A" in every
agent's list, whatever either magpie's Provider in model names says,
unless the user named the model themselves under Own
(Entry.Label/upstream, LabelsFor). Model settings' "Agents' lists show"
line follows the tick at once.
- Ids are unchanged, so a request still goes by office/relay-b/model.
Off (the default) names everything as before. A remote older than
magpie_by has nothing to add, so its names stay as before.
- The core's scripts stay in budget: four long comments in app.js were
cut to pay for it, no raise.
Run:
- Tests that fail on the old code: TestRemoteMagpieUpstreamNames
(gateway: an httptest remote with two relays' DeepSeek Chat and a
group, every Provider in model names mode, on and off, the third
magpie's magpie_by, ids kept), TestServedByAndUpstreamLabel (provider),
and name-suffix-remote.test.cjs's new case (tick, hint, save body).
- Broken by hand: upstream() returning "" and the magpie_by line removed;
both Go tests went red with the plain labels, then restored.
- Two real gateways, built -tags nogui on the Linux box (WSL) under
sandbox HOMEs: B with Relay A and Relay B both serving deepseek-chat,
A with B as Remote magpie "Office". A's /v1/models before:
"DeepSeek Chat · Relay A · Office"; after
`provider set office upstream-providers=on`:
"DeepSeek Chat · Office › Relay A" / "› Relay B" / "› routing group".
A request for office/relay-b/deepseek-chat reached relay-b on B.
- gofmt -l clean; go vet darwin, linux (nogui), windows on the touched
packages; go test catalog, provider, gateway, cli, gui on mote
(macOS) at the rebased head: ok (catalog 2.6s, provider 165s, gateway 948s, cli 56s, gui 149s).
- GUI on mote, chromium and webkit: name-suffix-remote, remote-magpie,
remote-self, i18n-keys, i18n-en-no-cjk, gui-ja, gui-de, gui-zh-tw,
provider-detect-draft, provider-unmasked, routing-remote-windows,
usage-remote-cards: all green except reds that fail the same on origin/main
|
||
|
|
a1ba92ad8c |
library: a market of Pi's packages, installed and removed by pi itself (nineruiing on X)
Library -> Pi now has a Discover list of Pi packages: npm packages with the pi-package keyword (pi's own docs: the keyword makes a package eligible for the pi.dev/packages gallery), sorted by monthly downloads, with search. Like the other markets it ships a 500-entry snapshot (market_pi.json), keeps a 6h memory and disk cache, and refreshes from npm. Install and remove run that Pi's own `pi install npm:<name>` / `pi remove npm:<name>` with PI_CODING_AGENT_DIR set to its folder, so settings.json's packages list and <agentDir>/npm are written by pi, not by magpie. Each card says which Pis have it; Install goes straight to the only Pi without it or asks which one; the Pi's list gets a remove button behind a confirm. New routes: GET /api/library/market/pi, POST /api/library/pi/install and /api/library/pi/remove. Run: - mote: go test -count=1 -timeout 45m ./internal/library ./internal/cli ./internal/gui at this head: ok, ok, ok. - mote: gofmt -l clean; go vet of library, gui, cli for darwin, linux (-tags nogui) and windows: ok. - mote: library-pi-market, library-pi-extensions, i18n-keys, i18n-en-no-cjk in chromium and webkit: 52 of 52; the 17 market and library GUI files: 598 pass, 0 fail (pre-rebase tree). - win-run: go test -tags nogui ./internal/library -run 'TestPi|TestMarket' ok (TestPiRunGivesAgentDir skips on Windows). - wsl-run: library TestPi|TestMarket ok; library-pi-market 22 of 22. - Real pi 1.5.1 in a sandbox HOME on WSL: PI_CODING_AGENT_DIR=$A pi install npm:pi-btw wrote packages ["npm:pi-btw"] beside the existing theme and installed node_modules/pi-btw; pi remove put packages back to []. The live ~/.pi was untouched. Broken by hand (each red, then green restored): - the pi-package keyword filter dropped: TestPiMarketFromNPM; - the name check dropped in the market: TestPiMarketFromNPM; - the name check dropped in install: TestPiInstallAndRemove; - PI_CODING_AGENT_DIR not set: TestPiRunGivesAgentDir; - the identity dedupe dropped: TestPiInstallAndRemove; - the installed marking always "live": library-pi-market 11 of 11 red. Not tried: a real magpie binary driving pi install end to end; pi on native Windows; git: and local package sources (the market lists npm only, and the Pi's list still shows and removes them as before). |
||
|
|
10c4dc109a |
update: a restart by itself waits while magpie's window is in use (BESTLJP0412 on X)
With Restart automatically on, magpie restarted to update as soon as the
gateway was idle, even while the user was adding a provider or changing
settings in its own window, which closed what they were doing.
The page now tells the app it is in use: any pointerdown, keydown, input
or wheel posts /api/update/using (at most every 20s, and at once when a
dialog opens or closes, with whether #modal is open). inUseAt holds a
restart for 2 minutes after the last input (usingFor), or 15 minutes
while a dialog was open at the last input (openFor). waitFor skips the
restart while the window is in use, unless the restart was asked for
(the tray's Restart to update, Settings' Restart now), which still
restarts at once. A `magpie update` from a terminal (restartBeside) waits
the same way. The route writes nothing, so held doesn't drop caches for
it. /api/update says `using`, and Settings' Version row and the Update
pill add "waiting while you use magpie" (en, zh, zh-TW, ja, de).
docs/subsystems/gui-shell.md describes it.
Run (mote, at this head):
- go test -run 'AutoRestart|Wait|Idle|Restart|Using|EveryRoute|CoreScript|Budget'
./internal/gui/ ./internal/cli/: ok.
- go vet darwin, GOOS=linux -tags nogui, GOOS=windows for internal/gui
and internal/cli: ok. gofmt -l: clean.
- GUI, chromium and webkit: update-using (new), every update-*.test.cjs
and i18n-keys.
- TestCoreScriptBudget: fits with no raise. Main had 40 bytes left, so
the update code's comments next to this change were cut to one line
each (no code, every issue and reporter kept): 1,533,641 of 1,533,802.
- One webkit run of update-wait.test.cjs had a red subtest while mote
needed 10 ssh tries (its output was cut by my grep, so not filed);
update-wait passed 3 of 3 in webkit at this change and 3 of 3 on
origin/main
|
||
|
|
a1181b4dfe |
cli: name /api/speeds with the Sessions routes
|
||
|
|
db9f0652a8 |
cli: name /api/gateway/pause with the gateway's restart and take-over
|
||
|
|
e115b96411 |
plugin: an api sign-in whose prompts ask the key asks no second key
An OpenCode plugin's "api" auth method with its own prompts and an authorize (inkstone's API key ways, Devin's session token in magpie-community/plugins#928) asks the key in its prompts and returns it from authorize(inputs). The GUI asked those prompts and then always showed a key field of its own, so the user typed the same token twice and the second entry went nowhere. The host's save() also copied every answer into the account's metadata, so the token sat there a second time in plain text. - host.js marks such a method keyAsked (type api, prompts, authorize). The GUI's startPluginSignIn signs in with no key field for it, as for keyless, and a rejected answer asks the prompts again on Try again. PluginAPIKey and `magpie plugin` login skip the empty-key check for it (Method.NoKey). - save() keeps only select answers (choices, never secrets) beside the authorize result's own metadata. A method with no authorize still keeps every answer, as OpenCode does. - An authorize that gives no key, with no key typed, is now an error instead of an "ok" that saved nothing. OpenCode itself differs: its v1 CLI (providers.ts) asks the prompts, then always asks "Enter your API key", saves result.key ?? the typed key, and merges the answers into metadata; its TUI never calls authorize for api methods. magpie-community plugins are written for magpie's flow and read the key from inputs, so this follows them. Plugins that read prompt answers back from metadata (grep of magpie-community/plugins packages): zcode (site, a select), joycode (tenant) and agnes (keyProfile, consoleToken). None has an authorize, so none changes. Every api+authorize plugin (inkstone, cloudflare-workers-ai, sensenova, agnes-code, astudio, sap-aicore, Devin #928) puts what it needs in its result's metadata itself; sensenova's apiKey: undefined workaround is now moot. Run on mote (macOS 27, Go 1.26.8, Playwright 1.62.0) at this change on origin/main |
||
|
|
ea310a8c90 |
cli: the Vertex show test reads the "as" row by its label
|
||
|
|
4011873001 |
catalog: models.dev unreachable falls back to the last copy or a shipped one, retried in minutes (creeksuen on X)
Where models.dev can't be reached (a network in China), the catalog that gives prices, context windows, reasoning levels and names degraded: - first run: no catalog file, so every model unpriced, no windows, and a plugin's provider listed no models, until a fetch got through; - a failed fetch: KeepFresh tried again only after an hour, and the app's backend waited up to 30s on models.dev before it asked the vendors for their lists; - Sync wrote models.json in place (os.WriteFile), so a reader could catch it half written, and a parse failure left no catalog at all. Now: - Sync writes the catalog through a temp file renamed over it (writeWhole, shared with labs.json). A refused, hanging or wrong answer (HTML, cut-off JSON) keeps the last good copy byte for byte. - The binary ships models.dev's api.json of 2026-11-10 (internal/catalog/bundled/api.json.gz, 608KB; go:generate refreshes it). loadGen reads magpie's copy, then OpenCode's, then the shipped one, passing over one it can't parse. Seed (app backend, magpie serve, the plugin host) writes the shipped copy into the cache when there is none or it is older, dated bundledAt, so the plugin host reads it and Stale still has the real one fetched. A test binary has it off (bundledOn). - The app's backend no longer waits on models.dev before the vendors' lists when a catalog is there; KeepFresh fetches beside them, and a failed fetch is tried again after 2 minutes, doubling up to the hour. - The fetch already goes through http.DefaultClient, which netproxy.Install routes through the proxy in Settings, *_PROXY or the system proxy; there is no models.dev mirror setting to honour. Run (mote, at the rebased head unless said): - gofmt -l: clean. go vet darwin (catalog, plugin, cli, gui), linux -tags nogui and windows: ok. - go test ./internal/catalog: ok at the rebased head; ./internal/plugin, ./internal/gui, ./internal/cli: ok at the pre-rebase head but for TestEveryRouteHasACommandOrIsNamed, red at that older base (a GUI route this change doesn't touch) and ok at the rebased head. - New tests, each fake models.dev on 127.0.0.1 (cut connection, hang, captive-portal HTML, cut-off JSON): TestFailedSyncKeepsLastGood, TestFirstRunOfflineAnswersFromShippedCopy, TestUnreadableCacheFallsBackToShippedCopy, TestSeed, TestSyncWritesThroughRename, TestFailedFetchRetriedSoon. - Windows (win-run): the catalog tests ok, 15 of 15 with -count=15; TestSyncWritesThroughRename skips there (it holds the file open). Broken by hand, each red: Sync back to os.WriteFile (TestSyncWritesThroughRename); load without the shipped copy (TestFirstRunOffline…, TestUnreadableCache…); Seed over a newer catalog and Seed dated now (TestSeed); first retry after the hour (TestFailedFetchRetriedSoon). Not tried: the real app started with models.dev blocked; the full suite (started after the tag). |
||
|
|
07af9f86a6 |
providers: mark a provider and a routing group on a plan or pay as you go (EV_John_Liu on X)
EV_John_Liu on X asked for pay-as-you-go and token plans to be marked on providers and routing groups. A provider row now carries a quiet grey badge, Plan, Pay as you go, or Plan + pay as you go when its keys are on both (Volcengine's Coding Plan beside a pay-as-you-go key). It is read from what magpie knows: a signed-in subscription is a plan; a plan preset (Kimi Code, Qwen/Bailian token plans, OpenCode Go, ClinePass) is a plan; a preset region's own name (Coding Plan, Token Plan, Pay as you go) decides; other vendor and relay presets are pay as you go. Presets whose billing magpie can't tell (MiniMax, Ollama Cloud, ModelScope and others) and custom endpoints show nothing until the user says: the provider editor's Advanced has Billing (Auto / Plan / Pay as you go), and `magpie providers set <id> billing=plan|payg|auto`. The user's word always wins. A routing group gets the same tag when every on member is known; its title lists each member. Run on mote with these changes on origin/main ccc96b4a7; pushed rebased on |
||
|
|
901e641f27 |
cli: name /api/model-price and /api/remote's routes
|
||
|
|
99b080e2ee |
agents: an agent can have its own Provider in model names (KillTry27355 on X)
"希望 可以在不同的 agent中选择是否显示供应商名字,现在只能统一开关":
Provider in model names was one switch for every agent. An agent's
Details on the Agents page now has a Provider in model names row: As in
Settings · <mode> (the default, kept for everyone), On, Not on names I
set, or Off, for that agent alone. The CLI has the same thing:
`magpie model suffix <agent> [on|own|off|every]`.
- settings.AgentSuffix keeps the agent's own mode by the id its lists are
kept by (Agent.ListsFor, lower-cased, without @wsl: or #profile). An
agent with none follows PlainNames/PlainOwnNames as before, so nothing
a user already set changes.
- provider.LabelsFor(agent, es) reads that agent's mode. Every place
that named models with Labels for an agent now passes the agent: Codex's
catalog, the agents' written lists (route.go, Pi's extension), the
gateway's /v1/models (by agentOf(r)), Muse, Antigravity, Ollama, Claude
Desktop's catalog and descriptions, Claude Science. Labels is
LabelsFor("").
- POST /api/settings/agent-suffix sets it and rewrites the agents'
configs (catalog.Touched), as Settings' switch does.
- docs/subsystems/agent-wiring.md says where the mode is kept and read.
- The picker is in agentsuffix.js, imported when an agent's Details open,
so the core grows by the one line that loads it (1,529,335 of its
1,533,802 budget, after the previous commit's move). An agent whose
list takes no names of magpie's (noNames) has no row.
Tests, each red on the old code: TestAgentSuffix (provider: modes, keys
with @wsl and #profile, reset, bad input), TestAgentSuffixReachesItsFileAlone
(agent: Pi's file follows its own mode while Codex's follows Settings'),
TestModelsListFollowsAgentSuffix (gateway /v1/models per agent),
TestModelSuffixAgentCmd (cli), settings_keep (AgentSuffix survives a
Settings save), agent-suffix.test.cjs (5 languages x 1180/390 x chromium
and webkit, and a noNames agent has no row).
Broken by hand (a copy with LabelsFor ignoring the agent and the picker
reading no own mode): TestAgentSuffix, TestAgentSuffixReachesItsFileAlone,
TestModelsListFollowsAgentSuffix and every agent-suffix GUI case went red.
TestModelSuffixAgentCmd stayed green; it checks what is saved, not the
names.
Run on mote at this change on top of
|