/**
 * CodexResumeMap — per-topic Codex rollout-id capture-at-kill,
 * TOPIC-PROFILE-SPEC §7 (prerequisite sub-task).
 *
 * `TopicResumeMap` + the `beforeSessionKill` listener capture only Claude
 * JSONL UUIDs; nothing captured Codex's rollout id from ~/.codex/sessions —
 * so the "Codex resume = none-loss" swap row would be a lie without this
 * (round-1 adversarial, CRITICAL). Scope: the per-topic sessionId
 * capture-at-kill only — `FrameworkSessionStore` already resolves a rollout
 * path GIVEN a sessionId, and `codex resume <id>` launch support exists.
 *
 * Capture is TIME-FENCED DISCOVERY scoped to the spawned session (Codex has
 * no hook, and a naive newest-rollout mtime scan is the wrong-conversation
 * class §8 brands worse than disclosed loss):
 *  - record the spawn timestamp + pane cwd at launch;
 *  - accept only a rollout file created after spawn whose recorded session
 *    cwd matches the topic's session;
 *  - THE FENCE IS ZERO-OR-ONE: if more than one candidate passes, capture
 *    NOTHING — the swap row degrades to recent-only, disclosed (round-5).
 *  - ambiguity-discards are counted separately from fence-validation
 *    failures (only genuine validation failures feed the L5 drift signal —
 *    round-6: ambient same-dir ambiguity must not fire false "codex CLI
 *    format drifted" signals or mask real drift).
 *
 * Entries are framework-tagged + provenance-tagged ('fence'), and support
 * PARKING (§8 — a fresh respawn parks rather than deletes, so the §10.4
 * breaker revert / §10.3 undo can un-park and resume the surviving
 * transcript). Read/write discipline per §5.1: in-memory authoritative,
 * atomic tmp+rename flush.
 */
import { codexHomeFromConfig } from '../providers/adapters/openai-codex/observability/sessionPaths.js';
export interface CodexResumeEntry {
    rolloutId: string;
    savedAt: string;
    sessionName: string;
    framework: 'codex-cli';
    provenance: 'fence';
    /** §8 — parked entries are ignored by resolution but recoverable. */
    parked: string | null;
}
export interface CodexSpawnFence {
    /** Epoch ms the codex session was spawned. */
    spawnedAt: number;
    /** The pane cwd recorded at launch. */
    cwd: string;
}
export interface FenceCaptureResult {
    outcome: 'captured' | 'ambiguous' | 'none' | 'validation-failed';
    rolloutId?: string;
    candidateCount: number;
}
export declare class CodexResumeMap {
    private readonly filePath;
    private readonly codexHome?;
    private entries;
    /** Per-(machine,framework) consecutive fence-validation failures (§7 L5 drift). */
    private consecutiveValidationFailures;
    /** Distinct non-drift metric: multi-candidate discards (§7 round-6). */
    private ambiguityDiscards;
    constructor(stateDir: string, codexHome?: string);
    /**
     * Capture the rollout id for a topic's codex session at kill time, against
     * the spawn fence. Zero-or-one: multiple passing candidates capture
     * nothing. Returns the structured outcome so the §8 kill path can disclose
     * the real loss class and the drift counters stay honest.
     */
    captureAtKill(topicKey: number | string, sessionName: string, fence: CodexSpawnFence): Promise<FenceCaptureResult>;
    /** Persist a fence-validated mapping. */
    save(topicKey: number | string, rolloutId: string, sessionName: string): void;
    /**
     * Resume id for a topic — null when absent, parked, expired, or the
     * rollout file no longer exists on THIS machine (§5.3 transcript locality).
     */
    get(topicKey: number | string): string | null;
    /** Raw entry (parked included) for §8 park/un-park machinery. */
    getEntry(topicKey: number | string): CodexResumeEntry | null;
    /** §8 — "remove" means PARK, not delete (deletion destroys the cheap recovery). */
    park(topicKey: number | string, reason: string): void;
    /** §10.4 revert / §10.3 undo — un-park the matching-framework entry. */
    unpark(topicKey: number | string): boolean;
    /** Hard removal (successful resume consumption / stale-id clear). */
    remove(topicKey: number | string): void;
    /** §7 drift signal inputs — read by the L5 canary plumbing. */
    driftCounters(): {
        consecutiveValidationFailures: number;
        ambiguityDiscards: number;
    };
    private prune;
    private load;
    private persist;
}
/** Extract the rollout UUID from `rollout-<ts>-<uuid>.jsonl`. */
export declare function rolloutIdFromFilename(rolloutPath: string): string | null;
export { codexHomeFromConfig };
//# sourceMappingURL=CodexResumeMap.d.ts.map