ac4af582301a4e8a29245dbba767eba31334ddf9
94
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8a58c0e307 |
site: a fair comparison of magpie, CC Switch and Claude Code Router (docs/alternatives, zh, ja)
New docs page in three languages: a summary of each tool, a table (agents, how it switches, protocol translation, subscription sign-ins, routing and failover, GUI and CLI, platforms, license), which one fits, and an FAQ with FAQPage JSON-LD. Linked after "Models in OpenCode" in every docs page's nav and footer, in sitemap.xml and llms.txt. CC Switch and CCR facts come only from their own READMEs (fetched raw, Nov 2026); each column is dated. Cells their README doesn't cover say "not stated": CCR subscription sign-ins, CCR macOS signing, CC Switch CLI. magpie facts from its source and llms.txt. Run: mote-run site tests (worker.test.mjs install.test.mjs), 69 of 69 pass. Generator: magpie-wt/seo-scratch/altgen.py. |
||
|
|
80ccaba641 |
site: guide to other models and subscriptions in OpenCode (en, zh, ja)
New docs/opencode-models in English, Chinese and Japanese: DeepSeek, Kimi, GLM, Qwen and Claude/ChatGPT/Copilot sign-ins in OpenCode, what magpie writes in opencode.json (internal/agent/agents.go openCodeLike, magpieProviderJSONAt), small_model, reasoning variants, cost, magpie visible, magpie opencode default. Linked from every docs page's nav and footer, sitemap.xml and llms.txt. Run: mote-run sh -c 'cd site && node --test worker.test.mjs install.test.mjs': 69 pass, 0 fail. Not tried: a real OpenCode run against the page's steps. |
||
|
|
0ac8e6634d |
site: guide to local models in Claude Code and Codex (en, zh, ja)
/docs/local-models and its zh and ja pages: Ollama, LM Studio, oMLX and MLX-Serve presets with their default addresses and the APIs magpie uses for each, which agent goes through as is and which is translated, another port or computer (Server address, the certificate switch), vLLM and llama.cpp through Custom + Detect APIs, the context window and masking. Linked from every docs page's nav and footer, the sitemap and llms.txt. Facts read from the provider presets, internal/cli/providers_cli.go's help text and i18n.js labels. Left out for lack of evidence: detecting a running Ollama, Ollama's default num_ctx, how well local models call tools, default ports for llama.cpp and vLLM. Run: mote-run sh -c 'cd site && node --test worker.test.mjs install.test.mjs' at this tree: 69 pass, 0 fail. |
||
|
|
8f74442e4d |
site: guides for other models in Gemini CLI and subscriptions in any agent
New pages, en and zh, built on the claude-code-models template (same
head, nav, footer, TechArticle + FAQPage JSON-LD, canonical, hreflang):
- /docs/gemini-cli-models: pointing Gemini CLI at the gateway's Gemini
API, the four keys magpie writes, going back to Google, subscription
models in Gemini CLI, routing.
- /docs/subscriptions: the built-in subscriptions and their model
prefixes, sign-in, using one in another agent, several accounts,
routing modes and fallback, other tools through the gateway.
Every docs page (en, zh, ja; ja links to the English URLs) gets the two
nav and footer links after the Codex guide, the 4 URLs go in
sitemap.xml and the 2 English ones in llms.txt, as
|
||
|
|
082ca55a32 |
site: guides for other models in Claude Code and Codex
Google sends 6,140 clicks in 28 days, every one on "magpie" or a misspelling of it: no one finds magpie by searching for what it does. These two guides, in English and Chinese, answer the searches it should win: "claude code deepseek", "Claude Code 接入国产模型", "codex kimi", "Codex 使用第三方模型". - docs/claude-code-models and docs/zh/claude-code-models: why Claude Code needs a gateway, the setup in the app and the CLI, how the opus/sonnet/haiku/fable tiers map, every settings.json key magpie writes and how it is undone, GPT models from a ChatGPT or Copilot sign-in, several keys, and an FAQ. - docs/codex-models and docs/zh/codex-models: the same for Codex, with /model's catalog, the two shapes of config.toml (signed in to ChatGPT or not), going back, Claude in Codex. - Each page has TechArticle and FAQPage JSON-LD, canonical, hreflang (en, zh, x-default) and og tags. Both are in every docs page's nav and footer, in the sitemap and in llms.txt. Every claim is checked against internal/agent/claude.go, codex.go, internal/codexcat, internal/provider/presets.go and the gateway, or taken from docs/start.html (Copilot models in Claude Code). No ja pages yet; the ja nav links the English ones, as it does for integrate. Run: node --test worker.test.mjs install.test.mjs on mote, 69 pass. |
||
|
|
3fc6ee4111 |
site: release files from Cloudflare R2, GitHub behind them
Updates and the installer downloaded every file from github.com, which answered 504 for every release file for hours on 2026-11-08. The site now keeps a copy on R2 (bucket magpie-releases, binding RELEASES): - A five-minute cron copies the newest release and the Stable one from github.com (or, when that fails, GitHub's API) into R2. R2's put takes a file only with the SHA-256 the release's SHA256SUMS gives. A run starts no copy after 4 minutes; the feeds' tags and the 4 newest besides are kept, older ones deleted. - /files/<tag>/<file> serves R2's copy, Range and conditional asks included; a file R2 doesn't hold, or a failing R2, is a 302 to github.com. - /api/latest (both channels) and /download name /files only for a file R2 holds under the release's hash, and give every file's github.com address as `github`, which the previous commit's clients fall back to. Older clients only mirror a github.com address, so a mirror never goes in front of the site's. - start (en, zh, ja), privacy (en, zh, ja) and reference.md say where files come from. Run (mote): node --test site/*.test.mjs 104/104, with files.test.mjs (R2 stood in for by r2stub.mjs) and new worker tests for the feed, /download, /files and the cron. wrangler deploy --dry-run binds RELEASES. Broken by hand: onR2 taking any held file regardless of hash, two tests red (the feed test and "bytes R2 holds under another hash"). Not tried yet: the real cron run and R2 serving (after deploy). |
||
|
|
f9e6061b85 |
claude: claude-magpie runs Claude Code through magpie, a plain claude left on the user's account
baranwang on X (11-06): `claude` stays on the user's own Claude account, `claude-magpie` goes through magpie, and nothing is switched back and forth. `claude-magpie` runs `magpie claude run [args…]`. That writes a settings file of magpie's own, <config>/claude-launch/settings.json, connected as Connect connects Claude Code (the gateway, its key, the shared LAN key when sharing is on, the model, the tiers) and starts `claude --settings <file> args…`. Claude Code puts a --settings file's env and model over the user's settings.json, a claude.ai sign-in and the shell's variables (tried on 2.1.318), so ~/.claude/settings.json is never rewritten. ANTHROPIC_API_KEY and the cloud switches (Bedrock, Vertex…) are blanked in the file, so neither the user's file nor the shell can take a request past magpie. The file is the agent `claude#launch`, listed nowhere: the Agents page, Check and Notice see only the user's file. It is set again when the gateway moved or its key changed. - /model in a claude-magpie session saves to the user's settings.json (Claude Code never writes a --settings file). After the session a magpie model picked there moves into the launch file, for the next claude-magpie, and the user's file gets its model back. A Claude alias (sonnet) stays. - Claude Code's own one-time `opus` -> `opus[1m]` rewrite of the user's file (migration_opus_to_opus1m), which the launch file's 1M opus tier sets off, is undone the same way. Found in the end-to-end run below. - claude runs as a child so that can happen: on Unix a stopped child stops magpie too (^Z, fg; proc.WaitFollowingStops reaps it with WUNTRACED, as cmd.Wait can't see a stop), and claude's exit code is magpie's. On Windows magpie ignores Ctrl+C while claude has it. - The command: a launcher beside the `magpie` command. Settings › Command line (AddCLI) writes it; `magpie claude launcher [add|remove]` adds it for a command put there before. It is a `#!/bin/sh` exec of magpie's stable path, or on Windows a .cmd running "%~dp0magpie". A file by that name without "written by magpie" is never written over. - Docs: agent-wiring.md, and the start page in en/zh/ja. Run at this commit (rebased on origin/main |
||
|
|
465928bcce |
backup: the default backup folder says a reinstall takes it too; docs say how to keep magpie on another disk (two_2025.)
two_2025. on Discord asked to pick magpie's config folder: on Windows it is on C:, and a system reinstall without a backup loses everything. Two ways already exist and neither is said where the user looks: automatic backups can go to any folder (Settings > Sync and backup > Backup folder > Change...), but default to auto-backups inside magpie's own folder, lost with it; and portable mode (a data folder beside magpie.exe, internal/appdir) keeps everything on another disk. So no new data-folder setting: moving the live folder would have to repoint the library's links, agents' configs and a running gateway, and its pointer would sit on C: and be lost on the same reinstall. - AutoStatus reports inside: the backup folder is settings.Dir() or in it, letter case aside off Linux. The Backup folder row then says a reinstalled system or a lost disk takes these backups too, and to pick a folder on another disk or a cloud drive's (en, zh, zh-TW, ja, de). A folder picked elsewhere says nothing new. - docs/start (en, zh, ja) #data-folder: pick a backup folder on another disk and restore from it after a reinstall, sync for the keys, or run portable from D:\magpie with a data folder beside magpie.exe. - docs/subsystems/sync-backup.md names the field and the tests. Run (mote, at this tree on origin/main |
||
|
|
2891ec7a7b |
docs: Trae / Trae CN through magpie, in the start page's FAQ (en, zh, ja)
A user (tz_188, Discord) confirmed Trae works with magpie this way: the gateway's address in Trae's custom model settings, Share on local network (局域网共享) turned on, and a gateway key as the API key. Trae keeps custom models in the Trae account, server-side, so magpie can't set it up in one click, and Trae may not reach 127.0.0.1. The FAQ entry (#trae) says that, hedged as a user report, and links Remote magpie's #share. Run: node --test site/*.test.mjs via mote-run at this tree, 84 of 84 ok. (Run with -C site it is 83 of 84: the sponsors test reads ../README.md, which -C site doesn't copy; not a red.) No Go test reads site/public/docs (pluginrt's tree walk skips site/), so none was run. Not tried: Trae itself; the steps are the reporter's, not reproduced here. |
||
|
|
9d143eacab |
uninstall: install.sh --uninstall disconnects every agent first, a deleted magpie too
whimsical_wolf_15477 (Discord): after uninstalling magpie, Codex didn't go back to its own config. `install.sh --uninstall` deleted the magpie command and app and left every agent wired to a gateway that no longer runs: Codex kept openai_base_url (or model_provider = "magpie" and model_catalog_json) pointing at 127.0.0.1. A magpie deleted by hand undid nothing either, and `--purge` refused with no magpie left to run. - `magpie uninstall --keep-data` (uninstall.KeepData): every agent disconnected and its own values put back from stash.json, the service, autostart, shortcut, scheme and helpers removed, magpie's settings, providers and usage kept. - install.sh --uninstall runs `magpie uninstall --yes --keep-data` (--purge: `--yes`) before deleting anything, and stops if it fails. With no magpie of its own (deleted by hand) but magpie's config left, it fetches the newest release into a temporary folder, checks its sha256, runs that, and deletes it after. An older magpie without --keep-data gets the newest one for this too. A magpie on PATH that the script didn't install is left to its own `magpie uninstall`, and said so. - MAGPIE_UNINSTALL_SCRIPT=1: under the script magpie doesn't ask to delete a path that the script deletes next. - docs (en/zh/ja start.html #uninstall) and READMEs: what the line does, that it works for a magpie already deleted, and Codex's lines by hand. Run (WSL magpie-desktop; mote's disk is full, nothing run or deleted there): - go test -tags nogui -run "Uninstall|Help|TestKeepData" ./internal/cli/ ./internal/uninstall/: ok. node --test site/install.test.mjs: all pass. - The new install tests against the old install.sh: 5 red. Broken by hand (--keep-data case removed, Data() back in KeepData): TestUninstallKeepData and TestKeepData red. - Real e2e: magpie built from this tree, Codex wired in a sandbox HOME (not signed in, and ChatGPT signed in), magpie installed and deleted by hand; install.sh --uninstall with a local feed. config.toml's diff before wiring vs after is the [model_providers.magpie] table only (kept on purpose for threads started on magpie); model, effort, openai_base_url, model_provider and model_catalog_json are the user's again; settings kept. - gofmt -l clean; go vet GOOS=windows/darwin/linux (nogui) for the two packages; sh -n and dash -n install.sh. Not tried: macOS's zip path for a deleted magpie run for real (tests cover it with fakes), Termux, Windows (no install.sh there; docs say download magpie again and use Settings › Uninstall). The full internal/cli package timed out at 10m under WSL load in providers_unreadable_cli_test (not touched here); see the full suite record. |
||
|
|
6bef4fe043 |
docs: a Library page in en, zh and ja, linked from every docs page
luckymanjc. on Discord asked for one place that says how the Library
works underneath and how to set it up. site/public/docs/library.html
(and zh/, ja/) covers each tab: where it is kept (library.json, library/,
backups/ with the last 30), instructions and their markers, MCP servers
(per-agent files, ${NAME} variables, SSE limits, single tools off, OAuth
through /mcp/<name>, link to the MCP router page), skills (folders per
agent, links vs copies and how a copy's edit is taken back, editing,
the 12h update check, ~/.agents/skills, off here), subagents (file per
agent, which agents bind skills/MCP servers, agents with none), the
subagent model (written for Codex only, laid over the spawn; the Agents
page's Codex subagent model with Lead's pick / Same as the lead / a
model, which wins over the Library's; default_subagent_model; the
ChatGPT-sealed exception; Claude Code's own order), hooks and RTK.
Every fact was read from internal/library, internal/gateway and
internal/provider codex_subagent.go, internal/agent/codex.go and the
Library page's client.js and i18n, not guessed. The nav (toc-only) and
footer of all 32 docs pages and the sitemap link the three pages.
Run (mote, through mote-run):
- a Playwright script serving site/public, in Chromium and WebKit at
1280px and 400px, on all three pages: h1, docs.css loaded, 4 tables,
no sideways scroll (scrollWidth - innerWidth = 0), every toc and
in-page anchor has its id, no 4xx on any asset, no page errors, no
left border or gradient in the article, the language menu goes to the
sibling pages; every local link on the pages resolves to a file
(except /zh/ and /ja/, which the worker serves; checked live after
deploy), and every docs page links /docs/<lang>/library twice. ok.
Screenshots looked at for desktop en and 400px zh.
- node --test site/worker.test.mjs: 30 pass, 0 fail (it includes the
sitemap-lists-every-docs-page-with-its-own-canonical test).
Broken by hand: the first script run had a wrong toc selector and
counted the toc-only nav links as missing anchors; fixed the script,
not the page.
Not tried: no Go code changed, so no go test. The Library page's
"Copies" note still says "edits made in a copy are replaced", while
skill_edits.go takes the newest edit into the library; the docs follow
the code.
|
||
|
|
d10f377657 |
providers: Names & levels is Names, prices & levels, where a model's own price at one provider is set (ferock4669)
ferock4669 asked on Discord whether magpie has a screen to price each model, since one model can cost differently on each provider. It has: each row in a provider's per-model list has a price box (input, output, cache read, cache write, 1h cache write, long-context tier, $ / 1M tokens), saved in settings' ModelPrices under pid/model. It wins over the list price in Usage (usage.Pricer through provider.BasePriceIn) and in a key's spend cap (usage.KeySpent through NewCoster). Nothing has to be built; the button opening it said only "Names & levels", so nobody finds a price there. What changed: - The button, its panel's heading and fold, and every note that sends the user there say "Names, prices & levels" (zh 名称、价格与推理档位, zh-TW 名稱、價格與推理檔位, ja 名前・価格・推論レベル, de "Namen, Preise & Stufen"); the gateway's vision and compaction notes, the provider package's text, the subsystem pages and the site's start docs (en, zh, ja) follow. - The button's tooltip says it sets what each model costs at this provider; Usage's "estimated" tooltip says where a provider's own price is set and that it counts over the list price. Both in en, zh, zh-TW, ja and de. - Not changed: the Codex model description text in internal/codexcat (it goes to Codex, so a vendor sees it) and core_budget_test's history comment. - app.js: a comment above the price box is shortened so the core script stays under its budget, not raised (app.js 116 bytes under origin/main). Run at the pushed head (rebased on origin/main |
||
|
|
95d0c97bf9 |
routing: "Use before expiry" counts credits that expire before the reset (lcyksp)
lcyksp on Discord: the 「重置前用完」 strategy (pace) ranked a WorkBuddy
account by its monthly 500 credits ("积分 0 / 500 · 已用 0% · 28 天后重置").
WorkBuddy spends check-in credits first because they expire sooner
("70.85 积分 将于 2026/11/3 09:28:52 过期"), and the account was ranked as
if nothing would be lost for 28 days.
What changed:
- provider.Allowance.Pace takes a budget window's soonest expiry into
account (Limit.RunsOut, from QuotaWindow.RunsOutAt, which the
WorkBuddy plugin and others set on the credits window). When that
expiry comes before the window's reset, the window's pace is the
higher of:
- what is left per hour until the reset;
- the share that expires (QuotaWindow.RunsOut, now carried as
Limit.RunsOutLeft) per hour until it expires. When the amount isn't
told, all that is left counts. A share is capped at 100%, and the
hours at no less than one.
The account whose credits are lost soonest per hour goes first.
Expiry at or after the reset, or already past, changes nothing.
Zero-config: nothing new to set.
- The trace says DueBy "expiry" when the expiry set the deadline. The
Routing page's reason then reads "Use before expiry: {who} has the most
credits expiring per hour until they expire — {n} of its allowance
expires in {d}."
- Label: "Weekly pace" / 重置前用完 / 週ペース / Wochentempo becomes
"Use before expiry" / 到期前用完 (zh, zh-TW) / 期限前に使い切る /
Vor Ablauf aufbrauchen. Product call: the strategy's goal was always
"lose nothing at the deadline". A reset and an expiry are both such a
deadline, and "到期" covers both, where 「重置」 names only one. The id
stays pace, so saved groups are unchanged.
- The descriptions (Routing, Settings, group editor), docs/reference.md,
docs/subsystems/gateway-routing.md and the site's start page (en, zh,
ja) say the same.
Go, run on mote at base
|
||
|
|
4fc34828e5 |
docs: an agent's model picker sends a model in its vendor's fast mode from the bolt on its row (Phoen1xCode on Discord)
Phoen1xCode asked whether magpie can send a ChatGPT (Codex) account's models to other agents in Codex's Fast mode, service_tier "priority". It already does, since #954: the bolt beside a model's star in the agent's picker (shown on the picked row and under the pointer, like the star), and a routing group member's Fast switch. Nothing in the site docs said so, and the bolt is hidden on the other rows, so the feature couldn't be found without hovering the right row. Section 2 of the start page (en, zh, ja) now says which models have the bolt (provider.CanFast: a ChatGPT account's GPT, an OpenAI key's GPT and o-series, Cursor's with a fast variant, Claude Opus on an Anthropic key, a plugin's or remote magpie's that says priority), what it sends (service_tier "priority" as Codex's /fast does, checked against openai/codex a09812981 codex-rs/protocol/src/config_types.rs: ServiceTier::Fast.request_value() is "priority"; Claude's speed "fast"), the Ultrafast step, that it is per agent and leaves fallbacks as they are, and the routing group's switch. No code changed. The GUI's hover-only bolt is left as it is: it matches the star beside it. Run at this head on mote: node --test site/worker.test.mjs site/install.test.mjs site/stable.test.mjs site/credits.test.mjs, 80/80. Not tried: a real ChatGPT account's priority request; no test covers docs text. Not changed: the CLI and TUI have no way to switch an agent's fast pick (#4860). |
||
|
|
c3048cd266 |
site: a sitemap, robots rules, a searchable title and canonical docs pages
usemagpie.ai had no sitemap, a robots.txt with Cloudflare's comments
only, a home page titled just "magpie" in every language, and docs
pages with no canonical or x-default.
- public/sitemap.xml lists the home page in en, zh, ja and de and every
docs page by its clean URL. A test fails when a docs page on disk is
missing from it, or it lists one that isn't there.
- public/robots.txt names the sitemap and keeps crawlers off /api/,
/go/, /r/ and /download, so a crawler's fetch isn't counted as a
download or a partner click.
- The home <title>, og:title and twitter:title name the agents
("magpie: one model switcher for Claude Code, Codex and Gemini CLI"),
translated by worker.js like the rest (meta.title, meta.locale in
i18n.js). og:type, og:site_name and og:locale are added, plus JSON-LD
for a free, MIT-licensed SoftwareApplication and the WebSite.
- Each docs page has rel=canonical to its own clean URL and an
x-default alternate to the English page, plus og:site_name. A test
checks each one, and that every hreflang alternate is a listed page.
Run: on mote, node --test worker.test.mjs install.test.mjs from site/
at this tree: 54 of 54 pass. Broken by hand in a copy: a docs page
without its canonical, and the sitemap without docs/zh/docker, each
turns the sitemap test red.
Not tried: Google's Rich Results test; the live check is after deploy.
|
||
|
|
9d08993c8b |
routing: Cheapest first prices Ollama Cloud's DeepSeek models at double from 12:00 to 18:00 UTC on weekdays (hayden4608)
hayden4608 on Discord asked that time-of-day routing use the gap between peak and off-peak prices, citing https://ollama.com/pricing. That page (read live on 11-01) gives Off-Peak rows for two models only, deepseek-v4.1-flash ($0.30/$1.20 peak, $0.15/$0.60 off-peak) and deepseek-v4-pro ($1.32/$3.96 peak, $0.66/$1.98), and says off-peak is "outside 12:00 and 18:00 UTC on weekdays and all day on weekends". models.dev's ollama-cloud catalog lists the off-peak prices, so magpie priced Ollama Cloud's peak hours at half. - catalog: a new Peak kind, PeakOllama. Its hours are 12:00 to 18:00 UTC, Monday to Friday, with no holidays. PeakFactor (2) matches the page for both models, cache reads included. - provider: a peakBill for ollama.com (preset/catalog ollama-cloud) that names the two models. Dated tags (deepseek-v4-pro:1017) count as their model; the bare name before ':' is compared without allocating. Every other model there (glm-5.3, gpt-oss...) and every other vendor stays flat. A local Ollama, a relay that names itself ollama-cloud, and an ollama.com.evil host are not matched. - GUI: a model's price tooltip names Ollama's hours for peak "ollama". The Cheapest first and rate-window texts no longer say that only DeepSeek's hours count, in en, zh, zh-TW, ja and de. - docs/reference.md, site docs (en, zh, ja) and the gateway-routing and providers-accounts subsystem pages say the same. Run (on mote through mote-run, at this tree rebased on |
||
|
|
dac759e54c |
site: a contributors page, everyone magpie's history credits with the releases that came of it (packinggoodsllc_07668 on Discord)
usemagpie.ai/docs/contributors, /docs/zh/contributors and
/docs/ja/contributors list each person the release notes' thanks line
would (the previous commit's rules), with the versions their reports,
ideas or code went into, newest first: three shown, the rest under
"N more", each linking its release. A name with a known GitHub login
links it; the platform a report came from (Discord, X, …) sits under it.
How it is built: wrangler.jsonc's build runs `node credits-cli.mjs wall`
at each deploy. It reads every tag's commits from git, the issue authors
from GitHub (reusing the last build's answers), and writes
public/contributors.json and the table in each language,
public/contributors/{en,zh,ja}.html (gitignored). worker.js puts that
table into the page's #wall with HTMLRewriter; without it the page keeps
a line pointing at the release notes. A build that can't read git leaves
the last list. The page says how names are found (only as already public
in the history, no emails, no maintainer, agents or bots) and how to be
left off: Discord, an issue, or a PR to site/contributors-exclude.txt.
Every docs page's footer and the home page's (foot.contrib in zh, ja, de)
link it. Styles reuse docs.css's table and tokens.
Run (mote, node 22): node --test site/*.test.mjs 77/77. The wall on a
clone of origin/main
|
||
|
|
9162277b91 |
routing: Until used up stays on the next account once the first is used up (dzxx0496)
dzxx0496 on Discord: with free accounts one after another, the first used
up, requests went to the second; when the first renewed they went back to
it ("如果第一个恢复了,它又优先用第一个了"). No routing did what they asked:
In order and Smart both put the first back first.
A new routing, Until used up (drain, 用完再换): requests stay on one seat
until its quota is used up, then go on to the next in the list and stay
there. A seat counts as used up when its known allowance is at 100% or
it was refused for quota or credit (failQuota / failCredit, routes.Drained
called where the rest is recorded, so a failover inside one request moves
the pool too). A rate limit or other failure only passes it over while
it rests, as In order does. Each pool (a provider, a group/<id>) keeps its
own place; routes.Forget clears it.
Offered wherever a routing is picked: the provider editor, a group's row
menu and editor (app menu, no native select), the TUI, `magpie group set
<id> routing=drain` and a provider's routing=drain. Nothing defaults to
it, so no saved setting changes. SpentShareOf is 100 for it, as for In
order. Words in en, zh, zh-TW, ja and de (i18n.js and the routing
plugin's own), docs/subsystems and the site's start page (en, zh, ja).
Tests:
- internal/routes/drain_test.go: stays on the next when the first renews,
through a rate limit, all used up, a seat gone, per pool, Forget,
Drained after a renewal.
- internal/gateway/drain_test.go: a real request path with a fake upstream;
k1 refused for quota, k2 takes over, k1 renews: drain stays on k2,
In order goes back to k1. Red without the Drained hook (request 3 went
to k1). A rate limit comes back to k1; drain is saved on a provider and
a group.
- routing-drain.test.cjs: the Routing page's why and mode line in 5
languages, 1100px and 420px, Chromium and WebKit; red on the old assets
(20 of 20).
- routing-group-strategy, routing-save, builtins: the menu has 11 routings.
Run on mote (macOS) at origin/main
|
||
|
|
93879515a0 |
agent: QwenPaw, each of its agents' active_model one of magpie's (pkh1585 on Discord)
pkh1585 asked for QwenPaw (AgentScope, github.com/agentscope-ai/QwenPaw)
on Discord. Read in its source, 2.2.2.post1, as data:
- Its folder is QWENPAW_WORKING_DIR, else ~/.copaw when that exists (the
old name), else ~/.qwenpaw; WORKING_DIR/.env is loaded without
overriding the environment. config.json's agents.profiles lists the
agents, each with a workspace_dir whose agent.json holds active_model
{provider_id, model}, read again on each message.
- Providers are no plain config: SECRET_DIR (QWENPAW_SECRET_DIR, else
"<WORKING_DIR>.secret") holds providers/{builtin,custom}/<id>.json,
read once at start. A plain api_key there is encrypted to "ENC:" at
start, so that is the place QwenPaw itself keeps keys.
What magpie does now:
- `magpie qwenpaw <model>` and the GUI: a row per QwenPaw agent
(qwenpaw#<id>, the default one as plain qwenpaw), skipping agents whose
backend is ACP (another CLI runs those) and agents turned off.
- Connecting writes providers/custom/magpie.json (mode 600, the gateway's
/v1 and the magpie-qwenpaw key, magpie's models as extra_models with
their window, output and tool use) and sets that agent's active_model
to {magpie, <provider>/<model>}. The old active_model is stashed as it
was and put back verbatim on disconnect, absent and null included.
The provider file is removed only when no QwenPaw agent still uses it.
- A sync after QwenPaw re-saved the provider (encrypted key, discovered
models, its own defaults) keeps what QwenPaw wrote and changes only
what magpie owns, so a second connect leaves the file as it is.
- The notice says QwenPaw reads providers at start-up: restart it once
after connecting and after magpie's models change. New text in every
locale.
- appdir: QWENPAW_WORKING_DIR and QWENPAW_SECRET_DIR take ~/ as QwenPaw's
expanduser does; agentenv clears them in tests.
- README (en, zh), docs/reference.md, agent-wiring.md, the site's agent
list and start pages (en, zh, ja), icon.
Run:
- internal/agent's QwenPaw tests (Connect, AgentsAreRows, SyncKeeps-
WhatQwenPawChanged, Check, NotStartedYet, Folders, OwnModelAfter-
Magpies, SyncAfterQwenPawSaved, NullModelRestored) on mote, and the
all-agent tests (applied, rewire, lan_kept, proxy_kept, spelled) with
a QwenPaw fixture.
- Broken by hand, each red: always rewriting the key
(SyncKeepsWhatQwenPawChanged), removing the provider while another
agent uses it (AgentsAreRows), no backend filter (AgentsAreRows lists
qwenpaw#coder), dropping the keep of QwenPaw's own fields
(SyncAfterQwenPawSaved), IsObject for Exists (NullModelRestored).
- Real QwenPaw 2.2.2.post1 (Python 3.12 via uv) in a sandbox HOME on
the Linux box (WSL magpie-desktop), magpie on 3741, a fake OpenAI
upstream on 3742: first start wrote config.json and agent.json;
`magpie provider add fake …`, `magpie serve`, `magpie qwenpaw
magpie/fake/echo-1`; after a restart QwenPaw encrypted the key (ENC:)
and `qwenpaw agents chat` answered "PAWPAW-OK from the fake upstream",
its log "built agent … model=magpie/fake/echo-1"; the upstream saw
/v1/chat/completions model echo-1 streamed, magpie's usage.jsonl
agent qwenpaw status 200. A second connect and `magpie models` left
the provider file unchanged. `magpie qwenpaw default` took
active_model back out (the only diff in agent.json) and removed the
provider; QwenPaw started clean after.
- gofmt -l clean; go vet darwin, GOOS=linux and GOOS=windows -tags nogui.
- Full suite on mote (go test -tags nogui -count=1 -timeout 45m ./...)
at 9554883db on
|
||
|
|
ddc225c964 |
Revert "site: the favicon and iPhone icon fill their tile, no white margin"
This reverts
|
||
|
|
25d4058146 |
site: the favicon and iPhone icon fill their tile, no white margin
On a phone a usemagpie.ai link showed its icon inside a white ring (the owner: "包了一层白边"). favicon.png and the apple-touch-icon (img/icon-256.png) were the macOS app icon, a rounded tile with ~10% transparent margin on each side; a phone fills the transparency white and rounds the square itself, so the tile sat inside a white border. - favicon.png: 64px from the GUI's full-bleed apple-touch-icon, opaque, no margin. - apple-touch-icon.png (new, 180px, also the path iOS asks for by itself): the GUI's apple-touch-icon, which already fills its square. Every page's <link rel="apple-touch-icon"> points at it. - img/icon-256.png is left as it was: install.sh takes it as the Linux desktop icon and the READMEs show it, where the macOS shape is right. Run: sips on both files (64x64 and 180x180, opaque); looked at both; grep shows no page still names /img/icon-256.png as its touch icon. Deployed with wrangler and fetched both from usemagpie.ai. Not tried: a real iPhone's home screen or Safari tab after the deploy. |
||
|
|
2cfb8351d0 |
install.sh: a Linux desktop without WebKitGTK 4.1 has it installed through sudo, then gets the desktop app (shuhai)
shuhai on Discord, on f68ddca37's hint: "为什么不能帮用户直接装好?" On a
desktop without WebKitGTK 4.1 the installer put in the terminal build and
told the user to `sudo apt install libwebkit2gtk-4.1-0` and run it again.
Now, on a desktop without the libraries (and with --gui), when someone is
at the terminal, the script installs WebKitGTK 4.1 (GTK 3 comes with it)
with the distribution's package manager, says first in one line what and
why, and installs the desktop app:
- apt-get install -y libwebkit2gtk-4.1-0 (Debian/Ubuntu family), and when
that fails, apt-get update and once more (lists missing or stale);
- dnf install -y webkit2gtk4.1 (Fedora/RHEL family);
- pacman -S --needed --noconfirm webkit2gtk-4.1 (Arch family; no -Sy, so
no partial upgrade);
- zypper --non-interactive install libwebkit2gtk-4_1-0 (openSUSE).
Through sudo, which asks for the password itself; as root, without it.
"At the terminal" is /dev/tty opening (in a subshell, since a failed
redirection would end the script): curl | sh gives the script the pipe
for stdin, so every package command reads /dev/tty too, never the script.
No terminal, no sudo, the package manager missing, Void/Gentoo/another
distribution, or the install failing: the terminal build and the command,
as before, with "didn't work (see above)" when it was tried. --tui and
MAGPIE_CLI=1 install no package; a headless computer neither.
MAGPIE_TTY points the check at another file for the tests.
Docs: reference.md Install, README en/zh, docs start (en/zh/ja).
Run:
- sh -n, dash -n; shellcheck -s sh: only SC2010 at the uninstall's
ls | grep, there before.
- site/install.test.mjs, 5 new tests (fake sudo, id and package managers;
every distro's command, root without sudo, no tty, no sudo on PATH,
Void, NixOS, a failing install, apt's update-and-retry, --gui, --tui,
MAGPIE_CLI, headless): red on origin/main's install.sh (the 5 new fail,
19 pass), green after. CI's site step (sh -n + node --test
site/*.test.mjs) at this head, rebased on origin/main: 63/63 on mote
(macOS sh) and 63/63 on magpie-desktop through wsl-run (/bin/sh = dash).
- Real installs in fresh containers (Docker on xiaomi-gpu, amd64), a user
u with sudo, DISPLAY=:0, `cat install.sh | sh` (stdin a pipe), the
terminal kept with setpriv (su -c starts a session without one),
v0.1.2399/2400 from the real feed; then ldd (nothing missing),
`magpie version`, and the package query:
- Debian 12, sudo with a password, typed by expect at sudo's prompt,
package lists deleted first: install failed "Unable to locate", apt-get
update, retry ok, desktop app, libwebkit2gtk-4.1-0 installed;
- Ubuntu 24.04 (NOPASSWD): libwebkit2gtk-4.1-0, desktop app;
- Fedora 44, password via expect: webkit2gtk4.1, desktop app;
- Arch (archlinux:latest): webkit2gtk-4.1 2.54.2, desktop app;
- openSUSE Tumbleweed and Leap 15.6: libwebkit2gtk-4_1-0, desktop app;
- Debian 12 as root: apt-get without sudo, desktop app;
- Ubuntu 24.04 --gui: installed, desktop app; --tui: terminal build,
nothing installed;
- Debian 12 without -t (no terminal): terminal build + the apt line, no
install tried; without sudo at a terminal: the same;
- Ubuntu 20.04 (no WebKitGTK 4.1 in focal): install, update, retry all
fail "Unable to locate", then the terminal build and the "didn't work
(see above)" hint.
Not tried: a real desktop VM (the containers fake one with DISPLAY=:0);
the installed app wasn't opened, only `magpie version`. Void and Gentoo
stay hint-only (Gentoo would build WebKit from source). Debian 11 failed
in the container's own setup (archives unreachable), so focal stood in
for a distribution without 4.1. A held dpkg lock (unattended-upgrades)
would fail the install and fall back; not reproduced. On focal the hint
still names libwebkit2gtk-4.1-0, which focal lacks, as before.
|
||
|
|
0379f26109 |
docs: Getting Started lists the subscriptions the Add sheet has, Antigravity among them
seazon000 on X asked how to use Antigravity's models in Codex or Claude Code and couldn't find it in the manual. The Subscriptions paragraph still listed Cursor, Grok and Devin, which are plugins now, and left out Gemini (Code Assist) and Antigravity. It now names the built-ins (account.go's builtinOrder less the retired ones), sends the rest to the Plugins page, and says that an antigravity/… model picked on Codex's or Claude Code's row is all it takes, with the account-suspension warning the app shows. Run: node --test site/worker.test.mjs site/stable.test.mjs site/install.test.mjs on mote, 58 pass; the three pages parse. No test reads these pages. |
||
|
|
7e0fe83d4b |
provider: Listed as works for signed-in accounts and plugins (zeewell on X)
zeewell asked to list SuperGrok's grok/grok-4.6@500k as grok-4.6, and Cursor, Devin and WorkBuddy models (all plugins) under ids of their own. v0.1.2345's "Listed as" took ids only for key/relay providers (takesModelIDs was p.Account == nil). Why the restriction was there: the wire rewrite (Settings.Wires) turns the request body's model back into the own id, but some code reads the model by the vendor's id before that and got the listed one: - plugin model lookup (pluginModel: the plugin's APIs, tiers, prices); - the Claude subscription run (--model given to Claude Code); - Code Assist/Antigravity variant choice (codeAssistBody, SentNameOnIn); - account plan lists (fallback's Account.Lists, effort Levels/Tiers, AccountServes); - moveModelRefs refused a provider with no providers.json entry, which is every plugin and account provider until a pick is set. Each now translates with OwnModelID / the provider's ModelIDs, so the upstream request still carries the vendor's or plugin's own id. Only a decide-only provider refuses an id. The GUI box already follows TakesModelIDs, so no GUI file changed. Tests (red on the old code, each fix reverted by hand one at a time): - TestModelIDRefused, TestModelIDAtAnAccount (takesModelIDs, AccountServes, SentNameOnIn); - TestLocalModelIDAtAPlugin (Bun fake plugin: /v1/models, upstream path, X-Plugin-Model, body, usage; red on pluginModel and on moveModelRefs); - TestLocalModelIDAtAnAntigravityAccount (codeAssistBody); - TestLocalModelIDAtAClaudeAccount (claude got --model my-sonnet); - antigravity pool test (fallback Lists, Levels). Run on mote: gofmt clean; go vet darwin/linux/windows ok; go test -tags nogui -count=1 -timeout 45m on internal/provider, gateway, cli, gui, settings, access, usage, plugin: all ok except internal/gui's TestSettingsSaveKeepsWhatItDoesNotSend (SearchAll), red on main since |
||
|
|
15b83901ac |
accounts: switch to the next account with room, or the one with the most left (#4532)
StringKe (#4532), comparing magpie with cswap 0.29.0: there was no "switch to the next account", and when every account was past its line the automatic switch stayed on the spent one, where cswap moves to the account with the most room left. - `magpie accounts switch <claude|codex> next` (provider.NextInOrder) takes the other accounts that are on in magpie, from the one after the account the agent is on, wrapping round: the first whose allowance is known and has room, else the one with the most room left, and says it is past its line. A saved Claude account not read yet is read first (readSpare), as the automatic switch's spares are. With no reading of any it refuses rather than guess; for any other agent it asks for the account by name. - NextLogin (shared by Codex and Claude Code): when the account the agent is on is spent and every spare is past its line too, it moves to the spare with the most room left (roomLeft: the fullest stopping window's distance below the switch share, or the account's own cap when lower), when that has at least roomMargin (1 point) more than the one it is on, so two all but even accounts don't trade the agent each look. A held, failed or unknown reading is never moved to. One model's own window still counts for nothing, as before. - docs: reference.md (the automatic switch and `next`; its "a Claude account magpie knows nothing of is not moved to" was stale since readSpare), providers-accounts.md's Used-up switch row, the en/zh/ja start pages' command table, `magpie help`. Run (on mote, sandbox HOME through the packages' TestMain): - go test -timeout 45m -count=1 ./internal/provider ./internal/cli: ok (144s, 44s), at this change's tree before the next commit's edits. - TestNextLoginTakesTheMostRoomWhenAllArePast and TestNextInOrder, each over codex and claude with three accounts: green; red with the fallback taken out of NextLogin (the two "most room" cases, both agents) and with NextInOrder not starting after the signed-in account ("the one after it", both agents). The "none has more by the margin" case fails without roomMargin. - Built the nogui binary and ran in a fresh sandbox HOME on mote: `accounts switch claude next --help` (prints the accounts help), `switch claude next` and `switch codex next` with no accounts ("has no other account that is on"), `switch gemini next` (asks for a name), `switch claude nxt` (no such account), `switch claude` (usage). - gofmt -l clean. Cross-OS vet: run at the head of this stack. Not tried: a real switch between real Claude or Codex accounts; the CLI `next` with real saved accounts (the provider tests cover the choice). |
||
|
|
f68ddca370 |
install.sh: a Linux desktop gets the desktop app, or the command that installs its WebKitGTK; --gui and --tui choose (shuhai)
shuhai on Discord: on a Linux desktop install.sh installed the terminal build, and a desktop user expects the app. The script chose by `ldconfig -p` alone, and on Debian a user's PATH has no /sbin, so ldconfig wasn't found and every Debian desktop got the terminal build even with WebKitGTK 4.1 installed. Without the libraries, the only hint was a line mid-output. Now, with nothing asked (curl | sh stays unattended): - the libraries are looked up with ldconfig from PATH, /sbin or /usr/sbin, and in the usual lib folders when there is no cache (NixOS, Guix); GTK 3 is checked beside WebKitGTK 4.1, which brings the rest the app links (readelf -d of v0.1.2359's magpie-linux-amd64: gtk-3, webkit2gtk-4.1, soup-3.0, javascriptcoregtk-4.1, glib, X11, wayland-client, glibc); - libraries there: the desktop app, as before; - a desktop without them: the terminal build, and last in the output the distribution's command (apt/dnf/pacman/zypper/xbps/emerge from os-release ID and ID_LIKE), "run this again", or --gui. A desktop is DISPLAY, WAYLAND_DISPLAY, XDG_CURRENT_DESKTOP/XDG_SESSION_DESKTOP/ DESKTOP_SESSION, XDG_SESSION_TYPE x11/wayland, the user's logind Display session when its Type is x11/wayland/mir (over ssh; logind falls back to a tty login, which doesn't count), or a session file in xsessions/wayland-sessions under XDG_DATA_DIRS; - headless without them: the terminal build, with no desktop advice; - --gui: the app even before its libraries, with the package to add; --tui (or MAGPIE_CLI=1, kept) the terminal build on a desktop too; - musl (Alpine): always the terminal build; --gui refuses, since the app is built against glibc. Docs: reference.md Install, README en/zh, docs start FAQ (en/zh/ja, #linux-build). Run: - shellcheck -s sh: only SC2010 at the uninstall's `ls | grep`, there before this change. sh -n and dash -n clean. - site/install.test.mjs (5 new tests): 19/19 on mote (macOS sh) and on magpie-desktop through wsl-run (dash); CI's site step (sh -n + node --test site/*.test.mjs) 58/58 on magpie-desktop and 58/58 on mote. - Red on the old install.sh: tests 16-19 fail (desktop advice, headless advice, --gui, --tui). With the logind Type check taken out by hand, the headless test fails on login "135 tty". - Real installs on magpie-desktop (Ubuntu 24.04, XFCE, WSLg, /bin/sh = dash), `cat install.sh | env ... sh -s`, stdin a pipe, into a /tmp sandbox HOME/XDG dirs/MAGPIE_BIN_DIR, each removed after, v0.1.2360 downloaded from the real feed and `magpie version` run: session with DISPLAY/WAYLAND_DISPLAY: desktop app + menu entry; env -i with PATH=/usr/local/bin:/usr/bin:/bin: desktop app (the old script gave the terminal build here, run the same way); an ldconfig whose cache lacks the libs + DISPLAY=:0, and the same in env -i (found by /usr/share/xsessions): terminal build + the apt line; that with XDG_DATA_DIRS=/nonexistent: terminal build, quiet; --gui there: desktop app + the apt line; --tui in the session: terminal build. The first run found the tty-login fallback (logind's Display=135 is this WSL user's pts session), fixed before commit. - site/install.test.mjs on Windows (win-run): 0/19, the same 14 old tests too: the box has no sh for spawnSync; CI runs this file on Linux only. Not tried: a real Debian, Fedora, Arch or openSUSE box, or a box without WebKitGTK installed (simulated with a fake ldconfig); the package names were checked against each index (Ubuntu noble, Debian bookworm, Arch, Fedora mdapi, Tumbleweed oss, void-packages, Gentoo), not installed. The installed app wasn't opened (only `magpie version`), to keep off ports other sessions use there. Termux and macOS paths are unchanged and their tests pass. |
||
|
|
305c624eda |
install.sh: --uninstall takes off what it installed, --purge the settings too
pota on Discord: the Linux install script only installs. Now
curl -fsSL https://usemagpie.ai/install.sh | sh -s -- --uninstall
takes off what the script put there, and nothing of the user's:
- Linux: $bin/magpie, the menu entry (while it starts this magpie, or
one that is gone; another magpie's stays), its icon, the
x-scheme-handler/magpie=magpie.desktop line xdg-mime wrote (that line
only), and the menu's mimeinfo.cache when it lists nothing else. The
service and login entry go too while they start this magpie, since
left they would start a program that is gone at each login
(`magpie daemon uninstall`, systemctl as a fallback).
- macOS: magpie.app in /Applications or ~/Applications and the
~/.local/bin link into it. Termux: $PREFIX/bin/magpie.
- ~/.config/magpie stays and the script says so. A magpie still
running is named with its pid; it ends when the user quits it.
- --purge runs `magpie uninstall --yes` first (agents disconnected and
put back, magpie's folders deleted), then the above. With no magpie
to ask it refuses, and if magpie uninstall fails nothing of the
install is taken, so it can be run again.
- Nothing is downloaded; the uninstall runs before the CPU check.
Docs: an FAQ entry "How do I uninstall magpie?" in docs/start (en, zh,
ja), and a line in both READMEs' install note.
Run at
|
||
|
|
7b09d2c951 |
provider: a model can be listed by an id of the user's at its provider, asked for by its own
zeewell on X (tweet 2116404121930432888): relays serve one model under
ids of their own (deepseek-v4.1-flash-1017, grok-4.6@500k). They want to
give each one their own id at the provider layer. magpie then lists,
routes, groups and finds groups by that id, and the upstream request
still carries the vendor's id.
Choice: a new per-model map, settings' ModelIDs
("<pid>/<local>": "<own id>"), served through the wire names that
already exist. ModelSameAs was not widened. It means "same as another
vendor's model": it lends specs and joins found groups. Making it rename
models everywhere would change every existing user's ids and refs.
ModelWires was not reinterpreted either, for the same reason. ModelIDs is
ModelWires turned round: a wire keeps magpie's id and changes the one
sent, and this keeps the one sent and changes magpie's. Settings.Wires()
merges each entry in as a wire name (wrapped by a "<pid>/*" wire). Every
place that sent a ModelWires name (gateway, usage ledger, request page,
UpstreamName, UpstreamNameAs) reads Wires(), so the upstream id needs no
new path. An explicit ModelWires entry for the same id wins.
- Listed by the local id: Available, liveIDs/liveByID, Serving and
ListPrice translate through OwnModelID. /v1/models, agents' lists,
Resolve, routing groups and found groups (auto/<local>, merged with
every other provider serving that id) all see the local id.
- Only a provider of the user's own (Account == nil) takes one. An
account's or a plugin's request is built from its list's id, which no
wire reaches.
- Two variants of one provider given one id: the latest given it wins,
and the earlier one is listed by its own id again. The CLI names it.
The editor refuses two rows given one id in one save. A model of the
provider's own id that a variant is listed by (plain grok-4.6 beside
grok-4.6@500k) is not listed while the variant has it.
- The user's values are never overridden. SetModelID moves picks,
contexts, fallbacks, groups' members/rules/fast/placed/off/weights/
classifier/pick, the pickers' lists, every per-model setting
(Settings.MoveModel) and gateway keys' models (provider.ModelMoved,
set by access) to the new id, but only where nothing is under the new
id yet. Agents' own files are not rewritten: an old provider/<own id>
still resolves and is sent as it is. Group match patterns and key
patterns stay as written.
- Key limits: a key held to either id passes for both (modelAllowed:
the ref, OwnModelID, ListedModelID). Group members use the same check.
- Usage: model = the listed id, served = the vendor's id from its reply.
The price is the own id's first.
CLI: magpie model id <provider/model> [<id>|--reset], magpie model ids.
GUI: Providers > a provider's editor > Names & levels > "Listed as",
beside Same as. It is staged with the editor's Save and taken back by
Restore default, in zh, zh-TW, ja and de. Accounts have no box.
Docs: providers-accounts.md, gateway-routing.md, and site start.html in
en, zh and ja.
Run (mote-run, at this tree rebased on
|
||
|
|
ceeb73a0f1 |
app: the desktop app writes its log to app.log; magpie log and Settings › About › Log find it
rayem1w on X (0.1.2330, macOS) was asked for ~/Library/Logs/magpie/serve.log while chasing a Codex "hit a snag" through the gateway, and had no such folder. Only the launch agent (magpie daemon install, written by launchd) and a gateway magpie tui left running wrote a log; the app opened from the Finder, the Dock or the Start menu logged to a stderr nobody reads, on every system. Now runGUI and runPanel (magpie, app, tray, panel, a window view, a magpie: link) call applog.Start before gui.Run. It sends the standard logger (the gateway, the plugin host, providers and Wails' error handler all log through it) to app.log as well as stderr, and points debug.SetCrashOutput at it so a panic's trace is there too: macOS ~/Library/Logs/magpie/app.log Windows %LOCALAPPDATA%\magpie\logs\app.log Linux $XDG_STATE_HOME/magpie/app.log, else ~/.local/state/magpie/app.log portable data/logs/app.log app.log, not serve.log: on a Mac launchd writes serve.log for the service, another process. The file is 0600. At 5 MiB it becomes app.old.log (two files at most); when another magpie (an update's new process) rotated it already, it is only opened again; when it can't be moved it is emptied. stderr goes first, through a writer that never fails, since io.MultiWriter stops at a failed writer and an app opened from Explorer has no stderr. Secrets: the log calls name header names and paths without queries; no key or token was found logged (grep of log.Print* in gateway, provider, plugin, gui, agent). scrub masks bearer/basic credentials, key/token query parameters and sk-, AIza, gh?_ and JWT shapes anyway. How a user finds it: Settings › About › Log, with the path, Copy and an Open that shows its folder (POST /api/settings/log/reveal; the row is hidden in magpie web, which writes no file). magpie log prints where every log is (the app's, app.old.log, the service's, the tui's background serve.log); --path the app's alone, -n N its last lines, -f follows it across a rotation. Docs: reference.md, gui-shell.md, site start (FAQ "Where is magpie's log?" and the CLI table) and privacy (files on your computer), en/zh/ja. Run: At 227ce6074 on origin/main |
||
|
|
88ecae1738 |
routing: By weight spreads a subscription's requests over its accounts
rubbzha on X (tweet 2116346330625036794): a Claude Max account and a Pro
one signed in to one subscription should share its requests by how much
each allows. The provider editor's Routing now offers By weight for
subscription accounts as it does for keys. With it picked, each account
in use shows "Weight N · S%" beside its name, the key weight's chip, and
a click edits it in place (POST /api/provider/accountweight {id, account,
weight}). CLI: `magpie provider account-weight <id> [account [n|default]]`.
The weight is kept per account by its lower-case name
(Provider.AccountWeights), and is moved with a rename (moveAccountSettings).
The gateway's keyWeight reads it from the candidate, with no file read, so
the smooth weighted pick treats accounts as it treats keys: Stays keeps a
conversation on its account, and a resting account is passed over while
the others share its requests. The default is 1. Nothing is prefilled from
the plan, and 1 is stored as no entry, so a value the user set is never
overridden.
Re-derived: ROUTINGS' weight text and routingsOf (the editor), the Routing
page's MODES, provider-row options and its "why first" text for an account,
the routing and accounts subsystem pages, the start docs (en, zh, ja), and
i18n in zh, zh-TW, ja and de (i18n.js and plugins/routing/i18n.js).
app.js is 74 bytes smaller than before (a long comment cut, keyWeight
reused), so neither script budget is raised.
key-weight.test.cjs read #status before accountAction's second round trip
(/api/state) had written it. The same race is now waited on in both tests:
with a 400ms delay injected on /api/state, the old read is red and the
new one is green.
Run (rebased on 03f3e1528; then on
|
||
|
|
14b451c117 |
site: the MCP hub's docs are the MCP router's, and the old links redirect
The feature is called the MCP router now (the commit before). The docs pages move to mcp-router.html in en, zh and ja, their wording follows (MCP router / MCP 路由 / MCP ルーター, `magpie library mcp router on|off`), and every docs page's link and canonical/hreflang URL points at the new path. The worker answers /docs/mcp-hub, /docs/zh/mcp-hub and /docs/ja/mcp-hub (with or without .html or a trailing slash) with a 301 to the new page, keeping the query, so links already shared still open. The plugins pages' link to the router page (Search1API's tools, from the rebase) follows too. Run at e2583df31 (this stack on |
||
|
|
06d36d4142 |
gateway: Stays: Session spreads new sessions over the accounts (connor_yang)
connor_yang on Discord: three sessions on one provider's three accounts,
Stays: Session (整个会话), ended up on two accounts. Under Smart routing a
conversation nobody had answered yet went wherever routing put first,
whatever other sessions were on; only In turn counted the sessions each
account holds (leastHeld, #946).
Kept for the whole session (Stays: Session or Strict) under a routing that
picks by what is left (Smart, Least used first, Weekly pace;
spreadsSessions), a new conversation now goes to the key, account or
group member the fewest other conversations of the last 30 minutes are on.
It passes over one routing keeps new conversations off (readyForNew:
resting, an aside key, a fallback while the provider's own model leads,
one used past lowShare), counts leads only, and keeps routing's order on a
tie. A Claude Code subagent's first request goes to its lead's account
(withLead), not to another as a session of its own. An answered
conversation is kept as before, and resting, spent and the rest/quota
fallback are unchanged. In order, By weight, Free first, Speed first,
Cheapest, Manual and plugin routings keep their order. Docs: reference,
gateway-routing, site start.html (en, zh, ja).
Run (mote, at this head on
|
||
|
|
4f2d5fc7e0 |
routing: a group can put its cheapest member first, by each one's price at that hour
liyuanzheng (#general) and lam_em (#feedback) both asked for the same thing. Off-peak, DeepSeek's own API should come first for deepseek-flash. At DeepSeek's peak (weekdays 01-04 and 06-10 UTC, billed 2x since v0.1.2173), another provider should come first, Ollama say. A schedule editor would make the user copy DeepSeek's hours into magpie. Instead, a group gets one more routing, "Cheapest first" (`cheap`). Each request sorts the members by what they cost right then: input + output price per million, at the peak rate when it is peak hours. A tie goes to the lower cache-read price. Free models count as 0. A member with no known price keeps its listed place after the priced ones. Prices come from the same priceOf the usage ledger bills with, so the user's own ModelPrices, list prices and maker prices all count, and so does a provider's rate windows. - routes: Seat carries Priced/Cost/CacheCost; Strategy.ByPrice; Cheapest is a stable sort, so equal prices keep the user's order. - gateway: weighRouted prices each seat at priceClock() (time.Now; a test holds it) through the new provider.PriceAt. The trace's Weighed row gets a price (input/output/cacheRead/peak) so Routing can say why. - It is a group's alone, like Manual. A provider saved with it drops it, and `magpie provider set … routing=cheap` refuses it. Groups take it in the GUI menu (one more item, no new controls), the TUI and `magpie group set <id> routing=cheap` (aliases cheapest, price, cost). - Routing's mode line says why the first one is first, e.g. "Cheapest first: deepseek-v4-flash costs least on ollama-cloud now — $0.150 in, $0.600 out a million tokens.", with peak and unpriced variants. en/zh/zh-TW/ja/de. - Docs: gateway-routing, plugin-runtime, reference (it also points at Time window and Pause rules for a fixed schedule) and the site's start pages (en/zh/ja). Run, at |
||
|
|
0745db932e |
site: an MCP hub page in the docs, in en, zh and ja
CyberCaius (Discord) asked what the Library's MCP hub is for. The page says what the switch does, how to turn it on (GUI and `magpie library mcp hub on|off`), the /mcp/magpie/hub address for other apps, which agents keep their own entries and why, and when to leave it off. Facts from docs/subsystems/mcp-hub.md and internal/library/mcp_hub.go. Every docs page's nav and footer link it after Privacy masking. Run: site's node --test on mote from the repo root, 45 of 45 pass. |
||
|
|
19dc5b9252 |
routing: accounts renewing together spend first the one whose credits left lapse first (zhaocai_83020 on Discord)
zhaocai_83020 on Discord asked how to make several WorkBuddy accounts spend the credits that expire soonest first. Smart, the default routing, already took a window's runsOutAt (plugin 0.1.14, cdredfox on X) as its renewal, but only when it came before the window's reset. Since plugin 0.1.35 (windy on Discord) a WorkBuddy free account's Credits window resets at the month's end, the same moment on every account (cycleOf, packages/workbuddy usage.test.mjs CN_FREE: 10-31 23:59:59 +08), so given credits lapsing after that end ranked alike and kept the accounts' listed order: the account whose credits were lost first wasn't spent first. Allowance.Lapse is the soonest RunsOut in the future of a window that counts the model, carried to routes.Seat.Lapse. Smart goes by it, to the hour, only when the renewals tie: the one lapsing first goes first, one telling none after those that do, the same hour keeps the listed order. The share-used tiers and the renewal still decide before it. It is read from the window's structure (RunsOut), not the provider's name; only the WorkBuddy plugin sends runsOutAt today. Weekly pace and the other routings are unchanged, as before. The gateway-strategy plugin seat (middleware/points.go) doesn't carry it, as it carries no Free, Credits or speed either. Docs: reference.md (How magpie picks an account), gateway-routing.md, site docs start.html en/zh/ja (not deployed by this commit). Run at |
||
|
|
d9a8148d7c |
routing: Speed first sends a request to the provider or key that answered the model fastest lately
joeliu96872540 on X: when one model is reachable through several API
channels, they want an option that sends each request to whichever has
been answering fastest, because they compare channel speeds by hand
today. Speed first (`fast`; `fastest` and `speed` also work) is a new
routing beside Free first. It applies to a provider's keys and accounts
(provider editor › Routing) and to a group of one model on several
providers (Routing page › group › Routing).
How it decides. When a streamed answer ends, gateway/speed.go records two
numbers for that account or key and model (restID): the time to first
token and the output tokens per second, as usage.DecodeOf computes them
for the Requests page. Each is a decayed average with a 20m half-life.
After an hour with no answer the record goes stale, and the store holds
at most 4096 records. This is O(1) at the answer choke point, beside
servedCandidate. For a pool routed by BySpeed, weighRouted reads one map
entry per candidate, and only for that pool. The usage history is never
read on a request.
routes.Fastest ranks each awake seat by its estimated time to a
200-token reply: TTFT + 200/TPS. A seat that reported no TPS gets the
median TPS of the others. Seats within 10% of the fastest in their band
keep their listed order, so near-ties don't swap on every request.
Seats with no recent measurement go after the measured ones. One request
in five, counted per pool, goes first to an unmeasured seat, rotating
among them, so each gets measured again. Resting seats go behind the
awake ones, and used-up seats behind those. Rests and failover are the
same as for every other routing.
The request trace gets lateTtft and lateTps, and the row-story sentence
says "answered m fastest lately: first token in 0.8s, 60 tokens a
second". It has a variant for a probe turn and one for when no seat has
been measured yet. i18n covers zh, zh-TW, ja and de. Also updated: the
CLI (`magpie group|provider set <id> routing=fast`, plus a new
`routing=` pair on provider set that refuses manual), the TUI name, the
rotation plugin's Sub, docs/subsystems/gateway-routing.md,
plugin-runtime.md, docs/reference.md and site start.html (en, zh, ja).
There is no new layout: it is one more item in the existing pickers.
app.js stays under its budget with no raise.
Tests:
- routes/fastest_test.go:
- ordering: fastest first, slow writer loses, alike keep order,
resting and used-up, median pace, none measured;
- the probe turn at 5, 10, 15 and 20, rotating between seats;
- a resting seat never gets a probe turn.
- gateway/speed_test.go:
- decay, staleness and per-model records, with an injected clock;
- a group of slowv and fastv routed fast: after the speeds are
measured and seeded, the request goes to fastv with lateTtft set;
- the same group routed in order still goes to slowv.
- cli: parseRouting and the provider routing= pair.
- GUI routing-speed-first.test.cjs: the row story for measured,
no-pace, probe and none, in en, zh, zh-TW, ja and de, in chromium and
webkit: 40/40.
Broken by hand:
- Fastest returning the listed order: the routes tests and the gateway
group test go red.
- noteTrySpeed removed: "the streamed answer wasn't measured".
- The client.js case renamed: routing-speed-first 0/20 in chromium.
Run at b5a5caff2 (base
|
||
|
|
ea1f9492bc |
cli: magpie tools lists, and magpie tool calls, the tools magpie's MCP servers give agents (iwinux)
iwinux on Discord (#feedback) wanted magpie's image generation, image recognition and web search without going through an agent's MCP, and had written a Python script for generate_image. magpie now has it: magpie tools [<name>] magpie tool <name> [--<param> <value>…] [<words>…] [-o <file|folder>] [--json] Both ask the running gateway's own MCP servers (gateway.OwnMCPServers: image, vision, web-search, plugin tools) over HTTP, with the local token and the magpie-tool/1 User-Agent, so the tools, schemas, models from Settings and usage counting are the ones an agent gets. Nothing is started besides (#3318: the cases sit before startUp, beside mcp). - Parameters are read against the tool's inputSchema: types (integer, number, boolean, array given once per item, object as JSON), enum, - and _ alike, --p v or --p=v. The words left over are the tool's one required text, else its prompt. An unknown flag or parameter, a missing required one, a bad value, a value given twice or both words and the same --param are refused with "nothing was called"; no request is sent. - A file path a parameter takes (its description says file and path) is made absolute, since the gateway doesn't know the current folder. - --help prints toolUsage (static): help is handled before anything runs. - A still-being-made answer is waited on with generation_result (1s between asks, 30 min at most). The gateway's image server now says so in _meta too: usemagpie.ai/pending is the id, usemagpie.ai/files the files made ({url, inline}); an older gateway is read from its text. - Images and videos are saved through imagemcp.Target (now exported): -o file or folder, else the current folder named from the prompt, numbered when more than one, never over a file that is there; a file not inline is downloaded by its path from the gateway asked (the token goes nowhere else). --json prints the raw answer and saves nothing. - No magpie at the address: "magpie isn't running at <url>: open the app or run magpie serve". MAGPIE_GATEWAY=<url> points at another. Docs: usage lines in magpie help, docs/reference.md (Use), the gateway routing subsystem page (_meta and the CLI), README en/zh, site docs start page en/zh/ja. Tests (internal/cli/tool_cli_test.go, never the network; every test sets MAGPIE_GATEWAY to its own httptest server): - TestToolsListsTheServersTools, TestToolReadsParameters, TestToolRefusesWhatItDoesntKnowAndCallsNothing (no tools/call, no file), TestToolHelpCallsNothing (no request at all), TestToolSavesTheImage, TestToolWaitsOnWhatIsStillMade (pending _meta, then the old text form, download with the key from the gateway asked, not the URL's host), TestToolErrorIsSaid, TestToolSaysMagpieIsntRunning, TestToolDrawsThroughTheGateway (the real gateway.New().Handler() with a fake vendor: lists, draws, saves the vendor's PNG). - TestImageMCPDrawsAndServesTheImage, ...SlowDrawingIsWaitedOn and ...MakesVideos now check the _meta. Red on the old behaviour: with withMeta setting nothing (what main answers) all three fail ("_meta map[], want pending img_…"). - Broken by hand: dropping the unknown-parameter check makes TestToolRefuses… red (the --model call was made); saving an inline image by its URL instead makes TestToolSavesTheImage red. Both restored. - TestHelpOnEveryCommandDoesNothing covers tool and tools. Run with this change on origin/main |
||
|
|
d153f02593 |
docs: a privacy masking how-to in en, zh and ja, linked from every docs page
YH31377807 on X asked how to use magpie's local masking (咋用?能出个 教程吗?). The docs had only a short section on the Privacy page. /docs/masking, /docs/zh/masking and /docs/ja/masking: turning it on in Settings › Privacy, settings.json for magpie serve and Docker (no CLI command exists), what each switch masks, an example, how to check it (Try it, the shield badge on Gateway and Routing, Insights › Masking, ~/.config/magpie/masking), Mask/Warn/Block and Never mask, and limits. Each docs page's nav and footer link it; the Privacy pages' masking section points to it. Checked against the source: the secret rules and personal kinds in internal/redact/redact.go and more.go (Categories and their defaults), masking.Wanted and options in internal/masking, the sealed/kept keys in redact/json.go, Hint for the Block message, gwmw.ErrUnmasked (503) and maskBlocked (400), the GUI labels from index.html/app.js and their zh and ja strings in i18n.js, plugins/redact's name. The example's output is redact.Preview's on that text, run in a throwaway test (placeholders differ per run's key). Run: node --test site/worker.test.mjs site/install.test.mjs (31 pass). The three pages rendered in Chromium and WebKit at 390 and 1280 px with no horizontal scroll and no page errors; tags balanced. Not tried: the GUI itself; labels read from source. |
||
|
|
e3491e2bb0 |
docs: point dsh's own DeepSeek row at magpie by hand (#3298)
tom047784 (Discord) wants dsh's llm-deepseek row, which keeps DeepSeek's cache across in-history prompt and tool updates and uploads images through the Files API, to go through magpie. magpie doesn't take that row over (the key would mean two things, it would override the user's own entry, and a file_id belongs to one account while magpie fails over), so this documents the entry a user writes themselves: docs/reference.md under "Notes on some agents", and a FAQ entry in site/public/docs start.html (en, zh, ja). Checked against @deepseek-ai/dsh-llm-deepseek 0.2.1-rc.2's source (npm pack into a scratchpad, read only): messagesApiRoot adds /v1 to baseURL unless it ends in /v1; apiKeyEnv is a credential reference read from dsh's credentials and then the environment; an explicit models list replaces DEFAULT_MODELS, whose in-history/addition-only settings are on deepseek-flash only; any Files failure rebuilds the request inline, bounded by maxInlineRequestImageBytes (20 MiB) against maxRequestFilesBytes (128 MiB). Against magpie: internal/agent/dsh.go drops only magpie-marked llm-deepseek entries and removes MAGPIE_GATEWAY_KEY on Disconnect; POST /v1/files answers 404; the catalog ids are deepseek/deepseek-flash and deepseek/deepseek-v4-pro. Tried: real dsh 0.2.1-rc.2, `dsh --profile headless`, sandbox DSH_HOME and HOME, a magpie built from this tree on its own port. Through a fake Anthropic upstream: "say pong" answered; the upstream got output_config.effort, thinking, tools, dsh_session_log and dsh_plugin_packages as sent, the provider's key, and no x-deepseek-harness-* header. A mid-history system message with tool_addition and the mid-conversation-tool-changes anthropic-beta went through unchanged (curl). With a real DeepSeek key copied into the sandbox: dsh read a file with a tool, three calls all 200, cache_read 5760 on a later call; a system message added in the history after two turns was followed and cache_read_input_tokens was 3456. Usage rows had agent dsh, /v1/messages and dsh's session; x-deepseek-harness-compact: 1 recorded kind compact. Not tried: an image turn through dsh (the inline fallback is from the source and the 404), the desktop app and its Models-page key entry, Windows. |
||
|
|
a1cce7faa1 |
gateway: the decision model's timeout is a setting (#2934, reyoung)
A routing group's intent classifier (askChat) and System One (askJev) were each given a fixed 8s. A slow subscription classifier can now be given longer in Settings > Models > Replies > Intent classifier timeout. settings.json's classifyTimeout takes 1..60 seconds; 0 or missing keeps 8s. save() refuses below 0 or above 60, and ClassifyWait clamps a value edited by hand (below 1 gives 8s, above 60 gives 60s). A settings file that can't be read gives Shared()'s defaults, so 8s, never no timeout. Both askChat and askJev read it per call. The GUI row is the app's own segmented control (8, 15, 30, 60, plus a value set by hand), and other saves carry the value on (prefsKeep, api.go). zh, zh-TW, ja and de strings; the routing reference and the en, zh, ja docs say it. Ported from reyoung's classify-timeout-2934 (author kept). On top: - askJev's defer reworded any error once ctx had expired, so a refusal (decideRefused) or an answerError read as the wait ran out lost the type askDecideTries rests an account by. Now only errNoAnswer, which systemOne returns when postDecide failed with ctx done, is reworded to "<provider> gave no answer in <wait>". - ja intent.html: a stray space in "遅いモデルだと 設定した". - app.js: the Image generation timeout row and the new row share waitRow (~350 bytes less). TestCoreScriptBudget was red (app.js 1,337,982 > 1,337,000); budgets raised to the exact sizes, app.js 1,337,633 and core 1,529,393, no room added. Run (macOS, Go env pinned, sandbox HOME): - Full go test -tags nogui -timeout 45m ./... at 766cf1cf9: 68 packages ok; internal/gui red on TestCoreScriptBudget only, fixed above. - At ed008ca9f and again after rebasing on |
||
|
|
81a24cf8fe |
groups: a found group is listed as auto/<model id as the vendor spells it>
ZeroClover asked on X: Auto Group ids group/auto-<slug> can't be looked
up on models.dev. A found group is now listed and written as
auto/<model>, e.g. auto/claude-opus-5.5: /v1/models, the catalog, agent
configs, the GUI's Routing page and the CLI. Context and output limits
come from the model's metadata as before.
What stays the same:
- The internal id is still group/auto-<slug> (Group.Ref() gives the
public one). Every old form is still accepted as input forever:
provider.CanonicalRef turns auto/<model>[:level][[1m]] into it at the
gateway (validateModel), keys, stats, affinity and usage, so both ids
route to the same group and count as one.
- A key's model list allows a model by either id, group/* included
(allows() in key_models.go).
- Hand-made groups stay group/<id>.
- A provider whose stored id is "auto" keeps its models: while one
exists, found groups are listed by their old id (AutoRefsOn) and
auto/<x> means that provider's model. Documented in
docs/subsystems/gateway-routing.md.
Agent configs: SyncCatalog rewrites a field that holds a found group's
old id (renameFoundGroups), but only while the value is still what
applied.json says magpie wrote; a value the user set stays. A pick by
the old id written now is written as auto/<model> (Apply). Hidden,
picked and ordered model lists saved by the old id hold for the new one
(visible.go), and a bare model id still reaches its found group (bare.go).
Claude Code is given a dotted Claude version dashed (ClaudeSpelled), so
auto/claude-sonnet-4.5 sits in its settings as auto/claude-sonnet-4-5.
That routes to the same group, but with found groups off nothing reads
it back dotted, and Reseat took the field for changed and left the agent
on a group that was gone. Reseat now compares a group pick by its
canonical id (samePick). The old ids had no dots, so this is new with
auto/<model>.
Run at this tree (sandbox HOME, caches pinned):
- gofmt -l: clean. go vet ./...: clean on darwin, GOOS=linux -tags
nogui, GOOS=windows.
- go test -p 4 -timeout 45m ./...: every package ok except agent and
gateway, whose failures were the tests' expected ids (updated here)
and two regressions now fixed (bare ids; desktop models hiding groups
by prefix). Every failing test passes on rerun. Load average was
~210-290 from other sessions throughout.
- Reruns: provider, cli, codexcat ok. internal/gui: only
TestSetAnswersWhileDevinAndProvidersHang fails (set slow/slow-1 took
10.19s), and it fails the same in a git-archive export of
|
||
|
|
333c167575 |
routing: a rule can set the reasoning its model is asked for (#2633)
dengtongcai asked for a routing rule that picks both the model and the reasoning it is asked for (a quick question goes to a cheap model at low). A rule now has an output field, useEffort (low|medium|high|xhigh|max). When the rule matches, its member is asked for that effort. A member's own fixed effort still wins. Otherwise the rule beats the model's suffix, the turn's pick and the agent's pick. The existing effort condition is unchanged. - The value is fitted to the model's levels (max -> high on a model that tops out at high). A model with no Efforts is sent what the agent asked, untouched. Unset changes nothing. Failover members are not affected. - The trace records it: Rule.UseEffort and the try's RuleEffort (the second Try construction in the candidate loop was missing it). - Saving a group rejects an unknown value or one on a pause (cleanRules). The CLI takes use-effort=; the TUI and CLI lists show " at <effort>". - GUI: a chip after the rule's model, picked from the app menu (pickFrom, no native select), set/changed from the rule's menu. A pause clears it. Strings in zh, zh-TW, ja, de. - A Gemini-protocol client is left unchanged, as with every effort magpie sets. - Docs: docs/subsystems/gateway-routing.md; site docs intent and start (en, zh, ja). What was run, at d4c03a2c5 (rebased on |
||
|
|
486ea82378 |
agents: cursor-agent's row is Cursor CLI (@G_Z_Y on X)
@G_Z_Y looked for Cursor CLI on the Agents page and took the "Cursor" row
for the editor. The row is cursor-agent, so it is named Cursor CLI. What
it keeps in ~/.cursor is the Cursor editor's too (MCP servers, skills,
chats), so the Library and Sessions name it Cursor there (SharedName).
Run at this head before the rebase onto
|
||
|
|
538753a7a6 |
gui: a routing group's rule reads as one line, its conditions added from its + menu
The rules editor drew every condition of every rule as an empty box to fill (tokens, images, effort, agents, intent, compact, folders, hours), then "send to" and the model, with Move up / Remove as words and two paragraphs of help below. Three intent rules took ~600px and the intent itself was cut at 24ch. The owner: "现在这个页面太复杂了,用户要输入、 填写这么多东西,太恐怖了。" Now each rule is one line, read as a sentence: 1 asks for <intent…> + → [model] ⋯ - Only the conditions a rule has are drawn, in the rule's own order; each has a × (shown on hover or focus, always on touch) that clears it back to "not set". The rule's + opens the app menu (openProtoMenu, never a native select) with the conditions it doesn't have yet; a pause is offered only the conditions a pause can hold by. - "→ model" sits in its own grid column (subgrid), so it lines up across rules whatever the conditions' widths; under 640px it wraps under the conditions. - The intent is a one-row textarea that grows with its words (a hidden copy sizes it), so the whole intent shows and wraps; Enter and pasted newlines stay one line, as saved before. - Folder boxes size to their text (canvas-measured with the box's own font, +8px so the caret never scrolls the text inside). - Sending is the default and goes unsaid; a pause says "pause" before its model. The ⋯ menu holds Move up, Move down, Send to / Pause the model instead, and Remove rule. - "Add a rule" starts a rule with the intent box ready. The two help paragraphs became an ⓘ beside it, and beside Effort and the intent model. - Saved data is unchanged: an unchanged editor saves the same rules field for field (routing-rules-line round-trips the old assets too). Docs: intent.html and start.html (en, zh, ja) say where Add a rule's intent box and the ⋯ menu's pause now are. The /img/intent-rules-*.png screenshots still show the old editor; not regenerated here. Run: - New routing-rules-line.test.cjs: every condition drawn in order, none empty, + menu (app menu, not select), × removes, ⋯ moves, no overflow or sideways scroll; Chromium and WebKit, en/zh/zh-TW/ja/de, 1100 and 390px. Broken by hand, it went red. - Updated routing-intent-entry, routing-compact, routing-pause, routing-pause-folder, routing-time; with routing-folder, routing-manual, routing-levels, own-requests, i18n-keys, click-scroll and every *menu* test: all pass in both engines but removed-groups-menu-scroll, red 1-2 of 8 per run on a4d580fa2's assets too. - The full routing-*/group-*/images-* GUI set (1261 tests, both engines, concurrency 6): reds outside the editor (routing-days-fit, -agent-gone, -agent-hue-not-red, -burst-speed, -failed-open, -keys-fold, -model-rest, -side-calls, -wb-restricted, group-found-off) fail the same on a4d580fa2's assets run alone here. Of the editor's own reds in that run, two were the tests' clicks (now wheeled to, both ways). The third was real: in WebKit routing-pause-folder's ⋯ menu shut at once, because the folder box's text had scrolled inside it. The box now has room for the caret; the next commit fixes the menu itself. - go test ./internal/gui: ok. - Shots: zh 1000px before/after, en 390 WebKit, zh 390 Chromium, dark. Not tried: the real Wails window, the Windows box, a WebKitGTK without subgrid (falls back to unaligned columns), the docs images. |
||
|
|
82f3befd29 |
daemon: magpie daemon install --web serves the browser page from the service, with a link that lasts (HuanCheng Bai)
HuanCheng Bai on Discord runs `magpie daemon` on a Linux server and asked
for the daemon to serve the web page too, or for an option to turn it on.
`magpie web` run beside it is a second process, and he read it as not
seeing the daemon's state.
- `magpie serve --web[=host:port]` serves the gateway and `magpie web`'s
page from one process (stats, StartWeb, Wait). The default page address
is 127.0.0.1:3430. Any other argument is refused, where before it was
ignored.
- `magpie daemon install --web | --lan | --addr host:port | --no-web` and
`magpie daemon web [on|off] [--lan] [--addr host:port]`. The unit's
ExecStart and the plist's ProgramArguments become `serve --web=<addr>`,
and the key goes into the 0600 file's environment as MAGPIE_WEB_KEY. The
key is made once. A reinstall with no flags keeps the page and its key
(read back from the file by daemon.Web), so the link survives restarts
and reinstalls. `web off` drops it. MAGPIE_WEB_KEY in the shell, when
set, is used and checked like magpie web's. The page defaults to
loopback; --lan or a non-loopback --addr prints the network links and
magpie web --lan's warning.
- `magpie daemon status`, install and `daemon web` print the page's link.
- `magpie web` while the service serves a page prints that page's link and
exits. Beside a gateway another magpie serves, it says so and points to
`magpie daemon web on`.
- docs/reference.md (the service section and the Use list), and the
site's start page (en, zh, ja). The READMEs don't cover the daemon.
Run:
- Tests: TestInstallWithWeb (systemd and launchd, plutil lint, read back,
reinstall without the page, the shell's key not carried, no key
refused), TestWebNotInstalled, TestParseDaemon, TestWebOptions,
TestDaemonStatusPrintsPage and TestServeArgs. Each of these went red
with its line reverted by hand: withKey, prevKey in webOptions, and the
status page line.
- Sandbox HOME with a fake launchctl:
- `daemon install --web --lan` wrote a 0600 plist with
`serve --web=0.0.0.0:3430` and the key. plutil said OK, and it printed
the link, the network links and the warning.
- Reinstalling with no flags kept the key. `daemon status` showed the
link.
- `daemon web off` / `daemon web` / `daemon web on` behaved as above,
with a new key after off.
- `daemon web bogus` and `serve --lan` gave the usage errors.
- `serve --web=127.0.0.1:3462` served the gateway (3461) and the page in
one process. The page answered 200 with the key and 401 without, and the
page and /v1/models both showed 3 models. `magpie web --no-open` beside
it printed the service's link and exited 0.
- gofmt -l; go vet (gui), and go vet -tags nogui for darwin, linux and
windows; go test -tags nogui ./... in a sandbox HOME.
Not tried: a real systemd on Linux. The unit text is checked by test only.
|
||
|
|
f64d9312ff |
site, docs: a Privacy page lists everything magpie sends and how to turn it off (#1986)
#1986 asked what the daily count sends, where the id lives and how to stop it. The answer was spread over one README paragraph and the reference. A new page, /docs/privacy (en, zh, ja), lists it from the code: - the daily PostHog batch (internal/stats): a whole example, the label rules for agents/providers/models, partner counts, the $process_person_profile:false flag; - every switch: Settings -> Privacy's two toggles, noStats/noUsageStats, DO_NOT_TRACK / MAGPIE_NO_STATS, noAutoUpdate (About -> Automatic updates), and that a change applies at the next hourly look; - the files: install-id (made at the first send, not at first run, as the issue said) and stats-sent in settings.Dir(), partner-counts.json in the cache folder, their paths per OS and portable, and deleting them; - what usemagpie.ai sees whatever the settings (update feed every 6h, notes, partner list with its 1-in-10 sampled count, /go links, the icon proxy) and the Cloudflare Web Analytics on the site's own pages; - public lists fetched (models.dev, open.er-api.com, npm, GitHub) and providers' quota reads with the user's own accounts; - OTLP export, off by default, its env vars; - why the count stays on by default in releases. Every docs page in all three languages gets a Privacy link in its nav and footer. README (en, zh) and start.html's "What does magpie send about me?" (en, zh, ja) link to the page. docs/reference.md's Files list gains install-id, stats-sent and partner-counts.json, and Counting users says when the id is made, the hourly try, and links the page. Checked against: internal/stats/stats.go, usage.go, provider/partner_events.go, settings (NoStats, NoUsageStats, NoAutoUpdate, UpdateEvery 360, otel.go), appdir, update, fx, catalog, site/worker.js, and the GUI's Settings tabs/labels in index.html, app.js and i18n.js (zh, ja). Run: Playwright (Chromium and WebKit) on all three pages at 1100 and 420 wide, light and dark: no horizontal scroll, no element past the viewport, no page errors (24/24), screenshots looked at for zh at 420 dark. Every href/anchor in site/public/docs resolves; relative links in README and reference resolve. node site/worker.test.mjs passes. Not run: the page on the deployed worker (the site deploys by hand with wrangler, so it is live at the next deploy); the language redirect for /docs/privacy was not exercised beyond the worker's existing tests. |
||
|
|
5617281f55 |
cli: magpie daemon install|uninstall|start|stop|restart|status keeps the gateway running as a service (HuanCheng on Discord)
What changed: a new internal/daemon package and `magpie daemon`, which run
`magpie serve` as the user's own service, with no window and no desktop
session.
- Linux: a systemd user unit at ~/.config/systemd/user/magpie.service
(Restart=on-failure), driven by systemctl --user. status reads
`systemctl --user show`, and says `sudo loginctl enable-linger $USER`
when the user doesn't linger. su/sudo without the user's bus, no
systemd, and WSL without systemd each get an error that says what to
do.
- macOS: a launch agent, com.yetone.magpie.serve (RunAtLoad, KeepAlive on
failure), loaded with launchctl bootstrap gui/$UID. Its log is
~/Library/Logs/magpie/serve.log.
- Windows and Android: refused, pointing to `magpie autostart on` (or to
WSL).
- The service carries PATH, the proxy variables, MAGPIE_*, the XDG folders
and the agents' folder variables from the install shell. The file is
0600 because a proxy can hold a password. It runs magpie by its PATH
name when that is the same file, so Homebrew's link survives updates.
It refuses a go-build binary and an AppTranslocation copy.
- Install is refused while `magpie autostart` is on: the tray app serves
the gateway too, and the two would crash-loop on the port.
- Docs: a reference.md section, and one sentence on the site's start page
(en, zh, ja).
Why: users on headless Linux boxes asked for a supported way to keep
`magpie serve` up across reboots instead of hand-written units. The
existing `magpie autostart` needs a desktop session (an XDG autostart
entry).
What was run:
- gofmt -l; go vet on darwin, GOOS=linux -tags nogui, and GOOS=windows.
- go test ./internal/daemon ./internal/cli on macOS, at origin/main
|
||
|
|
eba7187368 |
gateway, provider, cli, gui: a group can route By weight, each member's share set beside it (#1910, DD on Discord)
DD asked for weighted round robin as a group routing, next to In turn.
A provider's keys could already route by weight (#841). Groups could not.
What changes:
- provider: Group.Weights maps a member's spelling to its weight, 1 to
1000. A member left out, or set to 0, weighs 1. SaveGroup accepts
routing "weight". It also cleans weights the way it cleans fast and
off: it strips :fast, drops weights of members that are gone and of
members weighing 1, and refuses a weight below 0 or above 1000.
Weights follow a member when it is renamed (RenameMember, Rename,
RenameGroup) and survive Share/Import.
- gateway: planLevel treats each member of a weight-routed group as one
unit: a model with its keys in its provider's order, or a nested group
routed its own way. weightedUnits orders the units by smooth WRR on a
round per group ("group/<id>"), sharing wrrPick with the keys. The
round's pick goes first and the rest stay in member order for
failover. A unit whose head is resting leaves the round. When a
conversation is kept on another member (session/turn/cache/strict),
the charge moves to that member (wrrSeat, wrrMove).
- cli: routing=weight (also weighted, wrr). weight=<model>=<n>[,...]
sets weights and keeps the rest; weight= on its own clears them. The
group view shows "· weight N" for each member.
- tui: By weight is in the group routing list.
- gui: the group editor offers By weight. Each member then shows
"Weight N · S%", its share among the members that are on. Clicking it
edits the number in place: Enter or blur keeps it, Escape cancels,
and a value outside 1 to 1000 shows a warning. The trace header uses
group wording for a weight-routed group. Strings are added in zh,
zh-TW, ja and de.
- docs: reference.md, gateway-routing.md, and site start pages in en,
zh and ja.
Run:
- go test -tags nogui ./internal/provider ./internal/cli ./internal/tui:
ok.
- ./internal/gateway: ok in 988s with -timeout 45m. The first run hit
the default 10m timeout at load average ~170. The test running at
that moment had been running for 2s; it was not a hang.
- go vet -tags nogui on those packages, for darwin, GOOS=linux and
GOOS=windows: clean. gofmt -l: clean.
- New group-member-weight.test.cjs: 8/8 in Chromium and WebKit, en and
zh at 1100, en and de at 420. The WebKit de 420 case also passed six
runs at once.
- gui-zh-tw, gui-ja, gui-de, i18n-keys, routing-*, group-*,
panel-routing*, settings-groups and agent-model-groups: all green
except two.
- routing-steady (WebKit) is #1804. It is red 2/3 alone on origin/main
|
||
|
|
e528aeb3ce |
agent: DevEco Code, Huawei's OpenCode, as an agent (#1885)
foobra asked for DevEco Code (npm @deveco/deveco-code), Huawei's
HarmonyOS coding agent. It is OpenCode underneath, so it joins through
openCodeLike as MiMo Code did (
|
||
|
|
908c910931 |
gateway, gui: Stays: Strict keeps a conversation on the account or key that answered it, even past its cap, and passes its error on rather than moving it (#1797)
miniers asked that a conversation never move to another account: a
move changes the account a vendor sees mid-conversation and loses its
prompt cache. Session affinity keeps the account while it can answer,
then moves on.
The new affinity mode "strict" (Stays: Strict) does what session does
for a new conversation. Once one has an account, strictKeep asks that
account alone (its other models too) and no other account, key or
provider:
- one resting or spent is still asked, and its error (429, 402, 5xx)
goes to the agent rather than to the next candidate;
- one over a user cap is asked past it (plan's capped candidates,
capHeldOnly);
- one held for credits answers 429 naming Stays: Strict rather than
moving;
- one removed, turned off, barred or not allowed for the key counts as
gone, and the conversation is routed as usual.
A last try that fails verification is not rested for a strict
conversation that had nowhere else to go.
Set in the provider editor and the Routing page's pool row (GUI, all
five languages), `magpie groups ... stays=strict` (strict-session,
never-move), and the TUI ("stays strictly"). Documented in
gateway-routing.md, reference.md and the site's start pages (en, zh,
ja).
Run:
- go test -tags nogui ./internal/gateway (-timeout 30m under load ~150),
./internal/provider ./internal/tui ./internal/cli: ok. The three
TestStrictAffinity* tests fail on the code before this commit (200
where 429 was expected, acct-2 answering).
- GUI: stays-strict.test.cjs, chromium and webkit, 900 and 560px, en,
zh, zh-TW, ja, de: 30 of 30. On the assets before this commit it
fails 15 of 15 in chromium. routing-*.test.cjs pass but for
routing-steady's webkit 1.69px shift, which fails on the old assets
too: filed as #1804.
- gofmt -l, go vet (darwin, linux, windows), full go test ./... before
the push.
Not tried: a real agent conversation held on a real rate-limited
account.
Known and left: planLevel doesn't merge a nested group's sub.held, as
before this commit.
|