import type { ContentClassification } from '../security/classifier.js'; import type { Clock, ContextItem, KnowledgeEntry } from '../knowledge/types.js'; import type { QuarantineRecord } from '../security/quarantine.js'; export type IngestionState = 'received' | 'validated' | 'classified' | 'stored' | 'extracted' | 'indexed' | 'available' | 'quarantined' | 'failed' | 'retrying' | 'superseded' | 'discarded'; export type IngestionAction = 'validate' | 'classify' | 'store' | 'extract' | 'index' | 'make-available' | 'quarantine' | 'fail' | 'retry' | 'supersede' | 'discard'; /** Untrusted connector evidence at the original-byte boundary. */ export interface IngestionEnvelope { readonly id: string; readonly idempotencyKey: string; readonly connector: string; readonly connectionRef: string; readonly externalId: string; readonly receivedAt: string; readonly fileName: string; readonly declaredMediaType: string; readonly transformedMediaType: string; readonly originalBytes: Uint8Array; readonly actor: string; } export interface TrustedIngestionBinding { connectionRef: string; connector: string; projectId: string; } export interface IngestOptions { binding: TrustedIngestionBinding; clock: Clock; maxBytes?: number; allowedMediaTypes?: string[]; } interface IngestResultBase { idempotencyKey: string; reasons: string[]; classification: ContentClassification; } export interface AppliedIngestResult extends IngestResultBase { status: 'applied'; state: 'available'; entry: KnowledgeEntry; context: ContextItem; } export interface QuarantinedIngestResult extends IngestResultBase { status: 'quarantined'; state: 'quarantined'; quarantine: QuarantineRecord; } export interface DuplicateIngestResult extends IngestResultBase { status: 'duplicate'; } export type IngestResult = AppliedIngestResult | QuarantinedIngestResult | DuplicateIngestResult; export {};