/**
 * Serialize async work on a file path within this process. Returns the
 * result of `fn`. While `fn` is in flight, any other call with the same
 * absolute path queues and runs after `fn` settles.
 *
 * The internal Promise chain always resolves (never rejects), so one
 * caller's failure does NOT poison subsequent callers. The original
 * rejection is rethrown to the failing caller only.
 *
 * Memory: one Promise reference per unique path that's ever been locked.
 * Bounded by the number of distinct files the harness uses — small.
 *
 * Caller MUST pass an absolute path. Relative paths can alias across
 * cwd changes and break the contract.
 */
export declare function withFileLock<T>(absolutePath: string, fn: () => Promise<T>): Promise<T>;
export interface AtomicWriteOptions {
    encoding?: BufferEncoding;
    /** File mode (e.g. 0o600 for secret-bearing files). */
    mode?: number;
}
/**
 * Crash-safe write: writes to a unique sibling temp file then renames
 * over the destination. The temp file lives in the same directory so
 * `rename` is atomic on POSIX and atomic-ish on Windows (with retry on
 * the transient EPERM/EBUSY/EACCES that the OS surfaces when antivirus
 * or another reader briefly holds the destination).
 *
 * On rename failure the temp file is cleaned up best-effort so the
 * directory does not accumulate orphan `.tmp.*` files.
 */
export declare function atomicWriteFile(absolutePath: string, data: string | Buffer, options?: AtomicWriteOptions): Promise<void>;
/** Test-only: clear the lock chain map. Do not use in production code. */
export declare function _resetFileLocksForTest(): void;
//# sourceMappingURL=atomicFile.d.ts.map