/**
 * Pure logic for cleanup-stale-pool — extracted into a library so the
 * stale-rule, KEEP_LIST derivation, and classification logic can be
 * exercised by a unit test without spinning up the live backend.
 *
 * The CLI (`cleanup-stale-pool.ts`) is a thin shell that fetches WIs
 * via HTTP and calls {@link classifyPoolForCleanup} on the result.
 *
 * @module scripts/cleanup-stale-pool.lib
 */
/**
 * The minimal WorkItem shape this library actually reads. Defined as a
 * narrow structural type so the library does not depend on the full
 * backend type graph (which would force the CLI to bundle backend
 * source). Production payloads from `/api/task-pool/items` carry many
 * more fields — they are passed through unchanged.
 */
export interface MinimalWorkItem {
    id: string;
    status: string;
    createdAt: string;
    target?: string;
    parentWorkItemId?: string;
    parentRequestId?: string;
    requestId?: string;
    [key: string]: unknown;
}
/**
 * Hardcoded WI ids that must NEVER be deleted regardless of age.
 * These are ORC-parked umbrella WIs and audit-trail entries Steve
 * referenced as "keep-no-matter-what" in the dispatch.
 *
 * Children of these (via `parentWorkItemId`) are also kept — see
 * {@link classifyPoolForCleanup}.
 */
export declare const DEFAULT_KEEP_IDS: readonly string[];
/**
 * Parent Request ids whose child WIs must never be deleted regardless
 * of age. The pool-umbrella Request from Steve's directive sits here.
 */
export declare const DEFAULT_KEEP_PARENT_REQUEST_IDS: readonly string[];
/** Inputs for {@link classifyPoolForCleanup}. */
export interface CleanupOptions {
    /**
     * ISO8601 cutoff. WorkItems with `createdAt` strictly before this
     * timestamp are stale candidates (subject to KEEP_LIST overrides).
     */
    cutoff: string;
    /** Hardcoded WI ids that must always survive. */
    keepIds?: readonly string[];
    /** Parent Request ids whose children must always survive. */
    keepParentRequestIds?: readonly string[];
}
/** Output of {@link classifyPoolForCleanup}. */
export interface CleanupClassification {
    /** WorkItems that should be deleted. */
    stale: MinimalWorkItem[];
    /** WorkItems retained because `createdAt >= cutoff` (today's work). */
    keptToday: MinimalWorkItem[];
    /** WorkItems retained because they hit the KEEP_LIST. */
    keptByAllowlist: MinimalWorkItem[];
}
/**
 * Apply the stale rule against an in-memory pool snapshot.
 *
 * Stale rule (single clause):
 *   STALE iff createdAt < cutoff AND id NOT IN dynamic KEEP_LIST
 *
 * Dynamic KEEP_LIST is the union of:
 *   1. Hardcoded ids (`opts.keepIds`).
 *   2. Any WI whose `parentWorkItemId` is in the hardcoded id set
 *      (umbrella sub-WIs).
 *   3. Any WI whose `parentRequestId` (or `requestId`) is in
 *      `opts.keepParentRequestIds`.
 *
 * Pure function — no I/O, no logging. The CLI handles printing and
 * HTTP. This separation lets the unit test pin the rule and KEEP-LIST
 * derivation without touching the network or filesystem.
 *
 * @param items - The full pool snapshot (typically from
 *   `GET /api/task-pool/items`).
 * @param opts - Cutoff + allow-list seed.
 * @returns A {@link CleanupClassification} bucketed into stale,
 *   kept-today, and kept-by-allowlist.
 */
export declare function classifyPoolForCleanup(items: readonly MinimalWorkItem[], opts: CleanupOptions): CleanupClassification;
//# sourceMappingURL=cleanup-stale-pool.lib.d.ts.map