Skip to content

@bendyline/molen-schema ​

Molen data formats: schemas, validator, and error formatter.

ts
import { /* … */ } from '@bendyline/molen-schema';

Interfaces ​

AircraftData ​

Extends ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

kind ​
ts
kind: string;

Stable external entity/type id.

spec ​
ts
spec: AircraftSpec;

AircraftEngineInputData ​

Extends ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

enabled? ​
ts
optional enabled?: boolean;

Individual engine switch. The common engine switch remains a master cutoff.

power? ​
ts
optional power?: number;

Absolute throttle override, 0–1. Omitted inherits the common throttle.


AircraftEngineSpec ​

Extends ​

Extended by ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

idleRpm ​
ts
idleRpm: number;
maxThrust? ​
ts
optional maxThrust?: number;
minPropellerSpeed? ​
ts
optional minPropellerSpeed?: number;
position ​
ts
position: [number, number, number];
power ​
ts
power: number;
propellerEfficiency? ​
ts
optional propellerEfficiency?: number;

Optional per-engine propeller tuning; defaults to the airplane's values.

rotorAngularSpeed ​
ts
rotorAngularSpeed: number;
spoolRate ​
ts
spoolRate: number;
thrustAxis ​
ts
thrustAxis: [number, number, number];

AircraftEngineStateData ​

Extends ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

failed ​
ts
failed: boolean;

Latched failure; pilot throttle/switch changes cannot clear it.

rotorAngle ​
ts
rotorAngle: number;
rpm ​
ts
rpm: number;
thrust ​
ts
thrust: number;

