Tighten review format, badge finding counts, add per-finding fix button
This commit is contained in:
Vendored
+17
-3
@@ -2,7 +2,7 @@ import { get, post } from "./api.js";
|
||||
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 } from "./state.js";
|
||||
import { taskStyle } from "./taskcolor.js";
|
||||
export const models = [
|
||||
@@ -179,6 +179,7 @@ export function mountChat(root, src, makeHead) {
|
||||
tools: new Map(),
|
||||
subagents: new Map(),
|
||||
reviewers: new Set(),
|
||||
reviewButtons: new Map(),
|
||||
run: undefined,
|
||||
lastMessage: undefined,
|
||||
held: undefined,
|
||||
@@ -396,9 +397,16 @@ export function mountChat(root, src, makeHead) {
|
||||
}
|
||||
if (ev.kind === "snapshot.created") {
|
||||
ctx.run = undefined;
|
||||
put(snapRow(p, ctx.taskId));
|
||||
put(snapRow(p, ctx));
|
||||
continue;
|
||||
}
|
||||
if (ev.kind === "review.finished") {
|
||||
const r = p;
|
||||
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));
|
||||
@@ -755,7 +763,12 @@ function claudeTaskStatus(p, ctx) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
function snapRow(snap, taskId) {
|
||||
function markFindings(button, n) {
|
||||
replace(button, "review", n > 0 && h("span", { class: "badge", title: `${n} findings` }, n));
|
||||
button.classList.toggle("attention", n > 0);
|
||||
}
|
||||
function snapRow(snap, ctx) {
|
||||
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);
|
||||
@@ -778,6 +791,7 @@ function snapRow(snap, taskId) {
|
||||
};
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user