diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css
index bdb2d16ad..93d013924 100644
--- a/internal/gui/assets/app.css
+++ b/internal/gui/assets/app.css
@@ -4451,7 +4451,7 @@ input.words.window-in { width: 96px; font-variant-numeric: tabular-nums; }
sends, who the allow list lets in), a line with a button or link in
it. A touch screen, with no hover, keeps them all. */
@media (hover: hover) {
- :is(#view-settings:not(.set-searching), .editor.roomy .prov-prefs) .row.pref > .who > .sub:not(.err, .bad, .say, .proxy-check, .lib-way, .image-gen-hidden, .sync-sign-in, .no-names, .pv-hits, .feat-why, .vision-not-marked, .video-gen-how, .font-note, .acts, [role="status"], #proxySub):not(#otelSessionsRow *, #allowList *, .disabled-model *) {
+ :is(#view-settings:not(.set-searching), .editor.roomy .prov-prefs) .row.pref > .who > .sub:not(.err, .bad, .say, .proxy-check, .lib-way, .image-gen-hidden, .sync-sign-in, .no-names, .pv-hits, .feat-why, .vision-not-marked, .video-gen-how, .font-note, .acts, [role="status"], #proxySub, :has(> .warn)):not(#otelSessionsRow *, #allowList *, .disabled-model *) {
--hint: 1; position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
/* the line held out of sight stays in its row's box: placed against the
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js
index e65b949c2..319fd801c 100644
--- a/internal/gui/assets/app.js
+++ b/internal/gui/assets/app.js
@@ -21213,9 +21213,14 @@ function renderWarmNow(agent, users, rowId) {
// renderAlerts draws the usage alerts (#368): a notification when a window
// that routing counts reaches the share set, or a balance falls to the
// amount set, each once; Off, or the number in a field beside On.
-function renderAlerts(s, keep) {
- const problem = s.notifyProblem === "denied" ? t("Notifications are turned off for magpie in the system's settings")
+// notifyWarn: why a notification set here wouldn't be seen, said beside
+// each alert, the Masking alert's in Privacy too
+function notifyWarn(s) {
+ return s.notifyProblem === "denied" ? t("Notifications are turned off for magpie in the system's settings")
: s.notifyProblem === "unavailable" ? t("Notifications can't be shown on this system") : "";
+}
+function renderAlerts(s, keep) {
+ const problem = notifyWarn(s);
const sub = (id, what) => {
const box = $(id);
box.textContent = what;
diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js
index 0acb43703..9876f1f75 100644
--- a/internal/gui/assets/i18n.js
+++ b/internal/gui/assets/i18n.js
@@ -1529,6 +1529,7 @@ const I18N = {
"{n} h before": "提前 {n} 小时",
"Task done alert": "任务完成提醒",
"Bark": "Bark",
+ "Every notification magpie shows goes here too, even while the system's notifications are off": "magpie 显示的每条通知也会发到这里,系统通知关闭时也照发",
"Bark daily summary": "Bark 每日汇总",
"Server": "服务器",
"Device key": "设备密钥",
@@ -7014,6 +7015,7 @@ const I18N = {
"{n} h before": "提前 {n} 小時",
"Task done alert": "任務完成提醒",
"Bark": "Bark",
+ "Every notification magpie shows goes here too, even while the system's notifications are off": "magpie 顯示的每則通知也會發到這裡,系統通知關閉時也照發",
"Bark daily summary": "Bark 每日彙總",
"Server": "伺服器",
"Device key": "裝置金鑰",
@@ -12449,6 +12451,7 @@ const I18N = {
"{n} h before": "{n} 時間前",
"Task done alert": "タスク完了通知",
"Bark": "Bark",
+ "Every notification magpie shows goes here too, even while the system's notifications are off": "magpie が表示する通知はすべてここにも届きます。システムの通知がオフでも届きます",
"Bark daily summary": "Bark の毎日のまとめ",
"Server": "サーバー",
"Device key": "デバイスキー",
@@ -17933,6 +17936,7 @@ const I18N = {
"{n} h before": "{n} Std. vorher",
"Task done alert": "Benachrichtigung bei fertiger Aufgabe",
"Bark": "Bark",
+ "Every notification magpie shows goes here too, even while the system's notifications are off": "Jede Benachrichtigung von magpie kommt auch hierher, auch wenn die des Systems aus sind",
"Bark daily summary": "Bark-Tagesübersicht",
"Server": "Server",
"Device key": "Geräteschlüssel",
diff --git a/internal/gui/assets/index.html b/internal/gui/assets/index.html
index 2a5e63b08..de20906b4 100644
--- a/internal/gui/assets/index.html
+++ b/internal/gui/assets/index.html
@@ -392,7 +392,7 @@
-
+
Bark
Every notification magpie shows goes here too, even while the system's notifications are off
diff --git a/internal/gui/assets/plugins/redact/settings.js b/internal/gui/assets/plugins/redact/settings.js
index e45b51e92..4836de1a7 100644
--- a/internal/gui/assets/plugins/redact/settings.js
+++ b/internal/gui/assets/plugins/redact/settings.js
@@ -403,7 +403,11 @@ function ruleBulk(s, sel) {
const r = el("div", "row pref");
r.id = "maskAlertRow";
const who = el("div", "who");
- who.append(el("div", "name", t("Masking alert")), el("div", "sub wraps", t("A notification when masking swaps a value for the first time: its kind and how many, never the value itself")));
+ const sub = el("div", "sub wraps", t("A notification when masking swaps a value for the first time: its kind and how many, never the value itself"));
+ // and why it wouldn't be seen, as Settings › Usage's alerts say it
+ const warn = notifyWarn(s);
+ if (warn) sub.append(" · ", el("span", "warn", warn));
+ who.append(el("div", "name", t("Masking alert")), sub);
const v = el("div", "val");
v.id = "maskAlertSegs";
v.append(segs([["off", t("Off")], ["on", t("On")]], s.maskAlert ? "on" : "off", (x) => savePrefs({ ...keep, maskAlert: x === "on" })));
diff --git a/internal/gui/tests/notify-warn-places.test.cjs b/internal/gui/tests/notify-warn-places.test.cjs
new file mode 100644
index 000000000..3bd1d92d8
--- /dev/null
+++ b/internal/gui/tests/notify-warn-places.test.cjs
@@ -0,0 +1,118 @@
+// Run with Node's test runner and Playwright on the module path; see README.md.
+// When the system blocks magpie's notifications, or can't show them, every
+// row that sets an alert says so beside it: Settings › Usage's alerts did,
+// the Masking alert in Settings › Privacy didn't, and on a computer with
+// a pointer both were held out of sight with the line explaining the row,
+// for the card the pointer brings. And Bark's row says it gets every
+// notification magpie shows, even while the system's are off, since
+// sendAs pushes to Bark whatever the system does with it. Every
+// language, wide and narrow, both engines; the API is faked here.
+const assert = require("node:assert/strict");
+const fs = require("node:fs/promises");
+const path = require("node:path");
+const { test } = require("node:test");
+const { chromium, webkit } = require("playwright");
+const { watchSettingsReads, settingsDrawn } = require("./reader.cjs");
+
+const assets = path.resolve(__dirname, "../assets");
+
+function server(lang, notifyProblem) {
+ const cur = {
+ theme: "light", lang, tray: "panel", quotaLeft: false, currency: "usd", dock: false, dockWindow: false, proxy: "",
+ redact: true, redactPersonal: false, redactWords: [], codexWarmup: "", claudeWarmup: "", codexWarmAt: "", claudeWarmAt: "",
+ trayUsage: "", trayUsageEvery: 3, vision: "", imageGen: "", version: "0.1.900", dir: "~/.config/magpie",
+ gateway: "http://127.0.0.1:3425", proxyNow: "none", proxySource: "none", visionModels: [], imageGenModels: [], lanURLs: [],
+ fx: { rate: 7.2, at: new Date().toISOString(), stale: false }, turnDoneAlert: 0, featuresOff: [],
+ maskAlert: true, usageAlert: 80, notifyProblem,
+ };
+ return async (route) => {
+ const req = route.request(), url = new URL(req.url());
+ const json = (data) => route.fulfill({ json: data });
+ if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:false,featuresOff:[]};` });
+ if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });
+ if (url.pathname === "/api/state") return json({ agents: [], profiles: [], settings: { lang, theme: "light" }, fx: cur.fx });
+ if (url.pathname === "/api/settings") return json(cur);
+ if (url.pathname === "/api/plugins") return json({ plugins: [] });
+ if (url.pathname === "/api/usage/quotas") return json([]);
+ if (url.pathname === "/api/groups") return json({ groups: [], models: [] });
+ if (url.pathname.startsWith("/api/")) return json({});
+ const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname);
+ const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)];
+ await route.fulfill({ body: await fs.readFile(file), contentType });
+ };
+}
+
+const words = {
+ en: { denied: "Notifications are turned off for magpie in the system's settings", unavailable: "Notifications can't be shown on this system",
+ bark: "Every notification magpie shows goes here too, even while the system's notifications are off" },
+ zh: { denied: "系统设置里关闭了 magpie 的通知", bark: "magpie 显示的每条通知也会发到这里,系统通知关闭时也照发" },
+ "zh-TW": { denied: "系統設定裡關閉了 magpie 的通知", bark: "magpie 顯示的每則通知也會發到這裡,系統通知關閉時也照發" },
+ ja: { denied: "システム設定で magpie の通知がオフになっています", bark: "magpie が表示する通知はすべてここにも届きます。システムの通知がオフでも届きます" },
+ de: { denied: "Benachrichtigungen für magpie sind in den Systemeinstellungen ausgeschaltet",
+ bark: "Jede Benachrichtigung von magpie kommt auch hierher, auch wenn die des Systems aus sind" },
+};
+
+// shown on the page: a line held out of sight for the hover card is 1px
+const seen = (page, sel) => page.locator(sel).evaluate((e) => {
+ const r = e.getBoundingClientRect();
+ return r.width > 40 && r.height > 8 && getComputedStyle(e.closest(".sub")).clipPath === "none";
+});
+
+async function open(browser, width, lang, problem, tab) {
+ const context = await browser.newContext({ viewport: { width, height: 700 }, reducedMotion: "reduce" });
+ const page = await context.newPage();
+ page.setDefaultTimeout(5000);
+ page.setDefaultNavigationTimeout(60000);
+ const errors = [];
+ page.on("pageerror", (e) => errors.push(e.message));
+ await page.route("**/*", server(lang, problem));
+ await watchSettingsReads(page);
+ await page.goto("http://magpie.test/?view=settings&tab=" + tab);
+ await settingsDrawn(page);
+ return { page, errors, context };
+}
+
+for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
+ for (const lang of (process.env.LANGS ? process.env.LANGS.split(",") : Object.keys(words))) {
+ test(`${engine} ${lang}: every alert row says when notifications won't show, and Bark says it gets them all`, async (t) => {
+ const w = words[lang];
+ const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
+ t.after(() => browser.close());
+ for (const width of [900, 380]) {
+ await t.test(`${width}px`, async () => {
+ // blocked: the Masking alert says so, as the usage alert does
+ let { page, errors, context } = await open(browser, width, lang, "denied", "privacy");
+ await page.locator("#maskAlertRow .sub").waitFor();
+ assert.equal(await page.locator("#maskAlertRow .sub .warn").textContent(), w.denied, "masking alert");
+ // in sight, not held for the hover card with the line it is in
+ assert.ok(await seen(page, "#maskAlertRow .sub .warn"), "the masking alert's warning in sight");
+ assert.deepEqual(errors, []);
+ await context.close();
+
+ ({ page, errors, context } = await open(browser, width, lang, "denied", "usage"));
+ await page.locator("#usageAlertSub .warn").waitFor({ state: "attached" });
+ assert.equal(await page.locator("#usageAlertSub .warn").textContent(), w.denied, "usage alert");
+ assert.ok(await seen(page, "#usageAlertSub .warn"), "the usage alert's warning in sight");
+ assert.equal((await page.locator("#barkRow .sub").textContent()).trim(), w.bark, "Bark's row");
+ const over = await page.evaluate(() => [...document.querySelectorAll("#barkRow *")]
+ .filter((e) => e.getBoundingClientRect().right > innerWidth + 1).map((e) => e.className || e.id));
+ assert.deepEqual(over, [], "nothing past the edge");
+ assert.deepEqual(errors, []);
+ await context.close();
+
+ // nothing wrong: nothing said
+ ({ page, errors, context } = await open(browser, width, lang, "", "privacy"));
+ await page.locator("#maskAlertRow .sub").waitFor();
+ assert.equal(await page.locator("#maskAlertRow .warn").count(), 0, "no warning when notifications show");
+ await context.close();
+ if (w.unavailable) {
+ ({ page, errors, context } = await open(browser, width, lang, "unavailable", "privacy"));
+ await page.locator("#maskAlertRow .sub").waitFor();
+ assert.equal(await page.locator("#maskAlertRow .warn").textContent(), w.unavailable);
+ await context.close();
+ }
+ });
+ }
+ });
+ }
+}