Files
skills/orchestrator/templates/page-morse.js
T
Kevin Veen-BirkenbachandClaude Opus 5.5 d695bb2b58 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>
2026-11-18 19:28:37 +00:00

61 lines
2.5 KiB
JavaScript

const MORSE_EDGE = 0.005;
function morseSigns(step) {
return [...(step.joined ? Morse.joined(step.sign) : Morse.words(step.sign)), ...Morse.words(step.text)];
}
function keyEdge(param, at, length, level) {
const edge = Math.min(MORSE_EDGE, length / 4);
param.setValueAtTime(0, at);
param.linearRampToValueAtTime(level, at + edge);
param.setValueAtTime(level, at + length - edge);
param.linearRampToValueAtTime(0, at + length);
}
/**
* @param {AudioContext} sound the page's audio context.
* @param {object} item the row that sounds now.
* @param {object} step the Morse step the radio set planned: sign, joined, text and pitch.
* @returns {Promise<boolean>} whether the whole message was keyed to its end; false when Stop or a mode change cut it or its tone is silent.
*/
function keyMorse(sound, item, step) {
const level = loudness(item.tone);
const {tones, ms} = Morse.timeline(morseSigns(step), settings.morse.wpm);
if (level <= 0 || !tones.length) {
return Promise.resolve(false);
}
const source = sound.createOscillator();
const gain = sound.createGain();
const start = sound.currentTime;
const seconds = ms / 1000;
source.type = "sine";
source.frequency.value = step.pitch;
gain.gain.setValueAtTime(0, start);
tones.forEach(([at, length]) => keyEdge(gain.gain, start + at / 1000, length / 1000, level));
source.connect(gain).connect(sound.destination);
voicePace(item, Infinity, seconds);
const ended = sounded(item, source, seconds);
source.start(start);
source.stop(start + seconds);
return ended.then(() => speech.item === item && !item.cut);
}
async function setMorseSpeed(wpm) {
if (wpm !== settings.morse.wpm && await saveSettings({...settings, space: savedSpace(), morse: {wpm}})) {
toast("Morse speed saved", [`The radio keys Morse at ${Morse.rate(wpm)}.`], true);
}
redrawModeMenus();
}
function morseSpeed() {
const {wpm} = settings.morse;
const shown = h("output", {class: "morse-rate"}, Morse.rate(wpm));
const input = h("input", {type: "range", class: "knob", ...Morse.SPEED, value: wpm, ...named("Morse speed", "Morse speed: words per minute after PARIS, for every browser of this hub"), on: {
input: (event) => {
shown.textContent = Morse.rate(Number(event.target.value));
},
change: (event) => setMorseSpeed(Number(event.target.value)),
}});
return h("label", {class: "morse-speed"}, h("span", {}, "Morse speed"), input, shown);
}