31da93ccdca03073513d2e1d73efdfd50bd14f6a
128
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a6d7e02c77 |
gui: a page wheeled right after a click scrolls on macOS 13's WebKit too (issennknight on Discord)
issennknight (macOS, trackpad): every page scrolled again, but a saved profile opened on the Agents page and then scrolled through often stayed where it was. macOS 13's WebKit scrolls a view under wheels it never dispatches, so the view guard puts each such scroll back and takes three put back the same way within a second as the reader's run ( |
||
|
|
d3191a51c8 |
gui: with Hide accounts on, an account's eye shows that one account in this window (yogurt36)
yogurt36 on Discord, for a screen share: with Hide accounts on, one
account should be readable while the others stay masked. Now an
account's name on the provider editor's row (accountNameButton and the
one-account line) and on its Usage card (quotaWho) has a quiet eye, in
sight on hover or keyboard focus, with an aria-label. A click shows
that account, its address and the name the user gave it together
(kin), everywhere the window draws it, tooltips included: the shown
set is skipped in hits(), which every mask goes through. It lives in
memory only. The tray panel keeps hiding it, and closing the window
hides it again: the page stays loaded while the window is hidden, so
hideMain runs mainClosedJS (hideAccounts.closed) first. With Hide
accounts off there is no eye. Strings in zh, zh-TW, ja and de.
Run (macOS, playwright 1.62.0, rebased on 630fd1d69; at push
|
||
|
|
6e96903346 |
codex: auto-review follows the session on a ChatGPT Free plan (cybercaius)
cybercaius on Discord measured codex-auto-review spending a Free
account's allowance ("实测在 free 账号不免费"). magpie left an unset
auto-review to Codex (codex-auto-review), and held such a call by no
usage cap, on #1593's finding that OpenAI counts it in no window; that
was measured on a paid account.
Decision: with nothing picked and Codex signed in to a Free plan (the
ID token's chatgpt_plan_type is "free"), auto-review counts as "Same as
the session", as Codex's other side calls do, so the review stops
spending the free allowance when the session is on one of magpie's
models. On Codex's own model nothing changes (its entries keep OpenAI's
reviewer). A paid plan, or a plan magpie can't read, keeps Codex's pick;
a pick in Settings always wins.
- codexcat.AutoReviewModel is the setting in effect; the plan comes from
provider.CodexSignInPlan (liveLogin, keychain read cached), read once
per model list, and the list tag already re-stamps on auth.json.
- freeOnChatGPT no longer exempts a Free plan's codex-auto-review call
from usage caps (capHeld).
- GUI tooltip says it (en, zh, zh-TW, ja, de); docs updated.
Run at the pushed tree (on origin/main
|
||
|
|
a1174674da |
codex: subagents and memories follow the session's magpie model; auto-review can too (cybercaius on Discord)
Codex's side calls ask for one of Codex's own models by its bare name
whatever the conversation is on: a subagent goes on the model the lead
names in spawn_agent, memories on gpt-5.6-luna/terra, auto-review on
codex-auto-review. With Codex signed in to ChatGPT and the conversation
routed onto one of magpie's models, each of those went to the ChatGPT
account instead (cybercaius: "can't pick follow the main model").
- gateway (codexFollowTo, codexLeads): a collab_spawn or memory call
that asks for a bare model, with nothing set for it (no magpie
subagent model, no [agents] default_subagent_model, no [memories]
extract/consolidation_model in Codex's config), goes on the model its
conversation's own turns go on (parent thread, own thread, else the
key's last turn), when that is a magpie model the key may use. A task
the ChatGPT backend sealed stays on ChatGPT. The trace shows a
subagent's pick as {asked -> to}.
- agent.CodexSideSet reads Codex's config.toml for those keys; an
unreadable config counts as set (leave as sent).
- Auto-review gets "Same as the session" (settings value "session"):
codexcat writes each magpie entry's own id as its
auto_review_model_override. Not the default: codex-auto-review runs
free on a ChatGPT sign-in (#1593).
- GUI: the option in all languages; Memories' default text says it
follows the session. app.js stays under its budget by folding five
identical writingPrefs then/catch chains into prefWrite.
Ran (sandbox HOME, -tags nogui -count=1 -timeout 45m):
- go test ./internal/gateway ./internal/agent ./internal/codexcat
./internal/settings ./internal/cli ./internal/gui: ok.
./internal/provider: FAIL with "close of synctest channel from outside
bubble" in filememo.Forget (TestUnreadLoginsWriteErrorsKeepCredentials),
which is #3632 on main; this change touches nothing there.
- TestCodexSubagentFollowsTheSession and TestCodexMemoriesFollowTheSession
go red with codexFollowTo returning "" (broken by hand).
TestCodexSideCallsKeepTheConfigsModel, TestCodexSideCallsStayOnChatGPT,
TestCodexSideSet, TestCodexAutoReviewFollowsTheSession pass.
- GUI (playwright 1.62.0, chromium + webkit): codex-auto-review (en, zh,
zh-TW, ja, de), codex-memories, codex-memories-settings, codex-titles,
codex-predictions, codex-descriptions, settings-general, agent-prefs,
i18n-keys: 120/120 pass. TestCoreScriptBudget passes, budget unchanged.
- gofmt -l clean; go vet -tags nogui for linux, windows and darwin ok.
Again after rebasing on origin/main
|
||
|
|
30d3001a04 |
gui: a wheel or coast macOS 13's WebKit never tells the page of still scrolls the view (issenn on Discord)
issenn, on macOS 13.7.8 (system WebKit 18615, Safari 16.6's): no page of the window scrolls by trackpad or mouse wheel, the bar doesn't move, a forced trackpad scroll shakes and snaps back, and only dragging the bar works. Cause (hedged, not seen on a real WebKit 16.6): the view guard puts back every .view scroll outside a window the reader's own events open (wheel, touch, keys, scrollOnPurpose). The bar's drag goes past it (barDrag), which is why that alone works. WebKit 16.x can scroll a view under a wheel or a coast it never dispatches to the page (WebKit bug 256582, Safari 16.4.1: monitorEvents(window) showed no wheel over some elements). With no wheel heard, no window opens, and every reader scroll is taken as code's and put back. That is the shake, and the v0.1.1488 coast chain couldn't help, since it starts from a heard wheel. Fix, in puttingBack: three put-backs on one view in one direction within a second, with no click holding (held), are the reader's. They are given back, and the fling window opens. Each later put-back the same way within a second of the last is given back at once. So a wheel turned slowly, or one run broken on a loaded Mac, loses no step. A scroll by code happens once and makes no run: two at rest are still put back, and scrolls a click holds against still are. On a WebKit that does dispatch the wheel, nothing changes: the wheel opens the window first and nothing is put back. To stay under appScriptBudget with no raise, the guard header's click bullet was shortened, and its detail moved to gui-shell.md. Test: view-wheel-unheard.test.cjs (Chromium and WebKit, en and zh). A capture listener stops every wheel before app.js hears it. Then: - ten fast 20px wheels must move the view 190px or more; - five notches 400ms apart must land, down and back up; - six wheels up must bring it back; - two code scrolls at rest are still put back; - after a click on an agent row, a code scroll each frame leaves the row in place. Run: - At origin/main |
||
|
|
1b039a3c72 |
gui: a trackpad's coast after the lift is the reader's scroll, no longer put back (issenn on Discord)
issenn (v0.1.1472, macOS app): a page with a scrollbar wouldn't scroll by
trackpad. It shook fast and snapped back, and only dragging the bar
worked. Seen on Agents.
Cause: the scroll guard puts back any .view scroll that comes outside
a window the reader's own events open. A wheel opened 250ms. When the
fingers lift, WebKit on the Mac plays the coast itself, and the page
hears those scrolls with no wheel for each. Once the last wheel's 250ms
ran out, the guard put back every coast scroll. Each coast step moved
the page and each put-back moved it back, so it shook and came to rest
where the fingers lifted.
Fix: the wheel now starts the same chain a touch fling does (flings,
flingUntil). Each view scroll keeps the next one the reader's until the
coast rests, and a click still ends it (purposeUntil = flingUntil = 0).
A code scroll at rest is still put back. The code and the comment fit
the old app.js size; no budget raised.
Test: view-trackpad-coast.test.cjs, chromium and webkit, en and zh. It
does five trusted wheels, then a 1s coast the page plays each frame
with no wheel. The coast must reach its end, a code scroll at rest is
put back, and a click mid-coast stops the row under the pointer.
- On origin/main's app.js: red 6/6 ("lifted at 40, coast asked 166,
left at 101/105").
- Broken by hand, flingUntil not reset by a click: red 6/6 ("the row
was at 269 after the click, 140 once at rest").
- With the fix: 6/6.
Real WKWebView probe (a Swift app loading the GUI with synthetic
NSEvent scroll phases): with every momentum wheel delivered, old and new
both end at 277. With the wheels after the first 32 kept from the page,
standing in for the coast with no wheel, old ends at 249 and new at
277.
Run:
- click-scroll, view-scrollbar-drag, view-middle-autoscroll and
view-trackpad-coast: 44/44.
- Whole GUI suite (internal/gui/tests/*.test.cjs, chromium and webkit,
every language) through suite-lock: still running at push, no red in
its first 30 minutes; a red it finds gets a follow-up commit and an issue.
- go test -tags nogui -run Budget ./internal/gui: ok, run again after
the rebase.
- No Go changed, so no gofmt or vet.
Not tried: a real trackpad on the mac app. Synthetic NSEvents skip
WebKit's MomentumEventDispatcher, which swallows the system's momentum
and plays its own. That the page gets its coast with no wheel is the
best fit for the report, not something seen on issenn's hardware. Also
not tried: ProMotion 120Hz, and WebKitGTK and WebView2 with a real
touchpad.
|
||
|
|
75e78a5a04 |
tui: quitting hands the gateway to magpie's service on Linux
zaidu259434 on X: "启动codex这些cli连接会失败,AI分析没自动启动magpie的网关".
With magpie installed inside WSL (or on a server over SSH), nothing
opens magpie at login, and XDG autostart doesn't run there. So once
`magpie tui` quit, the agents it had connected asked a gateway that was
gone.
When the terminal quits having served the gateway with an agent
connected, on Linux and where magpie doesn't open at login, keepGateway:
- starts magpie's service (magpie daemon) when it is installed;
- installs it when the user never removed it (daemon.Removed: Uninstall
now leaves a daemon-removed mark, and Install clears it), so it starts
with the system or the login from then on, and says how to remove it;
- otherwise (no systemd, which is WSL's default, or the user removed it)
starts `magpie serve` in its own session, logging to magpie's cache,
and says so. In WSL it also says how to turn systemd on.
macOS, Windows, nothing connected, or magpie opening at login: the same
"gateway stopped" note as before. Docs: gui-shell.
Run:
- TestKeepGatewayAsTheTerminalQuits covers each of those cases, and
TestUninstallRecordsTheUsersNo checks the mark.
- go test -timeout 45m on the four packages, the same run as the
previous commit's: all four ok (gateway 428s, agent 255s, tui 23s, daemon 16s), at
|
||
|
|
208bd5c48b |
gui: Settings descriptions wrap instead of ending in … (arculongus on Discord)
arculongus (English UI, screenshot) couldn't read many Settings rows: the
line under a setting's name ended in "…". The generic `.row .sub` rule holds
a row's line to one line with an ellipsis; a few Settings rows opted out
(`.wraps`) and the rest were cut, among them Image generation's ChatGPT
note, Image recognition MCP server and Web search's Searches for other
models.
Fixed for the class, not the rows in the screenshot: every setting row's
line (`.row.pref .sub`) now wraps whole beside its control. That covers
every Settings part, Plugins › Built-in and an agent's own settings (the
same rows). The control keeps its size (`.prefs .val` is `flex: none`,
max 60%), and nothing else in the layout moves. The window is never
narrower than 560pt, so a row stays a few lines at most. Lines elsewhere (provider
and account cards, chips, URLs) stay one line; their full text is already
reachable through the hover title.
Tests:
- New settings-lines-wrap.test.cjs checks every visible Settings part plus
Plugins › Built-in, in chromium and webkit, en/zh/zh-TW/ja/de, at
1000px and 440px. No row's line is cut or nowrap, each control stays
inside its row, and the page never scrolls sideways (more than 30 rows
checked). It also checks the three reported rows by name.
- Tests that assumed one-line rows now follow the taller rows:
- searcher-pick: the help wraps rather than ellipsizing with a title.
- settings-general: one line only at 1000px, never cut at either width.
- reader.cjs reach(): goes up to 8,000px, not 2,400.
- member-model-setting, turn-done, connect-address-kept, tray-cost and
tray-totals: wheel to the control with reach() before
clicking, not scrollIntoViewIfNeeded or Playwright's own scroll, which
the app undoes.
- update-download, update-restart and tray-totals: a click whose row
grows a line may scroll, but only to keep the clicked control under
the pointer (the app's hold, #2134). tray-totals allows 2px, because
WebKit's whole-pixel scrolls drifted 1.3px over four holds.
- mobile-web: compares against an origin/main baseline without this
change.
- Docs: gui-shell.md and gateway-routing.md.
Run (worktree from origin/main
|
||
|
|
1b32bdcfcb |
gui: magpie web's port answers the gateway's /v1 routes too, so one proxy location serves both (zgcwkj on Discord)
zgcwkj puts magpie behind nginx on one domain and wanted the browser UI (magpie web / serve --web, 127.0.0.1:3430) and the gateway (:3425) from one port, so one location works. Now the web port hands every gateway client route to the gateway: /v1/..., /v1beta/..., /models, /chat/completions, /responses, /messages, /images, /embeddings, /rerank, /audio, /videos, /muse-code/models, /backend-api/codex/..., the search path and /mcp/... (gateway.ClientPath). Everything else stays the page's, behind webGuard as before. /api/* stays split: on the web port it is the UI's API; Ollama's /api/* and Claude Desktop's /api/hello still need the gateway port, since the two can't share the path. Security: a handed-over request goes through the gateway's whole own stack, not a copy of it. gateway.Server.Front() is lanGuard(Handler()), built once; ListenAndServe serves the same handler. When this process serves the gateway, the web port calls Front() in process; when another magpie does, toGateway reverse-proxies to gateway.URL(), keeps the Host, copies Forwarded/X-Forwarded-* back (ReverseProxy strips them), and adds X-Forwarded-For for a non-loopback peer, so remote, proxied, rebound, Origin null, *.localhost and foreign-Origin requests are judged exactly as on the gateway port. The web cookie is never a gateway key. Paths that aren't clean (/v1/../api, /v1//x, /v1/./x) are not client paths, so they never reach the gateway as one. The allow list (AllowGuard) still wraps both. Tests: - TestClientPathCoversHandler reads every mux pattern Handler registers and fails when one is neither a ClientPath nor /, /api/* or /_magpie/*, so a new gateway route has to be placed. - TestClientPathOnlyClean. - TestWebOnePortServedHere / ServedElsewhere: with no web cookie, the UI API (/api/settings) is never reached for: no Origin (GET, POST), Origin null, a foreign Origin, a rebound Host (GET, POST), through a proxy (XFF), from another machine, /v1/../api, /v1/%2e%2e/api, /v1//api, and with a gateway key. The gateway routes on the web port: local agent 200; Origin null POST 403; foreign Origin 403; rebound Host 403 (with the page's cookie too); proxy or remote without a key 401 (with the page's cookie too); with a gateway key 200; not shared 403. - TestWebAssetsAreNoClientPath: no embedded asset shadows a client path. Run (full packages at the first rebase, on origin/main |
||
|
|
d08b6118bd |
agents: Restart a desktop app that started before magpie's change, after asking
微雨南山 and stones on Discord: Claude Desktop, WorkBuddy and the Codex
app read magpie's settings only as they start, so a change made in
magpie did nothing until they quit and reopened the app themselves.
The agent's row now carries a Restart when the app is installed, running,
and started before its config last changed (agent.AppBehind):
Claude Desktop, WorkBuddy and WorkBuddy AI on macOS (bundle executable
via pgrep), Claude Desktop and WorkBuddy on Windows (process tree, main =
earliest process whose parent is outside it). A press opens magpie's own
dialog first (confirmAction); Cancel and Escape send nothing. On accept
POST /api/agents/restart/{id} quits the app gracefully (AppleScript quit
on macOS; taskkill without /F on Windows, then /F /T after appCloseWait
for a tray that holds on), waits, and opens it again. On macOS an app
that won't quit is reported (StillOpen) and never forced. The Codex
app's existing Restart now asks first too. CLI agents get none.
changedAt: a stash digest that changed with no file written since the
app started now counts the change as now, so a change magpie made while
the app ran is seen (it was dated to the old write and missed).
app.js budget, not raised: archivePanel moved into plugins/usage/page.js
(its own comment called it the Usage page's; Routing's trace calls it at
draw time, after page.js has loaded), maskWho, maskProv and stillMotion
into plugins/redact, and usageHidOpen into plugins/usage. app.js is
1,108 bytes smaller than on main, budget unchanged.
Run (the first five at the pre-rebase head, same code):
- GUI agent-app-restart + agent-stale-copies: 120/0, chromium and webkit,
en/zh/zh-TW/ja/de, window 980 and 440 and panel 440, no sideways scroll,
no placeholder in aria-label or title.
- Broken by hand: without the confirm the GUI test is red; without the
changedAt fix TestChangedAtWithoutAWrite is red; without the since gate
TestWorkBuddyRestartOnMac and TestWorkBuddyRestartOnWindows are red.
- macOS, real fake-app processes in a sandbox HOME with a stubbed
launcher: quit in 100ms and reopened; a held quit returns StillOpen
after 4s, not forced.
- Windows box, console session (schtasks /IT), fake app and stub
launcher: graceful close in 407ms; a tray that holds on is ended after
5.66s; reopened through the stub.
- gofmt -l clean; go vet darwin (agent, gui), GOOS=linux and
GOOS=windows; builds.
- At 2c5327925 (on origin/main
|
||
|
|
e219f699ca |
gateway: with no S3 bucket the request archive keeps calls on this computer, oldest removed past 1 GiB (CyberCaius)
CyberCaius on Discord: "请求存档只能存在 s3 存储桶里,不能保存在本地吗". The Usage page's Request archive switch refused without an s3:// sync. Now, with no bucket, the same switch keeps each call in <settings.Dir()>/request-archive/<date>/<id>.json: the same file the bucket gets, masked the same way (Archived, archiveRequest), written to a temporary file beside it, synced and renamed, 0600 in a 0700 folder. Past its size (RequestArchiveLocalMB, 1 GiB unless set) the oldest calls go first, down to a tenth under it; the call just written is never removed, empty day folders go, and a .part file an hour old is removed on the next scan. The running total is counted once and then added to, so a write walks the folder only once it is over. On by default or a switch: a switch, still off unless turned on. Bodies can hold secrets, so nothing is written to a disk where the user didn't ask. The local switch is its own field, RequestArchiveLocal, in KeepOwn with its size, so sync never turns it on at another computer, and RequestArchive synced from a computer with a bucket keeps nothing on one without (archiveDest). The GUI switch writes RequestArchive while sync has a bucket and RequestArchiveLocal while it has none; the tooltip names the folder and the size, and a failed write reads "Not saved" (en, zh, zh-TW, ja, de). GET /api/archive reads this computer's copy first, then the bucket. The Settings page's save keeps both fields (api.go). Docs: sync-backup.md and gui-shell.md say where the archive goes and why the switch is per computer; the privacy pages (en, zh, ja) say what the folder holds, that it is off by default, and how large it grows. The READMEs' Privacy is about what is sent and is unchanged. app.js stays under TestCoreScriptBudget (its comment was shortened, and one t() call folded); no budget raised. Run (worktree diff on |
||
|
|
ccbbcbffcb |
gui: a restart to update leaves the Mac's menu bar icon for the next magpie (Mitsuha, audie)
From v0.1.1354 a restart to update hands the gateway over, and the old
magpie hides its own menu bar item with Wails' Hide, which is
[statusItem setVisible:NO]. AppKit keeps that in the app's defaults by
the item's autosave name ("NSStatusItem VisibleCC Item-0" = 0 on macOS
26), and the next item made under that name starts hidden. So after the
update the icon was gone, and quitting and reopening didn't bring it
back (Mitsuha on v0.1.1364; audie on two Macs, macOS 27.0.1).
Evidence: a 30-line Cocoa probe made a status item, setVisible:NO, and
every later launch of the same program started with visible=0 and the
key = 0; removeStatusItem kept nothing; removing the key brought it back
on the next launch. This machine's com.yetone.magpie.sbhandover.plist
(the handover commit's own sandbox run) holds
"NSStatusItem VisibleCC Item-0" => false.
Fix (internal/gui/trayshown_darwin.go, app.go):
- leaveMenuBar (was the onHandedOver closure) queues forgetTrayHidden
on the main thread after Wails' hide block, so the hide is made on
screen but not kept.
- bringTrayBack, once per computer (a flag in the Mac's defaults, never
in a WebDAV backup), forgets a kept hide before the tray is made: that
repairs everyone an older magpie already hit. A hide kept after that
is the user's and is left alone.
- A magpie handed over to by an older one (which still hides for good)
forgets the hide once that pid has quit and shows its item, unless a
hide was already kept when it started.
docs/subsystems/gui-shell.md says so under the handover.
Run (worktree at origin/main
|
||
|
|
f4640c0aee |
sessions: an agent's folders are one list, newest first, the temporary ones folded at the end
The Sessions page drew each folder as a boxed group with its checkbox,
path and buttons always showing. Now it is one list, the way Finder's
recents read: a row says the folder's name, where it is (home as ~, from
the manage reply's new `home`), its newest session's title, when, and how
many. Temporary folders, the disk's root and apps' hidden folders under
home wait folded under Other folders at the end; a search or a session
opened from elsewhere unfolds them. Checkboxes and the Delete bar come
only with Select, and Done lets the pick go. Relocate project and Delete
all sessions move into a folder's ⋯ menu (hover, always on touch, and
right-click); Delete all asks in magpie's own dialog.
Asked for by the owner ("这个会话页面其实特别丑"), who approved the design.
Tests: sessions-folder-list.test.cjs (new) checks the order, the ~ path,
the fold and its count, Select/Done, the ⋯ menu's Delete all and its ask,
and no horizontal scroll, in Chromium and WebKit, en/zh/zh-TW/ja/de, at
1000 and 420px. The other sessions tests follow the ⋯ menu and Select.
Run at this head (rebased on
|
||
|
|
17a2b00efb |
gui: the sidebar's open page moves from row to row on a spring, as iOS's selection does
The owner asked for the sidebar's pages (Providers, Routing, Gateway…) to slide from one to the next like their sub-tabs do, "like iOS". The open page's row is now marked by one shape (.nav-top-hl) that navTopGo moves on a damped spring (NAV_SPRING: SwiftUI's response 0.42s, damping 0.84; navTopStep, four sub-steps a frame, dt capped): - it sets off as the row is pressed, and comes back if the press leaves the row or the page refuses to be left; - being physics, a press that changes its mind turns it with the speed it has, never a jump; - it follows its row while Usage's tab list folds above it and lands where the row ends up; - it is put in place, not sent, when the window opens on a kept page or the rows move under it at rest (ResizeObserver); away while Settings is open, it fades back in on its row; reduced motion jumps; the header's tabs keep their .thumb and draw none. The rows give up their own ground (open, hovered, pressed) to it. #nav is position: relative in the sidebar for it, so .seg's centring left/top are reset (without that the whole list sat 105px right). Tests: - sidebar-glide.test.cjs (new): Chromium + WebKit, en + zh, 1024 and 1440, plus 900 (header): at rest on its row and the list in the sidebar, no ground hovered, press sets off before release and comes back off the row, Providers→Usage→Agents by frames (≥3 moving frames, overshoot < 3px) landing on the row, Settings hides it and Routing brings it back, reduced motion jumps, no page errors. Broken by hand: without the left/top reset the list check goes red; before the "not seen yet" rule the boot slid from Agents (red). - sidebar.test.cjs: a pressed page row no longer darkens itself (the shape comes to it); Settings still must. - routing-idle-frame.test.cjs counted every self-asking rAF callback as Routing's loop, so navTopStep after the click read as 33 Routing frames. It now counts only callbacks no global holds (app.js's are globals; Routing's frame is in its plugin's scope). Broken by hand: Routing's loop made to always ask again → 4 red; green on main's assets and on this change. - TestCoreScriptBudget: app.js 1,343,324 / core 1,535,084 with no room added; the sidebar is the window's shell, not a page a plugin can take. Run: - Full GUI suite at 183fa169b (this change on |
||
|
|
a95f0b83ff |
gui: a restart to update hands the gateway to the new version (xuanwo on X)
Before, a restart to update ended the gateway, so it waited until no agent request was in flight (#577). An agent busy for hours held the update back, and Restart now cut its replies off. On a Mac and on Linux the restart now starts the new version beside the old one and hands it the gateway's listening socket. The new version takes every new connection at once. The old one stops accepting, finishes the requests it has (up to 15 minutes, as `make dev` already gave), then quits. Nothing an agent sends is refused or cut short. How (docs/subsystems/gui-shell.md, "A restart to update hands the gateway over"): - internal/handoff, new, darwin and linux. The old magpie opens a unix socket in a 0700 temporary folder and writes handover.json (fresh for 2 minutes) in its config folder. The new one finds it, says Hello, and gets the listening socket by SCM_RIGHTS with the address, its pid and a callbacks socket. Only the same program (same path, same uid) is given it. When TMPDIR is too long for a socket path (sun_path is 104 bytes on a Mac), the folder goes in /tmp (sockDir). - gateway: Inherit/Listen serve on the socket given, and acknowledge once serving. HandOff gives the old one handedOffDrain (15m) instead of the 2s an ordinary end gives. A Claude Code run of the old magpie whose helper calls its tools on the port gets those calls passed back to the old one over the callbacks socket (forwardCallback, mcpCall, ownCallback). The bridge's turns are counted on their own (Busy.Bridge, BridgeLast). - gui: restartInto calls beginHandover (OpenBeside `open -n` on a Mac, StartBeside for the binary on Linux). On the new version's ack, the old one hides its menu bar icon, panel, window and Dock icon (Mac), ends its backend, waits for its requests, and quits. OnShutdown leaves Codex's failover, the thread port and the install to the new one, which serves the gateway they point at. - Never two on screen. Mac: the old one lets go of its instance lock just before giving the socket and takes it back if the handover fails, then hides on the ack. Linux: Wails holds the D-Bus name until exit, so the new one serves the gateway at once but puts its tray up only once the old pid has exited (awaitExit, 16m at most). Until then the old tray stays. - What a handover can't carry: the subscription bridge's Claude Code turns live in the old process, so the restart still waits for those (restartBusy = blocking(Busy, true)), along with turns parked on tools. Every other request is not waited for. The update badge, the Updates page and Settings' "Restart automatically" say so, in every language in i18n.js. - A handover that isn't made restarts as before: socket not opened, new version not started, no hello in 60s, no ack in 90s. Because the restart didn't wait for the requests in flight, it now waits for gatewayBusy to be idle (fallbackWait, 15m at most) before it quits and relaunches, so a failed handover never cuts a request. - The overlap. The instance lock is handled as above. Both processes write: the sticky routing is flushed before the hand (FlushSticks), and files go through the existing locked or atomic writes. Counters (RPM, concurrency) are per process for the overlap (gateway-routing Constraints). OAuth refresh: the previous commit locks Codex's and the ChatGPT API's refreshes across processes. The rest were already locked or don't rotate (providers-accounts Constraints). - Not changed: Windows (no SCM_RIGHTS; it restarts as before and still waits for idle, #577), `magpie web` (re-execs in place), and `make dev` (its own Handover). MAGPIE_NO_HANDOVER=1 turns it off. Found by the sandbox run, fixed here: in run 2 the sandbox's long TMPDIR made the socket bind fail ("bind: invalid argument"). The restart fell back at once, cut the stream at chunk 6 (curl exit 18), and 4 of 381 requests got no answer over ~2s. Two fixes: sockDir (/tmp fallback), and the fallback that waits for idle. Tests (each red when broken by hand or on the old code): - gateway/handover_test.go: TestHandedOverGatewayFinishesItsStream (drainFor without handedOff: "the old one ended with a stream in flight"; takeAck off: "the new one never said it serves"). TestToolCallOfTheMagpieBeforeGoesToIt (mcpCall forward off: 404; ownCallback forwarding off: 401). TestInheritedForAnotherAddressIsLetGo, TestCallbacksSocketServesOnlyToolCalls, TestBridgeTurnsCount, TestSameAddr. - handoff/handoff_test.go: TestHandOverListener, TestNoAckKeepsTheSocket, TestTakeOnlyAFreshOfferForThisProgram, TestCloseRemovesOnlyItsPointer, and TestOpenWithALongTemporaryFolder (red on the old Open: "bind: invalid argument"). - gui/handover_unix_test.go: TestRestartHandsTheGatewayOver, cross- process. The test binary re-execs as the new magpie. A stream through the old one finishes whole, requests during the restart are all answered, the next ones reach the new pid, and the old one quits only after its stream. On the old restart it is red: "quit with a reply streaming". TestHandoverNotMadeRestartsAsBeforeOnceIdle ("never says hello", "doesn't start") is red on the code before the fallback drain: "quit with a reply streaming" / "the restart didn't try to hand over". - gui/handover_test.go: TestRestartWaitsForWhatAHandoverCantCarry, TestHandsOverOnlyWhereItCan. - update/relaunch_open_test.go: TestOpenBeside, TestStartBesideWaitsForNothing. - GUI: update-wait.test.cjs (the handover wording on the badge and page), update-restart.test.cjs (Settings' description). Real run, Mac, sandbox (env -i, HOME and XDG_CONFIG_HOME in a scratch folder, a long TMPDIR, MAGPIE_ADDR 127.0.0.1:63249, MAGPIE_UPDATE_FEED pointed at a fake feed). The app is -tags production, ad-hoc signed, bundle id com.yetone.magpie.sbhandover, built as 0.1.9001 and 0.1.9002. autoRestart is on. A fake upstream streams 100 one-second chunks. The real app found the update, downloaded and staged it, and restarted with the stream in flight (run 3, at this change's tree before the rebase): - 18:31:43, pid 59833 serves. 18:31:51, the new pid 60477 serves; v1 logged "magpie 0.1.9002 (pid 60477) serves the gateway now". - Requests: 375, failed 0. 19 were answered by 59833, then 356 by 60477. - The stream got all 100 chunks, END and [DONE] at 18:33:24, curl exit 0, 92s after the hand. 59833 exited within 3s of the stream's end. Run at the pushed head (7a5bca443's tree, on origin/main |
||
|
|
d3f3df746e |
routing: the page's head has Routing groups, which brings the groups at the page's foot into view (shihh on Discord)
The routing groups sit below the stage, the story and every request; with many models (shihh on Discord) they are a long scroll down. The Routing page's head now has Routing groups (#rtGoGroups) beside New group: a down arrow, its name, and a tooltip saying where they are. Its click goes through scrollOnPurpose, brings .rt-gsec to the top of the view and moves the focus into it. The page's layout is unchanged (no #1354-style move): the groups stay last in #rtMore. fitGo gives the button only the head's spare room (the .grow spacer): named, its arrow alone (still named to a screen reader), or left out, so nothing else in the head moves or wraps. Strings in zh, zh-TW, ja and de. app.js untouched (plugin files only). Test: routing-groups-jump.test.cjs, Chromium and WebKit x en/zh/zh-TW/ja/de x 1000px web, 480px web, 640px window: 30/30. It is red on main's assets (no button), red with the scrollOnPurpose check removed (the app's guard pulls the view back), red without the focus move, and red with fitGo removed (de at 480px web: Hide accounts moves). Run at this change on |
||
|
|
cba59b05e1 |
gui: the middle button's autoscroll scrolls a page instead of twitching (#2767)
#2767 (znbsf, with AvatarGanymede's recording on the Discover page) and 多喝热水 on Discord, on Windows: pressing the wheel and moving the mouse made a page twitch instead of scrolling, or pulled it back. znbsf's patch found the same cause. Chromium and WebView2 give the autoscroll a pointerdown of button 1 and then no wheel, touch or drag of the reader's. The "where the reader is" rule put back each of its scrolls as it came, so the page twitched between where it went and where it was. What changed (internal/gui/assets/app.js, the click guard): - From a trusted middle press on a view that can scroll (`panning`), that view's scrolls count as the reader's, and what a click held is let go. This lasts until the autoscroll ends as Chromium ends it: on the next press (seen only as a pointerup with no pointerdown), on a key, on blur, or on the lift after the mouse moved more than 15px while held. - A field the guard brings back into view after putting a scroll back must have been focused since the reader last scrolled that view (`scrolledFrom`). Before, the button the middle press focused, which the autoscroll or the wheel took out of sight, was brought back by the next scroll that was put back, and the page jumped to it. - docs/subsystems/gui-shell.md says both. Guarded by internal/gui/tests/view-middle-autoscroll.test.cjs: a real middle press and move in Chromium, en and zh, a scroll by code still put back after the autoscroll ends, and WebKit (no autoscroll) left as it was. Broken by hand: - app.js put back to its base: Chromium 0/3 ("the autoscroll scrolled the page: at 0, passed 0,0,0,…"). WebKit passes, as expected. - Only the panning line taken out: Chromium 0/3, same message. - Only the scrolledFrom check taken out: Chromium 0/3 ("after the autoscroll: a scroll by code is put back (was 374, asked 1212, at 126)"). Record for this push: 13 commits on origin/main |
||
|
|
c036d6c34a |
gui: what the window shows can be selected and copied, its controls can't
Outvi V on Discord: the page is user-select: none as a whole, so nothing could be selected or copied into a bug report, only the few places that opted in. Two rules at no specificity after body in app.css now make content selectable: paragraphs, pre and code, a detail's values (dd, td), hints, notes, every error class (.err, .error, *-err, *-error), a conversation (.sess-talk, a subagent's too), a request's story and log on Routing (.rt-log, .rt-steps, .rt-time). Controls stay unselectable with what is in them, as in a Mac app: buttons, labels, summary, select, the navigation, menus (.pop), tabs, switches, segments, grips, draggable rows. With no specificity, a view's own rule still decides (a list being sorted, a blurred value), and a field stays a field. An account's or a key's name was selectable by accident through its row (a button inside .accts > [data-account-id]); .acc .rename now says so itself, and account-arrange keeps checking it. user-select.test.cjs: on Routing, a mouse drag across a vendor's error in a request's story selects it; a drag across a request's row selects nothing, and the row still opens on a click with text selected elsewhere; no nav, button, tab, segment or option is selectable, and no field is unselectable. Both engines, en/zh/ja/de, 1100 and 420 wide: 16/16, twice. Red on HEAD's app.css (16/16 fail: 'none' !== 'text'). Ran: click-scroll 22/22, agent-grip 10/10, provider-order 6/6, search-order 16/16, account-arrange 2/2 (red in chromium before the .acc .rename line), account-alias 20/20, panel-arrange 8/8, sessions-talk 4/4, sessions-subagents 40/40, usage-ledger-detail 6/6. Not tried: the app's own webviews (WKWebView, WebView2, WebKitGTK); only Playwright's Chromium and WebKit. Run for this batch of seven commits (devin, routing zh, qoder, masked words any case, Long conversations, Claude subagents, user-select), in a worktree, sandbox HOME, never against live configs: - At e352cc823 (tree ea497c9f5, on origin/main |
||
|
|
9691997bb0 |
gui: Long conversations stays in Settings when no Codex or Claude Code is here to hold it (Linka)
Linka on Discord runs magpie in Docker, with no agent installed. |
||
|
|
b00c82acfa |
masking: each kind is masked, sent with a warning or held back; a Never mask list and Try it (#1977)
Settings › Privacy gets two sections under What to mask:
- When a value is found: Mask, Warn or Block per kind (redactActions;
a kind left out is masked). Warn sends the value as written and records
it with a placeholder nobody remembers, not counted as masked. Block
masks it as before and the gateway answers 400 naming the kind and the
value's hint, never the value, with nothing sent (maskBlocked); the
record is kept as Blocked. The secret kinds come first, the personal
ones behind Show all kinds. A Never mask list (redactAllow) lets a whole
value go as written in any case; a longer value it is part of is masked.
- Try it: POST /api/masking/preview masks a text as a request would
(redact.Preview) and remembers nothing: no placeholder stands for it
afterwards and its values aren't masked later as seen before. The page
shows the vendor's text, what was found and what would be done, and
keeps the text in no storage.
The masking card counts requests held back and values sent as written; a
call whose values only went as written gets an amber badge on Recent calls
and the Routing log. zh, zh-TW, ja and de throughout. Docs: gateway-routing
and gui-shell.
Broken by hand: the new GUI badge assertion fails on the old maskedBadge
(no .warn badge drawn); TestSettingsSaveKeepsWhatItDoesNotSend went red
until the two settings were in its fixture; "{n} held back" turned
i18n-keys red against the routing plugin's "{n} held" and was renamed.
Run at this tree (base origin/main
|
||
|
|
f21dd99f5a |
privacy: every masking is recorded, and Settings › Privacy shows it
What was masked is now kept, so the user can see it. Settings › Privacy opens on a summary card: how many values were kept from vendors over 1, 7 or 30 days, by kind, by finder (rules, your words, the local model, known values) and by where they went, with a day strip. The page is grouped into What to mask, How it's found (rules and the local model are layers, not a toggle: the model adds names and addresses rules can't see) and Sharing. A records view lists each masked request: its kinds, finders, placeholders and, while magpie runs, the line around each value. Gateway › Recent calls and the Routing log carry a masked-N badge that opens the record. Originals never go to disk. internal/maskrec writes day files under ~/.config/magpie/masking (0600, 30 days, 100MB at most) holding kinds, finders, placeholders, a first character or key prefix and a length. The lines around values are kept in memory for the last 400 records only, and /api/masking/value answers only while the masker remembers a placeholder. Nothing is written under MAGPIE_TEST_SANDBOX. A masker says what it masked through gwmw.Teller (JSONHits, TextHits, Value); a plugin masker that doesn't is counted only, so older redact plugins keep working. Every route that masks notes it: chat, Responses, Codex backend and search, embeddings, images, video, transcription, decide and the search MCP query. Masking still fails closed: a masker that panics on any path refuses the request (TestMaskingOnAndOff's fake now panics on JSONHits and TextHits too, since the gateway asks a Teller through those). app.js grows to 1,314,432 bytes, so its budget rises to 1,335,000 and the core's to 1,528,800 (+1.5%): Settings is the core's own page. Run at this head (rebased on origin/main |
||
|
|
f1e4516da2 |
gui: Codex's and Claude Code's own settings are in the agent's row on the Agents page, not in Settings
The owner, 10-20: Settings › General held Codex subagents, Long
conversations, Codex background compaction, thread titles, thread
descriptions, composer predictions, the auto-review model and the
memories model, apart from the agents they set; "很割裂、很分散,不直观".
They now sit with their agent (AGENT_PREFS): in its opened row on the
Agents page (a Settings list in connectPanel), in a sheet from the
tray panel's row ("Settings" line, openAgentPrefs) and from the agent's
menu ("{agent} settings"). Each row is the one element moved between
those places, so its handlers and state go with it. Settings' search
still finds them, with a row that opens the agent's sheet
(#agentPrefLinks). A gateway has no Agents page and none of them.
Strings for zh, zh-TW, ja and de; docs (reference, agent-wiring,
gui-shell) point at the new place. app.js 1,277,298 bytes and the core
scripts 1,469,058, so both budgets rise.
Run on 6416d639c (the dialog morph, on origin/main
|
||
|
|
5e30d5b5ae |
autostart, gui: Open at login says when the Mac's own switch for it is off (#2120)
Anoninz on #2120: Settings said Open at login was On while System Settings › General › Login Items › Allow in the Background had magpie switched off, so magpie never opened at login. autostart.Enabled now returns a State: off, on, or needs allowing. - macOS 13+: with the plist present, Enabled asks Background Task Management through SMAppService statusForLegacyURL: (cgo, ServiceManagement weak-linked, minos stays 12.0). RequiresApproval reads as needs allowing. Any other answer, a failed ask (-1), macOS 12 or a build without cgo (the darwin CLI release) leaves the plist alone deciding, as before: a failed read is never "off". launchctl print-disabled did not follow the switch on macOS 26.2, so it isn't used. - BTM matches the item by the plist's Label, not its path: the tests ask about a label of their own, and TestMain stubs the ask so no test reads the user's real item. - GUI: Settings › General keeps On and adds one line, "Switched off in System Settings’ Login Items…", with an "Open Login Items" button that opens x-apple.systempreferences:com.apple.LoginItems-Settings.extension through /api/open (that one URL is allowed; other x-apple URLs aren't). The window's focus reload clears it once switched back on. The row is hidden in magpie web, as before. Strings in zh, zh-TW, ja, de. - CLI `magpie autostart` says where to switch it on. The daemon counts a held-back record as on (it is the user's choice, held by the system). Part B (SMAppService.mainApp) is not in this commit: it can't be verified here without registering in the user's real login items and logging out to see a login launch stay tray-only. Run: - go test ./internal/autostart (cgo and CGO_ENABLED=0), cli, daemon, gui after rebasing on origin/main |
||
|
|
ef655acb40 |
gateway, gui: a console shows the routing of the magpie that serves the gateway (#2606, fatcutegg)
fatcutegg's patch (fatcutegg/magpie 40ceb22df). The routing trace is held
by the process that serves the gateway. A second magpie on this computer
(`magpie web`, or the app while a launchd `magpie serve` holds the port)
showed none of it. Now its console reads the serving magpie's
GET /v1/magpie/trace (and /v1/magpie/concurrency for the lanes) over
loopback, and plays that trace as its own. The heading names which magpie
is routing ("serve (pid N) is routing").
Reviewed as a community change. A trace names accounts and emails, session
ids, a folder's last two parts and error text. It holds no prompt text and
no key. The endpoint answers local(r) alone: a request from another address
gets 403, and so does a loopback request carrying a proxy or Tailscale
header, or a LAN request while the gateway is shared, whatever key it holds.
lanGuard and corsGuard stop rebinding Hosts, Origin: null and *.localhost
first, as on every route.
Changed on top of the patch:
- A gateway key held to a budget, models or accounts is refused with
KeyHeldCode (refuseHeld), as concurrency and quotas refuse it.
- The console reads loopback alone (ownerURL). A non-loopback MAGPIE_ADDR is
never asked, and 0.0.0.0, :port, [::] and localhost are read at
127.0.0.1.
- OwnerTrace lets a hung magpie go at wait+5s (was +20s). OwnerLanes waits
700ms like ServedBy (was 2s) and is asked only when a magpie answers.
- `/` tells pid and serves to a loopback request alone. A plain `magpie`
that opens the TUI reports itself as "tui".
- Takeover: in the real two-instance run, after B took the gateway over the
hub still read "serve (pid A) is routing", from the providers state. Now
the trace carries `by` (pid, serves), and the page names the router from
it. When `by` changes, the page drops its routes and reads the new
magpie's whole trace, so route ids from two magpies never mix. The
label's full text is in its title, because the node cuts it with an
ellipsis.
- Trace's doc comment, which the patch had orphaned, is back on it. Docs
(gateway-routing.md, gui-shell.md) say all of the above. Issue
references are #2606 (were #110).
- Tests: a proxy-header subtest, TestOwnerReadOnLoopbackAlone, the trace
added to TestHeldKeyToldNoAccounts, and `by` / pid / serves asserted in
both packages' peer tests.
Run:
- Each guarantee broken by hand, and its test went red: refuseHeld removed,
ownerURL returning MAGPIE_ADDR, local(r) replaced by a RemoteAddr check,
pid/serves dropped from the answer, `by` dropped in OwnerTrace, and the
console's OwnerTrace fallback turned off.
- A real sandbox (own HOME, ports 3591-3593, fake upstream on 3564):
- A `magpie serve`, B `magpie web`. B's Routing page played A's routes
live (the long poll counted 3 requests through A).
- Probes of A's /v1/magpie/trace. 200 from plain loopback. 403 for
evil Origin, Origin: null, evil.localhost, a rebound Host with and
without Origin, x.localhost Host, X-Forwarded-For and
Tailscale-User-Login.
- A LAN-shared instance answered 403 from 10.0.0.111 even with a valid
key, and gave no pid on `/`.
- Killed A: B took over in ~11s. The hub dropped the "is routing" label,
and the next request through B showed as a fresh trace (1 request).
- Chromium and WebKit screenshots at 1280 and 390 wide, in en, zh and ja.
No horizontal scroll.
- gofmt -l clean. go vet darwin, GOOS=linux -tags nogui and GOOS=windows
pass, and all three builds pass.
- go test -timeout 45m ./... at this tree (sandbox HOME, load 250-400):
every package ok except four.
- agent, gateway and library hit 45m in TestClaudeTierPickedAsTheMainModelStays,
TestQueuedStreamKeptAliveOnceSentToItsVendor and TestWellKnownKitGrouped.
- plugin failed TestGatewayHookMixedPiPackage (#2865).
- Rerun alone with -p 1: plugin ok (464s). gateway finished in 45m with
one red, TestRequestBuildsProvidersOnce, a 900ms/1s timing window under
load. It is 8/8 green alone here and on origin/main
|
||
|
|
04e8aa8f10 |
library: typing with an input method no longer moves the page (#2636)
In Library -> Instructions, typing Chinese through an input method made the
page jump up or down while a word was composed. The cause: the textarea's
autosize set height:auto to measure scrollHeight, so the page went short for
a moment and the browser clamped the view's scrollTop. Putting the height
back doesn't undo a clamp. app.js's scroll guard took the clamp for a scroll
the reader didn't make, and its scrollIntoView({block:"nearest"}) pulled a
textarea taller than the view to one of its edges. Every composition step is
an input, so this happened on every keystroke.
autosize (the only one in the GUI, used by a set's text, an agent's own
text, a skill's description and subagent boxes) now holds the textarea's
parent at its height while measuring, so the page never goes short.
What was run:
- New internal/gui/tests/library-ime-scroll.test.cjs covers en/zh, 980/560px,
a Default set's text and Cline's own text. Chromium composes through CDP
Input.imeSetComposition/insertText. WebKit gets synthetic
composition events and inputs.
- With the fix: 9/9 in both engines, before and after rebasing onto
|
||
|
|
17557132cb |
gui: in a narrow window the title bar's tools show their icons, then the title gives way; nothing lies over it (#2625, linusxiong)
Beside the sidebar, Library's, Plugins' and Settings' heads sit in the
title bar after the breadcrumb, between --tools-l (the crumb's right +
16) and the window's buttons, laid out flex-end. When the tools needed
more than that room they ran on to the left, over the crumb: at about
650pt with the sidebar, Library -> MCP servers had 「发现」 over
「MCP 服务器」's last character. The crumb never gave way to them.
app.js tools() now shares the room out, laying out and reading each
step in its one frame, the next only if the tools still run over:
1. the crumb whole (its natural width from its parts, the last one's
scrollWidth) and the tools with their words;
2. body.tools-tight: Library's Discover / Library folder / Backups and
Plugins' "Mirrors in China" show their icon (or switch) alone. Each
keeps its name as aria-label (a hidden span leaves the accessible
name) and its tooltip as before (the folder's path, the backups'
note and path, Discover's and the mirrors' sentences);
3. --crumb-max: the crumb drops its leading parts ("Work /"), a part
and its slash at a time, and last cuts the page's name at its end.
In the side-nav head the Library buttons and the mirror switch are
flex: none and Plugins' search keeps 120px, so what doesn't fit shows
as running over rather than shrinking out of sight. The views'
MutationObserver also asks tools() again, as a tab's own tools change
(Discover only on MCP servers and Skills) without the crumb resizing.
title-bar-tools.test.cjs (new): every Library tab, Plugins' three and
Settings, sidebar picked, window mode, at 560 (the window's least),
650, 760, 900, 1024 and 1280px, in zh, zh-TW, ja, de and en, Chromium
and WebKit. No tool lies over the shown title or another tool or out
of the bar, no label is cut, an icon-only tool has aria-label and
title, only leading crumb parts go and the page's name shows, whole
from 650px. Against the old assets (MAGPIE_GUI_ASSETS) it fails in all
five languages at 560px Library Instructions ("a tool lies over the
title"); with the change Chromium 5/5 and WebKit 5/5. Looked at
screenshots of zh Library MCP servers and Plugins Discover at 560, 650
and 760px.
docs/subsystems/gui-shell.md says how the title bar gives way.
Run with both #2623's and #2625's changes, on
|
||
|
|
85eef5d87a |
gui: quota refreshes stay centered and finish each turn without jumping (#2397)
chiperman's patch (df288db, #2397), landed here since external PRs are collaborators only. The card redraw replaced its refresh button on a background reading and again when the click finished, restarting its rotation and hover reveal and moving the Updated text; a fast reply also stopped the spin partway through a turn. Each account's control and its animation are kept through redraws, the reply is shown at once and the current 800ms turn finishes (at least one), Reduce Motion skips it, and the glyph sits on the text baseline in an inline grid instead of a pixel offset. Changed in landing: main had since given the tray panel's Allowances the same quotaRefresh (#panelQuota, #840). A kept button is reused only when its redraw took it out of the page, so a refresh started on the Usage page is never moved out of the panel (or back); the other place's copy of a turning control gets busy+spun and turns by itself until done() clears it. The panel's hover rule (.pq-card:hover) reveals it as the Usage card's does. quota-refresh-order's vm harness gets a document stub for that. app.js's budget goes from 1,250,000 to 1,269,000: with four comments shortened it is 1,250,904 here, the core's own code since the tray panel draws the same control, plus 1.5% as the budget's comment asks. Every core script together is still under coreScriptBudget, which is unchanged. Run, sandbox HOME, pinned GOMODCACHE/GOCACHE, load ~110-360 from other sessions' suites: - Full suite on |
||
|
|
af601541ef |
routing: a request opens to its request and response (Fate on Discord)
Fate asked on Discord to see what a single request on the Routing page sent
and got back, such as a Codex prediction. The bodies were captured already,
in the Gateway page's 40 recent calls and the opt-in request archive, but
nothing led there from a Routing request.
- gateway: a Call carries the Routing request it was (Call.Route = the
trace's Route.ID), set where serve, the Codex backend and a refused title
record it. Server.RouteCall finds it in the ring. A route id is not a
call id. A route names its archive copy (Route.Archive =
call.archiveName()), set only when the archive was on, so it reaches the
saved history too.
- gui: GET /api/gateway/call takes ?route= besides ?id=. It is the same
handler, the same no-store, the same key guard and the same 404 once the
ring has let the call go.
- Routing page: the story's head has "Request and response". It fetches
only when pressed, and shows the masked bodies through callBodyPanel (an
SSE reply reads as its events). A request the ring no longer has shows
the archive's copy through archivePanel when the route names one.
Otherwise it says the last 40 are kept until magpie quits and how to turn
the archive on. Nothing more is captured or kept than before.
- The head now wraps. At narrow widths its buttons ran past the story
("Back to live" was cut off at 440px).
- The two button words live in i18n.js: i18n-keys' "a plugin's words are
its own" found them inside core strings.
- docs/subsystems/gui-shell.md says how a route reaches its bodies.
Tests:
- TestRoutingRequestOpensItsBodies (new): each of two routes gets its own
bodies; route 0 and an unknown route get 404. Red without
`call.Route = tr.ID` ("route …: 404").
- TestArchiveWholeBodies now checks that the route names the archive. Red
without the t.Archive line (`route names archive ""`).
- routing-bodies.test.cjs (new), chromium and webkit at 440px, en, zh,
zh-TW, ja and de, 10/10. It covers the ring's copy read only when asked,
hiding, another request closing it, the archive's copy, the
how-to-keep note, nothing past the story and no left border.
- Red with the client asking ?id= and with the head's wrap removed.
- routing-request-metrics.test.cjs: with the head wrapped, its 480px
picker clicks in WebKit landed on the footer. Playwright's WebKit places
elements in the scrolled view hundreds of px lower than
getBoundingClientRect, which elementFromPoint agrees with. The test now
clicks where the page shows them. 5 runs of both engines, 20/20.
Run in a sandbox HOME at
|
||
|
|
d6b045a7e7 |
usage: the Overview's lists fold under their headings and stay folded, the token totals can count the cache, and the Requests Tokens card wraps its cache count instead of cutting it (#2378)
The reporter asked for three things on the Usage page: fold Agents,
Models and Accounts from their titles and remember it (日常看账号维度
较多,都要拉到最底下); an option to count the cache in the token totals;
and the Requests tab's Tokens card cut its cache count off on a wide
window ("缓存 879…").
- Folds: each Overview list's heading (Agents, Models, Accounts, and
Gateway keys beside them) is a .fold button with its chevron, the
Gateway page's pattern. A click keeps the page still (backToReader).
What is folded is kept per viewer in localStorage magpie.usageFolded
(mountUsageFolds at the plugin's mount, showUsageFolds per render).
- Cache: the tokens tile's label is a pop-up (usageTokensPick, the app
menu, no <select>) of Without cache / With cache, kept in
localStorage magpie.usageWithCache. With cache, the tile, the chart,
and every row's count and share add cache read and written
(usageTokens), and the tile says the cache's count. Default unchanged.
- Cut count: a token line in parts (the Requests strip's Tokens card,
the Overview's tokens tile) wraps between its counts and keeps each
whole (usageParts, .parts); only a count wider than its card on its
own is cut. The part spans undo .kpi span's label capitals.
- Strings in zh, zh-TW, ja, de. docs/subsystems/gui-shell.md bullet.
- mobile-web.test.cjs: until BASE_REF has mountUsageFolds, the
desktop Usage comparison puts the new fold buttons and the pop-up
back to their plain labels and compares the rest as before. That
comparison caught the tile's line in the label's capitals and 5px
taller; both fixed, and usage-overview-fold now checks them.
Run at this head (base
|
||
|
|
1242367020 |
gui: the menu bar's idle tooltip splits today's tokens into input, output and cache (NextCommit on Discord)
With no cards ticked, the tooltip said only "Today: 6.3M tokens". It now says "Today: 6.3M tokens (912K in · 318K out · 5.1M cached)" over the cost and requests, as the usage:today card's tooltip has since #1984 (trayTokens, shared by both; cached left out when nothing was cached). Run: TestTrayIdleTip and the SNI tip case, updated. gofmt -l clean. Full suite: SUITE_LINE |
||
|
|
49d60394ef |
gui: the Mac's menu bar item shows its tooltip, which Wails never set there (NextCommit on Discord)
NextCommit (macOS, 0.1.1244) hovered the menu bar item for today's
tokens split into input, output and cache and saw nothing. Nothing was
shown at all: Wails v3.0.0-beta.24's macosSystemTray.setTooltip is a
no-op ("Tooltips not supported on macOS"), so neither the idle tip nor a
card's tooltip (usage:today already said "6.3M tokens (912K in · 318K
out · 5.1M cached)") ever reached a Mac. Linux has its own setTrayTip
(SNI); Windows keeps Wails'.
setTrayTip on the Mac now sets the status item's button toolTip on the
main queue (trayTipNative, mpTip in trayimage_darwin.go), returning false
while the item isn't up yet so it is tried again, as Linux's does.
Run: TestMacTrayTipIsSet (darwin, cgo): setTrayTip reaches the native
setter, false before the item is up, and a real NSStatusBarButton keeps a
multi-line tip whole. go vet: darwin (cgo, GUI) and -tags nogui for
darwin, linux and windows. Not tried: hovering the icon in a built app.
Full suite: SUITE_LINE
|
||
|
|
94c70a2dd9 |
gui: the tray's Allowances cards say "Resets 14:26", not a bare ↻ that read as a button, and each card has the Usage page's own refresh (#840, hhh2210)
In the tray panel the first reset deadline was drawn as "↻ 14:26": text
with no click handler, which reads as a refresh to click (hhh2210 clicked
it). It now uses resetText, "Resets 14:26" / "重置于 14:26", as the
Usage page does; the other windows keep "Weekly Oct 31".
The tray cards also had no per-card refresh. They now get the main
window's quotaRefresh, the same single-card API and response-order
guard, at the start of the line under the account (the deadline, the
error, "Unlimited", or a balance's name): opened as the card is hovered
or the button is focused, spinning while it reads, closed taking no room
(the balance row's flex gap is closed with it). renderPanelQuota puts the
focus back on the button after the redraw. A failed read keeps the
figures and says the error in the footer, as on the Usage page.
Based on hhh2210's fork commit 9ea883ffb. Kept: the reset label, the
refresh on every tray card kind, the focus kept through the redraw, the
test's fixtures. Trimmed for the owner's UI restraint: the always-visible
24px button and the new "Updated N ago" row on every card (now hover-
revealed in the existing line, as on the Usage page), and the new status
texts (reading / cached, no new data / refresh failed / Claude's 30s
interval), which the Usage page's own refresh doesn't have either. No new
strings: "Resets {when}" and "Refresh this card" exist in every language.
Run (macOS arm64, Playwright 1.62.0, Chromium and WebKit):
- panel-quota-refresh.test.cjs, rewritten for this behaviour: 20/20,
en/zh/zh-TW/ja/de at 440 and 360px tray widths.
- Broken by hand, each red with its own message: the ↻ label back ("the
deadline says 重置于, got ↻ 14:31"); no refresh in the deadline line
("has its own refresh"); no focus restore ("the redraw keeps the
focus"); no .pq-card:hover rule (hover never opens it); the error card
without one ("kimi has its own refresh"); without the .pq-bn margin the
closed button moved the balance's logo ("relay's closed refresh moves
nothing").
- 68 GUI files that open the tray's Allowances or the Usage refresh
(every mode=panel file reading usage/quotas, usage-card-refresh,
quota-balance-error, usage-remote-*, quota-read-at): 943/944. The one
red, usage-fold chromium "the view didn't scroll" 184 !== 180, is red
alone on origin/main
|
||
|
|
ec13d1162a |
search: the search APIs are dragged into the order they are asked in, and each switches off without losing its key (#2286, blackrion)
The search APIs were asked in the order they were added, and the only way to keep one out of the chain (to try another alone, or rest one whose credit is nearly spent) was to remove it and paste its key again later. - provider: SearchAPI.Off; SearchAPIs() leaves an API switched off out, so neither a model's search nor the web_search MCP asks it. SwitchSearchAPI keeps key, URL and place; SetSearchAPI keeps Off. ArrangeSearchAPIs puts them in the vendors' order, refuses an unknown or twice-named vendor, and keeps one not named after them. RestoreSearchAPIs now puts a backup's APIs in the backup's order (one only here after them), so a restored order and Off come back as they were; sync already mirrors the list. - GUI: each API's row and its keys' row are one unit, dragged off its buttons with dragRows (as routing's groups, #779) or moved with Alt+↑/↓, renumbered at once, focus kept, redrawn as saved if the order is refused. A lib-switch per row posts {vendor, on}; one off is dimmed and says Off; Search first with counts only APIs that are on. The row's buttons wrap instead of running past a 420px window. - CLI: magpie search off|on <api>, move <api> <n>; the list says off. - POST /api/settings/search-api takes {arrange} and {vendor, on}. - Docs: gateway-routing "The search APIs' order, and one switched off", gui-shell, README (en, zh-CN). Run: go test -tags nogui ./internal/provider ./internal/cli ./internal/gui ./internal/gateway (TestSearch*) ./internal/backup ./internal/davsync; GOOS=linux/windows go vet of the touched packages; gofmt -l clean. GUI: search-order.test.cjs 16/16 (chromium + webkit, en/zh/ja/de, 1100/420), and search-api, search-first, search-instead, search-keys, search-mcp, searcher-pick, i18n-keys, gui-ja, gui-de, gui-zh-tw 100/100. Broken by hand: SearchAPIs without the Off filter turns TestSearchAPIOrderAndOff and TestSearchCLIOffAndMove red; the GUI counting off APIs for Search first turns search-order red. Full suite: SUITE_LINE |
||
|
|
5ca37ef86b |
tray: Settings › Menu bar cost off shows magpie's today and 7-day totals as tokens alone, in the menu bar and its tooltip (BussanQ on Discord)
BussanQ asked for the menu bar's today card with the token count only.
A new Settings › Usage › Menu bar row, "Menu bar cost" (On by default,
segs, every OS, shown with or without cards since the no-card tooltip
says the cost too), saves settings.TrayNoCost. Off, trayMoney drops a
total's cost and its count of unpriced calls before trayTotalCard and
trayIdleTip see it, so the macOS cells and title, and the tooltip on
macOS, Windows and Linux, say the tokens and requests alone. A relay's
or subscription's balance card is money itself and stays. TrayNoCost is
per computer (KeepOwn, beside the other Tray* fields), and a change
redraws the tray (api.go). Translated in zh, zh-TW, ja and de.
Run:
- TestTrayNoCost (internal/gui): broken by hand (trayMoney a no-op) it
fails with label "Σ47M · $128 | Σ6.3M · $3.40+", want tokens alone,
plus the tooltip and idle tooltip.
- TestSync (internal/davsync) now sets TrayNoCost on one computer; with
TrayNoCost left out of KeepOwn it fails "b's menu bar: … TrayNoCost:true".
- tray-cost.test.cjs: Chromium + WebKit, en/zh/zh-TW/ja/de, widths 1100
and 420, Mac/Windows/Linux and no cards: 22/22 pass. With trayNoCost
dropped from the prefs it fails "a save of another setting keeps the
cost off". Also green: i18n-keys, tray-bird, tray-logos, tray-totals,
tray-usages, tray-usage-redraw, quota-pace, tray-inuse.
- gofmt -l clean; go vet ./... and -tags nogui for GOOS=darwin, linux,
windows clean.
- go test ./internal/tune ./internal/gui ./internal/settings ./internal/davsync
green at this head, rebased on origin/main
|
||
|
|
b00da3860c |
usage: a past cycle shows its own whole-window estimate, and a reset ends a dry run (#2009, #2010, NorethSea)
Ported from NorethSea's fork (abed2e224) and re-derived on main.
What it does:
- A known reset ends a dry run (a stretch where a window read 0% left), even
when the next poll sees the refill later. A stale dry reading taken after
its own reset no longer extends the run. Calls from the reset on are not
treated as "maybe paid from credits".
- A refill observed later than reset minus span
(QuotaPoint.StartsCycleAfter, the boundaries history sampling keeps)
starts what is reckoned. Calls before a fixed-deadline refill stay in the
cycle before it. A first reading is not a reset.
- Picking a past cycle in Usage > Allowances > Trends > Cycle asks
GET /api/usage/quotas/history/holds once per selection
(quotaCycleHoldsOf). The route asks no vendor. HistoricalWindowHolds
reckons each window at its own last reading in the cycle, using the
ledger and readings from before that reading. "Loading..." shows while it
is pending. An answer for a cycle no longer picked is dropped. The card's
Refresh, or an asked read, reckons again. The estimate's tooltip names the
window's start and the reading's time.
Changed from the fork:
- After a run closed at its reset, the fork reset lastLeft to zero. A
window that ran dry again before its next reset then opened a run from
time zero, which hid every window's estimate, the weekly one included.
The next run now starts no earlier than that reset.
TestWindowHoldsDryAgainAfterReset covers it (red with the fork's line).
- The fork narrowed the live card's Span to the observed refill. Span also
feeds provider.WithWindowStarts, so the window's Pace would have moved.
withSpansOf puts the card's spans back after reckoning. A span assertion
in TestWindowHoldsUsesObservedRefillStart covers it (red without it).
- The fork's historical snapshot dropped the card's Balance. That slipped
past the gate a live card has (holdsBounds), so a card that tells a
balance got past-cycle estimates. Balance is now kept. Covered in
TestHistoricalWindowHoldsUsesEachWindowsOwnReading (red without it). The
fork's fixture had a Codex card with a Balance, which no Codex card has.
- Main has since added HoldsWhy (#2045). The fork's own "Whole: not enough
reliable data" line and its .quota-holds-unknown CSS are left out. A past
cycle uses main's holdsUnknownLine and its reasons, as a live card does.
A window with neither an estimate nor a reason shows nothing, where the
fork showed its unknown line.
- withRecordedWindowStarts is ported to main's holdsBounds(start, end, why).
- quota-refresh-order.test.cjs's VM harness now stubs quotaCycleHolds,
which loadQuotas and quotaRefresh clear.
Left out: nothing else from the fork. Past prices aren't kept, so a past
cycle's cost uses today's API list prices (documented). Credits can't be
attributed per call, so none is attempted (documented).
What was run:
- gofmt -l: clean. go vet -tags nogui ./... for GOOS darwin, linux and windows.
- go test -tags nogui ./internal/usage ./internal/gui ./internal/provider:
ok.
- Each of the three fixes above was reverted by hand, and its test went red.
- GUI, Chromium and WebKit:
- quota-curve: 30/30. Also run at 1100 and 420 wide: 60/60 (all five
languages).
- Also: quota-*, i18n-keys, gui-de/ja/zh-tw, usage-card-refresh,
usage-refresh*, usage-stale-answer, usage-remote-cards,
usage-accounts*, usage-quota-head, usage-pack and usage-alert.
- Reds: quota-count-wrap and quota-name-translated are red in WebKit,
the same as on origin/main
|
||
|
|
64b0f3a201 |
plugins: a community plugin's own page in magpie's window, shut in a sandboxed frame (P4)
A plugin's package.json may declare magpie.page {title, file, icon} and
magpie.permissions.reads. While the plugin is on, its page gets a tab in a
"Plugins" group after the built-in pages, drawn in an iframe sandboxed to
allow-scripts only (an opaque origin: no cookie, no storage, no parent).
Its files come from /_magpie/plugin/<token>/ (HMAC of the spec with a
per-process secret) under a CSP with connect-src 'none' and
frame-ancestors 'self'; a path that leaves the page's folder, a symlink
out, or an off plugin's token is refused. The window's postMessage bridge
answers only that frame (event.source checked) with theme and language,
the plugin's own options.get/set (throttled), and the reads it declared;
any other read is refused in the window and again by the server, and no
read carries a secret. /api refuses Origin: null and frame/iframe
fetch-dest requests (noFramedAPI), so the frame never reaches the GUI's
API even with the cookie. A page that throws or never says hello shows
the kernel's broken-page state with Try again. The Plugins page shows the
page and what it reads before the plugin is turned on.
Docs: gui-shell.md, plugin-runtime.md (P4 section), site docs en/zh/ja
with an example plugin; i18n zh, zh-TW, ja, de; fixture in
internal/gui/testdata/page-plugin.
Run (worktree at base 4df1ba0c6, -p 2, one package at a time):
- go test -count=1 -timeout 45m: internal/gui ok, internal/plugin ok,
internal/pluginrt ok, plugins/... (budget groups middleware otel redact
rotation search) ok.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows clean.
- Playwright (chromium + webkit, 5 languages, narrow widths): plugin-page 4/4,
plugin-kernel 4/4, builtins 4/4, i18n-keys, gui-de, gui-ja, gui-zh-tw 3/3,
plugin-middleware 24/24, plugin-own-icon 22/22, plugin-options 22/22,
plugin-local 8/8, plugin-agent 22/22, click-scroll 22/22.
Broken by hand, each went red: CSP without connect-src; apiFramed always
false; the server's read check removed; the noFramedAPI wrap removed from
api.go (red through the real Handler); inside() letting every path
through; CORP same-origin re-added; in JS the client read check removed,
the ev.source check removed, and allow-same-origin added to the sandbox.
Without the Array.isArray guard on /api/plugin-pages, plugin-kernel,
builtins and plugin-middleware/own-icon/options went red (their mocks
answer a non-list) - that was found by the run, then fixed.
Real use: built magpie, `magpie web` on 127.0.0.1:3472 (gateway 3471) in a
sandbox HOME with the example plugin added. curl: the page file loads
with the CSP and no cookie, traversal and a bad token are 404, /api with
Origin: null or Sec-Fetch-Dest: iframe is 403 even with the cookie, an
undeclared read 403, a declared one 200. Chromium and WebKit at 1100 and
420: the page draws its declared read, the probe's fetch/absolute
fetch/top access/undeclared read are all refused, an <img> of /api is
refused, no page errors. Real use found that a
Cross-Origin-Resource-Policy: same-origin header blocked the frame's own
files (its origin is opaque); it is gone and a test guards it.
Not tried: the desktop (Wails) window. Market cards of plugins not yet
installed don't show a page's reads. The Playwright suite mirrors the
CSP in a mock route rather than the Go server (the Go tests and real use
cover the server).
|
||
|
|
c7830731ca |
sessions: a session nothing was said in, which the Sessions page lists, opens and exports instead of "no such session" (#2273)
ListAgent lists a session assemble calls empty (no title, nothing
counted), so it can be cleared away, but Find searched only List(0) and
Get, and both drop it. The row's conversation, Markdown and Terminal
routes all go through Find, so they answered "no such session" for a row
the page itself shows. A real case is Codex's Image Session Helper: a
rollout with session_meta, settings, task_started and turn_aborted only.
Find now falls back to get(), which reports a session's files were found
even when assemble calls it empty, and fills it in the way ListAgent does
(listed(): Resume, Carry, Transcript), so Find finds every session
ListAgent lists. Get and List are unchanged: an empty session still
isn't in the main list and Get still says ok=false for it.
Run:
- TestFindEmptySession (internal/sessions) and TestEmptySessionOpens
(internal/gui), on a fixture made from the real aborted helper rollout
(paths and ids redacted). Both fail with Find's fallback broken by
hand (only taking ok sessions), and pass with it.
- gofmt -l clean; go vet for darwin, linux (nogui) and windows.
- go test -p 4 -timeout 40m ./... with pipefail, sandbox HOME, at
|
||
|
|
5618ade1e6 |
sessions: each reply in a session's conversation names the model its own line in the agent's file names (#2253, cnlove7777777-art)
Usage -> Sessions' conversation said only "Assistant", so which model wrote a reply couldn't be told, though the agents' files name it. - sessions.Part gains model (omitempty), set on assistant parts only, from the part's own line: Claude Code's message.model (the model that answered; none for its "<synthetic>" lines), Codex's turn_context.model (the model the turn was sent to; a /model between turns moves the next turn), Pi's and omp's message.model, OpenCode's modelID and OpenCode 2's model.id. - Kimi Code (its model is only on a usage.record written after the reply), Cursor (no model in the transcript) and gateway transcripts (GatewayTurn.Model is the model asked for, not the one that answered) name none. Nothing is guessed from nearby requests. - The reader (sessions client.js) says it muted after the role, once a reply at its first part and again only where it changes inside the reply; the tooltip is "Model: <id>" (an existing string, translated). ledSaid takes the model as an argument, so the Usage page's per-request content, whose row already names its model, is unchanged. No layout change: one muted span in the existing header line, ellipsized at narrow widths. Run: - TestTranscriptModelClaude/Codex/Pi/OpenCodeV2/OpenCodeFiles: all five fail on the old content.go/transcript*.go, pass on the new. - sessions-talk-model.test.cjs: 20/20 (chromium+webkit, en/zh/zh-TW/ ja/de, 1100 and 420). Fails on the old app.js/client.js, and with the once-a-reply rule removed by hand (label every assistant part). - sessions-talk, sessions-export, gateway-conversations, usage-ledger-content, usage-ledger-detail GUI tests: all pass. - go test -tags nogui ./internal/sessions ./internal/gui ./internal/gateway: ok. gofmt -l clean; go vet -tags nogui darwin/ linux/windows clean. Full suite for this push (#2257, #2251, #2254, #2253) at 53677ed8d: go test -tags nogui -p 4 -timeout 40m ./... with pipefail: every package ok. (An earlier full run caught davsync's TestSyncLibrary and profile's TestOldProfiles/TestProfileCarriesLibrary relying on a gone CLI after #2254; their sandboxes now have the CLIs, in #2254's commit.) Not tried: the real app against a live Codex rollout (fixtures follow the lines the readers already parse for usage). |
||
|
|
52ee847612 |
gui: a Linux bar's tray icon is the bird's silhouette, not the app's tile, and the tooltip says today's total (ylorn on Discord)
ylorn (Hyprland, 0.1.1241): the StatusNotifierItem's IconPixmap was the
coloured app icon on an opaque white tile, which clashed with a bar's
monochrome icons and became a solid block on bars that tint icons by
alpha; the tooltip said only "magpie".
- Linux now gets the macOS menu bar's template bird (tray.png) in one
colour on transparency (trayIconFor / linuxTrayIcon, trayglyph.go):
light, or dark when xdg-desktop-portal's org.freedesktop.appearance
color-scheme is 2 (prefer light); it is set again on the portal's
SettingChanged (watchTrayScheme, own D-Bus connection). An unreadable
portal counts as no preference (light). No IconName is set: a host
that resolves a -symbolic name but draws it untinted would show a
black bird on a dark bar with no pixmap fallback. macOS keeps its
template icon, Windows the coloured app icon.
- With no cards in the menu bar the tooltip is "magpie" over one line of
today's total, as the panel's Usage tab sums it (trayIdleTip: all
tokens, cost in Settings' currency, requests), refreshed with the
cards' loop. Cards picked: unchanged.
- The menu is unchanged (Open / version / Quit): no info lines. The
panel one click away has the models and usage, and the menu is shared
with Windows and macOS.
Run (sandbox HOME, pinned GOMODCACHE, shared GOCACHE), on origin/main
|
||
|
|
d966e19154 |
gateway, gui: the Routing page tags a Claude Code subagent's turn as it does Codex's
Codex names a subagent's request (x-openai-subagent: collab_spawn), and the Routing page tags its row Subagent, with why it went where it did. Claude Code names no kind, so Claude Desktop's subagent turns, which magpie now moves to their own model and effort, read as the lead's: a Desktop session's rows on one routing group could not be told apart. Claude Code 2.1.295 sends x-claude-code-agent-id from every agent context but the main one. Its x-claude-code-request-class and x-claude-code-agent-type hints go only to a first-party base URL or with CLAUDE_CODE_GATEWAY_HINT_HEADERS, so magpie doesn't get them. - subagentTurnOf keeps the id in Route.SubagentID for a request that offers tools and names no kind: the turn desktopSubagentPick and desktopSubagentEffort take. Desktop's and terminal Claude Code's turns are kept, moved or not. The lead's turns, a subagent's tool-less helper calls (#2081: Claude Code's housekeeping) and a blank id are not. A kind wins over the id. - A Desktop pick or effort that found the turn is trusted, so the body isn't decoded again; a request without the id isn't decoded at all. Only a subagent's turn with neither setting reads its tools once. - Kind stays empty (#2081), so the ledger, the Usage page and the Purpose filter keep the turn unmarked. The ledger's Subagent already keeps the same id, on the helper calls too. - routing.js tags it through tagKind in the request list (by request and by session), the story, the replay and the tray panel, with Codex's words and reasons (kindWhy's collab_spawn: moved or kept, within a routing group, on the model asked for). No new strings. - The day's history keeps the id. A route kept before it has no tag, and its moved/kept story reads as before. Verified at this head, on |
||
|
|
3c7ec4ba24 |
gui: Usage is a plugin's page, its code, markup and words in plugins/usage (P2)
P2 of docs/subsystems/plugin-runtime.md, the fourth page after Sessions,
Library and Routing, and the largest part of app.js.
- The Usage page's code (~3000 lines: the Overview's cards, the
Requests ledger and heatmap, the Sessions tab, the Agents list) moves
from app.js to assets/plugins/usage/page.js; its markup, index.html's
<main id="view-usage">, is client.js's part html. app.js 25756 →
22675 lines (1,355,376 → 1,198,239 bytes).
- page.js builds on app.js at the top level (its timers, ?view=usage's
tab and filters), so it is the one plugin script that loads after
app.js. index.html: kernel.js, the plugins' other scripts, app.js and
the scripts beside it, each page.js, then start.js, which is app.js's
old tail (magpie.start(), navHides, OPEN_VIEWS, the first page shown,
load()), so the first page has its code. TestBuiltinClientsLoaded
holds that order.
- Hooks: open loads it, refresh(again) is load()'s read of it, reload is
Refresh now, costs redraws costs on a currency change, tab says the
tab for focusQuotaCard. app.js calls those through magpie.call. The
allowance cards, quotasOpened, panelQuotaFocus and panelUseFocus stay
in app.js: the tray panel draws them too.
- plugins/usage: Essential, Requires window, no InUse. Off, its nav tab
goes and so do the ways to it (data-feature="usage": the panel's Open
Usage, Routing's View usage); show("usage") gives way to Agents; the
panel's Allowances tab stays. builtins.test.cjs switches it off and
checks each.
- The 173 strings only Usage says move to plugins/usage/i18n.js;
i18n.js 15032 → 14344 lines. "{n}s" and
"All sessions" stay: context.js says them too since #1591.
- context.js: with context.js now in before the first page is shown,
the page's open and load()'s first refresh both reached loadContext,
and the second drew "Reading…" again over the advice the first had
just drawn, so its curves never played their entrance (context-tune,
3 of 3 red). loadContext draws the waiting pane once for the same
days. Its dead last line, which loaded the tab once context.js came
in late, goes.
- context-window.test.cjs's "arrives after the state" becomes "loads at
once though context.js is slow": start.js now waits for it.
usage-stale-answer reads page.js beside app.js. quota-refresh-order
(#1630) cut app.js at the period picker's comment, now in page.js; it
ends at the next comment that stays (5 of 5; without keepRefreshedQuotas'
call, 2 of 5 red).
- docs: plugin-runtime.md, gui-shell.md.
Run, at this tree on origin/main
|
||
|
|
eb7199e120 |
gui: Routing is a plugin's page, its script, style and words in plugins/routing (P2)
P2 of docs/subsystems/plugin-runtime.md, the third page after Sessions and Library. - routing.js and routing.css move to assets/plugins/routing/ (client.js, routing.css). Its part's html is the page's head and boxes that were index.html's <main id="view-routing">; the rest is drawn by routingPage, run at mount since it builds on app.js. It keeps itself after that as it did (its own hidden, the language, focus), so its hooks are dirty and discard, a routing group being edited, which show() and the window's close ask through magpie.call: window.routingDirty and discardRouting are gone. - plugins/routing: Essential, Requires window and gateway, in use while the user has a routing group (not Auto, not Hidden), since the page is where it is edited. The gateway routes the same with it off. - With it off, what leads to the page goes too: the nav and panel tabs and the panel's section (data-feature="routing"), the guide's Open Routing, Providers' "Make a routing group of …", the Usage list's View routing and its time as a link, the context card's Latest request. A panel left on its Routing tab shows Agents. - What other pages use of it stays on window: openRoute (context.js), kindName, swapWhy, routedWhy (Usage's Requests), newGroupWith (Providers), panelRoutingShown (the panel). - The 505 strings only Routing says move from i18n.js to plugins/routing/i18n.js (4 languages); i18n.js 17048 → 15032 lines. The plugin's own name and line stay in i18n.js: the Plugins page says them with the plugin off (TestBuiltinsTranslated). - Tests and comments that named routing.js name the new path (gateway's antigravity_rest and loop_guard, codeassist.go, usage.go, web_compress, group_member_info, assets_revalidate, font-cascade, win-fonts, three routing-*.test.cjs). builtins.test.cjs and builtins_test.go count seven built-ins and switch Routing off: its tabs go, the page shown stays. - docs: plugin-runtime.md, gui-shell.md, gateway-routing.md. Run, first on origin/main |
||
|
|
2a99e7a429 |
gui: keep refreshed cards when their account identity changes (#1630)
The |
||
|
|
743fcc0351 |
gui: a click at the view's top keeps the clicked control under the pointer, not the view at its top (#2134)
|
||
|
|
86cc7ac56d |
usage, gui: keep refreshed cards and distinguish deferred readings (#1630)
A card refresh and a whole-page quota read could replace each other's entire snapshots. An older GET arriving after a successful refresh put the old number back on screen; two card refreshes could undo each other. Apply each POST's requested card alone and retain completed card readings against whole-page requests that began before them. Later reads can still update or remove cards. Failed refreshes do not block background results. A saved Claude account not asked for, or allowances held by When I ask, could also show "couldn't be read just now" without making a request. Carry readDeferred through the cached card and CLI/gateway report, and give that state a separate translated notice. Keep original read times, network-failure notices and authentication errors. Automatic saved-account reads and the existing 30-second floor are unchanged. Verification (macOS arm64, Go 1.27.2, Bun 1.4.3; isolated homes/API fixtures): - On base |
||
|
|
bfef5d51b5 |
gui: Routing is back to v0.1.1231's layout; reverts dae2618ad (#1354)
v0.1.1233 shipped community PR #1354 ( |
||
|
|
7d4ad7c628 |
gui: the menu bar's total is every token, cache too, marked Σ, as the Requests tab sums it (NextCommit)
NextCommit on Discord: the menu bar's usage showed only input tokens, and
more input than the Usage page. It showed input + output, unlabelled, so
it read as the input and came out above the page's input. And it was summed
as the Overview sums (usage.SummarizeTop: the gateway's calls only, cache
aside), while a click opens the panel's Usage tab, which sums the ledger
(the agents' own session-file calls too) and counts the cache's tokens
in its Tokens. Two numbers under one name.
- trayTotalSum is the ledger's cached sum, usage.QueryPage(p, {}, 0, 1).Sum,
the one the panel's Usage tab and the window's Requests tab show.
- The cell's top row is every token (in + out + cache read + write, as
allTokens) prefixed Σ; the cost stays under it. The tooltip spells out
"N tokens (a in · b out · c cached)".
- With the window as the tray's, a click opens the Requests tab at the
period (quotaView), not the Overview, which sums differently.
- docs/reference.md and gui-shell.md say so.
Run:
- TestTrayTotalIsTheLedgers (new): a Codex session-file call of 1000 in,
200 out, 8000 cache read; the menu bar's sum equals ledgerPage's and the
cell reads Σ9.2K. With trayTotalSum put back to SummarizeTop it fails
(menu bar all zeros, ledger 1 call).
- TestTrayTotals/BesideCards updated for Σ, the cache and tab=requests.
- go test -tags nogui ./internal/gui (sandbox HOME via the package): ok.
- tray-totals, tray-usages, tray-cell-click .test.cjs, chromium and
webkit, five languages, 1100 and 420: 70 pass.
- The Mac cell rendered with trayImagePNG and looked at: "Σ6.3M" over
"$3.40", "Σ47M" alone, both inside the row width.
- gofmt -l, go vet darwin, GOOS=linux -tags nogui, GOOS=windows; builds.
Not tried: the real menu bar on the reporter's data.
|
||
|
|
5fc2f87d13 |
gui: in colorblind mode a quota legend key is its window's dash, the even paces are dotted, and the balance curve and the good grade keep their look (#2073)
A review of db25c4ee found that colorblind mode reached past the quota
curve and that its legend shapes matched nothing on the plot:
- The fallback rules `.qc-line:not([data-series="0"])...` and the
matching `.qc-key` rule also matched elements with no data-series, so
the balance curve's solid line became dashed like its fitted line, and
its legend dot became a ring in var(--c4) while the line was var(--c1).
- A filled circle, hollow square or diamond in the legend appeared
nowhere on the plot, so it didn't tell a reader which line was which.
Series 3 and up shared one dash and one shape.
- The 7-day line's 6 2.5 dash sat beside its own 3 3 dashed even pace in
the same colour, while the tooltip still said "Solid: what was left.
Dashed: an even pace".
- The Context tab's "good" grade took var(--c2), which the palette turns
amber, next to "fair" in --amber (dark #fbbf24 vs #f2b544).
- omarchy.css made the first legend dot round with colorblind mode off.
- The legend set its colour twice (--sw and background) and undid it
with !important.
Now, with colorblind mode on:
- drawQuotaPlot tags each window's path.qc-line and line.qc-even with
data-series (its index mod 7, the same slot as its colour), and the
quota legend tags its key. Seven dash patterns, one per slot, apply to
`:is(.qc-line, .qc-dash)[data-series=N]`, so a line and its key can't
drift apart. Nothing else sets data-series, so the balance curve is as
on main.
- Each quota legend key shows a 22px sample of its window's line
(svg.qc-sample > line.qc-dash) in place of the dot; with the mode off
the sample is hidden and the dot is as on main.
- The even paces are dotted (0 4, round caps), unlike every window's
dash; the curve's tooltip, set in box.draw, says "Each window's line
has the dash shown beside its name. Dotted: an even pace, ..." in en,
zh, zh-TW, ja and de.
- `.ctx-ring.good` / `.ctx-grade-word.good` take --c1, the palette's
blue.
- omarchy.css is back to main's; the legend's `--sw` and !important are
gone.
- The Settings note now says what the mode does ("Colorblind-safe chart
colors, and each allowance window's line in a dash of its own"), and
gui-shell.md says the note is the Off/On control's tooltip, as the
code has it.
Run on db25c4ee + this change (upstream/main
|
||
|
|
a7a38193f5 |
gui, settings: colorblind mode for quota curves and chart series (#2073)
In Usage -> Allowances, the 5-hour and weekly quota curves and their
legend dots took --c1 and --c2, which are both shades of blue in light
(#4f46e5, #0ea5e9) and dark (#a5b4fc, #7dd3fc) themes, with identical
solid lines and 7px round dots and the 5-hour line dimmed to .45 over a
week (#2073, chenlz22550).
- settings.Colorblind ("colorblind" in settings.json), passed in GET
/boot.js when on and applied before first paint by theme.js and on
every state/settings read by applyPrefs as data-colorblind="1" on
:root.
- Settings -> General adds a Colorblind mode row (#colorblindRow,
#colorblindSegs) under Appearance, in en, zh, zh-TW, ja and de.
- Under :root[data-colorblind="1"], --c1...--c7 switch to an Okabe-Ito
qualitative palette in both light and dark themes so adjacent series
differ in hue and lightness across quota curves, tray sparklines, the
usage ledger and context charts.
- drawQuotaPlot and quotaCurve's drawLegend tag each series with
data-series on path.qc-line and .qc-key; in colorblind mode series 0
and series 1+ use distinct stroke-dasharray patterns and legend swatch
shapes (filled circle vs hollow square/diamond), and .qc-line.qc-short
keeps .85 opacity so short windows stay legible over a weekly span.
- docs/subsystems/gui-shell.md documents the boot and Settings contract.
Run (on origin/main
|
||
|
|
dae2618ade |
gui: make the Routing context lazy and align wide cards (#1354)
* gui: make the Routing context lazy and align wide cards (#1354) Rebuild the context and wide-layout change on main |