/**
 * Auto-Dream Cycle — autonomous BRAIN consolidation with STDP plasticity.
 *
 * Implements three trigger tiers for autonomous `runConsolidation` dispatch:
 *
 *   Tier 1 — Volume threshold (primary):
 *     When `brain_observations` delta since last consolidation exceeds
 *     VOLUME_THRESHOLD_DEFAULT (10), trigger immediately.
 *
 *   Tier 2 — Idle detection (secondary):
 *     When `brain_retrieval_log` shows no activity for IDLE_MINUTES_DEFAULT (30)
 *     minutes, trigger consolidation in the background.
 *
 *   Tier 3 — Nightly cron (tertiary):
 *     A setInterval-based scheduler fires once per day at off-peak hours.
 *     Activated explicitly via `startDreamScheduler`. Disabled by default.
 *
 * Each trigger calls `runConsolidation(projectRoot, sessionId, 'scheduled')`
 * which includes Steps 9a (R-STDP reward backfill) + 9b (STDP plasticity) +
 * 9c (homeostatic decay) per docs/specs/stdp-wire-up-spec.md §4.
 *
 * Idempotency: `checkAndDream` tracks `lastDreamAt` in-process so that
 * repeated calls within the same process cannot double-trigger consolidation.
 * The `brain_consolidation_events` table provides cross-process idempotency
 * via the cooldown window check.
 *
 * @task T628
 * @epic T627
 * @see docs/specs/stdp-wire-up-spec.md §4.5
 */
/** Result of a `checkAndDream` evaluation. */
export interface DreamCheckResult {
    /** Whether consolidation was triggered. */
    triggered: boolean;
    /** Which tier fired (or null if no trigger). */
    tier: 'volume' | 'idle' | 'cron' | 'manual' | null;
    /** Reason consolidation was skipped (if not triggered). */
    skippedReason?: string;
    /** New observations since last consolidation (volume trigger input). */
    newObservationCount?: number;
    /** Minutes since last retrieval activity (idle trigger input). */
    idleMinutes?: number;
}
/** Options accepted by `checkAndDream`. */
export interface DreamCycleOptions {
    /** Minimum new observations to trigger volume tier. Default: 10. */
    volumeThreshold?: number;
    /** Minutes of retrieval inactivity to trigger idle tier. Default: 30. */
    idleThresholdMinutes?: number;
    /** Session ID forwarded to runConsolidation (for Step 9a). */
    sessionId?: string | null;
    /**
     * Whether to run inline (await) vs fire-and-forget (setImmediate).
     * Default: false (fire-and-forget).
     */
    inline?: boolean;
}
/**
 * Volume trigger: return true when new observation count since last
 * consolidation exceeds `threshold`.
 *
 * @param threshold - Minimum new observations required to trigger.
 * @returns Object with the decision and the raw observation count.
 */
export declare function checkVolumeTrigger(threshold: number): {
    shouldTrigger: boolean;
    newObservationCount: number;
};
/**
 * Idle trigger: return true when retrieval activity HAS occurred before
 * and no new activity has been seen for at least `idleThresholdMinutes`.
 *
 * When no retrievals have ever been recorded (null timestamp), the idle
 * trigger does NOT fire — the system is newly initialised, not idle.
 *
 * @param idleThresholdMinutes - Required idle window in minutes.
 * @returns Object with the decision and elapsed idle minutes.
 */
export declare function checkIdleTrigger(idleThresholdMinutes: number): {
    shouldTrigger: boolean;
    idleMinutes: number;
};
/**
 * Evaluate all three trigger tiers and fire the dream cycle when any triggers.
 *
 * Tier evaluation order: volume → idle → (cron is timer-based, not checked here).
 *
 * Idempotency guards:
 * - `dreamInFlight` prevents overlapping concurrent runs.
 * - `DREAM_COOLDOWN_MS` (5 min) prevents repeated triggers in a tight loop.
 *
 * @param projectRoot - Project root for brain.db resolution.
 * @param opts - Optional tuning parameters.
 * @returns Check result indicating whether and why consolidation was triggered.
 *
 * @task T628
 */
export declare function checkAndDream(projectRoot: string, opts?: DreamCycleOptions): Promise<DreamCheckResult>;
/**
 * Manually trigger the full dream cycle immediately.
 *
 * Bypasses all trigger thresholds and cooldown guards. Intended for
 * `cleo memory dream` CLI invocation and test scaffolding.
 *
 * @param projectRoot - Project root for brain.db resolution.
 * @param sessionId - Active session ID (for Step 9a reward backfill).
 * @returns The RunConsolidationResult from the full pipeline.
 *
 * @task T628
 */
export declare function triggerManualDream(projectRoot: string, sessionId?: string | null): Promise<import('./brain-lifecycle.js').RunConsolidationResult>;
/**
 * Start the nightly cron scheduler (Tier 3).
 *
 * Fires `checkAndDream` daily at `hourUTC` (default: 4 AM UTC).
 * The timer is a best-effort setInterval — it will not survive process restart.
 *
 * Only one nightly scheduler can be active. Calling this when already active
 * is a no-op.
 *
 * @param projectRoot - Project root for brain.db resolution.
 * @param hourUTC - Hour of day (0–23 UTC) to fire nightly consolidation.
 * @returns true if the scheduler was started, false if already running.
 *
 * @task T628
 */
export declare function startDreamScheduler(projectRoot: string, hourUTC?: number): boolean;
/**
 * Stop the nightly cron scheduler.
 *
 * @returns true if a running scheduler was stopped, false if none was active.
 *
 * @task T628
 */
export declare function stopDreamScheduler(): boolean;
/**
 * Reset in-process dream cycle state.
 *
 * Intended for test teardown only. Clears `lastDreamAt`, `dreamInFlight`,
 * and stops the nightly scheduler if running.
 *
 * @internal
 */
export declare function _resetDreamState(): void;
//# sourceMappingURL=dream-cycle.d.ts.map