/** * `resumeFlow`: a run carried on from its run directory, as deep as its * journal goes. * * It runs what the snapshot holds, never the flow files on disk, checked * again at both stages with the scripts the run started with, on the input * and the settings it started with. Only `timeoutMs` may be given again. The * subagents are fresh, since no conversation is kept: each reads its * `reads:`, its ledger and the tree. The same journal goes on, under the same * lock, and the run's branch must be where `HEAD` is: a resume checks it, and * never switches to it. */ import { type FlowPorts } from "../check-run.ts"; import type { Fault } from "../fault.ts"; import { type FlowResult, type RunFlowOptions } from "./flow.ts"; /** * What a resume is given: where it runs, and the switches of a run. `model` * and `input` are the run's own, frozen: giving either refuses the resume. */ export type ResumeFlowOptions = Pick & { /** How the resumed run reaches the world, checked again at the run stage. */ readonly ports: FlowPorts; /** Whether a person can answer now: the run stage holds the flow to it, as at a start. */ readonly somebodyThere: boolean; /** Refused when given: the input is the run's own, kept in its snapshot. */ readonly input?: unknown; }; /** * How a resume ended: as the run did, with the visit it picked up from and a * line saying which flow files changed on disk since it started; or refused * before anything ran, with why, or with the faults of a check. */ export type Resumed = (FlowResult & { readonly from: string; readonly changed?: string; }) | { readonly ok: false; readonly refused: string; } | { readonly ok: false; readonly faults: readonly Fault[]; }; /** Resumes the run in `runDir`. Throws when the directory holds no snapshot: it holds no run. */ export declare function resumeFlow(runDir: string, options: ResumeFlowOptions): Promise; /** The run a resume would take, and the visit it picks up from; or the newest run, and why it cannot. */ export type Resumable = { readonly ok: true; readonly runDir: string; readonly from: string; } | { readonly ok: false; readonly runDir: string; readonly refused: string; }; /** * The newest run under `runsDir` started in `cwd` that a resume would take, * newest by directory name, which a run directory's timestamp makes its age * ({@link newestRunFirst}). * When none would, the newest run of `cwd` and why; nothing when `cwd` * started none there. A directory holding no snapshot holds no run, and one * that no longer reads or checks cannot be resumed by this version anyway. */ export declare function latestResumable(runsDir: string, cwd: string): Resumable | undefined; //# sourceMappingURL=resume.d.ts.map