/** * MotionTrainingPipeline.ts * * DPO (Direct Preference Optimization) pair generation from contracted * HoloScript AST slices, with full Merkle-tree provenance. * * Every pair carries: * - chosen clip (contracted / plausible) * - rejected clip (implausible baseline) * - source commit hash * - AST SourceRange * * The training corpus hash is the Merkle root of all pair hashes, * producing the depth-5 chain claimed in paper-9 ยง3. * * @module animation/paper */ import { type MotionCategory, type MotionClip } from './PhysicsPlausibilityContract'; /** Byte-precise AST location metadata. */ export interface SourceRange { file: string; startLine: number; startColumn: number; endLine: number; endColumn: number; } /** One DPO preference pair. */ export interface DPOPair { id: string; chosen: MotionClip; rejected: MotionClip; category: MotionCategory; sourceCommitHash: string; sourceRange: SourceRange; /** SHA-256 of this pair (computed, not stored redundantly). */ pairHash?: string; } /** Training corpus with Merkle provenance. */ export interface TrainingCorpus { pairs: DPOPair[]; merkleRoot: string; pairCount: number; createdAt: string; metadata: { sourceCommitHash: string; description: string; }; } export declare function sha256(input: string | Uint8Array): string; /** Deterministically serialize a MotionClip for hashing. */ export declare function serializeClip(clip: MotionClip): string; /** Compute the SHA-256 hash of a DPO pair (chosen + rejected + source). */ export declare function hashDPOPair(pair: DPOPair): string; /** Build a Merkle tree from DPO pair hashes and return the root. */ export declare function buildCorpusMerkleRoot(pairs: DPOPair[]): string; /** Generate a Merkle proof for a pair at a given index. */ export declare function generateMerkleProof(pairs: DPOPair[], targetIndex: number): { root: string; proof: { siblingHash: string; isLeft: boolean; }[]; }; /** Verify a Merkle proof. */ export declare function verifyMerkleProof(leafHash: string, proof: { siblingHash: string; isLeft: boolean; }[], expectedRoot: string): boolean; /** Simulate slicing contracted AST nodes into DPO pairs. * * In production this would be driven by the Absorb pipeline extracting * actual AST ranges from HoloScript source. Here we generate synthetic * but structurally valid pairs that satisfy the contract semantics. */ export declare function generateDPOPairsFromAST(params: { astNodes: { file: string; startLine: number; endLine: number; category: MotionCategory; }[]; sourceCommitHash: string; /** Base seed for reproducible pair generation. */ seed?: number; /** Number of pairs per AST node. */ pairsPerNode?: number; }): DPOPair[]; /** Assemble a fully provenance-tracked training corpus. */ export declare function assembleTrainingCorpus(params: { pairs: DPOPair[]; sourceCommitHash: string; description?: string; }): TrainingCorpus; /** Serialize a corpus to a JSON string (deterministic ordering). */ export declare function serializeTrainingCorpus(corpus: TrainingCorpus): string; /** Hash a training corpus (Merkle root of the full structure). */ export declare function hashTrainingCorpus(corpus: TrainingCorpus): string; /** Verify corpus integrity: recompute Merkle root and compare. */ export declare function verifyCorpusIntegrity(corpus: TrainingCorpus): boolean; /** Depth-5 provenance chain as described in the paper. */ export interface ProvenanceChain { motionArtifactHash: string; checkpointHash: string; corpusHash: string; corpusMerkleRoot: string; pairHashes: string[]; sourceCommitHash: string; } /** Build the full depth-5 provenance chain. */ export declare function buildProvenanceChain(params: { motionClip: MotionClip; checkpointHash: string; corpus: TrainingCorpus; }): ProvenanceChain; /** Verify the full provenance chain top-down (O(log N + k) hash ops). */ export declare function verifyProvenanceChain(chain: ProvenanceChain, sampleIndices: number[], corpus: TrainingCorpus): boolean; //# sourceMappingURL=MotionTrainingPipeline.d.ts.map