/**
 * manager.ts
 *
 * CompactionManager — orchestrates the full compaction lifecycle state machine.
 *
 * Responsibilities:
 * - Gate all compaction behind the `session-compaction` feature flag
 * - Drive state transitions (idle → checking_threshold → strategy → boundary_commit → done/failed)
 * - Select and execute the appropriate compaction strategy
 * - Create boundary commits with lineage tracking
 * - Emit CompactionEvents at each transition
 * - Expose the resume repair pipeline
 */
import type { RuntimeEventBus } from '../events/index.js';
import type { FeatureFlagManager } from '@pellux/goodvibes-sdk/platform/runtime/feature-flags/manager';
import type { BoundaryCommit, CompactionLifecycleResult, CompactionLifecycleState, CompactionTrigger } from './types.js';
import type { ResumeRepairResult } from './types.js';
import type { ProviderMessage } from '../../providers/interface.js';
/** Options for constructing a CompactionManager. */
export interface CompactionManagerOptions {
    /** Session ID for event correlation. */
    sessionId: string;
    /** Runtime event bus for emitting CompactionEvents. */
    bus: RuntimeEventBus;
    /** Feature flag manager — used to gate on `session-compaction`. */
    flags: FeatureFlagManager;
    /** Model context window size (tokens). */
    contextWindow: number;
    /** Threshold fraction at which compaction is triggered (default: 0.75). */
    thresholdFraction?: number;
}
/**
 * CompactionManager — manages the full lifecycle of session context compaction.
 *
 * All compaction is gated behind the `session-compaction` feature flag.
 * When the flag is disabled, `compact()` is a no-op and returns the original
 * messages unchanged.
 *
 * Usage:
 * ```ts
 * const manager = createCompactionManager({ sessionId, bus, flags, contextWindow });
 * const result = await manager.compact({ messages, tokenCount: 45000, trigger: 'auto' });
 * ```
 */
export declare class CompactionManager {
    private readonly _sessionId;
    private readonly _bus;
    private readonly _flags;
    private readonly _contextWindow;
    private readonly _thresholdFraction;
    /** Current state machine state. */
    private _state;
    /** Most recent boundary commit (null until first successful compaction). */
    private _lastCommit;
    /** Emitter context used for all event emissions. */
    private readonly _ctx;
    constructor(opts: CompactionManagerOptions);
    /** Returns the current lifecycle state. */
    get state(): CompactionLifecycleState;
    /** Returns the most recent boundary commit, or null. */
    get lastCommit(): BoundaryCommit | null;
    /**
     * Options for a compaction run.
     */
    /**
     * Runs the compaction lifecycle for the given messages and trigger.
     *
     * If the `session-compaction` feature flag is disabled, returns the
     * original messages unchanged with no events emitted.
     *
     * @param opts - Run options.
     * @returns Lifecycle result, or null if gated/skipped.
     */
    compact(opts: {
        messages: ProviderMessage[];
        tokenCount: number;
        trigger: CompactionTrigger;
        isPromptTooLong?: boolean;
    }): Promise<CompactionLifecycleResult | null>;
    /**
     * Runs the session resume repair pipeline on the last boundary commit.
     *
     * If no commit exists, returns a result with the original messages and
     * a warning action.
     *
     * @param overrideCommit - Optional commit to repair (defaults to lastCommit).
     * @returns ResumeRepairResult.
     */
    repair(overrideCommit?: BoundaryCommit): ResumeRepairResult;
    /**
     * Executes the selected strategy and emits the corresponding domain event.
     */
    private _runStrategy;
    /**
     * Applies a state transition, throwing if invalid.
     * Invalid transitions are logged and treated as internal errors.
     */
    private _transition;
}
//# sourceMappingURL=manager.d.ts.map