/**
 * Executes a single workflow step through the 3-phase model.
 *
 * Phase 1: Main agent execution (with tools)
 * Phase 2: Report output (Write-only, optional)
 * Phase 3: Status judgment (no tools, optional)
 */
import type { WorkflowStep, WorkflowState, AgentResponse, Language, FallbackContext, WorkflowResumePointEntry } from '../../models/types.js';
import type { PhaseName, PhasePromptParts, JudgeStageEntry, RuntimeStepResolution, StepRunResult } from '../types.js';
import type { OptionsBuilder } from './OptionsBuilder.js';
import type { RunPaths } from '../run/run-paths.js';
import type { StructuredCaller } from '../../../agents/structured-caller.js';
import type { StructuredOutputNormalizerRegistry } from './structured-output-normalizer.js';
export interface StepExecutorDeps {
    readonly optionsBuilder: OptionsBuilder;
    readonly getCwd: () => string;
    readonly getProjectCwd: () => string;
    readonly getReportDir: () => string;
    readonly getRunPaths: () => RunPaths;
    readonly getLanguage: () => Language | undefined;
    readonly getInteractive: () => boolean;
    readonly getWorkflowSteps: () => ReadonlyArray<{
        name: string;
        description?: string;
    }>;
    readonly getWorkflowDefinitionSteps: () => ReadonlyArray<WorkflowStep>;
    readonly getWorkflowName: () => string;
    readonly getWorkflowDescription: () => string | undefined;
    readonly getRetryNote: () => string | undefined;
    readonly getObservabilityRunId?: () => string | undefined;
    readonly observabilityEnabled?: () => boolean;
    readonly sanitizeObservabilityText?: (text: string) => string;
    readonly getCurrentWorkflowStack?: () => WorkflowResumePointEntry[] | undefined;
    readonly detectRuleIndex: (content: string, stepName: string) => number;
    readonly structuredCaller: StructuredCaller;
    readonly structuredOutputNormalizers: StructuredOutputNormalizerRegistry;
    readonly onPhaseStart?: (step: WorkflowStep, phase: 1 | 2 | 3, phaseName: PhaseName, instruction: string, promptParts: PhasePromptParts, phaseExecutionId?: string, iteration?: number) => void;
    readonly onPhaseComplete?: (step: WorkflowStep, phase: 1 | 2 | 3, phaseName: PhaseName, content: string, status: string, error?: string, phaseExecutionId?: string, iteration?: number) => void;
    readonly onJudgeStage?: (step: WorkflowStep, phase: 3, phaseName: 'judge', entry: JudgeStageEntry, phaseExecutionId?: string, iteration?: number) => void;
}
export declare class StepExecutor {
    private readonly deps;
    private readonly structuredOutputNormalizers;
    constructor(deps: StepExecutorDeps);
    private static buildTimestamp;
    private static buildSnapshotFileName;
    private writeSnapshot;
    private writeFacetSnapshot;
    private ensurePreviousResponseSnapshot;
    persistPreviousResponseSnapshot(state: WorkflowState, stepName: string, stepIteration: number, content: string): void;
    buildPhase1Instruction(instruction: string, step: WorkflowStep, runtime?: RuntimeStepResolution): string;
    private normalizeStructuredOutput;
    private buildStructuredOutputFailureFallback;
    private resolveStructuredOutputFailureReason;
    private logStructuredOutputFailure;
    /** Build Phase 1 instruction from template */
    buildInstruction(step: WorkflowStep, stepIteration: number, state: WorkflowState, task: string, maxSteps: number | 'infinite', fallbackContext?: FallbackContext): string;
    /**
     * Apply shared post-execution phases (Phase 2/3 + fallback rule evaluation).
     *
     * This method is intentionally reusable by non-normal step runners
     * (e.g., team_leader) so rule/report behavior stays consistent.
     */
    applyPostExecutionPhases(step: WorkflowStep, state: WorkflowState, stepIteration: number, response: AgentResponse, updatePersonaSession: (persona: string, sessionId: string | undefined) => void, runtime?: RuntimeStepResolution): Promise<AgentResponse>;
    /**
     * Execute a normal (non-parallel) step through all 3 phases.
     *
     * Returns the final response (with matchedRuleIndex if a rule matched)
     * and the instruction used for Phase 1.
     */
    runNormalStep(step: WorkflowStep, state: WorkflowState, task: string, maxSteps: number | 'infinite', updatePersonaSession: (persona: string, sessionId: string | undefined) => void, prebuiltInstruction?: string, runtime?: RuntimeStepResolution): Promise<StepRunResult>;
    /** Collect step:report events for each report file that exists */
    emitStepReports(step: WorkflowStep): void;
    private reportFiles;
    /** Check if report file exists and collect for emission */
    private checkReportFile;
    /** Drain collected report files (called by engine after step execution) */
    drainReportFiles(): Array<{
        step: WorkflowStep;
        filePath: string;
        fileName: string;
    }>;
}
//# sourceMappingURL=StepExecutor.d.ts.map