/** * The HOST-FRAME BIND CONTRACT — which nodes of the car's GLB a host-frame add-on's bind needs, and the check that * they are there. * * WHY THIS EXISTS. A meshed add-on authored in the host's frame carries `scene.extras.helixMeshFrame.bind * { socket, root, matrix }`. The engine's `applyComposition` (CompositionPreview.ts) resolves it against the car's * OWN nodes before it touches anything, and THROWS when the car lacks one: * * - the mount node: the node the host's socket table resolves `bind.socket` to (`vehicleHostSockets` over the * node names, through `resolveSocketName`) — an offered socket the GLB has no node for is an unresolved mount, * and an unresolved mount is not drawn; * - `bind.root`: a node of that name must exist ("host mesh bind root '…' is absent"); * - ownership: the mount node must sit inside `bind.root`'s subtree ("… does not own socket '…'"). * * The throw happens while the car is being composed, so the car is never presented: no frame, no page error, and a * preview that waits out its whole presentation timeout. A blind R34 run lost about an hour to a wing bound to a * `vehicle_root` the host GLB did not have; a Ferrari F40 run lost the same hour to a missing `boot` mount node. * Neither the host's validate nor its rail check said anything, because nothing on the host side stated the rule. * * Two entry points share one core: * - `checkBindAgainstHost`: one add-on's declared bind against the host's nodes. Exactly the engine's three tests. * Used by `vehicle addon check` (a directory against its hosts), `vehicle preview` (preflight) and the * published-rail check (`vehicle addon check --host`). * - `checkHostOffersBindableNodes`: the host alone (`vehicle validate --glb`). The add-on is not known, so the bind * root it will name is not either; this states what a host that offers a lid socket must carry for ANY add-on to * bind to it: the lid's mount node, and the host-frame root node, which owns the mount node. The root's name is the * documented host-frame origin (`vehicle_root`: what the BeamNG bridge writes and what the preview harness * measures the host frame from). * * Pure: node facts in, issues out. No I/O, no import of validate.ts at run time (validate.ts calls into this). */ import type { NodeFacts, VehicleIssue } from './validate'; type Json = Record; /** The documented host-frame root: the node a host-frame bind names as `root`, and the origin the host frame is measured from. */ export declare const HOST_FRAME_ROOT = "vehicle_root"; /** The lid sockets whose add-ons follow a moving panel (a wing rides the boot, a scoop rides the bonnet): the ones a host-frame bind names. */ export declare const BINDABLE_PANEL_SOCKETS: readonly string[]; /** The slice of the vendored engine validator this needs (its socket resolver, the same one the runtime composes with). */ export interface SocketResolver { resolveSocketName(raw: string, prefix?: string): { id?: string; warning?: string; }; detectNodePrefix(names: readonly string[]): string | undefined; } export interface HostFrameIndex { /** Node name → its facts (first in scene order wins, as `getObjectByName` does). */ byName: Map; /** Canonical socket id → the host's own node name for it, built the way the engine's `vehicleHostSockets` builds it. */ socketNode: Map; facts: Map; engine: SocketResolver; } export declare function buildHostFrameIndex(facts: Map, engine: SocketResolver): HostFrameIndex; export interface BindSubject { /** Who is binding, for the message: `add-on "Wing" (vehicle.spoiler@1)`. */ label: string; /** Where the bind was read from, for the issue path. */ path: string; /** `host` (published car name or the candidate) for the message. */ hostLabel: string; } /** The engine's three bind tests (mount node, bind root, ownership) for ONE add-on's declared bind. */ export declare function checkBindAgainstHost(bind: unknown, index: HostFrameIndex, subject: BindSubject): VehicleIssue[]; /** * The host alone: for every lid socket it OFFERS (a `boot`/`bonnet` socket in `asset.extras.HELIX_vehicle`, by name or * through an alias), the mount node must exist and sit inside the host-frame root, and that root must exist. An add-on * that binds to the lid (a wing, a scoop) can then compose. */ export declare function checkHostOffersBindableNodes(input: { offered: readonly string[]; index: HostFrameIndex; }): VehicleIssue[]; /** The socket keys `asset.extras.HELIX_vehicle` offers: `sockets` (an object of positions, or an array of names) and `socketNodes`. */ export declare function offeredSocketKeys(manifest: unknown): string[]; /** The `bind` an add-on GLB's scene declares, when it is a host-frame part; undefined otherwise. */ export declare function declaredHostBind(sceneExtras: Json | undefined): Json | undefined; export {};