@essentialai/cogent-bridge
Version:
Cogent Bridge — cross-agent comms for Claude Code, OpenAI Codex and Slack. Codex users: install with `curl -fsSL https://cogent.tools/install.sh | sh`, then start with `cogent-codex` for real-time peer wake.
30 lines • 1.6 kB
TypeScript
/** Hard ceiling on how long one lease may exclude others. Mirrors wake-claim's CLAIM_MAX_MS. */
export declare const WAKE_LOCK_MAX_MS = 1800000;
/** `~/.cogent/wake-locks/<sha256(cwd)[..16]>.json` — ONE checkout, ONE turn. */
export declare function wakeLockPath(cwd?: string): string;
export interface WakeLease {
/** True whenever the caller may wake — including every fail-open path. */
acquired: boolean;
/** Milliseconds spent waiting for another process. 0 when uncontended. */
waitedMs: number;
/** True when another live process held the lease and we had to wait for it. */
contended: boolean;
/** Idempotent. Safe to call even when the lease was never really taken. */
release: () => void;
}
/**
* Become the single process running an agent turn in `cwd`, waiting out any other holder.
*
* `sessionId` is recorded in the lease for diagnostics; it is NOT part of the key (see the header).
*
* Never returns `acquired: false` today — every path either takes the lease or fails open — but the
* field is explicit so a caller reads the intent rather than assuming it.
*/
export declare function acquireWakeLock(cwd?: string, sessionId?: string, opts?: {
maxWaitMs?: number;
}): Promise<WakeLease>;
/** Test-only: reset the in-process nesting counter. Production code must never call this. */
export declare function __resetWakeLockDepthForTests(): void;
/** Release the lease. Best-effort; an orphan expires or is stolen when its holder dies. */
export declare function releaseWakeLock(cwd?: string): void;
//# sourceMappingURL=wake-lock.d.ts.map