/** * MotionInferenceServer.ts * * HTTP inference service for motion generation with contract enforcement. * * - POST /generate — accepts constraints, returns a contracted MotionClip * - POST /verify — runs plausibility contract on an externally supplied clip * - GET /health — liveness + contract version * * Every generated clip is checked against PhysicsPlausibilityContract * before emission. Violating outputs are hard-rejected with structured * diagnostics (never silently returned). * * The server also maintains a provenance log so the full depth-5 chain * (motion → checkpoint → corpus → pair → source) can be reconstructed. * * @module animation/paper */ import { type MotionCategory, type MotionClip, type PlausibilityResult } from './PhysicsPlausibilityContract'; import { type ProvenanceChain, type TrainingCorpus } from './MotionTrainingPipeline'; export interface InferenceRequest { category: MotionCategory; /** Optional seed for deterministic generation. */ seed?: number; /** Number of frames (default 20). */ numFrames?: number; /** Frame timestep in seconds (default 0.05). */ dt?: number; /** Enable constrained-decoding retry on rejection. */ retryOnReject?: boolean; /** Max retries (default 3). */ maxRetries?: number; } export interface InferenceResponse { success: boolean; clip?: MotionClip; rejection?: PlausibilityResult; retryCount?: number; latencyMs: number; provenance?: ProvenanceChain; } export interface VerifyRequest { clip: MotionClip; } export interface VerifyResponse { pass: boolean; result: PlausibilityResult; } export interface HealthResponse { status: 'ok' | 'degraded'; contractVersion: string; uptimeSeconds: number; totalRequests: number; totalRejections: number; categories: MotionCategory[]; } export declare class MotionInferenceServer { private server?; private startTime; private totalRequests; private totalRejections; private port; /** Optional training corpus for provenance chain construction. */ corpus?: TrainingCorpus; /** Optional checkpoint hash for provenance. */ checkpointHash?: string; constructor(options?: { corpus?: TrainingCorpus; checkpointHash?: string; }); /** Start the HTTP server. Returns the actual bound port. */ start(port?: number): Promise; /** Stop the server. */ stop(): Promise; getPort(): number; getStats(): { totalRequests: number; totalRejections: number; uptimeSeconds: number; }; private handleRequest; private handleGenerate; private handleVerify; } export interface BatchVerifyRequest { clips: MotionClip[]; } export interface BatchVerifyResponse { total: number; passed: number; failed: number; passRate: number; results: PlausibilityResult[]; } /** Batch-verify a set of clips without starting the HTTP server. */ export declare function batchVerifyClips(req: BatchVerifyRequest): BatchVerifyResponse; export declare function createServerWithSyntheticCorpus(options?: { astNodeCount?: number; pairsPerNode?: number; checkpointHash?: string; sourceCommitHash?: string; }): { server: MotionInferenceServer; corpus: TrainingCorpus; }; //# sourceMappingURL=MotionInferenceServer.d.ts.map