e4e9eb0928becfa4e48484dde85ef5032671d582
299
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
1c9c359f9d |
gui: Usage cards keep their place as they come in (liuzhengdong99 on X)
liuzhengdong99 on X: 用量界面每张卡片取数的时间不一致,导致卡片渲染时高度一直 跳动——滑到上面看某张卡片,视图会被拽回下面. The allowance cards come in at different times: each vendor's read (the page asks again every 1.5s while X-Magpie-Reading says a read is under way), then the curves' history. Every answer redraws the cards (renderQuotas), and packUsage grows the ones above the card being read. Nothing kept that card in place: the view's scroll guard (keepInView) only knew elements by node, and the cards are new nodes on each draw, so the browser's anchoring was the only thing holding them. It anchored on nodes that were being replaced, and the reader ended up dragged down. Fix: - The Overview keeps the card being read in place: the highest card (or part of the page under the cards) that starts in sight, found again by its data-key after a redraw (keepInView's new `only` mode with pinnedAt), and followed after every packUsage (followPin). The browser's own anchoring stays on while nothing is kept: at the page's top, on another tab, and while the cards are dragged or moved by keys (unpin, so a dropped card lands where its slot showed). - Placeholders from the last known height: each card's height drawn in full is kept by its key (localStorage magpie.usageCardTall, 1s debounce, 200 keys at most). A card still waiting on its read or its curve (usageWaiting: quotasReading, the new flag loadQuotas sets, or no history answer yet) is packed and held at least that tall, in the column count the cards were last whole in at that width. On the next start, no card in sight moves. - loadQuotaHist counts its first answer even when it is empty, so a user with no history isn't left waiting (found by usage-pack: the cards held their first packing at 560px). No new animation, nothing scrolls the page on its own (click-scroll passes), and the layout is unchanged once the cards are in. Run (mica, Playwright 1.62.0, Chromium + WebKit): - usage-cards-steady.test.cjs (new): 20 tests, all 5 languages, 1100px and 420px. On the old assets (MAGPIE_ASSETS) it was red 8 of 8 in en and ja. With the hold disabled, the second visit goes red. - At |
||
|
|
bfbc22e190 |
claude: an idle session is saved whenever the gateway ends or hands over (#7017)
recih: after magpie web restarted (an update's re-exec, or Quit and
start again) the next Claude turn replayed the whole conversation
instead of resuming its session. Web.Wait closed the page server and
never drained the gateway, so abortAll never ran and claude-shelf.json
was never written.
- Web.Wait drains the gateway (Close: page server, then stopServing)
before the plugin hosts end and before update.Reexec.
- Desktop quit: OnShutdown calls stopServing.
- Signals: web, serve, the TUI and the app register their gateway with
the signal handler (stopGatewayOnSignal). SIGINT, SIGTERM and SIGHUP
drain it, sessions saved, before magpie dies of the signal. The return
path waits for a drain the signal already started. The TUI and the
app take SIGINT/SIGTERM themselves, but SIGHUP (the terminal closing)
stays with magpie. runTUI, runGUI and runPanel now register
tui.StopGateway and gui.StopServing for it (added in review).
- Handover: the successor answered a Claude turn before the predecessor
had saved its shelf. The predecessor now serves
GET /_magpie/claude-ready on its callback socket, answered once
abortAll has run. A Claude turn on the successor waits for it.
- The predecessor saves only after every request it holds has ended,
of any provider, which can take up to handedOffDrain (15m).
- Added in review: the wait is bounded by predecessorWait (90s, inside
Claude Code's ten minutes for a reply). Past that, the turn goes on
as before, as a replay, and no later turn waits
(errPredecessorSlow).
- loadShelf still reads a shelf written later, at the next turn with
no session found.
- A predecessor without the endpoint (404) keeps the old race.
- Sweep: sweepSessions removed session files older than idleLongest.
That included a session kept for hours past a quota 429
(keepForReset) and one moving from the shelf to a run.
- Those are now protected: the shelf file, the in-memory shelf, the
resuming set and active runs.
- An unreadable shelf skips the sweep.
- loadShelf and the sweep's snapshot are serialised by shelfFileMu.
The bridge lock is held only for the shelf maps, never across the
file's reads (added in review: the branch read the file under b.mu,
which every Claude turn takes).
From recih's branch fix/web-restart-session-persistence (7a0261cc1,
fab0ea651), with the review's follow-ups. Not taken from the branch:
the .github/workflows/test.yml change (contributors.md: .github/ stops
for the maintainer), and the test-flake commits in other packages,
which are separate goals.
Red on origin/main
|
||
|
|
1b360f08c2 |
gui: the Version row's Restart is named Restart only (realfxw on X)
With automatic updates off, Settings › About's Version row shows Check and a bare Restart. realfxw restarted again and again, reading Restart as "install the update", while his build was newer than Daily's and no update was on offer. Why the button is there: |
||
|
|
4d79bebfa7 |
usage: speed counts all output, reasoning and tool calls too, from the first output (Archivemylife on X)
Archivemylife on X: speed should be the upstream's usage over the local time, with no split into reasoning, tools and answer, since reasoning and tool calls are tokens too. Speed is now every output token the vendor's usage counts (reasoning and tool-call arguments included) over the time from the first output of any kind to the end of the reply. The first output is the earlier of the first content (TTFT) and the first sign of reasoning, firstToken.reasoningMs in ttft.go, which works the same in every protocol: - a Responses reasoning item's start; - an Anthropic thinking or redacted_thinking block's start; - sealed (hidden) thinking; - reasoning deltas spread over 100 ms or more. Deltas that came at once are a buffered burst and tell none. A summary is no sign (summaryPart: a Responses reasoning summary, a Gemini thought, or a summary translated from another protocol via firstToken.summarized), because it is written after some of the reasoning it sums up (#1463). A reply that reasoned with no sign of when it began counts only its answer, its output less the reasoning, from its first text, and none with no text. Before this, a reply that reasoned always counted only its answer, and a reply that wrote tool calls after reasoning told no speed. Burst and held-content checks judge the answer's part. The same definition holds everywhere: - gateway: speed.go, trace.go, codex_backend.go; - usage.DecodeOf, for the Usage cards, rows and `magpie usage`; - the Usage page's ledDecode; - the Routing page's decodeOf and its ranking (fast routing reads noteTrySpeed, which uses DecodeOf). settledCountVersion goes to 8, so settled heat totals are counted again. The rule text is in en, zh, zh-TW, ja and de. Docs: reference.md, and gui-shell.md under "Streamed output speed". Red on the old code (scratch worktree at |
||
|
|
1c0ecec0f6 |
library: a magpie in Docker keeps skills and prompts for its clients
fenglian980510 on X: in the Docker gateway the Library had MCP and no Skills. Since |
||
|
|
9314999a4a |
ccswitchlink: a ccswitch:// link that still reaches magpie goes to CC Switch, and so does the scheme (asombrado_a on X)
@asombrado_a (X, 2122995130097713493) has CC Switch and magpie both installed, and a ccswitch://v1/import link opened magpie. magpie claims magpie:// only since |
||
|
|
c5cb1c0588 |
gui: the tray's logo is 16pt, as large as other apps' menu bar icons
qingnianxiaozhe on X: magpie's A\ in the menu bar looked a size smaller than another app's A\ beside it. magpie fitted each logo to a 14pt box, so the A\ (about 1.37:1) drew 14x10pt. Claude.app's menu bar template (TrayIconTemplate@2x.png, 48x48 px) has 32x32 px of ink, a 16pt glyph, and in the reporter's screenshot the other A\ is 32x22 px against magpie's 28x20 px at 2x. mpLogo is now 16; the letter in a ring (a logo that can't be read) grows with it. The two 10pt rows of percentages are unchanged and still fit the 22pt bar. Tests: the logo boxes in the tray tests follow the 16pt box (offsets 28 -> 32, 34 -> 38 px at 2x); TestTrayImageLogoSizes now wants 27-33 px of a 32 px box. Run on mote (macOS 27.2): - go test ./internal/gui -run Tray -count=1 -v: ok. - Broken by hand (mpLogo back to 14): TestTrayImageLogoSizes FAILs ("alma spans 24 px of a 32 px box", codex/zcode/workbuddy 26 px) and TestTrayImagePlain FAILs ("238 px with logos, 182 without"). - Rendered by the real drawing code (trayImagePNG, 22pt bar at 2x) next to Claude.app's own template icon: the A\ is 28 px wide before and 32x24 px of ink after, as wide as Claude's 32 px spark; the percentages are the same text at the same size. The before/after strips are kept outside the repo (tray-toolbar-scratch/before and after/strip-{light,dark}.png). Suite and checks, on mote at aa31e737c8d271455865615fafdf512e09073663 (this commit and its pair, the tray logo size / the toolbar menu): - go test -count=1 -timeout 45m ./... in a sandbox HOME, caches pinned: exit 0, 103 packages ok, none FAIL (internal/gateway 1633s, internal/agent 949s, internal/provider 470s, internal/gui 295s). - gofmt -l internal/gui: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go build, GOOS=linux go build -tags nogui, GOOS=windows go build: all ok. - No GUI asset changed, so the Playwright suite wasn't run. After a rebase onto |
||
|
|
add1e75ee3 |
gui: no Icon and Text menu on a right-click by the traffic lights
AlanWang1027713 on X: a right-click on the main window's title bar, by the lights, offered "Icon and Text / Icon Only / Text Only". It comes from the empty NSToolbar that MacTitleBarHiddenInset puts there to inset the lights; NSThemeFrame's menuForEvent: lists its display modes. insetLights takes the toolbar away only in the macOS 26 design, so on macOS 27, with an older SDK and in a right-to-left layout the toolbar, and its menu, stayed. quietToolbar turns the menu off where the toolbar stays: allowsDisplayModeCustomization = NO (macOS 15+), and AppKit's own _setWantsToolbarContextMenu: NO for macOS 12-14, each looked up with respondsToSelector, since the SDK that builds magpie may be older than the system it runs on. Nothing about the title bar's shape changes. windowshape.Of now reads the menu a right-click 20pt below the top, 120pt in, gets from the window frame (TitlebarMenu), and TestMainWindowCorners and TestMainWindowRightToLeft fail when the main window gets one, or when the reference toolbar window doesn't (so the probe is proven to see it). Run on mote (macOS 27.2), real makeMain window: - go test ./internal/gui -run 'TestMainWindowCorners|TestMainWindowRightToLeft' -count=1 -v: ok. Each stage logs "title bar menu []" next to the reference toolbar window's ["Icon and Text" "Icon Only" "Text Only" "-"] (macOS 26 SDK) and ["-"] (macOS 15 SDK). Lights [[26 26] [49 26] [72 26]], 66pt title bar and 16pt corners with the 26 SDK, [[19 19] [39 19] [59 19]] and 38pt with the 15 SDK: the same as without the change. - Broken by hand (quietToolbar call taken out): both FAIL, "a right-click on the title bar gets a menu: ["Icon and Text" "Icon Only" "Text Only" "-"]" (26 SDK) and ["-"] (15 SDK). - A probe app on mote: either switch alone empties the frame's menu. Suite and checks, on mote at aa31e737c8d271455865615fafdf512e09073663 (this commit and its pair, the tray logo size / the toolbar menu): - go test -count=1 -timeout 45m ./... in a sandbox HOME, caches pinned: exit 0, 103 packages ok, none FAIL (internal/gateway 1633s, internal/agent 949s, internal/provider 470s, internal/gui 295s). - gofmt -l internal/gui: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go build, GOOS=linux go build -tags nogui, GOOS=windows go build: all ok. - No GUI asset changed, so the Playwright suite wasn't run. After a rebase onto |
||
|
|
cb1fe6d5d9 |
gui: Get started put away comes back from Settings › General
Once the Agents page's Get started card was hidden (POST
/api/settings/guide {hidden:true}) nothing in the app brought it back.
Hiding it now says where it comes back ("Get started hidden; Settings ›
General brings it back"), and General has a Get started row with Show,
only while the card is hidden and would otherwise show (setup not done,
not gateway mode). Show posts {hidden:false}, redraws the Agents page and
says so; the row goes. The row lives in guideback.js, imported by
navpages.js beside the sidebar's pages, so the core grows by one status
line. Settings' search finds it by its name.
Run (mote, at this tree):
- getting-started, nav-pages-hidden, nav-pages-order, settings-general,
settings-search, i18n-keys, gui-de, Chromium and WebKit, every
language: 117 tests, all pass after the fake server answered
/api/settings with the guide flag as the real one does.
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok.
Broken by hand, each red, then put back:
- renderNavPages not calling guideBack: getting-started 20 of 60 red
(the row never shows).
- the hide's status line removed: getting-started 30 of 60 red.
Not tried: the real app window.
|
||
|
|
de321cc92e |
gui: Settings' search finds by a part's name, unfolds an Advanced around a hit, and reaches the settings sheets build
Three gaps in Settings' search (the UI/UX scan's item 12): - every part matched its tab's id too, so "usage" brought all of Allowances (id usage), rows that never say it included. A part is now found by its name; Observability still answers to "otel". - a hit under a folded Advanced (Network and sharing's Name) stayed folded, so the part showed with nothing in it to see. It is unfolded while the search lasts and folded again when it ends (setFolds, in the lazy provlinks.js, so the core grows by two calls). - what an agent's sheet or the Claude editor draws only when opened wasn't in the page to be found: Claude Code's prompt cache (main and subagents), its commit signature (Co-Authored-By), an agent's own fields (permission mode) and the Claude editor's run mode (claude -p). Each has a link row now, in the agent's or provider's name; Open opens the sheet or editor and lights the row, again if the editor draws it anew once the provider list is in (lightWhen). docs/subsystems/gui-shell.md says so. Run (mote, at this tree, rebased on origin/main |
||
|
|
74bba1fa67 |
gui: Settings › Version and the tray restart magpie with no update (yansheng1003 on X)
yansheng1003 asked for a Restart beside Check: "每次改了需要重新magpie, 都要自己退出再启动麻烦". The Version row now has Restart after Check while no update is on offer (found, downloading, downloaded, blocked, a newer version named or a failed download each have their own buttons, which restart through the update and fill a 420px row), and the tray's Restart magpie is always shown: with an update ready it installs it as before, with none it starts this magpie again as it is. Both go through restartSelfNow (restart.go), the updater's own way of starting again: on macOS and Linux the gateway's socket is handed over (beginHandover), so requests in flight carry on; otherwise the bundle or binary is started again (update.Relaunch, relaunchBinary), and on Windows requests in flight are cut. magpie web runs itself again in place. POST /api/restart answers 204 and then quits, or 400 "magpie couldn't start again: quit it and open it again", and the row says Couldn't restart magpie with the reason and gives its buttons back. /api/update now says its run (the time this process started), so a browser's page reloads once another run answers. The click, its error and the reload are in versionrow.js, imported when Restart is pressed. The mirror's Download from GitHub click moved there too, so app.js stays under its budget with no raise (TestCoreScriptBudget at 1,088,248 and 1,272,581, as they were). The route is named in the CLI's notYet list. Words in en, zh, zh-TW, ja and de. What needed a restart before, besides an edited path plugin (the commit before): most settings already applied live (proxies, OTel, HTTPS/mTLS, LAN from the GUI, allow-lists, CORS, shortcuts, tray, language, name, fonts, port, hand-edited caller-keys, oidc-rules and library.json). Still start-only: LAN switched by hand in settings.json, environment variables, and in-memory routing state such as a rate-limited account's order; Restart is for those. Run: - Full Go suite (mote, -timeout 45m) at the head before the rebase and before versionrow.js: 101 packages ok; the reds were TestEveryRouteHasACommandOrIsNamed, TestEveryRouteIsNamedForTheCLI (the route unnamed) and TestCoreScriptBudget, all fixed here. - At this head (mote): go test ./internal/gui -run 'TestCoreScriptBudget|TestEveryRouteIsNamedForTheCLI|TestRestart| TestUpdateSaysItsRun|TestTrayMenu' ok; ./internal/cli -run TestEveryRouteHasACommandOrIsNamed ok. go build, go vet, GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... ok; gofmt -l clean. - GUI (mote, both engines, at this tree): update-*.test.cjs, version-restart, settings-update-source, refresh-page, old-webkit, i18n-keys and i18n-en-no-cjk: 628 pass, then 6 red in update-check (Restart not dimmed while a check runs), fixed here (Restart dims with Check); update-check, version-restart and old-webkit again: 90 pass, 0 fail. - Real restart (mote, sandbox HOME): a built magpie web with MAGPIE_WEB_KEY, signed in through ?k=; POST /api/restart answered 204, the same pid ran again with a new run, and the cookie still signed in. - Broken by hand: restartAppFrom returning true on an error, and TestRestartStartsMagpieAgain is red; version-restart.test.cjs on the old app.js is red (21 on chromium); with Restart shown beside an update on offer again, "no Restart beside an update on offer" is red in all 5 languages and both engines (12 fails). - The whole GUI suite is still running on mica at push time; its reds are compared against origin/main and fixed or filed after. Not tried: the tray item and a restart in the real macOS, Windows and Linux apps (only magpie web was restarted for real). |
||
|
|
b0c2b5e261 |
gui: a page left out of the sidebar still opens from a link, ?view= or a search hit
Settings › General › Sidebar pages (magpie.navHidden) took a page out of
the sidebar, and offView then sent every way to it (a link, ?view=, a
Settings search hit, a plugin's show()) to Agents or Providers with
nothing said, so the page was unreachable. offView now redirects only a
page gateway mode or a switched-off built-in plugin leaves out. Hiding
stays a sidebar choice: the window's own kept page (magpie.lastView)
isn't reopened when it is hidden, so a fresh window still opens on the
first page, or Providers when Agents is hidden too (keptView in
start.js).
nav-pages-hidden: with Library hidden, show("library") and ?view=library
open Library; a kept lastView of library opens Providers.
Run (mica, at this tree; mote at load 27):
- nav-pages-hidden, nav-pages-order, last-page, gateway-mode, Chromium
and WebKit: 19 pass, 1 red, last-page WebKit, red the same on
origin/main and filed (#7033).
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok.
Broken by hand, each red, then put back:
- the new test on origin/main's app.js and start.js: 2 of 2 red (line
69, Library not opened), both engines.
- keptView without the navMine check: Chromium red at line 76 (the
window reopened the hidden page).
Not tried: the real app window, the full GUI suite.
|
||
|
|
169446a1d7 |
gui: the Mac's menu bar item takes its clicks from the start, so the first click after a restart keeps the panel open (Refeccd on Discord)
Refeccd on Discord: "每次更新后,第一次在菜单栏点击唤起主界面会出现闪退现象
(实际程序未退出,只是隐藏了)" (macOS, automatic updates).
Cause:
|
||
|
|
05d46f42e5 |
gui: Claude's menu bar cards can show Anthropic's A\ mark (qingnianxiaozhe on X)
qingnianxiaozhe asked for Anthropic's A\ in the menu bar in place of
Claude's logo. Settings › Usage › Menu bar Claude logo (Mac only, shown
while logos are on and a ticked card is Claude's, under the magpie icon
row) picks Claude's logo
(the default, unchanged) or the A\.
- settings.TrayAnthropicMark, kept per computer through KeepOwn like the
other menu bar choices; settingsapi.Keys saves it; a change wakes the
menu bar (onTrayUsage).
- trayAnthropic swaps the icon of cells whose card logo is claude-color
or a plugin's claudecode-color (trayCell.Logo) for trayAnthropicMark,
an SVG drawn here (two paths, no other app's bytes), and marks it mono
so mpGlyph paints it in the bar's text colour. Menu bar logos off
wins.
- The row's code is trayClaudeRow in traywindows.js (lazy). app.js only
adds the key to prefsKeep; to stay in TestCoreScriptBudget without a
raise, renderTrayUsage's no-card branch moved into trayWindowsRow,
which now hides Windows' figure row itself when no card is ticked.
- en, zh, zh-TW, ja, de strings; docs/subsystems/gui-shell.md bullet.
Tests: TestTrayAnthropicMark (which cells change, input not mutated,
plain cells stay plain), TestTrayAnthropicMarkSVG,
TestTrayAnthropicMarkSaved (POST as the page does, saved and woken once
per change), TestTrayImageAnthropicMark (darwin: renders the real
AppKit image light and dark, the logo rect differs, the rest of the
image is identical), tray-anthropic-mark.test.cjs (five languages, 900
and 400px, Chromium and WebKit: row, two logos, default Claude, A\
posts true, another setting's save keeps it, back to false, no row with
no Claude card / logos off / no card / Win32, no page errors, no
sideways scroll). The GUI test waits for the redraw after a save rather
than a fixed time: a click on a control drawn before the save lands
sends the old value back (any setting, not new here).
Broken by hand: trayAnthropicMark taken out of prefsKeep turns the GUI
test red ("a save of another setting keeps the A\") in all languages;
taken out of settingsapi.Keys turns TestTrayAnthropicMarkSaved red.
Run:
- mica, at 2fa9295ed (this tree less the doc bullet): go test -timeout
45m -count=1 ./... : 103 ok, exit 0.
- mote, at this head's code: gofmt -l clean; go vet ./...;
GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./... ok;
internal/settings, settingsapi, davsync ok; internal/gui -run
"Tray|CoreScript|Budget|EveryRoute" ok.
- mote GUI, Chromium and WebKit, the 20 files that touch the menu bar
rows, Settings search or prefs (tray-*, settings-search, side-effort,
searcher-pick, quota-pace, proto-menu-overflow, classify/image-timeout,
i18n-*): tray-bird first went red (its row must follow the logos row),
so the Claude row sits after the magpie icon row. side-effort is 5/5
red in both engines on origin/main
|
||
|
|
ead91a9a50 |
gui: a browser tab's title names this magpie: MAGPIE_NAME or Settings › Network and sharing › Advanced › Name (starballl on X)
starballl on X (tweet 2122376116220633444) runs several magpie web pages
and every tab is titled "magpie", so they can't be told apart. A magpie
now has a name, and a browser tab's title is "<name> · magpie" (plain
"magpie" with none).
- settings.Name, set in Settings › Network and sharing › Advanced › Name
(instancename.js, imported when Settings is drawn, so nothing is added
to app.js's core). Advanced is closed until a name is set.
- MAGPIE_NAME (Docker, magpie web) names it while the field is empty and
is the field's placeholder. It is read, never written, so a name typed
in Settings always wins and clearing the field goes back to it.
- One line, at most 60 characters (settings.CleanName).
- This computer's own (KeepOwn): sync and a restored backup never bring
another magpie's name. A Settings save that leaves `name` out keeps it
(settingsapi.Merge).
- boot.js titles a browser tab itself for the first paint, so app.js's
core gains only the line in applyPrefs, which sets the title again from
every settings read (TestCoreScriptBudget was 74 bytes over with a
title function in app.js). Only a browser page (web) is retitled: the
app's windows and tray keep "magpie".
- Docker docs (en, zh, ja) list MAGPIE_NAME; docs/reference.md and
docs/subsystems/gui-shell.md say how it works.
Tests:
- TestInstanceName (internal/gui): the variable alone names it at boot;
a saved name wins over it, trimmed; a save without `name` keeps it;
KeepOwn keeps it; cleared goes back to the variable; no name, none at
boot. Broken by hand, each red: KeepOwn without Name ("KeepOwn took
\"other\""), Merge without the keep ("a save without the name changed
it to \"\""), boot.js with s.Name in place of InstanceName ("named by
the variable alone: boot <nil>"), boot.js not setting the title ("a
browser tab's boot.js sets no title"). The app window's boot.js sets
none.
- TestSettingsSaveKeepsWhatItDoesNotSend now sets Name: the page's other
saves leave it out, and it is kept.
- instance-name.test.cjs: title from the first paint, the field under a
closed Advanced, save and clear retitle the tab, Advanced open after a
reload, 360px, the app's window keeps "magpie"; en, zh, zh-TW, ja, de,
Chromium and WebKit, 16/16. 14 of 16 red with applyPrefs not setting
the title.
Run, at this commit on
|
||
|
|
34606000da |
gui: the tray panel's Usage tab ends in a heatmap of recent weeks (eiyuuzaki2333 on X)
Asked for "a heatmap like GitHub's / Codex's, also in the tray". The window already has one (Usage › Requests, 53 weeks, #1369), so no second copy goes on the Overview, which counts gateway calls only while the heatmap counts session-file calls too. The tray panel had none. The panel's Usage tab now ends in a card of the recent weeks, one cell a day, Monday on top, as many weeks as the card fits (8 to 53: about 25 at the panel's 440, 17 at 320). It goes after the chart and ranking, so nothing above it moves. Its shades are the existing monochrome accent ramp (.l0 to .l4) and follow the tab's own Tokens / Cost / Requests switch, with no new read; a provider or computer picked above narrows it. A tooltip says the day and its tokens, requests and cost. Weeks with no call show no card. No animation. It reads the existing cached /api/usage/heatmap, at most once a minute and again when a pick changes; the tab's own 10 s reads don't wait for it, and no endpoint was added. The card, its reads and tooltip live in plugins/usage/page.js, which shares its grid (heatGridOf, taken out of drawLedHeat as it was) and tooltip (ledHeatTip, now told the metric and provider) with the Requests tab. app.js keeps one guarded call in renderPanelUse: the ledger read can come back before page.js has run, so page.js draws the tab again when it loads. Both script budgets hold it at this base with no raise. The card is .pu-heat, not .pu-card, so the chart's card stays the tab's one .pu-card. The panel's light pills are its card's white, so a quiet day there is a 7% shade of the text over the card. Run (rebased on origin/main |
||
|
|
187d067241 |
gui: a page's row in Sidebar pages is dragged by a finger too (chet030714 on X)
v0.1.4296's page order "根本拖不动" on a phone. Reproduced in Chromium with real touch input (CDP Input.dispatchTouchEvent, 390px, hasTouch, isMobile): the press on the grip went pointerdown, pointermove, lostpointercapture, and the drag ended before it began. A finger (and a pen, where the browser does so) is captured by what it pressed, here the grip span inside the row; dragRows then takes the capture on the row, the grip loses it, and its lostpointercapture bubbled to the row's listener in dragListen, which cancelled the drag. A mouse has no implicit capture, which is why the mouse test and the desktop app were fine (mouse drags passed in Chromium and WebKit, 1100px and 390px). dragListen now cancels only on the handle's own lostpointercapture. The fix is in the shared listener, so every dragRows/dragCards whose handle holds a child (the accounts' rows, a model's rows, plugin pages) gets it. On a coarse pointer the grip is 40px wide instead of 26, a finger's target. Alt+Up/Down is unchanged. No new motion: the rows' existing 0.16s strong ease-out shift (none under reduced motion) is what a finger drag shows. The listener's lines were written shorter so app.js stays under its budget (4 bytes of room left), no raise. Run: - nav-pages-order.test.cjs: a finger drag (CDP touch) and a pen drag (CDP pointerType pen) on the phone's menu, Chromium; WebKit checks the grip shows. 10/10 (Chromium, WebKit x en/zh/zh-TW/ja/de) on mica. Red on origin/main 269e54de5's app.js: "a finger dragged Masking up", chromium en and zh (2/2). The pen step passes on the old code too (Chromium's CDP pen isn't implicitly captured), so it guards nothing old, only the path. - The drag GUI files (account-arrange, agent-grip, codex-model-order, drag-rows-shift, gateway-key-arrange, group-arrange, group-member-drag, group-member-row-drag, panel-arrange, plugin-page-arrange, provider-order, routing-rule-drag, usage-arrange, usage-drag, tap-lost-click, tap-inverted, tap-click, search-order, nav-pages-order) on mica: 196 pass / 12 fail. The 12 are account-arrange (53 !== 52, #6010) and gateway-key-arrange 420px (#6268); both fail the same 12 at origin/main 269e54de5's assets. - go test ./internal/gui/ on mote: ok (TestCoreScriptBudget included). Not tried: a real phone (iOS Safari, Android Chrome); WebKit touch, which Playwright can't send; a real pen; the Wails windows. |
||
|
|
269e54de5f |
gui: an update restart nobody clicked comes back in the tray alone (eating_dream on X)
eating_dream on X (v0.1.4303, macOS, Restart automatically on, a check every half hour, prerelease channel): after each automatic update the main window came back over what they were doing. A restart by itself brought the window back when it was up (#2096), and minimised when it was (#3495). Now every restart nobody clicked comes back with the tray icon alone, on every system, the window closed even when it was up. That covers Settings' AutoRestart, `magpie update` from a terminal, a Remote magpie's ask, and another copy replacing this binary. The restart path is restartBySelf, which updates.autoRestart calls. It still takes no focus and the Mac's Dock icon joins without coming to the front (quiet_restart.go). A restart the user clicked (the pill, Settings, the tray) opens the window as it was. No new setting. restartInto loses its minimised parameter, and markQuietRestart writes the seconds alone. An older version restarting into this one still asks for its window and may write "<seconds> minimised", so the reading side (takeQuietRestart, quietMinimised, showMinimised) stays. host.mainUp had no caller left, so it moved into the Windows test that reads it. Tests: - New TestRestartBySelfComesBackToTheTray: by itself asks for no window, clicked asks for it. - TestRestartBySelfComesBackQuietly now checks restartBySelf's mark and reads an older version's minimised mark (markOldQuietRestart, which the Windows minimised and quiet tests use too). Run, at fd407bc99 + this change: - mote-run: - go test ./internal/gui -count=1 -timeout 45m: ok - go vet ./internal/gui, GOOS=windows go vet ./internal/gui, GOOS=linux go vet -tags nogui ./internal/gui: clean - gofmt -l: clean - Broken by hand: restartBySelf asking for the window (the old behaviour with it up) fails "windows asked for [true true], want [false true]". The old code read the window through a live Wails window, so the test can't run against it as it was. - win-run go test ./internal/gui -run 'Quiet|BySelf|Minimised|RestartBy': ok. TestRestartMinimisedComesBackMinimised and TestRestartBySelfAsksNoAttention skip over ssh (session 0). - wsl-run go test -tags nogui ./internal/gui -run 'Quiet|BySelf|Beside': ok Not tried: a real automatic restart of the app on any system, and the Windows desktop tests in the signed-in session. The first update into this version is still made by the old one, which brings the window back once. Docs: gui-shell.md, restart by itself. |
||
|
|
e0f9218f91 |
update: Restart to update goes into the newest version out, not an older download (char1es_lu on X)
char1es_lu on X: Restart to update put in a version downloaded a while ago, and right after the restart magpie offered an update again. Since |
||
|
|
b010fba05b |
gui: the pages go in the reader's own order, in the sidebar and a phone's tab bar (chet030714 on X)
Settings › General › Sidebar pages, where pages are hidden, now also puts them in order: a row is dragged by its grip (shown on hover, always on a touch screen), or moved with Alt+↑/↓. The order is kept for this browser in localStorage magpie.navOrder, beside magpie.navHidden. The sidebar and the header's tabs follow it at once, and a phone's tab bar (phonetabs.js) shows the first four with the rest under More. Providers is listed (it can be moved, never hidden). While the order isn't the home one the sidebar's group names (Work, Models, ...) are left out, since a reordered list breaks the groups; Default order (shown only then) removes the key and puts the pages and their names back. A page the kept order doesn't name (new in an update) goes after the page it follows at home. Plugin pages keep their place in their group. A reader who never reorders sees nothing change. navOrder and navArrange live in the new navorder.js, imported by navHides only once an order is kept (and by navpages.js with the menu), so what is left in app.js is that one line: +107 on both core budgets, explained there. old-webkit's list of on-demand scripts names navorder.js. Built on the unpushed WIP 10b9ee22c (page-order worktree), cherry-picked onto origin/main; the WIP test clicked the aria-disabled Providers row without force, and its reload checks now wait for the async import. Run: - nav-pages-order.test.cjs (new): Chromium and WebKit, en/zh/zh-TW/ja/de, 10/10 pass. Red on origin/main (no menu opens), 5/5 chromium. - The whole GUI suite (make test-ui) on mote at the first, inline version (navArrange ran on every start; the final version runs nothing new for a reader with no order), stopped after 4,171 ok / 171 not ok, none in a nav, sidebar or phone file. Five of the red files (agent-switch-accounts, gateway-key-arrange, first-untick, data-folder, api-key-theme) rerun on mica at this tree and at origin/main |
||
|
|
023a563735 |
install: the Windows install dialog says the download can be deleted
@jiangshangmuyun on X updated on Windows and found a new magpie while "the original is still there". That is by design since |
||
|
|
c6a67dd412 |
gui: the Windows main window is resized from its edges again (Puremilk_chun on X)
Since 0.1.4274 ( |
||
|
|
b34243823e |
routing: accounts' resets stay in their column, and resizing over many accounts is smooth (lexrus on X)
lexrus on X: on Routing's Accounts and keys, at some widths "resets in
3h" ran over the next column and the right column's words were cut, and
with many accounts dragging the window's edge was janky.
Overlap: the window parts' widths (--wk/--wv/--wr) were taken from the
widest window of the whole list, so one provider's long reset pushed
every row past its column. They are now per provider, and CSS caps each
part to its row.
Jank: the list was CSS columns, and the browser balanced every row again
on each layout. packActs (plugins/routing/client.js) places each
provider's box (and a long box's rows) itself under .rt-acts.packed with
--px/--py: down a column and on into the next, ends as level as a binary
search on the cap allows, a heading never last in a column. It runs on
the window's resize, on render, and a frame after a box's height changes.
Side mode (min1150, beside the requests) is unchanged: one scrolled
column, nothing placed. Measured on mote with a 100-row fixture, per
resize step: WebKit layout 26.6ms -> 5.9ms, frame p90 35 -> 18ms;
Chromium layout 8.24ms -> 2.86ms.
Test: routing-account-windows-fit.test.cjs, 4 and 20 Codex accounts, en
and zh, Chromium and WebKit, widths 420-1600: no window part runs past
or is cut, a provider's lines start together, the list isn't CSS
columns, boxes sit inside the list in column order without overlapping,
2+ columns at 700-1099. Broken by hand: the old assets are red on the
overlap; packing turned off is red ("the list isn't CSS columns").
gui-shell.md says how the columns are placed.
Run on mote at this change on origin/main
|
||
|
|
dd77094ca2 |
gui: on Windows the header is the window's title bar (258a14 on X)
With a wallpaper, Windows' main window had a white native title bar over
the page, cut off from it ("内容区域和标题栏有割裂感"). On Windows the main
window is now frameless (mainFrameless), as the Mac's header already is
the title bar: the page and its wallpaper run to the top edge. Wails v3's
frameless window keeps WS_OVERLAPPEDWINDOW, so the shadow, Windows 11's
rounded corners, snap (Win+arrows, drag to an edge) and Wails' resize
edges stay. The header draws minimise, maximise/restore and close at its
right (#wincap, wincap.js, imported in that window alone), Windows-sized
with Segoe Fluent Icons, in the theme's colour, Close red on hover
(.1s ease); the header's refresh and pin sit left of them and stay
no-drag. A double click on what drags the window maximises or restores
it. The app tells the page when the window is (un)maximised (captionJS),
which swaps the glyph and its tooltip and keeps Wails' resize edges off
while maximised so the corner pixel is Close's. The buttons stay over a
dialog's scrim (wincap.js undoes modalBackground's inert on them). The
Mac, Linux, the tray panel and the web page are unchanged.
TestCoreScriptBudget: +27 on both budgets for the one import line in
app.js, past the 29 bytes of room there were; the rest lives in
wincap.js and app.css.
Run (mote, at this tree on origin/main
|
||
|
|
261f482260 |
gui: Disconnect and quit puts the agents back for the next start, which connects them again (jtbbtnt54249 on X)
jtbbtnt54249, on LolingVerse's agy thread: "很多都这样,退出有时候又要重新开启".
Several agents' switches were off after quitting magpie and had to be
turned on again by hand.
Looked for a shared path that flips agents off. The row's switch is
Wired() alone, and nothing automatic disconnects an agent except a
removed plugin, the gateway pause (which reconnects on resume) and
Put agents back when quitting (which reconnects at start). The quit
question's Disconnect and quit, though, ran each row's Disconnect,
which leaves the disconnectedKey mark: every agent it listed stayed off
at every start after, and RewireOnStart skips a marked agent. Users
choose it so their agents work while magpie is closed, not to leave
magpie for good.
Now Disconnect and quit posts quit/disconnect (quitDisconnect), which
runs agent.RestoreOnQuit on the agents the question lists: their own
files back, no mark, recorded in quit.restored, so the next start's
RewireOnStart connects them again, the setting on or off. This covers
every agent the question lists: every detected agent wired to magpie,
built-in, plugin and WSL ones alike. A failure answers an error naming
the agent and magpie stays open. Its tooltip says magpie connects them
again when it opens (en, zh, zh-TW, ja, de).
Run at this tree (parent
|
||
|
|
139a6be2bb |
gui: a pin in the title bar keeps the main window on top (NovaStudiosss on X)
NovaStudiosss wanted to watch Usage and Routing while working in other apps. The main window's toolbar now has a pin between Refresh and Settings. A click keeps the window above other apps' windows (Wails SetAlwaysOnTop through POST /api/window/ontop?on=1|0) and saves it as settings.json's onTop, which this computer keeps for itself (KeepOwn, not synced). makeMain opens the window pinned on the next start, and boot.js shows the pin pressed before the first paint. There is no pin in the panel, in a browser's page (magpie web) or under Wayland, where always-on-top is ignored (GDK_BACKEND=x11 keeps it). A refused pin goes back up. Tooltips "Keep on top" and "Stop keeping on top" are in every language. A Settings save keeps onTop (settingsapi.Merge), which a test showed was lost before. Run (rebased on |
||
|
|
923cc8747f |
routing: filtering groups reuses indexed lookups and cards (liu-kan, #6744)
Ported from liu-kan's routing_mod_filter branch at 5aca86598 (#6744). Typing in the Routing groups filter re-ran every member's lookups as a linear .find over all models, deciders, drawers and accounts, and redrew the whole page each keystroke. Now a lazy index (Maps built first-match like .find, splitMember and memberInfo cached, search text cached per group and locale) is rebuilt whenever `groups` is reassigned (it never is mutated in place) and dropped 5 minutes after both Routing pages are hidden. The filter's input redraws only the group list from cached cards, falling back to a full draw when groups or the locale changed. No look, matching or saved config change; no new strings; app.js untouched (client.js is outside the core budget). Measured (mote, Playwright, 4000 models, 20 groups x 20 members, 16 keystrokes, ms per keystroke incl. layout): chromium: before mean 4767.6 / median 5086.3, after 0.37 / 0.2 webkit: before mean 4813 / median 5075, after 0.88 / 1 Run: - go test -count=1 ./internal/gui/ on |
||
|
|
b0d634b850 |
routing: Expand picks how far the stage opens, models or accounts (ipsikent on X)
ipsikent asked on X for a setting for how deep the Routing page opens:
often only which model a route uses matters, not which provider's account
it went to. Expand, at the end of the stage's top line, opens a menu
(openProtoMenu) with Automatic (as before: long lists folded, short ones
open), Models (two or more accounts or keys of one provider fold into the
row naming the model, and start folded) and Accounts (every fold starts
open). Models and Accounts open every group in the group. The pick is
kept in localStorage magpie.routingDepth; picking one forgets the stage's
remembered folds, so every row follows it at once, and a row clicked
after it is kept as before. Accounts and keys isn't changed. Display only:
the gateway's choice of seat is untouched.
It sits in the stage card's top line, not the page head: in the head it
pushed Hide accounts onto a second line at 420px in English. "Expand" is
in the core dictionary, since i18n-keys finds the word in plugged.go.
Run (mica, at this tree on
|
||
|
|
5bccfb4ef2 |
usage: a table's provider with several accounts is one folded row; an empty Account column is left out (#6740, jay68xu on X)
jay68xu on X: the Usage page gets hard to scan with many providers and accounts. This change covers the table view only, as the issue's comment asks. In the Allowances table (Usage > Overview, Table), a provider with several accounts is now one row. The row shows the chevron, the provider's icon and name, "N accounts" (a string every language already has), and each window column's mean share over the accounts. A failed read counts for nothing in the mean. The provider's accounts sit under it, folded until the row (or its button, with Enter or Space) is clicked. Each provider's open state is kept in localStorage magpie.quotaTableOpen, the way the cards' folds are kept. A provider with one account is one row, as before. Sorting orders accounts within a provider, then providers by their mean (window columns) or by their first row. The Account column is left out when no row names an account. Window columns and Other already appear only when some row has one. There is no motion: a toggle redraws the table, and the chevron turns. app.js is untouched (quotatable.js loads lazily), and there are no new strings. Run at this tree (base origin/main |
||
|
|
dd89f12556 |
gui: the no-activate hook's handle is swapped atomically, and the Windows exit doc says what the unhook leaves to endProcess (#6705)
On top of wizd's unhook (#6705, afe3b3ff7, kept as authored with its test): noActivateHook becomes an atomic.Uintptr that unhookNoActivate swaps to 0, so the three places that unhook (OnShutdown, the main-thread window's WM_DESTROY, Run's return) take it off once without a racy read-then-clear. Nothing hooks it again: hookNoActivate runs its SetWindowsHookEx under noActivateOnce, and noActivateHooked stays true after the unhook. 07dfd0bb8's endProcess (TerminateProcess on itself) and awaitExit are kept and the gui-shell doc says why: they still cover the other DLL detaches, an os.Exit while the app runs (Wails' fatal error, which this unhook doesn't reach), and an update from a version before the fix. Exit paths reviewed: Quit (tray, page) runs Wails' cleanup, whose shutdown tasks run on the main thread (InvokeSync), so OnShutdown unhooks on the hook's thread before Run returns into endProcess. A restart to update quits the same way. Wails' SingleInstance os.Exit in a second instance comes in application.New, before any window exists, so no hook is on. SIGINT/SIGTERM in the app go to Wails (ownSignals), so through OnShutdown. The handover's quitBy exitNow is Mac/Linux only. Run at this tree on base |
||
|
|
7ce93508f0 |
gui: unhook noActivateHook before process exit on Windows (#6705)
Two full-memory dumps on Windows 11 (magpie.DMP on v0.1.4196 and magpie2.dmp on v0.1.4185) show why ExitProcess throws in exitsyscall and wedges with one thread left (#5922, #6678, #6705): 1. hookNoActivate installs a thread-local WH_CBT hook (noActivateCBT, Go callback #93) on Wails' main thread and never unhooks it. 2. When the process exits through runtime.exit(0) -> ExitProcess (for example from Wails' SingleInstance handover os.Exit, Wails' fatal os.Exit, or before 07dfd0bb8's endProcess), runtime.exit(0) acquires runtime.finlock and enters ExitProcess via runtime.stdcall with g1.syscallsp set. 3. Inside ExitProcess -> RtlExitUserProcess -> LdrShutdownProcess -> RtlpFlsDataCleanup -> msctf!CicFlsCallback -> msctf!SYSTHREAD::DestroyThreadMessageWindow -> win32u!NtUserDestroyWindow, Windows dispatches HCBT_DESTROYWND (nCode=4) to noActivateCBT on the main thread. 4. noActivateCBT calls w32.CallNextHookEx, whose nested Go syscall clears g1.syscallsp = 0 on return. When cgocallbackg then calls runtime.exitsyscall, gp.syscallsp < sp triggers 'fatal error: exitsyscall: syscall frame is no longer valid'. 5. runtime.fatalthrow.func1 calls runtime.exit(2) on the same thread (m0), which attempts to lock runtime.finlock a second time and self-deadlocks forever while still holding Wails' single-instance mutex and WebView2 profile handles. Fix: unhook noActivateHook (w32.UnhookWindowsHookEx) when Wails' main-thread window receives WM_DESTROY in appWndProc, in OnShutdown, and when Run returns. TestUnhookNoActivatePreventsExitDeadlock reproduces the exact FLS window-destruction callback on ExitProcess's last thread: without unhookNoActivate the child process throws 'exitsyscall: syscall frame is no longer valid' and wedges with 1 thread left; with unhookNoActivate (or WM_DESTROY on the main-thread window) it exits 0 cleanly. Fixes #6705 |
||
|
|
028b07b4bd |
routing: a folded fold of accounts on one plan shows its bar in the app (Sdsi134a on X)
Sdsi134a on X: on the Routing stage, "Command Code Plan · 3 accounts" folded said only "3 available", with no quota, though the accounts are on one plan. foldQuota ( |
||
|
|
862660144e |
gui: a page's tabs in the sidebar fold from its own row, with a disclosure chevron (hkwok06 on X)
Opening Settings unrolled its tabs in the window's sidebar and nothing said they would fold again; only opening another page (the gateway) put them away. The open page's row now carries a quiet disclosure chevron, as a Mac sidebar's: turned to its list while the list shows (down for the pages above, up for Settings, whose list opens above its row), and clicking the row or the chevron again folds the list and unfolds it, the page staying open on its tab. A list folded stays folded, per page, until it is opened again (localStorage magpie.navFolded). The same holds for Usage, Library and Plugins. The chevron is muted, turns in 200ms on the strong ease-out, and doesn't move under prefers-reduced-motion. aria-expanded says the state; Enter on the focused row toggles it too. The chevron and the fold live in navicons.js (navFoldRows, navFold), imported with the first list; app.js keeps 123 bytes (navList shared with navMine, the two rows' clicks asking navFold first), with the budgets raised by that and the reason in core_budget_test.go. Run (mote): - nav-sub-fold.test.cjs (new), chromium + webkit, en zh zh-TW ja de: red on the old code (12 of 12, "Settings' row shows a disclosure chevron"), green 12 of 12 on this change. - After rebasing on origin/main |
||
|
|
1ac137e100 |
update: a version found is downloaded at once, not when Update is clicked
canlee886 on X (11-13, again 11-15): with downloads automatic, magpie
showed a new version and downloaded it only after a click on Update.
0.1.4051 made a click go into the copy downloaded and waiting, but the
clock's check (byClock) also kept that copy, so every version out after
it waited for the click: the pill said Update while the newest had never
been fetched. A failed download likewise waited, as a pill to click, for
the next 6-hour check, and a "found" version stayed found when downloads
were turned back on.
Every check that finds a newer version now downloads it with downloads
automatic: the clock's (5 s after start, then UpdateEvery), Check now,
the Version row's refresh and a page asking for notes in another
language (relang now starts the clock's check when the feed names a
newer version). A newer one replaces the one waiting. Only a restart's
check and the update dialog's (keep: recheck, freshen), a restart
waiting for the gateway to go idle (waiting) and downloads on a click
leave it, so a click on Update still restarts at once.
One download at a time stays (begin refuses a check meanwhile); such a
check now sets again (supersede), and the feed is asked again once the
download is in, so a newer version found then takes its place. The
minute loop fetches what was left (fetchDue): "found" once downloads are
automatic, and a failed download (error with retry) after 30 minutes.
docs/subsystems/gui-shell.md has the rule (When an update downloads).
Tests: TestUpdateClockLeavesWaitingDownload, which held the old rule, is
now TestUpdateClockFetchesNewerThanWaiting; new TestUpdateFetchDue,
TestUpdateCheckDuringDownloadTakesNewer (one download in flight at most)
and TestUpdateWaitingRestartKeepsItsDownload.
Broken by hand: putting u.byClock back in the keep-staged condition
turns TestUpdateClockFetchesNewerThanWaiting red (0.1.12 out, still
0.1.11, 1 download); supersede as a no-op turns
TestUpdateCheckDuringDownloadTakesNewer red (never took 0.1.12);
fetchDue false for found turns TestUpdateFetchDue red; dropping
u.waiting turns TestUpdateWaitingRestartKeepsItsDownload red (0.1.12, 2
downloads).
Run at this tree on
|
||
|
|
93762f968a |
usage: small, idle clients fold into one Other row
WJaunita45604 on X: test runs leave dozens of randomly named clients of
~10K tokens each in the Usage page's Agents list, and the page crawls.
renderUsage draws every Agents row again at each refresh whose summary
changed, at ~0.1ms of DOM and layout a row: with 400 clients a redraw
took 30-54ms in Chromium and 45-66ms in WebKit, with 2000 136-178ms and
224-246ms (probe at 1200px, Bun/SiYuan/translate-web and N clients).
A client not hidden folds when it is past the 5 with the most tokens,
under 1% of the period's tokens, and either made no call in the last 3
days (the agent group's new `last`) or is past the top 20; two or more
fold, or none do. No setting. Other sits at the list's foot with the
folded groups' sums (usageSum), so totals stay exact, and opens with a
click, Enter or Space; open, it draws the folded rows with their own
actions 100 at a time (Show {n} more). Closed they aren't drawn at all:
with 400 or 2000 clients a redraw now fits one frame (~13-20ms in both
engines), as with none.
Run at
|
||
|
|
07dfd0bb8f |
update: a magpie stuck in its exit on Windows no longer holds the restarted one (BESTLJP0412 on X)
BESTLJP0412 on X (Windows 11 26200, 0.1.4179 to 0.1.4193, WebView2 157):
after an update's restart the window stayed "Not Responding", and a
process with a single thread sat on port 3425 and the WebView2 profile.
A Go process has several threads while it runs; one left means it is in
ExitProcess (os.Exit on Windows), which ends every other thread and then
runs each loaded DLL's detach on the last one. A detach that waits for a
thread already ended (WebView2's, COM's) never returns, so the old magpie
never ends, its handles stay open, and the new one waited its 60s
(awaitGone), went on beside it, and hung on the held port and profile.
Both ends fixed:
- the old one: cli.Main ends through endProcess, on Windows
TerminateProcess on itself instead of ExitProcess. Everything magpie
writes is written by then; the kernel closes every handle and no
detach runs.
- the new one: awaitGone's wait for the old magpie (awaitExit) looks at
its thread count every 250ms; one thread for a second is a magpie stuck
in its exit, and it is ended (opened with PROCESS_TERMINATE). This is
what fixes the update from 0.1.4193 and older, which still exit through
ExitProcess.
docs/subsystems/gui-shell.md says how a Windows restart waits and ends.
Tests (Windows, real processes; the stuck detach is a fiber-local storage
callback set to kernel32's Sleep with INFINITE, which ExitProcess runs on
its last thread and TerminateProcess doesn't):
- cli TestEndProcessSkipsAStuckDetach: first checks the stand-in is real
(os.Exit there hangs with exactly 1 thread left), then that
endProcess(3) ends with code 3. Broken by hand (TerminateProcess taken
out): red, "endProcess hung in a DLL's detach, as os.Exit does".
- update TestAwaitGoneEndsAMagpieStuckInItsExit: a predecessor stuck that
way is ended in ~1.4s. Broken by hand (the thread check skipped): red,
"the start went on after 20.022s with the old magpie still stuck".
Run:
- win-run on xiaomi-gpu (Windows 11): go test ./internal/cli ok (179s);
./internal/update all ok but TestPackagedByDpkg, red the same on
origin/main
|
||
|
|
1edebf0500 | tray: a card with more than two windows shows them all, in columns of two (jen_celeus on X) | ||
|
|
221c91fae3 |
gui: the gateway card opens the chat page
The gateway card gets a "Chat page" button beside Restart gateway while the gateway runs. It opens <gateway>/deepseek-chat/ in the browser, or, in web mode, the public URL's chat page. Both buttons sit in one .gw-acts group, so a narrow card wraps them together, and Restart keeps its .gw-fix class (the takeover, pause and port-holder tests read the first .gw-fix). The label is translated in zh, zh-TW, ja and de. Run: gateway-chat-page.test.cjs in Chromium and WebKit, every language, at 1100 and 420 wide, on mica: ok. It is red without this change (no button). At |
||
|
|
47684ef176 |
usage: a table column is what its windows are of, not their names
normalcoder_ on X: in Usage > Overview's table, Antigravity's
"Gemini · 5 hours / 7 days" landed in the last ("Other") column, since
columns were keyed by window name. That holds for every provider whose
names don't match the column keys.
columnOf keys a pooled window to its pool's column (poolWord, "Claude &
GPT" under Claude) and names the window in the cell; any other window
goes by its span (spanOf: "Weekly", "7 days" and "7d" share a column,
headed by the name most rows use, a number on a tie); a window with no
span goes by its name.
Run (mote, chromium + webkit, en zh zh-TW ja de, 1100 and 420px):
usage-account-subcards.test.cjs 40/40 here, 40/40 red on origin/main
|
||
|
|
2a6ab83d8a |
usage: each account of a provider's card is a card of its own; the ⋯ keeps its room
normalcoder_ on X (v0.1.4079, Usage > Overview): accounts inside a provider
card were told apart by a hairline only, and the card's ⋯ was drawn over
the end of the head ("Show the other accounts in brief" was hidden).
- renderQuotas puts each account of a card with several into a
.subscription-acct box (a provider's keys, a balance a line, stay
lines); quotaCardMenu looks through the box for the account's head.
- The head keeps 18px for the ⋯ whether it shows or not; where nothing
hovers, the ⋯ is always shown.
- Core budgets +57 (app.js) / +81 (core): renderQuotas draws every card,
so there is no page to move it to.
Run (mote, both engines):
- usage-card-menu-room.test.cjs: 20/20 here; red 20/20 on origin/main
|
||
|
|
cfd70c60c2 |
update: the old pill quiet ran through 0.1.4181, not 0.1.4179
Comments and docs only: v0.1.4180 and v0.1.4181 were tagged before
|
||
|
|
3f09b9ffc6 |
update: the header's Update pill shows a waiting update at once; only its x holds it, for 3 days (visamzh, normalcoder_ on X)
visamzh (0.1.4174, 0.1.4176 downloaded, Update button and Automatic updates on) and normalcoder_ (0.1.4079) saw no Update pill for about two days. Cause: |
||
|
|
90efddabae |
gui: providers can be picked and removed together (eiyuuzaki2333 on X)
Many API providers added meant removing them one at a time. Select, by
the Providers search box (shown with two or more), puts a box on every
row as Routing's groups and Library's lists have it: a click on a row
picks it rather than open its editor, Shift picks the rows shown
between, and the bar's box picks every row shown. Remove asks once, in
the app's own dialog, with the count and every name, then posts
POST /api/providers/delete {ids}. That runs provider.Delete for each
id, as the editor's Remove does, inside one agent.Reseat, so agents
move once, to where they end up. One it can't remove comes back in
`unremoved` with why, stays picked and is named in the status; the call
is refused only when nothing was removed. Done or Escape ends picking.
The rows, bar and removal are in pvpick.js, imported when Select is
first clicked. The core grows 270 bytes (pvSel, the button's click and
two lines in renderProviders), and coreScriptBudget is raised by that
with the reason. "{name} wasn't removed: {error}" moves from Library's
words into core i18n.js, since core code says it now.
Run (rebased on origin/main
|
||
|
|
1ab2c39843 |
tray: the menu bar and panel leave out what Usage's Overview hides (onkashiko on X)
onkashiko on X: a quota hidden in the main window still showed from the menu bar. |
||
|
|
61e2035d39 |
gui: a Windows start no one can answer is never asked where to install, so the gateway comes up (v0.1.4160-4166 release check)
Every magpie-releases build from v0.1.4160 to v0.1.4169 failed windows-check (amd64 and arm64) at "Launch magpie": the exe logged "magpie 0.1.4166 started (app, ...)" and the gateway never answered, so none of those versions has assets. Cause: |
||
|
|
ee6352b638 |
gui: black's dark page is #000000, and a dark colour darkens the page in its hue (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS on X (tweet 2121543612278472704), on the dark theme: 「现在的纯黑……感觉色对不上」 beside Chrome's black, and the darkest navy of the system's picker 「感觉是有浅灰存在,所以导致深变浅」. Their screenshots: black's page (2,1,7), Chrome's (0,0,0); navy #191047's page (24,23,29), card (31,30,36), the grey of Graphite's. Why (appearance.go ground()): - the dark grounds went down by the same amount on every channel, so app.css's cool grey cast stayed: black's page was #000003, its card #08080c, a blue-black next to Chrome's #000000; - how dark a pick is was its mean channel against the page's. #191047's mean (37) is above the page's (27), so a deep navy counted as light and only got a breath of hue (0.08): the same grey page as Graphite. What changes: - darkness(): a pick's OKLab lightness under 0.4 (Graphite #52525b is 0.44, every preset 0.51 or more) is how far the dark grounds go toward black; 1 for black. #191047 is 0.23, so 0.43. - as a ground goes down it loses the grey's cool cast by as much, and takes more of the pick's hue (0.08 + 0.25 x darkness). Black's page is #000000 with neutral steps above it (card #090909); navy's page is a near-black navy. - Graphite, the presets, colours lighter than 0.4 and the light theme are unchanged; lifted() (where the ink starts) is unchanged. Measured (Settings > General zh, dark, 1200px; screenshot pixels, the same in Chromium and WebKit), before -> after: - black: page #000003 -> #000000, card #08080c -> #090909 - #191047: page #191821 -> #0c0b17, card #22212a -> #151420 - #130830: page #17161e -> #0b0813, card #201f27 -> #14111c - Default, Graphite (#1a1a1e / #232327), teal, #7f1d1d: unchanged Tests: - TestDarkPickDarkensPage: black's grounds are neutral greys; three dark blues draw a darker, blue page with text >= 7:1 and the accent >= 4.4:1; Graphite and the presets have darkness 0. - TestBlackIsBlack: black's page is #000000 exactly. - appearance-look: black's dark page is rgb(0, 0, 0); #191047 draws a dark navy page with Settings' list on its card (dark), and keeps the light page's lightness (light). Fixture gains #191047. Run on mote (load ~22-35 over its 18 cores; mica's disk is full, 116MB free), at this change on origin/main |
||
|
|
14807bcf20 |
update: a Windows download kept outside Downloads asks to install too
@XBJNTMs2mDbsvPH on X: on Windows magpie ran from wherever the
downloaded exe was and updated itself in place there, so deleting the
download deleted magpie, and opening copies of different versions left
several Magpie entries in the Start menu.
Cause: update.Settle installed the exe into %LOCALAPPDATA%\Programs\magpie
only when it ran from the known Downloads or Desktop folder or a temp
folder. A browser set to save elsewhere (D:\下载), or a download moved
into a folder of the user's own, never counted, so that copy stayed the
app, updated in place, and each copy opened was an app of its own to
Windows (its own path: taskbar, Start's lists, Open at login,
Magpie.lnk repointed at whichever ran last).
Now an exe still named as the site's download
(magpie-windows-amd64.exe, "… (1).exe", arm64; downloadName) counts as a
download wherever it is, but only through the existing install dialog,
never unasked (no dialog, no install). Installed, it opens the installed
copy as a download in Downloads does, and a newer one replaces it.
Cancel on such a copy is kept in HKCU\Software\magpie NotInstalled (the
exe's path): it runs where it is from then on, is not asked again and
never forwards; another copy is still asked. Cancel in Downloads is not
recorded, as before. forwards() (no magpie.com beside a forwarding
copy) follows the same rule. Uninstall's ForgetInstallDir takes the new
value out with InstallLocation. A renamed copy (D:\Tools\magpie.exe)
is left alone as before. No new UI: the dialog is the one from
|
||
|
|
7ea1e6a4b3 |
usage: the tray panel and the TUI leave out what the Usage page hides
onkashiko on X: a provider whose allowance card was hidden in the main
window (Usage > Overview, "Hide from Overview") still showed in the menu
bar's panel. The panel's Allowances tab had only its own Arrange list
(panelUsageHidden) and read the full cards.
Now the panel leaves out a card whose cardHideKey is in usageCardsHidden
and the rows in usageWindowsHidden (withoutHiddenRows), as Overview does;
a menu bar cell's card still shows (panelPeek). A subscription whose
every card the page hides counts in the foot's "{n} hidden" and shows as
hidden in Arrange; Show there
also drops its keys from usageCardsHidden, since the panel follows the
page. All of it is panelPageCut in the Usage plugin's page.js, which every
window loads, so the core scripts get no bigger (TestCoreScriptBudget
unchanged). Hiding from the panel alone still leaves the page as it is. The
panel reads settings again each time it is shown (loadBack), so a hide or
unhide in the main window reaches it with no restart.
Siblings: magpie tui's Usage page leaves out the same cards and rows
(usageShown, read at every quota read). The menu bar's cells and tooltip
show only the cards picked in Settings, so they keep a hidden card as
before; routing, caps and counting are unchanged.
Run:
- panel-page-hidden.test.cjs (new): chromium + webkit, en/zh/zh-TW/ja/de,
10/10 green; red on the old app.js/panelarrange.js (cards still drawn).
- TestUsagePageLeavesOutWhatTheAppHides (new): green; red on the old
pages.go (balance, account and row still listed).
- GUI: the 128 files that read the panel, Usage or tray code, chromium +
webkit, every language, on mote: 17 files red, rerun alone at
concurrency 1 here 123/449 red and at origin/main
|
||
|
|
90ad90646a |
gui: black draws a black dark theme, not Graphite's grey (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS, on v0.1.4124 (tweet 2121468612238266666), with three dark-theme screenshots of Settings > General, one each with Default, Graphite and a custom black picked: 「这三个颜色……都显示是一样的」, 「尤其是黑色始终一直是灰色」. Their screenshots show the same page in all three: ground (25,25,27), card (32,32,34). Why: - v0.1.4124 tints the grounds with the pick's hue only (base + k*(c - mean(c))), lightness kept. Black and Graphite have no hue, so they changed nothing. Default draws no look at all (magpie's own). - accentOn lifts a dark pick toward white only until it reads at 4.5:1, so black's dark ink came out #8a8a8a, next to Graphite's #89898f. What changes (appearance.go): - ground(): on the dark theme, a pick darker than the theme's background darkens every dark ground by as much (depth()). Black draws a black page (#000003), with cards, pills, lines, menus and the tray panel the same steps above it as in app.css (card #08080c, line #18181e). Graphite, and any colour as light as the ground, draw as before. - lifted(): black's ink starts most of the way to white, so it is a light mono ink (#e0e0e0, dark text on its buttons), not Graphite's grey. On the light theme black is #000000, as before. The sibling, white on the light theme, now gets a dark ink instead of a mid grey. - The light theme's grounds keep their lightness: a white pick would melt its white cards into the page. - app.css: a swatch's edge and the chosen ring take a little of the text's ink, so the black swatch stays seen on the black page it draws. - Default stays magpie's own look (grey grounds, indigo accent) for every user. Not changed here. Tests: - TestBlackIsBlack: black's dark page is black and each ground keeps its step; Graphite moves nothing; black's ink is light in dark (>= 1.8:1 from Graphite's) and #000000 in light; white's light ink is dark; text reads >= 7:1 on black's grounds. - appearance-look.test.cjs: "Default, Graphite and black are three looks", light and dark, both engines: three different --accent values; Graphite keeps the grey page; in dark, black's page is black, Settings' list sits on black's card a step above it, its ink is light; in light, black is #000000 ink. - TestLookFixture's fixture gains #000000 and #52525b. Run on mote (mote was unreachable for ~20 minutes; the red check ran on mica), at this commit rebased on origin/main |
||
|
|
27c998aba0 |
usage: the tray panel's and Requests' costs follow each provider's currency
onkashiko on X: with Currency set to By provider, the menu bar panel still showed every cost in one currency; providers and models were not each in their own. drawLedColumns and drawLedRank (shared by the tray panel and the window's Requests tab) formatted every value with no provider, so fmtCost fell back to the Totals in currency. - usageapi.Ledger echoes the provider a page is filtered to (`provider`, omitempty). - app.js: ledProv(l, split, id) names the provider of a value: the ledger's filter, the row's provider (provider split), the provider part of a modelAt id, or for a model split the provider(s) that served it when they all share a currency. ledFormat/ledFormatLong take it, so the rank's values and sub-lines, the tooltip's rows and the axis (when one provider is picked) are in that provider's currency. Sums (the panel total, the tooltip total, a model served in two currencies) stay in the Totals in currency. - page.js: the Requests head and the cost head use the filter's provider; the heatmap tip too. Other fmtCost calls are sums or sessions with no provider and are unchanged. - core script budget +491 (1,269,040 -> 1,269,531): drawLedColumns and drawLedRank are drawn by the panel, so there is no lazy page to move this to; packed to the shortest form. - docs/subsystems/gui-shell.md says how By provider reaches the panel. Run: - At 065fb6a8b (rebased on |