UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

11 lines (10 loc) • 711 B
/** Acquire the CC-shape lock for `target` (a file or directory path). Returns a release fn that * THROWS if the lock was found compromised (stale-reclaimed mid-hold) — the caller's critical * section may have overlapped and its effects must not be silently trusted. */ export declare function acquireCcLock(target: string, opts?: { staleMs?: number; }): Promise<() => void>; /** Run `fn` under the CC lock for `target` — the adapters' single critical-section helper. A * compromised lock surfaces as a throw AFTER `fn` (the release fence), so a raced write is never * silently reported as success. */ export declare function withCcLock<T>(target: string, fn: () => T | Promise<T>): Promise<T>;