085 calm Match deck: no header hourglass, centred bare empty state, the release card as a deck card (Cancel, Skip, Release), fixed card height. 086 motion: vanish() fade everywhere with a lint test, view transitions, a lub-dub heartbeat for working objects, confetti that lands and fades. 087 time readout under the pivot of every analog clock. 088 prune dialog grouped by prefix with tri-state boxes, search, stepper and sticky footer. 089 one-row task toolbar with Filter and Actions menus and a filter chip. 090 card border by state colour with a soft glow and owner avatars. 091 draggable limit lines with staged changes and one Save, a Limits menu with the matrix, View toggles, the GPU cause in its tooltip. 093 request chips Open, Expired, Stale, Failed, All and a signed Delete. 094 closed cards leave the deck within 5 s; open in Claude stamps. 095 compact agent message box with Post/Call, attach, mic and Send in the field. 096 Reject on an expired card drops it silently as Drop (expired). 097 Show filter in Match's right-click menu. 098 docked speech bubbles carry the speaker's avatar and a skip button. 099 Match card headlines cut to 120 characters with the full title in the tooltip; the code box keeps the whole command. tests/test_hub_path_links.py: a unicode fixture without German. Full make test green through the queue (2605 tests, ruff, shellcheck, markdownlint). Gate missed on the operator's word: break 7 %, the E2E specs (13 new, 15 updated) run next. 🎯 Fix: 92 % 💥 Break: 7 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 86 🚦 Gate: ⛔ break 7 % > 5 Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
109 lines
4.7 KiB
JavaScript
109 lines
4.7 KiB
JavaScript
const beeps = new Set();
|
|
|
|
function silenceBeeps() {
|
|
for (const oscillator of beeps) {
|
|
oscillator.stop();
|
|
}
|
|
beeps.clear();
|
|
}
|
|
|
|
function play(kind, volume) {
|
|
const sound = context();
|
|
if (!sound) {
|
|
return;
|
|
}
|
|
const level = Math.max(volume * 0.5, 0.0002);
|
|
duck(Math.max(...TONES[kind].map(([, at, length]) => at + length)));
|
|
for (const [frequency, at, length] of TONES[kind]) {
|
|
const oscillator = sound.createOscillator();
|
|
const gain = sound.createGain();
|
|
const start = sound.currentTime + at;
|
|
oscillator.type = kind === "mayday" ? "square" : "sine";
|
|
oscillator.frequency.value = frequency;
|
|
gain.gain.setValueAtTime(0.0001, start);
|
|
gain.gain.exponentialRampToValueAtTime(level, start + 0.02);
|
|
gain.gain.exponentialRampToValueAtTime(0.0001, start + length);
|
|
oscillator.connect(gain).connect(sound.destination);
|
|
oscillator.addEventListener("ended", () => beeps.delete(oscillator), {once: true});
|
|
beeps.add(oscillator);
|
|
oscillator.start(start);
|
|
oscillator.stop(start + length + 0.05);
|
|
}
|
|
}
|
|
|
|
function notifyLabel() {
|
|
const button = document.getElementById("notify");
|
|
if (!button) {
|
|
return;
|
|
}
|
|
const permission = "Notification" in window ? Notification.permission : "unsupported";
|
|
const labels = {granted: "Notifications on", denied: "Notifications blocked", default: "Enable notifications", unsupported: "Browser has no notifications"};
|
|
relabel(button, "bi-bell", labels[permission] || labels.default);
|
|
button.disabled = permission !== "default";
|
|
}
|
|
|
|
/**
|
|
* @param {object} before the channels of the settings the page held until now.
|
|
*/
|
|
function syncChannels(before) {
|
|
if (before.sounds && !settings.channels.sounds) {
|
|
silenceBeeps();
|
|
}
|
|
if (before.aloud && !settings.channels.aloud) {
|
|
cancelSpeech();
|
|
}
|
|
drawTitle();
|
|
}
|
|
|
|
async function askNotify() {
|
|
if ("Notification" in window) {
|
|
await Notification.requestPermission();
|
|
}
|
|
notifyLabel();
|
|
}
|
|
|
|
/**
|
|
* @param {boolean} [resumed] whether this state is the first answer after the page was offline.
|
|
*/
|
|
function announce(resumed) {
|
|
const arrived = !resumed && known.now !== null && state.now - known.now <= LIVE_GAP;
|
|
const alarms = new Map(alarmRows().map((row) => [`${row.ts}|${row.from}`, row]));
|
|
const radio = new Set(state.radio.map((row) => `${row.ts}|${row.from}|${row.text.slice(0, 40)}`));
|
|
if (known.inbox !== null && live()) {
|
|
const fresh = state.inbox.filter((item) => !known.inbox.has(keyOf(item)));
|
|
const newAlarms = [...alarms].filter(([key]) => !known.alarms.has(key)).map(([, row]) => row);
|
|
const newRadio = state.radio.filter((row) => !known.radio.has(`${row.ts}|${row.from}|${row.text.slice(0, 40)}`));
|
|
const direct = newRadio.filter((row) => row.to.includes(HUMAN));
|
|
const sounding = newRadio.filter((row) => RadioSet.heard(row, settings.agents, "sound"));
|
|
const present = {mayday: newAlarms.length > 0, review: fresh.some((item) => item.kind !== "operator"), direct: sounding.some((row) => row.to.includes(HUMAN)), radio: sounding.length > 0};
|
|
const kind = radioSet.mode === "silence" || !settings.channels.sounds ? null : Voice.beep(present, tones(), SOUND_KINDS.map(([id]) => id));
|
|
if (kind) {
|
|
play(kind, loudness(kind));
|
|
}
|
|
const lead = kind ? Math.max(...TONES[kind].map(([, at, length]) => at + length)) : 0;
|
|
window.setTimeout(() => speakRows(newRadio, arrived), lead * 1000);
|
|
if (settings.channels.browser && "Notification" in window && Notification.permission === "granted") {
|
|
for (const row of newAlarms) {
|
|
new Notification(`${row.class === "mayday" ? "Mayday" : "Pan-Pan"} from ${dash(row.from)}`, {body: row.text.slice(0, 200), tag: `alarm-${row.ts}`, requireInteraction: row.class === "mayday"});
|
|
}
|
|
for (const item of fresh) {
|
|
new Notification(`${ITEM_LABELS[item.kind]} waiting`, {body: item.title.slice(0, 200), tag: `item-${keyOf(item)}`, requireInteraction: item.kind === "ask"});
|
|
}
|
|
for (const row of direct) {
|
|
new Notification(`Radio from ${dash(row.from)}`, {body: row.text.slice(0, 200), tag: `direct-${row.ts}`});
|
|
}
|
|
}
|
|
}
|
|
known.inbox = new Set(state.inbox.map(keyOf));
|
|
known.alarms = new Set(alarms.keys());
|
|
known.radio = radio;
|
|
known.now = state.now;
|
|
for (const batch of state.pending) {
|
|
if (!known.batches.has(batch.id)) {
|
|
known.batches.add(batch.id);
|
|
const source = batch.source.startsWith("rule:") ? "Rule" : batch.items.every((item) => item.verb === "dismiss") ? "Delete" : "Grant";
|
|
undoToast(batch, `${source}: ${batch.items.map((item) => short(item.title)).join(", ")}`);
|
|
}
|
|
}
|
|
}
|