Surface (requirement 001 phase 2): navigation Stream (Inbox, Regeln) / Agents / Artifacts with keys 1-3 and hash routes (#graph and #tree redirect), header with title, command palette and settings only, server-side badges (unsnoozed inbox, beats within 900 s, open jobs), a Mayday banner with "aufheben", four stream chips with agent:/art:/seit: search, Filter and time menus, the inbox in main, an agents toolbar (Funk an alle with Newsletter, Broadcast, Pan-Pan, Security, Mayday; Priorität; Tag/Nacht), Post or Call in the agent panel, Ambiente in the settings and read-aloud over the seven classes with Mayday locked. Rename (decision 9): hub/ is orchestrator/, the package kvb_orchestrator, the unit kvb-orchestrator-runner.service, scripts/orchestrator.sh, environment KVB_ORCHESTRATOR_*, make targets orchestrator-*, the MCP server, image and compose project kvb-orchestrator, the guard header X-Kvb-Orchestrator and the message marker [kvb-orchestrator msg <id>]. install runs migrate first: it stops the old container, removes its image and code, moves state, approvals and pinned keys, swaps the MCP registration, the PermissionRequest hook and the runner unit, and changes nothing on a second run (scratch-HOME test with stub docker, claude and systemctl). Saved views fall back to the old localStorage key once. MEDUSA acceptances carried to the renamed paths: 82 rows whose lines are unchanged (reason prefixed "renamed from <old path>, line unchanged"), and 7 rows whose text changed only in the product name, the package name, a temp prefix or a new class argument, each upheld by one kvb-think-criticize skeptic (approval.py:60, messaging.py:53, server.py:56, tests/hub_support.py:64, passkey.py:205, page-agent.js:75, language.py:46). Cost 101 %: the longer name adds 15 tokens of skill text; the operator approved it with the commit. 🎯 Fix: 92 % 💥 Break: 4 % 💸 Cost: 101 % ⏱️ Time: – 🛡️ Security: 100 % 💰 Value: ? 🏆 Score: 87 🚦 Gate: ⚠️ cost 101 % > 100: ask the operator before the commit 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: "Benachrichtigungen an", denied: "Benachrichtigungen blockiert", default: "Benachrichtigungen aktivieren", unsupported: "Benachrichtigungen fehlen im Browser"};
|
|
button.textContent = 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 = SOUND_KINDS.map(([id]) => id).find((id) => present[id] && settings.sounds[id].on);
|
|
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"} von ${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]} wartet`, {body: item.title.slice(0, 200), tag: `item-${keyOf(item)}`, requireInteraction: item.kind === "ask"});
|
|
}
|
|
for (const row of direct) {
|
|
new Notification(`Funk von ${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:") ? "Regel" : "Freigabe";
|
|
undoToast(batch, `${source}: ${batch.items.map((item) => short(item.title)).join(", ")}`);
|
|
}
|
|
}
|
|
}
|