@wrongstack/core 0.305.1 → 0.306.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.
Files changed (38) hide show
  1. package/dist/coordination/agents/index.js +3 -2
  2. package/dist/coordination/agents/types.d.ts +1 -1
  3. package/dist/coordination/index.js +3 -2
  4. package/dist/core/index.d.ts +2 -1
  5. package/dist/core/index.js +2764 -2632
  6. package/dist/core/system-prompt-blocks.d.ts +1 -1
  7. package/dist/core/system-prompt-builder.d.ts +7 -1
  8. package/dist/core/system-prompt-glossary.d.ts +0 -23
  9. package/dist/defaults/index.js +3 -2
  10. package/dist/execution/index.js +3 -2
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.js +875 -530
  13. package/dist/observability/index.js +7 -3
  14. package/dist/plugin/index.d.ts +4 -3
  15. package/dist/plugin/index.js +589 -143
  16. package/dist/plugins/auto-review-plugin.d.ts +14 -7
  17. package/dist/plugins/chimera-plugin.d.ts +15 -1
  18. package/dist/plugins/review-finding-integration.d.ts +15 -3
  19. package/dist/plugins/review-finding-parser.d.ts +36 -0
  20. package/dist/plugins/review-finding-types.d.ts +46 -0
  21. package/dist/plugins/review-finding-verification.d.ts +53 -0
  22. package/dist/plugins/review-report-integration.d.ts +1 -0
  23. package/dist/plugins/review-report-store.d.ts +7 -0
  24. package/dist/plugins/review-report-types.d.ts +14 -0
  25. package/dist/plugins/review-types.d.ts +74 -0
  26. package/dist/replay/replay-provider-runner.d.ts +5 -4
  27. package/dist/tools/fallback-manage-tool-options.d.ts +9 -0
  28. package/dist/tools/index.js +91 -38
  29. package/dist/tools/one-shot-llm-tool.d.ts +6 -0
  30. package/dist/types/blocks.d.ts +10 -0
  31. package/dist/utils/index.js +8 -9
  32. package/instructions/agents/browser.md +1 -0
  33. package/instructions/agents/e2e.md +2 -0
  34. package/instructions/llm/chimera-review.md +52 -1
  35. package/instructions/system-lite.md +17 -6
  36. package/instructions/system-pro.md +25 -20
  37. package/instructions/system.md +25 -12
  38. package/package.json +3 -3
@@ -2,6 +2,7 @@ import type { ProviderModelStatusTracker } from '../coordination/provider-status
2
2
  import type { Config } from '../types/config.js';
3
3
  import type { Plugin } from '../types/plugin.js';
4
4
  import type { CascadeAgentKind } from './chimera-plugin.js';
