/**
 * OrgIntentDriftAnalyzer — Phase 4 of the ORG-INTENT runtime project.
 *
 * Samples recent Coherence Gate review history and emits a drift digest:
 * which reviewer dimensions are flagging most, whether the trend is rising
 * or falling between the two halves of the lookback window, which ORG-INTENT
 * constraints are most frequently being approached, and a single overall
 * trend label.
 *
 * SIGNAL only — never blocks anything. The Coherence Gate from Phase 1
 * remains the authority for any actual message-review decision. This module
 * exists to surface accumulated patterns that no single review verdict
 * could catch on its own — the Klarna failure mode early-warning surface.
 *
 * Deterministic pure logic. No LLM call. Given the same input it always
 * produces the same output.
 */
import type { ParsedOrgIntent } from './OrgIntentManager.js';
/**
 * Minimal shape of a review history entry the analyzer needs. Subset of
 * CoherenceGate's AuditLogEntry — keeps the analyzer decoupled from the
 * gate's internal types so it can be reused for offline analysis.
 */
export interface DriftReviewEntry {
    /** ISO-8601 timestamp string. */
    timestamp: string;
    /** Outcome verdict — e.g. 'pass', 'block', 'hold', 'pass-warn'. */
    verdict: string;
    /** Per-reviewer violations from this entry. */
    violations: Array<{
        reviewer: string;
        severity: 'block' | 'warn';
        issue: string;
    }>;
}
export interface DriftAnalysisInput {
    /** Review history entries (already filtered to the analysis window by caller). */
    entries: DriftReviewEntry[];
    /** Parsed ORG-INTENT.md, or null if absent. */
    orgIntent: ParsedOrgIntent | null;
    /** Lookback window in days, used for output framing only. */
    lookbackDays?: number;
    /** Sensitivity controls. */
    thresholds?: {
        /** Block-rate threshold (fraction) for 'concerning' verdict. Default 0.15. */
        concerningBlockRate?: number;
        /** Block-rate threshold (fraction) for 'rising' verdict. Default 0.05. */
        risingBlockRate?: number;
        /** Minimum entries before reporting a trend. Below this, returns 'insufficient-data'. */
        minEntries?: number;
    };
}
export interface ReviewerStats {
    reviewer: string;
    total: number;
    blocks: number;
    warns: number;
    blockRate: number;
}
export interface DriftAnalysis {
    /** Overall trend label. */
    trend: 'stable' | 'rising' | 'concerning' | 'insufficient-data' | 'no-org-intent';
    /** Window stats. */
    windowDays: number;
    totalEntries: number;
    blockedEntries: number;
    overallBlockRate: number;
    /** Half-window comparison: first half vs second half block rates. */
    firstHalfBlockRate: number;
    secondHalfBlockRate: number;
    /** Per-reviewer breakdown. */
    perReviewer: ReviewerStats[];
    /** Reviewer dimensions flagged as drifting (top N by block count). */
    flaggedDimensions: string[];
    /** Mapped to ORG-INTENT bucket counts. */
    constraintMatches: number;
    goalMatches: number;
    valueMatches: number;
    /** Human-readable summary suitable for a Telegram digest. */
    summary: string;
    /** Suggested next actions for the user / agent. */
    suggestions: string[];
    /** True when caller should surface this digest (trend != 'stable' && != 'insufficient-data' && != 'no-org-intent'). */
    shouldSurface: boolean;
}
export declare function analyzeOrgIntentDrift(input: DriftAnalysisInput): DriftAnalysis;
//# sourceMappingURL=OrgIntentDriftAnalyzer.d.ts.map