Commit Graph
34 Commits
Author SHA1 Message Date
yetone 6a81a3c62a masking: its head's Settings link is a link, and the head wraps before it squeezes the title
v0.1.3386 (ff7d84b9b) put "Settings › Privacy" in Insights › Masking's
head as a second button.text beside Turn off masking. The whole GUI
suite, run on mote after the tag, went red on it:
- mask-alert and masking-records "masking on, the page turns it off and
  on again" found two button.text where Turn off is the only one
  (all languages, both engines);
- masking-records "the card says what was kept" at de 640px: the two
  buttons and the 7/30 days switch left the title a column ~60px wide,
  the head 276px tall, and the first request at 907px, past 760.

Now the link is a .link (as on Plugins › Built-in), and .msk-head wraps
whenever its title would be narrower than 16em, in place of the
600px media query. de 640px: head 107px, first request 738px.

Run on mote: node --test masking-records, mask-alert, builtin-places
(Chromium and WebKit, every language): 218 pass, 0 fail. Red before
this on the same files (gui-full.log of the post-tag run).
The rest of that post-tag GUI run is triaged separately; mote rebooted
mid-run twice, and its other reds are in files this change doesn't
reach.
2026-11-11 02:14:20 +08:00
yetone 327fb57659 redact: Never mask holds from the next text on, earlier turns stay masked (NicoleS76448271 on X)
A value let go from the request view's menu (Never mask) went as written
in the conversation's earlier turns too, so the prompt the vendor had
cached no longer matched and the whole conversation was read again at
full price. Now a text sent masked on a route keeps that value masked,
with the same placeholder, while magpie remembers the text; new texts
(the next turn, another conversation) send it as written. It holds for
values added in Settings too.

allowkept.go remembers a maphash of (route, text) and of the value,
never the value, in two generations of 2^17 like sentSpans' memo. Only a
request with a route (Options.sent and Route) keeps it; a search's query
or an embedding's input has the value as written at once. Keeping a
value masked is the safe side: a collision masks a value the user let
go, and a text no longer remembered (after a restart) sends it as
written, as before. The menu's message now says earlier messages stay
masked so the cache holds (en, zh, zh-TW, ja, de). The request view's
inline Never mask was already there (yew_fence on Discord).

Run (mote refused SSH for ~30 min at load ~125, so on the Linux box):
- wsl-run go test ./internal/redact/ ./internal/masking/ ./plugins/redact/
  ok, at the pushed head b9d1f00a5 too.
- wsl-run go test -run "Mask|Redact|Allow|Sent" ./internal/gateway/ and
  -tags nogui ./internal/gui/: ok.
- go vet: GOOS=windows (redact, gui), GOOS=darwin (redact), linux -tags
  nogui (redact, gui): ok. gofmt -l clean.
- node --test mask-value-menu, i18n-keys, i18n-en-no-cjk (chromium and
  webkit, every language): ok. masking-records: the same reds as fresh
  origin/main b35867730 (24 there, 23 here), filed as #5830, commented.
Broken by hand: apply without the maskedBefore check makes
TestAllowKeepsSentTextMasked red (the earlier turn goes as written).
Not tried: a real Anthropic request reading the cache across the
change; macOS (mote down); the full suite.
2026-11-10 18:50:45 +08:00
yetone 0549e5301a masking: Send requests unmasked is found from Settings › Privacy and holds on every route (CrazyMouse_TT on X)
CrazyMouse_TT runs a model of their own and wanted masking off for it.
The switch already existed (the provider editor's Advanced › Send requests
unmasked, provider.Unredacted), but nothing near masking pointed to it,
and it held only on chat-shaped routes.

- Settings › Privacy has a "Sent unmasked" row: each provider set so is a
  button that opens its editor with Advanced open; with none, the row says
  where the switch is (settingsJSON.UnmaskedProviders, redact plugin's
  unmaskedRow).
- Images (draw.go), videos (video.go) and Ark's own API (native.go) go as
  written when every model they may go to is such a provider
  (unmaskedMembers); a group with one member left on stays masked, as a
  chat's route does (unredactedRoute).
