/** * resource-lease — register resources BEFORE they are created, verify ownership * on cleanup/reconciliation. * * G-026 M3 (ADR-0004 #5/#11/#26): a lease is registered before any tmux * session/pane or L1 child is created. It carries the one-time nonce, backend, * worker PID/process group, tmux identity (detached session OR split-pane host * + worker pane), cwd, created-at and the cleanup deadline. Cleanup that cannot * uniquely confirm ownership is UNCONFIRMED — never guessed from task-id * prefixes, never auto-adopted/killed. */ import { type ResourceLease } from "./file-layout.js"; import type { AttemptContext } from "./attempt-context.js"; export interface LeaseRegistration { lease: ResourceLease; /** Absolute path to lease.json. */ path: string; } /** Register a lease BEFORE any resource is created. Throws on write failure (fail-closed). */ export declare function leaseBeforeSpawn(ctx: AttemptContext, backend: ResourceLease["backend"], opts?: Partial>): Promise; /** Read the lease for an attempt (undefined when not registered). */ export declare function readAttemptLease(ctx: AttemptContext): Promise; /** * Verify ownership of a live resource against the lease. * Returns "confirmed" only when the lease exists and the queried resource * (process group / tmux session / pane) uniquely matches the lease identity. * Anything else → "unconfirmed" (fail-closed; no auto adoption, no guessing). */ export declare function verifyLeaseIdentity(lease: ResourceLease | undefined, query: { pid?: number; pgid?: number; sessionName?: string; paneId?: string; hostSessionName?: string; }): { ok: boolean; reason: string; };