ea3d1c62e7eebc8e080a07b65f97facc3cebcb53
202
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
11d9d0a3a5 |
routing: each account one calm cell in Accounts and keys (danzi002 on Discord)
danzi002 (v0.1.2945): Accounts and keys "显示的好乱啊,没有之前一目了然". |
||
|
|
532d054bee |
sessions: every Cursor row has a delete, and the right-hand column lines up
ysm119 (Discord), Sessions page, Cursor tab: some rows had a delete and
some had none, and the time / "N sessions" column stood at a different x
from row to row.
Causes:
- Delete: listAgentWith set Deletable = Deletable(agent) && !ReadOnly, so
every editor-transcript row (read only) came back deletable:false, and
client.js drew .sm-del only for deletable rows.
- Alignment: a folder adds its ⋯ only when it has actions, and a session
row's Resume / terminal / Continue in / delete come and go per row, so
.sm-when, .cost and .num moved with them. "Copied" is wider than
"Resume", and at <=600px the cost line wrapped at different places.
Change:
- rowDeletable decides per row. An editor transcript the editor no longer
keeps (no state.vscdb, or it was read and has no composer for that id)
is "loose" and deletable: Delete trashes only its <id>/ folder or
<id>.jsonl/.txt, never state.vscdb. A chat the editor keeps, or a store
that can't be read, stays undeletable with undeletable:"cursor-editor".
- In an agent magpie deletes from, every row has its delete. One it can't
delete is aria-disabled, says why in its title, and a click shows the
reason in the status line and sends nothing (en, zh, zh-TW, ja, de).
- A row without Resume, Continue in or a terminal, and a folder without
its ⋯, keep that room with an inert, aria-hidden slot. Resume reserves
the wider of Resume and Copied; at <=600px the cost keeps a min width.
- docs/subsystems/gui-shell.md says so.
Run (on mote via mote-run, base f44fa2ef6; origin/main 93d5c76c0's 3
commits since touch none of these files):
- go test ./internal/sessions: ok. go test ./internal/gui: ok except
TestMainWindowCorners/macOS_26_SDK, an AppKit titlebar red on macOS 27
already filed as #3949.
- gofmt -l clean; go vet native, GOOS=linux -tags nogui, GOOS=windows ok.
- New sessions-cursor-align.test.cjs: 10/10 (chromium + webkit x en, zh,
zh-TW, ja, de; widths 1100/660/420, hover, Copied).
- Sessions GUI set (sessions-*, session-*, gateway-conversations,
gateway-mode-sessions, account-mask-sessions, header-session-hint,
routing-session*, routing-ctx-sessions, usage-session*, i18n-keys,
gui-de, gui-ja, gui-zh-tw): 728/728, and 728/728 again after the
rebase onto
|
||
|
|
70a98dd85c |
routing: a long Accounts and keys shows its first rows, the rest behind Show N more (ferock4669, iyou00 on Discord)
With many keys the Routing page's Accounts and keys ran on and on: each card held every window, the models it answered and a meter. Now a card keeps its name, one line of what is left (or its rest) and how it fares, with Try now or Sign in again when it needs one. The models it answered are in its tooltip under its id, and a subscription's other windows are on hover over its figure. A list longer than 8 rows shows the first 8 and puts the rest behind "Show N more" at its foot (kept across a reload in magpie.routingActsAll). Never behind it: a row to sign in again, a resting account or model, failures with no answer, a remote whose allowance can't be read, rows under a fold the reader opened, and the heading of a provider with a row shown. Two more alone aren't folded. The button clicked stays where it is on the screen. "View usage" beside it opens Usage's Overview, where each account's card says it all, without making that tab the reader's own (window.openUsageOverview). The foot writes only what changed, so an idle page writes nothing (routing-live-calm). Tests: routing-acts-compact.test.cjs (new; chromium and webkit, en zh zh-TW ja de, 1300px and 420px). routing-account-windows, routing-read-allowances, routing-wallet-lapse, routing-accounts-narrow and routing-columns follow the card's new shape and the foot. Run on mote via mote-run, worktree based on origin/main |
||
|
|
14f6d10de0 |
routing: a remote's Claude card whose read failed says so on its row, not nothing (yi_time on Discord)
remoteWinsOf ( |
||
|
|
c7bbd3faf6 |
routing: a Claude joined over the network shows its windows in Accounts and keys (yi_time on Discord)
A remote magpie's provider row on the Routing page showed no usage, while the subscriptions above it did. The remote's cards already reach the window as /api/usage/quotas entries with `from` set (provider = <remote id>/<card provider>), but the page's cardOf/winsOf match only kind "account" with no `from`. remoteWinsOf (plugins/routing/client.js) now draws those windows on a remote-magpie row: a claude-* model row gets the remote's claude cards, gpt/codex/o\d rows its codex cards, each window prefixed by the user when several cards match. When the remote's read failed it says "Allowance unavailable — hover for why" with the error as the title (existing string, all languages), never 0. The usage comes from the machine that owns the account; no gateway change. Run (mote, no Go change): - routing-remote-windows.test.cjs (new; 5 languages, widths 1100 and 420, chromium and webkit) and routing-account-windows.test.cjs at ec697e692 on origin/main 07f02d0d9..: 44 pass, 0 fail. - Broken by hand: render call removed, and the model-family filter removed; each took the new test to 0 pass, 11 fail. - Full go test -timeout 45m ./... at ea1aab179 (same client.js, rebased on |
||
|
|
d1fa254b1d |
gui: masked words and Never mask are a list, a row per word (noahhrreion on Discord)
noahhrreion: "希望脱敏词选项可以做成真正的列表,在一个小输入框里面不方便管理多个脱敏词". Settings → Privacy's Masked words was one comma-separated box. It is now a list (wordList in plugins/redact/settings.js): each word is its own row, edited in place (Enter or leaving the row saves, Escape puts it back, emptied is removed), × removes it, and the last row adds. Its sibling, Never mask under the mask actions, had the same box and gets the same list. Stored values are unchanged: redactWords and the allow list are still string arrays, saved through the same savePrefs / settings/redact-allow calls, and nothing is rewritten on open (the new test checks that opening the page saves nothing). Typed or pasted text splits as the old box did (, , and newlines, trimmed, empties dropped), so a pasted "a, b" is two rows. The Hide eye still shows every row as dots. New strings are in the redact plugin's i18n for zh, zh-TW, ja and de; the two old "separated by commas" hints are gone from the core i18n. The site's masking docs (en, zh, ja) say a row each. Run (on mote via mote-run, Chromium and WebKit): - new redact-words-list.test.cjs: 5 languages × 1100/400px × both engines, draw, add with Enter, paste-split, edit, Escape, ×, empty-and-Tab, reload; with i18n-keys 24/24 ok - redact-words-hidden, any-case, whole, mask-actions, redact-route, redact-kinds, redact-shape, settings-search, settings-sections, settings-lines-wrap, settings-hints, settings-groups, readable-focus, masking-records, mask-alert: 378/378 ok - go test ./internal/gui/ -run 'TestCoreScriptBudget|TestSettings': ok (app.js shrank; no budget raised) - screenshots light/dark, 1100/400px, both engines, looked at Broken by hand: without wordFocusBack (focus kept across a redraw) the new test goes red (waitForFunction timeout after the first add). Dropping the blur guard during a redraw (wordsRedrawing / isConnected) stays green in both Playwright engines, which fire no blur on removal; it is kept as a guard for engines that do, with no test that fails without it. Not tried: the real app on WebKitGTK / Windows WebView2; no Go files changed. |
||
|
|
6673171595 |
update: the app and magpie web follow each other's update (visamzh on X)
visamzh on X: with the desktop app and magpie web both open, an update
from either side left the other still offering it ("↑ 更新") until it was
quit by hand.
Cause: the app and magpie web are two processes over one program, each
with its own updater (state, download, latest) in memory. One restarting
to update puts the new binary in; the other is told nothing. Its
replaced() (the binary on disk is no longer the one it started from) was
read only on a click of its own Update or on magpie update's gateway ask
(restartBeside), which reaches only the process serving the gateway. And
a browser's page reloaded (backAsNew) only after a restart it asked for
itself, so magpie web's tab kept the old page and its pill even once
the process under it was new.
Fix:
- followReplaced (update_beside.go): every updater stats its binary each
5 s and, once another magpie replaced it, restarts into it through
restartBeside, once: at once when idle, else after the gateway's
requests (waitIdle), as for magpie update's ask. Not for what this
process put in itself (installed, set by install, cleared by
wontStart), not twice (followed), not for a build that isn't a release
(make dev, go build rebuild in place). It stops with backendCtx, so a
copy left draining after a handover doesn't look.
- waitFor (update_wait.go): a wait for the gateway restarts into what
another magpie put in whatever the feed says now; before, a feed out
of reach or a "latest" answer ended the wait with nothing restarted.
- boot.js names the version that served the page (bootPrefs.version);
app.js's servedAnew reloads a browser's page (web) when /api/update's
current names another, on the reads it already made (load, focus, back
into view) and once a minute while shown. The app's own windows come
back with their new process and are left alone.
- docs/subsystems/gui-shell.md describes it.
Run (mote, through mote-run, at
|
||
|
|
7033f50722 |
gui: the panel opens the main window from its edge nearest the tray
isaac_bai on Discord, after v0.1.2857 named the header's icon "Open the
main window": with Windows' taskbar at the bottom, the panel stands above
the tray and its header is the panel's whole height from the icon; the
button left of Quit was where his pointer already was. yogurt36 had asked
for one opener, not two, so the panel still has exactly one, now on the
edge nearest the tray:
- Hung below its icon (the Mac's menu bar, a taskbar or bar at the top)
it is the header's icon, as before.
- Standing above it (Windows' bottom taskbar, a bottom panel on Linux) it
is "Open the main window" left of Quit in the foot (#openMain), and the
header has no icon. The string is the one the icon's name already
uses, in all five languages.
Which side: once togglePanelNow has placed and shown the panel,
tellPanelSide reads the panel's bounds and its screen's and sends
magpiePanelOpenAt("foot") when the panel is nearer the screen's bottom,
"head" otherwise (panelOpenAt, panelside.go; the Mac is always "head").
Under Wayland a window can't read where the compositor put it, so there,
and until the app says, layout.js sets body[data-open-at] by the system:
"foot" on Windows, "head" elsewhere. CSS shows one of the two from it.
Tests:
- TestPanelOpensTheWindowFromTheEdgeNearestTheTray: Windows bottom/top
taskbar, a tall panel, a second screen above the first, Linux X11
bottom/top, Wayland, a screen not read, the Mac, unknown places; only
"head" or "foot" reach the page.
- TestPanelToldItsSideWhenShown: both show paths in togglePanelNow call
tellPanelSide after placing; app.js has magpiePanelOpenAt.
- panel-open-once.test.cjs, Chromium and WebKit x en/zh/zh-TW/ja/de:
on a Mac platform exactly one opener, the header's, named per
language, opening /api/window/main, foot ["profBtn","quit"]; told
"foot" it moves. On Win32 exactly one opener, the foot's, left of Quit
(["profBtn","openMain","quit"]), the foot's buttons fitting apart with
their words whole at 360px, opening /api/window/main; told "head" it
moves back; an unknown side changes nothing.
Run on mote via mote-run:
- At this head (rebased on
|
||
|
|
b088fd0f09 |
gui: the panel's header icon is named "Open the main window"; a double-click on the Windows tray icon opens it
isaac_bai on Discord missed the "Open magpie" button beside the quick panel's Quit, and was setting the tray click to open the main window just to get back to it; he asked for a double-click on the tray icon. History: the foot's button (#openMain) was taken out on purpose in |
||
|
|
af55a7917f |
tui: quitting where magpie opens at login says how to have the gateway handed on (#3756)
With #3372, Open at login on Linux reads a package's own autostart entry in $XDG_CONFIG_DIRS (nixpkgs ships one). JoeyWu-tech's #3756 asked what `magpie daemon install`'s guard and `magpie tui`'s hand-off as it quits should count on a box no desktop logs into (NixOS-WSL, a server over SSH), where nothing ever starts that entry. Decided: both keep counting what Open at login shows (autostart.Enabled). A session check can't tell (an SSH login into a desktop box has no DISPLAY either), and counting less than the switch shows would install the service beside an app the desktop does start. The install already refuses with "run `magpie autostart off` first", which is the way out. The terminal's quit only said "the gateway stopped", with nothing about why or what to do; it now says magpie opens at login and serves it then, and that `magpie autostart off` has magpie tui hand it on where no desktop logs in (atLoginNote). Off Linux and with nothing connected the note is as before. What was run (wsl-run, magpie-desktop Ubuntu 24.04, go1.26.8): go test -tags nogui -count=1 ./internal/autostart ./internal/daemon ./internal/testenv ./internal/tui: ok With keep.go as before (the test kept): TestKeepGatewayAsTheTerminalQuits red, "app at login: ... the gateway stopped with magpie tui; ..." gofmt -l: nothing Not tried: a real NixOS-WSL login; mtul0729 ran the #3372 patch on real NixOS + COSMIC, at the systemd generator's level. Batch run, at tree 104d75f0a (the twelve coffemon ports together, on origin/main |
||
|
|
ab25a2317b |
autostart: on Linux the switch follows a package's own entry (#3372)
mtul0729, packaging magpie for nixpkgs (#3372, COSMIC on Wayland, v0.1.1334): a package that ships its own autostart entry ($XDG_CONFIG_DIRS/autostart/magpie.desktop, /etc/xdg when unset) has magpie open at login, but enabled() read only $XDG_CONFIG_HOME/autostart, so Open at login said off over it. Off removed a user file that wasn't there, and the package's entry went on starting magpie. On wrote this copy's own path over the package's entry: under a package manager a versioned path, gone once the package is upgraded and collected. The package doc says the switch "can't say one thing while the system does another"; on such a system it did. Now, as the XDG Autostart spec has it: - The entry that counts is the user's, else the first of the $XDG_CONFIG_DIRS folders (/etc/xdg when unset or empty) that has one. A relative folder has none, as the spec says, and neither has a file listed there, a folder this user can't search or a name too long, which systemd's generator and GLib can't open either. The user's own folder listed there too, by any name (os.SameFile, so /home linked to /var/home too), is still the user's. - An entry is read as GLib's key file and systemd's parser read it: the keys of its [Desktop Entry] group alone (a [Desktop Action]'s Exec is not the entry's), spaces around = and CRLF lines as any others, the last of a key given twice, true or 1 for Hidden. It opens magpie when it is an application (Type=Application) with an Exec other than true (below), not Hidden. - X-GNOME-Autostart-enabled=false (or 0) reads off too, as the issue asks. GNOME's and Cinnamon's sessions read it; systemd's generator (KDE's and COSMIC's sessions under systemd) doesn't, so there such an entry reads off while it starts. - Off, over a package's entry that some desktop starts, writes an entry of the user's that hides it; that includes one GNOME has off, which systemd's generator still starts. Otherwise off removes the user's entry, as before. On, over a package's entry that starts magpie, removes the user's entry and writes no path; otherwise (no package entry, a hidden one, or one GNOME has off) it writes this copy's entry, as before. The hiding entry is "[Desktop Entry] Type=Application Name=magpie Exec=true Hidden=true". A session holds back the entries of a name only once it has read one, and each reads differently (from their source): - gnome-session (main and 42.0) and cinnamon-session load an entry with g_desktop_app_info_new_from_filename. GLib (main, g_desktop_app_info_load_from_keyfile) refuses one with no Type or Name, or whose Exec names a program it can't find, and the session skips an entry it can't load, so the package's starts. - mate-session's egg_desktop_file_new refuses an application entry with no Exec, and the entry then takes no app id. - cosmic-session without systemd never reads Hidden: it starts what Exec names, and takes the name once that ran. - systemd's generator (main, xdg-autostart-service.c) reads Hidden first, and hides an entry it can't parse, which still holds back the rest. true is on every system by that name, so each session reads the entry, and COSMIC's runs true where it would have run magpie. A copy of the package's own Exec would stop holding the package's back on GNOME once its store path is collected. With this box's GLib 2.72.4 (Ubuntu 22.04's) and 2.84.2 (anaconda's), through ctypes: Exec=true and no Exec load, hidden; an Exec naming a store path that is gone, and a bare "[Desktop Entry] Hidden=true", don't load. An entry that runs true opens nothing, so it reads off: XFCE's Session and Startup lists the hiding entry as magpie, unticked, and ticking it there writes Hidden=false into it (xfae-model.c), which runs true, not magpie. On takes it away for the package's. What is no entry, and what can't be read: a path where no regular file is (a folder, a link that leads nowhere or round in a loop) is no entry, as systemd's generator and GLib pass over it, and on leaves a folder there alone. A file that can't be read (EACCES, EPERM, EIO) counts and starts nothing, as systemd's generator has it; GLib passes over it, so where the first entry is unreadable GNOME starts the next folder's while Open at login reads off. Any other failed read, magpie out of files or memory, says nothing of what the desktop reads at login: Set returns it and writes nothing, and Open at login reads on, as the package's doc has it for a system that can't be asked (Windows' Run key that can't be read is not a no either). The user's entry is written where the desktop reads it. A link there (to magpie's launcher, which install.sh writes, the usual way to have an app open at login; or into a read-only store), or a hard link, is replaced by the entry, not written through: edit.WriteAtomic writes a link's target, and a hard-linked file in place, so off over a package's entry would have left the launcher running true, and failed over a read-only target with the switch still on. Main's enable() wrote through such a link too, when on was asked over one (a linked launcher already reads on); it goes through the same write now. Old entries: a user entry an older magpie wrote stays and still counts over a package's, as before. The switch reads on over it, so in the app taking it away is off, then on; `magpie autostart on` does it in one step. One whose store path was collected reads on as well, though systemd's generator starts nothing for it and still holds the package's back, so on COSMIC or KDE magpie doesn't open while the switch says on; GLib passes over it, and GNOME starts the package's. The daemon and the terminal: `magpie daemon install` refuses while magpie opens at login, so the app and the service don't both serve the gateway, and `magpie tui` quitting hands the gateway on (keepGateway, |
||
|
|
9019ca88d6 |
gui: Scroll to top and Scroll to bottom move when the page under them changes, not only on a scroll (Jiabubu)
Jiabubu on Discord: with the capsule in sight, a click that opened a
Routing group left it over the editor's member rows (Remove beside Up
and Down) and its held Cancel and Add, and it moved off them only once
the page was scrolled.
scrollends.js placed the capsule on a scroll, a resize, focus or the
pointer leaving it, and a hidden attribute set anywhere. Opening a group
in place sets none, unless something else on the page happened to be
hidden again in the same draw (an empty pool list is, on every draw,
which is why the earlier tests saw it move). It now also watches the
open page and each of its own children with a ResizeObserver, and the
page's child list, so any change of size under it (a group opened or
closed, rows added or taken out) places it again on the next frame: it
rises above a held foot, steps aside at the page's foot, or comes back.
One file serves every page with the capsule (Agents, Providers, Routing,
Library, Settings, plugin pages), so they all take it. No core script
changed; scrollends.js loads lazily and has no budget.
view-ends-relayout.test.cjs: with no scroll after the change, the capsule
must be where the reader's next scroll puts it, and over nothing of the
editor's:
- Routing, 16 groups of the reporter's rows ("低-ultra", 922K), a pool in
the list: a screen down, a click on the card lowest in sight opens its
editor; then Cancel closes it.
- Agents, 40 rows: a little above the foot, a block at the list's end
taken out so the foot comes up under the capsule.
Desktop 1100, 700, 560; browser page 1100, 440, 360; Chromium and WebKit,
en/zh/zh-TW/ja/de.
Run on mote (mote-run) at this tree:
- view-ends-relayout, both engines, every language: 10 of 10 ok.
- On
|
||
|
|
0872bc2a0e |
context: a request's text and reply from the request archive (wangbinyq)
wangbinyq on Discord: with the request archive on, clicking a block of
the context window card still said "只保留最近 10 个请求的原文", since the
card read only the last 10 bodies magpie keeps in memory.
What changed:
- /api/context/text tries memory first, then the request archive's copy
when the route names one (Route.Archive, the route found in the trace
or in the history file of the card's ?day=, HistoryRoute looks a day
either side). gateway.ArchivedPromptText parses it as PromptText does
and masks it through maskedCopy, as the body in memory is; it is
marked from "archive" and the card says so.
- New /api/context/reply: the reply to the request, from the Recent
calls (Server.ReplyBody) or the archive's Response. gateway.ReplyPieces
reads it into thinking/assistant/call pieces (conversationOutput, split
out of conversationTurn) after redact.ScrubJSON, and masks every piece
through maskedCopy. The card's text view has a Reply button beside
Close that shows it and goes back to the part.
- What is shown is what the archive stores, masked as the memory copy
would be, nothing more. A body or reply that can't be masked shows
nothing (404 "unread"); one the archive cut short isn't parsed ("cut");
one it names and doesn't have says so ("missing"), and one with no
archive copy keeps the old "only the last 10" line ("off"). A failed
bucket read is an error, not "gone".
- The archive read is capped at archiveReadMost and the last copy read is
kept 5 minutes, so the items opened one by one read it once.
- ctxtext.js takes the route (id and time) instead of the id; context.js
passes it (its one-line change paid for by a comment cut, core budget
not raised). New strings in zh, zh-TW, ja and de.
- docs/subsystems/gateway-routing.md (Prompt) and gui-shell.md.
Run on
|
||
|
|
84da86ebd5 |
gui: Hide accounts is one switch for every page, window and the panel (paultian)
paultian on Discord (#feedback): Routing, Usage and Providers each kept their own "Hide accounts" state, so turning it on in one page left the others showing emails. Now window.hideAccounts is one switch, one localStorage value (magpie.maskEmails), behind #rtMask, #usageMask and #pvMask alike. Flipping it in any page applies to every page at once, and a storage event carries it to other windows and the tray panel. The old magpie.maskProviders value is folded in on first load (hidden if either value was on) and then removed, so nobody who hid accounts on one page sees them shown after updating. The tooltip and the Settings line now say "on every page" instead of "on this page", in every language. Tests: provider-mask.test.cjs checks that one switch hides accounts on every page and in a second window, that the state survives a reload, and that an old maskProviders=1 comes through as hidden. account-mask's expected tooltip text is updated. Run on mote (GUI files at base 05aba5ca4; the Go asset/budget tests again at this head after rebasing on |
||
|
|
b295d11965 |
serve, update: one magpie works the gateway; the service waits, the copy an update left stops (#4938)
ox01024's #4938, Bug 2. Two magpies did the gateway's work at once on a Mac: - launchd's com.yetone.magpie.serve ran `magpie serve` beside the app. It ran startUp (plugin Settle/Refresh, FoldCopies, Hold, the agent moves), the plugin host and every account's model fetch, then failed to bind, exited 1 and was started again 5s later: 6,035 times in two days, a 279MB serve.log, and logins.json.lock held against the app's requests until they went 504. - The copy an update left (.magpie-update/old) handed the socket over, hid, and lived on ~3h, its loops writing beside the new one. What changed: - cli: `magpie serve` (no --web) checks codexrelay.Leave, gateway.ServedBy and gateway.Taken before startUp, as the app's serveGatewayLocked does. While the port is held it prints one line and looks again every 15s, doing nothing else. Once the port is free it serves (serve_wait.go). It waits rather than exiting 0: under KeepAlive SuccessfulExit:false a clean exit would leave no service after the app quits. - gui: after a handover the old magpie's loops end with backendCtx: - library.KeepLinked (now takes a ctx), - provider.WatchQuotas, - the menu bar usage loop, - the updater's check/auto-restart loop. lighten lets its hidden webviews go as lightweight mode does, so their polls stop. quitBy exits it at handedOffDrain + 3m whatever holds its quit up (gateway.HandedOffDrain getter; exitNow stubbable). - docs/subsystems/gui-shell.md says both. Run at the pushed head on mote (mote-run): - gofmt -l internal/: nothing. go vet ./internal/{cli,gui,library,gateway}; GOOS=linux go vet -tags nogui and GOOS=windows go vet of the same: ok. - go test -count=1 -timeout 45m ./internal/cli ./internal/library ./internal/gui ./internal/gateway at |
||
|
|
eb779ce92a |
gui: the tray icon's tooltip is in magpie's language (yi_time)
yi_time in #feedback: magpie set to Chinese on Windows, and the tray
icon's hover tooltip said "Today: 121K tokens (2.9K in · 180 out ·
118K cached)" and "3 requests" in English. The tray menu already
followed magpie's language (trayLang, #301); the tooltip's words were
hard-coded English in trayusage.go.
Now every tooltip is in trayLang(settings.Lang, systemLang), on
Windows, macOS and Linux alike. That covers trayIdleTip, magpie's
totals (trayTotalCard), and each subscription card (trayCardText: its
use or what is left, the pace, when it resets, until's d/h/m, "as of
…"). The words are in trayWords beside the menu's, for zh, zh-TW, ja
and de; English stays the key and the fallback. A window's name and an
error are still the card's own. A change of language in Settings now
also refreshes the tooltip (onTrayUsage); before, only the menu was
relabelled. The test-only trayUsageText and trayUsageView stay in
English, so the existing tests keep their strings.
Test: TestTrayTooltipFollowsMagpiesLanguage.
- yi_time's own numbers in zh: "magpie\n今天:121K token(输入 2.9K ·
输出 180 · 缓存 118K)\n3 个请求".
- The same numbers in en are unchanged.
- Covers the total card and a card's used, left, reset and as-of.
- For zh, zh-TW, ja and de, no English word in the idle, totals, card
(with pace) or combined tooltips.
Run at this head (rebased on
|
||
|
|
5ec2375688 |
gateway: a call's HTTP headers both ways, masked, folded under its bodies
usrname1833 on Discord asked to see the raw request and response HTTP headers (查看原始请求和原始响应的http头), to debug as with a capture. magpie kept the client's request headers and its own response headers only in the request archive, and nothing of what went upstream. Now a call keeps its headers both ways (internal/gateway/wire_headers.go): - the client's, as they reached magpie: headerLogged in Handler() clones them for every request that isn't a GET, HEAD or OPTIONS; - each request magpie sent upstream for the call: method, address, headers, and the answer's status, protocol, headers and time, or the error. rpmTransport (under s.client) records it as it is sent; provider.SendsThroughPlugin records a plugin account's hand-off, shown as handed to the plugin, since the plugin's own request to its vendor is made in Bun and magpie doesn't see it (the view says so). The first 8 tries are kept, the rest counted. Recording copies each header map; nothing is masked or sorted as a request goes. Secrets are taken out when the headers are read (Call.Headers): by what each header is (new redact.SecretHeader, now behind redact.ScrubHeader: Authorization, cookies, x-api-key, api-key, any *-Key, *-Token, *-Secret, *-Auth, *-Signature, but Idempotency-Key and a count of tokens such as anthropic-ratelimit-tokens-remaining), any Bearer or Basic value, and redact.Scrub on the rest; an address loses its password, a secret-named query value (?key=) and its fragment. They live with the call in the 40-call ring; /api/gateway/call gives them as "headers". The request archive keeps the upstream ones as "upstream" beside the request's and response's headers, masked the same way. No body is stored that wasn't before. GUI: under a recent call's bodies on Gateway and a request's on Routing, "HTTP headers" folds open the client's headers, then each upstream request beside its answer (wireHeadersView, plugins/usage/page.js); the archive's copy shows its upstream requests too. Strings in all four languages. docs/subsystems/gui-shell.md describes it. Also changed by SecretHeader: the request archive no longer masks a rate-limit count header (…-tokens-remaining), which the old name rule took for a token. (provider.SecretHeader, which backups use, is another function and unchanged.) Tests: TestRecentCallHeadersBothWays (a fake vendor; the client's key and cookie, magpie's upstream key and the vendor's Set-Cookie all masked; status, protocol and response headers kept), TestRecentCallHeadersEachTry (a 429 then the next key, both kept in order), TestPluginHandOffHeaders, TestScrubURL, TestSecretHeaderRealNames (real header names both ways), TestArchiveOnThisComputer and TestRecentCallBodiesOnDemand extended, call-headers.test.cjs (Gateway, Routing and the archive's copy; chromium and webkit; en at 1100px, zh, zh-TW, ja, de at 380px and Routing at 440; nothing out of the box, no left-border accent). Run (on mote, macOS 27.2, through mote-run, unless named): - Full suite at ebd22b1b4 (the same change on |
||
|
|
d5dc8eeccc |
gui: Scroll to top and Scroll to bottom on a long page (emo172)
#1090 (emo172) asked for back-to-top and back-to-bottom buttons on the main pages. Once a page is scrolled more than one window down, a small capsule with two buttons, Scroll to top and Scroll to bottom, fades in. It sits in the page's right margin when a wide window leaves one, and otherwise over the page's corner, above Providers' sticky Add buttons. It stays hidden near the top of the page, while a dialog is open, and (over the corner) at the page's foot, where the last row can't scroll out from under it, unless it has the pointer or keyboard focus. The page's own height never changes for it, because app.js's scroll guard measures that height. A press goes through scrollOnPurpose, so the window's scroll guard takes it as the reader's own scroll. It scrolls smoothly, or at once under reduced motion, and the button at the end it already reached is aria-disabled. Both buttons are real buttons, reachable by Tab, with a label and tooltip in en, zh, zh-TW, ja and de. They are drawn from the window's tokens in both themes, with no gradient and no coloured edge. scrollends.js is imported on the window's first scroll, so the core scripts carry one line in app.js, paid for by two comments cut from the scroll guard's. No budget was raised. old-webkit lists scrollends.js among the lazy scripts. docs/subsystems/gui-shell.md says where the capsule sits and when it shows. Run on mote at this head (on |
||
|
|
18c69aa467 |
gui: Windows reads the screens with one callback, not one per display change (1111_13879)
1111_13879 on Discord: on Windows the app died after a few hours with
"fatal error: too many callback functions", taking the gateway with it
(clients got connection refused). Five dumps all ended in
w32.GetAllScreens -> syscall.NewCallback -> runtime.compileCallback,
from Wails' WM_DISPLAYCHANGE handling.
Wails (v3.0.0-beta.24 here; v3.1.0 and v3.2.0-nightly.20261101 are the
same) reads the screens again on every WM_DISPLAYCHANGE, and on
WM_SETTINGCHANGE for SPI_SETWORKAREA, through w32.GetAllScreens, which
passes a fresh closure to syscall.NewCallback each call. Go never frees
a callback and throws past about 2000, unrecoverably.
magpie now sets WndProcInterceptor (screensWndProc): on Wails' hidden
main-thread window ("__wails_hidden_mainthread") it takes those two
messages before Wails does, enumerates the monitors with one callback
made once at package level (allScreens), builds the screens exactly as
Wails' processAndCacheScreens does (wailsScreen) and hands them to
Screen.LayoutScreens, then answers as Wails would (DefWindowProc for
WM_DISPLAYCHANGE, 0 for WM_SETTINGCHANGE). Other windows and messages go
on to Wails. Wails' one read at start-up is the only per-call callback
left. No go.mod change: no newer Wails fixes it, and magpie has no fork.
Other per-call NewCallbacks in Wails' Windows code: w32.EnumChildWindows
and w32.SetWindowsHookEx, neither called by Wails or magpie. WndProc
classes are registered once; the WebView2 COM vtables are package-level.
magpie's own (internal/agent apprestart) is already made once.
Run at this tree (base e156fdd03; origin/main since adds only
|
||
|
|
ed978e560f |
gui: the Quit question's Don't ask again, and Settings › General › Ask before quitting (zhujiu on Discord)
zhujiu (Discord #feedback) asked for a 不再提示 on the question a tray Quit asks while agents go through magpie ( |
||
|
|
70b96126ef |
gui: a provider's editor grows with a large window (5046312 on Discord)
5046312 on Discord: in a large, wide window the provider editor (Codex's, with its accounts, meters, cap pill, switches and many option rows) stayed a 600px box in the middle, cramped, and asked for a better layout or a resizable sheet. drawEditor's editor now carries `roomy`, and openModal copies it onto #modal's dialog as it already did `wide`. `.modal .dialog.roomy` is min(max(600px, 56vw), 880px, 100%): 600 up to a 1071px window, then 56% of it, at most 880, as a Mac sheet takes the room its content needs. Its height already follows the content up to the window, so no new height rule. A question that takes the editor's place in the same dialog (Sign out's forget-ask, Disconnect, ...) drops the class and stays 600. No drag handle. The rows themselves are unchanged. Every provider editor (subscriptions, keys, new providers, presets) goes through drawEditor. The core-script budget is not raised (7 bytes under). Sizes (chromium, en; width x height of the dialog): window before after 2560x1440 600 x 1228 880 x 1038.5 1440x900 600 x 810 806.4 x 810 1100x800 600 616 1024x768 600 600 560x420 512 512 390 web 374 374 Run at the pushed tree (this commit on 019b308f1; the whole-suite runs below at earlier bases, editor-roomy, i18n-keys and the budget tests again at |
||
|
|
f9595e7684 |
gateway: System One requests are kept in the request archive, and Routing says when the archive is on (wangb on Discord)
wangb on Discord: 「请求存档开启, 但是 systemone 的请求没有记录下来」. The Routing page then said "magpie 只保留最近 40 个请求的请求体和响应体… 要保留 每个请求的,请在「用量 › 请求」顶部打开「请求存档」", as if the archive were off. Why: only serve() made an archive wire (archiving). The two System One paths never reached it: - /v1/systemone, which an app sends (serveDecideTries, also used for a decision group), opened a Route but recorded no Call. It was in neither Recent calls nor the archive, so the Routing page could never open its bodies. - the question a routing group's Jev classifier asks for a turn (askJev / jevLevelled -> systemOne -> postDecide) only appended a usage row. What changed: - serveDecideTries captures its reply, makes the wire as serve does, names it on the Route from the start (Route.Archive), and records a Call (Route, status, error, fallbacks, usage, bodies) when it ends. So the call is in Recent calls and, with the archive on, in the archive. Its usage row carries Archive. - systemOne keeps the call magpie made itself through a new archiveOwn. It keeps the request as it went (method, path, the headers magpie signed it with, the body in the provider's shape) and the answer, with secrets scrubbed as for any call. Its "routing" usage row names the archive entry. postDecide became postDecideSent, which also returns the request it sent. archive's queueing moved into queueArchive, which both share. archiveID makes the name. - Routing's "Request and response" for a request in neither the ring nor the archive: with the archive on (gateway.archive.on in /api/providers) it says the archive is on and this request isn't in it (made while it was off, or not saved). It no longer says to turn the archive on. New string in zh, zh-TW, ja and de. - docs/subsystems/gui-shell.md says which calls are archived and which still aren't. Still not archived (unchanged): Codex's own backend (codexUpstreamOn), draw, embeddings and video side routes, and replies magpie writes itself (answeredHere). Masking makes no outgoing call. Chat classifiers and Codex titles to a model already go through serve and are archived. Run on mote at base |
||
|
|
1a864f156e |
usage: a hidden card a menu bar cell showed offers Show in Overview, not Hide again
Found while fixing yuu003348's report ( |
||
|
|
dee1afa400 |
usage: what is hidden from the Overview can be found again (yuu003348 on Discord)
yuu003348 on Discord: "观测/用量/概览 从概览中隐藏 后 无法取消隐藏". The way
back was there: a "{n} hidden" line under the cards (#quotaHid), each row with
Unhide, Show all from two. But it was drawn in --faint (#b9b9c2 on #f4f4f6,
1.77:1, 11.5px), so it couldn't be found; the Agents list's line (ikunbots on
X) is the same class.
- app.css: .us-hid .us-hidline is --muted (3:1 or more in light; ~5:1 in
dark by the tokens), for both lines.
- plugins/usage/page.js: while any are hidden, a card's menu and an Agents
row's menu end with "Show {n} Hidden". It opens the line under its list,
puts the keyboard on it and brings it into sight on the menu's click
(openHidden, scrollOnPurpose). hiddenQuotas() is the one count both the
line and the menu read.
- i18n: "Show {n} Hidden" in zh, zh-TW, ja, de.
- docs/subsystems/gui-shell.md says both.
- usage-cards-hide / usage-agents-hide now expect the new item when
something is hidden already.
Run (mote, node --test):
- usage-hidden-way-back.test.cjs (new): chromium and webkit, en/zh/zh-TW/ja/
de, 1200, 560 and 390 (touch long-press): 2 of 2 ok (32 cases).
- 130 Usage/menu/tray GUI files: the only reds the change made were
usage-cards-hide and usage-agents-hide's exact menu lists, now updated.
Every other red there is red at origin/main
|
||
|
|
e44ad72cfd |
gui: a failed status dot is an x, not a red dot alone
coolmantou on Discord (#feedback), who is red-green colour-weak, could barely tell the green status dot from the red one. Under a deuteranopia or protanopia simulation the two are one olive colour, in light and dark. Making the green lighter would not help a greyscale or protan reader, so the failed state now says it by shape (Apple HIG: never colour alone). What changed - app.css: a --x-mark token (an SVG x, used as a mask). Each failed dot keeps its red and its 6-7px box, is drawn through the mask and scaled 1.5 so it reads as heavy as the round dot. Layout is unchanged. Dots: Test models (.tdot.bad), an agent's status (.ag-st.bad .ag-dot), the check-in (.ci-dot.bad), the request ledger (.led tr.bad .st .dot). - routing.css: a try or probe (.rt-req/.rt-probe.bad .to i), a step (.rt-steps li.bad::before), the preview (.ps-dst.bad > i). - library.css: a server that failed (.lib-health.err::before). A ring was not used because "not checked" is already a ring there (#2308). - Not changed: green-only dots with no red pair (gateway, keys, tiles, live), chart markers, routing's animated packets, redact's categorical facet dots. The tray has no status dots of its own. - docs/subsystems/gui-shell.md says it beside "State is shown with a dot". Tests - status-dot-shape.test.cjs (new): for all 9 pairs with the real stylesheets, in chromium and webkit, light and dark, 980 and 420 wide: the good dot has no mask, the failed one has the x mask and the good one's box, and its pixels have ink on the arms and centre and none above the centre. - library-mcp-health.test.cjs: its "a dot, not a stripe" check now expects the x for a failed server and a round dot for the rest. Run at the pushed head (mote, via mote-run) - status-dot-shape + library-mcp-health: 16 pass, 0 fail (chromium and webkit). - go test -run 'Asset|CSS|Budget|Compress|Revalidate' ./internal/gui: ok. - At |
||
|
|
89ffc58f5b |
gui: a card's Refresh says the read's failure, and Claude Code's first-run screens say what to do (#4817, uiuing)
From uiuing's branch (1eeb8928b, 66818dbf6), adapted. A usage card's
Refresh showed nothing when the read came back as a card with an
error: only a thrown request reached status. quotaRefresh now says the
refreshed card's error through quotaError, for a single account and
for a provider whose cards were replaced (the one kept in quotas).
quotaError reads the helper's new "stays on its first-run screens" and
an older magpie's "shows its first-run notes" as "Finish Claude Code's
first-run setup, then refresh", in en, zh, zh-TW, ja and de. Comments in
quotaError and quotaRefresh were cut so the core scripts stay in their
budget (1,533,732 of 1,533,802; main was at 1,533,780), with no raise.
Run at the pushed head, on mote: node --test of claude-quota-onboarding,
quota-refresh-order, usage-card-refresh, usage-refresh,
usage-refresh-flight, account-refresh, editor-quota-quiet,
usage-no-reading, usage-remote-cards, tray-usages, glm-quota-error,
claude-usage-asked, allowance-open-read, api-key-usage,
key-balance-card, copilot-signed-out-account, signin-again, plugin-git
and i18n-keys (chromium and webkit, every language each file runs, 440px
where it sets it): 287 of 287.
go test -run 'Budget|I18n|Lang' ./internal/gui ok.
go test -run "Claude|TUI" ./internal/gateway ok. The full
./internal/gateway (-timeout 45m, before the rebase onto
|
||
|
|
16ce5ed232 |
usage: an account whose longer window is used up adds no headroom to the all-accounts sum (#4791)
hayden4608 (Discord) and handong66 (#4791) have four Codex accounts. Three show 5 hours 100% left with 7 days 0% left, and one shows 5 hours 0% left with 7 days 22% left. The All accounts strip read "5 hours 75% left", but none of those three can spend its 5 hours until its week starts again. The right figure is 0%. mergeQuotas (quotaall.js) is the one place that sums windows across accounts. It feeds the Usage page's strip, the tray panel's strip and the Routing groups' line. The native menu-bar tray, the TUI, the CLI and /v1/magpie/quotas show one account at a time and are unchanged. The GUI's JSON doesn't carry Aside, Model or the matches, so the call is made in Go. provider.WithHeldWindows marks a window heldBy another window of the same account when that other window: - stops the account for every model, by routing's rule: not aside, no model, no matches, used >= 100, reset not passed, and not Codex credits that go on; and - starts again after this one (by reset times, else by span). So 7 days used up holds 5 hours, but 5 hours used up doesn't hold a week with 22% left. /api/usage/quotas and its refresh apply it. mergeQuotas counts a held share window as 100 used and a held counted one as its limit, and the strip's tooltip says how many were counted that way (en/zh/zh-TW/ja/de). The account cards still show the vendor's own figure. Run on mote (macOS) at this head's parent tree: - go vet for darwin, linux (nogui) and windows: ok; gofmt -l: none. - go test -count=1 ./internal/provider ./internal/gui, before the quota_span leftOut line and an i18n comment fix. The provider package's only red was TestQuotaSpanCarriesEveryWindowField, which wanted heldBy named, and it is now named. internal/gui's only red was TestMainWindowCorners/macOS_26_SDK, which is #3949. - GUI, chromium and webkit, every language, 440px and 360px: quota-*, usage-* (all-accounts, merge, accounts, fold, refresh and more), panel-usage/quota/switch-accounts/balance-order, routing-quota-left, routing-group, tray-usage, i18n-keys, gui-de/ja/zh-tw, old-webkit: 704 of 707. The reds were i18n-keys (a quoted "All accounts" in window_held.go's comment, fixed here) and usage-fold's "17 subscriptions and 29 accounts" in both engines, which is #4790 and is red at origin/main too (see below). At the pushed head, rebased on |
||
|
|
da275848b6 |
tray: Windows shows a card's number in its icon (Benjaminliang_1 on X)
Windows' notification area shows no text beside an icon, so with a card in the tray the icon itself is now the first card's figure: the first row of the first card whose first row is a percentage, used or left as Allowance display has it, its digits alone (trayIconFigure). It is drawn in Segoe UI Semibold (Go's bold if the font can't be read) at SM_CXSMICON, white on a dark taskbar, near black on a light one, as tall as fits, centred by its ink, three digits narrowed into the square (trayNumberIcon). It is drawn again when the figure, the icon size or the taskbar theme changes (SystemThemeChanged wakes the loop); the tooltip still lists every card. A balance or magpie's totals are skipped; with no such card, or no cards at all, the icon is the bird as before. Settings > Usage > Tray icon number (settings.TrayNoNumber, Windows only, on by default, kept per computer) keeps the bird when off; Menu bar windows is now shown on Windows too, since it picks the row the number comes from. The number row sits after Menu bar cost, so the bird > pace > cost order the other tests pin holds. Linux and the Mac are unchanged. New words in zh, zh-TW, ja and de. app.js stays in the core budget with one comment shortened, no raise. Run at this commit on origin/main |
||
|
|
8826a15ea4 |
gui: a Quit while agents go through magpie asks first, naming them (Aisiverto on X)
Aisiverto on X (Windows, v0.1.2519) wired Codex to magpie and quit magpie. Codex then retried "unexpected status 502 Bad Gateway ... url: http://127.0.0.1:3425/backend-api/codex/responses" five times and gave up, and it took a long search to find magpie's openai_base_url in config.toml. A Quit the user chooses (the tray's Quit, the panel's and window's Quit, Command-Q on the Mac) now asks first when this process serves the gateway and agents are wired to it. The window comes up on a sheet (quitask.js, lazy-loaded) that names each agent cut off, says closing the window keeps magpie running (menu bar on a Mac, system tray elsewhere), and offers Quit (focused), Disconnect and quit, and Cancel. Disconnect and quit puts each agent back as its row's Disconnect does, then quits; a disconnect that fails keeps magpie open, named in the status line. A second Quit within a minute of the question quits, so a window that can't show it traps nobody. With nothing wired, or another magpie serving the gateway, Quit quits at once. Not asked: a restart to update, Uninstall, a browser's page (magpie web), logging out or shutting down, and the Dock's Quit (AppKit terminate:). Found while checking the report: - Closing the window on Windows hides it; magpie stays in the tray and the gateway keeps serving (tried for real, below). Not a bug. - Autostart is off by default on Windows. - The proxy / NO_PROXY in the report isn't magpie's to fix: the 502 is magpie's port with nothing behind it. Strings in en, zh, zh-TW, ja and de (existing terms: Agent, 退出). No native dialog, no <select>. TestCoreScriptBudget met without a raise: app.js gains two lines, the sheet is outside the core, and driftFix's comment block is cut to six lines (453 bytes back; main's core had grown to 258 bytes over with these lines in). Run, at this head (on origin/main |
||
|
|
57246b3818 |
usage: a provider's accounts together, and a routing group's (CryptoSarom on X)
CryptoSarom on X (tweet 2116797183207035245, the tray panel's Usage tab):
"能否支持合并用量和额度显示? 有时候更关心某个模型还能用多少 ... 同个供应商
同模型可以合并 ... 或者单个路由组单独显示用量和额度. 有需要关心账号限制
的时候可以进详情再去看".
What it does:
- A Usage card of several accounts has "All N accounts" under its head:
each window the accounts share, one figure and a thin bar, and how
many couldn't be read. The tray panel's group of several has the same
strip above its cards (at most 3 windows). Each account stays below it
as it was: the details are where they were.
- A routing group's row (Routing › groups) has a line for each provider
among its members: "WorkBuddy AI, 4 accounts: Credits 355 / 1,500
credits · 23.7% used · 1 couldn't be read", following Used/Left.
The design, and why:
- Only what reads alike goes together (mergeQuotas). Counted windows of
one name and unit add their amounts and limits, the share is of the
sum; wallets add balances in one unit. A window said only as a share
is the mean over accounts on one plan, whose allowances are the same
size, so the mean is the share of their allowance together; two plans
are never averaged, and a share is never added to a count. Text-only
windows are left out; unlimited only when every account read says so.
- An account whose reading failed is unknown, not 0 or 100: left out of
the figure and counted ("1 couldn't be read"). A window an earlier
reading (asOf) stands in for, past its reset, is left out the same way
and counted in its tooltip. No single reset is claimed for the whole;
the tooltip says when the first of them starts again.
- Only what two or more accounts have goes together: one account's
window is already below it.
- No switch: the strip is additive and quiet (no gradient, no coloured
stripe; the pill grey of the page, the accent bar the cards use), and
it names no account, so Hide accounts holds.
- The code is in quotaall.js, imported when a provider first has two
accounts (quotaAllJS) or a routing group's member has readings, and
each place is drawn again once it is in. app.js has the loader and the
two call sites; three comments in the quota code were cut to keep the
core inside its budget (1,533,096 of 1,533,105), no raise.
Run, at this tree (rebased on origin/main
|
||
|
|
f06551c277 |
gui: a closed window's page is told it is out of sight
A macOS orderOut hides the NSWindow but can leave its WKWebView document visible. The Routing page's frame loop and SVG animations therefore kept running in a closed window (20-40% Web Content CPU; reopening and closing returned it to 0%). Tell the page before every app-window hide and again on show. Compose that signal with WebKit's own hidden state, and pause CSS animations while out of sight. Verified with: - go test ./internal/gui -run '^(TestCoreScriptBudget|TestClosingWindowMarksPageOutOfSight|TestClosingHidesShownAccounts|TestPanelCloseHidesIt|TestPanelJoinsFullScreenSpaces)$' -count=1 - node --test internal/gui/tests/window-visibility.test.cjs (Chromium and WebKit) - the new JS test against v0.1.2049's app.js: it times out without the bridge - the new AppKit test with hideMain calling Hide directly: it times out without the visibility signal - go vet ./internal/gui - GOOS=linux CGO_ENABLED=0 go vet -tags nogui ./internal/gui - GOOS=windows CGO_ENABLED=0 go vet ./internal/gui The full GUI package still has unrelated environment failures in TestProxyCheckSaysAProxyPassedBy and TestMainWindowCorners on this macOS 27 setup. |
||
|
|
947377307b |
usage: the Sessions tab's token totals count the cache, as the Overview's do (#2591)
n1majne3 reports the usage totals ignoring the cache reads the same page
shows beside them. The Overview's totals have counted the cache on request
since #2378 (magpie.usageWithCache); the Sessions tab counted tokens in and
out alone wherever they showed: the tokens tile, a session's row in both
lists (the Usage page's and the Sessions page's, sessSpent), the projects
and models bars and pickers (sessSums, spent), the day chart's bars,
tooltips and calendar, and the top sessions. A reader who asked for the
cache on the Overview saw two different totals for the same period.
The tab now reads usageTokens everywhere, so the one pick decides for both
pages. Its tokens tile carries the same label pop-up and says the cache's
count in its line; a pick made there refreshes the tab it is on, not the
Overview. The chart's day and week buckets carry the cache's counts now
that their value reads them, and the top sessions, ranked without the
cache, are ranked again by the count the reader sees. The default stays
without the cache, as #2378 left it; the per-session median and p90 stay
counted in and out (Stats.Overview ranks them), and the Requests tab's
totals always counted every token (allTokens).
Run at
|
||
|
|
5dfbca6274 |
cli: magpie settings list|get|set|reset, through the window's own save (#4745)
Stage 1 of #4745 (StringKe): every setting POST /api/settings saves can be read and set from the terminal. - internal/settingsapi holds the save the handler made: Merge (the carry of keys a page leaves out, moved verbatim from api.go, plus upstream's RouterNote line), the vision/imageGen/searcher checks, settings.Save's own checks, catalog.Touched. POST /api/settings and `magpie settings` both call settingsapi.Apply, so a value is checked and saved one way. It sits outside internal/gui so the nogui build has it. - `magpie settings` (list, the default, with value, default and choices; get; set; reset to settings.Defaults()), --json on list and get. Body sends the whole file with one key changed, so a key the save keeps when absent (noBird, refusalRetries, ...) is set even to off. A flag where a key or value goes, an unknown key (with near matches named) or a refused value writes nothing and exits 1; --help prints usage. - Parity guards: TestKeysAreWhatTheSaveWrites (each Settings field sent changed on its own; what the save takes must equal Keys), TestSettingsCLISetsWhatTheWindowSaves (every key the page's prefsKeep and savePrefs send is a key), TestEveryRouteHasACommandOrIsNamed (each /api route has a command or a reason in notYet, which later stages shrink; 36 have one now). - Item 3 of the stage (per-provider CLI-only fields in the window) is left for stage 2. - The open app's in-process follow-ups (fonts, Dock, tray menu, alerts, language, update re-check) run only from the window's save: #4752. Run (mote, at the pushed head |
||
|
|
9097687a31 |
gui: Hide accounts leaves the user's own account names and plans in sight (#3656)
With Hide accounts (账号打码) on, the name a user gave an account (#1515) was blurred like the account, so faketrader's several Antigravity accounts couldn't be told apart; and an Antigravity account whose value is "Google" blurred "Google" of its plan "Google AI Pro" on Usage and on the Providers row. The name the user gave an account is shown text, not an identity. The account is. - provider: a card's Alias says whether it is the user's own name (SubscriptionQuota.Named, set by withAccountNames from AccountNameOf), since Alias is also a plugin's name for an account (PluginUserOf, a masked phone, #4416) or a seat's key plan, and the Usage page and tray panel may have no /api/providers to tell them apart. labelProvider is AccountLabelOf's "plugin:" lookup, shared. - app.js names(): the user's own names (accountNames) and named aliases are no longer accounts to hide; accountUsers, an unnamed alias and a seat still are (noteAccounts keeps an alias without named). - app.js mask(): labels are scoped by element, never by value (LESSONS: scope an exemption by where the value sits). In .own-name, .plan, .acct-plan (the Providers row's plan pill, new class), .model-value and .subscription-head > b only an address is hidden; a plan's and a model's tooltip too (TIPS). The own name's tooltip ("name · account") is masked in full. - .own-name is set only where the text is the user's own: the editor's rename span when it has one (else it shows the raw account and stays hidden), Usage's quota-alias and the panel's pq-user when q.named. From skygunner's patch (95c0511 on |
||
|
|
4c815ac2a5 |
search: searchers picked to follow the one named, tried in their order when it fails (axelburks on Discord)
axelburks asked for more than one searcher, so that when one fails another provider searches. A searcher named in Settings gave way to no other provider before, only to the Search APIs. Automatic already fell back to up to three. - settings: SearcherThen, the searchers after the one named. Entries are trimmed. Blanks, "off", the named one and repeats are dropped. - gateway: when the named searcher fails (the context still live), modelSearch asks each of SearcherThen in order and skips one that can't search now or is the same model. The first that searches answers, and the call is marked searchingInstead, so the Routing row says why the named one didn't search. If all of them fail, their errors go back together, saying "the searchers picked ..., in their order", and webSearch goes on to the Search APIs as before. SearchFailure.Instead names the one that searched in its place. - gui api: searchFailed.instead. A save takes only searchers that Searchers() offers. A save without searcherThen keeps the list, since the page's prefsKeep doesn't send it, and [] clears it. - Settings › Web search (plugins/search/settings.js, outside app.js's budget): an "If it fails" row under a named searcher, with numbered chips and Add. A chip's picker changes the chip or removes it. The row is hidden for Automatic and Off. The failure line names who searched instead, or says the ones after it failed too. The help text says the same in en, zh, zh-TW, ja and de. - docs: gateway-routing's failing searcher, and gui-shell. Tests: - TestPickedSearchersInTheirOrder (gateway): one test where the named searcher answers without searching and one where it fails. A gone entry and one that can't search are skipped, and the third searches once. With no working entry, the error says so and Instead is empty. - TestSearcherThenSaved (settings) and TestSearcherThenFromSettings (gui): what is saved, kept and cleared; refusing an entry that can't search. settings_keep_test sets SearcherThen. - searcher-then.test.cjs: chromium and webkit, en, zh, zh-TW, ja, de, at 560 and 1000 wide. Checks the row's place and words, what Add offers, the posted lists, that the chips fit with no horizontal scroll, that no click moves the page, and both failure lines. Broken by hand: running no fallback turned TestPickedSearchersInTheirOrder red (both subtests: "ds2 searched []"). Not keeping the list on save turned TestSearcherThenFromSettings and the keep test red. Run on mote (mote-run): - At the pre-rebase tree (base |
||
|
|
90c02326bb |
gui: an app takes the gateway over from its older copy once idle, and says any other version serving it (matrix0487)
matrix0487 on Discord: after an update, pi said 404 'magpie knows no model "kimi/k3.1-pro" ... add a provider in magpie first'. The app had written pi a model its older gateway didn't know, and updating the gateway fixed it. A magpie that finds another one serving the gateway used to log it and wait for that one to quit (watchGateway took the port only once nothing answered). Only the Gateway page said so. Now (otherServes, gateway_older.go): - An older released copy of the app (it says serves app or tray, and a pid) is this app's predecessor. Once its /v1/magpie/concurrency says nothing is in flight (gateway.ServedBusy; unknown is never idle), the app quits it the way the Gateway page's button does (quitMagpieOnPort: a magpie only, by its program) and serves the gateway. A stream through it runs to its end first. watchGateway looks again every 15s while another serves. At most three times a run; a quit that fails is left to the button. - Any other one (magpie serve or the service, magpie web, a TUI, a newer magpie, a build of its own) is left running. /api/state carries it as gatewayOther, and the Agents page says it above the list with what to do, plus the take-over button for an older one (gatewaySkewLine, in plugins/gateway/client.js so app.js stays under its budget). A dev build of this magpie says nothing. New strings in zh, zh-TW, ja and de. How the reporter's older gateway outlived the update isn't known: they never said whether one ran separately. A failed handover leaves the old app serving for up to 15m, and a magpie serve left running is another source. Both are covered now: the first is replaced, and the second is said. Known gap: a request that starts between the idle read and the quit gets the older app's short drain. A socket handover between two running apps (no gap) is not built. Run on mote at 0f8ea30bb (this change on |
||
|
|
3f2faef620 |
gui: the Providers page has its own Hide accounts switch
Routing's Hide accounts (账号打码) also masked the Providers page, where nothing showed it was on or let you turn it off (Discord #feedback, 1566189346665799752). The Providers page now has its own switch beside its search box, placed and drawn like Routing's (.rt-mask moved from routing.css to app.css), and each page follows its own switch: Routing, Usage and the tray panel follow magpie.maskEmails, Providers follows magpie.maskProviders. The user's own choice is kept: when maskProviders was never stored, it is seeded from maskEmails and written at once, so someone who had masking on stays masked on both pages after the update, and someone who turned it off stays unmasked. A switch with a stored choice is not changed by Mask personal data's follow(); turning Mask personal data on still masks both (hideAccounts.set(true, true), in app.js and plugins/redact/page.js). show() asks hideAccounts.page() to re-mask when the page in sight follows the other switch. No new strings: the button reuses Routing's translated label and title. app.js 1,310,438, core under its budget, no raise. Run: - New internal/gui/tests/provider-mask.test.cjs, both engines, all 5 languages, at 1000 and 420 wide, plus the touched window-mask, account-eye, privacy-hides-accounts, mask-emails, plugin-name-unmasked, masking-demo-unblurred: 134/134 on mote. At the rebased head (origin/main |
||
|
|
e1aec53895 |
routing: each session sending at once has its own context window, named by its title (tjhhhh on Discord)
tjhhhh runs several agent sessions at once. The Routing page's context
window card followed whichever request came last, so it jumped from one
session's prompt to another's. The card still tells of the request it
picked. Under it, while two or more sessions are live, a strip now
shows one small block per session (renderCtxSessions):
- keyed as the card's line of prompts is (sessionKey, else the
conversation);
- named by the agent's title for the session (sessionName), else its
folder's last level, never a bare id;
- holding that session's newest reading through context.js's stack bar,
exported as window.ctxStack.
A session is live while a request of it is under way, or while its
newest request is within 15 minutes of the newest overall. At most six
blocks show, newest session first. A block keeps its place while the
sessions take turns, because blocks are ordered by each session's first
request. The block the card tells of is lit (aria-pressed), and a click
on a block picks that session's newest request. The card's footer names
the session by its title too. New words are in every locale in
plugins/routing/i18n.js. The strip reuses the card's tokens: no select,
no coloured border, no gradient.
The strip sits under the card, not over it. Over it, the strip's first
appearance moved the card, and routing-ctx-still ("the cache kept its
place") went red in both engines. It is green at base
|
||
|
|
fb29cd30f9 |
tray: the Mac's menu bar figures are regular weight, a lone one in the menu bar's own font (qingnianxiaozhe on X)
Beside Surge's speeds and another app's stacked "0 KB/s", magpie's
"93% / 98%" read visibly bolder, and a lone "98%" too small and too
heavy, so the reporter kept it out of the menu bar. mpRowFont drew two
stacked rows in 9.5pt semibold and one row in 11pt medium, both since
|
||
|
|
ceeb73a0f1 |
app: the desktop app writes its log to app.log; magpie log and Settings › About › Log find it
rayem1w on X (0.1.2330, macOS) was asked for ~/Library/Logs/magpie/serve.log while chasing a Codex "hit a snag" through the gateway, and had no such folder. Only the launch agent (magpie daemon install, written by launchd) and a gateway magpie tui left running wrote a log; the app opened from the Finder, the Dock or the Start menu logged to a stderr nobody reads, on every system. Now runGUI and runPanel (magpie, app, tray, panel, a window view, a magpie: link) call applog.Start before gui.Run. It sends the standard logger (the gateway, the plugin host, providers and Wails' error handler all log through it) to app.log as well as stderr, and points debug.SetCrashOutput at it so a panic's trace is there too: macOS ~/Library/Logs/magpie/app.log Windows %LOCALAPPDATA%\magpie\logs\app.log Linux $XDG_STATE_HOME/magpie/app.log, else ~/.local/state/magpie/app.log portable data/logs/app.log app.log, not serve.log: on a Mac launchd writes serve.log for the service, another process. The file is 0600. At 5 MiB it becomes app.old.log (two files at most); when another magpie (an update's new process) rotated it already, it is only opened again; when it can't be moved it is emptied. stderr goes first, through a writer that never fails, since io.MultiWriter stops at a failed writer and an app opened from Explorer has no stderr. Secrets: the log calls name header names and paths without queries; no key or token was found logged (grep of log.Print* in gateway, provider, plugin, gui, agent). scrub masks bearer/basic credentials, key/token query parameters and sk-, AIza, gh?_ and JWT shapes anyway. How a user finds it: Settings › About › Log, with the path, Copy and an Open that shows its folder (POST /api/settings/log/reveal; the row is hidden in magpie web, which writes no file). magpie log prints where every log is (the app's, app.old.log, the service's, the tui's background serve.log); --path the app's alone, -n N its last lines, -f follows it across a rotation. Docs: reference.md, gui-shell.md, site start (FAQ "Where is magpie's log?" and the CLI table) and privacy (files on your computer), en/zh/ja. Run: At 227ce6074 on origin/main |
||
|
|
e6b851b0fe |
update: magpie update in a terminal restarts the app with its gateway handed over
gaubeebangeel on X has an agent run the magpie upgrade at 4am and had
to give that agent its own provider: magpie couldn't serve it through
the upgrade.
Cause: `magpie update` put the new version in and printed "quit and
reopen magpie to use it" (a .app) or "updated to X" (a binary). The
running app never restarted, so the agent (or the user) had to restart
it by hand, and a plain restart closes the port and drops streams.
Measured before, on mote, a sandbox HOME `magpie serve` with a fake
upstream streaming 61 chunks at 100ms, restarted by SIGTERM + start:
- the stream was cut at chunk 15 of 61 (unexpected EOF); SIGTERM to exit
took ~18ms, no drain;
- requests during the restart: 289 answered, 5 refused over 87ms.
Now `magpie update`, once the new version is in, POSTs it to the
running app's /v1/magpie/restart (gateway/restart.go). It is answered
only to a program on this computer over loopback; a LAN caller, a page
(Origin / Sec-Fetch) and another Host get 403. The updater's
restartBeside (gui/update_beside.go) restarts only when its own exe was
the one replaced (replaced() now also compares a .app's binary,
bundleExe), takes the version as ready without the feed, and runs the
same restart as Settings' AutoRestart: at once when it cuts nothing
short, else through waitIdle. On macOS and Linux that restart is the
existing SCM_RIGHTS handover, so the port never closes and in-flight
streams finish in the old process. The command prints what happened:
restarting (handing the gateway over), waiting for N requests, another
copy (current), magpie serve (unsupported), not running, or too old
(404: the first update into this version still needs a manual
restart).
Tests:
- TestUpdateInATerminalRestartsTheAppWithoutCuttingIt (darwin, linux):
a stream through the gateway, the exe rewritten, magpie update's ask
answered "restarting" with handover; the successor serves a request
while the stream runs, the stream ends whole, the old one quits only
after it. Red by hand with the route removed ("magpie update's ask:
404").
- TestUpdateOfAnotherCopyLeavesTheAppBe, TestRestartAskedOnlyFromThisComputer
(refused cases never reach the restarter), TestUpdateAsksTheRunningMagpieToRestart
(each reply, a 404 magpie, none running).
Run at this tree:
- rebased on
|
||
|
|
bdc1617bed |
routing: Accounts and keys count the whole day, not the last kept requests (#3351)
1234fsdc: the live Routing page's Accounts and keys said tried and answered over the requests the page still keeps in memory, so on a busy day the counts were a sliver of what Usage showed for the same accounts and went down as old requests fell off. /api/trace/history (the read the live page already makes every 15s) now carries `tallies`: per account or key, today's tries, answers, fails by reason, models answered, the last answer and the latest rest, read from routing/<today>.jsonl. The page seeds the list with them and still takes the latest rest and readings from the requests it keeps; a day looked at, or a purpose picked, counts its own list as before. The note says "over today's requests" then. Ported from ggbdpq's patch on the issue. Changed from the patch: - The patch parsed the whole day's file under history.mu on every look. A busy day's file is hundreds of MB (#3383) and saveRoute takes the same lock, so every 15s poll would stall the routes being written. DayTallies now folds in only the whole lines added since the last look (it keeps the offset, as History does); a line still being written waits for its end. It starts again when the day changes, the file shrank or was compressed, or the folder moved (another HOME). - What it returns is a copy: the patch handed out the live tallies, and the JSON writer read a Fails map the next fold wrote. - The latest name and rest go by the try's time, so no sort per look. - docs/subsystems/gui-shell.md says how the counts are made and that a request done since the last look is counted at the next one. Run on mote at this change on |
||
|
|
d159314e35 |
gui: a hidden window's WebView2 goes on its low memory target on Windows
molamaker11 on X: "magpie后台占用快接近600MB了。win端 这个能优化一下吗。比如剔除一些动画".
Cause. On Windows the tray panel and the main window are both made at
start and only hidden when closed, so two WebView2 renderers, the GPU
process and the browser process stay up in the tray. They were kept at
WebView2's normal memory target, so a hidden window held what it last
drew: after the window had been open, the GPU process kept ~85 MB and the
main renderer ~70 MB. Animations are not the cost: hidden pages run no
layout or style (LayoutCount/RecalcStyleCount 0 over CDP), the JS heaps
are 5 to 8 MB each, and the Go process is ~40 MB private (liveHeap 25 MB).
Fix. lowWhileHidden (memtarget_windows.go) sets
ICoreWebView2_19::put_MemoryUsageTargetLevel to LOW on each hide and on a
page that comes while the window is hidden (both windows are made hidden,
and get no hide), and back to NORMAL on each show. The page stays loaded
and running, unlike lightweight mode, whose default the owner turned off
on 10-21 because reopening reloaded the page. The vtable slot is 120:
ICoreWebView2_19's vtable holds every inherited method, counted in
WebView2.h of SDK 1.0.2210.55 (a first build that used slot 4 called
get_Source and crashed at start). zoom_windows_arm64.go's reflection walk
to the controller is now chromiumPart, shared with it. macOS and Linux:
WKWebView and WebKitGTK have no memory target magpie can set, so
memtarget_other.go is a no-op.
Numbers. xiaomi-gpu, Windows 11, WebView2 156.0.4314.50, a release build
of each (-tags production,comlauncher -H windowsgui) in its own sandbox
profile with the same seeded sessions and usage (~248 MB of Claude
projects, 72 Codex rollouts, a 4.2 MB usage.jsonl), tray start. The whole
process tree (magpie plus msedgewebview2), private working set (Task
Manager's Memory column) / commit, MB:
v0.1.2297 this change
fresh tray, window never opened 205-209/316-332 81/323
window open, every page clicked 304/482 236/467
1 min after closing it 265/479 69/459
5 min after closing it ~203/~476 64/453
idle 15-30 min later (sampled /5min) 200-214/474-481 -
1 min after closing, by process: GPU 85 -> 2.6, main renderer 70 ->
7.3, panel renderer ~50 -> 1.3, browser ~30 -> 6.2; magpie itself
~47 either way.
The commit charge barely moves: WebView2 trims the pages out of RAM to
the standby list and the page file rather than freeing them, so the
saving is RAM other apps get, not address space.
Reopening. Three trials, each window closed 3 to 5 minutes first, the
time for a view switch and two frames over CDP: the first trial took
901 ms on the first switch after reopening (v0.1.2297: 47 ms), then
12 to 31 ms; the other two trials were the same on both builds (first
frame 132 vs 131 ms, first switch 28 vs 30 ms, then 9 to 46 ms either
way).
Run: gofmt -l internal/gui (clean); on mote GOOS=windows go vet ./...,
GOOS=windows GOARCH=arm64 go vet ./internal/gui, GOOS=linux go vet -tags
nogui ./..., go vet ./..., go build; go test -timeout 45m ./... on this
tree (057c21b30, this commit with a draft message, on
|
||
|
|
2604d68db0 |
routing: the live card stays on the request it tells of while others come at once
qiang2040 on Discord ("狂闪", a screen recording): with Codex
conversations sending at once on group/glm-5.3-flash-free and
group/deepseek-v4.1-flash, the Routing page's top card (head, story,
context window) jumped to the newest request on every trace update,
and to "magpie hasn't routed this request yet" for each new one.
told() picks the request the card tells of: it stays on the one it
shows until that one is done, then goes to the newest, and a newer
request routing hasn't picked for yet doesn't take it from one that
was routed. play(), resume(), the live poll and rebuild() use it;
requests that come meanwhile still fly on the stage, without a caption
of their own. Pinned, replay and day views are unchanged.
Run:
- routing-concurrent-hold.test.cjs (new; two conversations interleaved,
every frame's head watched; en, zh, zh-TW, ja, de): red on the old
code in Chromium (mote); green on this code in Chromium (mote and
WSL) and WebKit (WSL).
- Broken by hand: told() returning newest() -> 6 of 6 red in Chromium
and WebKit (WSL), "the card stays on 101 while it is under way".
- routing-* and panel-routing* in both engines on WSL, against a base
worktree at origin/main: the reds are the same on base. row-swap is
red 3/3 on base too (#3799); live-patch's folded sample caught a
count-up mid-way once (129K vs 130K, the right request; #2174); the
rest are WSL WebKit reds under #4121.
- go test ./... -timeout 45m on mote: 80 packages ok; internal/gui's
10 real-window AppKit tests were killed at their deadlines (mote's
pboard/launchd state, #4125; also #2645, #1936). This change is
JavaScript only.
- The whole GUI suite (node --test, both engines) is still running on
WSL at push time; reds it shows that aren't on file get issues.
- At the pushed head (rebased on
|
||
|
|
7d4a631480 |
tray: pick which of a subscription's windows the menu bar shows (StrikingRaw on X)
Claude Pro's menu bar card drew its 5-hour and 7-day windows as two
small stacked numbers, and the user wanted one of them alone. Settings ›
Usage › Menu bar windows (under Allowances in the menu bar) lists a pill
per ticked subscription with two or more windows ("Claude Code · All
windows"), opening the app's menu: All windows, then each window. The
choice is settings.TrayWindows, by provider id (every account of it, the
in-use "|*" card too) and by window kind from the span ("5h", "1d", "7d",
"month", "15m", "name:<name>" when the span is unknown), so a vendor
reordering windows changes nothing. Unset shows every window as before;
a pick whose windows are all gone shows every window again, never an
empty card. Only the bar's rows and the Linux label are filtered; the
tooltip still says every window. One row draws at mpRowFont's 11pt
single-row size. Hidden on Windows (its tray shows no text). Per
computer through KeepOwn. The GUI learns kinds from trayKind on
/api/usage/quotas (withTrayKinds; model and aside windows get none). The
row's code is a lazily imported traywindows.js, so the core script
budget is not raised (app.js +4 lines for the call and the prefs keep).
Run:
- mote (macOS): go test -run 'TrayWindow|TrayUsage|WithTrayKinds|
CoreScriptBudget|AppScript|TrayImage' ./internal/gui/ ok;
./internal/settings/ ok; davsync TestSync ok. TestTrayImageOneWindow
draws through AppKit: Claude's card one line ("42%"), both windows two;
the PNGs were looked at.
- mote: gofmt -l empty; go vet ./..., GOOS=linux go vet -tags nogui
./..., GOOS=windows go vet ./... ok; go build, GOOS=linux go build
-tags nogui, GOOS=windows go build ok.
- magpie-desktop (Linux VM), --test-concurrency=1, BROWSER=chromium and
webkit: tray-windows (en, zh, zh-TW, ja, de; picking All; hidden on
Windows / single-window / no cards; 360px narrow), i18n-keys,
old-webkit, tray-usages, tray-logos, tray-cost, quota-pace: 43/43 each.
After rebasing on
|
||
|
|
2ec3453647 |
gui: the main window opens where it was left (jorbenzhu)
jorbenzhu on Discord: after every update and restart the panel is back in the middle of the screen. It is the main window: after an update magpie starts again with `magpie gui <tab>`, and Wails opens a window centred unless told otherwise. Its size and maximised state were kept; its place never was (gui-shell.md said "The window's position is not kept"), so nothing was lost on upgrade, there was nothing to restore. The tray's panel opens under the tray icon on the Mac and Windows, and where the click was on Linux, so it is not what moved. Now settings.WindowAt keeps the window's top left corner (system coordinates across every screen), per machine like Window (KeepOwn, and the Settings page's save carries it over). keepAt saves it once a move or resize has rested 500ms, unless the window is maximised, full screen, minimised or hidden; settings.Save writes through temp and rename, and an unreadable settings file is left alone. On the first show placeMain puts it back (putBack): openAt picks the screen holding most of the window and moves it fully onto that screen's work area; when no screen holds any of it (a monitor gone) or the screens or the file can't be read, it stays centred. Under Wayland a window can't place itself, so nothing is kept or restored there unless GDK_BACKEND is x11 (keepsPlace). Run: - mote, at 3f8f1d88b (on |
||
|
|
6d154ef1e1 |
context: scripts (curl, Bun, python-httpx…) are one Scripts card, not an agent each
A request whose User-Agent names only an HTTP library or an SDK (curl, Bun, node-fetch, undici, python-httpx, requests, aiohttp, Go-http-client, okhttp, the OpenAI/Anthropic SDKs, …) or nothing at all got a Context scorecard of its own, as if it were an agent (theforeveriris on X: "Bun", "curl", "python-httpx" cards). usage.IsLibrary names those clients; contextOfRecs folds them and "other" into one "Scripts" card at read time, so older history reads the same way, and the card's meta line and tooltip list the libraries by count. The cached day records are not changed. No setting: it works as is. The Usage page's Agents list still shows each library by name, with its Hide and Count-as-agent controls. i18n for zh, zh-TW, ja, de. Existing context.js comments were condensed so TestCoreScriptBudget holds without a raise (core scripts -28 bytes). Run, at this head (rebased on |
||
|
|
46fb0c1b93 |
gui: the tray panel switches a Claude Code's or Codex's account (shuizhuyu on X)
shuizhuyu asked for a global shortcut to switch accounts. v0.1.2143's Quick panel shortcut opens the tray panel, but the panel had no account switch: switchable() returned null there, because the panel reads no provider list (a fresh /api/providers reads every sign-in, seconds after a start, #1519). Now a Claude Code or Codex not connected has an "account" line in its opened panel row (switchEntry, the window's Switch accounts only menu). The line is drawn from the list kept from the last read (GET /api/providers?last=1, no keychain read; panelAccounts in app.js), read fresh only when nothing is kept. Opening the menu does one fresh read and opens on what it says. Manage accounts… and a lapsed pick open the window's Providers (window/main?view=providers). The provider and login actions now keep their answer as the last list (keepProviders), so a switch made in the window or the panel is in the next kept read. app.js stays under its budget with no raise: my own comments and two older ones (the usage accounts note, the sidebar note) were cut down. Run: - GUI, Windows box (xiaomi-gpu, win-run), Chromium + WebKit: 31 files (panel-*, panel-switch-accounts, agent-switch-accounts, switch-only, claude-switch-only, keep-login, agent-failover, agent-row-disclose, getting-started, click-scroll, i18n-keys, gui-zh-tw, gui-ja, gui-de): 503 of 503 pass. Not the whole GUI suite. - mote: no browser could launch there (pboard down, #4125; every WebKit and later Chromium launch timed out at 180s), so the GUI runs there were cut short. agent-panel-name-width, red there in both engines, is red on origin/main too (#4304, #4203), and this change doesn't draw the closed rows it measures. - mote: go vet ./internal/gui; go test -run 'TestKeptProvidersFollowActions| TestLastKnownProviders|Budget|TestProvider' ./internal/gui ok (includes TestCoreScriptBudget). gofmt -l clean. GOOS=windows go vet ./... ok. GOOS=linux go vet ./... fails only in wails/v3 pkg/application (cgo off when cross-compiling), the same on origin/main |
||
|
|
3bebc38393 |
gui: a key combination opens the quick panel from any app (ben hanks)
ben hanks on Discord asked for a global shortcut that opens the menu bar or tray panel. Settings › General has a new row, Quick panel shortcut, with none set by default. Clicking its field records the next combination: a letter, a digit, Space or F1–F20 with Ctrl, Alt/Option or Cmd/Win, or an F key on its own. Esc or a click elsewhere stops recording, and the cross clears the shortcut. It is shown the system's way (⇧⌘K on a Mac, Ctrl+Alt+K elsewhere). POST /api/settings/panel-shortcut checks the combination, has the running app bind it through Wails' GlobalShortcut (Carbon hot keys on the Mac, RegisterHotKey on Windows, XGrabKey on X11), and saves it only once it is bound. One the system refuses is not saved, the old one stays bound, and the status line says why. A pressed shortcut toggles the panel as a tray click does. The shortcut belongs to each computer (KeepOwn), the Settings page's own save leaves it alone, and the old Mac process lets go of it as it hands over. On Wayland no app may grab keys, so the field is turned off and the row names the command (`magpie panel`) to bind in the desktop's own keyboard settings. Every string is in en, zh, zh-TW, ja and de. No size budget was raised: app.js is 1,315,252 of its 1,315,316 after older comments were cut. Run at this head (rebased on origin/main |
||
|
|
9101bb8879 |
privacy: a request masking would change can go as written to a model you picked
jessyoungyu on X: when a masking rule hits, send the request to a self-hosted model instead, so a prompt like 「百度这家公司怎么样」 gets an answer about Baidu, not about a placeholder. Settings › Privacy › Instead of masking, send to (settings redactRouteTo). It is Off by default, and nothing changes for a user who leaves it Off. It is picked in the app menu, and only models whose every route is unmasked can be chosen: the provider is set to Send requests unmasked, it is on this computer or the network, it has no account, and any fallback or group member is unmasked too (gateway.MaskRoute, the same rule as provider.SkipsRedaction). The setting is saved on its own with POST /api/settings/redact-route, which checks it with MaskRoute. The general settings save keeps the value. Decisions: - When a value would actually be masked on an agent's turn (maskHits.n > 0), serve sends the request to the chosen model unmasked. Warn-only hits don't count, and Block still answers 400. - If that model fails, the request fails. It is never masked and re-sent to the model the agent asked for, and never goes to a cloud model with the unmasked text. Falling back to a masked cloud request would answer a different question in the background. The user picked this route because masking breaks the answer. - Streaming works the same as on any route. - The route is checked again on every request. A model that is gone or no longer unmasked, or that the caller's gateway key may not use, means the request is masked as before. - Covered: agents' Messages, Chat, Responses and Gemini turns (serve, marked by serveAgent), count_tokens, Codex magpie-model turns, and Codex own-sign-in /responses (codexMaskRoute). - Not covered: magpie's own asks (ownAsk clears the mark), embeddings, audio, images and video. These stay masked. GUI: redactRouteRow lives in plugins/redact/settings.js and wraps renderRedact, so app.js is byte-for-byte unchanged and the core budget is not raised. Strings are added in zh, zh-TW, ja and de. Docs: gateway-routing.md, gui-shell.md, and site/public/docs masking (en, zh, ja). Tests: internal/gateway/mask_route_test.go (TestMaskedRequestGoesToTheModelSet: unset, set, streamed, nothing to mask, local fails, falls back to a vendor, no longer unmasked, count_tokens; TestCodexSigninTurnGoesToTheModelSet; TestMaskRouteTakesOnlyUnmaskedRoutes; TestMaskRouteOnlyForTheAgentsTurn); internal/gui/redact_route_test.go; settings_keep_test.go; internal/gui/tests/redact-route.test.cjs (every language, chromium and webkit, 1100 and 640 wide). Broken by hand, each red: - serveAgent without the agent mark; - MaskRoute taking any route (TestMaskedRequestGoesToTheModelSet, TestMaskRouteTakesOnlyUnmaskedRoutes; at the pushed head); - the codex hook removed; - count_tokens without the mark; - ownAsk not clearing it; - no key check; - no reroute in serve; - the GUI: no keep in the general save, no MaskRoute check on save, and the picker listing every model; - the plugin script left out of index.html (redact-route.test.cjs 22 of 24 red; at the pushed head). Run on mote: - at 221ede767's tree, this change on |