feat(orchestrator): bulk grant mode, continuous review diff and an inbox denial reason (020)
A Direct/Select switch in the header (ids grant-direct, grant-select; ViewStore approval.mode) decides whether a grant button acts at once or adds its item to a selection that a tray grants under one passkey signature; rules and red gates still act at once. The review sheet shows every file in one scrolling stack whose next file opens as the previous one ends (openOnScroll moves to page-diff.js and serves Match too). The grant bar boots before the header is measured, so --head counts it. The inbox denial sheet takes an optional reason for every requester; it shares page-inbox.js hunks with the selection code, so both land in this one commit. Fix stays below 90: the header ids and the measure order fix e2e failures of the aborted final run of 2026-11-17 that the master gate has not rerun yet. Accepted MEDUSA false positives (security.py accept after kvb-think-criticize, 2026-11-17): page-inbox.js PQC007 EXA010; page-match.js EXA010. 🎯 Fix: 85 % 💥 Break: 5 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 81 🚦 Gate: ⛔ fix 85 % < 90 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
88a2d88e47
commit
65d00c0d2c
22 files changed
+763
-65
No files matched your search
@@ -20,7 +20,9 @@ VIEW = {
|
||||
"home": {"pins": []},
|
||||
"kanban": {"hidden": []},
|
||||
"legend": {"views": {}, "tiles": {}},
|
||||
"approval": {"mode": "direct"},
|
||||
}
|
||||
APPROVAL_MODES = ("direct", "select")
|
||||
LEGEND_PANELS = (
|
||||
"agents/orbit", "agents/chord", "agents/swimlane", "artifacts/orbit", "artifacts/chord", "artifacts/swimlane",
|
||||
"tasks/rasci", "tasks/gantt", "tasks/burn", "resources-hardware", "resources-tokens", "resources-combined",
|
||||
@@ -174,8 +176,11 @@ def valid_view(raw: object) -> dict:
|
||||
home = section(data["home"], "home", tuple(VIEW["home"]))
|
||||
kanban = section(data["kanban"], "kanban", tuple(VIEW["kanban"]))
|
||||
legend = section(data["legend"], "legend", tuple(VIEW["legend"]))
|
||||
approval = section(data["approval"], "approval", tuple(VIEW["approval"]))
|
||||
if not isinstance(resources["tokens"], str) or resources["tokens"] not in TOKEN_MODES:
|
||||
raise ToolError(f"resources.tokens must be one of {', '.join(TOKEN_MODES)}")
|
||||
if not isinstance(approval["mode"], str) or approval["mode"] not in APPROVAL_MODES:
|
||||
raise ToolError(f"approval.mode must be one of {', '.join(APPROVAL_MODES)}")
|
||||
pinned = pins(home["pins"])
|
||||
keys = {f"{pin['kind']}:{pin['id']}" for pin in pinned}
|
||||
tiles = legend_flags(legend["tiles"], "legend.tiles", PIN_KEY.fullmatch, "pin keys kind:id")
|
||||
@@ -193,6 +198,7 @@ def valid_view(raw: object) -> dict:
|
||||
"views": legend_flags(legend["views"], "legend.views", LEGEND_PANELS.__contains__, f"panels of {', '.join(LEGEND_PANELS)}"),
|
||||
"tiles": {key: shown for key, shown in tiles.items() if key in keys},
|
||||
},
|
||||
"approval": {"mode": approval["mode"]},
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -59,6 +59,10 @@ h1 { margin: 0; font-size: var(--fs-lg); font-weight: 680; letter-spacing: -.01e
|
||||
.badge.urgent { background: var(--accent); color: var(--on-accent); }
|
||||
.badge.alarm { background: var(--alarm); color: #fff; }
|
||||
.tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
|
||||
.grant-bar, .grant-tray { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
|
||||
.grant-tray[hidden] { display: none; }
|
||||
.grant-bar .segmented button { display: inline-flex; align-items: center; gap: 6px; }
|
||||
.grant-count { color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||
.banner { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-5); background: var(--alarm); color: #fff; font-weight: 650; }
|
||||
.banner[hidden] { display: none; }
|
||||
.banner .text { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
@@ -86,6 +90,7 @@ main { min-width: 0; min-height: calc(100vh - var(--head) - var(--sp-6) - var(--
|
||||
.sheet { padding: 0; }
|
||||
.sheet-box { min-height: 100%; border-radius: 0; }
|
||||
.settings .grid { grid-template-columns: minmax(0, 1fr); }
|
||||
.grant-label { display: none; }
|
||||
}
|
||||
.stack { display: grid; gap: 26px; }
|
||||
.group-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: var(--fs-sm); font-weight: 650; color: var(--muted); letter-spacing: .02em; text-transform: uppercase; }
|
||||
@@ -165,6 +170,11 @@ pre.notes { max-height: 260px; margin: 12px 0 0; padding: 10px 12px; overflow: a
|
||||
.diff-head .path { overflow-wrap: anywhere; font-weight: 600; }
|
||||
.pad { margin: 0; padding: 18px 16px; }
|
||||
.diff-scroll { overflow: auto; max-height: 70vh; }
|
||||
.review-stack { position: relative; overflow: auto; max-height: 70vh; overscroll-behavior: contain; }
|
||||
.review-file + .review-file { border-top: 1px solid var(--line); }
|
||||
.review-file > summary.diff-head { position: sticky; top: 0; z-index: 1; cursor: pointer; list-style: none; }
|
||||
.review-file > summary.diff-head::-webkit-details-marker { display: none; }
|
||||
.diff-wide { overflow-x: auto; }
|
||||
table.diff { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: var(--fs-sm); line-height: 1.5; }
|
||||
table.diff td { padding: 0 10px; vertical-align: top; }
|
||||
table.diff td.num { width: 1%; min-width: 44px; color: var(--faint); text-align: right; user-select: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
|
||||
@@ -457,6 +467,7 @@ pre.notes { margin: 0; padding: 8px 10px; background: var(--sunken); border-radi
|
||||
<header class="top">
|
||||
<div class="brand"><span class="logo" aria-hidden="true"></span><div class="brand-text"><h1>Agent Orchestrator</h1><span class="sky-note" id="sky-note"></span></div></div>
|
||||
<div class="tools">
|
||||
<div class="grant-bar" id="grant-bar"></div>
|
||||
<button type="button" class="btn small ghost icon-only spot-toggle" id="radio-open" title="Radio: post, call or a message to all, with Record, the radio settings and the stations" aria-label="Radio" aria-controls="radio-spot" aria-expanded="false"><svg class="bi" aria-hidden="true" focusable="false"><use href="#bi-broadcast-pin"></use></svg></button>
|
||||
<button type="button" class="btn small ghost icon-only" id="bubbles-toggle" title="Speech bubbles" aria-label="Speech bubbles" aria-pressed="false" aria-controls="bubbles"><svg class="bi" aria-hidden="true" focusable="false"><use href="#bi-chat-quote"></use></svg></button>
|
||||
<button type="button" class="btn small ghost icon-only" id="palette-open" title="Commands (Ctrl+K)" aria-label="Commands"><svg class="bi" aria-hidden="true" focusable="false"><use href="#bi-command"></use></svg></button>
|
||||
@@ -557,6 +568,8 @@ pre.notes { margin: 0; padding: 8px 10px; background: var(--sunken); border-radi
|
||||
|
||||
{% include "page-inbox.js" %}
|
||||
|
||||
{% include "page-grant.js" %}
|
||||
|
||||
{% include "page-console.js" %}
|
||||
|
||||
{% include "page-deny.js" %}
|
||||
@@ -646,6 +659,7 @@ pre.notes { margin: 0; padding: 8px 10px; background: var(--sunken); border-radi
|
||||
{% include "page-home.js" %}
|
||||
|
||||
{% include "page-legend.js" %}
|
||||
|
||||
{% include "page-rules.js" %}
|
||||
|
||||
{% include "page-firewall.js" %}
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
ratesBar();
|
||||
notifyLabel();
|
||||
announce();
|
||||
grantBoot();
|
||||
measure();
|
||||
homeBoot();
|
||||
legendBoot();
|
||||
|
||||
@@ -40,6 +40,27 @@
|
||||
}}}, icon("bi-eye"), words);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Element} body the scrolling element that holds the files.
|
||||
* @param {string} selector the files: details elements in reading order.
|
||||
* Opens the first closed file once the open file before it ends inside the visible part of body.
|
||||
*/
|
||||
function openOnScroll(body, selector) {
|
||||
const files = [...body.querySelectorAll(selector)];
|
||||
const view = body.getBoundingClientRect();
|
||||
for (let index = 0; index < files.length - 1; index += 1) {
|
||||
const file = files[index];
|
||||
if (!file.open) {
|
||||
return;
|
||||
}
|
||||
const next = files[index + 1];
|
||||
if (!next.open && file.getBoundingClientRect().bottom <= view.bottom + 8) {
|
||||
next.open = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function diffOf(item) {
|
||||
if (!item || typeof item.diff !== "number" || !["review", "ask"].includes(item.kind)) {
|
||||
return null;
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
const GRANT_SELECT = "select";
|
||||
const GRANT_MODES = [
|
||||
["direct", "Direct", "bi-lightning-charge", "Direct: every grant button grants at once"],
|
||||
[GRANT_SELECT, "Select", "bi-check2-square", "Select: every grant button adds its item to the selection; the tray grants the selection under one passkey signature"],
|
||||
];
|
||||
const DIRECT_WHY = {rule: "a rule is accepted one at a time", review: "a red gate is never granted in a selection"};
|
||||
const grantView = {modes: [], tray: null, sig: ""};
|
||||
|
||||
const grantMode = () => (typeof ViewStore === "object" && ViewStore ? ViewStore.get("approval.mode") : "direct");
|
||||
const collecting = (item) => grantMode() === GRANT_SELECT && selectable(item);
|
||||
|
||||
function regrant() {
|
||||
render(false);
|
||||
drawStream();
|
||||
}
|
||||
|
||||
function collect(item) {
|
||||
const key = keyOf(item);
|
||||
if (ui.selected.has(key)) {
|
||||
ui.selected.delete(key);
|
||||
} else {
|
||||
ui.selected.add(key);
|
||||
}
|
||||
regrant();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param button - the grant button of item.
|
||||
* @param item - a waiting inbox item.
|
||||
* @returns button; in Select it shows whether item is in the selection, or why its grant still acts at once.
|
||||
*/
|
||||
function grantPress(button, item) {
|
||||
if (grantMode() !== GRANT_SELECT) {
|
||||
return button;
|
||||
}
|
||||
if (!selectable(item)) {
|
||||
button.setAttribute("title", `${button.getAttribute("title")}: acts at once, ${DIRECT_WHY[item.kind]}`);
|
||||
return button;
|
||||
}
|
||||
const picked = ui.selected.has(keyOf(item));
|
||||
button.setAttribute("aria-pressed", String(picked));
|
||||
button.setAttribute("title", picked ? "In the selection: press to take it out" : "Select: press to add it to the selection; the tray grants it");
|
||||
return button;
|
||||
}
|
||||
|
||||
function drawGrant() {
|
||||
if (!grantView.tray) {
|
||||
return;
|
||||
}
|
||||
const mode = grantMode();
|
||||
const chosen = state.inbox.filter((item) => ui.selected.has(keyOf(item)));
|
||||
const sig = JSON.stringify([mode, chosen.map(keyOf), state.inbox.map((item) => [keyOf(item), isGreen(item), item.held]), ui.busy]);
|
||||
if (sig === grantView.sig) {
|
||||
return;
|
||||
}
|
||||
grantView.sig = sig;
|
||||
for (const button of grantView.modes) {
|
||||
button.setAttribute("aria-pressed", String(button.dataset.mode === mode));
|
||||
}
|
||||
grantView.tray.hidden = mode !== GRANT_SELECT;
|
||||
grantView.tray.replaceChildren(...(mode === GRANT_SELECT ? [
|
||||
h("span", {class: "grant-count", "aria-live": "polite"}, `${chosen.length} selected`),
|
||||
...selectionButtons(state.inbox),
|
||||
h("button", {type: "button", class: "btn small ghost", ...named("Clear", "Clear: empty the selection"), disabled: !chosen.length, on: {click: () => {
|
||||
ui.selected.clear();
|
||||
regrant();
|
||||
}}}, icon("bi-x-lg"), "Clear"),
|
||||
] : []));
|
||||
}
|
||||
|
||||
function grantBoot() {
|
||||
const bar = document.getElementById("grant-bar");
|
||||
grantView.modes = GRANT_MODES.map(([mode, label, name, hint]) => h("button", {type: "button", id: `grant-${mode}`, "data-mode": mode, ...named(label, hint), on: {click: () => ViewStore.set("approval.mode", mode)}},
|
||||
icon(name), h("span", {class: "grant-label"}, label)));
|
||||
grantView.tray = h("div", {class: "grant-tray", role: "group", "aria-label": "Selection"});
|
||||
bar.replaceChildren(h("div", {class: "segmented", role: "group", "aria-label": "Grant mode"}, grantView.modes), grantView.tray);
|
||||
ViewStore.on("approval", regrant);
|
||||
drawGrant();
|
||||
}
|
||||
@@ -87,6 +87,10 @@
|
||||
}
|
||||
|
||||
function approveOne(item) {
|
||||
if (collecting(item)) {
|
||||
collect(item);
|
||||
return null;
|
||||
}
|
||||
if (item.kind === "rule") {
|
||||
return acceptRule(item);
|
||||
}
|
||||
@@ -100,14 +104,14 @@
|
||||
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)], `Choice: ${label}`);
|
||||
|
||||
const denialOf = (item) => (item.deniable ? {...entryOf(item, "reject", ""), channel: "post", reason: "", to: item.to} : item.kind === "review" ? entryOf(item, "reject", "") : null);
|
||||
const pickable = (item) => !item.held && (selectable(item) || denialOf(item) !== null);
|
||||
const deniable = (item) => item.deniable || item.kind === "review";
|
||||
const denialOf = (item, reason) => ({...entryOf(item, "reject", ""), channel: "post", reason, to: item.to});
|
||||
const pickable = (item) => !item.held && (selectable(item) || deniable(item));
|
||||
|
||||
function bulk(items, label, deny) {
|
||||
const usable = items.filter(deny ? (item) => denialOf(item) !== null : selectable);
|
||||
const usable = items.filter(deny ? deniable : selectable);
|
||||
if (!usable.length) {
|
||||
toast(`${label}: nothing to ${deny ? "deny" : "grant"}`, [], false);
|
||||
return;
|
||||
@@ -119,15 +123,29 @@
|
||||
item.kind === "operator" ? h("span", {class: "muted"}, revealed(`in ${item.directory}`)) : null,
|
||||
item.kind === "ask" ? h("div", {class: "command"}, h("code", {}, revealed(item.command))) : null));
|
||||
const confirm = h("button", {type: "button", class: deny ? "btn danger" : "btn primary"}, `${deny ? "Deny" : "Grant"} ${usable.length}`);
|
||||
const reason = deny ? h("textarea", {class: "field", maxlength: DENY_REASON, rows: 3, placeholder: "e.g. make the gate green first"}) : null;
|
||||
confirm.addEventListener("click", () => {
|
||||
closeSheet();
|
||||
submit(usable.map((item) => (deny ? denialOf(item) : entryOf(item, "approve", item.kind === "decision" ? item.recommended : ""))), `${label}: ${usable.length} entries`);
|
||||
submit(usable.map((item) => (deny ? denialOf(item, reason.value) : entryOf(item, "approve", item.kind === "decision" ? item.recommended : ""))), `${label}: ${usable.length} entries`);
|
||||
});
|
||||
const note = deny
|
||||
? "Every entry and every full command that gets denied; each requester gets its denial by post. After the click the passkey signs the whole selection once; then 3 s remain to undo."
|
||||
? "Every entry and every full command that gets denied; each requester gets its denial and the reason by post. After the click the passkey signs the whole selection once; then 3 s remain to undo."
|
||||
: "Every entry and every full command that gets granted. After the click the passkey signs the whole selection once; then 3 s remain to undo.";
|
||||
openSheet(label, [h("p", {class: "muted"}, note), h("ul", {class: "mini"}, rows), h("div", {class: "actions"}, h("span", {class: "spacer"}), btn("Cancel", "btn ghost", closeSheet), confirm)], false);
|
||||
confirm.focus();
|
||||
openSheet(label, [h("p", {class: "muted"}, note), h("ul", {class: "mini"}, rows), ...(deny ? [h("label", {class: "deny-reason"}, "Reason (optional, every requester reads it)", reason)] : []),
|
||||
h("div", {class: "actions"}, h("span", {class: "spacer"}), btn("Cancel", "btn ghost", closeSheet), confirm)], false);
|
||||
(reason || confirm).focus();
|
||||
}
|
||||
|
||||
function selectionButtons(items) {
|
||||
const green = items.filter(isGreen);
|
||||
const chosen = items.filter((item) => ui.selected.has(keyOf(item)));
|
||||
const denials = chosen.filter(deniable);
|
||||
const grantable = chosen.filter(selectable);
|
||||
return [
|
||||
h("button", {type: "button", class: "btn small soft", ...named(`Grant selection (${grantable.length})`), disabled: !grantable.length || ui.busy, on: {click: () => bulk(chosen, "Grant selection", false)}}, icon("bi-check2-square"), String(grantable.length)),
|
||||
h("button", {type: "button", class: "btn small danger", ...named(`Deny selection (${denials.length})`, `Deny selection (${denials.length}): each requester gets its denial and an optional reason by post, one passkey signature, 3 s to undo`), disabled: !denials.length || ui.busy, on: {click: () => bulk(chosen, "Deny selection", true)}}, icon("bi-x-square"), String(denials.length)),
|
||||
h("button", {type: "button", class: "btn small primary", ...named(`Grant all green (${green.length})`), disabled: !green.length || ui.busy, on: {click: () => bulk(green, "Grant all green", false)}}, icon("bi-check2-all"), String(green.length)),
|
||||
];
|
||||
}
|
||||
|
||||
async function mark(item, until, pinned) {
|
||||
@@ -168,16 +186,18 @@
|
||||
return [h("span", {class: "muted"}, "takes effect …")];
|
||||
}
|
||||
const buttons = [];
|
||||
const grant = (button) => buttons.push(grantPress(button, item));
|
||||
if (item.kind === "review") {
|
||||
buttons.push(iconBtn("bi-check-lg", "Grant", "btn small primary", () => approveOne(item)), iconBtn("bi-x-lg", "Deny", "btn small danger", () => rejectOne(item)));
|
||||
grant(iconBtn("bi-check-lg", "Grant", "btn small primary", () => approveOne(item)));
|
||||
buttons.push(denySplit(item));
|
||||
} else if (item.kind === "ask") {
|
||||
buttons.push(iconBtn("bi-check-lg", "Grant", "btn small primary", () => approveOne(item)));
|
||||
grant(iconBtn("bi-check-lg", "Grant", "btn small primary", () => approveOne(item)));
|
||||
} else if (item.kind === "decision" && item.recommended) {
|
||||
buttons.push(h("button", {type: "button", class: "btn small primary", ...named(revealed(`Recommendation: ${item.recommended}`)), on: {click: () => approveOne(item)}}, icon("bi-check-lg"), revealed(item.recommended)));
|
||||
grant(h("button", {type: "button", class: "btn small primary", ...named(revealed(`Recommendation: ${item.recommended}`)), on: {click: () => approveOne(item)}}, icon("bi-check-lg"), revealed(item.recommended)));
|
||||
} else if (item.kind === "operator" && item.runnable) {
|
||||
buttons.push(iconBtn("bi-play-fill", "Run", "btn small primary", () => approveOne(item)));
|
||||
grant(iconBtn("bi-play-fill", "Run", "btn small primary", () => approveOne(item)));
|
||||
} else if (item.kind === "rule") {
|
||||
buttons.push(h("button", {type: "button", class: "btn small primary", ...named("Accept", "Accept: the passkey signs exactly this rule, then it applies"), on: {click: () => approveOne(item)}}, icon("bi-shield-check"), "Accept"));
|
||||
grant(h("button", {type: "button", class: "btn small primary", ...named("Accept", "Accept: the passkey signs exactly this rule, then it applies"), on: {click: () => approveOne(item)}}, icon("bi-shield-check"), "Accept"));
|
||||
}
|
||||
if (item.deniable) {
|
||||
buttons.push(denySplit(item));
|
||||
@@ -248,28 +268,22 @@
|
||||
ui.selected.delete(key);
|
||||
}
|
||||
}
|
||||
const sig = JSON.stringify([items.map(withoutOutput), [...ui.selected], ui.cursor, ui.snoozed, ui.busy, Math.floor(nowSeconds() / 60), diffView.version, state.messages.map((message) => message.id)]);
|
||||
const mode = grantMode();
|
||||
const sig = JSON.stringify([mode, items.map(withoutOutput), [...ui.selected], ui.cursor, ui.snoozed, ui.busy, Math.floor(nowSeconds() / 60), diffView.version, state.messages.map((message) => message.id)]);
|
||||
if (sig === inboxSig) {
|
||||
repaintConsoles(items);
|
||||
return;
|
||||
}
|
||||
inboxSig = sig;
|
||||
const green = items.filter(isGreen);
|
||||
const chosen = items.filter((item) => ui.selected.has(keyOf(item)));
|
||||
const hidden = state.inbox.length - waitingCount();
|
||||
const snoozed = h("input", {type: "checkbox", checked: ui.snoozed, on: {change: (event) => {
|
||||
ui.snoozed = event.target.checked;
|
||||
drawInbox();
|
||||
}}});
|
||||
const deniable = chosen.filter((item) => denialOf(item) !== null);
|
||||
const grantable = chosen.filter(selectable);
|
||||
const choose = h("button", {type: "button", class: "btn small soft", ...named(`Grant selection (${grantable.length})`), disabled: !grantable.length || ui.busy, on: {click: () => bulk(chosen, "Grant selection", false)}}, icon("bi-check2-square"), String(grantable.length));
|
||||
const deny = h("button", {type: "button", class: "btn small danger", ...named(`Deny selection (${deniable.length})`, `Deny selection (${deniable.length}): each requester gets its denial by post, one passkey signature, 3 s to undo`), disabled: !deniable.length || ui.busy, on: {click: () => bulk(chosen, "Deny selection", true)}}, icon("bi-x-square"), String(deniable.length));
|
||||
const all = h("button", {type: "button", class: "btn small primary", ...named(`Grant all green (${green.length})`), disabled: !green.length || ui.busy, on: {click: () => bulk(green, "Grant all green", false)}}, icon("bi-check2-all"), String(green.length));
|
||||
Panels.keepFocus(inboxSlot, () => inboxDom.replaceChildren(
|
||||
h("div", {class: "inbox-head"}, h("h2", {class: "group-title"}, "Waits on Operator", counter(waitingCount())), h("span", {class: "spacer"}),
|
||||
hidden ? h("label", {class: "check"}, snoozed, `${hidden} snoozed`) : null, inboxSlot),
|
||||
h("div", {class: "inbox-actions"}, choose, deny, all),
|
||||
mode === GRANT_SELECT ? null : h("div", {class: "inbox-actions"}, selectionButtons(items)),
|
||||
onLocalhost() ? "" : h("p", {class: "muted"}, "The passkey signs grants only under ", localLink()),
|
||||
items.length ? h("ol", {class: "inbox-list"}, items.map(inboxItem)) : emptyState("All done", "Nothing is waiting for you right now.")));
|
||||
settleConsoles(items);
|
||||
|
||||
@@ -118,22 +118,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
function openOnScroll(body) {
|
||||
const files = [...body.querySelectorAll(".match-file")];
|
||||
const view = body.getBoundingClientRect();
|
||||
for (let index = 0; index < files.length - 1; index += 1) {
|
||||
const file = files[index];
|
||||
if (!file.open) {
|
||||
return;
|
||||
}
|
||||
const next = files[index + 1];
|
||||
if (!next.open && file.getBoundingClientRect().bottom <= view.bottom + 8) {
|
||||
next.open = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function closeComment(card) {
|
||||
const open = card.querySelector(".match-comment");
|
||||
if (open) {
|
||||
@@ -228,11 +212,11 @@
|
||||
const files = card.files || [];
|
||||
const list = files.length ? h("ol", {class: "match-files", "aria-label": `Files: ${files.length}`}, files.map((file, index) => fileBlock(card, file, index))) : h("p", {class: "muted"}, card.kind === "commit" ? "No diff shipped with this stage." : "Its command names no file.");
|
||||
const body = h("div", {class: "match-body"}, matchCommand(card), list);
|
||||
body.addEventListener("scroll", () => openOnScroll(body), {passive: true});
|
||||
body.addEventListener("scroll", () => openOnScroll(body, ".match-file"), {passive: true});
|
||||
const article = h("article", {class: "card match-card front", "data-card": card.id, "data-kind": card.kind, "data-stale": String(Boolean(card.stale)), "aria-label": `${card.kind} card of ${card.agent || "an agent"}`},
|
||||
matchHead(card), body);
|
||||
markable(article, card);
|
||||
window.setTimeout(() => openOnScroll(body), 0);
|
||||
window.setTimeout(() => openOnScroll(body, ".match-file"), 0);
|
||||
return article;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
const REVIEW_FILE = ".review-file";
|
||||
|
||||
function fileList(id) {
|
||||
if (!files.has(id)) {
|
||||
files.set(id, "loading");
|
||||
@@ -77,7 +79,7 @@
|
||||
return h("span", {class: "stat"}, h("span", {class: "add"}, `+${file.added}`), h("span", {class: "del"}, `-${file.removed}`));
|
||||
}
|
||||
|
||||
function pick(index, list) {
|
||||
function markFile(index) {
|
||||
ui.file = index;
|
||||
for (const entry of reviewDom.tree.querySelectorAll(".file-entry")) {
|
||||
if (Number(entry.dataset.index) === index) {
|
||||
@@ -86,7 +88,26 @@
|
||||
entry.removeAttribute("aria-current");
|
||||
}
|
||||
}
|
||||
reviewDom.diff.replaceChildren(diffPane(list));
|
||||
}
|
||||
|
||||
function pick(index) {
|
||||
const stack = reviewDom.diff.querySelector(".review-stack");
|
||||
const file = stack ? stack.querySelector(`${REVIEW_FILE}[data-index="${index}"]`) : null;
|
||||
if (file) {
|
||||
file.open = true;
|
||||
stack.scrollTop = file.offsetTop;
|
||||
markFile(index);
|
||||
}
|
||||
}
|
||||
|
||||
function followScroll(stack) {
|
||||
openOnScroll(stack, REVIEW_FILE);
|
||||
const top = stack.getBoundingClientRect().top;
|
||||
const files = [...stack.querySelectorAll(REVIEW_FILE)];
|
||||
const shown = files.filter((file) => file.getBoundingClientRect().top <= top + 24).pop() || files[0];
|
||||
if (shown && Number(shown.dataset.index) !== ui.file) {
|
||||
markFile(Number(shown.dataset.index));
|
||||
}
|
||||
}
|
||||
|
||||
function branch(node, list) {
|
||||
@@ -105,7 +126,7 @@
|
||||
const [letter, tone] = FILE_STATUS[file.status] || ["?", "neutral"];
|
||||
items.push(h("li", {}, h("button", {
|
||||
type: "button", class: "file-entry", "data-index": index, "aria-current": index === ui.file ? "true" : null,
|
||||
title: file.old ? `${file.old} → ${file.path}` : file.path, on: {click: () => pick(index, list)},
|
||||
title: file.old ? `${file.old} → ${file.path}` : file.path, on: {click: () => pick(index)},
|
||||
}, h("span", {class: "letter", "data-tone": tone}, letter), h("span", {class: "name"}, name), stat(file))));
|
||||
}
|
||||
return h("ul", {class: "tree-list"}, items);
|
||||
@@ -135,15 +156,20 @@
|
||||
if (!Array.isArray(list) || !list.length) {
|
||||
return h("p", {class: "muted pad"}, list === "loading" ? "Loading changes …" : "No diff available.");
|
||||
}
|
||||
const file = list[Math.min(ui.file, list.length - 1)];
|
||||
const stack = h("div", {class: "review-stack"}, list.map((file, index) => reviewFile(file, index)));
|
||||
stack.addEventListener("scroll", () => followScroll(stack), {passive: true});
|
||||
return stack;
|
||||
}
|
||||
|
||||
function reviewFile(file, index) {
|
||||
const [letter, tone] = FILE_STATUS[file.status] || ["?", "neutral"];
|
||||
return h("div", {},
|
||||
h("div", {class: "diff-head"},
|
||||
return h("details", {class: "review-file", "data-index": index, open: index === ui.file},
|
||||
h("summary", {class: "diff-head"},
|
||||
h("span", {class: "letter", "data-tone": tone}, letter),
|
||||
h("code", {class: "path"}, file.old ? `${file.old} → ${file.path}` : file.path),
|
||||
file.tags.map((tag) => pill(tag, "neutral")),
|
||||
h("span", {class: "spacer"}),
|
||||
stat(file)),
|
||||
file.detail ? h("p", {class: "muted pad"}, file.detail) : null,
|
||||
file.lines.length ? h("div", {class: "diff-scroll"}, h("table", {class: "diff"}, h("tbody", {}, file.lines.map(diffRow)))) : null);
|
||||
file.lines.length ? h("div", {class: "diff-wide"}, h("table", {class: "diff"}, h("tbody", {}, file.lines.map(diffRow)))) : null);
|
||||
}
|
||||
@@ -95,6 +95,7 @@
|
||||
drawHierarchy(force);
|
||||
drawToolbar();
|
||||
drawInbox();
|
||||
drawGrant();
|
||||
drawRadio();
|
||||
drawTasks();
|
||||
drawMatch(false);
|
||||
|
||||
Reference in new issue
Block a user