import type { GoalId, PlanRevisionId, TaskId } from "@awp/contracts";
import type { Task } from "./model.js";
export type QueueReadiness = "RUNNING" | "READY" | "BLOCKED_DEPENDENCY" | "BLOCKED_POLICY" | "WAITING_USER" | "PAUSED" | "DONE" | "CANCELLED";
export interface QueueEntry {
    readonly taskId: TaskId;
    readonly planRevisionId: PlanRevisionId;
    readonly goalIds: readonly GoalId[];
    readonly position: number;
    readonly readinessState: QueueReadiness;
    readonly unsatisfiedDependencyIds: readonly TaskId[];
    readonly policyBlocked?: boolean;
    readonly waitingUser?: boolean;
    readonly paused?: boolean;
}
export interface LegalPlacementRange {
    readonly earliestLegalPosition: number;
    readonly latestLegalPosition: number;
    readonly blockingDependencies: readonly TaskId[];
    readonly blockingDependents: readonly TaskId[];
}
export declare class QueueOrderConstraintError extends Error {
    readonly entryId: TaskId;
    readonly desiredPosition: number;
    readonly legalRange: LegalPlacementRange;
    readonly code = "QUEUE_ORDER_CONSTRAINT";
    constructor(entryId: TaskId, desiredPosition: number, legalRange: LegalPlacementRange);
}
export declare function buildQueue(tasks: readonly Task[], requestedOrder: readonly TaskId[]): readonly QueueEntry[];
export declare function legalPlacementRange(task: Task, order: readonly TaskId[], tasks: readonly Task[]): LegalPlacementRange;
export declare function moveTaskToPosition(order: readonly TaskId[], taskId: TaskId, desiredPosition: number, tasks: readonly Task[]): readonly TaskId[];
export declare function isDispatchEligible(task: Task, tasks: readonly Task[], options?: {
    approvalsSatisfied?: boolean;
    executionProfileResolved?: boolean;
    providerCapacityAvailable?: boolean;
    paused?: boolean;
    policyAllows?: boolean;
}): boolean;
//# sourceMappingURL=queue.d.ts.map