/** * Pure, zero-dependency classification of a model-asset fetch before it reaches * a GLTF parser. Runtime loaders hand the raw response (status, content type, * and the first bytes) to {@link classifyAssetResponse} so a missing or * mis-served file surfaces as an actionable diagnostic naming the broken asset * contract, instead of the opaque "Unexpected token < in JSON" parse error a * dev-server HTML fallback otherwise produces. No `fetch`, DOM, or three.js * dependency lives here — callers supply the already-read bytes. */ /** * How a model-asset fetch resolved. `ok` means the bytes are a parseable GLB or * glTF-JSON; every other kind is a distinct failure a loader should report * rather than parse: `missing` (HTTP error / no bytes), `html` (a dev-server * fallback page served in place of the file), `corrupt` (bytes present but not a * recognizable model), `unsupported` (a recognizable but non-model format). */ export type AssetLoadKind = "ok" | "missing" | "html" | "corrupt" | "unsupported"; /** The signature read from a response's leading bytes, independent of HTTP metadata. @internal */ export type AssetByteSignature = "glb" | "gltf-json" | "html" | "png" | "jpeg" | "zip" | "unknown" | "empty"; /** * A probe of a model-asset fetch: the URL, an optional logical asset id for the * diagnostic, and whatever the caller managed to read. Any field may be absent * (e.g. a network error yields no `status` or `bytes`); the classifier degrades * gracefully. */ export interface AssetResponseProbe { url: string; /** Logical catalog id / alias behind the URL, surfaced in the diagnostic message when known. */ logicalId?: string; /** HTTP status code; `0` or `>= 400` is treated as missing. Omit when the fetch never completed. */ status?: number; statusText?: string; /** `Content-Type` response header, lower-cased or not — matched case-insensitively. */ contentType?: string; /** The leading bytes of the body (a few hundred is plenty); their signature decides GLB vs HTML vs corrupt. */ bytes?: Uint8Array; } /** The verdict for one model-asset fetch: its {@link AssetLoadKind} plus a ready-to-log message. */ export interface AssetLoadDiagnosis { kind: AssetLoadKind; /** True only for `kind: "ok"` — safe to hand the bytes to a GLTF parser. */ ok: boolean; url: string; logicalId?: string; byteSignature: AssetByteSignature; /** Human-readable, actionable one-liner naming the asset, the URL, and the likely fix. */ message: string; } /** GLB little-endian magic — the ASCII "glTF" at byte 0 of a binary glTF container. @internal */ export declare const GLB_MAGIC_ASCII = "glTF"; /** * Classify the leading bytes of a response body by their format signature, with * no HTTP context. Recognizes GLB (`glTF` magic), glTF-JSON (a leading `{`), an * HTML fallback page (`= 400` or `0` status is `missing`), then the * `Content-Type` and byte signature decide between an HTML fallback, a * parseable model (`ok`), an unsupported-but-recognizable format, and otherwise * corrupt bytes. The returned `message` always names the asset and URL and, for * failures, points at the likely fix (provision the pack, check the serving path). * * @capability asset-load-diagnostics classify a model fetch (missing / HTML fallback / corrupt / unsupported) before parsing */ export declare function classifyAssetResponse(probe: AssetResponseProbe): AssetLoadDiagnosis;