/** * quarantine/state — quarantine state model, review decisions, and report * construction (#435). * * Extracted from quarantine.ts: the pure report-building surface * (state entries, lifecycle transitions, suggested actions), the persisted * review-decision log, and the mirror-index review-target resolution. The * CLI dispatcher and command flows (list, inspect, review, report) stay in * quarantine.ts. */ import type { MirrorIndexEntry, QuarantineReviewAction, QuarantineReviewDecision, QuarantineStateEntry, QuarantineStateReport, QuarantineTransition } from "../types.js"; /** * Relative path of the mirror index file under a project root. */ export declare const MIRROR_INDEX_PATH: readonly ["mirror", "index.jsonl"]; /** * Relative path of the quarantine review-decision log under a project root. */ export declare const REVIEW_LOG_PATH: readonly ["state", "quarantine", "reviews.jsonl"]; /** * Relative path of the quarantine state report under a project root. */ export declare const QUARANTINE_REPORT_PATH: readonly ["state", "quarantine", "quarantine-state.json"]; /** * Mirror statuses that are safe from a quarantine standpoint: assets in * these states are not pending review. */ export declare const SAFE_MIRROR_STATUSES: ReadonlySet; /** * Reads and validates the mirror index entries for a project root. */ export declare function readMirrorIndex(projectRoot: string): Promise; /** * Reads the persisted quarantine review decisions for a project root. */ export declare function readQuarantineReviewDecisions(projectRoot: string): Promise; /** * Resolves the mirror-index entry targeted by a quarantine review command, * from `--asset ` or `--mirror ` (or the first positional * argument as the asset id). * * @throws {Error} When neither selector is given or no entry matches. */ export declare function findReviewTarget(projectRoot: string, args: string[]): Promise; /** * Builds the quarantine state report from mirror entries and review * decisions: filtered state entries sorted by asset id plus aggregate * summary counts. */ export declare function buildQuarantineStateReport(entries: readonly MirrorIndexEntry[], decisions: readonly QuarantineReviewDecision[]): QuarantineStateReport; /** * Builds a single quarantine state report entry from a mirror-index entry, * its review decisions, and the official-asset id set. */ export declare function buildQuarantineStateEntry(entry: MirrorIndexEntry, decisions: readonly QuarantineReviewDecision[], officialAssetIds: ReadonlySet): QuarantineStateEntry; /** * Collects asset ids that have at least one official-first-party mirror * entry, used to detect when an official asset supersedes a community * duplicate. */ export declare function collectOfficialAssetIds(entries: readonly MirrorIndexEntry[]): ReadonlySet; /** * Derives the full quarantine lifecycle transition set for an entry from * real signals: the acquisition-time quarantine signals recorded on the * entry, the persisted review-decision evidence (prior/next status deltas), * and cross-entry official-duplicate detection. Every declared transition * kind maps to an observable cause; nothing is inferred without a concrete * signal. */ export declare function collectQuarantineTransitions(entry: MirrorIndexEntry, decisions: readonly QuarantineReviewDecision[], officialAssetIds: ReadonlySet): QuarantineTransition[]; /** * Describes the quarantine reason for a report entry: the latest decision's * reason when one exists, a pending-review statement for quarantined assets, * and a lifecycle-history fallback otherwise. */ export declare function describeQuarantineReason(entry: MirrorIndexEntry, latestDecision: QuarantineReviewDecision | undefined): string; /** * Suggests the operator action for a report entry from its latest decision * and current status. */ export declare function suggestQuarantineAction(entry: MirrorIndexEntry, latestDecision: QuarantineReviewDecision | undefined): QuarantineStateEntry["suggestedAction"]; /** * Returns whether a mirror entry belongs in the quarantine state report: * quarantined, approved-with-warning, or carrying any review decisions. */ export declare function shouldReportQuarantineEntry(entry: MirrorIndexEntry, decisionsByMirrorId: Map): boolean; /** * Groups review decisions by mirror id, preserving log order per id. */ export declare function groupReviewDecisions(decisions: readonly QuarantineReviewDecision[]): Map; /** * Returns the mirror status a review action transitions an entry to: * approved entries become approved-with-warning; reject and pin keep the * entry quarantined. */ export declare function getReviewedStatus(action: QuarantineReviewAction): MirrorIndexEntry["status"]; /** * Formats a review action for console output ("Approved" / "Pinned" / * "Rejected"). */ export declare function formatReviewAction(action: QuarantineReviewAction): string;