/**
 * Snapshot export service — fleet-general write integrity layer
 * (item-3-snapshot-export).
 *
 * Dumps Neotoma entity state as a structured JSON document that any
 * fleet can diff against its own external state (MEMORY.md, a shadow
 * SQLite, a vector store, etc.). The exporter is deliberately fleet-
 * agnostic: filters accept the same classification axes the write path
 * exposes (`entity_types`, `observation_source`, attribution fields)
 * and the output preserves per-field provenance so drift reports can
 * answer "who believed this, at what trust tier, via what kind of
 * write".
 *
 * Fleet-specific projection (AIBTC MEMORY.md, LangGraph state dumps,
 * custom-adapter logs) lives in separate parsers registered with
 * `drift_comparison.ts`; this module produces the *canonical* Neotoma
 * shape.
 *
 * Design notes:
 *   * The export is append-only and does not mutate state. Reuses the
 *     same snapshot tables that power the runtime read path (no
 *     recomputation).
 *   * `attribution_fingerprint` and `observation_source_histogram` are
 *     computed per entity so downstream reports can flag "this entity
 *     is 100% unverified_client" without a second pass.
 *   * Output is a plain JSON document (no streaming); bulk exports are
 *     bounded by the caller via `limit` + `since` filters.
 */
import type { AttributionTier } from "../crypto/agent_identity.js";
import type { ObservationSource } from "../shared/action_schemas.js";
export interface SnapshotExportFilter {
    /** Restrict to these entity types (e.g. `["agent_task", "agent_attempt"]`). */
    entity_types?: string[];
    /** Restrict to a specific agent (AAuth `agent_sub`). */
    agent_sub?: string;
    /** Restrict to a specific attribution tier. */
    attribution_tier?: AttributionTier;
    /** Restrict to observations carrying this kind of write. */
    observation_source?: ObservationSource;
    /** ISO-8601 lower bound on `last_observation_at`. */
    since?: string;
    /** Hard cap on returned entities. Defaults to {@link DEFAULT_SNAPSHOT_EXPORT_LIMIT}. */
    limit?: number;
    /** User whose entities are being exported. Required. */
    user_id: string;
}
export declare const DEFAULT_SNAPSHOT_EXPORT_LIMIT = 500;
/** Envelope returned by {@link exportEntitySnapshots}. */
export interface SnapshotExportDocument {
    schema_version: "0.1.0";
    exported_at: string;
    filter: Omit<SnapshotExportFilter, "user_id"> & {
        user_id: string;
    };
    total_entities: number;
    entities: ExportedEntitySnapshot[];
}
export interface AttributionFingerprint {
    tiers: Partial<Record<AttributionTier, number>>;
    agent_subs: string[];
    client_names: string[];
    /**
     * True if every contributing observation carries at least one
     * attribution key (agent_sub / agent_public_key / client_name /
     * connection_id). Lets drift reports flag "still anonymous".
     */
    fully_attributed: boolean;
}
export interface ExportedEntitySnapshot {
    entity_id: string;
    entity_type: string;
    schema_version: string;
    canonical_name?: string | null;
    computed_at: string;
    last_observation_at: string;
    observation_count: number;
    snapshot: Record<string, unknown>;
    /** Map of field → observation id that produced the winning value. */
    provenance: Record<string, string>;
    /**
     * Histogram of `observation_source` values contributing to this
     * snapshot. NULL maps to the legacy "unclassified" bucket so drift
     * reports can flag pre-classification rows.
     */
    observation_source_histogram: Partial<Record<ObservationSource | "unclassified", number>>;
    /** Roll-up of attribution fields across contributing observations. */
    attribution_fingerprint: AttributionFingerprint;
}
/**
 * Produce a canonical JSON export of entity snapshots matching the
 * provided filter. Runs one query per stage (entities, snapshots,
 * observations) and joins in memory so callers can hook up to any
 * repository backend the `db` shim supports.
 */
export declare function exportEntitySnapshots(filter: SnapshotExportFilter): Promise<SnapshotExportDocument>;
//# sourceMappingURL=snapshot_export.d.ts.map