import type { DreamingDeepConfig, DreamingLightConfig, DreamingRemConfig } from './config.js';
export declare const DREAMING_LAST_RUN_FORMAT_VERSION: 2;
export type { DreamingDeepConfig } from './config.js';
export type DreamingDeepPhaseSkipped = {
    alreadyPromotedKey: number;
    rehydrateFailed: number;
    contaminated: number;
    hashDuplicate: number;
};
/**
 * On-disk / API shape for `memory/.dreams/last-run.json` (deep promotion sweep).
 */
export type DreamingDeepLastRun = {
    version: typeof DREAMING_LAST_RUN_FORMAT_VERSION;
    phase: 'deep';
    runId: string;
    startedAt: string;
    finishedAt: string;
    durationMs: number;
    ok: boolean;
    reason: string;
    config: DreamingDeepConfig;
    memoryPath: string;
    errorMessage?: string;
    deep: {
        candidatesRanked: number;
        applied: number;
        skipped: DreamingDeepPhaseSkipped;
    };
};
/**
 * On-disk shape for light sweep last-run.
 */
export type DreamingLightLastRun = {
    version: typeof DREAMING_LAST_RUN_FORMAT_VERSION;
    phase: 'light';
    runId: string;
    startedAt: string;
    finishedAt: string;
    durationMs: number;
    ok: boolean;
    reason: string;
    config: DreamingLightConfig;
    light: {
        scannedEntries: number;
        newSignals: number;
        deduped: number;
    };
    errorMessage?: string;
};
/**
 * On-disk shape for REM pattern last-run.
 */
export type DreamingRemLastRun = {
    version: typeof DREAMING_LAST_RUN_FORMAT_VERSION;
    phase: 'rem';
    runId: string;
    startedAt: string;
    finishedAt: string;
    durationMs: number;
    ok: boolean;
    reason: string;
    config: DreamingRemConfig;
    rem: {
        patternsDiscovered: number;
        entriesAnalyzed: number;
    };
    errorMessage?: string;
};
/** Union of all phase last-run shapes. */
export type DreamingLastRun = DreamingDeepLastRun | DreamingLightLastRun | DreamingRemLastRun;
/**
 * Parse `last-run.json`. Only the current on-disk format (`version: 2`, `phase: 'deep'`) is accepted.
 */
export declare function parseDreamingLastRunFile(raw: unknown): DreamingDeepLastRun | null;
export declare function emptyDeepPhaseSkipped(): DreamingDeepPhaseSkipped;
export declare function writeDreamingDeepLastRun(params: {
    workspaceDir: string;
    lastRun: DreamingDeepLastRun;
}): Promise<void>;
