Review every new snapshot with an agent from the other vendor
This commit is contained in:
+22
-2
@@ -1,12 +1,15 @@
|
||||
import { get, post, type AgentSession, type ByreEvent, type Participant, type Snapshot } from "./api.js";
|
||||
import { get, post, type AgentSession, type ByreEvent, type Participant, type Schemas, type Snapshot } from "./api.js";
|
||||
import { ago, errorText, h, replace, showAlert, showConfirm } from "./dom.js";
|
||||
import { markdown } from "./markdown.js";
|
||||
import { previewURL } from "./preview.js";
|
||||
import { reviewCounts } from "./reviews.js";
|
||||
import { currentSession, findTask, focusTab, focusTask, onEach, pinSnapshot, setFocus, state, type Topic } from "./state.js";
|
||||
import { taskStyle } from "./taskcolor.js";
|
||||
|
||||
export type Usage = { used: number; window: number; model: string };
|
||||
|
||||
type Review = Schemas["Review"];
|
||||
|
||||
export type ChatSource = {
|
||||
key: () => string | undefined;
|
||||
events: () => ByreEvent[];
|
||||
@@ -64,6 +67,7 @@ type Subagent = {
|
||||
type Ctx = {
|
||||
tools: Map<string, HTMLElement>;
|
||||
subagents: Map<string, Subagent>;
|
||||
reviewers: Set<string>;
|
||||
run: Run | undefined;
|
||||
root: () => string;
|
||||
taskId: string | undefined;
|
||||
@@ -245,6 +249,7 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
|
||||
const newCtx = (): Ctx => ({
|
||||
tools: new Map(),
|
||||
subagents: new Map(),
|
||||
reviewers: new Set(),
|
||||
run: undefined,
|
||||
lastMessage: undefined,
|
||||
held: undefined,
|
||||
@@ -398,7 +403,7 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
|
||||
stream = undefined;
|
||||
};
|
||||
const appendDelta = (ev: ByreEvent) => {
|
||||
if (ctx.handoff) {
|
||||
if (ctx.handoff || (ev.agent_session_id && ctx.reviewers.has(ev.agent_session_id))) {
|
||||
return;
|
||||
}
|
||||
if (!stream) {
|
||||
@@ -447,6 +452,13 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
|
||||
for (const ev of events) {
|
||||
const p = ev.payload as Record<string, unknown>;
|
||||
const parent = parentOf(p);
|
||||
if (ev.kind === "session.created" && p["role"] === "reviewer" && ev.agent_session_id) {
|
||||
ctx.reviewers.add(ev.agent_session_id);
|
||||
continue;
|
||||
}
|
||||
if (ev.agent_session_id && ctx.reviewers.has(ev.agent_session_id)) {
|
||||
continue;
|
||||
}
|
||||
if (ev.kind === "agent.vendor") {
|
||||
claudeTaskStatus(p, ctx);
|
||||
continue;
|
||||
@@ -1038,6 +1050,14 @@ function renderEvent(ev: ByreEvent, ctx: Ctx): HTMLElement | null {
|
||||
case "task.merge_title":
|
||||
return h("div", { class: "note" }, `${ev.actor} set the merge commit title to "${String(p["merge_title"])}" `, when);
|
||||
|
||||
case "review.finished": {
|
||||
const r = p as unknown as Review;
|
||||
const open = h("button", { type: "button", title: "Show the task's reviews" }, "reviews");
|
||||
open.onclick = () => focusTab("reviews");
|
||||
const outcome = r.state === "failed" ? `failed: ${r.error}` : reviewCounts(r);
|
||||
return h("div", { class: `note${r.state === "failed" ? " error" : ""}` }, `review of snapshot #${r.snapshot_n}: ${outcome} `, when, " ", open);
|
||||
}
|
||||
|
||||
case "task.merge_queued":
|
||||
return h("div", { class: "note" }, `${ev.actor} asked to merge; held until the merge in progress in this project is done `, when);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user