/** * Typed ralplan review conflicts and dispositions (#2902). * * Architect and Critic findings remain free-form in their stage markdown, but * the join/revision path can record machine-checkable findings against stable * plan targets. Incompatible actions on the same target produce open conflicts * that block a clean join until an explicit disposition is recorded. */ export declare const RALPLAN_REVIEW_CONFLICTS_SCHEMA: "ralplan.review_conflicts.v1"; export type ReviewAction = "add" | "remove" | "change" | "clarify"; export type ReviewRole = "architect" | "critic"; export type ReviewSeverity = "info" | "watch" | "block"; export type DispositionChoice = "accept_architect" | "accept_critic" | "synthesize" | "defer_user" | "reject_both"; export interface ReviewSourceReceipt { stage: "architect" | "critic"; stageN: number; path: string; sha256: string; } export interface ReviewFinding { findingId: string; targetId: string; action: ReviewAction; severity: ReviewSeverity; evidence: string; sourceRole: ReviewRole; sourceReceipt: ReviewSourceReceipt; proposedOwner?: string; } export interface ReviewConflict { conflictId: string; targetId: string; findingIds: [string, string]; actions: [ReviewAction, ReviewAction]; sourceRoles: [ReviewRole, ReviewRole]; status: "open" | "dispositioned"; } export interface ConflictDisposition { conflictId: string; choice: DispositionChoice; rationale: string; decisionOwner: string; affectedSections: string[]; dispositionedAt?: string; } export interface ReviewConflictDocument { schema: typeof RALPLAN_REVIEW_CONFLICTS_SCHEMA; plannerStageN: number; findings: ReviewFinding[]; conflicts: ReviewConflict[]; dispositions: ConflictDisposition[]; } export interface JoinGateResult { ok: boolean; openConflictIds: string[]; missingDispositionIds: string[]; orphanDispositionIds: string[]; message: string; } /** True when two actions on the same target cannot both remain. */ export declare function actionsAreIncompatible(left: ReviewAction, right: ReviewAction): boolean; /** * Derive open conflicts from typed findings. Only cross-role incompatible pairs * on the same targetId are conflicts (Architect remove vs Critic add, etc.). */ export declare function detectReviewConflicts(findings: readonly ReviewFinding[]): ReviewConflict[]; /** Mark conflicts dispositioned when a matching disposition exists. */ export declare function applyDispositions(conflicts: readonly ReviewConflict[], dispositions: readonly ConflictDisposition[]): ReviewConflict[]; /** * Join gate: clean only when every derived conflict has an explicit disposition * with rationale and decision owner, and no orphan dispositions reference unknown * conflicts. */ export declare function evaluateReviewJoinGate(findings: readonly ReviewFinding[], dispositions: readonly ConflictDisposition[], precomputedConflicts?: readonly ReviewConflict[]): JoinGateResult; /** Strip optional markdown fence and parse JSON. */ export declare function parseReviewConflictJson(raw: string): unknown; /** * Authoritative provenance required by `gjc ralplan --write --stage disposition`. * * Without this, a disposition document can claim arbitrary path/hash strings and * join the wrong Architect/Critic pass (#3013 adversarial review). */ export interface IndexedReviewArtifact { path: string; sha256: string; } export interface DispositionProvenanceContext { /** CLI `--stage_n` for this disposition write; must equal `plannerStageN`. */ expectedStageN: number; /** * Persisted Architect/Critic (and other) stage artifacts from this run's * `index.jsonl`, keyed by `${stage}\u0000${stageN}`. */ indexedArtifacts: ReadonlyMap; } /** Stable map key for a staged artifact identity in the run index. */ export declare function reviewArtifactIndexKey(stage: string, stageN: number): string; /** * Cross-check every finding's source receipt against the CLI stage number and * the run's persisted Architect/Critic artifact index. Fail closed on mismatch * or spoofed path/hash attestations. */ export declare function assertDispositionProvenance(doc: ReviewConflictDocument, provenance: DispositionProvenanceContext): void; /** * Parse and validate a disposition-stage document. Re-derives conflicts from * findings when omitted, then fails closed unless every conflict is dispositioned * (or findings produce zero conflicts and dispositions are empty). * * When `provenance` is provided (CLI write path), also enforces authoritative * same-pass receipt checks against the run index. */ export declare function parseReviewConflictDocument(raw: string | unknown, provenance?: DispositionProvenanceContext): ReviewConflictDocument; /** Canonical JSON serialization for disposition-stage artifacts. */ export declare function serializeReviewConflictDocument(doc: ReviewConflictDocument): string;