5
+ import type { ChimeraFinding } from './review-finding-types.js';
5
6
  export interface AutoReviewConfig {
6
7
  enabled?: boolean | undefined;
7
8
  /** Provider for review subagents. Falls back to session provider. */
@@ -108,20 +109,26 @@ export interface ParsedSeverities {
108
109
  high: number;
109
110
  medium: number;
110
111
  }
112
+ /**
113
+ * Count verified findings into the severity shape `shouldCascade` expects.
114
+ * Used by the P0-2 cascade gate: only disk-verified findings count toward
115
+ * the cascade threshold when a parsed report is available.
116
+ */
117
+ export declare function severitiesFromFindings(findings: readonly ChimeraFinding[]): ParsedSeverities;
111
118
  /** Parse report counts for clean-vs-actionable classification. */
112
119
  export declare function parseReviewSeverity(text: string): ParsedSeverities;
113
120
  /**
114
- * Decide which follow-up cascade agents to spawn based on the review text.
121
+ * Decide which follow-up cascade agents to spawn based on the review.
115
122
  *
116
- * - `security-scanner` is selected when any Critical/High finding mentions
117
- * a security keyword (injection, secret, XSS, etc.).
118
- * - `bug-hunter` is selected whenever the threshold is crossed at all
119
- * any High+ finding warrants a focused bug hunt.
123
+ * When structured, disk-verified findings are supplied (P0-1/P0-2), routing
124
+ * uses the finding's `category` tag: `security` selects security-scanner,
125
+ * and any High+ finding selects bug-hunter. The legacy keyword scan on the
126
+ * report text remains the fallback for reports without structured findings.
120
127
  *
121
- * Both may be returned in parallel when a finding is both severe and
128
+ * Both agents may be returned in parallel when a finding is both severe and
122
129
  * security-related.
123
130
  */
124
- export declare function decideCascadeAgents(text: string, severities: ParsedSeverities): CascadeAgentKind[];
131
+ export declare function decideCascadeAgents(text: string, severities: ParsedSeverities, findings?: readonly ChimeraFinding[] | undefined): CascadeAgentKind[];
125
132
  /**
126
133
  * Determine whether a review result should trigger a cascade, given the
127
134
  * configured threshold and parsed severities. Returns the crossed
@@ -1,6 +1,6 @@
1
1
  import type { Plugin } from '../types/plugin.js';
2
2
  import type { ResolvedChimeraConfig } from './review-types.js';
3
- export type { CascadeAgentKind, ChimeraCascadeNeededPayload, ChimeraReviewCompletePayload, ChimeraReviewNeededPayload, ResolvedChimeraConfig, ReviewContextBundle, ReviewFileEntry, } from './review-types.js';
3
+ export type { CascadeAgentKind, CascadeEvidenceCheckResult, CascadeEvidenceStatus, ChimeraCascadeNeededPayload, ChimeraReviewCompletePayload, ChimeraReviewNeededPayload, ResolvedChimeraConfig, ReviewContextBundle, ReviewFileEntry, } from './review-types.js';
4
4
  interface ChimeraConfig {
5
5
  enabled?: boolean | undefined;
6
6
  provider?: string | undefined;
@@ -26,6 +26,20 @@ interface ChimeraConfig {
26
26
  * re-check). Mirrors the auto-review plugin's maxCascadeDepth.
27
27
  */
28
28
  maxCascadeDepth?: number | undefined;
29
+ /**
30
+ * Chimera-specific fallback model chain (`provider/model` refs). When set,
31
+ * the reviewer subagent uses these models as its in-request fallback chain
32
+ * instead of inheriting the session-level fallback profile. Example:
33
+ * `["openai/gpt-4o", "anthropic/claude-sonnet-4-20250514"]`.
34
+ */
35
+ fallbackModels?: string[] | undefined;
36
+ /**
37
+ * Named fallback profile to use for Chimera reviews. When set, the reviewer
38
+ * spawn resolves this profile's chain from config and uses it as the
39
+ * fallback ladder. Takes precedence over the session-level fallback profile
40
+ * for Chimera spawns only.
41
+ */
42
+ fallbackProfile?: string | undefined;
29
43
  /**
30
44
  * @deprecated Removed. The subagent's `Request.maxTokens` now defaults to
31
45
  * the provider's `capabilities.maxOutput`, so Chimera reports can run up
@@ -6,7 +6,17 @@
6
6
  *
7
7
  * @module review-finding-integration
8
8
  */
9
- import type { ChimeraReviewCompletePayload } from './review-types.js';
9
+ import type { ChimeraReviewCompletePayload, ReviewContextBundle } from './review-types.js';
10
+ import type { FindingSource } from './review-finding-types.js';
11
+ /**
12
+ * Classify the review source from the payload bundle.
13
+ *
14
+ * Shared by finding integration and report integration so the two stores
15
+ * always agree on how a review is labeled. Mirrors the historical logic:
16
+ * cascadeDepth > 0 → 'cascade'; cascadeOn configured (not 'off') → 'auto';
17
+ * otherwise the post-session/manual Chimera plugin → 'chimera'.
18
+ */
19
+ export declare function classifyChimeraReviewSource(bundle: ReviewContextBundle): FindingSource;
10
20
  /**
11
21
  * Result of a findings integration run.
12
22
  */
@@ -28,8 +38,10 @@ export interface FindingsIntegrationResult {
28
38
  * Integrate findings from a completed Chimera review into the
29
39
  * project's finding store.
30
40
  *
31
- * Parses the review report text, upserts all findings, and
32
- * returns a summary.
41
+ * Uses the execution owner's pre-parsed findings (P0-1) when present so the
42
+ * report is never re-parsed with a divergent context; falls back to parsing
43
+ * `payload.reviewText` for legacy emitters. Upserts all findings and returns
44
+ * a summary.
33
45
  */
34
46
  export declare function integrateFindings(payload: ChimeraReviewCompletePayload, projectDir: string, reportId: string): Promise<FindingsIntegrationResult>;
35
47
  //# sourceMappingURL=review-finding-integration.d.ts.map
@@ -26,7 +26,43 @@ export interface ParsedReviewReport {
26
26
  unparseableCount: number;
27
27
  /** Total time for the review, extracted from "Duration: Xs" line. */
28
28
  durationSeconds?: number | undefined;
29
+ /**
30
+ * True when the findings came from the structured JSON contract (P0-1)
31
+ * rather than the legacy markdown heuristics. When false, findings are
32
+ * recovered from `### Severity (N)` headings + numbered list items and
33
+ * carry no `category`/`confidence`.
34
+ */
35
+ structured?: boolean | undefined;
29
36
  }
37
+ /**
38
+ * One finding item from the structured JSON contract appended by the
39
+ * reviewer to the end of the markdown report (P0-1).
40
+ */
41
+ export interface StructuredFindingItem {
42
+ severity: string;
43
+ file?: string | undefined;
44
+ line?: number | undefined;
45
+ category?: string | undefined;
46
+ confidence?: string | undefined;
47
+ title: string;
48
+ description?: string | undefined;
49
+ suggestedFix?: string | undefined;
50
+ }
51
+ /**
52
+ * The parsed fenced JSON block: a `findings` array plus optional metadata.
53
+ */
54
+ export interface StructuredFindingsBlock {
55
+ findings: StructuredFindingItem[];
56
+ durationSeconds?: number | undefined;
57
+ }
58
+ /**
59
+ * Extract the structured findings JSON block from a report. Returns the
60
+ * LAST fenced block that parses as JSON and carries a `findings` array —
61
+ * the reviewer is instructed to append exactly one such block, so the last
62
+ * one wins when earlier blocks are examples or stray prose. Returns `null`
63
+ * when no parseable block exists (legacy markdown-only reports).
64
+ */
65
+ export declare function extractStructuredFindingsBlock(reportText: string): StructuredFindingsBlock | null;
30
66
  /**
31
67
  * Parse a Chimera review report text into structured findings.
32
68
  *
@@ -26,6 +26,36 @@ export type ResolutionOutcome = 'fixed' | 'wontfix' | 'duplicate' | 'false_posit
26
26
  export type FindingSource = 'auto' | 'chimera' | 'cascade' | 'security-scanner';
27
27
  /** What kind of actor performed a lifecycle transition. */
28
28
  export type ActorKind = 'agent' | 'operator' | 'system';
29
+ /**
30
+ * What kind of defect a finding describes. The reviewer tags every finding
31
+ * with one of these in the structured JSON contract (P0-1); cascade routing
32
+ * prefers the tag over keyword heuristics (P1-6).
33
+ */
34
+ export type FindingCategory = 'bug' | 'security' | 'performance' | 'type' | 'contract' | 'test' | 'other';
35
+ /** How confident the reviewer is that the finding is real. */
36
+ export type FindingConfidence = 'high' | 'medium' | 'low';
37
+ /** Whether the deterministic disk-verification pass confirmed the finding. */
38
+ export type FindingVerificationStatus = 'verified' | 'failed' | 'unverified';
39
+ /**
40
+ * Result of the P0-2 disk-verification pass. Attached by the execution owner
41
+ * AFTER parsing, BEFORE persistence and cascade gating:
42
+ *
43
+ * - `verified` — the cited file exists, the cited line is in range, and a
44
+ * code anchor extracted from the finding appears at/near that line.
45
+ * - `failed` — the citation is provably wrong (file missing, line out of
46
+ * range, or the path escapes the workspace).
47
+ * - `unverified` — could not confirm either way (no location, no line, or
48
+ * no anchor found near the cited line).
49
+ *
50
+ * Only `verified` findings are actionable: they are counted in the mailbox
51
+ * message and may trigger a cascade.
52
+ */
53
+ export interface FindingVerification {
54
+ status: FindingVerificationStatus;
55
+ reason: 'no_line' | 'file_missing' | 'unreadable' | 'outside_workspace' | 'line_out_of_range' | 'anchor_found' | 'no_anchor' | 'anchor_not_found';
56
+ /** The matched source line (trimmed), when the anchor was found. */
57
+ evidence?: string | undefined;
58
+ }
29
59
  export interface ChimeraFindingLocation {
30
60
  /** Project-relative file path. */
31
61
  file: string;
@@ -62,6 +92,22 @@ export interface ChimeraFinding {
62
92
  source: FindingSource;
63
93
  /** Where the issue was found. */
64
94
  location?: ChimeraFindingLocation | undefined;
95
+ /**
96
+ * Defect category from the structured JSON contract. Absent for findings
97
+ * recovered from the legacy markdown path (no JSON block in the report).
98
+ */
99
+ category?: FindingCategory | undefined;
100
+ /**
101
+ * Reviewer confidence, from the structured JSON contract. Absent for
102
+ * findings recovered from the legacy markdown path.
103
+ */
104
+ confidence?: FindingConfidence | undefined;
105
+ /**
106
+ * Result of the P0-2 disk-verification pass. Absent when the execution
107
+ * owner did not verify the report (legacy emitters) or for findings
108
+ * without any citation.
109
+ */
110
+ verification?: FindingVerification | undefined;
65
111
  /** One-line title extracted from the report item. */
66
112
  title: string;
67
113
  /** Full description paragraphs. */
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Chimera finding disk-verification pass (P0-2).
3
+ *
4
+ * A review finding is only as good as its citation. Before a finding is
5
+ * persisted and before it can gate a cascade, the execution owner runs this
6
+ * deterministic pass against the actual working tree:
7
+ *
8
+ * 1. the cited file must exist inside the workspace;
9
+ * 2. the cited line must be in range for that file;
10
+ * 3. a code anchor extracted from the finding's title/description must
11
+ * appear at or near the cited line.
12
+ *
13
+ * This is deliberately NOT semantic verification — it does not judge whether
14
+ * the claim is correct, only whether the citation is real. It catches the
15
+ * gross phantom-finding classes cheaply: files that do not exist, line
16
+ * numbers past EOF, and lines that have nothing to do with the claim.
17
+ *
18
+ * @module review-finding-verification
19
+ */
20
+ import type { ChimeraFinding } from './review-finding-types.js';
21
+ export interface VerifyFindingsOptions {
22
+ /** Workspace root the reviewer cited against. */
23
+ cwd: string;
24
+ /**
25
+ * Lines around the cited line to search for the code anchor.
26
+ * Default 2 (i.e. the cited line plus 2 above and 2 below).
27
+ */
28
+ anchorWindow?: number | undefined;
29
+ }
30
+ /**
31
+ * Extract the most distinctive code identifier from a finding's
32
+ * title + description. Prefers camelCase / snake_case / `$`-suffixed
33
+ * identifiers (code-like), then falls back to the first non-stopword
34
+ * token of length >= 3. Exported for unit tests.
35
+ */
36
+ export declare function extractFindingAnchor(title: string, description: string): string | undefined;
37
+ /**
38
+ * Resolve a finding's cited path against the workspace, normalizing
39
+ * backslashes, leading `./`, absolute POSIX paths, and (on win32) absolute
40
+ * Windows paths. Returns the absolute path when the citation resolves
41
+ * INSIDE the workspace, or `null` when it escapes it. Exported for tests.
42
+ */
43
+ export declare function resolveFindingPath(raw: string, cwd: string): string | null;
44
+ /**
45
+ * Verify findings against the working tree. Each finding that carries a
46
+ * `location` gets a `verification` result attached; findings without a
47
+ * location are left untouched (there is nothing to verify). Files are read
48
+ * once per unique path. Never throws — read failures degrade to a
49
+ * `failed`/`unverified` verdict so one unreadable file cannot abort the
50
+ * whole review pipeline.
51
+ */
52
+ export declare function verifyFindingsAgainstDisk(findings: ChimeraFinding[], opts: VerifyFindingsOptions): Promise<ChimeraFinding[]>;
53
+ //# sourceMappingURL=review-finding-verification.d.ts.map
@@ -37,6 +37,7 @@ export interface ReportIntegrationResult {
37
37
  * @param projectDir - Project root (~/.wrongstack/projects/<slug>).
38
38
  * @returns Integration result summary.
39
39
  */
40
+ export declare function updateReviewReportEvidence(reportId: string, projectDir: string, evidenceStatus: import('./review-types.js').CascadeEvidenceStatus, evidenceChecks: import('./review-types.js').CascadeEvidenceCheckResult[]): Promise<void>;
40
41
  export declare function persistReviewReport(payload: ChimeraReviewCompletePayload, reportId: string, projectDir: string): Promise<ReportIntegrationResult>;
41
42
  /**
42
43
  * Result of a report-completion sync check.
@@ -12,6 +12,7 @@
12
12
  *
13
13
  * @module review-report-store
14
14
  */
15
+ import type { CascadeEvidenceCheckResult, CascadeEvidenceStatus } from './review-types.js';
15
16
  import type { ReviewReport, ReviewReportCounts, ReviewReportEvent, ReviewReportFile } from './review-report-types.js';
16
17
  import { type ReportActorKind, type ReportLifecycleStatus } from './review-report-types.js';
17
18
  /** Default retention for completed/skipped reports (90 days in ms). */
@@ -38,6 +39,10 @@ export interface PersistReportInput {
38
39
  durationSeconds?: number | undefined;
39
40
  rawText: string;
40
41
  cascadeDepth?: number | undefined;
42
+ /** P0-3: cascade fix evidence status (verified/failed/missing). */
43
+ evidenceStatus?: CascadeEvidenceStatus | undefined;
44
+ /** P0-3: per-check claimed-vs-observed exit-code comparisons. */
45
+ evidenceChecks?: CascadeEvidenceCheckResult[] | undefined;
41
46
  }
42
47
  /** Context for who is creating/transitioning a report. */
43
48
  export interface ReportActor {
@@ -55,6 +60,7 @@ export interface ReportStore {
55
60
  reason?: string;
56
61
  }): Promise<ReviewReport>;
57
62
  addNote(reportId: string, actor: ReportActor, note: string): Promise<ReviewReport>;
63
+ updateEvidence(reportId: string, evidenceStatus: CascadeEvidenceStatus, evidenceChecks: CascadeEvidenceCheckResult[]): Promise<ReviewReport>;
58
64
  list(opts?: ListReportsOptions): Promise<ReviewReport[]>;
59
65
  get(id: string): Promise<ReviewReport | null>;
60
66
  getEvents(reportId: string): Promise<ReviewReportEvent[]>;
@@ -73,6 +79,7 @@ export declare class JsonlReportStore implements ReportStore {
73
79
  transition(reportId: string, to: ReportLifecycleStatus, actor: ReportActor, opts?: {
74
80
  reason?: string;
75
81
  }): Promise<ReviewReport>;
82
+ updateEvidence(reportId: string, status: CascadeEvidenceStatus, checks: CascadeEvidenceCheckResult[]): Promise<ReviewReport>;
76
83
  addNote(reportId: string, actor: ReportActor, note: string): Promise<ReviewReport>;
77
84
  list(opts?: ListReportsOptions): Promise<ReviewReport[]>;
78
85
  get(id: string): Promise<ReviewReport | null>;
@@ -13,6 +13,7 @@
13
13
  *
14
14
  * @module review-report-types
15
15
  */
16
+ import type { CascadeEvidenceCheckResult, CascadeEvidenceStatus } from './review-types.js';
16
17
  import type { FindingSource } from './review-finding-types.js';
17
18
  /**
18
19
  * Lifecycle status of a review report.
@@ -79,6 +80,19 @@ export interface ReviewReport {
79
80
  rawText: string;
80
81
  /** Cascade iteration depth (0 for initial review). */
81
82
  cascadeDepth?: number | undefined;
83
+ /**
84
+ * P0-3: machine-evidence verification status of the cascade fix step that
85
+ * preceded this report's review. `verified` / `failed` / `missing` mirror
86
+ * the bundle's evidenceStatus; absent when no cascade step ran.
87
+ */
88
+ evidenceStatus?: CascadeEvidenceStatus | undefined;
89
+ /**
90
+ * Per-check comparison results (claimed vs. observed exit codes) from the
91
+ * cascade evidence verification. Recorded so a report is auditable: exactly
92
+ * which commands the fix agent claimed, what the orchestrator observed, and
93
+ * which checks matched.
94
+ */
95
+ evidenceChecks?: CascadeEvidenceCheckResult[] | undefined;
82
96
  }
83
97
  export type ReportEventType = 'created' | 'actioned' | 'completed' | 'skipped' | 'reopened' | 'note_added';
84
98
  /** A single state-transition or annotation event in a report's lifecycle. */
@@ -1,3 +1,5 @@
1
+ import type { ParsedReviewReport } from './review-finding-parser.js';
2
+ import type { ChimeraFinding } from './review-finding-types.js';
1
3
  export interface ResolvedChimeraConfig {
2
4
  enabled: boolean;
3
5
  provider: string;
@@ -6,6 +8,19 @@ export interface ResolvedChimeraConfig {
6
8
  autoFix: 'off' | 'ask' | 'auto';
7
9
  cascadeOn: 'off' | 'critical' | 'high';
8
10
  maxCascadeDepth: number;
11
+ /**
12
+ * Chimera-specific fallback model chain (`provider/model` refs), resolved
13
+ * from `extensions["wstack-chimera"].fallbackModels`. Empty when unset —
14
+ * the reviewer then inherits the session-level fallback profile chain.
15
+ */
16
+ fallbackModels: string[];
17
+ /**
18
+ * Named fallback profile to use for Chimera reviews, resolved from
19
+ * `extensions["wstack-chimera"].fallbackProfile`. When set, the reviewer
20
+ * spawn resolves the profile chain from config and prepends it to
21
+ * `fallbackModels`.
22
+ */
23
+ fallbackProfile: string | undefined;
9
24
  }
10
25
  /**
11
26
  * A single changed file with its content and, for modified files, a
@@ -119,6 +134,47 @@ export interface ReviewContextBundle {
119
134
  eventType?: string | undefined;
120
135
  observedAt?: string | undefined;
121
136
  }> | undefined;
137
+ /**
138
+ * P0-3: machine-evidence verification status of the cascade fix step that
139
+ * preceded this (re-)review. Set by the cascade handler after re-running
140
+ * the fix agents' claimed verification commands against the working tree:
141
+ * - `verified` — every claimed typecheck/lint/test check re-ran and passed.
142
+ * - `failed` — at least one check failed, mismatched, timed out, or was
143
+ * refused (unsafe command).
144
+ * - `missing` — the fix agent returned no evidence block at all.
145
+ * Absent on initial reviews (no cascade step yet).
146
+ */
147
+ evidenceStatus?: CascadeEvidenceStatus | undefined;
148
+ /**
149
+ * Per-check comparison results from the cascade evidence verification.
150
+ * Carried so the persisted report can record exactly which commands were
151
+ * claimed, what the orchestrator observed, and which checks matched.
152
+ */
153
+ evidenceChecks?: CascadeEvidenceCheckResult[] | undefined;
154
+ }
155
+ /**
156
+ * Aggregate verdict on a cascade fix agent's machine evidence (P0-3).
157
+ * See {@link ReviewContextBundle.evidenceStatus} for the semantics of each
158
+ * value. Shared across the cli cascade handler (which produces it), the
159
+ * core bundle type, and the report store (which persists it) so the shape
160
+ * cannot drift between producer and consumers.
161
+ */
162
+ export type CascadeEvidenceStatus = 'verified' | 'failed' | 'missing';
163
+ /**
164
+ * One check's comparison: the command a cascade fix agent claimed to run,
165
+ * the exit code it claimed, the exit code the orchestrator observed when it
166
+ * re-ran the command against the working tree, and whether the check counts
167
+ * as passed (observed exit code 0 matching a claimed 0).
168
+ */
169
+ export interface CascadeEvidenceCheckResult {
170
+ name: 'typecheck' | 'lint' | 'tests';
171
+ command: string;
172
+ /** Exit code the agent claimed (null when the block omitted the key). */
173
+ claimedExitCode: number | null;
174
+ /** Exit code observed by the orchestrator's re-run. */
175
+ actualExitCode: number | null;
176
+ /** True when the check ran and actual matches a passing (0) claim. */
177
+ ok: boolean;
122
178
  }
123
179
  /** Legacy alias for the bundle emitted when a Chimera review is requested. */
124
180
  export type ChimeraReviewNeededPayload = ReviewContextBundle;
@@ -140,10 +196,21 @@ export interface ChimeraReviewCompletePayload {
140
196
  * directory path (which was the previous broken behaviour).
141
197
  */
142
198
  sessionId?: string | undefined;
199
+ /**
200
+ * Findings parsed ONCE by the execution owner (P0-1) and verified against
201
+ * the working tree (P0-2) before persistence. Threaded through so
202
+ * `persistReviewReport`, `integrateFindings`, and the cascade gate never
203
+ * re-parse the report with divergent contexts. Absent for failed reviews
204
+ * and legacy emitters that do not pre-parse — consumers fall back to
205
+ * parsing `reviewText` themselves in that case.
206
+ */
207
+ parsedReport?: ParsedReviewReport | undefined;
143
208
  }
144
209
  export type CascadeAgentKind = 'security-scanner' | 'bug-hunter';
145
210
  export interface ChimeraCascadeNeededPayload {
146
211
  bundle: ReviewContextBundle;
212
+ /** Source review whose findings triggered this cascade. */
213
+ reportId?: string | undefined;
147
214
  reviewText: string;
148
215
  severities: {
149
216
  critical: number;
@@ -152,5 +219,12 @@ export interface ChimeraCascadeNeededPayload {
152
219
  };
153
220
  threshold: 'high' | 'critical';
154
221
  agents: CascadeAgentKind[];
222
+ /**
223
+ * Findings that passed the P0-2 disk-verification pass (file exists, line
224
+ * in range, code anchor present). Only these findings may gate a cascade
225
+ * when the execution owner threaded a parsed report. Absent for legacy
226
+ * emitters that skip pre-parsing.
227
+ */
228
+ verifiedFindings?: ChimeraFinding[] | undefined;
155
229
  }
156
230
  //# sourceMappingURL=review-types.d.ts.map
@@ -30,10 +30,11 @@ import type { Response } from '../types/provider.js';
30
30
  * ## What a hit requires
31
31
  *
32
32
  * The lookup key is `hashRequest`, which covers everything the provider is
33
- * actually sent — including `system`. The agent loop appends volatile blocks
34
- * to the system prompt on every request (the continuity ledger, the live
35
- * next-steps gate, memory evidence; see `agent-response.ts`), and those blocks
36
- * describe the state of *this* run. A re-run whose ledger or retrieved memory
33
+ * actually sent — including `system`. The agent loop carries a live-context
34
+ * tail on every request (the continuity ledger, the live next-steps gate,
35
+ * memory evidence, epoch-volatile prompt blocks appended after the last
36
+ * message; see `agent-response.ts`), and those blocks describe the state of
37
+ * *this* run. A re-run whose ledger or retrieved memory
37
38
  * differs therefore produces a different request, and correctly misses: the
38
39
  * recorded response answered a different prompt.
39
40
  *
@@ -10,6 +10,15 @@ export interface FallbackManageToolOptions {
10
10
  updateConfig: (mutate: (cfg: Record<string, unknown>) => void) => Promise<void>;
11
11
  /** Optional secure interactive input callback for secrets such as API keys. */
12
12
  requestInput?: ((prompt: string) => Promise<string>) | undefined;
13
+ /**
14
+ * Optional live provider/model switch (the host's switchProviderAndModel).
15
+ * When present, `leader_model_set` routes leader changes through it so the
16
+ * live agent context (provider instance, model, context caps) follows the
17
+ * config write. Returns an error string on failure, null on success —
18
+ * mirroring cli-main's switch callback. When absent, the tool persists the
19
+ * config and reports that the live session keeps its current model.
20
+ */
21
+ switchProviderAndModel?: ((providerId: string, modelId: string) => Promise<string | null>) | undefined;
13
22
  /** Optional logger for internal warnings. */
14
23
  logger?: Logger | undefined;
15
24
  }