Files
skills/orchestrator/templates/page-time.js
T
Kevin Veen-BirkenbachandClaude Opus 5.5 90c56cb786 feat(orchestrator): Agents and Artifacts views with spawn tree, orbit, 3D and signed branch deletes
Phase 4 of requirement 001. Agents and Artifacts each offer Orbit, Chord, Swimlane, Tree and 3D: the spawn tree (page-spawn.js) and the artifacts orbit (page-artifacts.js, kvb_orchestrator/artifacts.py) replace the "folgt" placeholders, 3D runs on the vendored 3d-force-graph and three.js (MIT, LICENSE files kept, served from the image under the unchanged CSP), and a Bootstrap Icons sprite (icons.py, MIT) replaces the emoji glyphs, also in the meditation page.

Signed branch deletes: the Tree view offers a delete only for merged-clean branches without a gc skip reason; the operator signs the exact item with the passkey, the hub writes a job without any command (kvb_orchestrator/cleanup.py), and the host path unit runs client/cleanup.py, which verifies the signature, dry-runs pkgmgr branch cleanup for that exact branch, refuses patterns, option names, changed tips, other worktrees and plans naming other branches, deletes, and rewrites the branch tree. pkgmgr runs with core.hooksPath=/dev/null, core.fsmonitor=false and the config hook events disabled through GIT_CONFIG_COUNT, because the cwd is a repository agents can write and pkgmgr releases before 4c8b137 delete without scan mode (test with a positive control that both hook kinds fire without it).

3D labels go into the tooltip as a text node: the vendored tooltip renders a string label as HTML.

Tests: 503 OK, Chromium (CDP) and Firefox (BiDi) walks over every screen at three widths.

MEDUSA acceptances (kvb-think-criticize skeptic 2026-11-07): WEB-FLASK-004 view.py:135 (file template, autoescape on, state via tojson), MEDUSA-MM-SCAN-058 server.py:69/:85 (substring pla in --templates and Places), RH005 client/cleanup.py:199 (raise SystemExit(main())), B704 icons.py:45 (sprite baked into the image, names checked against it), EXA002 page-artifacts.js:221 (openAgent only opens the drawer), STG002 page-constants.js:64 (U+2212 in a static label), PL002 page-graph3d.js:44 (CSS class space-tools; the real tooltip sink fixed), B603 client/cleanup.py:75 (argv without shell; hook hole closed).

🎯 Fix: 92 %
💥 Break: 5 %
💸 Cost: 100 %
⏱️ Time: –
🛡️ Security: 100 %
🏆 Score: 87
🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 %

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 15:03:14 +00:00

