/**
 * CAE persistence helpers against unified kit SQLite (ADR-cae-persistence-v1).
 */
import Database from "better-sqlite3";
type SqliteDatabase = InstanceType<typeof Database>;
export declare function openKitSqliteReadWrite(workspacePath: string, effective: Record<string, unknown>): SqliteDatabase | null;
/** When persistence is on, write trace+bundle to kit SQLite (no-op if DB missing). */
export declare function persistCaeTraceIfEnabled(workspacePath: string, effective: Record<string, unknown>, persistenceEnabled: boolean, traceId: string, trace: Record<string, unknown>, bundle: Record<string, unknown>, summary?: Record<string, unknown>): void;
export declare function persistCaeTraceSnapshot(db: SqliteDatabase, traceId: string, trace: Record<string, unknown>, bundle: Record<string, unknown>, summary?: Record<string, unknown>): void;
export declare function loadCaeTraceSnapshot(db: SqliteDatabase, traceId: string): {
    trace: Record<string, unknown>;
    bundle: Record<string, unknown>;
} | null;
export type CaeTraceSnapshotSummaryRow = {
    traceId: string;
    createdAt: string;
    trace: Record<string, unknown>;
    bundle: Record<string, unknown>;
    summary: Record<string, unknown> | null;
};
export declare function listCaeTraceSnapshotSummaries(db: SqliteDatabase, filters?: {
    limit?: number;
}): CaeTraceSnapshotSummaryRow[];
export declare function pruneCaeTraceSnapshots(db: SqliteDatabase, maxRows: number): void;
export declare function countCaeTraceRows(db: SqliteDatabase): number;
export declare function countCaeAckRows(db: SqliteDatabase): number;
export type CaeAckSatisfactionRow = {
    id: number;
    traceId: string;
    ackToken: string;
    activationId: string;
    satisfiedAt: string;
    actor: string;
};
export declare function listCaeAckSatisfactions(db: SqliteDatabase, filters?: {
    traceId?: string;
    activationId?: string;
    limit?: number;
}): CaeAckSatisfactionRow[];
export declare function insertCaeAckSatisfaction(db: SqliteDatabase, row: {
    traceId: string;
    ackToken: string;
    activationId: string;
    actor: string;
}): void;
export type CaeRegistryArtifactDbRow = {
    version_id: string;
    artifact_id: string;
    artifact_type: string;
    path: string;
    title: string | null;
    description: string | null;
    metadata_json: string;
    retired_at: string | null;
};
export type CaeRegistryActivationDbRow = {
    version_id: string;
    activation_id: string;
    family: string;
    priority: number;
    lifecycle_state: string;
    scope_json: string;
    artifact_refs_json: string;
    acknowledgement_json: string | null;
    metadata_json: string;
    retired_at: string | null;
};
/** True when `cae_registry_versions` exists (post kit SQLite v12 migration). */
export declare function caeRegistryTablesReady(db: SqliteDatabase): boolean;
/** Active version id, or null when none is marked active. */
export declare function getActiveCaeRegistryVersionId(db: SqliteDatabase): string | null;
export declare function listCaeRegistryVersionIds(db: SqliteDatabase): string[];
/**
 * Insert a registry version row. When `setActive` is true, clears other active flags first
 * (at most one active version).
 */
export declare function insertCaeRegistryVersion(db: SqliteDatabase, row: {
    versionId: string;
    createdBy: string;
    note?: string | null;
    setActive?: boolean;
}): void;
/** Mark `versionId` active; returns false if the version row does not exist. */
export declare function activateCaeRegistryVersion(db: SqliteDatabase, versionId: string): boolean;
export declare function listCaeRegistryArtifactsForVersion(db: SqliteDatabase, versionId: string): CaeRegistryArtifactDbRow[];
export declare function listCaeRegistryActivationsForVersion(db: SqliteDatabase, versionId: string): CaeRegistryActivationDbRow[];
export declare function insertCaeRegistryArtifactRow(db: SqliteDatabase, row: {
    versionId: string;
    artifactId: string;
    artifactType: string;
    path: string;
    title?: string | null;
    description?: string | null;
    metadataJson?: string;
    retiredAt?: string | null;
}): void;
export declare function insertCaeRegistryActivationRow(db: SqliteDatabase, row: {
    versionId: string;
    activationId: string;
    family: string;
    priority: number;
    lifecycleState: string;
    scopeJson: string;
    artifactRefsJson: string;
    acknowledgementJson?: string | null;
    metadataJson?: string;
    retiredAt?: string | null;
}): void;
/** Remove all artifact + activation rows for a version (keeps the version header row). */
export declare function clearCaeRegistryVersionContents(db: SqliteDatabase, versionId: string): void;
/**
 * Delete a version row when it is not active (children removed by FK CASCADE).
 * Returns false when missing or still active.
 */
