import { ExecutionState } from './ExecutionState';
import { RegisteredAgent } from './AgentRegistry';
import { RegisteredSquad } from './SquadRegistry';
import { RegisteredSkill } from './SkillRegistryV2';
export interface ConsequenceThoughtTrace {
    schema: 'openlife.consequence-thought-trace';
    traceVersion: '1.0.0';
    serviceContext: {
        serviceId: string;
        serviceObjective: string;
        taskId: string;
    };
    goal: string;
    governanceRisk: 'low' | 'medium' | 'high';
    selectedPathId: string;
    selectedScore: number;
    candidates: Array<{
        id: string;
        score: number;
        policy: {
            executionMode: string;
            swarmMode: string;
            maxBranches: number;
            rationale: string;
        };
        consequences: string[];
    }>;
    executiveSummary: string;
    generatedAt: string;
}
export interface MissionState extends ExecutionState {
    workspaceId?: string;
    mode: 'task' | 'service';
    chosenAgents: RegisteredAgent[];
    chosenSquads: RegisteredSquad[];
    chosenSkills: RegisteredSkill[];
    routeMode: 'single' | 'review_loop' | 'parallel';
    missionScope?: 'general' | 'research' | 'engineering' | 'sensitive';
    allowedCapabilities?: string[];
    deniedCapabilities?: string[];
    memoryCandidates: string[];
    consequenceThoughtTrace?: ConsequenceThoughtTrace;
    teamId?: string;
    teamDomain?: string;
    skillNetworkCapabilities?: string[];
}
export declare class MissionStateStore {
    private baseDir;
    constructor();
    persist(state: MissionState): string;
}
/**
 * Persisted step-level checkpoint for a long-running mission or workflow run.
 * Story 6.2 — enables crash recovery (resume after kill -9) for WorkflowEngine
 * runs (Epic 4.2) and any other long-running operation that wants to survive
 * process restart.
 */
export interface MissionCheckpoint {
    missionId: string;
    step: string;
    state: Record<string, unknown>;
    savedAt: string;
}
/**
 * Checkpoint persistence backed by atomic writes. Each missionId has at most
 * one active checkpoint file; saveCheckpoint replaces the previous one.
 *
 * Storage: `<stateDir>/checkpoints/<sanitizedMissionId>.json` where
 * `<stateDir>` = `OPENLIFE_STATE_DIR` env var if set, else `.openlife/`
 * relative to the constructor root (or process.cwd()).
 *
 * Why a separate store and not extending MissionStateStore? Checkpoints are
 * autonomy-layer artifacts (lives in `.openlife/`, survives across project
 * workspaces) while MissionStateStore is workspace-scoped under
 * `.artifacts/missions/`. The split matches the v1.2 layering: `.openlife/`
 * is the autonomous runtime layer, `.artifacts/` is the execution-results
 * layer.
 */
export declare class MissionCheckpointStore {
    private baseDir;
    constructor(root?: string);
    /**
     * Save (or overwrite) the latest checkpoint for `missionId`. The write is
     * atomic — if the process crashes mid-save the previous checkpoint stays
     * intact.
     */
    saveCheckpoint(missionId: string, step: string, state: Record<string, unknown>): void;
    /**
     * Read the latest checkpoint for `missionId`. Returns null if no checkpoint
     * exists or the file is corrupted (in which case the caller should treat
     * the mission as un-resumable and start fresh).
     */
    getLatestCheckpoint(missionId: string): MissionCheckpoint | null;
    /**
     * Read the latest checkpoint and signal intent to resume. Currently
     * identical to getLatestCheckpoint; the separate method exists so that
     * future audit/event hooks (e.g. emit `mission.resume.started` to the
     * security event log) can be attached here without changing call sites.
     */
    resumeFromCheckpoint(missionId: string): MissionCheckpoint | null;
    /**
     * List all missionIds that currently have a saved checkpoint. Useful for
     * recovery sweeps on daemon boot (find pending resumes after a crash).
     */
    list(): string[];
    /**
     * Remove the checkpoint for `missionId`. Call after a successful resume
     * has consumed the checkpoint, or after the mission has reached a
     * terminal state.
     */
    clear(missionId: string): void;
    /** Exposed for tests so they can assert the resolved storage location. */
    _baseDir(): string;
    private checkpointPath;
    private sanitize;
}
