Commit Graph
266 Commits
Author SHA1 Message Date
yetone b62fa332f3 provider: Send requests unmasked for subscriptions and plugin providers too (isee1_1)
isee1_1 on Discord uses a community translation plugin as a provider and
asked why "Send requests unmasked" (请求不脱敏) isn't offered for it.
698da36f3 (lc) left a signed-in account, a plugin's provider and another
magpie out because the switch was then for local addresses only, and none
of those is local. 380032cda (AcMilan) made it the user's word at any
address, with a caution while on for one not local, but kept the
exclusion. Nothing still stands behind it for a subscription or a plugin:
the setting lives with the account's model picks, and every route reads
SkipsRedaction. Another magpie stays excluded, as it masks on its own side.

- provider.SkipsRedaction: an account (subscription or plugin) skips when
  set; another magpie never. Save keeps Unredacted in the picks record,
  withPicks applies it (AlsoOn accounts too).
- gateway: serve, count_tokens, embeddings, Jev and the plugin's fetch
  already go by unredactedRoute (every fallback and group member must be
  set too). The Codex relay on a ChatGPT sign-in masked always: it now
  sends the turn whole when the Codex subscription is set
  (codexRouteUnmasked; only for the ChatGPT backend, not the Codex API
  key route), codexMaskRoute stands aside then, and ChatGPT web search
  (alphaSearchOn) goes unmasked only when every provider it is on is set.
  Speech and video stay masked whatever the switch (maskTextHits), as
  before, for every provider.
- GUI: the editor's Redaction row is shared (unmaskRow); a subscription
  or plugin provider has it too, its caution naming the provider while
  on, since its vendor is never local; saved with the account's body.
  Another magpie has none. No new strings; app.js stays in its budget.
- CLI help/show text, gateway-routing.md and the masking docs (en, zh,
  ja) say so.

Run (mote, through mote-run):
- go test ./internal/provider ./internal/cli: ok
- go test -timeout 45m ./internal/gateway: ok (676s)
- go test -run 'Budget|Redact|Unmask|I18n' ./internal/gui: ok
  (TestCoreScriptBudget at +45 bytes)
- GOOS=linux go vet ./internal/gateway ./internal/provider, GOOS=windows
  go vet ./internal/gateway ./internal/provider ./internal/cli: clean
  (GOOS=linux vet of internal/cli fails in wails without cgo, as on main)
- node --test provider-unmasked (chromium): 36/36; i18n-keys: 4/4.
  WebKit on mote can't launch (#4125); WebKit ran through wsl-run:
  the whole file in chromium and webkit, 72/72. At 440 in Linux WebKit
  the list's sticky foot covers the last row (another magpie's), so the
  test clicks that row as an event (#4484).
- gofmt -l: clean

Broken by hand:
- SkipsRedaction's account branch back to false: TestSkipsRedaction
  (an account, a plugin's provider), TestPluginProviderUnmaskedSwitch/set
  and TestCodexSignInUnmaskedSwitch/set go red.
- Unredacted dropped from Save's account whitelist: the plugin test's
  "saved as" goes red.
- codexRouteUnmasked forced off: TestCodexSignInUnmaskedSwitch/set red.
The unset and falls-back-to-a-vendor cases stay masked in each.

Not tried: a real plugin provider or a real Codex/Claude account with
the switch on (fakes only: the fake bun plugin and a fake ChatGPT
backend); the Claude bridge path; the full Go and GUI suites run after
the push.
2026-10-31 02:56:49 +08:00
yetone 14b451c117 site: the MCP hub's docs are the MCP router's, and the old links redirect
The feature is called the MCP router now (the commit before). The docs
pages move to mcp-router.html in en, zh and ja, their wording follows
(MCP router / MCP 路由 / MCP ルーター, `magpie library mcp router on|off`),
and every docs page's link and canonical/hreflang URL points at the new
path. The worker answers /docs/mcp-hub, /docs/zh/mcp-hub and
/docs/ja/mcp-hub (with or without .html or a trailing slash) with a 301
to the new page, keeping the query, so links already shared still open.

The plugins pages' link to the router page (Search1API's tools,
from the rebase) follows too.

Run at e2583df31 (this stack on 86fef947e), on mote: gofmt -l clean;
go vet for darwin, linux (-tags nogui) and windows; go build ./...;
go test -tags nogui ./... -timeout 45m, 81 packages ok, 0 FAIL;
library, gateway, imagemcp, sessions, cli and gui again alone, ok;
site's node --test, 49 of 49. GUI on xiaomi-gpu (Windows; mote's
browsers crashed under other sessions' suites): library-*, image*,
mcp-hub-direct, i18n-keys, list-sort and plugin-tools, both engines and
every language, 1055 of 1056: i18n-keys found "{name} is given to each
agent directly" dropped from the library's strings in the rebase. Put
back in the first commit; at the pushed head i18n-keys, mcp-hub-direct
and library-mcp-hub are 48 of 48. That is the only difference from
e2583df31.
Broken by hand at e2583df31: imagemcp ignoring magpie/roots fails
TestHubCallSavesInTheCallersProject; the router asking anything but
roots/list fails TestHubAsksTheAgentItsRoots and TestHubRootsUnasked;
inHub leaving magpie-image out fails TestHubGivesMagpieImage.
Checked: no 聚合, ハブ or mcp-hub left under site/ except the redirect.
The worker's redirect test fails without the redirect line (not ok 7).
Rebased once more onto 2570efb5f, which changed library-mcp-hub,
list-sort, mcp-hub-direct and gateway-routing.md. Run at the pushed
head: go build; gateway, library, cli and imagemcp tests ok; the GUI
budget tests ok; on xiaomi-gpu i18n-keys, mcp-hub-direct,
library-mcp-hub and list-sort, 51 of 54. The three reds were WebKit
420px library-mcp-hub cases with no Connect sheet after a reload.
origin/main d77da5bff goes red the same way (de 420px, 9 of 11). In a
second run of library-mcp-hub on WebKit at this head, 11 of 11 passed.
Filed as #4483.
2026-10-31 02:49:08 +08:00
yetone cfb06e11c3 site: PostHog goes through usemagpie.ai/r/, and downloads are counted
A blocker that knows posthog.com dropped every count of the pages, so the
snippet's api_host is now this site's /r/: relay passes the library and
its config on to PostHog's assets host and the rest to its ingestion
host, with the visitor's address as X-Forwarded-For (PostHog's country)
and without the site's cookies. ui_host stays PostHog's.

Downloads weren't in PostHog at all: /download/* and install.sh are now
counted server-side, as "magpie site download" (link, file, country,
browser or command) and "magpie site install script", each under an id
of its own like the partner counts. A HEAD, or a file the release
doesn't have, isn't counted. The privacy pages (en, zh, ja) say both.

