From 0df6a3aba9a14a4716655293ad9dc8b331e379d4 Mon Sep 17 00:00:00 2001 From: yetone Date: Sat, 24 Oct 2026 22:27:18 +0800 Subject: [PATCH] =?UTF-8?q?gui:=20Insights=20=E2=80=BA=20Masking's=20reque?= =?UTF-8?q?st=20kinds=20and=20day=20names=20move=20into=20its=20plugin,=20?= =?UTF-8?q?and=20the=20core=20budgets=20go=20back=20to=20what=20they=20wer?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- internal/gui/assets/app.js | 9 --------- internal/gui/assets/plugins/redact/page.js | 11 +++++++++++ internal/gui/core_budget_test.go | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index 36fdd3705..cd613752d 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -22028,8 +22028,6 @@ const MASK_KINDS = { }; // who found a value (redact.By*) const MASK_BY = { rule: "Rules", yours: "Your rules", word: "Your words", model: "Local model", known: "Seen before" }; -// what a request was, beside a chat (gateway's noteMasked) -const MASK_WHAT = { search: "Web search", image: "Image", video: "Video", decide: "System One", embeddings: "Embeddings", audio: "Audio" }; const SHIELD = "M8 1.8 13 3.6v4.1c0 3-2.1 5.4-5 6.5-2.9-1.1-5-3.5-5-6.5V3.6Z"; const PLACEHOLDER = /\{\{[^{}\s]{1,64}\}\}/g; let maskSum = null; // the summary Insights › Masking read last: its kinds' colours @@ -22062,13 +22060,6 @@ function maskDot(k) { d.style.background = maskColor(k); return d; } -function maskDayName(when) { - const d = new Date(when), now = new Date(); - const days = Math.round((new Date(now.toDateString()) - new Date(d.toDateString())) / 86400000); - if (days === 0) return t("Today"); - if (days === 1) return t("Yesterday"); - return d.toLocaleDateString(intlLang(), { weekday: "short", month: "short", day: "numeric" }); -} // maskValue: what placeholder p stood for, or null where this magpie no // longer knows. A value it doesn't know isn't kept as such: the same value diff --git a/internal/gui/assets/plugins/redact/page.js b/internal/gui/assets/plugins/redact/page.js index 3631e3244..7870b26c4 100644 --- a/internal/gui/assets/plugins/redact/page.js +++ b/internal/gui/assets/plugins/redact/page.js @@ -5,6 +5,17 @@ // never on disk, so after a restart it is gone; so is the text a request // went out with (/api/masking/sent), kept for the newest requests only. +// what a request was, beside a chat (gateway's noteMasked) +const MASK_WHAT = { search: "Web search", image: "Image", video: "Video", decide: "System One", embeddings: "Embeddings", audio: "Audio" }; +// maskDayName: Today, Yesterday or the date a masked request went on +function maskDayName(when) { + const d = new Date(when), now = new Date(); + const days = Math.round((new Date(now.toDateString()) - new Date(d.toDateString())) / 86400000); + if (days === 0) return t("Today"); + if (days === 1) return t("Yesterday"); + return d.toLocaleDateString(intlLang(), { weekday: "short", month: "short", day: "numeric" }); +} + // ---- the summary: over 7 or 30 days, kept per machine ---- let maskSumDays = 0, maskAt = 0, maskBusy = null, maskBusyDays = 0; let maskDays = 7; diff --git a/internal/gui/core_budget_test.go b/internal/gui/core_budget_test.go index c905af801..d28e3317c 100644 --- a/internal/gui/core_budget_test.go +++ b/internal/gui/core_budget_test.go @@ -15,8 +15,8 @@ import ( // so a page can't quietly grow back into the core; a change that needs more // raises them and says why in its commit. const ( - appScriptBudget = 1_317_876 // app.js: 1,198,239 after Usage left (P2); 1,218,098 with the 10-15 fixes to pages still in the core; 1,232,466 with the provider editor's Advanced fold and every dialog holding its place, the core's own (10-16); 1,250,533 with the quota refresh kept through redraws, the core's own since the tray panel draws it too, plus 1.5% (#2397); 1,269,083 with Free first's option in the provider editor's ROUTINGS, which the Routing page reads too, plus 1.5%; 1,272,726 with the Providers page drawing its last list at once (#1519), the core's page, and the Routing trace's account names read without Object.entries (#1481), plus 1.5%; a dialog growing out of the row that opened it and folding back into it, the core's own since every page's dialogs open through it (10-20); Codex's and Claude Code's own settings moved from Settings into the agent's row on the Agents page, the core's own since the tray panel and the window both draw them (10-20); 1,314,432 with Settings › Privacy's record of what was masked (its summary, the records view and the local model's controls), which belongs to Settings, the core's own, plus 1.5%; 1,336,481 with a provider's Names & levels saying Provider in model names is Settings' and opening it there (joe), and Settings' Image recognition saying where a custom provider's model is marked (nexnull), both in the core's own pages, with no room added (10-23); 1,337,633 with Settings › Models › Replies' Intent classifier timeout (#2934, reyoung), Settings' own row, drawn by waitRow, which the Image generation timeout's row now shares, with no room added; 1,337,735 with the provider editor's link naming a partner's page by its own host (siteHost) instead of usemagpie.ai's /go link, the core's own editor, with no room added (10-23); 1,338,084 with Check in now saying what the press came to (claimed +credits, already today, not available yet) where it said "refreshed" (#3326), the check-in row the tray panel draws too, the core's own, with no room added (10-23); 1,338,929 with a new partner's tile keeping a small dot until it is opened, in the add sheet, the core's own, with no room added (10-23); 1,343,324 with the sidebar's open-page row marked by one shape that moves on a spring (navTopGo), the window's own shell, which every page sits beside, with no room added (10-23); 1,343,465 with a dialog kept centred while its content comes in, until it is pressed (holdModal, every page's dialogs), the core's own, with no room added (10-24); 1,317,486 with what masking did moved out to Insights › Masking (plugins/redact), the budget lowered to it (10-24); 1,317,876 with Codex's background compaction row saying when a Codex here is too old for its share (codexAsyncHeld, 多喝热水), the agent's own row in the core, with no room added (10-24) - coreScriptBudget = 1_525_090 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it; 1,472,589 with the dialog that grows out of its row and the agents' own settings in their rows, on main's 10-20 core work (the Providers page's last list, the Routing trace's names), plus 1.5% (10-20); 1,506,192 with Settings › Privacy's record of what was masked, plus 1.5%; 1,529,393 with the Intent classifier timeout row (#2934), with no room added; 1,529,495 with the editor's partner link host, with no room added; 1,529,844 with Check in now's press summary (#3326), with no room added; 1,530,689 with the new partner tile's dot, with no room added; 1,535,084 with the sidebar's spring, with no room added; 1,549,478 with the context window card's map (tiles by tokens, the default look, the block grid a switch away) and its text view showing an inline image, in context.js, which the Routing page draws as well as Usage, so the core's own, with no room added (10-24); 1,550,768 with a usage card's refresh opening after its text (#840's card, which the tray panel draws too), the Add key spinner, and a dialog kept centred while its content comes in, with no room added (10-24); 1,524,789 with what masking did moved out to Insights › Masking, lowered to it; 1,525,090 with the Codex row's too-old note (codexAsyncHeld), with no room added (10-24) + appScriptBudget = 1_317_486 // app.js: 1,198,239 after Usage left (P2); 1,218,098 with the 10-15 fixes to pages still in the core; 1,232,466 with the provider editor's Advanced fold and every dialog holding its place, the core's own (10-16); 1,250,533 with the quota refresh kept through redraws, the core's own since the tray panel draws it too, plus 1.5% (#2397); 1,269,083 with Free first's option in the provider editor's ROUTINGS, which the Routing page reads too, plus 1.5%; 1,272,726 with the Providers page drawing its last list at once (#1519), the core's page, and the Routing trace's account names read without Object.entries (#1481), plus 1.5%; a dialog growing out of the row that opened it and folding back into it, the core's own since every page's dialogs open through it (10-20); Codex's and Claude Code's own settings moved from Settings into the agent's row on the Agents page, the core's own since the tray panel and the window both draw them (10-20); 1,314,432 with Settings › Privacy's record of what was masked (its summary, the records view and the local model's controls), which belongs to Settings, the core's own, plus 1.5%; 1,336,481 with a provider's Names & levels saying Provider in model names is Settings' and opening it there (joe), and Settings' Image recognition saying where a custom provider's model is marked (nexnull), both in the core's own pages, with no room added (10-23); 1,337,633 with Settings › Models › Replies' Intent classifier timeout (#2934, reyoung), Settings' own row, drawn by waitRow, which the Image generation timeout's row now shares, with no room added; 1,337,735 with the provider editor's link naming a partner's page by its own host (siteHost) instead of usemagpie.ai's /go link, the core's own editor, with no room added (10-23); 1,338,084 with Check in now saying what the press came to (claimed +credits, already today, not available yet) where it said "refreshed" (#3326), the check-in row the tray panel draws too, the core's own, with no room added (10-23); 1,338,929 with a new partner's tile keeping a small dot until it is opened, in the add sheet, the core's own, with no room added (10-23); 1,343,324 with the sidebar's open-page row marked by one shape that moves on a spring (navTopGo), the window's own shell, which every page sits beside, with no room added (10-23); 1,343,465 with a dialog kept centred while its content comes in, until it is pressed (holdModal, every page's dialogs), the core's own, with no room added (10-24); 1,317,486 with what masking did moved out to Insights › Masking (plugins/redact), the budget lowered to it (10-24) + coreScriptBudget = 1_524_789 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it; 1,472,589 with the dialog that grows out of its row and the agents' own settings in their rows, on main's 10-20 core work (the Providers page's last list, the Routing trace's names), plus 1.5% (10-20); 1,506,192 with Settings › Privacy's record of what was masked, plus 1.5%; 1,529,393 with the Intent classifier timeout row (#2934), with no room added; 1,529,495 with the editor's partner link host, with no room added; 1,529,844 with Check in now's press summary (#3326), with no room added; 1,530,689 with the new partner tile's dot, with no room added; 1,535,084 with the sidebar's spring, with no room added; 1,549,478 with the context window card's map (tiles by tokens, the default look, the block grid a switch away) and its text view showing an inline image, in context.js, which the Routing page draws as well as Usage, so the core's own, with no room added (10-24); 1,550,768 with a usage card's refresh opening after its text (#840's card, which the tray panel draws too), the Add key spinner, and a dialog kept centred while its content comes in, with no room added (10-24); 1,524,789 with what masking did moved out to Insights › Masking, lowered to it ) func TestCoreScriptBudget(t *testing.T) {