@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
21 lines • 1.38 kB
TypeScript
export declare const UNUSED_SNAPSHOT_GRACE_MS: number;
/**
* Runs `task` while holding the runtime root's lock; undefined when the lock stays busy.
* The lock is a directory, so creating it is atomic on every platform and filesystem.
*/
export declare function withRuntimeLock<T>(root: string, task: () => T): T | undefined;
/**
* Runs `build` as the only builder of snapshot `id`; undefined when another live builder keeps it
* past the wait. Building a snapshot copies thousands of files, so it runs under its own lock, not
* the runtime root's, and never blocks launches of snapshots that already exist. A lock whose
* holder died is taken over, and the dead builder's staging directories are removed first.
*/
export declare function withBuildLock<T>(root: string, id: string, build: () => Promise<T>, isAlive?: (pid: number) => boolean): Promise<T | undefined>;
export declare function isProcessAlive(pid: number): boolean;
export declare function claimRuntimeSnapshot(snapshotDir: string, pid: number): void;
/**
* Removes snapshots no live process claims and nobody used within the grace period, plus
* staging and trash leftovers of crashed launches. `keep` is the snapshot this launch runs.
*/
export declare function pruneRuntimeSnapshots(root: string, keep: string, now: number, isAlive?: (pid: number) => boolean): void;
//# sourceMappingURL=registry.d.ts.map