import type { ContinuumPackageVersion } from '@hypersoniclabs/helix-manifest'; import { type EnsureNormalsReport } from '../glb/smooth-normals'; import type { ContinuumObjectPublication } from './types'; /** * Publication-time guard for a Package's GLB objects. * * A GLB with no NORMAL attribute renders faceted everywhere (glTF 2.0 makes * every runtime fall back to flat face normals), and a sealed Package Version * is immutable: the bytes you seal are the bytes every owner gets, forever. * The only moment the defect is cheap to fix is before sealing, so * `helix continuum publish-package` writes smooth NORMALs into any GLB object * that lacks them, then re-derives the CID and byte counts the descriptor * declared. * * That re-derivation is only sound when the descriptor names the GLB solely * through Package Version object references (`root`, `variants[].object`, * `source`). A vehicle definition or any other sibling object that quotes the * mesh by CID would be left pointing at bytes that no longer exist, so in that * case nothing is rewritten and the publish is refused with the remedy * (`helix glb add-normals`, rebuild the descriptor) or an explicit opt-out. */ export interface MissingNormalsOptions { creaseAngleDeg?: number; /** Receives one line per rewritten object. Defaults to stderr so a receipt on stdout stays machine-readable. */ log?: (message: string) => void; } export interface NormalsRewrite { filename: string; oldCid: string; newCid: string; oldBytes: number; newBytes: number; report: EnsureNormalsReport; } export declare class MissingNormalsError extends Error { readonly filename: string; readonly cid: string; readonly fixablePrimitives: number; constructor(filename: string, cid: string, fixablePrimitives: number, detail: string); } /** * Adds smooth normals to every GLB object that lacks them, rewriting the * Package Version and the object list in place. Returns what changed. * * Only inline (file) objects are examined: an object adopted by CID from an * existing asset is already published and cannot be re-derived here. */ export declare function addMissingNormalsToPublication(packageVersion: ContinuumPackageVersion, objects: ContinuumObjectPublication[], options?: MissingNormalsOptions): Promise;