import type { BatchProgress } from './batch-progress-types.js'; /** The batch that is running, and the record that says so. */ export interface ActiveBatch { readonly batchId: string; readonly progress: BatchProgress; } /** * The ids of the batches this session holds a record for. * * This function only READS a directory, so it does not throw. A session id * that is not one safe path segment is refused by `getSessionDir` — and * refusing to LOOK is the whole answer here: there are no batches to list. * The refusal still stands for everything that WRITES under the session * directory; this is a reader. * * @returns The ids, or an empty list when the session has no batches. */ export declare function listBatchIds(projectRoot: string, sessionId: string): readonly string[]; /** * The batch that is in flight, if one is. * * @returns The running batch, or `null` when the session holds no batch, * only finished batches, or only records that cannot be read. */ export declare function findActiveBatch(projectRoot: string, sessionId: string): ActiveBatch | null; /** * Whether a batch record is at a COMPACTION BOUNDARY. * * The batch's phase machine is linear — diagnosis → topology → fix → verify * → done — so the phase alone says whether a boundary has been crossed: a * batch in `topology` has just crossed ①→②, and a batch in `verify` has * just crossed ③→④. In both cases the stage that just finished has its * results on disk and its agents are done, which is exactly the moment * compaction is cheapest: the recovery cost is the lowest it will be, and * the window is at its heaviest. * * A batch in `diagnosis` or `fix` is mid-stage, with agents in flight: that * is the case the existing in-flight deferral is for. */ export declare function isBatchAtCompactionBoundary(progress: BatchProgress): boolean; /** * Whether a batch in this project is at a compaction boundary. * * THIS FUNCTION NEVER THROWS. It is called on EVERY auto-compact run, and * the batch lookup is ADVISORY: a batch in flight is a hint about the * cheapest moment to compact, never a precondition for compacting. So a * failure to determine whether a batch is at a boundary means "assume not * at a boundary" — the compaction path carries on exactly as it did before * this lookup existed. * * Fail-safe: `false` when there is no batch in flight, when its record * cannot be read, when the session id is not usable, and when the batch is * mid-stage. */ export declare function resolveBatchCompactionBoundary(projectRoot: string, sessionId: string): boolean;