import type { DecisionLifecycleHold, DecisionLifecycleReference, DecisionLifecycleTombstone } from './lifecycle.js'; import type { ArtifactPin } from './types.js'; export declare const PREPROCESSED_EVIDENCE_KIND: "PreprocessedEvidence"; /** * Destination origin for an adapter that declares `egress: { mode: 'none' }` and runs with no * D10 projection policy. Manifests authorize local derived-text use by listing * `{ provider: , origin: PREPROCESSING_LOCAL_ORIGIN }`. */ export declare const PREPROCESSING_LOCAL_ORIGIN: "local://no-egress"; export type PreprocessingLocatorClass = 'opaque-id' | 'artifact-ref' | 'local-redacted' | 'remote-url'; export type PreprocessingExtractionKind = 'ocr' | 'asr' | 'caption' | 'image-description'; /** Kinds a recorded preprocessing step may have. Human correction is never a step. */ export type PreprocessingStepKind = PreprocessingExtractionKind | 'normalization' | 'redaction' | 'translation' | 'truncation' | 'summary' | 'concatenation'; /** Human correction enters only as a validated, append-only transformation event. */ export type PreprocessingTransformationKind = Exclude | 'human-correction'; export type PreprocessingKind = PreprocessingStepKind | 'human-correction'; export type PreprocessingReviewFlag = 'low-quality' | 'truncated' | 'incomplete' | 'stale' | 'policy-limited' | 'human-corrected'; export interface PreprocessedEvidence { apiVersion: 'decision.aiwg.io/v1alpha2'; kind: typeof PREPROCESSED_EVIDENCE_KIND; metadata: { id: string; version: string; description: string; }; spec: { source: { assetId: string; contentDigest: `sha256:${string}`; mediaType: string; sizeBytes: number; acquiredAt: string; locator: { class: PreprocessingLocatorClass; value: string; }; owner?: string; license?: string; consent?: string; classification: 'public' | 'internal' | 'confidential' | 'restricted'; }; preprocessing: PreprocessingStep[]; output: { id: string; version: number; contentDigest: `sha256:${string}`; language: string; value: string; reference?: { class: PreprocessingLocatorClass; value: string; }; }; segments: Array<{ id: string; ordinal: number; sourceLocator: { page?: number; startMs?: number; endMs?: number; frame?: number; wholeImage?: boolean; bbox?: { x: number; y: number; width: number; height: number; unit: 'pixel' | 'ratio'; }; }; /** UTF-8 byte range [start, end) of this segment within the digest-verified `output.value`. */ outputRange: { start: number; end: number; }; text: string; textDigest: `sha256:${string}`; }>; selectedSegments: Array<{ segmentId: string; outputVersion: number; outputDigest: `sha256:${string}`; }>; quality: { source: 'preprocessor' | 'human-reviewer'; profile: string; label: string; score: number; flags: PreprocessingReviewFlag[]; }; transformations: Array<{ id: string; kind: PreprocessingTransformationKind; inputDigest: `sha256:${string}`; outputDigest: `sha256:${string}`; at: string; reviewer?: string; rationale?: string; previousOutput?: { id: string; version: number; digest: `sha256:${string}`; }; }>; policy: { trust: 'verified' | 'untrusted'; sensitivity: 'public' | 'internal' | 'confidential' | 'restricted'; retention: string; residency: string; rawEgress: { allowed: boolean; destinations: PreprocessingEgressDestination[]; }; derivedEgress: { allowed: boolean; destinations: PreprocessingEgressDestination[]; }; }; }; } export interface PreprocessingEgressDestination { provider: string; origin: string; } export interface PreprocessingStep { id: string; ordinal: number; kind: PreprocessingStepKind; tool: { id: string; version: string; }; model?: { id: string; version: string; }; configurationDigest: `sha256:${string}`; runtime: 'recorded-fixture' | 'offline' | 'live-observed'; startedAt: string; endedAt: string; inputDigest: `sha256:${string}`; outputDigest: `sha256:${string}`; /** Required exactly when the step is an identity transform (input digest equals output digest). */ noOp?: true; notesDigest?: `sha256:${string}`; } export interface PreprocessedEvidenceReference { evidence: ArtifactPin; sourceAssetId: string; sourceDigest: `sha256:${string}`; outputId: string; outputVersion: number; outputDigest: `sha256:${string}`; /** The D10 provider/origin this lineage was resolved (and egress-authorized) for. */ destination: PreprocessingEgressDestination; selectedSegments: Array<{ id: string; ordinal: number; locatorDigest: `sha256:${string}`; textDigest: `sha256:${string}`; preprocessingDigest: `sha256:${string}`; }>; quality: { source: 'preprocessor' | 'human-reviewer'; profileDigest: `sha256:${string}`; labelDigest: `sha256:${string}`; score: number; flags: PreprocessingReviewFlag[]; }; policy: { trust: 'verified' | 'untrusted'; sensitivity: 'public' | 'internal' | 'confidential' | 'restricted'; /** Free-text retention/residency never enter receipts; only their digests do. */ retentionDigest: `sha256:${string}`; residencyDigest: `sha256:${string}`; rawEgressAllowed: boolean; derivedEgressAllowed: boolean; }; } export interface PreprocessedDecisionState { text: string; lineage: PreprocessedEvidenceReference[]; } export interface PreprocessedEvidenceTrace { evidence: ArtifactPin; stepIds: string[]; stepCount: number; /** Identity steps, declared `noOp: true` in the manifest, recorded explicitly. */ noOpStepIds: string[]; sourceDigest: `sha256:${string}`; outputDigest: `sha256:${string}`; selectedSegmentCount: number; durationMs: number; qualityFlags: PreprocessingReviewFlag[]; policyOutcome: 'allowed' | 'review'; reasons: PreprocessedEvidenceReviewReason[]; } export type PreprocessingDispatchGateReason = PreprocessedEvidenceReviewReason | 'unverified' | 'unavailable' | 'destination-mismatch' | 'destination-unbound' | 'malformed-lineage' | 'input-unbound' | 'input-mismatch' | 'input-undeclared' | 'lineage-missing'; /** Evaluator-written pre-dispatch verdict. Anything but `allowed` means no credential or transport call. */ export interface PreprocessingDispatchGate { outcome: 'allowed' | 'review' | 'refused'; reasons: PreprocessingDispatchGateReason[]; } export interface PreprocessedEvidenceReceiptEvidence { schemaVersion: 'decision-preprocessing-lineage/v1'; status: 'ready' | 'review'; references: PreprocessedEvidenceReference[]; traces: PreprocessedEvidenceTrace[]; /** Present only in a RulesetResult: the evaluator's pre-dispatch gate verdict. */ dispatchGate?: PreprocessingDispatchGate; } export type PreprocessedEvidenceReviewReason = 'low-quality' | 'truncated' | 'incomplete' | 'stale' | 'policy-limited' | 'untrusted' | 'raw-egress-denied' | 'derived-egress-denied' | 'unsupported-locator' | 'lifecycle-unavailable' | 'legal-hold'; /** Host-resolved D10 lifecycle state for the subject that owns the lineage records. */ export interface PreprocessingLifecycleState { subject: string; now: number; tombstones: ReadonlyArray; holds: ReadonlyArray; } export interface ResolvePreprocessedEvidenceOptions { destination: PreprocessingEgressDestination; now?: () => number; maxAgeMs?: number; minQualityScore?: number; allowedLocatorClasses?: PreprocessingLocatorClass[]; sourceBytes?: Uint8Array; requireRawEgress?: boolean; /** Tombstoned lineage records withhold text; held records route to review. */ lifecycle?: PreprocessingLifecycleState; } export interface PreprocessedEvidenceResolution { status: 'ready' | 'review'; reasons: PreprocessedEvidenceReviewReason[]; state: PreprocessedDecisionState; receiptEvidence: PreprocessedEvidenceReceiptEvidence; } /** * Host-controlled verification for a stored lineage. Nothing here comes from the lineage itself: * the evaluator re-derives every review reason and the expected input text from these records. */ export interface PreprocessingVerification { /** Current host-stored manifests, looked up by the lineage reference IDs. */ manifests: PreprocessedEvidence[]; /** Required D10 lifecycle state; omitting it routes lineage to review (`lifecycle-unavailable`). */ lifecycle: PreprocessingLifecycleState; /** Required finite acceptance thresholds re-applied to the current manifests. */ minQualityScore: number; maxAgeMs: number; now?: () => number; /** * Which decision input field carries which manifests' verified text, in order. The expected * value is recomputed from the verified manifests' selected output slices and compared exactly. */ inputBindings: Array<{ pointer: string; manifestIds: string[]; }>; /** Every other string field in the decision input must be declared here as non-lineage text (scoped subtree pointers; the root pointer is rejected as malformed). */ nonLineagePointers?: string[]; } export declare class PreprocessedEvidenceError extends Error { readonly reason: 'invalid-manifest' | 'digest-mismatch' | 'broken-chain' | 'policy-denied'; constructor(reason: 'invalid-manifest' | 'digest-mismatch' | 'broken-chain' | 'policy-denied', message: string); } export interface PreprocessedEvidenceReferenceCheck { status: 'current' | 'stale'; reasons: Array<'manifest-pin' | 'source' | 'output' | 'segments' | 'quality' | 'policy'>; } export declare function preprocessedEvidencePin(manifest: PreprocessedEvidence): ArtifactPin; export declare function preprocessedEvidenceContentDigest(value: string | Uint8Array): `sha256:${string}`; /** True when a lineage carries no references and no traces: it is treated exactly as absent. */ export declare function isEmptyPreprocessingLineage(lineage: PreprocessedEvidenceReceiptEvidence | undefined): boolean; /** * A host-supplied lineage the evaluator can gate: it matches the closed result schema, has at * least one reference, and carries no pre-filled evaluator verdict. */ export declare function isWellFormedPreprocessingLineage(lineage: unknown): lineage is PreprocessedEvidenceReceiptEvidence; export declare function checkPreprocessedEvidenceReference(reference: PreprocessedEvidenceReference, manifest: PreprocessedEvidence): PreprocessedEvidenceReferenceCheck; export declare function resolvePreprocessedEvidence(manifests: PreprocessedEvidence[], options: ResolvePreprocessedEvidenceOptions): PreprocessedEvidenceResolution; /** * D10 lifecycle records for one manifest. Hosts register these as `links()` of the owning subject, * so cascading erasure tombstones the source, every transformation, the output and the manifest. * Identical sources or transformations in other manifests map to the same opaque IDs, so one * tombstone invalidates every dependent manifest and reference. */ export declare function preprocessingLifecycleReferences(manifest: PreprocessedEvidence): Array<{ role: 'manifest' | 'source' | 'transformation' | 'output'; reference: DecisionLifecycleReference; }>; /** Lifecycle reasons that stop automatic use of a manifest's derived text. */ export declare function preprocessingLifecycleReasons(manifest: PreprocessedEvidence, state: PreprocessingLifecycleState): Array<'lifecycle-unavailable' | 'legal-hold'>; /** * Pre-dispatch gate for a stored lineage. Runs before credential resolution and transport. * `destinations` are the D10 provider/origin of every target the evaluator could dispatch to * (`null` when a destination cannot be bound); `input` is the decision input the evaluator * projects and dispatches; `dispatchPointers` are the ruleset evaluation input pointers. * Stored trace status, reasons and digests are never trusted to allow dispatch. */ export declare function gatePreprocessedEvidenceDispatch(lineage: PreprocessedEvidenceReceiptEvidence | undefined, verification: PreprocessingVerification | undefined, destinations: Array, input: unknown, dispatchPointers: readonly string[]): PreprocessingDispatchGate; export declare function assertPreprocessedEvidence(value: unknown): asserts value is PreprocessedEvidence; //# sourceMappingURL=preprocessed-evidence.d.ts.map