This website requires JavaScript.
Explore
Help
Sign In
okooooooo
/
magpie
Watch
1
Star
0
Fork
0
Code
Issues
Pull Requests
Actions
Packages
Projects
Releases
Wiki
Activity
Files
6ac01d2835d4ffe6e7eff30e893c4f88488ecf9d
magpie
/
internal
/
settings
T
History
yetone
60b910b758
provider: the Agents page's data reads the settings and each provider's model list once per request (Junjie Zhou on Discord: the Agents page takes long to show) — a look at the agents asked settings.Load for every model of every agent (hundreds of reads of settings.json, about a fifth of /api/state's time in a profile) and catalog.Live for each model's APIs. The settings are now read through filememo (again only once the file changes) and held for the request like the catalog (heldSettings, used by VisibleTo, HiddenModels, ModelAPI, Labels), ListedAPIs holds each provider's live list, and settings.Save drops what is held. With a read-only copy of the owner's configs, a warm /api/state went from about 165 ms to about 100 ms. TestHoldReadsSettingsOnce. Check chain under a temp HOME passes.
2026-10-05 00:52:06 +08:00
..
lightweight_test.go
gui: lightweight mode, off by default, lets a closed panel's or window's webview go and makes it again when it is opened (somls on
#580
: GUI版可否增加轻量模式,关闭面板退出webview,减少资源占用) — closing the tray panel or the main window only hid it, so each kept its page and, on a Mac, its WebKit WebContent process (about 65 MB each at start, 95–100 MB after use) for as long as magpie ran. Settings → General now has Lightweight mode (轻量模式), shown in the app only (not on a browser's page) and kept as this computer's own through a sync or a restored backup (KeepOwn): with it on, a window found closed on two looks in a row 30 s apart (lightStep) is let go 30–60 s after it was closed, so a panel opened again soon after is still the same one at once. Letting go happens on the main thread under a new h.winMu: the window field is set to nil, the panel is unhooked from the tray icon (AttachWindow(nil); left click goes through magpie's own OnClick), and the main window is marked gone so its closing hook, which otherwise cancels a close and hides, lets it close; on the Mac the WKWebView is taken out of the window first (stopLoading, delegates and script handlers cleared, removed from its superview), since Wails' NSWindow close alone left the WebContent process alive for minutes. Opening it again (the tray icon, ShowMain, an import link, the Dock) makes the window anew with the options it was started with (makeMain/makePanel, moved out of Run with their hooks), its text size and title bar or Hyprland name (madeAgain), on Windows shown only once its page has loaded; every other path that reached h.main or h.panel (fit, tint, zoom, hide, glide, the Windows title-bar tint, the Hyprland click watch, the folder picker) now goes through the main thread and does nothing to a window let go; Linux keeps running with no window left (DisableQuitOnLastWindowClosed). Measured in a sandbox build under a temp HOME on other ports: started in the tray with the setting on, two WebContent processes of ~65 MB each; about a minute later both windows were let go and both processes ended (GPU and Networking, ~56 MB, are shared and stay; magpie's own process is unchanged), so the saving is ~130 MB idle and up to ~200 MB after use; the main window and the panel were then opened again with their pages, tinted and at the tray icon, closed, let go a second time, and magpie quit cleanly, with fit/tint/zoom calls every 0.2 s through a release crashing nothing. Windows and Linux build but were not run. TestLightStep and TestLightweightKeptAndOwn are new; lightweight.test.cjs (WebKit, en and zh: the row, off by default, On/Off posted as lightweight true/false, another setting's save keeping it, no scroll, no left-border accent, no row on a browser's page) is new and passes, as do click-scroll, settings-sections and searcher-pick. go vet ./internal/..., go build (darwin GUI), go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui -count=1 ./... under a temp HOME pass.
2026-10-03 00:24:49 +08:00
main_test.go
Add German translation; harden paths against unset env vars (
#770
)
2026-10-04 23:30:56 +08:00
migrate.go
Add German translation; harden paths against unset env vars (
#770
)
2026-10-04 23:30:56 +08:00
otel_test.go
feat: export gateway and agent conversation waterfalls to Langfuse (
#581
)
2026-10-03 01:43:32 +08:00
otel.go
feat: export gateway and agent conversation waterfalls to Langfuse (
#581
)
2026-10-03 01:43:32 +08:00
portable_test.go
Add German translation; harden paths against unset env vars (
#770
)
2026-10-04 23:30:56 +08:00
save_concurrent_test.go
test(settings): shorten hard-link save stress test (
#630
)
2026-10-03 12:51:45 +08:00
save_test.go
settings: save atomically and preserve unreadable configuration (
#621
)
2026-10-03 11:21:04 +08:00
save_windows_test.go
settings: save atomically and preserve unreadable configuration (
#621
)
2026-10-03 11:21:04 +08:00
settings_test.go
test: every package's tests pass on Windows, and none writes outside its sandbox (the user: 把 Windows 上那几个失败的测试修掉) — on a Windows box the suite failed in most packages, and the root package hung for 25 minutes. Tests set HOME, which os.UserHomeDir ignores on Windows (it reads USERPROFILE), so they read and wrote the runner's own home; each now sets USERPROFILE beside HOME, and Devin's, Goose's, Crush's and Claude Desktop's tests set APPDATA/LOCALAPPDATA, where those keep their files there. said() read the command's output only once it returned, and a pipe holds a few KB on Windows, so magpie model --help blocked forever; it reads while the command writes. Unix permission bits (the gateway key store's 0600 too), exec bits and symlinks Windows lacks are checked only off Windows; TOML strings hold Windows paths as literal strings, JSON as marshalled ones; a URL's path is compared as one. The provider and usage packages run in a home of their own (TestMain, as the gateway's already does), since a CLI's identity kept by a refresh still going when its test ended landed in the runner's ~/.config/magpie — and on a Mac in the user's own. Two product fixes came out of it: imagemcp took a file:///C:/… root or image for the path /C:/…, which doesn't exist on Windows, and now makes a Windows path of it (a host for a UNC share); and session discovery could keep a new Cowork session hidden on Linux, where a folder's mtime is a kernel tick and its size doesn't change, so an entry added within the tick of the last listing left both as they were — a listing made within 2s of its folder's last change is read again, as git does for racy files. TestFilePath and TestRacyDirectoryListedAgain fail without the change. On Windows 11 every package passes (32 of 32) and a run of each package in a fresh home leaves nothing in home, APPDATA or LOCALAPPDATA; on Linux (WSL) and macOS go test -tags nogui ./... passes. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build pass.
2026-10-01 23:15:07 +08:00
settings.go
provider: the Agents page's data reads the settings and each provider's model list once per request (Junjie Zhou on Discord: the Agents page takes long to show) — a look at the agents asked settings.Load for every model of every agent (hundreds of reads of settings.json, about a fifth of /api/state's time in a profile) and catalog.Live for each model's APIs. The settings are now read through filememo (again only once the file changes) and held for the request like the catalog (heldSettings, used by VisibleTo, HiddenModels, ModelAPI, Labels), ListedAPIs holds each provider's live list, and settings.Save drops what is held. With a read-only copy of the owner's configs, a warm /api/state went from about 165 ms to about 100 ms. TestHoldReadsSettingsOnce. Check chain under a temp HOME passes.
2026-10-05 00:52:06 +08:00
trayusages_test.go
tray: the menu bar shows several subscriptions' usage side by side (KevinXC on Discord) — Settings → Usage in the menu bar picked one card; its menu now ticks any number (kept open while ticking, saved once when it closes, Off unticks all, a ticked card that has gone stays listed to untick) and the pill says "3 subscriptions". settings.TrayUsages keeps them in order; a file with only the older trayUsage shows that one, and trayUsage is still written as the first for an older magpie. On the Mac the bird and a cell per card are drawn as one image by AppKit on the status item's button: the card's logo (a black glyph tinted in the menu bar's text colour, a coloured one as it is, the name's letter in a ring when there is none) and its two windows stacked, "42%" over "18%", in the bar's colour light or dark and sharp at any scale; the bird's flap goes through it. Arc flags run into numbers (Codex's logo) are spaced out for AppKit's SVG reader. A row longer than 10 characters (a plan's balance read from its page) is cut with an ellipsis in the bar and whole in the tooltip. Windows and Linux show the cards as text, " | " between them. TestTrayUsageCells, TestSVGArcFlags, TestTrayImage (darwin, renders 0-3 cards light and dark at 2x), TestTrayUsagesMigrate and tray-usages.test.cjs (Chromium, WebKit, en/zh) are new. go vet, go build (darwin GUI), go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./..., go test ./internal/gui pass; tray-usages, settings-groups, panel-*, click-scroll, old-webkit pass. Not seen in a live menu bar.
2026-09-30 19:45:44 +08:00