Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

gui: the masking card is flat and shows the lines the vendor got

yetone52209522a0e4
diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css
index 19ce00848..a169e7c9a 100644
--- a/internal/gui/assets/app.css
+++ b/internal/gui/assets/app.css
@@ -3204,78 +3204,87 @@ body:not(.side-nav) #view-settings .set-head.stuck::before { box-shadow: 0 1px 0
.static-pill.on { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
#privacyModelRow.pm-wait .name { color: var(--muted); }
-/* Privacy › what masking kept from vendors (renderMaskObs): a card over the
- switches, its colours the charts' own, a glow of the accent behind */
-.mask-obs { position: relative; isolation: isolate; overflow: hidden; margin-bottom: 6px; padding: 14px 16px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); }
+/* Privacy › what masking kept from vendors (renderMaskObs): a quiet card
+ over the switches. Flat colour only: hairlines, the charts' own colours
+ for kinds, and the accent kept for today and the shield */
+.mask-obs { position: relative; margin-bottom: 6px; padding: 16px 18px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); }
.mask-obs:empty { display: none; }
-.mask-obs::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(110% 90% at 100% 0%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 62%), radial-gradient(70% 80% at 0% 100%, color-mix(in srgb, var(--c2) 6%, transparent), transparent 70%); }
-.mask-obs.off::before { opacity: .35; }
-.mo-head { display: flex; align-items: center; gap: 10px; min-height: 30px; }
-.mo-head .grow { flex: 1; }
-.mo-shield { flex: none; width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent); }
-.mask-obs.off .mo-shield { color: var(--muted); background: var(--pill); box-shadow: none; }
+.mo-head { display: flex; align-items: center; gap: 11px; min-height: 30px; }
+.mo-head .grow, .mo-lh .grow { flex: 1; }
+.mo-shield { flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--accent); box-shadow: inset 0 0 0 1px var(--line-2); }
+.mask-obs.off .mo-shield { color: var(--muted); }
.mo-title { min-width: 0; }
-.mo-name { font-size: 13px; font-weight: 600; color: var(--fg); }
+.mo-name { font-size: 13px; font-weight: 600; letter-spacing: -.005em; color: var(--fg); }
.mo-sub { font-size: 11.5px; line-height: 1.4; color: var(--muted); }
-.mo-empty { margin-top: 10px; font-size: 12px; line-height: 1.5; color: var(--muted); }
-.mo-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: end; margin-top: 14px; }
-.mo-count { min-width: 0; padding-bottom: 14px; }
+.mo-empty { margin-top: 12px; font-size: 12px; line-height: 1.5; color: var(--muted); }
+.mo-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: end; margin-top: 20px; }
+.mo-count { min-width: 0; padding-bottom: 2px; }
.mo-big { display: flex; align-items: baseline; gap: 8px; }
-.mo-num { font-size: 40px; line-height: 1; font-weight: 650; letter-spacing: -.025em; font-variant-numeric: tabular-nums; color: var(--fg); }
-@supports (-webkit-background-clip: text) {
- .mo-num { background: linear-gradient(180deg, var(--fg) 30%, color-mix(in srgb, var(--fg) 55%, var(--accent))); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
-}
-.mo-unit { font-size: 12px; color: var(--muted); white-space: nowrap; }
-.mo-meta { margin-top: 7px; font-size: 12px; color: var(--fg-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
-.mo-chart { position: relative; min-width: 0; height: 78px; }
-.mo-svg { display: block; overflow: visible; }
-.mo-line { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
-.mo-base { stroke: var(--line); stroke-width: 1; }
-.mo-axis { font-size: 10px; fill: var(--faint); font-variant-numeric: tabular-nums; }
-.mo-dot { fill: var(--accent); stroke: var(--card); stroke-width: 2; }
-.mo-hover line { stroke: var(--line-2); stroke-dasharray: 2 3; }
-.mo-ctip { position: absolute; top: 0; transform: translate(-50%, -100%); padding: 4px 8px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--card); box-shadow: 0 6px 20px rgba(0, 0, 0, .12); font-size: 11px; white-space: nowrap; color: var(--fg); font-variant-numeric: tabular-nums; pointer-events: none; }
+.mo-num { font-size: 52px; line-height: .92; font-weight: 600; letter-spacing: -.045em; font-variant-numeric: tabular-nums; color: var(--fg); }
+.mo-unit { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
+.mo-meta { margin-top: 10px; font-size: 12px; color: var(--fg-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
+.mo-days { position: relative; min-width: 0; height: 84px; display: flex; flex-direction: column; }
+.mo-bars { flex: 1; min-height: 0; display: flex; align-items: stretch; justify-content: space-between; gap: 6px; border-bottom: 1px solid var(--line); }
+.mo-bars.many { gap: 3px; }
+.mo-day { flex: 1 1 0; max-width: 22px; min-width: 3px; display: flex; align-items: flex-end; justify-content: center; }
+.mo-day i { display: block; width: 100%; border-radius: 3px 3px 1px 1px; background: color-mix(in srgb, var(--fg) 15%, transparent); transform-origin: bottom; transition: background-color .15s; }
+.mo-day:hover i { background: color-mix(in srgb, var(--fg) 32%, transparent); }
+.mo-day.now i, .mo-day.now:hover i { background: var(--accent); }
+.mo-day.zero i { width: 3px; height: 3px; margin-bottom: 3px; border-radius: 50%; background: var(--line-2); }
+.mo-axis { display: flex; justify-content: space-between; padding-top: 5px; font-size: 10px; line-height: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
+.mo-ctip { position: absolute; top: -4px; transform: translate(-50%, -100%); padding: 4px 8px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--card); box-shadow: 0 6px 20px rgba(0, 0, 0, .12); font-size: 11px; white-space: nowrap; color: var(--fg); font-variant-numeric: tabular-nums; pointer-events: none; }
.mo-ctip[hidden] { display: none; }
-.mo-sk-num { width: 120px; height: 40px; border-radius: 8px; }
-.mo-sk-chart { height: 60px; border-radius: 8px; }
-.mo-sec { margin-top: 16px; }
+.mo-sk-num { width: 120px; height: 46px; border-radius: 8px; }
+.mo-sk-chart { height: 64px; border-radius: 8px; }
+.mo-sec { margin-top: 20px; }
.mo-sec > .label, .mo-lh { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.mo-hint { font-size: 11px; color: var(--faint); }
-.mo-bar { display: flex; gap: 2px; height: 10px; border-radius: 99px; overflow: hidden; }
-.mo-seg { flex: 1 1 0; min-width: 4px; }
-.mo-legend { display: flex; flex-wrap: wrap; gap: 5px 6px; margin-top: 9px; }
-.mo-chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 8px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--fg-2); font: inherit; font-size: 12px; cursor: default; }
-.mo-chip:not(:disabled):hover { background: var(--pill); }
-.mo-chip b { font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums; }
+/* the lines as the vendor got them, each placeholder in its kind's colour */
+.mo-saw { margin-top: 20px; padding: 11px 14px 12px; border-radius: 10px; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); }
+.mo-saw .mo-lh { margin-bottom: 6px; }
+.mo-snip { font-family: var(--code); font-size: 11.5px; line-height: 1.75; color: var(--fg-2); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
+.mo-snip + .mo-snip { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
+.mo-ph { padding: 1px 5px; border-radius: 4px; font: inherit; color: color-mix(in srgb, var(--k) 78%, var(--fg)); background: color-mix(in srgb, var(--k) 13%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--k) 22%, transparent); outline: none; cursor: default; }
+.mo-ph:hover { background: color-mix(in srgb, var(--k) 22%, transparent); }
+.mo-ph:focus-visible { background: color-mix(in srgb, var(--k) 22%, transparent); }
+/* what was kept and what found it, side by side */
+.mo-ledger { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 28px; margin-top: 20px; }
+.mo-ledg { min-width: 0; }
+.mo-ledg > .label { margin-bottom: 2px; }
+.mo-row { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; grid-template-rows: 26px 2px; align-items: center; column-gap: 6px; width: 100%; padding: 0 6px 7px; margin: 0 -6px; box-sizing: content-box; border: 0; border-radius: 7px; background: transparent; color: var(--fg); font: inherit; font-size: 12.5px; text-align: left; cursor: default; }
+.mo-row:not(:disabled):hover { background: var(--pill); }
+.mo-row .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-2); }
+.mo-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
+.mo-row .mo-dotc { justify-self: center; }
+.mo-meter { grid-column: 2 / 4; height: 2px; border-radius: 1px; background: var(--line); overflow: hidden; }
+.mo-meter i { display: block; height: 100%; background: color-mix(in srgb, var(--fg) 40%, transparent); transform-origin: left; }
+.mo-row.model .mo-meter i { background: var(--c6); }
.mo-dotc { flex: none; width: 7px; height: 7px; border-radius: 50%; }
-.mo-model { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 8px 8px 8px 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--c6) 24%, transparent); background: linear-gradient(90deg, color-mix(in srgb, var(--c6) 12%, transparent), color-mix(in srgb, var(--c2) 7%, transparent)); font-size: 12.5px; line-height: 1.4; color: var(--fg); }
-.mo-model .grow { flex: 1; }
-.mo-model .text { flex: none; }
-.mo-spark { flex: none; display: inline-flex; color: var(--c6); }
+.mo-spark { flex: none; display: inline-flex; justify-self: center; color: var(--c6); }
.mo-flow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(56px, 1fr) minmax(0, 1fr); }
.mo-col { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0; }
-.mo-node { display: flex; align-items: center; gap: 7px; height: 30px; min-width: 0; padding: 0 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--card-2); color: var(--fg); font: inherit; font-size: 12px; cursor: default; }
+.mo-node { display: flex; align-items: center; gap: 7px; height: 30px; min-width: 0; padding: 0 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--fg); font: inherit; font-size: 12px; cursor: default; }
.mo-node:not(:disabled):hover { background: var(--pill); }
.mo-node:disabled { color: var(--muted); }
.mo-node .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.mo-node .ct { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.mo-mid { position: relative; min-width: 0; }
.mo-mid svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
-.mo-rib { fill: none; stroke-linecap: butt; }
-.mo-rib.out { stroke: var(--accent); stroke-opacity: .42; }
-.mo-hub { position: absolute; left: 50%; top: 50%; width: 32px; height: 32px; margin: -16px 0 0 -16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--accent-fg); background: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 16%, transparent), 0 4px 14px color-mix(in srgb, var(--accent) 32%, transparent); }
+.mo-rib { fill: none; stroke: var(--fg); stroke-linecap: round; }
+.mo-rib.out { stroke: var(--accent); }
+.mo-hub { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--accent); background: var(--card); box-shadow: inset 0 0 0 1px var(--line-2), 0 0 0 4px var(--card); }
.mo-values { display: flex; flex-wrap: wrap; gap: 6px; }
-.mo-val { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 26px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--card-2); color: var(--fg); font: inherit; font-size: 12px; cursor: default; outline: none; }
+.mo-val { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; height: 26px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--line); background: transparent; color: var(--fg); font: inherit; font-size: 12px; cursor: default; outline: none; }
.mo-val:hover { border-color: var(--line-2); background: var(--pill); }
.mo-val:focus-visible { border-color: var(--line-2); background: var(--pill); }
.mo-val .sh { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--code); font-size: 11.5px; letter-spacing: .02em; }
.mo-val .x { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
-.mo-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
+.mo-foot { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--line); }
.mo-note { flex: 1; min-width: 0; font-size: 11.5px; line-height: 1.4; color: var(--muted); }
.mo-open { flex: none; display: inline-flex; align-items: center; gap: 2px; }
@media (max-width: 560px) {
- .mo-hero { grid-template-columns: minmax(0, 1fr); gap: 4px; }
- .mo-count { padding-bottom: 0; }
+ .mo-hero { grid-template-columns: minmax(0, 1fr); gap: 14px; }
+ .mo-num { font-size: 44px; }
.mo-flow { grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr); }
.mo-node .ic { display: none; }
}
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js
index eeafc4357..c6792814b 100644
--- a/internal/gui/assets/app.js
+++ b/internal/gui/assets/app.js
@@ -21894,7 +21894,7 @@ let maskDays = 7; // the card's span, kept per machine
try { if (localStorage.getItem("magpie.maskDays") === "30") maskDays = 30; } catch {}
let maskDrawn = ""; // what the card says, so a redraw that changes nothing is skipped
let maskView = null; // the records, while they are open
-let maskGrad = 0;
+let maskSaw = null, maskSawAt = 0, maskSawBusy = false; // the newest records, for the lines the vendor saw
const maskValues = new Map(); // placeholder → what it stood for, as this magpie told it
const maskKindName = (k) => MASK_KINDS[k] ? t(MASK_KINDS[k]) : k;
const maskByName = (b) => MASK_BY[b] ? t(MASK_BY[b]) : b;
@@ -22023,7 +22023,9 @@ function drawMaskObs() {
const s = maskS;
const sum = maskSumDays === maskDays ? maskSum : null;
const on = !!(s.redact || s.redactPersonal);
- const key = JSON.stringify([document.documentElement.lang, maskDays, on, sum, state.agents?.length, (providers || maskProv)?.providers?.length]);
+ if (sum?.requests) maskSawLoad();
+ const saw = maskSawLines();
+ const key = JSON.stringify([document.documentElement.lang, maskDays, on, sum, saw.map((x) => x.text), state.agents?.length, (providers || maskProv)?.providers?.length]);
if (key === maskDrawn && box.firstChild) return;
maskDrawn = key;
// it moves when it first has numbers to say, and for other days: not
@@ -22067,57 +22069,31 @@ function drawMaskObs() {
count.append(big, el("div", "mo-meta", sum.requests
? t(sum.distinct === 1 ? "1 different value" : "{n} different values", { n: fmtN(sum.distinct) }) + " · " + t(sum.requests === 1 ? "1 request" : "{n} requests", { n: fmtN(sum.requests) })
: t("Nothing yet in these days")));
- const chart = el("div", "mo-chart");
+ const chart = el("div", "mo-days");
hero.append(count, chart);
box.append(hero);
- maskChart(chart, sum.days, move);
+ maskStrip(chart, sum.days, move);
if (move && sum.n) maskCountUp(num, sum.n);
if (!sum.requests) {
box.append(el("div", "mo-empty", t("A request that carries a key, a password or personal data shows here as it goes")));
return;
}
- // what was kept, by kind
+ // what the vendor saw: the newest lines, as they went
+ if (saw.length) box.append(maskSawPane(saw, move));
+
+ // what was kept, by kind, and what found it
+ const ledger = el("div", "mo-ledger");
if (sum.kinds.length) {
- const sec = el("div", "mo-sec");
- sec.append(el("div", "label", t("What was kept")));
- const bar = el("div", "mo-bar");
- const legend = el("div", "mo-legend");
const top = sum.kinds.slice(0, 6), rest = sum.kinds.slice(6);
- const parts = top.map((k) => ({ ...k, c: maskColor(k.name), label: maskKindName(k.name) }));
- if (rest.length) parts.push({ name: "", n: rest.reduce((a, k) => a + k.n, 0), c: "var(--faint)", label: t("Other") });
- for (const p of parts) {
- const seg = el("span", "mo-seg");
- seg.style.flexGrow = String(p.n);
- seg.style.background = p.c;
- seg.title = `${p.label} · ${fmtN(p.n)}`;
- bar.append(seg);
- const chip = el("button", "mo-chip");
- chip.type = "button";
- const dot = el("span", "mo-dotc");
- dot.style.background = p.c;
- chip.append(dot, el("span", "", p.label), el("b", "", fmtN(p.n)));
- if (p.name) {
- chip.title = t("Show the requests with {kind}", { kind: p.label });
- chip.onclick = () => maskOpenRecords({ kind: p.name });
- } else chip.disabled = true;
- legend.append(chip);
- }
- sec.append(bar, legend);
- box.append(sec);
- if (move) bar.animate([{ clipPath: "inset(0 100% 0 0 round 99px)" }, { clipPath: "inset(0 0 0 0 round 99px)" }], { duration: 900, delay: 120, easing: "cubic-bezier(.32, .72, 0, 1)", fill: "backwards" });
- }
-
- // what only the model found
- if (sum.by?.model) {
- const m = el("div", "mo-model");
- const sp = el("span", "mo-spark");
- sp.append(svg(SPARK, 15, 1.3));
- const b = el("button", "text", t("Show them"));
- b.onclick = () => maskOpenRecords({ by: "model" });
- m.append(sp, el("span", "", t(sum.by.model === 1 ? "1 value found by the local model, which no rule recognises" : "{n} values found by the local model, which no rule recognises", { n: fmtN(sum.by.model) })), el("span", "grow"), b);
- box.append(m);
+ const rows = top.map((k) => ({ n: k.n, c: maskColor(k.name), label: maskKindName(k.name), open: { kind: k.name }, tip: t("Show the requests with {kind}", { kind: maskKindName(k.name) }) }));
+ if (rest.length) rows.push({ n: rest.reduce((a, k) => a + k.n, 0), c: "var(--faint)", label: t("Other") });
+ ledger.append(maskLedger(t("What was kept"), "kind", rows, move));
}
+ const by = Object.keys(MASK_BY).filter((b) => sum.by?.[b]).map((b) => ({ n: sum.by[b], label: maskByName(b), open: { by: b }, model: b === "model",
+ tip: b === "model" ? t(sum.by.model === 1 ? "1 value found by the local model, which no rule recognises" : "{n} values found by the local model, which no rule recognises", { n: fmtN(sum.by.model) }) : "" }));
+ if (by.length) ledger.append(maskLedger(t("Found by"), "by", by, move));
+ if (ledger.firstChild) box.append(ledger);
// from which agents, to which providers
if (sum.agents.length && sum.providers.length) {
@@ -22169,92 +22145,135 @@ function maskCountUp(node, n) {
requestAnimationFrame(step);
}
-// a path through the points that never overshoots them (Fritsch–Butland)
-function maskCurve(xs, ys) {
- const n = xs.length;
- if (n === 1) return `M${xs[0] - 1},${ys[0]}L${xs[0] + 1},${ys[0]}`;
- const d = [], m = [];
- for (let i = 0; i < n - 1; i++) d.push((ys[i + 1] - ys[i]) / (xs[i + 1] - xs[i]));
- m[0] = d[0];
- m[n - 1] = d[n - 2];
- for (let i = 1; i < n - 1; i++) m[i] = d[i - 1] * d[i] <= 0 ? 0 : 2 / (1 / d[i - 1] + 1 / d[i]);
- let p = `M${xs[0]},${ys[0]}`;
- for (let i = 0; i < n - 1; i++) {
- const h = (xs[i + 1] - xs[i]) / 3;
- p += `C${xs[i] + h},${ys[i] + m[i] * h} ${xs[i + 1] - h},${ys[i + 1] - m[i + 1] * h} ${xs[i + 1]},${ys[i + 1]}`;
- }
- return p;
-}
-
-// maskChart: the values masked each day, an area under a line, the day
-// pointed at said over it. Drawn again at its width as the window resizes.
-function maskChart(box, days, move) {
- const H = 78, top = 10, base = H - 16;
- const s = sv("svg", { class: "mo-svg", height: H, "aria-hidden": "true" });
- const tip = el("div", "mo-ctip");
- tip.hidden = true;
- box.append(s, tip);
+// maskStrip: the values masked each day, a bar a day on a hairline, today
+// in the accent; the day pointed at said over it
+function maskStrip(box, days, move) {
const total = days.reduce((a, d) => a + d.n, 0);
box.setAttribute("role", "img");
box.setAttribute("aria-label", t("{n} values masked over {days} days", { n: fmtN(total), days: days.length }));
- let xs = [], first = move;
- const draw = () => {
- const W = box.clientWidth;
- if (!W || !days.length) return;
- s.setAttribute("viewBox", `0 0 ${W} ${H}`);
- s.setAttribute("width", W);
- s.replaceChildren();
- const max = Math.max(1, ...days.map((d) => d.n));
- const pad = 4;
- xs = days.map((_, i) => days.length < 2 ? W / 2 : pad + (i * (W - 2 * pad)) / (days.length - 1));
- const ys = days.map((d) => base - (d.n / max) * (base - top));
- const line = maskCurve(xs, ys);
- const id = "moGrad" + ++maskGrad;
- const defs = sv("defs");
- const g = sv("linearGradient", { id, x1: 0, y1: 0, x2: 0, y2: 1 });
- g.append(sv("stop", { offset: "0%", "stop-color": "var(--accent)", "stop-opacity": ".34" }), sv("stop", { offset: "100%", "stop-color": "var(--accent)", "stop-opacity": "0" }));
- defs.append(g);
- const area = sv("path", { d: `${line}L${xs.at(-1)},${base}L${xs[0]},${base}Z`, fill: `url(#${id})` });
- const stroke = sv("path", { d: line, class: "mo-line", pathLength: 1 });
- const end = sv("circle", { cx: xs.at(-1), cy: ys.at(-1), r: 3.2, class: "mo-dot" });
- const fmt = (d) => d === days.at(-1).day ? t("Today") : new Date(d + "T00:00").toLocaleDateString(intlLang(), { month: "short", day: "numeric" });
- const a0 = sv("text", { x: xs[0], y: H - 2, class: "mo-axis" });
- a0.textContent = fmt(days[0].day);
- const a1 = sv("text", { x: xs.at(-1), y: H - 2, class: "mo-axis", "text-anchor": "end" });
- a1.textContent = fmt(days.at(-1).day);
- const hover = sv("g", { class: "mo-hover", visibility: "hidden" });
- const vl = sv("line", { y1: top - 4, y2: base });
- const hd = sv("circle", { r: 3.2, class: "mo-dot" });
- hover.append(vl, hd);
- s.append(defs, sv("line", { x1: 0, x2: W, y1: base, y2: base, class: "mo-base" }), area, stroke, end, a0, a1, hover);
- if (first) {
- first = false;
- stroke.style.strokeDasharray = "1";
- stroke.animate([{ strokeDashoffset: 1 }, { strokeDashoffset: 0 }], { duration: 1200, easing: "cubic-bezier(.65, 0, .35, 1)", fill: "backwards" });
- area.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 700, delay: 500, easing: "ease-out", fill: "backwards" });
- end.animate([{ opacity: 0, transform: "scale(.2)" }, { opacity: 1, transform: "none" }], { duration: 420, delay: 1050, easing: "cubic-bezier(.34, 1.56, .64, 1)", fill: "backwards" });
- end.style.transformBox = "fill-box";
- end.style.transformOrigin = "center";
- }
- s.onpointermove = (e) => {
- const x = e.clientX - s.getBoundingClientRect().left;
- let i = 0;
- for (let k = 1; k < xs.length; k++) if (Math.abs(xs[k] - x) < Math.abs(xs[i] - x)) i = k;
- const d = days[i];
- vl.setAttribute("x1", xs[i]);
- vl.setAttribute("x2", xs[i]);
- hd.setAttribute("cx", xs[i]);
- hd.setAttribute("cy", ys[i]);
- hover.setAttribute("visibility", "visible");
+ if (!days.length) return;
+ const max = Math.max(1, ...days.map((d) => d.n));
+ const bars = el("div", "mo-bars" + (days.length > 14 ? " many" : ""));
+ const tip = el("div", "mo-ctip");
+ tip.hidden = true;
+ const fmt = (d) => d === days.at(-1).day ? t("Today") : new Date(d + "T00:00").toLocaleDateString(intlLang(), { month: "short", day: "numeric" });
+ days.forEach((d, i) => {
+ const b = el("span", "mo-day" + (i === days.length - 1 ? " now" : "") + (d.n ? "" : " zero"));
+ const f = el("i");
+ if (d.n) f.style.height = Math.max(5, (100 * d.n) / max) + "%";
+ b.append(f);
+ b.onpointerenter = () => {
tip.hidden = false;
tip.textContent = `${fmt(d.day)} · ${t(d.n === 1 ? "1 value masked" : "{n} values masked", { n: fmtN(d.n) })} · ${t(d.requests === 1 ? "1 request" : "{n} requests", { n: fmtN(d.requests) })}`;
- const w = tip.offsetWidth;
- tip.style.left = Math.max(w / 2, Math.min(xs[i], W - w / 2)) + "px";
+ const w = tip.offsetWidth, W = box.clientWidth, x = b.offsetLeft + b.offsetWidth / 2;
+ tip.style.left = Math.max(w / 2, Math.min(x, W - w / 2)) + "px";
};
- s.onpointerleave = () => { hover.setAttribute("visibility", "hidden"); tip.hidden = true; };
- };
- const ro = new ResizeObserver(() => { if (!box.isConnected) return ro.disconnect(); draw(); });
- ro.observe(box);
+ b.onpointerleave = () => { tip.hidden = true; };
+ if (move && d.n) f.animate([{ transform: "scaleY(0)" }, { transform: "none" }], { duration: 760, delay: 160 + (i * 520) / days.length, easing: "cubic-bezier(.32, .72, 0, 1)", fill: "backwards" });
+ bars.append(b);
+ });
+ const axis = el("div", "mo-axis");
+ axis.append(el("span", "", fmt(days[0].day)), el("span", "", fmt(days.at(-1).day)));
+ box.append(bars, axis, tip);
+}
+
+// maskLedger: one column of the breakdown, a row each with its count and a
+// hairline meter of its share; a row opens its records
+function maskLedger(title, kind, rows, move) {
+ const col = el("div", "mo-ledg " + kind);
+ col.append(el("div", "label", title));
+ const max = Math.max(1, ...rows.map((r) => r.n));
+ rows.forEach((r, i) => {
+ const b = el("button", "mo-row" + (r.model ? " model" : ""));
+ b.type = "button";
+ if (r.model) {
+ const sp = el("span", "mo-spark");
+ sp.append(svg(SPARK, 12, 1.3));
+ b.append(sp);
+ } else {
+ const d = el("span", "mo-dotc");
+ d.style.background = r.c || "var(--faint)";
+ b.append(d);
+ }
+ const m = el("span", "mo-meter"), f = el("i");
+ f.style.width = (100 * r.n) / max + "%";
+ if (r.c) f.style.background = r.c;
+ m.append(f);
+ b.append(el("span", "nm", r.label), el("b", "", fmtN(r.n)), m);
+ if (r.open) {
+ if (r.tip) b.title = r.tip;
+ b.onclick = () => maskOpenRecords(r.open);
+ } else b.disabled = true;
+ if (move) f.animate([{ transform: "scaleX(0)" }, { transform: "none" }], { duration: 820, delay: 360 + i * 60, easing: "cubic-bezier(.32, .72, 0, 1)", fill: "backwards" });
+ col.append(b);
+ });
+ return col;
+}
+
+// maskSnipTexts: a record's lines around its values, each piece of text
+// once where values side by side share it
+function maskSnipTexts(r) {
+ const core = (x) => x.replace(/^…|…$/g, "");
+ const all = [...new Set(Object.values(r.snips || {}))];
+ return all.filter((x, i) => !all.some((y, j) => j != i && (y.length > x.length || y.length == x.length && j < i) && y.includes(core(x))));
+}
+// the newest records, read again with the summary; their lines live in
+// memory only, so there are none after a restart
+function maskSawLoad() {
+ if (maskSawBusy || Date.now() - maskSawAt < 14000) return;
+ maskSawBusy = true;
+ api("masking/records?limit=12").then((r) => { maskSaw = r?.records || []; })
+ .catch(() => {})
+ .finally(() => { maskSawBusy = false; maskSawAt = Date.now(); drawMaskObs(); });
+}
+// up to three lines, one a record before a second from any
+function maskSawLines() {
+ const out = [], seen = new Set();
+ for (const pass of [0, 1]) for (const r of maskSaw || []) {
+ const texts = maskSnipTexts(r).filter((x) => !seen.has(x));
+ for (const text of pass ? texts : texts.slice(0, 1)) {
+ if (out.length >= 3) return out;
+ seen.add(text);
+ out.push({ text: text.replace(/\s+/g, " "), t: r.t, info: new Map((r.values || []).map((x) => [x.p, x])) });
+ }
+ }
+ return out;
+}
+// maskPlace: a placeholder as the text carried it, in its kind's colour,
+// what it stood for shown while pointed at
+function maskPlace(cls, p, x) {
+ const kind = x?.k || p.slice(2, -2).replace(/_[^_]*$/, "");
+ const mark = el("mark", cls, p);
+ mark.style.setProperty("--k", maskColor(kind));
+ mark.tabIndex = 0;
+ maskTipOn(mark, { p, kind, by: x?.b || "known" });
+ return mark;
+}
+function maskSawPane(lines, move) {
+ const pane = el("div", "mo-saw");
+ const h = el("div", "mo-lh");
+ h.append(el("span", "label", t("What the vendor saw")), el("span", "grow"), el("span", "mo-hint", ago(lines[0].t)));
+ pane.append(h);
+ let k = 0;
+ for (const x of lines) {
+ const s = el("div", "mo-snip");
+ let at = 0;
+ for (const m of x.text.matchAll(PLACEHOLDER)) {
+ s.append(document.createTextNode(x.text.slice(at, m.index)));
+ const mark = maskPlace("mo-ph", m[0], x.info.get(m[0]));
+ // a marker drawn over the value, then lifted to the placeholder
+ if (move) mark.animate([
+ { clipPath: "inset(0 100% 0 0)", backgroundColor: "var(--k)", color: "transparent" },
+ { clipPath: "inset(0 0 0 0)", backgroundColor: "var(--k)", color: "transparent", offset: .55 },
+ { clipPath: "inset(0 0 0 0)" },
+ ], { duration: 900, delay: 520 + k++ * 180, easing: "cubic-bezier(.65, 0, .35, 1)", fill: "backwards" });
+ s.append(mark);
+ at = m.index + m[0].length;
+ }
+ s.append(document.createTextNode(x.text.slice(at)));
+ pane.append(s);
+ }
+ return pane;
}
// maskFlow: the agents that sent what was masked, each a ribbon as wide
@@ -22286,24 +22305,15 @@ function maskFlow(sum, move) {
const H = Math.max(fromRows.length, toRows.length) * rowH - 4;
const s = sv("svg", { viewBox: `0 0 100 ${H}`, preserveAspectRatio: "none", "aria-hidden": "true" });
const max = Math.max(...fromRows.map((r) => r.n), ...toRows.map((r) => r.n), 1);
- const defs = sv("defs");
- s.append(defs);
const ys = (rows) => {
const off = (H - (rows.length * rowH - 4)) / 2;
return rows.map((_, i) => off + i * rowH + 15);
};
const c = H / 2;
const ribs = [];
- ys(fromRows).forEach((y, i) => {
- const id = "moRib" + ++maskGrad;
- const g = sv("linearGradient", { id, gradientUnits: "userSpaceOnUse", x1: 0, y1: 0, x2: 50, y2: 0 });
- g.append(sv("stop", { offset: "0%", "stop-color": `var(--c${(i % 7) + 1})`, "stop-opacity": ".55" }), sv("stop", { offset: "100%", "stop-color": "var(--accent)", "stop-opacity": ".55" }));
- defs.append(g);
- ribs.push(sv("path", { d: `M0,${y}C28,${y} 26,${c} 50,${c}`, class: "mo-rib", stroke: `url(#${id})`, "stroke-width": 2 + (10 * fromRows[i].n) / max, "vector-effect": "non-scaling-stroke", pathLength: 1 }));
- });
- ys(toRows).forEach((y, i) => {
- ribs.push(sv("path", { d: `M50,${c}C74,${c} 72,${y} 100,${y}`, class: "mo-rib out", "stroke-width": 2 + (10 * toRows[i].n) / max, "vector-effect": "non-scaling-stroke", pathLength: 1 }));
- });
+ const line = (d, n, out) => sv("path", { d, class: "mo-rib" + (out ? " out" : ""), "stroke-width": 1 + n / max, "stroke-opacity": (out ? .3 : .16) + (.5 * n) / max, "vector-effect": "non-scaling-stroke", pathLength: 1 });
+ ys(fromRows).forEach((y, i) => ribs.push(line(`M0,${y}C28,${y} 26,${c} 50,${c}`, fromRows[i].n)));
+ ys(toRows).forEach((y, i) => ribs.push(line(`M50,${c}C74,${c} 72,${y} 100,${y}`, toRows[i].n, true)));
s.append(...ribs);
const hub = el("span", "mo-hub");
hub.append(svg(SHIELD, 16, 1.6));
@@ -22514,10 +22524,7 @@ function maskRecordBody(r) {
vals.append(line);
}
body.append(vals);
- // values side by side share their text: each piece of it is shown once
- const core = (x) => x.replace(/^…|…$/g, "");
- const all = [...new Set(Object.values(r.snips || {}))];
- const snips = all.filter((x, i) => !all.some((y, j) => j != i && (y.length > x.length || y.length == x.length && j < i) && y.includes(core(x)))).map((x) => [, x]);
+ const snips = maskSnipTexts(r).map((x) => [, x]);
if (!snips.length) body.append(el("div", "mr-note", t("The text around them was kept in memory only, and magpie has restarted since")));
const info = new Map((r.values || []).map((x) => [x.p, x]));
for (const [, text] of snips) {
@@ -22525,13 +22532,7 @@ function maskRecordBody(r) {
let at = 0;
for (const m of text.matchAll(PLACEHOLDER)) {
s.append(document.createTextNode(text.slice(at, m.index)));
- const mark = el("mark", "mr-ph", m[0]);
- const x = info.get(m[0]);
- const kind = x?.k || m[0].slice(2, -2).replace(/_[^_]*$/, "");
- mark.style.setProperty("--k", maskColor(kind));
- mark.tabIndex = 0;
- maskTipOn(mark, { p: m[0], kind, by: x?.b || "known" });
- s.append(mark);
+ s.append(maskPlace("mr-ph", m[0], info.get(m[0])));
at = m.index + m[0].length;
}
s.append(document.createTextNode(text.slice(at)));
diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js
index 9288950c2..5ec6214d5 100644
--- a/internal/gui/assets/i18n.js
+++ b/internal/gui/assets/i18n.js
@@ -3775,6 +3775,7 @@ const I18N = {
"Nothing yet in these days": "这几天还没有",
"A request that carries a key, a password or personal data shows here as it goes": "带着密钥、密码或个人信息的请求,一发出就会出现在这里",
"What was kept": "遮住了什么",
+ "What the vendor saw": "厂商看到的样子",
"Show the requests with {kind}": "查看含{kind}的请求",
"Show them": "查看",
"1 value found by the local model, which no rule recognises": "本地模型找到 1 个规则认不出的值",
@@ -7596,6 +7597,7 @@ const I18N = {
"Nothing yet in these days": "這幾天還沒有",
"A request that carries a key, a password or personal data shows here as it goes": "帶著金鑰、密碼或個人資訊的請求,一發出就會出現在這裡",
"What was kept": "遮住了什麼",
+ "What the vendor saw": "廠商看到的樣子",
"Show the requests with {kind}": "查看含{kind}的請求",
"Show them": "查看",
"1 value found by the local model, which no rule recognises": "本機模型找到 1 個規則認不出的值",
@@ -11419,6 +11421,7 @@ const I18N = {
"Nothing yet in these days": "この期間はまだありません",
"A request that carries a key, a password or personal data shows here as it goes": "キー、パスワード、個人情報を含むリクエストは送信と同時にここに表示されます",
"What was kept": "隠したもの",
+ "What the vendor saw": "ベンダーに届いた姿",
"Show the requests with {kind}": "{kind}を含むリクエストを表示",
"Show them": "表示",
"1 value found by the local model, which no rule recognises": "ルールでは見つからない値をローカルモデルが 1 個検出",
@@ -15242,6 +15245,7 @@ const I18N = {
"Nothing yet in these days": "In diesen Tagen noch nichts",
"A request that carries a key, a password or personal data shows here as it goes": "Eine Anfrage mit einem Schlüssel, Passwort oder personenbezogenen Daten erscheint hier, sobald sie rausgeht",
"What was kept": "Was verborgen wurde",
+ "What the vendor saw": "Was der Anbieter sah",
"Show the requests with {kind}": "Anfragen mit {kind} zeigen",
"Show them": "Anzeigen",
"1 value found by the local model, which no rule recognises": "1 Wert vom lokalen Modell gefunden, den keine Regel erkennt",
diff --git a/internal/gui/tests/masking-records.test.cjs b/internal/gui/tests/masking-records.test.cjs
index 0550919b6..968834fce 100644
--- a/internal/gui/tests/masking-records.test.cjs
+++ b/internal/gui/tests/masking-records.test.cjs
@@ -102,7 +102,7 @@ async function open(engine, lang, width, sum, where) {
}
// English that a translated page must not show
-const english = ["Kept from vendors", "values masked", "What was kept", "Masked most", "View records", "What was masked", "Every kind", "Found by", "Local model", "Not in memory", "This request"];
+const english = ["Kept from vendors", "What the vendor saw", "values masked", "What was kept", "Masked most", "View records", "What was masked", "Every kind", "Found by", "Local model", "Not in memory", "This request"];
const wide = (page) => page.evaluate(() => {
const over = [...document.querySelectorAll("#maskObs *, #maskRecs *")].filter((n) => n.getClientRects().length && n.getBoundingClientRect().right > innerWidth + 1).map((n) => n.className?.baseVal ?? n.className);
return { page: document.documentElement.scrollWidth > document.documentElement.clientWidth, over };
@@ -118,10 +118,16 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
const card = page.locator("#maskObs");
await card.locator(".mo-num").waitFor();
assert.equal(await card.locator(".mo-num").textContent(), "42");
- assert.equal(await card.locator(".mo-svg path.mo-line").count(), 1, "the days' line");
- assert.equal(await card.locator(".mo-bar .mo-seg").count(), 3);
- assert.equal(await card.locator(".mo-legend .mo-chip:enabled").count(), 3);
- assert.equal(await card.locator(".mo-model").count(), 1, "what only the model found");
+ assert.equal(await card.locator(".mo-days .mo-day").count(), 7, "a bar a day");
+ assert.equal(await card.locator(".mo-days .mo-day.zero").count(), 2, "a day with nothing, a dot");
+ assert.equal(await card.locator(".mo-ledg.kind .mo-row:enabled").count(), 3);
+ assert.equal(await card.locator(".mo-ledg.by .mo-row:enabled").count(), 2, "rules, then the model");
+ assert.equal(await card.locator(".mo-row.model").count(), 1, "what only the model found");
+ // the newest lines, as the vendor got them: one line shown once
+ await card.locator(".mo-saw .mo-snip").first().waitFor();
+ assert.equal(await card.locator(".mo-saw .mo-snip").count(), 1);
+ assert.deepEqual(await card.locator(".mo-saw mark.mo-ph").allTextContents(), [KEY, MAIL]);
+ assert.equal(await page.evaluate(() => [document.querySelector("#maskObs"), ...document.querySelectorAll("#maskObs *")].some((n) => /gradient/.test(getComputedStyle(n).backgroundImage + getComputedStyle(n, "::before").backgroundImage))), false, "flat: no gradient");
assert.deepEqual(await card.locator(".mo-col.agent .nm").allTextContents(), ["Claude Code", "Codex"]);
assert.deepEqual(await card.locator(".mo-col.provider .nm").allTextContents(), ["Anthropic", "OpenAI"]);
assert.deepEqual(await card.locator(".mo-val .sh").allTextContents(), ["sk-p••••••••", "•••"]);
@@ -143,8 +149,14 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.mouse.move(1, 1);
await page.locator(".mask-tip").waitFor({ state: "detached" });
- // a kind's chip opens its records, filtered by it
- await card.locator(".mo-chip").nth(1).click();
+ // a line's placeholder says what it stood for
+ await card.locator(".mo-saw mark.mo-ph").first().hover();
+ await page.waitForFunction((s) => document.querySelector(".mask-tip .v")?.textContent === s, SECRET);
+ await page.mouse.move(1, 1);
+ await page.locator(".mask-tip").waitFor({ state: "detached" });
+
+ // a kind's row opens its records, filtered by it
+ await card.locator(".mo-ledg.kind .mo-row").nth(1).click();
const recs = page.locator("#maskRecs");
await recs.locator(".mr-item").first().waitFor();
assert.match(asked.filter((a) => a.startsWith("?")).at(-1), /kind=EMAIL/);