/**
 * @fileoverview Auto-compact, auto-clear, and auto-resume automation for Session.
 *
 * Monitors token counts and triggers /compact or /clear commands when
 * configurable thresholds are reached. Waits for Claude to be idle
 * before sending commands, with retry logic and mutual exclusion
 * (compact and clear never run simultaneously).
 *
 * Also implements auto-resume on usage limit ("token pause" control):
 * when enabled and Claude stops on a usage-limit message ("5-hour limit
 * reached ∙ resets 8pm" and friends — see usage-limit-patterns.ts), a timer
 * is armed for the parsed reset time plus a safety buffer, then Escape
 * (dismisses the rate-limit options dialog if open) and a "continue" prompt
 * are sent so work resumes automatically. If the session is still limited,
 * the fresh limit message re-arms the scheduler — that retry loop is the
 * safety net for clock skew and parse imprecision.
 *
 * @module session-auto-ops
 */
import { EventEmitter } from 'node:events';
/**
 * Callbacks required by SessionAutoOps to interact with the parent Session.
 */
interface AutoOpsCallbacks {
    /** Send a command via the terminal multiplexer */
    writeCommand: (command: string) => Promise<boolean>;
    /** Check if Claude is currently working */
    isWorking: () => boolean;
    /** Check if the session has been stopped */
    isStopped: () => boolean;
    /** Get current total token count (input + output) */
    getTotalTokens: () => number;
    /** Get session ID for logging */
    getSessionId: () => string;
}
/**
 * Events emitted by SessionAutoOps.
 */
/**
 * Manages auto-compact and auto-clear automation for a Session.
 *
 * When enabled, monitors token counts after each update and triggers
 * /compact or /clear commands when thresholds are exceeded. Ensures
 * mutual exclusion between compact and clear operations.
 */
export declare class SessionAutoOps extends EventEmitter {
    private _autoCompactThreshold;
    private _autoCompactEnabled;
    private _autoCompactPrompt;
    private _isCompacting;
    private _autoCompactTimer;
    private _autoClearThreshold;
    private _autoClearEnabled;
    private _isClearing;
    private _autoClearTimer;
    private _autoResumeEnabled;
    private _autoResumeTimer;
    /** Esc→continue gap timer; detections must NOT cancel a resume in flight */
    private _resumeFollowupTimer;
    /** When the scheduled resume fires (epoch ms), null when not armed */
    private _autoResumeAt;
    private _limitPaused;
    private _resumeAttempts;
    private readonly callbacks;
    constructor(callbacks: AutoOpsCallbacks, config?: {
        compactThreshold?: number;
        clearThreshold?: number;
    });
    get autoCompactThreshold(): number;
    get autoCompactEnabled(): boolean;
    get autoCompactPrompt(): string;
    get isCompacting(): boolean;
    setAutoCompact(enabled: boolean, threshold?: number, prompt?: string): void;
    get autoClearThreshold(): number;
    get autoClearEnabled(): boolean;
    get isClearing(): boolean;
    setAutoClear(enabled: boolean, threshold?: number): void;
    get autoResumeEnabled(): boolean;
    /** When the scheduled resume fires (epoch ms), or null when not armed. */
    get autoResumeAt(): number | null;
    /** True while the session is believed to be paused on a usage limit. */
    get isLimitPaused(): boolean;
    setAutoResume(enabled: boolean): void;
    /**
     * Restore auto-resume state after a Codeman restart. A persisted pending
     * schedule is re-armed; an overdue one fires shortly after boot (the limit
     * footer won't reprint on its own, so without this the pause would stall).
     */
    restoreAutoResume(enabled: boolean, resumeAt?: number): void;
    /**
     * Scan cleaned terminal output for a usage-limit pause message and (re)arm
     * the resume schedule. Called from the session's throttled parser path.
     */
    processCleanData(cleanData: string): void;
    /**
     * Claude started working — the limit is lifted (or the user resumed
     * manually), so any pending auto-resume is obsolete.
     */
    notifyWorking(): void;
    private _scheduleResume;
    private _fireResume;
    private _cancelAutoResume;
    /**
     * Check if auto-compact should be triggered based on current token count.
     * Called after token count updates.
     */
    checkAutoCompact(): void;
    /**
     * Check if auto-clear should be triggered based on current token count.
     * Called after token count updates.
     */
    checkAutoClear(): void;
    /**
     * Clear all timers and reset state. Called when the session stops.
     */
    destroy(): void;
}
export {};
//# sourceMappingURL=session-auto-ops.d.ts.map