@vgai/engine 0.5.4 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (448) hide show
  1. package/dist/adapter/adapter-surface.d.ts +30 -0
  2. package/dist/adapter/adapter-surface.d.ts.map +1 -0
  3. package/dist/adapter/adapter-surface.js +18 -0
  4. package/dist/adapter/authoring.d.ts +597 -0
  5. package/dist/adapter/authoring.d.ts.map +1 -0
  6. package/dist/adapter/authoring.js +22 -0
  7. package/dist/adapter/colyseus-networking-adapter.d.ts +77 -0
  8. package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -0
  9. package/dist/adapter/colyseus-networking-adapter.js +76 -0
  10. package/dist/adapter/first-party-systems.d.ts +23 -0
  11. package/dist/adapter/first-party-systems.d.ts.map +1 -0
  12. package/dist/adapter/first-party-systems.js +196 -0
  13. package/dist/adapter/host-context.d.ts +194 -0
  14. package/dist/adapter/host-context.d.ts.map +1 -0
  15. package/dist/adapter/host-context.js +80 -0
  16. package/dist/adapter/index.d.ts +33 -0
  17. package/dist/adapter/index.d.ts.map +1 -0
  18. package/dist/adapter/index.js +25 -0
  19. package/dist/adapter/ingest/game-contract.d.ts +53 -0
  20. package/dist/adapter/ingest/game-contract.d.ts.map +1 -0
  21. package/dist/adapter/ingest/game-contract.js +30 -0
  22. package/dist/adapter/ingest/scene-capture.d.ts +121 -0
  23. package/dist/adapter/ingest/scene-capture.d.ts.map +1 -0
  24. package/dist/adapter/ingest/scene-capture.js +270 -0
  25. package/dist/adapter/ingest/structural-ids.d.ts +64 -0
  26. package/dist/adapter/ingest/structural-ids.d.ts.map +1 -0
  27. package/dist/adapter/ingest/structural-ids.js +110 -0
  28. package/dist/adapter/ingest/upstream-pin.d.ts +44 -0
  29. package/dist/adapter/ingest/upstream-pin.d.ts.map +1 -0
  30. package/dist/adapter/ingest/upstream-pin.js +47 -0
  31. package/dist/adapter/loop-gate-report.d.ts +34 -0
  32. package/dist/adapter/loop-gate-report.d.ts.map +1 -0
  33. package/dist/adapter/loop-gate-report.js +37 -0
  34. package/dist/adapter/rapier-physics-adapter.d.ts +69 -0
  35. package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -0
  36. package/dist/adapter/rapier-physics-adapter.js +135 -0
  37. package/dist/adapter/root-adapter.d.ts +195 -0
  38. package/dist/adapter/root-adapter.d.ts.map +1 -0
  39. package/dist/adapter/root-adapter.js +25 -0
  40. package/dist/adapter/setup-three-root-adapter.d.ts +87 -0
  41. package/dist/adapter/setup-three-root-adapter.d.ts.map +1 -0
  42. package/dist/adapter/setup-three-root-adapter.js +791 -0
  43. package/dist/adapter/system-adapter.d.ts +453 -0
  44. package/dist/adapter/system-adapter.d.ts.map +1 -0
  45. package/dist/adapter/system-adapter.js +13 -0
  46. package/dist/adapter/transform.d.ts +18 -0
  47. package/dist/adapter/transform.d.ts.map +1 -0
  48. package/dist/adapter/transform.js +1 -0
  49. package/dist/ai/navigation.d.ts +78 -0
  50. package/dist/ai/navigation.d.ts.map +1 -0
  51. package/dist/ai/navigation.js +152 -0
  52. package/dist/animation/anim-graph-types.d.ts +25 -0
  53. package/dist/animation/anim-graph-types.d.ts.map +1 -0
  54. package/dist/animation/anim-graph-types.js +1 -0
  55. package/dist/animation/animation-clock.d.ts +213 -0
  56. package/dist/animation/animation-clock.d.ts.map +1 -0
  57. package/dist/animation/animation-clock.js +301 -0
  58. package/dist/animation/blend-node.d.ts +22 -0
  59. package/dist/animation/blend-node.d.ts.map +1 -0
  60. package/dist/animation/blend-node.js +97 -0
  61. package/dist/animation/camera-ownership.d.ts +249 -0
  62. package/dist/animation/camera-ownership.d.ts.map +1 -0
  63. package/dist/animation/camera-ownership.js +169 -0
  64. package/dist/animation/cinematic-cues.d.ts +200 -0
  65. package/dist/animation/cinematic-cues.d.ts.map +1 -0
  66. package/dist/animation/cinematic-cues.js +213 -0
  67. package/dist/animation/clip-map.d.ts +12 -0
  68. package/dist/animation/clip-map.d.ts.map +1 -0
  69. package/dist/animation/clip-map.js +31 -0
  70. package/dist/animation/cubic-spline-interpolant.d.ts +54 -0
  71. package/dist/animation/cubic-spline-interpolant.d.ts.map +1 -0
  72. package/dist/animation/cubic-spline-interpolant.js +111 -0
  73. package/dist/animation/theatre-clock-binding.d.ts +89 -0
  74. package/dist/animation/theatre-clock-binding.d.ts.map +1 -0
  75. package/dist/animation/theatre-clock-binding.js +29 -0
  76. package/dist/animation/theatre-director.d.ts +277 -0
  77. package/dist/animation/theatre-director.d.ts.map +1 -0
  78. package/dist/animation/theatre-director.js +248 -0
  79. package/dist/animation/theatre-object-binding.d.ts +305 -0
  80. package/dist/animation/theatre-object-binding.d.ts.map +1 -0
  81. package/dist/animation/theatre-object-binding.js +351 -0
  82. package/dist/animation/xstate-animation-binding.d.ts +119 -0
  83. package/dist/animation/xstate-animation-binding.d.ts.map +1 -0
  84. package/dist/animation/xstate-animation-binding.js +349 -0
  85. package/dist/animation/xstate-animation-meta.d.ts +266 -0
  86. package/dist/animation/xstate-animation-meta.d.ts.map +1 -0
  87. package/dist/animation/xstate-animation-meta.js +252 -0
  88. package/dist/asset-formats/camera.d.ts +15 -0
  89. package/dist/asset-formats/camera.d.ts.map +1 -0
  90. package/dist/asset-formats/camera.js +15 -0
  91. package/dist/asset-formats/collider.d.ts +21 -0
  92. package/dist/asset-formats/collider.d.ts.map +1 -0
  93. package/dist/asset-formats/collider.js +53 -0
  94. package/dist/asset-formats/index.d.ts +46 -0
  95. package/dist/asset-formats/index.d.ts.map +1 -0
  96. package/dist/asset-formats/index.js +36 -0
  97. package/dist/asset-formats/instances.d.ts +17 -0
  98. package/dist/asset-formats/instances.d.ts.map +1 -0
  99. package/dist/asset-formats/instances.js +31 -0
  100. package/dist/asset-formats/light.d.ts +21 -0
  101. package/dist/asset-formats/light.d.ts.map +1 -0
  102. package/dist/asset-formats/light.js +35 -0
  103. package/dist/asset-formats/material.d.ts +129 -0
  104. package/dist/asset-formats/material.d.ts.map +1 -0
  105. package/dist/asset-formats/material.js +88 -0
  106. package/dist/asset-formats/mesh.d.ts +22 -0
  107. package/dist/asset-formats/mesh.d.ts.map +1 -0
  108. package/dist/asset-formats/mesh.js +64 -0
  109. package/dist/asset-formats/parse.d.ts +20 -0
  110. package/dist/asset-formats/parse.d.ts.map +1 -0
  111. package/dist/asset-formats/parse.js +34 -0
  112. package/dist/asset-formats/particles.d.ts +1390 -0
  113. package/dist/asset-formats/particles.d.ts.map +1 -0
  114. package/dist/asset-formats/particles.js +319 -0
  115. package/dist/asset-formats/render-env.d.ts +387 -0
  116. package/dist/asset-formats/render-env.d.ts.map +1 -0
  117. package/dist/asset-formats/render-env.js +300 -0
  118. package/dist/asset-formats/tuples.d.ts +12 -0
  119. package/dist/asset-formats/tuples.d.ts.map +1 -0
  120. package/dist/asset-formats/tuples.js +14 -0
  121. package/dist/asset-loaders.d.ts +97 -0
  122. package/dist/asset-loaders.d.ts.map +1 -0
  123. package/dist/asset-loaders.js +209 -0
  124. package/dist/asset-parse-error.d.ts +24 -0
  125. package/dist/asset-parse-error.d.ts.map +1 -0
  126. package/dist/asset-parse-error.js +29 -0
  127. package/dist/asset-registry.d.ts +38 -0
  128. package/dist/asset-registry.d.ts.map +1 -0
  129. package/dist/asset-registry.js +66 -0
  130. package/dist/assets.d.ts +26 -0
  131. package/dist/assets.d.ts.map +1 -0
  132. package/dist/assets.js +55 -0
  133. package/dist/audio/wav-encode.d.ts +38 -0
  134. package/dist/audio/wav-encode.d.ts.map +1 -0
  135. package/dist/audio/wav-encode.js +97 -0
  136. package/dist/canvas-react/engine-bridge.d.ts +45 -0
  137. package/dist/canvas-react/engine-bridge.d.ts.map +1 -0
  138. package/dist/canvas-react/engine-bridge.js +45 -0
  139. package/dist/canvas-react/index.d.ts +42 -0
  140. package/dist/canvas-react/index.d.ts.map +1 -0
  141. package/dist/canvas-react/index.js +41 -0
  142. package/dist/canvas-react/pixi-primitive.d.ts +85 -0
  143. package/dist/canvas-react/pixi-primitive.d.ts.map +1 -0
  144. package/dist/canvas-react/pixi-primitive.js +181 -0
  145. package/dist/canvas-react/pixi-react-adapter.d.ts +71 -0
  146. package/dist/canvas-react/pixi-react-adapter.d.ts.map +1 -0
  147. package/dist/canvas-react/pixi-react-adapter.js +229 -0
  148. package/dist/canvas-react/pixi-react-root-factory.d.ts +56 -0
  149. package/dist/canvas-react/pixi-react-root-factory.d.ts.map +1 -0
  150. package/dist/canvas-react/pixi-react-root-factory.js +73 -0
  151. package/dist/canvas-react/world-context.d.ts +88 -0
  152. package/dist/canvas-react/world-context.d.ts.map +1 -0
  153. package/dist/canvas-react/world-context.js +212 -0
  154. package/dist/config.d.ts +9 -0
  155. package/dist/config.d.ts.map +1 -0
  156. package/dist/config.js +8 -0
  157. package/dist/core/frame-pacing.d.ts +90 -0
  158. package/dist/core/frame-pacing.d.ts.map +1 -0
  159. package/dist/core/frame-pacing.js +89 -0
  160. package/dist/core/game-loop.d.ts +62 -0
  161. package/dist/core/game-loop.d.ts.map +1 -0
  162. package/dist/core/game-loop.js +189 -0
  163. package/dist/core/seeded-random.d.ts +69 -0
  164. package/dist/core/seeded-random.d.ts.map +1 -0
  165. package/dist/core/seeded-random.js +121 -0
  166. package/dist/core/sim-clock.d.ts +199 -0
  167. package/dist/core/sim-clock.d.ts.map +1 -0
  168. package/dist/core/sim-clock.js +291 -0
  169. package/dist/core/system-runner.d.ts +96 -0
  170. package/dist/core/system-runner.d.ts.map +1 -0
  171. package/dist/core/system-runner.js +253 -0
  172. package/dist/core/types.d.ts +111 -0
  173. package/dist/core/types.d.ts.map +1 -0
  174. package/dist/core/types.js +25 -0
  175. package/dist/data/data-asset.d.ts +101 -0
  176. package/dist/data/data-asset.d.ts.map +1 -0
  177. package/dist/data/data-asset.js +122 -0
  178. package/dist/data/data-check-core.d.ts +109 -0
  179. package/dist/data/data-check-core.d.ts.map +1 -0
  180. package/dist/data/data-check-core.js +177 -0
  181. package/dist/data/data-ref.d.ts +79 -0
  182. package/dist/data/data-ref.d.ts.map +1 -0
  183. package/dist/data/data-ref.js +130 -0
  184. package/dist/data/vite-plugin-data.d.ts +79 -0
  185. package/dist/data/vite-plugin-data.d.ts.map +1 -0
  186. package/dist/data/vite-plugin-data.js +217 -0
  187. package/dist/defaults.d.ts +233 -0
  188. package/dist/defaults.d.ts.map +1 -0
  189. package/dist/defaults.js +137 -0
  190. package/dist/dev/chrome-trace.d.ts +45 -0
  191. package/dist/dev/chrome-trace.d.ts.map +1 -0
  192. package/dist/dev/chrome-trace.js +114 -0
  193. package/dist/dev/console-bridge.d.ts +22 -0
  194. package/dist/dev/console-bridge.d.ts.map +1 -0
  195. package/dist/dev/console-bridge.js +71 -0
  196. package/dist/dev/debug-draw.d.ts +24 -0
  197. package/dist/dev/debug-draw.d.ts.map +1 -0
  198. package/dist/dev/debug-draw.js +73 -0
  199. package/dist/dev/instruments.d.ts +133 -0
  200. package/dist/dev/instruments.d.ts.map +1 -0
  201. package/dist/dev/instruments.js +231 -0
  202. package/dist/dev/logger.d.ts +30 -0
  203. package/dist/dev/logger.d.ts.map +1 -0
  204. package/dist/dev/logger.js +90 -0
  205. package/dist/dev/performance-profiler.d.ts +111 -0
  206. package/dist/dev/performance-profiler.d.ts.map +1 -0
  207. package/dist/dev/performance-profiler.js +215 -0
  208. package/dist/dev/render-debug-adapter.d.ts +57 -0
  209. package/dist/dev/render-debug-adapter.d.ts.map +1 -0
  210. package/dist/dev/render-debug-adapter.js +141 -0
  211. package/dist/dev/render-memory.d.ts +53 -0
  212. package/dist/dev/render-memory.d.ts.map +1 -0
  213. package/dist/dev/render-memory.js +190 -0
  214. package/dist/dev/webgl-frame-capture.d.ts +134 -0
  215. package/dist/dev/webgl-frame-capture.d.ts.map +1 -0
  216. package/dist/dev/webgl-frame-capture.js +270 -0
  217. package/dist/dev/webgl-gpu-timer.d.ts +8 -0
  218. package/dist/dev/webgl-gpu-timer.d.ts.map +1 -0
  219. package/dist/dev/webgl-gpu-timer.js +52 -0
  220. package/dist/ecs/scene-index.d.ts +179 -0
  221. package/dist/ecs/scene-index.d.ts.map +1 -0
  222. package/dist/ecs/scene-index.js +331 -0
  223. package/dist/ecs/scene-query.d.ts +6 -0
  224. package/dist/ecs/scene-query.d.ts.map +1 -0
  225. package/dist/ecs/scene-query.js +40 -0
  226. package/dist/ecs/user-data.d.ts +193 -0
  227. package/dist/ecs/user-data.d.ts.map +1 -0
  228. package/dist/ecs/user-data.js +145 -0
  229. package/dist/index.d.ts +35 -0
  230. package/dist/index.d.ts.map +1 -0
  231. package/dist/index.js +29 -0
  232. package/dist/input/input-manager.d.ts +944 -0
  233. package/dist/input/input-manager.d.ts.map +1 -0
  234. package/dist/input/input-manager.js +2209 -0
  235. package/dist/input/input-types.d.ts +174 -0
  236. package/dist/input/input-types.d.ts.map +1 -0
  237. package/dist/input/input-types.js +1 -0
  238. package/dist/input/prompt-labels.d.ts +21 -0
  239. package/dist/input/prompt-labels.d.ts.map +1 -0
  240. package/dist/input/prompt-labels.js +121 -0
  241. package/dist/input/rebind-controller.d.ts +59 -0
  242. package/dist/input/rebind-controller.d.ts.map +1 -0
  243. package/dist/input/rebind-controller.js +85 -0
  244. package/dist/input/schema.d.ts +16 -0
  245. package/dist/input/schema.d.ts.map +1 -0
  246. package/dist/input/schema.js +228 -0
  247. package/dist/loader.d.ts +76 -0
  248. package/dist/loader.d.ts.map +1 -0
  249. package/dist/loader.js +114 -0
  250. package/dist/manifest/editor-port.d.ts +53 -0
  251. package/dist/manifest/editor-port.d.ts.map +1 -0
  252. package/dist/manifest/editor-port.js +67 -0
  253. package/dist/manifest/filename.d.ts +14 -0
  254. package/dist/manifest/filename.d.ts.map +1 -0
  255. package/dist/manifest/filename.js +43 -0
  256. package/dist/manifest/index.d.ts +6 -0
  257. package/dist/manifest/index.d.ts.map +1 -0
  258. package/dist/manifest/index.js +9 -0
  259. package/dist/manifest/load-file.d.ts +7 -0
  260. package/dist/manifest/load-file.d.ts.map +1 -0
  261. package/dist/manifest/load-file.js +23 -0
  262. package/dist/manifest/load.d.ts +161 -0
  263. package/dist/manifest/load.d.ts.map +1 -0
  264. package/dist/manifest/load.js +269 -0
  265. package/dist/manifest/locate.d.ts +24 -0
  266. package/dist/manifest/locate.d.ts.map +1 -0
  267. package/dist/manifest/locate.js +48 -0
  268. package/dist/manifest/schema.d.ts +293 -0
  269. package/dist/manifest/schema.d.ts.map +1 -0
  270. package/dist/manifest/schema.js +633 -0
  271. package/dist/physics/collider-dimensions.d.ts +63 -0
  272. package/dist/physics/collider-dimensions.d.ts.map +1 -0
  273. package/dist/physics/collider-dimensions.js +98 -0
  274. package/dist/physics/collision-system.d.ts +41 -0
  275. package/dist/physics/collision-system.d.ts.map +1 -0
  276. package/dist/physics/collision-system.js +64 -0
  277. package/dist/physics/physics-registry.d.ts +45 -0
  278. package/dist/physics/physics-registry.d.ts.map +1 -0
  279. package/dist/physics/physics-registry.js +65 -0
  280. package/dist/physics/transform-writer.d.ts +16 -0
  281. package/dist/physics/transform-writer.d.ts.map +1 -0
  282. package/dist/physics/transform-writer.js +38 -0
  283. package/dist/pixi/authoring.d.ts +93 -0
  284. package/dist/pixi/authoring.d.ts.map +1 -0
  285. package/dist/pixi/authoring.js +207 -0
  286. package/dist/pixi/index.d.ts +16 -0
  287. package/dist/pixi/index.d.ts.map +1 -0
  288. package/dist/pixi/index.js +15 -0
  289. package/dist/pixi/ingest-iframe.d.ts +82 -0
  290. package/dist/pixi/ingest-iframe.d.ts.map +1 -0
  291. package/dist/pixi/ingest-iframe.js +166 -0
  292. package/dist/pixi/ingest.d.ts +97 -0
  293. package/dist/pixi/ingest.d.ts.map +1 -0
  294. package/dist/pixi/ingest.js +40 -0
  295. package/dist/pixi/physics-registry.d.ts +24 -0
  296. package/dist/pixi/physics-registry.d.ts.map +1 -0
  297. package/dist/pixi/physics-registry.js +38 -0
  298. package/dist/pixi/scene-capture.d.ts +43 -0
  299. package/dist/pixi/scene-capture.d.ts.map +1 -0
  300. package/dist/pixi/scene-capture.js +92 -0
  301. package/dist/pixi/system-adapters.d.ts +16 -0
  302. package/dist/pixi/system-adapters.d.ts.map +1 -0
  303. package/dist/pixi/system-adapters.js +37 -0
  304. package/dist/react/unmanaged-root-detector.d.ts +18 -0
  305. package/dist/react/unmanaged-root-detector.d.ts.map +1 -0
  306. package/dist/react/unmanaged-root-detector.js +70 -0
  307. package/dist/react/use-data.d.ts +60 -0
  308. package/dist/react/use-data.d.ts.map +1 -0
  309. package/dist/react/use-data.js +101 -0
  310. package/dist/react/use-selection.d.ts +54 -0
  311. package/dist/react/use-selection.d.ts.map +1 -0
  312. package/dist/react/use-selection.js +71 -0
  313. package/dist/react/world-state.d.ts +154 -0
  314. package/dist/react/world-state.d.ts.map +1 -0
  315. package/dist/react/world-state.js +220 -0
  316. package/dist/render/auto-batcher.d.ts +34 -0
  317. package/dist/render/auto-batcher.d.ts.map +1 -0
  318. package/dist/render/auto-batcher.js +140 -0
  319. package/dist/render/instance-mesh.d.ts +5 -0
  320. package/dist/render/instance-mesh.d.ts.map +1 -0
  321. package/dist/render/instance-mesh.js +19 -0
  322. package/dist/render/light-camera-factory.d.ts +24 -0
  323. package/dist/render/light-camera-factory.d.ts.map +1 -0
  324. package/dist/render/light-camera-factory.js +71 -0
  325. package/dist/render/lod.d.ts +13 -0
  326. package/dist/render/lod.d.ts.map +1 -0
  327. package/dist/render/lod.js +16 -0
  328. package/dist/render/material-factory.d.ts +15 -0
  329. package/dist/render/material-factory.d.ts.map +1 -0
  330. package/dist/render/material-factory.js +186 -0
  331. package/dist/render/mesh-shadow.d.ts +11 -0
  332. package/dist/render/mesh-shadow.d.ts.map +1 -0
  333. package/dist/render/mesh-shadow.js +19 -0
  334. package/dist/render/particles-factory.d.ts +99 -0
  335. package/dist/render/particles-factory.d.ts.map +1 -0
  336. package/dist/render/particles-factory.js +361 -0
  337. package/dist/render/render-batch-system.d.ts +33 -0
  338. package/dist/render/render-batch-system.d.ts.map +1 -0
  339. package/dist/render/render-batch-system.js +223 -0
  340. package/dist/render/render-features.d.ts +47 -0
  341. package/dist/render/render-features.d.ts.map +1 -0
  342. package/dist/render/render-features.js +105 -0
  343. package/dist/render/render-settings.d.ts +35 -0
  344. package/dist/render/render-settings.d.ts.map +1 -0
  345. package/dist/render/render-settings.js +51 -0
  346. package/dist/render/spark-renderer-lifecycle.d.ts +18 -0
  347. package/dist/render/spark-renderer-lifecycle.d.ts.map +1 -0
  348. package/dist/render/spark-renderer-lifecycle.js +57 -0
  349. package/dist/render/viewport-shading.d.ts +17 -0
  350. package/dist/render/viewport-shading.d.ts.map +1 -0
  351. package/dist/render/viewport-shading.js +87 -0
  352. package/dist/runtime/create-runtime.d.ts +259 -0
  353. package/dist/runtime/create-runtime.d.ts.map +1 -0
  354. package/dist/runtime/create-runtime.js +666 -0
  355. package/dist/runtime/debug-bridge.d.ts +288 -0
  356. package/dist/runtime/debug-bridge.d.ts.map +1 -0
  357. package/dist/runtime/debug-bridge.js +277 -0
  358. package/dist/runtime/debug-registry.d.ts +287 -0
  359. package/dist/runtime/debug-registry.d.ts.map +1 -0
  360. package/dist/runtime/debug-registry.js +528 -0
  361. package/dist/runtime/dev-layers.d.ts +34 -0
  362. package/dist/runtime/dev-layers.d.ts.map +1 -0
  363. package/dist/runtime/dev-layers.js +40 -0
  364. package/dist/runtime/frame-selector-cache.d.ts +41 -0
  365. package/dist/runtime/frame-selector-cache.d.ts.map +1 -0
  366. package/dist/runtime/frame-selector-cache.js +65 -0
  367. package/dist/runtime/game.d.ts +576 -0
  368. package/dist/runtime/game.d.ts.map +1 -0
  369. package/dist/runtime/game.js +1003 -0
  370. package/dist/runtime/gameplay-rng-trap.d.ts +47 -0
  371. package/dist/runtime/gameplay-rng-trap.d.ts.map +1 -0
  372. package/dist/runtime/gameplay-rng-trap.js +95 -0
  373. package/dist/runtime/input-router.d.ts +78 -0
  374. package/dist/runtime/input-router.d.ts.map +1 -0
  375. package/dist/runtime/input-router.js +171 -0
  376. package/dist/runtime/mount-game.d.ts +126 -0
  377. package/dist/runtime/mount-game.d.ts.map +1 -0
  378. package/dist/runtime/mount-game.js +159 -0
  379. package/dist/runtime/mount-manifest.d.ts +174 -0
  380. package/dist/runtime/mount-manifest.d.ts.map +1 -0
  381. package/dist/runtime/mount-manifest.js +304 -0
  382. package/dist/runtime/presentation.d.ts +85 -0
  383. package/dist/runtime/presentation.d.ts.map +1 -0
  384. package/dist/runtime/presentation.js +92 -0
  385. package/dist/runtime/render-audio-control.d.ts +126 -0
  386. package/dist/runtime/render-audio-control.d.ts.map +1 -0
  387. package/dist/runtime/render-audio-control.js +116 -0
  388. package/dist/runtime/render-control.d.ts +347 -0
  389. package/dist/runtime/render-control.d.ts.map +1 -0
  390. package/dist/runtime/render-control.js +317 -0
  391. package/dist/runtime/render-seed.d.ts +56 -0
  392. package/dist/runtime/render-seed.d.ts.map +1 -0
  393. package/dist/runtime/render-seed.js +73 -0
  394. package/dist/runtime/state-bridge.d.ts +60 -0
  395. package/dist/runtime/state-bridge.d.ts.map +1 -0
  396. package/dist/runtime/state-bridge.js +62 -0
  397. package/dist/runtime/types.d.ts +285 -0
  398. package/dist/runtime/types.d.ts.map +1 -0
  399. package/dist/runtime/types.js +1 -0
  400. package/dist/runtime/unexported-game-trap.d.ts +36 -0
  401. package/dist/runtime/unexported-game-trap.d.ts.map +1 -0
  402. package/dist/runtime/unexported-game-trap.js +80 -0
  403. package/dist/setup/setup-audio.d.ts +20 -0
  404. package/dist/setup/setup-audio.d.ts.map +1 -0
  405. package/dist/setup/setup-audio.js +41 -0
  406. package/dist/setup/setup-particles.d.ts +17 -0
  407. package/dist/setup/setup-particles.d.ts.map +1 -0
  408. package/dist/setup/setup-particles.js +16 -0
  409. package/dist/setup/setup-physics.d.ts +25 -0
  410. package/dist/setup/setup-physics.d.ts.map +1 -0
  411. package/dist/setup/setup-physics.js +51 -0
  412. package/dist/setup/setup-renderer.d.ts +82 -0
  413. package/dist/setup/setup-renderer.d.ts.map +1 -0
  414. package/dist/setup/setup-renderer.js +381 -0
  415. package/dist/world3d-react/engine-bridge.d.ts +47 -0
  416. package/dist/world3d-react/engine-bridge.d.ts.map +1 -0
  417. package/dist/world3d-react/engine-bridge.js +48 -0
  418. package/dist/world3d-react/index.d.ts +47 -0
  419. package/dist/world3d-react/index.d.ts.map +1 -0
  420. package/dist/world3d-react/index.js +46 -0
  421. package/dist/world3d-react/r3f-adapter.d.ts +51 -0
  422. package/dist/world3d-react/r3f-adapter.d.ts.map +1 -0
  423. package/dist/world3d-react/r3f-adapter.js +368 -0
  424. package/dist/world3d-react/r3f-root-factory.d.ts +62 -0
  425. package/dist/world3d-react/r3f-root-factory.d.ts.map +1 -0
  426. package/dist/world3d-react/r3f-root-factory.js +79 -0
  427. package/dist/world3d-react/rapier-physics-bridge.d.ts +76 -0
  428. package/dist/world3d-react/rapier-physics-bridge.d.ts.map +1 -0
  429. package/dist/world3d-react/rapier-physics-bridge.js +120 -0
  430. package/dist/world3d-react/renderer-config.d.ts +58 -0
  431. package/dist/world3d-react/renderer-config.d.ts.map +1 -0
  432. package/dist/world3d-react/renderer-config.js +96 -0
  433. package/dist/world3d-react/world-context.d.ts +123 -0
  434. package/dist/world3d-react/world-context.d.ts.map +1 -0
  435. package/dist/world3d-react/world-context.js +204 -0
  436. package/dist-config/config.js +303 -0
  437. package/dist-config/config.js.map +7 -0
  438. package/package.json +14 -3
  439. package/src/adapter/rapier-physics-adapter.ts +77 -34
  440. package/src/config.ts +8 -0
  441. package/src/core/frame-pacing.ts +26 -0
  442. package/src/core/game-loop.ts +4 -3
  443. package/src/dev/instruments.ts +302 -0
  444. package/src/runtime/mount-game.ts +6 -0
  445. package/src/runtime/unexported-game-trap.ts +82 -0
  446. package/src/setup/setup-renderer.ts +2 -0
  447. package/src/world3d-react/index.ts +9 -0
  448. package/src/world3d-react/rapier-physics-bridge.tsx +137 -0
