import { z } from "zod";
import { type ContractEnvelope } from "../../../schema/src/decisions/contract.js";
import type { DetectorVersionRef } from "../../../schema/src/decisions/scope.js";
import { type RecordCodec } from "../../../schema/src/records/envelope.js";
import type { DraftContract } from "./promotion.js";
export declare const CONTRACT_INDEX_VERSION: "contract-index/v1";
export declare const CALIBRATION_RECORD_VERSION: "contract-calibration/v1";
declare const contractIndexSchema: z.ZodObject<{
    schemaVersion: z.ZodLiteral<"contract-index/v1">;
    activeIds: z.ZodArray<z.ZodString>;
}, z.core.$strict>;
export type ContractStoreIndex = z.infer<typeof contractIndexSchema>;
export declare const contractIndexCodec: RecordCodec<ContractStoreIndex>;
declare const calibrationRecordSchema: z.ZodObject<{
    schemaVersion: z.ZodLiteral<"contract-calibration/v1">;
    contractId: z.ZodString;
    contractVersion: z.ZodString;
    evidenceRef: z.ZodObject<{
        relativePath: z.ZodString;
        contentHash: z.ZodString;
    }, z.core.$strict>;
    passed: z.ZodBoolean;
    calibratedAt: z.ZodString;
    witnessHash: z.ZodString;
}, z.core.$strict>;
export type CalibrationRecord = z.infer<typeof calibrationRecordSchema>;
export declare const calibrationRecordCodec: RecordCodec<CalibrationRecord>;
export type ContractStorageKind = "confirmed" | "inferred";
export declare class ContractAuthorityError extends Error {
    readonly contractId: string;
    readonly contractVersion: string;
    readonly reason: string;
    constructor(contractId: string, contractVersion: string, reason: string);
}
export declare class ContractStore {
    private readonly index;
    private readonly contracts;
    private readonly storageKinds;
    constructor(index: ContractStoreIndex, contracts: Map<string, ContractEnvelope>, storageKinds: Map<string, ContractStorageKind>);
    getContract(id: string): ContractEnvelope | undefined;
    getStorageKind(id: string): ContractStorageKind | undefined;
    isActive(id: string): boolean;
    activeIds(): readonly string[];
    confirmedContracts(): ContractEnvelope[];
    inferredContracts(): ContractEnvelope[];
}
export declare function readContractIndex(root: string): Promise<ContractStoreIndex>;
export declare function readContractRecord(root: string, contractId: string, kind: ContractStorageKind): Promise<ContractEnvelope>;
export declare function loadContractStore(root: string): Promise<ContractStore>;
export declare function writeContractIndex(root: string, index: ContractStoreIndex): Promise<void>;
export declare function persistContractRecord(root: string, contract: ContractEnvelope | DraftContract, options?: {
    kind?: ContractStorageKind;
}): Promise<void>;
export declare function writeCalibrationRecord(root: string, record: Omit<CalibrationRecord, "schemaVersion">): Promise<void>;
export declare function readCalibrationRecord(root: string, contractId: string): Promise<CalibrationRecord | undefined>;
export declare function writeOracleManifest(root: string, detector: DetectorVersionRef): Promise<void>;
export declare function loadAuthoritativeContract(root: string, contractId: string, contractVersion: string): Promise<ContractEnvelope>;
export {};
//# sourceMappingURL=store.d.ts.map