Files
skills/orchestrator/templates/page-console.js
T
Kevin Veen-BirkenbachandClaude Opus 5.5 6323f087bc feat(orchestrator): hub page for requirements 085 to 099
085 calm Match deck: no header hourglass, centred bare empty state, the
release card as a deck card (Cancel, Skip, Release), fixed card height.
086 motion: vanish() fade everywhere with a lint test, view transitions,
a lub-dub heartbeat for working objects, confetti that lands and fades.
087 time readout under the pivot of every analog clock.
088 prune dialog grouped by prefix with tri-state boxes, search, stepper
and sticky footer.
089 one-row task toolbar with Filter and Actions menus and a filter chip.
090 card border by state colour with a soft glow and owner avatars.
091 draggable limit lines with staged changes and one Save, a Limits menu
with the matrix, View toggles, the GPU cause in its tooltip.
093 request chips Open, Expired, Stale, Failed, All and a signed Delete.
094 closed cards leave the deck within 5 s; open in Claude stamps.
095 compact agent message box with Post/Call, attach, mic and Send in
the field.
096 Reject on an expired card drops it silently as Drop (expired).
097 Show filter in Match's right-click menu.
098 docked speech bubbles carry the speaker's avatar and a skip button.
099 Match card headlines cut to 120 characters with the full title in
the tooltip; the code box keeps the whole command.
tests/test_hub_path_links.py: a unicode fixture without German.

Full make test green through the queue (2605 tests, ruff, shellcheck,
markdownlint). Gate missed on the operator's word: break 7 %, the E2E
specs (13 new, 15 updated) run next.

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

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 01:47:41 +00:00

101 lines
3.4 KiB
JavaScript

const consoles = new Map();
const FOLLOW_SLACK = 12;
const CONSOLE_POLL = 2000;
const jobOpen = (job) => job.status === "queued" || job.status === "running";
const withoutOutput = (item) => (item.job ? {...item, job: {...item.job, output: null}} : item);
const consoleSizes = new ResizeObserver((entries) => {
for (const entry of entries) {
const view = consoles.get(entry.target.dataset.job);
if (view && view.follow) {
view.out.scrollTop = view.out.scrollHeight;
}
}
});
function lasting(seconds) {
const total = Math.max(0, Math.round(seconds));
if (total < 60) {
return `${total} s`;
}
if (total < 3600) {
return `${Math.floor(total / 60)} min ${total % 60} s`;
}
return `${Math.floor(total / 3600)} h ${Math.floor((total % 3600) / 60)} min`;
}
function consoleWords(job) {
if (job.status === "queued") {
return `waiting for the runner for ${lasting(nowSeconds() - job.created_ts)}`;
}
if (job.status === "running") {
return `running for ${lasting(nowSeconds() - job.started)}`;
}
if (job.status === "refused") {
return "the runner did not accept the signature";
}
return `Exit code ${job.code} after ${lasting(job.finished - job.started)}`;
}
function paintConsole(view, job) {
const text = job.output || (jobOpen(job) ? "No output yet." : "No output.");
if (view.out.textContent !== text) {
view.out.textContent = text;
}
view.box.dataset.status = job.status;
view.line.classList.toggle("is-working", job.status === "running");
view.line.replaceChildren(status(job.status), h("span", {}, consoleWords(job)));
}
function consoleOf(job) {
let view = consoles.get(job.id);
if (!view) {
const out = h("pre", {class: "console-out", tabindex: "0", "aria-label": "Command output", "data-job": job.id});
const line = h("div", {class: "console-status"});
view = {box: h("div", {class: "console", "data-job": job.id}, line, out), out, line, follow: true, top: 0};
out.addEventListener("scroll", () => {
view.top = out.scrollTop;
view.follow = out.scrollHeight - out.scrollTop - out.clientHeight <= FOLLOW_SLACK;
});
consoles.set(job.id, view);
consoleSizes.observe(out);
}
paintConsole(view, job);
return view.box;
}
function settleConsoles(items) {
const shown = new Set(items.filter((item) => item.job).map((item) => item.job.id));
for (const [id, view] of consoles) {
if (!shown.has(id)) {
consoleSizes.unobserve(view.out);
consoles.delete(id);
} else if (view.box.isConnected) {
view.out.scrollTop = view.follow ? view.out.scrollHeight : view.top;
}
}
}
function repaintConsoles(items) {
for (const item of items) {
const view = item.job ? consoles.get(item.job.id) : null;
if (view) {
paintConsole(view, item.job);
}
}
settleConsoles(items);
}
async function dismissJob(job) {
const result = await sendJson("/api/inbox/dismiss", {id: job.id});
if (!result.ok && !closeGone(result, state.inbox.filter((item) => item.job && item.job.id === job.id).map(keyOf), "Close")) {
toast("Cannot close", fail(result), false);
}
await load();
}
window.setInterval(() => {
if (ui.screen === "inbox" && state.inbox.some((item) => item.held || (item.job && jobOpen(item.job)))) {
refresh();
}
}, CONSOLE_POLL);