/**
 * V2 Task Claim Type Definitions
 *
 * Claims represent an agent's active hold on a WorkItem from the Task Pool.
 * The claim system uses lease + heartbeat to ensure liveness:
 * - Lease: 10 minutes default, agent must renew before expiry
 * - Heartbeat: 2 minutes, agent signals it's still working
 * - Grace period: 3 minutes after lease expiry before forced release
 *
 * @module types/v2/claim.types
 */
/**
 * Lifecycle statuses for a TaskClaim.
 */
export type ClaimStatus = 'active' | 'expiring' | 'released' | 'revoked';
/** All valid ClaimStatus values. */
export declare const CLAIM_STATUSES: readonly ClaimStatus[];
/**
 * Represents an agent's claim on a WorkItem from the Task Pool.
 *
 * The claim lifecycle:
 *   1. Agent calls claimFromPool() → TaskClaim created (status: 'active')
 *   2. Agent sends heartbeats every 2 minutes → lastHeartbeatAt updated
 *   3a. Agent finishes → releases claim (status: 'released')
 *   3b. Lease expires → Reconciler sets 'expiring', starts grace period
 *   4. Grace period exceeded → Reconciler revokes (status: 'revoked'), WorkItem back to pool
 */
export interface TaskClaim {
    /** UUID v4 */
    id: string;
    /** WorkItem ID being claimed */
    workItemId: string;
    /** Agent session name that holds the claim */
    agentId: string;
    /** Current claim status */
    status: ClaimStatus;
    /** ISO8601 — when the claim was created */
    claimedAt: string;
    /** ISO8601 — when the lease expires (claimedAt + leaseDurationMs) */
    leaseExpiresAt: string;
    /** ISO8601 — last heartbeat received from the agent */
    lastHeartbeatAt: string;
    /** Number of lease extensions granted */
    extensionCount: number;
    /** Maximum allowed extensions (default: 3) */
    maxExtensions: number;
    /** Lease duration in ms (default: 600000 = 10 min) */
    leaseDurationMs: number;
    /** ISO8601 — when the claim ended (release or revoke) */
    endedAt?: string;
    /** Reason for release or revocation */
    endReason?: string;
}
/**
 * Input for creating a new claim.
 */
export interface CreateClaimInput {
    workItemId: string;
    agentId: string;
    leaseDurationMs?: number;
    maxExtensions?: number;
}
/** Default lease duration: 10 minutes. */
export declare const DEFAULT_LEASE_DURATION_MS = 600000;
/** Default heartbeat interval: 2 minutes. */
export declare const DEFAULT_HEARTBEAT_INTERVAL_MS = 120000;
/** Default grace period after lease expiry: 3 minutes. */
export declare const DEFAULT_GRACE_PERIOD_MS = 180000;
/** Default maximum lease extensions. */
export declare const DEFAULT_MAX_EXTENSIONS = 3;
/**
 * Checks whether a string is a valid ClaimStatus.
 *
 * @param value - The string to check
 * @returns True if value is a valid ClaimStatus
 */
export declare function isValidClaimStatus(value: string): value is ClaimStatus;
/**
 * Validates that an unknown value is structurally a valid TaskClaim.
 *
 * @param value - Unknown value to validate
 * @returns True if value conforms to the TaskClaim interface
 */
export declare function isTaskClaim(value: unknown): value is TaskClaim;
/**
 * Checks whether a claim's lease has expired (not counting grace period).
 *
 * @param claim - The claim to check
 * @param now - Current time (defaults to Date.now())
 * @returns True if the lease has expired
 */
export declare function isLeaseExpired(claim: TaskClaim, now?: number): boolean;
/**
 * Checks whether a claim is past its grace period and should be revoked.
 *
 * @param claim - The claim to check
 * @param gracePeriodMs - Grace period duration in ms
 * @param now - Current time (defaults to Date.now())
 * @returns True if grace period has exceeded
 */
export declare function isGracePeriodExceeded(claim: TaskClaim, gracePeriodMs?: number, now?: number): boolean;
/**
 * Checks whether a claim can be extended (has not exhausted max extensions).
 *
 * @param claim - The claim to check
 * @returns True if another extension is allowed
 */
export declare function canExtendLease(claim: TaskClaim): boolean;
/**
 * Validates CreateClaimInput and returns an array of error messages.
 *
 * @param input - The creation input to validate
 * @returns Array of validation error strings (empty = valid)
 */
export declare function validateCreateClaimInput(input: CreateClaimInput): string[];
/**
 * Creates a new TaskClaim with sensible defaults.
 *
 * @param input - Required and optional creation fields
 * @returns A fully populated TaskClaim object
 *
 * @example
 * ```typescript
 * const claim = createTaskClaim({
 *   workItemId: 'wi-abc-123',
 *   agentId: 'crewly-product-leo-member-n',
 * });
 * // claim.leaseExpiresAt will be 10 minutes from now
 * ```
 */
export declare function createTaskClaim(input: CreateClaimInput): TaskClaim;
/**
 * Extends a claim's lease by the original lease duration.
 * Returns a new claim object (immutable pattern).
 *
 * @param claim - The claim to extend
 * @returns New TaskClaim with extended lease, or null if extension not allowed
 */
export declare function extendClaim(claim: TaskClaim): TaskClaim | null;
//# sourceMappingURL=claim.types.d.ts.map