import { type Decision, type DecisionRequest } from "../decision.js"; import { type TaskRunner } from "../run.js"; /** * One run of a pipeline file. It picks the round, makes the checks, computes * the formulas, runs the stages in order through one folder, then a summary * that is the only report. */ export declare class Pipeline { private readonly options; private readonly cwd; private readonly git; private readonly launcher; private readonly cli; private readonly runTask; private readonly decide; private readonly deciders; private readonly overrides; constructor(options: PipelineOptions); static list(json?: boolean): number; run(): Promise; /** Validates the file, then checks every prerequisite it declares. Runs no stage. */ check(): Promise; private runStages; /** The summary reads every stage and writes the one report that is posted. */ private summarize; private context; /** One decider per model, made the first time a stage asks. */ private decider; /** The process is in an unknown state after an uncaught error: save what ran, stop. */ private crashed; private interrupted; /** A retry finishes the round it started, so a file edited since cannot reorder the stages half-way through. */ private definition; /** The checks the runner makes itself: each prerequisite's marker, and every --gate. */ private gates; /** The file's `$tests`, before any check is made. One that fails makes the file wrong: bad usage. */ private test; /** Why nothing runs: the top-level when, then a --gate. Null when the run goes on. */ private blocked; private message; /** * Each stage gets a numbered folder, padded so they sort in order. An output may * not take the stage's own file names, nor be one of its inputs: those are links * to another stage's files. */ private stages; /** * The job's environment, `--set`, the runner's own, the `$vars` defaults no * one set, then `env:` computed from all of them. `--set` wins over `env:`. */ private variables; /** Each check once. A shallow clone cannot say what changed, and a silent skip would look like a quiet pull request. */ private checkGates; /** Every input comes from an earlier stage, the runner, or the folder itself. */ private checkInputs; private inputsSkipped; /** The last stage before the reader that wrote the input, else the top of the folder. */ private locate; private whyMissing; private keptRecord; /** The summary is an agent, so a pipeline with one needs a model. */ private needsAi; private needsChat; private needsDecider; private aiProblem; private folder; private dryRun; } export interface PipelineOptions { name: string; dir?: string; dryRun?: boolean; /** pipeline-check also writes a Mermaid diagram to the current folder. */ diagram?: boolean; sets?: Record; /** Gate name to a shell check, from --gate. */ gates?: Record; /** A patch of the pipeline, from --pipeline. */ pipelineOverrides?: string[]; /** ID:YAML, a patch of one stage, from --stage. */ stageOverrides?: string[]; outputs?: string[]; thread?: string; header?: string; footer?: string; noDefaultFooter?: boolean; model?: string; exitZero?: boolean; json?: boolean; /** The CLI a stage spawns under TESTEIYA_PIPELINE_SPAWN=1. Tests swap in a fake. */ cli?: string; /** Runs an agent stage. Tests swap in a fake. */ runTask?: TaskRunner; /** Throws when no model or key resolves. */ checkAi?: (model?: string) => Promise; /** Throws when a decide stage has no decision model or key. */ checkDecider?: (model?: string) => Promise; /** Asks the decision model of a decide stage. Tests swap in a fake. */ decide?: DecideRunner; } type DecideRunner = (request: DecisionRequest, model?: string) => Promise; export {};