133 lines
5.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
function windowQuery() {
if (ui.preset === -1) {
return `from=${Math.floor(ui.from)}&to=${Math.ceil(ui.to)}`;
}
const end = ui.asOf === null ? nowSeconds() : ui.asOf;
const begin = ui.preset === 0 ? 0 : end - ui.preset;
return `from=${Math.floor(begin)}${ui.asOf === null ? "" : `&to=${Math.ceil(end)}`}`;
}
const localInput = (ts) => {
const date = stampOf(ts);
return new Date(date.getTime() - date.getTimezoneOffset() * 60000).toISOString().slice(0, 16);
};
function customRange() {
const from = h("input", {type: "datetime-local", "aria-label": "Von", value: localInput(ui.from === null ? state.since : ui.from)});
const to = h("input", {type: "datetime-local", "aria-label": "Bis", value: localInput(ui.to === null ? state.until : ui.to)});
return h("span", {class: "custom"}, from, h("span", {class: "muted"}, "bis"), to,
h("button", {type: "button", class: "btn small soft", on: {click: () => {
const begin = Date.parse(from.value) / 1000;
const end = Date.parse(to.value) / 1000;
if (!Number.isFinite(begin) || !Number.isFinite(end) || begin >= end) {
toast("Zeitraum ungültig", ["„Von“ muss vor „Bis“ liegen."], false);
return;
}
stopReplay();
ui.preset = -1;
ui.from = begin;
ui.to = end;
reload();
}}}, "Anwenden"));
}
function timeBar() {
const bar = document.getElementById("time");
const presets = h("div", {class: "segmented", role: "group", "aria-label": "Zeitraum"});
const summary = h("summary", {title: "Zeitraum und Wiedergabe"});
const slider = h("input", {type: "range", min: 0, max: 1000, step: 1, value: 1000, "aria-label": "Stand der Wiedergabe"});
const play = iconBtn("bi-play-fill", "Wiedergabe", "btn small soft", null);
const liveButton = h("button", {type: "button", class: "btn small ghost"}, "Live");
const label = h("span", {class: "window-label"});
for (const [seconds, name] of PRESETS.filter(([seconds]) => seconds !== -1)) {
presets.append(h("button", {type: "button", "data-preset": seconds, on: {click: () => choosePreset(seconds)}}, name));
}
slider.addEventListener("input", () => {
stopReplay();
const span = state.now - state.first;
ui.asOf = Number(slider.value) >= 1000 ? null : state.first + (span * Number(slider.value)) / 1000;
reload();
});
play.addEventListener("click", () => (ui.playing ? stopReplay() : startReplay()));
liveButton.addEventListener("click", () => {
stopReplay();
ui.asOf = null;
if (ui.preset === -1) {
ui.preset = DAY;
}
reload();
});
bar.append(summary, h("div", {class: "menu-box end"}, h("h3", {}, "Zeitraum"), presets, h("h3", {}, "Wiedergabe"), h("div", {class: "replay"}, play, slider, liveButton), label,
h("p", {class: "muted"}, "Einen eigenen Zeitraum setzt Filter ▾ im Stream.")));
timeDom = {summary, presets, slider, play, live: liveButton, label};
}
function reload() {
load();
if (ui.screen === "stream") {
fetchEvents();
}
}
function choosePreset(seconds) {
stopReplay();
ui.preset = seconds;
reload();
}
function drawTime() {
if (!timeDom) {
return;
}
for (const button of timeDom.presets.children) {
button.setAttribute("aria-pressed", String(Number(button.dataset.preset) === ui.preset));
}
timeDom.summary.textContent = `${(PRESETS.find(([seconds]) => seconds === ui.preset) || [0, "eigener"])[1]}${ui.asOf === null ? "" : " · Wiedergabe"} ▾`;
timeDom.slider.disabled = ui.preset === -1;
timeDom.play.disabled = ui.preset === -1;
timeDom.live.disabled = live();
const span = Math.max(state.now - state.first, 1);
if (!ui.playing) {
timeDom.slider.value = String(ui.asOf === null ? 1000 : Math.round((1000 * (ui.asOf - state.first)) / span));
}
timeDom.label.textContent = `${absolute.format(stampOf(state.since))} – ${absolute.format(stampOf(state.until))}${live() ? " · live" : ""}`;
}
function startReplay() {
if (ui.preset === -1) {
return;
}
const began = state.first;
const span = Math.max(state.now - began, 1);
const resume = ui.asOf !== null && ui.asOf < state.now - 60;
let progress = resume ? (ui.asOf - began) / span : 0;
ui.playing = true;
relabel(timeDom.play, "bi-pause-fill", "Pause");
const advance = async () => {
if (!ui.playing) {
return;
}
progress = Math.min(progress + 1 / 48, 1);
ui.asOf = progress >= 1 ? null : began + span * progress;
timeDom.slider.value = String(Math.round(progress * 1000));
await load();
if (ui.screen === "stream") {
fetchEvents();
}
if (progress >= 1) {
stopReplay();
} else if (ui.playing) {
replay = window.setTimeout(advance, 500);
}
};
advance();
}
function stopReplay() {
ui.playing = false;
window.clearTimeout(replay);
if (timeDom) {
relabel(timeDom.play, "bi-play-fill", "Wiedergabe");
}
}