feat(orchestrator): S5.1 radio spot, compact menus, trend, ETA and Tasks 3D
🧪 Test / 🧪 Lock + lint (push) Canceled after 0s
🧪 Test / 🧪 Lock + lint (push) Canceled after 0s
Requirement 001 decisions 52 to 58 (operator 2026-11-09): - Radio spot: the Agents toolbar radio button expands inline with the one composer (every channel, post and call recipients, Record, Send), a gear with the radio settings (tones, squelch, read aloud, moved out of the general settings) and Cancel mayday, which leaves the toolbar; the Radio tab keeps speakers, stations and the log plus a jump to the spot. - Day/Night menu: the badge and Drain, Suspend and Resume only; each explanation is the button's tooltip. - Tasks toolbar: views, filter, estimation, sort and business value in one wrapping row with a Request choices dropdown; the status chips stay the second row. - Burndown and burnup: a trend selector (off, linear regression, velocity over N days) stored in the hub settings, the trend lines and the forecast date on the chart, and a tooltip per point with the work packages that started, ended or joined there. - ETA: every list row shows its ETA (end when done, else start or now plus the forecast length behind its predecessors), sharing one predecessor walk with the Gantt. - Tasks 3D: a sixth view on the 3D engine with the dependency edges in the Gantt colours, layouts Force and Time. - Steady 3D camera: the view fits once per graph build, refreshes keep the operator's camera. - e2e: Firefox runs with its profile as cwd, so its crashreporter no longer drops core dumps into the repository. - A forecast beyond the last second a Date can hold is no forecast, so a nearly flat regression no longer aborts the Tasks render. Evidence: make test Ran 717 OK, ruff clean, markdownlint 0 errors; e2e 30 of 30 OK in Chromium and Firefox at 1920, 1366 and 390 px; MEDUSA 0 findings after one skeptic-accepted lexical EXA006. 🎯 Fix: 93 % 💥 Break: 4 % 💸 Cost: 100 % ⏱️ Time: – 🛡️ Security: 100 % 🏆 Score: 89 🚦 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
e94f2800d5
commit
57ab29eb0d
25 files changed
+1390
-215
No files matched your search
@@ -15,6 +15,8 @@ from .records import read_json, write_atomic
|
||||
|
||||
THEMES = ("sky", "light", "dark", "custom")
|
||||
ESTIMATIONS = ("none", "points")
|
||||
TRENDS = ("off", "regression", "velocity")
|
||||
TREND_DAYS = (1, 365)
|
||||
TONES = ("mayday", "review", "direct", "radio")
|
||||
COLOR = re.compile(r"#[0-9a-f]{6}")
|
||||
CLOCK = re.compile(r"(?:[01][0-9]|2[0-3]):[0-5][0-9]")
|
||||
@@ -46,6 +48,7 @@ SETTINGS = {
|
||||
"sky": {"azimuth": 180.0, "altitude": 0.0, "fov": 180.0},
|
||||
},
|
||||
"estimation": "none",
|
||||
"trend": {"mode": "off", "days": 7},
|
||||
}
|
||||
SPACE_AXES = ("none", "time", "spawn")
|
||||
SPACE_LIMITS = {
|
||||
@@ -182,6 +185,16 @@ def space_setting(raw: object) -> dict:
|
||||
return {"graph": {"axis": graph["axis"], **numbers["graph"]}, "sky": numbers["sky"]}
|
||||
|
||||
|
||||
def trend_setting(raw: object) -> dict:
|
||||
entry = section(raw, "trend", tuple(SETTINGS["trend"]))
|
||||
low, high = TREND_DAYS
|
||||
if not isinstance(entry["mode"], str) or entry["mode"] not in TRENDS:
|
||||
raise ToolError(f"trend.mode must be one of {', '.join(TRENDS)}")
|
||||
if isinstance(entry["days"], bool) or not isinstance(entry["days"], int) or not low <= entry["days"] <= high:
|
||||
raise ToolError(f"trend.days must be a whole number from {low} to {high}")
|
||||
return {"mode": entry["mode"], "days": entry["days"]}
|
||||
|
||||
|
||||
def valid_settings(raw: object) -> dict:
|
||||
data = section(raw, "settings", tuple(SETTINGS))
|
||||
colors = section(data["colors"], "colors", tuple(SETTINGS["colors"]))
|
||||
@@ -206,6 +219,7 @@ def valid_settings(raw: object) -> dict:
|
||||
"speech": speech_setting(data["speech"]),
|
||||
"space": space_setting(data["space"]),
|
||||
"estimation": data["estimation"],
|
||||
"trend": trend_setting(data["trend"]),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -68,7 +68,6 @@ h1 { margin: 0; font-size: var(--fs-lg); font-weight: 680; letter-spacing: -.01e
|
||||
.menu > summary::-webkit-details-marker { display: none; }
|
||||
.menu-box { position: absolute; top: calc(100% + 6px); z-index: 25; display: grid; gap: var(--sp-3); width: max-content; max-width: min(640px, calc(100vw - 32px)); padding: var(--sp-3) var(--sp-4); background: var(--glass-card); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-lift); }
|
||||
.menu-box.end { right: 0; }
|
||||
.menu-box textarea { min-width: min(460px, calc(100vw - 64px)); }
|
||||
.menu-box h3 { margin: 0; color: var(--muted); font-size: var(--fs-xs); font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
|
||||
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
|
||||
.classes { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); }
|
||||
|
||||
@@ -3,7 +3,7 @@ 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"], ["gantt", "Gantt"], ["burn", "Burndown and burnup"]];
|
||||
const TASK_VIEWS = [["list", "List"], ["board", "Board"], ["rasci", "RASCI"], ["gantt", "Gantt"], ["burn", "Burndown and burnup"], ["3d", "3D"]];
|
||||
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",
|
||||
|
||||
@@ -11,8 +11,10 @@
|
||||
return result.ok && result.data && result.data.ok;
|
||||
}
|
||||
|
||||
const actionOf = (action) => ACTIONS.find(([id]) => id === action);
|
||||
|
||||
async function confirmAct(action) {
|
||||
const [, label, question] = ACTIONS.find(([id]) => id === action);
|
||||
const [, label, question] = actionOf(action);
|
||||
if (!window.confirm(question)) {
|
||||
return;
|
||||
}
|
||||
@@ -29,52 +31,75 @@
|
||||
|
||||
const picked = (group) => group.querySelector("input:checked").value;
|
||||
|
||||
function toAll() {
|
||||
const text = h("textarea", {"aria-label": "Radio to all", placeholder: "Message to all agents …", on: {input: (event) => {
|
||||
ui.draft = event.target.value;
|
||||
}}});
|
||||
text.value = ui.draft;
|
||||
const classes = choice("to-all", TO_ALL, "newsletter");
|
||||
const send = async () => {
|
||||
const cls = picked(classes);
|
||||
if (!ui.draft.trim() || (cls === "mayday" && !confirmMayday())) {
|
||||
return;
|
||||
}
|
||||
if (await radioSend({to: "*", text: ui.draft, upload: "", cls, voice: ""})) {
|
||||
ui.draft = "";
|
||||
text.value = "";
|
||||
}
|
||||
};
|
||||
return h("details", {class: "menu", id: "to-all"}, h("summary", named("Radio to all"), icon("bi-broadcast-pin"), caret()), h("div", {class: "menu-box"},
|
||||
text, classes, h("p", {class: "muted"}, "Newsletter arrives as post at the end of the turn; Broadcast, Pan-Pan, Security and Mayday at once. Your passkey signs every message."),
|
||||
h("div", {class: "actions"}, h("span", {class: "spacer"}), iconBtn("bi-send", "Send", "btn soft", send, "Send to all"))));
|
||||
function actionButton(action, cls, name) {
|
||||
const [, label, , hint] = actionOf(action);
|
||||
return h("button", {type: "button", class: cls, ...named(label, hint), on: {click: () => confirmAct(action)}}, name ? icon(name) : null, label);
|
||||
}
|
||||
|
||||
function openToAll() {
|
||||
function openSpot(spot, open) {
|
||||
ui.spot = open;
|
||||
spot.panel.hidden = !open;
|
||||
spot.toggle.setAttribute("aria-expanded", String(open));
|
||||
window.requestAnimationFrame(refresh3d);
|
||||
if (open) {
|
||||
spot.text.focus();
|
||||
}
|
||||
}
|
||||
|
||||
function toggleGear(spot) {
|
||||
const open = spot.gearBox.hidden;
|
||||
spot.gearBox.replaceChildren(...(open ? [radioSettings(() => toggleGear(spot))] : []));
|
||||
spot.gearBox.hidden = !open;
|
||||
spot.gear.setAttribute("aria-expanded", String(open));
|
||||
window.requestAnimationFrame(refresh3d);
|
||||
}
|
||||
|
||||
function radioSpot() {
|
||||
const {form, recipient, text} = composerForm();
|
||||
const gearBox = h("div", {class: "radio-gear", id: "radio-gear", hidden: true});
|
||||
const gear = h("button", {type: "button", class: "btn small ghost icon-only spot-toggle", "aria-expanded": "false", "aria-controls": "radio-gear", ...named("Radio settings", "Radio settings: tones, squelch and read aloud")}, icon("bi-gear"));
|
||||
const clear = actionButton("clear-mayday", "btn small danger", "bi-life-preserver");
|
||||
const panel = h("section", {class: "card radio-spot", id: "radio-spot", "aria-label": "Radio", hidden: !ui.spot},
|
||||
h("div", {class: "spot-head"}, h("h3", {class: "group-title"}, "Radio"), h("span", {class: "spacer"}), gear, clear), h("div", {class: "spot-body"}, form, gearBox));
|
||||
const toggle = h("button", {type: "button", class: "btn small spot-toggle", "aria-expanded": String(ui.spot), "aria-controls": "radio-spot", ...named("Radio", "Radio: post, call or a message to all, with Record and the radio settings")}, icon("bi-broadcast-pin"), caret());
|
||||
const spot = {panel, toggle, gear, gearBox, text};
|
||||
toggle.addEventListener("click", () => openSpot(spot, !ui.spot));
|
||||
gear.addEventListener("click", () => toggleGear(spot));
|
||||
return {toggle, panel, clear, recipient};
|
||||
}
|
||||
|
||||
function openRadio() {
|
||||
ui.spot = true;
|
||||
go("agents", null);
|
||||
window.setTimeout(() => {
|
||||
const menu = document.getElementById("to-all");
|
||||
if (menu) {
|
||||
menu.open = true;
|
||||
menu.querySelector("textarea").focus();
|
||||
const field = document.querySelector("#radio-spot textarea");
|
||||
if (field) {
|
||||
field.focus();
|
||||
}
|
||||
}, 50);
|
||||
}
|
||||
|
||||
function agentsToolbar() {
|
||||
const clear = iconBtn("bi-life-preserver", "Cancel mayday", "btn small danger", () => confirmAct("clear-mayday"));
|
||||
const spot = radioSpot();
|
||||
const mode = h("span", {});
|
||||
const night = h("details", {class: "menu"}, h("summary", named("Day/Night"), icon("bi-moon-stars"), caret()), h("div", {class: "menu-box"}, mode,
|
||||
h("p", {class: "muted"}, "Drain: agents finish their task and take nothing new. Suspend: they park their work and idle. Resume: all continue from the handover. Your passkey signs each."),
|
||||
h("div", {class: "actions"}, ACTIONS.slice(1).map(([id, label]) => btn(label, "btn small", () => confirmAct(id))))));
|
||||
return {bar: h("div", {class: "toolbar", role: "toolbar", "aria-label": "Controls"}, toAll(), clear, iconBtn("bi-sort-down", "Priority", "btn small", openAgentOrder, "Priority: agent order in the hierarchy"), night), clear, mode};
|
||||
h("div", {class: "actions"}, ACTIONS.slice(1).map(([id]) => actionButton(id, "btn small")))));
|
||||
const bar = h("div", {class: "toolbar", role: "toolbar", "aria-label": "Controls"}, spot.toggle, iconBtn("bi-sort-down", "Priority", "btn small", openAgentOrder, "Priority: agent order in the hierarchy"), night);
|
||||
return {bar, spot: spot.panel, clear: spot.clear, recipient: spot.recipient, mode, names: ""};
|
||||
}
|
||||
|
||||
function drawToolbar() {
|
||||
if (!graphDom || !graphDom.toolbar) {
|
||||
const toolbar = graphDom && graphDom.toolbar;
|
||||
if (!toolbar) {
|
||||
return;
|
||||
}
|
||||
const [mode, tone] = NIGHT[state.night] || [state.night, "neutral"];
|
||||
graphDom.toolbar.clear.disabled = !state.silence;
|
||||
graphDom.toolbar.mode.replaceChildren(pill(mode, tone));
|
||||
toolbar.clear.disabled = !state.silence;
|
||||
toolbar.mode.replaceChildren(pill(mode, tone));
|
||||
const names = agentNames();
|
||||
if (JSON.stringify(names) !== toolbar.names) {
|
||||
toolbar.names = JSON.stringify(names);
|
||||
const chosen = toolbar.recipient.value;
|
||||
toolbar.recipient.replaceChildren(...names.map((name) => h("option", {value: name, selected: name === chosen}, name)));
|
||||
}
|
||||
}
|
||||
@@ -21,18 +21,19 @@
|
||||
await load();
|
||||
}
|
||||
|
||||
function choiceBar() {
|
||||
function choiceMenu() {
|
||||
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));
|
||||
return h("details", {class: "menu choice-request", id: "choice-request"},
|
||||
h("summary", named("Request choices", "Request choices: every open decision comes back as a choice, signed with your passkey"), icon("bi-ui-checks"), "Request choices", caret()),
|
||||
h("div", {class: "menu-box end", role: "group", "aria-label": "Choice requests"},
|
||||
h("h3", {}, "Post or call to", count), picks, h("div", {class: "choice-buttons"}, direct),
|
||||
h("h3", {}, "To all"), h("div", {class: "choice-buttons"}, TO_ALL.map(button))));
|
||||
}
|
||||
|
||||
function syncChoices() {
|
||||
|
||||
@@ -136,7 +136,10 @@
|
||||
const channel = h("select", {class: "field"}, CHANNELS.map(([id, label]) => h("option", {value: id}, label)));
|
||||
const recipient = h("select", {class: "field"});
|
||||
const toField = h("label", {}, "To", recipient);
|
||||
const text = h("textarea", {"aria-label": "Message", placeholder: "Message to the agents …", maxlength: 20000});
|
||||
const text = h("textarea", {"aria-label": "Message", placeholder: "Message to the agents …", maxlength: 20000, on: {input: (event) => {
|
||||
ui.draft = event.target.value;
|
||||
}}});
|
||||
text.value = ui.draft;
|
||||
const replay = h("div", {class: "voice-note", hidden: true});
|
||||
const hint = h("p", {class: "muted"});
|
||||
const status = h("span", {class: "muted composer-status", "aria-live": "polite"});
|
||||
@@ -173,11 +176,12 @@
|
||||
submit.disabled = true;
|
||||
if (await radioSend({to: direct ? recipient.value : "*", text: text.value, upload: "", cls: channel.value, voice: attach.checked ? composer.voice : ""})) {
|
||||
text.value = "";
|
||||
ui.draft = "";
|
||||
status.textContent = "";
|
||||
attachVoice(parts, "");
|
||||
}
|
||||
submit.disabled = false;
|
||||
});
|
||||
attachVoice(parts, composer.voice);
|
||||
return {form, recipient};
|
||||
return {form, recipient, text};
|
||||
}
|
||||
@@ -10,7 +10,12 @@
|
||||
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: "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 ACTIONS = [
|
||||
["clear-mayday", "Cancel mayday", "Lift the radio silence of the active mayday?", "Cancel mayday: lift the radio silence so the agents write again; your passkey signs it"],
|
||||
["drain", "Drain", "Drain all agents: finish the current task, accept nothing new (kvb-agent-drain)?", "Drain: the agents finish their task and take nothing new; your passkey signs it"],
|
||||
["suspend", "Suspend", "Suspend all agents: park work, write the handover, idle (kvb-agent-suspend)?", "Suspend: the agents park their work, write the handover and idle; your passkey signs it"],
|
||||
["resume", "Resume", "Resume all agents from their handover (kvb-agent-resume)?", "Resume: all agents continue from their handover; your passkey signs it"],
|
||||
];
|
||||
const UPLOAD_LIMIT = 50 * 1024 * 1024;
|
||||
const STREAM_KEEP = 5000;
|
||||
const CLASSES = {post: "Post", call: "Call", newsletter: "Newsletter", broadcast: "Broadcast", mayday: "Mayday", "pan-pan": "Pan-Pan", security: "Sécurité", receipt: "Read", grant: "Grant"};
|
||||
|
||||
@@ -185,5 +185,5 @@
|
||||
const toolbar = agentsToolbar();
|
||||
graphDom = {stage: stageBox, pulses: null, toolbar};
|
||||
const body = view === "tree" ? spawnScreen() : view === "hierarchy" ? hierarchyScreen() : h("div", {class: "card stage-card"}, stageBox, view === "3d" ? null : legend());
|
||||
return h("div", {class: "graph"}, toolbar.bar, h("div", {class: "card controls"}, viewSwitch("agents"), view === "3d" ? layoutTools("agents") : null), body);
|
||||
return h("div", {class: "graph"}, toolbar.bar, toolbar.spot, h("div", {class: "card controls"}, viewSwitch("agents"), view === "3d" ? layoutTools("agents") : null), body);
|
||||
}
|
||||
@@ -4,13 +4,29 @@
|
||||
["spawn", "Spawn depth", "bi-layers", "Depth = spawn depth: each level one generation"],
|
||||
];
|
||||
const KIND_COLORS = {operator: "accent", chair: "accent", session: "info", subagent: "violet", twig: "violet", repo: "warn", branch: "info", worktree: "teal", agent: "accent", artefact: "violet", task: "muted"};
|
||||
const LINK_COLORS = {spawn: "violet", contains: "line-strong", merge: "grant", overlap: "alarm", direct: "direct", broadcast: "broadcast", alarm: "alarm", security: "security", grant: "grant"};
|
||||
const LINK_COLORS = {spawn: "violet", contains: "line-strong", merge: "grant", overlap: "alarm", direct: "direct", broadcast: "broadcast", alarm: "alarm", security: "security", grant: "grant", after: "violet", base: "info", queue: "warn"};
|
||||
const TONE_ROLES = {ok: "ok", bad: "bad", info: "info", warn: "warn", neutral: "muted"};
|
||||
const DEPENDENCIES = new Set(["after", "base", "queue"]);
|
||||
const SPAWNED = new Set(["twig", "subagent"]);
|
||||
const DEPTH_GAP = 90;
|
||||
const TIME_DEPTH = 640;
|
||||
const g3 = {lib: null, three: null, graph: null, host: null, tab: "", sig: "", planes: [], colors: null, failed: "", picked: null};
|
||||
const g3 = {lib: null, three: null, graph: null, host: null, tab: "", sig: "", planes: [], colors: null, failed: "", picked: null, fit: false};
|
||||
|
||||
const layoutOf = () => space.views.graph.axis;
|
||||
const layoutsOf = (tab) => (tab === "tasks" ? LAYOUTS.filter(([id]) => id !== "spawn") : LAYOUTS);
|
||||
const layoutOf = (tab) => (layoutsOf(tab).some(([id]) => id === space.views.graph.axis) ? space.views.graph.axis : "none");
|
||||
|
||||
function fit3d(ms) {
|
||||
if (g3.graph) {
|
||||
g3.graph.zoomToFit(ms, 40);
|
||||
}
|
||||
}
|
||||
|
||||
function builtFit() {
|
||||
if (g3.fit) {
|
||||
g3.fit = false;
|
||||
fit3d(calm.matches ? 0 : 400);
|
||||
}
|
||||
}
|
||||
|
||||
function loadScript(src) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -39,11 +55,11 @@
|
||||
}
|
||||
|
||||
function layoutTools(tab) {
|
||||
const group = h("div", {class: "segmented", role: "group", "aria-label": "Layout"}, LAYOUTS.map(([id, label, name, hint]) => h("button", {
|
||||
type: "button", class: "icon-only", "data-layout": id, ...named(label, `${label}: ${hint}`), "aria-pressed": String(layoutOf() === id), on: {click: () => chooseLayout(tab, id, group)},
|
||||
const group = h("div", {class: "segmented", role: "group", "aria-label": "Layout"}, layoutsOf(tab).map(([id, label, name, hint]) => h("button", {
|
||||
type: "button", class: "icon-only", "data-layout": id, ...named(label, `${label}: ${tab === "tasks" && id === "time" ? "depth = start: earlier lies behind, later in front, forecasts behind their predecessors" : hint}`), "aria-pressed": String(layoutOf(tab) === id), on: {click: () => chooseLayout(tab, id, group)},
|
||||
}, icon(name))));
|
||||
return h("div", {class: "space-tools"}, group,
|
||||
iconBtn("bi-arrow-counterclockwise", "Reset view", "btn small ghost", () => g3.graph && g3.graph.zoomToFit(calm.matches ? 0 : 600, 40)),
|
||||
iconBtn("bi-arrow-counterclockwise", "Reset view", "btn small ghost", () => fit3d(calm.matches ? 0 : 600)),
|
||||
h("span", {class: "muted"}, "Drag turns · right drag pans · wheel zooms · click opens the popup"),
|
||||
nodeSearch(() => model3d(tab).nodes, (node) => pick3d(tab, node)));
|
||||
}
|
||||
@@ -52,9 +68,10 @@
|
||||
for (const button of group.querySelectorAll("button")) {
|
||||
button.setAttribute("aria-pressed", String(button.dataset.layout === id));
|
||||
}
|
||||
if (id !== layoutOf()) {
|
||||
if (id !== layoutOf(tab)) {
|
||||
setView("graph", {...space.views.graph, axis: id}, false);
|
||||
g3.sig = "";
|
||||
g3.fit = true;
|
||||
if (ui.screen === tab) {
|
||||
stage3d(tab, g3.host);
|
||||
}
|
||||
@@ -87,6 +104,9 @@
|
||||
if (tab === "agents") {
|
||||
return agentModel();
|
||||
}
|
||||
if (tab === "tasks") {
|
||||
return taskModel3d();
|
||||
}
|
||||
const built = tree.model || {nodes: [], links: []};
|
||||
return {nodes: built.nodes.map((node) => ({id: node.id, kind: node.kind, label: node.label, depth: node.depth, ts: node.ts, parent: node.parent})), links: built.links.map((link) => ({...link}))};
|
||||
}
|
||||
@@ -109,7 +129,7 @@
|
||||
function colors3d() {
|
||||
const css = window.getComputedStyle(document.documentElement);
|
||||
const value = (name) => css.getPropertyValue(`--${name}`).trim() || "#888";
|
||||
const roles = new Set([...Object.values(KIND_COLORS), ...Object.values(LINK_COLORS), "text", "alarm"]);
|
||||
const roles = new Set([...Object.values(KIND_COLORS), ...Object.values(LINK_COLORS), ...Object.values(TONE_ROLES), "text", "alarm"]);
|
||||
g3.colors = Object.fromEntries([...roles].map((role) => [role, value(role)]));
|
||||
return g3.colors;
|
||||
}
|
||||
@@ -146,7 +166,7 @@
|
||||
focusSub(node.session, node.sub);
|
||||
return;
|
||||
}
|
||||
(tab === "artifacts" ? artSelect : select)(node.id, anchor3d(node.id), () => mark3d(null));
|
||||
({artifacts: artSelect, tasks: taskSelect}[tab] || select)(node.id, anchor3d(node.id), () => mark3d(null));
|
||||
mark3d(node.id);
|
||||
}
|
||||
|
||||
@@ -176,7 +196,7 @@
|
||||
}
|
||||
|
||||
function signature3d(tab, data) {
|
||||
return JSON.stringify([tab, layoutOf(), data.nodes.map((node) => [node.id, node.kind, node.depth, node.ts]), data.links.map((link) => [link.source, link.target, link.kind])]);
|
||||
return JSON.stringify([tab, layoutOf(tab), data.nodes.map((node) => [node.id, node.kind, node.depth, node.ts, node.tone]), data.links.map((link) => [link.source, link.target, link.kind])]);
|
||||
}
|
||||
|
||||
async function stage3d(tab, host) {
|
||||
@@ -195,7 +215,7 @@
|
||||
dispose3d();
|
||||
g3.host = host;
|
||||
g3.tab = tab;
|
||||
host.replaceChildren(h("div", {class: "graph3d", role: "img", "aria-label": `3D graph of the ${tab === "agents" ? "agents" : "artifacts"}; the search above finds every node`}), h("div", {class: "space-note"}, "Loading 3D …"));
|
||||
host.replaceChildren(h("div", {class: "graph3d", role: "img", "aria-label": `3D graph of the ${tab}; the search above finds every node`}), h("div", {class: "space-note"}, "Loading 3D …"));
|
||||
}
|
||||
g3.sig = sig;
|
||||
const box = host.querySelector(".graph3d");
|
||||
@@ -223,9 +243,11 @@
|
||||
const colors = colors3d();
|
||||
g3.graph.backgroundColor("rgba(0,0,0,0)").showNavInfo(false).nodeRelSize(5).nodeOpacity(0.92).linkOpacity(0.45)
|
||||
.nodeLabel((node) => h("span", {}, node.label)).nodeVal((node) => ({operator: 6, chair: 4, repo: 6, branch: 3, session: 2.5}[node.kind] || 1) * (node.id === g3.picked ? 4 : 1))
|
||||
.nodeColor((node) => (node.id === g3.picked ? g3.colors.alarm : g3.colors[KIND_COLORS[node.kind]] || colors.text)).linkColor((link) => g3.colors[LINK_COLORS[link.kind]] || colors.text)
|
||||
.nodeColor((node) => (node.id === g3.picked ? g3.colors.alarm : g3.colors[node.tone || KIND_COLORS[node.kind]] || colors.text)).linkColor((link) => g3.colors[LINK_COLORS[link.kind]] || colors.text)
|
||||
.linkWidth((link) => (link.kind === "contains" || link.kind === "spawn" ? 0.6 : Math.min(0.8 + Math.log2(1 + (link.count || 1)), 4)))
|
||||
.onNodeClick((node) => pick3d(g3.tab, node)).onEngineStop(() => g3.graph && g3.graph.zoomToFit(calm.matches ? 0 : 400, 40));
|
||||
.linkDirectionalArrowLength((link) => (DEPENDENCIES.has(link.kind) ? 5 : 0)).linkDirectionalArrowRelPos(1)
|
||||
.onNodeClick((node) => pick3d(g3.tab, node)).onEngineStop(builtFit);
|
||||
g3.fit = true;
|
||||
g3.graph.warmupTicks(calm.matches ? 160 : 80);
|
||||
if (calm.matches) {
|
||||
g3.graph.cooldownTicks(0);
|
||||
@@ -233,13 +255,13 @@
|
||||
g3.graph.cooldownTime(4000);
|
||||
}
|
||||
}
|
||||
const layout = layoutOf();
|
||||
const layout = layoutOf(tab);
|
||||
place(data.nodes, layout);
|
||||
g3.graph.width(box.clientWidth).height(box.clientHeight).graphData(data);
|
||||
drawPlanes(layout, data.nodes);
|
||||
const words = `${data.nodes.length} nodes · ${data.links.length} edges · ${LAYOUTS.find(([id]) => id === layout)[1]}${calm.matches ? " · without motion (prefers-reduced-motion)" : ""}`;
|
||||
host.replaceChildren(box, h("div", {class: "space-note"}, words));
|
||||
window.requestAnimationFrame(() => g3.graph && g3.host === host && g3.graph.zoomToFit(0, 40));
|
||||
window.requestAnimationFrame(() => g3.host === host && g3.fit && fit3d(0));
|
||||
}
|
||||
|
||||
function dispose3d() {
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
...Object.entries(state.views).map(([id, view]) => ({label: `Stream: ${view.label}`, hint: "Category", run: () => useView(id)})),
|
||||
...userViews.map((view) => ({label: `Stream: ${view.name}`, hint: "saved view", run: () => useSaved(view)})),
|
||||
...agentNames().map((name) => ({label: name, hint: "Agent", face: name, run: () => openAgent(name)})),
|
||||
{label: "Radio to all …", hint: "Newsletter, Broadcast, Pan-Pan, Security, Mayday", run: openToAll},
|
||||
{label: "Radio …", hint: "Post, Call, Newsletter, Broadcast, Pan-Pan, Security, Mayday; the gear holds tones and read aloud", run: openRadio},
|
||||
...ACTIONS.map(([id, label]) => ({label, hint: id === "clear-mayday" ? "Mayday" : "Day/Night", run: () => confirmAct(id)})),
|
||||
{label: "Priority …", hint: "agent order in the hierarchy", run: openAgentOrder},
|
||||
{label: "Firewall …", hint: "automatic grants", run: () => go("rules", null)},
|
||||
{label: "Settings …", hint: "Ambience, location, colors, music, tones, read radio aloud, internet radio", run: settingsSheet},
|
||||
{label: "Settings …", hint: "Ambience, location, colors, music, notifications, internet radio", run: settingsSheet},
|
||||
{label: settings.music.on ? "Music off" : "Music on", hint: "Ambience", run: toggleMusic},
|
||||
{label: space.look ? "Leave the sky" : "Look at the sky", hint: "h", run: () => skyLook(!space.look)},
|
||||
{label: "Toggle control room", hint: "Ambience", run: toggleLeitstand},
|
||||
|
||||
@@ -101,12 +101,6 @@
|
||||
radioDom.speakers.replaceChildren(...speakerChips());
|
||||
drawSpeaker();
|
||||
}
|
||||
const names = agentNames();
|
||||
if (JSON.stringify(names) !== radioDom.names) {
|
||||
radioDom.names = JSON.stringify(names);
|
||||
const chosen = radioDom.recipient.value;
|
||||
radioDom.recipient.replaceChildren(...names.map((name) => h("option", {value: name, selected: name === chosen}, name)));
|
||||
}
|
||||
const sent = JSON.stringify(state.messages.slice(-5));
|
||||
if (sent !== radioDom.sent) {
|
||||
radioDom.sent = sent;
|
||||
@@ -120,12 +114,12 @@
|
||||
const caption = h("div", {class: "radio-caption", role: "status", "aria-live": "polite", hidden: true});
|
||||
const stations = h("ul", {class: "stations", "aria-label": "Stations"});
|
||||
const outbox = h("div", {});
|
||||
const {form, recipient} = composerForm();
|
||||
radioDom = {speakers, caption, stations, outbox, recipient, crew: "", names: "", sent: "", stationsSig: ""};
|
||||
const send = h("button", {type: "button", class: "btn small soft", ...named("Send …", "Send: the radio spot under the Agents toolbar"), on: {click: openRadio}}, icon("bi-broadcast-pin"), "Send …");
|
||||
radioDom = {speakers, caption, stations, outbox, crew: "", sent: "", stationsSig: ""};
|
||||
return h("div", {class: "stack radio-view"},
|
||||
h("h2", {class: "title"}, "Radio"),
|
||||
h("div", {class: "radio-grid"},
|
||||
h("section", {class: "card radio-talk", "aria-label": "Radio"}, h("h3", {class: "group-title"}, "Radio"), caption, speakers, form),
|
||||
h("section", {class: "card radio-talk", "aria-label": "Radio"}, h("div", {class: "card-head"}, h("h3", {class: "group-title"}, "Radio"), send), caption, speakers),
|
||||
h("div", {class: "stack"},
|
||||
h("section", {class: "card", "aria-label": "Internet radio"},
|
||||
h("div", {class: "card-head"}, h("h3", {class: "group-title"}, "Internet radio"), btn("Edit stations", "btn small ghost", settingsSheet)),
|
||||
|
||||
@@ -85,6 +85,54 @@
|
||||
return section;
|
||||
}
|
||||
|
||||
function radioSettings(close) {
|
||||
const tones = SOUND_KINDS.map(([id, label]) => {
|
||||
const on = h("input", {type: "checkbox", checked: settings.sounds[id].on, "aria-label": `${label} on`});
|
||||
const level = h("input", {type: "range", min: 0, max: 1, step: 0.05, value: settings.sounds[id].volume, "aria-label": `${label} volume`});
|
||||
const loudest = () => Math.max(...tones.map((tone) => Number(tone.level.value)), settings.music.volume);
|
||||
return {id, on, level, row: h("div", {class: "sound-row"}, h("strong", {}, label), h("label", {class: "check"}, on, "on"), level, btn("Test", "btn small ghost", () => play(id, id === "mayday" ? loudest() : Number(level.value))))};
|
||||
});
|
||||
const squelch = h("input", {type: "range", min: 0, max: 1, step: 0.05, value: settings.squelch, "aria-label": "Squelch"});
|
||||
const speechOn = h("input", {type: "checkbox", checked: settings.speech.on, disabled: !state.speech.tts});
|
||||
const spoken = SPEECH_CLASSES.map(([id, label]) => ({id, label, box: h("input", {type: "checkbox", checked: id === "mayday" || settings.speech.classes.includes(id), disabled: id === "mayday", title: id === "mayday" ? "MAYDAY is always read aloud" : null})}));
|
||||
const stations = Object.entries(people()).sort(([, a], [, b]) => a.now.localeCompare(b.now))
|
||||
.map(([key, entry]) => ({key, label: entry.now, box: h("input", {type: "checkbox", checked: !settings.speech.muted.includes(key), "aria-label": `Read ${entry.now} aloud`})}));
|
||||
const absent = settings.speech.muted.filter((key) => !people()[key]);
|
||||
const sample = btn("Test", "btn small ghost", () => say({text: state.speech.sample, voice: state.speech.operator, tone: "direct", cls: "newsletter", who: HUMAN, line: "radio check"}));
|
||||
sample.disabled = !state.speech.tts;
|
||||
const form = h("form", {class: "settings radio-settings", "aria-label": "Radio settings"},
|
||||
h("section", {}, h("h3", {}, "Tones"), h("p", {class: "muted"}, "MAYDAY and PAN-PAN are always loudest. With several new events only the most urgent one plays."),
|
||||
tones.map((tone) => tone.row), h("label", {}, "Squelch: scales every tone, 0 plays none", squelch)),
|
||||
h("section", {}, h("h3", {}, "Read radio aloud"),
|
||||
h("p", {class: "muted"}, state.speech.tts
|
||||
? "New radio is read aloud in maritime radio style (SMCP), one message after another, each speaker with its own voice; music and internet radio go quieter meanwhile. The volume follows the tones above; MAYDAY is always spoken, and loudest."
|
||||
: `The radio stays silent: ${state.speech.tts_off}.`),
|
||||
h("div", {class: "days"}, h("label", {class: "check"}, speechOn, "Read radio aloud"), sample),
|
||||
h("div", {class: "days", role: "group", "aria-label": "Classes"}, spoken.map((entry) => h("label", {class: "check"}, entry.box, entry.label))),
|
||||
stations.length ? h("div", {class: "days", role: "group", "aria-label": "Speakers"}, stations.map((entry) => h("label", {class: "check"}, entry.box, entry.label))) : null),
|
||||
h("div", {class: "actions"}, h("span", {class: "spacer"}), btn("Cancel", "btn ghost", close), h("button", {type: "submit", class: "btn primary"}, "Save")));
|
||||
form.addEventListener("submit", async (event) => {
|
||||
event.preventDefault();
|
||||
context();
|
||||
const next = {
|
||||
...settings,
|
||||
space: savedSpace(),
|
||||
sounds: Object.fromEntries(tones.map((tone) => [tone.id, {on: tone.on.checked, volume: Number(tone.level.value)}])),
|
||||
squelch: Number(squelch.value),
|
||||
speech: {
|
||||
on: speechOn.checked,
|
||||
classes: spoken.filter((entry) => entry.box.checked).map((entry) => entry.id),
|
||||
muted: [...absent, ...stations.filter((entry) => !entry.box.checked).map((entry) => entry.key)],
|
||||
},
|
||||
};
|
||||
if (await saveSettings(next)) {
|
||||
close();
|
||||
toast("Radio settings saved", [], true);
|
||||
}
|
||||
});
|
||||
return form;
|
||||
}
|
||||
|
||||
function settingsSheet() {
|
||||
const number = (value, min, max, label) => h("input", {class: "field", type: "number", min, max, step: "any", value, required: true, "aria-label": label});
|
||||
const latitude = number(settings.latitude, -90, 90, "Latitude");
|
||||
@@ -105,21 +153,7 @@
|
||||
judge();
|
||||
const musicOn = h("input", {type: "checkbox", checked: settings.music.on});
|
||||
const volume = h("input", {type: "range", min: 0, max: 1, step: 0.05, value: settings.music.volume, "aria-label": "Overall volume"});
|
||||
const tones = SOUND_KINDS.map(([id, label]) => {
|
||||
const on = h("input", {type: "checkbox", checked: settings.sounds[id].on, "aria-label": `${label} on`});
|
||||
const level = h("input", {type: "range", min: 0, max: 1, step: 0.05, value: settings.sounds[id].volume, "aria-label": `${label} volume`});
|
||||
const loudest = () => Math.max(...tones.map((tone) => Number(tone.level.value)), Number(volume.value));
|
||||
return {id, on, level, row: h("div", {class: "sound-row"}, h("strong", {}, label), h("label", {class: "check"}, on, "on"), level, btn("Test", "btn small ghost", () => play(id, id === "mayday" ? loudest() : Number(level.value))))};
|
||||
});
|
||||
const squelch = h("input", {type: "range", min: 0, max: 1, step: 0.05, value: settings.squelch, "aria-label": "Squelch"});
|
||||
const notify = h("input", {type: "checkbox", checked: settings.notify});
|
||||
const speechOn = h("input", {type: "checkbox", checked: settings.speech.on, disabled: !state.speech.tts});
|
||||
const spoken = SPEECH_CLASSES.map(([id, label]) => ({id, label, box: h("input", {type: "checkbox", checked: id === "mayday" || settings.speech.classes.includes(id), disabled: id === "mayday", title: id === "mayday" ? "MAYDAY is always read aloud" : null})}));
|
||||
const stations = Object.entries(people()).sort(([, a], [, b]) => a.now.localeCompare(b.now))
|
||||
.map(([key, entry]) => ({key, label: entry.now, box: h("input", {type: "checkbox", checked: !settings.speech.muted.includes(key), "aria-label": `Read ${entry.now} aloud`})}));
|
||||
const absent = settings.speech.muted.filter((key) => !people()[key]);
|
||||
const sample = btn("Test", "btn small ghost", () => say({text: state.speech.sample, voice: state.speech.operator, tone: "direct", cls: "newsletter", who: HUMAN, line: "radio check"}));
|
||||
sample.disabled = !state.speech.tts;
|
||||
const list = h("div", {class: "mini"});
|
||||
const rows = [];
|
||||
settings.streams.forEach((stream) => streamRow(stream, rows, list));
|
||||
@@ -130,15 +164,8 @@
|
||||
h("section", {}, h("h3", {}, "Appearance"), h("label", {}, "Colors", theme), custom, verdict),
|
||||
h("section", {}, h("h3", {}, "Music"), h("p", {class: "muted"}, "Generative ambient music, made offline: calm with an empty inbox, a little tenser when something waits, quieter under messages."),
|
||||
h("div", {class: "grid"}, h("label", {class: "check"}, musicOn, "Music on"), h("label", {}, "Overall volume (music and radio)", volume))),
|
||||
h("section", {}, h("h3", {}, "Tones and notifications"), h("p", {class: "muted"}, "MAYDAY and PAN-PAN are always loudest. With several new events only the most urgent one plays."),
|
||||
tones.map((tone) => tone.row), h("label", {}, "Squelch: scales every tone, 0 plays none", squelch), h("label", {class: "check"}, notify, "Show desktop notifications when the browser allows them")),
|
||||
h("section", {}, h("h3", {}, "Read radio aloud"),
|
||||
h("p", {class: "muted"}, state.speech.tts
|
||||
? "New radio is read aloud in maritime radio style (SMCP), one message after another, each speaker with its own voice; music and internet radio go quieter meanwhile. The volume follows the tones above; MAYDAY is always spoken, and loudest."
|
||||
: `The radio stays silent: ${state.speech.tts_off}.`),
|
||||
h("div", {class: "days"}, h("label", {class: "check"}, speechOn, "Read radio aloud"), sample),
|
||||
h("div", {class: "days", role: "group", "aria-label": "Classes"}, spoken.map((entry) => h("label", {class: "check"}, entry.box, entry.label))),
|
||||
stations.length ? h("div", {class: "days", role: "group", "aria-label": "Speakers"}, stations.map((entry) => h("label", {class: "check"}, entry.box, entry.label))) : null),
|
||||
h("section", {}, h("h3", {}, "Notifications"), h("p", {class: "muted"}, "Tones, squelch and reading radio aloud sit behind the gear of the radio spot in the Agents toolbar."),
|
||||
h("label", {class: "check"}, notify, "Show desktop notifications when the browser allows them")),
|
||||
h("section", {}, h("h3", {}, "Internet radio"), h("p", {class: "muted"}, "Internet radio at fixed times with a 3 s fade in and out; the music pauses meanwhile. A new station plays around the clock until you change its times; under Stream → Radio you start and stop it by hand. The page may load sound only from these addresses; your passkey signs a new address. If a signed station redirects, the server resolves the redirect when you save a new station or a changed address and releases its target; the note after saving names it."),
|
||||
list, h("div", {}, btn("+ Station", "btn small soft", () => streamRow({name: "", url: "", from: "00:00", to: "24:00", days: [0, 1, 2, 3, 4, 5, 6], on: true, via: []}, rows, list)))),
|
||||
passkeySection(),
|
||||
@@ -152,17 +179,14 @@
|
||||
theme: theme.value,
|
||||
colors: Object.fromEntries(COLOR_FIELDS.map(([id]) => [id, colors[id].value])),
|
||||
music: {on: musicOn.checked, volume: Number(volume.value)},
|
||||
sounds: Object.fromEntries(tones.map((tone) => [tone.id, {on: tone.on.checked, volume: Number(tone.level.value)}])),
|
||||
squelch: Number(squelch.value),
|
||||
sounds: settings.sounds,
|
||||
squelch: settings.squelch,
|
||||
notify: notify.checked,
|
||||
streams: rows.map((entry) => entry.read()),
|
||||
speech: {
|
||||
on: speechOn.checked,
|
||||
classes: spoken.filter((entry) => entry.box.checked).map((entry) => entry.id),
|
||||
muted: [...absent, ...stations.filter((entry) => !entry.box.checked).map((entry) => entry.key)],
|
||||
},
|
||||
speech: settings.speech,
|
||||
space: savedSpace(),
|
||||
estimation: settings.estimation,
|
||||
trend: settings.trend,
|
||||
};
|
||||
if (await saveSettings(next)) {
|
||||
closeSheet();
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
let state = JSON.parse(document.getElementById("state").textContent);
|
||||
const KINDS = Object.entries(state.kinds);
|
||||
const ui = {screen: "stream", views: {agents: "orbit", artifacts: "tree", tasks: "list"}, preset: DAY, from: null, to: null, asOf: null, playing: false, busy: false, offline: false, agent: null, order: null, draft: "", cursor: 0, selected: new Set(), snoozed: false, review: null, file: 0};
|
||||
const ui = {screen: "stream", views: {agents: "orbit", artifacts: "tree", tasks: "list"}, preset: DAY, from: null, to: null, asOf: null, playing: false, busy: false, offline: false, agent: null, order: null, draft: "", spot: false, cursor: 0, selected: new Set(), snoozed: false, review: null, file: 0};
|
||||
const filter = {view: "fuer-dich", saved: "", kinds: new Set(state.views["fuer-dich"].kinds), waiting: true, q: "", agent: "", session: "", sub: "", parts: new Set(PARTS.map(([id]) => id))};
|
||||
const stream = {key: null, events: [], entries: [], last: 0, sessions: {}, busy: false, again: false, dom: null, error: ""};
|
||||
const tree = {data: null, model: null, busy: false, q: "", open: new Set(), dom: null};
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
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 STEP_WORDS = [["started", "Started"], ["ended", "Ended"], ["joined", "Joined the scope"]];
|
||||
const ESTIMATION_ICONS = {none: "bi-1-circle", points: "bi-suit-diamond"};
|
||||
const TREND_DAYS = [1, 365];
|
||||
const TREND_REACH = 3;
|
||||
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);
|
||||
@@ -88,20 +92,75 @@
|
||||
return {x, y};
|
||||
}
|
||||
|
||||
function burnPoints(series, changes, names, x, y) {
|
||||
const marks = s("g", {class: "burn-points"});
|
||||
series.forEach((point, index) => {
|
||||
const change = changes[index];
|
||||
const listed = STEP_WORDS.filter(([key]) => change[key].length).map(([key, label]) => `${label}: ${change[key].join(", ")}`);
|
||||
const words = listed.length ? listed.join("\n") : "No work package started, ended or joined the scope here";
|
||||
for (const name of names) {
|
||||
marks.append(s("circle", {
|
||||
class: `burn-point k-${name}`, cx: fixed(x(point.t)), cy: fixed(y(point[name])), r: 3.5, "data-step": index, "data-series": name, "data-t": point.t, "data-value": point[name],
|
||||
...Object.fromEntries(STEP_WORDS.map(([key]) => [`data-${key}`, change[key].join(" ")])),
|
||||
}, s("title", {}, `${absolute.format(stampOf(point.t))} · ${SERIES_WORDS[name]}: ${point[name]}\n${words}`)));
|
||||
}
|
||||
});
|
||||
return marks;
|
||||
}
|
||||
|
||||
function trendNote(trend) {
|
||||
const forecast = trend ? trend.forecast : null;
|
||||
const words = forecast !== null ? `Forecast: ${absolute.format(stampOf(forecast))}` : trend ? "No forecast: the trend never reaches 0 remaining, so done never meets scope" : "No forecast: too few points for a trend";
|
||||
return h("span", {class: "burn-forecast", "data-forecast": forecast === null ? "" : String(forecast)}, icon("bi-graph-up-arrow"), words);
|
||||
}
|
||||
|
||||
function burnTrend(svg, trend, end, x, y) {
|
||||
for (const name of Plan.TRENDED) {
|
||||
const line = trend.lines[name];
|
||||
svg.append(s("path", {class: `burn-trend k-${name}`, "data-series": name, "data-from": trend.start, "data-to": end, d: `M${fixed(x(trend.start))},${fixed(y(Plan.lineAt(line, trend.start)))} L${fixed(x(end))},${fixed(y(Plan.lineAt(line, end)))}`},
|
||||
s("title", {}, `${SERIES_WORDS[name]} trend`)));
|
||||
}
|
||||
if (trend.forecast !== null) {
|
||||
const at = fixed(x(end));
|
||||
svg.append(s("line", {class: "forecast-line", x1: at, x2: at, y1: BURN.top, y2: BURN.height - BURN.bottom, "data-forecast": trend.forecast}));
|
||||
svg.append(s("text", {class: "forecast-label", x: at, y: BURN.top + 10, dx: -4, "text-anchor": "end"}, `Forecast ${absolute.format(stampOf(trend.forecast))}${end < trend.forecast ? " (beyond the chart)" : ""}`));
|
||||
}
|
||||
}
|
||||
|
||||
function burnSpan(picked, trend) {
|
||||
const forecast = trend ? trend.forecast : null;
|
||||
if (forecast === null) {
|
||||
return {reach: picked.to, end: picked.to};
|
||||
}
|
||||
const reach = Math.min(Math.max(forecast, picked.to), picked.to + TREND_REACH * Math.max(picked.to - picked.from, 1));
|
||||
return {reach, end: Math.min(forecast, reach)};
|
||||
}
|
||||
|
||||
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 trend = Plan.trend(series, settings.trend);
|
||||
const {reach, end} = burnSpan(picked, trend);
|
||||
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 ends = trend ? Plan.TRENDED.flatMap((name) => [trend.start, end].map((t) => Plan.lineAt(trend.lines[name], t))) : [];
|
||||
const top = Math.max(1, ...series.flatMap((point) => names.map((name) => point[name])), ...ends);
|
||||
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 svg = s("svg", {class: "chart burn", viewBox: `0 0 ${BURN.width} ${BURN.height}`, role: "img", "aria-label": `Burndown and burnup in ${unit}; hover a point for the work packages of its step`});
|
||||
const {x, y} = burnAxis(svg, picked.from, reach, top);
|
||||
const last = series[series.length - 1];
|
||||
if (reach > picked.to) {
|
||||
svg.append(s("line", {class: "now", x1: fixed(x(picked.to)), x2: fixed(x(picked.to)), y1: BURN.top, y2: BURN.height - BURN.bottom}));
|
||||
}
|
||||
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]}`)));
|
||||
if (trend) {
|
||||
burnTrend(svg, trend, end, x, y);
|
||||
}
|
||||
svg.append(burnPoints(series, Plan.steps(picked.rows, series, picked.from), names, x, y));
|
||||
const legend = h("div", {class: "legend"}, names.map((name) => h("span", {class: `burn-key k-${name}`, "data-series": name}, `${SERIES_WORDS[name]}: ${last[name]}`)),
|
||||
settings.trend.mode === "off" ? null : trendNote(trend));
|
||||
return h("div", {class: "burn-box"}, svg, legend, h("p", {class: "muted"}, `${picked.rows.length} tasks in scope, counted in ${unit}`));
|
||||
}
|
||||
|
||||
@@ -115,6 +174,31 @@
|
||||
drawTasks();
|
||||
}
|
||||
|
||||
async function chooseTrend(next) {
|
||||
if (await saveSettings({...settings, trend: next})) {
|
||||
toast(`Trend: ${Plan.TRENDS.find(([id]) => id === next.mode)[1]}${next.mode === "velocity" ? ` over ${next.days} days` : ""}`, [], true);
|
||||
}
|
||||
syncPlan();
|
||||
drawTasks();
|
||||
}
|
||||
|
||||
function trendControls() {
|
||||
const mode = h("select", {class: "field", ...named("Trend", "Trend: off, linear regression (least squares over the shown window) or velocity (the mean burn rate of the last N days); the forecast is where it reaches 0 remaining"), on: {change: (event) => chooseTrend({...settings.trend, mode: event.target.value})}},
|
||||
Plan.TRENDS.map(([id, label]) => h("option", {value: id, selected: id === settings.trend.mode}, label)));
|
||||
const [low, high] = TREND_DAYS;
|
||||
const days = h("input", {type: "number", class: "field", min: low, max: high, step: 1, value: settings.trend.days, ...named("Velocity days", `Velocity days: the mean burn rate over the last N days, ${low} to ${high}`), on: {change: (event) => {
|
||||
const value = Number(event.target.value);
|
||||
if (Number.isInteger(value) && value >= low && value <= high) {
|
||||
chooseTrend({...settings.trend, days: value});
|
||||
} else {
|
||||
event.target.value = String(settings.trend.days);
|
||||
}
|
||||
}}});
|
||||
const box = h("label", {class: "plan-group", hidden: settings.trend.mode !== "velocity"}, days, "days");
|
||||
taskView.plan.trend = {mode, days, box};
|
||||
return h("div", {class: "plan-group", role: "group", "aria-label": "Trend and forecast"}, mode, box);
|
||||
}
|
||||
|
||||
async function requestEstimates() {
|
||||
const signed = await signedProof("/api/board/sign", {action: "estimates"}, "Request estimates");
|
||||
if (signed) {
|
||||
@@ -140,8 +224,8 @@
|
||||
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);
|
||||
const button = h("button", {type: "button", class: "btn small primary", id: "bulk-value", disabled: true, ...named("Set business value", "Set business value: of every selected task as Operator, signed once with the passkey"), on: {click: () => bulkValue(Number(value.value))}},
|
||||
icon("bi-gem"), count);
|
||||
taskView.bulk = {button, count};
|
||||
return h("div", {class: "plan-group", role: "group", "aria-label": "Business value of the selection"}, value, button);
|
||||
}
|
||||
@@ -163,18 +247,20 @@
|
||||
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) => {
|
||||
return h("select", {class: "field", ...named("Scope", "Scope: the whole register, the list filter in the time window, or one agent or line"), on: {change: (event) => {
|
||||
taskView.scope = event.target.value;
|
||||
drawTasks();
|
||||
}}}, choices.map(([id, label]) => h("option", {value: id, selected: id === taskView.scope}, label))));
|
||||
}}}, 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 planTools(view) {
|
||||
const modes = h("div", {class: "segmented", role: "group", "aria-label": "Estimation"}, Plan.ESTIMATIONS.map(([id, label]) => h("button", {
|
||||
type: "button", class: "icon-only", "data-estimation": id, "aria-pressed": String(estimation() === id), ...named(label, `${label}: ${id === "points" ? "the Fibonacci complexity of rasci.py estimate" : "every task counts 1"}`), on: {click: () => chooseEstimation(id)},
|
||||
}, icon(ESTIMATION_ICONS[id]))));
|
||||
const request = h("button", {type: "button", class: "btn small icon-only", 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"));
|
||||
taskView.plan = {modes, request, trend: null};
|
||||
const own = {list: () => [sortControls(), bulkControls()], gantt: forecastControl, burn: () => [scopeControl(), trendControls()]}[view];
|
||||
return [modes, request, own ? own() : null];
|
||||
}
|
||||
|
||||
function syncPlan() {
|
||||
@@ -186,6 +272,13 @@
|
||||
button.setAttribute("aria-pressed", String(button.dataset.estimation === estimation()));
|
||||
}
|
||||
plan.request.hidden = estimation() !== "points";
|
||||
if (plan.trend) {
|
||||
plan.trend.mode.value = settings.trend.mode;
|
||||
plan.trend.box.hidden = settings.trend.mode !== "velocity";
|
||||
if (document.activeElement !== plan.trend.days) {
|
||||
plan.trend.days.value = String(settings.trend.days);
|
||||
}
|
||||
}
|
||||
if (taskView.bulk) {
|
||||
const picked = state.tasks.filter((row) => row.editable && taskView.picked.has(row.task)).length;
|
||||
taskView.bulk.count.textContent = String(picked);
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
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: "", sort: "prio", descending: false, forecast: "always", scope: "all", picked: new Set(), plan: null, bulk: null};
|
||||
const ETA_HINTS = {
|
||||
true: "ETA: its start, or for a task not yet started now or the latest ETA of its predecessors, plus the forecast length of the estimation mode",
|
||||
false: "ETA: the end of the ended task",
|
||||
};
|
||||
|
||||
const columnOf = (row) => (TASK_COLUMNS.some(([id]) => id === row.status) ? row.status : "queued");
|
||||
const branchOf = (row) => row.worktree_branch || (row.branch !== "-" ? row.branch : "");
|
||||
@@ -54,11 +58,20 @@
|
||||
return h("button", {type: "button", class: "linkish", title: `Open ${row.task}`, on: {click: () => taskSheet(row.task)}}, row.kind === "command" ? h("code", {}, titleOf(row)) : titleOf(row));
|
||||
}
|
||||
|
||||
function taskItem(row) {
|
||||
const etaOf = () => Plan.etas(state.tasks, state.task_edges, {now: state.now, estimation: settings.estimation});
|
||||
|
||||
function etaMark(found) {
|
||||
const known = Boolean(found) && found.eta !== null;
|
||||
const forecast = Boolean(found) && found.forecast;
|
||||
return h("span", {class: "task-eta", "data-eta": known ? String(found.eta) : "", "data-start": found && found.start !== null ? String(found.start) : "", "data-forecast": String(forecast), title: ETA_HINTS[forecast]},
|
||||
icon("bi-flag"), "ETA ", known ? absolute.format(stampOf(found.eta)) : "–");
|
||||
}
|
||||
|
||||
function taskItem(row, eta) {
|
||||
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"}, pick, 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"}), etaMark(eta),
|
||||
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,
|
||||
@@ -110,6 +123,32 @@
|
||||
return h("div", {class: "matrix-box"}, h("div", {class: "matrix-scroll"}, table), legend);
|
||||
}
|
||||
|
||||
function taskModel3d() {
|
||||
const rows = shownTasks();
|
||||
const ids = new Set(rows.map((row) => row.task));
|
||||
const starts = new Map(Plan.bars(rows, state.task_edges, {now: state.now, estimation: settings.estimation, forecast: "always"}).map((bar) => [bar.task, bar.start]));
|
||||
const toneOf = (row) => TONE_ROLES[Object.hasOwn(TASK_STATUS, row.status) ? TASK_STATUS[row.status][1] : "neutral"];
|
||||
return {
|
||||
nodes: rows.map((row) => ({id: row.task, kind: "task", label: `${row.task} · ${titleOf(row)}`, tone: toneOf(row), depth: 0, ts: starts.get(row.task), parent: null})),
|
||||
links: state.task_edges.filter((edge) => ids.has(edge.from) && ids.has(edge.to) && edge.from !== edge.to).map((edge) => ({source: edge.from, target: edge.to, kind: edge.kind})),
|
||||
};
|
||||
}
|
||||
|
||||
function taskSelect(id, anchor, closed) {
|
||||
const row = state.tasks.find((entry) => entry.task === id);
|
||||
if (!row) {
|
||||
return;
|
||||
}
|
||||
const at = (ts) => (ts === null ? "" : absolute.format(stampOf(ts)));
|
||||
const open = h("button", {type: "button", class: "btn small soft", ...named("Open task", `Open ${row.task}: priority, WSJF, RASCI and signed changes`), on: {click: () => {
|
||||
closePopup();
|
||||
taskSheet(row.task);
|
||||
}}}, icon("bi-box-arrow-up-right"), "Open");
|
||||
openPopup(row.task, [popupHead(icon(Nav.ICONS.tasks), titleOf(row), h("code", {class: "task-id"}, row.task)), h("div", {class: "popup-body"},
|
||||
h("div", {class: "states"}, taskBadges(row, true)), meta([["Worker", row.worker], ["Branch", branchOf(row)], ["Start", at(row.start)], ["End", at(row.end)]]),
|
||||
etaMark(etaOf().get(row.task)), h("div", {class: "actions"}, open))], anchor, closed);
|
||||
}
|
||||
|
||||
function chooseTaskFilter(id) {
|
||||
if (id === "operator") {
|
||||
go("inbox", null);
|
||||
@@ -146,12 +185,21 @@
|
||||
taskView.q = event.target.value;
|
||||
drawTasks();
|
||||
}}});
|
||||
const body = inbox ? inboxScreen() : h("div", {class: "tasks-body"});
|
||||
taskView.dom = {chips, count, body, inbox, view};
|
||||
const stage = !inbox && view === "3d" ? h("div", {class: "stage"}) : null;
|
||||
const body = inbox ? inboxScreen() : stage ? h("div", {class: "card stage-card tasks-body"}, layoutTools("tasks"), stage) : h("div", {class: "tasks-body"});
|
||||
taskView.dom = {chips, count, body, inbox, view, stage};
|
||||
taskView.sig = "";
|
||||
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);
|
||||
const bar = h("div", {class: "card controls task-toolbar", role: "toolbar", "aria-label": "Tasks"}, taskViewSwitch(inbox), search, count, inbox ? null : planTools(view), choiceMenu());
|
||||
return h("div", {class: "graph tasks"}, bar, chips, body);
|
||||
}
|
||||
|
||||
function shownTasks() {
|
||||
const q = taskView.q.trim().toLowerCase();
|
||||
const [, , , test] = TASK_FILTERS.find(([id]) => id === taskView.filter);
|
||||
const hit = (row) => !q || [row.task, row.title, row.worker, row.branch, row.workdir, row.objective].some((text) => String(text).toLowerCase().includes(q));
|
||||
return state.tasks.filter(test).filter(hit);
|
||||
}
|
||||
|
||||
function drawTasks() {
|
||||
@@ -159,8 +207,11 @@
|
||||
if (!dom) {
|
||||
return;
|
||||
}
|
||||
if (dom.stage) {
|
||||
stage3d("tasks", dom.stage);
|
||||
}
|
||||
const q = taskView.q.trim().toLowerCase();
|
||||
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)]);
|
||||
const sig = JSON.stringify([state.tasks, state.jobs, state.task_edges, settings.estimation, settings.trend, taskView.filter, taskView.sort, taskView.descending, taskView.forecast, taskView.scope, q, waitingCount(), Math.floor(nowSeconds() / 60)]);
|
||||
if (sig === taskView.sig) {
|
||||
return;
|
||||
}
|
||||
@@ -178,12 +229,16 @@
|
||||
dom.count.textContent = `${rows.length} tasks in the register`;
|
||||
return;
|
||||
}
|
||||
const [, , , test] = TASK_FILTERS.find(([id]) => id === taskView.filter);
|
||||
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);
|
||||
const shown = shownTasks();
|
||||
dom.count.textContent = `${shown.length} of ${rows.length} tasks`;
|
||||
if (dom.stage) {
|
||||
return;
|
||||
}
|
||||
const views = {
|
||||
list: (found) => h("ol", {class: "task-list"}, Plan.sortRows(found, taskView.sort, taskView.descending).map(taskItem)),
|
||||
list: (found) => {
|
||||
const etas = etaOf();
|
||||
return h("ol", {class: "task-list"}, Plan.sortRows(found, taskView.sort, taskView.descending).map((row) => taskItem(row, etas.get(row.task))));
|
||||
},
|
||||
board: taskBoard,
|
||||
rasci: taskMatrix,
|
||||
gantt: ganttChart,
|
||||
|
||||
+126
-25
@@ -2,10 +2,13 @@ const Plan = (() => {
|
||||
"use strict";
|
||||
const FORECASTS = [["always", "always"], ["points", "points only"], ["real", "real only"]];
|
||||
const ESTIMATIONS = [["none", "No estimate"], ["points", "Story points"]];
|
||||
const TRENDS = [["off", "off"], ["regression", "linear regression"], ["velocity", "velocity"]];
|
||||
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 TRENDED = ["scope", "done", "remaining"];
|
||||
const OUTSIDE = ["queue", "command"];
|
||||
const DAY = 86400;
|
||||
|
||||
function median(values) {
|
||||
const sorted = values.filter((value) => Number.isFinite(value)).sort((a, b) => a - b);
|
||||
@@ -45,16 +48,13 @@ const Plan = (() => {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rows - task rows in their shown order.
|
||||
* @param rows - task rows.
|
||||
* @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.
|
||||
* @param settle - (row, ahead) => value or null, where ahead() lists the settled values of the row's
|
||||
* predecessors; a predecessor still being settled (a cycle) and a null value are left out.
|
||||
* @returns a Map from task to its settled value, each row settled once, in row order.
|
||||
*/
|
||||
function bars(rows, edges, options) {
|
||||
const known = medians(rows);
|
||||
function settled(rows, edges, settle) {
|
||||
const byTask = new Map(rows.map((row) => [row.task, row]));
|
||||
const before = new Map(rows.map((row) => [row.task, []]));
|
||||
for (const edge of edges) {
|
||||
@@ -72,23 +72,60 @@ const Plan = (() => {
|
||||
return null;
|
||||
}
|
||||
visiting.add(row.task);
|
||||
let bar = null;
|
||||
const value = settle(row, () => before.get(row.task).map((task) => place(byTask.get(task))).filter(Boolean));
|
||||
visiting.delete(row.task);
|
||||
placed.set(row.task, value);
|
||||
return value;
|
||||
};
|
||||
rows.forEach(place);
|
||||
return placed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 placed = settled(rows, edges, (row, ahead) => {
|
||||
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};
|
||||
return {task: row.task, start: row.start, end, forecast: false, dot: end <= row.start};
|
||||
}
|
||||
visiting.delete(row.task);
|
||||
placed.set(row.task, bar);
|
||||
return bar;
|
||||
};
|
||||
return rows.map(place).filter(Boolean);
|
||||
if (row.end !== null) {
|
||||
return {task: row.task, start: row.end, end: row.end, forecast: false, dot: true};
|
||||
}
|
||||
if (row.ended || options.forecast === "real") {
|
||||
return null;
|
||||
}
|
||||
const start = Math.max(options.now, ...ahead().map((found) => found.end));
|
||||
const length = forecastLength(row, options.estimation, options.forecast, known);
|
||||
return {task: row.task, start, end: start + length, forecast: true, dot: length <= 0};
|
||||
});
|
||||
return rows.map((row) => placed.get(row.task)).filter(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rows - task rows.
|
||||
* @param edges - {from, to, kind} edges; only those between the rows count.
|
||||
* @param options - {now, estimation}.
|
||||
* @returns a Map from task to {start, eta, forecast}: an ended task's end (null without one); else its start, or
|
||||
* for a task not yet started the latest of now and its predecessors' ETAs, plus forecastLength() under "always".
|
||||
*/
|
||||
function etas(rows, edges, options) {
|
||||
const known = medians(rows);
|
||||
return settled(rows, edges, (row, ahead) => {
|
||||
if (row.ended) {
|
||||
return {start: row.start, eta: row.end, forecast: false};
|
||||
}
|
||||
const start = row.start !== null ? row.start : Math.max(options.now, ...ahead().map((found) => found.eta).filter((eta) => eta !== null));
|
||||
return {start, eta: start + forecastLength(row, options.estimation, "always", known), forecast: true};
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,11 +160,10 @@ const Plan = (() => {
|
||||
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 present = rows.filter((row) => joinedAt(row, options.from) <= 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);
|
||||
@@ -137,6 +173,71 @@ const Plan = (() => {
|
||||
return {points: times.map(at)};
|
||||
}
|
||||
|
||||
const joinedAt = (row, from) => (row.start !== null ? row.start : row.end !== null ? row.end : from);
|
||||
|
||||
/**
|
||||
* @param rows - the scope's task rows.
|
||||
* @param points - burn() points of the rows.
|
||||
* @param from - the range start burn() was given.
|
||||
* @returns per point {started, ended, joined}: the tasks whose start, end or, without a start, entry into the
|
||||
* scope falls after the previous point and up to this one; the first point takes everything up to it.
|
||||
*/
|
||||
function steps(rows, points, from) {
|
||||
return points.map((point, index) => {
|
||||
const after = index ? points[index - 1].t : -Infinity;
|
||||
const within = (t) => t !== null && t > after && t <= point.t;
|
||||
const tasks = (test) => rows.filter(test).map((row) => row.task);
|
||||
return {
|
||||
started: tasks((row) => within(row.start)),
|
||||
ended: tasks((row) => within(row.end)),
|
||||
joined: tasks((row) => row.start === null && within(joinedAt(row, from))),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
const LAST_SECOND = 8.64e12;
|
||||
|
||||
function leastSquares(pairs) {
|
||||
const mean = (values) => values.reduce((sum, value) => sum + value, 0) / values.length;
|
||||
const t0 = mean(pairs.map(([t]) => t));
|
||||
const y0 = mean(pairs.map(([, y]) => y));
|
||||
const spread = pairs.reduce((sum, [t]) => sum + (t - t0) ** 2, 0);
|
||||
return spread > 0 ? {t0, y0, slope: pairs.reduce((sum, [t, y]) => sum + (t - t0) * (y - y0), 0) / spread} : null;
|
||||
}
|
||||
|
||||
function velocity(points, name, start) {
|
||||
const last = points[points.length - 1];
|
||||
const before = points.filter((point) => point.t <= start).pop();
|
||||
return {t0: last.t, y0: last[name], slope: (last[name] - before[name]) / (last.t - start)};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param points - burn() points, in time order.
|
||||
* @param choice - {mode: "off", "regression" or "velocity", days: N for velocity}.
|
||||
* @returns null when off or with fewer than two distinct times, else {start, lines, forecast}: per series of
|
||||
* TRENDED a line {t0, y0, slope}, its value y0 + slope * (t - t0) with slope per second, fitted by least squares
|
||||
* over every point (regression, drawn from the first point) or through the last point and the value at
|
||||
* max(first point, last point - N days), the mean rate of those days (velocity, drawn from there). The forecast
|
||||
* is where the remaining line reaches 0, which by linearity is where done meets scope; null when it never falls
|
||||
* or falls only after LAST_SECOND, the last second a Date can hold.
|
||||
*/
|
||||
function trend(points, choice) {
|
||||
if (choice.mode === "off" || points.length < 2) {
|
||||
return null;
|
||||
}
|
||||
const last = points[points.length - 1];
|
||||
const start = choice.mode === "velocity" ? Math.max(points[0].t, last.t - choice.days * DAY) : points[0].t;
|
||||
const lines = Object.fromEntries(TRENDED.map((name) => [name, choice.mode === "velocity" ? (start < last.t ? velocity(points, name, start) : null) : leastSquares(points.map((point) => [point.t, point[name]]))]));
|
||||
if (TRENDED.some((name) => lines[name] === null)) {
|
||||
return null;
|
||||
}
|
||||
const rest = lines.remaining;
|
||||
const reached = rest.slope < 0 ? rest.t0 - rest.y0 / rest.slope : null;
|
||||
return {start, lines, forecast: reached !== null && Number.isFinite(reached) && Math.abs(reached) <= LAST_SECOND ? reached : null};
|
||||
}
|
||||
|
||||
const lineAt = (line, t) => line.y0 + line.slope * (t - line.t0);
|
||||
|
||||
const KEYS = {
|
||||
prio: () => null,
|
||||
wsjf: (row) => (row.wsjf ? row.wsjf.score : null),
|
||||
@@ -169,7 +270,7 @@ const Plan = (() => {
|
||||
return keyed.map((entry) => entry.row);
|
||||
}
|
||||
|
||||
return {FORECASTS, ESTIMATIONS, SORTS, SERIES, STATUS_ORDER, median, medians, forecastLength, bars, scoped, burn, sortRows};
|
||||
return {FORECASTS, ESTIMATIONS, TRENDS, SORTS, SERIES, TRENDED, STATUS_ORDER, median, medians, forecastLength, bars, etas, scoped, burn, steps, trend, lineAt, sortRows};
|
||||
})();
|
||||
if (typeof module === "object" && module.exports) {
|
||||
module.exports = Plan;
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
.graph.tasks { grid-template-columns: minmax(0, 1fr); }
|
||||
.tasks-body { min-width: 0; }
|
||||
.tasks .controls input[type="search"] { flex: 1; min-width: min(240px, 100%); }
|
||||
.task-toolbar { gap: 8px 10px; }
|
||||
.task-toolbar [hidden] { display: none; }
|
||||
.task-toolbar input[type="search"] { flex: 1 1 120px; min-width: min(120px, 100%); }
|
||||
.task-toolbar .segmented button.icon-only { min-width: 30px; padding: 4px 8px; }
|
||||
.task-toolbar input[type="number"] { width: 4.5rem; }
|
||||
.task-toolbar > .choice-request { margin-left: auto; }
|
||||
.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; }
|
||||
.choice-agents { display: grid; gap: 6px; max-height: 30vh; overflow: auto; }
|
||||
.choice-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
.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); }
|
||||
@@ -43,11 +48,10 @@ 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-toolbar select.field { width: auto; min-width: 0; max-width: min(11rem, 100%); }
|
||||
.task-pick { margin: 0; accent-color: var(--accent); }
|
||||
.task-eta { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; }
|
||||
.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; }
|
||||
@@ -70,10 +74,16 @@ svg .gantt-tip { fill: var(--muted); }
|
||||
.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 .k-scope, .burn-key.k-scope { --c: var(--info); }
|
||||
svg.burn .k-done, .burn-key.k-done { --c: var(--ok); }
|
||||
svg.burn .k-remaining, .burn-key.k-remaining { --c: var(--accent); }
|
||||
svg.burn .k-unestimated, .burn-key.k-unestimated { --c: var(--warn); }
|
||||
svg .burn-line.k-unestimated { stroke-dasharray: 6 4; }
|
||||
svg .burn-trend { fill: none; stroke: var(--c); stroke-width: 1.6; stroke-dasharray: 2 5; stroke-linecap: round; }
|
||||
svg .burn-point { fill: var(--c); stroke: transparent; stroke-width: 10; cursor: help; }
|
||||
svg .burn-point:hover { r: 6px; }
|
||||
svg .forecast-line { stroke: var(--ok); stroke-width: 1.4; stroke-dasharray: 4 3; }
|
||||
svg .forecast-label { fill: var(--ok); font-size: var(--fs-2xs); font-weight: 650; }
|
||||
.burn-forecast { display: inline-flex; align-items: center; gap: 6px; }
|
||||
svg .node.a-worktree.open circle { stroke: var(--warn); stroke-width: 2.6; stroke-dasharray: 3 2; }
|
||||
svg .edge.flow { stroke-dasharray: 2 5; }
|
||||
@@ -37,6 +37,13 @@ svg .node.speaking circle { stroke: var(--ok); stroke-width: 4; animation: speak
|
||||
.station { grid-template-columns: minmax(0, 1fr) auto auto; }
|
||||
.station-when { display: none; }
|
||||
}
|
||||
.spot-toggle[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
|
||||
.radio-spot { display: grid; gap: var(--sp-3); max-height: 46vh; overflow: auto; }
|
||||
.radio-spot[hidden], .radio-gear[hidden] { display: none; }
|
||||
body.fit .radio-spot { flex: 0 1 auto; min-height: 0; }
|
||||
.spot-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
|
||||
.spot-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: var(--sp-4); align-items: start; }
|
||||
.radio-gear { min-width: 0; }
|
||||
.composer { display: grid; gap: var(--sp-2); }
|
||||
.composer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: var(--sp-2) var(--sp-3); }
|
||||
.composer-grid label { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: var(--fs-sm); }
|
||||
|
||||
Reference in new issue
Block a user