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,10 +1,11 @@
|
||||
const GRANT_SELECT = "select";
|
||||
const GRANT_MODES = [
|
||||
["direct", "Direct", "bi-lightning-charge", "Direct: every grant button grants at once"],
|
||||
[GRANT_SELECT, "Select", "bi-check2-square", "Select: every grant button adds its item to the selection; the tray grants the selection under one passkey signature"],
|
||||
];
|
||||
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 adds its item to the selection; Grant grants the selection under one passkey signature"],
|
||||
};
|
||||
const PICKED_HINT = "In the selection: take it out with ✕ in the Grant menu";
|
||||
const DIRECT_WHY = {rule: "a rule is accepted one at a time", review: "a red gate is never granted in a selection"};
|
||||
const grantView = {modes: [], tray: null, sig: ""};
|
||||
const grantView = {tray: null, sig: "", open: false};
|
||||
|
||||
const grantMode = () => (typeof ViewStore === "object" && ViewStore ? ViewStore.get("approval.mode") : "direct");
|
||||
const collecting = (item) => grantMode() === GRANT_SELECT && selectable(item);
|
||||
@@ -27,53 +28,83 @@
|
||||
/**
|
||||
* @param button - the grant button of item.
|
||||
* @param item - a waiting inbox item.
|
||||
* @returns button; in Select it shows whether item is in the selection, or why its grant still acts at once.
|
||||
* @returns button; a picked item's button turns pale green and disabled, and in Select it says why a grant still acts at once.
|
||||
*/
|
||||
function grantPress(button, item) {
|
||||
if (grantMode() !== GRANT_SELECT) {
|
||||
return button;
|
||||
}
|
||||
const select = grantMode() === GRANT_SELECT;
|
||||
if (!selectable(item)) {
|
||||
button.setAttribute("title", `${button.getAttribute("title")}: acts at once, ${DIRECT_WHY[item.kind]}`);
|
||||
if (select) {
|
||||
button.setAttribute("title", `${button.getAttribute("title")}: acts at once, ${DIRECT_WHY[item.kind]}`);
|
||||
}
|
||||
return button;
|
||||
}
|
||||
const picked = ui.selected.has(keyOf(item));
|
||||
button.setAttribute("aria-pressed", String(picked));
|
||||
button.setAttribute("title", picked ? "In the selection: press to take it out" : "Select: press to add it to the selection; the tray grants it");
|
||||
if (picked) {
|
||||
button.disabled = true;
|
||||
button.setAttribute("class", `${button.getAttribute("class")} picked`);
|
||||
button.setAttribute("title", PICKED_HINT);
|
||||
}
|
||||
if (select) {
|
||||
button.setAttribute("aria-pressed", String(picked));
|
||||
if (!picked) {
|
||||
button.setAttribute("title", "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 chosen = state.inbox.filter((item) => ui.selected.has(keyOf(item)));
|
||||
const sig = JSON.stringify([mode, chosen.map(keyOf), state.inbox.map((item) => [keyOf(item), isGreen(item), item.held]), ui.busy]);
|
||||
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;
|
||||
for (const button of grantView.modes) {
|
||||
button.setAttribute("aria-pressed", String(button.dataset.mode === mode));
|
||||
}
|
||||
grantView.tray.hidden = mode !== GRANT_SELECT;
|
||||
grantView.tray.replaceChildren(...(mode === GRANT_SELECT ? [
|
||||
h("span", {class: "grant-count", "aria-live": "polite"}, `${chosen.length} selected`),
|
||||
...selectionButtons(state.inbox),
|
||||
h("button", {type: "button", class: "btn small ghost", ...named("Clear", "Clear: empty the selection"), disabled: !chosen.length, on: {click: () => {
|
||||
ui.selected.clear();
|
||||
regrant();
|
||||
}}}, icon("bi-x-lg"), "Clear"),
|
||||
] : []));
|
||||
grantView.tray.replaceChildren(grantSplit(mode, actions));
|
||||
}
|
||||
|
||||
function grantBoot() {
|
||||
const bar = document.getElementById("grant-bar");
|
||||
grantView.modes = GRANT_MODES.map(([mode, label, name, hint]) => h("button", {type: "button", id: `grant-${mode}`, "data-mode": mode, ...named(label, hint), on: {click: () => ViewStore.set("approval.mode", mode)}},
|
||||
icon(name), h("span", {class: "grant-label"}, label)));
|
||||
grantView.tray = h("div", {class: "grant-tray", role: "group", "aria-label": "Selection"});
|
||||
bar.replaceChildren(h("div", {class: "segmented", role: "group", "aria-label": "Grant mode"}, grantView.modes), grantView.tray);
|
||||
grantView.tray = h("div", {class: "grant-tray"});
|
||||
bar.replaceChildren(grantView.tray);
|
||||
ViewStore.on("approval", regrant);
|
||||
drawGrant();
|
||||
}
|
||||
Reference in new issue
Block a user