feat(hub): grant split menu, radio redesign and answerable decision rows
The Grant bar becomes one split control: Select, or Grant N with a menu for Deny, Grant all green, the picked list, Clear and Direct mode; picked items turn pale green. The radio drops its filter flyout and gains three-state bells per row, a test per row including Speak, Auto or Morse on a second click, mute on the sender avatar and the agent profile, Cancel MAYDAY beside Send only while one is active, a Send menu with a test message and hold-to-record push-to-talk. Decision rows read as questions with their options; the signed answer is Decision <id> plus Answer: <answer>, and the card names its recipient. Security: the passkey-signed answer carries no agent-written text, the inbox lists answerable rows only when their id fullmatches the TASK rule of the installed rasci.py (skill_scripts.task_pattern), and rasci.py, operator.py and hotfix.py check task slugs with fullmatch, so a trailing newline no longer passes. Accepted MEDUSA findings after kvb-think-criticize: page-inbox.js:116 EXA006 (by design after the fix), page-inbox.js:125 EXA010, operator.py:173, 618 and 633 RP001, FT-TRIGGER-005 and RLHF-POISON-002, operator.py:639 MEX-SCAN-346, operator.py:968 MM-SCAN-058, operator.py:974 ACP-SCAN-028 (false positives). 🎯 Fix: 85 % 💥 Break: 10 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 77 🚦 Gate: ⛔ fix 85 % < 90, break 10 % > 5 Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ff9bbc19c2
commit
d695bb2b58
42 files changed
+1158
-340
No files matched your search
@@ -1,18 +1,20 @@
|
||||
const STATION_TONES = {playing: "ok", loading: "info", reload: "info", blocked: "warn", error: "bad", due: "teal", stopped: "neutral", idle: "neutral", off: "neutral"};
|
||||
const NOTE_ID = /^[0-9a-f]{16}$/;
|
||||
const MODE_LABELS = {
|
||||
auto: ["bi-volume-up", "Auto", "Auto: speech while the host CPU lies below the threshold, otherwise the fallback picked under Read aloud"],
|
||||
quiet: ["bi-soundwave", "Quiet", "Quiet: the fallback picked under Read aloud, never speech; MAYDAY, PAN-PAN and Sécurité still sound their procedure word"],
|
||||
auto: ["bi-volume-up", "Auto", "Auto: speech while the host CPU lies below the threshold, otherwise the fallback; press Auto again to pick the fallback"],
|
||||
quiet: ["bi-soundwave", "Quiet", "Quiet: the fallback, never speech; press Quiet again to pick it; MAYDAY, PAN-PAN and Sécurité still sound their procedure word"],
|
||||
silence: ["bi-volume-mute", "Silence", "Silence: no sound, bubbles and log only; MAYDAY, PAN-PAN and Sécurité still sound their procedure word"],
|
||||
morse: ["bi-three-dots", "Morse", "Morse: every message keyed whole in Morse, in its sender's own pitch, at the hub's Morse speed; MAYDAY keys SOS"],
|
||||
morse: ["bi-three-dots", "Morse", "Morse: every message keyed whole in Morse, in its sender's own pitch; press Morse again to set the speed; MAYDAY keys SOS"],
|
||||
gibberlink: ["bi-robot", "Gibberlink", "Gibberlink: every message sent whole as ggwave data sound a machine can decode, in its sender's own protocol and stereo position; MAYDAY, PAN-PAN and Sécurité still sound their procedure word"],
|
||||
};
|
||||
const MODE_MENUS = {auto: () => fallbackPick(), quiet: () => fallbackPick(), morse: () => morseSpeed()};
|
||||
const FALLBACK_LABELS = {
|
||||
gibberlink: ["Gibberlink", "Where speech cannot play, send the rest as ggwave data sound"],
|
||||
morse: ["Morse", "Where speech cannot play, key the whole message in Morse"],
|
||||
burst: ["Hiss", "Where speech cannot play, play the short noise burst"],
|
||||
};
|
||||
const radioParts = {bars: [], devices: [], logs: [], speaks: []};
|
||||
const BELLS = {off: ["bi-bell-slash", "off"], tone: ["bi-bell", "tone only"], speak: ["bi-megaphone", "tone and read aloud"]};
|
||||
const radioParts = {devices: [], logs: [], speaks: []};
|
||||
const liveParts = (kind) => radioParts[kind].filter((part) => part.root.isConnected);
|
||||
|
||||
function voiceReplay(note) {
|
||||
@@ -131,14 +133,23 @@
|
||||
return {input, value, name, row: h("div", {class: "knob-row", title: hint}, name, input, value)};
|
||||
}
|
||||
|
||||
function radioCheck(tone, line) {
|
||||
say({steps: [{kind: "speech", text: state.speech.sample}], voice: state.speech.operator, tone, cls: "newsletter", who: HUMAN, sent: true, line});
|
||||
}
|
||||
|
||||
function testTone(id, label) {
|
||||
play(id, loudness(id));
|
||||
if (state.speech.tts && RadioSet.bell(radioSet, id) === "speak") {
|
||||
radioCheck(id, `${label} test`);
|
||||
}
|
||||
}
|
||||
|
||||
function toneKnob(id, label) {
|
||||
const toggle = h("button", {type: "button", class: "btn small ghost icon-only knob-toggle", "aria-pressed": "false", ...named(`${label} tone`), on: {click: () => {
|
||||
keepRadio({sounds: {...radioSet.sounds, [id]: {...radioSet.sounds[id], on: !radioSet.sounds[id].on}}});
|
||||
}}});
|
||||
const toggle = h("button", {type: "button", class: "btn small ghost icon-only knob-toggle", "aria-pressed": "false", ...named(`${label} tone`), on: {click: () => keepRadio(RadioSet.ring(radioSet, id))}});
|
||||
const level = knob(label, `${label}: tone volume; speech and the burst of these rows play at it`, {min: 0, max: 1, step: 0.05}, (volume) => {
|
||||
keepRadio({sounds: {...radioSet.sounds, [id]: {...radioSet.sounds[id], volume}}});
|
||||
});
|
||||
const test = iconBtn("bi-play-fill", `Test ${label}`, "btn small ghost knob-test", () => play(id, loudness(id)), `Test: play the ${label} tone`);
|
||||
const test = iconBtn("bi-play-fill", `Test ${label}`, "btn small ghost knob-test", () => testTone(id, label), `Test: play the ${label} tone, while it reads aloud also a spoken line`);
|
||||
level.row.prepend(toggle);
|
||||
level.row.append(test);
|
||||
return {id, toggle, level};
|
||||
@@ -164,9 +175,51 @@
|
||||
squelch.row.append(iconBtn("bi-play-fill", "Test Squelch", "btn small ghost knob-test", () => say({steps: [{kind: "burst"}], voice: "", tone: "radio", cls: "post", who: HUMAN, sent: true, line: "squelch test"}), "Test: play the burst of a radio row, at the All radio volume times the squelch"));
|
||||
const threshold = knob("Threshold", "Speech threshold: the hub renders new speech only while the host CPU lies below it, always at 100 %, never at 0 %; your passkey signs each change", RadioSet.GATE, (value) => drawGate(threshold, value));
|
||||
threshold.input.addEventListener("change", (event) => setThreshold(Number(event.target.value)));
|
||||
const check = iconBtn("bi-broadcast", "Radio check", "btn small ghost radio-check", () => say({steps: [{kind: "speech", text: state.speech.sample}], voice: state.speech.operator, tone: "direct", cls: "newsletter", who: HUMAN, sent: true, line: "radio check"}), "Radio check: hear the operator's voice once");
|
||||
const check = iconBtn("bi-play-fill", "Radio check", "btn small ghost knob-test radio-check", () => radioCheck("direct", "radio check"), "Radio check: hear the operator's voice once at these settings");
|
||||
check.disabled = !state.speech.tts;
|
||||
return {tones, squelch, threshold, check, rows: [...tones.map((tone) => tone.level.row), squelch.row, threshold.row]};
|
||||
threshold.row.append(check);
|
||||
return {tones, squelch, threshold, rows: [...tones.map((tone) => tone.level.row), squelch.row, threshold.row]};
|
||||
}
|
||||
|
||||
function fallbackPick() {
|
||||
return h("div", {class: "chips radio-fallback", role: "group", "aria-label": "Fallback", title: "Fallback: what plays in Auto above the threshold and in Quiet, kept in this browser"}, h("span", {class: "chips-label"}, "Fallback"),
|
||||
RadioSet.FALLBACKS.map((id) => h("button", {type: "button", class: "chip", "aria-pressed": String(radioSet.fallback === id), ...named(FALLBACK_LABELS[id][0], FALLBACK_LABELS[id][1]), on: {click: () => keepRadio({fallback: id})}}, FALLBACK_LABELS[id][0])));
|
||||
}
|
||||
|
||||
function pressMode(part, id) {
|
||||
if (radioSet.mode === id && MODE_MENUS[id]) {
|
||||
part.menuFor = part.menuFor === id ? "" : id;
|
||||
drawModeMenu(part);
|
||||
return;
|
||||
}
|
||||
part.menuFor = "";
|
||||
keepRadio({mode: id});
|
||||
context();
|
||||
}
|
||||
|
||||
function drawModeMenu(part) {
|
||||
const {menu, modes} = part.face;
|
||||
if (part.menuFor !== radioSet.mode) {
|
||||
part.menuFor = "";
|
||||
}
|
||||
for (const button of modes.querySelectorAll("button[data-mode]")) {
|
||||
if (MODE_MENUS[button.dataset.mode]) {
|
||||
button.setAttribute("aria-expanded", String(part.menuFor === button.dataset.mode));
|
||||
}
|
||||
}
|
||||
const sig = JSON.stringify([part.menuFor, radioSet.fallback, settings.morse.wpm]);
|
||||
if (sig !== part.menuSig) {
|
||||
part.menuSig = sig;
|
||||
menu.replaceChildren(...(part.menuFor ? [MODE_MENUS[part.menuFor]()] : []));
|
||||
menu.hidden = !part.menuFor;
|
||||
}
|
||||
}
|
||||
|
||||
function redrawModeMenus() {
|
||||
for (const part of liveParts("devices")) {
|
||||
part.menuSig = "";
|
||||
drawModeMenu(part);
|
||||
}
|
||||
}
|
||||
|
||||
function faceplate(part) {
|
||||
@@ -176,49 +229,22 @@
|
||||
const caption = h("div", {class: "radio-caption", role: "status", "aria-live": "polite", hidden: true});
|
||||
const modes = h("div", {class: "segmented radio-modes", role: "group", "aria-label": "Mode"}, RadioSet.MODES.map((id) => {
|
||||
const [name, label, hint] = MODE_LABELS[id];
|
||||
return h("button", {type: "button", "data-mode": id, "aria-pressed": "false", ...named(label, hint), on: {click: () => {
|
||||
keepRadio({mode: id});
|
||||
context();
|
||||
}}}, icon(name), label);
|
||||
return h("button", {type: "button", "data-mode": id, "aria-pressed": "false", ...named(label, hint), on: {click: () => pressMode(part, id)}},
|
||||
icon(name), label, MODE_MENUS[id] ? h("span", {class: "mode-caret", "aria-hidden": "true"}, "▾") : null);
|
||||
}));
|
||||
part.face = {lamp, cls, mode, cpu, caption, modes};
|
||||
part.knobs = knobs();
|
||||
const menu = h("div", {class: "radio-mode-menu", hidden: true});
|
||||
Object.assign(part, {face: {lamp, cls, mode, cpu, caption, modes, menu}, menuFor: "", menuSig: "", knobs: knobs()});
|
||||
const display = h("div", {class: "radio-display", role: "group", "aria-label": "Display"}, lamp, cls, mode, cpu);
|
||||
return h("div", {class: "radio-face", role: "group", "aria-label": "Radio set"}, display, caption, modes, part.knobs.check,
|
||||
return h("div", {class: "radio-face", role: "group", "aria-label": "Radio set"}, display, caption, modes, menu,
|
||||
h("div", {class: "radio-knobs", role: "group", "aria-label": "Knobs"}, part.knobs.rows));
|
||||
}
|
||||
|
||||
function toggleGear(part) {
|
||||
const open = part.box.hidden;
|
||||
part.box.replaceChildren(...(open ? [radioFilters()] : []));
|
||||
part.box.hidden = !open;
|
||||
part.gear.setAttribute("aria-expanded", String(open));
|
||||
window.requestAnimationFrame(refresh3d);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} spot whether the bar heads the radio spot.
|
||||
* @returns {object} the bar part: root, gear, its box and the Cancel mayday button.
|
||||
* @returns {object} the bar part with its root.
|
||||
*/
|
||||
function radioBar(spot) {
|
||||
const part = {box: h("div", {class: "radio-gear", id: spot ? "radio-gear" : null, hidden: true})};
|
||||
part.gear = iconBtn("bi-funnel", "Read aloud", "btn small ghost spot-toggle", () => toggleGear(part), "Read aloud: the classes and agents the radio sounds for");
|
||||
part.gear.setAttribute("aria-expanded", "false");
|
||||
if (spot) {
|
||||
part.gear.setAttribute("aria-controls", "radio-gear");
|
||||
}
|
||||
const [, label, , hint] = actionOf("clear-mayday");
|
||||
part.clear = iconBtn("bi-life-preserver", label, "btn small danger", () => confirmAct("clear-mayday", []), hint);
|
||||
part.clear.disabled = !state.silence;
|
||||
part.root = h("div", {class: "spot-bar", "data-star-slot": ""}, h("div", {class: "spot-head"}, spot ? h("h3", {class: "group-title"}, "Radio") : null, h("span", {class: "spacer"}), part.gear, part.clear), part.box);
|
||||
radioParts.bars.push(part);
|
||||
return part;
|
||||
}
|
||||
|
||||
function drawBars() {
|
||||
for (const part of liveParts("bars")) {
|
||||
part.clear.disabled = !state.silence;
|
||||
}
|
||||
return {root: h("div", {class: "spot-bar", "data-star-slot": ""}, h("div", {class: "spot-head"}, spot ? h("h3", {class: "group-title"}, "Radio") : null, h("span", {class: "spacer"})))};
|
||||
}
|
||||
|
||||
function cardHead(title, ...tools) {
|
||||
@@ -270,8 +296,8 @@
|
||||
}
|
||||
|
||||
function speakCard() {
|
||||
const {form, recipient, text, channel} = composerForm();
|
||||
const part = {recipient, text, channel, names: ""};
|
||||
const {form, recipient, text, channel, clear} = composerForm();
|
||||
const part = {recipient, text, channel, clear, names: ""};
|
||||
part.root = h("section", {class: "radio-card radio-speak", "data-panel": "radio-speak", "aria-label": "Speak"}, cardHead("Speak"), form);
|
||||
radioParts.speaks.push(part);
|
||||
return part;
|
||||
@@ -281,6 +307,7 @@
|
||||
const names = agentNames();
|
||||
const sig = JSON.stringify(names);
|
||||
for (const part of liveParts("speaks")) {
|
||||
part.clear.hidden = !state.silence;
|
||||
if (sig !== part.names) {
|
||||
part.names = sig;
|
||||
const chosen = part.recipient.value;
|
||||
@@ -289,47 +316,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
function radioFilters() {
|
||||
const chip = (label, pressed, hint, run, locked) => h("button", {type: "button", class: "chip", "aria-pressed": String(pressed), disabled: locked, ...named(label, hint), on: {click: run}}, label);
|
||||
const classes = SPEECH_CLASSES.map(([id, label]) => chip(label, radioSet.classes.includes(id), id === "mayday" ? "MAYDAY always sounds" : `Read ${label} aloud`, () => {
|
||||
keepRadio({classes: radioSet.classes.includes(id) ? radioSet.classes.filter((name) => name !== id) : [...radioSet.classes, id]});
|
||||
redrawFilters();
|
||||
}, id === "mayday"));
|
||||
const agents = Object.entries(people()).sort(([, a], [, b]) => a.now.localeCompare(b.now)).map(([key, entry]) => chip(entry.now, !radioSet.muted.includes(key), `Read ${entry.now} aloud`, () => {
|
||||
keepRadio({muted: radioSet.muted.includes(key) ? radioSet.muted.filter((name) => name !== key) : [...radioSet.muted, key]});
|
||||
redrawFilters();
|
||||
}, false));
|
||||
const fallbacks = RadioSet.FALLBACKS.map((id) => chip(FALLBACK_LABELS[id][0], radioSet.fallback === id, FALLBACK_LABELS[id][1], () => {
|
||||
keepRadio({fallback: id});
|
||||
redrawFilters();
|
||||
}, false));
|
||||
return h("div", {class: "radio-read", "aria-label": "Read aloud"},
|
||||
h("p", {class: "muted"}, state.speech.tts ? "The radio sounds for these classes and agents, each speaker with its own voice; MAYDAY always sounds." : `The hub speaks no line: ${state.speech.tts_off}. The fallback and the procedure words stand in.`),
|
||||
h("div", {class: "chips", role: "group", "aria-label": "Classes"}, classes),
|
||||
agents.length ? h("div", {class: "chips", role: "group", "aria-label": "Agents"}, agents) : null,
|
||||
h("div", {class: "chips radio-fallback", role: "group", "aria-label": "Fallback", title: "Fallback: what plays in Auto above the threshold and in Quiet, kept in this browser"}, h("span", {class: "chips-label"}, "Fallback"), fallbacks),
|
||||
morseSpeed());
|
||||
}
|
||||
|
||||
function redrawFilters() {
|
||||
for (const part of liveParts("bars")) {
|
||||
if (!part.box.hidden) {
|
||||
part.box.replaceChildren(radioFilters());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function drawRadioSet() {
|
||||
for (const part of liveParts("devices")) {
|
||||
for (const button of part.face.modes.querySelectorAll("button[data-mode]")) {
|
||||
button.setAttribute("aria-pressed", String(button.dataset.mode === radioSet.mode));
|
||||
}
|
||||
drawModeMenu(part);
|
||||
const {tones, squelch, threshold} = part.knobs;
|
||||
for (const {id, toggle, level} of tones) {
|
||||
const sound = radioSet.sounds[id];
|
||||
toggle.setAttribute("aria-pressed", String(sound.on));
|
||||
toggle.replaceChildren(icon(sound.on ? "bi-bell" : "bi-bell-slash"));
|
||||
toggle.title = `${toggle.getAttribute("aria-label")}: ${sound.on ? "on, a press mutes it" : "off, a press turns it on"}`;
|
||||
const bell = RadioSet.bell(radioSet, id);
|
||||
toggle.setAttribute("aria-pressed", String(bell !== "off"));
|
||||
toggle.dataset.bell = bell;
|
||||
toggle.replaceChildren(icon(BELLS[bell][0]));
|
||||
toggle.title = `${toggle.getAttribute("aria-label")}: ${BELLS[bell][1]}; each press moves on: ${RadioSet.SPOKEN[id].length ? "off, tone, read aloud" : "off, tone"}`;
|
||||
level.input.value = String(sound.volume);
|
||||
level.value.textContent = sound.volume.toFixed(2);
|
||||
}
|
||||
@@ -346,7 +346,6 @@
|
||||
drawRadioSet();
|
||||
drawStations();
|
||||
drawSpeak();
|
||||
drawBars();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user