/** * #2661 root-fix — worktree leases. * * Registers which worktrees of a repository are currently "alive" (have a * running daemon actively heartbeating), independent of whether that * worktree's daemon is the elected repository supervisor (see * repo-supervisor.ts). A lease expires after 15 minutes without a heartbeat * — a removed worktree, or a daemon that crashed without a graceful * shutdown, becomes ineligible within one expiry window instead of lingering * forever in the registry. * * The registry lives under the user's home directory (not the workspace) so * it is visible to every worktree's daemon, keyed by repositoryId: * * ~/.claude-flow/leases/.json * * This is deliberately a thin, single-purpose registry — repo-supervisor.ts * is the piece that actually elects one process to own the recurring AI * worker schedule; leases only answer "which worktrees are currently live" * for status reporting and future supervisor-dispatched work. */ export declare const LEASE_TTL_MS: number; export interface LeaseRecord { worktreeRoot: string; pid: number; registeredAt: number; lastHeartbeat: number; } export declare class WorkspaceLeaseRegistry { private readonly dir; constructor(options?: { baseDir?: string; }); private fileFor; private ensureDir; private withLock; private readFile; private writeFile; /** Register or renew this process's lease on a worktree. Best-effort. */ heartbeat(repositoryId: string, worktreeRoot: string): Promise; /** Release this worktree's lease on graceful shutdown. Best-effort. */ release(repositoryId: string, worktreeRoot: string): Promise; /** * Active leases for a repository — expired (>15 min stale) or dead-PID * entries are excluded, not just filtered at read time, so callers never * see a worktree that's actually gone. */ listActive(repositoryId: string): LeaseRecord[]; /** True when the given worktree currently holds a live (non-expired) lease. */ isLeaseActive(repositoryId: string, worktreeRoot: string): boolean; } export declare function getWorkspaceLeaseRegistry(): WorkspaceLeaseRegistry; /** Test hook: reset the singleton (e.g. after changing RUFLO_AI_BUDGET_DIR). */ export declare function resetWorkspaceLeaseRegistryForTests(): void; //# sourceMappingURL=workspace-lease.d.ts.map