/** * ExecutionPipeline - Composable stage-based execution engine. * * Replaces the monolithic Bash.exec() method with an ordered sequence * of self-contained stages: normalize -> parse -> transform -> sandbox -> * interpret -> persist -> error-handle. * * Each stage either continues (passing context forward) or short-circuits * with a final BashExecResult. */ import type { Bash, ExecOptions } from "../Bash.js"; import type { InterpreterState } from "../interpreter/types.js"; import type { ServiceContainer } from "../services/ServiceContainer.js"; import type { BashExecResult } from "../types.js"; import type { PipelineStage } from "./types.js"; /** * Callback applied to every BashExecResult leaving the pipeline (success AND * error paths). Mirrors the monolith's Bash.logResult: logs the result and * decodes binary (latin1) stdout/stderr to UTF-8 at the output boundary. * Returns the (decoded) result. */ export type ResultFinalizer = (result: BashExecResult) => BashExecResult; export declare class ExecutionPipeline { private readonly stages; private readonly finalize; constructor(finalize?: ResultFinalizer); addStage(stage: PipelineStage): void; run(script: string, options: ExecOptions | undefined, bash: Bash, services: ServiceContainer, execState: InterpreterState, /** * The PARENT Bash instance's interpreter state. Used ONLY for error-path * env semantics: the monolith builds all 11 error/guard results from * `this.state.env` (unchanged on error), NOT the possibly-mutated execState. * Defaults to execState when omitted (direct/test usage without a parent). */ parentState?: InterpreterState): Promise; }