Files
magpie/internal/settings
yetone e219f699ca gateway: with no S3 bucket the request archive keeps calls on this computer, oldest removed past 1 GiB (CyberCaius)
CyberCaius on Discord: "请求存档只能存在 s3 存储桶里,不能保存在本地吗". The
Usage page's Request archive switch refused without an s3:// sync. Now,
with no bucket, the same switch keeps each call in
<settings.Dir()>/request-archive/<date>/<id>.json: the same file the
bucket gets, masked the same way (Archived, archiveRequest), written to a
temporary file beside it, synced and renamed, 0600 in a 0700 folder.
Past its size (RequestArchiveLocalMB, 1 GiB unless set) the oldest calls
go first, down to a tenth under it; the call just written is never
removed, empty day folders go, and a .part file an hour old is removed
on the next scan. The running total is counted once and then added to,
so a write walks the folder only once it is over.

On by default or a switch: a switch, still off unless turned on. Bodies
can hold secrets, so nothing is written to a disk where the user didn't
ask. The local switch is its own field, RequestArchiveLocal, in KeepOwn
with its size, so sync never turns it on at another computer, and
RequestArchive synced from a computer with a bucket keeps nothing on one
without (archiveDest). The GUI switch writes RequestArchive while sync
has a bucket and RequestArchiveLocal while it has none; the tooltip names
the folder and the size, and a failed write reads "Not saved" (en, zh,
zh-TW, ja, de). GET /api/archive reads this computer's copy first, then
the bucket. The Settings page's save keeps both fields (api.go).

Docs: sync-backup.md and gui-shell.md say where the archive goes and why
the switch is per computer; the privacy pages (en, zh, ja) say what the
folder holds, that it is off by default, and how large it grows. The
READMEs' Privacy is about what is sent and is unchanged.

app.js stays under TestCoreScriptBudget (its comment was shortened, and
one t() call folded); no budget raised.

Run (worktree diff on 5222a4b12, sandbox HOME):
- go test -tags nogui -count=1 ./internal/settings/ ./internal/gui/
  ./internal/gateway/: ok (29s, 73s, 507s)
- node --test request-archive, request-archive-usage, routing-bodies,
  gui-zh-tw, gui-ja, gui-de, i18n-keys (chromium and webkit): 37/37 pass
- gofmt -l internal/: clean; go vet ./..., GOOS=linux go vet -tags nogui
  ./..., GOOS=windows go vet ./...: clean; go build for darwin, linux
  (nogui), windows: ok
- TestCoreScriptBudget: ok

After rebasing onto origin/main 3840333c5: -run Budget|Archive|SaveKeeps|
RequestArchiveLocal in gui, gateway, settings ok; request-archive and
i18n-keys 8/8; gofmt clean; linux and windows vet clean.

Broken by hand, each red, then put back:
- archiveDest's local branch off: TestArchiveOnThisComputer red
- RequestArchive also writing to disk: TestArchiveNeverOnDiskUnasked red
- no pruning: TestLocalArchiveRemovesOldestPastItsSize red
- KeepOwn line removed: TestRequestArchiveLocalIsThisComputers red
- POST setting RequestArchive with no bucket:
  TestArchiveSwitchKeepsOnThisComputer red
- GET not reading the local copy: TestArchiveSwitchKeepsOnThisComputer red
- api.go not carrying the fields: TestSettingsSaveKeepsWhatItDoesNotSend red
- writing in place, not through temp+rename: TestArchiveOnThisComputer red
  (mode 0644, a .part left)

Not tried: the real app with a real agent's calls (the gateway tests
drive real requests through serve with a fake vendor); Windows' file
modes (0600 is skipped there); the full ./... suite before the push (the
machine had a queue of sessions' suites; it is queued after).
2026-10-24 21:01:18 +08:00
..
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