- A Remote magpie may be set so too (SkipsRedaction no longer refuses
  it): it is sent the request as written with no X-Magpie-Masked-As, so
  it masks by its own Settings and switches, once, before any vendor
  (1d6d263ee's hop). Left off, it is masked here, as before. The editor
  says so for a remote magpie.
- Default stays off for every provider: nothing changes for anyone who
  hasn't ticked it.

app.js stays under TestCoreScriptBudget by a shorter unmaskRow call and
three trimmed comments (app.js -51 bytes vs base).

Run (mote, at this tree): gofmt -l clean; go vet darwin, GOOS=linux
-tags nogui, GOOS=windows clean; go test -count=1 ./internal/gateway
./internal/provider ./internal/cli ./internal/masking ./internal/gui ok.
GUI (chromium + webkit, 5 languages, 1100/440px):
provider-unmasked, unmasked-providers, i18n-keys, i18n-en-no-cjk,
redact-route: 126 pass, 0 fail. masking-records.test.cjs is red the same
on origin/main 9430c5309 (#5830).

Broken by hand: SkipsRedaction refusing a remote magpie again made
TestUnredactedRemoteMagpieMasksOnItsOwnSide red; images/videos/Ark
ignoring the switch made TestUnredactedProviderDrawsWhole,
...MakesVideosWhole and ...ArkNativeWhole red; dropping
unmaskedProviders made unmasked-providers.test.cjs red.

Not tried: Windows (win-run), and a real two-machine magpie hop; the hop
is tested with two in-process gateways and a tap between them.
2026-11-10 10:03:49 +08:00
yetone 7cb437ee16 masking: its alert sits with its other settings, and its Built-in row says when nothing is masked
The Masking alert was the one masking setting on the Masking page, under
the request list, away from every other one in Settings › Privacy (and
in Settings › Usage before that, where nb5p looked for it). It is now
the first row of Privacy's "when a value is found" list, out in gateway
mode as before. The Masking page is the list of masked requests alone.

Masking turned on with no kind, no personal data and no word of the
user's masks nothing, and its Plugins › Built-in row said only where
its settings are. It now says "Nothing is masked yet" before the link
(the scattered settings audit after netube99 on X).

Run in the tree with this change and the rest of the audit's fixes
(mote, base cd0ba05c2): mask-alert, builtin-places, settings-search:
162 pass, 0 fail, Chromium and WebKit, every language, 1100 and 420
wide; i18n-keys pass. The builtin-places file committed here is the
one run minus the routing-groups case, which comes with its change.
2026-11-09 21:51:53 +08:00
yetone ff7d84b9b2 gui: a built-in's switch, settings and page lead to each other (netube99 on X)
netube99 (X, 2119721422918742222): masking is switched on in Plugins ›
Built-in, set in Settings › Privacy and seen in Insights › Masking, and
none of the three leads to the others. Web search had the same split.
One pattern for every built-in whose switch, settings and page are apart:

- pluginrt.Manifest.SetAt ("privacy #redactList") says where Settings has
  its settings: redact, search, gateway and otel set one. builtins.go
  sends setAt and page (its nav.page Part).
- Its Built-in row (featGo): "Settings › <tab>" and, while on, its page
  ("Masking"). No settings link while off when those settings hide with
  the plugin (Observability).
- Its settings, while off (featOff): a first row "Off in Plugins ›
  Built-in", what being off means, and Turn on. Privacy and Web search
  use it; search's own off row went.
- Insights › Masking's head: "Settings › Privacy", unless Turn off
  already goes there. At 600px and under its buttons wrap below the title.
- docs/subsystems/plugin-runtime.md documents SetAt.

Proposal for the owner, not built: give each feature one home with its
switch, settings and page together. This commit only links the three.

Core budget: no raise. +~1.9KB of code is paid for by shortening six
app.js comments (logo mask shelf, copy, sidebar, account models,
fitSend, the hold room).

Run on mote at fe672ce69's tree (origin/main 2b22425b4 + these two):
- go vet ./internal/gui ./internal/pluginrt ./plugins/...;
  GOOS=linux -tags nogui and GOOS=windows vet of gui and plugins: clean.
  gofmt -l: clean.
- go test -run 'TestBuiltin|TestCoreScriptBudget|Translated'
  ./internal/gui ./internal/pluginrt: ok (budget passes after the cuts).
- node --test builtin-places, websearch-places, builtins, i18n-keys,
  i18n-en-no-cjk: 235 pass, 1 fail. The fail is i18n-keys "a plugin's
  words are its own" on plugins/usage "View routing", red on origin/main
  too (#5332, #5426, #5482).
  builtin-places and websearch-places cover en, zh, zh-TW, ja and de in
  Chromium and WebKit, at 1100 and 420 wide, nothing past the edge.
Broken by hand: featGo and featOff made to return at once, and 40
builtin-places subtests went red (42 fails with their parents). Round 1's
files reverted made websearch-places 102 of 142 red.

Queued, not waited for (owner: push each verified fix at once): the full
`go test -timeout 45m ./...` then `make test-ui` on mote behind
~/suite.lock; log at
~/workspace/projects/magpie-wt/websearch-surfaces-scratch/full.log. Any
red gets an issue.
Not tried: the real app on Linux/Windows; warm-ups have no SetAt (their
settings moved into the provider editor).
2026-11-09 17:58:11 +08:00
yetone 710f0290cc masking: a masked value in a request opens Copy and Never mask
yew_fence on Discord: in Insights › Masking's diff of a request, a false
positive can't be copied or put on the allow-list from there. Now a
masked value in the request's text, as written here or as the vendor got
it, opens the app's row menu (right-click on a value card under it):

- Copy copies what the value was, through /api/copy (it is the user's
  own value, shown on this computer only).
- Never mask posts the placeholder to the new POST /api/masking/allow.
  The server asks the masker for the value it stood for (so only a value
  masking masked can be added), reads settings with LoadChecked (an
  unreadable file is not written over), appends it to RedactAllow, the
  list Settings › Privacy's Never mask saves, and Save trims it and keeps
  one copy. allows() runs after the span memos, so the next request
  sends it as written. Off, with why, for a value already on the list and
  for one of the user's own Masked words. A value from before a restart
  is not in memory and opens nothing.

Strings in plugins/redact/i18n.js for zh, zh-TW, ja and de. settings
parity maps the route as S2.

Run on mote at this tree rebased on 578053d6a (pushed on cde3bc9fa; dca338f3a
and cde3bc9fa change internal/gateway and one mover min only):
- go test ./internal/gui ./internal/cli ./internal/settings ./internal/redact: ok,
  but for internal/gui's TestPanelHiddenByWailsMarksPageOutOfSight (#5322,
  "marked=false" as filed) while another session's suite ran on mote; alone
  it passes 3 of 3 here and 2 of 2 at 578053d6a
  (TestMaskingAllowFromRecord new: 404 for an unknown placeholder, GET
  refused, added once, the next TextHits sends it unmasked)
- go vet, GOOS=linux go vet -tags nogui, GOOS=windows go vet on internal/gui
  and internal/cli: ok (all of ./... before the rebase); gofmt -l clean
- node --test mask-value-menu (new; Chromium and WebKit, en/zh/zh-TW/ja/de,
  1100 and 640px, plus the before-a-restart case), mask-actions,
  masking-records, masking-demo, masking-demo-unblurred, mask-alert,
  redact-words-import, i18n-en-no-cjk, i18n-keys: 235 of 236, the one red
  below
- i18n-keys: its "a plugin's words are its own" is red for three keys
  that aren't this change's, filed as #5332/#5327, #5482 and #5426; no
  key of this change is listed.

Broken by hand: the route without its append, TestMaskingAllowFromRecord
red ("allow [build-01], saved [build-01]"); maskInk without maskActsOn,
mask-value-menu red.

Not tried: the real app with a live masked request; the whole GUI suite
(1266 files; the new call is made only on a click in this page, and every
file that opens the masking page was run).

Reported-by: yew_fence
2026-11-07 23:27:42 +08:00
yetone eeecd41505 privacy: masked words and never-mask values are imported in bulk and copied out (acmilan_)
acmilan_ on Discord asked to import masking words in bulk instead of adding
them one at a time. Settings > Privacy's Masked words row now has Import...
and Copy beside Show. Import... opens a box under the list: what is pasted
there, a word a line or split at commas (either width), is added after the
list's words in one save. A word the list already has, or one pasted twice,
is passed over; the box counts the new ones as you type, and once saved the
status says "Words added: 3 · already in the list: 2". Cmd/Ctrl+Enter
imports, Escape and Cancel close it without saving; a redraw keeps the box
open with what it holds; a save that fails says no count. Copy puts the
list on the clipboard a word a line, the form Import takes. Never mask
uses the same wordList, so it gets both too. The pasted text is drawn as
dots while the words are hidden. Strings in zh, zh-TW, ja and de.

Test: internal/gui/tests/redact-words-import.test.cjs, Chromium and WebKit,
en/zh/zh-TW/ja/de at 400px: 10 of 10 ok on mote. Broken by hand: with the
dedupe against the list taken out it fails ("New words: 5", expected 3);
with the saved-words check before the count taken out, the failed save's
error is written over and the test times out waiting for it.
Looked at it in both engines at 400px (screenshots, en and zh).
Run (mote, at the pushed head of this commit and the two after it,
bae625cdf on origin/main 8a8079680):
- node --test redact-words-import, i18n-en-no-cjk, zcode-site,
  zcode-site-layout, plugin-moved-signin, plugin-other-ways, zhipu-team,
  gui-de, gui-ja, gui-zh-tw, i18n-keys, agent-leave-magpie,
  agent-own-direct, checkin-now-account, checkin-account, plugin-checkin,
  usage-checkin: 215 of 215 ok.
- go test ./internal/gui/...: ok but TestMainWindowCorners/macOS_26_SDK,
  red the same at origin/main 8a8079680 (#3949, macOS 27 on mote);
  TestCoreScriptBudget ok.
- The whole GUI suite was not run before the push: both test boxes were
  running other sessions' GUI suites (one suite a machine). It runs after
  the tag; reds are filed.
- Rebased on origin/main d02b8a000 (agent-own-direct, app.js, i18n.js
  changed there) and run again at the pushed tree: TestCoreScriptBudget,
  i18n-en-no-cjk, i18n-keys, gui-de, gui-ja, gui-zh-tw and
  agent-own-direct, 37 of 37 ok.
2026-11-04 22:19:21 +08:00
yetone 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.
2026-11-04 12:38:10 +08:00
yetone 08d7bfaaa5 redact: Settings › Privacy's Masked words show as dots until Show (noahhrreion)
noahhrreion on Discord: the masked words are the names a user keeps from
vendors, and Settings showed them to anyone looking at the screen.

The redact plugin (plugins/redact/settings.js, outside the core budget)
draws the Masked words box with -webkit-text-security: disc and a
Show/Hide button after it, as a provider's key is; Show holds through a
redraw, for the page's life. The box stays a text box, so an IME still
writes into it; where the engine has no text security it falls back to a
password box. Nothing saved changes.

Test: redact-words-hidden.test.cjs, chromium and webkit,
en/zh/zh-TW/ja/de, 1100 and 400px: dots first, Show and Hide with
aria-pressed, Show kept through another row's save, a word typed while
hidden saves and stays hidden.

Run (mote): redact-words-hidden 20/20 (chromium, webkit, every language, 1100 and 400px) after
f37742e14 and 44/44 with the other new file and i18n-keys at the pushed head; every redact-*, masking-*, privacy-* file and i18n-keys pass
there; TestCoreScriptBudget, i18n-keys and this test again at the pushed head (plugin files are outside the core).
Broken by hand: the wrapper's redactWordsHidden() call taken out, 10/10 red.
Not run: the whole GUI suite (lost twice, mote rebooted mid-run); it runs after the push.
Not tried: the real app, Firefox's password-box fallback, an IME typing into the dotted box.
2026-11-03 20:17:00 +08:00
yetone 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 573b21f4b) with gui-zh, gui-ja and
  i18n-keys: 140/141, the red is gui-ja's ja string from a7b47d57e
  (#4580), red on main.
- provider-mask on origin/main's assets: 60/60 red (no #pvMask).
- Broken by hand (chromium en), each red: cur() always Routing's
  switch ("Providers shows the account while its own switch is
  off"); the seed taken out (the upgrade on/off cases); show()'s
  page() call taken out.
- gofmt -l clean; go vet, GOOS=linux -tags nogui and GOOS=windows vet
  ok; the three builds ok; go test -tags nogui -timeout 45m ./... on
  mote at base 6712e367e: every package ok but internal/gui's
  TestSettingsSaveKeepsWhatItDoesNotSend, red on main too (#4514).
  At the rebased head: internal/gui's budget tests ok.
- Whole GUI suite on Linux (WSL magpie-desktop, concurrency 6, host at
  100% CPU), files a to l so far, the rest on mote: each red file was
  run alone at this head and at origin/main 6712e367e. Red alone at
  both, already filed: agent-panel-name-width (#4203), context-map
  webkit 420 (#3488), gateway-caller-keys (#3797), gateway-key-models
  (#4081), header-centre webkit ResizeObserver (#3479), key-replace
  webkit 420 (#4126), gui-ja (#4580). Red only under the whole run,
  green alone at this head: agent-plugin-agents (#4481), agent-prefs
  (#4552), allow-ips (#3699), api-key-theme (#3307), click-scroll,
  codex-predictions, currency (#3101), editor-advanced-align, fonts,
  gateway-key-limit, group-from-model-add, group-member-fast,
  group-member-off, group-morph, icon-url, inner-scroll-contain,
  keep-awake, lan-docker, ledger-hscroll, library-chip-fan,
  library-items, library-mcp-hub, library-mcp-tools, list-sort (the
  load class, #4400,
  #4471).

Not tried: the real desktop app's webview (Wails), and the GUI suite
on macOS beyond the files above.
2026-11-01 06:30:17 +08:00
yetone 847f0c4703 gui: Masking alert lives on the Masking page
nb5p on Discord (#feedback): "这个脱敏提醒被放到额度设置里了,害得我找半天没找到".
The Masking alert row sat in Settings › Usage. It now closes Insights ›
Masking, after the list of requests, in the page's own `.list.prefs` rows
(same Off/On segs, same ids #maskAlertRow/#maskAlertSegs, same i18n keys
and the same maskAlert setting). Nothing is left in Usage. The page draws
it from page.js after loadSettings, hides it while one request is open,
and gateway mode leaves it out as Settings did. Placed after the list so
the requests still start in the first screen (masking-records at 640px)
and the demo keeps its place between the card and the list.

Run at base 07a3312c5 with this change:
- mask-alert.test.cjs, Chromium (WSL magpie-desktop and mote) and WebKit
  (WSL), en/zh/zh-TW/ja/de at 900 and 380px: all pass.
- WebKit (WSL): mask-alert, masking-records, masking-demo,
  masking-demo-unblurred: 87 pass, 0 fail (tree differed from the pushed
  one by a client.js comment reflow only). Earlier WebKit run: turn-done,
  quota-reads, routing-masking, gateway-mode, builtins, sidebar pass.
- Chromium (WSL) at the final tree: i18n-keys, mask-alert, masking-records,
  masking-demo, masking-demo-unblurred, turn-done, quota-reads,
  routing-masking, gateway-mode, builtins, sidebar: 131 pass, 1 fail. The
  fail is i18n-keys "a plugin's words are its own" on "Unmarked"
  (plugins/routing/i18n.js), red on main, #4524.
- mote: go test -timeout 45m ./internal/gui/...: TestCoreScriptBudget and
  the budgets pass (app.js only shrinks). Red: TestSettingsSaveKeepsWhat-
  ItDoesNotSend (SearchAll, red on origin/main 93b31f5b7 too, #4514),
  TestColdTurnsTaken (passes alone 3 of 3, #4510), and the AppKit window
  tests killed at their 30s bar on mote over ssh (no window session).

Broken by hand: with internal/gui/assets back as on 07a3312c5 (row in
Settings › Usage, none on the page), mask-alert.test.cjs went 11 of 12
red in Chromium; the feature-off test is the one that still passes.

Not tried: the real app (desktop window) and WebKit on mote, whose
Playwright WebKit launch hangs there.
2026-10-31 14:05:02 +08:00
yetone 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 f5806ed21 (pushed on 44d697993,
  which adds only app.css lines and a Gateway page GUI test):
  go test -tags nogui ./internal/gui ./internal/settings ok (the core
  budget is green again since ec789445d; #4307, filed and closed);
  the mask-route tests in ./internal/gateway ok; GOOS=linux go vet
  -tags nogui ./internal/gui ./internal/gateway ok; GUI: node --test of
  redact-route, redact-*, privacy-*, mask-*, masking-*, settings-*,
  i18n-keys, account-discovery, sessions-reads and gui-de/ja/zh-tw:
  643 pass, 0 fail. gofmt -l clean.
- at the same change on af8f3a939, one rebase back (the only
  difference is index.html's script order and main's own commits):
  go test -timeout 45m ./internal/gateway (488s) ./internal/redact
  ./internal/settings ./internal/provider ok; GOOS=linux go vet -tags
  nogui ./..., GOOS=windows go vet ./..., go vet ./... ok.
The whole Go suite was not run; every package this change touches was
run above.

Not tried: a real self-hosted model (Ollama) with a real agent. The
local model is a fake Chat server in the tests.
2026-10-30 00:46:45 +08:00
yetone 449231c19f masking: the Masking page turns masking off as it turns it on
ZekeXiao on X: "脱敏好像只有一个打开开关,不能关?". Insights › Masking's
header had "Turn on masking" while masking was off and nothing at all
while it was on; the off switches were only in Settings › Privacy.

- Masking on, the header has a "Turn off masking" text button where
  "Turn on masking" sits when off. It sets redact and redactPersonal off,
  and the card then says "Masking is off" with Turn on masking.
- Turn on masking from this page after that brings personal data back on
  if it was on before (and Hide accounts with it, as Settings does);
  otherwise it turns secrets on, as before.
- With the user's own Masked words, masking stays on with both switches
  off (masking.Wanted), so a button that turned the switches off would
  leave the page saying on, or lie. Then the button reads "Turn off in
  Settings" and opens Settings › Privacy, with a tooltip saying the words
  mask until they are taken out there. Words are never deleted from here.
- Strings in plugins/redact/i18n.js for zh, zh-TW, ja, de.

Run (worktree at origin/main 628ac36fc):
- masking-records: new "masking on, the page turns it off and on again"
  (5 languages, 1100 and 640px) and the words case, now asserting the
  one way off opens Settings and saves nothing. Red on the old page.js:
  30 of 30 (mote, chromium + webkit). Green with the change: 30 of 30.
- Broken by hand: not restoring redactPersonal on Turn on makes
  "personal data comes back on as it was" red in both engines.
- An earlier label "Turn off masking…" was red in i18n-keys (it says
  routing's own key "masking…"); relabelled.
- Linux box (wsl-run, magpie-desktop, playwright 1.62.0):
  chromium: i18n-keys, mask*, redact*, account-mask*, routing-masking,
  window-mask, provider-unmasked: 201 of 201 ok.
  webkit: masking-records, mask-actions, routing-masking 72 of 72; the
  rest 124 of 129, the 5 reds redact-rule-edit at 420px, red the same at
  origin/main 3142a5559 alone (#3407, commented).
- mote at load 18-30 with other sessions' full GUI suites: WebKit could
  not launch at all, origin/main too (#4125, commented), and Chromium had
  5s-timeout reds in account-mask*, mask-alert and masking-demo-unblurred,
  files this change doesn't reach; the same files passed on the Linux
  box.

Not tried: the whole GUI suite (mote was taken by others' suites and
could not launch WebKit); the real app; WebKit on macOS after the
relabel (Linux WebKit only).
2026-10-29 11:13:39 +08:00
yetone 310efb635c masking: a record from before a restart says its text was in memory only
brianeee2 on X: in Docker, the masked content can't be seen after the
container restarts; is a mounted folder missing?

No folder is missing. Reproduced on xiaomi-gpu with the image built from
905166d78 (volume on /config, a fake provider with redaction on, a
request carrying DB_PASSWORD=...): /config/magpie/masking/<day>.jsonl
holds the record and survives `docker restart`. The request's text, the
lines around each placeholder, the Sent body and the values behind the
placeholders are memory only by design (maskrec, gateway-routing.md,
README, privacy page; TestNoValueOnDisk), so after a restart they are
gone in any install, Docker or not.

What was wrong is the page. A record with neither body nor snips (every
record from before a restart) said "Still here: ... the line around each
placeholder as the vendor got it" and, under it, that the text was kept
in memory only: one claim false, the two contradicting each other. It
now says once that the request's text and values were kept in memory
only, never on disk, and that the record keeps each value's kind, length
and first characters. The old msk-none line's key goes from i18n.js;
the new one is in en, zh, zh-TW, ja and de.

Run:
- masking-records.test.cjs new test, chromium + webkit, 5 languages at
  640px, on mote: 10/10. Broken by hand: with HEAD's page.js it is red
  ("no second message").
- GUI files mask*, masking*, privacy*, redact*, i18n-keys,
  routing-masking, plugin-page on mote: 380/380.
- go test ./internal/gui/ ./internal/maskrec/ on mote: ok.

Not done: snips and bodies are still not kept on disk; keeping them
would break the documented never-on-disk promise, an owner's call.
What the answer put back (Back) is memory only too and isn't reworded.
2026-10-29 07:38:50 +08:00
yetone 2ff85f8a2b gui: a page's bar room comes out of its right padding, so both sides match
v0.1.1904 had every page keep its scrollbar's room, so nothing moves
when a page grows past the window. The owner asked whether the clear
bar now makes the sides uneven: it did, by the bar's width (8px on the
Mac, 10px on Windows and Linux), and the centred pages sat 4px to the
left.

layout.js measures the bar of a .view into --bar (again on resize, so
a text-size zoom is followed), and app.css takes it from each page's
right padding: the panel's 12px, the window's 16px, the centred pages'
max(16px, 50% - 600px) and the phone web's safe-area right. The heads
and strips that reach over the padding (Library's and Settings' sticky
heads, Providers' after-list fade, the masking record's bar) reach that
much less on the right, or they would run the page sideways. A plugin's
page, whose frame scrolls itself, shows a bar only when it needs one.

layout.js's measuring adds 254 bytes to the core's scripts; the budget is
raised by exactly that, with no room added.

page-width-steady.test.cjs now checks every page's left gap against its
right gap with the bar (chromium and webkit, the Mac's 8px bar and the
10px one, 1100 and 1600 wide) and that no page scrolls sideways; that
check found Providers' after-list fade running 4px past the page. With
v0.1.1904's CSS it is red ("agents: 16px on the left, 24px on the
right (bar 8px)", 26px with the 10px bar, 94/102 centred). page-width's
"centred" check compared paddings only, and now counts the bar too.

Run on mote at this head (f70cb6825's tree, on origin/main 174250b27):
page-width-steady, page-width, inner-scroll-contain, settings-tabs-stick,
library-all, agent-layout, i18n-keys, text-size, view-scrollbar: 168 of
168 pass; go test ./internal/gui -run Budget ok. Before the last rebase,
209 GUI files that reach pages, heads, panels, providers, masking,
library, settings and the gateway (3087 tests) had 29 reds; the same
files on origin/main d4f1d6480 had the same ones, apart from flakes:
gateway-key-limit and gateway-key-cycle (#4072, from f835bd713),
gateway-older (waits for #gateway .dot, which f835bd713 replaced; filed
with #4072's fix next), menu-input-scroll (#3402), header-centre webkit
(a ResizeObserver loop message, red on main too), account-mask chromium
zh, and gateway-caller-keys / gateway-key-models reading the page right
after a resize to 560 (#3523, #3797).
Not tried: the real Windows and Linux apps.
2026-10-28 22:44:22 +08:00
yetone 76218200af gui: a demo's made-up account is never blurred by Hide accounts (data-no-pii)
outloudvi on Discord (#feedback, 1564923315095732276): with Hide accounts
on, the masking demo's letter on Insights › Masking had its account
(yetone@example.com) blurred and its password (hunter2-prod) not. The
blur is hideAccounts, which masks every address in the window's body.
It isn't the demo's own masking. The demo's values are made up, and
showing them is the point of it.

An element marked data-no-pii, and everything inside it, is now skipped
by the text walker and the tooltip pass. The demo's section carries the
marker. The class: any illustration with made-up accounts takes the same
attribute. A search of the GUI assets found no other drawn one. The only
other fake address is ops@company.com, in input placeholders, which the
blur never touches. Text added later in a marked element stays unmasked
too: the observer's mask(e) passes through the same checks.

New test masking-demo-unblurred: Hide accounts on, an address elsewhere
on the page still masked, the demo played (reduced motion on and off),
its account and password slots both readable, and no .pii in #maskDemo.
A generic [data-no-pii] element with a title and text changed after
masking stays unmasked. It runs en and zh, in both engines.

Run on mote:
- masking-demo-unblurred and masking-demo at this tree: green.
- go test -tags nogui -run Budget ./internal/gui: ok (no budget raised).
- The 124-file GUI run in the commit before, at this tree: none of its
  reds in masking files (masking-records zh-TW was green when rerun).
Broken by hand:
- Marker removed from client.js: red, account slot "ilottn@aamital.cmd"
  in webkit (the reporter's blur).
- Walker and title checks removed from app.js: red.
Not tried: Linux and Windows.
2026-10-28 17:58:50 +08:00
yetone 6af83172d3 gui: the masking demo shows no video where WebKitGTK can't play one (avk458 on X)
On Omarchy (Arch + Hyprland) without gst-plugins-good, opening Masking's
"How masking works" aborted WebKitWebProcess about 3s later: WebKitGTK
2.52.6 gives every <video>, muted ones too, an autoaudiosink, which lives
in libgstautodetect.so ("no such element factory autoaudiosink", then a
SIGABRT). The window was left frozen on its last frame ("一点就崩溃再点
magpie就卡死了").

Cause: b90e81da1's noVideo was only in GET /api/settings. The page's
state.settings comes from /api/state, which never carried it, so a demo
opened before Settings was visited set the webm src. The GUI fixture put
noVideo into /api/state's settings and hid it.

Now boot.js says noVideo (app only, not a browser tab) before the page
paints, and demo.js reads window.bootPrefs.noVideo; the poster shows
instead. Also, for BoyC338's memory question: folded, or with the page
left, the video lets go of its source (removeAttribute src + load), so
no decoder or buffer is held; opened again it goes on from where it was.

Run:
- mote: GUI masking-demo, masking-records, i18n-keys in Chromium and
  WebKit: 116 pass, 0 fail.
- mote: go test -run 'TestBootSaysNoVideo|TestBoot|TestSettings|
  TestFontSettingsAPIAndBoot|Budget' ./internal/gui ok; gofmt -l none;
  vet for darwin, GOOS=windows, GOOS=linux -tags nogui ok.
- WSL magpie-desktop: go test -tags gtk3 -run 'TestBootSaysNoVideo|
  TestGstAutodetect|TestWebkitDefaults|TestSettings' ./internal/gui ok.
- Real app on omarchy, v0.1.1840 release: Masking > demo row aborted
  WebKitWebProcess (coredump 07:10:10 UTC), window frozen. Built this
  tree with make release-linux in WSL and ran it there: demo opens with
  the poster and animates, fold/reopen, Agents and back to Masking all
  respond; no coredump, no autoaudiosink line, both web processes alive.
These ran at base ea53eb126; rebased onto 05ed578bd (redact/gateway
changes, none in internal/gui) and the budgets run again before push.

Broken by hand:
- demo.js reading state.settings?.noVideo: the poster test is red in
  both engines.
- hold() commented out: the folded test is red in WebKit.
- boot flag removed: TestBootSaysNoVideo is red.

Not tried: a Linux system with gst-plugins-good (the video path there
is unchanged); arm64 Linux. Recovering a window whose web process died
(web-process-terminated) is not handled by magpie or Wails; not in this
commit.
2026-10-28 15:25:53 +08:00
yetone a41d0d5098 redact: the demo's notebook has a square icon and its entries under the header
The owner's screenshot of the masking demo's "小鹊的小本本" box: the
notebook icon was stretched tall, and the two entries overlapped the
subtitle and each other.

- The icon carried the class "acc", which app.css already styles as an
  accounts row (flex, min-height 38px, padding), so the 22px tile came
  out 38px tall. It is xq-acc now; none of the demo's other short class
  names (on, done, hot, ok, hl, far) has an app.css rule of its own.
- The entries were placed at fixed tops (40 and 81) under a header that
  is ~41px tall in CJK fonts. They are a flowing list now, after the
  header: each entry is its placeholder pill over its value, 5px apart,
  and a highlighted entry gets a soft background instead of colliding.
  The flyers already land on the values' measured positions, so the
  animation follows.
- German's title "Notizbuch der kleinen Elster" wrapped to two lines
  in the 220px box and pushed the last entry 14px out of it (the
  existing no-clip check caught it). It is "Notizbuch der Elster".

Test: masking-demo's layout test checks every box icon is 22×22 and
that each notebook entry starts at least 4px below what is above it.

Run at this tree (a463b3ede + this change), on mote:
- masking-demo + masking-records, both engines: 110 of 110.
- gui-de, gui-ja, gui-zh-tw, i18n-keys, mask-actions, mask-emails,
  masking-demo, masking-records, redact-kinds, redact-rule-edit,
  redact-rule-row, redact-shape, redact-words-any-case,
  redact-words-whole: chromium 259 of 259; webkit 135 of 136. The red
  was mask-emails' page.goto at its 5s default on the Routing page,
  at load ~80; alone it passes 3 of 3 here and 2 of 2 on origin/main
  a463b3ede. Filed as #3995 (the class of #3525).
- Screenshots of the notebook at the demo's end in zh dark, en light,
  de light and ja dark, both engines: square icon, entries under the
  header, nothing clipped.

Rebased onto 58fb3a778 (it adds a Windows modal-backdrop rule to app.css),
then run again at the pushed tree: masking-demo, masking-records,
i18n-keys and gui-de, both engines: 117 of 117. 60520ddb3 (moejs's module path, no GUI
file) landed after; the push is rebased onto it.

Broken by hand: the old demo.js and redact.css with the new test are
red in every language (icon 22×38, gaps false); with only the class
renamed, the old fixed-top entries are still red (gaps false, false).

Not tried: the real desktop app; the change is CSS and DOM order in a
page the GUI suite loads as the app does.
2026-10-28 14:39:34 +08:00
yetone b90e81da14 gui: on Linux without gst-plugins-good the masking demo shows her poster
On stock Omarchy (Arch + Hyprland, WebKitGTK 2.52.6, GStreamer 1.28.6
with gst-plugins-base and -bad only), opening the masking demo aborted
WebKitWebProcess about three seconds in, so the app's window went blank.
WebKitGTK gives every video, a muted one too, an audio sink it makes with
autoaudiosink ("GStreamer element autoaudiosink not found", then a NULL
g_signal_connect, then SIGABRT); that element is in gst-plugins-good.
canPlayType can't tell: an Ogg Theora copy, "probably" playable there,
crashed the same way, so no other format would do.

The Linux app now looks for libgstautodetect.so in GStreamer's plugin
folders (its variables' and the system's): GStreamer's core there and
autodetect in none of them means no video (webkitPlaysVideo). Settings
state says noVideo then, in the app only (magpie web plays in the user's
own browser), and the demo sets no src: she is her poster and the sheets
move on the frame clock, as when the video can't load. No GStreamer folder
found says nothing, and video stays on.

Run at this head (origin/main 0f053024f + this change; the runs were at
ec6c2de52 + this change, and 0f053024f changes only README and site/):
- mote: node --test masking-demo, masking-records: 110 pass, 0 fail
  (Chromium and WebKit; the new poster test in both).
- magpie-desktop (WSL, Ubuntu 24.04): go test -tags gtk3 -run
  'TestGstAutodetect|TestWebkitDefaults|TestRenderNodeOpens|TestSettings'
  ./internal/gui: ok.
- mote: GOOS=linux CGO_ENABLED=0 go vet -tags gtk3, GOOS=windows go vet
  and go vet of ./internal/gui: ok. gofmt -l: none.
- omarchy, the real check on the real system, from a test binary built
  at this head: webkitPlaysVideo() is false
  ([/usr/lib/gstreamer-1.0 /usr/lib64/gstreamer-1.0]); on magpie-desktop,
  which has gst-plugins-good, true.
- omarchy, WebKitGTK driven from Python on `magpie web`'s page: with the
  demo's webm src set, the web process aborts every time (core dumps
  23:07:33, 23:10:17, 23:12:59, and 23:18:30 with an .ogv); with no src,
  as this change does, it stays up and T runs (2.99 -> 4.39 s).
- Broken by hand: gstAutodetect returning true makes TestGstAutodetect
  red ("stock omarchy: gstAutodetect = true, want false"); demo.js setting
  src regardless makes the poster test red in both engines.

Not tried: clicking the demo row in the real desktop app on omarchy (no
pointer tool there); the app's half was checked through the same
WebKitGTK and the detection through the real folders, separately.
2026-10-28 07:31:02 +08:00
yetone f13aafa87e redact: the masking demo card keeps 14px from the card above it
The page has no gap of its own; the request list keeps its distance from
the card with margin-top: 14px. The demo card, put between them in
cad7bbbdb, had none, so it sat flush under the card above. It gets the
same 14px, and masking-demo checks the room above and below it is 14
and 14.

Run at this head (origin/main cad7bbbdb + this change), on mote:
- node --test masking-demo, masking-records: 108 pass, 0 fail
  (Chromium and WebKit, five languages, 1100 and 640px).
- Broken by hand: without the margin, the new check is red (0 for 14,
  WebKit en 1100px).
2026-10-28 06:56:38 +08:00
yetone cad7bbbdb7 redact: Insights › Masking shows how masking works, with Little Magpie, folded until opened
A card under "What the vendor didn't see" and above the request list
plays a 27s demo: Little Magpie takes one request (a GitHub sign-in with
a password and an email), tears the real values out into her notebook,
pastes placeholders in, sends it, and swaps them back on your computer
when the tool call comes home.

- Folded by default. The video (xq_light/xq_dark.webm, 1.7MB/1.5MB) and
  the stage are built only on the first open, so a folded card fetches
  nothing but its 0:27 thumbnail.
- It plays only while open, on screen, in a visible window and not
  covered by a single record's sheet; it plays once and rests on the
  last step. Under reduced motion it shows the last step, still.
- The stage (request, notebook, browser, provider) is drawn in the page
  and translated in every language (41 keys, zh, zh-TW, ja, de); only
  Little Magpie herself is video. Light and dark takes match the card's
  colour exactly, and the take follows the theme as it changes, still
  playing (a new source starts paused, so it is woken where T is).
- The request and provider boxes keep room for taller fonts: WebKitGTK's
  Noto ran the provider's note 16px past its box. The stage is 1000x420.
- T, the frame clock, is the authority; a video that drifts (a seek
  it couldn't make) is sent back to T, never the other way.

Run at this head (origin/main 4842f69be + this change), on mote (macOS 27):
- node --test masking-demo, masking-records, i18n-keys: 111 pass, 1
  fail. The red is i18n-keys "a plugin's words are its own" on
  plugins/library "Runs as", red on main since 7f827b3b0 (#3897).
- masking-demo: Chromium and WebKit x en/zh/zh-TW/ja/de x 1100/640:
  folded fetches no webm, opening fetches one, the stage fits, no
  English left, nothing wider than the window, every box's text inside
  it (4px to spare in request and provider); plays, stops when folded
  or covered, rests at the end, restarts; dark take on the card colour;
  a theme changed mid-play goes on playing in the new take.
- go test ./internal/gui/: only TestMainWindowCorners/macOS_26_SDK red,
  the same on main (#3949); TestCoreScriptBudget ok.
- gofmt clean (no Go changed); go vet, GOOS=linux go vet -tags nogui,
  GOOS=windows go vet ./internal/gui/ clean.

Broken by hand:
- T following vid.currentTime (the first take): "plays while open" red
  in Chromium (the step 7 seek never stuck); green after.
- pickVid without wake(): the theme test red in both engines (0/2).
- The provider box at 350px: the no-clip check red ("prov -26px").

Whole GUI suite (*.test.cjs, mote, before the rebase, at dc1cfe015 +
this change): 75 files pass, 33 fail; origin/main 9e6347608 alone: 73
pass, 35 fail. Every file red with this change is red on main too:
account-mask (#3951), gateway-caller-keys (#3797), gateway-key-models
(#2648), header-centre (#3479), icon-tile (#3858), library-row-remove
(#3099), menu-input-scroll (#3402), mobile-web (#3952), old-webkit
(#3403), phone-web (#3876), quota-count-wrap (#3404),
quota-refresh-order (#3679).

Real use, magpie web from this tree:
- Windows 11 (xiaomi-gpu), Edge 156 headless = WebView2's engine:
  folded fetches no webm, VP9 "probably"; rAF 60fps, video 30fps, T
  never steps back; the step 7 seek holds; the theme switch keeps
  playing; rests at 27.5s; no page errors; every box fits in all five
  languages (8px or more to spare).
- Linux (WSL2 magpie-desktop, WebKitGTK 2.52.6 under Xvfb, compositing
  off as under Wayland): plays with T on the video's time, seeks, rests
  at the end, no errors. It found the two fixes above: the theme switch
  left the new take paused, and the provider's note ran 16px past its
  box in English and Japanese (and the request box 6px in ja and de). After: 10px or more to
  spare in all five languages.

Not tried: the packaged Linux and Windows apps themselves (magpie web
in their engines stood in); a real request through masking (the demo
is drawn, not live).
2026-10-28 06:43:31 +08:00
yetone e52a5e50ba redact: a request opens by its key again; the key goes to the GUI as a string
The owner opened the newest masked request and got "This request's
record is gone: records are kept for 30 days", and a request opened from
the list said its whole text was no longer in memory. A record's key is
its time in nanoseconds (~1.79e18), past 2^53, so JSON.parse rounded it
to 256ns: /api/masking/record?key= and /api/masking/sent?key= looked up
a key no record has. A list row worked only because it carried its
record. Every way in by key failed: the Gateway page's and tray panel's
masked badge, ?key= in the address, and each request's sent text; the
list's before= paging was off by the rounding too.

gateway.Masked's key and /api/masking/record(s)' key now go as JSON
strings (",string"); records on disk keep their number. The page keeps
the key a string (no unary +), and a refresh compares keys as BigInt.

Tests: TestMaskedRequestIsRecorded and TestMaskingRecordsAPI check the
key is a string, and masking-records' fake API uses 19-digit string keys
in place of 1001-1005, which no rounding touched.
Broken by hand: with the Go change out, both Go tests fail ("key not a
string"); with the page.js/client.js change out, "chromium: a masked call
on the Gateway page, and a key in the address, open its request" fails.

Run: go test ./internal/gui (twice ok; a first run under load ~180 went
red with its log cut by tail, so the test is unnamed; two reruns with
the whole log were ok), ./internal/gateway ok, ./internal/maskrec ok;
GOOS=linux/windows go vet ./internal/gateway ok; GUI masking-records,
routing-bodies, i18n-keys: 96 of 96 ok, both engines.
Not tried: the real app with a real masked request.
2026-10-26 22:50:37 +08:00
yetone 29f1a5a717 redact: a request's steps are joined number to number, not by a dash before each
The owner's screenshot of a masked request showed a short dash left of
steps 2 to 5. The connector (li + li::before) was 10px wide at left
-10px, so it covered only the grid gap, and read as a stray dash beside
each number. It now runs from the number before to this one, 6px clear
of each (columns are equal, 10px apart, numbers 20px).

masking-records' request test measures each line's ends against the two
numbers: 6px from each.

Run: masking-records.test.cjs whole (both engines, every language, 1100
and 640px), 82 of 82 ok. At 640px (container under 760px) the lines stay
hidden, as before.
2026-10-26 22:50:37 +08:00
yetone 630fd1d691 masking: Clear records… deletes what masking kept, after a confirm (maxyou2090)
maxyou2090 (#feedback) turned on strict masking and it recorded many
requests, with no way to delete them short of finding
~/.config/magpie/masking by hand.

Insights › Masking's list now ends in "Clear records…" (beside "Kept on
this computer for 30 days", shown while anything is kept). It asks first
with the app's confirm dialog (Cancel / Clear, red), then posts
/api/masking/clear and reads the page again: an empty list and card. A
clear that fails says why in the status pill and the list stays.

maskrec.Clear removes each day's file whole under the store's lock (a
day is removed, never rewritten, so there is no half-written file to
guard against), forgets each day's cached summary, and drops the text
around placeholders and the bodies kept in memory. A day it can't
remove stays, is still listed, and is named in the error. Keys keep
rising, so a record after the clear never takes an old key. What the
masker holds for each placeholder stays: a placeholder still in an
agent's context is put back in its answers. GET on the route does
nothing. Strings in zh, zh-TW, ja and de. gateway-routing.md says it.

Tests:
- internal/maskrec TestClear (three days and a stray file: the days go,
  the stray stays, List/Sum/Get/SentOf are empty, keys keep rising, a
  new Add counts) and TestClearSaysWhatStays (a directory it can't
  write: the error names 2026-10-26.jsonl and the record is still
  listed). With Clear stubbed to return nil both go red
  (maskrec_test.go:220 "left in ...", :260 "err <nil>").
- internal/gui TestMaskingRecordsAPI: GET clears nothing, POST clears,
  records/summary empty, record/sent 404. Red with Clear stubbed
  (masking_test.go:127).
- GUI masking-records.test.cjs: "Clear records asks first, then
  empties the page" in Chromium and WebKit, en/zh/zh-TW/ja/de, 1100 and
  640px (Cancel sends nothing; Clear posts once; nothing wider than the
  window; the click scrolls nothing; nothing left in English), and "a
  clear that fails says why and keeps the list". Red on the old page.js
  (the button never appears).

Run, at this commit (on origin/main 44a626bed; vet, maskrec, the gui Masking tests and the 22 new GUI cases again after that rebase):
- gofmt -l internal/maskrec internal/gui: clean. go vet on darwin,
  GOOS=linux -tags nogui and GOOS=windows for both packages: ok.
- go test ./internal/maskrec: ok. go test -run 'Masking|Budget|Script'
  ./internal/gui: ok.
- GUI: masking-records.test.cjs whole and i18n-keys.test.cjs, both
  engines: 86 pass, 0 fail (before the rebase onto a6c808b68, which
  touched no GUI file); the 22 new cases again after it: pass.
- Full suite, go test -tags nogui ./... -timeout 45m, at bdc25ec13: not
  a record. The machine's data volume was full (897 of 926 GiB, 3.2 GiB
  free afterwards), and backup, mcpauth, davsync, provider, cli, gateway
  and gui failed on "no space left on device" or failed to build.
  maskrec passed in it. The whole GUI suite was not run for the same
  reason.

Not tried: clearing in the real app with a real masking folder.
2026-10-26 18:07:19 +08:00
yetone 4b3bdbe28c masking: the flow's dots, scan and Live dot stop moving once played (#3185)
The Masking page never came to rest. Each dot in its agents-to-providers
flow was an SVG animateMotion with repeatCount "indefinite", the scan
mark on the middle line ran forever, and the Live dot pulsed forever.
The SMIL dots alone made Chromium lay the page out ~700 times a second
(6,965 layouts and 2,282 style recalcs in 10s, read with CDP
Performance.getMetrics). Removing just those 22 elements took it to 0.

Now each dot goes round twice when the flow is drawn, and the scan mark
plays twice. The flow is drawn again only when the numbers change. The
Live dot pulses once each time the list is drawn again, which happens on
each 15s read. Reduced motion is unchanged: still no motion at all.

Measured on a sandbox `magpie app` (origin/main, sandbox HOME, real
deepseek provider, the real masking log copied in: 19,657 values over
577 requests). The Masking page was loaded in Playwright 1.62.0, and only
that browser's own processes were sampled with proc_pid_rusage, 20s per
sample:
- WebKit, before: 180 wakeups/s, 2.8% CPU, 56 mW.
  After: 37/s and 9.7 mW while the motion plays out (8-28s), then
  10.8/s, 0.1% CPU, 1.4 mW.
- Chromium, before: 96-98/s, 17% CPU, 537-543 mW.
  After: 40/s, 2.0% CPU, 57 mW while the motion plays out, then
  18.5/s, 0.5% CPU, 10 mW.
- The other pages at rest: 12-30/s and 1.6-7.7 mW in WebKit.

Test: masking-records' new "the masking page's motion ends" (chromium
and webkit, 1100px and 640px). It moves the SVG clock on an hour and
asks Chromium whether any dot is still in an interval. In both engines
it checks that no SMIL element is set to repeat for good and that no
CSS animation has an infinite end. All 4 cases are red on the old
page.js/redact.css and green on the new ones.

Run at this tree:
- masking-records, held-animations and i18n-keys: 68/68.
- account-mask-sessions, account-mask, mask-actions, mask-emails,
  provider-unmasked and redact-*: 172/172.
- go test -timeout 45m ./internal/gui: ok.
- GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gui: ok.
- gofmt: clean.

Other states measured, with no change made:
- Go main process at rest with the window open: 25/s, 7 mW.
- Streaming 3 deepseek-flash replies (2,450 SSE events in 20s):
  275/s, 3.5% CPU, 107 mW, about 2 wakeups per event.

Not tried: the window hidden and the tray panel open; the
WKWebView in the real app window on Masking (measured in Playwright's
WebKit instead); the full GUI suite.
2026-10-25 20:33:33 +08:00
yetone 642180a809 redact: Insights › Masking and Try it mark a made-up key as a placeholder (#3599)
With "Keep a key's form" on (bea9f905d), a secret goes to the vendor as
a made-up key of its form, kept in the record as its placeholder. The
Masking page and Settings' Try it only matched {{…}}. So a request
masked that way showed no changed text: no marks, nothing side by side,
nothing lit. Try it showed the made-up key as plain text.

maskMatches (plugins/redact/page.js) matches the {{…}} placeholders and
the record's own non-{{ placeholders, longest first. A key of the same
form that the user wrote is not marked. All five page.js uses and
maskTryDraw in app.js use it. app.js grows 3 bytes.

Run at this head (origin/main 7536477c8):
- masking-records "a made-up key is marked as a placeholder is"
  (chromium/webkit, en/zh): red 4/4 on the old page.js/app.js (no
  .msk-msg drawn), green 4/4 with the fix.
- mask-actions "Try it marks a made-up key" (chromium, webkit): red 2/2
  on the old code (marks [] for [MADE, MADE]), green 2/2.
- GUI files masking-records, mask-actions, redact-*, privacy-*,
  provider-unmasked, vision-not-marked and i18n-keys, both engines,
  every language: 270 of 270 pass.
- go test ./internal/gui -run 'Budget|Assets|Script': ok.
- Rebased onto 642d430ec: six commits, and in the GUI only app.css and a
  heatmap test. Re-run at the pushed head: the budget tests ok, the six
  new GUI tests 6/6.
- Real run: a sandbox HOME with `magpie web` built from this tree,
  redact + redactShape on, a fake provider with an echo upstream, and
  "OPENAI_API_KEY=sk_w3ax…" sent through the gateway.
  - The upstream got sk_t1ns….
  - Insights › Masking marked sk_t1ns… on the vendor side and sk_w3ax…
    as written here; picking the value lit both.
  - Try it marked sk_t1ns….
  - No page errors.

Found on the way and filed: #3601. A value found by its KEY= context
is masked there only, and its other copies go as written, in either
mode.

Not tried: the old code in the real app (the GUI tests cover it), and
WebKitGTK/Windows.
2026-10-25 19:57:25 +08:00
yetone dc6f3d496c masking: the flow's logos sit on one disc each, before the name on both sides
Insights › Masking's flow card showed each agent's and provider's logo
bare in a 16px box. A logo's own drawing fills that box or not (Pi's
edge to edge, Codex's a small tile, Alma's a picture), so three logos
of one box read as three sizes (the owner's screenshot). And an
agent's logo came after its right-aligned name, so the logos and the
names on that side lined up with nothing.

- Every logo sits 14px on a 24px disc (card fill, hairline ring), the
  disc the app's agent stacks use.
- Both sides read logo, then name over count, left-aligned. The
  agents' nodes are one block against the lines (a grid track as wide
  as the widest), so their logos make one column and their names one
  edge, as the providers' do.

Run (rebased on origin/main of 19:00, 10-25):
- masking-records.test.cjs: 52/52, Chromium and WebKit, 5 languages,
  1100px and 640px. Its flow check now asserts logo before name on
  both sides, a 24px round disc for every logo, and one column of
  logos and one edge of names per side.
- Screenshots with the owner's case (Pi, Codex, Alma → OpenRouter,
  Codex, OpenCode Zen), dark, 1x and 2x, looked at.

Broken by hand: the agent's logo back after its name turns
masking-records red ("the logo before the name").

Not tried: the light theme by eye (the disc is drawn from theme
tokens), the real app on WebKitGTK or Windows. Budgets untouched:
plugins/redact isn't in the core.
2026-10-25 19:14:47 +08:00
yetone 9277c25673 masking: under the number, the flow's middle takes the card's width, and sits further from the chart
The owner's screenshot of Insights › 脱敏 with the band stacked: the
animation stayed narrow, as each of the flow's three columns kept a
third of the card, and it sat 16px under the chart.

Under 780px the names now take what they need (fit-content, up to 150px,
120px under 640px) and the middle the rest; the gap is 28px. Measured in
Chromium, the middle's width before → after: 760px window 386 → 452,
640px 189 → 365, 560px 162 → 285, 480px 135 → 205. 820px and up (the
flow beside the number) is unchanged.

Run: screenshots at 760, 640 and 560 in Chromium and WebKit, before and
after; GUI masking-records 52/52, privacy-usage-stats 4/4, mask-actions
20/20, i18n-keys 4/4, click-scroll 22/22; privacy-model 23/24 in that
run, beside a Go test run, and 24/24 three times alone after it (the
failing test's name wasn't kept); go test -tags nogui -run Budget
./internal/gui ok.
Not tried: the whole GUI suite; the real Linux app (WebKitGTK).
2026-10-25 17:05:38 +08:00
yetone 894603bcd8 masking: the Insights card says what Turn on masking masks, and your own words count as on
Lesnolie on X: masking is on and Insights › Masking "stays at 0". Run in a
sandbox HOME, built from origin/main, against a fake upstream: every count
is right. Each case below went chat, responses and anthropic, streamed and
not, in Claude Code and Codex shapes:
- with secrets only on, a request with a key masks it, the summary, the
  shield badge and the day's record under masking/ count it, and the reply
  gets it back;
- an email counts only with Mask personal data on.
The 0 is what the page promised. The off card said "keys, passwords,
computer names and emails become placeholders", but its Turn on masking
button turns on secrets only. Computer names aren't masked even with
personal data on. Everyday agent traffic carries no key, so the count
stays 0, under a line that says a request with personal data shows there.

Now:
- The off card names what the button masks: keys, passwords and tokens,
  and emails and phone numbers once Mask personal data is on.
- With secrets alone on and nothing masked yet, the empty line says only
  keys, passwords and tokens are masked now, and that emails and phone
  numbers are masked once Mask personal data is on, with a link to
  Settings › Privacy.
- Masking with only your own words counts as on, as the gateway's
  masking.Wanted does. It no longer shows "Masking is off" while words
  are masked.

Text in en, zh, zh-TW, ja and de.

Run, both engines (Chromium, WebKit):
- GUI: masking-records, i18n-keys, redact-kinds, privacy-model and
  mask-actions all pass.
- redact-words-any-case is red, 10 of 10, and is the same on origin/main
  641b1217f with the old page.js and i18n.js (#3500, not this change).
- go test -tags nogui ./internal/gui: ok.
- gofmt -l: clean. go vet linux (nogui) and windows ./internal/gui/...:
  ok.
Broken by hand: with origin/main's page.js and i18n.js the new tests are
red in Chromium: en's off card "promises what Turn on masking doesn't turn
on", and every other language times out waiting for the Only keys line or
for the card to be on.
Not tried: the real macOS, Linux and Windows apps, the whole GUI suite.
Not changed (seen while checking):
- Put-back counts, sent text and values live only in the serving
  process's memory, so a window that doesn't serve the gateway, or one
  after a restart, shows none.
- user@host.local counts as an EMAIL.
2026-10-25 10:40:54 +08:00
yetone dbbe979914 masking: the flow goes under the number before its middle bunches up (window ~760px)
ZeRo Xu on X (10-25) showed the Masking card in a narrow window: the
flow beside the number had its middle squeezed to a sliver, the lines
bunched up and "OpenCode Zen" was cut to "OpenCod…".

The band put the flow beside the number down to a 640px container. Measured
with the reporter's data (Codex 19.6K; openai 14.1K, Codex 3.7K, OpenCode
Zen 1.9K) the flow's middle is 410px at a 1068px container, 162 at 820,
110 at 760 and 80 (its floor) at 700, where the names are cut. Now the
flow goes under the number from a 780px container, as it already did
under 640, so it has the card's whole width; the 640px rules (narrow
side columns and the rest) are unchanged.

Run at this head: GUI masking-records, privacy-usage-stats, privacy-model,
mask-actions, i18n-keys, click-scroll (both engines, all pass); go test
-run Budget ./internal/gui ok. Screenshots at 1280, 1000, 900, 820, 780,
760, 700 and 560 in Chromium and WebKit, before and after.

Not tried: the real Linux (WebKitGTK) and Windows apps; CSS only, no
motion or new API.
2026-10-25 04:18:58 +08:00
yetone d3fb381afe gui: Masking's bird sits in the middle of its ring; agents and providers show their logos
The flow's rule for its hairline layer, `.mo-mid svg { position:
absolute; inset: 0 }`, also matched the bird's svg inside .msk-hub, so
the 20px bird was pinned to the 30px ring's top-left corner (5px left
and 5px up). The rule is now `.mo-mid > svg`, and the hub's flex
centring places the bird.

Each agent and provider in the flow has its logo, from the same icon()
and maskWho icon the request rows already use: an agent's after its
name, a provider's before it, both on the side where the lines are. An
"N more" row keeps an empty slot so the names line up.

The test fixture's agent icons were "claude" and "codex", which aren't
icon files. They are now claudecode-color and codex-color, as the real
agents have.

Run at 71fd92ddf + this:
- masking-records.test.cjs + i18n-keys.test.cjs: 36/36 (Chromium and
  WebKit, every language, 1100 and 640px)
- go test ./internal/gui -run Budget: ok
- measured: the bird's svg went from the ring's corner (779,160.5) to
  (784,165.5), centred in the 30px ring

Broken by hand: the old redact.css fails "the bird in the middle of its
ring"; the old page.js fails the logo check.

Not tried: the real Linux (WebKitGTK) and Windows apps, and the whole
GUI suite. The change is confined to the masking plugin's files, and no
other page uses mo-/msk- classes.
2026-10-25 00:46:57 +08:00
yetone d08b6118bd agents: Restart a desktop app that started before magpie's change, after asking
微雨南山 and stones on Discord: Claude Desktop, WorkBuddy and the Codex
app read magpie's settings only as they start, so a change made in
magpie did nothing until they quit and reopened the app themselves.

The agent's row now carries a Restart when the app is installed, running,
and started before its config last changed (agent.AppBehind):
Claude Desktop, WorkBuddy and WorkBuddy AI on macOS (bundle executable
via pgrep), Claude Desktop and WorkBuddy on Windows (process tree, main =
earliest process whose parent is outside it). A press opens magpie's own
dialog first (confirmAction); Cancel and Escape send nothing. On accept
POST /api/agents/restart/{id} quits the app gracefully (AppleScript quit
on macOS; taskkill without /F on Windows, then /F /T after appCloseWait
for a tray that holds on), waits, and opens it again. On macOS an app
that won't quit is reported (StillOpen) and never forced. The Codex
app's existing Restart now asks first too. CLI agents get none.

changedAt: a stash digest that changed with no file written since the
app started now counts the change as now, so a change magpie made while
the app ran is seen (it was dated to the old write and missed).

app.js budget, not raised: archivePanel moved into plugins/usage/page.js
(its own comment called it the Usage page's; Routing's trace calls it at
draw time, after page.js has loaded), maskWho, maskProv and stillMotion
into plugins/redact, and usageHidOpen into plugins/usage. app.js is
1,108 bytes smaller than on main, budget unchanged.

Run (the first five at the pre-rebase head, same code):
- GUI agent-app-restart + agent-stale-copies: 120/0, chromium and webkit,
  en/zh/zh-TW/ja/de, window 980 and 440 and panel 440, no sideways scroll,
  no placeholder in aria-label or title.
- Broken by hand: without the confirm the GUI test is red; without the
  changedAt fix TestChangedAtWithoutAWrite is red; without the since gate
  TestWorkBuddyRestartOnMac and TestWorkBuddyRestartOnWindows are red.
- macOS, real fake-app processes in a sandbox HOME with a stubbed
  launcher: quit in 100ms and reopened; a held quit returns StillOpen
  after 4s, not forced.
- Windows box, console session (schtasks /IT), fake app and stub
  launcher: graceful close in 407ms; a tray that holds on is ended after
  5.66s; reopened through the stub.
- gofmt -l clean; go vet darwin (agent, gui), GOOS=linux and
  GOOS=windows; builds.
- At 2c5327925 (on origin/main 703437866): go test -tags nogui
  ./internal/agent ./internal/gui ok. 95 GUI files (mask, redact, usage,
  request-archive, routing-bodies, agent-app-restart, agent-stale-copies,
  i18n, insights, panel), 6 wide: 1380/53. 52 of the reds are the same
  tests red on origin/main 3b5a2f612 run alone, all filed: #3500
  (redact-words-any-case), #3414 (usage-agents-hide), #3415 (usage-fold),
  #2549/#3091 (usage-checkin Qoder tab, WebKit), #3001 (usage-ledger's
  route callback). The 53rd, usage-curve-zoom-back chromium zh-TW, passes
  alone 20/0 twice; noted on #2399.
- At the pushed head (on origin/main 20d63621d, which changed app.js,
  routing/client.js and the panel tests, not internal/agent):
  TestCoreScriptBudget (budget unchanged), go test ./internal/gui ok,
  gofmt clean, go vet gui for linux, windows and darwin. 45 GUI files
  (routing-bodies, request-archive*, panel*, agent-app-restart,
  agent-stale-copies, i18n-keys, library-mcp*, mask-actions,
  masking-records, usage-agents*, usage-ledger*): 720/28. The only reds
  are #3414's and #3001's. Then rebased on aa3112f4e (app.js's panel fit()
  only): TestCoreScriptBudget, i18n and notice tests ok; agent-app-restart,
  i18n-keys and panel-fit-tabs 54/0.
- Not run at this head: the full go test ./... and the whole GUI suite
  (the machine's disk filled mid-run once; shipped on the packages and
  files above, per ship-immediately).

Not tried: a real AppleScript quit from a GUI session (this session is
Background, so the fake was quit by SIGINT and opened by exec), the real
Claude Desktop and WorkBuddy apps (never quit the user's running apps),
Codex app and WorkBuddy AI on Windows (process names unknown, so no
button there), Linux (no desktop app of these runs there).
2026-10-25 00:30:31 +08:00
yetone 0df6a3aba9 gui: Insights › Masking's request kinds and day names move into its plugin, and the core budgets go back to what they were
118486258 raised app.js's budget by 390 bytes and the core's by 301
for the Codex row's too-old note. A budget raised whenever a change
reaches it bounds nothing (LESSONS.md), so this takes them back to
1,317,486 and 1,524,789 and moves code out instead: MASK_WHAT and
maskDayName were left in app.js when Masking moved to plugins/redact
(10-24) and nothing but plugins/redact/page.js uses them (no other
asset, test or Go file names either). They go to the top of page.js
unchanged. app.js is 1,317,325 bytes now, 161 under; the core's
scripts 1,524,539, 250 under.

Run:
- go test -tags nogui ./internal/gui/... : ok (TestCoreScriptBudget
  passes at the old budgets).
- GUI (node --test, chromium + webkit): codex-async-compact,
  agent-prefs, settings-general, segs-glide, i18n-keys, mask-actions,
  masking-records, privacy-model, redact-rule-row,
  privacy-hides-accounts, redact-rule-edit: 208 pass, 0 fail.
- broken by hand: maskDayName renamed away in page.js makes
  masking-records red (11 of 16 in chromium); restored, green.

Not tried: the whole GUI suite; the Masking page in the real app.
2026-10-24 22:27:22 +08:00
yetone e698a688fd gui: Insights › Masking shows each request as sent, what was masked and how
What masking did moves out of Settings › Privacy into a page of its own
under Insights (plugins/redact: client.js, page.js, redact.css, i18n.js).
Privacy keeps how it is found and what to mask, with a "What was masked"
row that opens the page.

- The top card is Privacy's card, made shorter: the flow animation
  (agents → this computer → providers) with magpie's bird on the centre
  line and "magpie masks it on this computer" under it, so a screenshot
  says who masked it; the count and a 7-day bar. Nothing the list repeats.
- The list: one row per masked request, narrowed by kind, by who found it
  (rules or the local model), by agent or provider, or to held-back
  requests; or by value, each with how often it was put back.
- A request: the message as it went to the vendor beside the original,
  each mask marked, unchanged parts folded; picking a value lights every
  place it was masked; a held-back request offers "Mask it instead".
- Gateway's masked badge and ?view=masking&key=N (trace.go's mainView)
  open one request.
- Classes are msk-: library.css owns mk- (a first cut stacked the flow).
- Budgets lowered to the core's size after the move.
- Not shown: rule names and the local model's confidence; the records
  don't keep them.

Run on f5b1d36ff (rebased since onto 344d11484, which only raised the
budgets and changed a dialog's centring and two unrelated files):
- masking-records.test.cjs: 32/32, Chromium and WebKit, 5 languages,
  1100px and 640px (card, list, filters, detail, put back, held back,
  Gateway badge, deep link, Settings row, no scroll on click), with
  key-import and i18n-keys: 48/48.
- go test ./internal/maskrec ./internal/redact ./plugins/redact
  ./internal/gui ./internal/provider: ok. TestCoreScriptBudget and
  TestMainView ok; gofmt -l clean.
- Before the rebase, on 628e18987: go test ./... -timeout 45m, every
  package ok; GOOS=linux go vet -tags nogui ./... and GOOS=windows go
  vet ./... clean.
- Budgets lowered to the sizes at the pushed head (app.js 1,317,486,
  core 1,524,789), ~26KB under what f35c721c4 raised them to after
  ce5b23cdb's add-key spinner put the core over.

Broken by hand: the bird's href (#bird → #nobird) turns masking-records
red.

Not run at this head when pushed: internal/gateway, which main's newer
commits touched (run right after; the result goes on the release).
Not tried: the whole GUI suite (hours long, and another session's runs
held the machine), the real Linux (WebKitGTK) and Windows apps.
2026-10-24 19:45:03 +08:00