/** Minimal logger surface so this helper stays decoupled from the winston * instance threaded through `dev.mts` (and trivially fakeable in tests). */ interface ReclaimLogger { info: (message: string, meta?: unknown) => void; warn: (message: string, meta?: unknown) => void; } interface DiskSpace { totalBytes: number; freeBytes: number; usedBytes: number; /** Whole-number percent of the volume in use (0–100). */ percentUsed: number; } /** The error shape `util.promisify(exec)` rejects with (stdout/stderr/message * preserved separately). */ interface ExecLikeFailure { stdout?: string; stderr?: string; message?: string; } /** True when an exec-style failure looks like a disk-full (ENOSPC) error. */ export declare function isDiskFullError(failure: ExecLikeFailure): boolean; /** Best-effort `df` for the filesystem backing `dir`. Returns `undefined` if * the path can't be statfs'd (missing dir, unsupported platform) — callers * treat disk telemetry as advisory and must never fail an install over it. */ export declare function getDiskSpace(dir: string): Promise; interface ReclaimResult { /** Bytes reclaimed, measured as the increase in filesystem free space across * the deletions (a `statfs` delta). O(1) — deliberately NOT a directory walk: * sizing a real `node_modules` (50k–200k files) on an already-ENOSPC volume * could block recovery for minutes just to produce an advisory number. */ bytesFreed: number; /** cwd-relative paths that existed and were deleted (for telemetry). */ removed: string[]; } interface ReclaimOptions { /** Also remove `node_modules` — the tier-2 lever. After an ENOSPC mid- * install the tree is half-written anyway, so a clean reinstall is the * correct recovery AND it collapses the "old tree + new tree" 2× peak that * the private-registry validation install otherwise holds on the volume. */ includeNodeModules?: boolean; } /** Delete regenerable build artifacts under `cwd` to recover space after an * ENOSPC. Strictly scoped to `cwd`, best-effort (a failure on one target * never aborts the rest), and safe to call unconditionally. * * NOTE: `cwd` is always the Superblocks-managed app directory (the live-edit * PVC mount). The bare `build`/`dist` entries in `RECLAIMABLE_ARTIFACTS` are * only safe under that invariant; never call this against an arbitrary or * user-supplied path. */ export declare function reclaimDiskSpace(cwd: string, logger: ReclaimLogger, options?: ReclaimOptions): Promise; interface DiskRecoveryResult { recovered: boolean; /** The error from the final failed install attempt, when recovery failed — * so the caller can reclassify it for the most accurate surfaced error. */ lastError?: unknown; } /** Recover from an ENOSPC install failure by reclaiming disk space in * escalating tiers and retrying the install after each: * * Tier 1 — regenerable build caches only (cheap, non-destructive). * Tier 2 — also `node_modules` (a clean reinstall: collapses the * "old tree + new tree" 2× peak and discards the half-written * tree the ENOSPC left behind). * * `runInstall` re-runs the exact same install the caller already attempted. * Returns `{ recovered: true }` as soon as a retry succeeds; otherwise * `{ recovered: false, lastError }` so the caller surfaces an honest * disk_full error. Every tier's `df` + freed bytes are logged so a future * ENOSPC documents its own volume composition — the only way to inspect a * live-edit PVC that `reclaimPolicy: Delete` destroys at teardown. */ export declare function recoverFromDiskFull(cwd: string, runInstall: () => Promise, logger: ReclaimLogger): Promise; export {}; //# sourceMappingURL=disk-space.d.mts.map