@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
18 lines • 687 B
TypeScript
/** One caller's hold on a `KeyLock` key. Mirrors Python's KeyHold. */
export interface KeyHold {
/** Let the key go while `fn` runs, then wait for it again. */
released<T>(fn: () => Promise<T>): Promise<T>;
}
export declare class KeyLock {
private readonly queues;
withLock<T>(key: string, fn: (hold: KeyHold) => Promise<T>, signal?: AbortSignal): Promise<T>;
/** Whether someone holds the key now. */
held(key: string): boolean;
discard(key: string): void;
clear(): void;
/** The key's queue: taken at once when the key is free, else once its
* holder hands it over. */
private enter;
private leave;
}
//# sourceMappingURL=lock.d.ts.map