/** * Repair Planner * * The core oracle-guided algorithm that speculatively applies fixes, * verifies them against the TypeScript compiler, and builds a repair plan. */ import ts from "typescript"; import type { RepairPlan, VerifiedFix, RepairRequest } from "../output/types.js"; import { createBudgetLogger, createNoopLogger, type BudgetLogger } from "./logger.js"; /** * Scoring strategy for candidate ranking. * - "delta": Simple error count difference (errorsBefore - errorsAfter) * - "weighted": Weighted formula considering diagnostics, edit size, and risk */ export type ScoringStrategy = "delta" | "weighted"; /** * Assign risk level based on fix type */ export declare function assessRisk(fixName: string): "low" | "medium" | "high"; /** * Prune candidates using cheap priors before expensive verification */ export declare function pruneCandidates(fixes: readonly ts.CodeFixAction[], limit: number): ts.CodeFixAction[]; export declare const DEFAULT_SCORE_WEIGHTS: { readonly introducedMultiplier: 4; readonly editSizeAlpha: 0.0015; readonly riskPenalty: { readonly low: 0; readonly medium: 0.75; readonly high: 2; }; }; export type ScoreWeights = { introducedMultiplier: number; editSizeAlpha: number; riskPenalty: { low: number; medium: number; high: number; }; }; export interface VerificationResult { /** Did the fix eliminate the target diagnostic? */ targetFixed: boolean; /** Error count before the fix */ errorsBefore: number; /** Error count after the fix */ errorsAfter: number; /** Net change (positive = good) */ delta: number; /** New diagnostics introduced by this fix */ newDiagnostics: ts.Diagnostic[]; /** Weighted sum of resolved diagnostics (for weighted strategy) */ resolvedWeight: number; /** Weighted sum of introduced diagnostics (for weighted strategy) */ introducedWeight: number; /** Total edit size for the fix (for weighted strategy) */ editSize: number; } export declare function computeEditSize(fix: ts.CodeFixAction): number; export declare function computeScore(result: VerificationResult, risk: "low" | "medium" | "high", weights: ScoreWeights): number; export declare function deriveDependencies(steps: VerifiedFix[]): string[][]; export declare function computeBatches(steps: VerifiedFix[]): string[][]; export interface PlanOptions { /** Maximum candidates to evaluate per diagnostic */ maxCandidates: number; /** Maximum total candidates to consider per planning iteration */ maxCandidatesPerIteration: number; /** Maximum total verifications across all planning */ maxVerifications: number; /** Allow fixes that introduce new errors if net positive */ allowRegressions: boolean; /** Include high-risk fixes */ includeHighRisk: boolean; /** Maximum planning iterations */ maxIterations: number; /** Scoring strategy for candidate ranking */ scoringStrategy: ScoringStrategy; /** Score weights for weighted scoring strategy */ scoreWeights: ScoreWeights; /** Callback for progress updates */ onProgress?: (message: string) => void; /** Budget logger for tracing (optional) */ logger?: BudgetLogger; } /** * Generate a verified repair plan for a TypeScript project */ export declare function plan(configPath: string, options?: Partial): RepairPlan; /** * Main entry point for repair planning */ export declare function repair(request: RepairRequest, logger?: BudgetLogger): RepairPlan; export { createBudgetLogger, createNoopLogger, type BudgetLogger }; //# sourceMappingURL=planner.d.ts.map