import type { Database as DatabaseType } from 'better-sqlite3'; import { type ArtifactEdit, type ArtifactManifest } from './manifest.js'; import { type ArtifactRow, type ArtifactVersionRow } from '../db/artifacts.js'; import type { ArtifactReadAccessState } from './ops.js'; export type IngestErrorCode = 'manifest_parse' | 'manifest_validation' | 'artifact_file' | 'artifact_edit' | 'artifact_precondition' | 'artifact_conflict' | 'artifact_import'; export interface IngestErrorDetail { code: IngestErrorCode; message: string; recoverable: boolean; } export interface PreparedArtifactDoc { doc: ArtifactManifest['documents'][number]; body?: string; } export interface PreparedArtifactIngest { manifest: ArtifactManifest | null; preparedDocs: PreparedArtifactDoc[]; errors: string[]; errorDetails: IngestErrorDetail[]; skipped: boolean; } export interface IngestResult { imported: Array<{ artifact: ArtifactRow; version: ArtifactVersionRow; op: 'create' | 'update' | 'rewrite-from-version' | 'restore'; }>; errors: string[]; errorDetails: IngestErrorDetail[]; skipped: boolean; } export declare function formatIngestSummary(imported: IngestResult['imported']): string | null; export interface IngestOptions { outputDir: string; topicId: number; messageId?: number; jobId: number; agentName: string; userEmail?: string; artifactReadAccess?: ArtifactReadAccessState; enforceCurrentRead?: boolean; } export declare function prepareArtifactIngest(db: DatabaseType, opts: IngestOptions): PreparedArtifactIngest; export declare function applyArtifactEdits(body: string, edits: ArtifactEdit[]): { body: string; } | { error: string; editIndex: number; }; export declare function commitPreparedArtifactIngest(db: DatabaseType, opts: IngestOptions, preparedDocs: PreparedArtifactDoc[]): IngestResult; export declare function ingestArtifacts(db: DatabaseType, opts: IngestOptions): IngestResult; //# sourceMappingURL=ingest.d.ts.map