/** * pruner.ts * * `SnapshotPruner`, handles safe file-system deletion of expired checkpoint * artifacts on behalf of `RetentionPolicy`. * * Safety contract: * - The path must be a non-empty string before any I/O is attempted. * - Each deletion is attempted independently; failures do not abort others. * - Results are collected and returned as a `PruneResult` for audit. */ import type { CheckpointRecord, PruneOptions, PruneResult } from './types.js'; /** * Deletes checkpoint artifacts from the file system. * * Accepts an array of `CheckpointRecord` values, validates each path, and * performs deletion. Results are aggregated into a single `PruneResult`. * * @example * ```ts * const pruner = new SnapshotPruner(); * const result = await pruner.delete(candidates); * console.log(`Deleted ${result.deletedCount} checkpoints`); * ``` */ export declare class SnapshotPruner { /** * Delete the provided checkpoint records from the file system. * * Each record is processed independently so that a single failure does not * prevent deletion of other candidates. * * @param candidates - Records whose artifacts should be removed. * @returns `PruneResult` summarising successes and failures. */ delete(candidates: readonly CheckpointRecord[], options?: PruneOptions): Promise; /** * Validate that a path is safe to delete. * * Returns an error message string if the path is invalid, or `null` if safe. * * Guards: * - Path must be a non-empty string. * - Path must be absolute (prevent accidental relative-path deletions). * - Raw path must not contain `..` segments checked BEFORE normalization. * (After `path.normalize()`, traversal sequences are resolved and the `..` * check becomes dead code, e.g. `/foo/../../etc/passwd` normalizes to * `/etc/passwd` which no longer contains `..`. We therefore inspect the * raw input first.) * - Normalized path must still be absolute as a belt-and-suspenders check. */ private _validatePath; } //# sourceMappingURL=pruner.d.ts.map