import type { ConversationCache, ScannerMeta } from "../../conversation-cache"; import type { Logger } from "../../logger"; import type { CacheAlertResolveAction, WSMessage } from "../../types"; import type { WSHub } from "../../ws-hub"; import { type PendingAlert } from "./alertStore"; export type ResolveAction = CacheAlertResolveAction; /** The `cache_alert` WS variant, narrowed from the WSMessage union. */ export type CacheAlertWsMessage = Extract; export type ResolveResult = { ok: true; action: ResolveAction; pruned?: number; backupPath?: string; } | { alreadyResolved: true; } | { conflict: true; currentFingerprint: string; }; export declare class CacheIntegrityMonitor { private readonly cache; private readonly wsHub; private readonly log; private readonly cacheDir; private readonly rescan?; private readonly runDuringReset?; private _pending; private ignoredIds; private deferredUnlinks; private unlinkTimes; constructor(cache: ConversationCache, wsHub: WSHub, log: Logger, cacheDir: string, rescan?: (() => Promise) | undefined, runDuringReset?: ((operation: () => Promise) => Promise) | undefined); get pending(): PendingAlert | null; private persist; private classifySeverity; private sampleOf; private buildWsMessage; wsMessage(): CacheAlertWsMessage | null; healthzField(): { severity: "high" | "low"; missingCount: number; fingerprint: string; detectedAt: string; } | undefined; /** * Scan the cache for rows whose file is gone, excluding ids the user chose to * ignore. If none remain, clear any stale pending alert and return (the caller * decides whether to run pruneGhostFiles). Otherwise classify severity, persist * the pending record, back up on high severity, and broadcast the alert. */ runDetection(detectedAt?: string): Promise; /** Queue an unlink while an alert is pending — the row is not invalidated. */ deferUnlink(filePath: string): void; /** * Record a live unlink while NO alert is pending. Crossing the storm threshold * (>= 10 unlinks within 30s) re-triggers detection. */ recordUnlink(filePath: string): void; private ensureBackup; private clearPending; private applyDeferredUnlinks; private broadcastResolved; /** * Apply the human's chosen resolution. Idempotent per fingerprint: no pending * alert → alreadyResolved; a different fingerprint → conflict. See the spec's * four-action semantics. */ resolve(fingerprint: string, action: ResolveAction, ids?: string[]): Promise; } //# sourceMappingURL=cacheIntegrityMonitor.d.ts.map