/** The handoff that is running, as the handoff script wrote it down. */ export interface Lease { /** The issue whose window is open. */ issue: string; /** The handoff script's own pid, which lives as long as the tool does. */ pid: number; startedAt: string; } export declare function leasePath(projectDir: string): string; /** * The lease being held right now, or null. * * A file naming a process that has gone is cleared as it is read: the handoff * that wrote it cannot come back to tidy up, and leaving it would mean every * later read pays the same syscall to reach the same answer. */ export declare function readLease(projectDir: string): Lease | null; /** Whether anything holds the queue. What the pump asks. */ export declare function leaseHeld(projectDir: string): boolean; export declare function clearLease(projectDir: string): void; /** * The shell that takes the lease, runs the tool, and drops it however it ends. * * Written as lines for the handoff script to splice in. Three things it must * keep, each of which is a queue that stops moving if it slips: * * 1. **No `exec`.** Replacing the shell with the tool leaves nothing to run the * trap, so the lease outlives the session and its pid stays alive because it * IS the tool's pid. * 2. **The trap covers the ways a Terminal really ends**, which is mostly * somebody closing the window: HUP, not just a clean EXIT. * 3. **`$$` is the script's own pid**, and the script stays in the foreground * for the whole session, so "the lease's process is alive" and "the agent is * still going" are the same question. */ export declare function leaseScript(projectDir: string, issue: string, command: string): string;