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

104 lines
3.0 KiB
JavaScript

let loadTicket = 0;
let appliedTicket = 0;
let loadsInFlight = 0;
async function load() {
loadTicket += 1;
const ticket = loadTicket;
loadsInFlight += 1;
const abort = new AbortController();
const timer = window.setTimeout(() => abort.abort(), STATE_TIMEOUT);
try {
const response = await fetch(`/api/state?${windowQuery()}`, {cache: "no-store", signal: abort.signal});
if (!response.ok) {
throw new Error(String(response.status));
}
const next = await response.json();
if (ticket < appliedTicket) {
return;
}
appliedTicket = ticket;
const previous = state.now;
const resumed = ui.offline;
state = next;
forgetRevealed();
ui.offline = false;
if (JSON.stringify(state.settings) !== settingsSig) {
adoptSettings(state.settings);
}
tuneMusic(FADE / 1000);
drawSky();
announce(resumed);
render(false);
drawTime();
drawAgent();
drawQueueJobs();
drawStream(true);
if (motion.current.size === 0 || ui.asOf !== motion.asOf) {
const first = motion.current.size === 0;
motion.asOf = ui.asOf;
relayout(first ? 0 : ui.playing ? 450 : MOVE);
}
pulses(state.radio.filter((row) => row.ts > previous));
} catch {
if (ticket > appliedTicket) {
ui.offline = true;
tick();
}
} finally {
window.clearTimeout(timer);
loadsInFlight -= 1;
}
}
function poll() {
refresh();
}
const SELECTION_HOLD = 20000;
let selectedSince = 0;
function refresh() {
const selected = String(window.getSelection()).length > 0;
selectedSince = selected ? selectedSince || Date.now() : 0;
if (!loadsInFlight && !ui.busy && !ui.playing && !document.hidden && (!selected || Date.now() - selectedSince >= SELECTION_HOLD)) {
load();
}
}
function follow() {
if (ui.screen === "stream" && live() && !document.hidden) {
fetchEvents();
}
}
const CLOSED_POLL = 2000;
const closedWatch = {seen: null, busy: false};
/**
* @returns {Promise<void>} settled once the hub's count of closed cards (/api/match/closed) is read; when it moved
* since the last read, the first read included, an open Match deck fetches its cards and the state reloads at once
* instead of at their next interval, so a card answered in Claude or another browser leaves within one CLOSED_POLL.
*/
async function watchClosed() {
if (closedWatch.busy) {
return;
}
closedWatch.busy = true;
try {
const response = await fetch("/api/match/closed", {cache: "no-store"});
const data = response.ok ? await response.json() : null;
if (data && data.closed !== closedWatch.seen) {
closedWatch.seen = data.closed;
if (matchShown()) {
fetchMatch();
}
refresh();
}
} catch {
closedWatch.seen = null;
} finally {
closedWatch.busy = false;
}
}