/**
 * Post-compaction degradation monitor.
 *
 * Watches the first POST_COMPACTION_MONITOR_COUNT assistant turns after a
 * compaction completes and triggers a single recovery compaction if the
 * model emits POST_COMPACTION_NO_TEXT_THRESHOLD consecutive assistant
 * messages with no text content (only step-start/step-finish parts).
 *
 * Algorithm ported from omo's preemptive-compaction-degradation-monitor:
 * `/Users/yeongyu/local-workspaces/omo/src/hooks/preemptive-compaction-degradation-monitor.ts`
 *
 * Pi extension surface differences vs omo:
 * - Recovery dispatch: speculative generation plus `ctx.applyCompaction(...)`
 *   instead of omo's `client.session.summarize(...)`. The "RECOVERY:" prefix
 *   in customInstructions is the disambiguator; CompactionReason stays
 *   "extension" (no new variant in v1).
 * - Notification: `ctx.notify(message)` instead of omo's
 *   `client.tui.showToast(...)`.
 *
 * Recovery cap: 1 per compaction cycle (gate via recoveryTriggeredThisCycle).
 * MAX_RECOVERY_ATTEMPTS = 3 is exported for future iteration but the v1 cycle
 * gate keeps the effective cap at 1 — recoveryAttempts is incremented only on
 * successful trigger, so once it hits 1 the cycle gate also fires regardless.
 */
export declare const POST_COMPACTION_MONITOR_COUNT = 5;
export declare const POST_COMPACTION_NO_TEXT_THRESHOLD = 3;
export declare const MAX_RECOVERY_ATTEMPTS = 3;
export declare const RECOVERY_INSTRUCTIONS = "RECOVERY: prior compaction caused degraded responses; rebuild context";
export declare const RECOVERY_NOTIFICATION = "Detected repeated no-text assistant responses; retried compaction recovery.";
export interface DegradationMonitorState {
    postCompactionTurnsRemaining: number;
    noTextCounter: number;
    recoveryTriggeredThisCycle: boolean;
    recoveryAttempts: number;
}
export interface DegradationMonitorContext {
    applyCompaction: (options: {
        customInstructions: string;
    }) => Promise<{
        applied: boolean;
        reason: string;
    }>;
    notify: (message: string) => void;
}
interface MonitoredMessageContentPart {
    type: string;
    text?: string;
}
interface MonitoredMessageEvent {
    message: {
        role: string;
        content: MonitoredMessageContentPart[];
    };
}
export declare function createDegradationMonitorState(): DegradationMonitorState;
/**
 * Reset the per-cycle monitor fields when a fresh compaction completes.
 * Opens a new POST_COMPACTION_MONITOR_COUNT-turn window and clears the
 * cycle-trigger gate. recoveryAttempts is preserved across cycles so the
 * MAX_RECOVERY_ATTEMPTS ceiling remains a session-wide guard.
 */
export declare function resetOnSessionCompact(state: DegradationMonitorState): void;
export declare function handleMessageEnd(state: DegradationMonitorState, event: MonitoredMessageEvent, context: DegradationMonitorContext): Promise<void>;
export declare function handleTurnEnd(state: DegradationMonitorState): void;
export {};
//# sourceMappingURL=degradation-monitor.d.ts.map