import type { SessionParser } from "./ingest/types.js"; import type { SessionStore } from "../db/session-store.js"; import type { SessionContentBackup, SessionSource } from "../types/index.js"; declare const CHECKPOINT_VERSION = 2; declare const APPLY_CONFIRMATION = "BACKFILL_APPLY"; export interface BackfillKey { source: SessionSource; sourceId: string; key: string; } export interface BackfillInventoryEntry extends BackfillKey { sourcePath: string | null; messageCount: number; toolCallCount: number; estimatedBytes: number; maxBufferedLineBytes: number; maxNormalizedBatchRecords: number; sourceContentDigest: string; runConfigDigest: string; duplicateOf: string | null; } export interface BackfillCheckpointEntry { source: SessionSource; sourceId: string; sourcePath: string | null; estimatedBytes: number; messages: number; toolCalls: number; sourceContentDigest: string; runConfigDigest: string; updatedAt: string; note?: string; } export interface BackfillCheckpoint { version: typeof CHECKPOINT_VERSION; createdAt: string; updatedAt: string; completed: Record; failed: Record; skipped: Record; } export interface BackfillRunOptions { apply?: boolean; confirmApply?: string; allowProduction?: boolean; batchSize?: number; concurrency?: number; source?: SessionSource | string; sources?: Array; pilot?: number; rangeStart?: string; rangeEnd?: string; allSources?: boolean; knownIds?: string[]; checkpointPath?: string; backupCommand?: string; maxSessionBytes?: number; maxTotalBytes?: number; env?: Record; parsers?: SessionParser[]; store?: SessionStore; now?: () => Date; } export interface BackfillRunResult { target: "self_hosted_api"; dryRun: boolean; mode: "inventory" | "apply"; inventory: { files: number; sessions: number; selectableSessions: number; duplicates: number; errors: number; messages: number; toolCalls: number; estimatedBytes: number; largestSessionBytes: number; maxBufferedLineBytes: number; maxNormalizedBatchRecords: number; }; selection: { requestedSources: string[]; pilot: number | null; rangeStart: string | null; rangeEnd: string | null; selected: number; selectedMessages: number; selectedToolCalls: number; selectedEstimatedBytes: number; selectedKeys: string[]; knownIds: Array; }; limits: { batchSize: number; concurrency: number; maxSessionBytes: number; maxTotalBytes: number | null; maxResidentSessionPayloadBytes: number; }; gates: { confirmation: { required: string; satisfied: boolean; }; production: { url: string | null; productionLike: boolean; allowed: boolean; }; capacity: { checked: boolean; allowed: boolean; reason: string | null; }; backup: { required: boolean; configured: boolean; ran: boolean; exitCode: number | null; verified: SessionContentBackup | null; reason: string | null; }; }; checkpoint: { path: string; loadedCompleted: number; completed: number; failed: number; skipped: number; resumedSkipped: number; }; applied: { attempted: number; pushed: number; failed: number; skipped: number; verifiedKnownIds: number; maxMaterializedSessionBytes: number; maxMaterializedBatchRecords: number; }; duplicates: Array<{ key: string; kept: string | null; duplicate: string | null; }>; errors: string[]; warnings: string[]; } export declare function runSessionBackfill(opts?: BackfillRunOptions): Promise; export { APPLY_CONFIRMATION }; //# sourceMappingURL=backfill.d.ts.map