@mrclrchtr/supi-review 1.11.0 → 1.11.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-core",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "SuPi core — shared infrastructure for SuPi extensions (XML context tags, config system)",
5
5
  "license": "MIT",
6
6
  "repository": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-review",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "SuPi Review extension — structured code review via /supi-review command",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -20,7 +20,7 @@
20
20
  "README.md"
21
21
  ],
22
22
  "dependencies": {
23
- "@mrclrchtr/supi-core": "1.11.0"
23
+ "@mrclrchtr/supi-core": "1.11.1"
24
24
  },
25
25
  "bundledDependencies": [
26
26
  "@mrclrchtr/supi-core"
@@ -94,6 +94,9 @@ export function buildReviewPacket(
94
94
  "These tools are scoped to the snapshot's changed-files list — request a file from the manifest above.",
95
95
  "",
96
96
  "Combine snapshot inspection with read/grep/find/ls for broader codebase context.",
97
+ "",
98
+ "## Delivery",
99
+ "Call **submit_review** to submit your review.",
97
100
  );
98
101
 
99
102
  const includedFiles = snapshot.changedFiles.filter((f) => !classifySkipCategory(f));
@@ -18,6 +18,8 @@ const GRACE_TURNS = 3;
18
18
  const RECENT_EVENTS_MAX = 10;
19
19
  const LAST_ASSISTANT_TEXT_DEBUG_MAX = 2_000;
20
20
  const STEER_MESSAGE = "Time limit reached. Wrap up and submit your review now.";
21
+ const STEER_SUBMIT_MESSAGE =
22
+ "You stopped without calling submit_review. Call submit_review now with your findings.";
21
23
 
22
24
  /** Maps tool names to human-readable activity descriptions. */
23
25
  function toolNameToActivity(name: string, phase: "start" | "end"): string {
@@ -61,6 +63,8 @@ export function buildReviewerSystemPrompt(): string {
61
63
  "and a concrete list of changed files. Use the prompt packet as the primary brief,",
62
64
  "then inspect code with the available read-only tools before drawing conclusions.",
63
65
  "",
66
+ "CRITICAL: Call submit_review to deliver results. Never output review text directly.",
67
+ "",
64
68
  "--- Guardrails ---",
65
69
  "- You have read-only tools only. Do NOT modify files or propose running write/edit/bash commands.",
66
70
  "",
@@ -159,7 +163,7 @@ export function buildReviewerSystemPrompt(): string {
159
163
  "- Focus on application source and test code.",
160
164
  "",
161
165
  "--- Output ---",
162
- "Do NOT output JSON directly — call submit_review with the structured result.",
166
+ "Call submit_review. Never output review text directly.",
163
167
  ].join("\n");
164
168
  }
165
169
 
@@ -347,6 +351,7 @@ interface RunnerContext {
347
351
  resultHolder: { value: ReviewOutputEvent | undefined };
348
352
  signal?: AbortSignal;
349
353
  state: { settled: boolean };
354
+ submitSteered: boolean;
350
355
  timeout: { steered: boolean; graceTurnsRemaining: number | undefined; aborting?: boolean };
351
356
  debug: { recentEvents: string[] };
352
357
  }
@@ -411,6 +416,19 @@ function handleToolEnd(
411
416
  emitProgress(ctx);
412
417
  }
413
418
 
419
+ function handleMessageEnd(
420
+ event: Extract<AgentSessionEvent, { type: "message_end" }>,
421
+ ctx: RunnerContext,
422
+ ): void {
423
+ if (ctx.state.settled || ctx.submitSteered || ctx.resultHolder.value) return;
424
+
425
+ const msg = event.message as { role?: string; stopReason?: string };
426
+ if (msg.role !== "assistant" || msg.stopReason !== "stop") return;
427
+
428
+ ctx.submitSteered = true;
429
+ ctx.session.steer(STEER_SUBMIT_MESSAGE).catch(() => {});
430
+ }
431
+
414
432
  function handleAgentEnd(
415
433
  event: Extract<AgentSessionEvent, { type: "agent_end" }>,
416
434
  ctx: RunnerContext,
@@ -460,6 +478,10 @@ function handleSessionEvent(event: AgentSessionEvent, ctx: RunnerContext): void
460
478
  case "tool_execution_end":
461
479
  handleToolEnd(event, ctx);
462
480
  break;
481
+ case "message_end": {
482
+ handleMessageEnd(event, ctx);
483
+ break;
484
+ }
463
485
  case "agent_end":
464
486
  handleAgentEnd(event, ctx);
465
487
  break;
@@ -543,6 +565,7 @@ export async function runReviewer(invocation: ReviewInvocation): Promise<RawRevi
543
565
  resultHolder,
544
566
  signal: invocation.signal,
545
567
  state,
568
+ submitSteered: false,
546
569
  timeout: timeoutRef,
547
570
  debug: { recentEvents: [] },
548
571
  };