e4e9eb0928becfa4e48484dde85ef5032671d582
428
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c01988e439 |
routing: a group's Small context first sends a request to the smallest window that holds it
yg6888 on X (tweet 2123308968848379920): in a group routed Smart, Cursor Plus's Composer and Grok 4.7 were never used. Not a bug: Smart orders by allowance tier, then soonest renewal, then listed order, and never weighs the context window, so the 1M members listed ahead always answered. The small ones were only ever reached as a fallback. Smart itself is unchanged; changing its order would move every Smart user's traffic. A group gets a new routing instead, `fit` (Small context first; 小上下文优先, 小上下文優先, 小さいコンテキスト優先, Kleiner Kontext zuerst): - routes.SmallFirst takes Smart's order and sorts it stably by band (a provider set to be used first, the rest with room, the all but used up) and then by window, the smaller known first, an unknown one last. - Its strategy sets ByWindow, so weighRouted fills Seat.Window from windowIn (the provider's own Contexts, else the catalog's). - roomy already leaves out every member the request is estimated past, so the first left is the smallest that holds it: a small model is never asked for a request too long for it, and keeps its last-resort place as under every routing. - The trace's rows carry `context`; the Routing page says "its 200K context window is the smallest that holds this request". - A group's only: provider.normalize already drops it from a provider and the CLI refuses it there. GUI menu, hint, why-lines, TUI and CLI (`routing=fit`, small-first) carry it; docs/reference.md, the gateway-routing and plugin-runtime pages and the en/zh/ja start pages say it, with the search index rebuilt (via docs-index.mjs; #7065). Run first at the tree rebased on origin/main |
||
|
|
ef997d186c |
serve: a SIGTERM finishes the requests in flight, for Kubernetes rolling updates
@justforlxz on X runs magpie in Kubernetes and every update cut the
requests in flight. A SIGTERM ended the gateway like Ctrl+C: the
listener closed at once and Shutdown cut what was left after 2s, an
agent's stream included, with no unready phase for the Service to see.
Now a SIGTERM to `magpie serve`, `magpie web` or `serve --web`:
- GET / answers 503 {"draining":true} at once, so `magpie healthcheck`
(the image's HEALTHCHECK, and the readiness probe the docs give) fails
and the pod leaves its Service's endpoints;
- in a pod (KUBERNETES_SERVICE_HOST) it keeps accepting for 5s while
that reaches kube-proxy and the ingress, then stops accepting;
- the requests in flight, streams included, get up to MAGPIE_DRAIN to
finish: unset, 20s in a pod (k8s' default grace is 30s, with room to
save after) and 7s elsewhere (docker stop and Compose kill at 10s,
and a drain past that would lose the state saved at the end);
seconds or a Go duration; 0 ends after 2s as before; an unreadable
value logs and uses the default. magpie web's page port (which
serves /v1 too) shuts down within the same grace.
Ctrl+C and SIGHUP end as before. Nothing to configure.
A request still answering at the end of any drain was logged as "cut"
but kept running, its upstream call too, until the process exited:
Shutdown doesn't close active connections. The gateway now closes them
after a failed Shutdown, so a gateway restarted in-process (the GUI's
restart, a test) leaves nothing holding the provider catalog
(holdCatalog). TestDrainEndsAtItsGrace's cut request, still in flight
after it returned, made the next test, TestGrokGetsAgentMessageAsUser,
read migrations.json through that hold and fail in a full gateway run
on WSL; the test now waits for it to end, and without the Close that
wait fails at 30s.
PID 1: the image's ENTRYPOINT is exec form, so magpie is PID 1 and gets
the SIGTERM itself (it calls signal.Notify). As PID 1 it exits 2 rather
than 143 after the drain, the same on the old code.
/config shared by two pods (a RollingUpdate overlap) is not verified
safe: files are flock'd and written by rename, but the serving magpie's
sign-in renewal, plugin sign-in renewal and check-ins would run in both.
The docs say one pod per volume with strategy: Recreate (an RWO volume
on another node also stalls a RollingUpdate). Requests sent between the
old pod's end and the new one's start are refused; the drain covers what
was in flight.
Docs: a Kubernetes section (Deployment with an exec readiness probe,
terminationGracePeriodSeconds, Recreate, the RWO note) and a
MAGPIE_DRAIN row on docker.html in en, zh and ja; docs/reference.md's
Docker section; site index regenerated.
Run:
- TestDrainedGatewayFinishesItsStream, TestDrainEndsAtItsGrace,
TestHandedOverGatewayFinishesItsStream, TestReadOnlyKeyEveryRoute,
TestDrainGrace, TestDrainOnSignal and the cli Signal tests: ok (mica).
- Broken by hand: without Drain's grace in drainFor,
TestDrainedGatewayFinishesItsStream fails "the gateway ended with a
stream in flight".
- Real binary (before the 7s default, which applies outside a pod
only, and the Close), sandbox HOME, fake SSE upstream streaming 10s, SIGTERM
at +2s, KUBERNETES_SERVICE_HOST set, magpie as PID 1 in its own pid
namespace (unshare) on Linux (WSL magpie-desktop), serve and web:
new: healthcheck fails while draining, a new request 1s after SIGTERM
200, the stream completes at +10s, exit at +11s. origin/main: the new
request is refused, the stream is cut at +4s after 4 chunks. Also
serve on macOS (mica): same, exit status 143.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./..., go build: ok (mica), before the 7s default
and the Close.
- Full suite, go test -count=1 -timeout 45m ./..., on Linux (WSL
magpie-desktop; mote and mica were each running another session's
suite) at the first version of this change on
|
||
|
|
3132fa1cd9 |
library: Rules, a folder of rules given to Claude Code, Cline and Kiro CLI (JonahFu on X)
JonahFu asked on X (tweet 2123237371739316685) for Claude's rules folder in the Library. A new Rules tab keeps rules once and gives each to the agents ticked for it, in the folder each reads by itself: - Claude Code: <claude dir>/rules/<name>.md. `paths` is the only front matter key it reads (code.claude.com/docs/en/memory). Checked on real 2.1.327 in a sandbox: it reads every .md under the folder, loads one without paths at launch, and one with paths when Read/Write/Edit touches a matching file. - Cline: <cline dir>/rules (CLINE_DIR, else ~/.cline). Cline 3.0.70 reads every rule always and has no paths key, so a rule with paths isn't written for it; the agent gets a problem and the editor says why under the paths. - Kiro CLI: ~/.kiro/steering, `inclusion: fileMatch` + `fileMatchPattern` for paths, else always. A rule named "agents" is refused there (it would be AGENTS.md on a disk that ignores case). - Not listed: Cursor (user rules live in its settings; .cursor/rules is per project), Codex (its rules are execpolicy), Droid (command permissions), Gemini CLI, Qwen Code and OpenCode (no rules folder). A body starting with --- gets an empty front matter first. Files are recorded with their hash in Applied.Rules through the same syncOwnFiles as subagents and slash commands: a file of the user's own by that name, or one magpie wrote that the user edited, is never written over or taken away. Bundles (backup, WebDAV) carry rules; a bundle from an older magpie leaves this computer's alone. The editor lists each agent's file to reveal. No CLI yet. docs/subsystems/library.md: a Rules row and its tests. Run (mica-run, at this tree): - go vet -tags nogui ./internal/library ./internal/gui ./internal/davsync ./internal/cli: ok. gofmt -l: none. - go test -tags nogui -timeout 45m ./internal/library ./internal/davsync: ok (TestRulesEachAgentsFile, TestRulesKeptToTheirPaths, TestRulesLeaveTheUsersFiles, TestRuleCheck, TestRulesCarried). - node --test library-rules, library-subagents, library-commands, library-hooks, library-loading, library-groups, i18n-keys, i18n-en-no-cjk (Chromium and WebKit, 420 and 1100 wide, en zh zh-TW ja de): 78 of 78. - The full suite and cross-OS vet ran at the next commit, which this one is under. - Real use: Claude Code 2.1.327 in a sandbox HOME loaded a rule without paths at launch and one with paths only on touching a match; a sandbox magpie on mica wrote ~/.claude/rules/go-style.md with paths: ["**/*.go"]. Not tried: Cline and Kiro CLI loading the files for real, project-level rules (.claude/rules in a repository), Copilot and CodeBuddy (not verified, not listed), Windows and Linux. |
||
|
|
7d5db0f29a |
cli: a command that ends ends its plugin hosts, and one that doesn't serve starts none (#7146)
athemeroy (WangYeruo on X) runs `magpie serve` as a LaunchAgent with the
magpie-google-ai-studio browser plugin and 11 accounts. Each
`magpie --version`, `version`, `licenses` or `group <id>` run beside it
left a second magpie-bun host with PPID 1, holding the Chrome profiles
the gateway's host wanted ("Chrome exited before starting WebView").
Their analysis was right on each count:
- plugin.Cached starts a background list of the plugins' providers
whenever this process hasn't listed them (provGood is in memory), so
every short command reaching provider.Catalog (startUp's RenameLegacy,
groups, models, ...) started a host.
- Main ended through os.Exit and never stopped it. A host whose stdin
closes leaves only once nothing is pending, and a plugin holding a
browser keeps Bun up meanwhile, so the host outlived magpie, adopted
by init. SIGTERM (launchd stopping serve) orphaned serve's own host
the same way.
- --version and licenses were answered after startUp.
Now:
- Cached asks the plugins in the background only when
plugin.ListInBackground is on; run sets it from servesPages (app,
web, serve, TUI). Other commands read the list on disk.
- Main ends through exit(), which runs plugin.EndHosts first, on
success and error; die does too on SIGINT/SIGTERM/SIGHUP, bounded by
hostsOnSignal (20s, past the 15s a renewing host gets).
- provider test returns exitError instead of os.Exit(1).
- -v/--version/version and licenses answer before any start-up work.
Audit of the os.Exit calls in internal/cli: data_cli.go:135 and the
CheckEnv exit in Main run before anything can start a host;
claudeLetGo already called EndHosts.
Tests (red on the old code, the non-test sources reverted to
|
||
|
|
598bc45346 |
update: a container's hint names the found version's own image, not :latest (fishmagic80 on X)
In Docker, Settings › About on the Daily channel said "0.1.4479 is out … docker pull ghcr.io/yetone/magpie:latest". :latest is the newest release (docker.yml), daily and stable the Daily and Stable channels' (docker-daily.yml, docker-stable.yml), so :latest held 0.1.4504, not the 0.1.4479 announced; on Stable it is weeks apart. docker.yml writes every release's own tag (ghcr.io/yetone/magpie:0.1.4479; checked on ghcr: 4479, 4395, latest, daily, stable, 0.1 all resolve, daily = 4479's digest). update.Image(version) is that tag, and every place that printed the command names it now, with "recreate the container from it" (a compose file on :latest would otherwise run the old tag again): - the GUI's Version row and Update pill (/api/update's new `image`, stuck "container"; app.js updateStuck); - `magpie update` in a container (internal/cli); - a Remote magpie row's tip for a container: UpdateRemotes now keeps the version it asked for on an "unsupported" answer too, so the tip names that version's image; - i18n zh, zh-TW, ja, de for both strings; - docs/docker (en, zh, ja): Updates says Settings › About names the version's own image and that latest may be ahead of the channel; llms-full and search indexes rebuilt (site/docs-index.mjs). Run at this tree (mica, through mica-run): - red on origin/main |
||
|
|
4e24994a6e |
gateway: a key let use Magpie Memory reaches it from another computer
Niapyaya on X reaches their own MCP servers through the MCP hub from a remote machine, but not magpie-memory: memory answered the agents on this computer alone, on /mcp/magpie/memory ( |
||
|
|
2ab2f69132 |
agent: Codex's status line shows the account's quota or the relay's balance (opt-in)
lyj1115 on X asked for the current account's quota, or the relay key's
balance, under Codex's chat box, off by default. Codex's TUI draws its
footer from a status line provider from 0.171.0-alpha.12 on: a stdio
MCP server whose tool advertises a statusline entrypoint, picked in
[tui] status_line_provider behind [features] tui_extensions_statusline.
Codex reads it about once a second with the thread's id. Nothing is put
into the prompt or the model's reply.
- `magpie statusline --codex` is that server. Each read asks the local
gateway for the thread's latest route and the kept quotas (no vendor
read). It answers `→ provider/model` and that provider's account that
answered last, with its windows or a key's balance. A gateway that is
down gives a null tree, never an error, because an error stops Codex's
reads. The tool's name and words name neither magpie nor a vendor,
since the tool is listed to the model.
- A status line square on Codex's row (`magpie codex statusline on`)
writes the flag, [mcp_servers.quota_line] (this magpie by full path,
args statusline --codex, env_vars = ["MAGPIE_ADDR"]) and the
provider. Every write is read back, and the file is restored on a
mismatch. Off and Disconnect take out only magpie's keys, and the flag
only when the stash says magpie wrote it.
- Nothing of the user's is written over. A provider of their own, a
quota_line of theirs, the flag turned off or an unreadable file keeps
the square away and refuses on.
- The switch is offered only when a Codex CLI here is 0.171.0-alpha.12
or newer (0.170.0 reads the keys and draws nothing), and only on this
computer, not in a WSL distro.
- In the GUI, the status line square's title takes the note of its
field's on option, which Claude Code's field already sent with the
same words TOGGLES kept, so Codex's says its own words in en, zh,
zh-TW, ja and de. TOGGLES' copy of Claude's note went, and app.js
stays under its budget (30 bytes of room) without a raise.
The Codex desktop app has no such footer. cockpit-tools reaches it
through a debug port, and magpie doesn't.
Run (WSL magpie-desktop, since mote's load was over 18):
- go vet -tags nogui ./...; GOOS=windows go vet of agent, cli, provider
and gui; gofmt -l clean.
- go test -tags nogui of ./internal/cli and ./internal/provider: ok.
- ./internal/agent -run "CodexStatus|Statusline|StatusLine|TestCodex|
TestWSLCodex": ok.
- ./internal/gui -run "CoreScript|Budget|I18n|Keys" and node --test of
codex-statusline, claude-statusline and i18n-keys (both engines, every
language, window and panel), with vet (and GOOS=linux and windows
vet) of agent, cli, provider and gui, on mote at the rebased head
(on
|
||
|
|
ff64cb35d3 |
cli: TestSignalSavesTheSessionIndex sets its stubs before the handler runs
The test swapped sessionsSaved and saveOnSignal between two SIGTERMs while endProbesOnSignal's goroutine was alive. A signal a test sends to itself gives the race detector no ordering, so -race reported two DATA RACEs at finishSignalGateway and failed the test, on main |
||
|
|
bfbc22e190 |
claude: an idle session is saved whenever the gateway ends or hands over (#7017)
recih: after magpie web restarted (an update's re-exec, or Quit and
start again) the next Claude turn replayed the whole conversation
instead of resuming its session. Web.Wait closed the page server and
never drained the gateway, so abortAll never ran and claude-shelf.json
was never written.
- Web.Wait drains the gateway (Close: page server, then stopServing)
before the plugin hosts end and before update.Reexec.
- Desktop quit: OnShutdown calls stopServing.
- Signals: web, serve, the TUI and the app register their gateway with
the signal handler (stopGatewayOnSignal). SIGINT, SIGTERM and SIGHUP
drain it, sessions saved, before magpie dies of the signal. The return
path waits for a drain the signal already started. The TUI and the
app take SIGINT/SIGTERM themselves, but SIGHUP (the terminal closing)
stays with magpie. runTUI, runGUI and runPanel now register
tui.StopGateway and gui.StopServing for it (added in review).
- Handover: the successor answered a Claude turn before the predecessor
had saved its shelf. The predecessor now serves
GET /_magpie/claude-ready on its callback socket, answered once
abortAll has run. A Claude turn on the successor waits for it.
- The predecessor saves only after every request it holds has ended,
of any provider, which can take up to handedOffDrain (15m).
- Added in review: the wait is bounded by predecessorWait (90s, inside
Claude Code's ten minutes for a reply). Past that, the turn goes on
as before, as a replay, and no later turn waits
(errPredecessorSlow).
- loadShelf still reads a shelf written later, at the next turn with
no session found.
- A predecessor without the endpoint (404) keeps the old race.
- Sweep: sweepSessions removed session files older than idleLongest.
That included a session kept for hours past a quota 429
(keepForReset) and one moving from the shelf to a run.
- Those are now protected: the shelf file, the in-memory shelf, the
resuming set and active runs.
- An unreadable shelf skips the sweep.
- loadShelf and the sweep's snapshot are serialised by shelfFileMu.
The bridge lock is held only for the shelf maps, never across the
file's reads (added in review: the branch read the file under b.mu,
which every Claude turn takes).
From recih's branch fix/web-restart-session-persistence (7a0261cc1,
fab0ea651), with the review's follow-ups. Not taken from the branch:
the .github/workflows/test.yml change (contributors.md: .github/ stops
for the maintainer), and the test-flake commits in other packages,
which are separate goals.
Red on origin/main
|
||
|
|
78b6d47ccc |
update: a version newer than its channel's says nothing comes until the channel passes it (realfxw on X)
realfxw on X (tweet 2123033167170814171): "升级无效,重启了无数次,一直卡在这个版本", on 0.1.4445. Every release around it has its 17 assets, so nothing was missing to download. Their Update channel is Daily, and Daily's pick (the 11-17 20:00 UTC cut) is 0.1.4395, older than what they run. The app keeps the newer version and installs nothing until Daily passes it, which is right, but the version row said "Up to date on Daily" (每日版已是最新) and, before a check, Automatic updates are off with a bare Restart. They restarted again and again waiting for an update that couldn't come. - update.go: the update JSON says ahead when the state is latest and this version is newer than the channel's. - app.js: the row says "Newer than Daily's 0.1.4395; it updates once Daily passes it", the newest on Every version after it, and Switch to Every version as before; one t() for both channels and the Every version tail shared with Up to date. Translated in zh, zh-TW, ja, de. - update_cli.go: `magpie update check` says the same, with `magpie update channel every` to get it now. - core_budget_test.go: +68 bytes of code on app.js and the core scripts, packed to the shortest form; renderUpdate draws on every window, so there is no page to move it to. - docs/reference.md: the channel section names Daily and the line. Red on the old code (upd-ahead-red, origin/main |
||
|
|
e08dc0fe58 |
provider: OpenAI's own API sends Responses turns over the WebSocket by default, only the new input each turn (KawaiiZapic on X)
KawaiiZapic's screenshot showed 6.4 GB up for 799 MB down: every turn went out whole. What each leg sends, checked in the code: - Codex on a ChatGPT subscription: the kept upstream socket already sends previous_response_id and only the new input (codex_socket*.go). - A Responses provider with socket=auto/on: the same, but socket was off unless someone ticked it, so an OpenAI API key provider sent the whole conversation each turn over HTTP. - A client's own previous_response_id is kept for api.openai.com, Azure and Ark (prevKeeps); other relays get the expanded whole turn, since they can't be trusted to hold the chain. - Claude Messages, Chat Completions and Gemini have no incremental protocol; those always send whole (prompt caching is what saves there). - The ↑ counter (upbytes.go) counts each upstream write once; no double count found. Change: a Responses provider at https://api.openai.com with no socket set now goes over the WebSocket (provider.SocketByDefault, mirroring codex-rs's create_openai_provider supports_websockets: true). socket=off is now stored, so unticking it there sticks; elsewhere unticked is still "". The CLI shows "auto (default)" and takes socket=off|default. The editor's WebSocket row moved into socketrow.js (imported as the editor draws), so app.js and the core shrink by 165 bytes and their budgets drop with them. Caveat: an OpenAI provider saved unticked before this (socket "") now goes over the socket until it is unticked again; the docs say so. Measured (fake api.openai.com over TLS, sandbox HOME, 20 turns of a 4KB user message each): socket off 20 HTTP posts, 876,345 bytes up; default 0 posts, 20 socket turns on one handshake, 84,928 bytes up (Traffic().Up equal to the socket bytes, so no double count). Run (mica). At this head, rebased on origin/main |
||
|
|
9314999a4a |
ccswitchlink: a ccswitch:// link that still reaches magpie goes to CC Switch, and so does the scheme (asombrado_a on X)
@asombrado_a (X, 2122995130097713493) has CC Switch and magpie both installed, and a ccswitch://v1/import link opened magpie. magpie claims magpie:// only since |
||
|
|
74bba1fa67 |
gui: Settings › Version and the tray restart magpie with no update (yansheng1003 on X)
yansheng1003 asked for a Restart beside Check: "每次改了需要重新magpie, 都要自己退出再启动麻烦". The Version row now has Restart after Check while no update is on offer (found, downloading, downloaded, blocked, a newer version named or a failed download each have their own buttons, which restart through the update and fill a 420px row), and the tray's Restart magpie is always shown: with an update ready it installs it as before, with none it starts this magpie again as it is. Both go through restartSelfNow (restart.go), the updater's own way of starting again: on macOS and Linux the gateway's socket is handed over (beginHandover), so requests in flight carry on; otherwise the bundle or binary is started again (update.Relaunch, relaunchBinary), and on Windows requests in flight are cut. magpie web runs itself again in place. POST /api/restart answers 204 and then quits, or 400 "magpie couldn't start again: quit it and open it again", and the row says Couldn't restart magpie with the reason and gives its buttons back. /api/update now says its run (the time this process started), so a browser's page reloads once another run answers. The click, its error and the reload are in versionrow.js, imported when Restart is pressed. The mirror's Download from GitHub click moved there too, so app.js stays under its budget with no raise (TestCoreScriptBudget at 1,088,248 and 1,272,581, as they were). The route is named in the CLI's notYet list. Words in en, zh, zh-TW, ja and de. What needed a restart before, besides an edited path plugin (the commit before): most settings already applied live (proxies, OTel, HTTPS/mTLS, LAN from the GUI, allow-lists, CORS, shortcuts, tray, language, name, fonts, port, hand-edited caller-keys, oidc-rules and library.json). Still start-only: LAN switched by hand in settings.json, environment variables, and in-memory routing state such as a rate-limited account's order; Restart is for those. Run: - Full Go suite (mote, -timeout 45m) at the head before the rebase and before versionrow.js: 101 packages ok; the reds were TestEveryRouteHasACommandOrIsNamed, TestEveryRouteIsNamedForTheCLI (the route unnamed) and TestCoreScriptBudget, all fixed here. - At this head (mote): go test ./internal/gui -run 'TestCoreScriptBudget|TestEveryRouteIsNamedForTheCLI|TestRestart| TestUpdateSaysItsRun|TestTrayMenu' ok; ./internal/cli -run TestEveryRouteHasACommandOrIsNamed ok. go build, go vet, GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... ok; gofmt -l clean. - GUI (mote, both engines, at this tree): update-*.test.cjs, version-restart, settings-update-source, refresh-page, old-webkit, i18n-keys and i18n-en-no-cjk: 628 pass, then 6 red in update-check (Restart not dimmed while a check runs), fixed here (Restart dims with Check); update-check, version-restart and old-webkit again: 90 pass, 0 fail. - Real restart (mote, sandbox HOME): a built magpie web with MAGPIE_WEB_KEY, signed in through ?k=; POST /api/restart answered 204, the same pid ran again with a new run, and the cookie still signed in. - Broken by hand: restartAppFrom returning true on an error, and TestRestartStartsMagpieAgain is red; version-restart.test.cjs on the old app.js is red (21 on chromium); with Restart shown beside an update on offer again, "no Restart beside an update on offer" is red in all 5 languages and both engines (12 fails). - The whole GUI suite is still running on mica at push time; its reds are compared against origin/main and fixed or filed after. Not tried: the tray item and a restart in the real macOS, Windows and Linux apps (only magpie web was restarted for real). |
||
|
|
6c6d3bc842 |
gateway: Codex's web.run goes to a relay set to search by itself (YIXIE233 on X)
YIXIE233's GPT relay serves /v1/alpha/search itself, but Codex's web.run (<base>/alpha/search) only went upstream for ChatGPT accounts; for every API-key provider magpie ran its own searcher. The per-provider "Searches the web by itself" switch (search=yes, Advanced > Web search, default off) already sent Responses' web_search tool and Claude's WebSearch through as sent; now it covers web.run too. - relaySearchers resolves the model's provider, or a routing group's members in order (the leading candidate decides, as for the request). A provider qualifies when it has search on, is an API-key provider (not a ChatGPT account, not a plugin) and has a Responses base. - The search goes to that base's /alpha/search with the provider's key, Codex's headers, originator and the agent's User-Agent. - If the relay fails, magpie searches in its place and the output says "X's web search failed (why); magpie searched in its place." - Settings' "magpie searches for every model" still overrides it. - GUI help text, every language, names web_search and web.run; the CLI help, docs/reference.md and docs/subsystems/gateway-routing.md say so. Tests: TestCodexWebRunGoesToRelayThatSearches and TestCodexWebRunInGroupFollowsLeadingMember are red on the old code (magpie's searcher answered). TestResponsesWebSearchToolToRelayThatSearches guards the web_search pass-through. provider-search.test.cjs covers en, zh, zh-TW, ja, de in both engines and at 400px (no sideways scroll). Run (mica): gofmt clean; go vet, GOOS=linux and GOOS=windows vet ok. Full go test ./... -timeout 45m before the rebase: 102 packages ok, only internal/gui TestCoreScriptBudget red (app.js 22 bytes over); fixed by shortening the English help key (net -2 bytes), budget not raised. At 64c5e1e0a (on origin/main d4af0ca4f; then rebased over |
||
|
|
ae94571d70 |
library: a project's own instructions, in the file each agent reads
@VictorHong1022 on X asked to manage AGENTS.md per project beside a project's skills, so the shared instructions keep only general rules. A project in the Library now has instructions of its own (the Instructions tab, expand a project; `magpie library project instructions <dir>`). magpie writes them into the project file each picked agent reads there, by that agent's own name for it: Claude Code CLAUDE.md (or .claude/CLAUDE.md when that is the one there), Codex and pi their override first, Gemini GEMINI.md (or its context.fileName), Qwen QWEN.md, CodeBuddy CODEBUDDY.md, the rest AGENTS.md. magpie owns only a marked part (<!-- magpie:begin … --> to <!-- magpie:end -->): the user's own text around it is kept byte for byte, CRLF included, a hand edit of magpie's part stays until the project's text changes, a file magpie made is listed in the repo's .git/info/exclude and removed when emptied, and an agent's user-wide instructions file is refused. Worktrees of the project follow it. A first text goes to the agents the shared instructions are on for, else every agent here that reads a project file. Problems show as the project's "instructions" problem. Tested: - internal/library: 8 new tests (block kept around user text, CRLF, hand edit kept, made file excluded and removed, renamed files, global file refused, worktrees). Four broken by hand, each red. - internal/cli: TestLibraryProjectInstructionsCmd; red with the default agents dropped. - GUI: project-instructions.test.cjs, en and zh, chromium and webkit, 6 of 6. Red when Goose (no project file) was offered, and red when the defaults ignored the agents the instructions are on for. - Real use on mote: the built binary, sandbox HOME and project. add, text, agents; CLAUDE.md kept CRLF with the part appended; AGENTS.md and GEMINI.md made and excluded; the user-wide CLAUDE.md untouched; zed refused; an edited part survived `library sync`; `agents none` put CLAUDE.md back byte for byte, removed the made files and emptied the exclude block. - Full Go suite (go test ./... -timeout 45m) on mote: 103 packages ok, gofmt clean, go vet darwin, linux (nogui) and windows rc=0, at this change on origin/main |
||
|
|
5bfa57e3d3 |
usage: check one model on one provider with a few fixed-answer calls, kept beside the other providers
skingstyle48487 on X runs more than ten relays and asked for something like the "pelican test" to spot one that waters a model down. In a follow-up (2122694296054972815) they said speed, failures and the model's name show whether a relay is fast and stable, not whether the model got weaker. They asked for small tests with known answers, the share of right answers and of right tool calls, and relays compared side by side. On Usage › Requests › Model speed › Providers, each row has a Check… that opens a dialog. Opening it sends nothing; only its Check makes the calls. POST /api/relay-check (gateway.CheckRelay) makes 6 small streamed Chat Completions calls through the gateway, pinned to provider/model as an agent would, three at a time: - write 1 to 40; - 1234 × 5678, 987 × 654 and 2468 × 1357; - weather in Paris and time in Tokyo, each call offering both tools, so the right one has to be picked. Each part says what it found, never a verdict on the provider: - whether the answer was the expected one, and what came back; - the model the reply named, when the ledger would call it another model (usage.Swapped, not SameSpelled or ListedAs); - the provider that answered, when the call was handed on; - how many input tokens the 118-character prompt was counted as; - first token, tok/s and the whole time. The dialog heads the parts with "Answers right: n of m" and "Right tool calls: n of m". The numbers come from the gateway's own usage records (a tap in appendUsage keyed on the request's context), not from each protocol's reply. The tally of each provider's last check is kept in the window's storage. The Providers table then shows Answers and Tool calls columns: sortable, amber when short of all, a dash for providers not checked, so relays are compared side by side. The dialog code is a lazily loaded root script (relaycheck.js), as app.js has no room left. Run, at this head: - mote: go test -timeout 45m ./internal/gateway ./internal/gui ./internal/cli ./internal/usage: ok (the full ./... suite passed at 41d88731c, before the fixed-answer calls; mote and mica were each running another session's GUI suite at this head); - gofmt -l, GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./...: clean; - go test -run 'CheckRelay|ReadChatStream' -v ./internal/gateway (5 tests pass); - usage-model-speed.test.cjs, chromium and webkit, en, zh, zh-TW, ja and de at 400px: 12/12; - i18n-keys and old-webkit: their only reds are the three on origin/main, each filed (#6877 ", with an image", #5919 :has(), #6030 headerpresets.js); - TestCoreScriptBudget and the app.js budget: ok, not raised. Broken by hand: - taking tapUsage out of appendUsage turns TestCheckRelayAnsweredAsAsked and TestCheckRelaySaysWhatDiffers red; - dropping the tool-name check turns TestCheckRelayCountsEachAnswer red (get_weather for Tokyo read as right); - pressing Check as the dialog opens turns the GUI test red ("opening the dialog sends no call"). Not tried: - the whole GUI suite at this head (both machines busy with another session's suite); - a real relay (fakes only); - a context-window probe; - a comparison with the vendor's own count_tokens; - a periodic check (the check runs only on a press). |
||
|
|
50c5a52dbd |
backup: a backup file carries the usage history, and a restore merges it (JasonLeeForOnly on Discord)
JasonLeeForOnly moved magpie to a new server with magpie backup / magpie
restore and lost every call's usage history: a backup file held the setup
only.
- backup.WithUsage puts usage.jsonl's whole lines (gzipped, usage.LogBackup)
and the quota history (gzipped) in Bundle.Usage. magpie backup and
Settings -> Sync -> Export add it unless --no-usage / the tick says no.
Collect never does, so sync, join and automatic backups are unchanged.
- Restore (Parts.Usage, on in All; magpie restore --no-usage and the Import
tick turn it off) merges: usage.MergeLog appends the lines the log here
doesn't have, compared byte for byte as a multiset, so restoring the same
file twice adds nothing and two equal calls both arrive. It reads most
of the log before the gateway's log lock, the rest under it, and appends
with O_APPEND in 4MB chunks, after a newline when the log ends in an
unfinished line. Quota points merge with provider.MergeQuotaHistory.
A file without usage (older magpie, or --no-usage) restores as before.
- Result.Usage is the calls added; the CLI and the Import form say it.
- Docs: sync-backup.md, reference.md, site sync pages (en, zh, ja) and the
search index/llms-full.txt rebuilt with node docs-index.mjs.
Not changed: where usage is also shared by sync, the old computer's calls
are in usage-others and, after a restore, in this log too: filed #6987.
Run on mote at this head (26f69e85e rebased on origin/main
|
||
|
|
64ad53f6c7 |
sessions: magpie sessions search and show, for agents (yansheng1003 on X)
yansheng1003 asked for a command or skill an agent can call to search
and read its sessions. magpie had the search on the Sessions page and
in the Magpie Sessions MCP server, but not on the command line.
- `magpie sessions search <words…> [--agent] [--days N|today|all]
[--limit N] [--wait] [--json]`: the Sessions page's search
(sessions.SearchSaid over said-v1.db; SearchSaidSince adds the --days
bound), newest first, each hit named agent:id with title, folder,
time and the words round the match. A one-shot command waits for the
index (SaidReady, 60s by default, a progress line on a TTY only).
- `magpie sessions show <agent:id|id> [--find] [--from N] [--max-chars N]
[--json]`: the viewer's reader (TranscriptOf, TranscriptAt) as text,
from where the words were said; --json is the page's transcript.
- One renderer: the MCP server's search_sessions/read_session text moved
to sessions.SaidText/SessionText (said_text.go), with how to ask for
more given by each caller (TextHow). The MCP server's output is
unchanged (its tests pass as before).
- Consent: neither reads, nor makes the index, until the user has
answered which agents magpie may read; it prints notAskedLine and
exits 1. An agent not allowed is ErrNotRead for --agent and show.
- Flags: an unknown flag or a missing value is refused with the usage,
never taken for words or a session id; `--` ends flags; -h/--help
prints the subcommand's own usage (help_cli.go).
- Parity: /api/sessions/said and /api/sessions/transcript now map to
these commands (settings_parity_test.go).
- Library: magpie-sessions is a featured official skill
(magpie-community/plugins skills/magpie-sessions, pushed as plugins
cf5b0312), listed after magpie-quota.
- Docs: usage.html "Search what was said" in en, zh and ja; llms-full,
search indexes and docs-index.sums regenerated (node docs-index.mjs).
Run at 114eb4592 (rebased on
|
||
|
|
3f6a101fe1 |
providers: Images per request in the editor's Advanced, per model, learned from 100milionseek's and Coarena's words (#6849)
Yuu_jiang_ on X (#6849): 100milionseek and Coarena take at most 8 images a request, counted over the whole conversation, tool results included, and every turn after the ninth screenshot failed with no way on but /clear. ID-VerNe's max-images (the commit before) set one number from the CLI. This builds on it: - The cap is per provider, and optionally per model: max-images=8, or max-images=8,gemini-3-flash=10. The exact model is looked up first, then its upstream name, then "*" for all. The provider's cap moves with a model's local id like the other per-model limits. - 100milionseek's "At most 8 images per request (MAX_IMAGES)." and Coarena's "A request may carry at most 8 images." are learned as Copilot's words are, by provider and model, so the first refusal is the last. A user's own number is fitted before any refusal; a learned one that is smaller still lowers it. - Images are counted everywhere, a tool_result's too; the oldest are left out first and the latest user turn keeps its own. Only the request sent changes; session files are not touched. A request with no cap, or within it, goes out byte for byte as it came. - The provider editor's Advanced (folded unless set) has Images per request under Max output, in maximages.js, imported as that field is drawn, in every language. A GUI save keeps the value when the field isn't drawn. An editor opened and closed is not dirty (the draft takes the value only when typed), and the import, like keyrates.js's, draws nothing once the editor has closed: before that, a quick close threw "Cannot read properties of null (reading 'maxImages')" and ('keyPriceRates'), which add-sheet and key-box-once caught. - Budgets: app.js and the core +354, said in core_budget_test.go. What was run: - go test -count=1 -timeout 45m ./... on mote at |
||
|
|
e049b5cd35 |
providers: a user-set cap on the images of one request (max-images)
100milionseek's and Coarena's APIs take at most 8 images a request, counted over the whole conversation, and answer the ninth with a 400 of their own words (#6849): "At most 8 images per request (MAX_IMAGES)." and "A request may carry at most 8 images.". imageCapWords matches Copilot's wording alone, so the cap is never learned there and every turn of a session that has shown nine screens fails, with no way on but /clear. `magpie provider set <id> max-images=<n>` sets the user's own cap. The gateway fits a request over it before it is sent, the oldest images left out for the line imageOverCap stands, exactly as the learned Copilot cap does; no refusal is needed to know it. The user's number stands over a cap Copilot's refusal taught the same provider. 0, the default, keeps the learned path as it was. The provider editor has no field for it: a GUI save keeps what the CLI set, as it keeps usefirst and standin. What was run: - gofmt -l internal/ (clean); go vet ./internal/gateway ./internal/cli ./internal/provider ./internal/gui (clean); GOOS=linux go vet ./... (only wails beta.24's own cross-compile errors, the same 12 as at the base commit |
||
|
|
ff88ec264a |
sync: subscriptions whose sign-ins stay on this computer (Ethereal499 on X)
Sync's sign-ins can now leave chosen subscriptions out on one computer
(`signInsExcept`, provider ids; Ethereal499 on X keeps Claude's accounts
off other computers). On that computer:
- its accounts of those subscriptions never go up;
- the server's accounts of them are never merged in, so a removal or a
new account on another computer changes nothing here;
- the server keeps them as they are for the computers that do sync them
(syncOnce splits the remote set with SignIns.Except and puts the held
part back with With after the merge, so the hash doesn't change);
- the preview and Restore count and restore none of them.
An id names both the built-in and its -plugin id. An old config has no
field and syncs everything as before. The setup text doesn't carry the
choice, since it belongs to one computer.
GUI: Settings > Sync > edit > Advanced, under "Sign-ins", a "Not synced"
row with a multi-select openProtoMenu of the subscriptions with an
account. The row shows only while the sign-ins tick is on. The strings
already existed in en, zh, zh-TW, ja and de. CLI: `sign-ins-except=`
on the WebDAV, S3 and GitHub setups ("none" clears it), and status
shows the excluded ids. docs/subsystems/sync-backup.md says it.
Tests:
- TestSignInsExcept (provider) and TestSyncSignInsExcept (davsync, two
computers on a fake DAV).
- sync-signins-except.test.cjs: both engines, 1100 and 420px, all 5
languages.
Broken by hand, each red and then restored:
- the Except in collect;
- the Except on the remote set before the merge;
- the Except in the preview;
- the With after the merge;
- the GUI form's post of signInsExcept.
Run:
- At
|
||
|
|
ce16633367 |
tune: a Codex card locked by config.toml's own compact limit hands it to magpie on a click (sufeng1894 on X)
sufeng1894 asked why Codex's compaction threshold can no longer be set by hand. The card said config.toml's model_auto_compact_token_limit wins, and the background row said features.async_compaction's model_async_compact_threshold_percent wins: both locked, and nothing on the card did anything about it. Cause. Only the old tune card ( |
||
|
|
dbbb2f26b1 |
groups: free: takes the models a catalog marks free (#5903)
A routing group's pattern may now start with free: (provider.FreePrefix): free:workbuddy/* is, of the models workbuddy/* matches, those whose catalog entry says free (Entry.Free, the vendor's or plugin's own flag as the catalog was last read). The rest after free: is a glob, a re: pattern or an id, matched as on its own, so free:re:workbuddy/hy.* works too. It is expanded where every pattern is (matchesIn, PatternHits) each time the groups are read, from the catalog magpie already keeps: no request to a vendor, and a model the next list marks free joins without a save. Only the flag decides. A $0 price (PricedFree), a rate of 0, an account named Free or "free" in an id never counts; the test holds a deepseek-v4-free id with no flag, a rate-0 model and an or/y priced at $0 out. Existing patterns read as before: openrouter/*:free still means ids ending in :free (that is why the rule is a prefix, not a :free suffix), and a provider's AutoInclude takes no free: (isIDPattern). GUI: the Routing editor's pattern box counts and lists a free: rule live as it does any pattern (patternTest in plugins/routing/client.js, from groups.models' free), refuses "free:" alone, and one hint line says the flag is the last catalog's, not a promise of no charge, in en, zh, zh-TW, ja and de. CLI help, docs/subsystems/providers-accounts.md and the site's routing-groups page (en, zh, ja) say the same. routing-levels.test.cjs: the Advanced hint line made the editor taller, so the second group's Levels row opened under the editor's sticky foot and the click landed on the foot (webkit en). The test already wheels to that row for its first group; it now does for the second too. Run: - TestGroupFreeRule, TestFreeRuleSyntax and the existing pattern tests pass. Broken by hand: with groupmatch.go and autolist.go from origin/main both are red (no members for free:workbuddy/*, IsPattern); with takes() ignoring the flag, TestGroupFreeRule is red (all six WorkBuddy models matched). - group-free-rule.test.cjs (new): chromium and webkit, en and zh, green; red with origin/main's client.js. - go vet ./... (darwin, mica), GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: clean. gofmt -l: nothing. - Full suite go test -tags nogui -timeout 45m ./... on Linux (WSL magpie-desktop) at 1e180c630 (this change on |
||
|
|
8707ea7757 |
gateway: Codex's prompt suggestions go on a model set for them (@0xcb198609 on X)
The Codex app's home-page prompt suggestions (thread_source ambient_suggestions, and their safety check, ambient_suggestion_safety; the Routing page's 提示词建议) are a background agentic turn that reads the project and connected apps. The app asks for the model its server config names (codex-app-model-routing's codex_ambient_suggestions_model_slug, gpt-6-luna) with provider model fallback on, so with magpie as Codex's provider they ran on the provider's default model, often auto: @0xcb198609 saw 76.9k tokens in 113s on deepseek-v4-pro. Codex has no config.toml key for that model, only an on/off switch in the app (store key ambient-suggestions-enabled, Settings › Configuration › Homepage suggestions; read from the 26.1106 bundle). magpie now has a setting for it, "Codex prompt suggestions" in Codex's row on the Agents page (Settings, beside Codex composer predictions): - Empty, the default, is Codex's own pick: nothing moves. A value the user set is never overridden. - A model or group of magpie's puts both calls there: in serve as the codex-suggestions move (the Routing page says why), and on the ChatGPT backend's route before the split, carrying the asked model to serve so the trace and ledger keep it. codexOwnOffMagpie leaves a bare gpt-6-luna to magpie while the setting is on (codexSideSet). - A target that is disabled, unserved or not allowed to the gateway key leaves the call as asked, with a log line (compactRefused). - To fit app.js's script budget without raising it, the suggestions and auto-review pickers share codexPick with codexSidePick, and every Codex row's button comes from condButton. The new route is named for the CLI (settings_parity_test.go). agent-prefs and settings-general list the new row. - The row's tooltip and the Routing page's Suggestions story say where Codex turns them off. magpie's old story said "Suggested prompts", which the current app no longer shows; corrected in all five languages from the app's own locale files. Run (mote, at this head rebased on |
||
|
|
19794cc10c |
serve: a headless magpie follows a Remote magpie's agent picks (KoiLx0 on X)
v0.1.4298 made a client magpie follow the models a Remote magpie's agents are on (agent.FollowRemotePicks), but only the app's Library loop (library.KeepLinked) ran it. `magpie serve` and `magpie serve --web` followed the remote's model list and efforts (the long-poll in the gateway) and never a pick changed on the remote. Both now run agent.KeepFollowingRemote, which calls FollowRemotePicks every 30s; it still asks the remote at most every 5 minutes, and only while a Remote magpie is added. Run at this head, on mica: - go test -timeout 45m ./internal/agent/ ./internal/cli/: ok - go vet; GOOS=linux go vet -tags nogui; GOOS=windows go vet: ok - Real use: two sandbox magpies (R with a fake OpenAI upstream and a gateway key, C with R as remote-magpie "office"), both `magpie serve`. Claude Code connected on R to openai/gpt-5.5: C recorded claude.model.remote at start. R's Claude Code moved to openai/gpt-5.4-mini at 15:41; C's ~/.claude/settings.json followed at 15:45:49 (the 5-minute step). Efforts set on R (low,high) and a new upstream model reached C's /v1/models, Codex's magpie-models.json and Claude Code's model list within seconds to about a minute, before and after this change. Not broken by hand: the loop is a ticker around FollowRemotePicks, whose following is covered by remote_picks_test.go. Not tried: Windows and Linux real boxes. |
||
|
|
9dcec67513 |
archive: the request archive in an S3 bucket is kept under a GiB, oldest calls removed
An R2 user on X: the sync bucket grew by 18 GB in under a month. The
backup and usage files are small and rewritten in place; what grew was
the request archive, every call written whole (bodies up to 32 MiB) as
archive/<date>/<id>.json and never removed. The archive on this computer
is capped at a GiB; the one in the bucket had no cap.
Now the bucket's archive is held to RequestArchiveMB (a GiB unless set,
carried by sync), down to a tenth under it past the cap, oldest first:
- only keys of ArchiveName's own shape under <prefix>/magpie/archive/
are counted or removed; the backup, usage, other prefixes and anything
else in the bucket are never touched (a test seeds seven such keys);
- uploads are counted as they go, and the bucket is listed again only
after a tenth of the cap more is uploaded: one LIST for ~1000 calls,
never one per call;
- the serving magpie lists once two minutes after it starts, archive on
or off, so a bucket grown before this update is brought under the cap
without the user doing anything (auto-cleanup chosen over a button:
the objects are magpie's own, already capped locally, and a removal
is logged);
- the Usage page's switch tooltip says the size ("…in <bucket>, up to
1.1 GB"), in every language; the core script budget is kept, not
raised: the two tooltips share one options object and the switch's
aria-checked is set from a boolean.
The Nov 3 rise in Class B reads has no code cause found: archive reads
are click-driven only, and the backup's conditional GET runs every 3
minutes per computer online.
Red on the old logic (bucketAdded and KeepBucketArchiveBounded made
no-ops by hand, on mica): TestRequestArchiveKeptUnderItsSize "after 200
calls the archive holds 248 calls, 7629310 bytes, over its 1048576 (48
from 2020 left); 0 LISTs, 0 DELETEs"; TestBucketArchiveBroughtUnderIts
SizeAtStart keeps 30 calls / 3000 bytes; TestBucketArchiveListedPer
TenthUploaded "0 LISTs". With the fix: "200 calls: 44 kept, 986389
bytes; 4461157 bytes uploaded, 39 LISTs, 203 DELETEs".
Run at this tree (rebased on
|
||
|
|
64c4261582 |
sessions: search what was said in every agent's sessions, from the page and an MCP server
cryingLiu on X asked to search the chat history of every agent magpie
reads sessions from: prompts and replies, from one place.
What the user gets:
- The Sessions page's search also lists, under the agent's own list,
the other agents' sessions whose conversation says the words, each
with a snippet. A hit opens the conversation in the sheet at the
message that said it (transcript?find=), with "N earlier messages
not shown"; the page itself never scrolls. While the index is still
being built the head says "Indexing sessions…" or "Indexing N of M
sessions…", and the page asks again every 3s until it is done.
- Magpie Sessions, a built-in MCP server in Library → MCP (Discover),
opt in per agent like the other magpie servers. Its tools are
search_sessions(query, agent?, limit) and read_session(id, around?),
both returning text. It runs as `magpie mcp sessions` over stdio and
reaches the gateway's /mcp/magpie/sessions, which serves only local
callers that are not browsers.
How it works:
- internal/sessions/said_index.go keeps said-v1.db beside sessions.json:
a contentless SQLite FTS5 index (detail=none) of the words each
session says. It is built from the sessions list sessions already
caches and refreshed at most every 10s: a new or rewritten file is
read once, a grown Claude Code or Codex file only from where it ended,
and a gone one is forgotten. A query asks the index which sessions
have every word, then reads only those files for the snippet, for at
most 6s. A search waits up to 2s for a refresh. While the first
listing is still running the answer says `listing`, so an empty first
answer is not read as "no session says it".
- Privacy: only agents sessions.Reads allows are indexed or searched;
nothing is read until the user has answered the sessions question,
and in gateway mode no agent's own files are read (the page doesn't
ask). Reset forgets the index.
- /api/sessions/said for the page; the CLI parity list names it.
Run, at this tree (rebased on origin/main
|
||
|
|
8f3f7a46af |
provider: Baidu Qianfan's Token Plan Personal shows its month through a console sign-in (yuushabu_buyinn on X, #5860)
A Qianfan Token Plan key tells nothing of the plan's usage: Qianfan's
OpenAPI has no read for it, and the console's own page asks
console.bce.baidu.com/api/qianfan/charge/tokenPlanPersonal/resource with
the signed-in cookie. So the plan is read as StepFun's Step Plan is: the
editor of a provider at qianfan.baidubce.com/v2/tokenplan/personal has a
"Token Plan usage" field, drawn by the same renderStepPlan (now told
whose sign-in it brings) from qianfanplan.js, imported when such an
editor opens. The bookmarklet, run on the console, checks the session
with that same request and copies the console cookie; a raw Cookie
header or a copied cURL is taken too, since document.cookie leaves out
HttpOnly cookies. The paste is checked with a real read before it is
kept, by provider id, in qianfan-auth.json (0600, lastgood-guarded,
moved and dropped with the provider). POST /api/qianfan/{id}/session and
/signout serve it.
The Usage page's card (qianfanPlanQuotas in PlanQuotas) is the running
plan's credits (billingMode credit) or tokens as one Month window up to
expiresAt, the plan's tier as its name and auto-renew beside it;
released and past plans are skipped, and routing reads the same windows
(accountPlanWindows). A redirect, 401, 403, an HTML page or a refusal
naming the login is a signed-out session: an error card saying so, never
0 left; any other failure is an error card too, the last reading kept
only on a passing network error. The per-plan apiKey in the console's
reply is never kept, logged or shown.
Not done: the Enterprise (team) plan has no card. The console has no
tokenPlanTeam/resource; it reads team plans through seat and admin APIs.
Not tried with a real account: no one here is signed in to Baidu Cloud's
console, and #5860 has no reply bytes posted. The fixtures follow the
field names in the console's own script bundle and in the
dsh-qianfan-token-plan reader (planType, resourceStatus, billingMode,
usedCredits/totalCredits, usedTokens/totalTokens as numbers or strings,
expiresAt, autoRenew), not a captured reply.
core budget +35 (app.js and core): the field moved to qianfanplan.js;
what is left in the core is the import and two quotaError lines.
Run (at the pushed tree, rebased on origin/main
|
||
|
|
ec5b96c44f |
cli test: POST /api/quit/disconnect is the window's own (#6786)
|
||
|
|
2649d5d727 |
agents: Dim alpha (dima) is an agent, started on magpie's gateway (T_t__biu on X)
Dim alpha (arcships/dim, npm dimcode-alpha, command dima) gets a row on
the Agents page. Picking a magpie model there starts dima with the
variables Dim documents for any OpenAI-compatible endpoint
(docs/design/model-startup.md): DIM_BASE_URL (gateway /v1),
DIM_API_FORMAT=openai-compatible, DIM_API_KEY (magpie-dim), DIM_MODEL
and both DIM_MAX_*_TOKENS (the catalog's, else 128000/32000). They hold
for that run only; Dim's saved Providers, settings and database are not
written. The pick is in magpie's own dim.json; a dima function in the
user's shell profiles runs `magpie dim run`, and the row gives the
command for an open terminal. Picking Dim's own (or Disconnect) removes
both. Nothing signs in to, reads or proxies Dim's own account or the
DimAgent subscription (removed at its vendor's request, v0.1.471).
Run:
- mica, at this tree (rebased on
|
||
|
|
02f1cee794 |
plugin: a plugin installs the vendor CLI it signs in through (niuniu_8964 on X)
agy-cli signs in and serves requests through Google's agy CLI. In magpie's
Docker image there is none, so its sign-in failed with "agy CLI not found"
and the user had to get a shell in the container and install it by hand,
where it lived outside the volume. Claude's sign-in already installs
claude when it is missing ("Installing Claude Code…"); a plugin had no way
to say it needs a CLI.
A plugin now declares its CLI as auth.cli = {name, manual, installed(),
install({signal})}. The host lists it as Provider.CLI and answers two new
calls, cliInstalled and installCli (run through the provider's proxy, and
given up when magpie gives up). pluginCLI returns that CLI when it isn't
installed, so the plugin's sign-in goes through the same "installing"
state as Claude's: the Providers sheet shows "Installing Antigravity CLI…",
then the sign-in link; a failed install names its cause and the plugin's
manual command. `magpie plugin login` does the same in a terminal. An
answer magpie can't get (host down, a timeout) counts as installed, so a
plugin is never reinstalled for a failed read.
The agy-cli side (installing agy into the data folder, which is on the
container's volume, and keeping that copy current) is in
magpie-community/plugins.
Run, at this head (rebased on
|
||
|
|
60ebaea033 |
claude: the newest Claude Code on the machine runs, and an old one's sign-in says it is too old (zi_xiang5806 on X)
zi_xiang5806's in-magpie Claude sign-in ended "Sign-in didn't finish":
the claude magpie ran was an npm 2.1.38 first on PATH, which has no
`auth login --claudeai` ("error: unknown option '--claudeai'"), while
`claude update` had installed 2.1.325 into another Node after it.
- proc.FindTools lists every `claude` (each PATH folder, then where
installers put it), deduped by real path, cached like FindTool.
- claudecode.Own (behind claudecode.Find, so the sign-in, the gateway's
bridge, bili, keep and `magpie claude-code` all get it) runs the
newest. The first on PATH is passed over only for one whose version
is known and newer; an unreadable version is unknown, not old.
Versions are read first where each is installed, running nothing
(npm package.json via proc.PackageVersion, the native installer's
versions/<v>, Homebrew's Caskroom/claude-code/<v>); only when one is
known that way is another asked --version (VersionOf, kept per file
until it changes, an unknown for a minute). With one claude, or none
known, nothing is run.
- A sign-in whose claude says "unknown option"/"unknown command" now
says Claude Code is too old, with its version and path, and to run
`claude update` (or npm install -g @anthropic-ai/claude-code@latest).
Tests: TestClaudeSignInRunsTheNewestClaudeCode and
TestClaudeSignInSaysClaudeCodeIsTooOld put two fake npm-layout claudes
(2.1.38 first, 2.1.325 second) on PATH in a sandbox HOME; both were red
with Find reverted to the first on PATH (the first with the reporter's
exact "unknown option '--claudeai'"). TestOwn*, TestInstalledVersion,
TestFindTools.
Run at base
|
||
|
|
b466aa2803 |
update: a Daily channel, one release a day that passed its tests, for the app and Docker (fishmagic80 on X)
fishmagic80 on X: Stable is too slow (community plugins need a newer
magpie than it has), every release is too fast, and Docker users have
nothing in between. Daily sits between them.
What it is:
- site/worker.js keepDaily: at the daily cut (20:00 UTC, the quarter-hour
cron) the newest tag whose commit has a successful Test run and whose
release has all 17 assets is picked and kept in LEDGER "daily". A day
with none keeps the day before's; a failed GitHub read writes nothing.
/api/latest?channel=daily (503 until a pick exists), /download/daily/<p>,
and an urgent release overlays it as on Stable.
- .github/workflows/docker-daily.yml reads that feed and points
ghcr.io/yetone/magpie:daily at the picked version's image.
- App: settings.UpdateDaily ("daily"); update.Channel()/Picked() (Stable()
kept); the feed is asked channel=daily, never falls back to GitHub's
latest, What's new lists every change since yours. Settings > About >
Update channel has Every version / Daily / Stable; the version row says
"Up to date on Daily (· {v} is out on Every version)". CLI: magpie
update channel [stable|daily|every].
- Words in en, zh, zh-TW, ja, de, on top of 7f832b2f2's 尝鲜版/搶先版/先行版
for Every version (kept as it landed).
- The channel row wraps its switch under its name when narrow (ja at
420px was 18px past the window with three segments).
- app.js budget +338: the segment, its line and the two Up to date on
Daily words, packed to one t() per choice; Settings and renderUpdate
draw on every window, nothing lazy to move them to.
- Docs: docs/reference.md, site docs (docker, privacy in en/zh/ja),
llms-full.txt, search indexes.
Red on the old code (a daily-old worktree, then only settings allowing
"daily"): the feed was not asked channel=daily, 40 notes instead of all,
Picked false, notesKey "zh" not "zh|daily", the Daily row showed
"available"; the GUI tests had no Daily segment.
Run on mote at this commit's tree (on origin/main ec1a1a7a5; the Daily pick itself is live on the deployed worker: /api/latest?channel=daily answers 0.1.4171, /download/daily 302s to its dmg):
- go test -count=1 ./internal/settings ./internal/settingsapi
./internal/update ./internal/cli ./internal/gui: all ok (TestCoreScriptBudget
included).
- GUI, chromium and webkit, every language: update-*.test.cjs (22 files),
i18n-*.test.cjs, settings-search.test.cjs: 554 of 554 pass.
- site: node --test site/*.test.mjs, 132 of 132 (130 before the rebuild).
- gofmt -l clean; go vet darwin, windows (gui/update/cli) and
GOOS=linux -tags nogui.
Also: site/public/search/*.json and llms-full.txt rebuilt
(search-index.mjs, llms-full.mjs); they still listed Antigravity's old
sign-in after
|
||
|
|
ec1a1a7a55 |
library: import the slash commands the agents already have
miantiao_me on X (after v0.1.4189): 「之前在 Pi 定义的可以导入吗?」. Library ›
Slash commands now has a "Find in agents" card at the top. It reads the
command files each agent already has, from the same places magpie writes
them (Pi prompts/*.md, Claude commands/*.md, OpenCode command/ and
commands/, Gemini and Qwen .toml, Qwen .md, Droid), and lists them to
import, the way Subagents' import does.
- Parsing: frontmatter description plus body; for TOML, description and
prompt. Arguments go back to magpie's form: Claude's $ARGUMENTS[n] and
$n (0-based) become $n+1, Gemini/Qwen {{args}} becomes $ARGUMENTS,
Pi's $@ becomes $ARGUMENTS (${@:N} is left as written).
- Files magpie wrote itself are skipped. The same content in several
agents is one command; a name with different bodies per agent shows
"Differs by agent" and one of them is picked; a name the library has
with other content is "Name taken" and can't be picked.
- An imported command keeps its source agents ticked, and magpie adopts
each original file byte for byte (Command.Taken): sync writes the same
bytes at the same path, so the file is never doubled or rewritten.
After an edit the agent gets magpie's render at that path; a rename
drops Taken. Taken never leaves the machine (Collect strips it, Put
keeps the local one).
- API: POST /api/library/commands/probe, and commands/import through
the library change route. internal/cli's parity test names the probe
as stage 3, like subagents/probe.
- Docs: docs/subsystems/library.md has the new row.
Run at 039e25752 (on origin/main
|
||
|
|
72418591f0 |
cli tests: POST /api/warm-all is named with warm-now, as stage 3 (#6724)
|
||
|
|
142994b21c |
web: magpie web reaps the processes it adopts, as magpie serve does (swang20201 on X)
The Docker docs run `magpie web --addr 0.0.0.0:3430 --no-open`, so in a
container without an init `magpie web` is PID 1 and adopts every orphan.
|
||
|
|
6256d9956a |
gateway keys: a limit can follow a subscription account's own window (ljayic on X)
A key's limit gains the period "account": it names one subscription
account ("<provider>/<user>") and one of its windows (5h, Weekly, Monthly,
...), and starts and resets when that account's window does, at the reset
time in the account's last good reading (quotas.json), never asked of the
vendor on the request's path (provider.AccountWindow).
When the window can't be read (no reading yet, no such window, or its reset
has passed with no reading since), the limit is "reset unknown": it is
neither reset nor lifted. It counts from the latest time the window can't
have begun before (the reset that passed, else when the limit was set), so
it counts at least the window's calls; a refused call gets Retry-After 300
and a 429 saying the window can't be read now, and the accounts are read
again in the background at most once a minute.
GUI: Gateway keys -> a key's limit -> Window -> "An account's window", then
an app-menu picker of the accounts' windows as read (GET
/api/caller-keys/account-windows); the row reads "$x / $y · 5h of
codex/...", and an unknown reset reads "resets with the account's window".
CLI: magpie gateway-key limit <id> account --account codex/me@example.com
--window 5h --tokens 2m. i18n zh, zh-TW, ja, de. reference.md and
gateway-routing.md say it, with the fallback.
Run (at this tree, base
|
||
|
|
07dfd0bb8f |
update: a magpie stuck in its exit on Windows no longer holds the restarted one (BESTLJP0412 on X)
BESTLJP0412 on X (Windows 11 26200, 0.1.4179 to 0.1.4193, WebView2 157):
after an update's restart the window stayed "Not Responding", and a
process with a single thread sat on port 3425 and the WebView2 profile.
A Go process has several threads while it runs; one left means it is in
ExitProcess (os.Exit on Windows), which ends every other thread and then
runs each loaded DLL's detach on the last one. A detach that waits for a
thread already ended (WebView2's, COM's) never returns, so the old magpie
never ends, its handles stay open, and the new one waited its 60s
(awaitGone), went on beside it, and hung on the held port and profile.
Both ends fixed:
- the old one: cli.Main ends through endProcess, on Windows
TerminateProcess on itself instead of ExitProcess. Everything magpie
writes is written by then; the kernel closes every handle and no
detach runs.
- the new one: awaitGone's wait for the old magpie (awaitExit) looks at
its thread count every 250ms; one thread for a second is a magpie stuck
in its exit, and it is ended (opened with PROCESS_TERMINATE). This is
what fixes the update from 0.1.4193 and older, which still exit through
ExitProcess.
docs/subsystems/gui-shell.md says how a Windows restart waits and ends.
Tests (Windows, real processes; the stuck detach is a fiber-local storage
callback set to kernel32's Sleep with INFINITE, which ExitProcess runs on
its last thread and TerminateProcess doesn't):
- cli TestEndProcessSkipsAStuckDetach: first checks the stand-in is real
(os.Exit there hangs with exactly 1 thread left), then that
endProcess(3) ends with code 3. Broken by hand (TerminateProcess taken
out): red, "endProcess hung in a DLL's detach, as os.Exit does".
- update TestAwaitGoneEndsAMagpieStuckInItsExit: a predecessor stuck that
way is ended in ~1.4s. Broken by hand (the thread check skipped): red,
"the start went on after 20.022s with the old magpie still stuck".
Run:
- win-run on xiaomi-gpu (Windows 11): go test ./internal/cli ok (179s);
./internal/update all ok but TestPackagedByDpkg, red the same on
origin/main
|
||
|
|
4c86b0ab47 |
cli tests: POST /api/providers/delete is magpie provider rm (#6677)
|
||
|
|
91d27452b7 |
library: slash commands, written into each agent's own command folder
miantiao_me on X asked for custom slash commands (prompt templates) kept
once in the Library and given to agents as skills are. Library → Slash
commands keeps a name, a description and a prompt where $ARGUMENTS is
every word typed after /name and $1, $2… the first, second… word. Each
ticked agent gets its own command file, in its own folder and shape
(internal/library/commands.go, from each agent's docs and source):
- Claude Code: <claude dir>/commands/<name>.md; $n becomes $ARGUMENTS[n-1]
(Claude counts from 0), a literal $0 is escaped.
- OpenCode: <config>/commands/<name>.md, as written.
- Pi: <agent dir>/prompts/<name>.md, as written.
- Gemini CLI: ~/.gemini/commands/<name>.toml, $ARGUMENTS is {{args}}.
- Qwen Code: <qwen home>/commands/<name>.md, {{args}}.
- Factory Droid: ~/.factory/commands/<name>.md, $ARGUMENTS.
- Gemini, Qwen and Droid have no $1…: a command using them is not written
for those agents, and the row and editor say so.
- Codex is listed greyed: it reads ~/.codex/prompts no more, its skills
took their place. WSL agents get none yet.
What magpie wrote is recorded per file with its hash (Applied.Commands),
through syncOwnFiles, now shared with subagents: a file the user changed,
or one by that name magpie didn't write, is never overwritten or removed;
one equal to magpie's bytes is adopted. Commands travel with backups and
WebDAV sync (Bundle.Commands; an older bundle keeps this computer's).
docs/subsystems/library.md has the row.
Run (mote was over its load, so mica, then mote at the end):
- At 4119054bb on origin/main
|
||
|
|
106a24b95e |
library: skills from GitHub and git update by themselves when switched on
0xYaCo on X: "skill 能自动化升级吗?". magpie already checked for skill updates by itself (every 12h, as the Skills tab opens), but each update waited for a click on Update. A new switch, Update by themselves, sits under the Skills list while a skill comes from GitHub or git (POST /api/library/skills/auto-update; `magpie library skill auto-update on|off`; library.json's autoUpdateSkills, this computer's own). It is off by default. When it is on, KeepSkillsCurrent (a gateway.WhileServing loop) runs AutoUpdateTick 2 minutes after start and then hourly. Every 12h that runs CheckSkills, then UpdateSomeSkills on the skills found at "update". So a skill changed here stays in Unupdated with its Update button, one removed upstream is only marked, and a replaced edited version goes to the backups, as with an update by hand. Updated names and a new error are logged. Run (WSL2 magpie-desktop, Go 1.26.8; mote was at load 167, mica's disk full), at ab637d3c4 (this change on |
||
|
|
9f4e1120f3 |
agent: a Codex not connected is never pointed at magpie for account failover
TylerBai_loveai on X (tweet 2121532671180632290): with several ChatGPT accounts added in magpie and Codex not connected, Codex's requests went through magpie anyway; only adding Codex in Agents, then Disconnect, put it back. Cause: Sync's `failover` in codex.go wrote `openai_base_url = "http://127.0.0.1:3425/backend-api/codex"` (stash codex.failover), or pointed a CC Switch OpenAI mirror's base_url at the gateway (codex.mirror_failover), for any Codex signed in to ChatGPT with another of its accounts on (#1385), on every start and Sync, unless the user had disconnected Codex or turned on "Only switch Codex's sign-in". The row said not connected while every request went through magpie. Fix: failover writes nothing any more. A Codex that isn't wired or using magpie as its provider gets what failover wrote before taken out by Sync: the marked base URL, or the mirror's base_url. A base URL the user wrote by hand has no mark and stays (#856). Failover between Codex accounts comes with connecting Codex. modelOptions no longer counts failover as through magpie, so a pick of Codex's own model on the Agents page doesn't go via magpie. codexProxyOK (the proxy probe only failover waited for) is gone. The CLI's and GUI's switch-only lines, reference.md and the subsystem pages say failover is for a connected Codex. Users already affected: the first Sync after updating (magpie's start) removes the marked openai_base_url or mirror base_url, and the route change restarts Codex's app-server; Codex then goes straight to OpenAI on its own sign-in. A thread opened while it was on magpie keeps its provider until reopened, as after Disconnect. Tests: - TestCodexNotConnectedStaysOffMagpie: two spare accounts on, Codex not connected; SyncCatalog, Sync twice and a model pick leave no base URL, no model_provider, not Wired/FailingOver/CodexOwnOnly. - TestCodexFailoverFromBeforeTakenOut: a marked base URL and a marked mirror base_url from before are taken out, bytes restored exactly. - TestCodexSwitchOnlyKeepsCodexOffTheGateway, the CC Switch mirror, disconnect-stays and proxy/EndFailover tests reworked to seed the old state by hand; TestCodexFailoverHeldWhileProxyDoesNotPassOn deleted with codexProxyOK. Red on the old code (old codex.go + codex_proxy.go, new tests, mote): TestCodexNotConnectedStaysOffMagpie, TestCodexFailoverFromBeforeTakenOut and TestCodexSwitchOnlyKeepsCodexOffTheGateway fail with the reporter's line `openai_base_url = "http://127.0.0.1:3425/backend-api/codex"`; TestCodexCCSwitchOfficialOpenAIMirror fails with the mirror pointed at magpie. Run (mote; mica's disk is full, 100% with other sessions' runs, and mote's load was ~17-25 of 18): - At base |
||
|
|
69946f43c4 |
cli: POST /api/page-away is named as the window's own, so the route parity test is green
|
||
|
|
07a62b3739 |
providers: Copy all keys, and magpie provider keys, carry a provider's keys to another magpie
@emilochen on X asked to batch-export one provider's keys, to sync them between a local and a cloud magpie. Each key row could copy only its own key (#1480), and nothing printed them all. - A provider with two or more keys gets a "Copy all N keys" row under Add another key. It asks provider/key with allKeys (provider.AllKeys: the main key and every listed key, deduplicated, turned-off ones too) and copies them one a line, for the other magpie's Paste several (keys/import). The secret goes only to the clipboard on the click, through the page's copy(); nothing logs it, and the route sits behind the GUI API's existing local/origin guards. A signed-in account has no keys and is refused. - The row is drawn by keyrates.js (copyAllKeysRow), already imported when a provider with two or more keys opens; keyRateField now takes which of its parts to draw. It has its own class, keys-copy-all, not .add, since ~21 GUI tests take .acc.add as the one adding row. TestCoreScriptBudget's core budget goes up by the 72 bytes left in app.js (the placing line and the helper's new argument); app.js stays under its own budget. - CLI: `magpie provider keys <id>` prints the keys one a line; `magpie provider keys <id> add [key… | -]` adds them from words or stdin (SplitKeys + AddKeys), so `magpie provider keys relay | ssh cloud magpie provider keys relay add` works. A word starting with "-" is refused, never taken as a key. - Strings in en, zh, zh-TW, ja, de. Related: #5387 (sharing saved providers through magpie:// links), not closed by this. Run on mote (mote-run) at this tree on |
||
|
|
11ddf076b4 |
usage: a Qwen AI platform Token Plan is read through a sign-in to the platform (@imthe99galaxy on X, #5829)
On v0.1.4137 a provider on the Qwen AI platform's Token Plan
(qwen-token-plan, token-plan.maas.qianwenaiapi.com) had no quota card at
all. The plan key (sk-sp-) only authorizes inference; the platform tells
the plan's usage only to a sign-in on the platform, and magpie had none.
Now each such provider can sign in to the platform, as the QianWen CLI
1.10.0 does (qianwen_plan.go, UA qianwen-cli/1.10.0):
- a device sign-in with PKCE S256 at t.qianwenai.com/cli/device/code and
/cli/device/token, approved in the user's browser; the editor's
"Sign in to the Qwen AI platform" opens the page and waits for it;
- the session is the provider's own, kept by provider id in
qianwen-auth.json (0600), moved on Rename and dropped on Delete;
- cli.qianwenai.com/data/v2/api.json (GenerateCLIAccessToken) mints a
console token, kept and minted once more when the gateway answers
NotLogined; ConsoleNeedLogin or a fresh token refused signs it out;
- the usage is the Alibaba Token Plan's BroadScopeAspnGateway call at
cs-data.qianwenai.com with consoleSite QIANWENAI, region cn-beijing,
read by the shared aliAskUsage/aliReadWindows (alibaba_usage.go now
takes the console per call). The sk-sp- key is never sent there.
- Plan windows (planquota.go) and routing's key allowance
(key_allowance.go, keyTag "qianwen") read it; not signed in, the card
says so with Open settings (NeedsAccessKey).
- GUI routes /api/qianwen/{id}/signin (POST start, GET state),
/signin/cancel, /signout; the editor's field lives in qianwenplan.js,
imported when such a provider's editor opens. The core script budget
is raised by 326 for the import and one quotaError line (its reason in
core_budget_test.go). The routes are in the CLI parity's notYet, as
StepFun's are.
Run, on mote at the base
|
||
|
|
667ac8bd6f |
settings: a look at one setting takes the shared settings, not a copy
settings.Load() copies the whole Settings (clone + deepCopy of every map and slice) for each caller. 133 places read one field of it and threw the rest away: the proxy for every outgoing request (netproxy), the GitHub token, the China mirror switch, a model's output cap, wire or price on a gateway request. With a real account in the tray, Load's clone was 26.6 MB of the 318 MB the process allocated in its first seven minutes, most of it through netproxy.For on each request. Each of them now reads settings.Shared(), the read-only settings every caller is given for the same settings.json. Only reads were changed: a scalar field (string, bool, int, float) or a map field's index read. A caller that keeps a whole map or slice, or calls a method on the settings, still takes Load's copy. |
||
|
|
b325718f0a |
antigravity: turned-away lines go reworded, not broken up; Antigravity min 0.1.12 (#1118)
Since 11-14 Google's check reads past invisible characters. A system prompt with Claude Code's billing line and Agent SDK line, broken up with two U+200B in every word as the cloak sent them, was turned away 5 of 5 with the bare 429 "Resource has been exhausted". Claude Desktop's Code tab through magpie to Antigravity failed every turn (hc295971796 on X, tweet 2121429628019781849), and on v0.1.4110 with the Antigravity Cloak plugin Antigravity hit 429 very often (daoche_wuzui, tweet 2121432333769433178). The built-in cloak (codeassist.go) now rewords each line Google turns away, in plain words: - the x-anthropic-billing-header line is left out to its line's end; a system part or message holding only it is dropped; - "built on Anthropic's Claude Agent SDK" -> "built on the Claude Agent SDK by Anthropic"; - Codex's "based on GPT-5" -> "built on GPT-5"; - Hermes' "created by Nous Research" -> "built by Nous Research"; - omp's RFC "keywords" -> "key words". A copy an older magpie or middleware broke up (U+200B, U+2060, soft hyphen, inside or between words) is matched and reworded as the line. The Code tab's main line passes as written and is kept. The plugins repo's packages carry the same rewording (plugins 5bb41941: opencode-antigravity-auth 0.1.12, opencode-agy-cli-auth 0.1.41, middleware-antigravity-cloak 0.1.7 on the dist branch). The Antigravity mover's min goes to 0.1.12, the version dist has (these packages are not on npm); the cloak middleware is Official and updates itself. Run: - real Antigravity account, sandbox HOME, gemini-3.8-flash, 10 sequential requests each through the new plugin: Code tab main prompt as Claude Desktop sends it 10/10 200, Agent SDK subagent line 10/10, an old two-U+200B copy 10/10, Codex GPT-5 10/10, Hermes' earlier persona 10/10, omp's RFC line 10/10. The zero-width break went 0/5. - mote-run: gofmt -l; go vet, GOOS=linux go vet -tags nogui and GOOS=windows go vet of internal/gateway, provider, cli; go test -count=1 -timeout 45m ./internal/gateway/ ./internal/provider/ ./internal/cli/ ./internal/middleware/: all ok (gateway 926s); vet clean, gofmt clean. Broken by hand: codeassist.go from origin/main with these tests: 6 fail (TestAntigravityCloakClaudeCode2316, ...RewordsEveryLineItTurnsAway, ...AnswersHermesAndCodexByDefault, TestOnlyAntigravityIsSentThePrompt Reworded, ...LineWrappedOrWidened, ...TurnsCodexsGPT5ThreadAwayOnce). Not tried: models other than gemini-3.8-flash; the whole go test ./... (only the four packages this touches); Claude Desktop itself (its Code tab's system prompt was captured and replayed instead). |
||
|
|
4e770f733a |
library: subagents imported from a repository
CHENGJIAHEGOXIS on X asked for an easy way to install a repository of
subagents such as msitarzewski/agency-agents. Library → Subagents now
has a find line. It takes what the skill installer takes: owner/repo, a
GitHub or GitLab link to a repository, folder or file, any git address,
or a folder on this computer. It lists the subagents found, lets the
user tick all or some, and imports them as Library subagents for the
agents ticked.
- Fetching is the skill importer's: resolvePluginRoot's source handling
moved into fetchSourceRoot, which both use. tooBig still refuses a
whole repository that is too big and asks for the folder's link.
- A subagent is a Markdown file whose front matter has a description.
- Its name is the slug of `name`. In an `agents` or `droids` folder
with no `name`, it is the file's own name.
- The description is folded to one line of at most 1000 characters.
- The body is the prompt.
- Dropped: every other front-matter key (agency-agents' color, emoji
and vibe, and tools, model, author or anything else). A Codex TOML
role is not read. A skill's folder (one with SKILL.md) and .git,
.github and node_modules are skipped.
- Two files with one name: the shallower is taken, and the other is
listed as left out, with why. So is a file Subagent.check refuses.
- An imported subagent records its source and file (From) and a hash
of its description and prompt as imported (FromHash). Imported again,
a subagent from the same file is:
- have, when it is unchanged;
- update, when upstream changed and the library's copy still matches
FromHash (description and prompt replaced; agents, skills, servers
and model kept);
- edited, when the user changed it in magpie (left as it is).
- A name the library already uses for another subagent is never written
over: the import takes the next free name-N.
- A carried library carries From.
- The page has Select all, a filter past eight, a tag per state, the
files left out, and a summary of what was imported and updated.
i18n: zh, zh-TW, ja, de.
- The fixture is agency-agents' own files in
internal/library/testdata/agency-agents. No test reaches the network.
Run on 80ae5ba24, which is this change on
|
||
|
|
5211fd3ba2 |
usage: a currency "By provider" shows each provider's costs in what it sells in
onkashiko on X: DeepSeek, Kimi (China), Zhipu and other domestic vendors
price in yuan, the rest in dollars, and one currency for every cost made
the Usage page read wrong for half of them.
Settings > Usage > Currency gains a third choice, By provider. With it,
a figure of one provider's calls (a model's, an account's, a key's row,
a request, a routing try, a quota card's whole) shows in the currency
that provider sells in, and every sum across providers (the total,
agents, sessions, charts, the tray, Bark's daily, the day page) in the
currency a "Totals in" row picks, a row shown only while By provider is
chosen. GUI, TUI and CLI agree. Costs stay stored in dollars; only the
display converts, at the live rate (internal/fx).
Which providers sell in yuan (provider.PricesInYuan): a .cn host; a
preset at its own site that is a yuan preset (deepseek, zhipu,
volcengine, tencent-cloud, bailian, siliconflow…), ends in -cn, or is in
its China region; a plugin id ending in -cn; a provider of one's own
with a yuan models.dev catalog served at that catalog's site. A relay
made from DeepSeek's preset, Z.ai, Kimi's and MiniMax's international
endpoints stay in dollars: they share a catalog with their Chinese
twins, so the catalog alone can't tell.
Known limit: models.dev has only dollar prices (converted from the
vendors' yuan at ~6.7-7.0), so a yuan figure is that dollar price at
today's rate and can differ a few percent from the vendor's own list.
A second ask from onkashiko: set the currency of the menu bar and of
the totals apart, sums converted by themselves.
So Settings > Usage also gains an Advanced fold (closed by default, open while
set) with one row, Menu bar currency: Same as totals (the default), $ or
¥ (settings.TrayCurrency, TrayCostIn). It sets the menu bar's totals
cards and the tray tooltip's cost; the Usage page, the panel, the TUI,
the CLI and Bark's daily message stay in the totals' currency
(totalsCurrency). Like the other menu bar settings it stays on this
computer (KeepOwn). Every sum is still made in dollars and converted
once, at the live rate, so a mixed-currency total is never added up
from yuan and dollars.
Settings' currency rows (Currency, Totals in, Menu bar currency and the
rate in the tooltip) moved out of app.js into currencyprefs.js, imported
when Settings draws its usage prefs, and costInYuan is packed: the core
is 3 bytes under coreScriptBudget, with no raise.
Run:
- go test -count=1 at this tree on mote: internal/settings,
settingsapi, tui, cli, catalog, provider, fx and gui all ok
(TestCoreScriptBudget included). The full go test ./... and the whole
GUI suite are queued behind other sessions' suites on suite.lock
(mote and mica, load 35 and 60) and had not started at push.
- GUI files at this tree (mica): currency-provider, currency, i18n-keys,
i18n-en-no-cjk, tray-cost, tray-totals, every settings-*, old-webkit:
362 pass, 28 red. Every red is red the same at origin/main
|
||
|
|
533f351085 |
library: billion-context.json syncs, its settings change from its tab, running bilis reload
@Luxzinw on X asked for three things: sync billion-context's config, edit its settings in the Library's billion-context tab, and have running bili proxies reload after a change. Sync. billion-context.json goes in the library part (library.Bundle.Bili), by sync and backup file alike. magpie finds it the way bili's src/paths.ts does: BILI_CONFIG_FILE, else $XDG_CONFIG_HOME (or ~/.config, %USERPROFILE%\.config on Windows), then billion-context/billion-context.json. - The text is carried as written, comments kept. - magpie's summary recipe is carried at the canonical gateway address and localized to this computer's gateway when written, so two computers on different ports don't trade it back and forth. - A newer local file is never blindly overwritten. Before a carried file replaces a different one here, this computer's copy is kept with the backups. - An unreadable file, or one over 1 MiB, counts as unknown and is never carried as empty. A bundle without the file leaves this computer's alone. - A file naming a DSN is left out of keyless backups. - The credential store (<config>.summary-credentials.json) never travels. - A library with no such file hashes as before. - The new sync preview names the file when it would be added, changed or removed. Settings. GET/POST /api/library/bili/settings, and a Settings section under the agents in the tab: - In front: "Summarize with a fast model" (externalSummary), picked from the app's menu, never a <select>. It offers magpie's served models and the file's own recipes. "Fold only when nudged" (requireNudge) and "Nudge every N tokens" (nudgeGrowthTokens). - Under Advanced, collapsed: the compression philosophy (prompts.compressPhilosophy with acknowledgePromptsRisk, which bili needs before it reads a prompt override). Writes go through edit.PatchJSON and temp+rename, so unknown keys, comments and the BOM are kept. bili disables its whole compress section on one bad value, so magpie writes only values bili accepts. A magpie model becomes a providers.magpie recipe whose key is saved in bili's own credential store, the way bili writes it (0600, O_EXCL .lock, temp+rename). A user's own providers.magpie is never taken over. A file bili can't read is said so and left alone. Reload. After a change, and after sync writes the file, every running bili on loopback is sent POST /__bili/config/reload. bili reloads routes and compress there. The status line says whether it did, or that the agent needs a restart. Also: agentenv.Vars clears BILI_CONFIG_FILE in sandboxes, and the settings-parity list names the two routes for stage 3, as the other bili routes are. Run (mica, macOS): - At abcbc632e, this change on origin/main |