/** * HologramBundle — the canonical data structure for a HoloGram. * * A HoloGram is a 2D source image/GIF/video transformed into a 3D * representation that can be rendered on Looking Glass displays, Apple * Vision Pro (as MV-HEVC spatial video), or as a parallax card on phones. * * This file intentionally contains NO rendering logic — only the data * shape and deterministic content-addressing. Renderers live in * `createHologram.ts` (orchestrator) and platform-specific providers. * * @see D.019: HoloGram product line + telegram push metaphor * @see W.148: Browser-native depth estimation is production-ready * @see W.067a: Content hashes must be stable cross-platform (LF canon) */ export type HologramSourceKind = 'image' | 'gif' | 'video'; export type HologramTarget = 'quilt' | 'mvhevc' | 'parallax'; export interface HologramMeta { /** Source media kind */ sourceKind: HologramSourceKind; /** Output width in pixels (depth/normal map dimension) */ width: number; /** Output height in pixels */ height: number; /** Number of frames (1 for still images, >1 for GIF/video) */ frames: number; /** Depth model identifier used for inference */ modelId: string; /** Which backend actually ran the inference */ backend: 'webgpu' | 'wasm' | 'cpu' | 'onnxruntime-node'; /** Total wall-clock time to build the bundle (ms) */ inferenceMs: number; /** ISO8601 timestamp of bundle creation */ createdAt: string; /** Schema version for future migration */ schemaVersion: 1; } /** * Render output manifest — binds the rendered output to its source receipt. * Per D.058: receipt must ride to the pixels. */ export interface HologramManifest { /** Content-addressed hash of the source state (bundle identity) */ sourceHash: string; /** Receipt type discriminator */ receiptType: 'bundle-hash'; /** ISO8601 timestamp of manifest creation */ createdAt: string; } export interface HologramBundle { /** * Content-addressed identifier. SHA-256 hex of canonical * (meta ‖ depth ‖ normal). Stable across platforms per W.067a. * Quilt/MV-HEVC bytes are NOT hashed — different renderers may * produce byte-different outputs for the same logical HoloGram. */ hash: string; meta: HologramMeta; /** Render output manifest carrying the source receipt hash */ manifest: HologramManifest; /** Float32 depth map, row-major, values in [0,1] (0=near, 1=far) */ depthBin: Uint8Array; /** Float32 RGB normal map, row-major, values in [0,1] */ normalBin: Uint8Array; /** Looking Glass quilt as PNG bytes (if 'quilt' target requested) */ quiltPng?: Uint8Array; /** Apple Vision Pro MV-HEVC mp4 bytes (if 'mvhevc' target requested) */ mvhevcMp4?: Uint8Array; /** Fallback parallax WebM bytes (if 'parallax' target requested) */ parallaxWebm?: Uint8Array; } /** * Thrown when a HologramBundle fails validation. Carries a machine-readable * code so callers can branch (e.g., MCP tools surfacing structured errors). */ export declare class HologramBundleError extends Error { readonly code: 'invalid_media' | 'invalid_dimensions' | 'invalid_meta' | 'depth_size_mismatch' | 'normal_size_mismatch' | 'hash_mismatch'; constructor(code: 'invalid_media' | 'invalid_dimensions' | 'invalid_meta' | 'depth_size_mismatch' | 'normal_size_mismatch' | 'hash_mismatch', message: string); } /** * Validate a bundle's internal consistency. Throws HologramBundleError on * any mismatch. Does NOT recompute the hash — use verifyBundleHash for that. */ export declare function validateBundle(bundle: HologramBundle): void; /** * Canonical JSON serialization for `meta` — sorted keys, no whitespace, * guaranteed byte-stable across runtimes. This is what the hash commits to. * * We omit `inferenceMs` and `createdAt` from the hash: they're observational * metadata, not identity. Two identical runs produce the same hash. */ export declare function canonicalMetaJson(meta: HologramMeta): string; /** * Compute a bundle's canonical hash. Identity = meta (canonical JSON) ‖ 0x00 * ‖ depthBin ‖ 0x00 ‖ normalBin. Renderer outputs (quilt/mvhevc/parallax) * are NOT part of the identity — see HologramBundle.hash docstring. */ export declare function computeBundleHash(meta: HologramMeta, depthBin: Uint8Array, normalBin: Uint8Array): Promise; /** * Recompute and compare a bundle's hash. Throws HologramBundleError with * code 'hash_mismatch' if the stored hash doesn't match the recomputed * value. Use on read paths (storage fetch, network transfer) to detect * corruption. */ export declare function verifyBundleHash(bundle: HologramBundle): Promise; //# sourceMappingURL=HologramBundle.d.ts.map