export declare function deleteInactiveCaeRegistryVersion(db: SqliteDatabase, versionId: string): boolean;
export type CaeRegistryVersionMetaRow = {
    version_id: string;
    created_at: string;
    created_by: string;
    is_active: number;
    note: string | null;
};
export declare function getCaeRegistryVersionMeta(db: SqliteDatabase, versionId: string): CaeRegistryVersionMetaRow | null;
export type CaeRegistryVersionListRow = CaeRegistryVersionMetaRow & {
    artifact_count: number;
    activation_count: number;
};
export declare function listCaeRegistryVersionsWithCounts(db: SqliteDatabase): CaeRegistryVersionListRow[];
/** Append-only CAE registry mutation audit (kit SQLite v13+). */
export declare function insertCaeRegistryMutationAudit(db: SqliteDatabase, row: {
    actor: string;
    commandName: string;
    versionId: string;
    note?: string | null;
    payload?: Record<string, unknown>;
}): number | undefined;
export declare function countCaeRegistryMutationAuditRows(db: SqliteDatabase): number;
export type CaeRegistryMutationAuditRow = {
    id: number;
    recorded_at: string;
    actor: string;
    command_name: string;
    version_id: string;
    note: string | null;
    payload_json: string;
};
export declare function listCaeRegistryMutationAuditRows(db: SqliteDatabase, options?: {
    limit?: number;
    versionId?: string | null;
}): CaeRegistryMutationAuditRow[];
export type CaeRegistryCheckpointRow = {
    id: number;
    recorded_at: string;
    label: string;
    actor: string | null;
    note: string | null;
    version_id: string;
    registry_digest: string;
    mutation_ids_json: string;
};
/** Named restore point for a registry version (kit SQLite v22+). */
export declare function insertCaeRegistryCheckpoint(db: SqliteDatabase, row: {
    label: string;
    actor?: string | null;
    note?: string | null;
    versionId: string;
    registryDigest: string;
    mutationIds: readonly number[];
}): number | undefined;
export declare function listCaeRegistryCheckpointsForVersion(db: SqliteDatabase, versionId: string, options?: {
    limit?: number;
}): CaeRegistryCheckpointRow[];
export declare function getCaeRegistryCheckpointById(db: SqliteDatabase, checkpointId: number): CaeRegistryCheckpointRow | undefined;
export declare function updateCaeRegistryArtifactFields(db: SqliteDatabase, versionId: string, artifactId: string, patch: {
    artifactType?: string;
    path?: string;
    title?: string | null;
    description?: string | null;
    metadataJson?: string;
}): boolean;
export declare function retireCaeRegistryArtifact(db: SqliteDatabase, versionId: string, artifactId: string, retiredAt?: string): boolean;
export declare function updateCaeRegistryActivationFields(db: SqliteDatabase, versionId: string, activationId: string, patch: {
    family?: string;
    priority?: number;
    lifecycleState?: string;
    scopeJson?: string;
    artifactRefsJson?: string;
    acknowledgementJson?: string | null;
    metadataJson?: string;
}): boolean;
export declare function retireCaeRegistryActivation(db: SqliteDatabase, versionId: string, activationId: string, retiredAt?: string): boolean;
/**
 * Copy artifact + activation rows from one version to another (used by clone).
 * Target version must already exist as a header row with no children (or caller cleared it).
 */
export declare function copyCaeRegistryVersionContents(db: SqliteDatabase, fromVersionId: string, toVersionId: string): void;
export {};
