/** * Sync Policy and Safety Gates (TRL-334) * * Defines safety policies for realtime sync to prevent accidental * mutations, deletions, and corruptions from propagating between environments. */ import type { NackReason } from '../sync/types.js'; export interface SyncPolicy { /** Require manual approval for destructive ops from remote. */ blockRemoteDestructive: boolean; /** Require confirmation for bulk deletes (>N entities). */ bulkDeleteThreshold: number; /** Block sync if local has uncommitted changes. */ requireCleanWorkingTree: boolean; /** Quarantine suspicious ops for review. */ quarantineSuspicious: boolean; } export interface ChangeRisk { risk: 'safe' | 'elevated' | 'destructive' | 'critical'; reason: string; } export interface QuarantineEntry { id: string; timestamp: string; sourcePeerId: string; message: any; risk: ChangeRisk; reason: NackReason; reviewed: boolean; } /** * Default policies by environment type. */ export declare const DEFAULT_POLICIES: Record; /** * Get sync policy from environment or default. */ export declare function getSyncPolicy(): SyncPolicy; /** * Classify change risk based on message content. */ export declare function classifyChangeRisk(message: any): ChangeRisk; /** * Check if a message should be blocked by sync policy. */ export declare function shouldBlockMessage(message: any, policy: SyncPolicy): { blocked: boolean; reason?: NackReason; details?: string; }; /** * Quarantine store for suspicious changes. */ export declare class QuarantineStore { private entries; private storagePath; constructor(storagePath?: string); /** * Add an entry to quarantine. */ add(message: any, sourcePeerId: string, reason: NackReason): string; /** * Get all quarantine entries. */ getAll(): QuarantineEntry[]; /** * Get a specific quarantine entry. */ get(id: string): QuarantineEntry | undefined; /** * Mark an entry as reviewed. */ markReviewed(id: string): void; /** * Remove an entry from quarantine. */ remove(id: string): void; /** * Load quarantine from disk. */ private load; /** * Save quarantine to disk. */ private save; } //# sourceMappingURL=sync-policy.d.ts.map