/** * The session writer leases this process holds, so a process that is told to * stop can give them back before it exits. * * A turn renews its lease while it runs and releases it when it settles. A * process that is terminated mid-turn (SIGTERM from a supervisor, SIGHUP when * its terminal closes) settles nothing, and without this its lease stays live * until it expires: the session refuses `/resume`, `/abandon` and a new prompt * for up to the lease's time-to-live although no process is writing to it. * * {@link releaseHeldSessionLeases} publishes a release for every holding, * which leaves a running turn `interrupted` (no live lease, not paused; spec * §4.5): the next writer takes the session at once and closes the turn * through the explicit flow — `abandonTurn`, `resumeSession`, or * `beginTurn({ abandonInterrupted })`. Nothing is appended on the way out, * because the dying process cannot know how far its turn got. * * A process killed with SIGKILL runs no code; its lease is freed by expiry. */ /** One log instance's current holding, released under that log's own write order. */ export interface HeldSessionLease { release(): Promise; } /** A claim made after {@link releaseHeldSessionLeases}: this process is on its way out. */ export declare class SessionLeasesReleasedError extends Error { readonly name = "SessionLeasesReleasedError"; constructor(); } /** @internal Record a holding a log instance took. */ export declare function trackHeldSessionLease(holding: HeldSessionLease): void; /** @internal Forget a holding its log instance gave up. */ export declare function untrackHeldSessionLease(holding: HeldSessionLease): void; /** @internal Whether this process has released its leases to exit. */ export declare function sessionLeasesReleasedForExit(): boolean; export interface ReleaseHeldSessionLeasesOptions { /** * How long to wait for the releases. Each waits for its log's write in * flight, if any, so a release never lands under a half-written record. * Default 2000. */ readonly timeoutMs?: number; } export interface ReleaseHeldSessionLeasesResult { /** Holdings whose release landed (or was already stale: somebody took the session over). */ readonly released: number; /** Holdings whose release had not landed when the wait ended, or failed; expiry frees those. */ readonly unfinished: number; } /** * Give back every session writer lease this process holds, for a process that * is about to exit. From the first call on, every later claim in this process * is refused with {@link SessionLeasesReleasedError}, so a turn still unwinding * cannot renew or retake the lease it just gave up. Never throws. */ export declare function releaseHeldSessionLeases(options?: ReleaseHeldSessionLeasesOptions): Promise; //# sourceMappingURL=held-leases.d.ts.map