feat(orchestrator): S5 Tasks with choices, Gantt, estimates and burn charts
Requirement 001 phase 6, S5: - Tasks tab: every pending ask, rule request, operator row and choice card shows under "waits on Operator"; a choice request goes out on a fixed channel button, post and call with an agent multi-select, and a click on an option sends a passkey-signed answer the agent checks with operator_message. The unsigned /api/decisions/<id>/choose route is gone, and a decision, choice answer or choice recipient whose name holds "*" is refused, so a signed answer never reaches every agent. - Gantt view: one bar per task from start to end (running to now), one arrow per explicit, branch-base and queue-order edge, hatched forecast bars (always, points only, real only) from the median duration or points times median hours per point. - rasci.py set --after/--drop-after stores task dependencies and refuses unknown tasks and cycles. - Estimation toggle (No estimate default, Story points) is stored in the hub settings; burndown and burnup per whole register, list filter or one agent or line, counting tasks or summing complexity with the unestimated tasks as their own line. - New skill kvb-org-queue-estimate: "Request estimates" (story points mode, passkey-signed board action) or the skill sends exactly one newsletter listing every unestimated task with its RASCI parties; a party name that is no plain name shows as "unnamed party". - Business value per task or in bulk is stored only with a verified passkey assertion over the exact ids and values; WSJF uses it instead of the median. The task list sorts by every decision-50 mode both ways. - e2e: the walk's pending ask lives an hour instead of 60 s, and the CDP and BiDi drivers retry removing the browser profile while the browser exits (ENOTEMPTY). Evidence: make test 709 OK, ruff and markdownlint clean (/tmp/s5-make-test-fix-2.log); e2e 26 OK in Chromium and Firefox (/tmp/s5-e2e-fix-2.log); MEDUSA 50 files, an independent skeptic rejected four holes (unsigned choose route, unsigned estimates request, free-text party names, "*" recipients incl. normalizer bypasses), all fixed and re-verified, the 8 remaining pattern hits accepted, rescan 0 open. 🎯 Fix: 92 % 💥 Break: 4 % 💸 Cost: 100 % ⏱️ Time: – 🛡️ Security: 100 % 🏆 Score: 88 🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5c8b69d53d
commit
d9eb121d12
49 files changed
+2162
-148
No files matched your search
@@ -453,6 +453,8 @@ pre.notes { margin: 0; padding: 8px 10px; background: var(--sunken); border-radi
|
||||
{% include "popup.js" %}
|
||||
|
||||
{% include "faces.js" %}
|
||||
|
||||
{% include "plan.js" %}
|
||||
</script>
|
||||
<script nonce="{{ nonce }}">
|
||||
{# Jinja drops each file's last newline and trim_blocks the one after the tag: the blank lines keep consecutive modules on separate lines #}
|
||||
@@ -525,6 +527,10 @@ pre.notes { margin: 0; padding: 8px 10px; background: var(--sunken); border-radi
|
||||
|
||||
{% include "page-tasks-prio.js" %}
|
||||
|
||||
{% include "page-tasks-gantt.js" %}
|
||||
|
||||
{% include "page-choices.js" %}
|
||||
|
||||
{% include "page-time.js" %}
|
||||
|
||||
{% include "page-pulses.js" %}
|
||||
|
||||
@@ -3,12 +3,12 @@ const Nav = (() => {
|
||||
const TABS = [["stream", "Stream"], ["agents", "Agents"], ["artifacts", "Artifacts"], ["tasks", "Tasks"]];
|
||||
const SUBS = {stream: [["inbox", "Inbox"], ["rules", "Firewall"], ["radio", "Radio"]]};
|
||||
const VIEWS = [["orbit", "Orbit"], ["chord", "Chord"], ["swimlane", "Swimlane"], ["tree", "Tree"], ["3d", "3D"]];
|
||||
const TASK_VIEWS = [["list", "List"], ["board", "Board"], ["rasci", "RASCI"]];
|
||||
const TASK_VIEWS = [["list", "List"], ["board", "Board"], ["rasci", "RASCI"], ["gantt", "Gantt"], ["burn", "Burndown and burnup"]];
|
||||
const OWN = {agents: [["hierarchy", "Hierarchy"]]};
|
||||
const ICONS = {
|
||||
stream: "bi-activity", inbox: "bi-inbox", rules: "bi-card-checklist", radio: "bi-boombox", agents: "bi-people", artifacts: "bi-git", tasks: "bi-list-check",
|
||||
orbit: "bi-globe2", chord: "bi-bezier2", swimlane: "bi-bar-chart-steps", tree: "bi-diagram-3", "3d": "bi-badge-3d", hierarchy: "bi-diagram-2",
|
||||
list: "bi-list-task", board: "bi-kanban", rasci: "bi-grid-3x3",
|
||||
list: "bi-list-task", board: "bi-kanban", rasci: "bi-grid-3x3", gantt: "bi-calendar-range", burn: "bi-graph-down-arrow",
|
||||
};
|
||||
const OLD = {graph: ["agents", "orbit"], tree: ["artifacts", "tree"]};
|
||||
const viewsOf = (screen) => (screen === "tasks" ? TASK_VIEWS : [...VIEWS, ...(OWN[screen] || [])]);
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
const CHOICE_ICONS = {post: "bi-envelope", call: "bi-telephone", newsletter: "bi-newspaper", broadcast: "bi-broadcast", "pan-pan": "bi-exclamation-triangle", security: "bi-shield-exclamation", mayday: "bi-life-preserver"};
|
||||
const choiceAsk = {to: new Set(), dom: null, names: ""};
|
||||
|
||||
async function requestChoices(cls) {
|
||||
const direct = TO_ONE.some(([id]) => id === cls);
|
||||
const to = direct ? [...choiceAsk.to].sort((a, b) => a.localeCompare(b)) : ["*"];
|
||||
if ((direct && !to.length) || (cls === "mayday" && !confirmMayday())) {
|
||||
return;
|
||||
}
|
||||
const label = `Choice request (${CLASSES[cls]}) to ${direct ? to.join(", ") : "all"}`;
|
||||
const signed = await signedProof("/api/choices/sign", {class: cls, to}, label);
|
||||
if (!signed) {
|
||||
return;
|
||||
}
|
||||
const result = await sendJson("/api/choices", {class: cls, to, proof: signed.proof});
|
||||
if (!result.ok || !result.data) {
|
||||
toast(`${label} failed`, fail(result), false);
|
||||
return;
|
||||
}
|
||||
toast(`${label}: ${result.data.ok ? "sent" : "stored, sending failed"}`, [...result.data.ids.map((id) => `kvb-orchestrator msg ${id}`), ...runLines(result.data)], result.data.ok);
|
||||
await load();
|
||||
}
|
||||
|
||||
function choiceBar() {
|
||||
const picks = h("div", {class: "choice-agents", role: "group", "aria-label": "Post or call to"});
|
||||
const count = counter(0);
|
||||
const menu = h("details", {class: "menu"}, h("summary", named("Agents", "Agents: who gets a post or a call"), icon("bi-people"), count, caret()),
|
||||
h("div", {class: "menu-box"}, h("h3", {}, "Post or call to"), picks));
|
||||
const button = ([id, label]) => h("button", {type: "button", class: "btn small", "data-channel": id, ...named(label, `${label}: ask for every open decision as a choice, signed with your passkey. ${CHANNEL_HINTS[id]}`), on: {click: () => requestChoices(id)}},
|
||||
icon(CHOICE_ICONS[id]), label);
|
||||
const direct = TO_ONE.map(button);
|
||||
choiceAsk.dom = {picks, count, direct};
|
||||
choiceAsk.names = "";
|
||||
return h("div", {class: "card controls choice-request", role: "group", "aria-label": "Request choices"},
|
||||
h("span", {class: "group-title"}, "Request choices"), menu, direct, TO_ALL.map(button));
|
||||
}
|
||||
|
||||
function syncChoices() {
|
||||
choiceAsk.dom.count.textContent = String(choiceAsk.to.size);
|
||||
for (const button of choiceAsk.dom.direct) {
|
||||
button.disabled = !choiceAsk.to.size;
|
||||
}
|
||||
}
|
||||
|
||||
function pickChoice(name, on) {
|
||||
if (on) {
|
||||
choiceAsk.to.add(name);
|
||||
} else {
|
||||
choiceAsk.to.delete(name);
|
||||
}
|
||||
syncChoices();
|
||||
}
|
||||
|
||||
function drawChoices() {
|
||||
const dom = choiceAsk.dom;
|
||||
if (!dom || !dom.picks.isConnected) {
|
||||
return;
|
||||
}
|
||||
const names = agentNames();
|
||||
for (const name of [...choiceAsk.to]) {
|
||||
if (!names.includes(name)) {
|
||||
choiceAsk.to.delete(name);
|
||||
}
|
||||
}
|
||||
const sig = JSON.stringify(names);
|
||||
if (sig !== choiceAsk.names) {
|
||||
choiceAsk.names = sig;
|
||||
dom.picks.replaceChildren(...(names.length ? names.map((name) => h("label", {class: "check"},
|
||||
h("input", {type: "checkbox", value: name, checked: choiceAsk.to.has(name), on: {change: (event) => pickChoice(name, event.target.checked)}}), name)) : [h("p", {class: "muted"}, "No agent known yet.")]));
|
||||
}
|
||||
syncChoices();
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
const PART_TONES = {user: "info", assistant: "ok", tool_call: "violet", tool_result: "teal", system: "neutral"};
|
||||
const KIND_TONES = {radio: "teal", review: "info", ask: "warn", decision: "violet", operator: "bad", register: "neutral", rename: "info", cron: "teal", rule: "ok", approval: "ok", run: "info", transcript: "neutral"};
|
||||
const VIEW_ICONS = {"fuer-dich": "bi-person-check", funk: "bi-broadcast", arbeit: "bi-briefcase", transkripte: "bi-chat-left-text"};
|
||||
const ITEM_LABELS = {review: "Review", ask: "Ask", decision: "Decision", operator: "Operator", rule: "Rule request"};
|
||||
const ITEM_LABELS = {review: "Review", ask: "Ask", decision: "Choice", operator: "Operator", rule: "Rule request"};
|
||||
const NIGHT = {day: ["Day", "ok"], drain: ["Draining", "warn"], suspend: ["Suspended", "violet"]};
|
||||
const ACTIONS = [["clear-mayday", "Cancel mayday", "Lift the radio silence of the active mayday?"], ["drain", "Drain", "Drain all agents: finish the current task, accept nothing new (kvb-agent-drain)?"], ["suspend", "Suspend", "Suspend all agents: park work, write the handover, idle (kvb-agent-suspend)?"], ["resume", "Resume", "Resume all agents from their handover (kvb-agent-resume)?"]];
|
||||
const UPLOAD_LIMIT = 50 * 1024 * 1024;
|
||||
|
||||
@@ -57,13 +57,13 @@
|
||||
openItem(item);
|
||||
return null;
|
||||
}
|
||||
return submit([entryOf(item, "approve", item.recommended)], `Decision: ${item.recommended}`);
|
||||
return submit([entryOf(item, "approve", item.recommended)], `Choice: ${item.recommended}`);
|
||||
}
|
||||
return submit([entryOf(item, "approve", "")], `${item.kind === "operator" ? "Run" : "Grant"}: ${short(item.title)}`);
|
||||
}
|
||||
|
||||
const rejectOne = (item) => submit([entryOf(item, "reject", "")], `Denial: ${short(item.title)}`);
|
||||
const chooseOne = (item, label) => submit([entryOf(item, "approve", label)], `Decision: ${label}`);
|
||||
const chooseOne = (item, label) => submit([entryOf(item, "approve", label)], `Choice: ${label}`);
|
||||
|
||||
function bulk(items, label) {
|
||||
const usable = items.filter(selectable);
|
||||
@@ -162,7 +162,7 @@
|
||||
item.kind === "rule" ? ruleRequestBody(item) : null,
|
||||
item.kind === "ask" ? h("div", {class: "muted"}, `in ${dash(item.directory)}`) : null,
|
||||
item.kind === "decision" ? h("div", {class: "options"}, item.options.map((option) => h("button", {
|
||||
type: "button", class: `option${option.label === item.recommended ? " recommended" : ""}`, disabled: item.held, on: {click: () => chooseOne(item, option.label)},
|
||||
type: "button", class: `option${option.label === item.recommended ? " recommended" : ""}`, title: `${option.label}: your passkey signs this answer, a post to ${item.agent}`, disabled: item.held, on: {click: () => chooseOne(item, option.label)},
|
||||
}, h("strong", {}, option.label), option.description ? h("span", {}, option.description) : null))) : null),
|
||||
h("div", {class: "item-actions"},
|
||||
actionsFor(item),
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
const main = document.getElementById("main");
|
||||
main.setAttribute("aria-labelledby", `tab-${ui.screen}`);
|
||||
main.replaceChildren(screenOf());
|
||||
document.body.classList.toggle("fit", ["agents", "artifacts"].includes(ui.screen) && !["tree", "hierarchy"].includes(ui.views[ui.screen]));
|
||||
document.body.classList.toggle("fit", ["tasks", "inbox"].includes(ui.screen) || (["agents", "artifacts"].includes(ui.screen) && !["tree", "hierarchy"].includes(ui.views[ui.screen])));
|
||||
drawn.screen = ui.screen;
|
||||
drawn.sig = sig;
|
||||
if (g3.host && !g3.host.isConnected) {
|
||||
@@ -81,6 +81,7 @@
|
||||
drawInbox();
|
||||
drawRadio();
|
||||
drawTasks();
|
||||
drawChoices();
|
||||
drawStatus();
|
||||
tick();
|
||||
placePopup();
|
||||
|
||||
@@ -162,6 +162,7 @@
|
||||
muted: [...absent, ...stations.filter((entry) => !entry.box.checked).map((entry) => entry.key)],
|
||||
},
|
||||
space: savedSpace(),
|
||||
estimation: settings.estimation,
|
||||
};
|
||||
if (await saveSettings(next)) {
|
||||
closeSheet();
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
const GANTT = {label: 240, right: 28, top: 34, lane: 30, width: 1180, bar: 16, ticks: 4};
|
||||
const BURN = {width: 900, height: 340, left: 52, right: 24, top: 20, bottom: 40};
|
||||
const EDGE_WORDS = {after: "Follows (rasci.py set --after)", base: "Branches from (base branch)", queue: "Waits behind (queue order)"};
|
||||
const SERIES_WORDS = {scope: "Scope (burnup)", done: "Done (burnup)", remaining: "Remaining (burndown)", unestimated: "Unestimated tasks"};
|
||||
const LINE_OFFICE = /^(?!work\/|cluster\/)[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*$/;
|
||||
const estimation = () => settings.estimation;
|
||||
const cut = (text, size) => (text.length > size ? `${text.slice(0, size - 1)}…` : text);
|
||||
const lineHolders = () => Object.fromEntries(state.claims.filter((claim) => LINE_OFFICE.test(claim.office) && claim.agent).map((claim) => [claim.office, claim.agent]));
|
||||
|
||||
function ganttDefs() {
|
||||
return s("defs", {},
|
||||
s("pattern", {id: "gantt-hatch", width: 8, height: 8, patternUnits: "userSpaceOnUse", patternTransform: "rotate(45)"},
|
||||
s("rect", {class: "hatch-ground", width: 8, height: 8}), s("line", {class: "hatch-line", x1: 0, y1: 0, x2: 0, y2: 8})),
|
||||
s("marker", {id: "gantt-tip", viewBox: "0 0 10 10", refX: 9, refY: 5, markerWidth: 8, markerHeight: 8, markerUnits: "userSpaceOnUse", orient: "auto-start-reverse"},
|
||||
s("path", {class: "gantt-tip", d: "M0,0 L10,5 L0,10 z"})));
|
||||
}
|
||||
|
||||
function ganttAxis(svg, x, begin, end, height) {
|
||||
for (let index = 0; index <= GANTT.ticks; index += 1) {
|
||||
const ts = begin + ((end - begin) * index) / GANTT.ticks;
|
||||
svg.append(s("line", {class: "grid", x1: fixed(x(ts)), x2: fixed(x(ts)), y1: GANTT.top - 6, y2: height - 4}));
|
||||
svg.append(s("text", {class: "axis", x: fixed(x(ts)), y: GANTT.top - 14, "text-anchor": index === 0 ? "start" : index === GANTT.ticks ? "end" : "middle"}, (end - begin > DAY ? absolute : clock).format(stampOf(ts))));
|
||||
}
|
||||
}
|
||||
|
||||
function ganttMark(row, bar, x, middle) {
|
||||
const tone = Object.hasOwn(TASK_STATUS, row.status) ? TASK_STATUS[row.status][1] : "neutral";
|
||||
const classes = `${bar.dot ? "gantt-dot" : "gantt-bar"} tone-${tone}${bar.forecast ? " forecast" : ""}`;
|
||||
const attrs = {class: classes, "data-task": bar.task, "data-start": bar.start, "data-end": bar.end, "data-forecast": String(bar.forecast)};
|
||||
const words = s("title", {}, `${row.task}: ${bar.forecast ? "forecast " : ""}${absolute.format(stampOf(bar.start))} to ${absolute.format(stampOf(bar.end))}`);
|
||||
if (bar.dot) {
|
||||
return s("circle", {...attrs, cx: fixed(x(bar.start)), cy: fixed(middle), r: 5}, words);
|
||||
}
|
||||
return s("rect", {...attrs, x: fixed(x(bar.start)), y: fixed(middle - GANTT.bar / 2), width: fixed(Math.max(x(bar.end) - x(bar.start), 2)), height: GANTT.bar, rx: 3}, words);
|
||||
}
|
||||
|
||||
function ganttChart(rows) {
|
||||
const now = state.now;
|
||||
const drawnBars = Plan.bars(rows, state.task_edges, {now, estimation: estimation(), forecast: taskView.forecast});
|
||||
if (!drawnBars.length) {
|
||||
return emptyState("No bar", "No shown task has started, and real only draws no forecast.");
|
||||
}
|
||||
const lanes = new Map(drawnBars.map((bar, index) => [bar.task, index]));
|
||||
const bars = new Map(drawnBars.map((bar) => [bar.task, bar]));
|
||||
const begin = Math.min(now, ...drawnBars.map((bar) => bar.start));
|
||||
const end = Math.max(now, ...drawnBars.map((bar) => bar.end));
|
||||
const span = Math.max(end - begin, 3600);
|
||||
const height = GANTT.top + drawnBars.length * GANTT.lane + 10;
|
||||
const x = (ts) => GANTT.label + ((ts - begin) / span) * (GANTT.width - GANTT.label - GANTT.right);
|
||||
const middle = (task) => GANTT.top + lanes.get(task) * GANTT.lane + GANTT.lane / 2;
|
||||
const svg = s("svg", {class: "chart gantt", width: GANTT.width, height, viewBox: `0 0 ${GANTT.width} ${height}`, role: "img", "aria-label": "Gantt: one bar per task from start to end, hatched bars are forecasts, arrows lead from a task to the one that follows it"}, ganttDefs());
|
||||
ganttAxis(svg, x, begin, begin + span, height);
|
||||
const byTask = new Map(rows.map((row) => [row.task, row]));
|
||||
drawnBars.forEach((bar, index) => {
|
||||
const row = byTask.get(bar.task);
|
||||
const top = GANTT.top + index * GANTT.lane;
|
||||
svg.append(s("rect", {class: index % 2 ? "lane odd" : "lane", x: 0, y: top, width: GANTT.width, height: GANTT.lane}));
|
||||
svg.append(s("text", {class: "lane-label", x: 8, y: top + GANTT.lane / 2, dy: "0.35em", "data-task": row.task, on: {click: () => taskSheet(row.task)}}, s("title", {}, `${row.task}: ${titleOf(row)}`), cut(row.task, 30)));
|
||||
svg.append(ganttMark(row, bar, x, middle(bar.task)));
|
||||
});
|
||||
svg.append(s("line", {class: "now", x1: fixed(x(now)), x2: fixed(x(now)), y1: GANTT.top - 6, y2: height - 4}));
|
||||
const arrows = s("g", {class: "gantt-edges"});
|
||||
for (const edge of state.task_edges) {
|
||||
const from = bars.get(edge.from);
|
||||
const to = bars.get(edge.to);
|
||||
if (!from || !to) {
|
||||
continue;
|
||||
}
|
||||
const [x1, y1, x2, y2] = [x(from.end), middle(edge.from), x(to.start), middle(edge.to)];
|
||||
arrows.append(s("path", {class: `gantt-edge k-${edge.kind}`, "data-kind": edge.kind, "data-from": edge.from, "data-to": edge.to, d: `M${fixed(x1)},${fixed(y1)} C${fixed(x1 + 28)},${fixed(y1)} ${fixed(x2 - 28)},${fixed(y2)} ${fixed(x2)},${fixed(y2)}`, "marker-end": "url(#gantt-tip)"},
|
||||
s("title", {}, `${edge.to}: ${EDGE_WORDS[edge.kind] || edge.kind} ${edge.from}`)));
|
||||
}
|
||||
svg.append(arrows);
|
||||
const legend = h("div", {class: "legend"}, h("span", {class: "gantt-key forecast"}, "Forecast (hatched)"), Object.entries(EDGE_WORDS).map(([kind, words]) => h("span", {class: `gantt-key k-${kind}`}, words)));
|
||||
return h("div", {class: "gantt-box"}, h("div", {class: "gantt-scroll"}, svg), legend);
|
||||
}
|
||||
|
||||
function burnAxis(svg, from, to, top) {
|
||||
const x = (t) => BURN.left + ((t - from) / Math.max(to - from, 1)) * (BURN.width - BURN.left - BURN.right);
|
||||
const y = (value) => BURN.top + (1 - value / top) * (BURN.height - BURN.top - BURN.bottom);
|
||||
for (const value of [0, top / 2, top]) {
|
||||
svg.append(s("line", {class: "grid", x1: BURN.left, x2: BURN.width - BURN.right, y1: fixed(y(value)), y2: fixed(y(value))}));
|
||||
svg.append(s("text", {class: "axis", x: BURN.left - 8, y: fixed(y(value)), dy: "0.35em", "text-anchor": "end"}, String(Math.round(value * 10) / 10)));
|
||||
}
|
||||
for (const [index, t] of [from, (from + to) / 2, to].entries()) {
|
||||
svg.append(s("text", {class: "axis", x: fixed(x(t)), y: BURN.height - 14, "text-anchor": ["start", "middle", "end"][index]}, (to - from > DAY ? absolute : clock).format(stampOf(t))));
|
||||
}
|
||||
return {x, y};
|
||||
}
|
||||
|
||||
function burnChart(rows, shown) {
|
||||
const picked = Plan.scoped(rows, taskView.scope, {filtered: shown, since: state.since, until: state.until, now: state.now, holders: lineHolders()});
|
||||
const series = Plan.burn(picked.rows, {estimation: estimation(), from: picked.from, to: picked.to}).points;
|
||||
const names = estimation() === "points" ? Plan.SERIES : Plan.SERIES.filter((name) => name !== "unestimated");
|
||||
const top = Math.max(1, ...series.flatMap((point) => names.map((name) => point[name])));
|
||||
const unit = estimation() === "points" ? "story points; unestimated tasks as a line of their own" : "tasks";
|
||||
const svg = s("svg", {class: "chart burn", viewBox: `0 0 ${BURN.width} ${BURN.height}`, role: "img", "aria-label": `Burndown and burnup in ${unit}`});
|
||||
const {x, y} = burnAxis(svg, picked.from, picked.to, top);
|
||||
const last = series[series.length - 1];
|
||||
for (const name of names) {
|
||||
const d = series.map((point, index) => (index ? `H${fixed(x(point.t))} V${fixed(y(point[name]))}` : `M${fixed(x(point.t))},${fixed(y(point[name]))}`)).join(" ");
|
||||
svg.append(s("path", {class: `burn-line k-${name}`, "data-series": name, "data-last": String(last[name]), d}, s("title", {}, `${SERIES_WORDS[name]}: ${last[name]}`)));
|
||||
}
|
||||
const legend = h("div", {class: "legend"}, names.map((name) => h("span", {class: `burn-key k-${name}`, "data-series": name}, `${SERIES_WORDS[name]}: ${last[name]}`)));
|
||||
return h("div", {class: "burn-box"}, svg, legend, h("p", {class: "muted"}, `${picked.rows.length} tasks in scope, counted in ${unit}`));
|
||||
}
|
||||
|
||||
async function chooseEstimation(id) {
|
||||
if (id === estimation()) {
|
||||
return;
|
||||
}
|
||||
if (await saveSettings({...settings, estimation: id})) {
|
||||
toast(`Estimation: ${Plan.ESTIMATIONS.find(([name]) => name === id)[1]}`, [], true);
|
||||
}
|
||||
drawTasks();
|
||||
}
|
||||
|
||||
async function requestEstimates() {
|
||||
const signed = await signedProof("/api/board/sign", {action: "estimates"}, "Request estimates");
|
||||
if (signed) {
|
||||
await act("estimates", "Request estimates", {proof: signed.proof});
|
||||
}
|
||||
}
|
||||
|
||||
function sortControls() {
|
||||
const select = h("select", {class: "field", "aria-label": "Sort", on: {change: (event) => {
|
||||
taskView.sort = event.target.value;
|
||||
drawTasks();
|
||||
}}}, Plan.SORTS.map(([id, label]) => h("option", {value: id, selected: id === taskView.sort}, label)));
|
||||
const turn = (button) => relabel(button, taskView.descending ? "bi-sort-up" : "bi-sort-down", taskView.descending ? "Descending" : "Ascending", `${taskView.descending ? "Descending" : "Ascending"}: click to reverse`);
|
||||
const direction = h("button", {type: "button", class: "btn small icon-only", "data-direction": "", on: {click: (event) => {
|
||||
taskView.descending = !taskView.descending;
|
||||
turn(event.currentTarget);
|
||||
drawTasks();
|
||||
}}});
|
||||
turn(direction);
|
||||
return h("div", {class: "plan-group", role: "group", "aria-label": "Sort order"}, select, direction);
|
||||
}
|
||||
|
||||
function bulkControls() {
|
||||
const value = fibonacciPicker("Business value of the selection", 8);
|
||||
const count = counter(0);
|
||||
const button = h("button", {type: "button", class: "btn small primary", id: "bulk-value", disabled: true, ...named("Set business value", "Set the business value of every selected task as Operator, signed once with the passkey"), on: {click: () => bulkValue(Number(value.value))}},
|
||||
icon("bi-gem"), "Set business value", count);
|
||||
taskView.bulk = {button, count};
|
||||
return h("div", {class: "plan-group", role: "group", "aria-label": "Business value of the selection"}, value, button);
|
||||
}
|
||||
|
||||
function forecastControl() {
|
||||
return h("label", {class: "plan-group"}, "Forecast", h("select", {class: "field", "aria-label": "Forecast", on: {change: (event) => {
|
||||
taskView.forecast = event.target.value;
|
||||
drawTasks();
|
||||
}}}, Plan.FORECASTS.map(([id, label]) => h("option", {value: id, selected: id === taskView.forecast}, label))));
|
||||
}
|
||||
|
||||
function scopeChoices() {
|
||||
const agents = [...new Set(state.tasks.filter((row) => row.kind !== "queue").flatMap((row) => [row.worker, ...Object.keys(row.roles)]).filter((name) => name && name !== "-"))].sort((a, b) => a.localeCompare(b, "en"));
|
||||
return [["all", "Whole register"], ["filter", "List filter in the time window"], ...agents.map((name) => [`agent:${name}`, `Agent: ${name}`]), ...Object.entries(lineHolders()).map(([office, holder]) => [`line:${office}`, `Line: ${office} (${holder})`])];
|
||||
}
|
||||
|
||||
function scopeControl() {
|
||||
const choices = scopeChoices();
|
||||
if (!choices.some(([id]) => id === taskView.scope)) {
|
||||
taskView.scope = "all";
|
||||
}
|
||||
return h("label", {class: "plan-group"}, "Scope", h("select", {class: "field", "aria-label": "Scope", on: {change: (event) => {
|
||||
taskView.scope = event.target.value;
|
||||
drawTasks();
|
||||
}}}, choices.map(([id, label]) => h("option", {value: id, selected: id === taskView.scope}, label))));
|
||||
}
|
||||
|
||||
function planBar(view) {
|
||||
const modes = h("div", {class: "segmented", role: "group", "aria-label": "Estimation"}, Plan.ESTIMATIONS.map(([id, label]) => h("button", {type: "button", "data-estimation": id, "aria-pressed": String(estimation() === id), title: `${label}: ${id === "points" ? "the Fibonacci complexity of rasci.py estimate" : "every task counts 1"}`, on: {click: () => chooseEstimation(id)}}, label)));
|
||||
const request = h("button", {type: "button", class: "btn small", id: "request-estimates", hidden: estimation() !== "points", ...named("Request estimates", "Request estimates: one newsletter asks every agent with a RASCI role in an unestimated task for business value and complexity"), on: {click: requestEstimates}}, icon("bi-send-check"), "Request estimates");
|
||||
const own = {list: () => [sortControls(), bulkControls()], gantt: forecastControl, burn: scopeControl}[view];
|
||||
taskView.plan = {modes, request};
|
||||
return h("div", {class: "card controls plan-bar", role: "toolbar", "aria-label": "Plan"}, modes, request, own ? own() : null);
|
||||
}
|
||||
|
||||
function syncPlan() {
|
||||
const plan = taskView.plan;
|
||||
if (!plan) {
|
||||
return;
|
||||
}
|
||||
for (const button of plan.modes.querySelectorAll("button")) {
|
||||
button.setAttribute("aria-pressed", String(button.dataset.estimation === estimation()));
|
||||
}
|
||||
plan.request.hidden = estimation() !== "points";
|
||||
if (taskView.bulk) {
|
||||
const picked = state.tasks.filter((row) => row.editable && taskView.picked.has(row.task)).length;
|
||||
taskView.bulk.count.textContent = String(picked);
|
||||
taskView.bulk.button.disabled = picked === 0;
|
||||
}
|
||||
}
|
||||
|
||||
function pickTask(task, on) {
|
||||
if (on) {
|
||||
taskView.picked.add(task);
|
||||
} else {
|
||||
taskView.picked.delete(task);
|
||||
}
|
||||
syncPlan();
|
||||
}
|
||||
|
||||
async function bulkValue(value) {
|
||||
const rows = state.tasks.filter((row) => row.editable && taskView.picked.has(row.task));
|
||||
if (!rows.length) {
|
||||
return;
|
||||
}
|
||||
const changes = rows.map((row) => ({task: row.task, argv: ["estimate", row.task, ESTIMATOR, "--value", String(value)]}));
|
||||
if (await changeTasks(changes, `Business value ${value} for ${rows.length} tasks`, null)) {
|
||||
taskView.picked.clear();
|
||||
taskView.sig = "";
|
||||
drawTasks();
|
||||
}
|
||||
}
|
||||
@@ -8,23 +8,29 @@
|
||||
return h("select", {class: "field", "aria-label": label}, FIBONACCI.map((value) => h("option", {value, selected: value === picked}, String(value))));
|
||||
}
|
||||
|
||||
async function changeTask(row, argv, label, outcome) {
|
||||
const items = [{kind: "task", id: row.task, argv}];
|
||||
outcome.replaceChildren(h("p", {class: "muted"}, "Signing with the passkey …"));
|
||||
async function changeTasks(changes, label, outcome) {
|
||||
const items = changes.map(({task, argv}) => ({kind: "task", id: task, argv}));
|
||||
const tell = (attrs, text) => (outcome ? outcome.replaceChildren(h("p", {class: "muted", ...attrs}, text)) : null);
|
||||
tell({}, "Signing with the passkey …");
|
||||
const signed = await proofFor(items, label);
|
||||
if (signed === null) {
|
||||
outcome.replaceChildren(h("p", {class: "muted"}, "Not signed: nothing was handed over."));
|
||||
return;
|
||||
tell({}, "Not signed: nothing was handed over.");
|
||||
return false;
|
||||
}
|
||||
const result = await sendJson("/api/tasks", {items, proof: signed.proof});
|
||||
if (!result.ok || !result.data) {
|
||||
toast(`${label}: not possible`, fail(result), false);
|
||||
outcome.replaceChildren(h("p", {class: "muted"}, `${result.status} ${result.text}`.trim()));
|
||||
return;
|
||||
tell({}, `${result.status} ${result.text}`.trim());
|
||||
return false;
|
||||
}
|
||||
outcome.replaceChildren(h("p", {class: "muted", "data-jobs": result.data.jobs.join(" ")}, `Signed and handed to the runner (job ${result.data.jobs.join(", ")}); it calls rasci.py on the host.`));
|
||||
toast(`${label}: handed to the runner`, [shownArgv(argv)], true);
|
||||
tell({"data-jobs": result.data.jobs.join(" ")}, `Signed and handed to the runner (job ${result.data.jobs.join(", ")}); it calls rasci.py on the host.`);
|
||||
toast(`${label}: handed to the runner`, changes.map(({argv}) => shownArgv(argv)), true);
|
||||
await load();
|
||||
return true;
|
||||
}
|
||||
|
||||
function changeTask(row, argv, label, outcome) {
|
||||
return changeTasks([{task: row.task, argv}], label, outcome);
|
||||
}
|
||||
|
||||
function priorityForm(row) {
|
||||
@@ -32,23 +38,29 @@
|
||||
const own = row.estimates[ESTIMATOR] || null;
|
||||
const prio = h("input", {type: "number", class: "field", min: 1, max: PRIO_MAX, step: 1, value: row.prio === null ? "" : row.prio, "aria-label": "Priority", placeholder: "1"});
|
||||
const value = fibonacciPicker("Business value", own ? own.value : 5);
|
||||
const complexity = fibonacciPicker("Complexity", own ? own.complexity : 3);
|
||||
const complexity = fibonacciPicker("Complexity", own && own.complexity ? own.complexity : 3);
|
||||
const alone = fibonacciPicker("Business value as Operator", own ? own.value : 8);
|
||||
const pinCode = h("code", {});
|
||||
const estimateCode = h("code", {});
|
||||
const valueCode = h("code", {});
|
||||
const prioArgv = () => ["set", row.task, "--prio", prioText(prio.value)];
|
||||
const estimateArgv = () => ["estimate", row.task, ESTIMATOR, "--value", value.value, "--complexity", complexity.value];
|
||||
const valueArgv = () => ["estimate", row.task, ESTIMATOR, "--value", alone.value];
|
||||
const pin = h("button", {type: "button", class: "btn small primary", ...named("Pin", "Pin: sign the priority with the passkey")}, icon("bi-pin-angle-fill"), "Pin");
|
||||
const estimate = h("button", {type: "button", class: "btn small primary", ...named("Save estimate", "Hand the estimate to the runner, signed")}, icon("bi-calculator"), "Save estimate");
|
||||
const setValue = h("button", {type: "button", class: "btn small primary", ...named("Set business value", "Set the business value as Operator, signed with the passkey; WSJF uses it instead of the median")}, icon("bi-gem"), "Set business value");
|
||||
const sync = () => {
|
||||
pin.disabled = !prioText(prio.value);
|
||||
pinCode.textContent = pin.disabled ? `Enter a priority from 1 to ${PRIO_MAX}` : shownArgv(prioArgv());
|
||||
estimateCode.textContent = shownArgv(estimateArgv());
|
||||
valueCode.textContent = shownArgv(valueArgv());
|
||||
};
|
||||
for (const field of [prio, value, complexity]) {
|
||||
for (const field of [prio, value, complexity, alone]) {
|
||||
field.addEventListener("input", sync);
|
||||
}
|
||||
pin.addEventListener("click", () => changeTask(row, prioArgv(), `Priority ${row.task}`, outcome));
|
||||
estimate.addEventListener("click", () => changeTask(row, estimateArgv(), `WSJF ${row.task}`, outcome));
|
||||
setValue.addEventListener("click", () => changeTask(row, valueArgv(), `Business value ${row.task}`, outcome));
|
||||
const drop = own ? h("button", {type: "button", class: "btn small danger", ...named("Discard estimate", "Discard estimate: delete your estimate, signed with the passkey"), on: {click: () => changeTask(row, ["estimate", row.task, ESTIMATOR, "--drop"], `WSJF ${row.task}`, outcome)}}, icon("bi-x-circle"), "Discard estimate") : null;
|
||||
sync();
|
||||
return h("section", {class: "task-edit", "aria-label": "Priority and WSJF"},
|
||||
@@ -58,6 +70,10 @@
|
||||
h("h3", {}, `Estimate WSJF as ${ESTIMATOR}`),
|
||||
h("div", {class: "task-form"}, h("label", {}, "Business value", value), h("label", {}, "Complexity", complexity), estimate, drop),
|
||||
h("div", {class: "command"}, estimateCode),
|
||||
h("h3", {}, `Business value as ${ESTIMATOR}`),
|
||||
h("div", {class: "task-form"}, h("label", {}, "Business value", alone), setValue),
|
||||
h("div", {class: "command"}, valueCode),
|
||||
h("p", {class: "muted"}, "WSJF uses your business value instead of the median of the agents' values."),
|
||||
h("p", {class: "muted"}, "Your passkey signs exactly this call; the runner on the host checks the signature and the shape of the arguments and starts rasci.py without a shell. The agent priority stays untouched."),
|
||||
onLocalhost() ? null : h("p", {class: "muted"}, "Signing works only under ", localLink()),
|
||||
outcome);
|
||||
@@ -73,8 +89,8 @@
|
||||
const entries = Object.entries(row.estimates);
|
||||
const score = row.wsjf;
|
||||
return [h("h3", {}, "WSJF estimates", counter(entries.length)),
|
||||
entries.length ? h("ul", {class: "mini"}, entries.map(([party, entry]) => h("li", {}, h("div", {class: "row"}, h("strong", {}, party), h("span", {class: "muted"}, `Business value ${entry.value} · complexity ${entry.complexity}`))))) : h("p", {class: "muted"}, "No estimate yet: the task ranks after the estimated ones."),
|
||||
score ? h("p", {class: "muted"}, `Median ${score.value} / ${score.complexity} = WSJF ${score.score}`) : null];
|
||||
entries.length ? h("ul", {class: "mini"}, entries.map(([party, entry]) => h("li", {}, h("div", {class: "row"}, h("strong", {}, party), h("span", {class: "muted"}, `Business value ${entry.value} · complexity ${dash(entry.complexity)}`))))) : h("p", {class: "muted"}, "No estimate yet: the task ranks after the estimated ones."),
|
||||
score ? h("p", {class: "muted"}, `${Object.hasOwn(row.estimates, ESTIMATOR) ? `${ESTIMATOR}'s business value` : "Median business value"} ${score.value} / median complexity ${score.complexity} = WSJF ${score.score}`) : null];
|
||||
}
|
||||
|
||||
function taskJobs(row) {
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
["all", "All", "bi-list-check", () => true],
|
||||
["open", "Open", "bi-play-circle", (row) => !row.ended],
|
||||
["work", "Open work", "bi-pencil-square", (row) => row.open_work.length > 0],
|
||||
["operator", "Waiting for operator", "bi-person-raised-hand", null],
|
||||
["operator", "Waits on Operator", "bi-person-raised-hand", null],
|
||||
["grant", "Waiting for a grant", "bi-hourglass-split", (row) => row.kind === "queue" && row.status === "awaiting"],
|
||||
["ended", "Ended", "bi-check2-circle", (row) => row.ended],
|
||||
];
|
||||
const ROLE_TONES = {R: "ok", A: "violet", S: "info", C: "warn", I: "neutral"};
|
||||
const ROLE_WORDS = {R: "Responsible", A: "Accountable", S: "Supportive", C: "Consulted", I: "Informed"};
|
||||
const MATRIX_PARTIES = 40;
|
||||
const taskView = {filter: "all", q: "", dom: null, sig: ""};
|
||||
const taskView = {filter: "all", q: "", dom: null, sig: "", sort: "prio", descending: false, forecast: "always", scope: "all", picked: new Set(), plan: null, bulk: null};
|
||||
|
||||
const columnOf = (row) => (TASK_COLUMNS.some(([id]) => id === row.status) ? row.status : "queued");
|
||||
const branchOf = (row) => row.worktree_branch || (row.branch !== "-" ? row.branch : "");
|
||||
@@ -56,8 +56,9 @@
|
||||
|
||||
function taskItem(row) {
|
||||
const classes = ["task-row", row.open_work.length ? "open-work" : "", row.ended ? "ended" : ""].filter(Boolean).join(" ");
|
||||
const pick = row.editable ? h("input", {type: "checkbox", class: "task-pick", "aria-label": `Select ${row.task}`, title: `Select ${row.task} for a bulk business value`, checked: taskView.picked.has(row.task), on: {change: (event) => pickTask(row.task, event.target.checked)}}) : null;
|
||||
return h("li", {class: classes, "data-task": row.task, "data-kind": row.kind, "data-status": row.status},
|
||||
h("div", {class: "head-row"}, h("code", {class: "task-id"}, row.task), taskBadges(row, true), h("span", {class: "spacer"}),
|
||||
h("div", {class: "head-row"}, pick, h("code", {class: "task-id"}, row.task), taskBadges(row, true), h("span", {class: "spacer"}),
|
||||
row.editable ? iconBtn("bi-sort-numeric-down", "Priority", "btn small soft", () => taskSheet(row.task), `Priority and WSJF of ${row.task}: pin or estimate, signed with the passkey`) : null),
|
||||
opener(row),
|
||||
row.objective !== "-" ? h("div", {class: "muted"}, `Objective: ${row.objective}`) : null,
|
||||
@@ -148,7 +149,9 @@
|
||||
const body = inbox ? inboxScreen() : h("div", {class: "tasks-body"});
|
||||
taskView.dom = {chips, count, body, inbox, view};
|
||||
taskView.sig = "";
|
||||
return h("div", {class: "graph tasks"}, h("div", {class: "card controls"}, taskViewSwitch(inbox), search, count), chips, body);
|
||||
taskView.plan = null;
|
||||
taskView.bulk = null;
|
||||
return h("div", {class: "graph tasks"}, h("div", {class: "card controls"}, taskViewSwitch(inbox), search, count), inbox ? null : planBar(view), choiceBar(), chips, body);
|
||||
}
|
||||
|
||||
function drawTasks() {
|
||||
@@ -157,12 +160,19 @@
|
||||
return;
|
||||
}
|
||||
const q = taskView.q.trim().toLowerCase();
|
||||
const sig = JSON.stringify([state.tasks, state.jobs, taskView.filter, q, waitingCount(), Math.floor(nowSeconds() / 60)]);
|
||||
const sig = JSON.stringify([state.tasks, state.jobs, state.task_edges, settings.estimation, taskView.filter, taskView.sort, taskView.descending, taskView.forecast, taskView.scope, q, waitingCount(), Math.floor(nowSeconds() / 60)]);
|
||||
if (sig === taskView.sig) {
|
||||
return;
|
||||
}
|
||||
taskView.sig = sig;
|
||||
const rows = state.tasks;
|
||||
const editable = new Set(rows.filter((row) => row.editable).map((row) => row.task));
|
||||
for (const task of [...taskView.picked]) {
|
||||
if (!editable.has(task)) {
|
||||
taskView.picked.delete(task);
|
||||
}
|
||||
}
|
||||
syncPlan();
|
||||
dom.chips.replaceChildren(...taskChips(rows, dom.inbox));
|
||||
if (dom.inbox) {
|
||||
dom.count.textContent = `${rows.length} tasks in the register`;
|
||||
@@ -172,6 +182,12 @@
|
||||
const hit = (row) => !q || [row.task, row.title, row.worker, row.branch, row.workdir, row.objective].some((text) => String(text).toLowerCase().includes(q));
|
||||
const shown = rows.filter(test).filter(hit);
|
||||
dom.count.textContent = `${shown.length} of ${rows.length} tasks`;
|
||||
const views = {list: (found) => h("ol", {class: "task-list"}, found.map(taskItem)), board: taskBoard, rasci: taskMatrix};
|
||||
dom.body.replaceChildren(shown.length ? views[dom.view](shown) : emptyState("No task", "No entry matches this filter."));
|
||||
const views = {
|
||||
list: (found) => h("ol", {class: "task-list"}, Plan.sortRows(found, taskView.sort, taskView.descending).map(taskItem)),
|
||||
board: taskBoard,
|
||||
rasci: taskMatrix,
|
||||
gantt: ganttChart,
|
||||
burn: (found) => burnChart(rows, found),
|
||||
};
|
||||
dom.body.replaceChildren(shown.length || dom.view === "burn" ? views[dom.view](shown) : emptyState("No task", "No entry matches this filter."));
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
const Plan = (() => {
|
||||
"use strict";
|
||||
const FORECASTS = [["always", "always"], ["points", "points only"], ["real", "real only"]];
|
||||
const ESTIMATIONS = [["none", "No estimate"], ["points", "Story points"]];
|
||||
const SORTS = [["prio", "Prio"], ["wsjf", "WSJF"], ["value", "Business value"], ["complexity", "Complexity"], ["status", "Status"], ["start", "Start"], ["end", "End"], ["agent", "Agent"], ["title", "Title"]];
|
||||
const STATUS_ORDER = ["queued", "awaiting", "claimed", "running", "blocked", "stale", "done", "stopped"];
|
||||
const SERIES = ["scope", "done", "remaining", "unestimated"];
|
||||
const OUTSIDE = ["queue", "command"];
|
||||
|
||||
function median(values) {
|
||||
const sorted = values.filter((value) => Number.isFinite(value)).sort((a, b) => a - b);
|
||||
if (!sorted.length) {
|
||||
return null;
|
||||
}
|
||||
const middle = Math.floor(sorted.length / 2);
|
||||
return sorted.length % 2 ? sorted[middle] : (sorted[middle - 1] + sorted[middle]) / 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rows - task rows with status, start, end (epoch seconds or null) and points (median complexity or null).
|
||||
* @returns {duration, perPoint}: the median seconds a done task took from start to end, and the median seconds
|
||||
* per point of the done tasks with points; null where no done task gives one.
|
||||
*/
|
||||
function medians(rows) {
|
||||
const done = rows.filter((row) => row.status === "done" && row.start !== null && row.end !== null && row.end >= row.start);
|
||||
return {
|
||||
duration: median(done.map((row) => row.end - row.start)),
|
||||
perPoint: median(done.filter((row) => row.points).map((row) => (row.end - row.start) / row.points)),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param row - a task row not yet started.
|
||||
* @param estimation - "none" or "points".
|
||||
* @param forecast - "always" or "points" (points only).
|
||||
* @param known - medians() of the rows.
|
||||
* @returns the forecast length in seconds: points times the median seconds per point when story points apply,
|
||||
* else under always the median duration of done tasks; 0 (a dot) where neither applies.
|
||||
*/
|
||||
function forecastLength(row, estimation, forecast, known) {
|
||||
if (estimation === "points" && row.points && known.perPoint !== null) {
|
||||
return row.points * known.perPoint;
|
||||
}
|
||||
return forecast === "always" && known.duration !== null ? known.duration : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rows - task rows in their shown order.
|
||||
* @param edges - {from, to, kind} edges; only those between the rows count.
|
||||
* @param options - {now, estimation, forecast}.
|
||||
* @returns one {task, start, end, forecast, dot} per drawn row: a started task from start to its end, an open one
|
||||
* to now; a task not yet started, unless forecast is "real", as a forecast behind the latest end of its
|
||||
* predecessors and now, forecastLength() long, a dot when 0. A task never started is left out under "real", an
|
||||
* ended one without start and end always.
|
||||
*/
|
||||
function bars(rows, edges, options) {
|
||||
const known = medians(rows);
|
||||
const byTask = new Map(rows.map((row) => [row.task, row]));
|
||||
const before = new Map(rows.map((row) => [row.task, []]));
|
||||
for (const edge of edges) {
|
||||
if (byTask.has(edge.from) && before.has(edge.to) && edge.from !== edge.to) {
|
||||
before.get(edge.to).push(edge.from);
|
||||
}
|
||||
}
|
||||
const placed = new Map();
|
||||
const visiting = new Set();
|
||||
const place = (row) => {
|
||||
if (placed.has(row.task)) {
|
||||
return placed.get(row.task);
|
||||
}
|
||||
if (visiting.has(row.task)) {
|
||||
return null;
|
||||
}
|
||||
visiting.add(row.task);
|
||||
let bar = null;
|
||||
if (row.start !== null) {
|
||||
const end = row.end !== null ? row.end : row.ended ? row.start : Math.max(options.now, row.start);
|
||||
bar = {task: row.task, start: row.start, end, forecast: false, dot: end <= row.start};
|
||||
} else if (row.end !== null) {
|
||||
bar = {task: row.task, start: row.end, end: row.end, forecast: false, dot: true};
|
||||
} else if (!row.ended && options.forecast !== "real") {
|
||||
const ahead = before.get(row.task).map((task) => place(byTask.get(task))).filter(Boolean);
|
||||
const start = Math.max(options.now, ...ahead.map((found) => found.end));
|
||||
const length = forecastLength(row, options.estimation, options.forecast, known);
|
||||
bar = {task: row.task, start, end: start + length, forecast: true, dot: length <= 0};
|
||||
}
|
||||
visiting.delete(row.task);
|
||||
placed.set(row.task, bar);
|
||||
return bar;
|
||||
};
|
||||
return rows.map(place).filter(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rows - task rows.
|
||||
* @param choice - "all" (the whole register over the whole time), "filter" (the filtered rows within the header
|
||||
* window), "agent:<name>" (the tasks the agent works on or holds a RASCI role in) or "line:<office>" (those of
|
||||
* the office's holder, over the whole time).
|
||||
* @param context - {filtered, since, until, now, holders: {office: holder}}.
|
||||
* @returns {rows, from, to}: the scope's rows without queue jobs and commands and its time range.
|
||||
*/
|
||||
function scoped(rows, choice, context) {
|
||||
const own = (name) => (row) => row.worker === name || Object.hasOwn(row.roles, name);
|
||||
const [kind, ...rest] = String(choice).split(":");
|
||||
const key = rest.join(":");
|
||||
const chosen = kind === "filter" ? context.filtered : kind === "agent" ? rows.filter(own(key)) : kind === "line" ? rows.filter(own(context.holders[key])) : rows;
|
||||
const kept = chosen.filter((row) => !OUTSIDE.includes(row.kind));
|
||||
if (kind === "filter") {
|
||||
return {rows: kept, from: context.since, to: context.until};
|
||||
}
|
||||
const first = Math.min(...kept.flatMap((row) => [row.start, row.end]).filter((value) => value !== null));
|
||||
return {rows: kept, from: Number.isFinite(first) ? Math.min(first, context.now) : context.now - 86400, to: context.now};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rows - the scope's task rows.
|
||||
* @param options - {estimation, from, to}.
|
||||
* @returns {points: [{t, scope, done, remaining, unestimated}]}, a step series at from, at every start or end
|
||||
* inside the range and at to. A task joins the scope at its start (or end), from the range start when it has
|
||||
* neither; a done task burns at its end and a stopped one leaves the scope then. With no estimate each task
|
||||
* weighs 1; with story points it weighs its points and unestimated counts the open tasks without points.
|
||||
*/
|
||||
function burn(rows, options) {
|
||||
const points = options.estimation === "points";
|
||||
const weigh = (row) => (points ? row.points || 0 : 1);
|
||||
const joined = (row) => (row.start !== null ? row.start : row.end !== null ? row.end : options.from);
|
||||
const moments = rows.flatMap((row) => [row.start, row.end]).filter((value) => value !== null && value > options.from && value < options.to);
|
||||
const times = [...new Set([options.from, ...moments, options.to])].sort((a, b) => a - b);
|
||||
const at = (t) => {
|
||||
const present = rows.filter((row) => joined(row) <= t && !(row.status === "stopped" && row.end !== null && row.end <= t));
|
||||
const burnt = present.filter((row) => row.status === "done" && row.end !== null && row.end <= t);
|
||||
const scope = present.reduce((sum, row) => sum + weigh(row), 0);
|
||||
const done = burnt.reduce((sum, row) => sum + weigh(row), 0);
|
||||
const open = present.filter((row) => !burnt.includes(row));
|
||||
return {t, scope, done, remaining: scope - done, unestimated: points ? open.filter((row) => !row.points).length : 0};
|
||||
};
|
||||
return {points: times.map(at)};
|
||||
}
|
||||
|
||||
const KEYS = {
|
||||
prio: () => null,
|
||||
wsjf: (row) => (row.wsjf ? row.wsjf.score : null),
|
||||
value: (row) => row.value,
|
||||
complexity: (row) => row.points,
|
||||
status: (row) => (STATUS_ORDER.includes(row.status) ? STATUS_ORDER.indexOf(row.status) : STATUS_ORDER.length),
|
||||
start: (row) => row.start,
|
||||
end: (row) => row.end,
|
||||
agent: (row) => (row.worker && row.worker !== "-" ? row.worker.toLowerCase() : null),
|
||||
title: (row) => (row.title && row.title !== "-" ? row.title : row.task).toLowerCase(),
|
||||
};
|
||||
|
||||
/**
|
||||
* @param rows - task rows in the hub's register rank.
|
||||
* @param mode - one of SORTS; prio keeps the register rank.
|
||||
* @param descending - reverses the order of the keys.
|
||||
* @returns a new array: rows without a key last in both directions, ties in register rank.
|
||||
*/
|
||||
function sortRows(rows, mode, descending) {
|
||||
const key = KEYS[mode] || KEYS.prio;
|
||||
const sign = descending ? -1 : 1;
|
||||
const keyed = rows.map((row, index) => ({row, index, key: mode === "prio" ? index : key(row)}));
|
||||
keyed.sort((a, b) => {
|
||||
if ((a.key === null) !== (b.key === null)) {
|
||||
return a.key === null ? 1 : -1;
|
||||
}
|
||||
const order = a.key === null ? 0 : typeof a.key === "string" ? a.key.localeCompare(b.key, "en") : a.key - b.key;
|
||||
return sign * order || a.index - b.index;
|
||||
});
|
||||
return keyed.map((entry) => entry.row);
|
||||
}
|
||||
|
||||
return {FORECASTS, ESTIMATIONS, SORTS, SERIES, STATUS_ORDER, median, medians, forecastLength, bars, scoped, burn, sortRows};
|
||||
})();
|
||||
if (typeof module === "object" && module.exports) {
|
||||
module.exports = Plan;
|
||||
}
|
||||
@@ -2,6 +2,9 @@
|
||||
.tasks-body { min-width: 0; }
|
||||
.tasks .controls input[type="search"] { flex: 1; min-width: min(240px, 100%); }
|
||||
.tasks > .chips { margin-bottom: 0; }
|
||||
body.fit .graph.tasks > .tasks-body, body.fit .graph.tasks > .inbox { flex: 1; min-height: 0; overflow: auto; }
|
||||
.choice-request { gap: var(--sp-2) var(--sp-3); }
|
||||
.choice-agents { display: grid; gap: 6px; max-height: 40vh; overflow: auto; }
|
||||
.chip .count { margin-left: 2px; }
|
||||
.task-list, .task-cards { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
|
||||
.task-row { display: grid; gap: 6px; min-width: 0; padding: var(--sp-3); border: 1px solid var(--line); border-radius: 12px; background: var(--glass-card); }
|
||||
@@ -40,5 +43,37 @@ table.matrix th[scope="row"] { z-index: 1; min-width: min(240px, 52vw); max-widt
|
||||
.task-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
|
||||
.task-form label { display: grid; gap: 4px; color: var(--muted); font-size: var(--fs-sm); }
|
||||
.task-form input[type="number"] { width: 120px; }
|
||||
.plan-bar { gap: var(--sp-2) var(--sp-3); }
|
||||
.plan-bar [hidden] { display: none; }
|
||||
.plan-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-sm); }
|
||||
.plan-group select.field { width: auto; min-width: 0; max-width: min(260px, 100%); }
|
||||
.task-pick { margin: 0; accent-color: var(--accent); }
|
||||
.gantt-box, .burn-box { display: grid; gap: 8px; min-width: 0; }
|
||||
.gantt-scroll { max-width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--glass-card); }
|
||||
.gantt-scroll svg.gantt { display: block; max-width: none; }
|
||||
svg .gantt-bar, svg .gantt-dot { fill: color-mix(in srgb, var(--c, var(--accent)) 70%, var(--panel)); stroke: var(--c, var(--accent)); stroke-width: 1; }
|
||||
svg .gantt-bar.forecast, svg .gantt-dot.forecast { fill: url(#gantt-hatch); stroke-dasharray: 3 2; }
|
||||
svg .tone-ok { --c: var(--ok); }
|
||||
svg .tone-bad { --c: var(--bad); }
|
||||
svg .tone-info { --c: var(--info); }
|
||||
svg .tone-warn { --c: var(--warn); }
|
||||
svg .tone-neutral { --c: var(--muted); }
|
||||
svg .hatch-ground { fill: var(--accent-soft); }
|
||||
svg .hatch-line { stroke: var(--accent); stroke-width: 3; }
|
||||
svg .gantt-edge { fill: none; stroke: var(--c); stroke-width: 1.6; opacity: .8; }
|
||||
svg .gantt-edge.k-after, .gantt-key.k-after { --c: var(--violet); }
|
||||
svg .gantt-edge.k-base, .gantt-key.k-base { --c: var(--info); }
|
||||
svg .gantt-edge.k-queue, .gantt-key.k-queue { --c: var(--warn); }
|
||||
svg .gantt-tip { fill: var(--muted); }
|
||||
.gantt-key, .burn-key { display: inline-flex; align-items: center; gap: 6px; }
|
||||
.gantt-key::before, .burn-key::before { content: ""; width: 18px; height: 4px; border-radius: 2px; background: var(--c, var(--accent)); }
|
||||
.gantt-key.forecast::before { height: 10px; background: repeating-linear-gradient(45deg, var(--accent) 0 3px, var(--accent-soft) 3px 6px); }
|
||||
svg.burn { width: 100%; height: auto; max-height: 60vh; }
|
||||
svg .burn-line { fill: none; stroke: var(--c); stroke-width: 2.4; }
|
||||
svg .burn-line.k-scope, .burn-key.k-scope { --c: var(--info); }
|
||||
svg .burn-line.k-done, .burn-key.k-done { --c: var(--ok); }
|
||||
svg .burn-line.k-remaining, .burn-key.k-remaining { --c: var(--accent); }
|
||||
svg .burn-line.k-unestimated, .burn-key.k-unestimated { --c: var(--warn); }
|
||||
svg .burn-line.k-unestimated { stroke-dasharray: 6 4; }
|
||||
svg .node.a-worktree.open circle { stroke: var(--warn); stroke-width: 2.6; stroke-dasharray: 3 2; }
|
||||
svg .edge.flow { stroke-dasharray: 2 5; }
|
||||
Reference in new issue
Block a user