/** * Dry Run Execution Strategy * * Handles command execution in dry-run mode with full tool simulation. * * Flow: * 1. --dry-run mode: Execute full pipeline with simulated tools * 2. Display comprehensive summary with diffs, commands, and cost estimates * 3. Cache analysis for subsequent runs * * Unlike the previous approach that skipped tool execution, * this strategy runs the LLM with tools and simulates state-changing operations. * Read-only tools execute normally. */ import type { CommandDefinition, CommandResult } from '../types/command.types.js'; import type { ExecutionContext } from './execution-context.js'; import type { CommandExecutionStrategy } from './execution-strategy.js'; import { type DryRunCacheEntry } from './dry-run-cache.js'; /** * Dry Run Execution Strategy * * When --dry-run is enabled: * - Analyses the command pipeline * - Displays what would be executed * - Caches the analysis for subsequent runs * * When running without --dry-run after a dry-run: * - Uses cached analysis to speed up execution * - Skips redundant planning/analysis stages */ export declare class DryRunExecutionStrategy implements CommandExecutionStrategy { /** * Check if this strategy can handle the given command and context */ canExecute(_command: CommandDefinition, context: ExecutionContext): boolean; /** * Check if we have a valid cache entry for the given context */ hasCachedResult(command: CommandDefinition, context: ExecutionContext): boolean; /** * Get cached result if available */ getCachedResult(command: CommandDefinition, context: ExecutionContext): DryRunCacheEntry | undefined; /** * Execute in dry-run mode * * Runs the full pipeline with tool simulation enabled. * The LLM receives tools and makes tool calls, but state-changing * operations are simulated instead of executed. */ execute(command: CommandDefinition, context: ExecutionContext): Promise; /** * Execute the pipeline with tool simulation */ private executePipelineWithSimulation; /** * Execute using cached dry-run results * * This is called by other strategies when they detect a cache hit */ executeWithCache(command: CommandDefinition, context: ExecutionContext, cachedEntry: DryRunCacheEntry, pipelineExecutor: { execute: (stages: unknown[], ctx: unknown) => Promise; }): Promise; /** * Build an execution plan without executing */ private buildExecutionPlan; /** * Pre-compute expensive resources during dry-run for faster subsequent execution * * This method loads and caches: * - All prompt templates required by the pipeline * - The agent definition * - Pre-resolved static inputs (variables that don't depend on LLM output) * - File contents for file-based inputs * - Pipeline validation results */ private precomputeResources; /** * Pre-load all prompts for the pipeline stages */ private preloadPrompts; /** * Pre-load the agent definition */ private preloadAgent; /** * Build resolved args map from execution context using reduce */ private buildResolvedArgs; /** * Pre-resolve static inputs for each stage * Only resolves inputs that don't depend on LLM output ($STAGE_* variables are skipped) */ private preresolveStageInputs; /** * Process inputs for a single stage */ private processStageInputs; /** * Resolve a single input value */ private resolveInputValue; /** * Resolve $ARG_* variable */ private resolveArgVariable; /** * Resolve $ENV_* variable */ private resolveEnvVariable; /** * Enrich with file content if applicable */ private enrichWithFileContent; /** * Cache the execution plan for subsequent runs */ private cacheExecutionPlan; /** * Create lookup options from command and context */ private createLookupOptions; /** * Estimate execution complexity based on pipeline structure */ private estimateComplexity; /** * Extract required variables from pipeline stages using flatMap */ private extractRequiredVariables; } /** * Get a new DryRunExecutionStrategy instance */ export declare function createDryRunStrategy(): DryRunExecutionStrategy; //# sourceMappingURL=dry-run-strategy.d.ts.map