ac4af582301a4e8a29245dbba767eba31334ddf9
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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 |
||
|
|
92fbabb47e |
gui: the Providers page draws the last list at once and the fresh one behind it
#1519 (fatkun): the Providers page asked /api/providers each time it opened, and after a start that read takes seconds (every account's sign-in, every agent's model), so the page showed skeletons that long. Now, as the Agents page draws the last state: - the app reads /api/providers once in the background after the start (prefetchProviders), and the page's first opening uses that read, or waits on it, instead of asking again. The sidebar's gateway line reuses the same read (sideGwRead), so a start still makes one read. - the server keeps the list it last built in the cache folder (providers-state.json, 0600; lastproviders.go) without the gateway's recent calls and lanes or any provider's headers, proxy or extra body. /api/providers?last=1 serves it at once; the page draws it while the fresh read is out, and the fresh one replaces it. - a row clicked on a kept list waits for the fresh one rather than opening an editor that would be drawn again under the reader's hands. Tests: - TestLastKnownProviders (internal/gui): red when the stripping of Headers/Proxy was broken by hand ("the kept list holds hdr-secret-1519 / proxy-secret-1519"), green restored. - providers-last-known.test.cjs (new): the kept list drawn before the fresh read answers, then replaced; a row click waits. With kept.last = false by hand the row-click case was red in all 5 languages. - sidebar.test.cjs: the narrow case now guards one /api/providers read in total, still one after widening to 1200px (the sidebar reuses it). Red on the old assets (0 reads), green on the new, both engines. Run: go test -timeout 45m ./internal/gui ok github.com/yetone/magpie/internal/gui 528.667s gofmt -l internal/: nothing; go vet ./internal/gui, GOOS=linux and GOOS=windows go vet -tags nogui ./...: exit 0 GUI, chromium and webkit, every language, wide and narrow: providers-last-known 20/20, sidebar 8/8, provider-proxy 4/4, agents-last-known 3/3, last-page 1/1 in each engine. provider-advanced-fold: 1-3 of 25 red per run, the same on the old assets (#2552). Chromium full GUI suite (before the kept.last and sidebar-test edits), under load ~200: 5681 tests, 55 red in 23 files; each was rerun alone and either passed or was as red on the old assets. routing-model-rest runs, old vs new: old 4, 2, 7 red, new 3, 3 red; routing-request- metrics two runs: old 1, 0 red, new 0, 2 red, each red at 23-29s (load ~240; the same test red on old). Not verified: a real cold start on Windows; the webkit full suite (59 provider/sidebar/start files run: 516 tests, the reds there pass alone or are #1863). |