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>
160 lines
8.1 KiB
JavaScript
160 lines
8.1 KiB
JavaScript
/**
|
||
* @returns every command: {label, hint, run, scope, face, id}; scope is "general", a tab id of Nav.TABS, or an element
|
||
* kind of CTX_KINDS, which the item carries with the id of the one element it belongs to, such as an agent key.
|
||
*/
|
||
function paletteItems() {
|
||
return [
|
||
...Nav.TABS.flatMap(([id, label], index) => [{label: `View: ${label}`, hint: String(index + 1), scope: "general", run: () => go(id, null)}, ...(Nav.SUBS[id] || []).map(([sub, name]) => ({label: `View: ${label} › ${name}`, hint: Nav.hashOf(sub, null), scope: id, run: () => go(sub, null)}))]),
|
||
...["agents", "artifacts", "tasks"].flatMap((screen) => Nav.viewsOf(screen).map(([id, name]) => ({label: `${Nav.TABS.find(([tab]) => tab === screen)[1]}: ${name}`, hint: Nav.hashOf(screen, id), scope: screen, run: () => go(screen, id)}))),
|
||
...Object.entries(state.views).map(([id, view]) => ({label: `Stream: ${view.label}`, hint: "Category", scope: "stream", run: () => useView(id)})),
|
||
...userViews.map((view) => ({label: `Stream: ${view.name}`, hint: "saved view", scope: "stream", run: () => useSaved(view)})),
|
||
...agentNames().map((name) => ({label: name, hint: "Agent", face: name, scope: "agent", id: agentKey(name), run: () => openAgent(name)})),
|
||
{label: "Radio …", hint: "Post, Call, Newsletter, Broadcast, Pan-Pan, Security, Mayday; the gear holds tones and read aloud", scope: "general", run: openRadio},
|
||
...ACTIONS.map(([id, label]) => ({label, hint: id === "clear-mayday" ? "Mayday" : "Day/Night", scope: "general", run: () => confirmAct(id, [])})),
|
||
{label: "Priority …", hint: "agent order in the hierarchy", scope: "agents", run: openAgentOrder},
|
||
{label: "Controls …", hint: "tools, rules, groups and schedules", scope: "stream", run: () => go("rules", null)},
|
||
{label: "Schedules …", hint: "switch off or retime the reminders, timers and hooks", scope: "stream", run: () => go("rules", "schedules")},
|
||
{label: "Settings …", hint: "Ambience, location, colors, music, notifications, internet radio", scope: "general", run: settingsSheet},
|
||
{label: settings.music.on ? "Music off" : "Music on", hint: "Ambience", scope: "general", run: toggleMusic},
|
||
{label: space.look ? "Leave the sky" : "Look at the sky", hint: "h", scope: "general", run: () => skyLook(!space.look)},
|
||
{label: "Toggle control room", hint: "Ambience", scope: "general", run: toggleLeitstand},
|
||
{label: "Enable notifications", hint: "Ambience", scope: "general", run: askNotify},
|
||
{label: "Keyboard shortcuts", hint: "?", scope: "general", run: helpSheet},
|
||
];
|
||
}
|
||
|
||
function drawPalette() {
|
||
if (palette.plan) {
|
||
return;
|
||
}
|
||
const raw = palette.input.value.trim();
|
||
const q = raw.toLowerCase();
|
||
const items = paletteItems().filter((item) => !q || item.label.toLowerCase().includes(q) || item.hint.toLowerCase().includes(q));
|
||
if (raw) {
|
||
items.push(state.llm
|
||
? {label: `AI command: “${raw}”`, hint: "Tab", keep: true, run: () => askModel(raw)}
|
||
: {label: "AI command is off", hint: "set KVB_ORCHESTRATOR_LLM_URL and KVB_ORCHESTRATOR_LLM_MODEL in orchestrator/.env", keep: true, run: () => toast("AI command is off", ["Set KVB_ORCHESTRATOR_LLM_URL, KVB_ORCHESTRATOR_LLM_MODEL and KVB_ORCHESTRATOR_LLM_KEY_FILE in orchestrator/.env and reinstall."], false)});
|
||
}
|
||
palette.items = items;
|
||
palette.index = Math.min(palette.index, Math.max(items.length - 1, 0));
|
||
palette.list.replaceChildren(...items.map((item, index) => h("li", {role: "option", "aria-selected": String(index === palette.index), on: {
|
||
click: () => runPalette(index),
|
||
mousemove: () => {
|
||
if (palette.index !== index) {
|
||
palette.index = index;
|
||
drawPalette();
|
||
}
|
||
},
|
||
}}, h("span", {class: item.face ? "who" : null}, item.face ? face(item.face, false) : null, item.label), h("span", {class: "muted"}, item.hint))));
|
||
const current = palette.list.children[palette.index];
|
||
if (current) {
|
||
current.scrollIntoView({block: "nearest"});
|
||
}
|
||
}
|
||
|
||
function runPalette(index) {
|
||
const item = palette.items[index];
|
||
if (!item) {
|
||
return;
|
||
}
|
||
if (!item.keep) {
|
||
closePalette();
|
||
}
|
||
item.run();
|
||
}
|
||
|
||
async function askModel(text) {
|
||
palette.plan = {actions: [], rejected: [], busy: true};
|
||
palette.list.replaceChildren(h("li", {}, h("span", {class: "muted"}, "Asking the model … (only the command, ids and titles leave the hub)")));
|
||
const result = await sendJson("/api/nl", {text});
|
||
if (!palette.plan) {
|
||
return;
|
||
}
|
||
if (!result.ok || !result.data) {
|
||
palette.plan = null;
|
||
palette.list.replaceChildren(h("li", {}, h("span", {}, `AI command failed: ${result.status} ${result.text}`.trim())));
|
||
return;
|
||
}
|
||
palette.plan = result.data;
|
||
const actions = result.data.actions.map((action) => h("pre", {}, action.summary));
|
||
const rejected = result.data.rejected.map((entry) => h("p", {class: "muted"}, `discarded: ${entry.reason} · ${entry.action}`));
|
||
palette.list.replaceChildren(h("li", {class: "palette-plan"},
|
||
actions.length ? actions : h("p", {class: "muted"}, "The model proposed no valid action."),
|
||
rejected,
|
||
h("p", {class: "muted"}, actions.length ? "Enter runs exactly these actions · Esc cancels" : "Esc closes")));
|
||
}
|
||
|
||
async function executePlan(plan) {
|
||
for (const action of plan.actions) {
|
||
const args = action.args;
|
||
if (action.name === "approve" || action.name === "reject" || action.name === "choose") {
|
||
await submit(args.items, action.summary.split("\n")[0]);
|
||
} else if (action.name === "snooze" || action.name === "pin") {
|
||
for (const key of args.keys) {
|
||
const item = state.inbox.find((entry) => entry.kind === key.kind && entry.id === key.id);
|
||
if (item) {
|
||
await mark(item, action.name === "snooze" ? nowSeconds() + args.hours * 3600 : item.until, action.name === "pin" ? true : item.pinned);
|
||
}
|
||
}
|
||
} else if (action.name === "view") {
|
||
useView(args.name);
|
||
} else if (action.name === "open") {
|
||
go(args.view, null);
|
||
} else if (action.name === "message") {
|
||
await message(args.to, args.text, "", "post");
|
||
} else if (action.name === "filter") {
|
||
filter.q = args.q;
|
||
if (ui.screen === "stream" && stream.dom) {
|
||
stream.dom.search.value = args.q;
|
||
refilter();
|
||
} else {
|
||
go("stream", null);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
function openPalette() {
|
||
const box = document.getElementById("palette");
|
||
palette.input = h("input", {type: "text", placeholder: "View, agent, action, or a command in words …", "aria-label": "Command", role: "combobox", "aria-expanded": "true"});
|
||
palette.list = h("ul", {class: "palette-list", role: "listbox"});
|
||
palette.index = 0;
|
||
palette.plan = null;
|
||
palette.input.addEventListener("input", () => {
|
||
palette.index = 0;
|
||
palette.plan = null;
|
||
drawPalette();
|
||
});
|
||
palette.input.addEventListener("keydown", (event) => {
|
||
if (palette.plan && event.key === "Enter") {
|
||
event.preventDefault();
|
||
const plan = palette.plan;
|
||
if (!plan.busy && plan.actions.length) {
|
||
closePalette();
|
||
executePlan(plan);
|
||
}
|
||
} else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
||
event.preventDefault();
|
||
const size = Math.max(palette.items.length, 1);
|
||
palette.index = (palette.index + (event.key === "ArrowDown" ? 1 : size - 1)) % size;
|
||
drawPalette();
|
||
} else if (event.key === "Tab" && palette.input.value.trim() && !palette.plan) {
|
||
event.preventDefault();
|
||
palette.index = palette.items.length - 1;
|
||
runPalette(palette.index);
|
||
} else if (event.key === "Enter") {
|
||
event.preventDefault();
|
||
runPalette(palette.index);
|
||
}
|
||
});
|
||
box.replaceChildren(h("div", {class: "palette-box", role: "dialog", "aria-label": "Commands"}, h("div", {class: "palette-row"}, micFrame(palette.input, [])), palette.list));
|
||
box.hidden = false;
|
||
drawPalette();
|
||
palette.input.focus();
|
||
}
|
||
|
||
function closePalette() {
|
||
document.getElementById("palette").hidden = true;
|
||
palette.plan = null;
|
||
}
|