Files
skills/orchestrator/templates/page-grant.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

146 lines
6.2 KiB
JavaScript

const GRANT_SELECT = "select";
const GRANT_MODES = {
direct: ["Direct", "bi-lightning-charge", "Direct mode", "Direct: every grant button grants at once"],
[GRANT_SELECT]: ["Select", "bi-check2-square", "Select mode", "Select: every grant button and option adds its item to the selection; Grant grants the selection under one passkey signature, each rule and red-gate review under its own"],
};
const PICKED_HINT = "In the selection: take it out with ✕ in the Grant menu";
const UNPICK_HINT = "Selected: press again to take it out of the selection";
const SOLO_HINT = "Select: press to add it to the selection; Grant asks its own passkey signature for it";
const grantView = {tray: null, sig: "", open: false};
const choices = new Map();
const grantMode = () => (typeof ViewStore === "object" && ViewStore ? ViewStore.get("approval.mode") : "direct");
const chosenLabel = (item) => (ui.selected.has(keyOf(item)) ? choices.get(keyOf(item)) : undefined);
const solo = (item) => !item.held && (item.kind === "rule" || (item.kind === "review" && item.gate !== "pass"));
const batchable = (item) => selectable(item) || (!item.held && chosenLabel(item) !== undefined);
const collectable = (item) => batchable(item) || solo(item);
const collecting = (item) => grantMode() === GRANT_SELECT && collectable(item);
const picking = (item) => grantMode() === GRANT_SELECT && !item.held;
/**
* @param {Object} item a batchable inbox item.
* @returns {string} the label its grant carries: the picked option, else a decision's recommendation, else "".
*/
function grantLabel(item) {
const label = chosenLabel(item);
if (label !== undefined) {
return label;
}
return item.kind === "decision" ? item.recommended : "";
}
function regrant() {
render(false);
drawStream();
}
function flip(key) {
choices.delete(key);
if (ui.selected.has(key)) {
ui.selected.delete(key);
} else {
ui.selected.add(key);
}
}
function collect(item) {
flip(keyOf(item));
regrant();
}
/**
* @param {Object} item a decision or a decision row.
* @param {string} label the picked answer; picking the same answer again takes the item out of the selection.
*/
function collectPick(item, label) {
const key = keyOf(item);
if (chosenLabel(item) === label) {
collect(item);
return;
}
choices.set(key, label);
ui.selected.add(key);
regrant();
}
/**
* @param button - the grant button of item.
* @param item - a waiting inbox item.
* @returns button; a picked item's button turns pale green and disabled, and in Select a rule or red-gate review says it gets its own signature.
*/
function grantPress(button, item) {
if (!collectable(item)) {
return button;
}
const picked = ui.selected.has(keyOf(item));
if (picked) {
button.setAttribute("class", `${button.getAttribute("class")} picked`);
}
if (grantMode() !== GRANT_SELECT) {
button.disabled = picked;
if (picked) {
button.setAttribute("title", PICKED_HINT);
}
return button;
}
button.setAttribute("aria-pressed", String(picked));
button.setAttribute("title", picked ? UNPICK_HINT : solo(item) ? SOLO_HINT : "Select: press to add it to the selection; Grant grants it");
return button;
}
function modeItem(mode) {
const [, name, text, hint] = GRANT_MODES[mode];
return h("button", {type: "button", id: `grant-${mode}`, class: "menu-item", "data-mode": mode, ...named(GRANT_MODES[mode][0], hint), on: {click: () => {
grantView.open = false;
ViewStore.set("approval.mode", mode);
}}}, icon(name), text);
}
function pickedItem(item) {
return h("li", {}, h("button", {type: "button", class: "menu-item", ...named(`Remove ${item.title}`, "Remove: take it out of the selection"), on: {click: () => collect(item)}},
icon("bi-x-lg"), h("span", {class: "grant-picked-title"}, revealed(item.title))));
}
/**
* @returns {Node} the one selection control: Select, or Grant N once something is picked or Select mode is on, with a menu of the rest.
*/
function grantSplit(mode, actions) {
const selecting = mode === GRANT_SELECT || actions.chosen.length > 0;
const [label, name, , hint] = GRANT_MODES[GRANT_SELECT];
const main = selecting ? actions.grant : h("button", {type: "button", id: "grant-select", class: "btn small", "data-mode": GRANT_SELECT, ...named(label, hint), on: {click: () => ViewStore.set("approval.mode", GRANT_SELECT)}},
icon(name), h("span", {class: "grant-label"}, label));
const clear = h("button", {type: "button", class: "menu-item", ...named("Clear", "Clear: empty the selection"), disabled: !actions.chosen.length, on: {click: () => {
ui.selected.clear();
regrant();
}}}, icon("bi-x-lg"), "Clear selection");
const menu = h("details", {class: "menu grant-menu", open: grantView.open, on: {toggle: (event) => {
grantView.open = event.currentTarget.open;
}}}, h("summary", {class: "grant-count", ...named(`${actions.chosen.length} selected`, "More: deny, grant all green, the picked items, clear, mode")}, caret()),
h("div", {class: "menu-box end grant-menu-box"}, actions.deny, actions.green,
actions.chosen.length ? h("ul", {class: "grant-picked", "aria-label": "Picked"}, actions.chosen.map(pickedItem)) : null,
clear, selecting ? modeItem(mode === GRANT_SELECT ? "direct" : GRANT_SELECT) : null));
return h("div", {class: "grant-split", role: "group", "aria-label": "Selection"}, main, menu);
}
function drawGrant() {
if (!grantView.tray) {
return;
}
const mode = grantMode();
const actions = selectionActions(state.inbox);
const sig = JSON.stringify([mode, actions.chosen.map(keyOf), state.inbox.map((item) => [keyOf(item), isGreen(item), item.held]), ui.busy]);
if (sig === grantView.sig) {
return;
}
grantView.sig = sig;
grantView.tray.replaceChildren(grantSplit(mode, actions));
}
function grantBoot() {
const bar = document.getElementById("grant-bar");
grantView.tray = h("div", {class: "grant-tray"});
bar.replaceChildren(grantView.tray);
ViewStore.on("approval", regrant);
drawGrant();
}