import { type RiskLevel } from "./risk.js";
import { type ParsedTaskIntent } from "./task-intent.js";
import { type EvalSummary } from "./eval.js";
import type { ValidationIssue } from "./validator.js";
import type { WorkflowState } from "./workflow-engine.js";
export type ExecutionEngineState = "idle" | "planning" | "ready" | "executing" | "validating" | "failed" | "retrying" | "blocked" | "completed";
export type ExecutionPlanStepId = "prepare" | "expand-context" | "analyze" | "trace" | "locate" | "execute" | "validate" | "checkpoint" | "handoff";
export type ExecutionPlanStepStatus = "pending" | "running" | "success" | "failed";
export type ExecutionErrorType = "context_error" | "logic_error" | "environment_error";
export type RetryStrategy = "expand" | "narrow" | "re-plan";
export interface ExecutionExpectedOutcome {
    expectedFiles: string[];
    expectedChanges: string[];
}
export interface ExecutionPlanStep {
    id: ExecutionPlanStepId;
    description: string;
    command: string;
    expectedOutput: string;
    expectedOutcome: ExecutionExpectedOutcome;
    validation: string;
    status: ExecutionPlanStepStatus;
    workflowStepId: WorkflowState["steps"][number]["stepId"] | null;
    result: {
        ok: boolean | null;
        summary: string | null;
        validation: string | null;
        failureReason: string | null;
        suggestedFix: string | null;
    };
    fixCommand: string | null;
    retryCommand: string | null;
}
export interface ExecutionPlanError {
    errorType: ExecutionErrorType;
    retryStrategy: RetryStrategy;
    reason: string;
    fixCommand: string;
    retryCommand: string;
}
export interface ExecutionPlanContextSnapshot {
    selectedFiles: string[];
    selectedModuleGroups: string[];
    confidence: string | null;
    contextTreePath: string | null;
    dependencyChains: Record<string, string[]>;
    forwardDependencies: string[];
    reverseDependencies: string[];
}
export interface ExecutionPlanHierarchy {
    goal: string | null;
    subtasks: Array<{
        id: string;
        title: string;
        stepIds: ExecutionPlanStepId[];
    }>;
}
export interface ExecutionImpactPreview {
    likelyFiles: string[];
    moduleGroups: string[];
}
export interface ExecutionPlanState {
    artifactType: "kiwi-control/execution-plan";
    version: 2;
    task: string | null;
    intent: ParsedTaskIntent | null;
    hierarchy: ExecutionPlanHierarchy;
    state: ExecutionEngineState;
    currentStepIndex: number;
    confidence: string | null;
    risk: RiskLevel;
    blocked: boolean;
    summary: string;
    steps: ExecutionPlanStep[];
    nextCommands: string[];
    lastError: ExecutionPlanError | null;
    contextSnapshot: ExecutionPlanContextSnapshot;
    impactPreview: ExecutionImpactPreview;
    verificationLayers: Array<{
        id: "syntax" | "behavioral" | "regression";
        description: string;
    }>;
    partialResults: Array<{
        stepId: ExecutionPlanStepId;
        summary: string;
    }>;
    evalSummary: EvalSummary | null;
    updatedAt: string;
}
export interface FinalValidationResult {
    ok: boolean;
    summary: string;
    validation: string;
    errorType: ExecutionErrorType | null;
    reason: string | null;
    fixCommand: string | null;
    retryCommand: string | null;
}
export declare function loadExecutionPlan(targetRoot: string): Promise<ExecutionPlanState | null>;
export declare function persistExecutionPlan(targetRoot: string, plan: ExecutionPlanState): Promise<string>;
export declare function recordPlanStepResult(targetRoot: string, options: {
    stepId: ExecutionPlanStepId;
    status: ExecutionPlanStepStatus;
    summary: string | null;
    validation: string | null;
    failureReason?: string | null;
    suggestedFix?: string | null;
}): Promise<ExecutionPlanState | null>;
export declare function syncExecutionPlan(targetRoot: string, options?: {
    task?: string | null;
    validationIssues?: ValidationIssue[];
    forceState?: ExecutionEngineState | null;
    persist?: boolean;
}): Promise<ExecutionPlanState>;
export declare function deriveCompatibilityNextActions(plan: ExecutionPlanState): Array<{
    action: string;
    file: string | null;
    command: string | null;
    reason: string;
    priority: "critical" | "high" | "normal" | "low";
}>;
export declare function getCurrentExecutionStep(plan: ExecutionPlanState): ExecutionPlanStep | null;
export declare function getFailedExecutionStep(plan: ExecutionPlanState): ExecutionPlanStep | null;
export declare function evaluateFinalValidation(targetRoot: string, task?: string | null): Promise<FinalValidationResult>;
//# sourceMappingURL=execution-engine.d.ts.map