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>
89 lines
4.0 KiB
JavaScript
89 lines
4.0 KiB
JavaScript
const KanbanMarks = (() => {
|
|
"use strict";
|
|
const DAY = 86400;
|
|
const HOUR = 3600;
|
|
const MINUTE = 60;
|
|
const BEAT_S = 5 * MINUTE;
|
|
const HEAD_SHOWN = 32;
|
|
const QUEUE = "queue";
|
|
const RUNNING = "running";
|
|
const RESPONSIBLE = "R";
|
|
const NOBODY = "-";
|
|
const MARKS = [["queue", "bi-cpu"], ["agent", "bi-person-workspace"], ["hub", "bi-terminal"]];
|
|
|
|
/**
|
|
* @param seconds - a span in seconds.
|
|
* @returns the span in words, cut to its two largest units: "45 s", "12 min", "2 h 5 min", "3 d 4 h".
|
|
*/
|
|
function span(seconds) {
|
|
const whole = Math.max(0, Math.floor(seconds));
|
|
if (whole < MINUTE) {
|
|
return `${whole} s`;
|
|
}
|
|
if (whole < HOUR) {
|
|
return `${Math.floor(whole / MINUTE)} min`;
|
|
}
|
|
const [big, unit, small, rest] = whole < DAY ? [HOUR, "h", MINUTE, "min"] : [DAY, "d", HOUR, "h"];
|
|
const part = Math.floor((whole % big) / small);
|
|
return part ? `${Math.floor(whole / big)} ${unit} ${part} ${rest}` : `${Math.floor(whole / big)} ${unit}`;
|
|
}
|
|
|
|
/**
|
|
* @param command - a hub job's command.
|
|
* @returns its first line, cut to HEAD_SHOWN characters with an ellipsis.
|
|
*/
|
|
function head(command) {
|
|
const line = command.trim().split("\n")[0].trim();
|
|
return line.length > HEAD_SHOWN ? `${line.slice(0, HEAD_SHOWN - 1)}…` : line;
|
|
}
|
|
|
|
function queueMark(row, tasks, now) {
|
|
const own = tasks.filter((job) => job.kind === QUEUE && job.status === RUNNING && (job.task === row.task || job.queue.parent === row.task));
|
|
const first = own.filter((job) => job.start !== null).sort((a, b) => a.start - b.start)[0] || own[0];
|
|
if (!first) {
|
|
return null;
|
|
}
|
|
const runtime = first.start === null ? "?" : span(now - first.start);
|
|
const more = own.length > 1 ? `, ${own.length - 1} more running` : "";
|
|
return {text: `${first.queue.kind} · ${runtime}`, hint: `${row.task}: queue job ${first.task} runs ${first.queue.kind} for ${runtime}${more}`, at: first.start};
|
|
}
|
|
|
|
function agentMark(row, beats, now) {
|
|
const names = [row.worker, ...Object.entries(row.roles).filter(([, letters]) => letters.includes(RESPONSIBLE)).map(([party]) => party)];
|
|
const fresh = [...new Set(names)].filter((name) => name !== NOBODY && Object.hasOwn(beats, name) && now - beats[name] >= -MINUTE && now - beats[name] <= BEAT_S);
|
|
const name = fresh.sort((a, b) => beats[b] - beats[a])[0];
|
|
if (!name) {
|
|
return null;
|
|
}
|
|
const ago = span(now - beats[name]);
|
|
return {text: `${name} · ${ago}`, hint: `${row.task}: ${name} works on it, last beat ${ago} ago`, at: beats[name]};
|
|
}
|
|
|
|
function hubMark(row, runner, now) {
|
|
if (!runner || runner.task !== row.task) {
|
|
return null;
|
|
}
|
|
const shown = head(runner.command) || runner.job;
|
|
return {text: shown, hint: `${row.task}: the hub runs ${runner.job} for ${span(now - runner.started)}: ${runner.command || runner.job}`, at: runner.started};
|
|
}
|
|
|
|
/**
|
|
* @param row - a card's task row: task, worker and roles.
|
|
* @param sources - {now, tasks, beats, runner}: now the hub's epoch seconds; tasks the hub's task rows, whose queue
|
|
* rows are the entries of queue.json; beats the hub's {agent: epoch of its latest heartbeat}; runner the hub job
|
|
* runner-job.json names, {job, task, started, command}, or null.
|
|
* @returns the card's marks in MARKS order, each {key, icon, text, hint, at}: queue while a queue job of the
|
|
* task or the queue card's own job runs (its kind and runtime), agent while the task's worker or an R beat within
|
|
* BEAT_S (the freshest of them and how long ago), hub while runner-job.json names the task (the command's head).
|
|
*/
|
|
function marks(row, sources) {
|
|
const found = {queue: queueMark(row, sources.tasks, sources.now), agent: agentMark(row, sources.beats, sources.now), hub: hubMark(row, sources.runner, sources.now)};
|
|
return MARKS.filter(([key]) => found[key]).map(([key, icon]) => ({key, icon, ...found[key]}));
|
|
}
|
|
|
|
return {BEAT_S, MARKS, span, head, marks};
|
|
})();
|
|
if (typeof module === "object" && module.exports) {
|
|
module.exports = KanbanMarks;
|
|
}
|