Files
skills/orchestrator/templates/page-radiolog.js
T
Kevin Veen-BirkenbachandClaude Opus 5.5 0fad1bfae3 feat: hub and skills requirements 032 to 063
Hub: send in the field (032), coherent speak box (033), stream head band (034), Match at full width with its pile (035, 036), Home without the outer box (037), badge to Match (038), rejects that survive a changed or withdrawn card (039), the release card (040), code marks in the review diff (041), why Deny is off (042), the undo window clock (043), widgets without inner boxes (044), the Artifacts head on one line (045), accepting a red gate's risk (046), one code box (047), done rows greyed and folded (048), one control height (049), menus that stay open (050), radio settings in the Device card (051), bubbles beside the modes (052), agent settings on every face and name (053), pin only by menu (054), WASD in Match (055), the flowing card edge (056), Schedules in Controls (057) and the hub poll cost (059).

Skills: the coach leaves for its own repository kevinveenbirkenbach/coach (058; test_install pins its four skills in skills-lock.json and stays red until that repository is published and pinned), hooks and timers start fewer processes (060), council files on hot paths stay bounded and mirror by marker instead of mtime (061), scripts and hooks hand agents less output (062), and block.py builds the commit table and message block in one run (063). Requirement documents 032 to 063 with their implementation amendments.

MEDUSA false positives accepted after kvb-think-criticize (36 lines): MM-SCAN-058 (pla inside replace or plan), JB-SCAN-616/641 (the local clip helper), CODEGEN-SCAN-001 (drop-in paths), CGS-SCAN-029 (systemctl argv from constants), CGS-SCAN-040 (runner poll loop), FLA-SCAN-055 (feedback), WM-SCAN-354, AI-BACKDOOR-006, GENAI-SCAN-1270, B604 (runner shell path for passkey-verified commands), TC004, EXA002, EXA006, EXA010 and WEB-SSRF.

🎯 Fix: 92 %
💥 Break: 8 %
💸 Tokens: 89 %
⏱️ Velocity: –
🛡️ Security: ~100 %
🏆 Score: 95
🚦 Gate: ⛔ break 8 % > 5

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 08:44:15 +00:00

247 lines
12 KiB
JavaScript

