ac4af582301a4e8a29245dbba767eba31334ddf9
353
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a6e4cf7635 |
settings: what routing does sits under Models › Routing, and the Routing page opens it
The scattered settings audit after netube99 on X. Ask again after a
refusal, the Retry-After cap and the intent classifier's timeout were
under Models › Replies beside rows about a reply's content, and Busy
models last sat in Network and sharing, far from the routing it changes.
The four are now one Routing section under Models, after Replies, and the
Routing page's header has a Settings › button that opens Settings at that
section with its first row lit. The docs (reference.md, the site's
plugins page in en, zh and ja) name the new place.
Run (mote, mote-run):
- settings-places, retry-after-cap-setting, refusal-retries-setting,
classify-timeout-setting, model-load, i18n-keys and bare-ids, both
engines: all pass.
- mobile-web against origin/main
|
||
|
|
88b541a25c |
images: every pointer names Settings › Models › Images, where the page is
The image models moved under Settings › Models, but the Library's Magpie
Image sheet, the MCP server's instructions to agents, the gateway's
"no image model" errors, the video tool's text and the docs still sent
users to "Settings › Images", a tab that no longer exists (the scattered
settings audit after netube99 on X). Every user-facing string now names
Settings › Models › Images in en, zh, zh-TW, ja and de, as do the site's
Qwen docs (en, zh, ja), llms-full.txt, the subsystem pages and comments.
Run in the tree with this change and the rest of the audit's fixes
(mote, base
|
||
|
|
00e9a27582 |
site: /favicon.ico goes to /favicon.png
Search Console listed /favicon.ico as a 404 (crawled 10-28). The pages link /favicon.png, but crawlers and old browsers still ask for the .ico. It now gets a 301 to the PNG. Run: node --test worker.test.mjs install.test.mjs on mote, 71/71 ok. |
||
|
|
922c5f4b58 |
site: llms-full.txt carries the OTLP export's gateway key name (#5788)
|
||
|
|
4314f4b776 |
otel: export the gateway key's name as magpie.gateway_key.name (#5751)
reyoung (#5751) shares one magpie through several gateway keys and wants requests in Langfuse or another collector told apart by key. The ledger row already had CallerKeyName, but the OTLP allow-list dropped it, and the observer's root and attempt records never carried it. Ported from reyoung's 9d82162aa (reyoung/magpie feat/otel-gateway-key-name), applied unchanged onto current main: - observeRequest takes access.Caller(r).KeyName when observing begins and puts it on every End and Attempt record (CallerKeyName), so the root span and every try (failures, retries, fallbacks) carry it with no lookup at export time. - otlp's allow-list grows by this one attribute, on generation and ledger spans (otelAttributes, so the duration and token histograms too) and on the root span. Omitted when the name is empty. The key's id and secret are never sent; provider account names stay out. - docs/reference.md, plugin-runtime.md and the en/zh/ja privacy pages say the name goes to the user's collector. Added on top: docs/reference.md says each key name multiplies a metric's series, and that keys sharing a name are counted together. Review of the fork (read every line; run only on mote): no new address, dependency or credential; the name is read from the auth context at request time, the same source appendUsage uses for the ledger row; reported rows (another computer's) already have the caller key cleared and never reach observers; session spans of local transcripts have no key. READMEs (en, zh) mention OTLP only as a feature, with no list of what is sent, so they are unchanged. Run on mote (lockf ~/suite.lock), at base |
||
|
|
2f947ef65c |
site: llms.txt points to llms-full.txt
Run on mote: node --test worker.test.mjs install.test.mjs, 70/70 pass after rebuilding llms-full.txt. |
||
|
|
22076f201d |
site: /llms-full.txt holds every English docs page as Markdown
AI assistants that read a site in one file (the llms.txt convention's llms-full.txt) now get the full text of all 23 English docs pages, in llms.txt's order, each under a Source: line with its URL. site/llms-full.mjs builds it from each page's <article>: headings, lists, tables, callouts and code blocks become Markdown, and relative links become absolute. Run `node llms-full.mjs` in site/ after changing a docs page; the new worker test fails while the committed file differs from what it builds, misses a docs page, or has HTML outside a code block. Run on mote: node --test worker.test.mjs install.test.mjs, 70/70 pass. Broken by hand: the first version of the HTML check failed on two code samples (an <a> badge and a <p id="calls">), so it now skips fences. |
||
|
|
802f03e684 |
site: Qwen and MiniMax provider pages in en, zh and ja
Two more provider guides beside DeepSeek, Kimi and GLM, at
/docs/{,zh/,ja/}{qwen,minimax}, linked from each agent guide's
"By provider" line, the sitemap and llms.txt.
Facts come from source: the six Qwen presets (qwen, qwen-cn,
qwen-token-plan, bailian-token-plan, qwencloud, qwencloud-token-plan)
and their endpoints and key kinds in presets.go, alibabaPlanModels,
dashScope()'s non-streaming rule in gateway.go, alwaysThinks and
effortInOutputConfig in anthropic.go, MiniMax's inline <think> in
chat.go, readMiniMaxPlan's windows in planquota.go, and the Qwen Code
and MiniMax Code agents in internal/agent.
Run: mote-run sh -c 'cd site && node --test worker.test.mjs
install.test.mjs': 69 pass, 0 fail. JSON-LD of the six pages parses.
Not tried: a real Qwen or MiniMax key through the pages' commands.
|
||
|
|
25eec8f6cb |
site: provider pages for DeepSeek, Kimi and GLM (docs/deepseek, kimi, glm; zh, ja)
One page per provider, in English, Chinese and Japanese. Each covers adding the provider (the presets and plan= on the CLI), the endpoints magpie uses for each plan (from internal/provider/presets.go), how Claude Code, Codex, Gemini CLI and OpenCode reach it (linking the agent guides), the provider's thinking rules from internal/gateway (DeepSeek's thinking on tool turns, low/high/max effort and one-hour key affinity; GLM-5.3 and Kimi Code (China) K3.1 refusing thinking off; GLM's output_config.effort), the Zhipu 1113 retry on the Coding Plan endpoint, balances and plan windows (balance.go, planquota.go), and an FAQ with FAQPage JSON-LD. The four agent guides get a "By provider" line in each language; sitemap.xml and llms.txt list the new pages. Model ids are only ones in presets.go or catalog testdata. Generated by provgen.py in the seo scratch folder, from claude-code-models' layout. Run: mote-run node --test worker.test.mjs install.test.mjs, 69/69 pass. Tag balance of each article checked by script. Not tried: a browser render of the pages. |
||
|
|
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. |
||
|
|
8935abcf54 |
site: Japanese guides for other models in Claude Code, Codex, Gemini CLI and subscriptions
New pages under /docs/ja/, translated from the English guides with the same facts and nothing added, aimed at Japanese searches such as "Claude Code DeepSeek 使い方", "Codex 他のモデル", "Gemini CLI Claude" and "ChatGPT サブスク 他のツール": - /docs/ja/claude-code-models - /docs/ja/codex-models - /docs/ja/gemini-cli-models - /docs/ja/subscriptions Each is built on docs/ja/start.html's head, nav, footer and CSS, with TechArticle and FAQPage JSON-LD (inLanguage ja; the FAQ entries are the page's own FAQ text), canonical, og tags and hreflang en/zh/ja/x-default. UI labels stay in English, as in the other ja pages. - The en and zh versions of the four guides get a hreflang ja alternate and a 日本語 entry in their language menu, as docs/start.html has. - Every ja page's nav and footer now link the ja URLs of the four guides instead of the English ones. - sitemap.xml lists the 4 ja URLs. Run: - node --test worker.test.mjs install.test.mjs on mote (mote-run, at this tree): 69 tests, 69 pass, 0 fail. It includes the sitemap test (every docs page listed, own canonical, x-default, every alternate a listed page) and the contributors footer test. - A Python check over every docs page: all 12 JSON-LD blocks parse, the ja TechArticles carry inLanguage ja and their own URL, every canonical is the page's URL, and every hreflang set is reciprocal (47 pages, 0 problems). Not tried: rendering the pages in a browser before the deploy. |
||
|
|
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. |
||
|
|
ac043ffcc5 |
site: llms.txt for AI search
AI search sends almost nothing yet: in the last 7 days PostHog counts 74 visitors from Doubao and none from ChatGPT or Perplexity, against 12.6k from Bing and 6.7k from Google. llms.txt is the plain-text summary these engines read: what magpie is, the facts people ask for (free, MIT, platforms, install line, source), what it does, the agents and providers, every English docs page, and the questions people search for. Every fact is taken from the home page and the docs' own descriptions. A test fails if a docs page is missing from it or a link isn't in the sitemap; broken by hand (a link renamed) it went red. Run: node --test --test-name-pattern=seo worker.test.mjs on mote, 4 pass. |
||
|
|
da52b8ab73 |
site: leave Cloudflare's Web Analytics beacon to Cloudflare
Web Analytics had counted no visits for usemagpie.ai in 30 days. Every page carried two beacons: the worker's manual one and the one Cloudflare now injects into worker responses itself. The manual one loaded first, took the page, and posted to cloudflareinsights.com/cdn-cgi/rum, which answers 404 for this site's token. Cloudflare's own (r:1) posts to usemagpie.ai/cdn-cgi/rum, which answers 204 for the same payload. The worker now adds only PostHog. Run: node --test worker.test.mjs install.test.mjs on mote, 68 pass. The contributors test now fails if the worker adds cloudflareinsights again. Checked by hand: curl with browser headers shows Cloudflare's injected beacon on /, /zh/ and /docs/; the same-origin POST answers 204. |
||
|
|
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). |
||
|
|
9d366f15b9 |
update: a file the feed names off GitHub goes on to its github.com address, then the API
The feed is about to name usemagpie.ai's copy of each release file on
Cloudflare R2, with the file's github.com address beside it (`github`).
The app, `magpie update` and install.sh now try, in order: the feed's
url; github.com's address (Asset.GitHub), through the user's mirror when
one is set (a mirror is still only put before a github.com address); then
GitHub's API route, looked up from the github.com address, never through
a mirror. A route is left once it answers busy, or for the last tries
after connections that broke. The error names each route that failed.
Every file is checked against the feed's SHA-256 as before.
Run:
- mote: go test -count=1 ./internal/update ok; gofmt -l clean; go vet,
GOOS=linux go vet -tags nogui, GOOS=windows go vet of ./internal/update ok.
- wsl (magpie-desktop): go test ./internal/update ok; node --test
site/install.test.mjs ok.
- mote: node --test site/*.test.mjs 104/104.
- win-run: go test ./internal/update has one red, TestPackagedByDpkg,
the same on origin/main
|
||
|
|
c66cdbea97 |
update: a release file github.com won't serve comes through GitHub's API
On 2026-11-08 github.com answered 504 for every file of
yetone/magpie-releases (…/releases/download/<tag>/<file>) for hours, while
api.github.com/repos/yetone/magpie-releases/releases/assets/<id>, asked
with Accept: application/octet-stream, redirected to the same bytes.
Every self-update and the install script failed (kurutodenzeru, wjbdx,
isee1_1 on Discord). Retrying the same address (
|
||
|
|
b0926e81a2 |
import: a link can say where its key's balance is read (balance=, balance_path=, balance_method=)
A relay's "Add to magpie" link can now name the URL that tells a key its balance, where the amount sits in the reply, and GET or POST. magpie takes it only on the host of one of the link's own base URLs, over https, with no userinfo or fragment, so a link can't send the key anywhere its requests don't already go; anything else refuses the whole link. balance_path or balance_method without balance is an error. No header or token is taken from a link: an account-wide token is worth more than a key, and a URL stays in browser history. - provider.ParseImport: linkBalance checks and sets BalanceURL, BalancePath and BalanceMethod. - CLI: the import preview shows the balance URL and doesn't ask it before yes (showProviderAsking). - GUI: the import dialog shows method, URL and field (.imp-bal). - Docs: docs/import in en, zh and ja (table rows, a note on headers, the builder's three fields with the same host check, a security bullet); docs/reference.md's parameter table. Run on mote at this tree (rebased on |
||
|
|
7a6211d047 |
providers: a model's own headers, in Model settings
axelburks on Discord: a vendor routes one model by a header of its own. A key's provider (built-in or custom) can give each model headers (settings.ModelHeaders["pid/model"]). They go on that provider's requests for that model alone, after the provider's headers and after auth: a name both have is sent once, as the model's, so a user's value is never overridden by the provider's or magpie's key header. The gateway names the model (provider.WithModel) on every route that asks one: chat on each API, translated and streamed, count_tokens, System One's decision, embeddings, images, videos and the model test. A fallback provider serving the same model id gets its own headers only. Accounts and plugins carry their sign-in's headers and take none. The editor's "Name, price and reasoning level" panel is now "Model settings" (every language), with + Add header per model, staged and made with the Save; Restore default takes them away. The rows being typed are kept out of the draft's compare, so an untouched editor still closes without asking. Broken by hand: dropping WithModel from gateway.go turns TestModelHeadersReachTheirModelOnEveryRoute red; dropping the provider id check in modelOf turns TestModelHeadersStayWithTheirProvider red. Run, on this stack over origin/main |
||
|
|
922cc0ccf8 |
library: a plugin's tools hidden from every agent from its Plugins row
chengming0v0 (Discord) keeps a plugin for its providers but doesn't want
the MCP server it brings (minimax_query_video_generation and the rest)
shown to agents, and doesn't want to remove the plugin.
Before: a plugin that gives tools is a Library server of its own
(plugin_tools.go), switched per agent with the row's chips in Library ›
MCP, which held through updates and off/on. Nothing on the Plugins page
said so: its line read "Tools for every agent" whatever the Library had,
and an app at the router's address (/mcp/magpie/hub, agent "") was given
every server, ticked for any agent or none, so taking every chip off
still left the tools there.
Now:
- The plugin's tools line says "Tools for agents" or "Tools, hidden from
agents", with Hide from agents / Give to agents beside the copy button
(plugins.js, toolsServer in /api/plugins from library.PluginServers).
- PluginServerOn (servers/plugin-on {name, on}) sets Server.Hidden and
keeps the agents it had in Paused. Hidden, no agent is given it and
hubServers leaves it out for the router's address too. Give to agents
gives the kept agents back; with none kept, the router's agents
(hubAgents), or else every shown agent that can take it.
- It holds through a plugin update, the plugin off and on, an edit in the
Library editor (SaveServer keeps it) and an agent's "every server"
(serversAgents with no names skips a hidden one). Ticking an agent for
it in Library › MCP shows it again (save clears Hidden).
- Library › MCP tags the server "Plugin", its tooltip pointing at Plugins.
- /mcp/magpie/tools (every plugin's tools, wired by hand) is unchanged.
- Docs: plugin-tools.md, mcp-router.md, site docs plugins (en, zh, ja).
- The core script budget is not raised: two plugins.js comments cut, the
button's tooltips and status lines left out.
Run on mote at this tree (before the site docs, html only):
- go build ./..., go vet ./internal/library ./internal/gui, GOOS=windows
go vet of both, GOOS=linux go vet ./internal/library: ok.
- go test -count=1 ./internal/library/: ok (187s).
- go test -count=1 ./internal/gui/ -run 'Plugin|Library|Budget|Script':
ok (TestCoreScriptBudget 1,533,514 of 1,533,802).
- node --test plugin-tools.test.cjs (new: the line's words, Hide and Give
posting {name, on}, the button inside its row at 980 and 420, all five
languages, Chromium and WebKit): ok; builtins, every library-mcp-* and
mcp-* file: ok.
- i18n-keys "a plugin's words are its own": red, the same three words on
origin/main
|
||
|
|
e1eeeed734 |
browser: the extension's key connects Magpie Browser and nothing else; own needs this computer; a key turned off closes its browser
|
||
|
|
650bf84128 |
docker: a daily tag that moves once a day, for Renovate
magpie releases many times a day, and YaoFur on X runs the image with
Renovate, which opened a PR on every tag ("改成每天凌晨更新一次").
Releases stay as fast as they are. ghcr.io/yetone/magpie:daily is new:
.github/workflows/docker-daily.yml points it at :latest's image once a
day, at 20:00 UTC (04:00 in China), by digest, as docker-stable.yml does
for :stable. It never builds, and touches no other tag; a click on Run
workflow moves it too. A Renovate user follows daily with its digest
pinned and gets at most one PR a day; stable is still there for one a
week.
The docs name it: the Tags row and the Updates line of the Docker page in
en, zh and ja, and the Docker section of docs/reference.md.
site/docker-tags.test.mjs holds that the three languages name the same
floating tags with daily among them, that a workflow writes each tag the
docs name, and that daily has one daily schedule, copies latest and
builds nothing.
The desktop app is unchanged: it already checks every 6 hours by
default, and Settings > About offers Check every 24 h and the Stable
channel (one a week).
Run (mote): node --test site/*.test.mjs, 90 of 90 ok; without the
workflow and the docs, two of docker-tags' three tests are red.
actionlint on docker-daily.yml and docker-stable.yml: clean. No Go file
changed; go test ./... -timeout 45m runs on the Linux box (wsl-run) at
this tree, since mote had another session's full suite running.
Not tried: the workflow itself before this push; it is run once with
workflow_dispatch right after it.
|
||
|
|
6909c0fe55 |
site: the sponsor test takes the README's Markdown link to Kimi
|
||
|
|
483b131ef0 |
browser: magpie in Docker uses the host's own browser, through a key the page hands out
noahhrreion ran magpie in a container and its Magpie Browser never
connected. The host's Chrome dials ws://127.0.0.1:3425/v1/magpie/browser/
extension, which reaches the container from the bridge (172.17.0.1). That
is not loopback, so the gateway refused it (403). The browser MCP also
refused every caller from elsewhere, and the hub marked the browser
HereOnly. The extension's folder under the container's HOME can't be
loaded by the host's browser either.
Nothing is opened to the network without a key:
- The extension takes a gateway key: its popup has a Gateway key field,
and config.js carries KEY (extension 0.1.7). From another computer the
extension connects only with ?key= of a gateway key that is on, and
only from the extension's own Origin (checked first). Loopback is
unchanged, and a page's origin, null, a keyless call or a rebound Host
are all still refused (TestBrowserExtensionOnlyFromItsOrigin).
- A browser that connects with a key belongs to that key. Sessions are
tagged key:<id>/... (browserOwner, keyedSession), and a remote caller's
session is forced to its own key's whatever it names. The relay filters
every lookup (forSession, all, choose) through browserConn.serves. The
browser MCP admits a remote caller only with a gateway key; a web page
is refused as before.
- The key the page makes is recorded as this magpie's own browser's: its
id goes in settings.Dir()/browser-key, written temp-and-rename. This
goes by where the key came from, not by its name. A browser connecting
with it serves this computer's sessions too, so agents inside the
container use it as they would one on loopback. A record that can't be
read names no key, so no keyed browser is this computer's.
- Router: magpie mcp browser is HubServer.Keyed. A visitor from
elsewhere gets it only with a key (HubVisitor.Key), and hubCall names
its session key:<id>/..., so it reaches only that key's browser.
- GUI: a page whose browser can't reach magpie's folders (InContainer, or
a page from another computer) is "away". The Magpie Browser sheet's
button then reads Download the extension. It does a POST to
/api/library/browser/extension with the page's origin, which answers a
zip pointed at that origin (3430 passes the gateway's routes on) and
holding the recorded key's secret. The key is made the first time and
reused while it is on. The steps (unzip, chrome://extensions, Developer
mode, Load unpacked) are shown in every language. It is a POST so that
a link from another site can't mint a key.
- Docs: reference.md (Docker), subsystems/library.md and mcp-router.md,
and site docker.html in en, zh and ja.
Run, at this tree rebased on origin/main
|
||
|
|
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 |
||
|
|
f285426ac2 |
library: the MCP router turns on with no agent, and in gateway mode
treeman_26897 on Discord runs magpie as an MCP entry point for remote clients on a server with no agents. The router could only be turned on from the Library, and the Library said "No agents to write to" with no agent. In gateway mode (magpie web on a headless server, on by itself with no agents) GATEWAY_HIDES left the Library out altogether. The router's switch also showed only once a server was in the library. The gateway and `magpie library mcp router on` had no agent gate: the gate was the page's alone. Now, with no agent to write to, or in gateway mode (where no agent is shown), the Library is its MCP tab alone (`agentless` in client.js): - servers without agent chips, found servers or projects; - the router's switch, there before the first server too; - its lines and status say any app connects at its address, the router is on or off; - the servers it serves are checked once it is on; - Connect… has Other apps alone, with the gateway key line. Gateway mode hides only Agents now. The two keys of the empty state are gone; the gateway-mode subtitle no longer says "no Library". Remote use goes through the guard /v1 has, unchanged: lanGuard and serveMCP. TestHubMCPRemoteEntryNeedsKey holds /mcp/magpie/hub to it from another computer: not shared 403; shared with no key 401 (no Origin, tools/list, a wrong key); Origin null, chrome-extension://, file://, moz-extension://, a foreign site and another computer's page refused from there and from here; a rebound Host with a browser's marks (Origin = Host, Sec-Fetch only, a Mozilla UA) refused from here and there; a proxy or tunnel here (X-Forwarded-For, Cf-Connecting-IP) with no key refused; nothing ran for any of them; with the key it runs, through the proxy too. Run on mote at ef20ff690 (on origin/main |
||
|
|
e17c6976b2 |
provider: Voyage AI preset, its embedding and rerank models (heatonz on Discord)
heatonz on Discord asked for Voyage AI, its embeddings and rerank. The gateway already had /v1/embeddings and /v1/rerank; what was missing was a way to add Voyage and have its models found there. - presets.go: `voyage`, a vendor with an API key at https://api.voyageai.com/v1 (docs.voyageai.com, keys at dashboard.voyageai.com). Voyage has no /models, so it is NoList and the preset names its models in two new PresetDef fields, Embeddings (voyage-4-large, -4, -4-lite, code-4, finance-2, law-2, 3-large, 3.5, 3.5-lite, code-3, code-2) and Rerankers (rerank-3, -3-lite, 2.5, 2.5-lite), as Voyage's docs list them on 11-06. Region gets Rerankers too. - models.go: planMedia marks each plan model with what it serves (catalog.Model.Serves), falls back to the preset's own lists when the provider has no region, and PlanRerankers / PlanRetrieval(kind) sit beside PlanEmbeddings. A NoList provider's ListAll has them too, marked, so catalog.Chat keeps them out of agents' lists, keys and Routing's chat pickers. - gateway: resolveRetrievalModel and servesKind look up the kind asked for (PlanRetrieval(kind)) and not only embeddings. Before this, a plan's embedding model named on /v1/rerank was sent there, and a plan's reranker was never found. - catalog.ServesOf: `voyage-*` is an embedding model (its ids have no "embed"), so Test, detection and a relay serving voyage ids know it. - test.go / gui providers.go: the retrieval-only Test fallback and the editor's "retrieval" count read PlanRetrieval as well. - docs/reference.md: a new "Embeddings and rerank" section with both routes' bodies (OpenAI's for embeddings; the Cohere/Jina/Voyage shape for rerank, top_n or top_k) and the Voyage preset. READMEs and the import docs pages (en, ja, zh) list it. Not served: Voyage's contextualized and multimodal embeddings (their own endpoints). A Voyage 4xx comes back as its raw {"detail": ...} body with its status (errorSaid has no "detail" reader). Tests (no network; a fake built from Voyage's documented request and reply shapes): TestVoyageEmbeddingsAndRerank (bare and provider ids, input_type/output_dimension and top_k/return_documents passed on, usage total_tokens recorded), TestVoyageModelsStayOnTheirRoutes, TestVoyageRefusalSaysWhy, TestVoyagePreset, TestVoyageTestAsksItsRetrievalAPIs, TestServesOf's voyage cases. Run on mote: go test -count=1 -timeout 45m ./internal/provider ./internal/catalog ./internal/gui ./internal/gateway. provider, catalog and gateway ok. gui has one red, TestMainWindowCorners/macOS_26_SDK, which is #3949 (red on macOS 27); this change doesn't touch AppKit. go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... ok. gofmt -l clean. Broken by hand: - resolveRetrievalModel/servesKind back on PlanEmbeddings: TestVoyageEmbeddingsAndRerank red (rerank-3: 404 "magpie knows no model"), TestVoyageModelsStayOnTheirRoutes red (voyage-4 on /v1/rerank answered 200). - the voyage- prefix out of ServesOf: TestServesOf and TestVoyagePreset red. Not tried: against the real API. No Voyage key was available, so the endpoints, auth and shapes come from Voyage's docs alone. Not tried in the GUI's Add sheet by hand, and not on Windows or Linux beyond vet. |
||
|
|
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. |
||
|
|
1fd02d33ce |
agentplug: an agent plugin can pick the model its agent starts on in a second file (str_, PiG)
str_ on Discord (#help, v0.1.3005): PiG's row on the Agents page only
switched the model list on, where Pi's picks the model it starts on.
PiG, like Pi, keeps its providers in ~/.pig/agent/models.json and the
model a session starts on in settings.json (defaultProvider,
defaultModel; PiG's docs/site/docs/settings.md, startup_model.go). An
agent plugin could name a model key only in the one file connect
writes, so agent-pig 0.1.0 had to be connect-only.
An agent's descriptor can now say `startup: {config, format, model,
keys}`: the other file, the key that holds the model (the id without
magpie's prefix) and keys written beside it. With it the row gets a
model field as a built-in's does. Picking one of magpie's writes
connect's keys into config and the model and keys into startup.config,
each key kept aside as before; a model of magpie's picked in the agent
itself still reads as magpie's; a model of the user's own picked there
while magpie's provider is listed counts as connected (Beside), not
drift, and is kept on disconnect. Sync rewrites the list and leaves the
startup model where it is. Off, or `magpie <id> default` with the plugin
gone (RestoreGone), puts both files back. startup without connect, beside
agent.model, in config's own file, or naming the model key among keys
is refused. An older magpie ignores the field, so agent-pig 0.1.1
(plugins repo) stays connect-only there. Every other agent plugin
already names its model in its own config; pig is the only
connect-only one.
Run (mote):
- go test -count=1 ./internal/agentplug/: ok
- go test -count=1 -run 'TestPlugged|TestPlugin|TestRestoreGone|TestAgent'
./internal/agent/: ok
- go vet, GOOS=linux and GOOS=windows go vet of both packages; gofmt -l
clean
- the four TestPluggedStartup* tests on the old code: red (the row had
a provider field and only listed models)
- real PiG 0.5.3 (darwin-arm64 release, SHA256SUMS checked) in a sandbox
HOME, models.json written by agent-pig 0.1.1's own connect and
settings.json as startup writes it, against a fake OpenAI server:
`pig -p` sent model deepseek/flash with the gateway key. With an
enabledModels scope that leaves it out, PiG started on the scope's
first model (said in the plugin's README).
Broken by hand: no startRestore in Unwire (TestPluggedStartupModel and
OwnPickKept red); no Beside (OwnPickKept red, "wired false").
Not tried: the GUI and the TUI with the real row (app.js unchanged; the
row is the model field every built-in has), Windows and Linux runs of
PiG, a real magpie gateway in front of PiG, a real vendor model.
|
||
|
|
ed7aeb052f |
plugins: a package that declares magpie.agent is an agent, with a main or without (plugins#737)
miaocell's magpie-agent-deva ships a Bun module as its main beside its moejs agent file (deva.agent.js), because the agent needs a runtime. The market's GitHub list decided the kind by whether a main was there, so it listed the package under Providers, and the Installed row wore a Provider chip and a provider logo though the module serves no provider. Now readTagged gives Kind "agent" to any package that declares magpie.agent; middleware, page and hooks still need no main to be that kind. The file looked for in the repository is still the module Bun loads (its main), or the agent file when there is no main. The Installed row of an agent plugin wears Provider only when its module serves a provider, and its logo is the agent glyph unless it does. The moejs descriptor contract is unchanged. The community registry.json already gives kimi-desktop and reasonix-desktop (both with a main) kind agent; the plugins repo's check now fails an agent package listed as any other kind. Docs: docs/reference.md, docs/subsystems/provider-plugins.md, and site/public/docs plugins.html in en, zh and ja say an agent that needs a runtime keeps its agent file and adds a Bun main, and is listed as an agent either way. Run (on mote, at this head rebased on |
||
|
|
18726b9fb6 |
statusline: a held key is told how to see its line, ?format=json, and /v1/magpie/limit says what holds a key (steven_4422)
steven_4422 (Discord, #feedback): POST /v1/magpie/statusline answered 403
gateway_key_held to a key held to Claude's models, while GET
/v1/magpie/limit told the same key {"limited": false}. They asked for the
line scoped to what the key may use, /limit to agree, and a JSON line for
claude-hud's external usage snapshot.
The scoped view already exists (#2216): the status line goes through
scopeQuotas like the quotas routes, so a held key its owner turns Quotas
on for (Gateway -> Gateway keys, or `magpie gateway-key quotas <id> on`)
is told the accounts it may use of each provider whose every model it may
use, and nothing else. Its 403 never said so. Decision: the switch stays
the gate for every held key, budget, models or accounts alike. What holds
a key says nothing of whether its holder is the owner or a friend (#1981
was a friend's budget key seeing every account's email), and only the
owner knows that, so a model- or account-held key is not told quotas by
default either. The every-model rule of #2216 stays.
- scopeQuotas' refusal (heldQuotasOff) names the switch and what it then
tells. heldRefused, for the routes the switch doesn't open
(concurrency, trace, a card outside the scope, writeCards' told-none),
is unchanged.
- GET /v1/magpie/limit tells a held key heldTo (budget, models,
accounts), models, quotas and, with it on, quotaProviders (the
providers newQuotaScope tells it). No account is named. `limited`
keeps its meaning (the budget) for remote magpies that read it.
- ?format=json on the status line: {"text", "model", "accounts"}, the
cards the line shows in /v1/magpie/quotas?kept=1's shape (windows'
used, resetsAt), through the same scope.
- Docs: reference.md, integrating.md, gateway-routing.md; site docker
and remote pages in en, zh, ja.
Run at this head (
|
||
|
|
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.
|
||
|
|
cbb09383fb |
plugin: a GitHub-tagged package's card says its own name and summary (#3608, plugins#394)
MYCF711's #3608 (and plugins#394): a repository tagged magpie-plugin outside the community's list showed its repository's name and GitHub's description on its card under Discover → Unofficial, on GitHub, whatever its package.json said of itself. Ported from MYCF711's 1cc337001. Now readTagged keeps package.json's magpie.name (ownName, as main's row already does since |
||
|
|
8a80796805 |
gateway: the native route passes any path of a keyed provider's own API on, at its host
axelburks (Discord #feedback) asked for /v1/magpie/native/<provider>/... to reach the whole of a vendor's API, not only Ark's image and video task paths. Now GET, POST, PUT, PATCH and DELETE of /v1/magpie/native/<provider>/<path> go to the provider's host at /<path> (not under the base's /v1 or /api/v3), with the query and body as they came and the answer streamed back as it comes. Guards: - API-key providers only (nativeKeyed): no subscription, OAuth or plugin account, no remote magpie, no Vertex. 403 otherwise. - The gateway's own guards as every route: lanGuard's Host check, corsGuard (foreign Origin, null, *.localhost without a key), a key beyond loopback, read-only keys refused (PUT/PATCH added to readOnlyRefused), and a key held to models/accounts/limits refused (nativeHeld, as before). - nativeTarget refuses an empty path, "." / ".." segments (encoded too, across %2F), a backslash, a (encoded) leading slash, "://", a scheme-like first segment, and any URL whose host or scheme parsed back isn't the base's. 400, vendor not asked. - The caller's Authorization, x-api-key, api-key, x-goog-api-key, Cookie, ?key=, Origin/Referer/Sec-*/X-Forwarded-*/Cf-*, hop and X-Magpie-* headers are dropped; Sign puts the provider's key in the way it takes one. Set-Cookie, Alt-Svc and HSTS don't come back. - With masking on, a JSON body is masked (fails closed) and restored in the answer; a non-JSON body is a 415. Only a masked request's answer goes through restoring; every other answer streams in 32KB reads, never held whole. - Each request is a Requests row and a usage record (Operation "native"), with tokens when a JSON or SSE answer reports them. - Ark's short paths (nativeArkPath) keep their old code path, under the key's base, unchanged (nativeArk). Docs: gateway-routing.md (table row, native route section), reference.md (path table + paragraph), integrating.md, site integrate.html en and zh. Run (mote, darwin arm64, Go 1.26.8): - go test -count=3 -run 'Native|ReadOnly' ./internal/gateway: ok - go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., gofmt -l: clean - Rebased on origin/main |
||
|
|
f44fa2ef6a |
sessions: gateway mode lists only the gateway's sessions, never this computer's agents' files
paultian on Discord: magpie web in gateway mode, on a machine with Claude
Code and Codex installed, listed that machine's own sessions beside the
ones other computers sent through it. Owner's call (via the lead): keep
Sessions in gateway mode, scope it.
- sessions.OwnOff (set by the gui to ownSessionsOff): while it holds,
currentReads answers "none", Found and Dirs are empty, the trash lists
and restores/purges only what the gateway kept, and moving Claude
Code's folder is refused. Every route built on Reads follows: the list,
one, transcript, markdown, export, stats, overview, search, manage,
delete, carry, Usage's agent-file calls. Gateway-recorded sessions
(ledger projection, recorded conversations) are not behind the gate.
- ownSessionsOff: magpie web's page, and Settings' gateway mode On, or
Automatic with --gateway or no agents found (looked at once per 30s,
and again on another HOME/PATH). A turn of the answer resets the
sessions' caches and stats; the gateway-mode route does it at once.
- /api/sessions/reads says gateway:true: the page asks nothing, its empty
state names the gateway's sessions (en/zh/zh-TW/ja/de), and Settings ›
Privacy leaves out Agents' session history.
- The gateway-mode subtitle (5 languages), docs/reference.md and
site docs/docker.html (en/zh/ja) say Sessions stays and what it lists
(they said there was no Sessions tab, which was already wrong);
docs/subsystems/gateway-sessions.md has the design.
- Tests: Handler marks the process as magpie web for good, and 13 tests
served magpie web's page, so a later test's sandbox could be in gateway
mode by itself. webPageHandler ends the mark with the test, and
TestWebPageHandlerEveryWhere fails on a direct Handler(webHost{...}).
Ran (mote, at this tree rebased on origin/main):
- TestGatewayModeListsNoOwnSessions: red on the old code, green now.
- gateway-mode-sessions.test.cjs: chromium + webkit, en 900/390, zh,
zh-TW, ja 420, de 390: 36/36; red on the old client.js (every case).
- GUI files the change reaches (gateway-mode*, sessions-*, session-*,
privacy-*, usage-sessions-*, i18n-keys), both engines: 657/657.
- TestCoreScriptBudget ok.
- go test -shuffle=on ./internal/gui ./internal/sessions: sessions ok;
gui ok but TestMainWindowCorners/macOS_26_SDK, red the same on
origin/main
|
||
|
|
83bdfe70d2 |
otlp: OTEL_RESOURCE_ATTRIBUTES and OTEL_SERVICE_NAME name the server a trace or metric came from (#5167)
Several magpie servers exporting to one collector or to Langfuse all sent
the same resource, service.name=magpie alone, so nothing said which server
an event came from. Both signals' resource now merges the standard
OTEL_RESOURCE_ATTRIBUTES over that default, and OTEL_SERVICE_NAME over
that (otelResourceAttributes in internal/otlp/otel_resource.go). Nothing
about the machine is looked up; only what the user set is sent. Neither
variable turns export on.
Ported from reyoung's 7ed03b819 (feat/otel-resource-attributes, base
|
||
|
|
d1fa254b1d |
gui: masked words and Never mask are a list, a row per word (noahhrreion on Discord)
noahhrreion: "希望脱敏词选项可以做成真正的列表,在一个小输入框里面不方便管理多个脱敏词". Settings → Privacy's Masked words was one comma-separated box. It is now a list (wordList in plugins/redact/settings.js): each word is its own row, edited in place (Enter or leaving the row saves, Escape puts it back, emptied is removed), × removes it, and the last row adds. Its sibling, Never mask under the mask actions, had the same box and gets the same list. Stored values are unchanged: redactWords and the allow list are still string arrays, saved through the same savePrefs / settings/redact-allow calls, and nothing is rewritten on open (the new test checks that opening the page saves nothing). Typed or pasted text splits as the old box did (, , and newlines, trimmed, empties dropped), so a pasted "a, b" is two rows. The Hide eye still shows every row as dots. New strings are in the redact plugin's i18n for zh, zh-TW, ja and de; the two old "separated by commas" hints are gone from the core i18n. The site's masking docs (en, zh, ja) say a row each. Run (on mote via mote-run, Chromium and WebKit): - new redact-words-list.test.cjs: 5 languages × 1100/400px × both engines, draw, add with Enter, paste-split, edit, Escape, ×, empty-and-Tab, reload; with i18n-keys 24/24 ok - redact-words-hidden, any-case, whole, mask-actions, redact-route, redact-kinds, redact-shape, settings-search, settings-sections, settings-lines-wrap, settings-hints, settings-groups, readable-focus, masking-records, mask-alert: 378/378 ok - go test ./internal/gui/ -run 'TestCoreScriptBudget|TestSettings': ok (app.js shrank; no budget raised) - screenshots light/dark, 1100/400px, both engines, looked at Broken by hand: without wordFocusBack (focus kept across a redraw) the new test goes red (waitForFunction timeout after the first add). Dropping the blur guard during a redraw (wordsRedrawing / isConnected) stays green in both Playwright engines, which fire no blur on removal; it is kept as a guard for engines that do, with no test that fails without it. Not tried: the real app on WebKitGTK / Windows WebView2; no Go files changed. |
||
|
|
0e1054ce19 |
statusline: the gateway serves Claude Code's status line to another computer (steven_4422)
steven_4422 (Discord) runs magpie in Docker and Claude Code on the host.
The status line square writes the host's settings.json, which the
container can't reach, with a command naming a binary inside the container.
GET or POST /v1/magpie/statusline answers the line `magpie statusline`
prints, as text/plain, so the host needs only curl:
curl -fsS -m 1 -H 'Authorization: Bearer <key>' --data-binary @- http://<host>:3425/v1/magpie/statusline || true
Claude Code's stdin JSON (session_id) adds the model, as /v1/magpie/route
does; ?session= and ?only= work too. The renderer moved to
provider.StatuslineText, shared by the CLI and the endpoint. A caller that
isn't this computer needs a gateway key (lanGuard, unchanged; the handler
also refuses a non-local caller without one). A read-only key is allowed
(GET and POST in readOnlyRoutes) and gets the windows without the model; a
key held to budget, models or accounts sees only its own (scopeQuotas).
corsGuard and origin checks are untouched.
magpie web shows the command in Settings -> About (en, zh, zh-TW, ja, de).
Docs: reference.md, agent-wiring.md, gateway-routing.md, docker pages en/zh/ja.
Run at this head (rebased on
|
||
|
|
6c201095d8 |
gateway: in Docker, other containers on the host are shown the host's Docker bridge address
jiezhengj (Discord #feedback) runs magpie in Docker on a NAS at 192.168.31.218. The web UI's host address, http://192.168.31.218:3425, works for other devices. Other containers on the NAS couldn't use it, and not the container's own 172.17.0.x either. What works for them is the host's Docker bridge address, http://172.17.0.1:3425. On Linux, host.docker.internal is there only in a container given extra_hosts. magpie showed no such address. - gateway.ContainerHostURL: in a container on a bridge network, the gateway of /proc/net/route's default route (172.17.0.1 on the default bridge, a compose network's own otherwise), on the gateway's port. It is "" outside a container and on the host's network (`network_mode: host`, told by the host's docker0/br-*/veth*/podman* interfaces). In that case ContainerAddrs is false too, since the addresses are the host's own. - The GUI gets it as /api/providers' gateway.containerHost, /api/settings' lanContainerHost and boot's sideGateway.containerHost. - settings.js lanShown is fed by the new gwLAN(g) for Gateway, Connect, the sidebar and the key page. Each case lists: - Opened at the host: the host's address first, then the bridge address, labelled "Other containers on this host". - At localhost: the bridge address alone, with that label, and a line that the host's own is MAGPIE_PUBLIC_URL's. - No default route: as before. The container's own 172.17.0.x is no longer offered beside them. The sidebar line and the key page prefer an address other machines reach. The scheme comes from the URL, not a hard-coded http. Three new strings are in zh, zh-TW, ja and de. - CLI: `magpie web` and the share banner print "other containers on this host <url>". - docs/reference.md and site docs/docker (en, zh, ja): the log example and a new "Other containers on the same host" paragraph. Run on mote, at this change on |
||
|
|
d8501848a7 |
gateway: an Ark image request's own fields go to Ark, and watermark and response_format are the caller's
axelburks on Discord listed what /v1/images/generations did to a Seedream
request against Ark's images API (docs 82379/1541523). Checked against
those docs and draw.go / draw_volcengine.go; the real ones:
- Image params were dropped. drawing read OpenAI's fields alone, so
sequential_image_generation and its options (a group of up to 15),
optimize_prompt_options, tools, layer_decomposition and every other
Ark field never reached Ark. Now the request's fields magpie doesn't
read (drawingRead) are drawing.Extra, from a JSON body or a multipart
form, masked as the prompt is (fails closed), and sent to Ark as they
came; a form's values are typed as Ark takes them (formValue, with
Ark's text fields kept as text). layer_decomposition with an image
needs no prompt.
- watermark and response_format were forced. Every request went with
watermark false and response_format b64_json. Now watermark false is
magpie's default only, and a caller's watermark wins; response_format
"url" asks Ark for its URL and answers it, anything else still asks
b64_json.
- stream true would have gone to Ark and come back as events this route
can't read: it is a 400 that names
/v1/magpie/native/<provider>/images/generations.
Kept as it was: n stays OpenAI's, that many requests, each one image or
one group.
Tests: TestArkImagesPassOnTheirOwnFields (a group, optimize_prompt_options,
a caller's watermark, tools and url reach Ark as sent; a form's fields
typed; stream refused naming the native route). Docs: gateway-routing.md
(the Ark images row and paragraph), docs/integrating.md and the site's
integrate page (en, zh) on the vendor fields and the native route.
Run on mote at the head of this stack (the Ark video fields, the native
route and the Ark image fields, three commits on
|
||
|
|
af9ac3d25d |
gateway: /v1/models lists image and video models when ?kind= asks for them, chat models alone by default
axelburks on Discord asked that /v1/models return the image and video models too, so a client can find them. It listed chat models alone, with no way to ask for the others. Decided: they are listed only when asked for, with ?kind=image,video (or ?kind=chat,image,video, or ?kind=all), each row marked "kind": "image" or "kind": "video". Without ?kind= the list is the same chat list as before. Why not add them by default: - Agents and clients offer every id this list gives as a model to chat with: OpenCode's and Cherry Studio's model lists, ZCode's and others' pasted ?format=text. An image or video id there would sit in their chat pickers and fail on the first message (an image model on /v1/chat/completions). - OpenAI's own list mixes gpt-image and sora in with nothing to tell them apart, so a client has no field it would already read to skip them. - magpie's own callers that want them already ask (another magpie's drawers header, kind=image/video/decision on the MCP list); ?kind= gives any other client the same. An unknown kind is a 400 that names the kinds, not read as none. A gateway key held to models or accounts sees only its own image and video models, as on the chat list (drawerObjects/videomakerObjects already check modelAllowed and accountServes). Unticked image and video models (HiddenDrawers, HiddenVideomakers) are left out. TestModelsListMediaOnlyWhenAsked: the default list and ?kind=chat have no image or video row (so no agent's chat picker that reads it can offer one), ?format=text likewise; ?kind=image / video / image,video / all give them, marked; a bad kind is 400. Docs: docs/integrating.md, providers-accounts.md, site docs (en, zh). Run on mote, this change rebased on |
||
|
|
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 |
||
|
|
441a2b6b16 |
plugin: a cancelled sign-in saves nothing, and a failed authorize says why (#5016)
Found reviewing magpie-community/plugins#658 (AStudio's and Agnes Code's
sign-ins wait up to 5 minutes for the vendor's desktop app).
Cancel didn't end a plugin sign-in. The window's Cancel (and the sign-in's
timeout) ended plugin.Finish's context, but "callback" was not a
cancellable call, so the host never heard: the plugin's wait went on, and
a session file written after Cancel still saved the account. Now
authorize, callback and apiKey are cancellable as gatewayRequest is
(host.go `cancellable`): magpie writes `abort`, host.js (`signInSteps`)
drops whatever the plugin answers after it, so nothing is saved, and
counts the call done at once. The plugin's wait is told too: every fetch
it makes for the sign-in carries the sign-in's signal
(`whileSigningIn`), and magpie's hook passes the signal as
callback(code, { signal }) / authorize(inputs, { signal }), which OpenCode
doesn't, so a plugin can stop polling a file. A plugin that ignores the
signal keeps running until its own deadline, but its answer is dropped.
An oauth method's authorize that returned { type: "failed", error } (no
callback) was stored and its missing callback called, so the user saw
"s.a.callback is not a function". host.js now answers that, or any result
with no callback, as the sign-in's failure, and plugin.Authorize returns
ErrFailed with the plugin's reason, for auto and code methods; an api
method's authorize already did. The GUI's start shows it as its failure,
`magpie plugin login` prints it.
Docs: provider-plugins.md, and the plugin guide (en, zh, ja) on failing
from authorize and the signal.
Not changed: #3083's timeout field, #4678's model/usage task lifetime.
Tests (testdata/signinend, no network; the vendor is testenv.FakeVendor):
TestCancelledSignInSavesNothing, TestCancelledSignInEndsThePluginsWait,
TestCancelledSignInEndsItsFetch, TestSignInFailsWithThePluginsReason
(internal/plugin), TestCancelledPluginSignInSavesNothing
(internal/provider, through StartPluginSignIn/CancelSignIn).
Run on mote (macOS 27), at this change on
|
||
|
|
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
|
||
|
|
1747559d02 |
plugin pages: name the scheme in a browser's policy, and the service's 'self' (#4198)
In `magpie web`, iOS Safari (18.7) loaded none of a plugin page's scripts: pagePolicy named the page's folder as a scheme-less host-source (host/_magpie/plugin/<tok>/), a sandboxed frame's origin is opaque, and that WebKit took the missing scheme from it, so the bridge never said hello and the page was broken at 10s (orinsid; YangHonghang on v0.1.2681, young02036 on Discord). - pagePolicy: a browser's policy now names the folder under both https:// and http:// (ownSources). Behind nginx or Cloudflare TLS ends before magpie and nothing magpie trusts says which scheme the page came over, so X-Forwarded-Proto is not read; both name the same host, port and folder, and an https page can't load http:// files anyway. The desktop window keeps its own transport alone (wails://, http:// on Windows, #2501). - The second layer (YangHonghang): a page's local service sends its own policy, `connect-src 'self'`, and what it sends runs under magpie's `sandbox allow-scripts`. In WebKit, 'self' there didn't match the service page's own fetch of api/x. servePageService now names the service's root (/_magpie/plugin/<tok>/_magpie/service/) under both schemes after each 'self' in a CSP header the service sends, plus ws:// and wss:// in connect-src and default-src (serviceSelf). 'self' stays, so nothing allowed before is taken away. A <meta> policy isn't rewritten; the plugin docs (en, zh, ja) say to write whole sources. Run at f0a723d4c's tree (rebased on |