import { RiddleProofRunParams, RiddleProofStatus, RiddleProofStage, RiddleProofCheckpointPacket, RiddleProofCheckpointSummary, RiddleProofStatePaths, RiddleProofProofContract, RiddleProofRunCard, RiddleProofCheckpointResponse, RiddleProofEvent, RiddleProofRunState, RiddleProofPrLifecycleState, RiddleProofRunStatusSnapshot, IntegrationContext } from './types.js';

declare const RIDDLE_PROOF_RUN_STATE_VERSION: "riddle-proof.run-state.v1";
interface CreateRunStateInput {
    request: RiddleProofRunParams;
    run_id?: string;
    status?: RiddleProofStatus;
    state_path?: string;
    worktree_path?: string;
    branch?: string;
    current_stage?: RiddleProofStage | null;
    stage_started_at?: string | null;
    created_at?: string;
    updated_at?: string;
    iterations?: number;
    last_checkpoint?: string | null;
    checkpoint_packet?: RiddleProofCheckpointPacket;
    checkpoint_summary?: RiddleProofCheckpointSummary;
    state_paths?: RiddleProofStatePaths;
    proof_contract?: RiddleProofProofContract;
    run_card?: RiddleProofRunCard;
    checkpoint_history?: Array<{
        ts: string;
        packet?: RiddleProofCheckpointPacket;
        response?: RiddleProofCheckpointResponse;
    }>;
    events?: RiddleProofEvent[];
}
type RunEventInput = Omit<RiddleProofEvent, "ts"> & {
    ts?: string;
};
declare function normalizePrLifecycleState(input?: Partial<RiddleProofPrLifecycleState> | Record<string, unknown> | null, checkedAt?: string): RiddleProofPrLifecycleState | undefined;
declare function normalizeIntegrationContext(input?: Partial<IntegrationContext> | Record<string, unknown> | null, fallbackSource?: IntegrationContext["source"]): IntegrationContext | undefined;
declare function normalizeRunParams(input: RiddleProofRunParams): RiddleProofRunParams;
declare function createRunState(input: CreateRunStateInput): RiddleProofRunState;
declare function appendRunEvent<T extends RiddleProofRunState>(state: T, input: RunEventInput): T;
declare function appendStageHeartbeat<T extends RiddleProofRunState>(state: T, input: {
    stage: RiddleProofStage;
    summary?: string;
    checkpoint?: string;
    wait_reason?: string;
    blocker?: string;
    details?: Record<string, unknown>;
    ts?: string;
}): T;
declare function createRunStatusSnapshot(state: RiddleProofRunState, at?: string): RiddleProofRunStatusSnapshot;
declare function setRunStatus<T extends RiddleProofRunState>(state: T, status: RiddleProofStatus, at?: string): T;
declare function applyPrLifecycleState<T extends RiddleProofRunState>(state: T, input?: Partial<RiddleProofPrLifecycleState> | Record<string, unknown> | null, at?: string): T;

export { type CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, type RunEventInput, appendRunEvent, appendStageHeartbeat, applyPrLifecycleState, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizePrLifecycleState, normalizeRunParams, setRunStatus };