const TAB_LABELS = {sent: ["bi-arrow-up-right", "Sent", "Sent: what you transmitted"], received: ["bi-arrow-down-left", "Received", "Received: radio to you or to all"], all: ["bi-journal-text", "All", "All: every radio row the hub logs"]};
const CHIP_LABELS = {class: "Class", from: "Sender", to: "Recipient", agent: "Agent"};
const COPIED = 1600;
const FOLDED_READERS = 3;
function keepLog(change) {
keepRadio({log: {...radioSet.log, ...change}});
}
function chipSelect(name) {
const label = CHIP_LABELS[name];
const select = h("select", {class: "field", "aria-label": label, title: `${label}: filter the log`, on: {change: (event) => keepLog({chips: {...radioSet.log.chips, [name]: event.target.value}})}});
return h("label", {class: "chip-select", "data-chip": name, "data-active": "false"}, select);
}
function fillChip(chip, values) {
const name = chip.dataset.chip;
const chosen = radioSet.log.chips[name];
const options = [...new Set([...values, ...(chosen ? [chosen] : [])])];
const select = chip.querySelector("select");
const sig = JSON.stringify([options, chosen || ""]);
if (select.sig !== sig) {
select.sig = sig;
select.replaceChildren(h("option", {value: ""}, `${CHIP_LABELS[name]}: any`), ...options.map((value) => h("option", {value, selected: value === chosen}, name === "class" ? CLASSES[value] || value : value)));
}
setAttr(chip, "data-active", String(Boolean(chosen)));
}
function setAttr(node, name, value) {
if (node.getAttribute(name) !== value) {
node.setAttribute(name, value);
}
}
function setText(node, value) {
if (node.textContent !== value) {
node.textContent = value;
}
}
function firstLine(text) {
return text.split("\n").map((part) => part.trim()).find(Boolean) || "";
}
function logLine(row) {
const message = row.sent ? row : RadioSet.ledgerOf(row, state.messages);
const sent = Boolean(message);
const [name, label] = sent ? ["bi-arrow-up-right", "Sent"] : ["bi-arrow-down-left", "Received"];
const first = firstLine(row.text);
const line = h("li", {class: "radio-row", "data-key": row.key, "data-dir": sent ? "sent" : "received", "data-class": row.class, "data-ts": row.ts, on: {click: (event) => openRadioRow(event.currentTarget.row, event.currentTarget)}},
row.source && !sent && row.from !== HUMAN ? senderFace(row.source, row.from) : null,
h("button", {type: "button", class: "radio-pick", "aria-haspopup": "dialog", title: first},
when(row.ts),
h("span", {class: "radio-dir", role: "img", ...named(label)}, icon(name)),
klass(row.class),
h("span", {class: "radio-route"}, `${row.from} → ${targetsOf(row)}`),
h("span", {class: "radio-line"}, first)),
foldedReaders(row));
line.row = row;
return line;
}
function keepLine(kept, fresh) {
kept.row = fresh.row;
if (kept.outerHTML === fresh.outerHTML) {
return kept;
}
for (const name of ["data-dir", "data-class"]) {
setAttr(kept, name, fresh.getAttribute(name));
}
const [pick, twin] = [kept.querySelector(".radio-pick"), fresh.querySelector(".radio-pick")];
setAttr(pick, "title", twin.getAttribute("title"));
pick.replaceChildren(...twin.childNodes);
for (const node of [...kept.children].filter((child) => child !== pick)) {
node.remove();
}
const parts = [...fresh.children];
const at = parts.indexOf(twin);
pick.before(...parts.slice(0, at));
pick.after(...parts.slice(at + 1));
return kept;
}
/**
* @param {string} key the sender's session key.
* @param {string} name the sender's name.
* @returns {Element} the sender's avatar as a button that opens the agent with its own radio switches, without opening the row; greyed while its sound and read aloud are both off.
*/
function senderFace(key, name) {
const quiet = !agentOn(key, "sound") && !agentOn(key, "aloud");
return h("button", {type: "button", class: "radio-sender", "data-quiet": String(quiet), ...named(`Open ${name}`, `Open ${name}${quiet ? ": its sound and read aloud are off" : ""}; its own switches sit in the agent card`), on: {click: openFrom(key)}}, face(key, false));
}
function patchList(list, lines) {
const before = [...list.children];
const focused = before.find((node) => node.contains(document.activeElement)) || null;
const old = new Map(before.filter((node) => node.dataset.key).map((node) => [node.dataset.key, node]));
const wanted = lines.map((line) => {
const kept = old.get(line.dataset.key);
old.delete(line.dataset.key);
return kept ? keepLine(kept, line) : line;
});
const keep = new Set(wanted);
for (const node of before.filter((child) => !keep.has(child))) {
node.remove();
}
wanted.forEach((node, index) => {
if (list.children[index] !== node) {
list.insertBefore(node, list.children[index] || null);
}
});
if (focused && !focused.isConnected) {
const at = before.indexOf(focused);
const near = before.filter((node) => node.isConnected && node.querySelector(".radio-pick")).sort((a, b) => Math.abs(before.indexOf(a) - at) - Math.abs(before.indexOf(b) - at))[0];
(near ? near.querySelector(".radio-pick") : list).focus({preventScroll: true});
}
}
function foldedReaders(row) {
const strip = readerRow(row);
const {shown, hidden} = Receipts.strip(row);
const rest = shown.length + hidden.length - FOLDED_READERS;
if (strip && rest > 0) {
strip.append(h("span", {class: "readers-more readers-fold", role: "img", ...named(`${rest} more readers`, [...shown, ...hidden].slice(FOLDED_READERS).map(readLabel).join("\n"))}, `+${rest}`));
}
return strip;
}
function readerLine(reader) {
const known = reader.read !== null && reader.read !== undefined;
return h("li", {class: "popup-reader", "data-session": reader.session, "data-acked": String(reader.acked)},
h("strong", {}, agentLink(people()[reader.session] ? reader.session : reader.name)),
h("span", {class: "muted"}, known ? `read ${reader.approximate ? "about " : ""}${absolute.format(stampOf(reader.read))}` : "read, time unknown"),
reader.acked ? pill("acknowledged", "ok") : null);
}
function copyText(text) {
const said = h("span", {class: "radio-said", role: "status", "aria-live": "polite"});
const button = h("button", {type: "button", class: "btn small radio-copy", ...named("Copy", "Copy: the full message to the clipboard")}, icon("bi-clipboard"), h("span", {}, "Copy"));
const show = (name, word, done, note) => {
button.replaceChildren(icon(name), h("span", {}, word));
button.setAttribute("aria-label", word);
button.dataset.copied = done;
said.textContent = note;
};
button.addEventListener("click", async () => {
try {
await navigator.clipboard.writeText(text);
show("bi-clipboard-check", "Copied", "true", "Copied: the full message is on the clipboard");
} catch {
show("bi-x-circle", "Not copied", "false", "Not copied: the browser refused the clipboard");
}
window.setTimeout(() => show("bi-clipboard", "Copy", "", ""), COPIED);
});
return [button, said];
}
function replyTarget(list) {
const home = list ? list.closest(".radio-home") : null;
if (!home) {
return spotDom.speak;
}
const homes = liveParts("speaks").filter((part) => part.root.closest(".radio-home"));
return homes.find((part) => home.contains(part.root)) || homes.find((part) => part.root.closest(".radio-home-radio-speak")) || homes[0] || spotDom.speak;
}
function replyTo(row, list) {
const who = row.from === HUMAN && row.to.length ? row.to[0] : row.from;
const part = replyTarget(list);
closePopup();
if (part === spotDom.speak) {
openSpot(true);
}
part.channel.value = "post";
part.channel.dispatchEvent(new Event("change", {bubbles: true}));
if (![...part.recipient.options].some((option) => option.value === who)) {
part.recipient.append(h("option", {value: who}, who));
}
part.recipient.value = who;
part.text.focus();
}
function openRadioRow(row, li) {
const message = row.sent ? row : RadioSet.ledgerOf(row, state.messages);
const {shown, hidden} = Receipts.strip(row);
const readers = [...shown, ...hidden];
const list = li.closest("ul");
const anchor = () => (list ? [...list.querySelectorAll(".radio-row")].find((item) => item.dataset.key === row.key) || null : null);
openPopup(`Radio message from ${row.from}`, [
popupHead(klass(row.class), `${row.from} → ${targetsOf(row)}`),
meta([["Sender", row.from], ["Recipient", targetsOf(row)], ["Class", CLASSES[row.class] || row.class], ["Time", absolute.format(stampOf(row.ts))]]),
h("pre", {class: "radio-full"}, row.text),
voiceReplay(message ? message.voice : null),
h("div", {class: "actions radio-actions"},
h("button", {type: "button", class: "btn small primary radio-reply", ...named("Reply", "Reply: a post to the sender in the speak card"), on: {click: () => replyTo(row, list)}}, icon("bi-reply"), "Reply"),
copyText(row.text)),
h("h3", {}, readers.length ? `Read by ${readers.length}` : "Read by nobody yet"),
readers.length ? h("ul", {class: "popup-readers"}, readers.map(readerLine)) : null,
].filter(Boolean), anchor);
}
function drawLog() {
const entry = radioSet.log;
const sig = JSON.stringify([state.radio.length, state.radio.length ? state.radio[state.radio.length - 1].ts : 0, state.messages.length, Receipts.signature(state.radio), Receipts.signature(state.messages), entry, settings.agents, Math.floor(Date.now() / 60000)]);
for (const dom of liveParts("logs")) {
if (sig !== dom.sig) {
dom.sig = sig;
drawLogPart(dom, entry);
}
}
}
function drawLogPart(dom, entry) {
const counts = RadioSet.counts(state.radio, HUMAN, state.messages);
for (const button of dom.tabs.children) {
const {tab} = button.dataset;
const count = button.querySelector(".count");
setAttr(button, "aria-selected", String(tab === entry.tab));
setAttr(count, "aria-label", `${counts[tab]} rows`);
setText(count, String(counts[tab]));
}
const choices = RadioSet.choices(state.radio);
for (const chip of dom.chips.children) {
fillChip(chip, choices[chip.dataset.chip]);
}
if (document.activeElement !== dom.search && dom.search.value !== entry.q) {
dom.search.value = entry.q;
}
const rows = RadioSet.logRows(state.radio, entry, HUMAN, state.messages);
patchList(dom.list, rows.length ? rows.map(logLine) : [h("li", {class: "muted"}, state.radio.length ? "No radio row matches the tab, the chips and the search." : "No radio in the chosen time range yet.")]);
}
function historyCard() {
const tabs = h("div", {class: "radio-tabs", role: "tablist", "aria-label": "Log"}, RadioSet.TABS.map((tab) => {
const [name, label, hint] = TAB_LABELS[tab];
return h("button", {type: "button", role: "tab", "data-tab": tab, "aria-selected": "false", title: hint, on: {click: () => keepLog({tab})}}, icon(name), label, h("span", {class: "count"}));
}));
const chips = h("div", {class: "radio-chips", role: "group", "aria-label": "Log filters"}, RadioSet.CHIPS.map(chipSelect));
const search = h("input", {type: "search", class: "field", placeholder: "Search the log …", maxlength: 200, ...named("Search the log"), on: {input: (event) => keepLog({q: event.target.value})}});
const clear = iconBtn("bi-x-circle", "Clear filters", "btn small ghost", () => keepRadio({log: RadioSet.cleared(radioSet.log)}), "Clear filters: every chip and the search");
const list = h("ul", {class: "radio-log", tabindex: "-1", "aria-label": "Radio log"});
const part = {tabs, chips, search, list, sig: ""};
part.root = h("section", {class: "radio-card radio-logbox", "data-panel": "radio-log", "aria-label": "Radio log"}, cardHead("History", tabs, search), h("div", {class: "radio-filters"}, chips, clear), list);
radioParts.logs.push(part);
return part;
}