4794de398ea8337d223a91e207181c56fcf4ad76
159
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
eba7187368 |
gateway, provider, cli, gui: a group can route By weight, each member's share set beside it (#1910, DD on Discord)
DD asked for weighted round robin as a group routing, next to In turn.
A provider's keys could already route by weight (#841). Groups could not.
What changes:
- provider: Group.Weights maps a member's spelling to its weight, 1 to
1000. A member left out, or set to 0, weighs 1. SaveGroup accepts
routing "weight". It also cleans weights the way it cleans fast and
off: it strips :fast, drops weights of members that are gone and of
members weighing 1, and refuses a weight below 0 or above 1000.
Weights follow a member when it is renamed (RenameMember, Rename,
RenameGroup) and survive Share/Import.
- gateway: planLevel treats each member of a weight-routed group as one
unit: a model with its keys in its provider's order, or a nested group
routed its own way. weightedUnits orders the units by smooth WRR on a
round per group ("group/<id>"), sharing wrrPick with the keys. The
round's pick goes first and the rest stay in member order for
failover. A unit whose head is resting leaves the round. When a
conversation is kept on another member (session/turn/cache/strict),
the charge moves to that member (wrrSeat, wrrMove).
- cli: routing=weight (also weighted, wrr). weight=<model>=<n>[,...]
sets weights and keeps the rest; weight= on its own clears them. The
group view shows "· weight N" for each member.
- tui: By weight is in the group routing list.
- gui: the group editor offers By weight. Each member then shows
"Weight N · S%", its share among the members that are on. Clicking it
edits the number in place: Enter or blur keeps it, Escape cancels,
and a value outside 1 to 1000 shows a warning. The trace header uses
group wording for a weight-routed group. Strings are added in zh,
zh-TW, ja and de.
- docs: reference.md, gateway-routing.md, and site start pages in en,
zh and ja.
Run:
- go test -tags nogui ./internal/provider ./internal/cli ./internal/tui:
ok.
- ./internal/gateway: ok in 988s with -timeout 45m. The first run hit
the default 10m timeout at load average ~170. The test running at
that moment had been running for 2s; it was not a hang.
- go vet -tags nogui on those packages, for darwin, GOOS=linux and
GOOS=windows: clean. gofmt -l: clean.
- New group-member-weight.test.cjs: 8/8 in Chromium and WebKit, en and
zh at 1100, en and de at 420. The WebKit de 420 case also passed six
runs at once.
- gui-zh-tw, gui-ja, gui-de, i18n-keys, routing-*, group-*,
panel-routing*, settings-groups and agent-model-groups: all green
except two.
- routing-steady (WebKit) is #1804. It is red 2/3 alone on origin/main
|
||
|
|
e528aeb3ce |
agent: DevEco Code, Huawei's OpenCode, as an agent (#1885)
foobra asked for DevEco Code (npm @deveco/deveco-code), Huawei's
HarmonyOS coding agent. It is OpenCode underneath, so it joins through
openCodeLike as MiMo Code did (
|
||
|
|
d4c2512d2d |
usage: apps report their own calls with POST /v1/magpie/usage/requests, backfill included (#1874)
What changed
- POST /v1/magpie/usage/requests (internal/gateway/usage_ingest.go) takes
one record or an array, in usage.jsonl's shape:
- the post may carry up to 5000 records and 32 MiB;
- t, agent, provider, model and rid are required.
Each field is checked: unknown fields, quoted numbers, negative or absurd
counts, a status outside 100-599, a cost over 10000 USD, and a t more
than an hour ahead or before 2000-01-01T00:00:00Z. Any fault refuses the
whole post with a 400 that names error.index and error.param, and nothing
is written. A past t is otherwise taken as given, so history can be
backfilled. The reply gives accepted and skipped counts and each
record's index, rid and status.
- Access: lanGuard's rule (this machine, or another with a key while
shared, behind the Host check). A browser page also needs a key, since
corsGuard lets localhost pages and Origin null through. A held key is
refused.
- usage.IngestReported writes under usage.mu to the same file as
usage.Append. Rows carry source "reported" and no caller key. A rid
already reported is skipped, as is one repeated in the post. The set of
reported rids is read back from the log: one scan after a restart (lines
without the reported mark aren't parsed), then only what was appended.
- Pricing: a record with cost keeps it (Record.OwnCost, the rowOwnCost
flag; packed flags widened to uint16). Otherwise it is priced at
magpie's prices.
- Display:
- SourceReported is a source of its own: RequestPage.Reported,
?via=reported, and Ledger now honours via.
- The Requests tab gains a fourth cell "reported by apps", shown once
there are some, and a "Reported" badge (en, zh, zh-TW, ja, de).
- Nothing live: Record.IsReported keeps reported rows out of:
- a key's budget/spend limit (budget.counts);
- window holds, and the log start that decides whether a window can be
reckoned (logSnapshot.firstOwn);
- gateway sessions and Vias;
- Codex's sealed answers and remembered model.
There is no OTel span, rate limit, rest or alert for them.
- Docs: gateway-sessions.md, reference.md (with a curl), integrating.md,
site integrate.html (en, zh).
Why: the reporter's apps call vendors directly, and their usage (and
history) should show on the Usage page without becoming live traffic.
Run, in a worktree with sandbox HOME and a private GOCACHE
- gofmt -l: clean.
- go vet ./...: darwin, GOOS=linux -tags nogui, and GOOS=windows.
- go test internal/usage, usageapi, budget, gateway, gui: ok.
- -race -count=3 of the new usage/gateway tests: ok.
- GUI with playwright 1.62.0:
- usage-ledger-reported.test.cjs, 26/26 in chromium and webkit (5
languages, 1180 and 420 wide, light and dark);
- usage-ledger*.test.cjs, ledger-*.test.cjs, usage-sum-whole,
usage-unpriced-sum and i18n-keys: all pass.
- Timings with 200k reported rows (47 MB log, darwin):
- 40 posts of 5000 took 0.40 s (worst batch 18 ms);
- the first post after a restart took 0.45 s (rid rescan), a later one
1.6 ms;
- the cold index build took 2.1 s (as for gateway rows);
- page all took 27 ms warm, page 30d 39 ms, all via=reported 0.53 s;
- summary all took 215 ms, 30d 20 ms.
Broken by hand, each went red, then restored
- Go: dedupe against stored rids; the restart scan; CostAt ignoring own
cost; the block pricer overwriting own cost; the Reported split;
fromBrowser's key rule; skipping bad records instead of refusing; the
max-records and body limits; the ingest lock (race); both locks;
firstOwn -> first; the IsReported guards in windowHolds,
buildGatewaySessions, buildVias, budget.counts and loggedAnswers.
- GUI: the fourth cell, the --vias column count and the badge class.
Not shown red on its own: the remote-no-key and evil.example refusals come
from lanGuard and corsGuard before the handler, so breaking only the
handler's own check stays green. The codex_memory guard is not tested
alone: a reported row has no Requested there anyway. Not tried: a real
client against a live gateway, Windows/Linux runs of the tests, the full
GUI suite.
|
||
|
|
5756651e3b |
readme: the architecture diagram shows each agent's and provider's real logo
The owner asked for real logos on the agents and the models. Each agent row now carries its own mark (Claude Code, Codex, Gemini CLI, OpenCode), the "+ 40 more" row shows Zed, Cursor, Cline and Goose, and every provider name sits behind its logo (DeepSeek, Kimi, GLM, OpenRouter; Claude, ChatGPT, Copilot, Gemini; Ollama, LM Studio). The marks are inlined from internal/gui/assets/icons, the same files the GUI shows, with their gradient ids prefixed per use so the four copies don't clash; monochrome marks follow the theme's ink. Text and chip widths are now measured from SF Pro rather than estimated per character. Run: rendered all four SVGs in headless Chrome on #fff and #0d1117 at 2x and at the README's 880px width; no overlaps, every logo resolves. |
||
|
|
77a3deaed2 |
readme: the architecture diagram is a drawn picture in both themes, not a mermaid flowchart
The mermaid "How it fits together" / 整体结构 chart rendered as grey boxes in GitHub's default style. It is now four hand-made SVGs (en/zh × light/dark) under site/public/img/architecture*.svg, shown through <picture> with prefers-color-scheme: - agents on the left (the 40+ others as a dashed row), providers on the right, joined by curves into one magpie card; - the magpie card is inverted (black in light, near-white in dark), with the logo, 127.0.0.1:3425 in a mono face, and the gateway → routing groups → plugins stages on a rail, the four protocols as chips; - system font stacks only, since an SVG in <img> loads no web fonts. Run: rendered all four in headless Chrome on GitHub's backgrounds (#fff, #0d1117) at 2x and at the README's 880px width; checked no text overlaps or is clipped and the shadows aren't cut by the viewBox. Both READMEs no longer contain a mermaid block. Docs-only. |
||
|
|
5c82e6880d |
site: every sponsor link goes through usemagpie.ai/go, so its clicks are counted per place
The home page's "Sponsored by" cards and the READMEs' Sponsors logo linked the sponsors directly, so nothing told the owner how many clicks each seat brought. They now link /go/<id>/home and https://usemagpie.ai/go/<id>/readme. site/sponsors.js holds where each sends the browser (the sponsor's own ref link, unchanged: APINEBULA has one per place). The worker counts a GET as "magpie sponsor go" {id, where, country} in PostHog, beside the in-app partners' "magpie partner go" (whose /go links were already counted), and a HEAD goes on uncounted. A partner's keys/site links are tried first; a sponsor link takes no region. A test fails if index.html or either README links a sponsor's own URL directly, or names a /go link sponsors.js doesn't have. Run: node --test site/worker.test.mjs (20 pass) and site/install.test.mjs (10 pass). Broke it by hand: README.zh-CN.md back on the direct link turns the guard red. Deployed (version e4f40cff); curl on usemagpie.ai: /go/apinebula/readme → 302 apinebula.ai/ref/qmXqFGpr, /go/apinebula/home → 302 apinebula.ai/ref/Gs54HwyB, /go/yylx/home → 302 yylx.io/?ref=magpie, /go/yylx/readme and /go/apinebula/home/x → 404; / and /zh/ serve the /go hrefs. Not checked: the events arriving in PostHog (the worker's key can't read). |
||
|
|
7a9490638d |
gateway, gui, settings: an IP / CIDR allow list for the gateway, from MAGPIE_ALLOW_IPS or Settings beside Share on local network (lc on Discord)
What changed: lc runs magpie in Docker on a public host and asked that
only some addresses reach it at all. With a list set, a request from an
address outside it is refused 403 ("magpie answers only the addresses on
its allow list ..., and this request came from <addr>: add it there to
let it in") before its gateway key is looked at, so a leaked key is no use from
elsewhere. No list is as before.
- internal/settings/allowips.go: SplitAllowIPs, ParseAllowIP (an IP or a
CIDR range, v4 or v6; zones dropped, v4-mapped unmapped), CleanAllowIPs.
Settings gets AllowIPs (allowIPs).
- internal/gateway/allow.go: MAGPIE_ALLOW_IPS (comma or space separated)
sets the list in place of Settings'. The address judged is the
connection's own (r.RemoteAddr); X-Forwarded-For and the rest are never
believed (magpie has no trusted-proxy list; MAGPIE_TRUST_PROXY never
reads forwarding headers, and this follows it). Loopback and this
computer's own interface addresses always pass. An entry that doesn't
read lets nothing in and is logged once, so a typo never opens magpie
to every address. lanGuard checks it after the OAuth callback and
before the rebound-Host and key checks; `magpie web` is wrapped with
AllowGuard too.
- GUI: Settings > Network shows an "Allowed addresses" row under Share on local
network when sharing is on, the page is open from another computer, or
the env var is set (then read-only, saying so). POST
/api/settings/allowips saves it, refuses it while the env var is set,
refuses an entry that doesn't read, and refuses a list that would shut
out the address the page itself is open from (KeepsOut). The generic
settings save keeps AllowIPs. Strings in zh, zh-TW, ja and de.
- Docs: the Docker page (en, zh, ja) lists MAGPIE_ALLOW_IPS with a note
that a request from the host itself arrives from the bridge's gateway
(172.17.0.1), that Docker Desktop and rootless Docker show clients as
one address of their own, and that behind a proxy every request comes
from the proxy; docs/reference.md and docs/subsystems/gateway-routing.md
describe it. The READMEs list no env vars, so they are unchanged.
Why: a gateway key is the only lock on a public host; an allow list keeps
everyone else from even trying it.
Run (machine load average 75-140 from other sessions, so the large
packages ran in slices of their top-level tests, each slice
-timeout 9m, private GOCACHE, sandbox HOME):
- New tests: internal/gateway/allow_test.go TestAllowList (allowed,
denied, CIDR v4/v6, IPv6 literal, link-local with zone, v4-mapped,
loopback and own address always in, on the list still needs a key,
a typo shuts everything out, env over settings), TestAllowListServed
(a real connection from loopback passes lanGuard under a list naming
nothing of this computer's; a request from elsewhere is 403 naming its
address and MAGPIE_ALLOW_IPS), TestKeepsOut; internal/settings/allowips_test.go
TestCleanAllowIPs; internal/gui/allowips_settings_test.go
TestAllowIPsSetting; internal/gui/tests/allow-ips.test.cjs (14/14 in
chromium and webkit, at a 390px panel, en and zh, keys in zh, zh-TW,
ja and de). Broken by
hand: with lanGuard's check removed TestAllowList and TestAllowListServed
FAIL; with KeepsOut skipped TestAllowIPsSetting FAILs; with renderAllow
not called the GUI test has 5 failures. Restored, all pass.
- internal/gui/settings_keep_test.go gains AllowIPs:
TestSettingsSaveKeepsWhatItDoesNotSend failed without it, as it should
for a new field.
- go test -tags nogui: every package ok. internal/gateway (4 slices),
internal/agent (4), internal/provider (3), internal/gui (2),
internal/plugin (2), the rest whole. GUI Network-settings test files
(11) 98/98 and i18n-keys ok, both engines.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... ok; linux and windows builds ok.
- Not tried: a real Docker container on a public host (the bridge note
is from Docker's docs, not checked here); behind a real reverse proxy.
|
||
|
|
908c910931 |
gateway, gui: Stays: Strict keeps a conversation on the account or key that answered it, even past its cap, and passes its error on rather than moving it (#1797)
miniers asked that a conversation never move to another account: a
move changes the account a vendor sees mid-conversation and loses its
prompt cache. Session affinity keeps the account while it can answer,
then moves on.
The new affinity mode "strict" (Stays: Strict) does what session does
for a new conversation. Once one has an account, strictKeep asks that
account alone (its other models too) and no other account, key or
provider:
- one resting or spent is still asked, and its error (429, 402, 5xx)
goes to the agent rather than to the next candidate;
- one over a user cap is asked past it (plan's capped candidates,
capHeldOnly);
- one held for credits answers 429 naming Stays: Strict rather than
moving;
- one removed, turned off, barred or not allowed for the key counts as
gone, and the conversation is routed as usual.
A last try that fails verification is not rested for a strict
conversation that had nowhere else to go.
Set in the provider editor and the Routing page's pool row (GUI, all
five languages), `magpie groups ... stays=strict` (strict-session,
never-move), and the TUI ("stays strictly"). Documented in
gateway-routing.md, reference.md and the site's start pages (en, zh,
ja).
Run:
- go test -tags nogui ./internal/gateway (-timeout 30m under load ~150),
./internal/provider ./internal/tui ./internal/cli: ok. The three
TestStrictAffinity* tests fail on the code before this commit (200
where 429 was expected, acct-2 answering).
- GUI: stays-strict.test.cjs, chromium and webkit, 900 and 560px, en,
zh, zh-TW, ja, de: 30 of 30. On the assets before this commit it
fails 15 of 15 in chromium. routing-*.test.cjs pass but for
routing-steady's webkit 1.69px shift, which fails on the old assets
too: filed as #1804.
- gofmt -l, go vet (darwin, linux, windows), full go test ./... before
the push.
Not tried: a real agent conversation held on a real rate-limited
account.
Known and left: planLevel doesn't merge a nested group's sub.held, as
before this commit.
|
||
|
|
0738154520 |
plugin, gui: an installed plugin's row and page show its own magpie.icon, not its first provider's (#1775)
peterroe's plugin signs in to several providers. Each provider gets its own picture from the auth hook, and package.json's magpie.icon is the picture for the plugin itself. Settings → Plugins → Installed only took a plugin picture from the market listing. A plugin that isn't listed (installed from a path, git or an unlisted npm package) had none, so its row and its page showed its first provider's picture. - plugin.InstalledIcon reads magpie.icon from the installed package.json. It goes through the same ownIcon check as a listing's icon (data: or https only). - pluginsState stores the picture through provider.RepoIcons, as listed plugins' pictures are, and returns it as `icon` on each plugin entry. - plugins.js: the installed row and the detail page use the listing's icon, then the plugin's own, then its first provider's, as before. - Docs (en, zh, ja): magpie.icon is the plugin's picture (Discover card and Installed row) and the fallback for providers without their own. A plugin of several providers gives each provider auth.icon. Run: - go test ./internal/plugin ./internal/gui: ok. TestPluginsStateGivesThePluginsOwnIcon covers a data: icon (kept), no icon and a plain-http icon (both ""). - internal/gui/tests/plugin-own-icon.test.cjs: Chromium and WebKit, en, zh, zh-TW, ja, de, at 980 and 420 wide. It fails on the old plugins.js (the row shows pa.png). - The plugins GUI tests: 34/34 in each engine. - gofmt; go vet darwin, windows, and linux -tags nogui. - Full go test ./...: the only red is gateway OTel timing under load ~79. That's #1794, commented there; alone it passes 3/3. Not tried with peterroe's real package; the fixture follows the layout the issue describes. |
||
|
|
bfaedf1830 |
gui, profile: the profile in use is ticked and named on the panel's Profiles button, not a count read as its name (superhtoooth on X)
superhtoooth (macOS): 保存方案设置了方案名字,但是应用方案没有用这个名字。
menu 里面变成了方案 1,方案 2。而且在应用里面没有显示当前使用的方案.
The bug: the tray panel's Profiles button showed the number of saved
profiles next to its label ("方案" + "2"), which reads as a profile
named 方案 2. Profiles were saved and applied under the typed name all
along; nothing anywhere said which profile was in use.
What changed:
- profile.InUse: a profile is in use while applying it would change
nothing on this computer - every detected agent's saved field is as
the profile has it (compared with the same renamed-ref spelling Apply
writes), its model lists are held (provider.ModelListsHeld, a dry run
of SetModelLists via the extracted putModelLists) and its library
setup is as saved (library.Holds, the mirror of Restore). A profile
that touches no agent here is not in use.
- Why not "last applied": that would stay ticked after the user changes
a model by hand, a tick that lies. With this definition a profile
saved from the current setup is in use at once, a hand change clears
the tick, and applying puts it back. Two identical profiles are both
ticked; the button names the first.
- GUI: /api/state carries inUse. The panel's button names the profile
in use (a pop-up button showing what is picked), else counts them as
before; its chip gets a check mark and aria-current, in panel and
window; the chip's tooltip and its details say "In use" (string
already in every language). CLI `magpie profiles` marks it, the TUI
notes "in use". Docs (reference, start en/zh/ja) say so.
What was run:
- go test ./internal/profile (new TestProfileInUse: save, hand change,
apply, hidden model list, library instructions, absent agents) and
./internal/gui (new TestStateProfileInUse through the HTTP handler),
scratch HOME. Broken by hand: field compare, ModelListsHeld,
library.Holds and state's InUse each turned a test red.
- go test -tags nogui ./... in a scratch HOME (the four slow packages
rerun with -timeout 40m under load ~45).
- GUI: new profile-in-use.test.cjs (reporter's steps in the panel at
360px, every language, plus the window) and panel-profiles,
profile-confirm, profile-details, old-webkit, i18n-keys, gui-zh-tw,
gui-ja, gui-de in chromium and webkit: all pass. Old app.js fails the
new test.
- Real CLI in a sandbox HOME with a codex config: save/use/profiles
show the mark, and it goes after a hand edit.
- gofmt; go vet darwin, linux (nogui), windows.
Not tried: the real tray app with real agents, and Windows/Linux at
runtime.
|
||
|
|
217d2f8f20 |
site, readme: APINEBULA joins the sponsors, a card on usemagpie.ai and a small logo under the README badges
APINEBULA paid for the website seat and the en/zh README seat. The logo is the SVG they sent (143x37). A white-text copy is used on dark backgrounds, through .for-light/.for-dark on the site and <picture> in the READMEs (the .bird invert would turn the orange mark blue). The site's sponsor cards now stack in an equal-width grid, so the two cards line up; the intro has zh, ja and de strings. Run: site worker and install tests (28 pass). The home page served locally and checked in chromium and webkit, at 1200 and 390px, light and dark, in en/zh/ja/de (dictionary applied in the page): both logos load, the right one per theme, and there is no horizontal scroll. |
||
|
|
0fcf563e61 |
routing: a pause rule can hold by folder, in some or outside them (#1606, Ti800)
Ti800 keeps a subscription's quota for one long task in one folder and wants every other request kept off it (their option A). A pause rule held by hours, days and agents only; it now holds by folder too. What changed - provider.Rule gains ExceptFolders (json exceptFolders, CLI except-folders=, aliases except-folder/not-in/outside): the folder the agent works in is in none of them. An agent that says no folder isn't known to be in one, so except-folders holds for it; folders= still never matches an unknown folder. Both conditions are allowed on send-to and pause rules (Rule.ByFolder, inFolders); cleanRules cleans and dedupes both and lets a pause hold by time, days, agents and folders. - PausedOut takes the request's folder. The gateway reads it (workDir) only when a pause by folder is on the way (PausesByFolder); embeddings and System One's decision calls pass none. Paused carries Folder and ByFolder for the trace. ruleFor reads the folder for except-folders rules too. - Group sharing drops every rule by folder, except-folders included. - CLI usage, TUI hint, ParseRule/Line round-trip except-folders. - GUI: the rule editor has a "not in folder" condition beside "in folder", both shown on a pause and kept when a rule turns into one; a folder that isn't a whole path and a pause with no condition are refused; the group's rule and the trace say "not in …", and a paused reason says the folder read or that the agent said none. Strings in zh, zh-TW, ja, de. - Docs: gateway-routing.md, site start.html (en, zh, ja). What was run - go test -tags nogui ./internal/provider ./internal/gateway (folder, pause, share, rule tests); full go test ./... before pushing. - Broke it by hand: with the gateway's folder read replaced by nothing, TestPauseByFolder fails (in-task requests went to the other member). - GUI: routing-pause-folder.test.cjs (new), routing-pause, routing-folder, i18n-keys and 10 other rule-editor tests in Chromium and WebKit, en/zh/zh-TW/ja/de, at 1100px and 390px. - gofmt -l; GOOS=linux and GOOS=windows go vet of the touched packages. Not tried: a real Claude Code subagent's request against a live group; by the documented rule a request without a folder is paused off the kept member, which is what the reporter asked for. |
||
|
|
6f1b432759 |
provider, gui: smart routing spends WorkBuddy credits that expire soonest first (cdredfox on X)
WorkBuddy's Credits window had no reset, so in a Smart group every WorkBuddy account ranked alike. workbuddy plugin 0.1.14 (plugins f0274d6) reads WorkBuddy's own package lists (billing/meter/get-user-resource-paid- packages and -free-packages, the calls WorkBuddy's client makes) and reports on the Credits window when the soonest-ending package that still has credits ends (runsOutAt) and how many credits it holds (runsOut). The daily Free Plan slice (CapacityType 4) and code 001 aren't counted: they renew daily. magpie carries runsOutAt from the plugin's usage window into QuotaWindow and the routing Limit. Allowance.Renewal, which only Smart ranks on, treats it as the window's reset when it is sooner than the real one. Pace, the tiers, For, Full and resting are unchanged. The mover's min is raised to 0.1.14 so moved users get the plugin. The usage card and account meter say "232.4 expire in 5h" in every language. Run: - plugin: bun test, 63 pass; 2 of the 3 new tests fail on 0.1.13's index.mjs. Verified live on a workbuddy-ai account in a sandbox HOME: Bonus Pack 232.4 left ending 10-12T16:39Z ranked before Pro (10-28). - TestWorkBuddyCreditsRunOutForRouting and TestSmartSpendsWorkBuddyCreditsRunningOutFirst: both fail with the Renewal change removed by hand. - GUI: credits-run-out.test.cjs in webkit and chromium, 5 languages, at 360/440/1000px, red on the old app.js; with i18n-keys, quota-*, panel-usage, reset-each-title, usage-fold: 117 pass. - go test ./... green (agent and gateway rerun with -timeout 30m after the default 10m ran out under load from other sessions; 378s and 492s). - gofmt -l clean; GOOS=linux and windows go vet of provider, plugin, gateway clean. Not tried: the CN workbuddy site (its token was stale, 401), so the CN package list is assumed to have the same shape. The built-in WorkBuddy (not moved users) doesn't get this. The account-line tooltip has no GUI test of its own. |
||
|
|
35eea09464 |
gateway: a provider routed its own way keeps that order inside a group that routes another way (kchen0x on X)
kchen0x had a Smart routing group with Antigravity (9 accounts, set to 按顺序) and a Business account. Requests still went to the 9th account, the one renewing soonest. planLevel pooled every member's keys and accounts into one list for any group not routed in order, so the provider's own routing was never read; Smart then put the soonest renewal first. Now a member whose provider routes other than Smart, and other than the group does (ownRouting), is planned as a nested group already is: a unit weighed by the first account or key it would try (firstAwake), then tried whole in its own order. A provider left on Smart is pooled as before. leastHeld, which reorders a rotate group's first request, leaves such a group alone as it does one holding a nested group (without that, a rotate group still came back "k2 k1 k3 kb"). GUI hint (GROUP_NEST, 4 languages), start docs (en, zh, ja) and gateway-routing.md say so. Run: - TestProviderKeepsItsOwnRoutingInAGroup covers outer Smart, rotate, usage, pace and manual, plus a Smart provider still being pooled. On the old planLevel it fails with "k3 k2 k1 kb" (the reported order). - go test -tags nogui -count=1 -timeout 40m ./...: all ok. - gofmt -l clean; GOOS=linux and GOOS=windows go vet ./internal/gateway. - GUI: i18n-keys, gui-ja/de/zh-tw and every *group*/*routing* test, both engines: 765 pass. A first run beside the full go test had 9 webkit timing reds (routing-group-fold, routing-keys-fold, routing-ctx-still, gateway-key-groups); each file passes alone, and the whole set passes when nothing else runs. |
||
|
|
642bea3a99 |
gui, tui, provider: Remote magpie has a heading of its own in the Add sheet, Another computer's magpie, after On this machine, not among the Relays (Avalon on Discord)
Avalon on Discord (v0.1.1168): "供应商添加中没有Remote magpie 的选项". It was
there, filed under Relays (中转), where nobody looks for another computer's
magpie, since it isn't a relay.
The preset is now of its own kind, KindRemote ("remote"), declared after the
local presets. Kind only groups presets for display: the GUI's add sheet,
`magpie presets` and the TUI's add list; makerCatalogs (vendors only) and
the import matcher (skips local) are unchanged for it, as it has no URL.
- GUI: a fourth section after On this machine, "Another computer's magpie"
/ "shared on its network" (zh 另一台电脑上的 magpie / 在它的局域网上共享,
zh-TW, ja, de too). A preset's note is now also found in the words it is
shown in, and the zh/zh-TW/ja note begins with 远程/遠端/リモート, so 远程
finds it as remote and magpie do.
- TUI: the add list says "Remote magpie · another computer's magpie, shared
on its network" instead of "· relay" (kindNote).
- CLI: `magpie presets` lists it under "another computer's magpie".
- Docs: reference.md, subsystems/providers-accounts.md and the site's
remote page (en, zh, ja) say where the tile is.
Run:
- remote-magpie.test.cjs gains "Remote magpie has its own heading in the
add sheet" (420px, en and zh, Chromium and WebKit): the heading and hint,
right after On this machine, Remote magpie under no other heading, no
sideways scroll, and remote / magpie / 远程 each find it alone under its
heading. With the old app.js it fails "no heading of its own" in both
engines and languages; with only the note search taken out, zh fails on
远程. Its older test now wheels the sheet to the tile (now the last row;
a scroll from code is put back by the page's guard, which made it flaky
in WebKit at 700px): 8 of 8 WebKit runs green.
- TestTUIAddListSaysRemoteMagpieIsAnotherComputers fails on the old note
with `listed as "Remote magpie · remote"` (and "· relay" before the kind).
- Every GUI test that opens the add sheet (40 files) plus gui-de, gui-ja,
gui-zh-tw and i18n-keys, in Chromium and WebKit: all pass.
- site worker.test.mjs passes.
- gofmt -l clean; go vet -tags nogui on ., internal/provider, internal/tui,
internal/gui for darwin, GOOS=linux and GOOS=windows.
- go test -tags nogui -timeout 40m ./... under a temp HOME: all 48 packages ok.
Not tried in the real Wails window.
|
||
|
|
c05dd8b6fb |
provider: Tencent Cloud has Token Plan 企业版 as a region, Enterprise plan · China and · Global (#1574, undirectlookable)
#1574 asks for Tencent Cloud Token Plan's usage through TokenHub's DescribeTokenPlan API (api/1823/132270). That API covers Token Plan 企业版, the team plan, only. magpie's Tencent Cloud preset knew the personal plan (api.lkeap.cloud.tencent.com/plan) and TokenHub's pay as you go, not the enterprise plan, so a provider at it had nowhere to sit. The preset gains two regions, after the old three so imports and links are unchanged: - enterprise: https://tokenhub.tencentmaas.com/plan/v3 (chat completions and Responses) and /plan/anthropic, Guangzhou. - enterprise-intl: the same paths on tokenhub-intl.tencentmaas.com, Singapore. Both use the plan's docs (product/1823/130659, 131173 for the 轻享套餐, same endpoints) and the Token Plan console as the key page. Their model lists are the doc's tables for each site, with the three GLM models it says went away on 2026-10-09 left out, and without the deepseek/… ids. An entry imported at those endpoints, a magpie://import link with region=enterprise(-intl) and a provider moved there in the editor land on the region; TokenHub's pay as you go at the same hosts stays at its own. The site's import pages (en, zh, ja) list the two regions, and the region names are translated in zh, zh-TW, ja and de. Run: go test ./internal/provider (TestTencentCloud, TestTencentCloudEnterprisePlan, red before the regions), gofmt; GUI tencent-cloud.test.cjs in Chromium and WebKit, en and zh, 8/8. Not tried with a real enterprise plan key: we have no Tencent Cloud account. |
||
|
|
ae70d8eac8 |
routing: a group's rule can hold by the folder the agent works in (Cario0x on X)
Cario0x on X asked to route by the project being worked on. A group's rule now has a "folders" condition: it matches when the request's working folder is one of the listed folders or inside one. It combines (AND) with the existing conditions: tokens, images, intent, time, agents and quota. - gateway/workdir.go reads the folder each agent states in its own request: - Claude Code: "Primary working directory", including "(was …)" after a move. - Codex: <environment_context><cwd>. - Pi: <cwd>. - OpenCode: <env> "Working directory". The last one stated wins. Assistant text and tool results are ignored. A request that states no folder matches no folder rule: unknown, never empty. - provider/rulefolder.go matches a folder only at a path boundary. - ~ is the home folder. - C:\x is the same folder as /mnt/c/x, and \\wsl$\Distro\x as /x. - Case is ignored on macOS and Windows, and always for a drive. - A rule's folder must be a whole path. Pause rules can't have folders. - The trace's RuleHit.Folder makes the Routing page say "The agent works in …". - GUI: an "in folder" condition in the group editor, hidden on pause rules. Strings in zh, zh-TW, ja and de. - CLI: `magpie group rule add … folders=~/oss,"~/My Project"`. The TUI shows the condition. - Docs: docs/subsystems/gateway-routing.md and site start.html (en, zh, ja). Fixtures are real requests from Claude Code 2.1.296, Codex 0.162.0 and Pi 1.1.0, run in a sandbox from a folder named "a&b <c> 中文" or "My Proj", with the sandbox path replaced. Run at this head: - go test ./... green. - gofmt -l clean. - go vet green for darwin, GOOS=linux -tags nogui and GOOS=windows. - GUI routing-folder.test.cjs: chromium and webkit, en, zh, zh-TW, ja and de, 1100px and 390px (no horizontal scroll). It fails on the old routing.js. - Related routing, group and i18n GUI tests: 85/85. - Full GUI suite: 5611/5631 under --test-concurrency=6. Rerun alone, every failure passes except: - skill-install-agents-all (chromium, 420px), which is red on origin/main too: #1554. - The menu-scroll track flake, which flakes on main as well: #1550. - e2e: a sandbox HOME, a dev build and fake upstreams, with real Claude Code 2.1.296 (`claude -p --model group/fd`). - From proj/acme/web, rule 1 matched and the request went to kb. - From proj/acme-old, no rule matched and the request went to ka. The trace and UI showed the folder. |
||
|
|
26816de2f9 |
library, agentplug: an agent a plugin adds is given the Library's instructions, MCP servers and skills where its agent.library says (AlmarionAI on X)
Agent plugins wired models and keys only: library.targetOf had no case
for them, so the Library's instructions, MCP servers and skills never
reached an agent a plugin adds, while the announcement said the
Library carries over.
An agent export can now say
library: { instructions, mcp, mcpFormat, skills }
each a path (~ and $VAR expanded, as config is). mcpFormat names the
agent whose MCP file it is shaped like (agentplug.MCPFormats: claude,
codex, gemini, opencode, cursor, zed, ... 18 of the library's
mcpFormats). A format outside the list, or an mcp without one, keeps
the plugin from loading. library.pluginTarget makes such an agent a
Target, so it is written as any agent is: magpie's marker block in the
instructions file, servers merged beside the user's own (their fields
kept), skills linked or copied, Applied recording only magpie's part,
backups kept. Takes refuses a place the plugin doesn't name, and says
which agent.library key would give it.
Docs: docs/subsystems/library.md and agent-wiring.md; plugins.html
(en, zh, ja) gets the library field and what magpie does with it.
Run:
- internal/library/agent_plugin_test.go: TestPluginAgentGetsTheLibrary,
TestPluginAgentWithoutAPlaceIsRefused, TestPluginAgentMCPFormat,
TestPluginMCPFormatsAreWritten. With targetOf's plugin case and the
check() validation taken out by hand, the first three go red.
- e2e: a nogui build in a scratchpad HOME (env -i, no live configs),
`magpie plugin add` of a throwaway toy agent plugin; `library
instructions set/agents`, `library mcp add/rm` wrote and took back
only magpie's block and server, the user's "mine" server, its "note"
field and other keys kept, backups made; with mcp dropped from the
plugin, `library mcp add ... agents=toy` is refused naming
agent.library.mcp.
- go test -tags nogui ./... (one unrelated FIFO flake in internal/agent,
fixed in the commit before), gofmt -l clean, go vet for GOOS=linux
and GOOS=windows clean. No GUI code changed.
|
||
|
|
8c5b9f928d |
provider, agent, gui: subscription accounts can be turned off, and then no agent's sign-in is read (#1535, MaxHaiCom)
What changed: Settings → Privacy → Subscription accounts (On/Off), `magpie accounts discovery [on|off]` and MAGPIE_NO_ACCOUNTS=1 turn off account discovery. It stays on by default. While it is off, magpie reads none of the agents' sign-ins: ~/.claude/.credentials.json, .claude.json's account, ~/.codex/auth.json, Copilot's, Cursor's, Devin's, Kiro's, Gemini's, ZCode's, Command Code's and OpenCode's files. It runs no `security` / `secret-tool` for the Keychain or Secret Service, and asks no agent CLI who is signed in. It serves no subscription. API-key providers, middleware plugins and Pi extensions work as before. Why: the reporter runs magpie on machines where reading other tools' credentials isn't wanted. The owner delegated the call. How: settings.NoAccountDiscovery (kept per computer by KeepOwn) and settings.AccountDiscoveryOff(). The variable only ever turns discovery off. The gates sit at every reader (readAccountFile, discoveryOff) and at every route that reads or writes a sign-in, so a route that skips Accounts still reads nothing: - Accounts, All, Logins, usage, renewal, warm-up, session identities, check-ins; - switching, forgetting, SetLoginOn, StartSignIn, the imports; - moves onto plugins. The ones that write refuse with an error that names how to turn it back on. On the agent side, Agent.Source and OpenCode's auth.json are gated, and Codex wiring goes by magpie's stash instead of auth.json, so a toggle never rewires Codex. logins.json and plugin-auth.json are left untouched and serve again when discovery is turned back on. A change applies at once (ForgetAccounts). Docs: providers-accounts.md, README (en, zh-CN), and the site's CLI table (en, zh, ja). Run: - TestAccountDiscoveryOffReadsNoSignIn (provider) and TestAccountDiscoveryOffAgentsReadNoSignIn (agent). Every credential path is a FIFO that records each open, and security, secret-tool, claude, codex, cursor-agent, devin, kiro-cli, copilot and grok are fakes on PATH. Both fail with the gate removed: they show the opens and `security find-generic-password -s Claude Code-credentials`, among others. Both pass with the gate in place. - TestAccountDiscoverySetting and TestAccountsDiscoveryCmd. - account-discovery.test.cjs: chromium and webkit, 900 and 360 wide, en/zh/zh-TW/ja/de, 32/32. The neighbouring privacy, redact, settings-sections and i18n-keys GUI tests: 49/49. - The full `go test -tags nogui ./...`, gofmt -l, and go vet for darwin, linux and windows on the touched packages. Not tried: a real machine under fs_usage, and Linux and Windows at runtime. The FIFO tests are !windows. |
||
|
|
f04792f906 |
icon: remote icons are fetched through usemagpie.ai/api/icon, so their hosts never see the user's IP
A plugin's package.json icon, an import link's icon= and the library's market icons sit on hosts their authors pick. magpie fetched each straight from there, so an author could log the IP of everyone who opened Discover or the library. The owner asked for icons to keep showing without that. - site/worker.js: /api/icon?url=<https URL> fetches the picture from Cloudflare with only Accept: image/* and its own User-Agent, follows redirects, caps it at 1 MB (the app's MaxIcon), passes on only PNG, JPEG, GIF, WebP, ICO or SVG (by bytes, as StoreIcon), and counts and keeps nothing. It refuses http, userinfo, a non-443 port and usemagpie.ai itself; 404s are cached 5 minutes, 5xx not at all. - internal/iconproxy: URL(u) is the proxied address (MAGPIE_ICON_PROXY for tests); a picture already on usemagpie.ai is asked for as it is. - provider.FetchIcon (plugin, import link and partner icons) and library.fetchImage (market icons, avatars) fetch through it. The import link's checks (https, public host) still come first; there is no direct fallback. provider.FaviconFor still reads the user's own provider's site directly: they already send it their requests. - Privacy text in README en/zh, docs/reference.md and site docs start/import in en/zh/ja says so. Ran: - node --test site/*.test.mjs: 28 pass. The new test asks with Cookie, UA, X-Forwarded-For and CF-Connecting-IP and checks only accept and user-agent go upstream; 415/413/502/400 cases; its fetch stub throws instead of reaching the network. With the usemagpie.ai refusal removed by hand it goes red (27/1). - TestFetchIconGoesThroughTheProxy and TestIconGoesThroughTheProxy (author host is .invalid; an httptest server stands in for the proxy): with the proxy taken out by hand both go red (provider: lookup author.invalid; library: the proxy was never asked), green restored. - go test ./internal/iconproxy ./internal/provider ./internal/library ./internal/gui: ok. gofmt -l clean; go vet darwin (those four), linux (iconproxy, provider, library), windows (all four): clean. |
||
|
|
7af45761f7 |
plugin, gui: a plugin from a git repository shows Update only when its repository has new commits (ARNO on Discord)
ARNO installed opencode-codearts-auth as github:yuweihao17/codearts. Its row
on Plugins always had an Update button, and still did right after updating
it to the newest commit. The page drew Update for every git plugin whatever
its commit, since npm has no version to compare for one, and nothing asked
the repository.
|
||
|
|
a98ab77fde |
gui, gateway: a context window's part, cell or item clicked opens the text the request sent there (masaka)
masaka on Discord asked to see the whole context behind the context window
card: click the agent's prompt, or any other part, and read it.
What changed:
- gateway: the trace keeps the last 10 request bodies in memory only
(promptBodies; at most 32 MiB each and 64 MiB together, oldest dropped
first), masked as the vendor got them. For a model the user let have
the request unmasked, the masked copy is kept all the same. Never
written to disk, never in telemetry. Route.Prompt and the routing
history keep names and sizes only, as before.
- gateway: Server.PromptText re-reads a part's items and their text from
that body (prompt_text.go). promptBuilder gains a keep mode that records
each item's pieces: system text, tool definitions laid out as JSON, each
turn's user/thinking/assistant/call pieces, tool results, and images
or sealed reasoning named with their size. Sizes are unchanged.
- gui: GET /api/context/text?id=&kind=[&item=] (no-store; 404 "not kept"
when the body is gone or another process serves the gateway).
- gui: in the card, a legend part, a waffle cell or a content row
(click, Enter or Space) opens a wide modal: one item alone with "All of
{part}", or the part's list 100 rows at a time, each item's text
fetched when it is opened and shown 20000 characters at a time, with
copy buttons. Strings in zh, zh-TW, ja and de.
- docs: gateway-routing and gui-shell subsystem pages; the site's start
page (en, zh, ja) says the text is kept for the last 10 requests in
memory and sent nowhere. The README Privacy is unchanged, since nothing
more is sent.
What was run:
- go test -tags nogui ./... (temp HOME). internal/gateway hit the 10m
default under the full parallel run, in TestRequestTailAfterOldLimit,
which takes 57s alone on the base commit too; the package run alone
with -timeout 30m: ok (700s, the machine shared with other runs). Every other package: ok.
- New tests TestPromptTextIsWhatWasSent, ...KeepsOnlyTheLastBodies,
...ChatPieces, TestContextTextAPI. Broken by hand: keeping the unmasked
body fails (the key shows), and dropping keepBody fails ("not kept").
- gofmt -l; go vet, GOOS=linux and GOOS=windows go vet on internal/gateway
and internal/gui.
- GUI: tests/context-text.test.cjs in Chromium and WebKit, en/zh/zh-TW/
ja/de, at 1100 and 420px: legend, row, cell and keyboard open the text,
long text grows on demand, the page never scrolls, and a gone body is
named. It fails with the click wiring removed. Under a load average of
~140 one case failed once: the test read the list while the dialog
still said "Reading…". Reproduced with a 400ms reply, fixed by waiting
for the list; the mock now always answers after 200ms. A second case
("a click doesn't move the page", 662 vs 605 on the contents row) came
from taking the page's top while a wheel scroll was still easing: the
test now wheels to the row like the other cases, and wheelTo waits for
three equal looks. Four full runs at load ~150 then passed (80 cases). context-window,
i18n-keys, held-animations and the modal tests (dialog-backdrop-drag,
editor-short-window, readable-focus, ux-safety, whats-new, add-sheet,
api-key-theme) pass in both engines.
- Real use: a sandbox magpie (own HOME, ports 3486/3487, the Codex login)
served a real `claude -p` (Claude Code) request on codex/gpt-6-luna
that read a file. In its web UI, Usage > Context: each of System
prompt, Tools, Memory, Files and Conversation, a waffle cell and a
contents row opened the request's real text (Claude Code's system
prompt, 21 tool definitions, the CLAUDE.md reminder, main.go's Read
result, the turn with its thinking and call). No page errors.
|
||
|
|
4b2f2ec31e |
provider, plugin: a plugin can serve System One for its provider, and the models it marks are a routing group's classifier (#1514, FourLeafTec)
A plugin had no way to say its provider answers TypeSafe's System One,
so a free decision model a plugin reaches (mu-zi-lee/magpie-our-free-model)
could only be listed as a chat model.
Now the plugin's config hook sets `decide: true` on the provider, and
`decides: true` on a model, in the config hook or on the models hook's
list. host.js passes both through (plugin.Provider.Decide,
plugin.Model.Decides). pluginProvider sets the provider's Decide to its
own base, plugin://<id>/v1, so System One is asked at {baseURL}/systemone
through the loader's fetch with the account's sign-in: pluginFetch sends
nowhere but the loader's host, so an address the plugin named itself
couldn't be reached. AskSystemOne now sends with Provider.Do, as the
gateway's classifier already did, so the editor's test goes through the
fetch too (Do is client.Do for every provider without an account).
decide.go treats a plugin provider's decision models as the ones it marks
plus Jev's by name (jev-*): kept from agents, refused for chat ("only
decides"), refused as a group member, offered as a group's classifier
(Deciders, DecisionModels, Jev). A mark without `decide` on the provider
changes nothing. Docs: site plugins page (en, zh, ja) and
docs/subsystems/provider-plugins.md.
Thanks to FourLeafTec, whose reference commit (bc0b3fee in their fork)
proposed the two fields and the plugin base; this is written afresh.
Run:
- internal/gateway TestPluginServesSystemOne and
TestPluginMarksWithoutDecide, through the real bun plugin host with the
fake plugin (FAKE_DECIDE). Red with host.js, plugins.go and decide.go
reverted ("Decide = \"\""), with only host.js reverted, and with only
decide.go reverted (no classifiers, offered to agents, chat to one 200).
- go test -tags nogui ./... (temp HOME): every package ok; internal/gateway
hit the 10m default at load ~140 in TestLargeRequestEndpoints, then
passed alone with -timeout 40m (548s).
- gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui on
internal/plugin, internal/provider, internal/gateway.
- Real use: a nogui build in a sandbox HOME on 127.0.0.1:3612, a local
plugin declaring decide with judge-x marked, a fake vendor on 3613.
`magpie group rule add ... classifier=dec1514/judge-x` saved; judge-x
was not in /v1/models and not accepted as a member; a turn to the group
asked /v1/systemone judge-x (levels, then intent) with the plugin's key
and its fetch's own header, then went to chat-b; chat to judge-x
answered 400 "only decides".
- No GUI change: a plugin's editor is the account editor, which has no
address fields.
Co-authored-by: FourLeafTec <5875432+FourLeafTec@users.noreply.github.com>
|
||
|
|
cc2092a4b0 |
plugin, gui: a market plugin's card wears the picture its package gives (magpie.icon from npm) when the market gives none
yetone: 这里的 agent plugin 为什么没有 logo. Aider's card in Discover › Agent showed the generic agent glyph: the registry entry has no icon, and the card only read the registry's, which is one of magpie's icon names. A GitHub-tagged plugin's card already read package.json's magpie.icon; a listed one didn't. - plugin: npm's /latest answer carries package.json, so NPM.Icon is its magpie.icon, an https URL or data:image URI only (ownIcon, now shared with the GitHub listing's check). - gui: listings, market and /api/plugins/npm keep that picture as an installed plugin's is (provider.RepoIcons) and send the page a file: icon, never the data URI or the remote URL. - plugins.js: card, plugin page and installed row use l.icon, then l.npm.icon. - Registry icons stay names, so older magpies aren't handed a URL they would draw as a broken mask. - docs: magpie.icon also shows on the Discover card (en, zh, ja). agent-aider 0.1.1 (magpie-community/plugins bcc94e5) gives aider.chat's icon as magpie.icon and agent.icon. Ran: - go test ./internal/plugin ./internal/gui; go test ./internal/provider alone (504s, pass); go test ./... otherwise ok. - gofmt -l; vet linux/windows ./internal/plugin. - internal/gui/tests/plugin*.test.cjs in chromium+webkit; plugin-agent's new check goes red (11 fail) with the card reading l.icon only. - Sandbox HOME with the real npm package 0.1.1: the Discover card, Installed row and Agents row all show Aider's icon, in chromium and webkit at 1100 and 420. |
||
|
|
3541ec2fd5 |
gateway, gui: a gateway key's limit can run every N days, and Reset usage counts it from 0 again (#1509, PennyVibe)
PennyVibe asked for a key limit on a cycle of N days rather than a
calendar day, week or month, and for a way to zero a key's usage by
hand. Both are in.
Every N days (N from 1 to 3650):
- access.Limit gains Days and Since. Since is magpie's own: the
limit-key action always works it out, and a value a client sends is
ignored.
- The cycle starts when the limit is set. Each cycle is N×24h of
absolute time from Since, so a restart, a time-zone change or a DST
shift doesn't move it.
- Changing only the caps or "count cache reads" keeps the cycle.
Changing N or the period, or turning the limit on, starts a new
cycle now.
- A hand-written "days" limit with no Since runs from the Unix epoch.
- The GUI window menu offers "Every N days" with a Days field. The CLI
takes `magpie gateway-key limit <id> 10d`. The refusal and status
name the cycle ("for this 1-day cycle").
Reset usage:
- A new action, reset-limit-key, is on the editor's "Reset usage"
button (after a confirm) and on `magpie gateway-key limit <id> reset`.
- It sets Since to now, so tokens and cost both count from 0 together.
- An N-day key starts a new cycle then.
- A day, week or month key keeps its window's end, so it stays on the
calendar. Only the calls before the reset stop counting.
- The usage log is not touched. Authenticate reloads keys each request,
so the reset takes effect at once.
Keys saved before keep their JSON byte for byte (omitzero, nothing
written on load).
Docs: reference.md documents the cycle and reset rules. The docker page
(en, zh, ja) mentions every-N-days.
Run:
- go test -tags nogui ./... with a temp HOME.
- New Go tests:
- TestLimitDaysCycle covers the NY DST, UTC and UTC+8 boundaries.
- TestLimitCalendarReset.
- TestLimitSetAndReset covers keep/restart, an old key's JSON left
untouched, and errors.
- TestKeyLimitDaysCycleAndReset covers the 429 text and header, a
restart, the cycle boundary, and Reset clearing the token and cost
caps together.
- TestKeyLimitCalendarReset.
- TestGatewayKeyLimitCLI covers 10d, reset and bad args.
- Broken by hand: with reset leaving Since alone,
TestLimitSetAndReset, TestKeyLimitDaysCycleAndReset and
TestKeyLimitCalendarReset go red.
- gofmt -l is clean. GOOS=linux and GOOS=windows go vet -tags nogui
pass on ., access, budget, gateway and gui.
- GUI: the new gateway-key-cycle.test.cjs runs in chromium and webkit ×
en, zh, zh-TW, ja and de, with a narrow-width check. Also run, in both
engines: every test using the caller-keys fixture, i18n-keys,
gui-ja, gui-de and gui-zh-tw (80 pass).
- Real use:
- Sandbox magpie (temp HOME, gateway 127.0.0.1:3691, dev UI 3692)
with a fake OpenAI upstream (300+50 tokens a call).
- `gateway-key limit <id> 1d --tokens 700` allowed 2 calls with curl,
then a 429 "for this 1-day cycle" with X-Magpie-Limit-Reset a day
after it was set.
- Pressed Reset usage in the GUI with Playwright and confirmed. The
badge was no longer spent and showed 0 of 700, and curl passed 2
calls again before the next 429.
|
||
|
|
8d95ebc8c3 |
provider: Bailian Token Plan is a preset of its own, with its decision model for routing groups; the Qwen AI platform's decision model too, and Bailian's shows Bailian's icon (#1506, IamMiao)
Alibaba sells two Token Plans, both with sk-sp- keys, and a key works only on its own host. qwen-token-plan is the Qwen AI platform's (token-plan.maas.qianwenaiapi.com), but its website and keys links pointed at Bailian's console. Bailian's own plan (token-plan.cn-beijing.maas.aliyuncs.com) had no preset. What changed: - presets: new bailian-token-plan (chat /compatible-mode/v1, Anthropic /apps/anthropic, decide on /compatible-mode/v1/systemone, models from the docs' list, shared with qwen-token-plan as alibabaPlanModels). qwen-token-plan's links now point at the Qwen AI platform. New qwen-decision for Qwen's pay-as-you-go decision model at maas.qianwenaiapi.com/compatible-mode/v1/systemone. bailian-decision shows the Bailian icon instead of Qwen's. - decide: bailianDecides also matches the bare maas.qianwenaiapi.com host. A chat preset that also decides on a Bailian/Qwen host (bailianApart) lists decision-model-preview as its only decision model, so it is offered for routing groups and never given to an agent as a chat model. - gateway: dashScope() covers bailian-token-plan and maas.qianwenaiapi.com. - CLI help, docs/reference.md and the import docs (en, zh, ja) name the new preset. Usage: neither plan's docs give a usage or quota API; the remaining quota is only on the console (百炼控制台 Token Plan > 我的订阅, Qwen 工作台 token-plan/individual), which needs a browser session. So no usage card is added. An exhausted plan's 429 insufficient_quota is already read as out of credit. Not tried against the real API: no Bailian or Qwen key was available. The stand-in is an httptest server copying the docs' systemone curl (Bearer sk-sp-, model decision-model-preview) and its error table (401 on a wrong key, 422 on a bad body). qwen-decision sends "Authorization: Bearer <key>"; the Qwen doc's curl shows the bare key, which is untested. Run: - go test -tags nogui -count=1 ./... (temp HOME) - TestBailianTokenPlan, TestQwenDecisionPreset and TestDashScopeHosts fail with the old decide.go and gateway.go swapped in - gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui on . internal/provider, internal/gateway, internal/gui - GUI: system-one, add-sheet, gateway-decide-info, routing-kind tests in chromium and webkit (20 pass) |
||
|
|
b6a263b9fd |
gateway, usage: the Usage page's numbers are read over the gateway, and a Claude Code subagent's call says which subagent and which started it (HoGee_xxl on X)
HoGee_xxl wants their own usage app to read magpie over the gateway, which had no /api/usage counterpart, and asked for subagents' parent ids. - GET /v1/magpie/usage (the /api/usage summary, ?period=) and GET /v1/magpie/usage/requests (the /api/usage/requests ledger page, same filters, offset/limit) on the gateway. The builders moved out of gui into internal/usageapi so both serve the same JSON; gui keeps aliases and sets usageapi.Clients for agent names (gateway can't import agent). Guard as /v1/magpie/quotas: this machine, or another with an enabled gateway key, behind the same Host check. A key held to a budget, models or accounts is refused the summary (403) and gets the ledger filtered to its own CallerKey, with callerKeys/agents/providers/accounts cut to its own rows (usageapi.OwnPage): those facets are drawn from every call in the period. `path` is left out for another machine. - usage.Record gains subagent and parent_agent; session stays the parent conversation. Gateway rows take them from x-claude-code-agent-id and x-claude-code-parent-agent-id; session-file rows from the file name (<session>/subagents[/workflows/<run>]/agent-<id>.jsonl, no cache version bump) and the parentAgentId of the agent-<id>.meta.json beside it. Both packed into the request page's text columns (now 29, msg at 29). Codex sub-threads: only kind, as before; no spawned thread on disk to take a parent shape from. Run: real Claude Code 2.1.296 under a sandbox CLAUDE_CONFIG_DIR against a local fake Anthropic endpoint that made it spawn a subagent from a subagent: the nested request carried X-Claude-Code-Agent-Id=a143287ac46b82a96 and X-Claude-Code-Parent-Agent-Id=a99ca20c03d1813d8, the first-level one the agent id only, Session-Id the parent's throughout; the nested meta.json had parentAgentId. Tests use those bytes. TestUsageOverGateway goes red with OwnPage, the CallerKey pin, or the header read removed (each tried). gofmt -l clean; go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...; set -o pipefail; go test ./... green. |
||
|
|
cb406c8425 |
plugins: a plugin can add an agent magpie has no setup of its own for
Plugins could be subscription providers or gateway middleware. Now a third
kind: an agent plugin, so a user whose agent magpie doesn't ship can still
put it on magpie.
- internal/agentplug: a plugin's magpie.agent module (or a *.agent.js file)
exports agent = {id, name, config, format?, model, prefix?, bin?, dir?,
ua?, icon?, notice?} and an optional connect({gateway, model, models,
agent}) returning the other keys to write. Compiled in moejs, reloaded
when plugins.json or the file changes; why one didn't load is kept.
- internal/jsmod: module compiling (imports kept inside the plugin), moved
out of middleware so both share it.
- internal/agent/plugged.go: each becomes an Agent (Plugin set) after
magpie's own. JSON, YAML and env files are edited key by key, comments
kept; what each key held is stashed typed under plugin:<id>:<path>, and
its own model or Disconnect puts every key back. A built-in id is
refused; a connect that throws writes nothing. Key magpie-<id>; usage
names it by key or ua (usage.PluginAgents).
- GUI Plugins page: an Agent kind chip and glyph, a Discover "Agents"
section (market kind "agent"), and an installed row line "Adds X to
Agents" or why it didn't load. zh, zh-TW, ja, de strings.
- Docs: site Plugins page (en, zh, ja) "Agent plugins", reference.md,
agent-wiring.md, gateway-middleware.md.
Run:
- go test ./... (all ok); gofmt -l clean; GOOS=linux go vet -tags nogui
./... and GOOS=windows go vet ./... clean.
- TestPluggedYAML, TestPluggedJSONUnwire, TestPluggedRefused.
- GUI: plugin-agent.test.cjs 22/22 (en, zh, zh-TW, ja, de; 980 and 420;
chromium and webkit); all plugin-*.test.cjs, i18n-keys,
deprecated-subscriptions, filter-ime: 315 pass, 0 fail.
- Real use, in a sandbox HOME: an Aider plugin (~/.aider.conf.yml, prefix
openai/, connect writes openai-api-base/key) installed in a dev build;
picking DeepSeek V4.1 Flash on the Agents page wired the file keeping the
user's comment and keys; real aider 0.86.2 `--message` answered through
magpie from the real DeepSeek account; usage.jsonl recorded agent aider,
provider deepseek, 200; Disconnect restored the file byte for byte.
|
||
|
|
d35d47e18a | site: AiHubMix sits beside OpenRouter in the homepage's model list | ||
|
|
ddd4f43144 |
provider: a routing group can be duplicated, from its menu on the Routing page or with magpie group copy (lc on Discord)
provider.CopyGroup(id, name) saves a copy of the group as it is now: its
models and patterns, routing, stays, rules, classifier, effort, context,
levels, and fast and off members. The copy is deep, so its rules' time
windows aren't shared. Its name is the one given, or "<name> copy", with a
number added past a name in use. Its id comes from the name, numbered past
any id in use, removed ones included. It is listed right after the group
it copies. The copy is a group of the user's and switched on, even when
it copies a found group or a switched-off one. The original is unchanged.
Surfaces:
- GUI: a group row's menu (right-click, or a click on its logos) has
Duplicate under Move up and Move down. It posts /api/groups/copy with
the id and t("{name} copy"), so the name is in the reader's language.
It asks before discarding an editor with unsaved changes. The status
then says "Duplicated {name}". No click scrolls the page.
- CLI: magpie group copy <id> [name]; duplicate, dup and clone work too.
- zh, zh-TW, ja and de strings. docs/reference.md and the site's start
page (en, zh, ja) list the command.
Run:
- TestGroupCopy (internal/gui): the copy has the models, pattern,
routing, rule and off member, is on, and is listed after the original.
The original stays off and unchanged. A second copy is "Fast copy 2" /
fast-copy-2. An unknown id is refused.
- TestGroupCopyCLI (root): the default name, a given name, a found
group's copy as the user's, and the errors.
- group-duplicate.test.cjs: Chromium and WebKit, en/zh/zh-TW/ja/de at
420px, 10/10. It fails 10/10 on the old routing.js. Siblings
group-arrange, removed-groups-menu-scroll, group-bulk-remove and
click-scroll pass 36/36.
- Sandbox CLI (sandbox HOME): group copy and duplicate made "DupTest copy"
and "DupTest copy 2", listed after DupTest.
- gofmt -l clean. go vet darwin/linux/windows on the root, provider and
gui packages: ok.
|
||
|
|
3ee97def30 |
claude: a server or container without Claude Code can have magpie download Anthropic's own build, asked first and checked against its manifest (Jorben)
A Claude subscription signs in and answers through the local `claude`, so
on a server or in the Docker image, which has none, it couldn't be used
(Jorben on Discord: could it be downloaded on first use, as Bun is).
- internal/claudecode: Anthropic's native build, as claude.ai/install.sh
takes it: downloads.claude.ai/claude-code-releases/latest names the
version, its manifest.json the platform's SHA-256 and size (linux
glibc/musl, darwin, win32). A build that doesn't match both is not kept.
It goes to <cache>/claude-code/<version>/claude, one version kept. Find
takes the machine's own claude first, then the download.
- magpie claude-code [install [--yes]|remove]: says the version, platform,
size, the URL it comes from, where it goes, that its checksum is checked
and that it is Anthropic's software under Anthropic's terms, then asks
[y/N]. magpie accounts add claude offers it when there is no Claude Code
(not on Windows, where one in WSL may be the one).
- the gateway's claudeBinary and the sign-in's claudeExecutable take
claudecode.Find; their "not installed" errors name the command.
- Docker docs (en, zh, ja): Claude sign-in needs `docker exec -it magpie
magpie claude-code install` first; kept in /config/cache.
The Dockerfile is unchanged: distroless cc-debian12 has glibc.
Run:
- go test -tags nogui ./... under a temp HOME with pinned caches: all ok
- gofmt -l: none; go vet (darwin), GOOS=linux and GOOS=windows go vet
-tags nogui ./...: clean; darwin, linux, windows builds
- TestClaudeSubscriptionRunsTheDownloadedClaudeCode fails on the old
proc.FindTool lookup ("Claude Code is not installed"); taking the
checksum compare out fails TestInstallRefusesABuildTheManifestDoesntName
- real: magpie claude-code install --yes downloaded Claude Code 2.1.296
darwin-arm64 (230 MB) into a sandbox HOME, checked; it ran --version
- real, in gcr.io/distroless/cc-debian12:nonroot with the image's /config
layout: install downloaded 2.1.296 linux-arm64 (245 MB) to
/config/cache/magpie/claude-code, it ran `2.1.296 (Claude Code)` there,
and magpie accounts add claude went on to print the claude.ai sign-in
link and ask for the pasted address
- the claudecode tests built for linux/arm64 pass in debian:12-slim
|
||
|
|
4225ba1efb |
site: a partner's /go link and the home page's sponsor card say they came from magpie, as ref=magpie (yetone)
goTarget adds ref=magpie to the partner's key page or website, keeping the address's own query and fragment; an address that names its own ref (a referral code) keeps it as it is. The home page's sponsor card links to yylx.io/?ref=magpie. Run: node --test site/*.test.mjs (27 pass), with new cases for the query, the fragment and a partner's own ref. |
||
|
|
c98160c045 |
gateway: a group's rule can pause one of its models at set hours, days or agents, leaving it out of the group then, not first, not a fallback, not kept by affinity (John on Discord)
John asked for a pause in a group's Rules, e.g. a model paused in its vendor's peak hours. A time rule could only send those turns to another member first: the paused-for model stayed behind it for failover, went first when the other was unready, and was kept by affinity mid-turn. What changed: - provider: Rule.Pause (`"pause": true`, typed `pause=<model>`). It holds by time/days and agents only; cleanRules and ParseRule refuse any other condition, and refuse a pause with none. Pause rules are not send-to rules: MatchesBesidesIntent, ruledEntry and Ruled() leave them out. PausedOut(g, ms, agent, at) drops members a pause holds for, from the group's own rules and each nested group's (a group named = all its models; a model named = wherever a nested group has it, #625). - gateway: serve and embeddings run PausedOut on ruleClock before planning, on every request. Every member paused -> 503 naming each rule (pausedError). The trace's GroupRef carries Paused. - GUI: the rule editor's "send to" is now an app-menu action button (send to / pause); a pause hides the request conditions (clearing them), keeps hours, days and agents, and isn't saved without one. The group card's rule reads "→ pause <model>", and the Routing trace says which model was paused by which rule. Strings in zh, zh-TW, ja, de. - CLI/TUI: `magpie group rule add <g> pause=<model> time=… days=…`. - docs: gateway-routing.md step 2; start.html en/zh/ja "Hours and days". Run: - gofmt -l clean; go vet -tags nogui ./...; GOOS=linux and GOOS=windows go vet -tags nogui on gateway, provider, tui, root; go build ./... - go test -tags nogui ./... under a temp HOME with pinned caches: all ok. - rules_pause_test.go (3 tests) fails with the PausedOut call in serve removed (the paused model answers mid-turn, as a fallback, and the all-paused case returns 200). grouprule_pause_test.go covers clean, parse/Line, Ruled, Pauses and nested PausedOut. - GUI: routing-pause.test.cjs in Chromium and WebKit, en/zh at 1100px and en/zh/zh-TW/ja/de at 420px: 14/14; all 7 Chromium cases fail on the old routing.js. routing-*, group-*, i18n-keys, gui-ja, gui-de, click-scroll: 618 pass, 4 fail under --test-concurrency=4 (routing-blocked, -idle-frame, -side-calls, -wb-refused), all of which pass run alone; routing-side-calls failed 1 of 6 alone and passes with the old routing.js too, so it is a load flake not touched here. |
||
|
|
34f2078db8 |
site: a partner's website and key links go through usemagpie.ai/go, which counts the click; fetches of the partner list are counted too
The app's own partner counts only come from users who leave the stats on, so a sponsor's reach and clicks are now also counted where the server sees them. /api/partners hands out each partner's website and keysUrl (and a region's) as usemagpie.ai/go/<id>/site|keys[/<region>]; /go sends a "magpie partner go" event to PostHog (partner, link, region, country) and 302s to partners.js's own URL. One in ten list fetches sends "magpie partners fetch" with weight 10 while someone is listed. Events carry a random id each, no install id or address. Ended entries leave the list but /go still resolves them, since added providers keep the links. Privacy text updated in README (en, zh), docs/reference.md and the site docs (en, zh, ja). Run: node --test site/*.test.mjs (27 pass); a scratch copy with a fake partner served rewritten links, 302'd /go to the real URLs and posted both events; PostHog's /i/v0/e/ answered 200 to the payload shape. |
||
|
|
9bb2a467e4 |
agent: Snow CLI is an agent magpie sets up: a magpie profile in ~/.snow, made the active one, that Snow App takes in with "Sync Snow CLI API config" (#1457)
Snow CLI (npm snow-ai, MIT, MayDay-wpf/snow-cli) keeps one profile per file under ~/.snow/profiles (or $SNOW_CONFIG_DIR), names the active one in active-profile.json, and copies it over config.json at every start, headless `snow --ask` included. Each profile is the whole snowcfg: base URL, key, request method and models. Snow App (MayDay-wpf/snow-app) reads ~/.snow/profiles/*.json when "Sync Snow CLI API config" is pressed. magpie writes profiles/magpie.json from the profile the user was on (their settings kept, Snow's OAuth sign-in left out): baseUrlMode base at the gateway's /v1, requestMethod chat, the agent's key, the model as advancedModel and basicModel, and the catalog's window and output (200000 and 64000 when not known, the output cut to the window). It makes that profile active and copies it to config.json. The profile the user was on, whether there was an active-profile.json at all, and a magpie.json of their own are stashed; Disconnect, `magpie snow default`, or picking a model of one of the user's profiles puts those back. A Snow from before profiles (config.json alone) gets the default.json Snow itself would make, so its next start doesn't take magpie's config for the user's. Check reports a base URL, key or request method moved off magpie's; Sync rewrites the profile on a port move. A WSL distro's ~/.snow is found and written the same way. Registered: agents.go, the WSL kinds, SNOW_CONFIG_DIR in agentenv, the npm update spec (snow-ai), the icon (Snow App's own, trimmed to 96px), README, docs/reference.md, docs/subsystems/agent-wiring.md, the site's agent list and start.html (en, zh, ja). Run: - go test -tags nogui ./... in a scratch HOME: 44 packages ok. New: TestSnow, TestSnowOwnProfile, TestSnowNoProfiles, TestSnowUsersMagpieProfile, TestSnowCheckSync, TestAgentSnowDefault; snow added to TestOwnProviderNamedAsMagpies, the WSL more-agents tests and TestMaxTokensWithinContextWindow. All fail before this commit (no agent "snow"). - go vet -tags nogui for darwin, linux and windows; gofmt -l clean. - Real Snow CLI 0.9.2 in a sandbox HOME against a sandbox magpie (`magpie serve` on 127.0.0.1:3571, a fake OpenAI upstream on 3561): `magpie snow fake/pro` made the magpie profile active, `snow --ask` answered through the gateway (POST /v1/chat/completions, model pro, logged as agent snow), and `magpie snow default` left profiles, active-profile.json and config.json byte-identical to before. - GUI: agent-layout, agent-connect, agent-models-picker, agent-field-names and models-add-and-icons in Chromium and WebKit; a Snow CLI row checked at 520-960px in en, zh, zh-TW, ja and de in both engines. No new GUI strings. |
||
|
|
5b008f5a55 |
i18n: Chinese says 子代理 for subagent everywhere, not 子 agent in some places and 子代理 in others (willz on Discord)
willz asked what the difference between 子 agent and 子代理 is. There is
none: the zh and zh-TW GUI strings used 子 agent for the Agents page's
subagent row and subagent effort ("Subagents", "subagents",
"subagent effort" and its hint), and 子代理 for every other subagent
string (Codex subagents, routing's sealed subagent task, subagent model).
Both locales now say 子代理 throughout; zh-TW already used 子代理 for the
rest, so it takes the same term. The zh site docs (intent.html,
start.html) said 子 Agent / 主 Agent and now say 子代理 / 主代理, matching
the GUI's 主代理. ja already says サブエージェント everywhere; the READMEs
don't name subagents. The four GUI tests that expected 子 agent are
updated.
Run: omp-roles, profile-details, subagent-effort, tier-effort,
codex-subagent-model, routing-sealed-task, agent-tweak-fold,
claude-signin, codex-memories(-settings), gateway-mode, mobile-web,
usage-ledger-detail, gui-zh-tw, gui-ja, gui-de and i18n-keys in Chromium
(148/148) and WebKit (79/79); subagent-effort also at 420px wide in both
engines, with the zh screenshot checked (子代理推理强度).
|
||
|
|
ca3394ff80 |
docs: the community's plugins update by themselves every hour, not every six hours (en, zh, ja)
internal/plugin/updates.go's KeepUpdated first runs 30 seconds after magpie starts, then every updateEvery, which is time.Hour. #681 cut it from six hours. The Plugins page (plugins.js) already says "within the hour". site/public/docs/plugins.html, zh/ and ja/ still said six hours. Other "six hours" mentions were checked and left alone, since the code agrees with them: - the registry.json fetch on the same pages (market.go: 6*time.Hour); - the move retry in docs/subsystems/provider-plugins.md (migrate.go: moveRetry = 6*time.Hour). Bun's own check (bunEvery) is six hours, but no doc states it. No README or docs/ page states the plugin update interval. Run: grep across README*.md, docs/ and site/ for six hours / 6 hours / 六小时 / 6 小时 / 6 時間. No code changed. |
||
|
|
ba0e2a8aa9 |
plugin: Update all and magpie plugin update bring a plugin pinned to an older version to npm's newest, so the update prompt clears (ARNO on Discord)
ARNO: 非官方插件安装后就算更新到最新版,magpie依然提示有更新. A third-party plugin added as name@1.2.3 is pinned. The Plugins page still counts it under "Update all (n)", its row says "vX out" and the Plugins dot is on. Update all (and `magpie plugin update`) reinstalled the pinned version, reported "Plugins updated", and the prompt stayed. The row's own Update already installs the newest version and unpins the spec (name@latest). Update now does the same for a pinned plugin when npm has a newer version than the one installed: it installs that version through add, which keeps the plugin's options and the provider picked for it. A pinned plugin that is already at npm's newest keeps its pin. Git plugins, folders and plugins npm didn't answer for behave as before. The plugin docs (en, zh, ja) now say that updating a pinned plugin yourself unpins it. Reproduced in a sandbox HOME with the real opencode-gemini-auth from npm (magpie web on a spare port, China mirror switch on and off). Pinned at 1.4.15 with 2.0.1 out: before the fix, Update all and `magpie plugin update` left it at 1.4.15 and /api/plugins/updates still listed it. After the fix it is at 2.0.1 as opencode-gemini-auth@latest, the waiting list is empty and Check for updates reports "current". The row's Update (upgrade) path was checked too: unpinned opencode-gemini-auth, and scoped @gitlab/opencode-gitlab-auth 1.3.1 -> 1.3.3 with the mirror on. Both cleared the prompt before the fix as well. TestUpdateAllUpdatesAPinnedPlugin (real bun, fake registry) fails without the change: "Update all left opencode-someones-auth at 1.0.0, want 2.0.0". gofmt -l, go vet (darwin, GOOS=linux, GOOS=windows) on internal/plugin, and go test -tags nogui of internal/plugin, internal/gui and internal/provider under a temp HOME with pinned caches all pass. |
||
|
|
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. |
||
|
|
d86a4e0568 |
site: the docs have Docker and Remote magpie pages in English, Chinese and Japanese, listed in every docs page's contents and footer and linked from the READMEs (HuanCheng Bai on Discord)
Until now, both were only in docs/reference.md. The new pages are at
/docs/docker, /docs/remote and their zh/ and ja/ versions.
- docker: the image, its tags, ports, the /config volume and the nonroot
user. How to run it with the browser UI (`web --addr 0.0.0.0:3430
--no-open`, MAGPIE_WEB_KEY, the ?k= cookie). Signing in through the
Callback URL paste or `docker exec ... magpie accounts add`. What
/config keeps, the env vars, sharing with gateway keys, and a Compose
file for a NAS. Healthcheck and updates.
- remote: sharing the main magpie, then adding it as a Remote magpie
from the app, the TUI (a/w/m) or `magpie provider add remote-magpie
<key> url=... id=office`. What comes over (models, groups, APIs,
images, System One, embeddings, prices, quotas) and the errors magpie
shows, quoted from remote_quotas.go and lan.go.
The facts were checked against the code, not reference.md:
- the Dockerfile ENV, VOLUME, HEALTHCHECK and EXPOSE;
- docker.yml's tags;
- web_cli.go;
- the lanGuard in internal/gateway/lan.go;
- the remote-magpie preset.
The Docker page's warning says a Docker gateway answers anyone until
sharing is on, because MAGPIE_ADDR is 0.0.0.0 there.
The new links in the top nav bar carry a toc-only class:
- docs.js still lists them in the contents;
- the bar keeps today's width, since nine links overflowed it at
1024-1280px.
`.steps li` gets min-width: 0, so a long inline code no longer widens
the grid past a phone's width, where `overflow: hidden` clipped the
text.
Run:
- Real containers from ghcr.io/yetone/magpie:latest (v0.1.1150):
- the documented `docker run ... web` came up healthy, and its log
output is what the page shows;
- with "lan": true, `Bearer magpie` got 401 and a gateway key got 200;
- a second container ran `provider add remote-magpie <key>
url=http://<a>:3425 id=office` and listed office/test-relay/... models.
- `node --test site/*.test.mjs`: 23 pass.
- Playwright, in Chromium and WebKit, at 1280, 1024 and 390, light and
dark:
- no horizontal scroll and no nav overflow on all 20 docs pages;
- every internal link and #anchor resolves. /zh/ and /ja/ are routed
by the worker and return 200 live.
|
||
|
|
7d0e415e62 |
plugins: two plugins that sign in to one provider are both listed, each row says which serves it, and Use for picks the other (neiko on Discord)
neiko on Discord installed a third-party plugin beside a plugin of their
own, added by its folder. Only the third-party one could be seen. Both
plugins' auth hooks name the same provider id. The host's auths() keeps
the last plugin in plugins.json for an id, as OpenCode does, so the
user's own plugin silently lost it:
- its row read "Signs in to nothing magpie can use";
- its provider was gone from the Add sheet;
- keepUnloaded could list the id a second time, from the
plugin-providers.json kept before.
A package-name clash and a display-name clash were tried as well. Both
plugins stay visible in those cases, because a folder plugin's name is
its path.
What changed:
- host.js:
- init gives each loaded plugin the ids it signs in to (provides) and,
for each id another plugin serves, that plugin's spec (servedBy).
- auths() honours plugins.json's new prefer map (id -> spec).
- Only the serving plugin's provider.models hook runs for the id.
- plugin:
- Clashes() turns provides and servedBy into {id, by, with} per spec.
- Prefer() records a pick and restarts the host.
- Remove drops the removed plugin's picks.
- Re-adding a plugin under a new spec carries its picks over.
- remove, off, options and prefer find a plugin by its exact spec
before its package name (indexOf), so acting on one plugin never
reaches another of the same package.
- keepUnloaded no longer re-adds a provider from before when another
plugin serves its id now.
- GUI:
- /api/plugins rows carry clashes, with the provider's listed name.
- POST /api/plugins/prefer {spec, provider}.
- The serving row says "{other} signs in to {name} too; this one
serves it".
- The other row says, in amber, "{name} is served by {other}, which
signs in to it too", with a "Use for {name}" button.
- New strings in zh, zh-TW, ja and de.
- CLI: `magpie plugin` prints the same lines, with the command that
fixes it, and `magpie plugin use <name> <provider>` makes the pick.
- Docs: docs/subsystems/provider-plugins.md, docs/reference.md and
site/public/docs/{,zh/,ja/}plugins.html.
What was run:
- Reproduced under a sandbox HOME with magpie web on 3562: a fake npm
plugin and a folder plugin, both on id "acme".
- Old binary: the local row had providers [] and /api/providers
listed acme twice.
- New binary: both rows carry the clash; prefer moves acme to the
folder plugin; remove clears the pick and leaves the other plugin
serving acme.
- New Go tests:
- TestTwoPluginsOneProvider, a real Bun host: Prefer, restart,
off/on and Remove.
- TestClashes, TestPluginNamedExactlyFirst and
TestKeepUnloadedLeavesAServedID.
- TestPluginsClashRows (gui) and TestPluginListSaysClash (CLI).
- Each fails when its piece is broken by hand: prefer ignored in
host.js, the keepUnloaded id check removed, name before exact spec,
Remove keeping picks, no provides, no clashes in the rows, no
prefer route.
- plugin-clash.test.cjs, in Chromium and WebKit, in en, zh, zh-TW, ja
and de, at 1100 and 560px: 22/22 pass. It times out on the old
plugins.js.
- gui-de, gui-ja, gui-zh-tw, i18n-keys and every plugin-*.test.cjs:
248 tests.
- 245 passed in the 4-wide run.
- plugin-moved-signin (webkit) failed once in that run, then passed
3/3 alone and 26/26 in a smaller 4-wide rerun.
- gofmt -l; go vet ./...; GOOS=linux and GOOS=windows go vet -tags
nogui ./...; go build ./...
- The full go test -tags nogui ./... under a temp HOME with the caches
pinned: 44 packages ok, none failed.
- After rebasing onto
|
||
|
|
a3a8e25792 |
plugins: a repository tagged magpie-plugin shows the icon its package.json gives (yetone: 非官方的插件能否支持 icon)
magpie.icon, an https URL or a data:image URI, is read with the rest of package.json and kept through pluginOwnIcon as an installed plugin's is; the card shows it, else the puzzle piece. Ran: go test ./internal/plugin ./internal/gui ./internal/provider; the plugin GUI tests in Chromium and WebKit (en/zh/ja/de, 980 and 440). |
||
|
|
b4aa62af96 |
docs: the READMEs' Privacy and the site's "What does magpie send about me?" (en, zh, ja) say a partner's daily counts are sent too
|
||
|
|
f9a1ca0355 | docs: a Privacy section in the READMEs and a "What does magpie send about me?" FAQ on the site's Get started (en, zh, ja): the daily event's id, version and system, and the agents, providers and models by magpie's own ids (a provider of the user's own only "custom"), what is never sent, and the Settings → Privacy switches; node --test site/*.test.mjs passes | ||
|
|
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. |
||
|
|
f0a431651e | site: the Agents screenshots show today's page: eight agents on magpie (Claude Code, Codex, Gemini CLI, Antigravity CLI, OpenCode, Zed, Hermes Agent, Kimi Code), Show 21 more, the Sessions and Plugins tabs; en, zh and ja, light and dark; the docs give their new heights | ||
|
|
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. |
||
|
|
b7f1c7d2aa | docs: Intent routing's setup names Route by what it asks for, Jev as the classifier with a TypeSafe provider, and the offer under a group whose effort Jev picks (en, zh, ja) | ||
|
|
8b14afea15 | docs: Plugins says magpie asks GitHub for tagged repositories at most every ten minutes (en, zh, ja) | ||
|
|
290c60a31e | docs: Plugins says a GitHub repository tagged magpie-plugin is listed under Discover as unofficial (en, zh, ja) |