import React__default, { ReactNode } from 'react'; import { CanvasProps, ThreeElements } from '@react-three/fiber'; import * as THREE from 'three'; /** * @license * SPDX-License-Identifier: Apache-2.0 * * Helpers for turning browser camera captures into policy image tensors. */ type PolicyImageTensorLayout = 'CHW' | 'HWC'; type PolicyImageTensorRange = readonly [number, number]; /** * Row order of a raw pixel buffer. WebGL `readRenderTargetPixels` returns rows * bottom-to-top (`'bottom-left'`); `ImageData` is top-to-bottom (`'top-left'`). */ type PolicyImageTensorSourceOrigin = 'top-left' | 'bottom-left'; interface PolicyImageTensorOptions { width: number; height: number; channels?: 3 | 4; layout?: PolicyImageTensorLayout; range?: PolicyImageTensorRange; } interface PolicyImageTensorPixelOptions extends PolicyImageTensorOptions { /** Row order of the source buffer. Defaults to `'top-left'`. */ sourceOrigin?: PolicyImageTensorSourceOrigin; /** Mirror horizontally while reading. */ flipX?: boolean; } interface PolicyImageTensorResult { data: Float32Array; shape: [number, number, number]; width: number; height: number; channels: 3 | 4; layout: PolicyImageTensorLayout; range: PolicyImageTensorRange; } /** * Convert a raw RGBA pixel buffer (4 bytes per pixel) directly into a policy * image tensor. This is the fast path that skips canvas encoding entirely — * feed it the `Uint8Array` returned by `readRenderTargetPixels` (which is * bottom-left origin, so pass `sourceOrigin: 'bottom-left'`). */ declare function pixelsToPolicyImageTensor(pixels: Uint8Array | Uint8ClampedArray, options: PolicyImageTensorPixelOptions): PolicyImageTensorResult; declare function imageDataToPolicyImageTensor(imageData: ImageData, options: PolicyImageTensorOptions): PolicyImageTensorResult; declare function dataUrlToPolicyImageTensor(dataUrl: string, options: PolicyImageTensorOptions): Promise; /** * @license * SPDX-License-Identifier: Apache-2.0 * * Offscreen camera-frame capture for R3F/MuJoCo scenes. */ /** Options for capturing a camera frame straight into a policy image tensor. */ type CameraFrameCaptureTensorOptions = CameraFrameCaptureOptions & Pick; interface CameraFramePixelsResult { /** Raw RGBA pixels, bottom-left origin (reused buffer — consume before the next capture). */ pixels: Uint8Array; camera: THREE.Camera; width: number; height: number; source: CameraFrameCaptureSource; } interface CameraFrameTensorResult extends PolicyImageTensorResult { camera: THREE.Camera; source: CameraFrameCaptureSource; } interface CameraFrameCaptureSession { readonly width: number; readonly height: number; capture(options?: CameraFrameCaptureOptions): { canvas: HTMLCanvasElement; camera: THREE.Camera; width: number; height: number; source: CameraFrameCaptureSource; }; captureAsync(options?: CameraFrameCaptureOptions): Promise<{ canvas: HTMLCanvasElement; camera: THREE.Camera; width: number; height: number; source: CameraFrameCaptureSource; }>; captureDataUrl(options?: CameraFrameCaptureOptions): CameraFrameCaptureResult; captureDataUrlAsync(options?: CameraFrameCaptureOptions): Promise; captureBlob(options?: CameraFrameCaptureOptions): Promise; /** * Render and read raw RGBA pixels without any canvas/PNG round-trip. The * returned buffer is reused between calls — copy or convert it before the * next capture. */ capturePixels(options?: CameraFrameCaptureOptions): CameraFramePixelsResult; /** Render straight into a normalized policy image tensor (no canvas/PNG encode). */ captureTensor(options?: CameraFrameCaptureTensorOptions): CameraFrameTensorResult; dispose(): void; } declare const CAMERA_FRAME_CAPTURE_RENDER_USER_DATA_KEY = "mujocoReactCameraFrameCaptureRender"; declare const CAMERA_FRAME_CAPTURE_PRE_RENDER_USER_DATA_KEY = "mujocoReactCameraFrameCapturePreRender"; declare const CAPTURE_EXCLUDE_KEY = "mujoco.capture.exclude"; declare function createCameraFrameCaptureSession(renderer: THREE.WebGLRenderer, scene: THREE.Scene, fallbackCamera: THREE.Camera, options?: CameraFrameCaptureOptions): CameraFrameCaptureSession; declare function renderCameraFrameToCanvas(renderer: THREE.WebGLRenderer, scene: THREE.Scene, fallbackCamera: THREE.Camera, options?: CameraFrameCaptureOptions): { canvas: HTMLCanvasElement; camera: THREE.Camera; width: number; height: number; source: CameraFrameCaptureSource; }; declare function captureCameraFrame(renderer: THREE.WebGLRenderer, scene: THREE.Scene, fallbackCamera: THREE.Camera, options?: CameraFrameCaptureOptions): Promise; declare function captureCameraFrameBlob(renderer: THREE.WebGLRenderer, scene: THREE.Scene, fallbackCamera: THREE.Camera, options?: CameraFrameCaptureOptions): Promise; /** * One-shot camera frame capture straight into a policy image tensor, skipping * the canvas/PNG round-trip. For repeated captures (live inference, recording), * create a session once with {@link createCameraFrameCaptureSession} and call * `session.captureTensor()` so the render target and buffers are reused. */ declare function captureCameraFrameTensor(renderer: THREE.WebGLRenderer, scene: THREE.Scene, fallbackCamera: THREE.Camera, options?: CameraFrameCaptureTensorOptions): CameraFrameTensorResult; /** * @license * SPDX-License-Identifier: Apache-2.0 */ /** * Module augmentation interface for type-safe resource names. * * Declare your model's resource names via module augmentation: * ```ts * declare module 'mujoco-react' { * interface Register { * models: { * panda: { * actuators: 'joint1' | 'joint2' | 'gripper'; * sensors: 'force_sensor' | 'torque_sensor'; * bodies: 'link0' | 'link1' | 'hand'; * }; * }; * actuators: 'joint1' | 'joint2' | 'gripper'; * sensors: 'force_sensor' | 'torque_sensor'; * bodies: 'link0' | 'link1' | 'hand'; * } * } * ``` * * When no augmentation is declared, all names fall back to `string`. */ interface Register { } type RegisteredModelMap = Register extends { models: infer T extends Record>; } ? T : never; type Models = [RegisteredModelMap] extends [never] ? string : Extract; type ModelResource = [ RegisteredModelMap ] extends [never] ? string : TModel extends keyof RegisteredModelMap ? TKey extends keyof RegisteredModelMap[TModel] ? RegisteredModelMap[TModel][TKey] : string : never; type RegisterResourceKey = 'actuators' | 'sensors' | 'bodies' | 'joints' | 'sites' | 'geoms' | 'keyframes' | 'cameras'; type ModelResourceObject = string extends ModelResource ? Record : { readonly [K in ModelResource]: K; }; type ModelResourceCategory = string extends Models ? Record> : { readonly [TModel in Models]: ModelResourceObject; }; type ModelResourceRegistry = string extends Models ? Record>> : { readonly [TModel in Models]: { readonly [TKey in RegisterResourceKey]: ModelResourceObject; }; }; type RuntimeModelResourceRegistration = Readonly>>>>>; declare function registerModelResources(resources: RuntimeModelResourceRegistration): void; declare const ModelResources: ModelResourceRegistry; type ModelActuators = ModelResource; declare const ModelActuators: ModelResourceCategory<'actuators'>; type ModelSensors = ModelResource; declare const ModelSensors: ModelResourceCategory<'sensors'>; type ModelBodies = ModelResource; declare const ModelBodies: ModelResourceCategory<'bodies'>; type ModelJoints = ModelResource; declare const ModelJoints: ModelResourceCategory<'joints'>; type ModelSites = ModelResource; declare const ModelSites: ModelResourceCategory<'sites'>; type ModelGeoms = ModelResource; declare const ModelGeoms: ModelResourceCategory<'geoms'>; type ModelKeyframes = ModelResource; declare const ModelKeyframes: ModelResourceCategory<'keyframes'>; type ModelCameras = ModelResource; declare const ModelCameras: ModelResourceCategory<'cameras'>; type Actuators = Register extends { actuators: infer T extends string; } ? T : string; type Sensors = Register extends { sensors: infer T extends string; } ? T : string; type Bodies = Register extends { bodies: infer T extends string; } ? T : string; type Joints = Register extends { joints: infer T extends string; } ? T : string; type Sites = Register extends { sites: infer T extends string; } ? T : string; type Geoms = Register extends { geoms: infer T extends string; } ? T : string; type Keyframes = Register extends { keyframes: infer T extends string; } ? T : string; type Cameras = Register extends { cameras: infer T extends string; } ? T : string; /** * A single MuJoCo contact from the WASM module. * Accessed via `data.contact.get(i)`. */ interface MujocoContact { geom1: number; geom2: number; pos: Float64Array; frame: Float64Array; dist: number; } /** * WASM contact array — supports indexed access via `.get(i)`. */ interface MujocoContactArray { get(i: number): MujocoContact | undefined; delete?: () => void; } /** * Read a single contact from an already-acquired WASM contact array. * Returns undefined if the access fails (WASM heap issue, bad index, etc.). */ declare function getContact(contacts: MujocoContactArray, i: number): MujocoContact | undefined; /** * Minimal interface for MuJoCo Model to avoid 'any'. */ interface MujocoModel { nbody: number; ngeom: number; nsite: number; nu: number; njnt: number; nq: number; nv: number; nkey: number; nsensor: number; nsensordata: number; nlight: number; ntendon: number; nflex: number; nmesh: number; nmat: number; ncam?: number; names: Int8Array; name_bodyadr: Int32Array; name_jntadr: Int32Array; name_geomadr: Int32Array; name_siteadr: Int32Array; name_actuatoradr: Int32Array; name_keyadr: Int32Array; name_sensoradr: Int32Array; name_tendonadr: Int32Array; name_camadr?: Int32Array; body_mass: Float64Array; body_parentid: Int32Array; body_jntnum: Int32Array; body_jntadr: Int32Array; body_pos: Float64Array; body_quat: Float64Array; body_geomnum: Int32Array; body_geomadr: Int32Array; body_inertia: Float64Array; qpos0: Float64Array; jnt_qposadr: Int32Array; jnt_dofadr: Int32Array; jnt_type: Int32Array; jnt_range: Float64Array; jnt_bodyid: Int32Array; jnt_pos: Float64Array; jnt_axis: Float64Array; jnt_limited: Uint8Array; geom_group: Int32Array; geom_type: Int32Array; geom_size: Float64Array; geom_pos: Float64Array; geom_quat: Float64Array; geom_matid: Int32Array; geom_rgba: Float32Array; geom_dataid: Int32Array; geom_bodyid: Int32Array; geom_contype: Int32Array; geom_conaffinity: Int32Array; geom_friction: Float64Array; mat_texid: Int32Array; mat_texrepeat: Float32Array; mat_texuniform: Uint8Array; mat_rgba: Float32Array; tex_adr: Int32Array; tex_data: Uint8Array; tex_height: Int32Array; tex_nchannel: Int32Array; tex_width: Int32Array; mesh_vertadr: Int32Array; mesh_vertnum: Int32Array; mesh_faceadr: Int32Array; mesh_facenum: Int32Array; mesh_vert: Float32Array; mesh_face: Int32Array; mesh_normal: Float32Array; mesh_texcoordadr?: Int32Array; mesh_texcoord?: Float32Array; mesh_facetexcoord?: Int32Array; site_bodyid: Int32Array; actuator_trnid: Int32Array; actuator_ctrlrange: Float64Array; actuator_trntype: Int32Array; actuator_gainprm: Float64Array; actuator_biasprm: Float64Array; sensor_type: Int32Array; sensor_dim: Int32Array; sensor_adr: Int32Array; sensor_objtype: Int32Array; sensor_objid: Int32Array; key_qpos: Float64Array; key_ctrl: Float64Array; key_time: Float64Array; key_qvel: Float64Array; light_pos: Float64Array; light_dir: Float64Array; light_diffuse: Float32Array; light_specular: Float32Array; light_type: Int32Array; light_active: Uint8Array; light_castshadow: Uint8Array; light_attenuation: Float32Array; light_cutoff: Float32Array; light_exponent: Float32Array; light_intensity: Float32Array; cam_bodyid?: Int32Array; cam_pos?: Float64Array; cam_quat?: Float64Array; cam_fovy?: Float64Array; cam_intrinsic?: Float64Array; cam_resolution?: Int32Array; cam_sensorsize?: Float64Array; ten_wrapadr: Int32Array; ten_wrapnum: Int32Array; ten_range: Float64Array; ten_rgba: Float32Array; ten_width: Float64Array; flex_vertadr: Int32Array; flex_vertnum: Int32Array; flex_faceadr: Int32Array; flex_facenum: Int32Array; flex_face: Int32Array; flex_rgba: Float32Array; opt: { timestep: number; gravity: Float64Array; integrator: number; [key: string]: unknown; }; delete: () => void; [key: string]: unknown; } /** * Minimal interface for MuJoCo Data to avoid 'any'. */ interface MujocoData { time: number; qpos: Float64Array; qvel: Float64Array; ctrl: Float64Array; act: Float64Array; xpos: Float64Array; xquat: Float64Array; xfrc_applied: Float64Array; qfrc_applied: Float64Array; qfrc_bias: Float64Array; site_xpos: Float64Array; site_xmat: Float64Array; cam_xpos?: Float64Array; cam_xmat?: Float64Array; xmat?: Float64Array; sensordata: Float64Array; ncon: number; contact: MujocoContactArray; cvel: Float64Array; cfrc_ext: Float64Array; ten_length: Float64Array; wrap_xpos: Float64Array; ten_wrapadr: Int32Array; flexvert_xpos: Float64Array; geom_xpos: Float64Array; geom_xmat: Float64Array; delete: () => void; [key: string]: unknown; } /** * Minimal interface for the MuJoCo WASM Module. */ interface MujocoModule { MjModel: { from_xml_path?: (path: string) => MujocoModel; from_xml_string?: (xml: string, vfs?: unknown) => MujocoModel; loadFromXML?: (path: string) => MujocoModel; [key: string]: unknown; }; MjData: new (model: MujocoModel) => MujocoData; MjvOption: new () => { delete: () => void; [key: string]: unknown; }; mj_forward: (m: MujocoModel, d: MujocoData) => void; mj_step: (m: MujocoModel, d: MujocoData) => void; mj_resetData: (m: MujocoModel, d: MujocoData) => void; mj_step1: (m: MujocoModel, d: MujocoData) => void; mj_step2: (m: MujocoModel, d: MujocoData) => void; mj_applyFT: (model: MujocoModel, data: MujocoData, force: Float64Array, torque: Float64Array, point: Float64Array, bodyId: number, qfrc_target: Float64Array) => void; mj_ray: (model: MujocoModel, data: MujocoData, pnt: Float64Array, vec: Float64Array, geomgroup: Uint8Array | null, flg_static: number, bodyexclude: number, geomid: Int32Array) => number; mj_name2id: (model: MujocoModel, type: number, name: string) => number; mjtObj: Record; mjtGeom: Record; mjtJoint: Record; mjtSensor: Record; FS: { writeFile: (path: string, content: string | Uint8Array) => void; readFile: (path: string, opts?: { encoding: string; }) => string | Uint8Array; mkdir: (path: string) => void; unmount: (path: string) => void; }; [key: string]: unknown; } interface SceneObject { name: string; /** MuJoCo geom name. Defaults to `${name}_geom` for generated objects. */ geomName?: string; type: 'box' | 'sphere' | 'cylinder'; size: [number, number, number]; position: [number, number, number]; rgba: [number, number, number, number]; mass?: number; freejoint?: boolean; friction?: string; solref?: string; solimp?: string; condim?: number; /** MuJoCo geom contact type bitmask. Defaults to 1 for generated objects. */ contype?: number; /** MuJoCo geom contact affinity bitmask. Defaults to 1 for generated objects. */ conaffinity?: number; /** MuJoCo geom group. Group 3 is conventionally used for collision-only helper geoms. */ group?: number; } interface XmlPatch { target: string; inject?: string; injectAfter?: string; replace?: [string, string]; } type LocalMujocoFile = File; interface LoadFromFilesOptions { /** Entry MJCF/URDF file. Inferred from scene.xml, model.xml, robot.xml, or the first XML/URDF file when omitted. */ sceneFile?: string; /** Additional MJCF environment XML files merged into the entry scene before MuJoCo compilation. */ environmentFiles?: string[]; homeJoints?: number[]; xmlPatches?: XmlPatch[]; sceneObjects?: SceneObject[]; onReset?: (input: ResetCallbackInput) => void; } interface SceneConfig { /** Base URL for fetching model files. The loader fetches `src + sceneFile` and follows dependencies. */ src: string; /** Entry MJCF XML or URDF file name, e.g. 'scene.xml' or 'robot.urdf'. */ sceneFile: string; /** Browser-selected files for local MJCF/URDF loading. Preserves webkitRelativePath when available. */ files?: readonly LocalMujocoFile[]; /** * Additional MJCF environment XML files merged into the entry scene before compilation. * * Use this for static collision/physics layers such as a Gaussian-splat * environment's proxy `scene.xml`; render the splat itself as a separate * visual layer. */ environmentFiles?: string[]; sceneObjects?: SceneObject[]; homeJoints?: number[]; xmlPatches?: XmlPatch[]; onReset?: (input: ResetCallbackInput) => void; } type ResourceSelector = TName | readonly TName[] | RegExp | ((info: TInfo) => boolean); interface IkConfig { /** MuJoCo site name for IK target. */ siteName: Sites; /** * Explicit joints for IK. When omitted, the controller infers scalar hinge/slide * joints by walking from the site body to the model root. */ joints?: ResourceSelector; /** Explicit actuators for IK control output. */ actuators?: ResourceSelector; /** * Number of joints to solve for, assuming legacy contiguous qpos/ctrl layout * starting at index 0. Prefer inferred IK or `joints`/`actuators`. */ numJoints?: number; /** * Optional solve-space joint limits in the same order as the resolved joints. * Use this when MJCF limits are intentionally broad or when a setup/calibration * tool should stay within a narrower envelope. */ jointLimits?: ReadonlyArray; /** Custom IK solver. When omitted, uses built-in Damped Least-Squares solver. */ ikSolveFn?: IKSolveFn; /** DLS damping. Default: 0.01. */ damping?: number; /** Position error weight for the built-in DLS solver. Default: 1. */ posWeight?: number; /** Orientation error weight for the built-in DLS solver. Default: 0.3. */ rotWeight?: number; /** Solver convergence tolerance. Default: 1e-3. */ tolerance?: number; /** Finite-difference step used by the built-in DLS solver. Default: 1e-6. */ epsilon?: number; /** Max solver iterations. Default: 50. */ maxIterations?: number; } interface IkContextValue { ikEnabledRef: React__default.RefObject; ikCalculatingRef: React__default.RefObject; ikTargetRef: React__default.RefObject; siteIdRef: React__default.RefObject; setIkEnabled: (enabled: boolean) => void; moveTarget: (pos: IkTargetPosition, duration?: number) => void; syncTargetToSite: () => void; solveIK: (input: IkSolveInput) => number[] | null; getGizmoStats: () => { pos: THREE.Vector3; rot: THREE.Euler; } | null; } interface SceneMarker { id: number; position: THREE.Vector3; label: string; } interface PhysicsConfig { gravity?: [number, number, number]; timestep?: number; substeps?: number; paused?: boolean; speed?: number; } type IKSolveFn = (input: IkSolveInput) => number[] | null; type IkTargetPosition = THREE.Vector3 | readonly [number, number, number] | { readonly x: number; readonly y: number; readonly z: number; }; type IkTargetQuaternion = THREE.Quaternion | readonly [number, number, number, number] | { readonly x: number; readonly y: number; readonly z: number; readonly w: number; }; interface IkSolveInput { position: IkTargetPosition; quaternion: IkTargetQuaternion; currentQ: number[]; context?: IKSolveContext; } interface IKSolveContext { model: MujocoModel; data: MujocoData; siteId: number; controlGroup: ControlGroupInfo; } interface PhysicsStepInput { model: MujocoModel; data: MujocoData; } interface ResetCallbackInput extends PhysicsStepInput { } interface ReadyCallbackInput { api: MujocoSimAPI; } interface StepCallbackInput { time: number; model: MujocoModel; data: MujocoData; } interface SelectionCallbackInput { bodyId: number; name: string; } type PhysicsStepCallback = (input: PhysicsStepInput) => void; interface StateSnapshot { time: number; qpos: Float64Array; qvel: Float64Array; ctrl: Float64Array; act: Float64Array; qfrc_applied: Float64Array; } interface BodyInfo { id: number; name: string; mass: number; parentId: number; } interface JointInfo { id: number; name: string; type: number; typeName: string; range: [number, number]; limited: boolean; bodyId: number; qposAdr: number; dofAdr: number; } interface GeomInfo { id: number; name: string; type: number; typeName: string; size: [number, number, number]; bodyId: number; } interface SiteInfo { id: number; name: string; bodyId: number; } interface ActuatorInfo { id: number; name: string; range: [number, number]; } interface ActuatedJointInfo extends JointInfo { actuatorId: number; actuatorName: string; ctrlAdr: number; ctrlRange: [number, number]; } interface ControlJointInfo extends JointInfo { actuatorId: number | null; actuatorName: string | null; ctrlAdr: number | null; ctrlRange: [number, number] | null; } interface ControlGroupSelector { /** Infer a kinematic chain from a MuJoCo site. */ siteName?: Sites; /** Infer a kinematic chain from a body. */ bodyName?: Bodies; /** Select joints by name, names, regex, or predicate. */ joints?: ResourceSelector; /** Select actuators by name, names, regex, or predicate. */ actuators?: ResourceSelector; } interface ControlGroupInfo { /** Joints in solve/control order. */ joints: ControlJointInfo[]; /** Actuators in control output order. */ actuators: ActuatorInfo[]; /** qpos addresses for scalar hinge/slide joints. */ qposAdr: number[]; /** dof addresses for scalar hinge/slide joints. */ dofAdr: number[]; /** ctrl addresses matching writable actuators. */ ctrlAdr: number[]; readQpos(data: MujocoData): Float64Array; readCtrl(data: MujocoData): Float64Array; writeQpos(data: MujocoData, values: ArrayLike): void; writeCtrl(data: MujocoData, values: ArrayLike): void; } interface SensorInfo { id: number; name: string; type: number; typeName: string; dim: number; adr: number; } interface CameraInfo { id: number; name: string; bodyId: number; fov: number | null; resolution: [number, number] | null; sensorSize: [number, number] | null; intrinsic: [number, number, number, number] | null; position: [number, number, number] | null; quaternion: [number, number, number, number] | null; } interface ContactInfo { geom1: number; geom1Name: string; geom2: number; geom2Name: string; pos: [number, number, number]; depth: number; } interface RayHit { point: THREE.Vector3; bodyId: number; geomId: number; distance: number; } type ImagePointCoordinateSpace = 'normalized' | 'normalized-1000' | 'pixel' | 'ndc'; interface ImagePointProjectionOptions extends CameraFrameCaptureOptions { /** X coordinate in the selected coordinate space. Defaults to normalized 0..1. */ x: number; /** Y coordinate in the selected coordinate space. Defaults to normalized 0..1 with origin at top-left. */ y: number; /** * Coordinate convention for x/y: * - normalized: 0..1 image coordinates, top-left origin * - normalized-1000: 0..1000 detector coordinates, top-left origin * - pixel: pixel coordinates, top-left origin * - ndc: Three.js normalized device coordinates, -1..1 */ coordinateSpace?: ImagePointCoordinateSpace; /** Image width for pixel coordinates. Falls back to `width` or renderer canvas width. */ imageWidth?: number; /** Image height for pixel coordinates. Falls back to `height` or renderer canvas height. */ imageHeight?: number; /** Ignore hits farther than this distance from the camera ray origin. */ maxDistance?: number; } interface ImagePointProjectionResult extends RayHit { /** NDC coordinates used for raycasting. */ ndc: [number, number]; /** Image dimensions used when interpreting pixel coordinates. */ imageSize: [number, number]; /** Camera pose provenance, matching camera-frame capture results. */ source: CameraFrameCaptureSource; } interface ModelOptions { timestep: number; gravity: [number, number, number]; integrator: number; } interface TrajectoryFrame { time: number; qpos: Float64Array; qvel?: Float64Array; ctrl?: Float64Array; sensordata?: Float64Array; } interface TrajectoryData { frames: TrajectoryFrame[]; fps: number; } type PlaybackState = 'idle' | 'playing' | 'paused' | 'completed'; interface KeyBinding { actuator: Actuators; delta?: number; toggle?: [number, number]; set?: number; } interface KeyboardTeleopConfig { bindings: Record; enabled?: boolean; } type PolicyVector = Float32Array | Float64Array | number[]; interface PolicyObservationInput { model: MujocoModel; data: MujocoData; } interface PolicyInferenceInput extends PolicyObservationInput { observation: PolicyVector; /** Number of actions still queued locally when inference is requested. */ queuedActions?: number; } type PolicyActionChunk = readonly PolicyVector[]; type PolicyInferenceOutput = PolicyVector | PolicyActionChunk; type PolicyInferenceResult = PolicyInferenceOutput | Promise; interface PolicyActionInput extends PolicyInferenceInput { action: PolicyVector; } interface PolicyAPI { readonly isRunning: boolean; start: () => void; stop: () => void; clearQueue: () => void; reset: () => void; readonly inFlight: boolean; readonly queuedActions: number; readonly lastObservation: PolicyVector | null; readonly lastAction: PolicyVector | null; readonly lastError: unknown; } interface PolicyConfig { frequency: number; enabled?: boolean; /** Start async inference while this many queued actions remain. Defaults to 0. */ prefetchThreshold?: number; /** * How async action chunks update the queue. * - append preserves legacy FIFO behavior. * - replace is useful for receding-horizon policies where a fresh chunk should supersede stale queued actions. */ queueStrategy?: 'append' | 'replace'; /** * Clear queued actions and ignore in-flight async results when `stop()` is called. * Defaults to false so callers can choose pause/resume behavior explicitly. */ clearQueueOnStop?: boolean; onObservation: (input: PolicyObservationInput) => PolicyVector; /** Run policy inference. Omit to pass observations directly to `onAction` for custom inline controllers. */ infer?: (input: PolicyInferenceInput) => PolicyInferenceResult; onAction: (input: PolicyActionInput) => void; /** Called when async inference rejects. */ onError?: (error: unknown) => void; } interface RemotePolicyRequestInput extends PolicyInferenceInput { /** True for the first request after hook construction or `reset()`. */ reset: boolean; /** Zero-based request index since construction or `reset()`. */ requestIndex: number; /** Aborts when the request is no longer needed, e.g. after pause/reset. */ signal: AbortSignal; } interface RemotePolicyRequestInfo extends RemotePolicyRequestInput { body: unknown; requestStartedAt: number; } interface RemotePolicyResponseInfo extends RemotePolicyRequestInfo { response: Response; responseBody: unknown; responseFinishedAt: number; requestMs: number; } type RemotePolicyStatus = 'idle' | 'requesting' | 'ready' | 'error' | 'aborted'; interface RemotePolicyConfig extends Omit { endpoint: string | URL; method?: string; headers?: HeadersInit; credentials?: RequestCredentials; /** Additional external cancellation signal for remote inference requests. */ signal?: AbortSignal; /** * Abort the active HTTP request when `stop()` or `reset()` is called. * Defaults to true so paused policies stop consuming server work. */ abortOnStop?: boolean; fetcher?: typeof fetch; requestInit?: Omit; buildRequest?: (input: RemotePolicyRequestInput) => unknown | Promise; readResponse?: (response: Response) => unknown | Promise; parseResponse?: (responseBody: unknown, info: RemotePolicyResponseInfo) => PolicyInferenceResult; onRequest?: (info: RemotePolicyRequestInfo) => void; onResponse?: (info: RemotePolicyResponseInfo) => void; } interface RemotePolicyAPI extends PolicyAPI { abort: (reason?: unknown) => void; readonly remoteStatus: RemotePolicyStatus; readonly requestCount: number; readonly responseCount: number; readonly lastRequestBody: unknown; readonly lastResponseBody: unknown; readonly lastHttpStatus: number | null; readonly lastRequestMs: number | null; } interface PolicyCameraFrameStream extends CameraFrameCaptureOptions { /** Image key used in policy payloads, e.g. `image`, `front`, or `wrist_cam`. */ key: string; /** Additional payload keys that should receive the same data URL. */ aliases?: readonly string[]; } interface PolicyCameraFrameCaptureOptions { streams: readonly PolicyCameraFrameStream[]; /** * Include `observation.images.${key}` for every captured stream. * Defaults to true because LeRobot-style policies usually use these names. */ includeObservationImageAliases?: boolean; } interface PolicyCameraFrameCaptureResult { frames: Record; images: Record; /** Human-readable source summary for UI/debug telemetry. */ sourceSummary: string; capturedAt: number; } interface PolicyCameraFrameCaptureAPI { status: FrameCaptureStatus; error: Error | null; isCapturing: boolean; capture: (options?: Partial) => Promise; reset: () => void; } type ObservationOutput = 'float32' | 'float64'; interface ObservationConfig { /** Include scalar simulation time. */ time?: boolean; /** Include all qpos values. */ qpos?: boolean; /** Include all qvel values. */ qvel?: boolean; /** Include all ctrl values. */ ctrl?: boolean; /** Include all actuator activation values. */ act?: boolean; /** Include all raw sensordata values. */ sensordata?: boolean; /** Include named sensor values in the configured order. */ sensors?: readonly Sensors[]; /** Include named site world positions in the configured order. */ sites?: readonly Sites[]; /** Include world gravity projected into each named body's local frame. */ projectedGravity?: Bodies | readonly Bodies[]; /** Output array type. Defaults to Float32Array. */ output?: ObservationOutput; } interface ObservationLayoutItem { name: string; start: number; size: number; } interface ObservationResult { values: Float32Array | Float64Array; layout: ObservationLayoutItem[]; } interface ObservationHandle { /** Read a fresh observation from the current live MuJoCo model/data refs. */ read(): ObservationResult; /** Read just the vector values for policy inference. */ readValues(): Float32Array | Float64Array; } interface DebugVirtualCamera { name?: string; position?: CameraFrameCaptureVector3; lookAt?: CameraFrameCaptureVector3; up?: CameraFrameCaptureVector3; quaternion?: THREE.Quaternion | readonly [number, number, number, number]; fov?: number; width?: number; height?: number; frustumDepth?: number; markerScale?: number; color?: THREE.ColorRepresentation; aimColor?: THREE.ColorRepresentation; } interface DebugProps { showGeoms?: boolean; showSites?: boolean; showJoints?: boolean; showCameras?: boolean; /** Additional explicit virtual camera poses to visualize alongside MuJoCo XML cameras. */ virtualCameras?: readonly DebugVirtualCamera[]; showContacts?: boolean; showCOM?: boolean; showInertia?: boolean; showTendons?: boolean; } interface IkGizmoProps { controller: IkContextValue; siteName?: string; scale?: number; onDrag?: (input: IkGizmoDragInput) => void; } interface IkGizmoDragInput { position: THREE.Vector3; quaternion: THREE.Quaternion; } type KeyboardIkTargetAction = 'x+' | 'x-' | 'y+' | 'y-' | 'z+' | 'z-' | 'pitch+' | 'pitch-' | 'yaw+' | 'yaw-' | 'roll+' | 'roll-'; interface KeyboardIkTargetBinding { /** KeyboardEvent.code, e.g. `KeyW`, `ArrowUp`, `Space`. */ code: string; action: KeyboardIkTargetAction; /** Override translation speed in meters/second for this binding. */ translateSpeed?: number; /** Override rotation speed in radians/second for this binding. */ rotateSpeed?: number; } interface KeyboardIkTargetConfig { controller: IkContextValue | null; bindings: KeyboardIkTargetBinding[]; enabled?: boolean; /** Default translation speed in meters/second. Default: 0.25. */ translateSpeed?: number; /** Default rotation speed in radians/second. Default: 1.0. */ rotateSpeed?: number; /** Apply translation and rotation axes in world or current target space. Default: `world`. */ frame?: 'world' | 'target'; /** Enable IK while keys are active. Default: true. */ autoEnableIk?: boolean; /** Sync target to current site when keyboard control starts. Default: true. */ syncOnStart?: boolean; /** Prevent browser default behavior for bound keys. Default: true. */ preventDefault?: boolean; } interface DragInteractionProps { stiffness?: number; showArrow?: boolean; } interface SceneLightsProps { /** Override intensity for all MJCF lights. Default: 1.0. */ intensity?: number; } type ScenarioLightingPreset = 'studio' | 'warehouse' | 'low-light' | 'splat'; type SplatFormat = 'spz' | 'ply' | 'splat'; type SplatRendererKind = 'spark' | 'custom'; type SplatCollisionPrimitive = 'plane' | 'box' | 'sphere' | 'capsule' | 'mesh'; interface ScenarioCameraConfig { jitter?: number; exposure?: number; noise?: number; blur?: number; } interface ScenarioMaterialConfig { randomizeObjectColors?: boolean; randomizeTableMaterial?: boolean; roughness?: number; metalness?: number; } interface SplatAssetConfig { src: string; /** Common browser-friendly splat format. Renderer-specific loaders may accept more. */ format?: SplatFormat; /** Optional renderer hint. The library does not import renderer-specific code. */ renderer?: SplatRendererKind; } interface SplatScenarioConfig { enabled: boolean; /** Common browser-friendly splat format. Renderer-specific loaders may accept more. */ format?: SplatFormat; src?: string; requiresCollisionProxy?: boolean; collisionProxy?: SplatCollisionProxyConfig | null; } interface SplatCollisionProxyConfig { /** MJCF/XML file or artifact path that provides physics collision for the visual splat. */ xmlPath?: string; /** Human-readable status for authoring and validation flows. */ status?: 'missing' | 'planned' | 'generated' | 'validated'; /** Primitive proxy shapes expected in the MJCF collision proxy. */ primitives?: SplatCollisionPrimitive[]; /** Optional notes that should travel with scene variants and rollout metadata. */ notes?: string[]; } interface PairedSplatEnvironmentConfig { id: string; label: string; description?: string; /** Visual-only Gaussian splat asset. */ splat: SplatAssetConfig; /** Optional MJCF/XML contact geometry paired with the visual splat. */ collisionProxy?: SplatCollisionProxyConfig & { xmlPath: string; }; } declare const SplatEnvironmentReadinessStatus: { readonly Disabled: "disabled"; readonly MissingSplat: "missing-splat"; readonly MissingCollisionProxy: "missing-collision-proxy"; readonly UnsupportedFormat: "unsupported-format"; readonly Ready: "ready"; }; type SplatEnvironmentReadinessStatus = (typeof SplatEnvironmentReadinessStatus)[keyof typeof SplatEnvironmentReadinessStatus]; interface SplatEnvironmentReadiness { status: SplatEnvironmentReadinessStatus; ready: boolean; requiresCollisionProxy: boolean; missing: Array<'splat' | 'collisionProxy'>; format?: SplatFormat; renderer?: SplatRendererKind; message: string; } interface SplatEnvironmentMetadataInput { environment?: PairedSplatEnvironmentConfig; scenario?: VisualScenarioConfig; renderer?: SplatRendererKind; src?: string; format?: SplatFormat; collisionProxy?: SplatCollisionProxyConfig; } interface SplatEnvironmentMetadata { src?: string; format: SplatFormat; collisionProxy?: SplatCollisionProxyConfig; readiness: SplatEnvironmentReadiness; userData: Record; } interface ResolvedScenarioCameraConfig { jitter: number; exposure: number; noise: number; blur: number; } interface ResolvedScenarioMaterialConfig { randomizeObjectColors: boolean; randomizeTableMaterial: boolean; roughness?: number; metalness?: number; } interface VisualScenarioExecutionContext { scenarioId: string; scenarioLabel: string; variantId?: string; seed: number; lighting: ScenarioLightingPreset; environment?: string; camera: ResolvedScenarioCameraConfig; materials: ResolvedScenarioMaterialConfig; splatEnabled: boolean; splatSrc?: string; splatFormat: SplatFormat; splatRenderer?: SplatRendererKind; collisionProxyXmlPath?: string; collisionProxyStatus?: SplatCollisionProxyConfig['status']; collisionProxyPrimitives: SplatCollisionPrimitive[]; readiness: SplatEnvironmentReadiness; transformSource: 'visualScenario.camera'; } interface VisualScenarioExecutionContextInput { scenario?: VisualScenarioConfig; environment?: PairedSplatEnvironmentConfig; renderer?: SplatRendererKind; variantId?: string; enabled?: boolean; } type SplatSceneInput = PairedSplatEnvironmentConfig | VisualScenarioConfig | undefined | null; interface SplatSceneConfigInput { sceneConfig: SceneConfig; scenario?: VisualScenarioConfig; environment?: PairedSplatEnvironmentConfig; enabled?: boolean; renderer?: SplatRendererKind; } interface SplatSceneConfigState { environment: PairedSplatEnvironmentConfig | undefined; sceneConfig: SceneConfig; enabled: boolean; readiness: SplatEnvironmentReadiness; } interface VisualScenarioConfig { id?: string; label?: string; seed?: number; lighting?: ScenarioLightingPreset; environment?: string; camera?: ScenarioCameraConfig; materials?: ScenarioMaterialConfig; splat?: SplatScenarioConfig | null; } interface ScenarioLightingProps { preset?: ScenarioLightingPreset; intensity?: number; castShadow?: boolean; } interface SplatEnvironmentProps extends Omit { environment?: PairedSplatEnvironmentConfig; scenario?: VisualScenarioConfig; renderer?: SplatRendererKind; src?: string; format?: SplatFormat; collisionProxy?: ReactNode; collisionProxyMetadata?: SplatCollisionProxyConfig; showPlaceholder?: boolean; } interface VisualScenarioEffectsProps { scenario?: VisualScenarioConfig; enabled?: boolean; applyBackground?: boolean; applyFog?: boolean; applyRenderer?: boolean; applyMaterials?: boolean; background?: THREE.ColorRepresentation; fogNear?: number; fogFar?: number; materialFilter?: (input: VisualScenarioMaterialFilterInput) => boolean; } interface VisualScenarioMaterialFilterInput { object: THREE.Object3D; material: THREE.Material; } type TrajectoryInput = TrajectoryFrame[] | number[][]; interface TrajectoryPlayerProps { trajectory: TrajectoryInput; fps?: number; speed?: number; loop?: boolean; playing?: boolean; mode?: 'kinematic' | 'physics'; onFrame?: (input: TrajectoryFrameCallbackInput) => void; onComplete?: () => void; onStateChange?: (input: TrajectoryStateChangeInput) => void; } interface TrajectoryFrameCallbackInput { frameIndex: number; frame: TrajectoryFrame | number[] | undefined; } interface TrajectoryStateChangeInput { state: PlaybackState; } interface ContactListenerProps { body: Bodies; onContactEnter?: (info: ContactInfo) => void; onContactExit?: (info: ContactInfo) => void; } interface BodyProps { name: Bodies; type: 'box' | 'sphere' | 'cylinder'; size: [number, number, number]; position?: [number, number, number]; rgba?: [number, number, number, number]; mass?: number; freejoint?: boolean; friction?: string; solref?: string; solimp?: string; condim?: number; /** MuJoCo geom group. Group 3 is conventionally used for collision-only helper geoms. */ group?: number; children?: ReactNode; } interface MujocoSimAPI { readonly status: 'loading' | 'ready' | 'error'; readonly config: SceneConfig; reset(): void; setSpeed(multiplier: number): void; togglePause(): boolean; setPaused(paused: boolean): void; step(n?: number): void; getTime(): number; getTimestep(): number; applyKeyframe(nameOrIndex: Keyframes | number): void; saveState(): StateSnapshot; restoreState(snapshot: StateSnapshot): void; setQpos(values: Float64Array | number[]): void; setQvel(values: Float64Array | number[]): void; getQpos(): Float64Array; getQvel(): Float64Array; setCtrl(nameOrValues: Actuators | Record, value?: number): void; getCtrl(): Float64Array; getControlMap(): ControlGroupInfo; getActuatedJoints(): ActuatedJointInfo[]; resolveControlGroup(selector: ControlGroupSelector): ControlGroupInfo | null; applyForce(bodyName: Bodies, force: THREE.Vector3, point?: THREE.Vector3): void; applyTorque(bodyName: Bodies, torque: THREE.Vector3): void; setExternalForce(bodyName: Bodies, force: THREE.Vector3, torque: THREE.Vector3): void; applyGeneralizedForce(values: Float64Array | number[]): void; getSensorData(name: Sensors): Float64Array | null; getContacts(): ContactInfo[]; getBodies(): BodyInfo[]; getJoints(): JointInfo[]; getGeoms(): GeomInfo[]; getSites(): SiteInfo[]; getActuators(): ActuatorInfo[]; getSensors(): SensorInfo[]; getCameras(): CameraInfo[]; getModelOption(): ModelOptions; setGravity(g: [number, number, number]): void; setTimestep(dt: number): void; raycast(origin: THREE.Vector3, direction: THREE.Vector3, maxDist?: number): RayHit | null; getKeyframeNames(): string[]; getKeyframeCount(): number; loadScene(newConfig: SceneConfig): Promise; loadFromFiles(files: FileList | readonly LocalMujocoFile[], options?: LoadFromFilesOptions): Promise; addBody(body: SceneObject): Promise; removeBody(name: Bodies): Promise; recompile(patches?: XmlPatch[]): Promise; getCanvas(): HTMLCanvasElement | null; getCanvasSnapshot(width?: number, height?: number, mimeType?: string): string; captureFrame(options?: MujocoFrameCaptureOptions): Promise; captureFrameBlob(options?: MujocoFrameCaptureOptions): Promise; captureCameraFrame(options?: CameraFrameCaptureOptions): Promise; captureCameraFrameBlob(options?: CameraFrameCaptureOptions): Promise; /** Capture a camera frame straight into a policy image tensor (no canvas/PNG encode). */ captureCameraFrameTensor(options?: CameraFrameCaptureTensorOptions): CameraFrameTensorResult; /** * Create a reusable offscreen capture session bound to this scene. Reuse it * for live inference/recording so the render target and buffers persist * across frames; call `session.captureTensor()` / `capturePixels()` each step. */ createCameraFrameCaptureSession(options?: CameraFrameCaptureOptions): CameraFrameCaptureSession; /** * Resolve a named MuJoCo camera/site/body into concrete capture options with * the current world pose. Useful for re-aiming a persistent session each step. */ resolveCameraCaptureOptions(options?: CameraFrameCaptureOptions): CameraFrameCaptureOptions; recordCameraSequence(options: CameraFrameSequenceOptions): Promise; project2DTo3D(x: number, y: number, cameraPos: THREE.Vector3, lookAt: THREE.Vector3): { point: THREE.Vector3; bodyId: number; geomId: number; } | null; projectImagePointTo3D(options: ImagePointProjectionOptions): ImagePointProjectionResult | null; setBodyMass(name: Bodies, mass: number): void; setGeomFriction(name: Geoms, friction: [number, number, number]): void; setGeomSize(name: Geoms, size: [number, number, number]): void; readonly mjModelRef: React__default.RefObject; readonly mjDataRef: React__default.RefObject; } type FrameCaptureStatus = 'idle' | 'capturing' | 'captured' | 'error'; type FrameCaptureTarget = HTMLCanvasElement | HTMLElement | null | undefined; type FrameCaptureTargetRef = React__default.RefObject; interface FrameCaptureOptions { target?: FrameCaptureTarget | FrameCaptureTargetRef; type?: string; quality?: number; waitForAnimationFrame?: boolean; } type MujocoFrameCaptureOptions = Omit; interface FrameCaptureResult { canvas: HTMLCanvasElement; dataUrl: string; type: string; } interface FrameCaptureBlobResult { canvas: HTMLCanvasElement; blob: Blob; type: string; } interface FrameCaptureAPI { status: FrameCaptureStatus; error: Error | null; isCapturing: boolean; capture: (options?: FrameCaptureOptions) => Promise; captureBlob: (options?: FrameCaptureOptions) => Promise; reset: () => void; } type CameraFrameCaptureVector3 = THREE.Vector3 | readonly [number, number, number]; type CameraFrameCaptureQuaternion = THREE.Quaternion | readonly [number, number, number, number]; interface CameraFrameVisualOverrides { /** * Override `scene.background` for this capture only. * Use `null` or `false` to render without the viewer scene background. */ sceneBackground?: THREE.Scene['background'] | THREE.ColorRepresentation | null | false; /** * Override `scene.environment` for this capture only. * Use `null` or `false` to remove viewer environment lighting/maps. */ sceneEnvironment?: THREE.Scene['environment'] | null | false; /** * Override `scene.fog` for this capture only. * Use `null` or `false` to remove viewer fog. */ sceneFog?: THREE.Scene['fog'] | null | false; /** Override `renderer.shadowMap.enabled` while capturing. */ shadows?: boolean; /** Override renderer tone mapping while capturing. */ toneMapping?: THREE.WebGLRenderer['toneMapping']; /** Override renderer output color space while capturing. */ outputColorSpace?: THREE.WebGLRenderer['outputColorSpace']; } interface CameraFrameRenderIsolationOptions { /** * Use an independent offscreen WebGLRenderer for this capture. * * This prevents viewer renderer settings such as antialiasing, shadow-map * configuration, tone mapping, and environment setup from leaking into * policy/training images. Leave unset for the historical shared-renderer path. */ enabled?: boolean; /** Offscreen renderer antialiasing. Defaults to false for deterministic policy captures. */ antialias?: boolean; /** Offscreen renderer alpha buffer. Defaults to false, matching Three.js WebGLRenderer. */ alpha?: boolean; /** Offscreen renderer preserveDrawingBuffer flag. Defaults to false. */ preserveDrawingBuffer?: boolean; /** Offscreen renderer power preference. Defaults to the browser's renderer default. */ powerPreference?: WebGLPowerPreference; /** Reuse an offscreen renderer for matching capture dimensions/options. Defaults to true. */ cache?: boolean; } interface CameraFrameCaptureOptions { /** Existing Three camera to clone before applying pose overrides. */ camera?: THREE.Camera; /** Named MuJoCo `` to render from when available in the loaded model. */ cameraName?: Cameras; /** Named MuJoCo site to use as the rendered camera pose. Useful for robot-mounted optical frames. */ siteName?: Sites; /** Named MuJoCo body to use as the rendered camera pose. */ bodyName?: Bodies; position?: CameraFrameCaptureVector3; lookAt?: CameraFrameCaptureVector3; quaternion?: CameraFrameCaptureQuaternion; up?: CameraFrameCaptureVector3; /** Local-space offset applied after resolving a mounted MuJoCo camera/site/body pose. */ positionOffset?: CameraFrameCaptureVector3; /** Local-space rotation applied after resolving a mounted MuJoCo camera/site/body pose. Array values use Three.js order: [x, y, z, w]. */ quaternionOffset?: CameraFrameCaptureQuaternion; width?: number; height?: number; type?: string; quality?: number; fov?: number; near?: number; far?: number; /** * Explicit projection matrix for offscreen capture. This is useful when a * MuJoCo camera has calibrated intrinsics that cannot be represented by a * symmetric Three.js PerspectiveCamera fov alone. */ projectionMatrix?: THREE.Matrix4 | readonly number[]; /** Provenance for the camera pose used by the capture. Usually set by the MuJoCo provider. */ source?: CameraFrameCaptureSource; /** * When resolving a named MuJoCo camera, derive Three capture settings from * MuJoCo camera metadata where available: cam_resolution, cam_fovy, * cam_intrinsic/cam_sensorsize, and visual map near/far clipping. */ mujocoCameraCompatibility?: boolean | { useResolution?: boolean; useIntrinsics?: boolean; useClipping?: boolean; /** * When a MuJoCo camera has `resolution` metadata and the caller supplies * only width or only height, derive the missing dimension from the MuJoCo * camera aspect ratio. */ preserveAspect?: boolean; /** * Prefer the MuJoCo camera's configured resolution over width/height * provided by the caller. Leave false when a policy wants fixed-size * payloads while still preserving the camera aspect ratio. */ preferResolution?: boolean; }; /** Hide rendered Three objects whose MuJoCo geom group is in this list. */ hiddenGeomGroups?: readonly number[]; /** When provided, only rendered Three objects whose MuJoCo geom group is in this list are visible. */ visibleGeomGroups?: readonly number[]; /** Hide rendered Three objects whose MuJoCo geom name is in this list. */ hiddenGeomNames?: readonly string[]; /** Optional clear color for this capture only. Defaults to the renderer's current clear color. */ background?: THREE.ColorRepresentation; /** Optional clear alpha for this capture only. Defaults to the renderer's current clear alpha. */ backgroundAlpha?: number; /** Temporary scene/renderer visual overrides applied only for this offscreen capture. */ visualOverrides?: CameraFrameVisualOverrides; /** * Render this capture with a separate offscreen WebGLRenderer. * * This is useful for policy or training captures that should remain canonical * while the interactive viewer uses richer visual effects. */ renderIsolation?: boolean | CameraFrameRenderIsolationOptions; /** Mirror the captured image horizontally after rendering. Useful when matching policy datasets with mirrored camera frames. */ flipX?: boolean; } type CameraFrameCaptureSource = { kind: 'mujoco-camera'; cameraName: Cameras; } | { kind: 'mujoco-site'; siteName: Sites; } | { kind: 'mujoco-body'; bodyName: Bodies; } | { kind: 'custom-camera'; } | { kind: 'explicit-pose'; } | { kind: 'fallback-camera'; }; interface CameraFrameCaptureResult { canvas: HTMLCanvasElement; camera: THREE.Camera; dataUrl: string; type: string; width: number; height: number; source: CameraFrameCaptureSource; } interface CameraFrameCaptureBlobResult { canvas: HTMLCanvasElement; camera: THREE.Camera; blob: Blob; type: string; width: number; height: number; source: CameraFrameCaptureSource; } interface CameraFrameCaptureAPI { status: FrameCaptureStatus; error: Error | null; isCapturing: boolean; capture: (options?: CameraFrameCaptureOptions) => Promise; captureBlob: (options?: CameraFrameCaptureOptions) => Promise; reset: () => void; } interface CameraFrameSequenceCamera extends CameraFrameCaptureOptions { key: string; } interface CameraFrameSequenceFrame { frameIndex: number; time: number; cameras: Record; } interface CameraFrameSequenceCameraSummary { key: string; width: number; height: number; source: CameraFrameCaptureSource; frameCount: number; firstFrameIndex: number | null; lastFrameIndex: number | null; firstTimestamp: number | null; lastTimestamp: number | null; } interface CameraFrameSequenceSampleInput extends PhysicsStepInput { frameIndex: number; time: number; } interface CameraFrameSequenceStepInput extends PhysicsStepInput { frameIndex: number; stepIndex: number; time: number; } interface CameraFrameSequenceOptions { cameras: readonly CameraFrameSequenceCamera[]; frames: number; /** Number of MuJoCo steps between captured frames. Use 0 for static camera provenance captures. */ stepsPerFrame?: number; reset?: boolean; captureInitialFrame?: boolean; retainFrames?: boolean; /** * Require each recorded stream to resolve from exactly one mounted MuJoCo * camera/site/body selector. Defaults to true because sequence recording is * intended for dataset/policy camera streams. */ requireMountedSources?: boolean; signal?: AbortSignal; /** Called after stepping and before image capture for this frame. Use this to record synchronized state/action rows. */ onSample?: (input: CameraFrameSequenceSampleInput) => void | Promise; /** Called before each MuJoCo step inside sequence recording. Use this to apply policy/control actions. */ onBeforeStep?: (input: CameraFrameSequenceStepInput) => void | Promise; /** Called after each MuJoCo step inside sequence recording. Use this for step-level telemetry. */ onAfterStep?: (input: CameraFrameSequenceStepInput) => void | Promise; onFrame?: (frame: CameraFrameSequenceFrame) => void | Promise; } interface CameraFrameSequenceResult { frames: CameraFrameSequenceFrame[]; cameraKeys: string[]; cameraSummaries: Record; frameCount: number; } interface CameraFrameSequenceRecorderAPI { status: FrameCaptureStatus; error: Error | null; isRecording: boolean; record: (options: CameraFrameSequenceOptions) => Promise; reset: () => void; } type MujocoMeshNormalSmoothing = boolean | { /** Vertex merge tolerance used before recomputing mesh normals. Defaults to `1e-4`. */ tolerance?: number; }; interface MujocoRenderOptions { /** * Smooth mesh normals by welding duplicate vertices before recomputing normals. * Useful for faceted STL visuals; keep off for exact policy-render parity. */ meshNormalSmoothing?: MujocoMeshNormalSmoothing; } type MujocoCanvasProps = Omit & { config: SceneConfig; /** R3F content rendered while the MuJoCo WASM module is still loading. */ loadingFallback?: ReactNode; onReady?: (input: ReadyCallbackInput) => void; onError?: (error: Error) => void; onStep?: (input: StepCallbackInput) => void; onSelection?: (input: SelectionCallbackInput) => void; gravity?: [number, number, number]; timestep?: number; substeps?: number; paused?: boolean; speed?: number; interpolate?: boolean; renderOptions?: MujocoRenderOptions; /** * Names of model bodies whose geometry should not be rendered. The bodies stay * in the compiled model and continue to simulate — only their meshes are * skipped at scene-build time, so body/joint/actuator indices are unchanged. * Applied on every (re)build, so toggling names cannot be lost to a rebuild. */ hiddenBodies?: readonly string[]; }; interface SitePositionResult { position: React__default.RefObject; quaternion: React__default.RefObject; } interface MujocoContextValue { mujoco: MujocoModule | null; status: 'loading' | 'ready' | 'error'; error: string | null; } /** @deprecated Use `SensorHandle` instead. */ interface SensorResult { value: React__default.RefObject; size: number; } interface CtrlHandle { /** Read the current ctrl value. */ read(): number; /** Write a ctrl value (goes directly to data.ctrl). */ write(value: number): void; /** Actuator name. */ name: Actuators; /** Actuator control range [min, max]. */ range: [number, number]; } interface SensorHandle { /** Read the current sensor data. */ read(): Float64Array; /** Sensor dimensionality. */ dim: number; /** Sensor name. */ name: Sensors; } interface BodyStateResult { position: React__default.RefObject; quaternion: React__default.RefObject; linearVelocity: React__default.RefObject; angularVelocity: React__default.RefObject; } type JointStateKind = 'auto' | 'scalar' | 'array'; interface JointStateOptions { /** * Expected joint value shape. * * - `auto`: scalar joints return numbers, ball/free joints return Float64Array. * - `scalar`: return numeric refs for hinge/slide joints. * - `array`: return Float64Array refs for ball/free joints. */ kind?: JointStateKind; } interface JointStateResult { position: React__default.RefObject; velocity: React__default.RefObject; } interface ScalarJointStateResult { position: React__default.RefObject; velocity: React__default.RefObject; } interface ArrayJointStateResult { position: React__default.RefObject; velocity: React__default.RefObject; } export { type Joints as $, type ActuatedJointInfo as A, type BodyProps as B, type ControlGroupInfo as C, type DragInteractionProps as D, type VisualScenarioExecutionContext as E, type ScenarioLightingPreset as F, type SplatEnvironmentMetadataInput as G, type SplatEnvironmentMetadata as H, type IkConfig as I, type SplatSceneInput as J, type CameraFrameCaptureOptions as K, type DebugProps as L, type MujocoContextValue as M, type GeomInfo as N, type ObservationConfig as O, type PhysicsStepCallback as P, type ContactListenerProps as Q, type ReadyCallbackInput as R, type SceneConfig as S, type TrajectoryPlayerProps as T, type ActuatorInfo as U, type VisualScenarioEffectsProps as V, type Sites as W, type SitePositionResult as X, type Sensors as Y, type SensorHandle as Z, type SensorInfo as _, type MujocoCanvasProps as a, type IKSolveFn as a$, type ScalarJointStateResult as a0, type ArrayJointStateResult as a1, type JointStateOptions as a2, type JointStateResult as a3, type Bodies as a4, type BodyStateResult as a5, type Geoms as a6, type Actuators as a7, type CtrlHandle as a8, type ContactInfo as a9, type PolicyCameraFrameCaptureAPI as aA, type CameraFrameCaptureTensorOptions as aB, type CameraFrameTensorResult as aC, type CameraFrameSequenceRecorderAPI as aD, type ImagePointCoordinateSpace as aE, type ImagePointProjectionOptions as aF, type ImagePointProjectionResult as aG, type PolicyVector as aH, type BodyInfo as aI, CAMERA_FRAME_CAPTURE_PRE_RENDER_USER_DATA_KEY as aJ, CAMERA_FRAME_CAPTURE_RENDER_USER_DATA_KEY as aK, CAPTURE_EXCLUDE_KEY as aL, type CameraFrameCaptureBlobResult as aM, type CameraFrameCaptureQuaternion as aN, type CameraFrameCaptureResult as aO, type CameraFrameCaptureSession as aP, type CameraFrameCaptureVector3 as aQ, type CameraFramePixelsResult as aR, type CameraFrameSequenceCameraSummary as aS, type CameraFrameSequenceFrame as aT, type CameraFrameSequenceSampleInput as aU, type CameraFrameSequenceStepInput as aV, type CameraInfo as aW, type ControlJointInfo as aX, type DebugVirtualCamera as aY, type FrameCaptureTarget as aZ, type FrameCaptureTargetRef as a_, type KeyboardTeleopConfig as aa, type KeyboardIkTargetConfig as ab, type PolicyConfig as ac, type PolicyAPI as ad, type RemotePolicyConfig as ae, type RemotePolicyAPI as af, type ObservationHandle as ag, type ObservationOutput as ah, type TrajectoryInput as ai, type TrajectoryStateChangeInput as aj, type PlaybackState as ak, type TrajectoryFrame as al, type FrameCaptureOptions as am, type FrameCaptureResult as an, type FrameCaptureBlobResult as ao, type FrameCaptureAPI as ap, type CameraFrameCaptureAPI as aq, type Cameras as ar, type CameraFrameSequenceCamera as as, type CameraFrameCaptureSource as at, type CameraFrameSequenceOptions as au, type CameraFrameSequenceResult as av, type PolicyCameraFrameStream as aw, type PolicyCameraFrameCaptureOptions as ax, type PolicyCameraFrameCaptureResult as ay, type FrameCaptureStatus as az, type MujocoSimAPI as b, captureCameraFrameBlob as b$, type IkGizmoDragInput as b0, type IkSolveInput as b1, type JointInfo as b2, type JointStateKind as b3, type KeyBinding as b4, type KeyboardIkTargetAction as b5, type KeyboardIkTargetBinding as b6, type Keyframes as b7, ModelActuators as b8, ModelBodies as b9, type PolicyInferenceResult as bA, type PolicyObservationInput as bB, type RayHit as bC, type Register as bD, type RegisteredModelMap as bE, type RemotePolicyRequestInfo as bF, type RemotePolicyRequestInput as bG, type RemotePolicyResponseInfo as bH, type RemotePolicyStatus as bI, type ResetCallbackInput as bJ, type ResolvedScenarioCameraConfig as bK, type ResolvedScenarioMaterialConfig as bL, type ResourceSelector as bM, type ScenarioCameraConfig as bN, type ScenarioMaterialConfig as bO, type SceneMarker as bP, type SceneObject as bQ, type SensorResult as bR, type SiteInfo as bS, type SplatAssetConfig as bT, type SplatScenarioConfig as bU, type StateSnapshot as bV, type TrajectoryData as bW, type TrajectoryFrameCallbackInput as bX, type VisualScenarioMaterialFilterInput as bY, type XmlPatch as bZ, captureCameraFrame as b_, ModelCameras as ba, ModelGeoms as bb, ModelJoints as bc, ModelKeyframes as bd, type ModelOptions as be, type ModelResource as bf, ModelResources as bg, ModelSensors as bh, ModelSites as bi, type Models as bj, type MujocoContact as bk, type MujocoContactArray as bl, type MujocoFrameCaptureOptions as bm, type ObservationLayoutItem as bn, type PhysicsConfig as bo, type PhysicsStepInput as bp, type PolicyActionChunk as bq, type PolicyActionInput as br, type PolicyImageTensorLayout as bs, type PolicyImageTensorOptions as bt, type PolicyImageTensorPixelOptions as bu, type PolicyImageTensorRange as bv, type PolicyImageTensorResult as bw, type PolicyImageTensorSourceOrigin as bx, type PolicyInferenceInput as by, type PolicyInferenceOutput as bz, type StepCallbackInput as c, captureCameraFrameTensor as c0, createCameraFrameCaptureSession as c1, dataUrlToPolicyImageTensor as c2, getContact as c3, imageDataToPolicyImageTensor as c4, pixelsToPolicyImageTensor as c5, registerModelResources as c6, renderCameraFrameToCanvas as c7, type SelectionCallbackInput as d, type MujocoModule as e, type MujocoRenderOptions as f, type MujocoModel as g, type MujocoData as h, type ControlGroupSelector as i, type ObservationResult as j, type IkContextValue as k, type IkGizmoProps as l, type SceneLightsProps as m, type ScenarioLightingProps as n, type SplatEnvironmentProps as o, type VisualScenarioConfig as p, type SplatRendererKind as q, type PairedSplatEnvironmentConfig as r, type SplatFormat as s, type SplatCollisionProxyConfig as t, type SplatEnvironmentReadiness as u, type SplatCollisionPrimitive as v, SplatEnvironmentReadinessStatus as w, type SplatSceneConfigInput as x, type SplatSceneConfigState as y, type VisualScenarioExecutionContextInput as z };