/** * Core acquire loop + `StuckLockError` for the owned-lock primitive. * @module @skillsmith/core/config/owned-lock.acquire * @see owned-lock.ts for the full soundness argument and the PUBLIC API. * @see owned-lock.claim.ts for claim parsing, exclusive creation, and reclaim. * * INTERNAL module -- not part of the public surface (no `package.json` * subpath export), split out of `owned-lock.claim.ts` purely to keep both * files under the repo's 500-line-per-file gate. `owned-lock.ts`'s public * `acquireOwnedLock` is a thin wrapper over this file's * {@link acquireOwnedLockCore}; the cross-process race-test child harness * imports directly from here, by relative path, specifically to reach the * two destructive test-only options * ({@link AcquireOwnedLockCoreOptions.unsafeSkipReclaimRevalidation} and * `.linkSyncOverride`) that must NEVER be reachable via the public * `@skillsmith/core/config/owned-lock` subpath. */ import type { Claim, ReclaimOutcome, StuckLockReason } from './owned-lock.types.js'; /** * Thrown when {@link acquireOwnedLockCore} (and, through it, the public * `acquireOwnedLock`) times out. `reason` is a stable discriminant for * mechanical triage (never prose-matching); the message embeds the manual * unstick procedure verbatim. */ export declare class StuckLockError extends Error { readonly lockPath: string; readonly reclaimPath: string; readonly reason: StuckLockReason; constructor(lockPath: string, reclaimPath: string, label: string, reason: StuckLockReason, claim: Claim); } /** * Full internal option set, including the two options the public * `AcquireOwnedLockOptions` (owned-lock.types.ts) deliberately omits. */ export interface AcquireOwnedLockCoreOptions { timeoutMs?: number; label?: string; reclaimProbeAfterMs?: number; reclaimLockTimeoutMs?: number; onReclaimBoundary?: () => void; onReclaimOutcome?: (outcome: ReclaimOutcome) => void; /** @internal NEGATIVE CONTROL ONLY (owned-lock-reclaim-race.test.ts ยง8b). Removes the authoritative re-read that makes this mechanism sound -- reintroduces the round-3 lock-theft race on purpose. Never set outside that spec, and never reachable via the public acquireOwnedLock(). */ unsafeSkipReclaimRevalidation?: boolean; /** @internal test seam (owned-lock.test.ts item 14). Never reachable via the public acquireOwnedLock(). */ linkSyncOverride?: (existingPath: string, newPath: string) => void; } /** * A timing option as a finite, non-negative number of milliseconds. Anything * else (NaN, Infinity, a negative number) falls back to `fallback`: a NaN * deadline never passes, so it hung the synchronous wait loop forever * (SMI-6529 round 9). */ export declare function toTimingMs(value: number | undefined, fallback: number): number; /** * The full acquire loop. `owned-lock.ts`'s public `acquireOwnedLock` is a * thin wrapper over this that only ever forwards the PUBLIC-SAFE option * subset -- see the module-level comment above for why the two unsafe * options must never be reachable from there. */ export declare function acquireOwnedLockCore(target: string, opts?: AcquireOwnedLockCoreOptions): () => void; //# sourceMappingURL=owned-lock.acquire.d.ts.map