/**
 * Hardened multi-agent locking: leases, heartbeats, stale recovery, safe steal.
 */
import type { Database } from "bun:sqlite";
import { type Task } from "../db/tasks.js";
export declare const AGENT_COORDINATION_SCHEMA = "todos.agent_coordination.v1";
export declare const DEFAULT_LEASE_MINUTES = 30;
export interface TaskLease {
    task_id: string;
    agent_id: string;
    acquired_at: string;
    expires_at: string;
    heartbeat_at: string | null;
    steal_count: number;
}
export interface LeaseAcquireResult {
    success: boolean;
    lease?: TaskLease;
    conflict?: LockConflict;
}
export interface LockConflict {
    task_id: string;
    holder: string;
    locked_at: string | null;
    expires_at: string | null;
    message: string;
}
export interface StaleRecoveryResult {
    recovered: Array<{
        task_id: string;
        previous_agent: string | null;
        action: string;
    }>;
    stolen: Task | null;
}
export declare function formatLockConflict(taskId: string, holder: string, lockedAt: string | null, expiresAt?: string | null): LockConflict;
export declare function acquireTaskLease(taskId: string, agentId: string, ttlMinutes?: number, db?: Database): LeaseAcquireResult;
export declare function renewTaskLease(taskId: string, agentId: string, ttlMinutes?: number, db?: Database): TaskLease;
export declare function releaseTaskLease(taskId: string, agentId: string, db?: Database): boolean;
export declare function stealTaskLease(taskId: string, agentId: string, options?: {
    force?: boolean;
    stale_minutes?: number;
    reason?: string;
}, db?: Database): LeaseAcquireResult;
export declare function listExpiredLeases(db?: Database): TaskLease[];
export declare function listActiveLeases(agentId?: string, db?: Database): TaskLease[];
export declare function recoverStaleLeases(options?: {
    reclaim_agent?: string;
    stale_minutes?: number;
}, db?: Database): StaleRecoveryResult;
export declare function getTaskLease(taskId: string, db?: Database): TaskLease | null;
//# sourceMappingURL=agent-coordination.d.ts.map