Commit Graph
397 Commits
Author SHA1 Message Date
yetone 198ac57401 site: a Raycast docs page in en, zh and ja
/docs/raycast says how magpie puts its models in Raycast AI (Raycast
Pro, Mac and Windows): the entry, id magpie, magpie adds to the
providers list of ~/.config/raycast/ai/providers.yaml with the gateway's
OpenAI-compatible address, a key of Raycast's own and magpie's models;
Raycast picking the file up with no restart; the picker listing the
models picked for Raycast on the Agents page; each model's abilities
spelled out (tools on, vision, reasoning effort, temperature off where
refused); Windows' Reveal Providers Config folder; the user's other
providers, tools block, comments and own keys kept; and switching back
removing the entry, the list and an empty file. Each claim is from
internal/agent/raycast.go and the CLI's first-field handling in
internal/cli/main.go. Linked from each language's Crush page; in the
sitemap, llms.txt and llms-full.txt.

Run: the three pages' JSON-LD parsed with node; llms-full.mjs rebuilt;
node --test worker.test.mjs install.test.mjs on the WSL box
(magpie-desktop, wsl-run; mote has refused SSH this session): 71 pass,
0 fail.
Not tried: Raycast itself on magpie for this page; it names only what
magpie's source says.
2026-11-11 14:11:52 +08:00
yetone d8b6a2f555 site: a Crush docs page in en, zh and ja
/docs/crush says how magpie runs Charm's Crush on magpie's models:
providers.magpie in crush.json (~/.config/crush, XDG_CONFIG_HOME,
%LOCALAPPDATA%\crush on Windows) with the gateway's address, a key of
Crush's own and magpie's models; the large and small slots and the
large model's reasoning_effort (low, medium, high); the picks written to
Crush's data file (~/.local/share/crush, XDG_DATA_HOME), which wins over
the config, and the previous model's picker settings dropped from a
pick; the user's own keys in the provider kept; WSL; and the provider
removed once neither slot uses magpie. Each claim is from Crush's Agent
in internal/agent/agents.go. Linked from each language's Zed page; in
the sitemap, llms.txt and llms-full.txt.

Run: the three pages' JSON-LD parsed with node; llms-full.mjs rebuilt;
node --test worker.test.mjs install.test.mjs on the WSL box
(magpie-desktop, wsl-run; mote has refused SSH this session): 71 pass,
0 fail.
Not tried: Crush itself on magpie for this page; it names only what
magpie's source says.
2026-11-11 13:37:14 +08:00
yetone ec7596581e site: a Zed docs page in en, zh and ja
/docs/zed says how magpie runs the Zed editor's agent panel on magpie's
models: language_models.openai_compatible.magpie in settings.json
(~/.config/zed on macOS and Linux, XDG_CONFIG_HOME, %APPDATA%\Zed on
Windows) with the gateway's address and magpie's models, and
agent.default_model set; the key saved in the system credential store
(Keychain, Secret Service, Credential Manager) and the restart when Zed
still asks for one; each model's window, reply limit and images;
reasoning_effort high or the model's strongest, a level the user set
kept; a proxy address of the user's kept; and switching back. Each
claim is from internal/agent/zed.go, its credential files and its
notice. Linked from each language's Droid page; in the sitemap,
llms.txt and llms-full.txt.

Run: the three pages' JSON-LD parsed with node; llms-full.mjs rebuilt;
node --test worker.test.mjs install.test.mjs on the WSL box
(magpie-desktop, wsl-run; mote has refused SSH this session): 71 pass,
0 fail.
Not tried: Zed itself on magpie for this page; it names only what
magpie's source says.
2026-11-11 13:04:01 +08:00
yetone a3d2a85dd3 site: a Droid docs page in en, zh and ja
/docs/droid says how magpie runs Factory's Droid CLI on magpie's
models: one customModels entry per catalog model in
~/.factory/settings.json (FACTORY_HOME_OVERRIDE), with the gateway's
address and a key of Droid's own, each on the API its provider speaks;
sessionDefaultSettings.model set; the models in droid's /model picker
under Custom models; a starting reasoningEffort so the picker offers
levels, and a built-in model's own levels through baseModelId; a model
droid would warn about written on the API it expects; the user's own
custom models kept in front, a field they changed in magpie's entries
kept, config.json left alone; WSL; restarting droid; and
`magpie droid default`. Each claim is from internal/agent/droid.go and
its notice. Linked from each language's Goose page; in the sitemap,
llms.txt and llms-full.txt.

Run: the three pages' JSON-LD parsed with node; llms-full.mjs rebuilt;
node --test worker.test.mjs install.test.mjs on the WSL box
(magpie-desktop, wsl-run; mote has refused SSH this session): 71 pass,
0 fail.
Not tried: droid itself on magpie for this page; it names only what
magpie's source says.
2026-11-11 12:31:06 +08:00
yetone 156861b3a2 site: a Goose docs page in en, zh and ja
/docs/goose says how magpie runs Block's Goose, its CLI and desktop app,
on magpie's models: the custom provider custom_providers/magpie.json
beside config.yaml (XDG_CONFIG_HOME, or %APPDATA%\Block\goose\config on
Windows) with the gateway's address, a key of Goose's own and magpie's
models, each with its context window and whether it takes a thinking
level; Goose loading custom providers at start-up, so a restart; the
effort field GOOSE_THINKING_EFFORT (off, low, medium, high, max); the
two config layouts magpie writes to as found; the user's own keys in
the provider file kept; the file removed once Goose leaves magpie's
models; WSL; and `magpie goose default`. Each claim is from
internal/agent/goose.go and Goose's Agent in agents.go, its notice
included. Linked from each language's Cline page; in the sitemap,
llms.txt and llms-full.txt.

Run: the three pages' JSON-LD parsed with node; llms-full.mjs rebuilt;
node --test worker.test.mjs install.test.mjs on the WSL box
(magpie-desktop, wsl-run; mote has refused SSH this session): 71 pass,
0 fail.
Not tried: Goose itself on magpie for this page; it names only what
magpie's source says.
2026-11-11 11:57:30 +08:00
yetone 6d15f63d52 site: a Cline docs page in en, zh and ja
/docs/cline says how magpie runs Cline's CLI, VS Code extension and
desktop app on magpie's models: Cline's built-in openai-compatible
provider set to the gateway and made the one in use (a provider of
one's own is refused as a session starts), magpie's models in
models.json in place of the built-in list, what is stashed and put
back, new sessions taking the change, the effort field (none, low,
medium, high, xhigh), the extension's own state set too and its window
reload, the desktop app's composer picker, and `magpie cline default`.
Each claim is from internal/agent/cline.go and its notices. Linked from
each language's Hermes page (whose English link list now reads as
one); in the sitemap, llms.txt and llms-full.txt.

Run: the three pages' JSON-LD parsed with node; llms-full.mjs rebuilt;
node --test worker.test.mjs install.test.mjs on the WSL box
(magpie-desktop, wsl-run; mote refused SSH): 71 pass, 0 fail.
Not tried: Cline itself on magpie for this page; it names only what
magpie's source says.
2026-11-11 11:23:06 +08:00
yetone 2f7bc20e0e site: a Hermes Agent docs page in en, zh and ja
/docs/hermes says how magpie runs Hermes Agent and its bots on magpie's
models: the magpie provider it adds to config.yaml's providers (chat
completions, the catalog as its models), model.provider and
model.default, the stash put back on switching back, the magpie/...
names in Hermes's picker, the effort field (agent.reasoning_effort, as
/reasoning), the profile `hermes` starts in (HERMES_HOME, the sticky
`hermes profile use`, else the default), the provider spread into every
other profile, per-bot pickers and bots following the connected one, a
model of the user's own keeping magpie's provider, WSL, the restart
Hermes needs, and `magpie hermes default`. Each claim is from
internal/agent/hermes.go, its notice and the CLI's usage text. Linked
from each language's OpenClaw page; in the sitemap, llms.txt and
llms-full.txt.

