import { type ClassAnalysis, type IdentifiedFinding } from "./findings.js"; import type { PipelineConfig } from "./pipeline-config.js"; import type { CheckpointAssessment } from "./validate-loop.js"; import type { CriteriaPatch } from "./validate-loop.js"; export declare const REPLAN_REPORT_VERSION = 5; export type ReplanReportOutcome = "requires-replan" | "human-required"; export interface ProofObligationMember { /** Pipeline-minted token the replanner echoes, e.g. "P2.3". */ id: string; /** The checked subject's prose, display-only. */ text: string; /** True when this member is in affectedSubjects and must be dispositioned fixed. */ affected: boolean; } /** * One closure obligation the replanner must prove, keyed by a pipeline-minted * ID. IDs exist because free-text subjects are authored by one model and were * previously re-typed by another: exact matching of model output is only * legitimate on opaque tokens that code minted, so code mints them. */ export interface ProofObligation { id: string; subject: string; members: ProofObligationMember[]; } /** * Derive the obligation roster from a report's findings and class analyses. * Deterministic, so a legacy report without a persisted roster resolves to * the same IDs. */ export declare function buildProofObligations(report: { replanFindings?: Array<{ subject: string; }>; relatedFindings?: Array<{ subject: string; severity: string; }>; classAnalyses?: ClassAnalysis[]; }): ProofObligation[]; export interface ReplanResolutionProof { /** Obligation reference: its pipeline-minted ID, or legacy subject text. */ subject: string; changedPaths: string[]; dispositions: Array<{ /** Member reference: its pipeline-minted ID, or legacy subject text. */ subject: string; disposition: "fixed" | "already-correct"; evidence: Array<{ path: string; detail: string; }>; }>; completenessBasis: string; } export interface ReplanAttempt { attemptedAt: string; attempt: number; agent: string; outcome: "rejected" | "accepted"; reason: string; failedSubjects: string[]; /** False on rejection means canonical artifacts were restored transactionally. */ artifactsLeftOnDisk: boolean; /** Parsed proof payload, including incomplete proofs on rejected attempts. */ resolutionProofs?: ReplanResolutionProof[]; } export interface ReplanReport { schemaVersion: typeof REPLAN_REPORT_VERSION; programId: string; generatedAt: string; inputHash: string; outcome: ReplanReportOutcome; summary: string; /** * Present only when outcome is "human-required": the genuine user-intent * decision(s) the critic could not resolve. A planner must surface this to * the human and record their answers before changing any requirement. */ humanDecisionReason?: string; replanFindings: IdentifiedFinding[]; relatedFindings: IdentifiedFinding[]; /** Root-cause closure obligations discovered by the plan/spec critic. */ classAnalyses: ClassAnalysis[]; /** ID-keyed proof roster; resolutionProofs reference these IDs, not prose. */ proofObligations: ProofObligation[]; /** Intent-preserving criterion repairs the replanner is allowed to apply. */ criteriaPatches: CriteriaPatch[]; checkpointAssessments: CheckpointAssessment[]; criticSummary: string; criticLogs: string[]; planningInstruction: string; /** Archived report this handoff superseded, when one existed. */ supersedes?: string; /** Most recent automatic-replanner attempt. Read rejected attempts first. */ lastAttempt?: ReplanAttempt; /** Bounded diagnostic history so a later planner sees every failed retry. */ attemptHistory?: ReplanAttempt[]; } export declare function replanReportPath(root: string, programId: string): string; export declare function replanHistoryDir(root: string, programId: string): string; /** Remove the generated handoff once the replacement plan converges. */ /** * Retire a replan report after convergence succeeds. The report is archived * to the history directory, never deleted: the causal record of why a replan * happened must survive its resolution. */ export declare function clearReplanReport(root: string, programId: string, now?: () => Date): Promise; /** Hash the exact canonical planning inputs, including absent task specs. */ export declare function replanInputHash(rootInput: string, programId: string, config: PipelineConfig): Promise; export declare function recordReplanAttempt(path: string, attempt: ReplanAttempt): Promise; export declare function writeReplanReport(root: string, programId: string, config: PipelineConfig, input: { summary: string; replanFindings: IdentifiedFinding[]; relatedFindings: IdentifiedFinding[]; checkpointAssessments: CheckpointAssessment[]; criticSummary: string; criticLogs: string[]; classAnalyses?: ClassAnalysis[]; criteriaPatches?: CriteriaPatch[]; outcome?: ReplanReportOutcome; humanDecisionReason?: string; }, now?: () => Date): Promise<{ path: string; report: ReplanReport; }>; //# sourceMappingURL=replan-report.d.ts.map