ac4af582301a4e8a29245dbba767eba31334ddf9
7089
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ac4af58230 |
gateway: a LazyCat app is shared at its own domain, and a cgroup v2 container is known
mtoolstec on X runs magpie in LazyCat (懒猫微服) and, with "Share on local network" on, Settings offered http://172.28.3.65:3425: the container's own address, which nothing outside the box reaches, and no hint that it was a container's. LazyCat injects LAZYCAT_APP_DOMAIN (magpie.<box>.heiyu.space) into every container of an app and serves the app there over HTTPS. The magpie-lzcapp package sets MAGPIE_PUBLIC_URL=https://{{.S.AppDomain}} through a manifest template, which only lzcos 1.3.8+ renders; unrendered, url.Parse refuses the "{" host and publicURL() was "" (the log says "ignoring invalid MAGPIE_PUBLIC_URL"). A hand-written manifest may not set it at all. Then ContainerAddrs() needed inContainer(), which knew only Docker's and Podman's marker files and a runtime's name in PID 1's cgroup. Under cgroup v2 with a private cgroup namespace (Docker's default since 20.10) /proc/1/cgroup is "0::/", and a runtime that writes no marker file got past it, so the container's addresses were listed as the computer's. - publicURL() falls back to https://$LAZYCAT_APP_DOMAIN when MAGPIE_PUBLIC_URL is unset or invalid (a DNS name only; lower-cased). Everything built on PublicURL follows: LANURLs, PublicHost (the rebinding Host check), magpie web's links and trusted origin, the image MCP base, the CLI's advertised URL. InContainer() is true there too (updates go through the image). - inContainer() also takes a container's init as PID 1 (magpie itself, as our image starts it; tini, docker-init, dumb-init, catatonit), and a cgroup namespace's root ("0::/") on an overlay root filesystem (/proc/1/mountinfo). Neither alone catches a host: a systemd host is in /init.scope even on a read-only overlay root, and an init without cgroups on ext4/btrfs is not overlay. hostNetwork is unchanged, so a container on the host's network still lists the host's addresses. What the user sees: in LazyCat, "Share on local network" shows https://magpie.<box>.heiyu.space (and the Gateway URL is that domain). In any other cgroup v2 container on a bridge network without a marker file, Settings shows the container hint to set MAGPIE_PUBLIC_URL. Run: - TestInContainer (13 fake roots: systemd host, systemd on overlayroot, cgroup-less init on btrfs, WSL, markers, cgroup v1, kubepods, cgroup v2 on overlay, magpie/docker-init/tini as PID 1) and TestLazyCatPublicURL (LazyCat domain, mixed case, the unrendered template, MAGPIE_PUBLIC_URL winning, bad domains) pass on Linux (wsl-run, magpie-desktop). - Broken by hand: with origin/main's lan.go both tests are red (4 and 4 cases). - Real systems: the WSL2 distro (systemd host, 0::/init.scope) reads inContainer=false. Docker 28.2.2 on xiaomi-gpu, debian:12-slim with /.dockerenv removed (cgroup "0::/", overlay root, PID 1 sh) reads inContainer=true hostNetwork=false; with --init (docker-init) true; with --network host inContainer=true hostNetwork=true, so it still isn't called a container's addresses. - go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., and the darwin/linux nogui/windows builds pass on mote at the first base ( |
||
|
|
fdd38154b8 |
docs: the Usage, Video generation and sign-in links to their settings
gui-shell.md, gateway-routing.md and providers-accounts.md name the links 22c665d6f, |
||
|
|
3b550a99c7 |
providers: a sign-in kept to its link leads to the setting that kept it
With Settings › Privacy › Sign-in pages' "Open sign-in pages in the browser" off, adding an account says "magpie didn't open the sign-in page, as set in Settings" and gave no way to that setting (the scattered settings audit after netube99 on X). That line now ends in a Settings › link that opens Privacy and lights the row. The row stays in Privacy: it is there for max2020's reason, a vendor seeing which browser a user signs in from. app.js's core budget is met by one comment cut beside it, no raise (38 bytes over before the cut). Run (mote, through mote-run, Chromium and WebKit): signin-link-only (every language, both a link-only and an opened sign-in, which has no link), video-gen-pick and i18n-keys, 78 of 78; TestCoreScriptBudget ok after the cut. Broken by hand: no link, signin-link-only red in Chromium. Not tried: a real sign-in in the app; the whole GUI suite runs after the last of these changes. |
||
|
|
cedacf1aea |
settings: Video generation's how-to leads to the Providers page
With no model that makes videos, Settings › Models › Images' Video generation says to right-click a model in its provider's Model settings and mark it a video model, on another page, with no way there (the scattered settings audit after netube99 on X). The line now ends in a Providers › link that opens that page. It is drawn in videogen.js, so the core script doesn't grow. Run (mote, through mote-run, Chromium and WebKit): video-gen-pick (every language it covers, 1100 and 400), signin-link-only and i18n-keys, 78 of 78; TestCoreScriptBudget and the I18n Go tests. Broken by hand: no onclick, video-gen-pick red in Chromium. Not tried: the real app's window; the whole GUI suite runs after the last of these changes. |
||
|
|
8607a7a029 |
library: a skill GitHub's limit left unchecked leads to the token's row
A skill check that ran into GitHub's 60-an-hour limit says "Add a
GitHub token in Settings → Network and sharing", in a status line that
fades and a tag's tooltip, and nothing there went to Settings (the
scattered settings audit after netube99 on X). The Not checked tag is
now a link when the limit was the one without a token: it opens
Settings › Network and sharing and lights the GitHub token's row. A
token's own limit has nothing to add there, so its tag stays plain.
github-token.test.cjs swaps its route between rounds with
unrouteAll({ behavior: "ignoreErrors" }): the click leaves Settings'
lazy files being served, and the old unroute made the next round's
handler fulfil a route already handled.
Run (mote, through mote-run): github-token.test.cjs, Chromium and
WebKit, en and zh, 8 of 8; github-token plus every
library-*.test.cjs before the route fix: 1211 pass, the one red that
route race.
Broken by hand: the tag never a link, 4 of 8 red (each limited case).
Not tried: the real app's window; the whole GUI suite runs after the
last of these changes.
|
||
|
|
fc9ce34d86 |
usage: hashRows reuses its scratch, within sizes its rows exactly
Startup on a copy of the owner's real accounts (mote, GUI, network
blocked, acgui.sh) allocated ~3.5GB, and two usage functions were near
the top of it:
- hashRows built a fresh 32KB byte buffer and shape map for every chunk
it hashed: 510MB of the startup's allocations. It now takes them from
a sync.Pool and clears the map before use. The digest is the same
byte for byte (checked against the old code on the same chunks).
- rowChunk.within appended into a nil slice, growing it step by step
(292MB flat). It now counts the rows in range first, returns nil when
there are none, and makes the slice at that size.
Measured, same real-account copy, t9 (main) against t10 (this):
startup CPU 13.81s -> 9.77s
allocated (3m) 3483MB -> 2768MB (hashRows 510MB -> gone,
within 427MB -> 244MB cumulative)
footprint 179MB -> 175MB
Tests: TestHashRowsReusesItsScratch hashes a chunk again after a bigger
one and must get the same digest, and must allocate under 16KB a call
(min of 5 batches, so other goroutines' allocations don't count). Old
heat_disk.go: red at 32768 bytes a chunk; dropping clear(shapes): red.
TestWithinSizesItsRows needs len = cap = 600 (old code: cap 646).
Run on mote at this tree: go test ./internal/usage -count=1 ok, -race
ok, gofmt clean, go vet darwin/linux/windows ok, gui tests ok earlier.
An earlier usage run went red on a test whose name was lost (the log was
cut by tail); four full runs since are green, and the likely cause, the
first byte check counting other goroutines, is what the min-of-5 fixes.
|
||
|
|
3a5e4b62d0 |
usage: TestRowTokensAndZoneKept compares the zone by name and offset
The test compared got.Time.Location() with its own *time.Location by pointer. rowZones keeps the first zone it sees for a name and offset, so under -count=3 the second run got the first run's location back and the test went red on unchanged code. It now checks the zone's name and offset (IST, +5:30), which is what rowZones promises. Run on mote: go test ./internal/usage -count=1 ok; -run TestRowTokensAndZoneKept -count=3 ok (red on the old test). Broken by hand: writing the row with an "XST" zone turns it red. |
||
|
|
92be1d779b |
usage: the allowances' head opens Settings › Allowances
The Usage page draws the allowances, but how they are shown (used or
left, the menu bar's figures) and their alerts are set in Settings ›
Allowances, and nothing on the page said so (the scattered settings
audit after netube99 on X). The allowances' head now has a Settings ›
link, as the Routing page has, that opens that tab and lights the
Allowance display row (now #quotaLeftRow). Wired in the usage plugin,
so the core script doesn't grow.
Run (mote, through mote-run, Chromium and WebKit, every language, 1100
and 420): settings-places, mobile-web (with an origin/main baseline;
the button is taken out until the baseline has it, as rtToSet is),
account-mask, quota-curve, i18n-keys: 89 of 89, twice. A first run had
one red whose name a tail cut off; the next two runs of the same files
were 89 of 89, so it is unnamed and not seen again.
Broken by hand: no onclick, settings-places 2 of 2 red (no row lit);
no #quotaLeftRow, 1 of 1 red.
At the pushed head (rebased on
|
||
|
|
f37de8cc4e |
provider: the saved Claude accounts' files are listed once per request
claudeCodePrice and claudeModelsOf listed claude-accounts/*/.claude.json with filepath.Glob on every call, and each Claude model's price asks. Building an agent's model list (the window's drift poll rebuilds it each minute, buildClaudeVia and Pi's list) read the folder once per model. The listing is now held while a request holds the catalog (heldOf, 1 s), so a build lists it once; outside a hold it is listed afresh, as before. Measured on mote, real-account copy, GUI page open in Playwright Chromium, network blocked, 115 s CPU profile (acgui.sh), v0.1.3425-era build vs this change: - filepath.Glob: 50 ms -> gone; agent.buildModels 90 ms -> 50 ms - total samples 320 ms -> 290 ms; footprint 197 MB -> 172 MB (one run each) Test: TestClaudeCodeFilesListedOncePerHold saves a folder during a hold and checks the hold's second listing is the first one (same array), and that after the hold the new folder is seen. Broken by hand (the old claudeCodeFiles): red, "listed again within one hold". Run (mote): go test ./internal/provider ./internal/agent ok; go vet native (provider, agent), GOOS=linux and GOOS=windows (provider) ok; gofmt clean. |
||
|
|
623e797fde |
plugin pages: read a day's usage and share a picture they drew
A plugin's page can now read one day's usage and share an image it
drew. This is for the day card (JungleyYeh on X asked for a "daily AI
statement"); the card itself is an optional community plugin,
@magpie-community/page-day-card.
- A page that asks for the "usage:day" read gets that day as
magpie.read("usage:day", {date, tz}): totals, each agent and its
models, the streak and the average active day (usageapi/day.go,
gui/pageday.go). The Plugins page names the read before it is granted.
- magpie.image.copy(png) and magpie.image.save(png, name) share a PNG
of at most 16 MB. In the window they go through
POST /api/plugin-pages/image (pageimage.go): copy puts the picture on
the clipboard (clipimage.go: osascript PNGf on macOS, PowerShell
PNG + Bitmap on Windows, wl-copy or xclip on Linux), and save writes
it to Downloads under a name made safe. In magpie web, the browser
saves or copies the picture itself.
- The window's side, pageshare.js, is imported the first time a page
shares a picture. The core grows by its one call only, paid for by
comments cut, so the budget is not raised.
Tests:
- New: TestDayOf, TestPluginPageReadsADay, TestPluginPageSharesAPicture,
TestPageImageName and TestClipImageCommand. plugin-page.test.cjs
covers the bridge, both engines and a refused SVG.
What was run (mote):
- gofmt, plus go vet on darwin, linux and windows: clean.
- Full go test ./... at the pre-rebase base: 369 packages ok, 3 FAILs.
- TestEveryRouteHasACommandOrIsNamed and TestCoreScriptBudget were
this change's own reds. The new route now has a parity entry, and
the share code moved into lazy pageshare.js with no raise.
- TestGatewayModeStatsNameTheGatewaySessions is #5690, the red in the
first hour of the day (it ran at 00:32).
- GUI suite (affected and plugin files, both engines): 1160 of 1179
passed. Every red is filed and none touches this change:
- i18n-keys "a plugin's words are its own": #5332, #5426, #5482.
- page-width-steady: #5013.
- plugin-card-update in WebKit: #3079.
- plugin-move-unserved "Try again": #4410.
- At this head, after the rebase on
|
||
|
|
bc8b01d603 |
claude: the short system prompt is set in the Claude Code editor, not Settings › Replies
The scattered settings audit after netube99 on X. Short Claude system
prompt and Claude Code's interactive mode changed only Claude
subscription runs, yet sat in Settings › Models › Replies, while the
Claude Code editor already had its own "Claude Code runs as" switch for
the second, whose card said "Switched here or in Settings › Models ›
Replies".
Both rows now go in a claudeRunList in the Claude editor (PROV_PREFS), so
Settings' search still finds them and Open goes to the editor. In the app
the editor's own "runs as" switch is the one shown, and the duplicate
interactive mode row is hidden by CSS; in magpie web as a gateway, where
that switch is disabled, the row shows (the list gets a gw class from
renderReplies: body.gateway-mode is set only on a change, not at boot).
provPrefsField lets Claude's run list through in gateway mode, without
the warm-ups, which are this computer's. The card and the "off" reason
no longer name Settings (zh, zh-TW, ja, de written with them), and the
bridge's subsystem page names the editor.
Run (mote, mote-run, origin/main
|
||
|
|
8f72f95304 |
provider: a group's lookup copies the group found, not every group
FindGroup, FindGroupAlso and GroupFinder built every routing group with groupsIn, which copies each group and its rules, to return one. The window's 15-second /api/drift poll asks GroupFinder for each Pi model on a group (piModelJSON), and the gateway asks once per request on a group. They now read the groups held (sharedGroupsIn, heldFrom while Hold is active) and copy only the group found and each group a member comes through (cloneGroup), so what a caller gets is still its own to change. Measured on mote with the real-account copy, GUI page open in Playwright Chromium, network blocked, 2 minutes (acgui.sh): - piModelJSON allocations: 10.6 MB -> 1.5 MB (v0.1.3420 vs this change) - process CPU 0.39 s vs 0.43 s, footprint 187 vs 197 MB: within the run noise of the once-a-minute catalog rebuilds; the drop is in the profile. Test: TestGroupFoundCopiesItselfAlone changes a found group, its member's Via and EffortMap, and checks FindGroup, GroupFinder and Groups still see the saved ones; then 50 looks must allocate less than 50 copies of every group (100 groups with rules). Broken by hand, each red: - A: sharedGroupsIn -> groupsIn: looks 5384832 B >= copies 4796000 B - B: no cloneGroup of the found group: index out of range (shared slice) - C: no clone of a member's sub-group: "a change to a found group reached the next look" Run (mote): go test ./internal/provider ./internal/agent ok; go test ./internal/gateway -timeout 45m ok; go vet native, GOOS=linux, GOOS=windows ok; gofmt -l clean. Not tried: a gateway request through a group with a real account (the path is the same FindGroup the test covers). |
||
|
|
a6e4cf7635 |
settings: what routing does sits under Models › Routing, and the Routing page opens it
The scattered settings audit after netube99 on X. Ask again after a
refusal, the Retry-After cap and the intent classifier's timeout were
under Models › Replies beside rows about a reply's content, and Busy
models last sat in Network and sharing, far from the routing it changes.
The four are now one Routing section under Models, after Replies, and the
Routing page's header has a Settings › button that opens Settings at that
section with its first row lit. The docs (reference.md, the site's
plugins page in en, zh and ja) name the new place.
Run (mote, mote-run):
- settings-places, retry-after-cap-setting, refusal-retries-setting,
classify-timeout-setting, model-load, i18n-keys and bare-ids, both
engines: all pass.
- mobile-web against origin/main
|
||
|
|
7d177985f6 |
settings › allowances: the alerts under an Alerts heading, and no empty Menu bar cost row in magpie web
The scattered settings audit after netube99 on X found Task done alert filed among the allowances' display rows, with nothing saying why, and magpie web drawing Menu bar cost as a row with no control (it has no menu bar, and renderTrayUsage returns before filling it there). - Allowance alert, Low balance alert, Reset reminder and Task done alert are now a list of their own under an "Alerts" heading (#alertHead, #alertList), after the display rows. Gateway mode hides the heading and the list, as it hid the four rows. - #trayCostRow is app-only, as #trayUsageRow is. - "Alerts" in zh, zh-TW, ja, de. Run (mote, at this tree): - settings-places (new), bare-ids, turn-done, usage-alert, reset-reminder, mask-alert, settings-search, i18n-keys: 122 pass, 0 fail, both engines. - go test -run "Budget|I18n" ./internal/gui: ok. Broken by hand: without app-only, settings-places is red 10 of 10 on "no Menu bar cost row in magpie web"; with the heading renamed, red 10 of 10. Not tried: the real app; the row moves are markup only. |
||
|
|
ddd6c649b3 |
draw: a plugin's model that says it gives images alone is an image model
maonekone (Discord #feedback, 11-09): a plugin can't say which of its
models draw; magpie took a plugin's image model only by its name
(DrawsID and ImagesAPI words). Now a model the plugin lists with
modalities.output ["image"] (no text), on its openai-compatible API, is
listed among the drawers and drawn at the images API through the
plugin's fetch, whatever its name. A model that answers in text and
images still chats.
Run (mote): TestPluginDeclaredDrawerDraws red on the old code ("drawers
[]"); with only the listing change, red again (the draw went to chat
completions); green with both. go vet ./internal/gateway ok; go test
-run "Draw|Image|SenseNova|Loomy|Plugin" ./internal/gateway ok (74s).
Not tried: a real plugin declaring such a model; the full suite.
Reported-by: maonekone (Discord #feedback)
|
||
|
|
92e8edd7fc |
windows: magpie is listed in Installed apps, and its Uninstall puts every agent back
Jevik_AI on X uninstalled magpie and rebooted, and Codex's config.toml still had openai_base_url = "http://127.0.0.1:3425/backend-api/codex"; Rk1ngggg asked whether an update cleans it. magpie's own uninstall (Settings › About › Uninstall magpie, `magpie uninstall`) already disconnects every agent and takes Codex's leftovers (#3866), but on Windows magpie wasn't in Settings › Apps › Installed apps, so it was removed the way Windows offers for a program it doesn't list: by deleting the exe and folders, which runs no code. shortcut.Ensure now writes HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\magpie (DisplayName, DisplayIcon, Publisher, InstallLocation, UninstallString, URLInfoAbout, NoModify, NoRepair) at every installed start, beside App Paths, and Remove (uninstall's System step) takes it out the same way: only while it names this exe, or an exe that is gone. Its Uninstall runs `magpie.exe uninstall --window` (shortcut.UninstallArgs). magpie.exe has no console, where the terminal's `magpie uninstall` would refuse for want of one to ask on, so those exact args open the app's window (or forward to the running app, OnSecondInstanceLaunch) on Settings › About with Uninstall magpie's question asked (uninstallView, ?uninstall=1). It asks once: a redraw of Settings doesn't ask again, and Cancel removes nothing. magpie web opened at that link asks nothing. Deleting the app by hand still runs no code (macOS drag-to-Trash included); agent-wiring.md says so. Run on mote at the pushed head (rebased onto |
||
|
|
39569d5604 |
claude desktop: an optional Claude Magpie app beside your own Claude (#5671)
baranwang on X asked to keep Claude Desktop's own (1P, Anthropic) sign-in while using magpie. Turning on "Separate app" in Claude Desktop's row on the Agents page (or `magpie claude-desktop launcher add`) moves magpie's 3P wiring into ~/Library/Application Support/Claude-Magpie-3p and adds ~/Applications/Claude Magpie.app. That launcher opens Claude.app with --user-data-dir on that folder, so it runs side by side with the user's own Claude.app. Its icon is Claude's icon with a magpie badge. Off is the default, and turning it off (`launcher remove`) moves the wiring back and removes the app. It is macOS only: Desktop's packaged app strips CLAUDE_USER_DATA_DIR, and on Windows it hardcodes LOCALAPPDATA\Claude-3p. The folder ends in -3p because Desktop adds -3p to any other name. Restarting the isolated app ends only its own process (pkill on its --user-data-dir) and opens the launcher again. Run at 1b25cda26 (this change on origin/main |
||
|
|
fdabddeb41 |
catalog: a list fetched again as it was tells no agent
The magpie serving the gateway fetches each signed-in account's list
again once it is 45 minutes old (KeepAccountsListed), and saveLive
called Touched after every save: Changed ran SyncCatalog, which built
and compared every agent's model lists, and Forget moved the stamp
dsh's rounds build magpie's models by, so they built them again too.
For a list that came back the same, all of it was for nothing.
Now saveLive compares what it is about to write with the file there,
but for the fetch time. The same list is written (the new time keeps
the next relist 45 minutes away) and its next read looks at the file
(filememo.Look, also under a request's hold); nothing else is told. A
list that differs in a model, a part (Sides) or what it was asked as
is told as before.
Measured on mote with a copy of the owner's real config and accounts,
network blocked, the claude account's list set 2h old so the relist
falls in the window (acidle.sh, alloc_space from 60s to 180s idle):
v0.1.3416 (t5): 42.8 MB, SyncCatalog 27.7 MB, buildModels 8.9 MB
first cut, Forget kept (t6): 28.8 MB, dsh rounds' buildModels 12.1 MB
this (t7): 14.1 MB (4.7 MB of it the heap profile's own write),
neither SyncCatalog nor buildModels in the profile; the claude
list's fetched moved to the relist's time (06:18:52)
Without a relist due, idle was 7.8 MB before and after.
Test: TestLiveSavedAgainSameTellsNoAgent. Broken by hand: always
Touched (red: "changed 2, forgot 2; want 1, 1"), and no
filememo.Look (red: the held read keeps the old fetch time).
Run at this head on mote: go test -count=1 ./internal/catalog/
./internal/provider/ ./internal/agent/ ./internal/filememo/ ok; go vet
of internal/catalog native, GOOS=linux and GOOS=windows ok; gofmt -l
clean.
Not tried: an account whose list really changed in a running magpie
(the test covers a model, a window, a part and the asked version).
|
||
|
|
be9dbce02c |
settings search: built-ins are found too, off or on, and Open goes to their row
A built-in's switch and the settings it keeps in Plugins › Built-in or on its own page (Gateway's Recent calls at a time) were found by nothing in Settings' search, and one switched off took its Settings tab and rows with it, so searching "Observability" with it off said no setting matched (the scattered settings audit after netube99 on X). The search now lists, after Settings' own rows and under "Plugins › Built-in", each built-in whose name, line or schema setting has the words, in the language shown or English, one off saying Off. Open goes to Plugins › Built-in and lights that row, again when the list is drawn a second time as the plugins are read. The list is drawn by a lazy setfeats.js the first time a search runs, and only when what it finds changes, as Settings' observer runs the search again on each change under the view. Run (mote, at f98e954ce's tree plus this): settings-search, old-webkit, builtin-places, provider-prefs, i18n-keys: 170 pass, 0 fail, Chromium and WebKit, every language; TestCoreScriptBudget ok. Broken by hand: without the row's light, and with the match always false, the new case went red in Chromium (7 pass, 2 fail each). |
||
|
|
07a06617e1 |
quota: an early reset starts the Cycle chart though the card's reset has milliseconds
steven_4422 (Discord #feedback, 11-09): a weekly window refilled early at Nov 9 02:00 kept its deadline, yet the Cycle trend began at Nov 4 10:40, the vendor's own start. quotaCycle took the recorded early reset only when the card's resetsAt equalled the last reading's exactly. History keeps whole seconds and a vendor's deadline can drift a little between reads, so the two rarely matched. Now a reset minutes apart counts as the same one. Run (mote): new quotaCycle test red on the old code (actual 2026-11-04T10:40:00.437Z, the reporter's start), green after; quota-curve.test.cjs 31/31; go test -run Budget ./internal/gui ok. Not tried: the reporter's own account; the full GUI suite (mote's suite lock queue is hours long). Reported-by: steven_4422 (Discord #feedback) |
||
|
|
89d8b4d5f9 |
settings search: a provider's settings are found only while that provider is added
Settings' search lists each provider's own settings (warm-ups, check-ins
and the like) as rows that open the provider's editor. It listed them
for every provider magpie knows, so a search for "warm up on reset"
offered ChatGPT and Claude to a user with neither, and Open did nothing
(the scattered settings audit after netube99 on X). A row now remembers
its providers and is left out while none is added, and a row whose
built-in plugin is off is left out as the others are.
Those rows are drawn by a lazy provlinks.js the first time a search
wants them, not on each Settings draw: app.js was 399 bytes over
TestCoreScriptBudget with the change, and is now 956 under its size at
the base, with the budget unchanged.
Run in the tree with this change and the rest of the audit's fixes
(mote, base
|
||
|
|
4064c10362 |
routing groups: on while Routing is off, their Built-in row says their page went with it
Routing groups have no page of their own: theirs is on Routing. With
Routing off and Routing groups on, Plugins › Built-in showed the groups
switch on and nothing anywhere to set them, and the quick start's
routing step still counted groups alone (netube99 on X, and the
scattered settings audit after it). The groups row now says "Their page
is on Routing, which is off" with Turn on Routing, which flips Routing's
own switch on the same list, and the quick start's step leaves with
either one off.
The hook lives in a new plugins/routing/settings.js, loaded after app.js,
whose featWho it extends (plugin client files load before app.js; the
first try in client.js threw "featWho is not defined" in every test).
Run in the tree with this change and the rest of the audit's fixes
(mote, base
|
||
|
|
7cb437ee16 |
masking: its alert sits with its other settings, and its Built-in row says when nothing is masked
The Masking alert was the one masking setting on the Masking page, under
the request list, away from every other one in Settings › Privacy (and
in Settings › Usage before that, where nb5p looked for it). It is now
the first row of Privacy's "when a value is found" list, out in gateway
mode as before. The Masking page is the list of masked requests alone.
Masking turned on with no kind, no personal data and no word of the
user's masks nothing, and its Plugins › Built-in row said only where
its settings are. It now says "Nothing is masked yet" before the link
(the scattered settings audit after netube99 on X).
Run in the tree with this change and the rest of the audit's fixes
(mote, base
|
||
|
|
17a94a1b00 |
gateway: its keys show for a web page listed in Settings, and Settings links to them
A web page listed under Settings › Network and sharing › Web pages that
may call magpie is refused without a gateway key, shared or not, and the
row says to use "a gateway key from Gateway". But the Gateway page drew
its keys only while Share on local network was on, so that user found a
line saying keys come with sharing and no way to make one (the scattered
settings audit after netube99 on X). The keys now show while sharing is
on or a web page is listed, the off line names web pages too, and the
Web pages row links to Gateway's keys once it has a page.
The guard in renderGatewayOwn's settings callback also redraws the whole
view only while its box is still in the page, as 5efe0e195 does for the
first draw.
Run in the tree with this change and the rest of the audit's fixes
(mote, base
|
||
|
|
88b541a25c |
images: every pointer names Settings › Models › Images, where the page is
The image models moved under Settings › Models, but the Library's Magpie
Image sheet, the MCP server's instructions to agents, the gateway's
"no image model" errors, the video tool's text and the docs still sent
users to "Settings › Images", a tab that no longer exists (the scattered
settings audit after netube99 on X). Every user-facing string now names
Settings › Models › Images in en, zh, zh-TW, ja and de, as do the site's
Qwen docs (en, zh, ja), llms-full.txt, the subsystem pages and comments.
Run in the tree with this change and the rest of the audit's fixes
(mote, base
|
||
|
|
4ddd01fe5b |
gateway page: its own settings draw nothing while the page isn't drawn
c9a1c557d's renderGatewayOwn, run again once settings are read, met a
window where the view was "gateway" but the page's template wasn't on
it, and threw on a null #gwOwn. old-webkit's "with Safari 15.0's
built-ins, the panel and the window draw every page" was red on main
from then on ("null is not an object (evaluating 'box.replaceChildren')").
Run on mote:
- old-webkit + gateway-own-settings on origin/main
|
||
|
|
dae104bfac |
capre: a length check, not an unrolled repeat, holds nine patterns
Go's regexp unrolls a bounded repeat into that many copies of its
class: [A-Za-z0-9.-]{0,254} (the session terminal's bundle id) was
89kB of program, kept from start to exit, and Codex's item-id refusal
`.{0,1000}?` 88kB. Measured one by one over magpie's 540 package-level
patterns (1.5MB in all), the nine largest bounded ones were ~440kB.
capre.MustCompile(expr, max) is the pattern with * or +, matching only
a string of max characters at most (rune count, so the (?i) Kelvin
sign and invalid bytes count as the regexp counted them). The nine:
settings' bundle id, library's name and agent id (now name@wsl:distro
cut in two), Anthropic tool names, the trace page's name and find,
access's MCP server, OpenClaw's profile and Codex's provider id. The
item-id refusal is a function: the tail within 1000 characters of a
head.
Run on mote (go1.26.8):
- go test ./internal/capre ./internal/access ./internal/settings
./internal/library ./internal/sessions ./internal/agent ./internal/gui
. : ok; ./internal/gateway -run 'ItemID|Undeclared|ToolName|Refus': ok
- TestCappedMatchesBounded holds each old pattern against its new one
over 14 units x 19 lengths (0..300, at each bound +-1); with the
length check taken out it is red (1586 mismatches).
TestItemIDRefusalAsTheRegexp holds the function against the old
regexp at 998..1002 characters of x, é, 日, \xff, \n; with 1001 it is
red. TestCappedIsSmall: 1304 bytes held, 49680 bounded.
- go vet native, GOOS=linux and GOOS=windows over the touched packages
(gui natively: its Linux build needs cgo); gofmt -l clean.
- Real build, GODEBUG=inittrace=1: magpie's own inits allocate
11.93MB -> 10.61MB.
- Idle on the real-account copy, 180s heap: regexp programs (sampled)
4.54MB -> 3.01MB.
Not tried: the full ./... suite; the gateway package beyond the run
above.
|
||
|
|
ffbc45eac5 |
usage: a breakdown row's second line wraps at every width, not cut at 180px
In a wide window a Usage breakdown row's name column is a fixed 180px
and the line under the name (the sign-in, calls, credits, failures,
TTFT, speed) was one line cut with an ellipsis there, so everything after
the provider was hidden. Only the narrow web layout let it wrap. It now
wraps at every width; the narrow rule that did the same is gone.
Reported-by: shusoyo (Discord #general, 11-09)
Run (mote): usage-stat-sub-wrap.test.cjs 8/8 (chromium, webkit; en, zh;
1440 and 1000px). Broken by hand: with the old app.css it is 0/8 ("the
line wraps, not cut").
|
||
|
|
8d80f6bc0a |
sessions: the kept stats and listing hold an untitled id once, not a map entry
keptStats and keptList noted every answer Codex's titles gave in a map[id]string, to ask each again before the kept ranges are given out. Nearly every id has no title, and the map held 3.12MB on an 18k-file history. titleAnswers keeps the named ones in a map and the untitled ids in a slice, sorted, without repeats or slack once settled; still() asks each again as before. Both caches use it. Run (mote, real-account copy, idle 180s, network blocked): - statsKept.keptTitle.func4 3.12MB -> under the profile's cut; total inuse 107.40MB -> 104.23MB. - TestStatsKeptBetweenPolls now also names a Codex thread after the ranges were kept and checks the title reaches them. TestTitleAnswersSettled checks repeats and slack go. - Broken by hand (still() skipping untitled ids, settle not compacting): TestListKeptBetweenPolls, TestStatsKeptBetweenPolls and TestTitleAnswersSettled red; green on this code. - go test ./internal/sessions/ ok; go vet darwin, linux, windows ok; gofmt clean. Not tried: the full suite (only internal/sessions reads these caches). |
||
|
|
67d06c24ea |
sessions: a file's state fits the 416-byte size class, not 448
A state was 424 bytes, so each one decodeCache and parseRead make took a
448-byte slot. HeadSize is the length of a head of headLen (256) bytes
at most; as an int32 beside CdRead it saves 8 bytes, and a state is 416,
32 bytes less held per session file (~0.58MB for 18k files).
Run (mote, real-account copy, idle 180s, network blocked):
- decodeCache's inuse 26.01MB -> 23MB, reflect.unsafe_New 15.51MB ->
12MB. The profile samples every 512KB, so more than the ~0.58MB the
size class accounts for is sampling, not this change.
- TestStateFitsItsSizeClass: green; red on the old int by hand ("a state
is 424 bytes, over the 416-byte size class").
- go test ./internal/sessions/ ok; go vet darwin, linux, windows ok;
gofmt clean. The cache's JSON keeps head_size as a number, so an old
cache reads as before.
Not tried: the full suite (state is unexported, only internal/sessions
reads it).
|
||
|
|
cd0ba05c21 |
sessions: each day's usage and active rows are made to size
statsOfRange grew every day's Usage and Active rows by append, and the
overview keeps three ranges (7, 30, every day), each holding the slack
of every doubling. The rows are now counted per date first and made at
their length.
Run (mote, real-account copy, idle 180s, network blocked):
- statsOfRange's own inuse 9.90MB -> 8.37MB (-1.54MB in the diff
against the v0.1.3411 build's profile).
- TestStatsDayRowsHoldNoSlack: green; red on the old code by hand
("usage 5 of 8, active 5 of 8").
- go test ./internal/sessions/ ok; go vet darwin, linux, windows ok;
gofmt clean.
Not tried: the full suite (one package changed, nothing outside it reads
the rows' capacity).
|
||
|
|
46a615fb24 |
edit: a config's kept parse holds none of the file's text and no slack
tomlFileOf keeps a config's parse while the file is unchanged. Each key's
text, prefix and suffix were slices of the file's string, so the whole
file stayed alive beside the parse (1.5 MB of the owner's Codex
config.toml, ~11k project tables). The tables and names were also grown
by append and kept with their room. What is kept is now copied out:
text cloned, the prefixes and suffixes a config repeats on every line
(`trust_level = `, ` # …`) interned once through unique, and the tables,
each table's keys and the names held at their exact length.
Run on mote at this head:
- go test ./internal/edit: ok
- GOOS=darwin/linux/windows go vet ./internal/edit: ok
- gofmt -l: clean
- Broken by hand: without keptKeys on the tables,
TestTOMLFileKeepsNoFileText is red ("2996 keys' text is still a slice
of the file's"); with slices.Clone for the tables it was red on their
room (3000/3072).
- Real-account copy (~/r2278/acct), idle heap at 180s: edit.tomlFileOf
7.14 MB -> 2.97 MB; heap total 89.4 MB (102-103 MB the run before);
Footprint 151 MB.
|
||
|
|
195d79939e |
dirent: a listing's entry keeps its time as nanoseconds, 40 bytes not 56
Stat.Mod was a time.Time (24 bytes), so an Entry was 56 bytes. The
listings kept for a long history hold up to ~130k entries (keptEntries),
and on the owner's real cache they were the idle heap's 7.7 MB under
dirent.entry. Mod is now unix nanoseconds (int64) with ModTime() for the
three callers that want a time; getattrlistbulk's seconds and
nanoseconds are summed as time.Unix does. An Entry is now 40 bytes.
Run on mote at this head:
- go test ./internal/sessions ./internal/dirent: ok
- GOOS=darwin/linux/windows go vet ./internal/dirent ./internal/sessions:
ok
- gofmt -l: clean
- Broken by hand: a 16-byte pad in Stat makes TestEntrySize red
("an Entry is 56 bytes, want 40").
- Real-account copy (~/r2278/acct), idle heap at 180s: dirent.Stats
7.68 MB -> 4.20 MB (dirent.entry flat 5.68 -> 1.70 MB); Footprint
148 MB.
|
||
|
|
331f4a1393 |
gui tests: a comment line doesn't say a plugin's words (#5332, #5327, #5426, #5482)
i18n-keys' "a plugin's words are its own" has been red on main since |
||
|
|
c9a1c557d0 |
plugins: every built-in's row leads to where it is used, and the Gateway page holds its own setting
netube99 on X: one feature's settings are spread over pages that don't
say where the rest are. Plugins › Built-in had six rows (Key limits,
Groups, Rotation, Warm-ups, Middleware, Tools) with no page and no link,
so a user who turned one on was left to find where it shows. And the
Gateway page's one setting, Recent calls at a time, was a form under its
row in Plugins › Built-in, two pages from the calls it is about.
- pluginrt.Manifest gets Opens: the window page a built-in without a page
of its own is used on. budget → gateway (keys' limits), groups →
groups, rotation and warmups → providers (a provider's editor),
middleware and tools → plugins. builtinJSON sends it; featGo links to
that page by its sidebar name, as for a page plugin.
- A plugin with a page draws its settings there, not under its row
(renderBuiltins). The Gateway page draws its schema under Recent calls
(renderGatewayOwn), saves through /api/plugins/builtin as before, and
ends with a row "Port, allowed addresses and model ids" that opens
Settings › Network and sharing at the gateway's rows (4 languages).
Tests:
- TestBuiltinSaysWhereItsSettingsAre holds SetAt, Page and Opens per
built-in.
- builtins.test.cjs: no form in Built-in, and each Opens row's link says
its page's sidebar name. Its row reached by the wheel now counts the
window's bottom too, and frees a switch under the view's floating To
the bottom button by wheeling toward the window's middle: the rows grew
with their links, and WebKit de 420 left Usage's switch under it.
- gateway-own-settings.test.cjs (new): the setting under the calls,
translated, 20, picking 50 posts {id: gateway, config: {callsPage: 50}},
the row opens Settings › Network at #portList flashed; every language,
Chromium and WebKit, 1100 and 420, nothing past the window.
- builtin-places.test.cjs: Library's row now leads to Library.
Run at this tree (on origin/main
|
||
|
|
cdd99c5578 |
routing: a re: pattern with a lookahead saves and matches as its preview showed
maer8824 on Discord wrote "re:(?!.*flash).*glm.*" (glm but not flash) in
a routing group. The GUI's preview, which reads patterns with JS's
RegExp, matched the right models, but saving failed: Go's regexp has no
lookaround ("invalid or unsupported Perl syntax: (?!").
compilePattern now reads with Go's regexp first, as before, and only a
pattern Go can't read goes to regexp2 (already in go.sum; now required
directly), with a 100ms bound on one match. A pattern Go reads keeps
exactly the matches it had; one neither reads is still refused with
Go's error. Groups' patterns and providers' auto-include rules both
compile here, so both take it.
Run on mote at this head: go mod verify ok; go vet ./... ok;
GOOS=linux and GOOS=windows go vet ./internal/provider/ ok;
go test -count=1 ./internal/provider/ ok (133s).
Broken by hand: with groupmatch.go/autolist.go/go.mod reverted,
TestRegexpPatternLookahead fails 5 ways (the reporter's error among them).
Not tried: a real group saved in the GUI; the full suite follows the push.
Reported-by: maer8824 (Discord)
|
||
|
|
e3f1efdaac |
usage: a message id's pairing key is 16 bytes, not 24
msgKeysOf keeps each chunk's message ids as hashes, with the row, for every chunk a pairing reads. The key was two 64-bit hashes and an int32, padded to 24 bytes. It is now a 64-bit and a 32-bit hash with the row, 16 bytes: two of a long history's ~300k ids alike in all 96 bits is ~1e-18 likely. Run on mote at this head: - go test ./internal/usage: ok (28.8s) - GOOS=darwin/linux/windows go vet ./internal/usage: ok - gofmt -l: clean - Broken by hand: with the second hash back at 64 bits, TestMsgKeySize is red (24 bytes). - Real-account copy (~/r2278/acct), idle heap at 180s, v0.1.3404's tree vs this: appendMsgKeys 6.49 MB -> 3.69 MB, inuse 103.0 MB -> 97.8 MB, Footprint 154 MB. |
||
|
|
cf24e59065 |
gui: the stats answer test builds Active's hours through JSON (#5806)
|
||
|
|
1f1d210156 |
quotas: a wallet's counted spend goes out on /v1/magpie/quotas too (#5770)
|
||
|
|
a06872dec8 |
caps: a wallet window's spend is counted, so a cap holds it (#5770)
A window that tells only what is left (QuotaWindow.Balance: AStudio 0.2.0's 通用积分 and 星火积分, SuperMagic's points) read 0% used until it was empty, so an account cap never tripped on it. 9won capped an AStudio account at 4 and it spent over 1,000 credits past it. magpie now counts what such a wallet spends (wallet_spend.go). Each plugin reading's balance is set against the one before: a fall is spent, a rise (top-up, daily grant) is not. The count runs over the window's own period when it tells a reset, else the local day: a wallet never renews, and a cap reached for good would switch the account off with no time it comes back; the ask was "N a day". Spend before a period's first reading, or across a gap between periods, is unknown and not counted; spentSince says when counting began. The counts are kept in wallet-spend.json beside providers.json, so a restart doesn't lose them. Every wallet window carries spent and spentSince. On an account with a usage cap (WindowCaps.Holds) it also reads as amount spent of limit (spent plus what is left), and used that share. A cap by share then holds it in routing (allowanceOf takes the fields as they are) and on the GUI row (capHeldOf reads used). So does 40cbdaa7e's amount cap, which skipped a window with no total: 9won's "at most 300 a day" on a wallet now holds (magpie provider account-cap ... --window 通用积分 --amount 300). An uncapped wallet is unchanged: balance alone, routed by Allowance.Left. A cap just set is judged from the next reading. holdsBounds leaves wallets out: there is no whole to reckon "holds" from. Tests, each red on the old code (broken by hand where they compile): - TestPluginWalletCapHolds: real plugin host, fake plugin, wallet 10,000 -> 9,500 on an account capped at 4. Used 5, CapHeld set, the uncapped account untouched. Red with the plugin_usage.go hook removed (Used 0, Spent nil). - TestWalletSpendCounted: falls counted, top-ups not, a restart reads the count back, the next local day and a told reset start over (UTC+8 fixed zone), failed and share readings left alone. - TestWalletCapHolds: account cap 4, the window's own cap 4, and an amount cap of 700 (not held at 650 spent, held at 750). - TestWindowHoldsLeavesAWalletOut: red without the holdsBounds change (a wallet reckoned a 500-token whole). Run on mote at this tree on |
||
|
|
36ddd57619 |
sessions: the overview's active hours keep only the hours with time
Each range statsFor keeps holds an Active for every day, agent and folder, and each had a 24-int64 Hours (192 bytes), mostly zeros: 4.5 MB of statsOfRange's 13.5 MB in the idle heap on the owner's real cache (18,331 files). Active.Hours is now the same sparse hours a day keeps (hour<<58|seconds), and the act sums in statsOfRange use it too. Its JSON is the 24 numbers of seconds it was, which the Usage page's heatmap reads (a.hours.forEach). Run on mote at this head: - go test ./internal/sessions: ok - GOOS=darwin/linux/windows go vet ./internal/sessions: ok; gofmt clean - TestStatsHoursAndSessions now reads the hours through JSON, as the page does. Broken by hand (ms not turned into seconds): red, "the 20th by hour: [... 180000]". - Real-account copy (~/r2278/acct), idle heap at 180s: inuse 110.65 MB (v0.1.3402's tree) -> 100.21 MB at this head (sampled; 4.5 MB of it was the hours' own lists). |
||
|
|
7000b23b88 |
gui: a reset's time is said by a formatter kept per language, not made each call (#5310)
resetClock and resetText called toLocaleTimeString/toLocaleDateString/ toLocaleString, which build a new Intl formatter on every call. The Usage page says every account window's reset on each render, so 600 accounts made thousands of formatters per render. dateFmt(opts) in i18n.js keeps one Intl.DateTimeFormat per intlLang() and options. resetText's past time gives toLocaleString's default fields (year/month/day/hour/minute/second numeric) by name, which is what toLocaleString uses when given no options. Probe (mote, 600 accounts open, W=520, names wrapping, 8 renders, median sync ms, before → after): WebKit ~431 → ~377 Chromium ~327 → ~279 Test: reset-clock-formats.test.cjs compares resetClock and resetText with what the old toLocale*String code said word for word. It covers a time every 5h from a week back to eight days ahead, in en, zh, zh-TW, ja, de and then system (a language switch after the cache is warm), Chromium and WebKit, in a Tokyo time zone with an en-GB system. 2/2 green. Broken by hand: a cache key without the language is red in Chromium (zh said "02/11/2026, 20:29:01" for "2026/11/2 20:29:01"). Run at this change on |
||
|
|
f8186c6915 |
sessions: a day keeps only the hours it has time in
A day's hours were a [24]int64 (192 bytes) whether or not it had any. The owner's real cache has 18,331 files and 19,191 days; 13,406 days had hours, but only 19,107 hours across them had any time, so ~2.6 MB of zeros sat in the idle heap for good. hours is now a sorted []uint64 of hour<<58|ms, one entry per hour with time. Its JSON is still the 24-number array, so sessions.json reads and writes as before; an all-zero array read back keeps one zero entry so the day still counts as having hours. Run on mote at this head: - go test ./internal/sessions: ok - GOOS=darwin/linux/windows go vet ./internal/sessions: ok - gofmt -l: clean - Broken by hand: without hours.MarshalJSON, TestHoursKeepTheCacheShape is red (the packed entries went out as raw numbers). - Real-account copy (~/r2278/acct): idle heap at 180s, t1 (v0.1.3398's tree) vs this: inuse 112.94 MB -> 110.65 MB (-2.3 MB; the 2.6 MB estimate less sampling noise). |
||
|
|
22ffd4db69 |
plugin: a provider's models come from the plugin that serves it
Two plugins can sign in to one provider id. On the owner's MacBook Air,
tianpeng-dev's opencode-doubao-work-auth 1.1.6 was installed before
@magpie-community/opencode-doubao-work-auth 0.1.2. Both name
doubao-work. The third party's config hook ran first and wrote
cfg.provider["doubao-work"] with models: {}. Ours writes its entry with
??=, so it added nothing. Ours served the id, being the last to name it,
but info() read the shared config.provider entry: the provider showed
the other plugin's name and api and 0 models.
The config hooks still share one config object. Before each hook runs,
every provider it signs in to is set to the user's own entry, or to
this plugin's entry from the last load, never to another plugin's.
What the hook leaves there is kept as that plugin's (ownConfig).
info() reads the serving plugin's entry (providerConfig), so Prefer
moves the name, api and models with the provider.
Run (mote, at
|
||
|
|
7a2a05c7a3 |
routing: Accounts and keys keeps each provider's heading while it says the same
freefcw on X (11-09, v0.1.3373 and v0.1.3375): magpie at 32% CPU with 2,250 idle wakeups and its webviews at 80 to 223MB; lemonkillergame and laincatx say the same of CPU and memory. The Routing page draws Accounts and keys again each second while it is in sight (countdown: its rests and resets count down). Each drawing made every provider's heading anew, icon <img> included, and patch then kept the old heading in the page. But an <img> asks for its picture as soon as its src is set, in the page or not, and the app's icons go out no-cache (revalidated), so every provider's icon was asked for again each second: through the Wails asset server in the app (a read and a sha256 of the file each time), and each a new SVG document in the webview (~0.6MB, #909). Over `magpie web` on mote, a seeded HOME with five providers on Routing: 322 requests a minute, 155 of them icons every 30s; every other page asks for 4 to 13 in 45s. A heading is now kept per provider while its icon, name and routing mode are the same, and a heading with its first row are a list of nodes, no longer a box they were moved into: the move took a kept heading or keys row out of the page each second, so patch never found it in place. Measured on mote (M5 Pro, load 50 to 90 from other sessions), the 0.1.3377 build vs this one, `magpie web` in Playwright WebKit on ?view=routing, 60s, twice each: - requests: 322 and 325 a minute -> 7 and 7 (icons: 31 each per 30s -> 0) - magpie's CPU: 0.78% and 0.73% -> 0.32% and 0.32% - magpie's RSS: 225-227MB both Test: routing-acts-idle.test.cjs, in Chromium and WebKit, en, zh, zh-TW, ja, de at 1100px and en at 420px: a resting key's countdown redraws the list, and over 3.5s no icon is asked for again and each heading is the node drawn before. 14/14 pass; with client.js before this change 0/14 (each heading is a new node). Its icon count alone passes on the old code there, since page.route's replies are kept in the browser's memory cache; the real server's requests are the numbers above. Run on mote: - every GUI file that opens Routing (181 files, both engines, at origin/main |
||
|
|
74017e0b87 |
gui: a card of many accounts is laid out once a render, not once an account (#5310)
fitQuota stacks each window's counts and gives side-by-side names one height. It ran group by group: clear the names' min-height, then read their offsetTop. Every read after a write lays the card out again, so one Usage render with N accounts in full laid the card out N times, O(N²). With 600 accounts at 520px wide and the names wrapping (a long window name), one render held WebKit's WebContent at 100% CPU: 1.7-2.3s of script and 10-13s to the second frame after it. Chromium took 1.2-1.4s. fitQuota now takes every group. It reads all the sizes first, then writes the classes and clears the heights. It reads each name's row and height in one pass, then sets the heights. packUsage's heights() passes the card's groups in one call; the ResizeObserver path already passed a set. Probe (600 accounts, all open, W=520, wrapped names), on mote: WebKit: 0.5s sync, 0.7s to two frames (was 1.7-2.3s, 10-13s) Chromium: 0.45s (was 1.2-1.4s) Wide layout, both engines: 0.3-0.4s before and after. Scrolling 600 accounts was smooth before and after (2 frames ~30ms). Test: quota-fit-batched.test.cjs counts the layouts forced in one render: a read of a layout getter while MutationObserver records are pending. The count must be the same at 160 accounts as at 40 (+4 room for a frame's observer). It also checks that every group was drawn, the names' heights were written, and each group was evened. Chromium and WebKit, en/zh/zh-TW/ja/de, 10/10 green. Broken by hand: the test pointed at HEAD's app.js (MAGPIE_FIT_ASSETS) is red 10/10: 243 forced layouts at 40 accounts, 963 at 160, both engines. Run (mote, load ~30; first at base |
||
|
|
fc8e98ba47 |
edit: Codex's thousands of [projects] tables are left out of the reads that don't want them (#2278)
Codex writes a [projects."…"] table for every project it is trusted in;
the owner's config.toml has 10,933 of them in 1.5 MB. go-toml's decoder
checks each table against its siblings one at a time, so every decode
of the file cost ~0.3s of CPU, and six readers decoded it again each
time Codex wrote it, plus a whole-file check before each write magpie
made to it.
- edit.TOMLWithout drops [projects…] tables in a single unstable.Parser
pass. The agent's codexTopOf, sessions' readCodexConfig, provider's
readCodexStoreSetting, library's rtk sandbox, hooks rekey and MCP
entries read through it. None of them reads projects. A file that
doesn't parse is passed through unchanged, so it still fails.
- validateTOML checks definitions with the rest of the file and the
projects decoded apart, 128 projects to a decode. A bare [projects]
table, a dotted projects.… key outside the tables, or any error
decodes the whole file, so the error is the one it gives.
Run on mote (M5 Pro):
- BenchmarkCodexConfigDecode (10,933 projects): 283ms -> 7.6ms a decode.
- BenchmarkValidateCodexConfig: 52ms (the whole decode was 283ms).
- Startup CPU profile, first 70s, the real-account copy (the real
1,524,099-byte config.toml): 2.76s -> 2.26s of samples; go-toml
0.32s -> none sampled.
- go test ./internal/edit ./internal/sessions ./internal/provider
./internal/library ./internal/agent: all ok.
- go vet of the same five on darwin, GOOS=linux and GOOS=windows; gofmt -l clean.
Broken by hand:
- Decoding the batches into struct{} instead of a map:
TestValidateTOMLDefinitionsInGroups went red ("a key twice", "a
subtable then its key"), so the check keeps maps.
Not tried:
- the whole suite. Only the five packages that read the file were run.
- Now that projects is left out, a project table defined twice no longer
fails these readers' decode. Codex itself refuses such a file.
|
||
|
|
00e9a27582 |
site: /favicon.ico goes to /favicon.png
Search Console listed /favicon.ico as a 404 (crawled 10-28). The pages link /favicon.png, but crawlers and old browsers still ask for the .ico. It now gets a 301 to the PNG. Run: node --test worker.test.mjs install.test.mjs on mote, 71/71 ok. |
||
|
|
c056b7c8c3 |
provider: a Responses provider's turns may go over the Responses WebSocket (#5781)
A provider the user added with an http(s) Responses address can now send its Responses turns over the Responses WebSocket that magpie already speaks to chatgpt.com (codexSocket), with `socket=auto|on|off`: - off, or absent: today's behaviour exactly. Provider.Via hides any socket value an outer context carried, so such a provider never dials. - auto: tries the socket, falls back to HTTP when the handshake is refused or the socket ends before the reply, and speaks HTTP to a host for 10 minutes once it refused the handshake (codexShun). - on: the same fallback, but never shuns; the socket is tried each turn. Provider.Via puts the provider's Responses host and path in the request's context (withSocket); codexSocket's gate is provider.SocketTurn, which takes a ChatGPT turn as before, or a POST to that host at <Responses>/responses. The rest is the ChatGPT leg's: the kept socket and its delta (codexKeepKey now also hashes the scheme, X-Api-Key and Api-Key), the error frames, 1009 handling. A provider's reply with no Content-Type is marked text/event-stream, since it is read as one. Routing, keys, limits, usage and masking are unchanged: only the transport under the request differs. Set with `magpie provider set <id> socket=auto|on|off` (refused on a provider with an account, no http(s) Responses address, or Vertex, TakesSocket), saved in providers.json as "socket", shown by `provider show`, and in the editor's Advanced as a WebSocket tick beside HTTP version (ticked saves auto, keeps a CLI's on, unticked saves off; shown only while the Responses address is http(s) and there is no account). docs/subsystems/providers-accounts.md describes it. app.js pays for its rows by three long comments cut to one line (renderMove, the vendors' status pages, header rows): the core's scripts are 478 bytes smaller than on |
||
|
|
7cabf0da98 |
sessions: one place says which ids a ZCode request names, and drafts are one group (#5754)
On top of Flandern1211's cherry-picked fix (the commit before this one).
GatewayKeys gave the bare id of a ZCode session (sess_<id> in ZCode's
database, <id> in the gateway's record), but NativeIDs kept its own copy
of the keys: the management page still counted every ZCode session sent
through the gateway as a gateway-only session, its delete listed them,
and its search read them a second time. requestIDs is now the one place
that says which ids a request names a session by; GatewayKeys (Sessions
list, its spend, the stats' native set, viaOf, the manage search) and
NativeIDs (the manage page's count and delete) both read it.
ZCode runs a session started without a project in a folder it makes for
that session alone: <workspaceDirectory>/draft-<id> or <ms>-<uuid>, with
workspaceDirectory = ~/.zcode/workspace (read from ZCode 3.17.2's
out/host/index.js, downloaded from cdn-zcode.z.ai; never the live
~/.zcode). The reporter's group is renamed from "Scratch sessions" to
"Draft sessions" (草稿会话 / 草稿會話 / 下書きセッション /
Entwurfssitzungen), after ZCode's own word for them, with a GUI test of
its own. Comments no longer quote "Seen through the gateway", which
i18n-keys' plugin-words guard read as the core saying the word.
Run (mote, at this tree, rebased on
|