import { type HostFrameIndex } from './hostFrame'; export type VehicleIssueLevel = 'error' | 'warn'; export interface VehicleIssue { /** Stable, filterable identifier. */ code: string; level: VehicleIssueLevel; /** JSON path into the package, or `glb:node:` / `glb` for model findings. */ path: string; message: string; /** One line: what to change. */ fix: string; } export interface VehicleValidationResult { ok: boolean; errors: number; warnings: number; issues: VehicleIssue[]; /** The engine commit the vendored validator was generated from. */ engineCommit: string; } type Json = Record; type Vec3 = [number, number, number]; interface EngineIssue { level: 'error' | 'warn'; path: string; message: string; } interface VendoredVehicleValidator { VEHICLE_PACKAGE_V2_SOURCE: { commit: string; }; validateEngineVehiclePackage(pkg: unknown, options?: unknown): EngineIssue[]; assertPackagePublishable(pkg: unknown): void; resolveSocketName(raw: string, prefix?: string): { id?: string; warning?: string; }; detectNodePrefix(names: readonly string[]): string | undefined; isSeatId(id: string): boolean; compileComponentActionProtocol(build: unknown): { issues: string[]; protocol?: unknown; }; } /** The vendored engine validator is ESM; this package compiles to CommonJS, hence the dynamic-import indirection. */ export declare function loadVehicleValidator(): Promise; /** Metres. `physics.chassis.groundToBodyOrigin` must equal `wheelRadius + suspension.staticRideHeight` to this. */ export declare const GROUND_TO_BODY_ORIGIN_TOLERANCE_M = 0.005; /** Metres. A wheel node's origin must sit this close to the centre of its own geometry. */ export declare const WHEEL_PIVOT_TOLERANCE_M = 0.02; export declare const TWO_WHEELER_CLASSES: readonly string[]; /** * Recompute `specialty.componentBuild.digest`. The backend's `validateRows` accepts the seven authored row fields * AND `carried` / `unsupported`, and digests every accepted row; `dropped` must be empty and is not digested. */ export declare function computeComponentBuildDigest(build: Json): string | undefined; /** What `item publish` sends: a v2 package's mesh is rewritten to the universal-item `$self` pin first. */ export declare function publishedVehiclePackage(pkg: Json): Json; /** * Checks a+b+c on the package alone. Never throws: an engine validator that crashes on a malformed package is * itself reported as an issue, because that crash is exactly what the runtime would hit at spawn. */ export declare function checkVehiclePackage(candidate: unknown, engine: VendoredVehicleValidator): VehicleIssue[]; export interface GltfNode { name?: string; mesh?: number; children?: number[]; matrix?: number[]; translation?: number[]; rotation?: number[]; scale?: number[]; } export interface GltfPrimitive { attributes?: Record; /** Index into `materials`; absent means the glTF default material (no emissive). */ material?: number; } export interface GltfMaterial { name?: string; /** Linear RGB; [0, 0, 0] (or absent) is not emissive. */ emissiveFactor?: number[]; emissiveTexture?: { index: number; }; } export interface Gltf { scene?: number; scenes?: Array<{ nodes?: number[]; }>; nodes?: GltfNode[]; meshes?: Array<{ name?: string; primitives?: GltfPrimitive[]; }>; materials?: GltfMaterial[]; accessors?: Array<{ min?: number[]; max?: number[]; }>; } export interface Aabb { min: Vec3; max: Vec3; } export interface NodeFacts { index: number; name: string; parent: number | undefined; world: number[]; /** World-space bounds of this node's own mesh only. */ ownBox?: Aabb; } /** Walk every node reachable from the default scene (or all nodes when there is no scene). */ export declare function walkNodes(gltf: Gltf): Map; export declare function subtreeBox(index: number, gltf: Gltf, facts: Map): Aabb | undefined; /** The five lamp functions that MUST each be their own node in the model. */ export declare const REQUIRED_LAMP_FUNCTIONS: readonly ["headlamps", "taillamps", "reverselights", "indicator_l", "indicator_r"]; /** * Lamps a car may lack (never fabricate fog lamps, docs/vehicles.md): absent is a warning when a row declares * them, never a refusal. When one IS present it is held to the same node/material rules as a required lamp. */ export declare const OPTIONAL_LAMP_FUNCTIONS: readonly ["foglights", "chmsl", "numberplate"]; /** World-space bounds of everything the default scene draws, plus that scene's `extras` (where `helixMeshFrame` lives). */ export declare function glbSceneFacts(glb: Buffer): { box?: { min: Vec3; max: Vec3; }; sceneExtras?: Json; nodeNames: string[]; }; /** Backend `host-manifest.ts` NAME_PATTERN: a socket name outside it is silently dropped from the host surface. */ export declare const HOST_SOCKET_NAME_PATTERN: RegExp; /** What to paste: the manifest in `asset.extras`, the only place the backend reads it. */ export declare const HOST_MANIFEST_SNIPPET: string; /** * The add-on host surface. The backend (`src/add-ons/host-manifest.ts` `hostManifestOfGlb`) reads the vehicle's host * declaration from glTF `asset.extras.HELIX_vehicle` ONLY; without it the car publishes as a silent non-host (`verification.ok`, * a board with no sockets, "0 compatible" in the customizer). The RUNTIME reads scene > document > asset, so a manifest in * the scene extras drives fine and is still invisible to the backend — the round-1 F40 defect. These checks make * every way to get that wrong an error, before anything is minted. */ export declare function checkHostManifest(glb: Buffer): VehicleIssue[]; /** Checks that need the model. `pkg` supplies the articulation nodes; it may be anything (checked defensively). */ export declare function checkVehicleGlb(pkg: unknown, glb: Buffer, engine: VendoredVehicleValidator): VehicleIssue[]; /** `hostBindIssues` for a GLB on its own (the rail check reads a published car's bytes). */ export declare function checkHostBindNodesOfGlb(glb: Buffer, engine: VendoredVehicleValidator): VehicleIssue[]; /** The host GLB's node index for the host-frame bind contract (`hostFrame.ts`): names, socket nodes, ancestry. */ export declare function hostFrameIndexOfGlb(glb: Buffer, engine: VendoredVehicleValidator): HostFrameIndex; export declare function summarizeIssues(issues: VehicleIssue[], engineCommit: string): VehicleValidationResult; export interface VehicleSimulationOptions { /** API whose engine runtime is used (`/api/v1/instant-packages/humanoid-character/runtime/^0.3/index.js`). */ apiUrl: string; offline?: boolean; runtime?: string; range?: string; } /** * The offline drive: when the package declares `targets`, drive it with the platform's own instrument and turn every * out-of-tolerance figure into an ERROR. A runtime that cannot be loaded is a WARNING — validation must still work * offline with nothing cached — and so is an engine that refuses the package (the engine validator above has already * reported why). */ export declare function simulationIssues(pkg: unknown, opts: VehicleSimulationOptions): Promise<{ issues: VehicleIssue[]; report: import('./simulate').SimulationReport | null; }>; /** * The offline cabin check (`cabinCheck.ts`) as validation issues: every FAIL row is an ERROR, every WARN row a warning, each naming the seat, * the row and the figure. A runtime that cannot be loaded or a model it cannot read is a WARNING (validation must still work offline with * nothing cached), like the drive. */ export declare function cabinIssues(pkg: unknown, glb: Buffer, opts: VehicleSimulationOptions): Promise<{ issues: VehicleIssue[]; report: import('./cabinCheck').CabinCheckReport | null; }>; /** * Run every check. `glb` is optional; without it the model checks are simply not run. `simulate` adds the offline * drive (needs the engine runtime: fetched once, then cached); without it nothing touches the network. */ export declare function validateVehicle(pkg: unknown, glb?: Buffer, options?: { simulate?: VehicleSimulationOptions; cabin?: VehicleSimulationOptions; }): Promise; /** One block per issue: `✗ CODE path — message` then an indented fix line. */ export declare function formatVehicleIssues(issues: readonly VehicleIssue[]): string; /** Used by `item publish`: errors refuse, warnings are returned for display. */ export declare function assertVehiclePackagePublishable(pkg: Json): Promise; export declare function readJsonFile(path: string): unknown; /** Refuses a vehicle model whose host manifest the backend would not read (a silent non-host). */ export declare function assertVehicleHostManifest(glb: Buffer): void; /** * The Package-first gate: a `vehicle` Package Version descriptor whose drawn model (a GLB object carried as bytes) * has no host manifest the backend can read is refused before anything is sealed. Adopted / existing objects carry * no bytes here and are not re-checked (their model was judged when it was first sealed). */ export declare function vehiclePackageDescriptorHostIssues(descriptor: { package?: { type?: unknown; }; }, objects: ReadonlyArray<{ reference: { mediaType?: string; role?: string; }; source: { kind: string; bytes?: Uint8Array; filename?: string; }; }>): VehicleIssue[]; export declare function assertVehiclePackageDescriptorHost(descriptor: { package?: { type?: unknown; }; }, objects: Parameters[1]): void; /** * The `item publish` gate (publish, `--dry-run`, `--quote`): refuses a vehicle package with errors and a vehicle * model with no readable host manifest (when the mesh bytes are given), and returns the package's warnings. */ export declare function assertPublishVehiclePackage(opts: { kind: string; vehiclePackage?: Record; }, meshBytes?: Buffer | null): Promise; export {};