import type DatabaseCtor from "better-sqlite3";
import type { TaskEntity } from "../types.js";
type SqliteDb = InstanceType<typeof DatabaseCtor>;
export type DashboardCurrentPhaseQueue = {
    ready: number;
    proposed: number;
    blocked: number;
    inProgress: number;
    research: number;
};
export type DashboardCurrentPhaseSegments = {
    completed: number;
    cancelled: number;
    inProgress: number;
    ready: number;
    proposed: number;
    blocked: number;
    research: number;
};
export type DashboardCurrentPhaseDelivery = {
    schemaVersion: 2;
    phaseKey: string | null;
    closeoutPassed: boolean;
    released: boolean;
    remainingCount: number;
    terminalCount: number;
    checkedTaskCount: number;
    /** All non-archived tasks in this phase (any type), by queue status. */
    queue: DashboardCurrentPhaseQueue;
    /** Phase delivery tasks only — drives the progress bar segments. */
    segments: DashboardCurrentPhaseSegments;
    /** Completed + cancelled delivery tasks / all delivery tasks in phase. */
    progressPercent: number;
    /** 100 when `closeoutPassed`; otherwise mirrors `progressPercent` (cap 99). */
    releaseReadyPercent: number;
    /** Delivery-evidence preflight violations for phase delivery tasks (0 when none or no phase). */
    deliveryEvidenceViolationCount: number;
};
/** Phase keys with closeout-passed delivery evidence among workspace rollover candidates. */
export declare function collectDeliveredPhaseKeys(db: SqliteDb, tasks: TaskEntity[], limit?: number): string[];
/**
 * Phase key → ISO timestamp when workspace rolled off that phase (`previousCurrentKitPhase`
 * on `set_current_phase` events). Later rollovers overwrite earlier entries for the same key.
 */
export declare function collectPhaseReleaseDatesByKey(db: SqliteDb, limit?: number): Record<string, string>;
/** Unique phase keys rolled off via `set_current_phase` events (newest events first, capped). */
export declare function collectRolledOutPhaseKeys(db: SqliteDb, limit?: number): string[];
/**
 * Phase keys with at least one non-terminal, non-archived task (ready, proposed, in progress, etc.).
 * Dashboard roster and schedule tags keep these visible even when legacy rollover marks the phase delivered.
 */
export declare function collectPhaseKeysWithActiveQueueWork(tasks: TaskEntity[]): string[];
/** True when a live `set-current-phase` rolled workspace off this phase key. */
export declare function wasWorkspacePhaseRolledOut(db: SqliteDb, phaseKey: string): boolean;
/** Phase ordinal strictly before workspace `currentKitPhase` (roster Delivered semantics). */
export declare function isPhaseBehindWorkspaceCurrent(phaseKey: string, workspaceStatus: {
    currentKitPhase?: string | null;
} | null | undefined): boolean;
export declare function countPhaseQueueMetrics(tasks: TaskEntity[], phaseKey: string | null): DashboardCurrentPhaseQueue;
export declare function countPhaseDeliverySegments(tasks: TaskEntity[], phaseKey: string | null): DashboardCurrentPhaseSegments;
export declare function segmentTotal(segments: DashboardCurrentPhaseSegments): number;
export declare function buildDashboardCurrentPhaseDelivery(args: {
    tasks: TaskEntity[];
    workspaceStatus: {
        currentKitPhase?: string | null;
        nextKitPhase?: string | null;
    } | null;
    db: SqliteDb | null;
    effectiveConfig?: Record<string, unknown>;
}): DashboardCurrentPhaseDelivery;
export {};
