f68ddca370232eb96f8e1e2b17dfd32ec4427e1d
5611
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f68ddca370 |
install.sh: a Linux desktop gets the desktop app, or the command that installs its WebKitGTK; --gui and --tui choose (shuhai)
shuhai on Discord: on a Linux desktop install.sh installed the terminal build, and a desktop user expects the app. The script chose by `ldconfig -p` alone, and on Debian a user's PATH has no /sbin, so ldconfig wasn't found and every Debian desktop got the terminal build even with WebKitGTK 4.1 installed. Without the libraries, the only hint was a line mid-output. Now, with nothing asked (curl | sh stays unattended): - the libraries are looked up with ldconfig from PATH, /sbin or /usr/sbin, and in the usual lib folders when there is no cache (NixOS, Guix); GTK 3 is checked beside WebKitGTK 4.1, which brings the rest the app links (readelf -d of v0.1.2359's magpie-linux-amd64: gtk-3, webkit2gtk-4.1, soup-3.0, javascriptcoregtk-4.1, glib, X11, wayland-client, glibc); - libraries there: the desktop app, as before; - a desktop without them: the terminal build, and last in the output the distribution's command (apt/dnf/pacman/zypper/xbps/emerge from os-release ID and ID_LIKE), "run this again", or --gui. A desktop is DISPLAY, WAYLAND_DISPLAY, XDG_CURRENT_DESKTOP/XDG_SESSION_DESKTOP/ DESKTOP_SESSION, XDG_SESSION_TYPE x11/wayland, the user's logind Display session when its Type is x11/wayland/mir (over ssh; logind falls back to a tty login, which doesn't count), or a session file in xsessions/wayland-sessions under XDG_DATA_DIRS; - headless without them: the terminal build, with no desktop advice; - --gui: the app even before its libraries, with the package to add; --tui (or MAGPIE_CLI=1, kept) the terminal build on a desktop too; - musl (Alpine): always the terminal build; --gui refuses, since the app is built against glibc. Docs: reference.md Install, README en/zh, docs start FAQ (en/zh/ja, #linux-build). Run: - shellcheck -s sh: only SC2010 at the uninstall's `ls | grep`, there before this change. sh -n and dash -n clean. - site/install.test.mjs (5 new tests): 19/19 on mote (macOS sh) and on magpie-desktop through wsl-run (dash); CI's site step (sh -n + node --test site/*.test.mjs) 58/58 on magpie-desktop and 58/58 on mote. - Red on the old install.sh: tests 16-19 fail (desktop advice, headless advice, --gui, --tui). With the logind Type check taken out by hand, the headless test fails on login "135 tty". - Real installs on magpie-desktop (Ubuntu 24.04, XFCE, WSLg, /bin/sh = dash), `cat install.sh | env ... sh -s`, stdin a pipe, into a /tmp sandbox HOME/XDG dirs/MAGPIE_BIN_DIR, each removed after, v0.1.2360 downloaded from the real feed and `magpie version` run: session with DISPLAY/WAYLAND_DISPLAY: desktop app + menu entry; env -i with PATH=/usr/local/bin:/usr/bin:/bin: desktop app (the old script gave the terminal build here, run the same way); an ldconfig whose cache lacks the libs + DISPLAY=:0, and the same in env -i (found by /usr/share/xsessions): terminal build + the apt line; that with XDG_DATA_DIRS=/nonexistent: terminal build, quiet; --gui there: desktop app + the apt line; --tui in the session: terminal build. The first run found the tty-login fallback (logind's Display=135 is this WSL user's pts session), fixed before commit. - site/install.test.mjs on Windows (win-run): 0/19, the same 14 old tests too: the box has no sh for spawnSync; CI runs this file on Linux only. Not tried: a real Debian, Fedora, Arch or openSUSE box, or a box without WebKitGTK installed (simulated with a fake ldconfig); the package names were checked against each index (Ubuntu noble, Debian bookworm, Arch, Fedora mdapi, Tumbleweed oss, void-packages, Gentoo), not installed. The installed app wasn't opened (only `magpie version`), to keep off ports other sessions use there. Termux and macOS paths are unchanged and their tests pass. |
||
|
|
bb5e68ceac |
provider: Command Code's mover min is 0.1.20, the month in credits (plugins#556)
opencode-commandcode-auth 0.1.20 (npm view --prefer-online: 0.1.20,
plugins 622f950): a Go, GOAT or Pro account's Credits window says the
month in credits, the usage-value units Command Code counts those plans
in ("0.20 / 70.00 credits"; GOAT's 70 credits are its "up to $100"),
with bought and free credits said beside it, and a Provider account,
pay as you go, shows its balance instead of a $15 month. Raising the
min makes keepMovedCurrent update every moved Command Code user.
Run (mote, at this tree on
|
||
|
|
1e15a7a3b9 |
agents: Codex's memories and subagent model rows name the provider, as the rows beside them do (nb5p)
nb5p on Discord: in Codex's sheet, "Codex composer predictions" and
"Codex auto-review model" showed "GPT-6 Luna · MyGateway" while "Codex
memories model" showed "GPT-6 Luna" alone.
Cause: the sheet's rows draw from two sources. Predictions, titles,
descriptions and auto-review pick from Settings' titleModels and say
`${name} · ${providerName}` (namedIn). Memories and the subagent model are
Codex's own agent fields; their rows said the option's label only
(opt?.label in renderCodexMemories, codexSubSaid's name in
renderCodexSubagentModel), and an option keeps its provider in `group`,
not in the label. The API already sends it (internal/agent route.go
viaMagpie and codex.go's subagent options set Group: e.Provider.Name);
nothing was missing server side.
Fix: optNamed(opt, value) says an agent field's pick as "Label · Group",
a routing group (Group "Routing groups") by its name alone, and a value
no option has as it is. Both field rows use it. The card's subagent
square tooltip keeps its wording (its pinned text in
codex-subagent-model is unchanged); the memories square was removed
earlier. Codex's own models say "· OpenAI" (their group).
app.js stays in its budget, no raise: the helper is one line and
renderCodexMemories' comment was cut to two lines (1,316,414 bytes at
|
||
|
|
5d955a4d4b |
tune: Codex can take the compaction advice in the background, its own limit kept (herman_hong)
herman_hong on Discord: Tuned for you advises Codex compact at ~120K.
A foreground compaction kept them waiting, so they had set 384K by hand.
Now that Codex compacts in the background, they want the advice there
and the 384K kept as the backstop.
Codex has this since 0.163.0 (checked in codex-rs at rust-v0.166.0, not
in 0.162.1): [features.async_compaction] enabled and
model_async_compact_threshold_percent, an integer share (1 to 100) of
the model's window, 65 by default. It is Stage::UnderDevelopment, runs
only with remote compaction v2 (which magpie already sets on its
provider), and starts none once the foreground limit is reached. magpie
already writes it from Settings' Background compaction (#2490), with
the version gate and the user's own keys kept. This drives that setting
from tune:
- agent: knob TuneAsync ("async_compact") on codex. TuneRead gives the
share, TuneApply turns Background compaction on at it (stashing what
Settings had the first time), and TuneUndo puts that back unless the
user changed it since. The foreground limit (Long conversations, or
the user's model_auto_compact_token_limit) is never touched. Async
keys the user wrote in config.toml come first (codexAsyncOwn): the
row says so and Apply errors. A table magpie wrote itself doesn't
count as the user's.
- gui/tune.go: advice.async holds the advice as a share of the window,
rounded down. With timed compactions it uses the token-cheapest
window, since a background compaction keeps no one waiting. It is
offered only when it would start before the foreground limit (the
lesser of the limit now and 90% of the window). held lists Codexes
too old for a share.
- context.js: the row gets a text button, "Use 120K in the background",
whose tip gives the share and says the foreground limit stays. After
Use a chip says so, with Undo background. A config.toml of the
user's, or a Codex too old, gets a one-line caveat and no button.
The too-old line is shared with Settings' row (codexHeld). No select,
no layout change. zh, zh-TW, ja and de are in i18n.js.
- The core script budget goes up by 1,571 bytes for the row
(core_budget_test.go says why). app.js is 278 bytes smaller.
Run (at this change on origin/main 6893cfbe3; rebased on
|
||
|
|
d0a61b856a |
plugin: the pi tests keep the pinned pi's Bun cache between runs (#2865)
installPinnedPi's `bun install --frozen-lockfile` used the install cache bunCommand names, which lies in the test's home. testenv makes a new home for every go test process, so every run fetched pi's 118 tarballs before the host could start, inside the test's 4 minutes. yetone saw TestPiPackage red at |
||
|
|
a246ad4cfc |
plugin: the pi tests' host loads the pinned pi, not npm's latest (#2865)
TestPiPackage added testdata/pi, and TestGatewayHookMixedPiPackage a copy in a TempDir. Neither folder has a node_modules above it, so as the host started, Bun took each import of pi from there as one to install itself (its auto-install): first pi.js's resolve of @earendil-works/pi-coding-agent from the package's folder, then the extension's own imports, which jiti 2.7 imports natively under Bun (tryNative) from the extension's folder. Each start asked npm for 115 manifests, and init waited on them under its 2 minute bound. This would explain the red yetone sees under a full run, and with npm slow it is red alone. The host then ran npm's latest pi (1.4.0 today), not the 1.2.0 installPinnedPi installs from testdata/pi-lock, so #1879's pin never reached the host. The test's Version(piAgent) check reads the plugins folder's copy, so it passed. Now both tests put their package in the plugins folder (Dir()/fake-pi-package, Dir()/mixed-pi-package), beside the node_modules installPinnedPi fills. pi.js and the extension both resolve the pinned pi, and nothing is asked of npm as the host starts. fakepi.ts tells the VERSION its import of pi reached, and TestPiPackage checks it is the pinned one. With the old layout and npm reachable, that check is red. Not changed: the app. A pi package added from a folder with no node_modules above it should go the same way (the tests add theirs through the same Add, as a path): pi.js and its extensions get npm's latest from Bun as the host starts, and the pi ensurePi put in the plugins folder for it isn't the one that runs. Making pi.js resolve from the plugins folder alone isn't enough. Tried here with the old layout, the host then waited on @earendil-works/pi-ai's manifest for the extension's import instead, and both tests were still red. Each way out changes how plugins load: JITI_TRY_NATIVE=0 in pi.js (every pi extension then goes through jiti's transform and pi's aliases), `bun run --no-install` for the host (auto-install also stops for OpenCode plugins on disk), or a Bun.plugin onResolve for pi's scopes. That is the maintainer's call, so it isn't in this commit. Also not changed: installPinnedPi's `bun install --frozen-lockfile` still fetches pi's 118 tarballs on every run, as the sandbox's install cache starts empty, and the test skips when that fails (noted in #2865). What was run (tree 8aee6487, on origin/main |
||
|
|
225b494bea |
gui: a sync notice's Show says why the sync folder didn't open (#4066)
In Settings › Sync and backup, the notice a sync leaves (what it replaced here or on the server) has Show, which opens the sync folder in the file manager. When that failed, nothing was said (#4066): renderSync named the sync row's text `status`, a local that hid the status() function, so Show's `.catch((e) => status(e.message, "err"))` called that string, threw a TypeError, and the status line stayed empty. The local is named `line` now, so the catch reaches status(), and Show says its error in red, as a failed call does elsewhere. It fails, for example, when the sync folder is gone, or on a Linux without xdg-open. No other function in internal/gui/assets declares a status of its own (a git grep at |
||
|
|
75d63a1545 |
plugin: Discover no longer keeps a stale read from just after a push (#4067)
The Plugins page's Discover lists the repositories tagged magpie-plugin, and keeps what each one's package.json, npm and the file it names made of it by `owner/repo@pushed_at`, so a repository is read once a push. raw.githubusercontent.com can answer from before a push for a while after it (its answers, a 404 too, say they stand five minutes): the package.json or the file it names missing, or the package.json as it was. A read then was kept for the push, so a repository read as missing stayed out of the list until magpie started again or the repository was pushed to again (MengXiangxi on #3821, #4067). Now a read less than rawFresh, ten minutes, after the push is shown as any read is, and read again at the next ask; one rawFresh or more after the push is kept for the push, as before. When it was read is what counts: a whole list stands ten minutes, so the next ask is often past rawFresh, and judged then, a 404 read a minute after the push would be kept. A read again that comes in after the page stops waiting is shown at the ask after, as any late read is; one that gets no answer leaves the repository as it was read. A list is asked again when its time is up: ten minutes for a whole one, 20 seconds for one cut short, a minute after a failed search, and at once on Try again when it isn't whole. So such a repository is read about once more. raw's answers have no Age, and their Expires is each answer's own date plus five minutes, but they carry Source-Age, how long raw's cache has held them, a 404's too: 2s after a push, raw's 404 had Source-Age 20, cached before the push (below). This reads no headers (fetchJSON keeps none) and goes by the time since the push. What was run (tree 00637ea4, on origin/main |
||
|
|
722ca104c0 |
library: the Subagents page lists a stopped WSL distro's agents, greyed (#4238)
While a WSL distro runs, the Subagents page lists its agents that take subagents here (Claude Code, Codex and the rest of SubagentAgents) with a greyed chip that says magpie gives subagents only to agents on this computer, not yet to it in WSL. With the distro stopped, they were gone from the page: subagentsView built its agents from the targets only, and an agent in a stopped distro is no target (#3896). As the commit before did for the Hooks page: subagentsView now also lists each stopped agent of those kinds that the MCP and Skills pages list from its shape (asleepView), with the reason it has while the distro runs (wslNoSubagents, which subagentSpecOf now shares), so its chip, a subagent's problem for it and the "magpie can't give subagents to ... yet" line are the same, stopped or running. Nothing of the distro is opened. One magpie never saw (unseen) isn't listed. No WSL agent can be given a subagent yet, so there is nothing to keep for Woken. No change to the page; nothing new to translate. The line in library.md that named the pages leaving a stopped distro's agents out (#4182, #4237, #4238) is gone with this. What was run (tree e03c52f0, on origin/main |
||
|
|
0bd89a0237 |
library: the Hooks page lists a stopped WSL distro's agents, greyed (#4237)
While a WSL distro runs, the Hooks page lists each of its agents with a greyed chip that says magpie gives hooks only to agents on this computer, not yet to it in WSL. With the distro stopped, they were gone from the page: hooksView built its agents from the targets only, and an agent in a stopped distro is no target (#3896). So a hook's chips, and the "magpie can't give hooks to ... yet" line, changed with whether WSL was running. hooksView now also lists each stopped agent that the MCP and Skills pages list from its shape (asleepView), with the reason it has while the distro runs (wslNoHooks, which hookSpecOf now shares), so its chip, a hook's problem for it and the line are the same, stopped or running. Nothing of the distro is opened. One magpie never saw (unseen) isn't listed, as on the other pages. No WSL agent can be given a hook yet, so there is nothing to keep for Woken: the issue's "write a change once the distro runs" has no change to write until hooks reach WSL. No change to the page, which already greys a chip whose agent has `no` set; nothing new to translate. What was run (tree fb979055, on origin/main |
||
|
|
4ff086d1fb |
library: the Instructions page lists a stopped WSL distro's agents (#4182)
With a WSL distro stopped, the Instructions page listed none of its agents: instructionsView built its rows from the targets only, and an agent in a stopped distro is no target (#3896). So Claude Code, Codex and the rest in WSL couldn't be switched on until the distro ran. And a switch on the page sent the agents the page listed, so switching any agent on or off while the distro was stopped took its agents off the set, and the next sync once the distro ran took magpie's part out of their files. The same way |
||
|
|
e4c7841779 |
sessions: a Claude session read from its start has its calls read on the parse's own pass (#2278)
A first start parsed every Claude session for the Sessions page (parseWith, claudeLine) and then scanned each again for Requests' calls (readCalls, claudeCallLine): on the 13 GB fixture HOME that second scan was ~20 s of the start's CPU (scanThin under readCalls in the profile). callsAlong, which already let a packed Codex rollout's calls ride along its parse, now does the same for claude and claude-desktop files whose calls are read from the start: nothing kept, or kept without their revision window (prepareCalls would start over anyway). Each line is shown to both heads and handed to claudeLine and claudeCallLine as each asked, both thinned by thinClaude as on their own scans. finish keeps what readCalls keeps for Claude: writeCalls, then withoutRevisions for a file not being worked on when the kept calls had no window, then writeCallRevisions. Calls kept with their window are read on from where they were by readCalls, as before, and a summary read on from its own offset drops the ride (parseWith) so neither reader misses a line. The ride keeps its calls on disk only (the shard and the revision window), so a Sessions read still loads no calls into memory (TestCallsDoNotInflateSessionIndex); readCalls' fast path takes the window back from disk for a shard it loads (withCallRevisions), as prepareCalls did for a changed one. Only Claude files with no shard and nothing kept ride: calls read before are read on or again by readCalls exactly as they were. Run on mote (M5 Pro) at the pushed tree: - go test -count=1 -timeout 45m ./internal/sessions ./internal/usage: ok. ./internal/gui: ok but TestCoveredWindowStaysUp, killed at its 30s deadline alone too (an AppKit window on mote, #4125/#2645). - go vet sessions; GOOS=linux and windows go vet sessions, usage: ok. - New TestClaudeSessionReadOnceForSessionsAndCalls: each Claude file scanned once on sessions-then-calls, calls and sessions equal to a read of each on its own, and a grown file read on, not from its start. - Broken by hand: the ride off for Claude turns the new test red (scanned 2 times); dropping the fast path's withCallRevisions turns TestEvictedClaudeRevisionsReleasedAndRebuilt, TestClaudeLargeWindowSurvivesIdleAndSmallFiles, TestClaudeWindowReservationsAndRemoval and TestLargeClaudeFileKeepsAppendContinuation red. - Cold start on the fixture HOME (13 GB of Claude projects, 52 GB of Codex), 75 s each, alternating, load 12-19: previous head 3:27.98 and 3:18.01 of CPU, this one 3:03.74 and 3:06.88. Footprint peak 328/334 MB before, 339/333 MB after (unchanged). The heatmap, requests, sessions overview (0, 7, 30 days) and stats answers are byte-equal in both rounds. Not tried: Claude Desktop's Code tab files on a real Desktop install (they take the same path as claude, agent claude-desktop). |
||
|
|
6893cfbe34 |
gui: the Mac's menu bar icon keeps the place the user gave it across a quit (nb5p)
nb5p on Discord (macOS 26, Ice): after every update, and after a plain
quit and reopen, magpie's icon went back into Ice's hidden section however
often it was moved out. Alma has the same. Other apps keep their place.
Cause: AppKit keeps where a status item sits in the app's defaults by its
autosave name ("NSStatusItem Preferred Position Item-0"), and
-[NSStatusBar removeStatusItem:] deletes that key. Wails' cleanup removes
every tray as the app quits (application.go cleanup -> systray.destroy ->
systemTrayDestroy -> removeStatusItem:), so each quit forgot the place and
the next magpie's item started at the default spot, left of the others,
which in Ice is the hidden section. Apps that just exit keep the key.
(Electron's Tray, Alma's, removes its item the same way.) The autosave
name itself is stable: magpie makes one item, so it is Item-0 every
launch, under the same bundle id; it was never the identity that changed.
Fix: a shutdown task (h.app.OnShutdown, which Wails runs before it
removes trays) renames each of the app's status items to "magpie quitting
N" first, so the removal deletes a key nobody keeps and Item-0's place
stays. The items are found by their button's target, Wails'
StatusItemController, whose statusItem property is the item. Windows and
Linux get a no-op (trayshown_other.go). The handover's old magpie quits
through the same path, so a restart to update keeps the place too.
Evidence, on mote (macOS 27.2) with a 40-line Cocoa probe under its own
defaults domain: position seeded at 400, exit without removing -> key kept;
removeStatusItem on quit -> key gone, next launch has none; a fixed
autosave name "magpie" -> also gone on removal (so a fixed name alone
would not help); autosaveName changed just before removeStatusItem ->
key kept, next launch reads 400, and no key is written for the throwaway
name.
Run: gofmt -l internal/gui (clean); on mote at this head go vet
./internal/gui, GOOS=linux go vet -tags nogui, GOOS=windows go vet,
go build ./..., GOOS=windows go build ./..., GOOS=linux go build -tags
nogui ./... : ok. go test ./internal/gui on mote skipping the runAppKit
tests: everything passes except TestSettingsSaveKeepsWhatItDoesNotSend
(SearchAll, red on main, #4514) and TestMainWindowCorners (AppKit, killed:
mote has no Aqua session).
New test: TestQuitKeepsTheMenuBarIconsPlace (trayplace_darwin_test.go)
runs a Wails app twice under a sandboxed defaults home: Item-0's place
seeded, then tray.Destroy(), the call Wails' cleanup makes. Without
keepTrayPlace it must read "forgotten" (the cause), with it "kept".
Not tried: the new test and TestHandoverLeaves... hang over ssh on mote
(its console sits at the login window: no gui/501 launchd domain, no
Finder or Dock), and this Mac is the user's live one, so the AppKit test
has not run anywhere yet; macOS CI runs it. No real two-launch check with
the built app and Ice, for the same reason. The full suite was not run
(two other sessions' gateway suites were on mote).
|
||
|
|
4d6bd346ce |
provider: Cursor's mover asks for 0.2.35, which no longer stalls after a tool call (plugins#550)
0.2.35 ends a step on the calls Cursor completed itself, which its tool count includes but never reach the plugin, or on a checkpoint whose pending calls are the ones the plugin holds. 0.2.34 waited out Cursor's heartbeats and failed "went quiet" (Windsland52's wire trace). npm view @magpie-community/opencode-cursor-auth version --prefer-online says 0.2.35 at landing. Run on mote at this head: go test ./internal/provider ok. |
||
|
|
33a284497e |
plugin options: a switch a provider plugin declares is saved where the plugin reads it (plugins#550)
`magpie plugin options cursor '{"wire_trace": true}'` wrote the entry's
options in plugins.json (a middleware's ctx.options), while a provider
plugin's switches (auth.options, the editor's Plugin options) are read
from settings' PluginOptions (input.magpie.option). The command said
"options set" and Wire trace stayed off.
Now a key that the plugin declares as a switch for one of its providers
(from the providers last listed, else asked of the plugin host) goes to
PluginOptions for that provider, through settings.EditPluginOptions, and
a running host is handed it (SetProviderOptions, 5s, best effort). Only
true or false is taken for a switch. The other keys go to plugins.json
as before; set with switches only, a middleware's options stay, less a
switch written there before. `off` puts every switch back to the
plugin's default and clears plugins.json's options. Shown with no value,
each switch is listed with its value. docs/reference.md and the plugins
page (en, zh, ja) say so.
Run at this head on mote: go test ./internal/cli ./internal/settings
./internal/plugin ok; gofmt -l clean; go vet darwin and GOOS=windows ok;
Linux go vet -tags gtk3 in WSL (magpie-desktop) ok.
Broken by hand: no key read as declared, and both new tests went red
(PluginOptions empty, the old switch left in plugins.json).
Not tried: the real CLI against a running magpie with the Cursor plugin
installed; a plugin not listed yet (the host path) is not in a test.
|
||
|
|
f7a80bc904 |
usage: a Model filter beside the Provider filter on Requests (OHHHHHH05 on X)
OHHHHHH05 asked for 按模型筛选 next to the provider filter, with requests,
input/output tokens, cache and estimated cost for the range, gateway and
session-log calls alike. Usage › Requests could already be narrowed to a
model, but only by clicking it in the chart's ranking or typing it in the
search box. Now it has its own filter, after Provider, in the app's menu
(sessPick/openSessCombo, no <select>). It lists the models the other
filters keep, by tokens (/api/usage/requests' by.model, which is counted
without the model's pick). Picking one sends model=, which the server
already applied to both sources, so the sum line (requests, in, out,
cache read/write), the cost head, the through/not-through-magpie cells,
the chart and the rows are all that model's. All models clears it. A
pick made in the ranking shows in the filter too. No API change, no new
strings ("All models", "Model", "{n} tokens" are already in every
locale), app.js untouched (the plugin's page.js only).
Run (at
|
||
|
|
b1a1b950fe |
routing: the classifier asks its model not to think (tangtang969 on X)
"classifier的模型调用可以加上不带思考的参数么?提速效果比较好". A routing
group's classifier (and its effort question) asked its model for the
least level on its list, and nothing at all when the list was unknown,
so a relay's reasoning model thought at its vendor's default before
answering a number.
Now classifyEffort asks for none, reasoning off, and each wire fits it
with the code that already fits a client's none:
- Chat/Responses: a model with none gets none; one without gets its
lowest (fitFor: low, minimal), as before; one whose levels aren't
known gets none (as auto mode's classifier does, fitAutoModeClassifier).
- Anthropic: thinking {"type":"disabled"}; Opus 5.5, which refuses it,
still has it left out (thinkingOffAsTaken).
- Gemini API / Code Assist 2.5: thinkingConfig.thinkingBudget is the
off budget (0 for Flash and Flash-Lite, 128 for Pro, as Vertex already
did) where a Chat none went as low's 4096. Gemini 3 is unchanged (low).
- A model the user marked as taking no reasoning ask (Reasonless) is
sent none at all; a routing group as classifier is left as before.
- An upstream that turns the effort away (unknown reasoning_effort
field, or the level) is asked again without it and remembered
(askLeast), so the classifier keeps answering.
The Image recognition model keeps its old least-level rule
(leastEffort); only the classifier changed.
Run (mote-run, this tree on origin/main
|
||
|
|
d83823d264 |
agent: a Claude Desktop Code tab session on WSL is told Desktop's window too (young02036)
young02036 on Discord: Claude Desktop 4.29.0 on Windows, a Code tab
session whose environment host is "WSL · Ubuntu", a magpie group of
Codex gpt-6.1-sol (500K) and Claude Opus 5.5 (1M) listed as
mythos-magpie-4247180078, and /context read "49.4k / 200k".
Cause: Desktop runs such a session on the distro's Claude Code, which
reads its user settings in the distro. Desktop 4.29.0's remote probe
reads them from `${CLAUDE_CONFIG_DIR:-$HOME/.claude}` there. Desktop sets
CLAUDE_CODE_MAX_CONTEXT_TOKENS only for Cowork (its bundle's one write of
it); a Code tab session gets the mythos-magpie id and no window. magpie
wrote Desktop's window, capabilities and Explore flag into Windows'
~/.claude/settings.json alone: desktopOn() was false for every
claude@wsl:<distro>. So the distro's Claude Code took the unknown id for
200K.
Fix: desktopOn() is true for a distro's Claude Code while this machine's
Desktop is on magpie (desktopSetsHere), so its Sync (desktopOnly when it
isn't on magpie itself, writeWindow when it is) writes the same values
into the distro's settings.json, and takes them out when Desktop leaves.
Turning Desktop on or off also syncs each running distro's Claude Code at
once; a stopped distro has no Sync (asleep) and is written on the first
catalog round after it starts.
Run:
- WSL (magpie-desktop, wsl-run), real Claude Code 2.1.289 in a sandbox
HOME, `claude -p --model mythos-magpie-4247180078 /context`: no env in
~/.claude/settings.json gives "30.4k / 200k" and the unknown-model
notice; CLAUDE_CODE_MAX_CONTEXT_TOKENS=500000 there gives "30.4k / 500k".
- New TestClaudeDesktopWSLContextWindow: a distro's settings.json gets
1000000 and mythos-magpie capabilities with Desktop on, the user's
model/theme kept, nothing before Desktop is on, all gone after it is off.
mote and Windows (win-run) pass.
- Broken by hand: desktopOn returning false for a distro, the test is red
("the distro's window "", want glm's 1000000").
- win-run go test ./internal/agent -run 'TestClaudeDesktop|TestWSLClaude':
only TestClaudeDesktopCarriesTheLanguage red, same at origin/main
|
||
|
|
90518de261 |
install.sh: --uninstall takes the mimeapps.list xdg-mime made when nothing else is in it
After |
||
|
|
305c624eda |
install.sh: --uninstall takes off what it installed, --purge the settings too
pota on Discord: the Linux install script only installs. Now
curl -fsSL https://usemagpie.ai/install.sh | sh -s -- --uninstall
takes off what the script put there, and nothing of the user's:
- Linux: $bin/magpie, the menu entry (while it starts this magpie, or
one that is gone; another magpie's stays), its icon, the
x-scheme-handler/magpie=magpie.desktop line xdg-mime wrote (that line
only), and the menu's mimeinfo.cache when it lists nothing else. The
service and login entry go too while they start this magpie, since
left they would start a program that is gone at each login
(`magpie daemon uninstall`, systemctl as a fallback).
- macOS: magpie.app in /Applications or ~/Applications and the
~/.local/bin link into it. Termux: $PREFIX/bin/magpie.
- ~/.config/magpie stays and the script says so. A magpie still
running is named with its pid; it ends when the user quits it.
- --purge runs `magpie uninstall --yes` first (agents disconnected and
put back, magpie's folders deleted), then the above. With no magpie
to ask it refuses, and if magpie uninstall fails nothing of the
install is taken, so it can be run again.
- Nothing is downloaded; the uninstall runs before the CPU check.
Docs: an FAQ entry "How do I uninstall magpie?" in docs/start (en, zh,
ja), and a line in both READMEs' install note.
Run at
|
||
|
|
41357f3935 |
codex: the ChatGPT desktop app on Linux is found, and a switch reaches it
pota on Discord: magpie switches the ChatGPT (Codex) desktop app's account on macOS and Windows but not on Linux. OpenAI ships the app for Linux since 08-11 (preview; learn.chatgpt.com/docs/linux/linux-app): a deb, an rpm and an Arch package, which install /usr/lib/chatgpt. Its app-server is /usr/lib/chatgpt/resources/codex ... app-server, run with the user's HOME and no CODEX_HOME, so it reads ~/.codex like the CLI. isCodexAppServer took only .app/Contents/ and Windows paths, so on Linux nothing found the app: no "still signed in as" notice after a switch, no restart of its app-server, and no version on the Agents row. - provider: linuxCodexApp takes an absolute .../chatgpt/resources/codex as the app's own app-server (findCodexApp, CodexAppStale, the switch's restart all read it). - agent: restartOnLinux; codexAppOpen knows on Linux whether the app is open (any /usr/lib/chatgpt/ChatGPT process, not its codex alone or another program's ChatGPT). desktopApps["codex"].linux reads the version from resources/linux-package-metadata.json, HasApp/AppVersion see it, and codexReaders counts the bundled codex's --version as a reader of Codex's config. version() no longer stops at an empty store read before the other sources. Real run, WSL magpie-desktop (Ubuntu 24.04), OpenAI's chatgpt_amd64.deb 26.1027.30824 (bundled codex-cli 0.166.0-alpha.5.1) under Xvfb, sandbox HOME, fake unsigned JWT accounts alice/bob (no real credentials), magpie web on 127.0.0.1:3591: - POST /api/login/switch alice: 200, auth.json alice; /api/providers then says codexApp "bob@example.com" (the stale notice). - POST /api/codex/daemon/restart-app: 200 in ~3s; the old app-server ended (app log "Codex CLI process exited classifiedAsExpected=true code=0"), a new one started with the sandbox HOME, the notice cleared. - /api/agents/cli: "codex":{"app":"26.1027.30824"}. - The same run with linuxCodexApp reverted: no notice, restart-app 400, the app-server untouched (pota's case). Run at |
||
|
|
40c0fe43e5 |
sessions: tsAt looks for the first timestamp only when that one is asked (#2278)
tsAt(b, true) found the first "timestamp" with bytes.Index over the whole line, then threw it away for lastIndex's. On a first start's CPU profile (mote, the 13 GB + 52 GB fixture history, 120 s) that Index was 2.11 s of tsAt's 5.68 s. Run on mote at the head: - go vet ./internal/sessions; go test ./internal/sessions ./internal/usage: ok. - Broken by hand (the last case taking bytes.Index): nothing went red, so TestTsAtLastIsTheLines is new: a tool result's own timestamp before the line's, with the line's in and past lastIndex's 1 KB tail. Red under that break (last = 2020-01-01), green on the fix. |
||
|
|
5b1709eee8 |
gui tests: six more pages get a minute for their first load (#4470)
nav-timeout.test.cjs ( |
||
|
|
244cf49371 |
update: a restart magpie makes by itself comes back as it was, without taking focus
xyxyxy_15591 (Discord #feedback) asked for a silent auto-update: once an update is in, the window shouldn't pop up. With "Restart automatically" (Settings, beside Version) on, the window state was already kept (a closed window came back as the tray icon only), and What's New stays quiet after an in-app restart. What did show was magpie taking focus: - macOS relaunched with `open -n` and no `-g`, so LaunchServices brought magpie to the front even when only the menu-bar icon came back; - with the window open, showHere's Focus() activated the app (every OS); - joining the Dock activated magpie, and with Dock on Wails' Regular policy activated it at launch. Now a restart magpie makes by itself (AutoRestart, `magpie update` from a terminal) writes a one-shot restart-quiet mark (read once, good for 10 minutes). The next start reads it: `open -n -g`, no Focus(), the Dock joined without activating, Accessory policy at launch and the Dock set afterwards. A restart the user clicks removes any mark and comes to the front as before. `open` gets -g also whenever no window is wanted. No new setting: zero-config, the existing switch is the one asked for. Run (base |
||
|
|
ced880ef00 |
gui tests: routing-save counts By weight among a subscription's routings
|
||
|
|
b52c39b65e |
routing: an account's row names the session it answers
connor_yang (Discord #help) asked that the Routing stage say which
session an account is serving next to its "answering…" / "answered this
request" status. The row now ends "· <title>", one line cut short with
the full title on hover, and only when the agent itself named that
session:
- Claude, Gemini and the other agents: sessions.Titles by agent:id, the
same source the By session list heads use.
- Codex: its own name index (session_index.jsonl) by thread id.
- A Codex request whose parent the server inferred from prompt and
reply fingerprints (parentMatched) shows nothing, since that parent
is a guess. An untitled session shows nothing too.
Cost: no new server path. The titles come from the existing
/api/gateway/session-titles calls that refreshSessionNames already makes
every 15s and on focus. A session id the page hasn't seen is asked for
once (marked asked before the fetch, 300ms debounce, never two calls at
once), and the ask is skipped when a read since then already covered it
(namesDue). The per-second render only reads two maps. The title sits in
its own nowrap span, because the narrow stage (.max560/.max460) wraps
the status.
A Codex names reply silent on a session no longer clears the title
the trace brought. CodexTitles leaves unknown ids out, and returns {}
when the index can't be read, so the old loop turned a failed read into
"no title". With the earlier ask it also raced the trace: routing-sessions'
"title helpers belong to the named parent" went red 3 of 6 runs under
--test-concurrency=4 until this change, then 6 of 6 green.
Run:
- routing-session-title.test.cjs (new): engines x claude/codex x en, zh,
zh-TW, ja, de x 1100/420px = 40 tests. Chromium 20/20 on mote.
WebKit 20/20 on the Linux box (wsl-run, magpie-desktop). On mote even
a bare webkit.launch() timed out at 60s under other sessions' load (21,
67 pw_run processes), so WebKit there tested nothing.
- 16 nearby routing GUI files (answered-still, row-reuse, row-two-lines,
stage-routes, sessions, reroute-title, tick-no-layout, live-patch,
busy, served, js, steady, steady-garbage, session-folder, live-calm,
request-model) in Chromium and WebKit on the Linux box, before the
rebase onto
|
||
|
|
cae01311cf |
agent: Kimi Code 2.x's notice says to reopen Settings › Providers, not to restart
After magpie writes Kimi's config.toml, every Kimi was told "reads its settings at start-up — restart open kimi sessions". That holds for the old Python kimi-cli (~/.kimi). Kimi Code 2.x (~/.kimi-code, npm @moonshot-ai/kimi-code) watches config.toml and reloads it, so an open session takes the new models at once; only its web and desktop app's model picker is read again when Settings › Providers is opened again. jiabubu picked from that stale picker and got "Model \"magpie/...\" is not configured in config.toml". The notice now follows KimiDir's legacy flag: kimi-cli keeps the restart advice word for word, and Kimi Code 2.x is told "reads this as it runs; in its web or desktop app, reopen Settings › Providers or reload the page to see new models". The same goes for Kimi in a WSL distro: wslKind gets an optional restartAt, which Kimi's kind uses to pick its notice from the distro's folder (a stopped distro reads as ~/.kimi-code, as kimiDir has it). Both new strings are in NOTICES and translated in zh, zh-TW, ja and de. Run (worktree at |
||
|
|
a94f2a9e0e |
provider: Cursor's mover min is 0.2.34, a quiet checkpoint named and an opt-in wire trace (plugins #550)
Windsland52 (plugins #550) got "Cursor went quiet: 24 heartbeats and
nothing else for 240 s, its last message checkpoint" and asked for more
about that checkpoint and for a way to capture a failed Run. The plugin
(magpie-community/plugins 1a5b184, @magpie-community/opencode-cursor-auth
0.2.34, on registry.npmjs.org) now:
- names the checkpoint in the quiet error: its number in the Run, which
of its step's (native path), how many in a row, and the frame kinds
before it;
- has a plugin option, Wire trace (wire_trace, off by default), that
writes a failed (not cancelled) Run's frames as shape only (direction,
ms, size, kind, field numbers, wire types, sizes one level deep; no
text, tokens, headers, blob or account ids; the error scrubbed) to
<magpie folder>/cursor-traces, newest 20 kept, mode 0600.
The quiet budget and retry are unchanged. This commit raises
keepMovedCurrent's min so moved users get it.
Run:
- plugins: bun test packages/cursor on mote, 165 pass 0 fail, and on
Windows (win-run) 165 pass; the full plugins suite on mote with a temp
HOME, 4186 pass 9 skip 0 fail; bun scripts/check.mjs cursor ok.
- here: gofmt -l internal/provider (clean), and
mote-run go test ./internal/provider/ -timeout 45m: ok (101.1s) at
base
|
||
|
|
0273600218 |
sessions: lastIndex finds a key in a line's tail going forward too (#2278)
lastIndex already found a key going forward over a whole line, but the 1 KB tail it looks at first, where Claude Code writes the timestamp, still went through bytes.LastIndex, a byte at a time back. tsAt and ccReply's usage both take it on every Claude line of a first start. Run on mote at the head: - A side-by-side test (not committed) over 620,566 real lines of the fixture history (tails cut to 8 KB), for "timestamp" and "usage": old, new and bytes.LastIndex agree on every line; 1.14s -> 0.79s and 1.14s -> 0.82s in two rounds, ~0.5 us a call saved. - go test ./internal/sessions: ok; TestLastIndexIsLastIndex holds it to bytes.LastIndex. |
||
|
|
ca7eb9aff7 |
gui: underTightGC's comment names the room a tight GC leaves a small heap
The comment still said a tight GC lets the heap grow by a tenth. Since v0.1.2331 it grows by tightGCRoom (32 MB) when that is more (tightPercent). Comment only. gofmt clean; nothing else to run. |
||
|
|
7baa473f22 |
sessions: a Claude line is told apart by its head, and a reply decoded without its content (#2278)
On a first start's CPU profile, claudeCallLine took ~18s: up to four bytes.Contains scans of every line that wasn't a reply (assistant, identity, compact, user), and json.Unmarshal of ccCall over the whole line, message.content included, ~8s of it checkValid and decode. A line now says what it is in its first KB: user, attachment and the type-first lines put "type" ahead of any object, so ccLineType reads it there; an assistant line puts message first, which ccReplyHead reads the way claudeLine does. Only a line neither tells apart is scanned as before (ccOtherCallLine, the old switch). A reply's ccCall is decoded with message.content spliced to null (ccWithoutContent); the content hash and an API error's text still read the whole line. Run on mote at the head: - A side-by-side test (not committed) fed every line of the 13 GB fixture history (4125 files, 3,666,183 lines) to the old and the new claudeCallLine: the callFiles are reflect.DeepEqual in every file, and the time went from 26.5s to 19.7s on raw, unthinned lines. - go vet ./internal/sessions; go test ./internal/sessions ./internal/usage: ok. - Broken by hand (ccLineType always "user"): 10+ sessions tests red, among them TestCallFramesAppendPatchAndRecover and TestCallsReuseSavedIndexAndContinue. - Cold first start, advst.sh on the fixture HOME, v0.1.2338 (wn) and this head (cl) alternated, at load 20-30: wn 3:42.93 / 3:19.78, cl 3:23.74 / 3:31.03 CPU; footprint peak 321/325 vs 323/326 MB. The load swamps the ~7s; heatmap, requests, overview 0/7/30 and stats 0/30 answers byte-identical in both rounds. - GOOS=linux and GOOS=windows go vet ./internal/sessions: ok. |
||
|
|
7b09d2c951 |
provider: a model can be listed by an id of the user's at its provider, asked for by its own
zeewell on X (tweet 2116404121930432888): relays serve one model under
ids of their own (deepseek-v4.1-flash-1017, grok-4.6@500k). They want to
give each one their own id at the provider layer. magpie then lists,
routes, groups and finds groups by that id, and the upstream request
still carries the vendor's id.
Choice: a new per-model map, settings' ModelIDs
("<pid>/<local>": "<own id>"), served through the wire names that
already exist. ModelSameAs was not widened. It means "same as another
vendor's model": it lends specs and joins found groups. Making it rename
models everywhere would change every existing user's ids and refs.
ModelWires was not reinterpreted either, for the same reason. ModelIDs is
ModelWires turned round: a wire keeps magpie's id and changes the one
sent, and this keeps the one sent and changes magpie's. Settings.Wires()
merges each entry in as a wire name (wrapped by a "<pid>/*" wire). Every
place that sent a ModelWires name (gateway, usage ledger, request page,
UpstreamName, UpstreamNameAs) reads Wires(), so the upstream id needs no
new path. An explicit ModelWires entry for the same id wins.
- Listed by the local id: Available, liveIDs/liveByID, Serving and
ListPrice translate through OwnModelID. /v1/models, agents' lists,
Resolve, routing groups and found groups (auto/<local>, merged with
every other provider serving that id) all see the local id.
- Only a provider of the user's own (Account == nil) takes one. An
account's or a plugin's request is built from its list's id, which no
wire reaches.
- Two variants of one provider given one id: the latest given it wins,
and the earlier one is listed by its own id again. The CLI names it.
The editor refuses two rows given one id in one save. A model of the
provider's own id that a variant is listed by (plain grok-4.6 beside
grok-4.6@500k) is not listed while the variant has it.
- The user's values are never overridden. SetModelID moves picks,
contexts, fallbacks, groups' members/rules/fast/placed/off/weights/
classifier/pick, the pickers' lists, every per-model setting
(Settings.MoveModel) and gateway keys' models (provider.ModelMoved,
set by access) to the new id, but only where nothing is under the new
id yet. Agents' own files are not rewritten: an old provider/<own id>
still resolves and is sent as it is. Group match patterns and key
patterns stay as written.
- Key limits: a key held to either id passes for both (modelAllowed:
the ref, OwnModelID, ListedModelID). Group members use the same check.
- Usage: model = the listed id, served = the vendor's id from its reply.
The price is the own id's first.
CLI: magpie model id <provider/model> [<id>|--reset], magpie model ids.
GUI: Providers > a provider's editor > Names & levels > "Listed as",
beside Same as. It is staged with the editor's Save and taken back by
Restore default, in zh, zh-TW, ja and de. Accounts have no box.
Docs: providers-accounts.md, gateway-routing.md, and site start.html in
en, zh and ja.
Run (mote-run, at this tree rebased on
|
||
|
|
0407d69e84 |
provider: a group of Kimi models keeps always_thinking, dynamic tools and its default effort
jiabubu on Discord (#feedback): one Kimi Code model put in a routing group so it lists first lost "always thinking" and "dynamic tool loading" in Kimi Code, which the same model straight from its provider has. buildGroupEntries never set AlwaysThinks, DynamicTools or DefaultEffort on a group (the Entry comment said "a group has none of them"), so kimiModelTables wrote the group's table without always_thinking and dynamically_loaded_tools, and default_effort fell back to high. groupSharedKimi now gives a group each of the three when every member's entry says the same, and none of it when one member doesn't or has no entry: a group request can reach any member (rule targets are members too, ruledEntry's of()), so Kimi Code must not shape a request for a member that can't take it. The capability words are Kimi Code 2.4.1's own (catalog-runtime.ts capabilityFromDeclared), already written for direct models; kimi-cli still gets neither. Tests: TestGroupSharesKimiFacts (provider: all share, one without, efforts differ) and TestKimiCodePlanCapabilities now writes a one-member group "top" (the reporter's case: always_thinking, dynamically_loaded_tools, default_effort max) and a group "mix" with a relay model (neither word). Run on mote (mote-run, sandbox HOME): - At 83a630d69 (on |
||
|
|
8413267097 |
catalog: a list's image/jpeg is an image, so OpenCode Go's models that see take images again (zeo9901)
zeo9901 (CC01CC) on Discord #feedback: "magpie 中 opencode go 所有的模型似乎 都无法实现图片输入了". Their screenshot is a routing group of DeepSeek V4.1 Flash at Open Design and at OpenCode Go. Cause: OpenCode Go's own /models (https://opencode.ai/inference/go/v1/models, the same at /zen/go/v1/models) lists what a model takes as media types: deepseek-v4.1-flash's modalities.input is ["text","image/jpeg","image/png", "image/gif","image/webp"], Gemini's adds application/pdf and audio/*, and so on. catalog's live-list reader took the list word for word and asked for "image", found none, and recorded ImageInput = false, an explicit answer. entryFor puts a list's explicit answer over models.dev's (which says image), so with a working Go key every Go model was text-only: a direct pick had its image described or turned away with "model does not support image input", a group member was sent it described or not at all, and agents were told the models take text only. It used to work while Go's list spelt modalities as models.dev does, or said nothing. Fix: catalog.Kinds reads a modalities list as models.dev words it (image/* image, video/* video, audio/* audio, text/* text, application/pdf pdf, each once, an unknown word kept, nil stays nil). imageInput and the live reader's InputModalities/OutputModalities go through it, as do Codex's input_modalities, the labs rows and a decision provider's listed facts (decide.go). A list saved before this, still holding Go's media types and false, is mended when read (mendKinds), so a user sees images from the first read after the update, not the next fetch. A user's own Accepts images answer still wins. Which OpenCode Go models take images, per Go's list on 2026-10-31: deepseek-v4.1-flash, kimi-k3, kimi-k3.1-pro, kimi-k2.7-code, glm-5.3-flash, qwen3.8-max, qwen3.8-flash, qwen3.7-plus, minimax-m3, minimax-m3.1-flash, mimo-v2.6-flash, mimo-v2.6-pro, step-5-preview, gemini-4-argon, grok-4.7, gpt-6-luna, gpt-5.6-luna, claude-haiku-5-5, muse-spark-1.2/1.3-contributor. Text only: deepseek-v4-pro, glm-5.2, glm-5.3, hy3, hy4-preview, longcat-2.0, beam-free, iceman-contributor-free. Tests (fixture: four rows of Go's real list, read without a key, no test reaches the network): - TestOpenCodeGoMediaTypesSee (catalog), TestKinds, TestSavedMediaTypesListSees, TestListedFactsMediaTypesSee (provider). - Broken by hand: Kinds returning its input unchanged turns all four red (deepseek-v4.1-flash, kimi-k3, gemini-4-argon "Images false"); the mendKinds call taken out turns TestSavedMediaTypesListSees red. Run on mote at the working tree on |
||
|
|
ceeb73a0f1 |
app: the desktop app writes its log to app.log; magpie log and Settings › About › Log find it
rayem1w on X (0.1.2330, macOS) was asked for ~/Library/Logs/magpie/serve.log while chasing a Codex "hit a snag" through the gateway, and had no such folder. Only the launch agent (magpie daemon install, written by launchd) and a gateway magpie tui left running wrote a log; the app opened from the Finder, the Dock or the Start menu logged to a stderr nobody reads, on every system. Now runGUI and runPanel (magpie, app, tray, panel, a window view, a magpie: link) call applog.Start before gui.Run. It sends the standard logger (the gateway, the plugin host, providers and Wails' error handler all log through it) to app.log as well as stderr, and points debug.SetCrashOutput at it so a panic's trace is there too: macOS ~/Library/Logs/magpie/app.log Windows %LOCALAPPDATA%\magpie\logs\app.log Linux $XDG_STATE_HOME/magpie/app.log, else ~/.local/state/magpie/app.log portable data/logs/app.log app.log, not serve.log: on a Mac launchd writes serve.log for the service, another process. The file is 0600. At 5 MiB it becomes app.old.log (two files at most); when another magpie (an update's new process) rotated it already, it is only opened again; when it can't be moved it is emptied. stderr goes first, through a writer that never fails, since io.MultiWriter stops at a failed writer and an app opened from Explorer has no stderr. Secrets: the log calls name header names and paths without queries; no key or token was found logged (grep of log.Print* in gateway, provider, plugin, gui, agent). scrub masks bearer/basic credentials, key/token query parameters and sk-, AIza, gh?_ and JWT shapes anyway. How a user finds it: Settings › About › Log, with the path, Copy and an Open that shows its folder (POST /api/settings/log/reveal; the row is hidden in magpie web, which writes no file). magpie log prints where every log is (the app's, app.old.log, the service's, the tui's background serve.log); --path the app's alone, -n N its last lines, -f follows it across a rotation. Docs: reference.md, gui-shell.md, site start (FAQ "Where is magpie's log?" and the CLI table) and privacy (files on your computer), en/zh/ja. Run: At 227ce6074 on origin/main |
||
|
|
fbb1b36d1f |
provider: the Claude keep-alive keeps off accounts, its reading, and its turn (#4532)
stringke read |
||
|
|
82b45888ac |
routing: a plain failure's rest says its status and the vendor's words (GanHei37443 on X)
GanHei37443 on X ("workbuddy 全都连接失败是怎么回事啊") showed Routing with
three WorkBuddy Free accounts each "失败 · 16 秒后恢复" on
deepseek-v4.1-flash, and a fourth (WorkBuddy AI) "额度用尽 · 19:07 恢复".
The fourth is the free plan's 24-hour token window, as it says. The three
rested at once for the same request, so the vendor refused that request
the same way on each, with an error the plugin doesn't name (no 11128,
11140, 14018 or content_filter): magpie's "failed". Nothing on the page
said what WorkBuddy answered: the rest carried no status shown and none
of the vendor's words, only the request's details did.
Cause on WorkBuddy's side not found. The owner's WorkBuddy AI account
answers deepseek-v4.1-flash with 200, plain and with DeepSeek Harness's
real main-turn and title bodies, through plugin 0.2.6 (current
5.9.3 headers). The owner's China (copilot.tencent.com) sign-in is
refused 401 since 10-29 and its refresh token too, so the China site,
the reporter's, couldn't be asked. No plugin change.
Fix: a Rest carries Error, the vendor's words (provider.APIError, cut to
300 runes), set where restAfterMarked makes every real rest, kept in the
rest note and sent with each try's and order's rest. The Routing page's
stage row, Accounts table and per-model rest line say the status for a
failure of no named kind ("500 · failed · back in 16s") and show the
vendor's words as the tooltip. Kinds that name themselves read as before.
No new strings.
Run (mote):
- go test ./internal/gateway -run 'TestRestCarriesTheVendorsWords|TestCarried|TestOneRequestDoesNotClimb': ok
- broken by hand: without Error set, TestRestCarriesTheVendorsWords is red
("the rest says \"\", not the vendor's words")
- gofmt -l; go vet ./internal/gateway for darwin, linux, windows: clean
- GUI, new routing-rest-error.test.cjs (5 languages, 1100 and 420px):
chromium 10/10 on mote; webkit on Linux (wsl magpie-desktop) with
routing-model-rest, rest-probed, routing-rest-off: 50/50. WebKit
doesn't launch on mote at the moment (browserType.launch timeout at
180s, untouched routing-model-rest the same), so it ran there.
- chromium on Linux: routing-rest-error, routing-model-rest, rest-probed,
routing-rest-off, provider-limit-rest, rest-try-now, key-rest-date,
routing-lifted-elsewhere, routing-day-tallies: 126/126
- broken by hand: origin/main's client.js with the new GUI test is red
("a@x.test: the stage row says failed · back in 16 s")
- rebased on
|
||
|
|
03f609e3fd |
redact: a token count is not a secret (Discord, steven_4422; #3775)
steven_4422 in #feedback, with a screenshot of the Masking page: "total
number of tokens are masked as secret". Claude Code's system reminder
<total_tokens>1499872 tokens left</total_tokens> went upstream as
<total_tokens>{{SECRET_dkfgb3bf}} tokens left</total_tokens>, listed under
Secrets and found by the local model. #3775 had the same with AstrLink
Guard (<total_tokens>14902266).
Cause: the model labels the count `secret`; modelFits lets a hex run
(hexRe, which a run of decimal digits matches) through when secretCued
finds a key word right before it, and secretCued takes a cue anywhere in
the name before the value, with letters after it: the tag's name
total_tokens ends "token" + "s", so the count was "called a token". The
same held for "total_tokens": N, max_tokens: N and token_count=N.
Fix: a value of decimal digits alone that the model calls a secret is
masked only where the name right before it (then =, :, is, a tag's >,
quotes) ends with a key's, a token's, a password's or a PIN's word
(numberNamedSecret: api_key=, "token": , PIN:, user_pin=, 密码是,
<token>…). A name that runs on past the word counts what it names.
Rules are unchanged (numeric keys after key=/token: labels, phones,
ID numbers keep their own rules). The eval's token-count case now comes
out right for AstrLink Guard, so its #3775 marker is off.
Tests: TestTokenCountIsNoSecret uses the reporter's bytes in a Claude
Code user message's system reminder (the reporter's 7-digit counts, and
8-digit ones as Claude Code sends on a large window; the model's
len >= 8 secret check already let the 7-digit ones go, so the reporter's
exact values may have been 8 digits as read off the screenshot), plus a
usage object, max_tokens, token_count and "spin:". TestNamedNumber-
SecretStillMasked keeps api_key=, "token":, token is, PIN:, user_pin=,
password:, 密码是 and <token>…</token> masked.
Broken by hand: with model.go as on main, TestTokenCountIsNoSecret is
red for the 8-digit counts, total_tokens, max_tokens and token_count
(PIN:/user_pin= were not masked on main either; now they are).
Run (mote-run, base origin/main
|
||
|
|
19594cc1cb |
usage: a span's trimmed chunk keeps only the strings its rows name
A first start's page, heatmap and Codex effort build pair their history
in 4-day spans, and a session file that reaches past a span is trimmed
to it (within). The trimmed chunk cloned the file's whole Strings
table, whose strings all point into the one decoded block of the file:
every span it reached held the whole file's text. within now copies the
strings its kept rows name into one block of its own, renumbers them
("" stays id 0), and rebuilds Shapes through setTexts.
Run on mote, at
|
||
|
|
42c49e74dc |
provider: test /usage with weekly windows only (#4532)
#4532's reporter's Max account printed /usage with no "Current session" line, only the week across all models and the Fable week. Every /usage the tests had carried a session line. TestClaudeUsageWeeklyOnly parses the reporter's literal text at two times in two zones (no 5-hour window made up, the Fable week is the model's own), checks near-out and used-up at 1/89/90/100% and BackAt at the reset; Fable at 100% alone is not counted, as today (#4532 asks that it may be). TestClaudeSwitchWeeklyOnly has switch-only stay at 1% and move to the spare at 100%. Run on mote at |
||
|
|
b48881f507 |
provider: keep idle saved Claude accounts signed in, by Claude Code itself (#4532)
#4532: a saved Claude account switched on but not needed for weeks (switch-only) had nothing run on it, its refresh token sat idle, and it was found signed out when the switch wanted it. Codex's saved sign-ins already had a keep-alive (RenewLogins, every 8 days, one account an hourly look). The same loop now takes saved Claude accounts that are on, not Claude Code's own, not added by setup-token and not already signed out (claudeKeptAlive). For one that is due it has real Claude Code run /usage in the account's own CLAUDE_CONFIG_DIR, the path a card's refresh takes (readSavedClaudeUsage, inSavedClaudeDir), and syncSavedClaude keeps whatever sign-in Claude Code refreshed. magpie asks Anthropic nothing itself: no OAuth or usage endpoint, as removed in |
||
|
|
847f0c4703 |
gui: Masking alert lives on the Masking page
nb5p on Discord (#feedback): "这个脱敏提醒被放到额度设置里了,害得我找半天没找到". The Masking alert row sat in Settings › Usage. It now closes Insights › Masking, after the list of requests, in the page's own `.list.prefs` rows (same Off/On segs, same ids #maskAlertRow/#maskAlertSegs, same i18n keys and the same maskAlert setting). Nothing is left in Usage. The page draws it from page.js after loadSettings, hides it while one request is open, and gateway mode leaves it out as Settings did. Placed after the list so the requests still start in the first screen (masking-records at 640px) and the demo keeps its place between the card and the list. Run at base |
||
|
|
93b31f5b79 |
plugins: Discover's install box floats at the foot of the list (0x3108 on X)
With many plugins, Discover's "Have one in mind?" box (install by name) was found only after scrolling to the very end. It now sticks to the bottom of the view while the cards scroll under it, on a strip of the page's own background (no shadow, no gradient), with the same dashed box. At the end of the list it sits in its place, above the npm registry line, and every card is above it. Its place in the DOM is unchanged. The strip blocks clicks so they can't reach a card hidden under it. Because a sticky box paints its ::before over its own border, the dashed border is now drawn by ::after. A scroll-padding-bottom keeps a card reached with Tab from stopping under the box. CSS only (plugins.css), so no script budget moves. Main's existing core budget red is #4526. Siblings: Discover is the only page that renders this box (manual() in plugins.js). Library's skills install card is already at the top of its page. Run: - New test, internal/gui/tests/plugin-manual-float.test.cjs: 40 cards, en/zh/zh-TW/ja/de, 390x780, 560x800, 980x820 and 1280x800. The box is in the view at the foot at the top and mid-way (wheel scrolling), with no card showing above or below it. At the end, the last card is above the box and the registry line is below it. Tab from the cards never stops under the box. The search field takes keys and Escape brings the box back. Chromium on mote: 6/6 pass, 3 runs. WebKit through wsl-run (Linux): 6/6 pass. With plugins.css at origin/main, both engines are red: "390x780 at the top: the box is in the view" (the box sits at ~6100 in a 780 view). - The 63 GUI files the change can reach (plugin*, plugins-more-discover, signin-paste-plugin, account-plugin-user, agent-plugin-agents, i18n-keys, click-scroll), run at --test-concurrency=4: - WebKit (wsl-run): 9 reds in 5 files. Rerun serially, they are the same 9 at base |
||
|
|
2eac916170 |
gateway: short-lived gateway keys, issued by POST /v1/magpie/keys or magpie gateway-key issue
xazaj on X is moving an enterprise LLM gateway onto magpie. Their
orchestrator gives each sandboxed agent a key of its own, and that key
has to stop working by itself.
A gateway key can now expire (Key.Expires) and can be issued under
another key (Key.Issuer). It lives from 1m to 30d. It can be held to a
set of models, a set of accounts, tokens or cost over its whole life
(one "hours" limit as long as its life), and read-only.
- POST /v1/magpie/keys {"ttl":"1h"|3600, name, models, accounts, tokens,
cost, readOnly} answers 201 with the secret once, no-store. GET lists
the caller's keys, masked. DELETE /v1/magpie/keys/{id} revokes one.
- magpie gateway-key issue --ttl 1h [--name] [--models] [--accounts]
[--tokens] [--cost] [--read-only] [--from <id>] [--json] prints the key
alone. gateway-key issuer <id> on|off lets a key issue keys. list shows
until/expired/issued by.
Who may issue:
- a key the user let issue (Issues), from wherever that key is let in,
so a container or CI can;
- with no key, a request that profileRefused passes: loopback, no
forwarding header, no Origin/Sec-Fetch/Mozilla marks, a loopback Host.
Such a request can already use every model with no key and run the CLI,
so it gains nothing.
Never: a page, another computer without such a key, a key not let issue,
an issued or expiring key, or a read-only key (readOnlyGuard).
An issued key never outlives or exceeds its issuer. IssueKey clamps its
expiry and refuses models and accounts the issuer can't use. On every
authentication (access.Check, under Authenticate and On), identityOf
folds the key into its issuer as the issuer is now: models, accounts,
read-only, quotas and expiry. An issuer that is off, removed or expired
refuses its keys. Spend counts against the issuer too: the new usage
field callerIssuerId, budget.read/Append counting both keys, and Reserve
reserving on both. /v1/magpie/limit answers expires and issuerLimits.
An expired or refused key gets 401 with why ("… expired at …: ask for a
new one") on every route, from loopback too. Otherwise a held sandbox
whose key ran out would be let in as no key. Expired keys are pruned
after an hour (every 10 minutes while serving, and on each issue).
rowText packs CallerIssuerID: without it, usage.Visit returned the field
empty and the issuer's limit counted none of its keys' calls.
Docs: gateway-routing.md has "Short-lived gateway keys" and the
/v1/magpie stats API table. site/public/docs remote has "Short-lived
keys" and "Stats API" in en, zh and ja. GitHub OIDC is filed as #4531.
Run at base
|
||
|
|
07a3312c53 |
library: sync and backup files carry the subagents
xixi_Sean_ on X asked why Sync leaves the Library's subagents out. There
was no reason: the library part of a bundle now carries them.
- library.Bundle.Subagents (*[]*Subagent): name, description, prompt,
the skills and MCP servers named, the agents ticked. Collect always
sets it, empty too. Applied.Subagents (which files magpie wrote here
and their hashes) stays out: each computer writes the files into its
own agents on the sync Put runs and records its own, so a file the
user edited there, or one of theirs by the same name, stays theirs.
- Put replaces the subagents with the bundle's, so one taken out on one
computer goes from the others. A nil list (a bundle from a magpie
before this) is unknown and keeps this computer's.
- check refuses a subagent whose name isn't one (it is a file name in
every agent) or comes twice; agent ids are carried as they come, so a
newer magpie's tick for an agent this one can't give subagents to
stays and writes nothing here.
- davsync: an empty list hashes as before the field, so upgrading with
no subagents syncs nothing.
- backup files go through the same Collect/Put; the CLI's backup line
counts subagents. The GUI's sync/export/import ticks say "instructions,
MCP servers, skills and subagents" in every language.
- webdav-settings-refresh's "Agents" tick locator also matched the
library tick's "subagents": it now asks for "Agents' models".
- library.md and sync-backup.md updated. Hooks still aren't carried.
Run (rebased on 0bf5adb11; Go runs at e0c57ffe2, same diff):
- mote: go test -tags nogui ./internal/backup ./internal/davsync
./internal/cli ok; ./internal/library -run 'TestCarry|TestSubagent|
TestLocalServer|TestPutKeeps|TestPutSame|TestRestoreKeeps' ok
- wsl-run (Linux): ./internal/library ./internal/backup ./internal/davsync
whole packages ok
- win-run (Windows): the same three, -run 'Subagent|TestCarry|TestLibrary|
TestSyncLibrary' ok
- go vet -tags nogui for darwin, GOOS=linux and GOOS=windows on the four
packages ok; gofmt -l clean
- GUI (wsl-run, Chromium + WebKit, every language): i18n-keys,
github-sync, s3-sync, sync-auto-restore, sync-not-backup,
sync-other-kind, sync-sign-in, sync-spin, sync-usage-error,
webdav-settings-refresh, library-backups-top, gui-de, gui-ja,
gui-zh-tw, settings-search, settings-sections: 170/173, then
webdav-settings-refresh green after the locator fix. The one red left,
i18n-keys "a plugin's words are its own" ("Unmarked" in
plugins/routing/i18n.js), is on main already: #4524.
mote ran five other GUI suites at load 18, where every WebKit
github-sync case timed out at launch, so the GUI run moved to Linux.
Broken by hand: with Collect not setting Subagents and Put ignoring
them, TestCarrySubagents, TestCarrySubagentKeepsUsersFiles,
TestCarryNewerSubagents, TestBackupFileCarriesSubagents,
TestSyncSubagents and TestNoSubagentsHashAsBefore went red; with Put
treating a missing list as empty, TestCarryOldBundleKeepsSubagents and
TestBackupFileCarriesSubagents went red.
Not tried: a real WebDAV/S3/GitHub remote between two real computers;
the fake DAV server carries it between two sandbox HOMEs.
|
||
|
|
59546b3fdb |
gateway: Kimi Code's K3.1 Pro refusing reasoning none on Chat is asked again at its lowest (#3739)
7eleven.eth (Discord #feedback) hit "Kimi Code: K3.1 Pro does not support disabled thinking mode. Please enable thinking and try again, or choose another model." in ZCode. On Anthropic Messages, ZCode's default format, this was fixed in |
||
|
|
0bf5adb118 |
gui: a tight GC lets a small heap grow by 32 MB, not a tenth (#2278)
The usage and sessions reads run under GOGC=10. On a first start they begin on a ~50 MB live heap and allocate ~400 MB a second, so a tenth was a collection every few MB: 2,102 to 2,239 collections in the first 75 s, about 70 s of the start's CPU, and each one emptied the zstd and bufio pools, which were then allocated again. While a read is under a tight GC, each collection now sets GOGC for the heap it left: tightPercent gives a tenth, or enough for 32 MB of growth, never above what was set before (a lower or off GOGC is kept). A heap over 320 MB is held to a tenth as before. The hook is a finalizer re-armed after each collection while a read is under it. Cold start on mote's copy of the real history (75 s, two runs each, v0.1.2330's lastIndex build vs this): - CPU 3:46.66 / 4:00.50 -> 3:08.69 / 3:10.04 (user 3:18.97 / 3:28.67 -> 2:44.23 / 2:45.85) - collections 2,239 / 2,102 -> 706 / 705 - phys_footprint_peak 318 / 312 -> 330 / 335 MB - heat, requests, overview 0/7/30 and stats 0/30 answers byte-identical A 16 MB room: 3:46.86 / 3:38.78 CPU, 1,554 / 1,390 collections, peak 331 / 323 MB, so it buys little. Tests (mote): go vet ./internal/gui; go test ./internal/gui -run 'TightGC|WarmUp|UnderTight|TightPercent|WarmCodex' ok. TestTightPercentLeavesRoom pins the bound; TestTightGCRetunesAfterACollection checks a collection retunes GOGC and the read's end restores it. Broken by hand: retightenGC not setting GOGC turns TestTightGCRetunesAfterACollection red. Not tried: the full gui package (TestCoveredWindowStaysUp is killed on mote, #4125); Windows and Linux runs. |
||
|
|
05dae78544 |
sessions: the last key of a line is found going forward, not a byte at a time back (#2278)
tsAt(b, true), Claude Code's reply line (the last "usage":{) and strAt
found their key with bytes.LastIndex, which goes back over the line a
byte at a time (Rabin-Karp). A Claude Code line holds a tool's whole
output, and on a first start over a real 14 GB Claude Code and 3.8 GB
Codex history, LastIndex was 8.4 s of the profile's CPU, 7 s of it
tsAt's. lastIndex finds the same index: it looks at the line's last
1 KiB first, where Claude Code writes the timestamp, then goes forward
with bytes.Index, which skips ahead with the CPU's vector instructions.
Run on mote (zone worktree at this head):
- go vet ./internal/sessions for darwin, linux and windows: ok.
- go test ./internal/sessions ./internal/usage: ok.
- TestLastIndexIsLastIndex: 3,000 random lines up to 3,000 bytes, keys
that overlap themselves and an empty one, against bytes.LastIndex;
and a key in the tail, before it and across its edge.
- Broken by hand: stopping at the first match forward, red
("lastIndex(996 bytes, "aa") = 7, want 983"); a tail match placed at
the tail's start, red ("= 535, want 673").
- First start on mote's real history (advst.sh, 75 s, cold caches),
v0.1.2328 against this, twice each: user CPU 3:40 and 3:38 against
3:27 and 3:22; footprint peak 324/320 MB against 319/316 MB. The
heatmap, requests, overview and stats answers (0, 7, 30 days) are
byte for byte the same.
|
||
|
|
2da173214f |
routing: a kept request is named by its agent as magpie knows it now, so Kimi Code's old requests show its icon (jiabubu)
jiabubu on Discord, after |
||
|
|
30f29564eb |
sessions: a change to one agent's calls reads that agent's files again, not every shard (#2278)
callCacheVersion named every shard, so raising it for a fix to one agent's calls threw away every agent's calls and re-read the whole history on the next start: on a real history of ~4,700 transcripts that is minutes of CPU and the ~310MB peak, for a change to Claude alone. Each agent now has its own number in callParseVersions. A shard frame records the number its agent had when it was written (callDiskState .Parser), and loadCalls drops a frame whose number is not the current one, so only that agent's files are read again. CallCacheVersion() adds the raised numbers, so the usage caches built on calls (requestDiskBinary, heat_disk) still start again when any agent's calls change. callCacheVersion stays for a change to every agent or to the shards' form. Existing shards are kept: the map is empty, gob leaves a zero Parser out, and CallCacheVersion() is still "calls-v15". Run on mote (zone worktree at this head): - go vet ./internal/sessions ./internal/usage for darwin, linux and windows: ok. go build ./...: ok. - go test ./internal/sessions ./internal/usage: ok. - go test -race -count=3 -run 'TestCallParseVersionRaise|Calls|Shard|Frame' ./internal/sessions: ok. - TestCallParseVersionRaiseReadsThatAgentAlone: a Claude transcript and a Codex rollout; raising claude scans the Claude file alone, with the same calls, and the next start scans nothing. - Broken by hand (the Parser check in loadCalls removed): red at call_versions_test.go:67, "scanned map[], want Claude's file alone". Not changed: internal/gui's TestCoveredWindowStaysUp is killed at 30s on mote, as in #4125. |