/** * Pipeline stage interfaces for oh-my-codex * * Shared stage contracts for the default Autopilot loop. * The pipeline sequences: deep-interview -> ralplan -> ultragoal -> code-review -> ultraqa. */ /** * Context passed into each pipeline stage. * Accumulates artifacts from prior stages so downstream stages can consume them. */ export interface StageContext { /** Original task description provided by the user. */ task: string; /** Accumulated artifacts from all prior stages keyed by producing stage name. */ artifacts: Record; /** Result of the immediately preceding stage (undefined for the first stage). */ previousStageResult?: StageResult; /** Working directory for the pipeline run. */ cwd: string; /** Optional session id for scoped state. */ sessionId?: string; } /** * Result returned by each pipeline stage after execution. */ export interface StageResult { status: 'completed' | 'failed' | 'skipped'; /** Artifacts produced by this stage (merged into StageContext.artifacts). */ artifacts: Record; /** Wall-clock duration of the stage in milliseconds. */ duration_ms: number; /** Human-readable error description when status is 'failed'. */ error?: string; } /** * A single stage in the pipeline. Implementations wrap concrete execution * backends (deep-interview, ralplan, ultragoal, code-review, ultraqa, and legacy team/Ralph adapters) behind this uniform interface. */ export interface PipelineStage { /** Unique name for this stage (e.g. 'deep-interview', 'ralplan', 'ultragoal', 'code-review'). */ readonly name: string; /** Execute the stage. Must return a StageResult. */ run(ctx: StageContext): Promise; /** * Optional predicate — return true to skip this stage. * Useful for conditional stages (e.g. skip ralplan if plan already exists). */ canSkip?(ctx: StageContext): boolean; } /** * Configuration for a pipeline run. */ export interface PipelineConfig { /** Human-readable pipeline name (used for state files and logging). */ name: string; /** The task description driving the pipeline. */ task: string; /** Ordered list of stages to execute. */ stages: PipelineStage[]; /** Working directory (defaults to process.cwd()). */ cwd?: string; /** Optional session id for scoped state persistence. */ sessionId?: string; /** * Maximum ralph verification iterations. * Passed through to the ralph stage. Defaults to 10. */ maxRalphIterations?: number; /** * Legacy worker count for adapters that still launch team execution. Defaults to 2. */ workerCount?: number; /** Agent type for team workers (e.g. 'executor'). Defaults to 'executor'. */ agentType?: string; /** Callback fired on each stage transition. */ onStageTransition?: (from: string, to: string) => void; } /** * Final result of a complete pipeline run. */ export interface PipelineResult { /** Overall pipeline status. */ status: 'completed' | 'failed' | 'cancelled'; /** Per-stage results keyed by stage name. */ stageResults: Record; /** Total wall-clock duration in milliseconds. */ duration_ms: number; /** Merged artifact map from all stages. */ artifacts: Record; /** Error from the failing stage (if any). */ error?: string; /** Name of the stage that failed (if any). */ failedStage?: string; } /** * Extended ModeState fields for pipeline mode. */ export interface PipelineModeStateExtension { /** Pipeline config name. */ pipeline_name: string; /** Names of stages in execution order. */ pipeline_stages: string[]; /** Index of the currently executing stage. */ pipeline_stage_index: number; /** Per-stage results collected so far. */ pipeline_stage_results: Record; /** Current review cycle count; increments when code-review is not clean. */ review_cycle?: number; /** Latest code-review verdict artifact. */ review_verdict?: unknown; /** Latest UltraQA verdict artifact. */ qa_verdict?: unknown; /** Reason Autopilot returned to ralplan after a non-clean review. */ return_to_ralplan_reason?: string | null; /** Phase handoff artifacts keyed by contract names such as deep_interview, ralplan, ultragoal, code_review, and ultraqa. */ handoff_artifacts?: Record; /** Quality-gate retry ceiling; legacy name retained for API compatibility. */ pipeline_max_ralph_iterations: number; /** Worker count for team execution. */ pipeline_worker_count: number; /** Agent type for team workers. */ pipeline_agent_type: string; } //# sourceMappingURL=types.d.ts.map