/** * createHologram — single isomorphic entry point for turning 2D media * (image / GIF / video) into a HoloGram bundle. * * Architecture: * media bytes * -> DepthProvider (inference) * -> depth Float32Array + normal Float32Array * -> [optional] QuiltRenderer -> quilt PNG bytes * -> [optional] MvhevcEncoder -> MV-HEVC mp4 bytes * -> [optional] ParallaxEncoder -> parallax WebM bytes * -> HologramBundle (with content-addressed hash) * * Providers are dependency-injected so the same orchestrator runs in * browser (WebGPU depth + Three.js quilt render) and on the Node-side * hologram-worker service (onnxruntime-node + headless Chromium quilt * render + ffmpeg MV-HEVC mux). See Sprint 0c for the Node providers. * * This file is audit-grade: * - All inputs validated at the boundary; typed errors thrown * - No hidden globals, no implicit fetches, no console.log * - Time source injectable for test determinism * * @see D.019 (MEMORY.md): HoloGram product line + telegram push metaphor * @see F.007: Plans declare both what's built and what's excluded * @see F.016: Scope discipline — Sprint 0a is orchestration only */ import { type HologramBundle, type HologramMeta, type HologramSourceKind, type HologramTarget } from './HologramBundle'; export interface DepthInferenceResult { /** Float32 depth map, row-major, values in [0,1]. */ depthMap: Float32Array; /** Width of the output map */ width: number; /** Height of the output map */ height: number; /** Number of frames (1 for still images, >1 for GIF/video) */ frames: number; /** Backend that actually ran the inference */ backend: HologramMeta['backend']; /** Model ID used (e.g., 'depth-anything/Depth-Anything-V2-Small-hf') */ modelId: string; } export interface DepthProvider { /** * Run depth estimation on media bytes. Implementations MUST NOT mutate * the input. MUST throw a descriptive Error on failure (do not return * empty results silently). */ infer(media: Uint8Array, sourceKind: HologramSourceKind): Promise; } export interface QuiltRenderer { /** * Render 48-view quilt as PNG. `tilesConfig` comes from QuiltCompiler — * a list of per-view camera offsets + shears. Returns the assembled * quilt image as PNG-encoded bytes. */ render(input: { depthMap: Float32Array; normalMap: Float32Array; width: number; height: number; frames: number; media: Uint8Array; sourceKind: HologramSourceKind; }): Promise; } export interface MvhevcEncoder { /** Encode a stereo pair sequence as MV-HEVC mp4 bytes */ encode(input: { depthMap: Float32Array; width: number; height: number; frames: number; media: Uint8Array; sourceKind: HologramSourceKind; }): Promise; } export interface ParallaxEncoder { /** Encode a parallax WebM loop (small, phone-friendly fallback) */ encode(input: { depthMap: Float32Array; width: number; height: number; media: Uint8Array; sourceKind: HologramSourceKind; }): Promise; } export interface HologramProviders { depth: DepthProvider; quilt?: QuiltRenderer; mvhevc?: MvhevcEncoder; parallax?: ParallaxEncoder; } export interface CreateHologramOptions { /** Which outputs to produce. Default: all three. */ targets?: HologramTarget[]; /** Override the default clock (for deterministic tests) */ now?: () => Date; /** * When true, run quilt / mvhevc / parallax encoders one after another instead * of in parallel. Node hologram-worker uses this so Playwright can reuse a * single browser across targets. */ sequentialRender?: boolean; } export interface CreateNodeProvidersOptions { /** Hologram worker base URL. Default: HOLOGRAM_WORKER_URL. */ workerUrl?: string; /** Bearer token for worker ingress. Default: HOLOGRAM_WORKER_INGRESS_TOKEN. */ token?: string; /** Fetch implementation for tests or custom runtimes. Default: global fetch. */ fetchImpl?: typeof fetch; } export declare class CreateHologramError extends Error { readonly code: 'empty_media' | 'invalid_source_kind' | 'unknown_target' | 'missing_provider' | 'depth_failed' | 'render_failed'; readonly cause?: unknown | undefined; constructor(code: 'empty_media' | 'invalid_source_kind' | 'unknown_target' | 'missing_provider' | 'depth_failed' | 'render_failed', message: string, cause?: unknown | undefined); } /** * Build a HologramBundle from media bytes. This is the ONE function every * push path (CLI, Studio upload, MCP tool, feed post) calls. Keeping it * isomorphic + provider-injected is what lets us share the pipeline * across browser + Node + worker surfaces. */ export declare function createHologram(media: Uint8Array, sourceKind: HologramSourceKind, providers: HologramProviders, options?: CreateHologramOptions): Promise; /** * Node-side providers for CLI and service surfaces. The implementation is * worker-backed: each provider calls the Sprint 0c hologram-worker provider * endpoint and returns bytes/maps to the isomorphic createHologram pipeline. * * If the worker is not configured or reachable, the provider fails loudly with * CreateHologramError('missing_provider'); there is no synthetic fallback. */ export declare function createNodeProviders(options?: CreateNodeProvidersOptions): HologramProviders; /** * @deprecated Use createNodeProviders(). Kept as a compatibility alias for * older callers; it no longer returns Sprint-0a stubs. */ export declare function createNodeProvidersStub(options?: CreateNodeProvidersOptions): HologramProviders; //# sourceMappingURL=createHologram.d.ts.map