Current propeller thrust in newtons (zero for the helicopter's shaft engine).


AircraftInputData ​

Extends ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

brake ​
ts
brake: boolean;
engine ​
ts
engine: boolean;
engines? ​
ts
optional engines?: Record<string, AircraftEngineInputData>;

Optional per-engine switch/throttle overrides, keyed by engine id.

flaps ​
ts
flaps: boolean;
gear ​
ts
gear: boolean;
pitch ​
ts
pitch: number;
power ​
ts
power: number;

Absolute engine throttle (airplane) or collective (helicopter), retained when keys release.

roll ​
ts
roll: number;
yaw ​
ts
yaw: number;

AircraftNamedEngineSpec ​

A named installation in an airplane's engine bank. Positions use aircraft-local meters.

Extends ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

id ​
ts
id: string;
idleRpm ​
ts
idleRpm: number;
Inherited from ​

AircraftEngineSpec.idleRpm

maxThrust? ​
ts
optional maxThrust?: number;
Inherited from ​

AircraftEngineSpec.maxThrust

minPropellerSpeed? ​
ts
optional minPropellerSpeed?: number;
Inherited from ​

AircraftEngineSpec.minPropellerSpeed

position ​
ts
position: [number, number, number];
Inherited from ​

AircraftEngineSpec.position

power ​
ts
power: number;
Inherited from ​

AircraftEngineSpec.power

propellerEfficiency? ​
ts
optional propellerEfficiency?: number;

Optional per-engine propeller tuning; defaults to the airplane's values.

Inherited from ​

AircraftEngineSpec.propellerEfficiency

rotorAngularSpeed ​
ts
rotorAngularSpeed: number;
Inherited from ​

AircraftEngineSpec.rotorAngularSpeed

spoolRate ​
ts
spoolRate: number;
Inherited from ​

AircraftEngineSpec.spoolRate

thrustAxis ​
ts
thrustAxis: [number, number, number];
Inherited from ​

AircraftEngineSpec.thrustAxis


AircraftRotorBinding ​

Extends ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

axis ​
ts
axis: "x" | "y" | "z";
Inherited from ​

AircraftVisualBinding.axis

engine? ​
ts
optional engine?: string;

Engine id for an independent propeller. Omitted follows the first engine.

multiplier ​
ts
multiplier: number;
Inherited from ​

AircraftVisualBinding.multiplier

node ​
ts
node: string;
Inherited from ​

AircraftVisualBinding.node


AircraftSpec ​

Complete data-driven tuning consumed by the generic aircraft solver and client.

Extends ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

airplane? ​
ts
optional airplane?: AirplanePhysicsSpec;
centerOfMass ​
ts
centerOfMass: [number, number, number];
collisionProbes ​
ts
collisionProbes: [number, number, number][];
engine? ​
ts
optional engine?: AircraftEngineSpec;

Single-engine form, identified as "main". Supply this or engines, never both.

engines? ​
ts
optional engines?: AircraftNamedEngineSpec[];

Named independent propeller engines. Currently supported by the airplane model.

hardLandingPitch ​
ts
hardLandingPitch: number;
hardLandingRoll ​
ts
hardLandingRoll: number;
hardLandingSpeed ​
ts
hardLandingSpeed: number;
height ​
ts
height: number;
helicopter? ​
ts
optional helicopter?: HelicopterPhysicsSpec;
label ​
ts
label: string;
length ​
ts
length: number;
mass ​
ts
mass: number;
maxSupportStep ​
ts
maxSupportStep: number;
model ​
ts
model: FlightModel;
pilotEye ​
ts
pilotEye: [number, number, number];
span ​
ts
span: number;
visual ​
ts
visual: AircraftVisualSpec;

AircraftStateData ​

Extends ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

airspeed ​
ts
airspeed: number;
altitudeAGL ​
ts
altitudeAGL: number;
angleOfAttack ​
ts
angleOfAttack: number;
crashed ​
ts
crashed: boolean;
engines? ​
ts
optional engines?: Record<string, AircraftEngineStateData>;

Per-engine state, initialized by the solver and authoritative once present.

grounded ​
ts
grounded: boolean;
pitch ​
ts
pitch: number;
pitchRate ​
ts
pitchRate: number;
roll ​
ts
roll: number;
rollRate ​
ts
rollRate: number;
rotorAngle ​
ts
rotorAngle: number;

First engine's rotor phase; independent visuals bind to engines by id.

rpm ​
ts
rpm: number;

Maximum engine RPM, retained for HUDs and safe boarding/exit checks.

stalled ​
ts
stalled: boolean;
thrustYawRate? ​
ts
optional thrustYawRate?: number;

Additional yaw rate caused by engine thrust moments, rad/s about local +Y.

velocity ​
ts
velocity: [number, number, number];
verticalSpeed ​
ts
verticalSpeed: number;
waitingForTerrain ​
ts
waitingForTerrain: boolean;
yaw ​
ts
yaw: number;

AircraftVisualBinding ​

Extends ​

Extended by ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

axis ​
ts
axis: "x" | "y" | "z";
multiplier ​
ts
multiplier: number;
node ​
ts
node: string;

AircraftVisualSpec ​

Extends ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

ailerons ​
ts
ailerons: AircraftVisualBinding[];
airspeedGaugeMax? ​
ts
optional airspeedGaugeMax?: number;

Legacy metadata; gauge calibration is owned by interior.bindings.

collective? ​
ts
optional collective?: AircraftVisualBinding;
controlStick? ​
ts
optional controlStick?: object;

Legacy explicit control binding. Prefer interior.bindings for new models.

node ​
ts
node: string;
pitchAxis ​
ts
pitchAxis: "x" | "y" | "z";
rollAxis ​
ts
rollAxis: "x" | "y" | "z";
flaps ​
ts
flaps: AircraftVisualBinding[];
gearNodes ​
ts
gearNodes: string[];
interior? ​
ts
optional interior?: VehicleInteriorSpec;
rotors ​
ts
rotors: AircraftRotorBinding[];

AirplanePhysicsSpec ​

Extends ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

brakeDeceleration ​
ts
brakeDeceleration: number;
camberAngle ​
ts
camberAngle: number;
controlAuthoritySpeed ​
ts
controlAuthoritySpeed: number;
coordinatedTurnMinSpeed ​
ts
coordinatedTurnMinSpeed: number;
flapDrag ​
ts
flapDrag: number;
flapLift ​
ts
flapLift: number;
gearDrag ​
ts
gearDrag: number;
groundLevelRate ​
ts
groundLevelRate: number;
groundSteerSpeed ​
ts
groundSteerSpeed: number;
groundTrackRate ​
ts
groundTrackRate: number;
inducedDrag ​
ts
inducedDrag: number;
lateralDamping ​
ts
lateralDamping: number;
liftSlope ​
ts
liftSlope: number;
maxControlAuthority ​
ts
maxControlAuthority: number;
maxGroundPitch ​
ts
maxGroundPitch: number;
maxPitch ​
ts
maxPitch: number;
maxRoll ​
ts
maxRoll: number;
maxThrust ​
ts
maxThrust: number;
minPropellerSpeed ​
ts
minPropellerSpeed: number;
pitchAuthority ​
ts
pitchAuthority: number;
pitchResponse ​
ts
pitchResponse: number;
postStallDecay ​
ts
postStallDecay: number;
postStallFlapEffect ​
ts
postStallFlapEffect: number;
postStallLift ​
ts
postStallLift: number;
profileDrag ​
ts
profileDrag: number;
propellerEfficiency ​
ts
propellerEfficiency: number;
rollAuthority ​
ts
rollAuthority: number;
rollingDeceleration ​
ts
rollingDeceleration: number;
rollResponse ​
ts
rollResponse: number;
rudderAuthority ​
ts
rudderAuthority: number;
stallAngle ​
ts
stallAngle: number;
stallDrag ​
ts
stallDrag: number;

Broadside separated-flow drag coefficient, blended by separation and sin(alpha)^2.

stallPitchRate ​
ts
stallPitchRate: number;
stallSpeed ​
ts
stallSpeed: number;

Legacy tuning reference in m/s; stall detection uses angle of attack.

stallTransitionAngle? ​
ts
optional stallTransitionAngle?: number;

Radians beyond stallAngle over which flow separates smoothly; default 0.12.

thrustYawDamping? ​
ts
optional thrustYawDamping?: number;

Damping of thrust-induced yaw rate in 1/s at reference airspeed; default 1.2.

wingArea ​
ts
wingArea: number;
wingPosition ​
ts
wingPosition: [number, number, number];
yawInertia? ​
ts
optional yawInertia?: number;

Yaw moment of inertia in kg m²; defaults to mass * (span² + length²) / 12.

yawStability? ​
ts
optional yawStability?: number;

Sideslip restoring yaw rate per radian at reference airspeed (1/s); default 1.


AssertionDoc ​

Properties ​

assertions ​
ts
assertions: Assertion[];
format ​
ts
format: "molen/assert@1";

AssetBounds ​

Properties ​

aabb ​
ts
aabb: object;
max ​
ts
max: [number, number, number];
min ​
ts
min: [number, number, number];
sphere ​
ts
sphere: object;
center ​
ts
center: [number, number, number];
radius ​
ts
radius: number;

AssetCollision ​

Properties ​

hulls ​
ts
hulls: AssetHull[];
trimesh? ​
ts
optional trimesh?: AssetTrimeshHeader;

AssetHull ​

Properties ​

node ​
ts
node: string;

Mesh-bearing node the hull was computed from.

points ​
ts
points: number[];

Flat xyz triples, ≤ 64 vertices, rounded to 1e-4.


AssetSidecar ​

Properties ​

animations ​
ts
animations: object[];
channels ​
ts
channels: number;
durationSec ​
ts
durationSec: number;
name ​
ts
name: string;
bounds ​
ts
bounds: AssetBounds;
collision ​
ts
collision: AssetCollision;
extensionsUsed ​
ts
extensionsUsed: string[];
files ​
ts
files: object;
collision? ​
ts
optional collision?: string;
main ​
ts
main: string;
variants ​
ts
variants: Record<string, string>;
format ​
ts
format: "molen/asset@1";
hash ​
ts
hash: string;

sha256 of files.main.

id ​
ts
id: string;
kind ​
ts
kind: "model" | "audio";
materials ​
ts
materials: object[];
alphaMode ​
ts
alphaMode: "OPAQUE" | "MASK" | "BLEND";
doubleSided ​
ts
doubleSided: boolean;
name ​
ts
name: string;
slots ​
ts
slots: ("baseColor" | "roughness" | "metalness" | "normal" | "emissive" | "ao")[];
nodes ​
ts
nodes: object[];

Named mesh-bearing nodes (capped; see nodesTruncated).

name ​
ts
name: string;
triangles ​
ts
triangles: number;
nodesTruncated ​
ts
nodesTruncated: boolean;
sourceHash? ​
ts
optional sourceHash?: string;

sha256 of the pre-import source file.

stats ​
ts
stats: AssetStats;

AssetStats ​

Properties ​

animations ​
ts
animations: number;
materials ​
ts
materials: number;
meshes ​
ts
meshes: number;
primitives ​
ts
primitives: number;
sizeBytes ​
ts
sizeBytes: number;
textures ​
ts
textures: number;
triangles ​
ts
triangles: number;
vertices ​
ts
vertices: number;

AssetTrimeshHeader ​

Properties ​

bin ​
ts
bin: string;

Sidecar-relative filename of the collision binary.

hash ​
ts
hash: string;

sha256 of the binary file.

indices ​
ts
indices: object;

u32le triangle indices.

byteOffset ​
ts
byteOffset: number;
count ​
ts
count: number;
positions ​
ts
positions: object;

f32le xyz triples.

byteOffset ​
ts
byteOffset: number;
count ​
ts
count: number;

Command ​

Properties ​

kind ​
ts
kind: "command";
payload ​
ts
payload: JsonValue;
seq ​
ts
seq: number;

Per-source monotonic sequence number: dedupe + deterministic total order.

source ​
ts
source: string;

Peer/agent identity: "local" in single-player, "agent:..." from tooling.

tick ​
ts
tick: number;

Requested execution tick (client-stamped).

tickExecuted? ​
ts
optional tickExecuted?: number;

Set by the kernel when a late command is re-stamped; replay logs store it.

type ​
ts
type: string;

CommandMessage ​

Properties ​

command ​
ts
command: Command;
type ​
ts
type: "command";

CommandQueueState ​

Accepted future commands and live-source deduplication cursors.

Properties ​

highestSeq ​
ts
highestSeq: Record<string, number>;
latePolicy ​
ts
latePolicy: "rewrite" | "reject";
pending ​
ts
pending: Command[];

ComponentEntry ​

Properties ​

meta ​
ts
meta: ComponentMeta;
name ​
ts
name: string;
zod ​
ts
zod: ZodType;

ComponentMeta ​

Properties ​

description ​
ts
description: string;

One-line human/agent description.

docsRef? ​
ts
optional docsRef?: string;
examples ​
ts
examples: JsonValue[];

At least one valid example of the component's data; feeds hints and docs.

owner? ​
ts
optional owner?: string;

Owning layer, for docs grouping.


ComponentSummary ​

Properties ​

description ​
ts
description: string;
name ​
ts
name: string;
owner? ​
ts
optional owner?: string;

ComponentValidateOptions ​

Extended by ​

Properties ​

allowUnknownComponents? ​
ts
optional allowUnknownComponents?: boolean;

When true, unknown component names are never flagged (not even near-typos).

partial? ​
ts
optional partial?: boolean;

The data is a partial layer (entity overrides, or components stacked on a prefab/type base): keep the unknown-name did-you-mean but skip shape validation — only the RESOLVED component map can be checked for completeness.

registry? ​
ts
optional registry?: ComponentRegistry;

ContentIdentityEntry ​

One content domain a world was built from (e.g. "types", "places").

Properties ​

hash ​
ts
hash: string;

Hash of the domain's content, from the library that loaded it.

packs? ​
ts
optional packs?: string[];

The packs it came from, as "id@version".


ControlMessage ​

Properties ​

control ​
ts
control: ControlAction;
type ​
ts
type: "control";

CustomComponentDecl ​

A declared custom component: docs + examples, optionally a JSON Schema for its data.

Properties ​

description ​
ts
description: string;
examples ​
ts
examples: JsonValue[];
schema? ​
ts
optional schema?: JsonObject;

CustomSkyData ​

Extends ​

Properties ​

lighting? ​
ts
optional lighting?: object;
castShadow? ​
ts
optional castShadow?: boolean;
dayAmbient? ​
ts
optional dayAmbient?: number;
moonIntensity? ​
ts
optional moonIntensity?: number;
nightAmbient? ​
ts
optional nightAmbient?: number;
sunIntensity? ​
ts
optional sunIntensity?: number;
Inherited from ​

SkyAppearance.lighting

mode ​
ts
mode: "custom";
moon? ​
ts
optional moon?: object;
earthshine? ​
ts
optional earthshine?: number;
size? ​
ts
optional size?: number;
visible? ​
ts
optional visible?: boolean;
Inherited from ​

SkyAppearance.moon

moonBody? ​
ts
optional moonBody?: SkyBodyData;
palette? ​
ts
optional palette?: SkyPalette;
Inherited from ​

SkyAppearance.palette

starRotationDeg? ​
ts
optional starRotationDeg?: [number, number, number];
stars? ​
ts
optional stars?: object;
enabled? ​
ts
optional enabled?: boolean;
intensity? ​
ts
optional intensity?: number;
magnitudeLimit? ​
ts
optional magnitudeLimit?: number;
size? ​
ts
optional size?: number;
Inherited from ​

SkyAppearance.stars

sun? ​
ts
optional sun?: object;
size? ​
ts
optional size?: number;
visible? ​
ts
optional visible?: boolean;
Inherited from ​

SkyAppearance.sun

sunBody ​
ts
sunBody: SkyBodyData;

DeclaredComponent ​

The shape of a project/scene-declared custom component (molen/project@1, molen/scene@3).

Properties ​

description ​
ts
description: string;
examples ​
ts
examples: JsonValue[];
schema? ​
ts
optional schema?: JsonObject;

JSON Schema for the data; omitted = any object.


Delta ​

Properties ​

baseTick ​
ts
baseTick: number;
changed ​
ts
changed: Record<EntityId, ComponentMap>;

Whole-component replacement granularity.

destroyed ​
ts
destroyed: string[];
events ​
ts
events: EngineEvent[];
kind ​
ts
kind: "delta";
removedComponents ​
ts
removedComponents: Record<EntityId, string[]>;
spawned ​
ts
spawned: Record<EntityId, ComponentMap>;
tick ​
ts
tick: number;
v ​
ts
v: 1;

DeltaMessage ​

Properties ​

delta ​
ts
delta: Delta;
type ​
ts
type: "delta";

DiagMessage ​

Properties ​

code ​
ts
code: 
  | "tick-overrun"
  | "command-rejected"
  | "protocol-error"
  | "control-rejected"
  | "tick-failed"
  | "link-error"
  | "frame-error";
detail ​
ts
detail: string;
type ​
ts
type: "diag";

EarthObserver ​

Properties ​

elevation? ​
ts
optional elevation?: number;
latitude ​
ts
latitude: number;
longitude ​
ts
longitude: number;
northOffsetDeg? ​
ts
optional northOffsetDeg?: number;

EarthSkyData ​

Extends ​

Properties ​

lighting? ​
ts
optional lighting?: object;
castShadow? ​
ts
optional castShadow?: boolean;
dayAmbient? ​
ts
optional dayAmbient?: number;
moonIntensity? ​
ts
optional moonIntensity?: number;
nightAmbient? ​
ts
optional nightAmbient?: number;
sunIntensity? ​
ts
optional sunIntensity?: number;
Inherited from ​

SkyAppearance.lighting

mode ​
ts
mode: "earth";
moon? ​
ts
optional moon?: object;
earthshine? ​
ts
optional earthshine?: number;
size? ​
ts
optional size?: number;
visible? ​
ts
optional visible?: boolean;
Inherited from ​

SkyAppearance.moon

observer ​
ts
observer: EarthObserver;
palette? ​
ts
optional palette?: SkyPalette;
Inherited from ​

SkyAppearance.palette

stars? ​
ts
optional stars?: object;
enabled? ​
ts
optional enabled?: boolean;
intensity? ​
ts
optional intensity?: number;
magnitudeLimit? ​
ts
optional magnitudeLimit?: number;
size? ​
ts
optional size?: number;
Inherited from ​

SkyAppearance.stars

sun? ​
ts
optional sun?: object;
size? ​
ts
optional size?: number;
visible? ​
ts
optional visible?: boolean;
Inherited from ​

SkyAppearance.sun

time ​
ts
time: SkyTime;

EngineEvent ​

Properties ​

payload ​
ts
payload: JsonValue;
type ​
ts
type: string;

EntityTypeDef ​

Properties ​

assets ​
ts
assets: string[];

Project asset ids this type depends on.

components ​
ts
components: ComponentMap;

Default components applied below prefab/entity data.

doc? ​
ts
optional doc?: string;
extends? ​
ts
optional extends?: string;

Full id of another registry type to inherit from (deep-merged, ancestor-first).

scripts ​
ts
scripts: ScriptRef[];

Deterministic behavior installed once per world for this external entity type.


EventAssertion ​

Properties ​

event ​
ts
event: string;
op ​
ts
op: "occurred" | "never" | "count" | "at_tick";
value? ​
ts
optional value?: number;

GamepadAxisBinding ​

Any raw axis index, including non-standard flight sticks, pedals and throttles.

Properties ​

action ​
ts
action: string;
axis ​
ts
axis: number;
center? ​
ts
optional center?: number;
curve? ​
ts
optional curve?: number;

Response exponent > 0 (default 1).

deadZone? ​
ts
optional deadZone?: number;

Rescaled dead zone in [0, 1). Defaults to 0.12, or 0 for unit axes.

device? ​
ts
optional device?: InputDevice;
invert? ​
ts
optional invert?: boolean;
max? ​
ts
optional max?: number;
min? ​
ts
optional min?: number;

Raw endpoints and center (defaults -1, 0, 1); min < center < max.

mode? ​
ts
optional mode?: "signed" | "positive" | "negative" | "unit";

signed: -1..1; positive/negative: one half of a stick; unit: full travel mapped to 0..1.


GamepadButtonBinding ​

Properties ​

action ​
ts
action: string;
button ​
ts
button: number;
device? ​
ts
optional device?: InputDevice;
threshold? ​
ts
optional threshold?: number;

Press threshold for analog buttons (default 0.5).


HelicopterPhysicsSpec ​

Extends ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

cyclicDamping ​
ts
cyclicDamping: number;
cyclicResponse ​
ts
cyclicResponse: number;
cyclicTilt ​
ts
cyclicTilt: number;
groundDeceleration ​
ts
groundDeceleration: number;
groundEffect ​
ts
groundEffect: number;
groundLevelRate ​
ts
groundLevelRate: number;
horizontalDrag ​
ts
horizontalDrag: number;
liftMultiplier ​
ts
liftMultiplier: number;
maxTilt ​
ts
maxTilt: number;
quadraticDrag ​
ts
quadraticDrag: number;
rotorPosition ​
ts
rotorPosition: [number, number, number];
rotorRadius ​
ts
rotorRadius: number;
translationalLift ​
ts
translationalLift: number;
translationalLiftSpeed ​
ts
translationalLiftSpeed: number;
verticalDrag ​
ts
verticalDrag: number;
yawRate ​
ts
yawRate: number;

InputDevice ​

Browser controller selector. Omit to accept any detected device; combine to disambiguate twins.

Properties ​

id? ​
ts
optional id?: string;
index? ​
ts
optional index?: number;

InputProfile ​

Serializable, complete set of physical bindings for one use case.

Extended by ​

Properties ​

axes? ​
ts
optional axes?: GamepadAxisBinding[];
bindings ​
ts
bindings: Record<string, string>;

KeyboardEvent.code or Mouse<button> -> named action.

buttons? ​
ts
optional buttons?: GamepadButtonBinding[];

JsonObject ​

Extended by ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Keyframe ​

Properties ​

commands? ​
ts
optional commands?: CommandQueueState;

Absent in older saves, which restore with an empty queue.

engine ​
ts
engine: string;
entities ​
ts
entities: Record<EntityId, ComponentMap>;
entityOrder? ​
ts
optional entityOrder?: string[];

Explicit creation order (including integer-like ids); absent in older saves.

kind ​
ts
kind: "keyframe";
nextEntitySeq ​
ts
nextEntitySeq: number;
plugins ​
ts
plugins: Record<string, JsonValue>;

Opaque per-plugin snapshot blobs (e.g. Rapier).

rng ​
ts
rng: RngState;
seed ​
ts
seed: string | number;
tick ​
ts
tick: number;
tickRate ​
ts
tickRate: number;
v ​
ts
v: 1;

KeyframeMessage ​

A full snapshot plus the events of the tick it was taken on (a keyframe replaces that tick's delta, so its events ride along; deltas carry theirs in delta.events). One ordering rule for the client: apply the state, then dispatch the message's events at its tick.

Properties ​

events ​
ts
events: EngineEvent[];
keyframe ​
ts
keyframe: Keyframe;
type ​
ts
type: "keyframe";

LegacySchemaVersion ​

Properties ​

examples ​
ts
examples: JsonValue[];

At least one valid legacy example (feeds cross-validation tests and migrate docs).

id ​
ts
id: string;

The legacy format envelope id, e.g. "molen/scene@1".

upgrade ​
ts
upgrade: (legacyParsed) => unknown;

Pure upgrade from this version's parsed shape to the CURRENT version's shape.

Parameters ​
legacyParsed ​

unknown

Returns ​

unknown

zod ​
ts
zod: ZodType;

Properties ​

onmessage? ​
ts
optional onmessage?: MessageEventLike | null;

Methods ​

addEventListener()? ​
ts
optional addEventListener(type, listener): void;
Parameters ​
type ​

"message"

listener ​

MessageEventLike

Returns ​

void

postMessage() ​
ts
postMessage(message): void;
Parameters ​
message ​

unknown

Returns ​

void

removeEventListener()? ​
ts
optional removeEventListener(type, listener): void;
Parameters ​
type ​

"message"

listener ​

MessageEventLike

Returns ​

void


ModelSignalBinding ​

Numeric simulation state mapped to an existing model's local transform channels.

Extends ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

axis ​
ts
axis: "x" | "y" | "z";
max? ​
ts
optional max?: number;
min? ​
ts
optional min?: number;
node ​
ts
node: string;
offset? ​
ts
optional offset?: number;
property ​
ts
property: "rotation" | "position";
scale ​
ts
scale: number;
source ​
ts
source: string;

ModelSignalSource ​

Extends ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

component ​
ts
component: string;
path ​
ts
path: (string | number)[];

Explicit segments; component and property names may contain dots.


ModelSignalSpec ​

Extends ​

Extended by ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

bindings ​
ts
bindings: ModelSignalBinding[];
sources? ​
ts
optional sources?: Record<string, ModelSignalSource>;

Same-entity component reads. Scripts can publish custom components here.


NamespaceReservation ​

Properties ​

namespace ​
ts
namespace: string;
note? ​
ts
optional note?: string;
owner ​
ts
owner: string;

PackBlock ​

Properties ​

entry ​
ts
entry: string;

Zip member holding the block.

size ​
ts
size: number;

Uncompressed block size in bytes.


PackEntry ​

Properties ​

block? ​
ts
optional block?: string;

Solid block holding this file; absent when the file is its own zip member.

mediaType ​
ts
mediaType: string;
offset? ​
ts
optional offset?: number;

Byte offset inside the block (required with block).

sha256 ​
ts
sha256: string;
size ​
ts
size: number;

Uncompressed size in bytes.

variants? ​
ts
optional variants?: Record<string, string>;

Alternative encodings of the same content, e.g. { "ktx2": "<path>" }.


PackIndex ​

A directory listing of built packs, for hosts that publish several.

Properties ​

format ​
ts
format: "molen/pack-index@1";
packs ​
ts
packs: Record<string, PackIndexEntry>;

PackIndexEntry ​

Properties ​

contentHash ​
ts
contentHash: string;
file ​
ts
file: string;

Pack file, relative to the index.

size ​
ts
size: number;

File size in bytes.

version ​
ts
version: string;

PackManifest ​

The manifest inside a built pack.

Properties ​

blocks ​
ts
blocks: Record<string, PackBlock>;
contentHash ​
ts
contentHash: string;

sha256 over every logical file (path and content), independent of the zip layout.

entries ​
ts
entries: Record<string, PackEntry>;
format ​
ts
format: "molen/pack@1";
id ​
ts
id: string;
ids ​
ts
ids: Record<string, string>;

Asset id to the entry path of its runtime file.

license? ​
ts
optional license?: string;

SPDX expression for the pack's content.

notice? ​
ts
optional notice?: string;

Path of the entry that carries the pack's attribution notice.

provides ​
ts
provides: Record<string, string[]>;

Role (e.g. types, stylepack, stars) to the entry paths that provide it.

title? ​
ts
optional title?: string;
version ​
ts
version: string;

PackSourceConfig ​

Build configuration read from molen-pack.source.json in a pack's source directory.

Properties ​

exclude ​
ts
exclude: string[];
format ​
ts
format: "molen/pack-source@1";
id ​
ts
id: string;
ids ​
ts
ids: Record<string, string>;
include ​
ts
include: string[];

Globs (*, **, ?) of files to include, relative to the source directory.

license? ​
ts
optional license?: string;
notice? ​
ts
optional notice?: string;
provides ​
ts
provides: Record<string, string | string[]>;
solid ​
ts
solid: boolean;

Group small text files into compressed solid blocks (default true).

title? ​
ts
optional title?: string;
version ​
ts
version: string;

Prefab ​

Properties ​

components ​
ts
components: ComponentMap;
extends? ​
ts
optional extends?: string;

Name of a prefab in the same manifest to inherit components from (deep-merged).

format? ​
ts
optional format?: "molen/prefab@1";
type? ​
ts
optional type?: string;

Project-registry type this prefab specializes (its defaults merge in below extends).


ProjectManifest ​

Properties ​

assets ​
ts
assets: Record<string, string>;

Asset id -> project-relative path to its molen asset sidecar.

codegen ​
ts
codegen: object;
out ​
ts
out: string;
components ​
ts
components: Record<string, CustomComponentDecl>;

Custom component vocabulary shared by every scene in the project.

defaultScene? ​
ts
optional defaultScene?: string;
engine? ​
ts
optional engine?: string;

Engine version this project targets (informational).

format ​
ts
format: "molen/project@1";
name ​
ts
name: string;
packs ​
ts
packs: ProjectPackRef[];

Content packs to load, in order; a later pack wins on duplicate ids.

reservations ​
ts
reservations: NamespaceReservation[];

Namespace ownership for type + asset ids (multi-agent vocabulary partitioning).

scenes ​
ts
scenes: Record<string, string>;

Scene name -> project-relative scene file path.

setup? ​
ts
optional setup?: string;

Default setup/Experience module for sim/shot (project-relative).

types ​
ts
types: string[];

Project-relative paths to molen/types@1 documents.


ProjectPackRef ​

A content pack a project loads (see molen/pack@1).

Properties ​

contentHash? ​
ts
optional contentHash?: string;

Expected pack contentHash; loading fails when the pack's differs.

id ​
ts
id: string;
source ​
ts
source: string;

Project-relative pack file or source directory, or an http(s) URL.


ReadyMessage ​

Properties ​

tick ​
ts
tick: number;
tickRate ​
ts
tickRate: number;
type ​
ts
type: "ready";

RegisterComponentOptions ​

Properties ​

override? ​
ts
optional override?: boolean;

Replace an existing registration instead of throwing on a duplicate name.


RenderableKindMeta ​

Properties ​

description ​
ts
description: string;

What the kind renders (e.g. "an imported project asset"); shown in the kind field docs.

fields? ​
ts
optional fields?: Record<string, ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>>;

Extra renderable fields this kind reads, e.g. figures' lod. renderable is strict, so a capability that reads a field nobody declared would have its own documents rejected as typos. Declare it here and it joins the schema, the emitted JSON Schema and the docs. Each field is made optional (one flat renderable shape serves every kind) and may not shadow a core field.

owner? ​
ts
optional owner?: string;

Owning layer (the capability's client half), for docs grouping.


ReplayFixture ​

Properties ​

commands ​
ts
commands: Command[];
content? ​
ts
optional content?: ContentIdentity;

The content the replay was recorded with; replaying against different content fails.

engine ​
ts
engine: string;
expected? ​
ts
optional expected?: object;
eventCount? ​
ts
optional eventCount?: number;
stateHash ​
ts
stateHash: string;
tickHashes? ​
ts
optional tickHashes?: string[];
format ​
ts
format: "molen/replay@1";
initialKeyframe? ​
ts
optional initialKeyframe?: Keyframe;
scene? ​
ts
optional scene?: string;
seed? ​
ts
optional seed?: string | number;
ticks ​
ts
ticks: number;

ResolvedEntityType ​

Properties ​

components ​
ts
components: ComponentMap;
scripts ​
ts
scripts: ScriptRef[];

Ancestor-first behavior scripts, already source-inlined by the host loader.


RngState ​

Properties ​

algo ​
ts
algo: "sfc32";
state ​
ts
state: [number, number, number, number];

SceneAmbient ​

Ambient life (NPC traffic) settings; consumed by @bendyline/molen-ambient.

Properties ​

classes? ​
ts
optional classes?: SceneAmbientKind[];

Which NPC classes run (default ['car']).

density? ​
ts
optional density?: Partial<Record<SceneAmbientKind, number>>;

Target agents per kilometre of lane near the observer, per class.

despawnRadius? ​
ts
optional despawnRadius?: number;

Distance in metres beyond which cars are removed.

drivingSide? ​
ts
optional drivingSide?: "right" | "left";
network? ​
ts
optional network?: string | JsonObject;

Scene-relative path to a molen/transport-network@1 document, or the document inline.

observer? ​
ts
optional observer?: string;

Entity whose position drives the spawn ring.

radius? ​
ts
optional radius?: number;

Outer spawn radius in metres for cars.

seedSalt? ​
ts
optional seedSalt?: string;
templates? ​
ts
optional templates?: Partial<Record<SceneAmbientKind, string>>;

Prefab name per class whose components every spawned agent receives.


SceneCommandDef ​

A command type the scene accepts; scripts attach handlers with molen.onCommand.

Properties ​

doc? ​
ts
optional doc?: string;
payload? ​
ts
optional payload?: JsonObject;

JSON Schema for the payload (see schema/src/commands.ts for the subset); omitted = any.


SceneEntity ​

Properties ​

components? ​
ts
optional components?: ComponentMap;

Components layered over the type/prefab base (a partial when a base is present).

id? ​
ts
optional id?: string;

Authored id; must not match /^e\d+$/, be all digits, or start with "$" (reserved).

prefab? ​
ts
optional prefab?: string;
type? ​
ts
optional type?: string;

Project-registry type to instantiate (lowest layer of the component stack).


SceneInput ​

Serializable, complete set of physical bindings for one use case.

Extends ​

Properties ​

axes? ​
ts
optional axes?: GamepadAxisBinding[];
Inherited from ​

InputProfile.axes

bindings ​
ts
bindings: Record<string, string>;

Device code (KeyW, Mouse0, …) -> action name; the client InputMap's exact shape.

Overrides ​

InputProfile.bindings

buttons? ​
ts
optional buttons?: GamepadButtonBinding[];
Inherited from ​

InputProfile.buttons

emit ​
ts
emit: InputEmitRule[];

Declarative action -> command emission rules the client runs; the kernel adjudicates.

profile? ​
ts
optional profile?: string;

Initial profile name; hosts switch at runtime with InputMap.setProfile().

profiles? ​
ts
optional profiles?: Record<string, InputProfile>;

Named complete binding sets. The root bindings are used when profile is absent.


SceneManifest ​

Properties ​

ambient? ​
ts
optional ambient?: SceneAmbient;
camera? ​
ts
optional camera?: SceneCamera;
commands ​
ts
commands: Record<string, SceneCommandDef>;

Command types this scene accepts, with optional payload schemas.

components ​
ts
components: Record<string, CustomComponentDecl>;

Custom component vocabulary this scene introduces.

entities ​
ts
entities: SceneEntity[];
format ​
ts
format: "molen/scene@3";
input? ​
ts
optional input?: SceneInput;
keyframeInterval ​
ts
keyframeInterval: number;
lateCommands ​
ts
lateCommands: "rewrite" | "reject";
name ​
ts
name: string;
physics? ​
ts
optional physics?: ScenePhysics;
prefabs ​
ts
prefabs: Record<string, Prefab>;
scripts ​
ts
scripts: ScriptRef[];
seed ​
ts
seed: string | number;
terrain? ​
ts
optional terrain?: SceneTerrainRef;
tickRate ​
ts
tickRate: number;

Fixed timestep rate in Hz; immutable for the world's lifetime.


ScenePhysics ​

Properties ​

character? ​
ts
optional character?: boolean;

Install the kernel character controller (character + moveIntent). Not with rapier.

engine ​
ts
engine: "none" | "kinematics" | "platformer" | "rapier";

kinematics and platformer are cross-platform deterministic; rapier is same-platform.

gravity? ​
ts
optional gravity?: Vec3;
ground? ​
ts
optional ground?: "flat" | "terrain";

Ground for kinematic bodies: flat y=0 (default) or the scene's terrain heightfield.


SceneResolveOptions ​

Properties ​

types? ​
ts
optional types?: ResolvedTypes;

Flattened registry types; required when the scene references type ids.


SceneTerrainRef ​

Properties ​

descriptor ​
ts
descriptor: string;

Scene-file-relative path to a molen/terrain@2 descriptor (v1 auto-upgrades).

heightmap? ​
ts
optional heightmap?: string;

Scene-file-relative path to a 16-bit grayscale heightmap PNG.


SchemaEntry ​

Properties ​

kind ​
ts
kind: string;
legacy ​
ts
legacy: LegacySchemaVersion[];

Older accepted versions, newest first; validate() auto-upgrades them with a notice.

meta ​
ts
meta: SchemaMeta;
zod ​
ts
zod: ZodType;

SchemaKindMap ​

Properties ​

assert ​
ts
assert: AssertionDoc;
asset ​
ts
asset: AssetSidecar;
command ​
ts
command: Command;
delta ​
ts
delta: Delta;
keyframe ​
ts
keyframe: Keyframe;
pack ​
ts
pack: PackManifest;
pack-index ​
ts
pack-index: PackIndex;
pack-source ​
ts
pack-source: PackSourceConfig;
prefab ​
ts
prefab: Prefab;
project ​
ts
project: ProjectManifest;
replay ​
ts
replay: ReplayFixture;
scene ​
ts
scene: SceneManifest;
soundbank ​
ts
soundbank: SoundbankDoc;
source-bundle ​
ts
source-bundle: SourceBundle;
types ​
ts
types: TypesDoc;

SchemaMeta ​

Properties ​

description ​
ts
description: string;
docsRef? ​
ts
optional docsRef?: string;
examples ​
ts
examples: JsonValue[];

At least one valid example document; feeds error hints, docs, and tests.

id ​
ts
id: string;

Format envelope id, e.g. "molen/scene@1".

title ​
ts
title: string;
validate? ​
ts
optional validate?: (data) => ValidationIssue[];

Optional post-parse, cross-field validation that Zod (and thus the emitted JSON Schema) can't express — e.g. material-graph cycles, dangling node refs, pixel-grid row lengths. Receives the parsed (defaults-applied) value; returns pinpoint issues (empty = valid). Runs only on Zod-valid documents, so it never double-reports structural errors.

Parameters ​
data ​

unknown

Returns ​

ValidationIssue[]


SchemaSummary ​

Properties ​

description ​
ts
description: string;
id ​
ts
id: string;
kind ​
ts
kind: string;
title ​
ts
title: string;

ScriptRef ​

Properties ​

checkpoint? ​
ts
optional checkpoint?: "state";

All durable state is in molen.state/components/plugins, never mutable closures.

code? ​
ts
optional code?: string;

Inline JavaScript text (exactly one of code | path).

config ​
ts
config: JsonObject;
id ​
ts
id: string;
path? ​
ts
optional path?: string;

Scene-file-relative path to a JS text file; tooling resolves it into code pre-build.


SelectAssertion ​

Properties ​

op ​
ts
op: SelectOp;
select ​
ts
select: string;

Selector DSL: "#id", "tag:x", "has:comp", value paths like ".health.hp".

tol? ​
ts
optional tol?: number;
value? ​
ts
optional value?: JsonValue;

SkyAppearance ​

Extended by ​

Properties ​

lighting? ​
ts
optional lighting?: object;
castShadow? ​
ts
optional castShadow?: boolean;
dayAmbient? ​
ts
optional dayAmbient?: number;
moonIntensity? ​
ts
optional moonIntensity?: number;
nightAmbient? ​
ts
optional nightAmbient?: number;
sunIntensity? ​
ts
optional sunIntensity?: number;
moon? ​
ts
optional moon?: object;
earthshine? ​
ts
optional earthshine?: number;
size? ​
ts
optional size?: number;
visible? ​
ts
optional visible?: boolean;
palette? ​
ts
optional palette?: SkyPalette;
stars? ​
ts
optional stars?: object;
enabled? ​
ts
optional enabled?: boolean;
intensity? ​
ts
optional intensity?: number;
magnitudeLimit? ​
ts
optional magnitudeLimit?: number;
size? ​
ts
optional size?: number;
sun? ​
ts
optional sun?: object;
size? ​
ts
optional size?: number;
visible? ​
ts
optional visible?: boolean;

SkyBodyData ​

Properties ​

angularDiameterDeg? ​
ts
optional angularDiameterDeg?: number;
direction ​
ts
direction: [number, number, number];

SkyPalette ​

Properties ​

dayHorizon? ​
ts
optional dayHorizon?: string;
dayZenith? ​
ts
optional dayZenith?: string;
ground? ​
ts
optional ground?: string;
moon? ​
ts
optional moon?: string;
nightHorizon? ​
ts
optional nightHorizon?: string;
nightZenith? ​
ts
optional nightZenith?: string;
sun? ​
ts
optional sun?: string;
twilight? ​
ts
optional twilight?: string;

SkyTime ​

Properties ​

epochMs ​
ts
epochMs: number;

UTC Unix milliseconds at simulation second zero.

scale? ​
ts
optional scale?: number;

Sky seconds per simulation second, default 1.


SourceBundle ​

Portable authoring-time contents for one logical thing. Runtime outputs live elsewhere.

Properties ​

files ​
ts
files: object;
definitions ​
ts
definitions: string[];
documents ​
ts
documents: string[];
generators ​
ts
generators: SourceBundleNamedFile[];
models ​
ts
models: SourceBundleModel[];
scripts ​
ts
scripts: SourceBundleNamedFile[];
sounds ​
ts
sounds: SourceBundleNamedFile[];
textures ​
ts
textures: SourceBundleNamedFile[];
format ​
ts
format: "molen/source-bundle@1";
id ​
ts
id: string;
kind ​
ts
kind: string;
order? ​
ts
optional order?: number;
title ​
ts
title: string;

SourceBundleModel ​

Properties ​

assetId? ​
ts
optional assetId?: string;
output? ​
ts
optional output?: string;
path ​
ts
path: string;
pipeline? ​
ts
optional pipeline?: "copy" | "import";
sha256? ​
ts
optional sha256?: string;

SourceBundleNamedFile ​

Properties ​

id ​
ts
id: string;
path ​
ts
path: string;

TypeIndex ​

Properties ​

index ​
ts
index: Map<string, TypeIndexEntry>;
issues ​
ts
issues: ValidationIssue[];

TypeIndexEntry ​

Properties ​

def ​
ts
def: EntityTypeDef;
id ​
ts
id: string;
source? ​
ts
optional source?: string;

Which types document declared it (for error messages).


TypesDoc ​

Properties ​

doc? ​
ts
optional doc?: string;
format ​
ts
format: "molen/types@1";
namespace ​
ts
namespace: string;

Dotted namespace every type id in this file must live under.

owner? ​
ts
optional owner?: string;

Matched against project reservations by molen types check.

types ​
ts
types: Record<string, EntityTypeDef>;

ValidateOptions ​

Extends ​

Properties ​

allowUnknownComponents? ​
ts
optional allowUnknownComponents?: boolean;

When true, unknown component names are never flagged (not even near-typos).

Inherited from ​

ComponentValidateOptions.allowUnknownComponents

label? ​
ts
optional label?: string;

Label used in the formatted error header, e.g. 'scene "arena"'.

partial? ​
ts
optional partial?: boolean;

The data is a partial layer (entity overrides, or components stacked on a prefab/type base): keep the unknown-name did-you-mean but skip shape validation — only the RESOLVED component map can be checked for completeness.

Inherited from ​

ComponentValidateOptions.partial

registry? ​
ts
optional registry?: ComponentRegistry;
Inherited from ​

ComponentValidateOptions.registry

types? ​
ts
optional types?: ResolvedTypes;

Supply project types to validate final scene entity and prefab merges.


ValidationFailure ​

Properties ​

formatted ​
ts
formatted: string;
issues ​
ts
issues: ValidationIssue[];
ok ​
ts
ok: false;

ValidationIssue ​

Properties ​

code ​
ts
code: string;

Stable machine code, e.g. "invalid_type", "unrecognized_keys".

docsRef? ​
ts
optional docsRef?: string;
expected? ​
ts
optional expected?: string;

What valid looks like.

hint? ​
ts
optional hint?: string;

Did-you-mean, example value, or fix suggestion.

message ​
ts
message: string;

What is wrong.

path ​
ts
path: string;

JSON Pointer to the offending location, e.g. "/components/transform/pos".

received? ​
ts
optional received?: string;

What was found (truncated repr).

severity? ​
ts
optional severity?: "error" | "notice";

Absent = error (blocks). notice = advisory only; the document is still accepted.


ValidationSuccess ​

Type Parameters ​

T ​

T

Properties ​

notices? ​
ts
optional notices?: ValidationIssue[];

Non-fatal advisories (e.g. code "deprecated_format" after a legacy auto-upgrade).

ok ​
ts
ok: true;
value ​
ts
value: T;

VehicleData ​

Complete external configuration consumed by the generic vehicle solver and client.

Extends ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

color ​
ts
color: string;
kind ​
ts
kind: string;
spec ​
ts
spec: VehicleSpec;
visual ​
ts
visual: VehicleVisualSpec;

VehicleInteriorSpec ​

Cabin geometry in the main GLB, shared by every camera view.

Extends ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

bindings ​
ts
bindings: ModelSignalBinding[];
Inherited from ​

ModelSignalSpec.bindings

nodes ​
ts
nodes: string[];

Informational: never hidden on boarding or in chase view.

sources? ​
ts
optional sources?: Record<string, ModelSignalSource>;

Same-entity component reads. Scripts can publish custom components here.

Inherited from ​

ModelSignalSpec.sources


VehiclePlacement ​

Serializable spawn record, independent of terrain tile identity and render resources.

Properties ​

color ​
ts
color: string;
id ​
ts
id: string;
kind ​
ts
kind: string;

External entity/type id, for example molen.entities.vehicle.sedan.

pitch? ​
ts
optional pitch?: number;
position ​
ts
position: [number, number, number];
roll? ​
ts
optional roll?: number;
spec ​
ts
spec: VehicleSpec;

Resolved external physics/dimension data used by terrain-owned low-detail rendering.

yaw ​
ts
yaw: number;

VehicleSpec ​

Data-driven tuning consumed by the generic wheeled-vehicle solver.

Extends ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

aerodynamicResistance ​
ts
aerodynamicResistance: number;
brakeDeceleration ​
ts
brakeDeceleration: number;
centerOfMass ​
ts
centerOfMass: [number, number, number];
driverEye ​
ts
driverEye: [number, number, number];
engineForce ​
ts
engineForce: number;
grip ​
ts
grip: number;
height ​
ts
height: number;
label ​
ts
label: string;
length ​
ts
length: number;
mass ​
ts
mass: number;
maxSlope ​
ts
maxSlope: number;
maxSpeed ​
ts
maxSpeed: number;
maxSteer ​
ts
maxSteer: number;
maxStepHeight ​
ts
maxStepHeight: number;
reverseSpeed ​
ts
reverseSpeed: number;
rollingResistance ​
ts
rollingResistance: number;
steeringFadeSpeed ​
ts
steeringFadeSpeed: number;
steeringRate ​
ts
steeringRate: number;
supportTolerance ​
ts
supportTolerance: number;
terrainAlignRate ​
ts
terrainAlignRate: number;
wheelbase ​
ts
wheelbase: number;
wheelRadius ​
ts
wheelRadius: number;
wheelTrack ​
ts
wheelTrack: number;
width ​
ts
width: number;

VehicleVisualSpec ​

Named-node bindings for a GLB-backed wheeled vehicle.

Extends ​

Indexable ​

ts
[key: string]: JsonValue | undefined

Properties ​

frontWheelNodes ​
ts
frontWheelNodes: string[];
interior? ​
ts
optional interior?: VehicleInteriorSpec;
paintMaterial ​
ts
paintMaterial: string;
steeringWheelNode? ​
ts
optional steeringWheelNode?: string;

Legacy explicit steering binding. Prefer interior.bindings for new models.

wheelNodes ​
ts
wheelNodes: string[];

Type Aliases ​

AircraftKind ​

ts
type AircraftKind = string;

Stable external entity/type id for an aircraft.


Assertion ​

ts
type Assertion = 
  | SelectAssertion
  | EventAssertion;

AudioAmbienceLayer ​

ts
type AudioAmbienceLayer = object;

Properties ​

fadeS? ​
ts
optional fadeS?: number;
gain? ​
ts
optional gain?: number;
gainFrom? ​
ts
optional gainFrom?: AudioSignalDrive;
pitchFrom? ​
ts
optional pitchFrom?: AudioSignalDrive;
sound ​
ts
sound: string;
when? ​
ts
optional when?: AudioWhen;

AudioCondition ​

ts
type AudioCondition = 
  | AudioScalar
  | AudioScalar[]
  | {
  max?: number;
  min?: number;
}
  | {
  exists: boolean;
};

AudioEnvironmentData ​

ts
type AudioEnvironmentData = object;

Properties ​

ambience? ​
ts
optional ambience?: AudioAmbienceLayer[];
buses? ​
ts
optional buses?: Record<string, number>;
events? ​
ts
optional events?: Record<string, AudioEventRule>;
footsteps? ​
ts
optional footsteps?: AudioFootsteps;
listenerEntity? ​
ts
optional listenerEntity?: string;
maxVoices? ​
ts
optional maxVoices?: number;
music? ​
ts
optional music?: AudioMusicSpec;

AudioEventRule ​

ts
type AudioEventRule = object;

Properties ​

at? ​
ts
optional at?: string;
bus? ​
ts
optional bus?: string;
gain? ​
ts
optional gain?: number;
pitch? ​
ts
optional pitch?: number;
sound ​
ts
sound: string;

AudioFootsteps ​

ts
type AudioFootsteps = object;

Properties ​

gain? ​
ts
optional gain?: number;
sound ​
ts
sound: string;
strideM? ​
ts
optional strideM?: number;
surfaces? ​
ts
optional surfaces?: Record<string, string>;
when? ​
ts
optional when?: AudioWhen;

AudioMusicSpec ​

ts
type AudioMusicSpec = object;

Properties ​

crossfadeS? ​
ts
optional crossfadeS?: number;
gain? ​
ts
optional gain?: number;
mode? ​
ts
optional mode?: "sequence" | "shuffle";
playlist ​
ts
playlist: string[];
when? ​
ts
optional when?: AudioWhen;

AudioScalar ​

ts
type AudioScalar = string | number | boolean;

AudioSignalBinding ​

ts
type AudioSignalBinding = object;

Properties ​

curve ​
ts
curve: [number, number][];
signal ​
ts
signal: string;
smoothS? ​
ts
optional smoothS?: number;

AudioSignalDrive ​

ts
type AudioSignalDrive = 
  | AudioSignalBinding
  | AudioSignalBinding[];

One signal binding, or several whose outputs multiply (fade with height AND distance).


AudioSourceData ​

ts
type AudioSourceData = object;

Properties ​

autoplay? ​
ts
optional autoplay?: boolean;
bus? ​
ts
optional bus?: string;
gain? ​
ts
optional gain?: number;
gainFrom? ​
ts
optional gainFrom?: AudioSignalDrive;
loop? ​
ts
optional loop?: boolean;
pitch? ​
ts
optional pitch?: number;
pitchFrom? ​
ts
optional pitchFrom?: AudioSignalDrive;
sound ​
ts
sound: string;
spatial? ​
ts
optional spatial?: SoundSpatial | false;
startTick? ​
ts
optional startTick?: number;
triggerFrom? ​
ts
optional triggerFrom?: AudioTrigger;
when? ​
ts
optional when?: AudioWhen;

AudioTrigger ​

ts
type AudioTrigger = object;

Properties ​

every? ​
ts
optional every?: number;
onChange? ​
ts
optional onChange?: boolean;
signal ​
ts
signal: string;
sound? ​
ts
optional sound?: string;

AudioWhen ​

ts
type AudioWhen = Record<string, AudioCondition>;

AudioZoneData ​

ts
type AudioZoneData = object;

Properties ​

bus? ​
ts
optional bus?: string;
fade? ​
ts
optional fade?: number;
gain? ​
ts
optional gain?: number;
shape ​
ts
shape: 
  | {
  kind: "sphere";
  radius: number;
}
  | {
  halfExtents: [number, number, number];
  kind: "box";
};
sound ​
ts
sound: string;
when? ​
ts
optional when?: AudioWhen;

ComponentMap ​

ts
type ComponentMap = Record<string, JsonObject>;

Component name -> pure-JSON component data.


ComponentRegistry ​

ts
type ComponentRegistry = ReadonlyMap<string, ComponentEntry>;

ContentIdentity ​

ts
type ContentIdentity = Record<string, ContentIdentityEntry>;

Which content a world was built from, by domain. Recorded next to the state hash (never in it), so a keyframe or replay can refuse to run against different content with a named error.


ControlAction ​

ts
type ControlAction = 
  | {
  action: "pause";
}
  | {
  action: "resume";
}
  | {
  action: "step";
  ticks?: number;
}
  | {
  action: "request-keyframe";
}
  | {
  action: "set-rate";
  hz: number;
};

EntityId ​

ts
type EntityId = string;

Runtime ids are "e" + sequence; authored ids are any other non-empty string.


FlightModel ​

ts
type FlightModel = "airplane" | "helicopter";

InputEmitRule ​

ts
type InputEmitRule = 
  | {
  action: string;
  command: string;
  kind: "press";
  payload: JsonObject;
}
  | {
  action: string;
  command: string;
  kind: "release";
  payload: JsonObject;
}
  | {
  action: string;
  command: string;
  field: string;
  kind: "axis";
  negative?: string;
}
  | {
  command: string;
  field: string;
  kind: "axis2d";
  xNeg: string;
  xPos: string;
  yNeg: string;
  yPos: string;
};

JsonPrimitive ​

ts
type JsonPrimitive = string | number | boolean | null;

JsonValue ​

ts
type JsonValue = 
  | JsonPrimitive
  | JsonValue[]
  | JsonObject;

KernelInbound ​

ts
type KernelInbound = CommandMessage | ControlMessage;

Messages the client sends to the kernel.


KernelOutbound ​

ts
type KernelOutbound = 
  | ReadyMessage
  | KeyframeMessage
  | DeltaMessage
  | DiagMessage;

Messages the kernel sends to the client.


PayloadCheck ​

ts
type PayloadCheck = 
  | {
  ok: true;
}
  | {
  message: string;
  ok: false;
};

Result of a payload validator: ok, or a formatted, agent-facing reason.


Quat ​

ts
type Quat = [number, number, number, number];

ResolvedTypes ​

ts
type ResolvedTypes = ReadonlyMap<string, ResolvedEntityType>;

Pre-flattened project type registry.


ResolvedWeather ​

ts
type ResolvedWeather = object;

Properties ​

atmosphere ​
ts
atmosphere: Required<NonNullable<WeatherData["atmosphere"]>>;
clouds ​
ts
clouds: Required<NonNullable<WeatherData["clouds"]>>;
precipitation ​
ts
precipitation: Required<NonNullable<WeatherData["precipitation"]>>;
seed ​
ts
seed: number;
visibility ​
ts
visibility: number;

SceneAmbientKind ​

ts
type SceneAmbientKind = "car" | "pedestrian" | "train" | "aircraft";

An NPC class the ambient-life capability simulates.


SceneCamera ​

ts
type SceneCamera = 
  | {
  entity: EntityId;
  fov?: number;
  lookOffset: Vec3;
  mode: "follow";
  offset: Vec3;
  space?: "world" | "local";
}
  | {
  fov?: number;
  lookAt?: Vec3;
  mode: "fixed";
  position: Vec3;
}
  | {
  boost: number;
  fov?: number;
  lookAt?: Vec3;
  mode: "free-fly";
  moveSpeed: number;
  position: Vec3;
}
  | {
  cameraHeight?: number;
  center: [number, number];
  mode: "top-down-ortho";
  viewHeight: number;
};

SchemaKind ​

ts
type SchemaKind = keyof SchemaKindMap;

SelectOp ​

ts
type SelectOp = 
  | "eq"
  | "approx"
  | "gt"
  | "gte"
  | "lt"
  | "lte"
  | "count"
  | "exists"
  | "all_eq"
  | "all_approx"
  | "all_gt"
  | "all_gte"
  | "all_lt"
  | "all_lte"
  | "any_eq"
  | "any_approx"
  | "any_gt"
  | "any_gte"
  | "any_lt"
  | "any_lte";

SkyData ​

ts
type SkyData = EarthSkyData | CustomSkyData;

SoundbankDoc ​

ts
type SoundbankDoc = object;

Properties ​

format ​
ts
format: "molen/soundbank@1";
id ​
ts
id: string;
license? ​
ts
optional license?: string;
sounds ​
ts
sounds: Record<string, SoundEntry>;
title? ​
ts
optional title?: string;

SoundEntry ​

ts
type SoundEntry = object;

Properties ​

bus? ​
ts
optional bus?: string;
clips ​
ts
clips: string[];
description? ​
ts
optional description?: string;
durationS? ​
ts
optional durationS?: number;
gain? ​
ts
optional gain?: number;
hash? ​
ts
optional hash?: string;
loop? ​
ts
optional loop?: boolean;
loopEnd? ​
ts
optional loopEnd?: number;
loopStart? ​
ts
optional loopStart?: number;
pitch? ​
ts
optional pitch?: [number, number];
source ​
ts
source: SoundSource;
spatial? ​
ts
optional spatial?: SoundSpatial | false;
tags? ​
ts
optional tags?: string[];

SoundSource ​

ts
type SoundSource = object;

Properties ​

author? ​
ts
optional author?: string;
generator? ​
ts
optional generator?: string;
license ​
ts
license: string;
notes? ​
ts
optional notes?: string;
prompt? ​
ts
optional prompt?: string;
site? ​
ts
optional site?: string;
title? ​
ts
optional title?: string;
url? ​
ts
optional url?: string;

SoundSpatial ​

ts
type SoundSpatial = object;

Properties ​

maxDistance? ​
ts
optional maxDistance?: number;
model? ​
ts
optional model?: "linear" | "inverse" | "exponential";
refDistance? ​
ts
optional refDistance?: number;
rolloff? ​
ts
optional rolloff?: number;

ValidationResult ​

ts
type ValidationResult<T> = 
  | ValidationSuccess<T>
  | ValidationFailure;

Type Parameters ​

T ​

T


Vec3 ​

ts
type Vec3 = [number, number, number];

VehicleInteriorBinding ​

ts
type VehicleInteriorBinding = ModelSignalBinding;

VehicleKind ​

ts
type VehicleKind = string;

Stable external entity/type id for a wheeled vehicle.


WeatherData ​

ts
type WeatherData = object;

Independent atmospheric, cloud and precipitation parameters, in SI units.

Properties ​

atmosphere? ​
ts
optional atmosphere?: object;
gasConstant? ​
ts
optional gasConstant?: number;
pressurePa? ​
ts
optional pressurePa?: number;
referenceAltitude? ​
ts
optional referenceAltitude?: number;
relativeHumidity? ​
ts
optional relativeHumidity?: number;
temperatureK? ​
ts
optional temperatureK?: number;
windVelocity? ​
ts
optional windVelocity?: [number, number, number];
clouds? ​
ts
optional clouds?: object;
baseAltitude? ​
ts
optional baseAltitude?: number;
coverage? ​
ts
optional coverage?: number;
density? ​
ts
optional density?: number;
scale? ​
ts
optional scale?: number;
thickness? ​
ts
optional thickness?: number;
precipitation? ​
ts
optional precipitation?: object;
intensity? ​
ts
optional intensity?: number;
kind? ​
ts
optional kind?: "none" | "rain" | "snow";
seed? ​
ts
optional seed?: number;
visibility? ​
ts
optional visibility?: number;

WeatherProfile ​

ts
type WeatherProfile = "sunny" | "partly-cloudy" | "overcast" | "rain" | "snow" | "fog";

Variables ​

AUDIO_BUS_PATTERN ​

ts
const AUDIO_BUS_PATTERN: RegExp;

Bus names: lowercase, e.g. music, ambience, sfx, ui, voice.


AUDIO_BUSES ​

ts
const AUDIO_BUSES: readonly string[];

The buses every audio backend creates; others are created on first use.


AUDIO_SIGNALS ​

ts
const AUDIO_SIGNALS: Readonly<Record<string, string>>;

Built-in signal names (besides <component>.<field> on an entity and host-supplied host.*).


audioEnvironmentSchema ​

ts
const audioEnvironmentSchema: z.ZodType<AudioEnvironmentData>;

audioSignalBindingSchema ​

ts
const audioSignalBindingSchema: z.ZodType<AudioSignalBinding>;

audioSignalDriveSchema ​

ts
const audioSignalDriveSchema: z.ZodType<AudioSignalDrive>;

audioSourceSchema ​

ts
const audioSourceSchema: z.ZodType<AudioSourceData>;

audioWhenSchema ​

ts
const audioWhenSchema: z.ZodType<AudioWhen>;

audioZoneSchema ​

ts
const audioZoneSchema: z.ZodType<AudioZoneData>;

inputProfileSchema ​

ts
const inputProfileSchema: z.ZodType<InputProfile>;

modelSignalsSchema ​

ts
const modelSignalsSchema: z.ZodType<ModelSignalSpec>;

Automatic ECS bridge requires all sources; the direct API can supply values itself.


PACK_MANIFEST_ENTRY ​

ts
const PACK_MANIFEST_ENTRY: "molen-pack.json" = "molen-pack.json";

Zip member name of the manifest; it is written last, just before the central directory.


PACK_RESERVED_PREFIX ​

ts
const PACK_RESERVED_PREFIX: "molen-pack/" = "molen-pack/";

Reserved prefix for zip members that are not logical files (solid blocks).


SCHEMA_ID_BASE ​

ts
const SCHEMA_ID_BASE: string;

Absolute base URI for the $id of every emitted JSON Schema (scripts/emit-schemas.mjs). The docs site (molen.dev) serves them, so an authored document can carry a resolvable "$schema" line and one emitted schema can $ref another. A bare relative $id like molen/scene@3 resolves against nothing, which is why the format envelope id (meta.id) and the schema $id are deliberately different strings.


skySchema ​

ts
const skySchema: z.ZodType<SkyData>;

Data-only configuration for an Earth ephemeris or an authored fantasy sky.


SOUND_ID_PATTERN ​

ts
const SOUND_ID_PATTERN: RegExp;

Sound ids: lowercase dotted segments, e.g. ambience.rain.medium, footstep.grass.


SOUNDBANK_EXAMPLE ​

ts
const SOUNDBANK_EXAMPLE: SoundbankDoc;

soundbankSchema ​

ts
const soundbankSchema: z.ZodType<SoundbankDoc>;

vehicleInteriorSchema ​

ts
const vehicleInteriorSchema: z.ZodType<VehicleInteriorSpec>;

weatherSchema ​

ts
const weatherSchema: z.ZodType<WeatherData>;

Data-only weather shared by headless simulation, scripts and rendering.

Functions ​

audioSignalBindings() ​

ts
function audioSignalBindings(drive): AudioSignalBinding[];

The bindings of a drive as a list.

Parameters ​

drive ​

AudioSignalDrive | undefined

Returns ​

AudioSignalBinding[]


audioSignalIssues() ​

ts
function audioSignalIssues(signal, path?): ValidationIssue[];

Issues for a signal path (unknown built-ins get did-you-mean); component paths pass.

Parameters ​

signal ​

string

path? ​

string

Returns ​

ValidationIssue[]


audioSignalRefs() ​

ts
function audioSignalRefs(component, data): object[];

Every signal path an audio component or environment references, with its JSON Pointer.

Parameters ​

component ​

"audioSource" | "audioZone" | "audioEnvironment"

data ​

| AudioEnvironmentData | AudioSourceData | AudioZoneData

Returns ​

object[]


audioSoundRefs() ​

ts
function audioSoundRefs(component, data): object[];

Every sound id an audio component or environment references, with its JSON Pointer.

Parameters ​

component ​

"audioSource" | "audioZone" | "audioEnvironment"

data ​

| AudioEnvironmentData | AudioSourceData | AudioZoneData

Returns ​

object[]


blockingIssues() ​

ts
function blockingIssues(issues): ValidationIssue[];

The issues that make a document invalid (everything except notices).

Parameters ​

issues ​

ValidationIssue[]

Returns ​

ValidationIssue[]


buildTypeIndex() ​

ts
function buildTypeIndex(docs): TypeIndex;

Index type defs across documents; duplicate ids across files are issues.

Parameters ​

docs ​

object[]

Returns ​

TypeIndex


checkTypes() ​

ts
function checkTypes(project, docs): ValidationIssue[];

Project-level cross-checks over all types documents: cross-file duplicates, dangling/cyclic extends, namespace ownership vs reservations, and asset refs missing from project.assets. (Per-file namespace containment and per-type component shapes are covered by validate.)

Parameters ​

project ​

ProjectManifest

docs ​

object[]

Returns ​

ValidationIssue[]


commandPayloadValidator() ​

ts
function commandPayloadValidator(type, schema): (payload) => PayloadCheck;

Build a command payload validator from a declared JSON Schema. The message on failure is the standard formatted issue block, labelled command "<type>" payload.

Parameters ​

type ​

string

schema ​

JsonObject

Returns ​

(payload) => PayloadCheck


compileCommandPayload() ​

ts
function compileCommandPayload(schema): ZodType;

Compile a JSON Schema payload shape to a Zod schema. Throws (with the converter's message) when the document uses keywords the converter does not support, and refuses a pattern that can backtrack catastrophically — molen validate reports the same patterns as issues, but a host that builds a world straight from a scene file never gets to run one.

Parameters ​

schema ​

JsonObject

Returns ​

ZodType


componentIssues() ​

ts
function componentIssues(
   name, 
   data, 
   basePointer, 
   opts?
): ValidationIssue[];

Validate one component's data, returning prefixed ValidationIssues. basePointer is the JSON Pointer to the component itself (e.g. "/entities/0/components/transform").

Parameters ​

name ​

string

data ​

unknown

basePointer ​

string

opts? ​

ComponentValidateOptions

Returns ​

ValidationIssue[]


componentMapIssues() ​

ts
function componentMapIssues(
   componentMap, 
   basePointer, 
   opts?
): ValidationIssue[];

Walk a component map and collect issues for each entry.

Parameters ​

componentMap ​

Record&lt;string, unknown&gt; | undefined

basePointer ​

string

opts? ​

ComponentValidateOptions

Returns ​

ValidationIssue[]


componentNames() ​

ts
function componentNames(registry?): string[];

Parameters ​

registry? ​

ComponentRegistry

Returns ​

string[]


createComponentRegistry() ​

ts
function createComponentRegistry(decls?, opts?): object;

Create an isolated vocabulary. Validation never installs declarations in another context.

Parameters ​

decls? ​

Record&lt;string, DeclaredComponent&gt;

opts? ​
base? ​

ComponentRegistry

owner? ​

string

Returns ​

object

issues ​
ts
issues: ValidationIssue[];
registry ​
ts
registry: ComponentRegistry;

decodeCollisionTrimesh() ​

ts
function decodeCollisionTrimesh(header, bin): object;

Decode a collision trimesh from its sidecar header + binary bytes. Pure (no fs/WASM) so the kernel/physics side can consume asset collision headlessly.

Parameters ​

AssetTrimeshHeader

bin ​

Uint8Array

Returns ​

object

indices ​
ts
indices: Uint32Array;
positions ​
ts
positions: Float32Array;

deepMergeJson() ​

ts
function deepMergeJson(base, override): JsonObject;

Deep-merge JSON objects (later sources win); arrays and primitives are replaced wholesale. The one merge semantics used everywhere data layers stack: prefab extends chains, type defaults under scene data, entity components under overrides. Inputs are never mutated.

Parameters ​

base ​

JsonObject

override ​

JsonObject

Returns ​

JsonObject


detectKind() ​

ts
function detectKind(data): string | undefined;

Infer the schema kind from a document's format/kind envelope fields (any registered kind).

Parameters ​

data ​

unknown

Returns ​

string | undefined


encodeCollisionTrimesh() ​

ts
function encodeCollisionTrimesh(positions, indices): object;

Encode a collision trimesh to binary + header fields (the writer used by asset import).

Parameters ​

positions ​

Float32Array

indices ​

Uint32Array

Returns ​

object

bin ​
ts
bin: Uint8Array;
indices ​
ts
indices: object;
indices.byteOffset ​
ts
byteOffset: number;
indices.count ​
ts
count: number;
positions ​
ts
positions: object;
positions.byteOffset ​
ts
byteOffset: number;
positions.count ​
ts
count: number;

findReservation() ​

ts
function findReservation(reservations, id): NamespaceReservation | undefined;

The longest (most specific) reservation covering an id, if any.

Parameters ​

reservations ​

readonly NamespaceReservation[]

id ​

string

Returns ​

NamespaceReservation | undefined


formatIssues() ​

ts
function formatIssues(label, issues): string;

Renders the agent-facing error block. Its exact shape is a tested product surface.

Parameters ​

label ​

string

issues ​

ValidationIssue[]

Returns ​

string


getComponent() ​

ts
function getComponent(name, registry?): ComponentEntry | undefined;

Parameters ​

name ​

string

registry? ​

ComponentRegistry

Returns ​

ComponentEntry | undefined


getLegacySchema() ​

ts
function getLegacySchema(kind, formatId): LegacySchemaVersion | undefined;

Find the legacy version entry (if any) whose id matches a document's format.

Parameters ​

kind ​

string

formatId ​

string

Returns ​

LegacySchemaVersion | undefined


getSchema() ​

ts
function getSchema(kind): SchemaEntry | undefined;

Parameters ​

kind ​

string

Returns ​

SchemaEntry | undefined


inputProfileIssues() ​

ts
function inputProfileIssues(profile): object[];

Semantic constraints shared by scene validation and runtime remapping.

Parameters ​

profile ​

InputProfile

Returns ​

object[]


jsonSchemaId() ​

ts
function jsonSchemaId(formatId): string;

The absolute $id an emitted JSON Schema carries, derived from a format envelope id: molen/scene@3 → https://molen.dev/schemas/scene@3.json, and molen/component/transform@1 → https://molen.dev/schemas/component/transform@1.json.

Parameters ​

formatId ​

string

Returns ​

string


listComponents() ​

ts
function listComponents(registry?): ComponentSummary[];

Parameters ​

registry? ​

ComponentRegistry

Returns ​

ComponentSummary[]


listRenderableKinds() ​

ts
function listRenderableKinds(): object[];

Every registered renderable kind, in registration order (core kinds first).

Returns ​

object[]


listSchemas() ​

ts
function listSchemas(): SchemaSummary[];

Returns ​

SchemaSummary[]


namespaceCovers() ​

ts
function namespaceCovers(ns, id): boolean;

Does a reserved namespace cover an id? Dot-boundary prefix: "train" covers "train.car", not "trainer.x".

Parameters ​

ns ​

string

id ​

string

Returns ​

boolean


nearest() ​

ts
function nearest(input, candidates): string | undefined;

Nearest candidate by Levenshtein distance, if close enough to be a likely typo.

Parameters ​

input ​

string

candidates ​

string[]

Returns ​

string | undefined


nearestWithDistance() ​

ts
function nearestWithDistance(input, candidates): 
  | {
  candidate: string;
  distance: number;
}
  | undefined;

Like nearest, but also reports the (case-insensitive) edit distance.

Parameters ​

input ​

string

candidates ​

string[]

Returns ​

| { candidate: string; distance: number; } | undefined


noticeIssues() ​

ts
function noticeIssues(issues): ValidationIssue[];

The advisory issues only.

Parameters ​

issues ​

ValidationIssue[]

Returns ​

ValidationIssue[]


registerComponent() ​

ts
function registerComponent(
   name, 
   zod, 
   meta, 
   opts?
): void;

Register a component schema. Capability packages and content may register their own component names so validation knows about them; core components are registered below. Duplicate names throw (two packages silently fighting over one name is a determinism hazard) unless { override: true } is passed.

Parameters ​

name ​

string

zod ​

ZodType

meta ​

ComponentMeta

opts? ​

RegisterComponentOptions

Returns ​

void


registerDeclaredComponents() ​

ts
function registerDeclaredComponents(decls, opts): ValidationIssue[];

Register a declared custom-component vocabulary so every consumer (validation, spawn checks, molen components, docs) knows the names. A declaration WITH a schema is shape-checked like a core component; without one it accepts any object. Re-declaring overrides (a project reload is the normal case). Returns blocking issues for reserved names or unsupported schemas.

registry is REQUIRED and is never the process-global vocabulary: one document's declarations must not leak into every later validation in a long-lived process (an MCP server validates documents from unrelated projects back to back). createComponentRegistry is the normal entry point; call this directly only to add declarations to a registry you already own.

Parameters ​

decls ​

Record&lt;string, DeclaredComponent&gt;

opts ​
owner? ​

string

pointer? ​

string

registry ​

Map&lt;string, ComponentEntry&gt;

Returns ​

ValidationIssue[]


registerLegacySchema() ​

ts
function registerLegacySchema(kind, legacy): void;

Register a previous version of a kind. Documents carrying the legacy format id still validate — against the legacy Zod, then upgraded to the current shape via upgrade() — and the result carries a deprecation notice (see validateByKind). There is no migration command: a legacy document is upgraded in memory on read, and a breaking change bumps the version.

Parameters ​

kind ​

string

legacy ​

LegacySchemaVersion

Returns ​

void


registerRenderableKind() ​

ts
function registerRenderableKind(kind, meta): void;

Register a renderable kind rendered by a capability client half (e.g. 'figure'). Idempotent (re-registering updates the description) and additive: renderable is re-registered with the widened kind enum — and with any fields the kind declares — so molen validate, the emitted JSON Schema, and the docs all list it.

Parameters ​

kind ​

string

meta ​

RenderableKindMeta

Returns ​

void


registerSchema() ​

ts
function registerSchema(
   kind, 
   zod, 
   meta
): void;

Capability packages register their formats here; tooling sees one unified registry.

Parameters ​

kind ​

string

zod ​

ZodType

meta ​

SchemaMeta

Returns ​

void


resolveAllTypes() ​

ts
function resolveAllTypes(index): Map<string, ResolvedEntityType>;

Parameters ​

index ​

Map&lt;string, TypeIndexEntry&gt;

Returns ​

Map&lt;string, ResolvedEntityType&gt;


resolveEntityComponents() ​

ts
function resolveEntityComponents(
   manifest, 
   entity, 
   opts?
): ComponentMap;

Resolve a scene entity's final components (type <- prefab <- components).

Parameters ​

manifest ​

SceneManifest

entity ​
components? ​

ComponentMap

prefab? ​

string

type? ​

string

opts? ​

SceneResolveOptions

Returns ​

ComponentMap


resolvePrefab() ​

ts
function resolvePrefab(
   manifest, 
   name, 
   opts?, 
   seen?
): ComponentMap;

Resolve a prefab's components: registry type <- extends chain <- own components.

Parameters ​

manifest ​

SceneManifest

name ​

string

opts? ​

SceneResolveOptions

seen? ​

string[]

Returns ​

ComponentMap


resolveType() ​

ts
function resolveType(
   index, 
   id, 
   seen?
): ComponentMap;

Resolve a type's component map, following the extends chain ancestor-first (parent under child). Throws on unknown ids and cycles — callers validate first via checkTypes.

Parameters ​

index ​

Map&lt;string, TypeIndexEntry&gt;

id ​

string

seen? ​

string[]

Returns ​

ComponentMap


resolveWeather() ​

ts
function resolveWeather(data?): ResolvedWeather;

Expand validated weather data without changing or retaining its mutable nested values.

Parameters ​

data? ​

WeatherData

Returns ​

ResolvedWeather


sceneTypeRefIssues() ​

ts
function sceneTypeRefIssues(manifest, knownTypeIds): ValidationIssue[];

Scene entities/prefabs that reference registry type ids the project does not define. Pure: pass the ids the project resolved (e.g. resolvedTypes.keys()); the issues carry a did-you-mean over them, so molen validate and the scene loader report a typo'd type with a pointer instead of the kernel throwing "unknown type".

Parameters ​

manifest ​

SceneManifest

knownTypeIds ​

Iterable&lt;string&gt;

Returns ​

ValidationIssue[]


schemaKinds() ​

ts
function schemaKinds(): string[];

Returns ​

string[]


unregisterComponent() ​

ts
function unregisterComponent(name): boolean;

Remove a registration (tests, and re-loading a project with a changed vocabulary). Core components are not removable: unregisterComponent('transform') would leave every later validation in a long-lived process (an MCP server, the dev server) unable to check the one component every entity has, and nothing would report it.

Parameters ​

name ​

string

Returns ​

boolean


validate() ​

ts
function validate<K>(
   kind, 
   data, 
   opts?
): ValidationResult<SchemaKindMap[K]>;

Type Parameters ​

K ​

K extends keyof SchemaKindMap

Parameters ​

kind ​

K

data ​

unknown

opts? ​

ValidateOptions

Returns ​

ValidationResult&lt;SchemaKindMap[K]&gt;


validateByKind() ​

ts
function validateByKind(
   kind, 
   data, 
   opts?
): ValidationResult<unknown>;

Validate against any registered schema kind (core or capability-package). Returns an untyped result; prefer the typed validate<K> for the core kinds in SchemaKindMap.

Parameters ​

kind ​

string

data ​

unknown

opts? ​

ValidateOptions

Returns ​

ValidationResult&lt;unknown&gt;


validateSoundbank() ​

ts
function validateSoundbank(data): ValidationIssue[];

Cross-field checks Zod cannot express (loop ranges, pitch order, license policy, paths).

Parameters ​

data ​

unknown

Returns ​

ValidationIssue[]


weatherProfile() ​

ts
function weatherProfile(profile): WeatherData;

Presets are starting points, not a mutually exclusive weather model. Returns fresh data.

Parameters ​

profile ​

WeatherProfile

Returns ​

WeatherData

37 guides · 36 schema formats · 41 API entry points · 10 samples. API, CLI and schema pages are generated from the shipped build.