Run: the three pages' JSON-LD parsed with node; llms-full.mjs rebuilt;
mote: node --test worker.test.mjs install.test.mjs: 71 pass, 0 fail.
Not tried: Hermes itself on magpie for this page; it names only what
magpie's source says.
2026-11-11 10:49:18 +08:00
yetone 83145e8d1d site: an OpenClaw docs page in en, zh and ja
/docs/openclaw says how magpie runs OpenClaw on magpie's models: the
magpie provider it adds to openclaw.json (the gateway's /v1, OpenAI chat
completions, a key of OpenClaw's own, one entry per model), the
magpie/<provider>/<model> refs, the primary model set with fallbacks
kept, magpie/* added to a non-empty allow list, 128K for an unknown
context, no restart but /model default for a chat that already has a
model, what is left alone (other providers, the user's own keys, a
per-agent model, $include, a JSON5 file), where the file is found
(OPENCLAW_CONFIG_PATH, _STATE_DIR, _PROFILE, _HOME) and
`magpie openclaw default`. Each claim is from internal/agent/openclaw.go
and the CLI's usage text. Linked from each language's OpenCode models
page; in the sitemap, llms.txt and llms-full.txt.

Run: the three pages' JSON-LD parsed with node; llms-full.mjs rebuilt;
mote: node --test worker.test.mjs install.test.mjs: 71 pass, 0 fail.
Not tried: OpenClaw itself on magpie for this page; it names only what
magpie's source says.
2026-11-11 10:14:58 +08:00
yetone 2901df6eef site: a Claude Desktop docs page in en, zh and ja
/docs/claude-desktop says how magpie runs Claude Desktop's chat, Code and
Cowork tabs in Desktop's third-party gateway mode on magpie's models:
turning it on from the Agents tab or `magpie claude-desktop magpie`,
the restart Desktop needs, the model list read at start-up (a 1M model
listed once), the Code tab's opus/sonnet/haiku picks and the subagent
model, chats kept in Desktop's own profile (Settings → Import), the
separate Claude Magpie.app on a Mac (`launcher add`), Desktop's English
window in gateway mode, and `magpie claude-desktop default`. Each claim
is from internal/agent/claudedesktop*.go, its notices and the CLI's
agent forms. Linked from each language's Claude Code models page; in
the sitemap, llms.txt (also named in the agent list) and llms-full.txt.

Run: the three pages' JSON-LD parsed with node; llms-full.mjs rebuilt;
mote: node --test worker.test.mjs install.test.mjs: 71 pass, 0 fail.
Not tried: Claude Desktop itself on magpie for this page; it names only
what magpie's source and notices say.
2026-11-11 09:38:26 +08:00
yetone c8f6076796 site: a Cherry Studio docs page in en, zh and ja
/docs/cherry-studio says how magpie adds itself to Cherry Studio as one
OpenAI-compatible provider: the Agents tab's Add magpie (or `magpie
cherrystudio add`) opens Cherry Studio's add-provider link, confirmed
there; the models come from /v1/models; the row shows magpie once
Cherry Studio 2.x's database has the gateway (read only; 1.x keeps the
button); usage is counted as Cherry Studio's on an unshared gateway.
Each claim is from internal/agent/cherrystudio.go, agentKeyAt and the
CLI's import path (shipped in v0.1.3325). The page has a TechArticle,
FAQPage and BreadcrumbList, and is in the sitemap, llms.txt,
llms-full.txt and linked from each language's start page.

Run: the three pages' JSON-LD parsed with node; llms-full.mjs rebuilt;
mote: node --test worker.test.mjs install.test.mjs: 71 pass, 0 fail.
Not tried: Cherry Studio's dialog itself (no Cherry Studio here); the
page names only what the link fills in.
2026-11-11 09:04:06 +08:00
yetone 4167419abf site: breadcrumbs in every docs page's structured data
Each docs page in en, zh and ja (98 pages, contributors left out) gets
a schema.org BreadcrumbList: magpie (the language's home page) > Docs
(that language's start page) > the page's h1. Search results can then
show the path instead of a bare URL. The eleven pages that had no JSON-LD
at all (docker, remote, intent, plugins, import, integrate, library,
mcp-router, masking, start, privacy) also get a TechArticle built from
their h1, meta description and canonical URL, like the other pages.
zh pages' inLanguage is zh-CN everywhere, as the older pages had it.
Existing JSON-LD is only appended to (the diff has no deletions besides
the inLanguage fix).

Run: every docs page's JSON-LD parsed with node (98 with a
BreadcrumbList); mote: node --test worker.test.mjs install.test.mjs:
71 pass, 0 fail.
Not tried: Google's Rich Results Test on the deployed pages.
2026-11-11 07:59:25 +08:00
yetone d681ad016e site: docs titles say what each page is for
Ten docs pages (docker, remote, intent, plugins, import, integrate,
library, mcp-router, masking, start) had one-word titles like "Docker ·
magpie docs", in en, zh and ja. Docker and remote are among the most
read docs pages, and Search Console shows searches such as "局域网远程"
and "magpie docker" with no title matching them. Each <title> now names
what the page does; h1, og tags and the article are unchanged.

Run (mote): node --test worker.test.mjs install.test.mjs: 71 pass,
0 fail.
Not tried: how Google rewrites the titles in results.
2026-11-11 05:54:33 +08:00
yetone d2a80b3173 site: docs pages for ChatGPT in Claude Code and fixing common errors
New /docs/claude-code-chatgpt and /docs/troubleshooting in en, zh and
ja, aimed at queries Search Console shows with impressions and no page
for them ("claude code use chatgpt subscription", "opencode 502",
"workbuddy wsl", "局域网远程"). The first walks through signing in to
ChatGPT, picking a codex/... model for Claude Code, tier mapping,
effort, usage windows, several accounts and switching back. The second
covers 401/403, 429 and rests, 502/504, unknown models, a model the
agent doesn't list, port 3425, WSL, the LAN and moved subscriptions.
Claims were checked against internal/gateway, internal/provider,
internal/agent, internal/agentenv and i18n.js; unsupported ones were
dropped (WorkBuddy is not a WSL agent, no ChatGPT Business). Linked
from subscriptions, claude-code-models and start in each language,
sitemap.xml, llms.txt and the rebuilt llms-full.txt.

Run (mote): node --test worker.test.mjs install.test.mjs: 71 pass,
0 fail. Each new page's JSON-LD parsed with node.
Not tried: the pages in a real browser beyond the deployed 200 check.
2026-11-11 04:48:31 +08:00
yetone 13a9f1263a plugins: Discover counts who uses and likes each plugin
Discover showed npm's weekly downloads, which CI, mirrors and magpie's
own keepMovedCurrent updates inflate. Now each card and the hero say
how many people use a plugin, counted by magpie itself, and a plugin's
page has a like.

- The daily stats send (stats.Send) also POSTs usemagpie.ai
  /api/plugins/report with the install id and the installed, switched-on
  plugins Discover lists, by their Discover key: the npm name, or
  github:owner/repo for a repository tagged magpie-plugin
  (plugin.Public). A folder, a private repository or an unlisted
  package is never named. It goes only while "Share the agents,
  providers, models and plugins I use" is on (noUsageStats), and only
  where the day's event goes at all (Count me as a user, DO_NOT_TRACK,
  MAGPIE_NO_STATS, release builds).
- site/pluginstats.js on D1 magpie-plugins: users are the ids that
  reported a plugin in the last 7 days, reports drop after 30 days, a
  caller's address is kept only as a hash for an hour (60 asks an
  hour). /api/plugins/stats carries no id and is cached for an hour.
- A like (POST /api/plugins/like through the GUI's /api/plugins/like)
  is taken only for a plugin installed and on here, can be taken back,
  and is kept in plugin-likes.json.
- "Most liked" sorts by likes once a plugin has 20, below that by
  GitHub's stars.
- plugincounts.js is loaded with the Plugins page, not the core, and
  redraws the cards only when the counts changed.
- The privacy text follows: README.md, README.zh-CN.md, docs/reference.md,
  the site's privacy and start pages in en, zh and ja, llms-full.txt,
  and the Privacy switch's label and description in every language.

Run at this tree (on origin/main 51da6f1f5):
- Windows box (win-run): gofmt -l clean; go vet of internal/stats,
  internal/plugin, internal/gui ok for windows and linux (-tags nogui);
  node --test site/pluginstats.test.mjs site/worker.test.mjs 44 of 44;
  TestCoreScriptBudget, TestPluginCountsAndLikes ok; GUI old-webkit,
  i18n-keys, privacy-usage-stats, plugin-git, plugin-local,
  plugin-github in both engines: 45 of 46, the one red is #5919
  (.side-foot:has, d374168d0).
- mote, one commit before the rebase onto 51da6f1f5 (Go unchanged
  since): go vet darwin ok; TestSendPlugins, TestPublicPlugins,
  TestPluginCountsAndLikes, TestCoreScriptBudget ok.
- Windows, at 7bc7af1d0 (one rebase earlier): go test internal/stats
  ok; internal/plugin and internal/gui red only in TestPiPackage and
  eight gui tests that fail the same at origin/main 72f2deebe on that
  box (#4115, #5928; TestCherryStudioImportRow added to #4115 with its
  cause). Every plugin*, market*, privacy*, i18n*, old-webkit* and
  discover* GUI file (83 files, both engines, concurrency 4): the reds
  left after the fix below match origin/main 6d7862769 on the same box,
  or are flakes red there too under concurrency: plugin-update-button
  (#4500), plugin-proxy-page (#6017, new), privacy-agent-telemetry
  (#6018, new).
- Broken by hand, caught: the first run had `const like = !local && …`,
  so a local plugin's page called false?.sync() every 600ms; 136
  "like?.sync is not a function" errors across plugin-git, plugin-local,
  plugin-github and the sign-in files. Fixed before this commit.
- Live: D1 magpie-plugins created and the worker deployed;
  /api/plugins/stats answers {"plugins":{}}, a bad report or like 400,
  /api/latest and / 200. No test data was written to production.

Not tried: the full Go suite and the full GUI suite. mote had 28 suites
waiting for its lock, and WSL on the Windows box failed with
E_UNEXPECTED while another session uninstalled a distro. Not tried
either: a real like or report from a release build (source builds
never send), so the first real counts come with this release.
2026-11-11 04:28:18 +08:00
yetone 025123431c library: add and remove a project's skills from the CLI (Sephiro_Lan on X, #5193)
magpie library project … does what the window's Library › Projects page
does, through the same library calls its page makes (AddProject,
RemoveProject, ProjectSkills, ProjectSkill, ProjectCopy):

  magpie library project [--json]                 the projects and their skills
  magpie library project add <dir>
  magpie library project rm <dir> [--keep-files]
  magpie library project skills <dir> [--json]
  magpie library project skill add <dir> <skill…> [agents=a,b…]
  magpie library project skill rm <dir> <skill…>
  magpie library project skill agents <dir> <skill> <a,b…|none>
  magpie library project copy <dir> on|off

<dir> may be relative or "." (library.ProjectPath / ProjectAt find the
listed project, through a link too). A skill added with no agents= goes
to the agents the page's Skills menu picks: those the project's skills
are for already, else every agent here with a project skills folder.
Each skill added says where it was placed; one that wasn't (a folder
there that isn't magpie's, left as it is) is named with why, and the
command exits 1, so a script tells "installed" from "left as it is" by
the status. --help prints the project usage; an unknown flag, command,
skill, agent or on/off value is refused, and so is rm of a skill the
project doesn't have.

Docs: the Projects row of docs/subsystems/library.md, and the site's
library page in en/zh/ja. site/public/llms-full.txt rebuilt with
`node llms-full.mjs`; it also picks up a line (Alma, Shelley) another
docs change left out of it.

Run (mote, at this tree):
- go test -count=1 -run TestLibraryProject ./internal/cli: ok; the same
  on Windows (win-run, xiaomi-gpu): ok.
- go vet ./internal/cli ./internal/library for darwin, linux (-tags nogui)
  and windows: ok. go test -count=1 ./internal/cli ./internal/library:
  ok (45s, 99s), at this head after the rebase. site: node --test worker.test.mjs: 38 pass. gofmt -l:
  clean.
- A sandbox HOME end to end with the built binary: claude and codex
  installed, three library skills, a git project. add ., skill add with
  no agents= (links in .claude/skills and .agents/skills, listed
  in .git/info/exclude, the .gitignore left as it is), a folder of the user's in .claude/skills/pdf (named,
  exit 1, untouched), agents=codex, skill agents, unknown
  skill/agent/flag/command refused, skills --json, skill rm, rm .: the
  links, magpie's folders and the exclude block gone, the user's
  folder kept.

Broken by hand: with the not-placed exit taken out, TestLibraryProjectCmd
goes red ("a folder of the user's in the way: <nil>").

Not tried: a project's MCP servers from the CLI (the issue asks for
skills; servers stay on the page), WSL agents, and a real Linux box.
2026-11-11 00:44:41 +08:00
yetone 6a450c4982 agent: Shelley, magpie's models as its custom models (on X, tweet 2120109384315658393)
"Can support Shelley?" Shelley is boldsoftware/shelley (Apache-2.0, Go,
`shelley serve`). It keeps models and profiles in its SQLite database,
not in a config file, so magpie talks to a running Shelley through the
same API its own Models and Profiles pages use, on the Unix socket it
opens for its CLI ($SHELLEY_SOCKET, else shelley.sock / shelley-N.sock in
$XDG_CONFIG_HOME/shelley or ~/.config/shelley; read from its source).

- Connect: each magpie model is a custom model (POST /api/custom-models,
  provider_type openai, endpoint = the gateway's /v1, Shelley's own
  gateway key, model_name = the catalog id, reasoning/images/max_tokens
  from the catalog). Picking one makes it the default profile's model
  (PUT /api/profiles/{name} with the whole profile, as the API requires)
  and clears a thinking level the model can't take.
- The user's own values: the profile's model and thinking level are
  stashed once and put back on Disconnect (to the server's default if
  that model is gone); only the custom models magpie made (ids stashed)
  are deleted, so a model the user pointed at the gateway by hand stays.
- Sync re-points magpie's models when the gateway port moves; Check names
  a model left on an old address. Shelley not running is an error on a
  pick and nothing on Sync/Check; turned off while Shelley is uninstalled,
  the takeout is stashed and done when Shelley answers again (Alma's way).
- A notice: new conversations start on the pick, an open one keeps its
  model. i18n for zh, zh-TW, ja, de.
- Icon: Shelley's own S mark from its assets, one tone. README (en, zh),
  site index, docs/reference.md, docs/integrating.md, site integrate
  pages (en, zh), docs/subsystems/agent-wiring.md.
- Library: listed as "not looked at (#5897)" like the other new agents.
- Shelley has no Windows build, so there is no Windows or WSL wiring.

Run (mote refused SSH for the whole session, kex reset, so runs went to
the Linux VM and the Windows box):
- Real binary: shelley v0.1718.926152762 linux_amd64 (sha256 66cb5acb…
  checked) in a sandbox HOME/XDG_CONFIG_HOME/-db on the Linux VM, with a
  throwaway test driving it against a fake OpenAI upstream at
  MAGPIE_ADDR: connect made custom model glm-4-6-… and the default
  profile's model; POST /api/conversations/new sent two
  /v1/chat/completions with model=relay/glm-4.6, auth magpie-shelley,
  UA Shelley/58d5f200; disconnect left the profile as before and no
  custom models. Check "" and Drift nil while connected.
- Linux (wsl-run, nogui): go vet ./internal/agent ./internal/agentenv
  ./internal/library; go test ./internal/agent ./internal/agentenv
  ./internal/library ./internal/profile ./internal/sessions: ok except
  TestGrokInstalled (#3548, red on base too) and, before its fix here,
  TestEveryAgentInLibrary. internal/cli times out there in
  TestEveryAgentFieldNameWritesNothing (43m, the #5234 class).
- Windows (win-run): go vet ./internal/agent ./internal/agentenv;
  GOOS=darwin and GOOS=linux -tags nogui vet; the Shelley, applied,
  rewire, disconnect, mark and kept tests: red only in
  TestAppliedOfParsesAnUnchangedFileOnce (#5950),
  TestAsideOfflineDisconnectRestoresWithoutDaemon (#5951) and the #4786
  allocation tests, all red on base d4b4a188e too. internal/cli
  TestHelpOnEveryCommandDoesNothing, TestEveryAgentFieldNameWritesNothing
  and internal/library TestEvery*: ok.
- GUI (node --test, chromium + webkit) i18n-keys, i18n-en-no-cjk,
  agent-notice-lang, gui-de, gui-ja, gui-zh-tw, icon-one-tone, icon-tile,
  routing-client-icons, usage-agent-filter-icons, agent-connect,
  agent-models, agent-layout, on the Windows box at the rebased head:
  110 tests, 107 pass. Red: gui-ja "ja has every zh string" ({model}
  twice, #5943) and icon-one-tone webkit voyage-color (#5962), both red
  at origin/main a1ba92ad8 too.
- At the rebased head 2a9c7b715 (on origin/main a1ba92ad8), Linux:
  vet of agent, agentenv, library ok; go test agent, agentenv, library,
  profile ok except TestGrokInstalled (#3548). Pushed on ca7a39291,
  which changes only internal/gateway (MiniMax drawing); not rerun.
- gofmt -l clean.

Broken by hand: not restoring the profile's model on Disconnect turns
TestShelley and TestShelleyThinkingLevel red; not deleting magpie's
custom models turns TestShelley and TestShelleyKeepsHandWired red.

Not tried: a real model upstream (the upstream was a fake), macOS (mote
unreachable; the darwin build was vetted only), the GUI against a real
Shelley, Shelley's web UI after the switch.
2026-11-10 21:52:19 +08:00
yetone c2c2c82ca8 agent: Tuanjie Cowork, a magpie provider and model in its Custom Models (Charles24209792 on X)
Tuanjie Cowork (Unity China's coworker app, dev.codelycowork.desktop,
2.1.6-stable) keeps the user's own models in ~/.codely/settings.json:
customModelProviders {id, name, baseUrl, apiKey, authType} and
customModels {id, model, providerId, displayName, roles, wireApi,
supportsMultimodal}, read afresh on every lookup. Read from the app's own
core (tZ/oE for the file, Mwi for a session's OPENAI_BASE_URL/KEY, BOe
for the model list, rha/sha for its startup migrations).

magpie adds a provider and a model of its own, both id "magpie": the
gateway's /v1 with Cowork's own magpie key, the model picked, wireApi
chat. The user's providers and models and every other key stay as
written; a name or roles given magpie's entries in Cowork are kept when
the model changes. Off takes both out, and the file too when magpie made
it and nothing else is in it. A provider or model with id magpie that is
the user's own is left alone, with an error. Which model a chat is on is
Cowork's own per-workspace pick, which magpie doesn't write; a notice
says to pick "<model> (magpie)" in its model menu while it runs. Skills
go to the shared ~/.agents/skills, which its core scans. Icon from the
app's icon.icns. Lists, READMEs, reference, agent-wiring doc, i18n.

Run:
- go test ./internal/agent ./internal/library ./internal/gui on mote;
  TestTuanjieCowork* and TestHandWiredMagpieProviderSiblings on Windows
  (win-run).
- gofmt; go vet darwin, linux -tags nogui, windows.
- GUI, chromium and webkit: i18n-keys, i18n-en-no-cjk,
  agent-notice-lang, gui-de, gui-ja, gui-zh-tw, icon-one-tone,
  icon-tile, routing-client-icons, usage-agent-filter-icons,
  agent-connect, agent-models, agent-layout.
- Cowork's own code on magpie's output: its tZ, oE, rha, sha, cE, KGa,
  Mwi, kOe and BOe, extracted from the 2.1.6 core, run in node on the
  settings.json magpie wrote (with the user's own provider, and fresh).
  Its migrations leave magpie's entries; cE("magpie") finds the model,
  the picker label is "deepseek/pro (magpie)", a session gets
  OPENAI_BASE_URL http://127.0.0.1:3425/v1 and magpie's key, the list
  URL is /v1/models, and the user's glm-4.5 is still there.

Where: the packages, vets and GUI files above ran on mote at b834dc2a7
(this change on 4a9142ccd); at the pushed head (on 016763f23) internal/agent's
Cowork, HandWired, EveryAgent, Aliases and Icon tests, internal/library, and
the de, zh-TW and en-no-cjk i18n files ran on Windows. Reds not from this
change, both red on main already: gui-ja's {model} twice (#5943), and
TestEveryAgentInLibrary for obsidian and avibe (#5945).

Broken by hand, each red:
- rest() keeping magpie's entries: TestTuanjieCowork (two models) and
  TestTuanjieCoworkMadeFile (file left behind).
- no check for a provider id magpie of the user's own:
  TestTuanjieCoworkLeavesTheUsersMagpie/provider.
- unwire never removing a file magpie made: TestTuanjieCoworkMadeFile.

Not tried: the real app's GUI (picking magpie's model in its menu and a
chat through it), Windows detection (its NSIS per-user path isn't
known, so on Windows it shows once ~/.codely exists), Linux.
2026-11-10 20:50:10 +08:00
yetone 016763f237 plugins: host.js passes a usage window's pool and family on, so Antigravity's card shows its pools (plugins#935)
mk311 (plugins#935): the Antigravity plugin's Usage card listed every
model's own window (13 rows, each Gemini one at 85.1%, Claude and
GPT-OSS at 100%), then a bare "7 days" and "5 hours" twice. The plugin
(0.1.0) already groups them as the built-in did: each model's window
carries its family and its pool ("Gemini", "Claude & GPT"), each pool's
own 5 hours and 7 days carry the pool. f92c0a2bd taught
plugin.UsageWindow and quotaOfPlugin to read the two fields, but
host.js's usageOf builds each window from a fixed list of fields and
left them out, so nothing reached Go: its test hands quotaOfPlugin a
plugin.Usage directly, past the host. Now host.js passes family and
pool on, and the card, menu bar rings, TUI page (PooledWindows), quota
alerts, caps and routing's pool holds treat the plugin's pools as the
built-in's. Only the antigravity plugin sends these fields (grep of the
plugins repo). The plugin docs (en, zh, ja, llms-full.txt) name them.

TestPluginAntigravityPoolsReachTheCard goes through the real plugin host
(bun, the fake plugin's FAKE_WINDOWS) with the windows the antigravity
plugin's own usage() returns for the reporter's literal figures (each
Gemini model 85.1% left resetting 20:31 +08, Claude and GPT-OSS 100%
resetting 11-11 00:24:47 +08, Gemini 7 days 91.8% left; the Claude & GPT
week isn't in the screenshots and is set to 100% left), kept in
testdata/antigravity-plugin-usage-935.json. The card's lines are then
Gemini · 7 days, Gemini · 5 hours, Claude & GPT · 7 days, Claude & GPT ·
5 hours.

A cap a user set on the plugin's bare "7 days" (two pools under one
name) is now keyed "Gemini · 7 days", as the built-in's was.

Run (mote refused SSH, kex reset; wsl-run in magpie-desktop at this
commit on 6886da1ca):
- gofmt -l: clean; go vet linux, windows, darwin: ok
- go test ./internal/provider, targeted -run with the new test: ok
- go test ./internal/plugin: ok (219s)
- site worker.test.mjs: 38 pass, 0 fail
- GUI quota-pools, quota-pool-model, quota-pool-order, window-cap-pool
  (chromium + webkit, every language): 52/52, also 52/52 at 9c39edb92
  and 4a9142ccd. A first run at 9c39edb92 had one red in window-cap-pool
  (chromium 420 de, each pool's caps); it passed 40/40 alone and on every
  rerun, filed as #5949.
- The antigravity plugin's own usage() (plugins repo, unchanged) run on
  the reporter's figures produced the testdata file.

Broken by hand: host.js with pool dropped: the new test is red with the
reporter's card (13 model rows, then "7 days", "5 hours" twice, no pool).

Not tried: a real Antigravity account through the plugin in the GUI;
macOS and Windows runs (mote down).
2026-11-10 20:32:38 +08:00
yetone 5e3f14f21f agent: Paimon, magpie's models through its litellm provider (ditangongyuan on X)
Paimon (aisk/paimon, `uv tool install paimon`) is a terminal coding agent
on pydantic-ai. Read at 7f7fa51 (config.py, llm.py): its settings are one
JSON file, $PAIMON_CONFIG_HOME/config.json, else ~/.config/paimon/config.json
on every OS. "model" is provider:name, and "providers" keeps each
provider's api_base and api_key.

magpie connects it through pydantic-ai's litellm provider, an
OpenAI-compatible proxy that profiles a vendor/model name by its vendor,
as magpie's ids are spelled, and which Paimon's login never offers:
model = litellm:<catalog id>, providers.litellm = the gateway's /v1 and
magpie's key for Paimon (0600, as Paimon writes it), and
compaction.context_window = the model's window. Paimon compacts against
that only for names genai-prices doesn't know, which magpie's ids aren't;
for a model whose window magpie doesn't know it gets the user's own back,
never the last model's. What the user had in the three keys is stashed and
put back on Disconnect (or `magpie paimon default`); the rest of the file
is untouched, and a file magpie made goes again. A model picked in Paimon
itself while magpie's provider stays is the user's from then on. Requests
are told apart by Paimon's paimon/<version> User-Agent. WSL distros, the
PAIMON_CONFIG_HOME isolation, notices in every language, icon, READMEs,
docs/reference.md, agent-wiring.md and the site's list come with it.

Run:
mote refused SSH all session (kex reset), so the Linux runs went
through wsl-run (magpie-desktop) and Windows through win-run:
- go vet: linux -tags nogui, GOOS=windows, GOOS=darwin -tags nogui on
  internal/agent, agentenv, library: ok. gofmt -l: clean.
- go test -tags nogui ./internal/agent/... agentenv library gui cli (WSL,
  base f03ec97b8): all ok except TestGrokInstalled, the known WSL binfmt
  red #3548.
- Windows: TestPaimon, TestHandWired*, TestEveryNoticeIsTranslated,
  TestPortMovesEveryAgent ok (file-mode checks skipped there).
- GUI, chromium + webkit (WSL): i18n-keys, i18n-en-no-cjk,
  agent-notice-lang, gui-de, gui-ja, gui-zh-tw, icon-one-tone, icon-tile,
  mono-icon-redraw, routing-client-icons, usage-agent-filter-icons,
  agent-connect(-no-models), agent-models(-own, -picker), agent-layout:
  150/151; the red is gui-ja's usage price string, untouched here, filed
  as #5943.
- Real Paimon 0.2.8 (uv pip install paimon) in a sandbox HOME on WSL,
  against a sandbox magpie gateway over a fake OpenAI upstream:
  `magpie paimon magpie/fakeup/m1` wrote litellm:fakeup/m1 and
  providers.litellm at 0600; `paimon -p ping` answered "pong from fake
  upstream", the upstream saw POST /v1/chat/completions with
  "paimon/0.2.8 (Python 3.10.19; Linux x86_64)", and magpie usage counted
  the call under Paimon; `magpie paimon default` put the file back equal
  to the user's.
- After the rebase on origin/main 9c39edb92: the three vets, the targeted
  agent tests and internal/gui ok; internal/library's
  TestEveryAgentInLibrary red for avibe from 9c39edb92 (#5945, not this
  change); i18n-keys, i18n-en-no-cjk, agent-notice-lang, gui-de, gui-zh-tw
  ok; icon-one-tone's every-logo case ok in both engines, its webkit
  Plugins-page case timed out on page.goto's 5s at WSL load 92 (#5425).

Broken by hand, each red in TestPaimon:
- the user's window not put back for a model magpie doesn't know (switch
  window: <nil>);
- stashing again while providers.litellm is magpie's (switch window: 200000);
- a file magpie made not removed (made file left: {});
- a model picked in Paimon not kept as the user's (restore after a pick).

Not tried: macOS (mote unreachable) and the GUI's own Connect click with
the real binary; Paimon's auto-compaction at a window magpie wrote (the
fake model had none, so Paimon said compaction was off, as it does for any
name it doesn't know); a model picked in Paimon's own /model while
connected beyond the unit test.
2026-11-10 19:54:37 +08:00
yetone d4b4a188ef site: zh subscriptions page says "任意 Agent", not "任意编程 Agent"
Title, og:title, JSON-LD headline and h1; the owner asked for it. Run: wsl-run node --test worker.test.mjs install.test.mjs, 71 pass.
2026-11-10 19:04:54 +08:00
yetone d657e182a7 site: regenerate llms-full.txt for the routing rule's system-prompt example
82962db79 added a 'system matches' example to docs/routing.html without
running node llms-full.mjs, so worker.test.mjs's 'llms-full.txt is
current' test was red on main. Run: node --test --test-name-pattern
'llms-full|docs' site/worker.test.mjs, 7 of 7 (wsl-run).
2026-11-10 19:01:05 +08:00
yetoneandRex Zhou 5673eab0ba redact: mask crypto wallet keys, seed phrases and exchange passphrases (#4025, rexzh0u on X)
Rex Zhou's #4025 proposed default rules for crypto secrets. This ports
them with every shape that can also be ordinary text checked first:

- WALLET_KEY: 64 hex digits (0x or bare) only after a key's name on the
  same line (private key, secret, signer, deployer, wallet, pk, 私钥 …),
  and not when a hash, sha, digest, sum, pub, addr, tx or an id name sits
  between: tx hashes, block hashes, storage slots and sha256 sums go as
  written. noIDs keeps it, since the name already says it is a key.
- WIF and BIP32 xprv/tprv: base58check (double sha256) and payload length,
  so a random base58 run, an xpub or an address is not one.
- Solana: a base58 secret or a 64-number keyfile counts only when its
  second half is the ed25519 public key of its first; a tx signature,
  same length, goes as written. Each number in a keyfile is <= 255.
- Stellar S... seeds: StrKey version byte and CRC16-XModem.
- Prefixed kinds: NEAR ed25519:, Sui suiprivkey1, Aptos AIP-80
  ed25519-priv-0x, Nostr nsec1, age, Zcash secret-extended-key.
- SEED_PHRASE: after seed/mnemonic/phrase/recovery (and zh, ja, ko), the
  longest run of words from the BIP39 English list, cut to 12/15/18/21/
  24/25 words. The list is embedded, its sha256 checked by a test against
  the published one. A sentence after "recovery" has words off the list.
- Exchange keys: secretNames gains passphrase/pass (OKX, Coinbase, KuCoin)
  and priv_key; API key and secret fields were already masked by name.

What the patch had that does not ship: every 0x+64 hex masked (tx and
block hashes), unchecked base58 lengths for WIF and Solana (any long
base58 run), and a phrase pattern that took prose after "recovery".

The three rules with no marker (WIF, Solana, Stellar) run their pattern
only after a byte scan finds a long enough run (rule.may). Without it the
prose benchmark went from 2.9ms to 15.8ms per MB; with it 3.0ms, the
same as without the rules (profile: sha256 of the memo and memmove).

Run (wsl-run magpie-desktop, mote refused SSH all session):
- go test -count=1 ./internal/redact: ok
- go test -run TestCountTokensRedacted ./internal/gateway: ok (crypto on
  with Redact, off with RedactPersonal only)
- gofmt -l; go vet linux, -tags nogui, GOOS=darwin, GOOS=windows for
  internal/redact and internal/gateway: clean
- node --test site/worker.test.mjs (llms-full, docs): 7 of 7
- false positives: 1000 npm sha512 integrity lines, go.sum h1 lines,
  git shas, uuids, sha256 sums, std and URL-safe base64 blobs, xpub,
  addresses, IPFS CIDs, bech32, npub, public keys: none masked.
- 1MB inputs of each shape stay linear (RE2, no backtracking).

Broken by hand, each red: Solana unchecked (Lookalikes, Lengths), WIF
unchecked (Lookalikes), WALLET_KEY without its name check
(WalletKeyNeedsItsName, LockfilesAndBlobs), phrase without the wordlist
(SeedPhrase), Stellar unchecked and keyfile unchecked (Lookalikes), rules
unwired (7 tests).

Not tried: real wallets (test vectors are the BIPs', NIP-19's and
derived keys); Monero's own word list; other BIP39 languages; a Windows
or macOS run of the tests; the full suite (after the tag).

Co-authored-by: Rex Zhou <zhouzhuojie@gmail.com>
2026-11-10 19:00:46 +08:00
yetone 4ca0befb8e site: docs pages for Anthropic and OpenAI API keys in every agent
New /docs/anthropic and /docs/openai in en, zh and ja: adding the key,
endpoints, model list, each agent's route (pass-through or translated),
what magpie does for the vendor (Anthropic cache marks and thinking,
OpenAI prompt_cache_key, Responses vs Chat, priority tier), reasoning,
web search, cost, several keys, troubleshooting and a JSON-LD FAQ.
Every claim was checked against internal/provider, internal/gateway and
internal/catalog. The "By provider" line on 30 pages, sitemap.xml (99
URLs), llms.txt and the rebuilt llms-full.txt link them.

Run (wsl-run, magpie-desktop; mote refused ssh at the time):
node --test worker.test.mjs install.test.mjs: 71 pass, 0 fail. Each new
page's JSON-LD parsed with node.
Not tried: the pages in a real browser beyond the deployed 200 check.
2026-11-10 18:56:19 +08:00
yetone 82962db79a routing: a rule can match the system prompt or the last user message, by words or a regex, with no model asked (SucroseMoE on X)
SucroseMoE asked for routing on plain string and regex matches instead
of an intent model: `system[0] matches /^你是对话标题命名/` → model A,
`user[-1] matches /^正在上下文压缩/` → model B, so any harness's title
and compaction calls can be routed without a classifier.

Two new rule condition fields, beside message/effort/subagent/agent:

- system: any block of the system prompt as the agent sent it (Anthropic
  system blocks, Chat system/developer messages, Responses instructions
  and system/developer items, Gemini systemInstruction). Any block, not
  only the first, because Claude Code's first block is its billing
  header.
- last: any text of the request's last user message as sent, reminders
  the agent adds included, so an anchored ^ still meets a compaction ask.

Ops for both: contains, doesn't contain, starts with, matches (regex,
case-insensitive; a value written /…/ has its slashes dropped). The
gateway reads system and last only when a rule asks (RulesRead), and
decodes raw system JSON lazily then. Like every rule, the decision is
made as a turn starts and its tool rounds keep it.

GUI: Routing → group → Rules, "+" on a rule row offers "System prompt text"
and "Last user message" pills (no modal), with tooltips, placeholders
and the bad-regex mark; zh, zh-TW, ja, de. CLI: `--when "system matches
^You are"`, with aliases system[0], user[-1], last-user. TUI hint, docs
(gateway-routing.md, site start pages) say the same.

Ran, on mote (macOS) until its sshd began refusing connections: gofmt
-l internal/ clean, go vet of provider/gateway/cli/tui, the rule tests;
the routing GUI files (routing-rule*, routing-rules-line,
routing-pause*, group-*, i18n-*, routing-compact, routing-intent-*,
routing-smart-intent) in chromium and webkit: 751 of 781, the 30 reds
being "System prompt" taken by a core word (now "System prompt text"),
routing-rules-line's + menu count (now with system and last), and
routing-intent-entry, red on main since 01a260af4 (#5392, next commit).
Then on the Linux box (wsl-run, magpie-desktop): go vet -tags nogui and
GOOS=windows go vet of the same packages; go test -tags nogui of
internal/provider, gateway, cli, tui, gui; node --check of the routing
plugin; routing-rule-ops, routing-rules-line, routing-intent-entry,
i18n-keys, i18n-en-no-cjk, routing-rule-example in chromium and webkit,
the new test 16 of 16 over four repeats.

Broken by hand: holdsIn's system/last cases returning false turns
TestCondHolds and 8 of TestRuleSystemAndLastText's cases red; dropping
the Anthropic system wiring turns its two Anthropic cases (one the real
Claude Code system fixture) red.

Not tried: a real harness's title or compaction request end to end
through a live gateway; the fixtures are Claude Code's, Codex's and pi's
recorded system prompts.
2026-11-10 18:48:13 +08:00
yetone 617200a320 providers: Vercel AI Gateway is a preset (Archie627 on X)
Archie627 said magpie has no Vercel AI Gateway. It is now a preset in
Add: Chat Completions and Responses at https://ai-gateway.vercel.sh/v1,
Anthropic Messages at https://ai-gateway.vercel.sh (Vercel takes the key
as Bearer there too), models.dev's "vercel" catalog, the vercel icon the
vercel-jev decision preset already used, and its API keys page. An
OpenCode or URL import at that host becomes the preset. READMEs and the
site's import pages (en, zh, ja) list it.

Its /v1/models (public, 505 rows today) marks each row's "type". Read
as before, the decision models (liquid/d1, typesafe-ai/jev) and realtime
voices showed as chat models, ElevenLabs voices were dropped, and
transcribers (elevenlabs/scribe-v2) showed as chat. At Vercel's host
alone (catalog.VercelGateway) the type now decides: evaluation and
realtime rows are left out, speech, transcription, embedding and
reranking rows get their Serves, image rows draw and video rows film.
The 48 "-batch" ids are left out: Vercel's docs say "Synchronous
requests don't accept -batch IDs". context_window gives the window.
Another host's "type" is read as before.

Run: TestVercelPreset and TestVercelLiveList (real rows from Vercel's
list in testdata, served through an httptest server, no network);
go test ./internal/catalog ./internal/provider on Linux (wsl-run) and
macOS (mote, -run Vercel|Preset|Import before mote stopped taking SSH);
gofmt; go vet linux, windows, darwin (CGO off).
Broken by hand: VercelGateway returning false turns TestVercelLiveList
red (decision, realtime, batch and transcriber rows back in chat); the
-batch skip alone turned off turns it red too.
Not tried: no Vercel key, so no real chat, Responses or Messages call;
only the public GET /v1/models. No GUI file reads the preset list by
name (the Add sheet is built from /api/presets), so no GUI run.
2026-11-10 18:11:38 +08:00
yetone 8cc4bd7e3c agent: Craft Agents, through a keyless connection at the gateway (springg1998 on X)
Craft Agents (lukilabs/craft-agents-oss, thecraftagents.com) keeps its LLM
connections in config.json under $CRAFT_CONFIG_DIR or ~/.craft-agent
(paths.ts, storage.ts, llm-connections.ts, v0.15.8). magpie adds one
connection: slug magpie, providerType pi_compat, authType none, baseUrl at
the gateway's /agent/craft-agents/v1, customEndpoint.api
openai-completions. Its models are the ones picked for it, and defaultModel
is always one of them, because Craft resets a default that isn't in the list
to the first. magpie makes it defaultLlmConnection. The user's default is
stashed (as JSON, "" for none) and put back on off when that connection still
exists. A name the user gives magpie's entry stays, and a sync with nothing
to change writes nothing. A config.json with no workspaces list is one Craft
doesn't load, so magpie never creates one: open Craft once first. Picking one
of the user's own models removes magpie's entry and sets that model on their
default connection. Sessions keep the connection they started on, so the
notice says new sessions use it (zh, zh-TW, ja, de).

Detected by ~/.craft-agent, Craft Agents.app (com.lukilabs.craft-agent), or
%LOCALAPPDATA%\Programs\@craft-agentelectron\Craft Agents.exe (per-user
NSIS; the GUID is the UUID v5 of the appId, derived the same way as dsh's
known one). Skills go to ~/.agents/skills. CRAFT_CONFIG_DIR is in
agentenv.Vars. Icon from Craft's own icon.svg (#9570BE). README, reference,
agent-wiring and site list it.

Run on mote, first on origin/main 720200092:
- go test -tags nogui ./internal/agent ./internal/library ./internal/agentenv: ok.
- go test ./internal/gui: ok.
- go test ./internal/proc: ok (at the pre-rebase head).
- GUI tests in chromium and webkit, 69/69: i18n-keys, i18n-en-no-cjk,
  icon-one-tone, icon-tile, tray-logos and usage-agent-filter-icons.
- gofmt -l is clean. go vet passes for darwin, GOOS=linux -tags nogui, and
  GOOS=windows.
Then rebased on 6b92824ff and run again there: go test ./internal/gui,
the Craft, hand-wired, spelled, drift and every-agent tests in
./internal/agent and ./internal/library, and i18n-keys: all ok.
Pushed rebased on 2fbead798 (provider relay URL, Windows restart, gateway cap: no
files in common), not run again there; the full suite runs after the tag.
Broken by hand: with unwire's restore of the user's default taken out,
TestCraftAgents goes red at "restore". On the old code the tests don't
compile (no craftAgents). The first run also showed every-agent tests
(drift, LAN, proxy, port move) needing a Craft fixture, which is now added.
Not tried: a real Craft Agents app or its Pi server against the gateway, or
the Windows install path on a real install.
2026-11-10 18:09:54 +08:00
yetone 2d92221880 site: APINEBULA's card takes the copy APINEBULA sent
The zh text is theirs word for word; en, ja and de are translated from
it (0.6折 = 6% of list price).
Ran: node --test site/*.test.mjs on magpie-desktop (WSL; mote refused
ssh), 107/107 pass.
2026-11-10 17:43:39 +08:00
yetone d109ec8da8 agent: miniQ, its provider on magpie's gateway (xiancrong on X)
miniQ (LeadingThink/miniQ, 0.1.213) is a desktop coworker and a `miniq`
terminal, both clients of one miniq-daemon. Its model is one provider in
<data dir>/settings.json, {baseUrl, apiKey, model, apiProtocol}: the data
dir is $MINIQ_DATA_DIR, else the folder miniq-data-dir.json names, else
%LOCALAPPDATA%\miniq or ~/.local/share/miniq (macOS too).

Picking one of magpie's models writes the provider as the gateway's /v1,
magpie's key for miniQ (it sends no User-Agent of its own), the catalog id
and apiProtocol chat_completions ("auto" guesses a protocol from the model
name). What the user had is stashed whole and put back on Disconnect; the
rest of settings.json is left alone. A settings.json magpie made is 0600
and goes again when magpie steps out. The daemon reads settings.json once
and writes its copy back on every change, so a running one is told too:
settings.update over the WebSocket daemon.json names, as miniQ's own
Settings does, which also moves open chats. Notice compares the daemon's
settings.get with the file and asks for a restart when they differ.
"On magpie" is known by magpie's key, so a moved port or a proxy in front
of the gateway is told apart by Check (baseUrl and apiKey). WSL: the
distro's ~/.local/share/miniq. Icon, i18n (zh, zh-TW, ja, de), READMEs,
reference, site, MINIQ_DATA_DIR in agentenv.Vars.

Run:
- At the pushed head, rebased on 286e3b6d5: internal/agent and
  internal/agentenv ok; i18n-keys, agent-notice-lang, icon-tile 29 of 29.
- mote: go test ./internal/agent/ ./internal/agentenv/ ok;
  ./internal/gui/ and ./internal/cli/ ok except
  TestGatewayModeStatsNameTheGatewaySessions, run in mote's first local
  hour (00:2x), which is #5690.
- GUI on mote, chromium and webkit: i18n-keys, i18n-en-no-cjk,
  agent-notice-lang, gui-de, gui-ja, gui-zh-tw, icon-one-tone, icon-tile,
  routing-client-icons, usage-agent-filter-icons, agent-connect,
  agent-models, agent-layout: 110 of 110.
- Windows (win-run): TestMiniq*, TestOwnProviderNamedAsMagpies/miniq,
  TestFolderVarsAreListed ok (the LOCALAPPDATA path).
- gofmt; go vet darwin, linux nogui, windows.
- Real miniQ in a sandbox on mote: the 0.1.213 aarch64 terminal tarball,
  sha256 checked against terminal.json, miniq-daemon on a sandbox
  MINIQ_DATA_DIR, a fake OpenAI upstream at MAGPIE_ADDR (uncommitted
  test). Set magpie/deepseek/pro: the running daemon's settings.get
  showed the gateway's /v1 at once; `miniq exec --no-start "say pong"`
  sent POST /v1/chat/completions with Bearer magpie-miniq and model
  deepseek/pro and printed the reply. Set "": the daemon and the file
  were back on the user's provider with their key; nothing else in
  settings.json changed. Run twice, before and after the key fix.

Broken by hand:
- push sent "settings.nothing": TestMiniq red ("the daemon was told
  nothing").
- apiProtocol dropped from the provider: TestMiniq red.
- on() by URL only (the first version): TestPortMovesEveryAgent,
  TestDriftUnwiredEveryAgent/miniq and TestReverseProxyIsStillMagpie red.

Not tried:
- miniQ's desktop app; only the terminal and daemon ran.
- Windows and WSL with a real miniQ.
- Session titles: miniQ asks a hard-coded gemini-3.8-flash on the same
  provider for them; without such a model at magpie the chat stays
  untitled (miniQ retries later). Nothing in its settings changes that.
- A project's own model in miniQ overrides the global one, as in miniQ.
- settings.update can't remove a provider, so a daemon that had none
  before magpie keeps magpie's until it restarts; the notice says so.
2026-11-10 16:46:39 +08:00
yetone 00e8242e85 library: Hermes folds its context with billion-context through its /bili/ prefix (Duckb7si on X)
Library › billion-context said no agent could use it on a machine where
Hermes was connected to magpie. Hermes was left out of the lanes on
purpose: bili's native Hermes plugin (hermes-plugin/__init__.py,
apply_env, billion-context 0.1.213) only sets HTTPS_PROXY, HERMES_CA_BUNDLE
and SSL_CERT_FILE. magpie's Hermes provider is http://127.0.0.1:3425/v1,
plain http on loopback, so that proxy never sees it: the plugin would add
its tools and fold nothing.

Hermes now takes the route Zed takes, bili's documented /bili/ prefix.
Turned on, magpie runs `bili start --port 8787` and sets base_url of the
magpie and magpie-anthropic providers to http://127.0.0.1:8787/bili/<gw>,
in config.yaml and in every profile that has magpie's provider
(agent.HermesThrough). Each later Sync or pick keeps a loopback prefix
with a path (hermesPrefix), and drops anything else back to the gateway.
Turning it off puts the gateway back. The empty-list string, docs (en, zh,
ja), llms-full.txt and docs/subsystems/library.md name Hermes.

The other agents bili supports that magpie wires (dsh, Kimi, ZCode, Codex,
Gemini, Qwen, ...) are #5915.

Run (mote, at the rebased head unless said):
- go test -tags nogui ./internal/library: ok (252s) at the rebased head
- go test -run 'TestHermes|TestZed|TestProxy|TestBili|Kept'
  ./internal/agent ./internal/library: ok before the rebase (base
  2219fdd49); the whole internal/agent at the rebased head was still
  running at push (mote load ~60), result goes on #5915
- GUI library-bili, library-all, i18n-keys, i18n-en-no-cjk (chromium and
  webkit, every language): 84, 26, 4, 4 pass, 0 fail (before the rebase)
- site node --test: 107 pass (llms-full.txt regenerated with llms-full.mjs)
- go vet darwin, GOOS=linux -tags nogui, GOOS=windows on agent and
  library: clean; gofmt -l clean
Broken by hand:
- hermesEntries without the prefix: TestHermesThroughBili red (a pick
  drops the prefix)
- no "hermes" URL lane: TestBiliHermesThroughPrefix red (Hermes not
  offered)
Not tried:
- a real Hermes and a real `bili start`; tests fake bili and the probe
- a profile created after turning it on goes to the gateway until Hermes
  is turned on again
- bili's native Hermes plugin installed at the same time
- Windows run (vet only)
2026-11-10 16:16:11 +08:00
yetone 97fcbe3540 library: billion-context's card shows the tokens it saved (Scott__D on X)
The RTK tab says what RTK saved (rtk gain); the billion-context tab said
nothing of its effect. bili 0.1.213 has no command that prints its
savings. Its running proxy serves its dashboard's numbers at
GET /__bili/overview, summed over every session in its one store, and
each bili that runs registers in <state>/instances/<id>.json
($XDG_STATE_HOME or ~/.local/state, then billion-context, on every
system; read from bili's dist and its Hermes plugin's twin reader).

readBiliSaved (internal/library/bili_saved.go) asks the registered
bilis newest first, loopback http origins only, 3s in all, and puts the
first answer on BiliView.Saved: netSavedTotal (bili's headline "net
savings", after post-fold rebuilds and the summaries' cost, only with
hasFoldData), grossSavedTotal (which bili calls an upper bound),
foldsTotal, sessions, requests. The answer is kept in bili-saved.json
in magpie's config folder and shown "as of" its time when no bili runs;
a kept file that doesn't parse is no answer. magpie never starts a bili
to ask (it would auto-update and start watchers). The card says
"166.3k tokens saved over 7 folds in 1 session", bili's own count over
every session on this computer, the gross before costs; "Nothing folded
yet over N requests" before a fold; and that it shows once bili has run
when no bili ever answered. zh, zh-TW, ja and de; site docs (en, zh,
ja) and docs/subsystems/library.md.

Run:
- Real bili 0.1.213 on mote in a sandbox HOME (ACP_AUTO_UPDATE=0, 20000
  token window, bili start on 18799, a fake OpenAI upstream answering
  usage = bytes/4): ten turns of a growing conversation through
  /bili/<upstream>/ gave overview net 166285, gross 166390, 7 folds,
  1 session, 10 requests. That literal answer is the Go fixture
  (testdata/bili/overview-0.1.213.json) and the GUI test's numbers.
  readBiliSaved/ReadBili run on mote against that live bili with that
  HOME read the same numbers (Live true, Version 0.1.213).
- go test -tags nogui ./internal/library ./internal/gui on mote: ok.
- win-run go test -run 'TestBiliSaved|TestBiliLoopback'
  ./internal/library on xiaomi-gpu: ok.
- library-bili, i18n-keys and i18n-en-no-cjk in chromium and webkit
  (every language, 1100 and 420 wide): 92 pass, 0 fail.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui and
  GOOS=windows for internal/library and internal/gui: ok.
- site/public/llms-full.txt regenerated (node llms-full.mjs); site
  worker.test.mjs: 38 of 38 ok.

Broken by hand:
- the loopback filter taken out: TestBiliSavedFromRunningBili red
  (192.0.2.7 asked first, the 3s budget gone, nothing read).
- net read from tokensSaved, and a kept answer marked live:
  TestBiliSavedFromRunningBili and TestBiliSavedOnThePage red.
- the card's line taken out: library-bili 40 of 42 red (chromium).

Not tried: a real agent session with a real model through bili (the
upstream was a fake with made-up usage, so only the plumbing of bili's
numbers is checked, not how much a real session saves); a bili with
money data (hasMoneyData; its dollars are passed as usd but not shown);
the card on Linux WebKitGTK.
2026-11-10 15:47:32 +08:00
yetone 86825005e2 plugin: a gateway hook given more than 10s gets up to 30s (#5890)
gatewayTimeoutMs was capped at 10000 and the Go side cut every hook RPC at
11s, so a recall hook (Nowledge Mem) asking for 15s was cut at 1s (any
value over 10000 fell back to the default) and could never finish.

- host.js: gatewayTimeoutMs takes integers 100-30000; a value outside is
  clamped to the nearer bound, a non-integer gets the 1000 default.
  gatewayBudget() is the old chain budget (sum, clamped 2-10s) or the
  longest hook's own timeout, whichever is larger. With no hook over 10s
  nothing changes.
- gateway.go mirrors both (gatewayTimeout, gatewayBudget, cached with the
  HasGateway scan). GatewayBegin's request RPC, Finish's completion RPC
  and GatewaySignIn now wait the budget plus 1s, never less than the old
  11s; host startup and the lock wait stay bounded at 11s. Caller
  cancellation still reaches the hook at once, a failing hook still
  rolls back, and the request-state limits are unchanged.
- Docs: gateway-request-hooks subsystem page, plugins docs (en, zh, ja).
  site/public/llms-full.txt regenerated with `node llms-full.mjs`; it was
  already stale on origin/main (OpenCode 2 keys, billion-context tab,
  data-folder move, vendor presets, group rule), so those docs pages'
  text lands in it too.

Run on mote at this tree (base 03a800ac6; origin/main has one newer
commit touching none of these files):
- gofmt -l internal/plugin internal/gateway: clean
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./...: rc 0
- go test -tags nogui -count=1 -timeout 45m ./internal/plugin/...
  ./internal/gateway/...: ok plugin 161.6s, ok gateway 897.0s
- site: node --test worker.test.mjs: 38 pass (llms-full red before the
  regeneration)
New tests (internal/plugin/gateway_budget_test.go): a 12s onRequest and
onResponse with gatewayTimeoutMs 15000 both land (24.2s); the default and
10000 are still cut with outcome "timeout"; two 8000ms hooks still share
10s; 130000 is clamped, not dropped; cancelling a 15000ms hook's request
stops its fetch at once (0.07s); the Go mirror matches host.js.

Broken by hand, each red:
- A host.js as on main: SlowRecall red at 1.10s, Clamps red
- B Go RPC kept at 11s: SlowRecall red at 11.04s, Mirror red
- C chain capped at 10s: SlowRecall red at 10.13s
- D default per-hook 30000: DefaultStillCuts/default red
- E caller signal off the begin chain: LongBudgetCallerCancellation red
- F chain budget 30s for every config: ChainStillTenSeconds red

Not tried: a real Nowledge Mem server; the full ./... suite; GUI tests
(no GUI change); a Windows or Linux runtime run (vet only).

Reported-by: aboat0625-cpu
2026-11-10 15:31:01 +08:00
yetone 03a800ac69 agent: OpenCode 2's config in its own words (kaising00 on X)
For an OpenCode 2 magpie wrote OpenCode 1's opencode.json: its provider
under `provider`, the small model as `small_model`, and `reasoning: true`
on models that reason. OpenCode 2 converts the first two in memory, but
it doesn't read `reasoning` and logged a WARN for each such model on
every load ("configuration normalization diagnostic ... omitted
unsupported legacy setting", reproduced with a real OpenCode 2.2.6).

Now the OpenCode that reads the file decides its words (openCodeTwo in
opencode_v2.go: the opencode on PATH, or a WSL distro's probed version,
now asked for opencode too). For 2.x magpie writes `providers.magpie` in
OpenCode 2's shape (openCodeNative), `agents.title.model`, and no
`reasoning`. A file written for OpenCode 1 moves over on the next sync:
openCodeFromV1 ports migrateStandardProvider (v2.2.6) so the user's keys
in magpie's provider (headers, timeout, setCacheKey, their own variants,
limit.output) go along; an empty `provider` is dropped; a small_model
that isn't magpie's stays. OpenCode 1, or an unknown version, gets the
same output as before. OpenChamber writes the same file and takes the
same decision, so the two syncs don't undo each other. mimocode, DevEco
Code and Air keep OpenCode 1's words.

Run:
- gofmt; go vet ./internal/agent for darwin, linux (-tags nogui) and
  windows (mote): clean.
- go test -count=1 ./internal/agent on mote: ok, at the rebased head.
- win-run go test -run 'OpenCode|OpenChamber|WSL' ./internal/agent: ok.
- Real binaries on mote, sandbox HOMEs, `opencode debug config
  --print-logs`: the file magpie now writes for OpenCode 2 loads in
  OpenCode 2.2.6 with no WARN/ERROR, and resolves (model, agents,
  providers) exactly as 2.2.6 resolves the OpenCode 1 file it replaces;
  the OpenCode 1 file loads in 1.19.5 with no WARN, small_model and
  reasoning intact. The old file in 2.2.6 still shows the reasoning WARN.

Broken by hand:
- openCodeTwo always false: TestOpenCode2WritesItsOwnWords,
  TestOpenCode2MovesAnOpenCode1File, TestOpenChamberAndOpenCode2AgreeOnWords
  and TestOpenCodeTwo red.
- moveProvider not carrying the v1 block over: the move test red on the
  user's timeout.
- moveSmall off: the move test red on agents.title.model.

Not tried: a real OpenCode 1 desktop app reading a file written for an
OpenCode 2 CLI on PATH (it would see no magpie provider; 1.19.5 logs
`providers` as not representable); Air's bundled OpenCode version; a real
WSL distro with OpenCode 2.
2026-11-10 14:52:01 +08:00
yetone bb4dd86790 appdir: magpie's files and cache move to another disk, a link left where they were (CHENGJIAHEGOXIS and buhaodeshiyehao on X)
CHENGJIAHEGOXIS asked to keep magpie's data and cache on an external SSD
instead of the Mac's own disk. buhaodeshiyehao asked to keep magpie's
personal data on another disk. Settings › Sync now has a Data folder row.
It shows where magpie's files are, with Show, Move… and Move back.
`magpie data` does the same from a terminal.

- What moves: appdir.Config() and Cache() only, into <picked>/magpie/config
  and /cache. The agents' own folders and session histories stay where
  each agent reads them. A link is left at each old path, so every path
  the agents were given still works. On Windows, when symlinks need a
  privilege (#973), the link is a junction; library's junction code moved
  into appdir for this.
- Never under a running magpie. Move… explains first in the app's own
  dialog, then asks for the move (move-to.json). The app restarts itself
  through the update path's relaunch and quits, and the new process makes
  the move in cli.Main before it reads anything, once. A failed move is
  kept in move-result.json and shown under the row. When another magpie
  serves the gateway, or for magpie web, the app doesn't restart, and the
  row says the move waits, with Cancel.
- Refused before anything quits: a relative or missing folder, a
  magpie folder there with files in it, or a folder inside magpie's own.
- One disk: a rename. Across disks: a copy. The old folder is put aside
  until the link is made, and a failed copy leaves everything as it was.
- Disk unplugged: magpie stops with an error (and a native alert from the
  app, as #989) instead of starting empty and writing over the link.
- Usage history in auto backups is left for a follow-up: auto backups are
  plain JSON kept 7 times, and usage is large and synced separately.

Docs: sync-backup.md has a "Data folder on another disk" section, and
docs/start's #data-folder (en, zh, ja) describes Move….

Run (mote, at this tree on 0791c91c5):
- gofmt -l: clean
- go vet: darwin, linux -tags nogui and windows, for appdir, cli, gui and
  library: ok
- go test -count=1 ./internal/appdir ./internal/cli ./internal/library
  ./internal/gui: ok. cli was red first, on TestEveryRouteHasACommandOrIsNamed;
  the routes are now mapped to magpie data.
- Windows (xiaomi-gpu): appdir's Move tests, including TestMoveByJunction
  with symlink forced to fail with ERROR_PRIVILEGE_NOT_HELD, and
  TestDataFolderMoveRestarts: ok. TestFoldersJoinedOnce is red there,
  which is #4846 (appdir.go is untouched).
- GUI, chromium + webkit: data-folder (5 languages x 1100/420px),
  auto-backup, sync-*, settings-sections, segs-press-redraw, old-webkit,
  github-sync, s3-sync, skill-how, usage-computers,
  webdav-settings-refresh, i18n-keys and i18n-en-no-cjk: ok except
  phone-no-sideways de 375 (#5869) and s3-sync webkit en (#3413/#5872,
  red 3 of 3 on this tree too), both already red on main.
- Linux (WSL magpie-desktop): appdir -run Move and
  TestDataFolderMoveRestarts (nogui): ok.

Again after rebasing on 0a44c1c84 (mote): gofmt, the three vets, go test
./internal/appdir ./internal/cli ./internal/gui, and the GUI files
data-folder, i18n-keys, i18n-en-no-cjk, auto-backup and settings-sections
in both engines (60 of 60): ok. Pushed on 5426c43cc, which touches only
the gateway's dsh_compact and the routing plugin, none of these files.

Broken by hand (each went red):
- no removal of a half copy: TestMoveCopyFailsLeavesAll "a half copy
  is left on the disk"
- no Unreachable check for a gone disk: TestMovedDiskGoneIsUnreachable
- restarting with another magpie serving: TestDataFolderMoveRestarts
  "2 restarts"

Not tried: a real app restart making a real move on a real external disk
(the restart is the update path's relaunch, faked in the test); a real
unplug.
2026-11-10 13:46:13 +08:00
yetone a79d16c684 routing: a rule can match on conditions: effort, subagent, message content, agent (aipha2025 on X)
A routing rule takes field/op/value conditions (Rule.Where) beside its
existing match. Fields: reasoning effort, whether the request comes from
a subagent, the user's own message that opened the turn (content), and
the agent. Ops: is, is not, contains, starts with, regex, greater/less
than. Only Claude Code and Codex say when a request is a subagent's.

- provider: rulecond.go parses and evaluates conditions; grouprule.go
  and ruleparse.go carry them in a rule.
- gateway: the request's effort, subagent flag and opening user text
  reach the rule check (ir.go, rules.go); the trace names a rule's where.
- CLI: `when="..."` on a rule; TUI shows it.
- GUI: the conditions are edited inside the existing rule row (no
  dialog), in every language (routing i18n).
- Docs: gateway-routing.md, site start pages (en, zh, ja).

Run:
- GUI: 124/124 on the touched files (routing-rule-ops, routing-rules-line,
  i18n-keys and the routing files), chromium and webkit.
- A wider 236-file GUI run is red only where the old code is red too:
  menu-input-scroll (#3402), webkit context-fold, intent-entry, row-swap.
- gofmt; go vet darwin, linux (nogui) and windows.
- go test ./internal/provider ./internal/cli ./internal/tui
  ./internal/gateway pass.
- After the rebase on origin/main c4a542466, at this head on mote:
  i18n-keys, routing-rule-ops and routing-rules-line 42/42 pass;
  go test ./internal/gui ./internal/provider ok.

Broken by hand: removing the condition loop, and forcing subagent to
false, each turn rulecond/rule_where tests red.

Not tried: a real Claude Code or Codex subagent end to end.
2026-11-10 13:10:28 +08:00
yetone b922e51685 agents: nanobot gets magpie as a provider of its own (Niapyaya on X)
nanobot (HKUDS/nanobot, pip install nanobot-ai) is now an agent magpie
connects. Its config is read from its own source (5c72ced, 0.4.1):
~/.nanobot/config.json, camelCase or snake_case keys, any extra key under
providers an OpenAI-compatible endpoint whose name is stripped from the
model.

magpie adds providers.magpie (apiBase at the gateway's /v1, its key, and
extraHeaders User-Agent nanobot), and sets agents.defaults provider
magpie, model magpie/<id> and contextWindowTokens when the window is
known. What the user had there, both spellings, and a modelPreset that
would go over magpie's model, is stashed and put back on disconnect,
the window as a number. A file magpie made goes again. Also in WSL
distros, with a notice in every language, the icon (a tile in app.css's
rule), READMEs, site list, docs/reference.md and agent-wiring.md.

Run:
- real nanobot 0.4.1 on mote in a sandbox HOME (~/nbsb), a sandbox
  gateway on 47812 over a fake OpenAI upstream: `magpie nanobot
  magpie/fakeup/m1` wrote the config and kept the user's relay provider
  and channels; `nanobot agent -m ping` answered "pong from fake
  upstream"; the upstream saw POST /v1/chat/completions, model m1,
  UA nanobot; `magpie nanobot default` put relay/glm-4.6 back exactly.
- go test ./internal/agent ./internal/gui ok; ./internal/gateway and
  ./internal/cli -run 'Client|UA|Agent|Empryo' ok; go vet darwin,
  linux -tags nogui, windows ok; gofmt -l clean.
- GUI, chromium 110/110 and webkit 65/65: i18n-keys, i18n-en-no-cjk,
  agent-notice-lang, gui-de, gui-ja, gui-zh-tw, icon-one-tone,
  icon-tile, routing-client-icons, usage-agent-filter-icons,
  agent-connect, agent-models, agent-layout.

Broken by hand, each red in TestNanobot: modelPreset not stashed
(preset left over magpie's model), the made file not removed, and the
window restored as a string.

Not tried: a real vendor behind the gateway (fake upstream only),
nanobot's long-running `nanobot gateway`/WebUI picking the change up
live, and WSL.
2026-11-10 10:27:05 +08:00
yetone 9309e28ced plugins: a plugin's provider in front of a vendor's API is that vendor to the gateway (songlairui on X, #5462, #5464)
A plugin whose provider's `api` is on a vendor's preset host (a Mistral
Vibe plugin's https://api.mistral.ai/v1) got none of what magpie does for
that vendor, since its Host() is the plugin's id. An earlier turn's
thinking went to the plugin's fetch as reasoning_content, and Mistral
turned the whole request away (422 extra_forbidden); the plugin had to
rewrite the body itself.

provider.VendorHost and VendorPreset now resolve a plugin's declared `api`
host to the preset that names it (every Chat, Responses and Anthropic base
of every preset and region; local and remote magpie presets excluded, and
an api on loopback, a private address, .local or .localhost names no
vendor). For every other provider, and a moved subscription, they are
Host() and Preset as before. The gateway's vendor checks read them: 38
p.Host() sites, Mistral's, OpenRouter's, DeepSeek's, Kimi's and
DashScope's preset checks. Host() stays the plugin's id where calls are
kept and shown; requests still go only to the plugin's fetch. Search and
the video plan check are unchanged. No community plugin's api is on a
preset host today (checked at plugins 7b52e3fc), so none changes.

Any plugin gets this with no new field; documented in
docs/subsystems/provider-plugins.md and the plugin docs (en, zh, ja).

Run (mote): go vet ./... darwin, GOOS=linux -tags nogui, GOOS=windows;
go test -count=1 -timeout 45m ./internal/provider ./internal/plugin
./internal/gateway: ok (provider 209s, plugin 182s, gateway 1002s). gofmt -l clean.
Broken by hand: pluginVendor resolving nothing (the old behaviour) turns
TestPluginVendor red, and TestPluginInFrontOfMistralIsMistral red on both
halves: the translated Claude Code turn is answered Mistral's 422
extra_forbidden, and the relayed Chat request carries reasoning_content.
Not tried: a real Mistral Vibe key through the reporter's plugin; Windows
and Linux runs of the tests (no OS-specific code).
2026-11-10 10:01:59 +08:00
yetone b75aff1073 library: billion-context for Zed through its /bili/ prefix (CoMi6818 on X)
billion-context's README lists Zed, but Library's billion-context tab
offered only Pi, omp, OpenCode and Claude Code. Zed has no plugin of
bili's. Upstream gives it two routes: `bili zed`, a Linux-only launcher
that leaves a provider on loopback direct (so it never passes magpie's
gateway), and, on every system, the /bili/ prefix its docs give any
client whose model address can be edited, with `bili start` answering
on 8787.

Zed is now a URL lane (biliURLLanes, internal/library/bili_url.go).
Switched on, magpie has bili start answer (one the user runs is used;
else magpie runs its own under KeepLinked's context, logged to
bili-start.log, and starts it again at magpie's start while Zed is on),
then agent.ZedThrough sets the magpie provider's api_url to
http://127.0.0.1:8787/bili/<gateway>/v1 and saves the key for that
address in the credential store, where Zed looks it up by address. A
pick and a sync keep the prefix while magpie answers through it
(zedReach, #1985's proxy recognition). Off puts api_url back on the
gateway and ends magpie's bili start when nothing goes through it.
Zed must be on magpie first; the error says to pick a magpie model.

Run:
- bili 0.1.213 on mote: bili start --port N, then
  /bili/http://127.0.0.1:<fake magpie>/v1 forwarded GET /, GET
  /v1/models and POST /v1/chat/completions with Authorization kept and
  bili's tools injected (repro/zedroute.sh).
- mote: go test -tags nogui ./internal/library ./internal/agent (full
  packages), go vet darwin, GOOS=linux -tags nogui, GOOS=windows.
- mote: library-bili, i18n-keys, i18n-en-no-cjk GUI tests (chromium
  and webkit).
- win-run: go test ./internal/agent ./internal/library -run
  'TestZed|TestBili'.
- gofmt -l clean.

Broken by hand: SetBili without the URL-lane dispatch, and zedReach
without the proxy keep: TestBiliZedThroughPrefix and TestZedThroughBili
go red; restored, green.

Not tried: a real Zed app through bili (no Zed on mote), and the real
keychain write (zedCredential stubbed in tests, as before). Other
clients upstream lists (Cline/Roo/Kilo, Continue, OpenHands, Void,
Cursor, Warp, launcher-only lanes) are not added here.
2026-11-10 09:59:22 +08:00
yetone 3aa55065a3 library: Claude Code keeps its auto-compaction beside billion-context (Kling__Lab on X)
Kling__Lab's Claude Code stopped after a little use with "Prompt is too
long", every message answered at once (作業時間 0s) with nothing sent.
bili's Claude Code install writes DISABLE_AUTO_COMPACT=1 into the shared
~/.claude/settings.json. A session bili doesn't fold then has nothing to
keep it under the window: the Claude desktop app's Code tab runs Claude
Code on that settings.json with its own ANTHROPIC_BASE_URL, past bili's
proxy (bili's own #2290), and a window bili takes larger than the one
magpie serves lets the session reach it first. With auto-compaction off,
Claude Code blocks locally at about window-3000 and returns "Prompt is
too long" without a request.

magpie now writes "0" in place of bili's added "1" right after the
install. bili leaves a value that isn't "1" as the user's, through its
SessionStart hook and a reinstall, and its remove takes only a "1". So
auto-compaction stays on as a backstop at the window magpie wrote
(CLAUDE_CODE_AUTO_COMPACT_WINDOW), which bili, when it does fold, keeps
the session under. A DISABLE_AUTO_COMPACT the user had before the install
is left as theirs. A plugin magpie installed before this is mended from
KeepLinked at start, and its bili-plugins.json record says "0" too, so
switching it off still puts the file back as it was.

Reproduced on mote with Claude Code 2.1.321 and billion-context 0.1.213
against a fake gateway reporting 195000 input tokens on a 200000 window:
with DISABLE_AUTO_COMPACT=1 the second turn is "Prompt is too long" with
no request sent; with 0 it compacts and goes on.

Run (mote-run): go test -tags nogui ./internal/library -run
'TestBili|TestParseBiliList' -v, all ok, including the new
TestBiliClaudeKeepsAutoCompact (on and off, the user's own value, a
plugin installed before), then the whole package (go test -tags nogui
./internal/library ok, 154s). gofmt -l clean; go vet ./internal/library
./internal/gui/..., GOOS=linux -tags nogui and GOOS=windows go vet
./internal/library ok.

Broken by hand: biliKeepCompact returning at once. The new test's "on
and off" and "installed before" went red (DISABLE_AUTO_COMPACT = 1 after
the install / after magpie started), "the user's own" stayed green.

Not tried: the real Claude desktop app's Code tab, and a real bili
install on a real account; the fake bili in the test copies bili 0.1.213's
"1 only when absent or 1" rule, read from its source.
2026-11-10 09:48:31 +08:00
yetone fdc96dfe4d library: a billion-context tab switches its plugin on per agent and restores each file exactly
@Kling__Lab on X asked for billion-context (npm billion-context, CLI bili,
github.com/ranxianglei/billion-context) beside RTK. The Library gets a
billion-context tab after RTK, a card like RTK's:

- No bili: its README's `npm install -g billion-context --prefix=~/.local`
  and Install billion-context (InstallBili; biliPath finds bili in
  ~/.local/bin when it isn't on PATH).
- Installed: its version, a note that an agent switched on here can't also
  run billion-context-pi or opencode-acp, and a switch per agent that runs
  `bili plugin install|remove <agent>` (SetBili), read back from
  `bili plugin list`.
- Offered for Pi, omp, OpenCode and Claude Code, the lanes that keep
  magpie in front: Pi/omp/OpenCode load it in process and still send to
  magpie; Claude Code goes through bili's proxy, which forwards to
  magpie's gateway. Not offered: Codex (MCP only), ZCode (routes only its
  own provider), Kimi Code (renames default_model to bili-kimi), dsh (its
  install failed through dsh's pnpm), Hermes (can't be tried in a sandbox
  HOME), and agents in WSL.

bili's remove doesn't restore a file: it leaves `"packages": []` in Pi's
settings and `extensions:` in omp's config, and after magpie rewrote
Claude Code's settings.json it deleted ANTHROPIC_BASE_URL (Claude Code
then went to Anthropic, not magpie) and put back DISABLE_AUTO_COMPACT.
So switching on records each file before and after (bili-plugins.json in
magpie's config folder), and off writes the before bytes back when the
file is unchanged since, else merges JSON three ways; with no record
(bili set up outside magpie) only a Claude Code ANTHROPIC_BASE_URL the
remove took out is put back. bili's .bili-bak/.bili-last files go too.
`GET/POST /api/library/bili`, `POST /api/library/bili/install` are
named in the CLI parity list beside RTK's. Docs: site library pages
(en, zh, ja) and docs/subsystems/library.md.

Run:
- go test ./internal/library -run 'TestBili|TestParseBiliList' on mote:
  ok (a fake bili mimicking pi/claude lanes, .bili-bak re-backup and
  claude's buggy remove; a fake npm for the install).
- Full `go test -timeout 45m ./...` on mote at 16c67965f (this commit
  before the body was written, same tree): every package ok but
  internal/gateway's TestBurstTellsNoSpeed/responses_from_chat_burst
  (804ms burst read as a speed, load ~50 after a mote reboot); passes
  -count=3 alone at the same head; recorded on #2719, same test. An
  earlier full run at 8c8c63537 was all ok.
- GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...,
  go vet ./... at 16c67965f: ok. gofmt -l: nothing.
- GUI at 16c67965f: library-bili, i18n-keys, i18n-en-no-cjk,
  library-memory, library-rtk-gain, library-pi-extensions, Chromium and
  WebKit (library-bili: every language, 1100 and 420 wide).
  80 of 80 pass.
- The whole GUI suite is still running on mote at this head, started
  before the tag; two earlier whole-suite runs were cut short (mote ran
  out of disk mid-run, then rebooted), so their reds are not a record.
  Its result goes in a follow-up.
- Real, in a sandbox HOME (named dir, bili 0.1.213 installed there,
  magpie web built from this branch on 3486/3487): through magpie's API,
  Pi and Claude Code switched on; `claude -p` and `pi -p` each answered
  "pong" through magpie's gateway (Claude Code via bili's proxy on
  18788 -> 127.0.0.1:3486); switched off: Pi's settings.json, Claude
  Code's settings.json and .claude.json byte-identical to before, no
  .bili-* files left, commands/acp-cache.md gone; claude -p answered
  again straight to the gateway. Earlier, with bili run by hand, Pi,
  OpenCode, omp, Claude Code and Kimi each sent a request through a
  recording relay with bili's tools/headers on it.

Broken by hand: skipping biliRestore turned TestBiliOnOffExact,
TestBiliClaudeKeepsMagpiesRoute and TestBiliOffWithoutRecord red;
dropping the no-record URL fix turned TestBiliOffWithoutRecord red;
removing the tab turned all 22 library-bili cases red; removing the zh
note string turned the zh cases red in both engines. Each put back.

Not tried: Kimi, dsh, Hermes, Codex, ZCode lanes (not offered); WSL;
Windows (the %APPDATA%\npm lookup and npm without --prefix are untried
on the Windows box); OpenCode and omp switched through magpie's API
(switched by hand with bili before); a real npm install from the button
(sandbox had bili already; the test fakes npm).
2026-11-10 07:24:26 +08:00
yetone b681b036d2 site: Mistral and Ollama pages in en, zh and ja
/docs/mistral and /docs/ollama (with zh/ and ja/) answer "how do I use
Mistral / Ollama in Claude Code, Codex, Gemini CLI and OpenCode".

Facts come from the source: the mistral, ollama and ollama-cloud
presets in internal/provider/presets.go, chattidy.go (thinking parts,
#483, #494), mistral_plan.go, ollama_usage.go, local_address.go,
gateway/ollama.go, and the usage text of internal/cli/providers_cli.go
and model_cli.go for every CLI example (provider add, fallback, models
+id, model price, model efforts).

Every docs page with a "By provider" line now lists both, in one order;
sitemap.xml, llms.txt and llms-full.txt (rebuilt) carry them.

Run on mote: node --test worker.test.mjs install.test.mjs (fail 0);
JSON-LD of the six pages parsed. Deployed (e33573b9) and every new URL
answers 200.
Not tried: the CLI examples against a live magpie (read from the
source's usage text instead).
2026-11-10 04:54:13 +08:00
yetone 682a1e3925 site: Gemini and Grok pages in en, zh and ja
New docs pages /docs/gemini and /docs/grok (with zh/ and ja/), each
linked from every "By provider" line (the four agent guides, OpenRouter
and Copilot in all three languages), sitemap.xml and llms.txt;
llms-full.txt rebuilt.

Gemini facts and their sources:
- preset "google", AI Studio keys, models.dev google catalog
  (internal/provider/presets.go); Chat and native Gemini endpoints,
  only Gemini clients on the native API (provider/gemini_api.go).
- thinking_config with include_thoughts, Gemini 2 budgets, xhigh/max
  sent as high (gateway/chat.go aiStudioThinking); a refused level is
  retried at the nearest one, a refused thinking_config falls back to
  reasoning_effort (gateway.go geminiRefusedLevel, refusesThinkingConfig).
- thought signatures kept 90 days and returned only to their provider
  (gemini_sigstore.go sigKeep, gemini_signature.go); tool schema clean-up
  (gemini_schema.go); search only without function tools (search.go
  geminiKeySearches); per-minute 429s as rate limits (routing.go).
- Vertex AI preset and options (provider/vertex.go, cli/providers_cli.go).
- Code Assist and Antigravity worded as docs/subscriptions.

Grok facts and their sources:
- xai preset: Chat and Responses at api.x.ai/v1, Messages at api.x.ai
  (presets.go); Claude Code, Codex, OpenCode go as they are, Gemini CLI
  translated to Chat (provider.go Speaks, gateway.go usable).
- fixes for xAI: xai_body.go, grok_schema.go (#2317), object_root.go
  (#1271), lone tool_choice (#378), additional_tools (#350),
  grok_integral.go (#1431), custom_tool.go.
- effort fitting (decide.go fitFor), search (search.go), cache stickiness
  (affinity.go cacheWorth/cacheCold), errors (gateway.go tooLongRe,
  fallback.go shapeRefused). Grok Build's ~/.grok/config.toml (agent/grok.go).
- The Grok subscription and its community plugin are left out on purpose.

Run: mote-run `node --test worker.test.mjs install.test.mjs` in site/,
71 pass; JSON-LD of all six pages parsed with node on mote. Deployed
(version f785815d) and curl-checked: all six pages 200, sitemap lists them.

Not tried: no real Gemini or xAI request was made for this page; header
names, vendor terms, free-tier numbers and xAI's own rate limits are left
out because the source doesn't state them.
2026-11-10 04:27:16 +08:00
yetone 795cab91ff site: OpenRouter and GitHub Copilot pages in en, zh and ja
Two provider guides beside DeepSeek, Kimi, GLM, Qwen and MiniMax, at
/docs/{,zh/,ja/}{openrouter,copilot}, linked from each agent guide's
"By provider" line, from each other, the sitemap and llms.txt
(llms-full.txt rebuilt).

Facts come from source. OpenRouter: the preset's Chat and Anthropic
bases in presets.go, the relay path that sends Claude Code's requests
as they are, Messages for Claude models (MessagesFirst) so cache_control
survives, skipOpenRouterAnthropic for the model list, readOpenRouter's
credits, MaxRPM on free models and openRouterSharedPool, creditRest.
Copilot: device sign-in and the three read-only login sources
(copilot_accounts.go, copilot_cli.go), GHE.com hosts, /models and
copilot_refused.go, copilot_auto.go's pick and fallback, the plan names
(copilot_accounts.go: Free, Pro, Pro+, Max, Education, Business,
Enterprise), copilotSubscriptionUsage's windows, cacheWritesAlike.
Header names, GitHub's terms and env variables are left out.

Run: mote-run sh -c 'cd site && node --test worker.test.mjs
install.test.mjs': 71 pass, 0 fail. JSON-LD of the six pages parses.
Deployed (1a513b7d); the six pages answer with their titles.
Not tried: a real OpenRouter key or Copilot seat through the pages'
commands.
2026-11-10 04:01:09 +08:00
yetone ab3710de3a hooks: onSignIn tells a request hook of an account to sign in again
shannnnnks on X: with several Codex accounts behind the gateway, one is
now and then signed out, and they want the notify plugin to push it.

The magpie that serves the gateway now looks every 2 minutes (first
after 1) at the same sign-in states the desktop alert reads
(provider.WatchSignIns' checkSignIns, so every provider: Claude, Copilot
and plugin accounts that lapsed, and built-ins whose mark says the
sign-in expired or must be done again, Codex's revoked and refused
refreshes among them; accounts in use only). Each account to sign in
again, and each Claude sign-in ending within days, goes to every hooks
file that exports onSignIn, once until the account works again, kept in
signin-hooks.json beside the desktop alert's own file. The event is
{provider, providerName, account, state: "signed-out"|"ending", endsAt?}:
the account is its display label; no token and no vendor reason text.
It is fire-and-forget in the Bun host (gatewayRequest operation
"signIn"), each hook under its own timeout, one that throws doesn't stop
the next. With no hooks file nothing is looked at or marked. A hooks
file may now export onSignIn alone, without onRequest.

Docs: gateway-request-hooks.md (Sign-in notification),
providers-accounts.md, site plugins.html en/zh/ja.

Run on mote at d939dd699 (on origin/main 835439ebf; then rebased on
3d49ac069, whose three commits touch only GUI assets, GUI tests and site):
- gofmt -l internal: clean. go vet of internal/plugin, gateway and
  provider for darwin, linux and windows: ok.
- go test -count=1 ./internal/plugin ./internal/gateway: ok (123s, 950s).
- ./internal/provider: crashed in TestCodexAppWorkspaceSwitchReadsEachWorkspace
  (concurrent map writes in its fake server, #5800, not this change);
  run again with -skip WorkspaceSwitch: ok (130s).
- Red on the old code: with origin/main's host.js both new tests fail
  (TestGatewaySignInHook: "magpie.hooks exports no onRequest";
  TestRevokedAccountToldToHooksOnce: the hook never heard of it).
- Broken by hand: without the HasGateway gate, the gateway test fails
  with "told with no hook".

Not run: the full ./... suite (queued behind ~10 suites on mote's
suite.lock). Not tried: the real app with a real revoked Codex account;
the GUI suite (no GUI file changed).
2026-11-10 01:44:24 +08:00
yetone 446579d05c site: verify usemagpie.ai in Bing Webmaster Tools
BingSiteAuth.xml and the msvalidate.01 meta on the home page. Bing's
XML check failed to fetch the file (curl as bingbot got 200), so the
meta tag verified it. Deployed (7b23789f), live page checked with curl;
the sitemap is submitted in Bing.
2026-11-10 01:26:23 +08:00
yetone a6e4cf7635 settings: what routing does sits under Models › Routing, and the Routing page opens it
The scattered settings audit after netube99 on X. Ask again after a
refusal, the Retry-After cap and the intent classifier's timeout were
under Models › Replies beside rows about a reply's content, and Busy
models last sat in Network and sharing, far from the routing it changes.
The four are now one Routing section under Models, after Replies, and the
Routing page's header has a Settings › button that opens Settings at that
section with its first row lit. The docs (reference.md, the site's
plugins page in en, zh and ja) name the new place.

Run (mote, mote-run):
- settings-places, retry-after-cap-setting, refusal-retries-setting,
  classify-timeout-setting, model-load, i18n-keys and bare-ids, both
  engines: all pass.
- mobile-web against origin/main fdabddeb4 (a git repo made in the copy
  from git archive, since mote-run carries no .git): 30 of 30. It now
  takes the new Settings › button out of the Routing page until main has
  it, as it does for other new rows.
- go test -run 'Budget|I18n|Strings' ./internal/gui: ok. gofmt clean.

Broken by hand:
- the three rows back in Replies and busyLoadRow left where it was:
  settings-places and retry-after-cap-setting 20 of 20 red (chromium);
- the Settings › button's click handler off: settings-places 10 of 10 red.

Not tried: the real app; the GUI suite beyond these files runs with the
rest of this audit's changes.
2026-11-09 22:42:58 +08:00
yetone 88b541a25c images: every pointer names Settings › Models › Images, where the page is
The image models moved under Settings › Models, but the Library's Magpie
Image sheet, the MCP server's instructions to agents, the gateway's
"no image model" errors, the video tool's text and the docs still sent
users to "Settings › Images", a tab that no longer exists (the scattered
settings audit after netube99 on X). Every user-facing string now names
Settings › Models › Images in en, zh, zh-TW, ja and de, as do the site's
Qwen docs (en, zh, ja), llms-full.txt, the subsystem pages and comments.

Run in the tree with this change and the rest of the audit's fixes
(mote, base cd0ba05c2):
- go vet ./internal/gui ./internal/gateway ./internal/agent
  ./internal/provider ./internal/settingsapi: ok
- go test -run 'Image|Draw|Video|Hidden|Group|Settings' ./internal/gui
  ./internal/gateway ./internal/settingsapi: ok; ./internal/imagemcp,
  ./internal/library, ./internal/catalog: ok
- GUI: i18n-keys, i18n-en-no-cjk, image-models-hide,
  library-browser-setup: pass in Chromium and WebKit
- gofmt -l: nothing
Not tried: a real agent reading the new MCP instructions (text only).
2026-11-09 21:51:53 +08:00
yetone 00e9a27582 site: /favicon.ico goes to /favicon.png
Search Console listed /favicon.ico as a 404 (crawled 10-28). The pages
link /favicon.png, but crawlers and old browsers still ask for the .ico.
It now gets a 301 to the PNG.

Run: node --test worker.test.mjs install.test.mjs on mote, 71/71 ok.
2026-11-09 19:03:47 +08:00
yetone 922c5f4b58 site: llms-full.txt carries the OTLP export's gateway key name (#5788)
4314f4b77 (#5751) said on the privacy page that OTLP export sends the
name given to the gateway key, and didn't rebuild llms-full.txt, so
"seo: llms-full.txt is current" was red on the cli job since. Rebuilt
with site/llms-full.mjs; the one changed paragraph is that page's.

Run (mote, at 2b22425b4 + this): node llms-full.mjs; node --test
worker.test.mjs 37/37 pass. The llms-full test is red without the
rebuilt file (0 pass, 1 fail) and green with it.

Fixes #5788
2026-11-09 17:50:13 +08:00
yetoneandreyoung 4314f4b776 otel: export the gateway key's name as magpie.gateway_key.name (#5751)
reyoung (#5751) shares one magpie through several gateway keys and wants
requests in Langfuse or another collector told apart by key. The ledger
row already had CallerKeyName, but the OTLP allow-list dropped it, and
the observer's root and attempt records never carried it.

Ported from reyoung's 9d82162aa (reyoung/magpie feat/otel-gateway-key-name),
applied unchanged onto current main:
- observeRequest takes access.Caller(r).KeyName when observing begins
  and puts it on every End and Attempt record (CallerKeyName), so the
  root span and every try (failures, retries, fallbacks) carry it with
  no lookup at export time.
- otlp's allow-list grows by this one attribute, on generation and
  ledger spans (otelAttributes, so the duration and token histograms
  too) and on the root span. Omitted when the name is empty. The key's
  id and secret are never sent; provider account names stay out.
- docs/reference.md, plugin-runtime.md and the en/zh/ja privacy pages
  say the name goes to the user's collector.

Added on top: docs/reference.md says each key name multiplies a
metric's series, and that keys sharing a name are counted together.

Review of the fork (read every line; run only on mote): no new address,
dependency or credential; the name is read from the auth context at
request time, the same source appendUsage uses for the ledger row;
reported rows (another computer's) already have the caller key cleared
and never reach observers; session spans of local transcripts have no
key. READMEs (en, zh) mention OTLP only as a feature, with no list of
what is sent, so they are unchanged.

Run on mote (lockf ~/suite.lock), at base c7ebb6f8d plus this change:
- gofmt -l internal/gateway internal/otlp: clean.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go
  vet ./...: ok.
- go test ./internal/otlp ./internal/gateway -run 'TestOTel|TestObserve':
  ok.
- go test -count=1 -timeout 45m ./internal/otlp ./internal/gateway
  ./plugins/otel: ok.
- go test -count=1 -timeout 45m ./... (macOS): every package ok (92),
  exit 0.

Rebased onto 136178803 after that run (5 commits; gateway.go and
prev_response.go, nothing in observe.go, otel*.go or internal/otlp).
The touched packages' run at the pushed head is queued behind mote's
suite lock and was not done before the push.

Broken by hand (each on mote, then restored):
- observeRequest without the name (o := &observed{}):
  TestOTelExportsGatewayKeyName/true red, "span 0: gateway key name ""
  seen 0 times".
- gatewayKeyAttr returning before adding the attribute:
  TestOTelBatchWireAndPrivacy red (attributes lack
  magpie.gateway_key.name) and TestOTelExportsGatewayKeyName/true red.

Not tried: a real Langfuse collector; Windows and Linux runtime runs (vet
only); the site pages are not deployed by this commit.

Co-authored-by: reyoung <728699+reyoung@users.noreply.github.com>
2026-11-09 17:21:48 +08:00
yetone 2f947ef65c site: llms.txt points to llms-full.txt
Run on mote: node --test worker.test.mjs install.test.mjs, 70/70 pass after rebuilding llms-full.txt.
2026-11-09 13:19:39 +08:00