@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
20 lines • 936 B
TypeScript
import lockfile from "proper-lockfile";
export type FileLockOptions = Omit<lockfile.LockOptions, "onCompromised"> & {
/** Called once, while the lock is still held, when the lock is reported compromised. Must not throw. */
onLost?: (error: Error) => void;
};
export interface HeldFileLock {
/** Releases the lock. A lost lock is already gone, so releasing it is a no-op. */
release(): Promise<void>;
/** True once the lock was reported compromised while held. */
lost(): boolean;
/** Throws FileLockLostError when the lock was lost; call right before the commit step. */
assertHeld(): void;
}
export declare class FileLockLostError extends Error {
readonly code = "ELOCKLOST";
readonly path: string;
constructor(path: string, cause: Error);
}
export declare function lockWithLossHandling(path: string, options?: FileLockOptions): Promise<HeldFileLock>;
//# sourceMappingURL=file-lock.d.ts.map