Run: node --test site/worker.test.mjs site/install.test.mjs
site/stable.test.mjs on mote, 48 pass. Broken by hand (no
X-Forwarded-For, the Cookie passed on, the download count off): the
relay and download tests went red. A Playwright page with the snippet
and every posthog.com request aborted (a blocker): Chromium on mote and
WebKit on xiaomi-gpu (mote's WebKit wouldn't launch at load 28) sent
$pageview, $autocapture, $snapshot, $$heatmap and $web_vitals through
/r/ alone, nothing blocked; under GPC nothing was fetched.
2026-10-31 01:46:34 +08:00
yetone 06d36d4142 gateway: Stays: Session spreads new sessions over the accounts (connor_yang)
connor_yang on Discord: three sessions on one provider's three accounts,
Stays: Session (整个会话), ended up on two accounts. Under Smart routing a
conversation nobody had answered yet went wherever routing put first,
whatever other sessions were on; only In turn counted the sessions each
account holds (leastHeld, #946).

Kept for the whole session (Stays: Session or Strict) under a routing that
picks by what is left (Smart, Least used first, Weekly pace;
spreadsSessions), a new conversation now goes to the key, account or
group member the fewest other conversations of the last 30 minutes are on.
It passes over one routing keeps new conversations off (readyForNew:
resting, an aside key, a fallback while the provider's own model leads,
one used past lowShare), counts leads only, and keeps routing's order on a
tie. A Claude Code subagent's first request goes to its lead's account
(withLead), not to another as a session of its own. An answered
conversation is kept as before, and resting, spent and the rest/quota
fallback are unchanged. In order, By weight, Free first, Speed first,
Cheapest, Manual and plugin routings keep their order. Docs: reference,
gateway-routing, site start.html (en, zh, ja).

Run (mote, at this head on 2604d68db): go test ./internal/gateway -run
'TestWholeSession|TestInOrderKeepsNew|TestSpreadsSessionsOnly|
TestRotateSpreads|Affinity|Strict|Subagent|Lone|LoginSwitch|ChatGPT' ok;
GOOS=linux and GOOS=windows go vet ./internal/gateway ok; gofmt clean.
The full Go suite (-timeout 45m) was started at this head after the push.

Broken by hand: spreadsSessions always false (the old code's behaviour):
TestWholeSessionSpreadsNewSessions red, "s2 went to k1, which s1 is on"
for session and strict. Subagent sent through leastHeld instead of
withLead: red, "s2's subagent went to k1, not s2's k2". readyForNew
without the fallback and lowShare checks: TestWholeSessionSpreadLeaves
TheNearlyUsedAndFallbacks red.

Not tried: real subscription accounts (the tests use three API keys on one
provider, the same candidate path); a group of different providers end to
end (leastHeld's group path is the one In turn has used); the reporter's
exact provider and agent; sessions idle more than 30 minutes no longer
count as holding their account.
2026-10-31 01:05:44 +08:00
yetone 4f2d5fc7e0 routing: a group can put its cheapest member first, by each one's price at that hour
liyuanzheng (#general) and lam_em (#feedback) both asked for the same
thing. Off-peak, DeepSeek's own API should come first for deepseek-flash.
At DeepSeek's peak (weekdays 01-04 and 06-10 UTC, billed 2x since
v0.1.2173), another provider should come first, Ollama say. A schedule
editor would make the user copy DeepSeek's hours into magpie. Instead,
a group gets one more routing, "Cheapest first" (`cheap`). Each request
sorts the members by what they cost right then: input + output price per
million, at the peak rate when it is peak hours. A tie goes to the lower
cache-read price. Free models count as 0. A member with no known price
keeps its listed place after the priced ones. Prices come from the same
priceOf the usage ledger bills with, so the user's own ModelPrices,
list prices and maker prices all count, and so does a provider's rate
windows.

- routes: Seat carries Priced/Cost/CacheCost; Strategy.ByPrice; Cheapest
  is a stable sort, so equal prices keep the user's order.
- gateway: weighRouted prices each seat at priceClock() (time.Now; a test
  holds it) through the new provider.PriceAt. The trace's Weighed row
  gets a price (input/output/cacheRead/peak) so Routing can say why.
- It is a group's alone, like Manual. A provider saved with it drops it,
  and `magpie provider set … routing=cheap` refuses it. Groups take it in
  the GUI menu (one more item, no new controls), the TUI and
  `magpie group set <id> routing=cheap` (aliases cheapest, price, cost).
- Routing's mode line says why the first one is first, e.g. "Cheapest
  first: deepseek-v4-flash costs least on ollama-cloud now — $0.150 in,
  $0.600 out a million tokens.", with peak and unpriced variants.
  en/zh/zh-TW/ja/de.
- Docs: gateway-routing, plugin-runtime, reference (it also points at
  Time window and Pause rules for a fixed schedule) and the site's start
  pages (en/zh/ja).

Run, at f7f2d75f2 (this change rebased onto it):
- Red on the old code: TestCheapestFirstGroupFollowsPeakHours (deepseek
  vs ollama with ModelPrices, priceClock held at 14:00 UTC off-peak and
  02:00 UTC peak) and TestCheapestOrdersByPriceNow did not compile
  without Cheapest. TestCheapestFirstIsAGroupsOnly checks that a provider
  drops it and a group keeps it.
- Broken by hand: without `pr = pr.In(at)` the gateway test is red ("at
  DeepSeek's peak ... went to deepseek"). With Cheapest returning the
  order unchanged, both the routes test and the gateway test are red.
  Both were restored.
- Full Go suite on mote (-count=1 -timeout 45m ./..., log kept): every
  package ok except two. internal/provider had
  TestQuotaSpanCarriesEveryWindowField, which is red on origin/main (#4457,
  fixed since in ccbefe2a2). internal/gui had ten AppKit window tests
  killed at their 20-40s deadlines (TestPanelCloseHidesIt,
  TestMainWindowCorners and others). Three of them are red the same way
  on a fresh origin/main f7f2d75f2 copy, under #2645/#4125 (mote has
  several GUI suites running). After the rebase, go vet and the Cheapest,
  SpeedFirstGroup, ParseRouting, ApplyGroupPairs and ProviderRouting tests
  are ok. go vet darwin, GOOS=linux -tags nogui and GOOS=windows are ok,
  and gofmt is clean.
- GUI on WSL (Linux, chromium + webkit): routing-cheapest-first (new,
  3 scenes x en/zh/zh-TW/ja/de x 2 engines), routing-group-strategy,
  builtins, i18n-keys and routing-speed-first gave 95 of 96. The one red,
  routing-group-strategy "webkit en light ... the pick moved nothing", is
  a wheel-scroll timing red. It fails 3 of 3 on origin/main and 1 of 3 here
  (#4459). Core-script budget ok (app.js +9 bytes).
- The whole GUI suite (1025 files) was started on WSL at this tree and
  was still running when this was pushed, at load ~160.

Not tried: real DeepSeek or Ollama accounts, and a real request during
DeepSeek's peak hours. Ollama Cloud's price here is the catalog's, not
checked against a bill.
2026-10-30 23:59:31 +08:00
yetone 2f65a33aaf library: a tools plugin is a Library server of its own, in the MCP hub (Search1API)
chenxiang0010 (Discord #general) asked for a tools plugin's tools, Search1API's
(@magpie-community/tools-search1api), to be in magpie's aggregated MCP server.
Until now plugin tools were served only at /mcp/magpie/tools, wired by hand;
the hub listed Library servers only.

Now each plugin that is on and gives tools becomes a Library server once the
plugin host has noted its tools (plugin-tools.json, new plugin.ToolsNoted):
- named by the plugin's short name (search1api, search1api-plugin beside a
  user's server of that name), `plugin` set, `local`, its URL the new
  /mcp/magpie/tools/<short> (gateway ToolsMCPOne), which serves that
  plugin's tools alone by their own names;
- added with the hub on, it is on for the agents given the hub's entry, so
  their hub lists search1api__search etc. at once; with the hub off it is on
  for none until switched on. Per agent and per tool it is switched like any
  server;
- the hub lists and runs its tools in process (gateway.PluginToolsOf,
  RunPluginToolOf, under the Plugin tools gate); with the hub off an agent is
  given the per-plugin URL at the address it reaches the gateway (through),
  with a key from another machine;
- offered once (pluginsOffered): removed by the user, it comes back only when
  the plugin is removed and added again. The plugin removed takes the server
  out; turned off it stays and lists nothing; an unreadable plugins.json
  changes nothing (plugin.ReadList). Edited in the Library's editor, which
  doesn't send `plugin`, it stays the plugin's.
Docs: docs/subsystems/plugin-tools.md, mcp-hub.md, site docs plugins (en, zh, ja).

Run (mote; full suite at this change on origin/main 024393fbb, then rebased on
acdc85ac8, whose 5 commits touch internal/plugin/page.go and a gateway test;
library, gateway and plugin focused runs again at the pushed head: ok):
- go test -tags nogui ./internal/library ./internal/gateway ./internal/plugin
  -run 'PluginTool|Hub|ToolsMCP|ServingGates|OwnMCPRejects|Tool': ok.
- TestReadOnlyKeyEveryRoute also covers the new route.
- New tests: TestPluginToolsInHub, TestPluginToolsServerComesAndGoes,
  TestPluginToolsServerThroughAnotherAddress (library), TestToolsMCPOnePlugin
  (gateway).
- go vet (darwin, GOOS=linux, GOOS=windows) on the three packages; go build: ok.
  gofmt -l: clean.
- Full suite, go test -tags nogui -count=1 -timeout 45m ./... (log kept):
  80 packages ok, internal/gateway red on TestReadOnlyKeyEveryRoute: the new
  route wasn't classified for read-only keys. Added to readOnlyRefused's
  list in the test (a read-only key is refused there, as at
  /mcp/magpie/tools); internal/gateway whole package again: ok (846s).
- Real run, sandbox HOME on mote, built binary, MAGPIE_ADDR on a free port:
  `magpie plugin add @magpie-community/tools-search1api` (latest from npm),
  `magpie serve`. library.json got the search1api server (plugin, local,
  url .../mcp/magpie/tools/search1api, pluginsOffered); the per-plugin
  endpoint listed search, news, ask, crawl, sitemap, trending, send_feedback;
  with the hub on, /mcp/magpie/hub listed search1api__search ... and
  search1api__search answered isError "Sign in with `magpie plugin login
  search1api`, configure apiKey ..." from the plugin.

Broken by hand (each red, then restored):
- hub ignoring plugin servers (backend path): TestPluginToolsInHub red
  ("claude's hub tools [fake/a fake/b fake/c]").
- adoptPlugins returning false at once: both library tests red ("no server
  for the plugin").
- through's plugin branch off: TestPluginToolsServerThroughAnotherAddress red.
- the ToolsMCPOne route removed: TestToolsMCPOnePlugin red (404).

Not tried: a signed-in Search1API account (none here), so no search went
through; a real agent (Claude Code, Codex) calling the hub; WSL/remote
agents through another address (unit test only); the GUI's Library page
showing the server (no GUI file changed, GUI suite not run).
2026-10-30 22:33:25 +08:00
yetone f982e46f26 site: PostHog also records sessions, errors, dead clicks and request timings
The owner asked for every dimension. The snippet now captures dead clicks,
uncaught errors, network timings with Web Vitals, and a session recording
with every input masked. advanced_disable_flags is gone, since the
recording, heatmaps and the other switches arrive in the project's remote
config. The project's settings were changed to match: cookieless off,
session recording, heatmaps, Web Vitals, exception autocapture and dead
clicks on, recordings masking all inputs. The privacy pages (en, zh, ja)
list what is sent now.

Run on mote: a Playwright page with the worker's snippet, Chromium and
WebKit x normal/DNT/GPC, events intercepted, remote config and recorder
from the real project. Normal: $pageview, $autocapture, $$heatmap,
$web_vitals and $snapshot sent, no cookies, one ph_* localStorage key;
text typed in an input appears in no payload, and in Chromium's
recording it is a 12-star mask. DNT and GPC: nothing fetched or sent.
node --test site/worker.test.mjs site/install.test.mjs site/stable.test.mjs:
45 pass.
2026-10-30 05:05:41 +08:00
yetone 3caa125f93 site: PostHog keeps a localStorage id, so it sees country, returns and clicks
Cookieless mode drops the address before GeoIP, so the dashboard had no
country, and a visitor's id changed daily. The snippet now keeps its id in
localStorage (never a cookie: the pages vary on Cookie for the lang
redirect), and adds autocapture with heatmaps and Web Vitals. No
recordings, and still nothing loaded under DNT or GPC. The privacy pages
(en, zh, ja) say what is sent now.

Run on mote: a Playwright page with the worker's snippet, Chromium and
WebKit x normal/DNT/GPC. Normal: $pageview and $autocapture sent with a
uuid distinct_id, no cookies, one ph_* localStorage key, typed input text
not in any event. DNT and GPC: the library isn't fetched, nothing sent.
Headless Chromium needed opt_out_useragent_filter in the harness only.
node --test site/worker.test.mjs site/install.test.mjs site/stable.test.mjs:
45 pass.
2026-10-30 04:56:38 +08:00
yetone d5d6420ba3 site: the privacy page says PostHog looks up no country for cookieless page views
With cookieless tracking on, PostHog hashes the address into the visitor id and strips it before GeoIP runs (its own settings page says so), so 0c12662f2's "the country your address is in" was wrong in en, zh and ja. Text only; checked the three pages' sentences by hand.
2026-10-30 04:49:56 +08:00
yetone 0c12662f2f site: PostHog Web Analytics on every page, cookieless
usemagpie.ai's pages now load PostHog beside Cloudflare Web Analytics,
injected where the beacon is (worker.js, every HTML response). It runs
with cookieless_mode "always" (nothing in cookies, localStorage or
sessionStorage), page views and page leaves only (no autocapture,
recordings, surveys or flags), in the daily count's project. Under Do
Not Track or Global Privacy Control the script isn't loaded at all:
respect_dnt alone doesn't stop a cookieless capture. The privacy page
(en, zh, ja) says what PostHog gets.

The project's cookieless tracking setting must be on, or PostHog drops
these events.

Run on mote: node --test site/worker.test.mjs site/install.test.mjs
site/stable.test.mjs, 45 pass. A Playwright check (Chromium and WebKit)
loaded the snippet, routed us.i.posthog.com, gunzipped the batch: one
$pageview with distinct_id $posthog_cookieless, no cookies, nothing in
either storage. With doNotTrack "1" and with globalPrivacyControl, no
request and posthog not loaded. Broken by hand: respect_dnt alone still
sent under DNT; Playwright's webdriver flag trips posthog's bot filter,
so the check hid it.
2026-10-30 03:50:32 +08:00
yetone 9101bb8879 privacy: a request masking would change can go as written to a model you picked
jessyoungyu on X: when a masking rule hits, send the request to a
self-hosted model instead, so a prompt like 「百度这家公司怎么样」 gets an
answer about Baidu, not about a placeholder.

Settings › Privacy › Instead of masking, send to (settings
redactRouteTo). It is Off by default, and nothing changes for a user who
leaves it Off. It is picked in the app menu, and only models whose every
route is unmasked can be chosen: the provider is set to Send requests
unmasked, it is on this computer or the network, it has no account, and
any fallback or group member is unmasked too (gateway.MaskRoute, the
same rule as provider.SkipsRedaction). The setting is saved on its own
with POST /api/settings/redact-route, which checks it with MaskRoute.
The general settings save keeps the value.

Decisions:
- When a value would actually be masked on an agent's turn (maskHits.n
  > 0), serve sends the request to the chosen model unmasked. Warn-only
  hits don't count, and Block still answers 400.
- If that model fails, the request fails. It is never masked and re-sent
  to the model the agent asked for, and never goes to a cloud model with
  the unmasked text. Falling back to a masked cloud request would answer
  a different question in the background. The user picked this route
  because masking breaks the answer.
- Streaming works the same as on any route.
- The route is checked again on every request. A model that is gone or
  no longer unmasked, or that the caller's gateway key may not use,
  means the request is masked as before.
- Covered: agents' Messages, Chat, Responses and Gemini turns (serve,
  marked by serveAgent), count_tokens, Codex magpie-model turns, and
  Codex own-sign-in /responses (codexMaskRoute).
- Not covered: magpie's own asks (ownAsk clears the mark), embeddings,
  audio, images and video. These stay masked.

GUI: redactRouteRow lives in plugins/redact/settings.js and wraps
renderRedact, so app.js is byte-for-byte unchanged and the core budget
is not raised. Strings are added in zh, zh-TW, ja and de. Docs: gateway-routing.md,
gui-shell.md, and site/public/docs masking (en, zh, ja).

Tests: internal/gateway/mask_route_test.go
(TestMaskedRequestGoesToTheModelSet: unset, set, streamed, nothing to
mask, local fails, falls back to a vendor, no longer unmasked,
count_tokens; TestCodexSigninTurnGoesToTheModelSet;
TestMaskRouteTakesOnlyUnmaskedRoutes; TestMaskRouteOnlyForTheAgentsTurn);
internal/gui/redact_route_test.go; settings_keep_test.go;
internal/gui/tests/redact-route.test.cjs (every language, chromium and
webkit, 1100 and 640 wide).

Broken by hand, each red:
- serveAgent without the agent mark;
- MaskRoute taking any route (TestMaskedRequestGoesToTheModelSet,
  TestMaskRouteTakesOnlyUnmaskedRoutes; at the pushed head);
- the codex hook removed;
- count_tokens without the mark;
- ownAsk not clearing it;
- no key check;
- no reroute in serve;
- the GUI: no keep in the general save, no MaskRoute check on save, and
  the picker listing every model;
- the plugin script left out of index.html (redact-route.test.cjs 22 of
  24 red; at the pushed head).

Run on mote:
- at 221ede767's tree, this change on f5806ed21 (pushed on 44d697993,
  which adds only app.css lines and a Gateway page GUI test):
  go test -tags nogui ./internal/gui ./internal/settings ok (the core
  budget is green again since ec789445d; #4307, filed and closed);
  the mask-route tests in ./internal/gateway ok; GOOS=linux go vet
  -tags nogui ./internal/gui ./internal/gateway ok; GUI: node --test of
  redact-route, redact-*, privacy-*, mask-*, masking-*, settings-*,
  i18n-keys, account-discovery, sessions-reads and gui-de/ja/zh-tw:
  643 pass, 0 fail. gofmt -l clean.
- at the same change on af8f3a939, one rebase back (the only
  difference is index.html's script order and main's own commits):
  go test -timeout 45m ./internal/gateway (488s) ./internal/redact
  ./internal/settings ./internal/provider ok; GOOS=linux go vet -tags
  nogui ./..., GOOS=windows go vet ./..., go vet ./... ok.
The whole Go suite was not run; every package this change touches was
run above.

Not tried: a real self-hosted model (Ollama) with a real agent. The
local model is a fake Chat server in the tests.
2026-10-30 00:46:45 +08:00
yetone 0745db932e site: an MCP hub page in the docs, in en, zh and ja
CyberCaius (Discord) asked what the Library's MCP hub is for. The page
says what the switch does, how to turn it on (GUI and
`magpie library mcp hub on|off`), the /mcp/magpie/hub address for other
apps, which agents keep their own entries and why, and when to leave it
off. Facts from docs/subsystems/mcp-hub.md and internal/library/mcp_hub.go.
Every docs page's nav and footer link it after Privacy masking.

Run: site's node --test on mote from the repo root, 45 of 45 pass.
2026-10-29 19:35:32 +08:00
yetone f6263439af gateway: serve OpenAI's text to speech, POST /v1/audio/speech
liuyuexue2020 on X (tweet 2115742181734445238) wanted audio models
(Mistral among them) behind magpie, and the gateway had no
/v1/audio/speech.

POST /v1/audio/speech (and the bare /audio/speech) takes OpenAI's JSON
body and goes through serveRetrieval, as transcriptions (#2053) and
embeddings do: routed (a group's members, a provider's keys and
accounts, pause rules, key limits), metered against MaxRPM, recorded
(usage operation "speech", Routing, recent calls). Only "model" is
rewritten to the provider's own id; every other field goes as sent, so
Mistral's voice_id and ref_audio pass too.

The answer is never held whole: a speech request's 2xx answer is left
unread by the new retrieveOpen (retrieveAs now wraps it) and copied to
the client as it comes, flushed per read, in the vendor's own
Content-Type: audio (mp3/opus/aac/flac/wav/pcm), SSE for
stream_format=sse, or a vendor's JSON (Mistral answers
{"audio_data": base64}). No Accept: application/json is sent for it.
The usage in SSE's speech.audio.done event is counted from the last
16KB. A vendor's error is read and passed on as before, and a failing
member still falls over to the next.

Masking: "input" and "instructions" are masked as the settings say,
as text (maskTextHits), each where it sits; nothing else in the body
is (voice, formats, a voice-cloning clip are no text of the user's).
Nothing is put back: the answer is audio, so a masked value is read
aloud as its placeholder (docs/reference.md says so).

Mistral: its API has POST https://api.mistral.ai/v1/audio/speech
(voxtral-mini-tts-3-0), at the OpenAI path but not OpenAI's shape:
voice_id instead of voice, and JSON {"audio_data": base64} back, not
raw audio. Both pass through as sent; a client must speak Mistral's
shape to it. OpenAI, Groq and other OpenAI-style TTS vendors (vLLM-Omni
included) are served as they are.

Also: the 404 message's list, /v1's "apis", remote_magpie's suffix
list, cors_test and lan_test route lists, docs/reference.md,
gateway-routing.md, plugin-runtime.md, site remote.html (en/zh/ja).

Run (mote-run, at this commit):
- go vet ./... (darwin), GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go build ./...: ok; gofmt -l clean
- go test -timeout 45m -count=1 ./internal/gateway ./internal/provider at 7bc52d44e^{tree} (= this tree, origin/main 65bd4e4f7): gateway ok 497.9s, provider ok 88.7s
- go test ./internal/gateway -run 'Speech|Transcri|Embedding|Rerank|CORS|LAN|ReplyHeaders': ok

Broken by hand (mote-run, each red, then restored):
- the two mux lines removed: all five TestSpeech* red
- streams() false (answer read whole): TestSpeechStreamsAsItComes red
  (first event never reached the client while the vendor held the rest)
- "instructions" left out of the masked fields: TestSpeechInputMasked red

Not tried: a real vendor (OpenAI, Groq, Mistral) through a sandbox
magpie; only the fake upstream in speech_test.go. Not run on the
Windows or Linux boxes (vet only).
2026-10-29 19:25:40 +08:00
yetone 1319a44bbc docs: plugin guide says what four rules do when a plugin gets them wrong (plugins#468)
Guide (en, zh, ja) and provider-plugins.md:
- usage: leave used out rather than send 0; with amount/limit it is their
  share, with no count the window is text and routing doesn't read it;
  aside keeps a window out of routing whatever its count.
- sign-in: a model refused is 403/404, not 401; a 401 that says only
  that the model isn't served is read as kept.
- free comes only from the vendor's word; rate 0 is none given, never
  free (magpie infers nothing from rate).
- GitHub listing licence: from LICENSE as GitHub reads it, else
  package.json's license.

Docs only. Checked each claim against the source at this tree
(plugin_usage.go quotaOfPlugin, plugins.go modelOnly401, fallback.go
modelRefused, plugin/providers.go Model.Rate, models.go FreeModel,
github.go readTagged). Site deployed with wrangler and the pages read
back with curl.
2026-10-29 00:52:19 +08:00
yetone 8273325b05 site: Sidrune AI has a China and a Global site, picked by where the user is
Sidrune reported (10-29) that it runs two sites whose keys don't cross:
China at sidrune.ai and Global at global.sidrune.ai, and its website
sends a browser to one by language. magpie listed the China site only,
so a user abroad who signed up on Global and pasted that key got 401
Invalid API key. They asked for a Global / China choice that moves the
endpoints and the key link with it.

Sidrune's entry is now two regions instead of top-level endpoints:
China (cn: sidrune.ai/v1, sidrune.ai) and Global (global:
global.sidrune.ai/v1, global.sidrune.ai), each with its own key link
(register?promo=MAGPIE3 on its site) and website. With regions named
China and Global, the app's existing paths take over (ef155a5ca): the
editor shows a picker, Get a key and the site link follow the region, a
new provider starts at China's in mainland China and Global's elsewhere,
and the two keep separate accounts (SplitAccounts).

Providers added before keep their endpoints: a provider stores its own,
and its region is read from them, so existing users stay on China.

Checked: global.sidrune.ai/v1/models and /v1/messages answer
API_KEY_REQUIRED without a key, as sidrune.ai does;
global.sidrune.ai/register?promo=MAGPIE3 answers 200;
global.sidrune.ai/ redirects to sidrune.ai/, their landing page.

Run on mote: node --test site/*.test.mjs, 45 of 45 pass. go test
./internal/provider -run TestPartner, all pass. A throwaway test fed
worker.js served() over this partners.js to the app and found Sidrune
valid, a new provider at sidrune.ai in China and when the zone is
unknown and at global.sidrune.ai abroad (key and site /go links with
/cn and /global), SplitAccounts set, and a provider at sidrune.ai
still at China after the user moves abroad.

Not tried: a request with a key on either site, and the editor's
picker for Sidrune in the GUI.
2026-10-29 00:07:00 +08:00
yetone fc6f1d5e8d site: CoreCode serves OpenAI chat and Responses too, with its ref links and new copy
CoreCode (Joe, 10-28 23:12) added an OpenAI-compatible API and asked for
it in the Add sheet: chat and Responses at https://corecode.live/v1 beside
the Anthropic endpoint, keysUrl https://corecode.live/keys?ref=magpie,
website https://corecode.live/sign-in?ref=magpie, and the en and zh
taglines they sent, word for word (sponsors' copy is used as written).
zh-TW is made from the zh.

Checked: without a key, /v1/models lists the Claude models with
supported_endpoint_types anthropic and openai, and /v1/chat/completions
and /v1/responses answer 401 "Invalid token". Both ref links answer 200.

Run: node --test site/*.test.mjs on mote, 45 of 45 pass.

Not tried: a request with a key. The test key CoreCode sent on 10-26 now
gets "Invalid token"; a new one has been asked for.
2026-10-28 23:42:50 +08:00
yetone c2aad3db02 redact: a wallet address goes as written, and an IP as a documentation address the agent can use
0x0_air on X (10-28): with masking on, the agent stopped and asked again.
Their EVM address (0x89dfBD9b…, public) went as a secret placeholder and
the vendor's model told them to rotate it in case it was a private key;
the server IP they typed went as {{IP_…}} and the model refused to ssh
to it and asked for the real host.

- model.go: the local model's SECRET/ACCOUNT span on 0x and 40 hex
  digits (evmRe) is left as written; no rule matched it, the model's
  label did (the 0x prefix and mixed case got past hexRe). A 64-hex
  private key is masked still, and so is a 40-hex value called a key
  (secretCued).
- shape.go: an IP the IP rule masks goes as an address from the
  documentation ranges (192.0.2/198.51.100/203.0.113 .101-.254, IPv6
  2001:db8::/32), stable for the value, never shared by two values
  (falls back to {{IP_…}} past 462 IPv4 ones), and put back only as a
  whole address in replies and streamed tool calls (restoreAddr).
  Preview shows the same stand-in.
- docs: gateway-routing.md, and masking.html in en/zh/ja.

Run:
- Real models through the local gateway, the screenshot's ssh prompt
  with the placeholder vs a documentation address: with
  {{IP_k3v9x2mq}}, deepseek-v4-pro, glm-5.3, kimi-k3 and
  claude-sonnet-5-5 mostly searched ~/.ssh or asked for the real IP;
  with 203.0.113.147 or 192.0.2.183 all 20 runs over 5 models ran ssh
  at once.
- New tests (internal/redact/standin_ip_test.go): the screenshot's
  message, the tool call restored whole and streamed cut at every byte,
  boundary cases, IPv6, 472 addresses never sharing, the screenshot's
  address under labels secret and account_number with every category
  on, and a 64-hex key still masked. gateway TestRedactedKinds now
  wants a documentation address upstream.
- Broken by hand: without the evmRe check TestEVMAddressGoesAsWritten
  is red for every text and label; without restoreAddr the boundary
  cases are red; without the IP stand-in all three IP tests and
  gateway TestRedactedKinds are red.
- On mote at this head (rebased on 27bf14790): gofmt -l, go vet
  ./... for darwin, linux (-tags nogui) and windows, go test -count=1 -timeout 45m
  -tags nogui ./... (and go build for
  darwin, linux -tags nogui and windows): every package ok, exit 0.
  The run before at 56602426d had TestMoreKinds red, which wanted
  {{IP_…}}; it now wants the documentation address.
- Rebased again on 56d26f0bb (two gateway commits, #4004): go vet
  and go test -tags nogui of internal/redact, internal/gateway and
  internal/maskrec on mote at this head: ok.

Not tried:
- the real AstrLink model on an EVM address (the fake model gives it
  the labels it can give);
- a host name (user@host) still goes as {{HOSTNAME_…}};
- a documentation address the user writes themselves can match a
  stand-in in a reply and be put back as the real one;
- stand-ins are not kept across a restart or once their slot is
  evicted, like every placeholder.
2026-10-28 20:23:38 +08:00
yetone ae03279458 masking: the local model is on by default; the rules mask alone until it is downloaded
The owner's plan (10-28, after the xuanwo/_kaichen reports under the
masking demo): with AstrLink Guard picked, the Chinese-name heuristic
is off and only nicknames like 小王/老李 stay a rule; with Privacy Filter
it is as before; every format rule stays; the model is on by default,
masks with the rules alone until its download finishes, and no longer
answers 503 for it.

- masking.ModelWanted(st): on when the user turned it on, off when the
  user turned it off (new RedactModelOff, set by SetRedactModel(false),
  remove, and cancelling the default's own download), on when the
  default's download finished (RedactModelAuto). A settings file from
  before this, with a model name picked or files on disk and the model
  off, reads as the user's off: magpie's default doesn't override it.
- Until the picked model is installed, requests are masked by the rules
  alone and fetch starts its download (one try per model per hour,
  never under testing.Testing(), nothing where the model can't run).
  When it finishes, settings.UseDefaultRedactModel records the default
  (it refuses when the user has set anything) and the model warms.
- model(..., strict): a model that fails holds requests back (503)
  only when the user turned it on; under the default the rules mask
  alone. The Privacy page says which ("…the rules mask requests alone"
  in en, zh, zh-TW, ja, de; /api/privacy-model has `chosen`).
- redact.Options.NamesByModel (AstrLink Guard picked): zhNameSpans
  keeps only zhNick candidates (小/老 + a surname).
- KeepOwn and POST /api/settings keep both new fields.
- Docs: gateway-routing.md, site masking docs (en, zh, ja).

Run (mote, Go 1.26.8):
- gofmt clean; go vet of masking, settings, redact, gui; GOOS=linux go
  vet of masking, settings, redact; GOOS=windows go vet of the four.
  (GOOS=linux vet of internal/gui needs cgo, as on main.)
- go test -count=1 -timeout 45m ./... at base 7fd77a944: every package
  ok except internal/gui. Its reds: TestCoreScriptBudget (+64 bytes,
  fixed by dropping a comment, budget not raised), TestPrivacyModelPick
  and TestSettingsSaveKeepsWhatItDoesNotSend (updated for the new
  default and fields), TestMainWindowCorners (#3949, red on origin/main
  e8c7dddcb too), and three AppKit tests killed at 20-30s under load
  just before mote rebooted, which pass in the rerun.
- Rerun at base 6bec526f7: internal/gui (only #3949 red), masking,
  settings, redact ok. GUI node tests privacy-model, masking-records,
  masking-demo, routing-masking, i18n-keys, gui-zh-tw, gui-ja, gui-de:
  Chromium 199/199, WebKit 106/106.
- At the pushed base 9e33962c0: TestCoreScriptBudget, TestSettingsSave*,
  TestPrivacyModel* ok; i18n-keys and privacy-model 68/68 in both
  engines.
- At the pushed base 7fcf642ee (masking in the request archive):
  -run 'Mask|Redact|Archive|Privacy' in masking, gateway, redact ok.

Broken by hand, each red: the nick filter off
(TestChineseNamesByModelOnlyNicks), ModelWanted needing RedactModel
(TestModelOnByDefault), strict ignored (TestDefaultModelFailingIsTheRules,
TestNoModelYetMasksByTheRules).

Not tried: a real default download in a sandbox HOME (the tests fake the
model). Known limit: a user who turned the model on before model picks
existed and then deleted it has no name or files left, so reads as new
and gets the default on.
2026-10-28 16:55:24 +08:00
yetone 189db9ba5b redact: ids, digests and 毛利 go as written; the slider reaches known values; a user name goes as a made-up name
Reports on X under the masking demo (10-28):

_kaichen: "hash类型也会被过滤…长int,假如以1为开头的…会被当作电话被mask;
"毛利低"也会被当作人名被mask。即使把匹配拉到 0.95,也是一样行为".

- Hex digests: 16 to 31 hex digits in one case, with letters and digits
  both (a cache key, a short commit), are ids now (digestShaped in
  ids.go), like UUIDs and 32+ hex. The rules' SECRET keeps one only under
  a credential's field or a CJK/prose key with no field word (密钥为…);
  the model's SECRET is dropped under a field named for something else
  (cache_key, commit, object, blob, file, content, revision, partition,
  shard, bucket, dedup, lookup, row, sort) and on a JSON object's key
  (nameOfField). A bare `key` after api/access/secret/private/signing/
  license is still a credential (keyPhrase). The IBAN case kept its mask
  through the letter/digit minimums.
- 11-digit 1x numbers (phone.go, phoneAt): a phone with +86/86, as the
  value of a field whose name says phone (phone, mobile, tel, cell,
  contact, 手机, 电话, `number`), or in prose with no id word right
  before it (order, id, no., #, 订单号, 编号, 单号, 流水号…). Under
  order_id/uid, after 订单号, or with a letter or digit against it, it
  goes as written. PHONE and BANK_CARD are bounded by alnum, not digits,
  in the rule and in known values.
- 毛利: zhWords gained 毛利, 毛重, 毛坯, 毛巾, 毛衣, so 毛利低 (a margin)
  is no surname+name. The model still finds 毛利兰 (Guard). 毛利小五郎
  (indekkusu141209) is masked by neither model nor the rules now.
- The slider: a value masked once was masked again as known whatever the
  threshold. Each value now remembers the highest score it was found
  with (rules count as sure, ruleFound), and knownSpans skips one under
  Options.MinScore, which masking sets from pii.Threshold.

eerttreeeert: with mimo-v2.6-flash the home folder went as
C:\Users\{{USERNAME_…}}; the model took it for a temp folder and set out
to delete it. With the user name switch on, it now goes as a made-up name
of 8 lowercase letters (HMAC of the name, same every turn, standIn in
shape.go), restored in replies and tool calls like any placeholder;
Preview shows the same name.

Docs: docs/subsystems/gateway-routing.md masking bullets, and the site's
masking page (en, zh, ja) on mobile ids and the user name.

Run (mote, at this tree on base 6af83172d; rebased onto b01193ef9, which
changes nothing in redact, masking or pii, and redact, masking and
pii/... run again ok at the pushed head):
- gofmt -l clean; go vet ./... and GOOS=darwin/linux/windows go vet of
  redact, masking, pii: ok.
- go test -count=1 -timeout 45m redact, masking, pii/..., gateway, otlp,
  sessions, settings: all ok but internal/gateway's
  TestPluginStreamsPastTheBudgetWait (connection reset by peer, 183 of
  192), red the same alone at fresh origin/main b01193ef9 (169 of 192);
  #3946, commented.
- Real models on mote (AstrLink Guard and Privacy Filter, cached): the
  reporter's hashes, ids and every 毛利低 sentence kept; a prose phone
  masked; 毛利兰是谁 masked by Guard; 毛利小五郎姓什么 kept by both.

Broken by hand, each red: phoneAt off; the phone bound back to digits;
digestShaped off; "cache" out of the field list; nameOfField off; the
model's field check off; 毛利 out of zhWords; the slider check out of
knownSpans; standIn off.

Not tried: a real mimo-v2.6-flash session with the made-up name; the
Windows box; the GUI suite (no GUI file changed). 毛利小五郎 stays
unmasked by rules and both models, said in the doc.
2026-10-28 16:05:19 +08:00
yetone f95121dd05 README: sponsors in two rows of three, each logo in an equal slot
Six logos wrapped onto a row of five and a lone AIGoCode. Now a <br>
after the third, and every logo is width=144 height=36 so the columns
line up (SVGs keep their ratio inside the box). AIGoCode's PNG is
640x170, which would stretch at 4:1, so the READMEs use a copy padded
to 680x170 (light and dark); the home page keeps the original.

Run: mote-run node --test site/*.test.mjs, 45/45 pass. Rendered the
rows in headless Chrome on a dark background and checked the columns line up.
Not tried: GitHub's own render (it goes live with the push).
2026-10-28 16:02:07 +08:00
yetone dfb73a04ef site, README: AIGoCode's dark logo in dark mode
AIGoCode sent the logo on a navy background; the navy is taken out to
transparency (colours un-blended at the edges) and the logo is placed in
the light PNG's 640x170 box, so the card doesn't move between themes.
Checked by eye over a dark and a white background.
Ran: node --test site/*.test.mjs on mote, 45/45 pass.
2026-10-28 15:52:01 +08:00
yetone 18b17a50b9 site: AIGoCode's card takes the copy AIGoCode sent
The en and zh text is theirs word for word; ja and de are translated
from it.
Ran: node --test site/*.test.mjs on mote, 45/45 pass.
2026-10-28 15:50:39 +08:00
yetone 60520ddb3b moejs: v0.1.0-alpha.11, at its new module path github.com/MoeForge/moejs
Gateway middleware and agent plugins run on moejs. alpha.11 moves the
module to github.com/MoeForge/moejs; every other API change since
alpha.4 is an addition. What magpie gets: faster calls, loops, property
lookups and JSON.parse, allocation-free await, a bytecode verifier, a
correct default.pgo, and Intl / toLocaleString in plugin code.

Checked against both tags' source: every name magpie uses (NewRuntime,
Options, Compile, Link, Hook, Value, Arg, Undefined, NativeFunc,
Referrer, the Promise results, Exception) has the same signature, and
Options' defaults (shared frozen builtins, no timers) are unchanged.
fetch, Streams, URL, node:fs and node:buffer live in the separate
webapi and node packages, installed only on request; magpie installs
neither, so a plugin still reaches no network or file.

Intl's CLDR, Unicode, ICU and V8 material is compiled into every build,
and moejs asks a program that includes it to carry sections 1 to 4 of
its notices. THIRD_PARTY_NOTICES holds them verbatim. Release archives
ship no LICENSE today either; that is not changed here.

Doc and site links (docs/, site/public/docs/{,zh/,ja/}plugins.html)
point at the new repo.

Run on mote at this tree: gofmt; go build -trimpath -s -w (60,670,658
bytes on origin/main 58fb3a778, 62,329,250 now, +1.66MB); go vet of
middleware, jsmod, agentplug for darwin, linux and windows; go test
./internal/middleware/... ./internal/jsmod/... ./internal/agentplug/...
ok; go test -run 'Middleware|Strateg|OnUsage|JSPlugin|Agentplug|AgentPlug'
./internal/gateway ./internal/provider ./internal/plugin ./internal/gui
ok.
Not run: the full suite, the GUI suite, a real request through a
middleware in a running gateway.
2026-10-28 14:36:17 +08:00
yetone 0f4763f434 site: AIGoCode's card says sign-ups through it get 10% extra credit on top-ups
Asked by the owner. The sentence is added in en, zh, ja and de.
Ran: node --test site/*.test.mjs on mote, all pass.
2026-10-28 13:40:58 +08:00
yetone 8bade6c5e2 provider: a plugin's usage window can be a prepaid wallet's balance (#3950)
SuperMagic's accounts (mycf_711's magicrew plugin) are prepaid wallets of
points with no total. A plugin can now send a usage window as
{name, balance: 6291, unit: "积分"} with no used or limit.

- host.js passes a finite balance on (at least 0), anything else as null.
  plugin.UsageWindow.Balance and provider.QuotaWindow.Balance are *float64.
- quotaOfPlugin keeps the figure and does not make the window Text or
  Aside, so routing knows the account with no Used invented. allowanceOf
  copies it into Limit.Balance; an empty wallet counts as used up.
  Allowance.Left(model) is the least balance of the windows that count
  the model.
- weighRouted fills routes.Seat.Left and Seat.LeftIn (the account's
  provider and unit). Smart, pace and usage (least used) put the seat
  with more left first where they would otherwise tie (byLeft), only
  when every seat with a balance shares one LeftIn: balances in two
  units or two providers are never compared. Tiers still come first.
- The Usage card, the Routing page (Weighed.Balance: the small row's
  text, no bar, a why sentence, the account list), magpie accounts and
  the status line show the figure, "6,291 积分 left", never a share.
- Docs: provider-plugins (new section), gateway-routing,
  providers-accounts, plugin-runtime, host.js typings and the site's
  plugins page (en, zh, ja).

Run, at base f13aafa87, on mote:
- go test -tags nogui -timeout 45m ./...: 72 packages ok; red were
  TestQuotaSpanCarriesEveryWindowField (this change's: its fixture now
  sets Balance, green after), and on the unchanged base too
  TestWSLColdPlaceOpensNothing (#3924), TestFetchAsksASharedBaseOnce and
  two siblings (#3854), TestTUIFetchesSubscriptionModels (#3919), all
  fixed on main since and run again after the rebase; and
  TestPluginStreamsPastTheBudgetWait (#3946), green alone on both.
- GOOS=linux and GOOS=windows go vet -tags nogui ./internal/..., go
  build ./..., gofmt -l: clean.
- New tests: TestPluginWalletBalanceIsAReading, TestAllowanceLeftIsTheLeastBalance,
  TestPluginHostPassesABalanceOn (through real Bun and host.js),
  TestWalletsGoByWhatTheyHaveLeft, TestWalletLeftWithinItsTier,
  TestWalletWithMoreLeftGoesFirst, TestQuotaCell's balance cases;
  usage-wallet-balance.test.cjs and routing-wallet-balance.test.cjs,
  34 of 34 in Chromium and WebKit, en zh zh-TW ja de, 1100/900/420/390px.
- GUI: every quota*, usage*, panel*, routing*, i18n* and tray* file (220
  files, 2928 tests), concurrency 4: 130 red, in 21 files. Those 21 files
  run again on an unchanged base copy and on this change, concurrency 2:
  the same 19 files red on both (126 and 131), the differing subtests
  being routing-rule-remove / rules-line / intent-entry flaps that go
  both ways. Each is filed (#3679, #2115, #3410, #3404, #3411, #3897,
  #1905, #3096, #3593, #3408, #3409, #3799, #3789, #3412, #3947, #3415,
  #3414, #1345); routing-story-shrinks had none and is #3954.

After rebasing on origin/main 833f51adc, on mote: Linux and Windows vet,
go build, gofmt clean; go test -tags nogui of internal/routes, provider,
gateway, cli, plugin, gui (the script budgets), agent and tui: all ok;
the two wallet GUI files and i18n-keys: 37 of 38, the red being
i18n-keys' "Runs as" (#3897, not this change).

Broken by hand, each red then restored: quotaReport's Balance copy
removed (TestQuotaSpanCarriesEveryWindowField red); byLeft always nil (routes and
gateway tests red); host.js's balance line removed (host test red);
quotaOfPlugin's balance copy removed (provider tests red); app.js and
client.js at base (both GUI files 34 of 34 red, "0% used" / "已用 0%").

Not tried: a real SuperMagic account or the magicrew plugin (it isn't
in the community repo; it needs to send balance), Windows and Linux
GUI apps, and the WebKitGTK app.
2026-10-28 08:28:56 +08:00
yetone 0f053024f5 README, site: link Apache Magpie and the ASF in the not-affiliated note
Jarek Potiuk (Apache Magpie PMC) suggested linking magpie.apache.org and
apache.org instead of naming them, to avoid any other confusion. Both
READMEs and the site footer (en, zh, ja, de) now link them.

Run: node --test site/*.test.mjs on mote, 45 of 45 pass.
2026-10-28 07:25:32 +08:00
yetone 4b0a32e0f3 site: AIGoCode's two links carry its invite code and a utm tag per place
The owner asked for referral tracking on both. aigocode.net reads no
aff parameter: its attribution takes utm_source (or ref), utm_medium
and the other utm_* from the landing URL, and the referral is the
/invite/<code> path. So /go/aigocode/home and /go/aigocode/readme both
land on /invite/MAGPIE, with utm_source=magpie and utm_medium=home or
readme to tell the places apart.

Run: node --test site/*.test.mjs (45 pass). Both new URLs answer 200.
2026-10-28 06:16:59 +08:00
yetone dc1cfe0156 site: AIGoCode on usemagpie.ai's Sponsored by and in the READMEs
AIGoCode took the home and README seats together (paid, Wise USD).
A fifth home card after SoleAPI, and a logo at the end of the Sponsors
row in README.md and README.zh-CN.md.

The logo is the 1280x368 PNG AIGoCode sent, cropped to its content and
scaled to 640x170. Its blue and purple mark sits on transparency and
reads on white, #1c1c1e and GitHub's #0d1117, so one copy serves both
themes. The en and zh taglines are AIGoCode's own; ja and de are
translated from them.

/go/aigocode/home sends the browser to https://www.aigocode.net/ and
/go/aigocode/readme to https://www.aigocode.net/invite/MAGPIE, the link
AIGoCode gave for the README (first top-up bonus).

Not tried: AIGoCode's API in a real agent. The owner chose to go live
without a test key; neither seat puts AIGoCode in the app.

Run: node --test site/*.test.mjs (45 pass). Logo rendered on light and
dark backgrounds and looked at.
2026-10-28 05:02:45 +08:00
yetone 5a9fb36a10 README, site: magpie is not affiliated with Apache Magpie or the ASF
Apache Magpie's PMC asked about the shared name. magpie keeps its name
(a common word, thousands of older projects use it) and says plainly it
is not affiliated with Apache Magpie or the Apache Software Foundation:
a line under License in both READMEs and in the site footer (en, zh,
ja, de).

Ran: node --test site/*.test.mjs (45 pass).
2026-10-28 00:40:23 +08:00
yetone 2675169eca site: SoleAPI's home card goes to its /r/magpie referral link
The owner asked for https://soleapi.com/r/magpie in place of ?aff=magpie. It lands on soleapi.com/register?ref=magpie (200).

Run: node --test site/*.test.mjs (45 pass).
2026-10-27 23:26:37 +08:00
yetone e09616adf1 site: SoleAPI's home card carries aff=magpie
The owner gave SoleAPI's referral code: /go/soleapi/home now sends the browser to https://soleapi.com/?aff=magpie (200).

Run: node --test site/*.test.mjs (45 pass).
2026-10-27 23:08:03 +08:00
yetone 00f8b11340 site: SoleAPI on usemagpie.ai's Sponsored by
A fourth home card, after FastAIToken. The tagline is the owner's
("不拼最低价,拼不掉线:多渠道容灾,逐笔透明计费"), translated for en, ja
and de. The logo is the PNG the owner sent, cropped to 640x157; the
dark-mode copy turns the black mark and "Sole" light and keeps the blue
"API" and its green dot.

/go/soleapi/home sends the browser to https://soleapi.com/ (200, titled
"SoleAPI - LLM API Gateway"). No referral code was given; when SoleAPI
sends one, it goes into sponsors.js.

Run: node --test site/*.test.mjs (all pass). Logos checked on white and
on #1c1c1e.
2026-10-27 23:01:15 +08:00
yetone df8e9de3f1 redact: a masked word that is a date matches that date however it is written
JackyCcao on X turned birthday masking off (old dates in logs and tasks
after a birthday's word were still taken) and put their own birthday in
Masked words instead. A word matched only as typed, so 1990-05-12 let
1990/5/12, 1990.05.12, 1990年5月12日 and 19900512 go as written.

A masked word that is all of a date (dateword.go: year-month-day with
- / . 、 or a space, 年月日 or 년월일, a month's English name, or
day/month/year where only one reading is a date) now matches that
calendar date in each of those forms, with or without leading zeros,
as eight digits, and day-first or month-first only where the day is
over 12 or equals the month: for 1990-05-12 neither 05/12/1990 nor
12/05/1990, which reads as December 5th too. A word like 05/12/1990
is no date and matches only as written. Eight digits alone are not
taken for a date word (as likely an id) and match as before. A date
match never has a digit, or a dot and a digit, beside it, whatever
Whole words only says, so 1990.5.12.1, 3.1990.5.12 and 11990-05-12
are no match; this is a change for a date word without Whole words,
which matched inside such numbers before.

The birthday rule is not changed. It takes a date only right after a
birthday's word (生日, DOB, born...), so a log line's, a file name's
or a task's own date is never one, however old. What is left (生日:
2019-03-02 in a task log about a party) has the same shape as a real
date of birth, and a time beside the date doesn't tell them apart: a
date of birth stored as a time (1990-05-11T16:00:00.000Z, midnight in
UTC+8, as JavaScript writes it) is the commonest way one reaches an
agent in JSON. TestBirthdayLogDates pins both sides; #3878 tracks
fixed-shape false alarms.

Tests: TestDateWordEveryForm (22 forms x 5 words x 6 contexts, each
restored as written), TestDateWordDayMonthOrder, TestDateWordNotAnotherDate
(another date, 1990.5.12.1, longer numbers), TestDateWordOnlyADate.
Broken by hand: with the dateSpans hook in mask turned off, EveryForm,
DayMonthOrder and NotAnotherDate fail; OnlyADate and BirthdayLogDates
pin behaviour that was already right and pass on both.

Docs: gateway-routing.md, masking.html en/zh/ja.

Run on origin/main 94c2aaecb, sandbox HOME and GOCACHE, then rebased
onto 841bcf8da (its changes are in usage and gateway/history.go, none
in redact) and the vet and the four packages run again there; on e056779a6
(a GUI change, nothing in redact) redact, masking and settings again:
- gofmt -l clean; go vet clean on macOS, GOOS=linux -tags nogui and
  GOOS=windows (internal/redact).
- go test -count=1 ./internal/redact/... ./internal/masking/...
  ./internal/pii/... ./internal/settings/...: ok. The date tests also
  with TZ=UTC and TZ=Pacific/Kiritimati: ok.
- go test -count=1 -timeout 100m ./internal/gateway (at 94c2aaecb):
  every test ok
  but TestPluginToldWhereTheAgentWorks, which failed only because the
  run's TMPDIR was inside this git worktree (its "not in a repo"
  folder was in one, git "yes"). Run alone with TMPDIR outside the
  repo it is ok; with TMPDIR inside it fails at this head too.
Not run: the full ./... suite (another session's full suite holds the
machine, load ~100-140). No GUI asset changed, so no GUI run.
2026-10-27 22:44:52 +08:00
yetone e96a8d2d40 privacy: the local model's threshold defaults stay, measured on real traffic
Yayoi_no_yume (X) asked for 0.85-0.95, ~0.88, over a hardcoded 0.5.
The threshold is the user's per model since v0.1.1689 (Settings >
Privacy > Confidence threshold, 0.5-0.95). This measures whether a
different default would be better, and keeps the defaults.

Corpora: 2000 segments of the owner's real Codex and Claude Code
sessions (prompts, tool arguments and results; 550 with CJK), kept
local; and 101 labelled cases (the 72 eval cases incl. #3029,
#3143, #3144, plus 30 new), 64 values that must be masked, 188 that
must not. Both real models, in a scratch cache: Privacy Filter q8
GGUF via pf-v2, AstrLink Guard rev 7216b6a3b897 (sha256 checked).
Rules alone mask 16 of 64.

  model  thr   labelled masked/64  labelled FP/188  real model masks
  Guard  0.5   60                  0                34
  Guard  0.8*  57                  0                20
  Guard  0.88  56                  0                12
  Guard  0.95  54                  0                 6
  PF     0.5*  59                  2                31
  PF     0.8   57                  1                19
  PF     0.88  56                  1                13
  PF     0.95  56                  0                12

Guard 0.8 -> 0.88 drops 3 false alarms (a model id, a sandbox path
word, a token counter) and lets a real colleague's name and a
labelled signed name through. PF 0.5 -> 0.88 drops 11 (timestamps
in paths, log lines, a plugin id) and lets 6 names and a phone
through, 4 of the names in real traffic. A higher default sends
real names unmasked; the false alarms left are shapes (ISO
timestamps in paths, Claude Code's <total_tokens> counter, base64)
that a check can turn away. The docs now say what the threshold
trades, en/zh/ja masking pages and gateway-routing.md.

Run at this head (and 89ef90356 under it), rebased on e7f21dba5:
gofmt -l, go vet (darwin), GOOS=linux -tags nogui and GOOS=windows
vet of redact (+gateway on linux), go build: clean. go test -count=1
internal/redact, masking, pii/..., settings, otlp, sessions: ok.
Not run before push: internal/gateway and internal/gui (both import
redact) and the full ./... suite, the machine at load ~138 with other
sessions' suites; running after. No GUI asset changed. Eval
recordings (testdata/eval-*.json) not re-recorded; TestMaskEval ok.
2026-10-27 17:10:20 +08:00
JoeyWu-tech 430e3050d8 gateway: magpie's own searches and image descriptions go without the agent's middleware (#3695)
aiirobyte (#3695): the gateway exited five times on 2026-10-26, and
every client was refused until it was started again. The one exit with
a stack died of "fatal error: concurrent map read and map write": two
of seenBody's goroutines in middleware.(*Run).Tried at once, one of
them in moejs's InternGoString.

A request's middleware runs in runtimes of the request's own
(serveAgent). Only one goroutine may use a runtime at a time (moejs),
and Run has no lock to hold callers to it. serve runs each try's
onProvider on them (triedOn) through the Tried the request's context
carries. For a model that can't see, magpie has each image of the
request described (seenBody), up to four at a time, and each
description is a request it makes of its own gateway on a context made
from the agent's (magpieChose(ctx)). So the descriptions carried the
agent's Tried and ran onProvider on one runtime from as many
goroutines. A model that can't search has its searches made the same
way (searchWith): a search is asked beside the agent's own stream,
which goes through the middleware's onEvent, and beside the round's
other searches, so one search is enough to share the runtime when the
middleware has onEvent. The runtime's maps were read and written from
two goroutines and the gateway died. When it didn't, the calls' values
crossed. In the runs below, hooks threw on values that weren't there
("Cannot read properties of undefined (reading 'push')", and "(reading
'messages')"), and a description went out as
{"0":0,"messages":[0,{"content":[0,{"image_url":0}],...}],...}, its
max_tokens, system prompt, text and image each turned into 0. An
earlier run of the same break (tree e1c90a00, this code with older
comments) had one image asked about twice and another never.

ownAsk takes the request's Tried off the context of those two asks, so
they go without the agent's middleware, as serveAgent's comment already
said of them ("search and vision stand-ins") and as magpie's other own
requests (titles, the classifier) go. The agent's own tries are as
before: each runs onProvider once, on its runtime. The subsystem page
now says why, and the user docs (en, zh, ja) name searches and image
descriptions among magpie's own requests.

Going without also keeps what the docs tell a hook. Its ctx.protocol,
ctx.model and ctx.stream are the agent's request's, while a
description's body is a Chat request and a search's an Anthropic one,
whatever the agent speaks. A description is also kept for later
requests (sights), so one asked through a request's middleware was
handed to later requests, other agents' too. The one community
middleware with onProvider, antigravity-cloak, rewrites Claude Code's
and Codex's lines in the system prompt, which a description's or a
search's prompt, magpie's own, doesn't have.

Not changed: the report's other fixes, a lock over the runtime, one ask
at a time, or a Run per ask. Each keeps the gateway up but still runs
the agent's middleware on asks that are magpie's own, which the docs
say go without it, and with the first two onProvider still gets bodies
its ctx doesn't describe. With ownAsk nothing else uses a request's Run
from two goroutines (holdWriter's keepalive writes under the h.mu the
handler's writes hold). magpieChose is left as it is: it says whose
pick a call is, and its other callers, Codex's thread titles,
descriptions and predictions (codex_titles.go), run before serveAgent
with no Tried to take off.

What was run (tree 4f97ac18, on origin/main 865df247, go1.26.8,
linux/amd64):
- TestImagesDescribedWithoutTheAgentsMiddleware, new: a text-only model
  asked with four images, and a middleware whose onProvider adds a line
  naming the provider's model. The four descriptions reach the model
  that sees without the line, the text model's request has it, and
  onProvider is called once, with no failure.
- TestSearchesWithoutTheAgentsMiddleware, new: a model that can't
  search makes two web_search calls in one round, with a middleware that
  has onProvider and onEvent. Both searches reach the searcher without
  the line, the model is asked twice, its first ask with it (the second
  goes on from that ask's body), and no hook failed.
- Both, without -race: -count=50 -v, 100 PASS; -count=40 three more
  times, ok.
- go test -tags nogui -race -count=20 -cpu 1,2 ./internal/gateway with
  this -run, ok, no race:
  'WithoutTheAgentsMiddleware|TestMiddleware|TestTextOnlyModel|TestVisionSetting|TestImageThatCant|TestGroupsTextOnly|TestDescriberThatCant|TestSeerPicks|TestManyImages|TestWebSearch'
- Broken by hand, each run with -race -count=1, then without -race at
  -count=40 three times:
  - main's vision.go: the test red, onProvider called 5 times (each
    description and the agent's try), 3 of the calls throwing "Cannot
    read properties of undefined" (reading 'push' twice, 'messages'
    once), the fourth description reaching the model that sees through
    the middleware as the mangled body above, races reported. At
    -count=40 all three runs died: of "concurrent map read and map
    write" in InternGoString (intern.go:167) twice, and of "concurrent
    map writes" in internASCII (intern.go:195) once.
  - main's search.go: the test red, both searches through the
    middleware, races reported. At -count=40 each run had 40 of 40 red,
    and none died.
  - ownAsk returning the context as it is: both tests red, races
    reported. At -count=40 all three runs died of "concurrent map read
    and map write" in InternGoString.
- A real run: magpie built at 865df247 and at this tree (go build -tags
  nogui -buildvcs=false), magpie serve in a sandbox HOME, a provider (a
  local server) with a text-only model and one that sees (from its
  /v1/models' modalities), Settings' vision model set to the one that
  sees, and a middleware added with magpie plugin add whose onProvider
  adds a line. 200 requests to the text-only model on
  /v1/chat/completions, four new images each, twice per build.
  865df247's gateway answered 6 and died on the 7th request, of
  "concurrent map read and map write" at the report's intern.go:167 in
  InternGoString, reached from Run.Tried; in the other run it answered
  7 and died on the 8th, of "concurrent map writes". 24 and 28
  descriptions reached the vendor, all but one with the line; that
  one's onProvider threw "Cannot read properties of undefined (reading
  'push')", so it went as it was. This tree's answered 200 of 200 both
  times, its 800 descriptions without the line and its 200 text
  requests with it.
- gofmt -l lists nothing; GOOS=linux, windows and darwin go vet -tags
  nogui ./..., GOOS=windows go vet ./..., GOOS=linux and darwin go
  build -tags nogui ./... and GOOS=windows go build ./...: exit 0
  each. go vet and go build without the tag on linux: exit 1 (this box
  has no GTK or WebKitGTK dev packages).
- node --test site/*.test.mjs, as CI runs it (node v22.22.1): 45 pass
  (none of them reads plugins.html).
- Full suite, -tags nogui (CI's Linux job tags gtk3), outside graftcp
  (systemd-run, umask 077, Bun 1.4.2 first on PATH as on CI, -timeout
  45m, log kept): 65 ok, and 7 red, none in what this changes:
  - agent TestCodexDriftReached and TestCodexBehindReverseProxy: #3398;
    TestCopilotFolderFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
    and TestZedAppPath: #3141;
    TestReasonixCLIRequiresSupportedNativeVersion and
    TestReasonixCLIRecoversAfterProbeTimeout: this box's /tmp/.git,
    #3641.
  - edit TestWriteAtomicReadOnlyHardLink and testenv TestProgram: this
    box's umask 077, #3640.
  - gateway TestPluginToldWhereTheAgentWorks, the package's only red:
    this box's /tmp/.git, #3675.
  - gui TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie:
    this box's millions of open fds, #3649.
  - pii TestFindJoinsTextsAndMapsBack, TestGPUDeathMovesToCPU,
    TestServeStartsWithoutResidencyHeartbeat and TestWarm: #3741, fixed
    on main by c84f859d.
  - provider: "fatal error: close of synctest channel from outside
    bubble", #3632; the package's tests after it didn't run.

Not tried: macOS, Windows (built and vetted only), the reporter's
middleware (the report doesn't name it), a real vision model or
searcher.
2026-10-27 15:47:49 +08:00
yetone f0ffee34ce guard: on a Mac AstrLink Guard runs through CoreML, 512 tokens in 12ms where the CPU takes 400
yyhhyyyyyy on X asked for CoreML. internal/pii/guard now runs the
encoder (everything after the embeddings) as a CoreML program on a Mac
with macOS 13 or later, on the Neural Engine or GPU (MLComputeUnitsAll).
bert.go still does the embeddings and stays the path everywhere else.

- coreml_gen.py builds the program with coremltools' MIL builder from
  the pinned int8 model: the int8 weights dequantized, float16 compute.
  The repo keeps only the graph (coreml.mlmodel, 112KB) and coreml.json
  (each blob's offset, weight.bin's size and sha256). On each Mac the
  weights are written from the model already downloaded (coremlWeights,
  float16 rounded to nearest even as numpy does), checked against that
  sha256, compiled once into <model dir>/coreml/<sha>.mlmodelc (about 5s,
  41MB), and opened from there after that (40-170ms). Nothing new is
  downloaded or hosted.
- The cgo lives in internal/pii/guard/coreml, because guard has Go
  assembly. Without cgo or off darwin it is a stub (Available false).
- A window under 16 tokens (coremlMin) stays on the CPU, which is faster
  there (8 tokens: 8.7ms CPU, 12.5ms CoreML; 16: 17 vs 13). A Mac before
  macOS 13, a failed write, compile or open, or a failed run goes to the
  CPU too. Model.MLErr keeps why.

Accuracy against the publisher's fp32 ONNX (onnxruntime): CoreML's
probabilities are within .067, the CPU's within .129, and both agree
with fp32's labels on the same tokens. The CPU quantizes activations as
the int8 model does and CoreML doesn't; fake quantization in the program
was tried and didn't match the CPU (.75 on CPU fp32, .70 on GPU,
unstable in fp16), so it was dropped. A span near the threshold can fall
the other side: TestModelFinds' go.mod module path is a common_secret at
.814 on CoreML, .788 on the CPU and .785 in fp32, so on a Mac it is
masked at the default 0.8. TestModelFinds now tests bert.go alone
(m.ml = nil), and TestCoreMLMatchesGo holds CoreML to it.

Run (M4 Pro, macOS 26.2, under load ~50):
- gofmt -l internal/pii: clean. go vet ./internal/pii/... with GOOS
  darwin, linux, windows and CGO_ENABLED=0: clean.
- MAGPIE_GUARD_DIR=<pinned model> go test ./internal/pii/...
  ./internal/redact/... ./internal/masking/... -count=1: ok. In guard:
  TestHalfRounds, TestCoreMLWeights (weight.bin's sha256),
  TestCoreMLMatchesGo (99%+ argmax agreement on a 512-token window, the
  same spans as the CPU with scores within .2; loaded in 6.3s cold,
  17ms for 512 tokens), TestCoreMLFailureFallsBack and TestModelFinds.
- TestMaskEval/astrlink-guard replayed with outputs recorded through
  CoreML: the same verdicts at the default threshold; scores moved a
  little and one account_number span at .508 is new, under 0.8.
  eval-astrlink.json stays the CPU's recording.

Broken by hand: half() rounding ties up instead of to even turns
TestHalfRounds red; a wrong sha256 in coreml.json makes Load fall back to
the CPU with MLErr set, find the same spans and leave the compiled
program in place (TestCoreMLFailureFallsBack).

Not tried: an Intel Mac, macOS 13 or 14 (only 26.2), the real app's GUI
with Find with a local model on (the gateway path calls the same Find).
2026-10-27 15:01:32 +08:00
yetone e111e08aaf site: 鱼鱼连线's home card goes to its register page with the owner's aff code
The owner asked for https://app.yylx.io/register?aff=YETONE in place of
https://yylx.io/?ref=magpie. Run: node --test site/worker.test.mjs, 0 fail.
2026-10-27 14:21:03 +08:00
yetone 19dc5b9252 routing: accounts renewing together spend first the one whose credits left lapse first (zhaocai_83020 on Discord)
zhaocai_83020 on Discord asked how to make several WorkBuddy accounts
spend the credits that expire soonest first. Smart, the default routing,
already took a window's runsOutAt (plugin 0.1.14, cdredfox on X) as its
renewal, but only when it came before the window's reset. Since plugin
0.1.35 (windy on Discord) a WorkBuddy free account's Credits window
resets at the month's end, the same moment on every account (cycleOf,
packages/workbuddy usage.test.mjs CN_FREE: 10-31 23:59:59 +08), so given
credits lapsing after that end ranked alike and kept the accounts'
listed order: the account whose credits were lost first wasn't spent
first.

Allowance.Lapse is the soonest RunsOut in the future of a window that
counts the model, carried to routes.Seat.Lapse. Smart goes by it, to the
hour, only when the renewals tie: the one lapsing first goes first, one
telling none after those that do, the same hour keeps the listed order.
The share-used tiers and the renewal still decide before it. It is read
from the window's structure (RunsOut), not the provider's name; only the
WorkBuddy plugin sends runsOutAt today. Weekly pace and the other
routings are unchanged, as before. The gateway-strategy plugin seat
(middleware/points.go) doesn't carry it, as it carries no Free, Credits
or speed either.

Docs: reference.md (How magpie picks an account), gateway-routing.md,
site docs start.html en/zh/ja (not deployed by this commit).

Run at 2e165fe9d + this change; rebased onto 50606d8c0, which changes only internal/sessions:
  go test -tags nogui -timeout 45m ./internal/routes/ ./internal/gateway/  ok
  go test -tags nogui -timeout 45m ./internal/provider/ -skip
    TestUnreadLoginsWriteErrorsKeepCredentials  ok
    (that test crashes the package with "close of synctest channel from
    outside bubble" in filememo.Forget, untouched here: #3632, open,
    with patches under review there)
  go vet, GOOS=linux go vet -tags nogui, GOOS=windows go vet on
    ./internal/routes/ ./internal/provider/ ./internal/gateway/  ok
  gofmt -l on the changed files  clean
New TestSmartSpendsCreditsLapsingFirstWhenRenewingTogether: with
strategies.go put back to origin/main by hand it fails "lapsing first
goes first: ab"; green with the change. The windows are the plugin's
for a real China-site free account (reset at the month's end over 31
days, given credits lapsing on their own day).
Not tried: a real move of requests over several real WorkBuddy free
accounts (no such accounts on this machine), and a GUI run (no GUI
change).
2026-10-27 11:56:05 +08:00
yetone 92cf0b68df docs: the two local models and how one is picked (#3578)
gateway-routing's masking paragraph, the pii package comment, and the
site's masking page in en, zh and ja name AstrLink Guard, the default,
and Privacy Filter, and say what the picker beside the switch does.

Run again after rebasing the stack onto f2aa7fe34 (the backend commit now
carries #3682's chunk-at-a-time find, and serve_test.go calls pf.missing):
gofmt clean; go build; GOOS=linux go vet -tags nogui ./..., GOOS=windows
go vet ./... (amd64) and arm64 for internal/pii clean; go test -race
internal/pii/... ok; go test internal/pii/..., masking, redact, settings,
source, gwmw ok; gateway -run 'Mask|Redact|Privacy|PII|Unmasked' ok; GUI
privacy-model, i18n-keys, account-mask, mask-actions 74/74 (both engines).
internal/gui: one -count=1 run red with its log lost, two green; -count=2
red on TestDesktopSubagentModelNotice, which fails the same on origin/main
f2aa7fe34 from its second run on (#3787, Claude Desktop, not touched here).
2026-10-27 02:01:17 +08:00
yetone d9a8148d7c routing: Speed first sends a request to the provider or key that answered the model fastest lately
joeliu96872540 on X: when one model is reachable through several API
channels, they want an option that sends each request to whichever has
been answering fastest, because they compare channel speeds by hand
today. Speed first (`fast`; `fastest` and `speed` also work) is a new
routing beside Free first. It applies to a provider's keys and accounts
(provider editor › Routing) and to a group of one model on several
providers (Routing page › group › Routing).

How it decides. When a streamed answer ends, gateway/speed.go records two
numbers for that account or key and model (restID): the time to first
token and the output tokens per second, as usage.DecodeOf computes them
for the Requests page. Each is a decayed average with a 20m half-life.
After an hour with no answer the record goes stale, and the store holds
at most 4096 records. This is O(1) at the answer choke point, beside
servedCandidate. For a pool routed by BySpeed, weighRouted reads one map
entry per candidate, and only for that pool. The usage history is never
read on a request.

routes.Fastest ranks each awake seat by its estimated time to a
200-token reply: TTFT + 200/TPS. A seat that reported no TPS gets the
median TPS of the others. Seats within 10% of the fastest in their band
keep their listed order, so near-ties don't swap on every request.
Seats with no recent measurement go after the measured ones. One request
in five, counted per pool, goes first to an unmeasured seat, rotating
among them, so each gets measured again. Resting seats go behind the
awake ones, and used-up seats behind those. Rests and failover are the
same as for every other routing.

The request trace gets lateTtft and lateTps, and the row-story sentence
says "answered m fastest lately: first token in 0.8s, 60 tokens a
second". It has a variant for a probe turn and one for when no seat has
been measured yet. i18n covers zh, zh-TW, ja and de. Also updated: the
CLI (`magpie group|provider set <id> routing=fast`, plus a new
`routing=` pair on provider set that refuses manual), the TUI name, the
rotation plugin's Sub, docs/subsystems/gateway-routing.md,
plugin-runtime.md, docs/reference.md and site start.html (en, zh, ja).
There is no new layout: it is one more item in the existing pickers.
app.js stays under its budget with no raise.

Tests:
- routes/fastest_test.go:
  - ordering: fastest first, slow writer loses, alike keep order,
    resting and used-up, median pace, none measured;
  - the probe turn at 5, 10, 15 and 20, rotating between seats;
  - a resting seat never gets a probe turn.
- gateway/speed_test.go:
  - decay, staleness and per-model records, with an injected clock;
  - a group of slowv and fastv routed fast: after the speeds are
    measured and seeded, the request goes to fastv with lateTtft set;
  - the same group routed in order still goes to slowv.
- cli: parseRouting and the provider routing= pair.
- GUI routing-speed-first.test.cjs: the row story for measured,
  no-pace, probe and none, in en, zh, zh-TW, ja and de, in chromium and
  webkit: 40/40.

Broken by hand:
- Fastest returning the listed order: the routes tests and the gateway
  group test go red.
- noteTrySpeed removed: "the streamed answer wasn't measured".
- The client.js case renamed: routing-speed-first 0/20 in chromium.

Run at b5a5caff2 (base 5b4dec58e):
- `go test ./... -count=1 -timeout 45m`, alone on the machine, at load
  130-230. Every package is ok except:
  - internal/provider: TestUnreadLoginsWriteErrorsKeepCredentials
    crashes with "close of synctest channel from outside bubble"
    (#3632, open);
  - internal/gui: TestMainWindowCorners and
    TestTrayCellClickReleasedPanel are killed at their deadline under
    load (#1936, #2645).
- gofmt -l is empty. go vet is ok on darwin, on GOOS=linux with -tags
  nogui, and on GOOS=windows for ./internal/....
- GUI files the change reaches, both engines, every language they test,
  all ok: i18n-keys, gui-de, gui-ja, gui-zh-tw, routing-save,
  routing-save-keeps-the-row, builtins, panel-routing,
  panel-routing-pick, panel-routing-providers, panel-routing-hidden,
  routing-key-windows, key-weight, key-weight-fit, group-member-weight,
  routing-weight-chip, account-arrange and routing-speed-first (40/40).
- routing-group-strategy was 4/18: the menu now has 9 items and the test
  still counted 8. Fixed in this commit; rerun, it is 18/18.
- routing-save-blank (a webkit click timeout) and routing-columns (zh
  "side by side") each failed one subtest at load ~200. Rerun alone,
  they are 4/4 each. Both are already filed (#1924, #1612).

Rebased on 8f023b511, where upstream changed gateway.go, app.js, client.js,
the routing plugin's i18n.js and gateway-routing.md; the rebase was clean.
At this head I reran gofmt, go build ./... and go vet (darwin, linux
nogui, windows) on routes, gateway and cli, and go test for routes, cli,
provider and gateway (the routing and speed tests) and for gui -run
Budget: all ok. The GUI files i18n-keys (4/4), routing-speed-first
(40/40) and routing-group-strategy (18/18) also passed.

Not tried:
- A real run against several channels of one model. Speeds come from
  real answers, so the first minutes after a start are in listed order
  plus probes.
- A non-streamed reply is not measured, a sub-millisecond TTFT is not
  counted, and a restart forgets every speed.
- The Windows runtime: only go vet ran for it.
2026-10-27 01:37:38 +08:00
yetone 4a33cf0a98 update: a Stable channel in Settings → About, and magpie update channel
ssharpcc on X reads every changelog before updating, for fear of a ban
when behind, and with many releases a day that is a lot of reading.
Settings → About → Update channel (zh: 更新渠道, 稳定版 / 每个版本) picks
Every version, the default and today's behaviour, or Stable: one version
a week, the newest that had been out three days as the week began
(Monday 00:00 UTC), and an urgent release at once. usemagpie.ai chooses
it from the release list (the previous commit); a release is urgent when
a line of its notes starts with "**Urgent release:**", which
magpie-releases' release run writes from an `Urgent: <why>` trailer
(magpie-releases 73f6cff).

- settings: updateChannel, "" or "stable"; anything else is refused.
- update: on Stable the feed is asked with channel=stable; What's new
  shows every release since the installed one (up to 1500) instead of
  the newest 40, so a week's notes read as one list.
- gui: the row is segs, never a <select>; a save that doesn't send the
  channel keeps it; switching asks the feed again at once, and a
  download from every version newer than Stable's pick is dropped,
  never restarted into. What's new's notes are kept per channel.
- cli: magpie update channel [stable|every] ("all" too), and it says
  which with nothing after it.
- docs: reference.md's Update channel (the rule and the marker); the
  privacy pages (en, zh, ja) name ?channel=stable on /api/latest.

The full Go and GUI suites were not run: the disk was at 3 GB free and
other sessions had GUI suites and a 45-minute gateway run going the
whole time.

Run, at this tree before the rebase:
- gofmt -l (clean); go vet on darwin, GOOS=linux -tags nogui and
  GOOS=windows for ./internal/update/... ./internal/cli/...
  ./internal/settings/... ./internal/gui/.
- go test -count=1 ./internal/update/... ./internal/cli/...
  ./internal/settings/...: ok. ./internal/gui -run
  'TestUpdateChannelSwitch|TestWhatsNewKeyedByChannel|TestCoreScriptBudget':
  ok (the app.js budget passes).
- GUI, chromium and webkit: update-channel (22: en, zh, zh-TW, ja, de at
  900 and 420 wide: default lit, Stable saved, kept by another save,
  kept over a reload, Every saved back, no click scrolls, no sideways
  scroll at 420), i18n-keys, gui-ja, gui-de, gui-zh-tw and every
  update-*.test.cjs: 253 of 253 pass.
- The live feed: /api/latest?channel=stable answers 0.1.1327 (out
  2026-10-22 21:55 UTC, the last before Friday 10-23 00:00) with 15
  assets after the first real cron run filled the ledger (400 releases
  back to 10-10); /api/notes 0.1.1200..0.1.1327 gives 124 notes, none
  empty (1213 and 1218 were never published).

After rebasing on afc99490f: TestCoreScriptBudget, the channel Go tests
(update, cli, gui) and GUI i18n-keys + update-channel (both engines,
26 of 26) pass again.

Broken by hand, each red: the feed asked without channel=stable
(TestLatestAsksTheChannel); Stable capped at 40 (TestStableNotesAreAll);
any channel saved (TestUpdateChannelSaved); "all" dropped
(TestUpdateChannelCmd); a save without the field clearing it, no new ask
on a switch, the newer download kept (TestUpdateChannelSwitch); one
notes key for both channels, What's new capped at 40 on Stable
(TestWhatsNewKeyedByChannel); app.js's other saves dropping the channel,
Stable's click saving "" (update-channel 11 of 11 red); the zh label or
a de subtitle taken out (update-channel and i18n-keys red).

Not tried: the full go test ./... and the whole GUI suite (above); a
real app switching channel against the live feed; Windows and Linux
runs (vet only); a real urgent release.

Requested by ssharpcc on X.
2026-10-26 21:09:44 +08:00
yetone 8f4469954e site: a Stable update feed, a release a week and an urgent one at once
ssharpcc on X reads every changelog before updating, for fear of a ban
when behind, and with many releases a day that is a lot of reading. This
is the feed side of Settings' Update channel: /api/latest?channel=stable.

How Stable is chosen (stableOf, from the release list, never by hand):
- as each week begins (Monday 00:00 UTC), the newest release that had
  been out three days by then (published <= Monday - 3 days);
- an urgent release is Stable as soon as it is out, until a weekly pick
  passes it.
A release is urgent when a line of its notes starts with
"**Urgent release:** <why>" (quoted or not). GitHub releases are not
marked pre-release for any of this.

GitHub's newest 100 releases are about a day of magpie, so a KV ledger
(LEDGER, usemagpie-ledger) keeps 45 days of {version, published, urgent}
and each day's notes, filled by a cron every 15 minutes: the API's first
page (the releases feed when the API says no, keeping the ledger's dates
and API notes), the pages after it while there is a hole, and on back to
21 days, at most four API asks a run, writing only what changed. A
ledger that can't be read is never written over. /api/notes reads a
range older than the newest 100 on from the ledger, so a Stable app's
week of notes comes as one list. Without a ledger reaching the week's
cut, the stable feed answers 503 (no-store) rather than guess. The
default feed, and any other channel value, is unchanged.

Run: node --test site/*.test.mjs (stable.test.mjs 14 new, every clock
held: weekStart, the cut to the second, a week held and moved on, urgent
before/after its time, unknown, the ledger's paging, hole, ask cap,
broken KV, API-limited feed fallback, notes past the 100 newest; the
existing worker and install tests 31 pass). wrangler deploy --dry-run
shows the LEDGER binding.
Broken by hand, each red: no soak, a rolling 3 days instead of the week,
urgent ignored, no ledger notes, a broken read taken as empty, the
feed's date or notes over the API's, notes bucketed by the feed's date,
no hole mending, no ask cap, the index always rewritten, the marker
matched mid-line.
Not tried: a real cron run before this deploy; the anonymous API's
60/hour limit under the cron's asks beyond reasoning (one ask a run once
the ledger is deep).

Requested by ssharpcc on X.
2026-10-26 21:08:00 +08:00
yetone 983371c3a2 site: FastAIToken's endpoints are on www.fastaitoken.com
FastAI asked for www.fastaitoken.com instead of api.fastaitoken.com.
Chat and Responses now use https://www.fastaitoken.com/v1, Anthropic
https://www.fastaitoken.com. Without a key, /v1/models and /v1/messages
there answer sub2api's API_KEY_REQUIRED. Not tried: a request with a
key.

Run: node --test site/*.test.mjs (31 pass).
2026-10-26 19:28:10 +08:00
yetone 9120acaffc site: Sidrune's in-app text says Claude, and its keys link carries their promo
Sidrune mailed a correction: their first materials said "Cloud" where
they meant Claude. The zh and en notes are now their new sentences
word for word, zh-TW follows zh, and keysUrl is their MAGPIE3 promo
register link ($3 trial credit, used to count sign-ups from magpie).
Name, website, endpoints, icon and dates are unchanged.

Run: node --test site/*.test.mjs (31 pass); the promo link answers 200.
2026-10-26 18:43:07 +08:00
yetone ea1f9492bc cli: magpie tools lists, and magpie tool calls, the tools magpie's MCP servers give agents (iwinux)
iwinux on Discord (#feedback) wanted magpie's image generation, image
recognition and web search without going through an agent's MCP, and had
written a Python script for generate_image. magpie now has it:

  magpie tools [<name>]
  magpie tool <name> [--<param> <value>…] [<words>…] [-o <file|folder>] [--json]

Both ask the running gateway's own MCP servers (gateway.OwnMCPServers:
image, vision, web-search, plugin tools) over HTTP, with the local token
and the magpie-tool/1 User-Agent, so the tools, schemas, models from
Settings and usage counting are the ones an agent gets. Nothing is
started besides (#3318: the cases sit before startUp, beside mcp).

- Parameters are read against the tool's inputSchema: types (integer,
  number, boolean, array given once per item, object as JSON), enum, -
  and _ alike, --p v or --p=v. The words left over are the tool's one
  required text, else its prompt. An unknown flag or parameter, a missing
  required one, a bad value, a value given twice or both words and the
  same --param are refused with "nothing was called"; no request is sent.
- A file path a parameter takes (its description says file and path)
  is made absolute, since the gateway doesn't know the current folder.
- --help prints toolUsage (static): help is handled before anything runs.
- A still-being-made answer is waited on with generation_result (1s
  between asks, 30 min at most). The gateway's image server now says so
  in _meta too: usemagpie.ai/pending is the id, usemagpie.ai/files the
  files made ({url, inline}); an older gateway is read from its text.
- Images and videos are saved through imagemcp.Target (now exported):
  -o file or folder, else the current folder named from the prompt,
  numbered when more than one, never over a file that is there; a file
  not inline is downloaded by its path from the gateway asked (the token
  goes nowhere else). --json prints the raw answer and saves nothing.
- No magpie at the address: "magpie isn't running at <url>: open the app
  or run magpie serve". MAGPIE_GATEWAY=<url> points at another.

Docs: usage lines in magpie help, docs/reference.md (Use), the gateway
routing subsystem page (_meta and the CLI), README en/zh, site docs start
page en/zh/ja.

Tests (internal/cli/tool_cli_test.go, never the network; every test sets
MAGPIE_GATEWAY to its own httptest server):
- TestToolsListsTheServersTools, TestToolReadsParameters,
  TestToolRefusesWhatItDoesntKnowAndCallsNothing (no tools/call, no file),
  TestToolHelpCallsNothing (no request at all), TestToolSavesTheImage,
  TestToolWaitsOnWhatIsStillMade (pending _meta, then the old text form,
  download with the key from the gateway asked, not the URL's host),
  TestToolErrorIsSaid, TestToolSaysMagpieIsntRunning,
  TestToolDrawsThroughTheGateway (the real gateway.New().Handler() with a
  fake vendor: lists, draws, saves the vendor's PNG).
- TestImageMCPDrawsAndServesTheImage, ...SlowDrawingIsWaitedOn and
  ...MakesVideos now check the _meta. Red on the old behaviour: with
  withMeta setting nothing (what main answers) all three fail ("_meta
  map[], want pending img_…").
- Broken by hand: dropping the unknown-parameter check makes
  TestToolRefuses… red (the --model call was made); saving an inline
  image by its URL instead makes TestToolSavesTheImage red. Both restored.
- TestHelpOnEveryCommandDoesNothing covers tool and tools.

Run with this change on origin/main 630fd1d69, then rebased on cebd0d4c3
(internal/pii, internal/gui, docs and site/ changed between, nothing
this change touches): there
gofmt, go vet of cli/gateway/imagemcp, internal/cli, internal/imagemcp and
the gateway's TestImageMCP/TestVisionMCP/TestSearchMCP again, ok.
At 630fd1d69:
- gofmt -l: nothing. go vet ./...; GOOS=linux go vet -tags nogui
  ./internal/...; GOOS=windows go vet ./internal/...: clean.
- go test ./... -timeout 45m: internal/gateway, imagemcp and the rest ok;
  ten packages failed with "no space left on device" (the machine's disk
  was full from other runs). Those rerun when space was back: agent, cli,
  davsync, gui, library, sessions, settings, tui, usage, usageapi,
  wslrun, plugins/... ok. internal/provider crashes in
  TestUnreadLoginsWriteErrorsKeepCredentials with "close of synctest
  channel from outside bubble" (filememo.Forget), twice: that is #3632,
  open, on main since 091153bf7, nothing this change touches.
- Real try: a nogui build of this head as magpie serve on 127.0.0.1:3482
  under a scratch HOME, a custom provider pointed at a local fake images
  API. magpie tools listed image, vision and web-search with their
  parameters; generate_image "…" --size 1024x1024 -o hero.png saved a PNG
  and the vendor got prompt and size; --n 2 --quality high saved two
  numbered files; --model was refused before calling; analyze_image and
  web_search said what to set up (no vision model or search API there);
  --help asked nothing. Usage counted the calls as magpie's own.

Not tried: a real image vendor, a real vision or search model, a video,
a plugin's tool through magpie tool, Windows and Linux runs (vet only).
2026-10-26 18:42:35 +08:00
yetone 7d075df9dd site: FastAIToken on usemagpie.ai and in the app, 10-26 to 11-26
FastAIToken paid for a website card and an in-app partner seat, each
with its own register link so they can count them apart: utm=official
behind /go/fastai/home, utm=soft for the app's keys and website links.
The tagline is the owner's ("Claude / GPT / Deepseek 一站式接入方案,最
低0.6折,支持对公"), translated for en, ja, de and zh-TW. The logos
come from the two PNGs they sent: the website gets a horizontal mark +
wordmark, with the dark wordmark turned light for dark mode; the app
gets the F mark alone.

Endpoints are api.fastaitoken.com, the API host their own site names
(a sub2api deployment: /v1/models, /v1/messages and /v1/responses each
answer API_KEY_REQUIRED without a key). Not tried: a request with a
key. The test key they mailed couldn't be copied out of the mailbox,
so no model has answered through this entry yet.

Run: node --test site/*.test.mjs (31 pass).
2026-10-26 18:27:41 +08:00
yetone 0f6615ffc5 site: Sidrune AI is an in-app partner, 10-26 to 11-26
Sidrune AI paid for an in-app partner seat. It serves Chat
Completions and Responses at https://sidrune.ai/v1 and Anthropic
Messages at https://sidrune.ai; each answered with the partner's test
key just before this commit (claude-sonnet-4-6), and real Claude Code
in a sandbox HOME answered earlier today. The taglines are the
partner's own sentences, "Cloud" kept as they wrote it; listed for zh
and en, as they asked. The icon is their white mark on a black tile,
since an entry has one icon for both themes.

Run: node --test site/*.test.mjs (31 pass); the served feed at
10-26 19:00 through checkPartner and validPartners in a throwaway
internal/provider test: kimi, apikeyfan, wandapi, corecode, sidrune
all valid.
2026-10-26 18:16:56 +08:00
yetone c28d3e8b00 docs: plugins document auth.checkin (plugins#392)
MYCF711 (plugins#392): the plugin docs listed the hooks magpie calls
without auth.checkin, magpie's own daily check-in hook several plugins
use. The page now has a Check-in section (signature, the six outcomes,
done vs failed, never solving a captcha, once a Beijing day per account
and again after a failure, the account's scope), the intro list and the
auth hook's shape name it, and the hooks sentence names refresh and
checkin. In en, zh and ja; taken from host.js's checkin contract and
provider/plugin_checkin.go.

Run: tag balance checked in all three pages; no test covers docs pages.
Not tried: rendering on the deployed site (the site is not deployed by
this commit).
2026-10-26 16:13:57 +08:00
yetone ef0a03e137 otel: Langfuse is set up from its host and the project's two keys
A user on X asked for Langfuse built in. magpie could already export to
Langfuse over OTLP, but Settings › Observability had the user type the
endpoint .../api/public/otel and a percent-encoded
Authorization=Basic%20<base64(pk:sk)> header by hand.

Settings › Observability now has a Collector row: OTLP or Langfuse.
With Langfuse, the user picks the host (Cloud EU, Cloud US, or
Self-hosted with an address, which also covers Langfuse's JP and HIPAA
regions) and fills in the public and secret keys. Once both keys are
there, magpie saves:
- the endpoint <host>/api/public/otel;
- Authorization: Basic base64(pk:sk), in otel.headers as before, so the
  secret is stored where it was and a backup without keys leaves it out;
- on a first setup, also x-langfuse-ingestion-version: 4, metrics off and
  export on. langfuse.com/docs/opentelemetry/get-started (read 10-26)
  gives the same header for every region and for self-hosted, and says
  that without it OTLP data can arrive up to 10 minutes late.
A Langfuse endpoint set up by hand opens in this view with its keys
decoded into the fields. Opening it saves nothing. Changing a key or the
host keeps the user's other headers, their metrics and export choices,
and an ingestion header they set or left out. Switching from another
collector leaves that collector's headers behind and does not send them
to Langfuse.

The Observability page moved from app.js into the otel plugin
(assets/plugins/otel/page.js, with i18n.js for its words, in Client),
because app.js had 13 bytes of budget left. The app.js and core budgets
are lowered to what is left (1,321,319 and 1,537,645; app.js is
1,321,313 after rebasing on 2620dc319). "Collector" and "Secret key" go
in the core i18n.js because other files use the same words.

Docs: reference.md's Langfuse paragraph (with the env form for magpie
serve) and the en/zh/ja privacy pages.

Run (macOS):
- go test ./... -timeout 45m -count=1 at the pre-rebase head (parent
  e5dd86965): every package ok but internal/provider, which crashed in
  TestUnreadLoginsWriteErrorsKeepCredentials with "close of synctest
  channel from outside bubble" in filememo.Forget. That is #3632, red on
  main since 091153bf7.
- The whole GUI suite (make test-ui, concurrency 4, Chromium and WebKit)
  at the same head: 16 reds. Each red file was run alone here and at the
  parent e5dd86965. The same reds came back at both: menu-input-scroll
  (#3402), old-webkit (#3403) and plugin-card-update's webkit Update
  (#3079). The parent also failed fonts' webkit run. page-width,
  api-key-theme, panel-arrange, panel-balance-order, own-requests,
  library-mcp-health-wsl and plugin-list-error passed alone here: 137
  passes, 7 fails, all of them the three filed above.
- At the pushed head (rebased on origin/main c87a0179b): the budget
  tests; otel, otel-langfuse, i18n-keys, settings-sections, builtins,
  idle-ticks and page-width, both engines, 58 pass; go test
  ./internal/otlp ./plugins/otel ./internal/gui, all ok except
  TestRestartHandsTheGatewayOver (#3451). That test failed 1 of 8 here
  and 1 of 8 on origin/main dce7fe609.
- Before the rebase: otel-langfuse (new: first setup, US, self-hosted,
  hand setup kept, another collector's headers dropped, 5 languages at
  1100/520/360px) with otel, i18n-keys, settings-sections, builtins,
  readable-focus, segs-press-redraw, ux-safety, dialog-backdrop-drag and
  mono-icon-redraw: 113 pass. go vet for darwin, linux and windows on the
  touched packages; gofmt -l clean.
- Broken by hand: with every save treated as a first setup and the old
  collector's headers carried over, otel-langfuse's "set up by hand keeps
  its values" and "another collector's headers" went red.
- New TestOTelLangfuseSetup: settings saved as the page writes them reach
  a fake collector at /api/public/otel/v1/traces with the Basic header and
  ingestion version 4, and nothing on /v1/metrics.
- Real app: a -tags dev build in a sandbox HOME (ports 3461/3462). I
  drove its real Settings page with Playwright: Langfuse, then
  Self-hosted http://127.0.0.1:3463, then both keys. settings.json got the
  endpoint, Basic header, version 4 and enabled. A gateway request then
  reached a local fake collector at /api/public/otel/v1/traces with
  Authorization Basic base64(pk-lf-real-ui:sk-lf-real-ui) and
  x-langfuse-ingestion-version 4.

Not tried: a real Langfuse Cloud or self-hosted project (no account here),
so Langfuse accepting the spans and how they show in its UI aren't checked.
The TUI and magpie serve still have no Langfuse shortcut; serve takes the
env form in reference.md. The Linux app (WebKitGTK) and Windows weren't
tried; the change is form fields and segs, with no motion.
2026-10-26 15:11:37 +08:00
yetone c87a0179ba site: CoreCode is a partner in the Add sheet
CoreCode paid for an in-app seat (the owner confirmed the payment). The
partner "corecode" serves Anthropic Messages at corecode.live. Its key
page is corecode.live/keys and its website is corecode.live. No langs
were asked for, so it is listed in every language. The en and zh
taglines are the ones it sent, and zh-TW is made from the zh. It is
listed from 10-26 to 11-26 +08:00, one month. The icon is their 64px SVG
rendered at 128px (rsvg-convert).

Run: node --test site/*.test.mjs passed 31 of 31. In a throwaway test in
internal/provider, the served feed (worker.js served() over partners.js
at 10-26) parsed as []Partner and passed checkPartner and validPartners.
All four partners were kept, and corecode's links are /go links.

Against the real service with the test key it sent:
- /v1/models lists the four Claude models.
- Real Claude Code in a sandbox HOME, with ANTHROPIC_BASE_URL set to
  corecode.live, answered "OK".
- A plain curl to /v1/messages or /v1/chat/completions is refused:
  "only accepts requests from Claude Code". Agents other than Claude
  Code may be refused the same way.

Not tried: adding it from the app's Add sheet, and requests through the
magpie gateway.
2026-10-26 15:09:32 +08:00