export type WorkspaceEditLeaseDirtyManifest = {
    lineCount: number;
    capped: boolean;
};
/** Persisted under `$GIT_COMMON_DIR/workflow-cannon/leases/workspace-edit.json`. */
export type WorkspaceEditLeaseV1 = {
    schemaVersion: 1;
    leaseId: string;
    agentSessionId: string;
    taskId: string | null;
    branch: string | null;
    headSha: string | null;
    worktreePath: string;
    dirtyManifest: WorkspaceEditLeaseDirtyManifest;
    claimedAt: string;
    heartbeatAt: string;
    expiresAt: string;
};
export type WorkspaceEditLeaseAlternatives = "wait" | "read_only_plan" | "release_if_holder" | "recover_stale_lease";
export type WorkspaceEditLeaseStatusKind = "lease-free" | "lease-held-by-me" | "lease-held-by-other" | "stale-invalid";
export type WorkspaceEditLeaseSuspectFlag = "lease:branch_drift" | "lease:head_drift" | "lease:worktree_path_drift" | "lease:dirty_manifest_drift" | "lease:stale_or_invalid";
export type WorkspaceEditLeaseHolderSummary = {
    agentSessionId: string;
    taskId: string | null;
    expiresAt: string;
};
export type WorkspaceEditLeaseStatusV1 = {
    schemaVersion: 1;
    state: WorkspaceEditLeaseStatusKind;
    present: boolean;
    active: boolean;
    staleOrInvalid: boolean;
    expiresAt: string | null;
    holder: WorkspaceEditLeaseHolderSummary | null;
    heldByCaller: boolean | null;
    invalidReason: string | null;
};
export declare function runGit(workspacePath: string, argv: string[]): {
    code: number;
    stdout: string;
    stderr: string;
};
export declare function resolveGitPath(workspacePath: string, raw: string | null): string | null;
export declare function resolveGitCommonDir(workspacePath: string): string | null;
export declare function leaseFilePathFromCommonDir(gitCommonDir: string): string;
export declare function gatherCheckoutFingerprint(workspacePath: string): {
    worktreePath: string | null;
    branch: string | null;
    headSha: string | null;
    dirtyManifest: WorkspaceEditLeaseDirtyManifest;
};
export declare function detectWorkspaceEditLeaseSuspectFlags(lease: WorkspaceEditLeaseV1, current: ReturnType<typeof gatherCheckoutFingerprint>): WorkspaceEditLeaseSuspectFlag[];
export declare function parseIsoOrNull(iso: unknown): number | null;
export declare function isLeaseExpired(expiresAt: string): boolean;
export declare function summarizeWorkspaceEditLeaseStatus(leasePath: string, callerAgentSessionId?: string | null): WorkspaceEditLeaseStatusV1;
export declare function readLeaseFile(leasePath: string): {
    ok: true;
    lease: WorkspaceEditLeaseV1;
} | {
    ok: false;
    reason: string;
};
export declare function writeLeaseAtomic(leasePath: string, lease: WorkspaceEditLeaseV1): void;
export declare function deleteLeaseBestEffort(leasePath: string): boolean;
export declare function defaultTtlMs(argsTtl: unknown): number;
export declare function clampExtendSeconds(raw: unknown, fallback: number): number;
