@mrclrchtr/supi-review 7.3.1 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/README.md +10 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-agent-runtime/package.json +7 -3
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/api.ts +37 -1
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/run.ts +151 -21
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/session/agent-run-registry-types.ts +95 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/session/agent-run-registry.ts +372 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/session/transcript-format.ts +184 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/session/transcript-store.ts +284 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/types.ts +22 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-command.ts +206 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-overlay-data.ts +78 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-overlay-render.ts +167 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-overlay.ts +400 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-run-list.ts +95 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-run-switcher.ts +29 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-run-viewer-input.ts +69 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-run-viewer-render.ts +246 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-run-viewer.ts +400 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-run-viewport.ts +112 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-steering-input.ts +50 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-transcript-context.ts +56 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-transcript-pane.ts +386 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-transcript-payload.ts +66 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-transcript.ts +380 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/package.json +5 -5
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/package.json +4 -4
- package/src/review.ts +5 -2
- package/src/tool/review_run/child-session.ts +29 -7
- package/src/tool/review_run/execute.ts +6 -1
- package/src/tool/review_run/execution.ts +6 -0
- package/src/tool/review_run/register.ts +3 -1
- package/src/tool/review_run/runner.ts +40 -0
- package/src/tool/review_run/workflow.ts +7 -1
- package/src/tui/review-command.ts +74 -3
- package/src/types.ts +5 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
1
2
|
import {
|
|
2
3
|
type AgentRunProviderAuthority,
|
|
4
|
+
type AgentRunRegistry,
|
|
3
5
|
createUnobservedAgentRunDiagnostics,
|
|
4
6
|
} from "@mrclrchtr/supi-agent-runtime/api";
|
|
5
7
|
import { normalizeReviewInput } from "../../review-input.ts";
|
|
@@ -126,11 +128,13 @@ export async function executeReviewTasks(
|
|
|
126
128
|
providerAuthority?: AgentRunProviderAuthority,
|
|
127
129
|
recoveryModel?: ReviewModelSelection,
|
|
128
130
|
recoveryModelId?: string,
|
|
131
|
+
registry?: AgentRunRegistry,
|
|
129
132
|
): Promise<ReviewTaskResult[]> {
|
|
130
133
|
const review = normalizeReviewInput(reviewInput);
|
|
131
134
|
let completedCount = 0;
|
|
132
135
|
const totalCount = review.tasks.length;
|
|
133
136
|
const effectiveThinkingLevel = clampReviewThinkingLevel(model.model, reviewerThinkingLevel);
|
|
137
|
+
const runGroupId = randomUUID();
|
|
134
138
|
// Partial tool output is replaced repeatedly; retain the review context and task state for expanded views.
|
|
135
139
|
const presentation = {
|
|
136
140
|
targetTitle: snapshot.title,
|
|
@@ -191,11 +195,13 @@ export async function executeReviewTasks(
|
|
|
191
195
|
requestedThinkingLevel: reviewerThinkingLevel,
|
|
192
196
|
...(recoveryModel ? { recoveryModel } : {}),
|
|
193
197
|
...(recoveryModelId ? { recoveryModelId } : {}),
|
|
198
|
+
...(registry ? { registry } : {}),
|
|
194
199
|
providerAuthority,
|
|
195
200
|
projectTrusted,
|
|
196
201
|
...(audit ? { audit } : {}),
|
|
197
202
|
...(dependencyBootstrapConfigured ? { dependencyBootstrapConfigured } : {}),
|
|
198
203
|
signal,
|
|
204
|
+
runGroupId,
|
|
199
205
|
onProgress: (progress) => {
|
|
200
206
|
taskStates[task.id] = { status: "running", progress };
|
|
201
207
|
emitUpdate(onUpdate, {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { AgentRunRegistry } from "@mrclrchtr/supi-agent-runtime/api";
|
|
2
3
|
import type { LocalReviewAuditStore } from "../../audit/local-review-audit-store.ts";
|
|
3
4
|
import type { ReviewArtifactStore } from "../../session/review-artifact-store.ts";
|
|
4
5
|
import { makeRunReviewExecute } from "./execute.ts";
|
|
@@ -11,6 +12,7 @@ export function registerReviewRunTool(
|
|
|
11
12
|
pi: ExtensionAPI,
|
|
12
13
|
artifactStore: ReviewArtifactStore,
|
|
13
14
|
localAuditStore?: LocalReviewAuditStore,
|
|
15
|
+
registry?: AgentRunRegistry,
|
|
14
16
|
): void {
|
|
15
17
|
pi.registerTool({
|
|
16
18
|
...reviewRunSpec,
|
|
@@ -19,6 +21,6 @@ export function registerReviewRunTool(
|
|
|
19
21
|
promptGuidelines: [...promptGuidelines],
|
|
20
22
|
renderCall: renderRunCall,
|
|
21
23
|
renderResult: renderRunResult,
|
|
22
|
-
execute: makeRunReviewExecute(artifactStore, localAuditStore),
|
|
24
|
+
execute: makeRunReviewExecute(artifactStore, localAuditStore, registry),
|
|
23
25
|
});
|
|
24
26
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
1
2
|
import {
|
|
3
|
+
type AgentRunDisplayMetadata,
|
|
2
4
|
type AgentRunSessionView,
|
|
3
5
|
createEarlyCancellationDiagnostics,
|
|
4
6
|
} from "@mrclrchtr/supi-agent-runtime/api";
|
|
@@ -16,8 +18,30 @@ import type {
|
|
|
16
18
|
import { runIsolatedChild } from "./child-session.ts";
|
|
17
19
|
import { createReviewRecoveryDeclineTool, createReviewSubmissionTool } from "./child-tools.ts";
|
|
18
20
|
import { ReviewRecoveryPolicy } from "./recovery.ts";
|
|
21
|
+
import { normalizeReviewSubmission } from "./submission.ts";
|
|
19
22
|
import { buildReviewerSystemPrompt } from "./system-prompt.ts";
|
|
20
23
|
|
|
24
|
+
function reviewerRunDisplay(
|
|
25
|
+
invocation: ReviewerInvocation,
|
|
26
|
+
thinkingLevel: AgentRunDisplayMetadata["thinkingLevel"],
|
|
27
|
+
tools: readonly string[],
|
|
28
|
+
): AgentRunDisplayMetadata & { readonly runKey: string; readonly batchId: string } {
|
|
29
|
+
return {
|
|
30
|
+
runKey: randomUUID(),
|
|
31
|
+
batchId: invocation.runGroupId ?? randomUUID(),
|
|
32
|
+
taskId: invocation.task.id,
|
|
33
|
+
kind: "Reviewer",
|
|
34
|
+
label: `${invocation.task.mode} review`,
|
|
35
|
+
cwd: invocation.cwd,
|
|
36
|
+
modelId: invocation.model.canonicalId,
|
|
37
|
+
thinkingLevel,
|
|
38
|
+
tools,
|
|
39
|
+
taskDescription: `Inspection-only Review Task in ${invocation.task.mode} mode.`,
|
|
40
|
+
display: { target: invocation.snapshot.title },
|
|
41
|
+
startedAt: Date.now(),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
21
45
|
function auditOutcome(result: ReviewerRunResult): {
|
|
22
46
|
kind: string;
|
|
23
47
|
failureCode?: string;
|
|
@@ -89,8 +113,24 @@ export async function runReviewer(invocation: ReviewerInvocation): Promise<Revie
|
|
|
89
113
|
...(invocation.recoveryModel
|
|
90
114
|
? { authorizedContinuationModels: [invocation.recoveryModel.model] }
|
|
91
115
|
: {}),
|
|
116
|
+
...(invocation.registry ? { registry: invocation.registry } : {}),
|
|
92
117
|
headlessInspection: true,
|
|
93
118
|
projectTrusted: invocation.projectTrusted ?? false,
|
|
119
|
+
runDisplay: reviewerRunDisplay(invocation, effectiveThinkingLevel, originalTools),
|
|
120
|
+
displayResult: (result) => {
|
|
121
|
+
if (result.kind === "failed") return { failureCode: result.failureCode };
|
|
122
|
+
if (result.kind !== "success") return {};
|
|
123
|
+
const submission = normalizeReviewSubmission(result.value);
|
|
124
|
+
return {
|
|
125
|
+
finalText: submission.summary,
|
|
126
|
+
display: {
|
|
127
|
+
target: invocation.snapshot.title,
|
|
128
|
+
verdict: submission.verdict,
|
|
129
|
+
findingCount: submission.findingCounts.total,
|
|
130
|
+
blockingFindingCount: submission.findingCounts.blocking,
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
},
|
|
94
134
|
onSessionCreated: (created) => {
|
|
95
135
|
session = created;
|
|
96
136
|
if (invocation.audit) {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
// biome-ignore lint/style/noExcessiveLinesPerFile: Review Target and Workspace lifecycle remain in one workflow module.
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
AgentRunProviderAuthority,
|
|
4
|
+
AgentRunRegistry,
|
|
5
|
+
} from "@mrclrchtr/supi-agent-runtime/api";
|
|
3
6
|
import {
|
|
4
7
|
combineAgentRunUsage,
|
|
5
8
|
createEarlyCancellationDiagnostics,
|
|
@@ -75,6 +78,8 @@ export interface RunReviewInput {
|
|
|
75
78
|
projectTrusted?: boolean;
|
|
76
79
|
/** Present when local reviewer replay is enabled. */
|
|
77
80
|
auditStore?: LocalReviewAuditStore;
|
|
81
|
+
/** Registry for the Pi runtime that owns the Review request. */
|
|
82
|
+
registry?: AgentRunRegistry;
|
|
78
83
|
signal?: AbortSignal;
|
|
79
84
|
onUpdate?: OnUpdate;
|
|
80
85
|
}
|
|
@@ -395,6 +400,7 @@ export async function runReview(input: RunReviewInput) {
|
|
|
395
400
|
input.providerAuthority,
|
|
396
401
|
input.recoveryModel,
|
|
397
402
|
input.recoveryModelId,
|
|
403
|
+
input.registry,
|
|
398
404
|
);
|
|
399
405
|
} finally {
|
|
400
406
|
cleanupWarning = await workspace.cleanup();
|
|
@@ -3,8 +3,14 @@ import {
|
|
|
3
3
|
BorderedLoader,
|
|
4
4
|
buildSessionContext,
|
|
5
5
|
type ExtensionAPI,
|
|
6
|
+
type Theme,
|
|
6
7
|
} from "@earendil-works/pi-coding-agent";
|
|
7
|
-
import {
|
|
8
|
+
import { Container, Key, matchesKey, Spacer, Text } from "@earendil-works/pi-tui";
|
|
9
|
+
import {
|
|
10
|
+
type AgentRunRegistry,
|
|
11
|
+
createAgentRunProviderAuthority,
|
|
12
|
+
openAgentsViewer,
|
|
13
|
+
} from "@mrclrchtr/supi-agent-runtime/api";
|
|
8
14
|
import type { LocalReviewAuditStore } from "../audit/local-review-audit-store.ts";
|
|
9
15
|
import { loadReviewConfig } from "../config.ts";
|
|
10
16
|
import { collectPlannerContext } from "../history/collect.ts";
|
|
@@ -153,6 +159,56 @@ async function editReviewInteractive(
|
|
|
153
159
|
interface CancellableLoaderOptions {
|
|
154
160
|
/** Finish at once on Escape only when the operation has no cleanup work. */
|
|
155
161
|
finishOnAbort?: boolean;
|
|
162
|
+
/** Open the shared run viewer without stopping the current operation. */
|
|
163
|
+
openAgents?: () => Promise<void>;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
class ReviewRunLoader extends Container {
|
|
167
|
+
readonly #loader: BorderedLoader;
|
|
168
|
+
readonly #openAgents: () => Promise<void>;
|
|
169
|
+
readonly #onOpenError: (error: unknown) => void;
|
|
170
|
+
#openingAgents = false;
|
|
171
|
+
|
|
172
|
+
constructor(
|
|
173
|
+
loader: BorderedLoader,
|
|
174
|
+
theme: Theme,
|
|
175
|
+
openAgents: () => Promise<void>,
|
|
176
|
+
onOpenError: (error: unknown) => void,
|
|
177
|
+
) {
|
|
178
|
+
super();
|
|
179
|
+
this.#loader = loader;
|
|
180
|
+
this.#openAgents = openAgents;
|
|
181
|
+
this.#onOpenError = onOpenError;
|
|
182
|
+
this.addChild(loader);
|
|
183
|
+
this.addChild(new Spacer(1));
|
|
184
|
+
this.addChild(new Text(theme.fg("dim", "Ctrl+O opens /agents"), 1, 0));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
get signal(): AbortSignal {
|
|
188
|
+
return this.#loader.signal;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
set onAbort(handler: (() => void) | undefined) {
|
|
192
|
+
this.#loader.onAbort = handler;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
handleInput(data: string): void {
|
|
196
|
+
if (matchesKey(data, Key.ctrl("o"))) {
|
|
197
|
+
if (this.#openingAgents) return;
|
|
198
|
+
this.#openingAgents = true;
|
|
199
|
+
void this.#openAgents()
|
|
200
|
+
.catch(this.#onOpenError)
|
|
201
|
+
.finally(() => {
|
|
202
|
+
this.#openingAgents = false;
|
|
203
|
+
});
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
this.#loader.handleInput(data);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
dispose(): void {
|
|
210
|
+
this.#loader.dispose();
|
|
211
|
+
}
|
|
156
212
|
}
|
|
157
213
|
|
|
158
214
|
/** Run command-owned child work behind an Escape-cancellable Pi loader. */
|
|
@@ -164,6 +220,14 @@ async function withCancellableLoader<T>(
|
|
|
164
220
|
): Promise<T | undefined> {
|
|
165
221
|
return ctx.ui.custom<T | undefined>((tui, theme, _keybindings, done) => {
|
|
166
222
|
const loader = new BorderedLoader(tui, theme, message);
|
|
223
|
+
const component = options.openAgents
|
|
224
|
+
? new ReviewRunLoader(loader, theme, options.openAgents, (error) =>
|
|
225
|
+
ctx.ui.notify(
|
|
226
|
+
error instanceof Error ? error.message : "Could not open /agents.",
|
|
227
|
+
"error",
|
|
228
|
+
),
|
|
229
|
+
)
|
|
230
|
+
: loader;
|
|
167
231
|
let settled = false;
|
|
168
232
|
const finish = (value: T | undefined) => {
|
|
169
233
|
if (settled) return;
|
|
@@ -183,7 +247,7 @@ async function withCancellableLoader<T>(
|
|
|
183
247
|
finish(undefined);
|
|
184
248
|
},
|
|
185
249
|
);
|
|
186
|
-
return
|
|
250
|
+
return component;
|
|
187
251
|
});
|
|
188
252
|
}
|
|
189
253
|
|
|
@@ -257,6 +321,7 @@ async function draftInteractiveReview(
|
|
|
257
321
|
async function executeInteractiveReview(
|
|
258
322
|
ctx: CommandContext,
|
|
259
323
|
input: {
|
|
324
|
+
pi: ExtensionAPI;
|
|
260
325
|
target: ReviewTargetSpec;
|
|
261
326
|
review: ReviewInput;
|
|
262
327
|
scope: ReviewScope;
|
|
@@ -267,6 +332,7 @@ async function executeInteractiveReview(
|
|
|
267
332
|
planning?: PlanningRecord;
|
|
268
333
|
provenance: "caller-supplied" | "planner-assisted";
|
|
269
334
|
auditStore?: LocalReviewAuditStore;
|
|
335
|
+
registry?: AgentRunRegistry;
|
|
270
336
|
},
|
|
271
337
|
) {
|
|
272
338
|
const config = loadReviewConfig(ctx.cwd);
|
|
@@ -297,8 +363,10 @@ async function executeInteractiveReview(
|
|
|
297
363
|
bootstrapCommand: config.bootstrapCommand,
|
|
298
364
|
projectTrusted: ctx.isProjectTrusted(),
|
|
299
365
|
...(auditStore ? { auditStore } : {}),
|
|
366
|
+
...(input.registry ? { registry: input.registry } : {}),
|
|
300
367
|
signal,
|
|
301
368
|
}),
|
|
369
|
+
{ openAgents: () => openAgentsViewer(input.pi, ctx) },
|
|
302
370
|
);
|
|
303
371
|
}
|
|
304
372
|
|
|
@@ -306,6 +374,7 @@ interface ReviewCommandServices {
|
|
|
306
374
|
pi: ExtensionAPI;
|
|
307
375
|
artifactStore: ReviewArtifactStore;
|
|
308
376
|
auditStore: LocalReviewAuditStore;
|
|
377
|
+
registry?: AgentRunRegistry;
|
|
309
378
|
}
|
|
310
379
|
|
|
311
380
|
/** Select the target after Review Modes are edited. State batches never pass a before endpoint. */
|
|
@@ -322,7 +391,7 @@ export async function runReviewCommand(
|
|
|
322
391
|
ctx: CommandContext,
|
|
323
392
|
services: ReviewCommandServices,
|
|
324
393
|
): Promise<void> {
|
|
325
|
-
const { pi, artifactStore, auditStore } = services;
|
|
394
|
+
const { pi, artifactStore, auditStore, registry } = services;
|
|
326
395
|
if (!ctx.hasUI) return;
|
|
327
396
|
let selectedTarget: InteractiveTarget | undefined;
|
|
328
397
|
try {
|
|
@@ -403,6 +472,7 @@ export async function runReviewCommand(
|
|
|
403
472
|
);
|
|
404
473
|
if (!approved) return;
|
|
405
474
|
const outcome = await executeInteractiveReview(ctx, {
|
|
475
|
+
pi,
|
|
406
476
|
target,
|
|
407
477
|
review: edited,
|
|
408
478
|
scope,
|
|
@@ -413,6 +483,7 @@ export async function runReviewCommand(
|
|
|
413
483
|
...(usePlannerDraft && plannerDraft ? { planning: plannerDraft.planning } : {}),
|
|
414
484
|
provenance: usePlannerDraft ? "planner-assisted" : "caller-supplied",
|
|
415
485
|
auditStore,
|
|
486
|
+
...(registry ? { registry } : {}),
|
|
416
487
|
});
|
|
417
488
|
if (!outcome) return;
|
|
418
489
|
if (outcome.kind !== "completed") {
|
package/src/types.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Model, ModelThinkingLevel, Usage } from "@earendil-works/pi-ai";
|
|
|
2
2
|
import type {
|
|
3
3
|
AgentRunDiagnostics,
|
|
4
4
|
AgentRunProviderAuthority,
|
|
5
|
+
AgentRunRegistry,
|
|
5
6
|
} from "@mrclrchtr/supi-agent-runtime/api";
|
|
6
7
|
import type { LocalReviewAuditStore } from "./audit/local-review-audit-store.ts";
|
|
7
8
|
import type { ReviewThinkingLevel } from "./thinking.ts";
|
|
@@ -278,6 +279,10 @@ export interface ReviewerInvocation {
|
|
|
278
279
|
signal?: AbortSignal;
|
|
279
280
|
projectTrusted?: boolean;
|
|
280
281
|
onProgress?: (progress: ReviewProgress) => void;
|
|
282
|
+
/** Shared viewer group for the independent Reviewer Sessions in one Review. */
|
|
283
|
+
runGroupId?: string;
|
|
284
|
+
/** Registry for the Pi runtime that owns this Reviewer. */
|
|
285
|
+
registry?: AgentRunRegistry;
|
|
281
286
|
}
|
|
282
287
|
|
|
283
288
|
export type ReviewerExtensionSetStatus = "active" | "degraded" | "unobserved";
|