f2eb56c6bbde1300dddc402861b59cd4e45e0215
178
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b62fa332f3 |
provider: Send requests unmasked for subscriptions and plugin providers too (isee1_1)
isee1_1 on Discord uses a community translation plugin as a provider and asked why "Send requests unmasked" (请求不脱敏) isn't offered for it. |
||
|
|
7bc602236b |
library: the MCP hub is called the MCP router
The owner asked why it was a "hub". Composio calls the same thing a Tool Router; "router" says what it does (one server that routes each call to the right one), and "gateway" is taken by magpie's LLM gateway. Only the words change: MCP router / MCP 路由 / MCP 路由 / MCP ルーター / MCP-Router, "Router address", and the CLI's `magpie library mcp router on|off`, where `hub` still works. The URL /mcp/magpie/hub, the mcpHub setting, the servers/hub API and the Go names stay, so nothing a user or an agent config holds changes. docs/subsystems/mcp-hub.md moves to mcp-router.md and the pages that link it follow. #4382's new words follow too: "Through the MCP router", "Not through the router" and their hints in every language, and the CLI's `magpie library mcp router <name> shared|direct` (`hub` works there too; library_hub_test.go says router for direct, hub for shared). Run at e2583df31 (this stack on |
||
|
|
a45a0f1c5d |
signin: Settings can keep sign-in pages out of the default browser (max2020)
max2020 on Discord signs in from a separate, fingerprint browser so the vendor never sees their default one. Every waiting sign-in already shows its link with Copy link (since |
||
|
|
3b5dccd527 |
accounts: a plugin account goes by its usage's name, not its id (#4416)
A Huawei Cloud CodeArts account is kept by its accountId, an IAM id (iam::<domain>:user:<name>), and every list showed that id while its quota card showed the masked phone the plugin's usage() names it by. Display only: an account now reads as the name the user gave it, else the `user` its plugin's last usage read gave (PluginUserOf: the in-memory read, else quotas.json), else its id. The id stays the key everything is kept by; nothing stored changes or migrates. A read that fails keeps the last good name; nothing read yet is the id, never blank. One rule in provider (AccountShown, AccountShownOf, AccountLabelOf), used by every list: cards' Alias (Usage page, tray panel, /v1/magpie/quotas, magpie quota), magpie accounts, magpie providers, the TUI's Providers rows and quota titles, usageapi's Account filter, the quota alert. The GUI gets it as /api/providers' accountUsers (accountShownOf in app.js): the editor's account rows (the id in the tooltip), the per-account proxy lines, Routing's userShown, the Providers search, Hide accounts. app.js's account lookups share one helper, so the core stays in its budget (1,536,561 of 1,536,586), with no room added. Run: - go test ./... -timeout 45m on mote at |
||
|
|
0621e70fb9 |
routing: leave a provider out of the groups magpie finds
chenxiang0010 on Discord asked to keep a provider or a model out of the auto-created routing groups. A model could already be kept out (remove its found group; magpie keeps it removed), but a provider could only be turned off per group or everywhere. Now Routing -> Groups, under "Find groups on their own", has "Leave out a provider..." (app menu, saved when it closes) and `magpie group auto skip <provider>...|none`. The providers chosen (providers.json autoGroupSkip) join no found group; a group the user made or changed keeps them, a found group left with one provider goes away, and a request for it is served by AutoStandIn from a provider still in, and agents on it are reseated (agent.Reseat). A rename carries the id along. en, zh, zh-TW, ja, de. Run at 383947fce (this change on origin/main |
||
|
|
65c7924108 |
cli: TestProviderAddressMovesALocalServer adds LM Studio in a folder of its own
The test added lmstudio in the package's shared config folder, so a
second run (-count=2 and up) found it there, added "LM Studio 2"
instead, and read the old provider back at localhost🔢 red on
origin/main
|
||
|
|
380032cda1 |
providers: Send requests unmasked is the user's switch at any address, with a caution while on for one not local (AcMilan)
AcMilan (Discord) runs a vLLM at http://llm.corp.lan:8000, and the editor never offered "Send requests unmasked": the switch showed only for a localhost, *.local or private-IP address. Asked, he said the choice should be the user's for each provider. provider.SkipsRedaction is now: Unredacted, no signed-in account, not another magpie, and at least one address. Nothing is looked up on the request path. The editor shows the row for every provider but an account or remote magpie. While it is ticked, an amber caution under it names an address not on this computer or the local network (awayHost). A name of the user's own DNS is asked about, only while ticked, through POST /api/local-hosts (provider.LocalHost -> netproxy.LocalName: every address loopback, private or link-local, 400ms lookup, kept 1 minute). That answer only words the caution. CLI help and `provider show` say the same. The 'away' i18n line is in zh, zh-TW, ja and de. To stay inside the core script budget, a few nearby editor comments were cut down (no raise). Run (logs in the worktree's logs/): - Full Go suite on mote at base |
||
|
|
995f84a0f9 |
codex: how early an expiring reset is used is a setting
A Codex reset card that would run out unused was spent 30 minutes before it expired, a fixed resetExpiryLead. Now the lead is codexResetLead in settings.json (minutes, 15 to 1440). Unset, out of range or unreadable reads as 30m, never 0, and magpie never writes it unless the user does. - settings: CodexResetLead and Settings.ResetLead(); the menu's values are 15m, 30m (default), 1h, 2h, 3h, 6h, 12h, 24h. - provider: the spend (expiringResetSpent) and routing (Allowance.Restarts, through nextResetLook) read the same resetLead(), so they still agree (#717, #718). The "near" look cadence follows it: lead + 30m, at least 1h, so a look lands inside a long lead. - GUI: Settings > Usage, under the Codex auto-use rows, a row "Codex: how early before one expires" with an app menu (no <select>), and the sub text says spending earlier loses what the windows have left. The four "before it expires" strings say the chosen lead. POST /api/settings/codex-reset-lead; the general save keeps the field. en, zh, zh-TW, ja, de. - CLI: magpie quota auto-reset lead [30m|3h|<minutes>|default]. - app.js budget: the auto-use rows moved out to lazy autoresetown.js (painted in the same draw once loaded), so app.js and the core script stay under their budgets with no raise. The button sizes to its widest label (a grid of every label), so picking one never rewraps the row. Run (all on mote through mote-run): - go vet: darwin, GOOS=linux -tags nogui, GOOS=windows; nogui build. - go test -tags nogui -timeout 45m ./... at 3955adccf (this change before the paint and sizer fixes, which touch only GUI assets): 81 ok. go test ./internal/gui at this head: ok. - GUI, Chromium: codex-reset-lead, codex-auto-reset, codex-auto-reset-settings, segs-press-redraw, i18n-keys: 62/62. WebKit: every case of those files failed at browserType.launch (180s timeout) before a page loaded, both runs; mote's browser launches hang under #4125 (load ~26), so WebKit is not run. - Rebased onto |
||
|
|
b889ffe813 |
library: a server can stay each agent's own entry with the MCP hub on (#4382)
cuipengcx90's #4382, Option A's first step (nifengfanpan asked on Discord): with the MCP hub on, every Library server went behind magpie's one entry, so a server that reads its project from the folder it starts in, or keeps a session's state, resolved the wrong repository or shared state across agents. A server now has a hub policy, Server.Hub ("hub" in library.json): "" (shared, the default, so nothing changes for existing users; "shared" is saved as "") or "direct". A direct server is left out of the hub through inHub, the test that already keeps magpie's own image server out, so each agent given it keeps its own entry written as with the hub off, beside the hub's entry for the rest. An agent whose every server is direct gets no hub entry. The hub neither lists nor runs a direct server, at /mcp/magpie/hub either, and hubPrune ends one it held. Switching goes through change(), so the agents are written again at once and the entry from the other policy is removed. An unknown policy is an error. - GUI: with the hub on, the server editor has a "Through the MCP hub" switch (role=switch, not a <select>; not shown with the hub off or for the image server), a direct server's row has a "Not through the hub" tag, and the hub's line and the Connect sheet name the direct servers with the image server as given directly. Strings are in zh, zh-TW, ja and de ("MCP 聚合" as the core uses it). - CLI: magpie library mcp hub <name> shared|direct (ServerHub), and magpie library marks a direct server. - TUI: an edit keeps the policy. - Not done: Option B (per-roots/project backends behind the hub, keying hubPool by roots). It is left for later; #4382 stays open for it. Run: - TestHubDirectServer (internal/library) and the extended TestLibraryMCPHub (internal/cli) on mote. Broken by hand: inHub back to !isSelf(s) makes TestHubDirectServer red ("codex with the hub on: [magpie], want [index magpie]"). - Real configs in a sandbox HOME on mote (fake claude on PATH, the real binary built from this tree): mcp add index + web for claude and codex, hub on, hub index direct, shared, then both direct. The direct index entry was in .claude.json and .codex/config.toml beside magpie's; with every server direct both files were byte-for-byte as with the hub off (json.tool diff and diff); shared again removed the index entry. - Full Go suite (-tags nogui -timeout 45m ./...) on mote at this tree rebased on origin/main |
||
|
|
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 |
||
|
|
d99e213f5b |
codex: an account switch restarts nothing while Codex's provider takes no ChatGPT account
danzi002 on Discord: with requires_openai_auth = false on Codex's provider,
switching the Codex account in magpie still restarted the Codex app's
app-server and said the app and daemon were left on the old account.
Codex's provider with no requires_openai_auth = true goes by no ChatGPT
account: codex-rs ModelProviderInfo::account_state answers no account, and
resolve_provider_auth sends the table's key, never auth.json. So which
account auth.json holds is nothing a running Codex uses.
- provider.CodexNoAccount (set to agent.codexNoAccount): the config's top
model_provider is not openai, has a [model_providers] table, and the table
doesn't say requires_openai_auth = true. A profile, the built-in provider,
no table or an unreadable config count as false (may use the account).
- codexAppStep forgets a switch (and a spent switch) while it holds, so the
app-server is left running; a route change still restarts it.
- CodexAppStale / CodexDaemonStale say nothing, and `magpie accounts`'
switch line says nothing needs restarting.
- Kept: route-change restarts (model_provider, openai_base_url,
model_catalog_json, base_url, catalog hash: read only as the app-server
starts) and the daemon's model-list restarts; and switch restarts when
magpie writes requires_openai_auth = true (ChatGPT sign-in with room).
Run (mote-run; full suite at this change on
|
||
|
|
0804f2d97d |
search: Tencent Cloud's Yuanbao Search (wsa) is a built-in search API (plugins#509)
chenjiangzi asked for Tencent Cloud's WSA SearchPro (元宝搜索). It is added
as vendor "wsa", following Doubao Search (
|
||
|
|
acbd6b11ab |
search: a search API's URL given with the path magpie adds is its base, never …/search/search (plugins#509)
chenjiangzi set Tavily's url to https://api.tavily.com/search, and magpie appended /search again. Each vendor now names the paths magpie puts after its base (SearchVendor.Paths). A url that already ends in one of them, with or without a trailing slash and in any case, is cut back to its base. This happens when it is saved (SetSearchAPI) and again when it is read (SearchAPI.Base), so an entry saved before this change works too, and so does Tavily's quota URL built on the same base. Every vendor is covered: tavily, brave, exa, firecrawl, you (both paths), deepseek, volcengine, searxng, and wsa in the next commit. A path of the user's own (/my-search) is left alone. The url= help and gateway-routing.md say so. Run on mote (mote-run), at the rebased head: - go test -run 'SearchAPI|WSASearch|Volcengine|Search' ./internal/gateway/ ./internal/gui/ ./internal/provider/ ./internal/cli/: ok - go vet -tags nogui for darwin, GOOS=linux and GOOS=windows on provider, gateway, cli (and gui on darwin): ok; gofmt -l clean - GUI (no GUI file changes; the picker reads SearchVendors): search-api.test.cjs in Chromium 4/4 ok. Its WebKit cases and searcher-pick timed out at browserType.launch (180s) on mote, where ~57 WebKit pw_run launches from several sessions hang. Not a result about this change; WebKit not run. Broken by hand: ownBase returning the URL unchanged made TestSearchAPIBaseURLWithItsPath red ("asked /relay/tavily/search/search, want /relay/tavily/search"). Not tried: a real Tavily request; the full go test ./... (to follow). |
||
|
|
70a0c387cb |
agent: a provider named magpie written by hand is the user's, not connected (JFunfunfun on X)
Pi set up by hand on a provider of its own named magpie (magpie/<model> at the gateway) read as connected in magpie: every catalog change wrote magpie's list over that provider, RenameProvider rewrote its refs, Drift offered Reconnect, and Disconnect took the provider out. |
||
|
|
f2c6831a31 |
gateway: a read-only gateway key reads quotas and usage and uses nothing (Steven on Discord)
Steven's ESP32 desk display polls magpie (Docker, on his LAN) every 15s on GET /v1/magpie/quotas and /v1/magpie/usage and never sends a model request. Only a key held to nothing was told the usage summary, so the key kept in the device's flash had to be one that could spend every account. A gateway key can now be read-only (access.Key.ReadOnly): - `magpie gateway-key add <name> --read-only`, `magpie gateway-key access <id> [read-only|full]` (`gateway-key --help` lists it; `list` has an ACCESS column), and "Make read-only" / "Give full access" in the key's menu in Gateway -> Gateway keys, with a "Read only" tag on its row. - readOnlyGuard (internal/gateway/readonly.go), after callerGuard and before withCaller/keyLimited, judges the pattern ServeMux.Handler routes the request to. A read-only key is answered GET /, /v1, the quotas, their history and cards, the usage summary and its requests, its limit and the concurrency. Every other route is refused with 403 gateway_key_read_only: every model route, count_tokens, the Responses WebSocket's upgrade, every MCP server, Codex's and Gemini's backends, /v1/models and the Ollama routes, the catch-all, the trace and route, debug profiles, and every write (usage ingest, quotas refresh). It is default deny, so a route added later is refused until it is classified. - The key is held to nothing else, so heldKey leaves it alone: it reads the usage summary and every account's quotas, as a key held to nothing does. None of those routes holds a key's secret. - The sharing key can't be made read-only, since magpie gives it to its own agents (LANSecret). Update refuses it, and the GUI item is off with why. Older versions: a magpie from before this commit doesn't know `readOnly` and treats such a key as a full one, so downgrading magpie widens the key. Tests: - TestReadOnlyKeyEveryRoute (internal/gateway/readonly_test.go) takes the patterns from the router itself (routes() records each HandleFunc). It fails when a pattern is in neither readOnlyRoutes nor its refused list. It sends every refused pattern, by each method it takes, from 192.168.1.9 and from loopback, plus a WebSocket upgrade and an unclean chat path, and expects 403 gateway_key_read_only with the upstream never reached. It checks that every allowed route answers, that no body holds any key's secret or the upstream key, that the usage summary names the other key's use, and that a full key and a key made full again still reach the model. - TestReadOnlyKey (access) covers add-key and access-key on and off, Authenticate, List, and the sharing key refused. - TestGatewayKeyCLIReadOnly covers --read-only before and after the name and beside --key, access, the list column, bad values, and --help. - gateway-key-readonly.test.cjs runs Chromium and WebKit, 1100 and 420px, in en/zh/zh-TW/ja/de. It covers the tag, both menu items and what they post, the status line, the sharing key's item off with its why, no scroll on click, no sideways scroll, no select, and no left stripe. gateway-card.test.cjs now expects the menu's 4th item. - TestClientPathCoversHandler takes the patterns from routes() instead of parsing Handler's source, which moved into routes(). Broken by hand: - readOnlyGuard passing everything: TestReadOnlyKeyEveryRoute red (103 lines, /v1/models 200 onward). - A new `POST /v1/new-thing` route in routes(): red, "in neither readOnlyRoutes nor readOnlyRefused". - The GUI item not off for the sharing key: gateway-key-readonly red 10 of 10 in Chromium. Run at the pushed head (on origin/main |
||
|
|
0911a65e7d |
agent: a catalog sync leaves a magpie provider the user wrote alone while the agent isn't connected
yyddbds on Discord: in Xiaomi MiMo they added a custom provider pointing
at magpie and picked a few models by hand. MiMo's switch on the Agents
page was off, yet after an update the provider held every one of
magpie's models. SyncCatalog runs at each start and update and on every
catalog change, and MiMo Code's Sync (openCodeLike) brought any
provider.magpie block up to the catalog whether magpie wrote it or not.
magpie's default went over a list the user set.
An Agent whose Sync does nothing but keep a block of magpie's name up
to the catalog is now ListOnly, and SyncCatalog runs it only while the
agent is Wired, which is what the Agents page's switch shows. The same
sync was in every sibling, so ListOnly is on all of them: openCodeLike
(OpenCode, MiMo Code and their WSL forms), piLikeKeyed (Pi and forks),
Goose, Crush, Air, AtomCode, Command Code, Droid, Fx, jcode, Kimi,
MiniMax, Mothx, omp, OpenChamber, OpenClaw, OpenPencil, Penguin, Qwen
Code and T3 Code. Left out on purpose: Codex, Claude, Grok and Hermes,
whose Syncs also repair while not connected (Hermes keeps its bots'
magpie provider current) and have their own gates.
Trade-off: a list magpie wrote while connected doesn't follow the
catalog while the agent runs a model of its own (switch off); it does
again once a model of magpie's is picked. Users whose list was already
written over: magpie keeps no copy of the old list, so it stays full;
from this release on it is left alone, and they trim it once by hand
(or connect the agent in magpie and use its model list's Pick).
Tests: TestCatalogSyncLeavesAHandWrittenMagpieBlock (MiMo, Pi and Crush
with a hand-written magpie block stay byte for byte; connected, MiMo's
list follows the catalog; disconnected and written by hand again, left
alone; a magpie model picked in MiMo, followed again).
TestListOnlyAgentsReadConnected: every ListOnly agent magpie connects
reads as Wired (n >= 15), so none of them loses catalog updates.
Fixtures of TestSyncCatalogRewritesAgentLists,
TestModelNameAndLevelsReachAgentFiles, TestSuffixModesReachAgentFiles
and TestPiKeepsTheirKeysInMagpiesProvider, and internal/cli's
TestSaveAnswersBeforeTheAgentsSync (its Pi settings were {}), now have
Pi connected (settings.json defaultProvider magpie), as a block magpie
wrote implies.
docs/subsystems/agent-wiring.md says the rule.
Run (mote, sandbox HOME via the tests' syncHome/codexHome):
- old code + the new test: red (MiMo, Pi, Crush written over; after
Disconnect written over).
- broken by hand: ListOnly dropped from openCodeLike: red on MiMo
(lines 52, 82); the Wired gate in SyncCatalog replaced with true: red
on all three.
- go test -tags nogui -count=1 ./internal/agent: ok.
- gofmt -l clean; go vet ./... for darwin, GOOS=linux and GOOS=windows:
ok.
- full suite, go test -tags nogui -count=1 -timeout 45m ./... at base
|
||
|
|
dca3e2d716 |
search: Doubao Search (Volcengine) as a search API (CyberCaius on Discord)
CyberCaius asked on Discord #help (10-30) for Volcengine's Doubao search under Settings › Models › Search APIs, or a custom API address. Volcengine's Doubao Search Custom (豆包搜索 Custom版, once 联网搜索 / 融合信息搜索, docs.volcengine.com/docs/networked-search/networked-search, the same page as volcengine.com/docs/87772/2272953) can now be added with its API key: - provider.SearchVendors: volcengine, "Doubao Search (Volcengine)", at https://open.feedcoopapi.com, keys at console.volcengine.com/search-infinity/api-key, after DeepSeek. The GUI takes its vendors from SearchVendors, so it shows in the Search API picker with its Get a key link and base URL field; no GUI file changes. - askSearchAPI: POST /search_api/web_search, Bearer key (the default, as the docs and volcengine/mcp-server's askecho_search_infinity send it), body {Query, SearchType: "web", Count: searchHits, Filter: {NeedUrl: true}}. The query is cut to the 100 characters the docs allow. NeedUrl leaves out its 火山如意 cards, which have no URL to cite. - readVolcSearch reads Result.WebResults: Summary as the page's text (the docs recommend it for models; Content is the whole page, Snippet ~200 chars "only for list display"), Snippet when there is no Summary, PublishTime as the page's age, a 1970-01-01 time (its image example's stand-in) as none, and a result with no Url left out. - volcSearchError: its errors are in ResponseMetadata.Error, a code the docs list, and the docs don't say the HTTP status, so the code decides: 10401/10403/10409 rest the key as turned away (403), 10406/10408/ 10410/10412 (free searches spent with none paid, no plan, plan spent) as out of credit (402), 700429 as rate limited (429). Any other code is a plain error, a 200 carrying one included. The key is masked in the error as for every vendor. - A custom address: every search API already takes a base URL (#1580, the field under the key in Settings, url= in the CLI), so an endpoint that answers as Tavily, SearXNG, Brave, Exa, Firecrawl, You.com, DeepSeek or now Doubao Search does can be set there. There is no common format across the vendors (each has its own path, body and reply), so no separate "custom" vendor was added. - Siblings: CLI usage (main.go, search_cli.go's api list and empty-state hint), README.md, README.zh-CN.md, gateway-routing.md's path list and refusal paragraph. The test's reply is the docs' own web-search response example, byte for byte (testdata/volcengine_web_search.json); its error replies are the docs' error example with its "// 该字段为错误码" note taken out (not JSON). Not tried against the real API: no Volcengine search key in this run. Run (worktree on origin/main |
||
|
|
e887139e7a |
providers: Best in family serves the newest model of each family a provider lists
Steven on Discord #feedback asked for a provider to serve only the newest model of each family, so a newer one (Opus 5.6) takes the old one's place without re-picking. The provider editor's Models control gets a fourth option, beside Vendor's list / Picked only / Usage only: Best in family. It is also on the CLI as `magpie provider models <id> best`. With nothing picked, the provider serves only the newest model of each family in the vendor's list, up to 24. A family is the id with its version numbers taken out (catalog.FamilyOf/BestInFamily in internal/catalog/family.go). A dated snapshot counts as its alias, and sizes and suffixes (mini, flash, -fast, -thinking) stay part of the name. Provider.Exposed applies it, and so does Codex's native list (CodexNativePicked). A provider/model a request names explicitly is still served, since resolve doesn't go through Exposed. A pick, Select none or Usage only clears the flag (normalize), and a providers.json without bestInFamily reads as before, so every existing mode is unchanged. The editor draws the family's newest as dashed (m.best) before saving. Every language has the wording (zh, zh-TW, ja, de). The design reference is docs/subsystems/providers-accounts.md (Model picks). Tests: family_test.go is a table of real ids, including the models.dev Claude list in testdata (no network). There are also best_in_family_test.go (provider), TestProviderModelsBest (cli), provider_save_best_test.go (gui save keeps/clears), codex_best_in_family_test.go (gateway) and provider-best-in-family.test.cjs (5 languages x chromium/webkit x 1100/420). Broken by hand: with the BestInFamily filter in Exposed and in CodexNativePicked turned off, the 4 new Go tests went red. Budget: after the rebase app.js went over appScriptBudget. Comments were cut and the tooltip and hint merged into one string, so app.js is 1,311,399 of 1,311,735. Neither budget was raised. Run at this head, on origin/main |
||
|
|
4054251865 |
library: an MCP server can be kept to this computer, never synced
huhuy72219405 on X: "能不能把不同设备的mcp区分一下,有些mcp属于本地的, 同步之后其他设备不应该读取到". A server in Library > MCP now has a "This computer only" switch in its editor (Server.Local; CLI `magpie library mcp add ... --local` and `magpie library mcp local <name> on|off`; the TUI keeps it on edit and marks the row). - Collect leaves local servers out (carriedServers), so neither a sync nor a backup file takes one to another computer. Turning a shared server local takes it out of what is carried, so the other computers drop it at their next sync; the flag itself is never carried. - Put (sync, join, Restore, Undo, backup file) keeps every local server, with its agents, and clears Local on what comes in. - Another computer's server by a local server's name goes to Library.Away: given to no agent, not in the hub, carried on as it came, so a push from here never removes it from the computers that have it. settleAway (every change) promotes it once the name is gone here, and drops it once the name is shared here again. - The hub serves local servers like any other (it runs here); subagents aren't carried, so one naming a local server keeps it. Docs: docs/subsystems/library.md, docs/subsystems/sync-backup.md. Run at |
||
|
|
05a6087e1f |
access: a key with accounts and no model may use only its accounts' providers' models
Linka on Discord (#feedback): in a gateway key's "Models this key can
use", ticking only an account and no model let the key list and use
every model of every provider.
Cause: Key.Models empty meant "every model", and Key.Accounts (#905)
held only the providers it names, so every other provider stayed open.
Change: access.HeldModels gives a key with accounts and no models the
models "<provider>/*" of each account's provider. Authenticate builds
the Identity with it, so every route's existing model gate narrows:
/v1/models, /v1beta/models, chat, responses, messages, Gemini,
count_tokens, embeddings, images, the Codex backend path, System One,
groups and fallbacks. A key that lists models is unchanged (#905: its
accounts still hold only the providers they name); a key with neither
is unchanged. The CLI's MODELS column and `gateway-key models` say so,
and the GUI editor's hint, the "not used" notes on providers no model
or account reaches, and the save status follow (en, zh, zh-TW, ja, de).
Tests:
- TestGatewayKeyAccountsOnlyHoldTheModels: each route above is 403 for
the accounts-only key and no upstream call reaches the other
provider, the decider or the image provider; its own provider, a
group of it and a key that also lists models work. Red on the old
code on every route (list showed spare/m2, chat/count_tokens/
embeddings/systemone 200).
- TestHeldModels (access).
- gateway-key-accounts.test.cjs: hint, notes and status; 4/4 red on
the old assets, green on the new.
- TestGatewayKeyAccountsListModels / SystemOne / OfANamedProvider and
TestHeldKeyToldItsOwnQuotas now encode the new rule (the held key is
told only its own provider's quotas).
Run on mote: gofmt -l clean; go vet darwin, linux -tags nogui, windows
on access, cli, gateway, gui ok; go test -timeout 45m ./internal/access
./internal/cli ./internal/gui ./internal/gateway: ok except gui's
TestMainWindowCorners/macOS_26_SDK (#3949, not this change) and
gateway's TestHeldKeyToldItsOwnQuotas, updated and rerun ok. After the
rebase on
|
||
|
|
af8f3a9399 |
sessions: a new install reads no agent's session history until the user allows it (RustCats on X)
RustCats on X: a fresh magpie showed every agent's session history on
the Sessions page before anyone agreed to it, and asked for a per-agent
choice instead.
- sessions.Reads(agent) (internal/sessions/access.go) is the one gate,
from settings.SessionReads {Asked, All, Agents}. Every lister asks it,
the aggregators (allFiles, callFilesWith, callSourcesWith,
traceLineFiles, wslFiles, DesktopDataDirs) filter by it again, and
readers of an already-listed session (TranscriptOf, ContentOf,
SearchSession, SubagentTranscript, CarryOver, ReadCallSource) return
ErrNotRead, so a cache from before a switch was turned off goes no
further. The Sessions list, stats, /api/sessions/overview, the call and
trace indexes, Usage's agent-file calls and the Codex/Pi title readers
all pass it.
- SettleReads decides once and saves: an install with sessions.json or
a calls-v* cache read sessions before and keeps all on; a fresh one
reads none, not asked. A saved value is never replaced; save, sync and
restore keep it (KeepOwn); only SetSessionReads writes it. An
unwritable settings.json reads nothing this run.
- GUI: GET/POST /api/sessions/reads. While not asked, the Sessions page
shows a consent card: each agent found (by a stat of its folder only)
with a switch, Allow selected and Allow all. Settings > Privacy >
Agents' session history has "Agents found later" and a row per agent.
Strings in en, zh, zh-TW, ja, de.
- CLI: magpie sessions read [on|off all|<agent>...]; magpie sessions
says on stderr when nothing is allowed yet; the TUI's empty Sessions
page says how.
Read either way, because none of it lists or shows a session: the
gateway's own usage ledger, its projections and the conversations it
recorded (magpie's own records, so usage and cost keep working); the
agents' config and sign-in files; Claude Code's and Codex's
history.jsonl last-used time and a session file's mtime for a quota's
first use; Codex's newest rollout's last line before magpie restarts
Codex (codexTurnOpen).
Tests: TestFreshInstallReadsNoAgentUntilAllowed,
TestSettleReadsKeepsWhatWasThere, TestSessionReadsRoutes,
TestSessionsRead, TestSessionsNotAskedSaysHow, sessions-reads.test.cjs
(26 cases: consent and Settings in 5 languages, Chromium and WebKit,
390 to 900 wide).
Run on mote:
- full Go suite (gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui,
GOOS=windows go vet, go build, go test -timeout 45m ./...) at this
change on
|
||
|
|
fd5c631cbe |
image mcp: generate_image and generate_video take the model to use (XYenon)
XYenon on Discord asked whether an agent can pick the model magpie's image/video MCP draws with. Both tools now take an optional `model`, as provider/model: - The schema lists the models that may be asked (the Settings default first, then each on provider's OfferedDrawers or Videomakers), only those the calling gateway key may use. Up to 40 of them form an enum; past that, the description names three. - Left out, the Settings default is used, as before. - A bare id only one provider has, a ChatGPT account's other GPT Image name (ListedDrawer), or a newer family model (drawsFamily, grokVideoFamily) is accepted. Anything else is a tool error naming the models the key may use, and nothing is drawn. It never falls back. - The chosen model goes into the images/videos request's `model`, so the APIs' own key check (keyHolds, keyModelError, #882) refuses one the key may not use: the same check /v1/images makes. - The stdio Magpie Image server copies the gateway's `model` property from its tools/list, and asks the hidden JSON-RPC method magpie/media_model which model a call means. An older gateway (-32601) passes the model through as named. - `magpie tool generate_image --model ...` works through the schema; the usage text says so. Docs: gateway-routing.md (image MCP section), reference.md. Run (mote, via mote-run, at this tree): - gofmt -l: clean. - go vet ./... for darwin, GOOS=linux -tags nogui, GOOS=windows: ok. - go test -count=1 -timeout 45m ./internal/gateway/ ./internal/imagemcp/ ./internal/cli/: ok. Broken by hand: with `req["model"] = ref` dropped in imageMCPDraw and imageMCPFilm, TestImageMCPDrawsWithTheModelAsked, TestImageMCPModelHeldToTheKey and TestImageMCPVideoModelAsked go red (the default was drawn instead); restored, they pass. Not tried: a real vendor account. The fakes are easeled's art provider and the fake Grok. GUI files not run: no GUI file changed. |
||
|
|
3ce2a9819f |
library: RTK for agents in WSL, with the distro's own rtk (lex on Discord)
lex: Claude Code and other agents in WSL couldn't use the RTK of magpie
on Windows. rtkAgents looked an agent up in rtkSpecs by its whole id, so
claude@wsl:Ubuntu never matched and WSL agents weren't on the RTK page at
all. Even matched, the specs read this machine's home, and Windows' rtk.exe
is no command inside the distro, where the hook runs.
Now an agent is looked up by its kind (rtkKind). One in WSL:
- has its files read and written under the distro's home as magpie opens
it (rtkClaudeDir, rtkCodexDir, rtkHome), with blocked/version checks
against the distro's rtk and OpenCode;
- uses the distro's own rtk: rtkDistroOf asks the distro (wsl.exe -d <d>
-e sh -lc) where rtk is on its shells' PATH, else in ~/.local/bin or
~/.cargo/bin (offPath), kept 15s; ReadRTK lists one RTKDistro per distro;
- switching on runs that rtk there (rtk init -g ..., its folder on PATH);
- Install RTK in WSL <distro> (POST /api/library/rtk/install {distro},
magpie library rtk install <distro>) runs RTK's own Linux installer in
the distro (curl, or wget).
A distro that isn't running is never started (#3896): its agents are
listed asleep with the switch off, and switching or installing says to
start it. The page has a card per distro (install, off-PATH, asleep) and
uses the distro's rtk for each WSL row's tags and switch; strings in zh,
zh-TW, ja and de. The install route now refuses a body it can't read
instead of installing on this computer.
Run:
- mote (macOS 27), at origin/main
|
||
|
|
c1da9ccda3 |
library: a stopped WSL distro's agents are listed, and a tick for one is written there once it runs (cybercaius on Discord)
cybercaius: with WSL not started, the Library's MCP page didn't list the agents in the distro at all, and nothing ticked for them could be kept. A stopped distro's agents are no targets (#3896: opening their files starts the distro), so they fell off the page. While a distro runs, each agent's places and what its MCP file takes are kept in wsl.json (keepShape, agent.WSLKeep, key library:<kind>). While it is stopped, Read lists its agents from that (asleepView, asleep: <distro>) with the library's ticks; one magpie never saw is listed only on rows that name it, as unseen, its chip disabled and kept by every click (keptOf). A tick on a stopped agent is kept in library.json (Takes accepts a known shape, serversAgents judges it by shape.reaches); nothing is opened or run in the distro. Woken, from KeepLinked's 30s loop, syncs once a distro the library names goes from stopped to running (wsl.exe -l --running starts nothing). The page greys a stopped agent's chip and says why in its tooltip and one line per distro; the MCP hub leaves them out. The CLI says the same on stderr (AsleepIn). en, zh, zh-TW, ja, de. Run at this tree (20695ad8b before this message; on |
||
|
|
96a703a591 |
uninstall: magpie uninstall and Settings › Uninstall magpie put every agent back before magpie's files go
Jevik_AI on X (Windows, portable magpie) deleted magpie's folders by hand. ~/.codex/config.toml kept openai_base_url on 127.0.0.1:3425, and every Codex turn then failed with a 502, with nothing left that knew why. Deleting magpie's files never puts an agent back, so there is now an uninstall that does. - internal/uninstall: Run goes in this order. System removes the background service, opening at login, the Start menu shortcut (shortcut.Remove, with its App Paths key), the magpie:// links and the privacy model's helper. Agents ends Codex's account failover, then runs each connected agent's own Disconnect, or its offline disconnect for an app that is closed. That is the same code as the Agents page, so a value the user changed by hand since Connect stays theirs ( |
||
|
|
0c4e3455ee |
agents: a line magpie writes into a TOML, YAML or env config has a note above it saying so
Jevik_AI on X deleted magpie's folders by hand. Codex's config.toml kept openai_base_url = "http://127.0.0.1:3425/backend-api/codex", with nothing in the file naming magpie, and every Codex turn failed with a 502. Each line magpie writes that points at the gateway, or at magpie's model list, now gets a comment line of its own just above it: # magpie: Codex on magpie's local gateway; Disconnect in magpie or # `magpie uninstall` undoes it, or delete this line and the model line model_provider = "magpie" - Only a line the write adds or changes, or one that had a note, gets one. A line of the user's own that magpie leaves alone gets none. - The note is never on the value's line. Grok App's providers.rs reads the rest of a line as the value, and an end-of-line comment broke TestGrokApp in a first try. - Every write takes the notes out and puts back the ones still needed, so a note goes with its line and Disconnect leaves none. - No note in JSON. A YAML note that would change what the file reads as isn't added. - Wired in run (agent.MarkWritten); tests leave edit.Mark nil so their exact bytes stay. Run at this commit's tree (worktree, sandbox HOME, private GOCACHE): - gofmt -l clean; go vet darwin, GOOS=windows, GOOS=linux -tags nogui ok. - go test -tags nogui -run Mark ./internal/edit ./internal/agent: ok. - ./internal/agent and ./internal/edit whole with edit.Mark forced on for every test (a snapshot with lineNote set in agent's TestMain): edit ok; agent fails only TestDshRouteKeepsTheAPIPickedInDsh and TestDshSearchThroughGateway, which compare exact bytes and see the note line. With Mark unset (as shipped) they pass. - Real Codex: built magpie from this tree, `magpie codex fakeai/fake-1` in a sandbox HOME. config.toml got the three notes above model_provider, model_catalog_json and openai_base_url; `codex mcp list` and `codex features list` (codex-cli 0.162.1) read it, rc 0, and Python's tomllib reads the same values. `magpie codex default` took them out. - Broken by hand: a note on every line, not only changed ones -> TestMarkTOML and TestMarkOnlyWhatMagpieWrites red. - The notes' line filter is withoutNotes, unexported: an exported Unmarked put a word the routing plugin translates into a Go file, and i18n-keys' "a plugin's words are its own" went red on it. It passes now. Full suite: run with the uninstall commit that follows, recorded there. |
||
|
|
4534561f6b |
codex: a thread open when magpie quits goes on through a relay, not a 503
idkatbro on X: a Codex session started while magpie was open keeps failing after magpie quits with "unexpected status 503 Service Unavailable: Unknown error, url: http://127.0.0.1:3425/backend-api/codex/responses", until magpie is opened again. Cause: Codex signed in to ChatGPT, with more of its accounts on in magpie, gets openai_base_url = the gateway's /backend-api/codex (failover). At quit EndCodexFailover takes it out of config.toml, but a thread already open, in the Codex app and its app-server above all, keeps the base URL it started with. Every turn after went to a closed port. With a system or env proxy in between, the proxy answers 503 with an empty body, which Codex shows as "Unknown error"; without one Codex says "Connection refused" and reconnects. Reproduced on mote with codex 0.162.1 and a proxy answering 503 for the closed port. Masking plays no part: it runs only in the gateway, is opt-in, and its own 503 carries a readable message. Fix: when quit really ends failover (EndCodexFailover now says so), the gateway is on loopback, and Codex processes run (provider.CodexPIDs), magpie starts a detached `magpie codex-relay` (internal/codexrelay). It waits up to 60s for the gateway's port, then passes /backend-api/codex/* on to the ChatGPT backend with the same transforms the gateway applies to Codex's own turns, signed by the caller's own Authorization; it adds no credential (gateway.CodexRelay). - Refused with a readable 400 (Codex retries a 5xx five times over): a magpie model, a turn naming one of magpie's Codex accounts, and a turn masking would have masked, which is never sent unmasked. - 403 for any Origin (null too) or a non-loopback Host, as corsGuard. - Any other path gets 503 "magpie isn't running", never readable as magpie by ServedBy. - It ends once every Codex process it was left for is gone and nothing is in flight. - The next magpie (GUI or `magpie serve`) calls codexrelay.Leave first: a POST with the token from a 0600 state file. The relay closes its listener at once, so the port is free when Leave returns, and finishes its streams (up to 30 minutes). No running turn is cut. Run (at 6df7dc287 on origin/main |
||
|
|
da8039368f |
library: skills kept in ~/.agents/skills can be handed over to the library, and then turned off per agent
tnt1223 on Discord asked for the skills in ~/.agents/skills to move into
magpie's library folder and be managed there ("统一移入 magpie 的资源库文件
夹,交给 magpie 管理"), since a skill there can't be turned off for one agent
("不能决定某个 skill 是否自由开启"). Codex, Gemini CLI and the other readers
of that folder read it themselves, whatever the library ticks. Goose, Kimi
Code and Cindy use it as their own folder.
HandOverSkills (POST /api/library/skills/hand-over with names) does the
hand-over only when the user asks for it:
- A folder kept in ~/.agents/skills moves into library/skills/<name>
(moveIn). It is renamed, or, across disks, copied. A copy has to read
back the same (sameTree) before the original is set aside with the
backups. On any failure the folder stays where it was and the library's
link stays as it was.
- An entry there that only links to a folder elsewhere is removed, and
the library links straight to that folder. The folder itself stays.
- The user's own links to the skill in agents' folders are removed too,
since they would point at nothing. The library gives those agents its
own link.
- Every agent here that read the skill there (readsSharedHere, plus the
agent of each such link) is ticked. So each agent keeps the skill, now
from the library, until the user unticks it or turns it off here.
- A skill found there that isn't in the library yet is imported first.
- A name that can't be handed over is listed in Result.Unmoved, and the
other names are handed over all the same.
HandBackSkill moves the folder back and links the library to it again.
"Kept there" is now sharedEntry: the skill's own entry in the shared
folder, by its name, or, for a library link into it under another
folder's name, by that folder's name. Everything that read the old
by-name check follows it:
- SkillView.Always, plus the new Shared and SharedElsewhere fields;
- syncSkills' in-shared check;
- the shared folder's own target, which no longer gets a second link
beside such an entry. TestSharedUnderAnotherName covers this, and it
fails without the guard.
Where:
- GUI, Library > Skills: a row kept there has "Manage in magpie"
("交给 magpie 管理") in its source line. With more than one such row,
the skills heading has "Manage {n} in magpie". Each asks first, in the
page, and says:
- where the folder goes, or that only the link goes;
- which agents keep the skill, ticked;
- how to put it back.
Cancel sends nothing. The strings are in en, zh, zh-TW, ja and de.
- CLI: `magpie library skill hand-over <name…>|--all` and
`magpie library skill hand-back <name>`.
Existing users: nothing changes until they click. A library.json gains
no new key.
Run (mote, at 58e926e5d/d4b7c0586 rebased on
|
||
|
|
628ac36fc9 |
agents: Add magpie says when nothing here opens the app's import link (sungt)
sungt (Discord #feedback, Windows, magpie 0.1.1976, Cindy 0.1.119, Cindy
open): on the Agents page Cindy's 添加 magpie "spins, no response".
What magpie got wrong: Cindy, AionUi and Lody take magpie only through
their import link, which magpie hands to rundll32 / open / xdg-open and
never waits on. A link nothing opens did nothing, the button never awaited
/api/open nor caught its error, and `magpie cindy add` printed "opened"
whatever happened.
- agent.OpenAppLink asks the system, without opening anything, whether
something opens the link's scheme: Windows' HKCR\<scheme> (what
Electron's setAsDefaultProtocolClient writes) and then the user's
UrlAssociations UserChoice; macOS Launch Services (cgo builds); Linux
`xdg-mime query default`. Only "none", or a registered program whose
full path is gone, refuses the link (NoLinkHandlerError); anything
unknown hands it over as before.
- /api/open (Cindy, AionUi, Lody after OpenLody) answers
code no_link_handler with app, exe and said, an i18n.js key from
linkSaid that api() puts through t() as it does bunSaid's.
- The import button now waits for /api/open and shows the result: "Sent
to {name}: confirm adding magpie there", or the reason in the
reader's language.
- The CLI's add returns the same error.
This is not verified as sungt's cause. Cindy was open, and Cindy
registers cindy:// at every start, so the check most likely passes on
their machine. If so, the spinner is Cindy's own import dialog
(previewProviderImport / fetching magpie's /v1/models). Cindy 0.1.119
wasn't available here. We still need Cindy's log around "received deep
link" from sungt.
Run (worktree at origin/main
|
||
|
|
0e2739743b |
codex: a reset set to go when the week runs out is spent before the credits
tongzhenbao on X: a Codex Pro account with "when its week runs out" on,
its week at 0% left, one reset held until 11-06 (after the week's own
reset on 11-03) and Use credits on. Overnight ~10k credits went and the
reset stayed; the card said "not auto-used" beside the switch on.
Cause: the week's auto-use ran only on a vendor refusal. autoReset in
routing needs a 429 usage_limit_reached on the last candidate, and the
relay's autoResetSignedIn the same on its 429. An account let spend its
credits is never refused for its week: ChatGPT answers on the credits,
and routing never benches it (full() and onCredits). So the week's reset
could only ever be spent with credits off.
Decision (product call delegated): a reset is free, credits cost money,
so a reset the user set to go when the week runs out goes before any
credits. resetBeforeCredits runs before a try is sent to a Codex account
on its credits whose last reading has its week used up, with the week's
switch on; AutoUseCodexReset reads the week again and keeps one a week
at most, so a second time in the same week goes on the credits. Hooked
in the routing loop and in codexUpstreamOn (the relay, signed-in or an
account). With no reset held, or the week's switch off, nothing changes.
The card's summary: with only the week's switch on it now says "auto-used
when the week runs out" (zh 周额度用完时自动使用), not "not auto-used",
with its title in all five languages. CLI help and auto-reset messages
say "or before its credits are spent". gateway-routing.md names it.
Siblings: the expiring switch already spends regardless of credits
(usedUp ignores them); the credits-off path (planned.held) is unchanged.
Run (mote, through mote-run, at this tree):
- go test ./internal/gateway -run 'TestCodexResetBeforeCredits|TestCodexAutoReset|TestCodexCredits|TestCodexNoCredits': ok
- broken by hand: gateway.go and codex_backend.go at origin/main:
TestCodexResetBeforeCredits/relayed and /routed red (200, spent ""),
the two negative cases green
- node --test codex-auto-reset, i18n-keys, codex-auto-reset-settings,
codex-resets-used, panel-options-fold, quota-curve: 96/96 (chromium +
webkit, en/zh/zh-TW/ja/de); codex-auto-reset red with origin/main's
app.js ("· not auto-used")
- full suite, before the rebase onto
|
||
|
|
b4267de595 |
gateway: a provider's fallback can be a routing group, routed as the group
01huadalang on Discord: "还有备用模型增加路由组的选择,现在只能选模型". A
provider's Fallback list held models only; a "group/<id>" entry resolved
to the group's first member alone. Now such an entry is served through the
group, as a request to the group would be:
- plan → planPaused: a fallback naming a group (provider.FallbackGroup,
the group as routed, Live) hands its members to planLevel
(planFallbackGroup): the group's own routing, its sink and asides, and
its pause rules (serve passes provider.PausedOut for the agent's folder).
Its trace rows are marked Fallback with the group in Via.
- No loop, each provider/model once a round: a member that is the primary,
a model named earlier, or another fallback group's member is left out
where it comes second. Groups have no fallbacks of their own and a
member's fallbacks are not followed, so nothing leads back. A group that
is gone or off is passed over, as a model none serves is.
- Every sibling that reads p.Fallback now reads a group's members through
provider.FallbackModels: redaction (unredactedRoute: an unmasked
provider with a fallback group holding a remote model is masked),
careful accounts (carefulOf), native compaction, Codex's own turns
(codexFallsBack) and Claude's auto-mode review (claudeReviewed, which
moves from provider.Resolve to ResolveRoute, as the gateway reads
fallbacks).
- CLI: `magpie provider fallback` already took group/<id> (Resolve knows
groups); its usage and error now say so. Pinned by
TestFallbackCmdTakesGroup.
- GUI: the provider editor's Fallback picker lists the routing groups
(providers.gateway.groups) beside the models as chips with the Routing
fan and a muted "routing group" tell; a picked group's row has the same
fan and tell, and a gone one says "No routing group {id} now; it is
skipped". A filter matches a group's name, id and its members'
providers. New strings in zh, zh-TW, ja and de.
- app.js budget raised 187 bytes on main (1,311,922; core 1,531,060), the core's
own editor, no room added; the addition was cut from ~900 bytes first.
- docs/subsystems/gateway-routing.md: the Candidates row says all this.
Not done: a fallback group's turn rules (ruleFor/ruleOver, which can ask
a classifier) are not applied. The plan is made before the primary is
tried, so they would cost a classifier call on every request the primary
answers. Its routing order, sink and pause rules are applied.
Run (at f6e7214af; after the rebase, the last bullet):
- gofmt -l: clean. mote: go build ./...; go vet on the touched packages;
GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...: ok.
- mote: go test -timeout 45m ./...: every package ok except internal/gui:
TestCoreScriptBudget (fixed above, then ok) and ten AppKit window tests
(TestDockJoinLeadsCommandTab, TestPanelCloseHidesIt, TestMainWindowCorners
…) killed at their 30s bars while four other sessions' GUI suites held
mote at load 70-110. Run alone, all ten
pass (TestDockJoinLeadsCommandTab skips) except TestMainWindowCorners,
red at base
|
||
|
|
a0ba8e1f2e |
grok: each model's context_window follows Long conversations, and one set by hand stays through a sync (uk.jent)
uk.jent (Discord #feedback) reported that magpie writes every Grok Build model's context_window as the model's whole window. They wanted about 300K without editing dozens of models, and they lost hand edits on each sync, because SetTOMLTables replaces the [model."magpie/..."] tables whole. Grok Build now uses Long conversations, the mechanism Codex and Claude Code already use. grokWindow gives: - min(window, Compact) when the model or provider has its own threshold; - otherwise settings.Working(window): 272K by default on longer windows, the typed size, or the whole window with Full context. What magpie wrote is stashed under grok:<path>:windows, and grokOwnWindow uses it to tell a hand edit apart: - A value that differs from what magpie last wrote is the user's, and it stays. - In a config written before the record, a value other than the model's whole window is the user's. - Disconnect forgets the record. The agent sheet's Long conversations row now shows for Grok Build (AGENT_PREFS). Its texts, the provider editor's hint, the Context tab's note and `magpie model compact` now name Grok Build, in en/zh/zh-TW/ja/de. setCompact and setAsync now share prefWrite. That dedupe keeps app.js under its budget, which is not raised. Behaviour change: a Grok Build model whose window is over 272K now gets 272K by default, as Codex does, unless Full context is on. Run on mote, at this head (c893c2229, rebased on |
||
|
|
fe05f0a721 |
library: a skill can be turned off on this computer alone, and a sync neither carries that nor turns it on
hanslin1666 on Discord (#general 1565016936344191096) wanted a library
skill off on one computer only ("只在这台电脑上关掉"). The only way to do
that was to untick its agents, and the ticks are what a sync carries, so
every other computer lost it too. A sync from a computer that had it on
also gave it back here.
Skill.OffHere (library.json "offHere", omitempty) turns a skill off on
this computer. No agent here gets it, whatever Agents says. Every reader
that gives a skill to an agent now asks gives():
- syncSkills, including the shared ~/.agents/skills check;
- desktop_skills.go;
- skill_changed.go;
- skill_edits.go;
- behind;
- Targets.
Agents stays what a sync carries, and the page shows those chips faded.
Collect never carries OffHere, so turning a skill off changes no part a
sync uploads. Put keeps this computer's OffHere for a skill it puts, so
a sync from a computer that has it on (or that gives it to more agents)
leaves it off here.
Where to turn it off:
- GUI: a power button on the skill row (aria-pressed). When off, an
"Off on this computer" tag sits on its own line under the name; it
says why and turns the skill on when clicked.
- CLI: `magpie library skill off-here|on-here <name>`.
- TUI: the row says the skill is off.
The strings are in en, zh, zh-TW, ja and de.
Existing users: nothing changes. An older library.json has no offHere,
so every skill stays on, and a skill that was never turned off writes no
key (TestSkillOffHereOldLibraryIsOn).
Not covered:
- a project's skills;
- a library skill whose own folder is inside ~/.agents/skills, which
agents read in place;
- a skill another computer removes (the flag goes with it).
The skill's files in the library folder still update while it is off.
Docs: docs/subsystems/library.md and sync-backup.md.
Run at the parent
|
||
|
|
ec3dad75ae |
provider, gateway, gui, cli: Claude's accounts can be kept to Claude Code's own sign-in, magpie serving nothing on them (myduso)
myduso on Discord asked for an exclusive mode on Claude's subscription: switch the credentials locally and proxy no traffic, since Claude Code is used on its own and the SDK run magpie's bridge makes spends more of the allowance than the interactive client. The switch-only setting Codex has (#1907) now also takes claude. On it, Provider.KeptToAgent is true and On() false, so the gateway, catalog, groups, fallbacks, search, draw and embeddings serve nothing on the Claude accounts, and a request naming them is refused 404 saying they are kept to Claude Code's own sign-in and how to undo it (switchedOff). Switching Claude Code's sign-in when an account is used up, and reading usage, go on: both are gated by leftAlone on the raw Off, which this doesn't set. Groups magpie found keep their Claude members (heldOffEntries). Nothing is sent as Claude Code: magpie only writes and restores Claude Code's own credentials as it already did. GUI: the tick under Claude's accounts, shown with one account too, drawn by the block Codex's tick had (one block now, its strings picked by agent). app.js stays under its budget with no raise (1,311,711 of 1,311,735). CLI: magpie accounts switch-only <codex|claude> [on|off]. Docs: reference.md, subsystems/providers-accounts.md. Run on mote at this tree on 06950fbbb; then rebased on |
||
|
|
e0ea15b8e8 |
library: an MCP hub, one magpie server in place of every library server (#2679)
With Library → MCP → "MCP hub" on (off by default), each agent that takes an MCP server over HTTP is given one entry, magpie, at /mcp/magpie/hub/<agent>, in place of the library servers ticked for it. magpie runs those servers itself, once for every agent: a command starts on its first call and ends after 10 idle minutes, a URL server is reached with its headers and MCP sign-in. Tools are <server>__<tool>; a tool off in the library is neither listed nor run. Any other app connects at /mcp/magpie/hub, which serves every library server. Both are guarded as /mcp/magpie/tools is (local or a gateway key, no foreign page, 4 MiB, the key's limit per call). An agent that reaches no server over HTTP (Claude Desktop), has a magpie entry of its own, or sits beside a library server called magpie keeps each server's own entry, and the page says why. Off gives every agent its servers back and ends every process the hub started. GUI: a switch under the MCP list, a line of what it serves, the address, and a Connect… sheet. The sheet lists every agent magpie detects that takes MCP (not a fixed four), each with where it stands; one given none of the hub's servers has a Connect that ticks it for every server it can reach (servers/agents-all), so it gets the entry, and the sheet stays open. Then any other app: Cursor (when it isn't a detected agent), VS Code, Other, with the JSON and, in the app, "Add to …" through the app's own install link built in Go (servers/hub-open; the page never sends a link). CLI: magpie library mcp hub on|off. Design: docs/subsystems/mcp-hub.md. With #3885 ( |
||
|
|
df9376592d |
routing: a group's member may offer several reasoning levels for the agent to pick among
Garydesu on X: "能不能让路由组里的模型设置多个可选推理强度,现在只能选一个或者整个 路由组的". A member was one fixed `:effort` or followed the group's levels. A member's suffix may now join several levels with "+", `provider/model:low+xhigh`, kept lowest first, each once. provider.MemberLevels splits it into Member.Levels and leaves Effort empty, so the member isn't fixed; one level is a fixed effort as before. The whole stays the member's id, so rules, fast, off, weights, share and the CLI key it as any member. The gateway fits the agent's ask to the member's own levels (groupLevels returns the candidate's levels first; ofMember, the quiet check and the trace see them), and the group lists them to agents (buildGroupEntries), intersected with the other members' as usual. In the Routing page's group editor the member's reasoning menu has "Several levels…", a menu that stays open with each level ticked or not; a fixed level picked from the first menu replaces the old one as before. i18n in zh, zh-TW, ja, de; CLI help and docs/subsystems/gateway-routing.md say it. Run on mote (mote-run). Rebased on |
||
|
|
e8c7dddcb4 |
notices: the release carries the third-party licence notices
The owner asked for the licence notices in the release package (moejs alpha.11 compiles Intl's data in, which carries its own notices). THIRD_PARTY_NOTICES is embedded in the binary (main.go, //go:embed) and handed to internal/notices; `magpie licenses` prints it, GET /api/notices serves it, and Settings › About has an Open-source licenses row that opens it in a dialog, in every language. `make app` copies the file into the .app's Resources too. The core's scripts are 1,527,245 bytes, their budget raised to it with no room added; app.js stays under its own. Run at this head (rebased on origin/main): - win-run (Windows 11): go vet -tags nogui . ./internal/notices ./internal/cli; go test TestNoticesFollowMoejs (.), ./internal/cli, TestCoreScriptBudget (./internal/gui): ok. - wsl-run (Ubuntu 24.04): go vet -tags nogui ./..., go build -tags nogui: ok. Run at the pre-rebase head 14e2d13fb, on mote (macOS): - gofmt; make app's copy byte-identical to the file; `magpie licenses` output equal to the file; GOOS=linux/windows vet and build; go test . ./internal/cli: ok. ./internal/gui: only TestMainWindowCorners red, the same on origin/main (#3949). - about-notices.test.cjs: chromium and webkit, en zh zh-TW ja de, 1100 and 420px: all ok. Broken by hand: TestNoticesFollowMoejs red with the embedded file cut. Not run: the GUI suite at this head. The rebase met main's cancelAsk helper where showNotices sat, and the dialog's Done now uses it (the same stopPropagation + closeConfirmAsk). The whole GUI suite at 14e2d13fb was cut off when mote went down at load ~50: the files it reached outside About had reds, most of them 180s browser-launch timeouts, the rest passing in other languages or the other engine; they are run again once mote is back, and any that stay red are filed. |
||
|
|
08b02cf18c |
providers: a pool stops at its caps and reads usage again near them (plugins#349)
What was adopted on magpie-community/plugins#349 (1939869736luosi): one
place, in the GUI and the CLI, for a subscription's account pool, and an
opt-in conservative mode.
- Stop at the caps (Provider.CapStop, off by default): once every account
in use is held at its cap, the request is answered 429 rather than going
on to the provider's fallbacks (plan returns restLast). Off, as before.
- Check usage again near a cap (Provider.CapCareful, off by default,
internal/gateway/cap_careful.go): before planning, a capped account's
usage is read again when its reading is over 15s old within 5 points of
a cap, or over 5m old at all; the request waits at most 10s, and a
failed account is asked again at most every 15s. An account whose usage
was never read, whose last read failed, or whose reading is still that
old is then held as one at its cap is (capHold "unread", traced as
Weighed.Unread, named in the 429 with "--careful off"). Generic: it
goes by provider.UsageRead/ReadUsageNow, so every subscription that
reports usage windows (Codex, Claude, plugins) gets it.
- provider: usedCache records each account's read state; a failed read
keeps the last good reading's time. ReadUsageNow no longer reports
false when the read had already finished on the first ask.
- GUI: under the provider's account list, once an account has a cap (or
either is on), two ticks for the above, and a note naming the accounts
in use with no cap ("used to 100% of each window"). Accounts, order and
caps stay where they were in that list. zh, zh-TW, ja, de added.
app.js 1,309,658 within its 1,310,460 budget, unraised: addRow and a
per-row forgetOf replace 3 add-button and 5 Remove-button builds.
- CLI: magpie provider pool <id> [--accounts a,b,…] [--cap percent|off]
[--stop on|off] [--careful on|off] shows and sets the whole pool.
- docs: gateway-routing.md and providers-accounts.md.
Run (mote, before the rebase at
|
||
|
|
8bade6c5e2 |
provider: a plugin's usage window can be a prepaid wallet's balance (#3950)
SuperMagic's accounts (mycf_711's magicrew plugin) are prepaid wallets of
points with no total. A plugin can now send a usage window as
{name, balance: 6291, unit: "积分"} with no used or limit.
- host.js passes a finite balance on (at least 0), anything else as null.
plugin.UsageWindow.Balance and provider.QuotaWindow.Balance are *float64.
- quotaOfPlugin keeps the figure and does not make the window Text or
Aside, so routing knows the account with no Used invented. allowanceOf
copies it into Limit.Balance; an empty wallet counts as used up.
Allowance.Left(model) is the least balance of the windows that count
the model.
- weighRouted fills routes.Seat.Left and Seat.LeftIn (the account's
provider and unit). Smart, pace and usage (least used) put the seat
with more left first where they would otherwise tie (byLeft), only
when every seat with a balance shares one LeftIn: balances in two
units or two providers are never compared. Tiers still come first.
- The Usage card, the Routing page (Weighed.Balance: the small row's
text, no bar, a why sentence, the account list), magpie accounts and
the status line show the figure, "6,291 积分 left", never a share.
- Docs: provider-plugins (new section), gateway-routing,
providers-accounts, plugin-runtime, host.js typings and the site's
plugins page (en, zh, ja).
Run, at base
|
||
|
|
e056779a67 |
gui: the app serves its page to a browser, behind its key (Settings › Browser access)
jiakun_zhao on X ran `magpie web` in a terminal beside the desktop app, to manage it through a Cloudflare tunnel. Settings › Network and sharing › Browser access now has the app serve the same page itself: Off, This computer (127.0.0.1, for a tunnel or SSH forward) or Local network. Access is magpie web's, unchanged: the key in the link is traded for the cookie (webGuard), the allow list holds, and the gateway's client routes on the page's port need a gateway key (onePort). A rebound Host and Origin: null get no cookie. There is no way to serve it without the key. The key and choice live in web-page.json (0600) beside settings.json, so a sync never carries them. GET/POST /api/web-page are the app windows' alone: a browser on the page can't read the key or turn the page off. A busy port (magpie web, the magpie before an update) is tried every 4s; `magpie web` on the same port opens the app's link instead. Run at d43b7c40d (this change on |
||
|
|
add927e604 |
codex: the Codex app beside the ChatGPT sign-in lists magpie's models too
laddieyao (Discord #general, 10-27): with Codex joined to magpie beside its ChatGPT sign-in, the Codex desktop app's model picker showed OpenAI's GPT models alone, while the Codex CLI listed magpie's. The /models request does reach magpie's gateway and its answer holds magpie's models. ChatGPT.app 26.1013's picker then narrows app-server model/list to the models a Statsig config (107580212, use_hidden_models / available_models) names, while Codex is on its built-in provider, unless Codex reads its list from a file (model_catalog_json, hasConfiguredModelCatalog) or names a provider of its own. The CLI has no such filter. Where the Codex app is installed (codexReaders has an "app"), and only joined/beside the sign-in (not magpie as Codex's provider, not account failover alone), magpie writes the list it hands Codex at /backend-api/codex/models to ~/.codex/magpie-desktop-models.json and names it with model_catalog_json. Codex is still on its built-in provider. With a catalog named Codex asks for no list, so magpie asks the backend itself, with Codex's live sign-in (provider.CodexLiveList): its entries go in verbatim, base_instructions and all, merged as the gateway merges them (codexMerged, factored out of codexModels: picked, hidden, window, V1, AutoReview edits), magpie's models after them. - A list not known (not asked yet, or the backend failing) is unknown: the file as it was stays, never an empty list; a key naming a file that is gone goes, as Codex loads no config then. - Written via temp+rename at Join, set, settle and every Sync (so a change of magpie's models, picks or hidden models rewrites it, as SyncCatalog runs on them); the backend list is asked again hourly (5 min after a failure) and a change syncs again. - A model_catalog_json of the user's own stands; none is written beside. - magpie API, the app gone, or unwire take the key and the file out; unroute never restores the desk file as the user's catalog. - connectinfo counts the file, so a running app on an old list reads as needing a restart. - CLI-only machines: unchanged, the live /models path as before. Run: - Real account, sandbox HOME (copy of auth.json, chatgpt Pro; live ~/.codex untouched): Join wrote model_catalog_json and the file with the real backend's 10 entries (gpt-6.1-sol ... codex-auto-review, each with base_instructions) plus relay/claude-opus-5.5 and relay/claude-sonnet-4-5. Then the real app-server bundled in ChatGPT.app (codex 0.163.0-alpha.10.2, CODEX_HOME sandbox, base URL pointed at a dead port) model/list returned all 12, relay models visible, and config/read showed model_catalog_json set, which is what the app's picker checks to skip its filter. - New tests: TestCodexDesktopListBesideSignIn, ...CLIOnly, ...KeepsTheirs (internal/agent), TestCodexDesktopCatalog (internal/gateway). - Broken by hand, each went red: deskList a no-op (all three agent tests), the user's-own branch removed (KeepsTheirs), the gone-file branch removed (KeepsTheirs), the keep-last-good rule broken in codexDeskRefresh (TestCodexDesktopCatalog). - go test -tags nogui -timeout 45m ./internal/agent ./internal/gateway ./internal/provider ./internal/cli at bc0a99bb6 (on |
||
|
|
ca8a6f346a |
agent: a renamed routing group moves its agents, and the Codex app reloads a changed catalog
lucis0116 on X: renaming a provider or a group in magpie didn't reach
every agent.
Display names already reached the agents' files: store and SaveGroup
drop the catalog, and SyncCatalog writes the new "<model> · <name>" and
"<group> · routing group" labels into Codex's model_catalog_json, Claude
Code's picker, OpenCode and Pi (checked in a sandbox HOME). Two gaps
were left:
- A routing group given another id (Routing page, `magpie groups
rename`, TUI) left every agent on group/<old>, which magpie no longer
has. The CLI even said "agents set to group/from need group/to now".
agent.RenameGroup now moves each agent field on group/<old> to
group/<new>, spelled as the agent spells it. It goes through
renameRefs, the move RenameProvider already made, now shared by both,
then SyncCatalog. The GUI, CLI and TUI call it in place of
provider.RenameGroup.
- The Codex app's own app-server reads model_catalog_json only as it
starts, and KeepCodexAppOnItsProvider restarts it only when
codexAppRoute changes. The route named the catalog's path, not what
the file holds, so a renamed provider or group, or a model added,
stayed on the old list until the user quit the app. The route now
carries a hash of the catalog's bytes (codexCatalogTag, read again
only when the file's size or time changes). The restart goes through
the existing idle gate: no Codex request in flight, 10s idle, no turn
open. A write of the same bytes is no change.
Run, in a sandbox HOME only:
- TestRenameGroupMovesTheAgentsOnIt (new): Codex, Claude Code, OpenCode
and Pi on group/smart, renamed to clever: each said moved and each
file on group/clever, none naming group/smart.
- TestCodexAppRouteFollowsTheCatalog (new): the route changes when a
renamed provider rewrites the catalog, and stays put when the same
bytes are written again.
- Broken by hand: RenameGroup's match turned off makes the first test
red (no agent moved, every file on group/smart). The catalog line
dropped from codexAppRoute makes the second red ("a provider renamed
left the Codex app's route as it was").
- At aded9beea (base
|
||
|
|
7f827b3b0b |
claude: magpie claude-code runs lists the Claude Code processes and says what they are
@Candydidi3 on X: with Opus in Claude Code, "magpie里拉起很多子进程". On a Claude account each conversation is answered by a real Claude Code (`claude -p`) with magpie's MCP helper (`magpie claude-mcp-helper`) as its child. Claude Code's parallel subagents are conversations of their own, so a session that starts N of them has N pairs running. idleMost (6) pairs are kept for an hour so the next turn reads the prompt cache, and runs waiting on tool calls stay up to 30 minutes. On macOS and Windows nothing bounds the total unless the user sets `magpie claude-code runs N`. A task manager names them "2.1.311" (Claude Code's binary is named by its version) and "magpie", and nothing told the user what they were. No leak was found. With the bridge's fakes, 12 concurrent conversations left 6 runs when they ended their turns, 12 when they were parked on tool calls and never answered (bounded by the 30-minute timer), and 0 right after they were cancelled. Real Claude Code 2.1.311, run with the bridge's args, exits within 0.1s of stdin EOF and when its parent is killed, and its helper exits with it. So nothing about which processes run changes. They become visible instead: - GET /v1/magpie/claude-runs (claude_runs.go) lists each run with its pid, model, account, state (answering, idle for its next turn, or waiting on tools), since when, when magpie lets it go, and its RSS, plus claudeRoom's live count. It is loopback only, refused like the heap profile, and served no-store. - `magpie claude-code runs` prints that list under the bound and says what the processes are and how long they are kept. - runs record when they started, when the current turn began, and the timer's deadline (endIn wraps every timer.Reset). The literal 30-minute timeouts become runTimeout. Tests: - TestClaudeRunsNamesEachProcess: idle, tools and answering runs are listed with the pids that are alive, and dropped once they end; every caller profileCallersRefused lists is refused. It went red with the route taken out (404), and with the guard off 3 callers got the list. - TestClaudeCodeRunsListsTheProcesses covers the CLI's lines and the case with no magpie running. The existing CLI test now stubs the gateway, so it never asks the live magpie on :3425. - oneport_test knows ClaudeRunsPath. Real run (10-27): a sandbox HOME with a made-up Claude sign-in in its own CLAUDE_CONFIG_DIR (no keychain item was written for it), `magpie serve` on 127.0.0.1:47820, and a `claude` wrapper that exec'd real Claude Code 2.1.311 against a mock Anthropic API. 8 concurrent subagent-like requests left 6 Claude Code, each with its helper. `magpie claude-code runs` listed the same 6 pids ps showed, idle, ends in 59m, about 160 MB each. SIGTERM to the sandbox serve ended all 12 within a second. Run (go1.26.8, -tags nogui, private GOCACHE): - At 184b4b8ba (this change on origin/main |
||
|
|
e4552cca9f |
library: a cargo RTK upgrades on Windows, and says why when it can't
新v学员 (Discord #feedback, 10-27): upgrading an RTK installed with cargo
failed silently on Windows. Four causes, each fixed:
- No cargo on magpie's PATH (magpie started before Rust was installed,
or from a shortcut whose PATH rustup never touched): rtkUpgrader gave
no upgrade, so Upgrade was greyed with only a tooltip, which a click
never shows. Now the cargo rustup put beside rtk is run by its path;
with no cargo anywhere, the card (and the CLI) says it was installed
with cargo, to install Rust from rustup.rs or run the command shown
(RTKView.NoUpgrade, Manual), and UpgradeRTK's error says the same.
- CARGO_HOME (D:\Rust\.cargo is common) moved cargo's folder: an rtk
there wasn't cargo's to magpie. cargoBins reads it, for finding rtk
and for the upgrade; on Windows the folder matches whatever its case.
- cargo install --git built rtk-ai/rtk's default branch, develop, whose
Cargo.toml says 0.49.0 while v1.1.0 is out from master: the upgrade
left rtk as it was, or older, on every OS. It now names --branch
master, as rtk's own installation guide does.
- Windows refuses cargo's move over a running rtk.exe ("failed to move
… (os error 5)", exit 101, after the whole build), and an agent runs
rtk for every command. On that refusal the rtk is renamed aside
(rtk.exe.old-<pid>, which Windows allows), a copy put in its place,
and cargo run again; its build is kept in magpie's CARGO_TARGET_DIR,
so the retry builds nothing. Old copies are removed on the next
upgrade.
A failed cargo now says its first error with the cause, and what to do
for the common ones (rtk in use, link.exe/dlltool missing, GitHub
unreachable), not its last three lines, which only said the build
failed and where its files were left.
Run:
- Real Windows (10.0.0.132, sandbox CARGO_HOME/RUSTUP_HOME/USERPROFILE,
rustup + cargo 1.99.1, removed after): plain cargo install over a
running rtk.exe fails with "拒绝访问。 (os error 5)" exit 101; a
Windows build of this package's tests (GOOS=windows go test -c, a
scratch test calling ReadRTK/UpgradeRTK, not committed) with no cargo
anywhere gave NoUpgrade "cargo" and the new error; with cargo only
beside rtk (not on PATH) and the old rtk.exe running, UpgradeRTK
built rtk-ai/rtk master and went 1.0.0 -> 1.1.0 in 3m26s, the running
rtk kept running, rtk.exe.old-<pid> was left and removed once it
exited. The build used the gnullvm toolchain with llvm-mingw; the
gnu toolchain failed with "error calling dlltool" and lld's missing
-lgcc_eh, which is the output the tests use.
- New tests (rtk_cargo_test.go) and the updated
TestRTKUpgradeCargoNamesThePackage are red on origin/main
(
|
||
|
|
2afacd7d18 |
windows: a terminal waits for magpie, through a magpie.com beside the app (#3737)
The Windows app is linked with -H windowsgui so a double click opens no console, and PowerShell and cmd don't wait for a GUI program. The prompt came back before magpie printed, and `magpie plugin login`'s password keys went to the shell as well as to magpie (tom047784 / TomXPRIME on Discord, 10-27; the handle error in the same report was |
||
|
|
3ec3cb704b |
plugin: turning an agent plugin off or removing it puts the agent's config back first (#3810)
An agent a plugin adds is known only while the plugin is on. Turning the plugin off or removing it (CLI `magpie plugin off/rm`, or the Plugins page) left the agent's config on magpie, and `magpie <agent> default` then said `unknown agent`, with nothing to put it back. - provider.SetPluginOff (off) and provider.RemovePlugin first call provider.PluginAgentGoing, set by internal/agent to UnwirePlugin: the agent is disconnected as `magpie <agent> default` does (Disconnect), while the plugin still loads. A plugin off already is read from its module as it is; one whose module is gone puts back each file whose stash names its spec. If that fails, the plugin is left as it was and the error says why. - The stash now records the plugin's spec and the file's format, so `magpie <id> default` for the agent of a plugin deleted on disk puts the file back from the stash alone (agent.RestoreGone; an older stash's format comes from its file's name, agentplug.FormatOf). A file that no longer holds magpie's gateway key is the user's and is left alone; one that can't be read is unknown: nothing is written, the stash is kept. With the plugin only switched off, `default` says the agent is off magpie already instead of "unknown agent". - Turning the plugin back on (or installing it again) does not rewire the agent by itself: its config stays as the user had it. Connecting it (its switch on the Agents page) puts back the model it was on, through Disconnect's `.reconnect`. The CLI says so when it turns off or removes a plugin whose agent was on magpie. Run (this change on origin/main |
||
|
|
9ae7912210 |
agent: plain agy starts Antigravity CLI on magpie in a new terminal
agy takes magpie's gateway, key (GEMINI_API_KEY, GOOGLE_GEMINI_BASE_URL)
and --model only from how it is started, so a user on magpie had to copy
the launch command at every start (bestony on Discord). Now:
- magpie agy run [args…] execs the real agy with the env and --model when
agy's settings.json is on magpie's model (a --model/-model the user
gives wins), and runs agy untouched otherwise. On Windows agy is a child
through proc and its exit code is passed through. It refuses when "agy"
on PATH resolves to magpie itself. magpie agy env prints what run adds
(PowerShell's function reads it, since the desktop exe has no console).
- update.ShellFunction puts a function named agy in a marked block
(# >>> magpie agy >>> … # <<< magpie agy <<<) of each shell profile
cliShells finds: .zshrc (ZDOTDIR), the bash profile a terminal reads
(.bash_profile, or .bash_login/.profile on macOS when that is missing),
config.fish once its folder exists, and the PowerShell 7 / Windows
PowerShell profiles where the execution policy runs them. Only the block
is written, in place, temp-and-rename, CRLF and BOM kept; a profile that
can't be read is not written; only files inside the home are. The
function falls back to `command agy` when the magpie it names is gone.
- Set to a magpie model writes the block, stepping out takes it out (the
file comes back byte for byte), and Sync at start writes it for users
already wired.
- Notice, Launch tooltip and the connect panel say plain agy works in a
new terminal, with the command for a terminal open now. Strings in
i18n.js for zh, zh-TW, ja, de. docs/reference.md and
docs/subsystems/agent-wiring.md updated.
Run at this head (base
|
||
|
|
a3d4f8c5c4 |
cli: magpie serve and magpie web give what they start the user's node too (#3803)
|
||
|
|
1885c607e2 |
gateway: Antigravity answers Codex's switched threads and Hermes' old persona with no setup
Antigravity answers some agents' system prompts with a fake 429 "Resource
has been exhausted", whatever quota is left. Jodiezzzzzz on X (10-27): a
Codex thread begun on GPT-5.x and switched to an Antigravity model got 429
again and again. zgoodz on X: "antigravity在Hermes里一样429". v0.1.1625
told the Codex case as a 400 with "start a new chat", which isn't zero
setup.
What Google matches, each tried on a real Antigravity account on 10-27
(in the system instruction, any case):
- "x-anthropic-billing-header:" (Claude Code)
- "built on Anthropic's Claude Agent SDK" ("running within the Claude
Agent SDK" goes through)
- "You are Codex, an agent based on GPT-5" / "..., a coding agent based
on GPT-5"
- new: "Hermes Agent, an intelligent AI assistant created by Nous
Research", Hermes' earlier default SOUL.md, kept by anyone who edited
their SOUL.md. Hermes' current default ("You are Hermes Agent, built by
Nous Research") goes through.
Each goes through with a zero-width space after its first letter.
"You are Hermes Agent, an intelligent..." still fails, so the
break goes inside the matched phrase itself.
Now codeAssistBody puts that zero-width space into each matched line
(antigravityCloak), in the system instruction only, and only for an
Antigravity account. Gemini CLI's account on the same envelope, and
every other provider and protocol, get the prompt as the agent wrote
it. The text added names nothing; it is one U+200B per line.
`magpie provider set antigravity prompt=as-written` (PromptAsWritten,
kept through Save/withPicks and the GUI's save) turns it off. Then the
v0.1.1625/#2156 fallback stands: a 400 with a hint (now one for Hermes
too, in the Routing page's five languages) and Antigravity skipped for
6h in a group.
Default-on, as the community antigravity-cloak middleware's README
says, changes what Google is sent so a request it means to refuse goes
through. That may be against Antigravity's terms. The owner asked for
it ("破解过 antigravity 提示词让其可以在别的 agent 中使用"), and it is
scoped to Antigravity accounts with an off switch.
Run at this tree (rebased on origin/main):
- go test -count=1 -timeout 45m ./internal/gateway/ ./internal/provider/
./internal/cli/ ./internal/gui/: gateway, cli and gui ok; provider
died in TestUnreadLoginsWriteErrorsKeepCredentials ("close of synctest
channel from outside bubble" in filememo.Forget), #3632, red on main
since 091153bf; with -skip of that test, provider ok.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: ok. go build: ok.
- GUI (node --test, Playwright 1.62, chromium and webkit):
routing-ag-turned-away, i18n-keys, gui-ja, gui-de, gui-zh-tw,
routing-js, panel-routing: 45 pass, 0 fail.
- Broken by hand: with the cloak skipped, TestAntigravityAnswersHermes
AndCodexByDefault and TestOnlyAntigravityIsSentThePromptBrokenUp go
red; without withPicks' line, "prompt=as-written isn't kept".
- Real account, sandbox HOME with only the Antigravity login copied,
this build on 127.0.0.1:3496:
- real Hermes Agent (AIAgent, sandbox SOUL.md = the old persona plus
one line): "OK", 200. With prompt=as-written: 400 with the Hermes
hint. Back on default: 200.
- real Codex 0.162.1: a thread begun on gpt-5.5 (against a local
fake Responses server), then `codex exec resume <id> -m
antigravity/gemini-3-flash` through this build: "OK". With
prompt=as-written: 400 with the Codex hint.
- a synthetic switched Codex Responses thread, with and without
web_search: 200.
- opencode, droid, kimi, pi, gemini-cli, qwen, crush, goose, amp and
openclaw identity sentences: never refused, as written.
Not tried: Claude models on Antigravity (the sandbox account's Claude
quota is spent, so the Claude Code lines were checked on Gemini 3
Flash only); other agents' whole prompts, only their identity lines;
the Windows box; the whole GUI suite.
The plugins repo's antigravity-cloak 0.1.2 adds the Hermes line for
magpies before this one.
|
||
|
|
d56c14e953 |
gateway: a single provider's busy or briefly rate-limited reply is waited out, for its own Patience (zoecats)
zoecats on Discord: a request to one provider (not a group) got a local
relay's short 429 straight back in Claude Code once the few same-one
retries were spent. A group would have held the agent and asked again.
A plain provider now takes the group's replan path (patience.go: replan,
pauseAlive, the held writer) once passing's same-one retries are spent:
its accounts take turns as members do, each pause never shorter than the
Retry-After, and a streaming agent gets keepalives past keepHeldAfter.
- Zero-config: unset, it waits singlePatience, PatienceDefault (60s),
counted from when the agent would have had the error.
- The user's value wins: Provider.Patience, the same values as a group's
Patience, set with `magpie provider set <id> patience=2m|off|default`
(at most 4m). The provider editor has no row for it (no new UI), and its
save keeps it. A group the provider is in keeps the group's own.
- Not retried: a Retry-After past the budget, quota/credit/plan limits,
401/403, refusals, response protection, didNotStream, and an agent
that has gone (499, try marked Gone).
- The try is traced with Again alone, so the Routing page tells it as
"tried again in …".
- codexReset (ChatGPT's 503 for a large request) is left out of the
plain-provider replan, so Codex still gets its 503 with advice.
- Codex's own one-account relay (codexUpstreamOn) does not join. It is
relayed outside the candidate loop, and its backend 429 is always the
plan's usage limit (codexBusy never retries one), so the short rate
limit this waits out doesn't arise there. Its overloads keep
lastRetries and then fallbacks.
longestPause became a var so tests can scale it. Tests updated for the
new count (1 + retries + replanRounds when it never clears):
- TestLastOneLeftIsTriedAgain
- TestRateLimitIsWaitedOut
- TestQueuedStreamFailureIsTheStreamsError
- TestOverflowTheVendorDidntSay
New tests, through the server with a fake upstream and injected
durations, waiting on trace state, not a duration:
- TestSingleProviderWaitsOutAShortRateLimit (stream and whole: 200,
keepalive before the answer, asked twice)
- TestSingleProviderPassesALongLimitThrough (an hour, quota, 401)
- TestSingleProviderAgentGoneInTheWait
- TestSingleProviderOwnPatienceWins (off, shorter and longer than the
default)
- TestPatiencePair (cli)
- TestProviderSaveKeepsPatience (gui)
Broken by hand, each red, then restored:
- singlePatience fallback 0 for a plain provider: WaitsOut stream and
whole got 429, and AgentGone never paused.
- replan's budget check off: PassesALongLimitThrough/an_hour, "magpie
waits to ask again".
- pauseAlive's ctx.Done case removed: AgentGone, "route done false
status 0".
- The gateway ignoring Provider.Patience: OwnPatienceWins off, shorter
and longer all red.
- The GUI save not keeping Patience: TestProviderSaveKeepsPatience,
"patience 0 … want -1 kept".
Run in this tree, before the rebase:
- go test ./internal/gateway ./internal/cli ./internal/gui: ok.
- ./internal/provider: ok with -skip TestUnreadLogins. That test crashes
with "close of synctest channel from outside bubble", the known #3632,
in filememo and not touched here.
- gofmt -l: clean.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go
vet ./...: all 0.
- go build for darwin, linux (nogui) and windows: ok.
Run again after rebasing on origin/main
|