Tighten review format, badge finding counts, add per-finding fix button

This commit is contained in:
Ian Gulliver
2026-10-15 18:34:12 -07:00
parent 514a2580f7
commit c7f19f2537
12 changed files with 183 additions and 45 deletions
+19 -3
View File
@@ -2,7 +2,7 @@ import { get, post, type AgentSession, type ByreEvent, type Participant, type Sc
import { ago, copyable, errorText, h, replace, showAlert, showConfirm } from "./dom.js";
import { markdown } from "./markdown.js";
import { previewURL } from "./preview.js";
import { reviewCounts } from "./reviews.js";
import { findingCount, reviewCounts } from "./reviews.js";
import { currentSession, findTask, focusTab, focusTask, onEach, pinSnapshot, setFocus, showReview, state, type Topic } from "./state.js";
import { taskStyle } from "./taskcolor.js";
@@ -68,6 +68,7 @@ type Ctx = {
tools: Map<string, HTMLElement>;
subagents: Map<string, Subagent>;
reviewers: Set<string>;
reviewButtons: Map<number, HTMLElement>;
run: Run | undefined;
root: () => string;
taskId: string | undefined;
@@ -251,6 +252,7 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
tools: new Map(),
subagents: new Map(),
reviewers: new Set(),
reviewButtons: new Map(),
run: undefined,
lastMessage: undefined,
held: undefined,
@@ -479,9 +481,16 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
}
if (ev.kind === "snapshot.created") {
ctx.run = undefined;
put(snapRow(p as unknown as Snapshot, ctx.taskId));
put(snapRow(p as unknown as Snapshot, ctx));
continue;
}
if (ev.kind === "review.finished") {
const r = p as unknown as Review;
const button = ctx.reviewButtons.get(r.snapshot_n);
if (button) {
markFindings(button, findingCount(r));
}
}
if (ev.kind === "agent.tool_call" && isSubagentCall(p)) {
ctx.run = undefined;
put(renderSubagent(p, ctx));
@@ -888,7 +897,13 @@ function claudeTaskStatus(p: Record<string, unknown>, ctx: Ctx): void {
}
}
function snapRow(snap: Snapshot, taskId: string | undefined): HTMLElement {
function markFindings(button: HTMLElement, n: number): void {
replace(button, "review", n > 0 && h("span", { class: "badge", title: `${n} findings` }, n));
button.classList.toggle("attention", n > 0);
}
function snapRow(snap: Snapshot, ctx: Ctx): HTMLElement {
const taskId = ctx.taskId;
const changes = h("button", { type: "button", title: `Show snapshot ${snap.n} in the Changes tab` }, "changes");
changes.onclick = () => {
pinSnapshot(snap.n);
@@ -910,6 +925,7 @@ function snapRow(snap: Snapshot, taskId: string | undefined): HTMLElement {
};
const review = h("button", { type: "button", title: `Show the review of snapshot ${snap.n} in the Reviews tab` }, "review");
review.onclick = () => showReview(snap.n);
ctx.reviewButtons.set(snap.n, review);
const time = new Date(snap.created_at).toLocaleTimeString([], { hour12: false });
return h("div", { class: "snap-row", title: `${snap.trigger.replace("_", " ")} · ${time}` }, `snapshot #${snap.n}`, changes, fork, review);
}