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
@@ -9,6 +9,7 @@
|
||||
mayday: "MAYDAY: all agents pause writing steps until you cancel it.",
|
||||
};
|
||||
const VOICE_POLL = 700;
|
||||
const HOLD_MS = 350;
|
||||
const composer = {live: null};
|
||||
|
||||
function confirmMayday() {
|
||||
@@ -71,6 +72,8 @@
|
||||
}
|
||||
|
||||
async function keepRecording(blob, parts) {
|
||||
const held = parts.ptt === "released";
|
||||
parts.ptt = "";
|
||||
parts.record.disabled = true;
|
||||
try {
|
||||
const sound = context();
|
||||
@@ -94,6 +97,9 @@
|
||||
parts.text.dispatchEvent(new Event("input", {bubbles: true}));
|
||||
parts.text.focus();
|
||||
parts.status.textContent = note.text ? "Check the text, then send." : "Nothing understood: write the text yourself.";
|
||||
if (held && note.text) {
|
||||
parts.text.form.requestSubmit();
|
||||
}
|
||||
} catch (error) {
|
||||
parts.status.textContent = "";
|
||||
toast("Recording failed", [String(error.message || error)], false);
|
||||
@@ -150,6 +156,9 @@
|
||||
composer.live = parts;
|
||||
recorder.start();
|
||||
recordLabel(parts, true);
|
||||
if (parts.ptt === "released") {
|
||||
stopRecording(parts);
|
||||
}
|
||||
parts.timer = window.setInterval(() => {
|
||||
const seconds = Math.floor((Date.now() - parts.started) / 1000);
|
||||
parts.status.textContent = `Recording ${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")} of at most ${state.speech.seconds} s`;
|
||||
@@ -167,17 +176,31 @@
|
||||
const replay = h("div", {class: "voice-note", hidden: true});
|
||||
const hint = h("span", {class: "muted composer-hint"});
|
||||
const status = h("span", {class: "muted composer-status", "aria-live": "polite"});
|
||||
const record = h("button", {type: "button", class: "btn small", "aria-pressed": "false", title: "Record: one click starts, another stops; the hub transcribes, you check the text before sending"});
|
||||
const record = h("button", {type: "button", class: "btn small", "aria-pressed": "false", title: "Record: one click starts, another stops, you check the text before sending; hold it to talk, release to send"});
|
||||
const submit = h("button", {type: "submit", class: "btn primary ptt", title: "PTT: push to transmit the message; your passkey signs it"}, icon("bi-broadcast-pin"), "PTT");
|
||||
const attach = h("input", {type: "checkbox", title: "Attach recording: the agents get the path of the sound file; otherwise only the checked text goes out"});
|
||||
const parts = {record, status, text, replay, attach, voice: "", recorder: null, timer: 0, started: 0};
|
||||
const parts = {record, status, text, replay, attach, voice: "", recorder: null, timer: 0, started: 0, ptt: "", hold: 0, swallow: false};
|
||||
recordLabel(parts, false);
|
||||
const gap = micGap();
|
||||
if (gap) {
|
||||
record.disabled = true;
|
||||
record.title = `Record: ${gap}`;
|
||||
}
|
||||
record.addEventListener("click", () => (parts.recorder ? stopRecording(parts) : startRecording(parts)));
|
||||
holdToTalk(parts);
|
||||
record.addEventListener("click", () => {
|
||||
if (parts.swallow) {
|
||||
parts.swallow = false;
|
||||
return;
|
||||
}
|
||||
parts.ptt = "";
|
||||
if (parts.recorder) {
|
||||
stopRecording(parts);
|
||||
} else {
|
||||
startRecording(parts);
|
||||
}
|
||||
});
|
||||
const [, cancel, , cancelHint] = actionOf("clear-mayday");
|
||||
const clear = h("button", {type: "button", class: "btn small danger radio-cancel", hidden: !state.silence, ...named(cancel, cancelHint), on: {click: () => confirmAct("clear-mayday", [])}}, icon("bi-life-preserver"), cancel);
|
||||
const sync = () => {
|
||||
const direct = TO_ONE.some(([id]) => id === channel.value);
|
||||
toField.hidden = !direct;
|
||||
@@ -187,7 +210,7 @@
|
||||
channel.addEventListener("change", sync);
|
||||
sync();
|
||||
const form = h("form", {class: "composer"}, h("div", {class: "composer-grid"}, h("label", {}, "Channel", channel), toField), text, replay,
|
||||
h("div", {class: "actions"}, record, micButton(text, false), status, hint, submit));
|
||||
h("div", {class: "actions"}, record, micButton(text, false), status, hint, clear, h("div", {class: "ptt-split", role: "group", "aria-label": "Send"}, submit, testMenu(text, channel))));
|
||||
form.addEventListener("submit", async (event) => {
|
||||
event.preventDefault();
|
||||
const direct = TO_ONE.some(([id]) => id === channel.value);
|
||||
@@ -207,5 +230,45 @@
|
||||
submit.disabled = false;
|
||||
});
|
||||
attachVoice(parts, "");
|
||||
return {form, recipient, text, channel};
|
||||
return {form, recipient, text, channel, clear};
|
||||
}
|
||||
|
||||
function holdToTalk(parts) {
|
||||
const {record} = parts;
|
||||
record.addEventListener("pointerdown", (event) => {
|
||||
if (event.button !== 0 || record.disabled || parts.recorder) {
|
||||
return;
|
||||
}
|
||||
parts.hold = window.setTimeout(() => {
|
||||
parts.ptt = "holding";
|
||||
startRecording(parts);
|
||||
}, HOLD_MS);
|
||||
});
|
||||
const release = () => {
|
||||
window.clearTimeout(parts.hold);
|
||||
if (parts.ptt === "holding") {
|
||||
Object.assign(parts, {ptt: "released", swallow: true});
|
||||
stopRecording(parts);
|
||||
}
|
||||
};
|
||||
for (const kind of ["pointerup", "pointercancel", "pointerleave"]) {
|
||||
record.addEventListener(kind, release);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Element} text the message field.
|
||||
* @param {Element} channel the class select.
|
||||
* @returns {Element} the ▾ of PTT: a menu whose item reads the message, or a sample line, aloud here only, so nothing leaves the browser.
|
||||
*/
|
||||
function testMenu(text, channel) {
|
||||
const item = h("button", {type: "button", class: "menu-item", ...named("Test message", "Test message: hear it here as the radio reads it aloud; nothing is sent, nothing is signed"), on: {click: (event) => {
|
||||
event.currentTarget.closest("details").open = false;
|
||||
if (!state.speech.tts) {
|
||||
toast("No test message", [`The hub speaks no line: ${state.speech.tts_off}.`], false);
|
||||
return;
|
||||
}
|
||||
say({steps: [{kind: "speech", text: text.value.trim() || state.speech.sample}], voice: state.speech.operator, tone: "direct", cls: channel.value, who: HUMAN, sent: true, line: "test message"});
|
||||
}}}, icon("bi-play-fill"), "Test message");
|
||||
return h("details", {class: "menu ptt-menu"}, h("summary", {class: "btn primary ptt-more", ...named("More send options", "More: send a test message only you hear")}, caret()), h("div", {class: "menu-box end"}, item));
|
||||
}
|
||||
Reference in new issue
Block a user