/** * SingleStepEnforcer Entity * * Enforces single-step execution in Phase 4 to prevent * agents from making multiple changes in a single operation. * * @see TSK-FR-013〜017 - SingleStepEnforcer * @see REQ-FR-090〜092 - SingleStepEnforcer * @trace DES-MUSUBIX-FR-001 DES-ORCH-003 */ import { type StepDefinition, type StepExecutionResult, type StepValidationResult, type SingleStepConfig } from '../value-objects/StepDefinition.js'; /** * Step executor function type */ export type StepExecutor = () => Promise<{ success: boolean; affectedFiles: string[]; linesAdded: number; linesRemoved: number; error?: string; }>; /** * Step validation context */ export interface StepValidationContext { affectedFiles: string[]; linesChanged: number; } /** * SingleStepEnforcer Interface */ export interface ISingleStepEnforcer { /** Validate a step before execution */ validateStep(step: StepDefinition, context: StepValidationContext): StepValidationResult; /** Enforce and execute a step */ enforceStep(step: StepDefinition, executor: StepExecutor): Promise; /** Get the current step in progress */ getCurrentStep(): StepDefinition | null; /** Get step execution history */ getStepHistory(): readonly StepExecutionResult[]; /** Reset enforcer state */ reset(): void; } /** * SingleStepEnforcer Implementation * * Ensures agents execute only one step at a time, preventing * runaway operations and maintaining control. * * @example * ```typescript * const enforcer = createSingleStepEnforcer(); * * const step = createStepDefinition({ * name: 'Modify index.ts', * type: 'file-modify', * target: 'src/index.ts', * }); * * const result = await enforcer.enforceStep(step, async () => { * // Perform the actual modification * return { success: true, affectedFiles: ['src/index.ts'], linesAdded: 10, linesRemoved: 5 }; * }); * ``` */ export declare class SingleStepEnforcer implements ISingleStepEnforcer { private readonly config; private currentStep; private history; constructor(config?: SingleStepConfig); /** * Validate a step before execution */ validateStep(_step: StepDefinition, context: StepValidationContext): StepValidationResult; /** * Enforce and execute a step */ enforceStep(step: StepDefinition, executor: StepExecutor): Promise; /** * Validate post-execution results (without concurrent step check) */ private validatePostExecution; /** * Get the current step in progress */ getCurrentStep(): StepDefinition | null; /** * Get step execution history */ getStepHistory(): readonly StepExecutionResult[]; /** * Reset enforcer state */ reset(): void; private executeWithTimeout; private determineChangeType; } /** * Create a SingleStepEnforcer instance * * @param config - Optional configuration * @returns ISingleStepEnforcer instance */ export declare function createSingleStepEnforcer(config?: SingleStepConfig): ISingleStepEnforcer; //# sourceMappingURL=SingleStepEnforcer.d.ts.map