023 box heads: one head band per box under its top border; in widget mode its controls join the widget title band. 024 Match card content: merge cards show their diff (the runner previews a review's tree against its worktree HEAD), every card carries legal and architecture scores, the null under command cards is gone. 025 Radio speak card: no hint text, a rounder flowing card, a MAYDAY toggle beside push to talk. 026 widget zoom: zoom a widget's content by keyboard and the context menu. 027 slash skill suggestions: every field that messages agents suggests skills after a slash, from a skills index the tree timer writes. 028 Resources accounts: an Accounts panel (provider, renewal, resets, usage and remaining, host-local, emails never in git) and panel checkboxes. 029 Controls layout: Rules and Groups pages laid out. 030 Yes/No answers as buttons, and nothing hides: rows the runner cannot run stay greyed with the reason. 031 mic in fields. Line comments (operator 2026-11-24): wherever code waits for a grant (Waits on Operator, the stream, the review overlay) selected lines or a right-clicked row take a comment that marks its lines and collects on the card; Deny opens with them as the reason and Call preselected, Grant sends them after the signed grant as one post. Requirement 003 decision 4 and its contract follow. Tests are written for every requirement and run once on this head. 🎯 Fix: 80 % 💥 Break: 20 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: ~95 % 🏆 Score: 61 🚦 Gate: ⛔ fix 80 % < 90, break 20 % > 5; security ~95 % < 100: ask the operator before the commit Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
157 lines
8.1 KiB
JavaScript
157 lines
8.1 KiB
JavaScript
function history(key) {
|
|
const known = (people()[key] || {names: [nameOf(key)]}).names;
|
|
const radio = state.radio.filter((row) => row.source === key || row.targets.includes(key)).map((row) => ({ts: row.ts, mine: row.from === HUMAN, who: row.from, text: row.text, readers: row.readers, acks: row.acks}));
|
|
const sent = state.messages.filter((message) => known.includes(message.to) || message.to === "*").map((message) => ({ts: message.created_ts, mine: true, who: HUMAN, text: message.upload ? `${message.text}\n📎 ${message.upload}` : message.text, id: message.id, voice: message.voice, readers: message.readers, acks: message.acks}));
|
|
const hubIds = new Set(sent.map((entry) => entry.id));
|
|
const relayed = radio.filter((entry) => !(entry.who === HUMAN && [...hubIds].some((id) => entry.text.includes(`[kvb-orchestrator msg ${id}]`))));
|
|
return [...relayed, ...sent].sort((a, b) => a.ts - b.ts).slice(-80);
|
|
}
|
|
|
|
function drawAgent() {
|
|
if (!agentDom) {
|
|
return;
|
|
}
|
|
const node = state.graph.nodes.find((entry) => entry.id === ui.agent);
|
|
const tasks = node ? node.tasks : [];
|
|
const claims = node ? node.claims : [];
|
|
const part = state.night_parts[ui.agent] || state.night;
|
|
agentDom.night.replaceChildren(pill(...(NIGHT[part] || [part, "neutral"])));
|
|
agentDom.info.replaceChildren(
|
|
...[presenceMark(ui.agent, true)].filter(Boolean),
|
|
h("p", {class: "muted"}, claims.length ? `Offices: ${claims.map((claim) => claim.office).join(", ")}` : "No office"),
|
|
h("h3", {}, "Tasks", counter(tasks.length)),
|
|
tasks.length ? h("ul", {class: "mini"}, tasks.map((task) => h("li", {},
|
|
h("div", {class: "row"}, h("code", {}, task.task), status(task.status)),
|
|
h("span", {}, dash(task.title)),
|
|
h("span", {class: "roles"}, [task.worker ? "Worker" : "", task.letters ? `Roles ${task.letters}` : ""].filter(Boolean).join(" · "))))) : h("p", {class: "muted"}, "No open tasks."),
|
|
h("h3", {}, "Claims", counter(claims.length)),
|
|
claims.length ? h("ul", {class: "mini"}, claims.map((claim) => h("li", {},
|
|
h("div", {class: "row"}, h("code", {}, claim.office), claim.beat === null ? null : h("span", {class: "muted"}, "Pulse ", when(claim.beat))),
|
|
h("span", {}, dash(claim.work)),
|
|
h("span", {class: "muted"}, `${dash(claim.runtime)} · since ${dash(claim.since)}`)))) : h("p", {class: "muted"}, "No claims."));
|
|
const rows = history(ui.agent);
|
|
agentDom.history.replaceChildren(rows.length
|
|
? h("div", {}, rows.map((row) => h("div", {class: `bubble ${row.mine ? "mine" : "theirs"}`}, h("span", {class: "muted"}, `${row.who} · `, when(row.ts)), row.text, voiceReplay(row.voice), readerRow(row))))
|
|
: h("p", {class: "muted"}, "No history in the chosen time range."));
|
|
placePopup();
|
|
}
|
|
|
|
async function loadSubagents(key, holder, life) {
|
|
if (!SESSION_ID.test(key)) {
|
|
holder.replaceChildren(h("p", {class: "muted"}, "No session known."));
|
|
return;
|
|
}
|
|
let data = null;
|
|
try {
|
|
const response = await fetch(`/api/subagents?session=${encodeURIComponent(key)}`, {cache: "no-store"});
|
|
data = response.ok ? await response.json() : null;
|
|
} catch {
|
|
data = null;
|
|
}
|
|
if (!data) {
|
|
holder.replaceChildren(h("p", {class: "muted"}, "Subagents unreadable."));
|
|
return;
|
|
}
|
|
life.textContent = stamp(data);
|
|
const rows = data.subagents.map((row) => ({...row, session: key})).sort((a, b) => a.started - b.started);
|
|
holder.replaceChildren(rows.length ? h("ul", {class: "mini"}, rows.map((row) => {
|
|
const item = h("li", {},
|
|
h("div", {class: "row"}, h("button", {type: "button", class: "linkish", title: "Show transcript in the stream", on: {click: () => focusSub(row.session, row.id)}}, `${row.type}: ${row.description}`), row.finished ? pill("finished", "neutral") : pill("running", "ok")),
|
|
h("span", {class: "muted"}, `Depth ${row.depth} · `, when(row.started), stamp(row) ? ` · ${stamp(row)}` : ""));
|
|
item.style.marginLeft = `${(row.depth - 1) * 18}px`;
|
|
return item;
|
|
})) : h("p", {class: "muted"}, "No subagents."));
|
|
placePopup();
|
|
}
|
|
|
|
async function deliver(key, text, file, cls) {
|
|
let upload = "";
|
|
if (file) {
|
|
if (file.size > UPLOAD_LIMIT) {
|
|
toast("File too large", [`${file.name}: at most 50 MiB`], false);
|
|
return false;
|
|
}
|
|
const stored = await send(`/api/uploads?name=${encodeURIComponent(file.name)}`, file, "application/octet-stream");
|
|
if (!stored.ok || !stored.data) {
|
|
toast("Upload failed", [`${stored.status} ${stored.text}`.trim()], false);
|
|
return false;
|
|
}
|
|
upload = stored.data.id;
|
|
}
|
|
return message(nameOf(key), text, upload, cls);
|
|
}
|
|
|
|
function message(to, text, upload, cls) {
|
|
return radioSend({to, text, upload, cls, voice: ""});
|
|
}
|
|
|
|
function openAgent(who, anchor, closed) {
|
|
const key = agentKey(who);
|
|
const name = nameOf(key);
|
|
const text = h("textarea", {"aria-label": `Message to ${name}`, placeholder: `Message to ${name} …`, "data-skills": ""});
|
|
const file = h("input", {type: "file", class: "field", "aria-label": "Attach file"});
|
|
const button = h("button", {type: "submit", class: "btn primary icon-only", ...named("Send")}, icon("bi-send"));
|
|
const classes = choice("to-one", TO_ONE, "post");
|
|
const form = h("form", {class: "popup-form"}, micFrame(text, []), file, classes,
|
|
h("p", {class: "muted"}, "Post arrives at the end of the turn, Call at once with a read receipt; your passkey signs, verifiable with operator_message."),
|
|
h("div", {class: "actions"}, h("span", {class: "spacer"}), button));
|
|
form.addEventListener("submit", async (event) => {
|
|
event.preventDefault();
|
|
if (!text.value.trim()) {
|
|
return;
|
|
}
|
|
button.disabled = true;
|
|
if (await deliver(key, text.value, file.files[0] || null, picked(classes))) {
|
|
text.value = "";
|
|
file.value = "";
|
|
}
|
|
button.disabled = false;
|
|
});
|
|
const info = h("div", {});
|
|
const subs = h("div", {}, h("p", {class: "muted"}, "Loading subagents …"));
|
|
const log = h("div", {"aria-live": "polite"});
|
|
const life = h("span", {class: "muted"});
|
|
const night = h("span", {});
|
|
const claimed = nightAgents().some(([sid]) => sid === key);
|
|
const nightRow = h("div", {class: "actions agent-night", role: "group", "aria-label": "Day/Night"}, night, h("span", {class: "spacer"}), radioMute(key, name),
|
|
claimed ? ACTIONS.slice(1).map(([id]) => actionButton(id, "btn small", null, () => [key])) : null);
|
|
const former = (people()[key] || {names: []}).names.filter((entry) => entry !== name);
|
|
openPopup(name, [
|
|
popupHead(face(name, true), name, h("span", {class: "muted"}, former.length ? `Agent · formerly ${former.join(", ")}` : "Agent"), " ", life),
|
|
h("div", {class: "popup-body", "data-item": `agent:${key}`}, nightRow, info, h("h3", {}, "Subagents"), subs, h("h3", {}, "History"), log),
|
|
form,
|
|
], anchor, () => {
|
|
agentDom = null;
|
|
ui.agent = null;
|
|
if (closed) {
|
|
closed();
|
|
}
|
|
});
|
|
ui.agent = key;
|
|
agentDom = {info, history: log, night};
|
|
drawAgent();
|
|
loadSubagents(key, subs, life);
|
|
text.focus();
|
|
}
|
|
|
|
function radioMute(key, name) {
|
|
const button = h("button", {type: "button", class: "btn small agent-mute", "aria-label": `Mute ${name}`});
|
|
const show = () => {
|
|
const muted = radioSet.muted.includes(key);
|
|
button.title = muted ? `Muted: the radio reads ${name} aloud again on a press` : `Mute ${name}: the radio stops reading this agent aloud`;
|
|
button.setAttribute("aria-pressed", String(muted));
|
|
button.replaceChildren(icon(muted ? "bi-volume-mute" : "bi-volume-up"), muted ? "Muted" : "Radio on");
|
|
};
|
|
button.addEventListener("click", () => {
|
|
keepRadio(RadioSet.muting(radioSet, key));
|
|
show();
|
|
});
|
|
show();
|
|
return button;
|
|
}
|
|
|
|
function agentNames() {
|
|
const names = new Set([...state.graph.nodes.filter((node) => node.kind === "session" || node.kind === "chair").map((node) => nameOf(node.id)), ...state.agent_order]);
|
|
return [...names].sort((a, b) => a.localeCompare(b));
|
|
}
|