opencode-swarm 7.74.3 → 7.75.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.
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Reviewer receipt collector (auto-review machinery, piece A).
3
+ *
4
+ * Parses the mandated reviewer OUTPUT FORMAT (`VERDICT:` / `RISK:` /
5
+ * `ISSUES:` / `FIXES:`) from a returning reviewer Task delegation and
6
+ * persists it as a durable review receipt under `.swarm/review-receipts/`
7
+ * via the existing receipt store (scope-fingerprinted over the delegation
8
+ * prompt, which defines the reviewed scope).
9
+ *
10
+ * Before this collector, reviewer verdicts existed only as free text inside
11
+ * the architect's context — re-reviews and drift verification had no durable
12
+ * machine-readable record of what the reviewer decided. Knowledge-directive
13
+ * lines (`DIRECTIVE_COMPLIANCE`) are handled separately by
14
+ * `reviewer-verdict-parser.ts`; this module covers the main verdict block.
15
+ *
16
+ * Fail-open: parsing or persistence failures never block tool execution.
17
+ */
18
+ export type ParsedReviewSeverity = 'critical' | 'high' | 'medium';
19
+ export interface ParsedReviewIssue {
20
+ /** Raw issue line (trimmed, bullet stripped) */
21
+ text: string;
22
+ /** Severity inferred from a CRITICAL/HIGH/MEDIUM/LOW/INFO tag, default medium */
23
+ severity: ParsedReviewSeverity;
24
+ /** `path:line` reference when one appears in the line */
25
+ location?: string;
26
+ }
27
+ export interface ParsedReviewerOutput {
28
+ verdict: 'approved' | 'rejected';
29
+ /** RISK: LOW | MEDIUM | HIGH | CRITICAL (uppercased), when present */
30
+ risk?: string;
31
+ /** Blocking/non-blocking issue lines from the ISSUES section */
32
+ issues: ParsedReviewIssue[];
33
+ /** Required-change lines from the FIXES section */
34
+ fixes: string[];
35
+ }
36
+ /**
37
+ * Parse the reviewer agent's mandated output block. Returns null when no
38
+ * unambiguous line-anchored `VERDICT: APPROVED|REJECTED` is present —
39
+ * including when multiple anchored verdict lines DISAGREE (ambiguous output
40
+ * fails toward "no machine-readable verdict", never toward approval).
41
+ */
42
+ export declare function parseReviewerOutput(text: string): ParsedReviewerOutput | null;
43
+ export interface ReviewerReceiptInput {
44
+ tool: unknown;
45
+ args?: unknown;
46
+ sessionID?: unknown;
47
+ }
48
+ export interface ReviewerReceiptOutput {
49
+ output?: unknown;
50
+ }
51
+ /**
52
+ * `tool.execute.after` collector. When a reviewer Task returns, parse its
53
+ * verdict block and persist a durable review receipt. No-op for non-reviewer
54
+ * delegations, missing prompts/outputs, or unparseable verdicts. Never throws.
55
+ *
56
+ * Returns the persisted receipt path (for tests/telemetry) or null.
57
+ */
58
+ export declare function collectReviewerReceiptAfter(directory: string, input: ReviewerReceiptInput, output: ReviewerReceiptOutput): Promise<string | null>;
@@ -20,6 +20,13 @@
20
20
  *
21
21
  * Critic drift verification can consume prior receipts as supporting context
22
22
  * but MUST NOT blindly trust them — staleness check is mandatory.
23
+ *
24
+ * Scope-description heterogeneity: receipts in one index may be fingerprinted
25
+ * over different canonical contents (e.g. 'reviewer-task-prompt' hashes the
26
+ * delegation prompt; 'auto-review-*-diff' hashes the reviewed diff). A prompt
27
+ * fingerprint does NOT change when the worktree changes, so consumers MUST
28
+ * filter by `scope_fingerprint.scope_description` (or compare like-for-like
29
+ * content) before treating an approved receipt as fresh via isScopeStale().
23
30
  */
24
31
  export type ReceiptVerdict = 'rejected' | 'approved';
25
32
  /** Identity of the reviewer/curator that produced the receipt. */