/** * Default admission window. Matches the 15-minute dedupe window that * `wake-state.ts` already used for re-sync, so the two mechanisms agree on how * long "recently" means instead of each inventing its own horizon. */ export declare const DEFAULT_CLAIM_TTL_MS: number; export interface WakeClaim { agentId: string; taskId: string; /** Who took it - the daemon pid, or the CLI pid for a manual run. */ pid: number; /** The wake type that won admission, for diagnostics. */ wakeType: string; at: string; expiresAt: number; } export interface ClaimAttempt { /** True when THIS caller now owns admission. */ claimed: boolean; /** The live claim that already holds it, when `claimed` is false. */ heldBy?: WakeClaim; } /** * Try to admit a wake. Exactly one concurrent caller gets `claimed: true`; * every other caller is told who holds it so it can queue or report instead of * spawning a second run into the same task. * * Never throws - a persistence problem must not stop a wake, so a failure to * claim is reported as `claimed: false` when we can prove a live holder exists * (or that another process is mid-write on the claim file), and otherwise * falls open to the caller (the per-agent lock remains the last line of * defence for actual concurrent execution). */ export declare function tryClaimWake(agentId: string, taskId: string, wakeType: string, opts?: { ttlMs?: number; pid?: number; }): ClaimAttempt; /** Release a claim this process owns. A foreign claim is never cleared. */ export declare function releaseWake(agentId: string, taskId: string, pid?: number): void; /** The live claim for a task, or null. Exposed for /status and diagnostics. */ export declare function readWakeClaim(agentId: string, taskId: string): WakeClaim | null; /** Every live claim, for `doctor` and the probe's arbitration status. */ export declare function listLiveWakeClaims(): WakeClaim[]; /** Drop claims whose holder is gone. Cheap sweep; safe to call anywhere. */ export declare function sweepDeadWakeClaims(): number;