Requirement 001 phase 6, S0: - Speech: the security class shows as "Sécurité" and is spoken as in maritime radio, "say-cure-ee-tay" three times. A hex run of 7 or more characters with a letter and a digit (commit, session, message ids) is spelled in the NATO alphabet; every other digit is spoken on its own in ICAO pronunciation (42305: four two tree zero fife). The spelling runs inside clip() before the length cut, so a phrase still fits SPEECH_LIMIT; the displayed text keeps its digits and hashes. - English: every orchestrator label, tooltip, message, error, script output, document and test string is English (Regeln -> Firewall, Hierarchie -> Hierarchy, Steuerung -> Controls, Ausführen -> Run, ...); the page declares lang="en" and formats dates as en-GB. Task filter ids are English. German stays only in the skill trigger phrases that quote the operator, and as identifiers: the view keys (view=) and the leitstand id. - tests/test_english.py scans every tracked text file for umlauts and German words, with an allowlist of the quoted trigger phrases. BREAKING CHANGE: the Stream search tokens art: and seit: are now kind: and since:; an old art: or seit: token counts as a plain word. Evidence: make test 657 OK, ruff and markdownlint clean (/tmp/s0-make-test-1.log); e2e 17 OK, none skipped (/tmp/s0-e2e-1.log); MEDUSA 86 files, 24 findings on reworded strings accepted after an independent skeptic (21 path:line, 0 rejected, no behaviour change in signing, approving, rules, denying, offices, events), rescan 0 open. 🎯 Fix: 93 % 💥 Break: 4 % 💸 Cost: 100 % ⏱️ Time: – 🛡️ Security: 100 % 🏆 Score: 89 🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
79 lines
3.7 KiB
JavaScript
79 lines
3.7 KiB
JavaScript
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.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";
|
|
}
|
|
|
|
async function askNotify() {
|
|
if ("Notification" in window) {
|
|
await Notification.requestPermission();
|
|
}
|
|
notifyLabel();
|
|
}
|
|
|
|
function announce() {
|
|
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 present = {mayday: newAlarms.length > 0, review: fresh.some((item) => item.kind !== "operator"), direct: direct.length > 0, radio: newRadio.length > 0};
|
|
const kind = Voice.beep(present, settings, 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), lead * 1000);
|
|
if (settings.notify && "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;
|
|
for (const batch of state.pending) {
|
|
if (!known.batches.has(batch.id)) {
|
|
known.batches.add(batch.id);
|
|
const source = batch.source.startsWith("rule:") ? "Rule" : "Grant";
|
|
undoToast(batch, `${source}: ${batch.items.map((item) => short(item.title)).join(", ")}`);
|
|
}
|
|
}
|
|
}
|