@@ -0,0 +1,944 @@
1
+ import type { ActionValueOf, ActionValueSource, ActionValueType, BindingConflict, BindingPrompt, InputBinding, InputMapFile, PromptDevice, Vector2 } from './input-types';
2
+ /**
3
+ * Thrown by `InputManager.setVirtualAction`/`tapVirtualAction` (Task 1.4)
4
+ * for an action name that was never `registerAction`/`loadMap`-ed. Carries a
5
+ * machine-readable `code` and `data.registered` (every declared action name)
6
+ * rather than requiring a caller to parse the message.
7
+ */
8
+ export declare class InputActionError extends Error {
9
+ readonly code: "INPUT_ACTION_NOT_FOUND";
10
+ readonly data: {
11
+ registered: string[];
12
+ };
13
+ constructor(action: string, method: string, registered: string[]);
14
+ }
15
+ /**
16
+ * Thrown by `InputManager.scheduleActionAtTick` (D15/T-D15.5) when the
17
+ * named `tick` has already elapsed — scheduling only ever applies to the
18
+ * CURRENT or a future tick, never one already serviced by `poll()`.
19
+ * Carries `data.currentTick` — the NEXT tick `poll()` will service (not
20
+ * the tick that just elapsed) — so a caller can retry by scheduling for
21
+ * `data.currentTick` or later.
22
+ */
23
+ export declare class InputTickError extends Error {
24
+ readonly code: "TICK_ALREADY_PASSED";
25
+ readonly data: {
26
+ currentTick: number;
27
+ };
28
+ constructor(tick: number, currentTick: number);
29
+ }
30
+ /**
31
+ * Maps raw keyboard/mouse/gamepad events → named actions.
32
+ *
33
+ * Usage:
34
+ * const input = new InputManager();
35
+ * await input.loadMap('inputmaps/default.inputmap.json');
36
+ * // In game loop:
37
+ * input.poll(); // call at start of frame
38
+ * if (input.isPressed('jump')) { ... }
39
+ * if (input.isJustPressed('attack')) { ... }
40
+ * input.endFrame(); // call at end of frame
41
+ *
42
+ * F1 (spec §12 "Define Typed Action Values") — typed action values:
43
+ *
44
+ * Every action DECLARES a value shape (`InputAction.valueType`, defaulted to
45
+ * `'digital'` — see `input-types.ts`'s `ActionValueType`). Each shape has its
46
+ * own typed getter, none of which return `any`:
47
+ *
48
+ * - `'digital'` — `isPressed`/`isJustPressed`/`isJustReleased` -> `boolean`
49
+ * - `'scalar'` — `getScalar` -> `number`
50
+ * - `'vector2'` — `getVector2` -> `Vector2` ({x,y})
51
+ * - `'pointerDelta'` — `getPointerDelta` -> `Vector2`
52
+ * - `'pointerPosition'` — `getPointerPosition` -> `Vector2`
53
+ *
54
+ * Reading an action through the WRONG getter (e.g. `getScalar` on a
55
+ * `'digital'` action) throws — that's the type-safety enforcement point,
56
+ * since actions are declared in data (JSON), not TS types, so there's no
57
+ * compiler backstop otherwise. `readAction(name, expectedType)` is a generic
58
+ * entry point over the same getters, typed via `ActionValueOf<T>`.
59
+ *
60
+ * Each typed getter has a `*Source` sibling (e.g. `getScalarSource`) that
61
+ * returns `ActionValueSource | null` — which binding (and, for gamepad
62
+ * bindings, which connected gamepad, or for injected test bindings, which
63
+ * named source) produced the current value. That's the "device/source
64
+ * metadata" AC.
65
+ *
66
+ * Deadzone + normalization:
67
+ * - scalar: below `deadzone` magnitude -> 0; at/above it, rescaled from 0
68
+ * (at the deadzone edge) to ±1 (at |raw| = 1), sign preserved
69
+ * (`rescaleScalar`).
70
+ * - vector2: below `deadzone` magnitude -> {0,0}; at/above it, direction is
71
+ * preserved and magnitude is rescaled the same way, then the result is
72
+ * clamped to the unit circle — magnitude never exceeds 1 even for a raw
73
+ * diagonal input like {1,1} (`rescaleVector2`).
74
+ *
75
+ * Simultaneous-binding combine rules (documented here, spec §12 F1
76
+ * "simultaneous bindings combine predictably"):
77
+ * - digital: OR — any one satisfied binding makes the action pressed
78
+ * (pre-existing behavior, unchanged).
79
+ * - scalar: max-magnitude across contributing bindings' (deadzone-applied)
80
+ * values, sign preserved; ties keep the first-listed binding
81
+ * (deterministic given binding array order).
82
+ * - vector2: sum contributing (deadzone-applied) {x,y} values component-
83
+ * wise, then clamp the sum to the unit circle (never renormalized UP —
84
+ * only ever scaled down if the sum exceeds magnitude 1).
85
+ * - pointerDelta: sum contributing deltas (matches the existing
86
+ * mouseDeltaX/Y + lookStick accumulation precedent below).
87
+ * - pointerPosition: last-write-wins — the contributing source most
88
+ * recently updated (by injection call order) wins; position isn't
89
+ * additive so summing would be meaningless.
90
+ *
91
+ * Synthetic input injection (test hook, also the shape of F2's "injected
92
+ * test input" backend): `injectAxis`/`injectVector2`/`injectPointerDelta`/
93
+ * `injectPointerPosition` push a raw value into a named source, read back by
94
+ * binding an action to `{ type: 'test_axis' | 'test_vector2' |
95
+ * 'test_pointer_delta' | 'test_pointer_position', sourceId }` — the exact
96
+ * same aggregation path (deadzone/normalize/combine) real device bindings
97
+ * use.
98
+ *
99
+ * F2 (spec §12 "Complete Device Backends") completes the real-device side of
100
+ * that same typed-value path:
101
+ *
102
+ * - `mouse_move` — un-rejected (schema.ts). Feeds `getPointerDelta` (raw
103
+ * accumulated `mouseDeltaX/Y`, no deadzone) and `getVector2` (the same
104
+ * delta, deadzone-rescaled + unit-circle-clamped).
105
+ * - `gamepad_axis_pair` — un-rejected (schema.ts). Feeds `getVector2` with
106
+ * the coupled `(xAxis, yAxis)` reading, deadzone-rescaled like a real
107
+ * stick (default deadzone 0.15, matching `gamepad_axis`).
108
+ * - `touch_button`/`touch_stick` — new binding kinds for touch/virtual
109
+ * controls. `setTouchButton(sourceId, pressed)` feeds a digital action
110
+ * (edge-tracked like `mouse_button`); `setTouchStick(sourceId, value)`
111
+ * feeds a vector2 action (deadzone-rescaled like a gamepad stick). These
112
+ * are the injectable entry points a real on-screen touch UI's own
113
+ * touchstart/touchmove/touchend handlers would call — that DOM wiring is
114
+ * a thin adapter at the edge (browser-verified separately, e.g. F4/e2e);
115
+ * the mapping logic here is unit-tested headlessly with no DOM.
116
+ * - Focus gating — `blur`/`focus` on `window` (guarded, real DOM only) now
117
+ * drop input the same way `setEnabled(false)` does (flushing held
118
+ * key/mouse/touch-button state) without touching the `enabled` flag the
119
+ * editor drives — see `focused`/`inputActive` below. This is what stops
120
+ * a stuck key/button when the user alt-tabs away mid-press.
121
+ * - Pointer lock — `pointerlockchange` on `document` (guarded) tracks
122
+ * `isPointerLocked()`; losing lock flushes mouse-button state (a click
123
+ * held at the moment lock exits must not stick).
124
+ * - Gamepad device identity — `getGamepadInfo(index)` exposes `{index, id,
125
+ * mapping, connected}`; `ActionValueSource.gamepadId` (in addition to the
126
+ * pre-existing `gamepadIndex`) is populated for every
127
+ * gamepad_button/gamepad_axis/gamepad_axis_pair source.
128
+ * - Disconnection/reconnection needs no new tracking: `poll()` already
129
+ * re-reads `navigator.getGamepads()` every frame and every read (digital
130
+ * edges, scalar/vector2 contributions) already skips a `null` gamepad
131
+ * entry, so a disconnected gamepad's bound actions go neutral (and a
132
+ * previously-held button correctly fires `isJustReleased`) with no
133
+ * special-cased code — see the state-transition tests.
134
+ *
135
+ * F3 (spec §12 "Add Rebinding and Prompts") completes the input system with
136
+ * rebinding, structural conflict detection, and device-prompt resolution:
137
+ *
138
+ * - Listing/mutating: `getBindings`/`setBindings`/`addBinding`/
139
+ * `removeBinding`/`replaceBinding` — the same `this.actions` map F1/F2
140
+ * already read, now with a public read + mutation surface (there was
141
+ * previously none — every existing call site either loaded a map once or
142
+ * read through the typed getters).
143
+ * - Reset-to-defaults: `registerAction`/`loadMap`/`loadMapObject` snapshot
144
+ * each action's bindings into `defaultBindings` (a deep clone) at
145
+ * registration/load time; `resetBindings`/`resetAllBindings` restore from
146
+ * that snapshot. Later rebinding calls do NOT touch the snapshot, so
147
+ * "reset" always means "back to what was authored/loaded", not "back to
148
+ * the last reset".
149
+ * - Persist: `toInputMapFile()` serializes the live action set back into
150
+ * the exact `.inputmap.json` shape (`InputMapFile`) `loadMap` reads;
151
+ * `loadMapObject(data)` is `loadMap`'s synchronous, no-`fetch` sibling —
152
+ * both funnel through the same `InputMapFileSchema`-validated
153
+ * `applyParsedMap`. This is the round-trip seam: serialize, write/hand to
154
+ * something else, reload, and rebound actions survive. It complements —
155
+ * doesn't replace — the SDK's `project.inputMap.read/validate/update`
156
+ * operations (B2, `packages/vgai-sdk/src/project/input-map-operations.ts`):
157
+ * those are FILE-level (a CLI/agent editing the `.inputmap.json` on disk,
158
+ * no running game involved); this is RUNTIME-level (a live game rebinding
159
+ * while playing). Both validate through the identical
160
+ * `InputMapFileSchema`, so a file B2 wrote loads here unchanged, and a
161
+ * map this class serializes is a valid document for B2 to read back.
162
+ * - Conflicts: `findConflicts(proposed, excludeActionName?)` scans every
163
+ * OTHER registered action's bindings for one that's structurally
164
+ * equivalent to `proposed` (see the private `bindingsCollide` — same
165
+ * physical input identity: same key code, same mouse button, the same
166
+ * gamepad button/axis/axis-pair, the same touch `sourceId`, etc.) and
167
+ * returns the (possibly empty) list as plain `BindingConflict` data —
168
+ * never throws. A rebinding UI calls this BEFORE calling
169
+ * `addBinding`/`replaceBinding`/`setBindings` and decides what to do with
170
+ * a non-empty result (block, warn, let the user steal the binding by
171
+ * removing it from the other action first).
172
+ * - Prompts: `getPrompt(actionName, device?, gamepadIndex?)` resolves a
173
+ * `BindingPrompt` (display label + icon name) for whichever of the
174
+ * action's bindings belongs to the requested `PromptDevice` family
175
+ * (keyboard/mouse/gamepad/touch — `bindingDeviceFamily` in
176
+ * `prompt-labels.ts`), using `getGamepadInfo` to prefer the standard
177
+ * mapping's canonical glyph names (`'A'`, `'LB'`, ...) for gamepad
178
+ * buttons and falling back to a raw index label (or a "disconnected"
179
+ * label) when the pad isn't in standard mapping or isn't connected.
180
+ * `device` is optional (F4 below) — omit it to resolve against
181
+ * `getLastActiveDevice()` instead.
182
+ *
183
+ * F4 (spec §12 "Schema and Examples") closes F3's one open gap — a
184
+ * current-ACTIVE-device tracker, so a prompt UI can switch its displayed
185
+ * label as the player switches controllers instead of the caller having to
186
+ * track that itself:
187
+ *
188
+ * - `getLastActiveDevice()` returns the `PromptDevice` family of whichever
189
+ * input arrived most recently — keyboard on `keydown`, mouse on
190
+ * `mousedown`/a real `mousemove`, gamepad on a button press or a stick
191
+ * pushed meaningfully off-center (checked in `poll()`), touch on
192
+ * `setTouchButton(_, true)` or `setTouchStick` pushed meaningfully
193
+ * off-center. `null` before any input has arrived.
194
+ * - `getPrompt(actionName)` (device omitted) resolves against it directly,
195
+ * falling back to `'keyboard'` before any input has arrived — a HUD can
196
+ * call it every frame with no extra bookkeeping and the label switches on
197
+ * its own.
198
+ */
199
+ export declare class InputManager {
200
+ private actions;
201
+ private actionValueTypes;
202
+ private defaultBindings;
203
+ private loadedMapVersion;
204
+ private keysDown;
205
+ private keysJustDown;
206
+ private keysJustUp;
207
+ private mouseButtons;
208
+ private mouseButtonsJustDown;
209
+ private mouseButtonsJustUp;
210
+ private mouseDeltaX;
211
+ private mouseDeltaY;
212
+ private gamepads;
213
+ private gamepadButtonsDown;
214
+ private gamepadButtonsPrev;
215
+ private gamepadButtonsJustDown;
216
+ private gamepadButtonsJustUp;
217
+ private gamepadAxesCurrent;
218
+ private gamepadAxesPrev;
219
+ private lookStickX;
220
+ private lookStickY;
221
+ private testAxisValues;
222
+ private testVector2Values;
223
+ private testPointerDeltaAccum;
224
+ private testPointerPositionValues;
225
+ private pointerPositionSeq;
226
+ private touchButtonsDown;
227
+ private touchButtonsJustDown;
228
+ private touchButtonsJustUp;
229
+ private touchStickValues;
230
+ private lastActiveDevice;
231
+ /** Coarse "is this stick meaningfully off-center" check shared by the
232
+ * gamepad and touch-stick active-device heuristics above — deliberately a
233
+ * higher bar than a binding's own (often much smaller) configured
234
+ * deadzone, since this is "did the player just grab this control", not
235
+ * "does this binding's value count as non-zero". */
236
+ private static isStickActive;
237
+ private virtualDigitalHeld;
238
+ private virtualDigitalTapQueued;
239
+ private virtualDigitalTapActive;
240
+ /** pulse-runner friction #4 — the release-edge mirror of
241
+ * `virtualDigitalTapActive`: a direct `setVirtualAction(action, false)` (or
242
+ * `clearVirtualActions()`) on an action that WAS held writes here so
243
+ * `isJustReleased` fires exactly once, mirroring real `onKeyUp`'s
244
+ * immediate `keysJustUp` write (no queue/promotion needed — unlike the
245
+ * press edge, nothing in `poll()` reassigns this set out from under a
246
+ * write that lands before `poll()` runs). Cleared every `endFrame()`,
247
+ * same bracket as every other just-* edge set. */
248
+ private virtualDigitalJustReleased;
249
+ private virtualScalarValues;
250
+ private virtualVector2Values;
251
+ private currentTick;
252
+ /** The last tick value `poll()` actually serviced, or `-1` before the
253
+ * first call. Used to detect a GAP (this world's input phase didn't run
254
+ * for one or more intervening ticks — e.g. frozen/paused while other
255
+ * roots kept advancing the shared game tick) so any schedule entries
256
+ * inside that gap can be dropped (with an observable event) instead of
257
+ * silently rotting in {@link scheduledActions} forever. */
258
+ private lastServicedTick;
259
+ /** Pending `scheduleActionAtTick` actuations, grouped by their exact target
260
+ * tick. Applied (and removed) at the START of that tick's `poll()` — see
261
+ * `applyScheduledActionsForTick`. A tick whose input phase is skipped
262
+ * entirely (this world paused/frozen, or a gap between two serviced
263
+ * ticks) never reaches it — its scheduled entries are dropped, each
264
+ * emitting one `'input.schedule.dropped'` debug event (`{tick, action}`)
265
+ * via {@link setDebugEmit}'s sink if one is wired — NOT retried on a
266
+ * later tick (mirrors `clearVirtualActions`-on-gate-close: no stuck
267
+ * actuation ever silently fires late). */
268
+ private scheduledActions;
269
+ /** Optional sink for the `'input.schedule.dropped'` debug event (`{tick,
270
+ * action}`) emitted whenever a scheduled entry is discarded because its
271
+ * target tick's input phase never ran. Wired by whoever constructs this
272
+ * `InputManager` with access to a `DebugRegistry`
273
+ * (`setup-three-root-adapter.ts`, the same seed spot as
274
+ * `setVirtualInputTarget`/`setInputActionsSource`) — `null` (the
275
+ * default) for a bare/headless `InputManager`, in which case a drop
276
+ * stays silent (matching pre-D15/T-D15.5 behavior). */
277
+ private debugEmit;
278
+ /** D15/T-D15.5 recording toggle — see {@link startInputRecording}. */
279
+ private inputRecording;
280
+ /** The post-gate action-delta trace (§2.c's format sketch) — capped so an
281
+ * accidentally-long recording session can't grow this unboundedly. */
282
+ private inputTrace;
283
+ /** Last value recorded per action, so `recordPostGateTick` only ever
284
+ * appends a DELTA (the format sketch's "deltas only" line), not a full
285
+ * snapshot every tick. Cleared on `startInputRecording()`. */
286
+ private lastTraceSnapshot;
287
+ private disposed;
288
+ /**
289
+ * When false, all raw input is ignored and held/transient state is cleared.
290
+ * The editor host drives this (T6.3, `packages/editor/src/play-mode.ts`) so
291
+ * the running game only receives input while its viewport is the active,
292
+ * focused surface — keystrokes typed into the editor (Scene tab, inspector
293
+ * fields) must not leak into the game. A standalone game leaves this true
294
+ * for its whole lifetime.
295
+ */
296
+ private enabled;
297
+ /**
298
+ * F2 — real window focus, distinct from `enabled` (which is the editor's
299
+ * explicit play-mode gate). `false` while the tab/window is blurred (real
300
+ * `blur`/`focus` events — see the constructor). Held keyboard/mouse/touch
301
+ * state is flushed on blur so a key/button held at alt-tab time doesn't
302
+ * stick (the browser stops delivering keyup/mouseup while blurred).
303
+ */
304
+ private focused;
305
+ /** Both gates a standalone game must pass for input to be live (spec §12
306
+ * F2 "focus gating"): the editor's explicit `enabled` flag AND real
307
+ * window focus. Used everywhere `enabled` alone used to be checked. */
308
+ private get inputActive();
309
+ /** #144 — the gate MACHINE input passes (virtual actions and
310
+ * tick-scheduled actuations): the editor's explicit `enabled` flag ONLY.
311
+ * Window focus deliberately does not participate: a synthetic player
312
+ * drives the shared editor tab precisely while the human's focus is
313
+ * elsewhere (their terminal, another window) — the first live in-editor
314
+ * E2E run froze mid-suite the moment the owner started typing to their
315
+ * agent, which is the bug this gate split fixes. Real-device input keeps
316
+ * the stricter `inputActive` (enabled AND focused) gate above. */
317
+ private get machineInputActive();
318
+ /** F2 — real pointer-lock state (`document.pointerLockElement`), tracked via
319
+ * `pointerlockchange` (see the constructor). */
320
+ private pointerLocked;
321
+ /** Element currently wired for click-to-pointer-lock, and its listener. */
322
+ private pointerLockElement;
323
+ private onPointerLockClick;
324
+ private onPointerLockChange;
325
+ private onKeyDown;
326
+ private onKeyUp;
327
+ private onMouseDown;
328
+ private onMouseUp;
329
+ private onMouseMove;
330
+ /** F2 — real window blur: drop focus and flush held REAL-device state
331
+ * (the browser stops delivering keyup/mouseup while blurred, so a key
332
+ * held at alt-tab time would stick). #144: virtual-action state is
333
+ * deliberately NOT flushed here — a bot's held action survives the human
334
+ * looking away (see `machineInputActive`); only `setEnabled(false)`
335
+ * clears it. */
336
+ private onWindowBlur;
337
+ /** F2 — real window focus regain. No flush needed (there's nothing held to
338
+ * flush — a fresh keydown/mousedown is required to register pressed
339
+ * again, exactly like re-enabling via `setEnabled(true)`). */
340
+ private onWindowFocus;
341
+ /** Clear held/transient REAL-device state (keyboard/mouse/touch-button) —
342
+ * shared by `setEnabled(false)` (via `flushHeldState`) and real blur
343
+ * (`onWindowBlur`), so a key/button physically held when input is
344
+ * suspended doesn't linger. Level values (gamepad axes, touch sticks,
345
+ * injected test axes) are deliberately NOT flushed here — they are gated
346
+ * at READ time instead (see `inputActive` checks in `poll()`/the
347
+ * `collect*Contributions` methods), matching the pre-existing
348
+ * gamepad-axis convention. */
349
+ private flushRealHeldState;
350
+ /** The full flush `setEnabled(false)` performs: real-device state AND
351
+ * virtual-action state. Task 1.4's rule ("a bot's held action must not
352
+ * survive input being suspended") now applies only to the editor's
353
+ * explicit gate — #144 moved real window blur onto `flushRealHeldState`
354
+ * alone, so machine input survives the human's focus leaving the tab.
355
+ * No release edge is manufactured here (`manufactureReleaseEdge: false`,
356
+ * the default) — this is a SUSPEND, not a deliberate release, and mirrors
357
+ * `flushRealHeldState`'s own silence (a key physically held at
358
+ * suspend/blur time is wiped with no `keysJustUp`, "flush held state,
359
+ * don't corrupt history", see `poll()`'s doc comment). */
360
+ private flushHeldState;
361
+ /** Shared by the public `clearVirtualActions()` and `flushHeldState()`
362
+ * above — clears every virtual-action store (held digitals, queued/active
363
+ * taps, scalar/vector2 values, the release-edge set itself).
364
+ *
365
+ * `manufactureReleaseEdge` (default `false`): when `true` — only
366
+ * `clearVirtualActions()`'s own deliberate "let go" passes this — every
367
+ * currently-held digital in `virtualDigitalHeld` first gets an
368
+ * `isJustReleased` edge written to `virtualDigitalJustReleased`, mirroring
369
+ * a real key-up (`onKeyUp` → `keysJustUp`). `flushHeldState()` (the
370
+ * editor-gate suspend path) deliberately passes `false` — see its own doc
371
+ * comment for why a suspend must stay silent. */
372
+ private clearVirtualActionState;
373
+ constructor();
374
+ /**
375
+ * Load action map from a .inputmap.json file. Validated via
376
+ * `InputMapFileSchema` (T4.6) — a malformed input map throws a
377
+ * `AssetParseError` naming the file, not a deep TypeError once the bad
378
+ * data reaches `isPressed`/`isJustPressed`/`isJustReleased`.
379
+ */
380
+ loadMap(url: string): Promise<void>;
381
+ /**
382
+ * F3 — `loadMap`'s synchronous, no-`fetch` sibling: apply an already-in-
383
+ * memory (or freshly-deserialized) input-map DOCUMENT, validated through
384
+ * the identical `InputMapFileSchema` (throws `AssetParseError` naming no
385
+ * file, matching `loadMap`'s error shape minus the URL). This is the other
386
+ * half of the F3 persist round-trip: `toInputMapFile()` serializes,
387
+ * `loadMapObject` re-applies — no network/file I/O required, so it's also
388
+ * how a headless test proves a rebind survives a save/reload cycle.
389
+ */
390
+ loadMapObject(data: unknown): InputMapFile;
391
+ /** Shared apply step for `loadMap`/`loadMapObject`: copy each action's
392
+ * bindings + declared valueType into the live maps, and snapshot the
393
+ * bindings as that action's F3 reset-to-defaults baseline. */
394
+ private applyParsedMap;
395
+ /** Register an action programmatically. `valueType` declares the action's
396
+ * value shape (F1) — defaults to `'digital'`, matching every call site
397
+ * written before F1. F3 — also snapshots `bindings` as this action's
398
+ * reset-to-defaults baseline (see `resetBindings`). */
399
+ registerAction(name: string, bindings: InputBinding[], valueType?: ActionValueType): void;
400
+ /** The declared value type for a registered/loaded action (F1) — `'digital'`
401
+ * for an action that never specified one (including an unregistered/typo'd
402
+ * name — harmless, since every typed getter already treats an unknown
403
+ * action as inert). */
404
+ getActionValueType(actionName: string): ActionValueType;
405
+ /** Enforces the F1 type-safety AC: reading an action through a typed getter
406
+ * whose value type doesn't match the action's DECLARED `valueType` throws,
407
+ * naming both. Unknown actions (never registered/loaded) are exempt — they
408
+ * already read as inert/zeroed by every getter, matching pre-F1 behavior
409
+ * for a typo'd action name. */
410
+ private assertValueType;
411
+ /** The names of all registered actions (r3f `world-context` enumerates these
412
+ * for its input-binding projection). */
413
+ actionNames(): string[];
414
+ /**
415
+ * Poll gamepads and virtual look stick (call at start of frame).
416
+ *
417
+ * `tick` (D15/T-D15.3/.5) — the GAME tick this call services. Pass the
418
+ * live, shared `Game` tick counter here (`setup-three-root-adapter.ts` does,
419
+ * via `DebugRegistry.getGameTick()`) so `scheduleActionAtTick`'s numbering
420
+ * never drifts from the actual game tick — the bug an earlier revision of
421
+ * this feature had: an InputManager-LOCAL counter, incremented once per
422
+ * `poll()` call, undercounts for a paused/frozen world (its `poll()` isn't
423
+ * called every game tick while frozen), so a schedule set against "tick
424
+ * 500" could fire at the wrong wall-tick once the world resumed. Omit it
425
+ * (every existing bare/headless caller does) to fall back to the
426
+ * self-incrementing `currentTick` counter — unchanged pre-D15 behavior.
427
+ */
428
+ poll(tick?: number): void;
429
+ /**
430
+ * D15/T-D15.5 — apply every actuation `scheduleActionAtTick` queued for
431
+ * exactly `tick`, then forget them (a tick is serviced at most once).
432
+ *
433
+ * Digital `true` gets SPECIAL handling (the objection-1 fix): it promotes
434
+ * the action into this tick's `virtualDigitalTapActive` set directly — the
435
+ * same one-tick "active" pulse `tapVirtualAction` uses — so `isJustPressed`
436
+ * reads true for EXACTLY this tick (false on the next, per `endFrame()`'s
437
+ * clear) while `isPressed` keeps reading true afterward (still held) until
438
+ * a later scheduled/explicit `false` releases it. This direct write is
439
+ * safe here (unlike `applyVirtualActionValue`'s equivalent direct-path
440
+ * case — see its doc comment) specifically because this method only ever
441
+ * runs from inside `poll()`, AFTER `poll()`'s own tap-queue-promotion
442
+ * reassignment of `virtualDigitalTapActive` has already happened for this
443
+ * tick (see `poll()`'s own comment on why it's placed after) — so there's
444
+ * no risk of this write being silently wiped by that reassignment.
445
+ *
446
+ * pulse-runner friction #4: a prior revision of this comment
447
+ * used to say `setVirtualAction`'s plain write "never produces a
448
+ * just-pressed edge at all" and that the edge fix landed ONLY here, for
449
+ * this scheduled path — true at the time, and exactly the gap a blind
450
+ * dogfood run (pulse-runner) hit through the direct `setVirtualAction`/
451
+ * `holdFor` path. `applyVirtualActionValue` now manufactures the same kind
452
+ * of edge for THAT path too (queued instead of written directly, for the
453
+ * timing reason above) — this is no longer the only path that does.
454
+ *
455
+ * A digital `false` here simply releases the hold — no edge is
456
+ * manufactured for it at a SCHEDULED tick (no caller needs a virtual
457
+ * `isJustReleased` fired at an exact future tick today); the direct
458
+ * `setVirtualAction(action, false)`/`clearVirtualActions()` paths DO
459
+ * manufacture one now (see `applyVirtualActionValue`/
460
+ * `clearVirtualActionState`). Scalar/vector2 values apply directly,
461
+ * unchanged.
462
+ */
463
+ private applyScheduledActionsForTick;
464
+ /** D15/T-D15.5 — append this tick's action-value DELTA to the recording
465
+ * ring, iff a recording is active. Reads every declared digital/scalar/
466
+ * vector2 action through the exact same typed getters gameplay code would
467
+ * (`readAction`), so the trace reflects what a component reading these
468
+ * actions THIS tick actually sees post-gate — never a raw/ungated value.
469
+ * `pointerDelta`/`pointerPosition` actions are skipped (a different,
470
+ * frame-accumulated shape, and not part of the virtual-action/schedule
471
+ * surface this trace exists to prove).
472
+ *
473
+ * Two replay-affecting caveats a future SP5 consumer must know:
474
+ * 1. A gated stretch never calls this at all (`poll()`'s gated branch
475
+ * returns before reaching it) — no entries are recorded for ticks
476
+ * input was suspended. Any change only OBSERVABLE once re-enabled (a
477
+ * delta against `lastTraceSnapshot`) lands as a delta AT the re-enable
478
+ * tick, not at whatever tick it actually happened.
479
+ * 2. This ring is capped (`INPUT_TRACE_CAP`) and evicts via `shift()` once
480
+ * it fills — dropping the OLDEST entry. Because entries are DELTAS,
481
+ * evicting the earliest entries drops the base state later deltas were
482
+ * relative to — this ring is not safe to replay from its start once it
483
+ * has ever been capped. */
484
+ private recordPostGateTick;
485
+ /** Has a `gamepad_axis` binding's raw value crossed its direction+deadzone
486
+ * threshold (positive: `value > deadzone`; negative: `value < -deadzone`)? */
487
+ private static axisThresholdMet;
488
+ /** Is an action currently held down? */
489
+ isPressed(actionName: string): boolean;
490
+ /** Was an action pressed this frame (not held from previous)? */
491
+ isJustPressed(actionName: string): boolean;
492
+ /** Was an action released this frame (held last frame, up now)? */
493
+ isJustReleased(actionName: string): boolean;
494
+ /** Device/source metadata (F1 AC) for a digital action: which binding is
495
+ * CURRENTLY satisfying `isPressed`, or `null` if none is (including an
496
+ * unknown action). First-satisfied-binding-wins, mirroring isPressed's own
497
+ * iteration order. */
498
+ getDigitalSource(actionName: string): ActionValueSource | null;
499
+ /** 1D deadzone rescale: magnitudes below `deadzone` become 0; magnitudes
500
+ * at/above it rescale from 0 (at the deadzone edge) to ±1 (at |raw| = 1),
501
+ * sign preserved. `raw` is clamped to [-1, 1] first so an out-of-range
502
+ * input can't overshoot past ±1 the other end. */
503
+ private static rescaleScalar;
504
+ /** Radial deadzone + unit-circle normalization for a Vector2: magnitude
505
+ * below `deadzone` snaps to {0,0}; at/above it, direction is preserved and
506
+ * magnitude is rescaled the same way `rescaleScalar` rescales a 1D
507
+ * magnitude (never renormalized UP past 1 — only ever scaled down). */
508
+ private static rescaleVector2;
509
+ /** Clamp a Vector2's magnitude to at most 1 (unit circle), preserving
510
+ * direction — the second half of the vector2 "sum-then-clamp" combine
511
+ * rule (a diagonal sum like {0.8, 0.8} has magnitude > 1). */
512
+ private static clampVector2;
513
+ /** Every `scalar`-relevant binding's (deadzone-applied) contribution for
514
+ * `actionName`, one entry per binding that can produce a scalar value —
515
+ * `gamepad_axis` (real device, already implemented pre-F1 for digital
516
+ * thresholding — F1 additionally reads its raw signed value for scalar
517
+ * actions, ignoring the binding's `direction` field, which is a digital-
518
+ * only hint) and `test_axis` (F1's injected-test-input source). `mouse_move`
519
+ * deliberately does NOT feed scalar (spec §12 F2 — no natural single-axis
520
+ * selector field is defined for it; it feeds pointerDelta/vector2 only —
521
+ * see `collectPointerDeltaContributions`/`collectVector2Contributions`). */
522
+ private collectScalarContributions;
523
+ private computeScalar;
524
+ /** Read a `'scalar'`-valueType action's current value: max-magnitude across
525
+ * contributing (deadzone-applied) bindings, sign preserved (combine rule —
526
+ * see the class doc comment). Throws if the action is declared a
527
+ * different valueType. */
528
+ getScalar(actionName: string): number;
529
+ /** Device/source metadata for {@link getScalar} — which binding is
530
+ * currently driving the combined value, or `null` if every contribution is
531
+ * zero (including an unknown action). */
532
+ getScalarSource(actionName: string): ActionValueSource | null;
533
+ /** `gamepad_axis_pair` contribution(s) for {@link collectVector2Contributions} — one entry
534
+ * per connected gamepad, deadzone-rescaled (default 0.15, matching `gamepad_axis`). Broken
535
+ * out to a helper so the per-gamepad loop doesn't add to the main dispatcher's complexity. */
536
+ private contributeGamepadAxisPair;
537
+ /** Every `vector2`-relevant binding's (deadzone-applied) contribution:
538
+ * `test_vector2` (F1's injected-test-input source), plus F2's real-device
539
+ * cases — `gamepad_axis_pair` (see {@link contributeGamepadAxisPair}), `mouse_move` (the
540
+ * accumulated mouse delta, deadzone default 0 — raw pixel deltas have no natural "at rest"
541
+ * jitter floor the way an analog stick does), and `touch_stick` (a virtual on-screen stick,
542
+ * deadzone default 0). */
543
+ private collectVector2Contributions;
544
+ private computeVector2;
545
+ /** Read a `'vector2'`-valueType action's current value: sum contributing
546
+ * (deadzone-applied) {x,y} values component-wise, then clamp to the unit
547
+ * circle (combine rule — see the class doc comment). Throws if the action
548
+ * is declared a different valueType. */
549
+ getVector2(actionName: string): Vector2;
550
+ /** Device/source metadata for {@link getVector2} — the contributing binding
551
+ * with the largest (pre-combine) magnitude, or `null` if the combined
552
+ * value is {0,0} (including an unknown action). */
553
+ getVector2Source(actionName: string): ActionValueSource | null;
554
+ /** Every `pointerDelta`-relevant binding's contribution: `test_pointer_delta`
555
+ * (F1's injected-test-input source) and — F2 — `mouse_move`, reading the
556
+ * real accumulated `mouseDeltaX/Y` (the same accumulator `onMouseMove`
557
+ * fills and `getMouseDelta()` reads). No deadzone for either (deltas are
558
+ * not deadzoned). */
559
+ private collectPointerDeltaContributions;
560
+ private computePointerDelta;
561
+ /** Read a `'pointerDelta'`-valueType action's this-frame movement: sum of
562
+ * contributing bindings' deltas (combine rule — see the class doc
563
+ * comment). Throws if the action is declared a different valueType. */
564
+ getPointerDelta(actionName: string): Vector2;
565
+ /** Device/source metadata for {@link getPointerDelta}. */
566
+ getPointerDeltaSource(actionName: string): ActionValueSource | null;
567
+ /** Every `pointerPosition`-relevant binding's contribution, each tagged
568
+ * with the injection-order sequence number used to break ties (last-
569
+ * write-wins) — today only `test_pointer_position` (F1's injected-test-
570
+ * input source). */
571
+ private collectPointerPositionContributions;
572
+ private computePointerPosition;
573
+ /** Read a `'pointerPosition'`-valueType action's current absolute position:
574
+ * last-write-wins across contributing bindings (combine rule — see the
575
+ * class doc comment; position isn't additive, so it is never summed).
576
+ * Throws if the action is declared a different valueType. */
577
+ getPointerPosition(actionName: string): Vector2;
578
+ /** Device/source metadata for {@link getPointerPosition} — the most
579
+ * recently-written contributing source. */
580
+ getPointerPositionSource(actionName: string): ActionValueSource | null;
581
+ /** Generic typed read (F1): dispatches to the matching typed getter based
582
+ * on `expectedType`, returning `ActionValueOf<T>` — a caller with a
583
+ * statically-known action-value-type map gets a fully-inferred, non-`any`
584
+ * return type. Throws the same mismatch error as the dedicated getters if
585
+ * the action's declared valueType disagrees with `expectedType`. */
586
+ readAction<T extends ActionValueType>(actionName: string, expectedType: T): ActionValueOf<T>;
587
+ /** Inject a synthetic scalar value for a named test source (F1's injected-
588
+ * test-input hook — also the shape of F2's "injected test input" backend).
589
+ * Bind an action to `{ type: 'test_axis', sourceId }` (`valueType:
590
+ * 'scalar'`) to read it back via {@link getScalar}. The value PERSISTS
591
+ * across frames (like a real analog stick held in position) until changed
592
+ * or cleared via {@link clearAxis}. */
593
+ injectAxis(sourceId: string, value: number): void;
594
+ /** Clear an injected scalar source (e.g. simulating an at-rest/disconnected
595
+ * device). */
596
+ clearAxis(sourceId: string): void;
597
+ /** Inject a synthetic {x,y} value for a named test source. Bind an action
598
+ * to `{ type: 'test_vector2', sourceId }` (`valueType: 'vector2'`) to read
599
+ * it back via {@link getVector2}. Persists across frames until changed or
600
+ * cleared via {@link clearVector2}. */
601
+ injectVector2(sourceId: string, value: Vector2): void;
602
+ /** Clear an injected Vector2 source. */
603
+ clearVector2(sourceId: string): void;
604
+ /** Accumulate a synthetic pointer delta for a named test source — mirrors
605
+ * real mouse-move delta accumulation (`onMouseMove` above): multiple calls
606
+ * within the same frame sum, and the accumulator is cleared in
607
+ * {@link endFrame}. Bind an action to `{ type: 'test_pointer_delta',
608
+ * sourceId }` (`valueType: 'pointerDelta'`) to read it back via
609
+ * {@link getPointerDelta}. */
610
+ injectPointerDelta(sourceId: string, delta: Vector2): void;
611
+ /** Set a synthetic absolute pointer position for a named test source.
612
+ * Persists (last-write-wins across contributing sources on read — see the
613
+ * pointerPosition combine rule) until changed. Bind an action to `{ type:
614
+ * 'test_pointer_position', sourceId }` (`valueType: 'pointerPosition'`) to
615
+ * read it back via {@link getPointerPosition}. */
616
+ injectPointerPosition(sourceId: string, value: Vector2): void;
617
+ /** Whether input capture is currently enabled (see {@link setEnabled}). */
618
+ isEnabled(): boolean;
619
+ /**
620
+ * Enable/disable input capture. The editor host disables the running game's
621
+ * input while its viewport isn't focused so keystrokes don't leak in from
622
+ * the editor. Disabling clears all held/transient keyboard/mouse/touch-button
623
+ * state (via {@link flushHeldState}) so nothing sticks (e.g. a held movement
624
+ * key when you switch back to the Scene tab mid-flight) — gamepad state
625
+ * doesn't need clearing here since `poll()` itself stops reading it while
626
+ * disabled (see poll()'s doc comment).
627
+ */
628
+ setEnabled(enabled: boolean): void;
629
+ /** Whether the window/tab is currently focused (F2, spec §12 "focus
630
+ * gating") — `false` while blurred (real `blur`/`focus` events; see the
631
+ * constructor). Distinct from {@link isEnabled}, which is the editor's
632
+ * explicit play-mode gate. */
633
+ isFocused(): boolean;
634
+ /** Whether the pointer is currently locked to {@link requestPointerLock}'s
635
+ * element (F2, spec §12 "pointer lock") — tracked via the real
636
+ * `pointerlockchange` event. */
637
+ isPointerLocked(): boolean;
638
+ /** Device identity for a connected gamepad slot (F2, spec §12 "expose
639
+ * device identity" + "prefer the standard mapping"), or `null` if nothing
640
+ * is connected at `index` (including while input is disabled/unfocused,
641
+ * since `poll()` empties `this.gamepads` then). `mapping` is the Gamepad
642
+ * API's own `'standard'`/`''` value — bindings author button/axis indices
643
+ * assuming the W3C Standard Gamepad layout, so a non-`'standard'` mapping
644
+ * means those indices may not correspond as documented. */
645
+ getGamepadInfo(index: number): {
646
+ index: number;
647
+ id: string;
648
+ mapping: string;
649
+ connected: boolean;
650
+ } | null;
651
+ /** Get mouse movement delta this frame */
652
+ getMouseDelta(): {
653
+ x: number;
654
+ y: number;
655
+ };
656
+ /**
657
+ * F4 (spec §12 "Schema and Examples" — the F3 prompt-switching gap): which
658
+ * device family most recently produced real input, or `null` before any
659
+ * input has arrived. A prompt UI polls this (or lets {@link getPrompt}
660
+ * consult it automatically by omitting `device`) to switch its displayed
661
+ * label as the player switches controllers — e.g. showing `'Space'` while
662
+ * they're on keyboard, then `'A'` the moment they touch a gamepad.
663
+ */
664
+ getLastActiveDevice(): PromptDevice | null;
665
+ /** The current bindings for `actionName` (F3 AC "listed") — a defensive
666
+ * deep clone, so mutating the returned array/objects never affects the
667
+ * live binding list. `[]` for an unknown/never-registered action. */
668
+ getBindings(actionName: string): InputBinding[];
669
+ /** Wholesale-replace `actionName`'s bindings array (F3 AC "replaced"). Does
670
+ * NOT touch the reset-to-defaults snapshot — see `resetBindings`. A no-op
671
+ * target for an action that was never registered is allowed (it simply
672
+ * registers one with `valueType: 'digital'`, matching `registerAction`'s
673
+ * own default) since a rebinding UI operates on actions it already knows
674
+ * about, but shouldn't have to special-case "brand new action" separately. */
675
+ setBindings(actionName: string, bindings: InputBinding[]): void;
676
+ /** Append one binding to `actionName` (F3 AC "added"). */
677
+ addBinding(actionName: string, binding: InputBinding): void;
678
+ /** Remove the binding at `index` from `actionName` (F3 AC "removed"). A
679
+ * no-op if the action is unknown or `index` is out of range (rather than
680
+ * throwing) — mirrors every other getter's "unknown action is inert"
681
+ * convention, so a UI doesn't need a separate existence check first. */
682
+ removeBinding(actionName: string, index: number): void;
683
+ /** Replace a single binding slot at `index` on `actionName` — the shape a
684
+ * rebinding UI actually wants ("rebind THIS control"), built on
685
+ * `getBindings`/`setBindings`. A no-op if the action is unknown or `index`
686
+ * is out of range. */
687
+ replaceBinding(actionName: string, index: number, binding: InputBinding): void;
688
+ /** Restore `actionName`'s bindings to the snapshot taken at
689
+ * `registerAction`/`loadMap`/`loadMapObject` time (F3 AC "reset"). A no-op
690
+ * for an action with no snapshot (never registered/loaded — there is no
691
+ * "default" to reset to). */
692
+ resetBindings(actionName: string): void;
693
+ /** Reset every action that has a snapshot back to its registered/loaded
694
+ * defaults. Convenience batch form of `resetBindings`. */
695
+ resetAllBindings(): void;
696
+ /**
697
+ * Whether `a` and `b` are the SAME physical input (F3's structural-conflict
698
+ * identity check — see `findConflicts`). Deliberately narrower than deep
699
+ * equality: `deadzone` never participates (two bindings on the same key
700
+ * with different deadzones are still the same physical control), and a
701
+ * `gamepad_axis`'s `direction` DOES participate — opposite directions of one
702
+ * physical axis (e.g. "accelerate" on positive, "brake" on negative) are a
703
+ * legitimate, non-conflicting pair, not a collision.
704
+ */
705
+ private static bindingsCollide;
706
+ /**
707
+ * Every EXISTING binding, on every OTHER registered action, that is
708
+ * structurally the same physical input as `proposed` (F3 AC "conflicts are
709
+ * detected and returned structurally") — never throws, always a plain
710
+ * (possibly empty) array a rebinding UI inspects before committing a
711
+ * rebind. `excludeActionName` is normally the action being rebound itself
712
+ * (so an action isn't reported as conflicting with its own current
713
+ * binding when re-proposing an unchanged value).
714
+ */
715
+ findConflicts(proposed: InputBinding, excludeActionName?: string): BindingConflict[];
716
+ /**
717
+ * Serialize every registered/loaded action back into the `.inputmap.json`
718
+ * document shape (F3 AC "persisted") — the exact `InputMapFile` shape
719
+ * `loadMap`/`loadMapObject` read, so `manager.loadMapObject(manager.toInputMapFile())`
720
+ * on a fresh instance reproduces the same live bindings. `version` is
721
+ * carried forward from the last loaded map when known, else `1` (a
722
+ * manager built purely via `registerAction` calls, never `loadMap`, has no
723
+ * file-format version to preserve).
724
+ */
725
+ toInputMapFile(): InputMapFile;
726
+ /**
727
+ * Resolve a display prompt (F3 AC: labels/icons like `'Space'`, `'A'`, or a
728
+ * touch control's name) for whichever of `actionName`'s bindings belongs to
729
+ * the requested `device` family. `null` when the action has no binding for
730
+ * that device (including an unknown action). `gamepadIndex` (default 0)
731
+ * selects which connected pad's `mapping`/connected state to consult for a
732
+ * `gamepad_*` binding — see `getGamepadInfo`.
733
+ *
734
+ * F4 — `device` is now OPTIONAL: omit it (or pass `undefined`) to resolve
735
+ * against {@link getLastActiveDevice} instead (falling back to `'keyboard'`
736
+ * before any input has arrived), so a prompt UI that wants "show whatever
737
+ * the player is actually holding right now" doesn't have to track the
738
+ * active device itself — it can just call `getPrompt(actionName)` every
739
+ * frame and the label switches on its own as the player changes controllers.
740
+ * Passing an explicit `device` (as every pre-F4 caller does) is unaffected.
741
+ */
742
+ getPrompt(actionName: string, device?: PromptDevice, gamepadIndex?: number): BindingPrompt | null;
743
+ /** Call at end of frame to clear per-frame state */
744
+ endFrame(): void;
745
+ /** Inject synthetic key state from touch controls */
746
+ setVirtualKey(code: string, pressed: boolean): void;
747
+ /** Set virtual look stick position (-1..1). Injected as mouse delta during poll(). */
748
+ setLookStick(x: number, y: number): void;
749
+ /** Inject synthetic mouse delta (e.g. from touch controls) */
750
+ addMouseDelta(dx: number, dy: number): void;
751
+ /**
752
+ * F2 (spec §12 "Complete Device Backends") — the touch/virtual-control
753
+ * digital backend. Set a named virtual button's (`sourceId` — a zone/knob
754
+ * id the touch UI chooses) pressed state; edge-tracked exactly like a real
755
+ * mouse button (`onMouseDown`/`onMouseUp` above) so `isJustPressed`/
756
+ * `isJustReleased` work for `{ type: 'touch_button', sourceId }` bindings.
757
+ * This is the injectable entry point a real on-screen button's own
758
+ * touchstart/touchend handler would call — that DOM wiring is a thin
759
+ * adapter at the edge (browser-verified separately); this method is the
760
+ * MAPPING logic, unit-tested headlessly with no DOM.
761
+ */
762
+ setTouchButton(sourceId: string, pressed: boolean): void;
763
+ /**
764
+ * F2 — the touch/virtual-control analog backend. Set a named virtual
765
+ * stick's (`sourceId`) raw `{x,y}` position (e.g. -1..1 per axis, like a
766
+ * gamepad stick); read back via `getVector2` on a `{ type: 'touch_stick',
767
+ * sourceId }` binding, deadzone-rescaled the same way a gamepad stick is.
768
+ * Persists across frames (a level value, like a real analog stick held in
769
+ * position) until changed or cleared via {@link clearTouchStick}.
770
+ */
771
+ setTouchStick(sourceId: string, value: Vector2): void;
772
+ /** Clear a virtual stick's value (e.g. simulating the touch point lifting —
773
+ * the knob returns to center). */
774
+ clearTouchStick(sourceId: string): void;
775
+ /** Existence check shared by `setVirtualAction`/`tapVirtualAction` — throws
776
+ * `InputActionError` (`code: 'INPUT_ACTION_NOT_FOUND'`, `data.registered`
777
+ * = every declared action name) for a name that was never
778
+ * `registerAction`/`loadMap`-ed. */
779
+ private assertActionExists;
780
+ /** Which declared `ActionValueType` a `setVirtualAction` value shape
781
+ * corresponds to — the type-safety check mirrors every typed getter's
782
+ * `assertValueType` (F1). `pointerDelta`/`pointerPosition` actions aren't
783
+ * drivable through `setVirtualAction` (no boolean/number/Vector2 call
784
+ * shape maps to them) — use `injectPointerDelta`/`injectPointerPosition`. */
785
+ private static virtualValueCategory;
786
+ /**
787
+ * Set a virtual value for `action`, OR'd/summed into the same action reads
788
+ * humans drive (see the section doc comment above). A `boolean` holds a
789
+ * digital action pressed until set `false`/cleared; a `number` or `{x,y}`
790
+ * is a level value combined via the action's own scalar max-magnitude /
791
+ * vector2 sum-then-clamp rule.
792
+ *
793
+ * A digital `false`→`true` transition manufactures a genuine `isJustPressed`
794
+ * edge, exactly one real key-down does (pulse-runner friction #4 —
795
+ * previously this write-half only ever held the action pressed with NO
796
+ * edge at all; every edge-triggered ability driven through this direct
797
+ * path was unprovable). Re-setting `true` while already held (auto-repeat)
798
+ * does NOT re-fire it — see {@link applyVirtualActionValue}. The mirror
799
+ * `true`→`false` transition manufactures an `isJustReleased` edge the same
800
+ * way a real key-up does.
801
+ *
802
+ * Throws `InputActionError` for an unregistered `action`, and the same
803
+ * valueType-mismatch error every typed getter throws (`assertValueType`)
804
+ * when `value`'s shape doesn't match the action's declared `valueType`.
805
+ *
806
+ * Gated (`setEnabled(false)` — play stopped or editor-gated; #144: window
807
+ * focus no longer gates machine input): writes NOTHING — matching
808
+ * `setTouchButton`'s write-gate precedent above — and returns
809
+ * `{delivered: false, reason}` rather than a silent no-op, so a probe/bot
810
+ * never mistakes a swallowed actuation for a delivered one.
811
+ */
812
+ setVirtualAction(action: string, value: boolean | number | {
813
+ x: number;
814
+ y: number;
815
+ }): {
816
+ delivered: boolean;
817
+ reason?: string;
818
+ };
819
+ /**
820
+ * The write half of {@link setVirtualAction} — extracted so D15/T-D15.5's
821
+ * `scheduleActionAtTick` can apply a non-boolean (scalar/vector2) queued
822
+ * actuation through the exact same code path (no gate check here: the two
823
+ * callers gate differently — `setVirtualAction` above checks
824
+ * `inputActive` before calling this; `applyScheduledActionsForTick` is
825
+ * only ever reached from inside `poll()` AFTER its own gate check has
826
+ * already returned early on a gated tick). `applyScheduledActionsForTick`
827
+ * still handles digital `true` itself rather than calling here (its
828
+ * one-tick edge must land EXACTLY at the scheduled tick — see its own doc
829
+ * comment) — this method's digital branch is `setVirtualAction`'s direct
830
+ * path, called at an arbitrary point relative to the poll()/endFrame()
831
+ * bracket.
832
+ *
833
+ * pulse-runner friction #4 — the digital branch used to be a bare held-flag
834
+ * write with no manufactured edge at all (the comment that used to sit
835
+ * here read: "A digital value is handled by `applyScheduledActionsForTick`
836
+ * itself (it needs the extra just-pressed edge a plain held-value write
837
+ * doesn't produce)" — i.e. the edge fix shipped ONLY for the scheduled
838
+ * path, never for this one, which is exactly the gap a blind dogfood run
839
+ * hit: `setVirtualAction('jump', true)` held the action down but
840
+ * `isJustPressed('jump')` never fired). Fixed here by reusing
841
+ * `tapVirtualAction`'s exact one-tick-pulse queue mechanism for this
842
+ * DIRECT case, specifically because this method's caller can land at any
843
+ * point relative to `poll()`: writing `virtualDigitalTapActive` directly
844
+ * here (as the scheduled path safely does, from inside `poll()` itself)
845
+ * would risk being silently wiped by `poll()`'s own unconditional
846
+ * `virtualDigitalTapActive = virtualDigitalTapQueued` reassignment,
847
+ * depending on timing. Queueing side-steps that hazard by construction —
848
+ * the same reason `tapVirtualAction` queues instead of writing directly. A
849
+ * redundant `true` while already held (`virtualDigitalHeld` already has
850
+ * `action`) does not queue again, matching a real key's auto-repeat never
851
+ * re-firing `isJustPressed`. The `false` branch mirrors real `onKeyUp`
852
+ * instead (immediate write, no queue needed — nothing in `poll()`
853
+ * reassigns `virtualDigitalJustReleased`), and only fires when the action
854
+ * was actually held (no released→released re-fire).
855
+ */
856
+ private applyVirtualActionValue;
857
+ /**
858
+ * One-frame press of a `'digital'` action (Task 1.4): queues `action` so it
859
+ * reads `isJustPressed`/`isPressed` true for EXACTLY the next `poll()`'s
860
+ * frame — promoted to the "active" set at the top of `poll()`, cleared in
861
+ * `endFrame()` alongside every other just-pressed edge set (see both
862
+ * above). Hollowstone's `queued`/`beginFrame` tap contract, ported onto
863
+ * this engine's existing fixed-step `poll()`/`endFrame()` bracket instead
864
+ * of a bespoke `beginFrame()` hook.
865
+ *
866
+ * Throws the same errors as {@link setVirtualAction} (unknown action;
867
+ * non-digital valueType). A gated tap does NOT queue — it must not fire on
868
+ * a later frame once input becomes active again — and returns
869
+ * `{delivered: false, reason}`.
870
+ */
871
+ tapVirtualAction(action: string): {
872
+ delivered: boolean;
873
+ reason?: string;
874
+ };
875
+ /** Clear all virtual-action state — held digitals, queued/active taps, and
876
+ * scalar/vector2 values. `flushHeldState()` (the same flush
877
+ * `setEnabled(false)`/real blur apply to held keys/mouse/touch buttons)
878
+ * shares the underlying wipe, so a bot's held action never survives input
879
+ * being suspended — but only THIS public entry point (a deliberate "let
880
+ * go", the mirror of `setVirtualAction(action, false)` below) manufactures
881
+ * an `isJustReleased` edge for whatever was held; the suspend path stays
882
+ * silent (see `flushHeldState`'s own doc comment). */
883
+ clearVirtualActions(): void;
884
+ /**
885
+ * D15/T-D15.5 — schedule a virtual actuation for exactly `tick`: applied
886
+ * at the START of that tick's `poll()` (composing with `runTicks` — a
887
+ * schedule for tick 500 fires exactly once the sim has been driven through
888
+ * tick 500, regardless of burst size). A digital `true` produces a genuine
889
+ * `isJustPressed` edge exactly at the target tick (not merely a held value
890
+ * — see `applyScheduledActionsForTick`).
891
+ *
892
+ * Throws `InputActionError` for an unregistered `action` and the same
893
+ * valueType-mismatch error every typed getter throws (`assertValueType`) —
894
+ * both checked EAGERLY, at schedule time, not deferred to the target tick.
895
+ * Throws `InputTickError` (`code: 'TICK_ALREADY_PASSED'`) when `tick` is
896
+ * strictly less than the tick `poll()` will service NEXT — scheduling only
897
+ * ever reaches the current or a future tick. A tick whose input phase
898
+ * never runs (this world paused/frozen at that point, or a multi-tick gap
899
+ * — see `poll()`) drops its scheduled entries rather than replaying them
900
+ * late — each drop emits one `'input.schedule.dropped'` debug event
901
+ * (`{tick, action}`) via {@link setDebugEmit}'s sink, if one is wired.
902
+ */
903
+ scheduleActionAtTick(tick: number, action: string, value: boolean | number | {
904
+ x: number;
905
+ y: number;
906
+ }): void;
907
+ /** Wire (or clear, via `null`) the sink `poll()` calls with
908
+ * `'input.schedule.dropped'` (`{tick, action}`) whenever it discards a
909
+ * scheduled entry for a tick whose input phase never ran. Called once by
910
+ * whoever constructs this `InputManager` with a `DebugRegistry` behind it
911
+ * (`setup-three-root-adapter.ts`), the same seed spot as
912
+ * `setVirtualInputTarget`/`setInputActionsSource` — never called directly
913
+ * by gameplay code. */
914
+ setDebugEmit(fn: ((event: string, detail?: unknown) => void) | null): void;
915
+ /** D15/T-D15.5 — start (or restart) recording the post-gate action-delta
916
+ * trace: clears any prior trace/snapshot, so a fresh recording session
917
+ * never carries over stale deltas from an earlier one. */
918
+ startInputRecording(): void;
919
+ /** D15/T-D15.5 — stop recording (the trace accumulated so far stays
920
+ * readable via {@link getInputTrace} until the next `startInputRecording`
921
+ * clears it). Idempotent. */
922
+ stopInputRecording(): void;
923
+ /** D15/T-D15.5 — whether a recording is currently active. */
924
+ isInputRecording(): boolean;
925
+ /** D15/T-D15.5 — the recorded trace so far (a defensive copy), versioned
926
+ * per the design doc's format sketch (§2.c). SP5 (out of scope here) is
927
+ * the eventual consumer that replays this; this module only ever
928
+ * RECORDS. */
929
+ getInputTrace(): {
930
+ version: 1;
931
+ ticks: {
932
+ tick: number;
933
+ actions: Record<string, boolean | number | {
934
+ x: number;
935
+ y: number;
936
+ }>;
937
+ }[];
938
+ };
939
+ /** Request pointer lock for FPS-style mouse control */
940
+ requestPointerLock(element: HTMLElement): void;
941
+ /** Clean up event listeners */
942
+ dispose(): void;
943
+ }
944
+ //# sourceMappingURL=input-manager.d.ts.map