@vgai/engine 0.5.0 โ†’ 0.5.2

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 (538) hide show
  1. package/package.json +1 -1
  2. package/schemas/engine-capabilities.json +4 -4
  3. package/schemas/vgai-game.schema.json +2 -2
  4. package/src/adapter/authoring.ts +42 -0
  5. package/src/adapter/index.ts +3 -0
  6. package/src/adapter/ingest/overlay-apply.ts +50 -6
  7. package/src/adapter/ingest/scene-capture.ts +51 -2
  8. package/src/adapter/vgai-scene-game-adapter.ts +24 -0
  9. package/src/manifest/schema.ts +7 -3
  10. package/src/runtime/create-runtime.ts +97 -0
  11. package/src/runtime/game.ts +11 -1
  12. package/src/scene/asset-ref-check.ts +1 -1
  13. package/src/scene/scene-loader.ts +2 -2
  14. package/src/scene/user-data.ts +18 -0
  15. package/src/world3d-react/behavior.tsx +19 -11
  16. package/src/world3d-react/r3f-adapter.tsx +8 -0
  17. package/dist/adapter/adapter-surface.d.ts +0 -30
  18. package/dist/adapter/adapter-surface.d.ts.map +0 -1
  19. package/dist/adapter/adapter-surface.js +0 -18
  20. package/dist/adapter/authoring.d.ts +0 -461
  21. package/dist/adapter/authoring.d.ts.map +0 -1
  22. package/dist/adapter/authoring.js +0 -22
  23. package/dist/adapter/colyseus-networking-adapter.d.ts +0 -43
  24. package/dist/adapter/colyseus-networking-adapter.d.ts.map +0 -1
  25. package/dist/adapter/colyseus-networking-adapter.js +0 -38
  26. package/dist/adapter/first-party-systems.d.ts +0 -38
  27. package/dist/adapter/first-party-systems.d.ts.map +0 -1
  28. package/dist/adapter/first-party-systems.js +0 -77
  29. package/dist/adapter/game-adapter.d.ts +0 -133
  30. package/dist/adapter/game-adapter.d.ts.map +0 -1
  31. package/dist/adapter/game-adapter.js +0 -10
  32. package/dist/adapter/host-context.d.ts +0 -71
  33. package/dist/adapter/host-context.d.ts.map +0 -1
  34. package/dist/adapter/host-context.js +0 -16
  35. package/dist/adapter/index.d.ts +0 -22
  36. package/dist/adapter/index.d.ts.map +0 -1
  37. package/dist/adapter/index.js +0 -15
  38. package/dist/adapter/ingest/game-contract.d.ts +0 -53
  39. package/dist/adapter/ingest/game-contract.d.ts.map +0 -1
  40. package/dist/adapter/ingest/game-contract.js +0 -30
  41. package/dist/adapter/ingest/overlay-applier.d.ts +0 -118
  42. package/dist/adapter/ingest/overlay-applier.d.ts.map +0 -1
  43. package/dist/adapter/ingest/overlay-applier.js +0 -132
  44. package/dist/adapter/ingest/overlay-apply.d.ts +0 -60
  45. package/dist/adapter/ingest/overlay-apply.d.ts.map +0 -1
  46. package/dist/adapter/ingest/overlay-apply.js +0 -101
  47. package/dist/adapter/ingest/overlay-file.d.ts +0 -79
  48. package/dist/adapter/ingest/overlay-file.d.ts.map +0 -1
  49. package/dist/adapter/ingest/overlay-file.js +0 -66
  50. package/dist/adapter/ingest/overlay-report.d.ts +0 -113
  51. package/dist/adapter/ingest/overlay-report.d.ts.map +0 -1
  52. package/dist/adapter/ingest/overlay-report.js +0 -103
  53. package/dist/adapter/ingest/scene-capture.d.ts +0 -97
  54. package/dist/adapter/ingest/scene-capture.d.ts.map +0 -1
  55. package/dist/adapter/ingest/scene-capture.js +0 -248
  56. package/dist/adapter/ingest/upstream-pin.d.ts +0 -47
  57. package/dist/adapter/ingest/upstream-pin.d.ts.map +0 -1
  58. package/dist/adapter/ingest/upstream-pin.js +0 -50
  59. package/dist/adapter/loop-gate-report.d.ts +0 -34
  60. package/dist/adapter/loop-gate-report.d.ts.map +0 -1
  61. package/dist/adapter/loop-gate-report.js +0 -37
  62. package/dist/adapter/rapier-physics-adapter.d.ts +0 -12
  63. package/dist/adapter/rapier-physics-adapter.d.ts.map +0 -1
  64. package/dist/adapter/rapier-physics-adapter.js +0 -46
  65. package/dist/adapter/system-adapter.d.ts +0 -206
  66. package/dist/adapter/system-adapter.d.ts.map +0 -1
  67. package/dist/adapter/system-adapter.js +0 -13
  68. package/dist/adapter/transform.d.ts +0 -18
  69. package/dist/adapter/transform.d.ts.map +0 -1
  70. package/dist/adapter/transform.js +0 -1
  71. package/dist/adapter/vgai-scene-game-adapter.d.ts +0 -108
  72. package/dist/adapter/vgai-scene-game-adapter.d.ts.map +0 -1
  73. package/dist/adapter/vgai-scene-game-adapter.js +0 -762
  74. package/dist/ai/navigation.d.ts +0 -64
  75. package/dist/ai/navigation.d.ts.map +0 -1
  76. package/dist/ai/navigation.js +0 -133
  77. package/dist/animation/anim-graph-types.d.ts +0 -25
  78. package/dist/animation/anim-graph-types.d.ts.map +0 -1
  79. package/dist/animation/anim-graph-types.js +0 -1
  80. package/dist/animation/animation-clock.d.ts +0 -213
  81. package/dist/animation/animation-clock.d.ts.map +0 -1
  82. package/dist/animation/animation-clock.js +0 -301
  83. package/dist/animation/blend-node.d.ts +0 -22
  84. package/dist/animation/blend-node.d.ts.map +0 -1
  85. package/dist/animation/blend-node.js +0 -97
  86. package/dist/animation/camera-ownership.d.ts +0 -250
  87. package/dist/animation/camera-ownership.d.ts.map +0 -1
  88. package/dist/animation/camera-ownership.js +0 -169
  89. package/dist/animation/cinematic-cues.d.ts +0 -200
  90. package/dist/animation/cinematic-cues.d.ts.map +0 -1
  91. package/dist/animation/cinematic-cues.js +0 -213
  92. package/dist/animation/clip-map.d.ts +0 -12
  93. package/dist/animation/clip-map.d.ts.map +0 -1
  94. package/dist/animation/clip-map.js +0 -37
  95. package/dist/animation/gsap-registration.d.ts +0 -119
  96. package/dist/animation/gsap-registration.d.ts.map +0 -1
  97. package/dist/animation/gsap-registration.js +0 -92
  98. package/dist/animation/theatre-clock-binding.d.ts +0 -89
  99. package/dist/animation/theatre-clock-binding.d.ts.map +0 -1
  100. package/dist/animation/theatre-clock-binding.js +0 -29
  101. package/dist/animation/theatre-director.d.ts +0 -242
  102. package/dist/animation/theatre-director.d.ts.map +0 -1
  103. package/dist/animation/theatre-director.js +0 -235
  104. package/dist/animation/theatre-object-binding.d.ts +0 -305
  105. package/dist/animation/theatre-object-binding.d.ts.map +0 -1
  106. package/dist/animation/theatre-object-binding.js +0 -351
  107. package/dist/animation/xstate-animation-binding.d.ts +0 -56
  108. package/dist/animation/xstate-animation-binding.d.ts.map +0 -1
  109. package/dist/animation/xstate-animation-binding.js +0 -331
  110. package/dist/animation/xstate-animation-meta.d.ts +0 -266
  111. package/dist/animation/xstate-animation-meta.d.ts.map +0 -1
  112. package/dist/animation/xstate-animation-meta.js +0 -252
  113. package/dist/assets.d.ts +0 -26
  114. package/dist/assets.d.ts.map +0 -1
  115. package/dist/assets.js +0 -55
  116. package/dist/audio/index.d.ts +0 -4
  117. package/dist/audio/index.d.ts.map +0 -1
  118. package/dist/audio/index.js +0 -24
  119. package/dist/audio/tone-clock-binding.d.ts +0 -75
  120. package/dist/audio/tone-clock-binding.d.ts.map +0 -1
  121. package/dist/audio/tone-clock-binding.js +0 -29
  122. package/dist/audio/tone-context.d.ts +0 -114
  123. package/dist/audio/tone-context.d.ts.map +0 -1
  124. package/dist/audio/tone-context.js +0 -39
  125. package/dist/audio/tone-offline-render.d.ts +0 -90
  126. package/dist/audio/tone-offline-render.d.ts.map +0 -1
  127. package/dist/audio/tone-offline-render.js +0 -56
  128. package/dist/audio/wav-encode.d.ts +0 -38
  129. package/dist/audio/wav-encode.d.ts.map +0 -1
  130. package/dist/audio/wav-encode.js +0 -97
  131. package/dist/character/cloth-sim.d.ts +0 -179
  132. package/dist/character/cloth-sim.d.ts.map +0 -1
  133. package/dist/character/cloth-sim.js +0 -334
  134. package/dist/character/spring-chain.d.ts +0 -135
  135. package/dist/character/spring-chain.d.ts.map +0 -1
  136. package/dist/character/spring-chain.js +0 -165
  137. package/dist/core/game-loop.d.ts +0 -42
  138. package/dist/core/game-loop.d.ts.map +0 -1
  139. package/dist/core/game-loop.js +0 -167
  140. package/dist/core/seeded-random.d.ts +0 -69
  141. package/dist/core/seeded-random.d.ts.map +0 -1
  142. package/dist/core/seeded-random.js +0 -121
  143. package/dist/core/system-runner.d.ts +0 -120
  144. package/dist/core/system-runner.d.ts.map +0 -1
  145. package/dist/core/system-runner.js +0 -297
  146. package/dist/core/types.d.ts +0 -92
  147. package/dist/core/types.d.ts.map +0 -1
  148. package/dist/core/types.js +0 -25
  149. package/dist/data/data-asset.d.ts +0 -101
  150. package/dist/data/data-asset.d.ts.map +0 -1
  151. package/dist/data/data-asset.js +0 -122
  152. package/dist/data/data-check-core.d.ts +0 -110
  153. package/dist/data/data-check-core.d.ts.map +0 -1
  154. package/dist/data/data-check-core.js +0 -178
  155. package/dist/data/data-ref.d.ts +0 -79
  156. package/dist/data/data-ref.d.ts.map +0 -1
  157. package/dist/data/data-ref.js +0 -130
  158. package/dist/data/vite-plugin-data.d.ts +0 -79
  159. package/dist/data/vite-plugin-data.d.ts.map +0 -1
  160. package/dist/data/vite-plugin-data.js +0 -217
  161. package/dist/dev/console-bridge.d.ts +0 -22
  162. package/dist/dev/console-bridge.d.ts.map +0 -1
  163. package/dist/dev/console-bridge.js +0 -71
  164. package/dist/dev/debug-draw.d.ts +0 -24
  165. package/dist/dev/debug-draw.d.ts.map +0 -1
  166. package/dist/dev/debug-draw.js +0 -73
  167. package/dist/dev/logger.d.ts +0 -30
  168. package/dist/dev/logger.d.ts.map +0 -1
  169. package/dist/dev/logger.js +0 -90
  170. package/dist/dev/performance-profiler.d.ts +0 -60
  171. package/dist/dev/performance-profiler.d.ts.map +0 -1
  172. package/dist/dev/performance-profiler.js +0 -181
  173. package/dist/dev/webgl-gpu-timer.d.ts +0 -8
  174. package/dist/dev/webgl-gpu-timer.d.ts.map +0 -1
  175. package/dist/dev/webgl-gpu-timer.js +0 -52
  176. package/dist/ecs/component-manager.d.ts +0 -205
  177. package/dist/ecs/component-manager.d.ts.map +0 -1
  178. package/dist/ecs/component-manager.js +0 -706
  179. package/dist/ecs/game-component.d.ts +0 -146
  180. package/dist/ecs/game-component.d.ts.map +0 -1
  181. package/dist/ecs/game-component.js +0 -141
  182. package/dist/ecs/hmr-swap-report.d.ts +0 -53
  183. package/dist/ecs/hmr-swap-report.d.ts.map +0 -1
  184. package/dist/ecs/hmr-swap-report.js +0 -55
  185. package/dist/humanoid/bake.operation.d.ts +0 -119
  186. package/dist/humanoid/bake.operation.d.ts.map +0 -1
  187. package/dist/humanoid/bake.operation.js +0 -228
  188. package/dist/humanoid/body.d.ts +0 -101
  189. package/dist/humanoid/body.d.ts.map +0 -1
  190. package/dist/humanoid/body.js +0 -530
  191. package/dist/humanoid/clips.d.ts +0 -62
  192. package/dist/humanoid/clips.d.ts.map +0 -1
  193. package/dist/humanoid/clips.js +0 -121
  194. package/dist/humanoid/compose.d.ts +0 -75
  195. package/dist/humanoid/compose.d.ts.map +0 -1
  196. package/dist/humanoid/compose.js +0 -176
  197. package/dist/humanoid/generate.d.ts +0 -92
  198. package/dist/humanoid/generate.d.ts.map +0 -1
  199. package/dist/humanoid/generate.js +0 -124
  200. package/dist/humanoid/index.d.ts +0 -24
  201. package/dist/humanoid/index.d.ts.map +0 -1
  202. package/dist/humanoid/index.js +0 -18
  203. package/dist/humanoid/schema.d.ts +0 -35
  204. package/dist/humanoid/schema.d.ts.map +0 -1
  205. package/dist/humanoid/schema.js +0 -87
  206. package/dist/humanoid/skeleton.d.ts +0 -103
  207. package/dist/humanoid/skeleton.d.ts.map +0 -1
  208. package/dist/humanoid/skeleton.js +0 -289
  209. package/dist/index.d.ts +0 -37
  210. package/dist/index.d.ts.map +0 -1
  211. package/dist/index.js +0 -30
  212. package/dist/input/input-manager.d.ts +0 -945
  213. package/dist/input/input-manager.d.ts.map +0 -1
  214. package/dist/input/input-manager.js +0 -2207
  215. package/dist/input/input-types.d.ts +0 -174
  216. package/dist/input/input-types.d.ts.map +0 -1
  217. package/dist/input/input-types.js +0 -1
  218. package/dist/input/prompt-labels.d.ts +0 -21
  219. package/dist/input/prompt-labels.d.ts.map +0 -1
  220. package/dist/input/prompt-labels.js +0 -121
  221. package/dist/input/rebind-controller.d.ts +0 -59
  222. package/dist/input/rebind-controller.d.ts.map +0 -1
  223. package/dist/input/rebind-controller.js +0 -85
  224. package/dist/input/schema.d.ts +0 -16
  225. package/dist/input/schema.d.ts.map +0 -1
  226. package/dist/input/schema.js +0 -228
  227. package/dist/loader.d.ts +0 -43
  228. package/dist/loader.d.ts.map +0 -1
  229. package/dist/loader.js +0 -59
  230. package/dist/manifest/index.d.ts +0 -5
  231. package/dist/manifest/index.d.ts.map +0 -1
  232. package/dist/manifest/index.js +0 -8
  233. package/dist/manifest/load-file.d.ts +0 -4
  234. package/dist/manifest/load-file.d.ts.map +0 -1
  235. package/dist/manifest/load-file.js +0 -14
  236. package/dist/manifest/load.d.ts +0 -144
  237. package/dist/manifest/load.d.ts.map +0 -1
  238. package/dist/manifest/load.js +0 -273
  239. package/dist/manifest/schema.d.ts +0 -230
  240. package/dist/manifest/schema.d.ts.map +0 -1
  241. package/dist/manifest/schema.js +0 -394
  242. package/dist/physics/collision-system.d.ts +0 -41
  243. package/dist/physics/collision-system.d.ts.map +0 -1
  244. package/dist/physics/collision-system.js +0 -64
  245. package/dist/physics/physics-registry.d.ts +0 -45
  246. package/dist/physics/physics-registry.d.ts.map +0 -1
  247. package/dist/physics/physics-registry.js +0 -65
  248. package/dist/physics/transform-writer.d.ts +0 -16
  249. package/dist/physics/transform-writer.d.ts.map +0 -1
  250. package/dist/physics/transform-writer.js +0 -38
  251. package/dist/physics/trigger-dispatch.d.ts +0 -24
  252. package/dist/physics/trigger-dispatch.d.ts.map +0 -1
  253. package/dist/physics/trigger-dispatch.js +0 -80
  254. package/dist/react/game-state.d.ts +0 -156
  255. package/dist/react/game-state.d.ts.map +0 -1
  256. package/dist/react/game-state.js +0 -222
  257. package/dist/react/root-adapter.d.ts +0 -11
  258. package/dist/react/root-adapter.d.ts.map +0 -1
  259. package/dist/react/root-adapter.js +0 -41
  260. package/dist/react/unmanaged-root-detector.d.ts +0 -12
  261. package/dist/react/unmanaged-root-detector.d.ts.map +0 -1
  262. package/dist/react/unmanaged-root-detector.js +0 -45
  263. package/dist/react/use-data.d.ts +0 -60
  264. package/dist/react/use-data.d.ts.map +0 -1
  265. package/dist/react/use-data.js +0 -101
  266. package/dist/react/use-selection.d.ts +0 -75
  267. package/dist/react/use-selection.d.ts.map +0 -1
  268. package/dist/react/use-selection.js +0 -90
  269. package/dist/render/auto-batcher.d.ts +0 -34
  270. package/dist/render/auto-batcher.d.ts.map +0 -1
  271. package/dist/render/auto-batcher.js +0 -140
  272. package/dist/render/render-batch-system.d.ts +0 -33
  273. package/dist/render/render-batch-system.d.ts.map +0 -1
  274. package/dist/render/render-batch-system.js +0 -230
  275. package/dist/render/render-features.d.ts +0 -47
  276. package/dist/render/render-features.d.ts.map +0 -1
  277. package/dist/render/render-features.js +0 -105
  278. package/dist/render/render-settings.d.ts +0 -36
  279. package/dist/render/render-settings.d.ts.map +0 -1
  280. package/dist/render/render-settings.js +0 -51
  281. package/dist/runtime/create-runtime.d.ts +0 -249
  282. package/dist/runtime/create-runtime.d.ts.map +0 -1
  283. package/dist/runtime/create-runtime.js +0 -641
  284. package/dist/runtime/debug-bridge.d.ts +0 -257
  285. package/dist/runtime/debug-bridge.d.ts.map +0 -1
  286. package/dist/runtime/debug-bridge.js +0 -224
  287. package/dist/runtime/debug-registry.d.ts +0 -288
  288. package/dist/runtime/debug-registry.d.ts.map +0 -1
  289. package/dist/runtime/debug-registry.js +0 -513
  290. package/dist/runtime/frame-selector-cache.d.ts +0 -41
  291. package/dist/runtime/frame-selector-cache.d.ts.map +0 -1
  292. package/dist/runtime/frame-selector-cache.js +0 -65
  293. package/dist/runtime/game.d.ts +0 -496
  294. package/dist/runtime/game.d.ts.map +0 -1
  295. package/dist/runtime/game.js +0 -741
  296. package/dist/runtime/gameplay-rng-trap.d.ts +0 -48
  297. package/dist/runtime/gameplay-rng-trap.d.ts.map +0 -1
  298. package/dist/runtime/gameplay-rng-trap.js +0 -96
  299. package/dist/runtime/input-router.d.ts +0 -78
  300. package/dist/runtime/input-router.d.ts.map +0 -1
  301. package/dist/runtime/input-router.js +0 -171
  302. package/dist/runtime/mount-game.d.ts +0 -129
  303. package/dist/runtime/mount-game.d.ts.map +0 -1
  304. package/dist/runtime/mount-game.js +0 -152
  305. package/dist/runtime/mount-manifest.d.ts +0 -173
  306. package/dist/runtime/mount-manifest.d.ts.map +0 -1
  307. package/dist/runtime/mount-manifest.js +0 -297
  308. package/dist/runtime/render-audio-control.d.ts +0 -110
  309. package/dist/runtime/render-audio-control.d.ts.map +0 -1
  310. package/dist/runtime/render-audio-control.js +0 -111
  311. package/dist/runtime/render-control.d.ts +0 -291
  312. package/dist/runtime/render-control.d.ts.map +0 -1
  313. package/dist/runtime/render-control.js +0 -264
  314. package/dist/runtime/render-seed.d.ts +0 -57
  315. package/dist/runtime/render-seed.d.ts.map +0 -1
  316. package/dist/runtime/render-seed.js +0 -74
  317. package/dist/runtime/state-bridge.d.ts +0 -61
  318. package/dist/runtime/state-bridge.d.ts.map +0 -1
  319. package/dist/runtime/state-bridge.js +0 -63
  320. package/dist/runtime/types.d.ts +0 -253
  321. package/dist/runtime/types.d.ts.map +0 -1
  322. package/dist/runtime/types.js +0 -1
  323. package/dist/scene/asset-loaders.d.ts +0 -79
  324. package/dist/scene/asset-loaders.d.ts.map +0 -1
  325. package/dist/scene/asset-loaders.js +0 -141
  326. package/dist/scene/asset-paths.d.ts +0 -11
  327. package/dist/scene/asset-paths.d.ts.map +0 -1
  328. package/dist/scene/asset-paths.js +0 -108
  329. package/dist/scene/asset-ref-check.d.ts +0 -88
  330. package/dist/scene/asset-ref-check.d.ts.map +0 -1
  331. package/dist/scene/asset-ref-check.js +0 -214
  332. package/dist/scene/asset-registry.d.ts +0 -38
  333. package/dist/scene/asset-registry.d.ts.map +0 -1
  334. package/dist/scene/asset-registry.js +0 -66
  335. package/dist/scene/collider-dimensions.d.ts +0 -63
  336. package/dist/scene/collider-dimensions.d.ts.map +0 -1
  337. package/dist/scene/collider-dimensions.js +0 -98
  338. package/dist/scene/component-registry.d.ts +0 -22
  339. package/dist/scene/component-registry.d.ts.map +0 -1
  340. package/dist/scene/component-registry.js +0 -37
  341. package/dist/scene/defaults.d.ts +0 -252
  342. package/dist/scene/defaults.d.ts.map +0 -1
  343. package/dist/scene/defaults.js +0 -151
  344. package/dist/scene/geometries/index.d.ts +0 -8
  345. package/dist/scene/geometries/index.d.ts.map +0 -1
  346. package/dist/scene/geometries/index.js +0 -7
  347. package/dist/scene/geometries/terrain.d.ts +0 -2
  348. package/dist/scene/geometries/terrain.d.ts.map +0 -1
  349. package/dist/scene/geometries/terrain.js +0 -37
  350. package/dist/scene/geometry-registry.d.ts +0 -24
  351. package/dist/scene/geometry-registry.d.ts.map +0 -1
  352. package/dist/scene/geometry-registry.js +0 -20
  353. package/dist/scene/instance-registry.d.ts +0 -36
  354. package/dist/scene/instance-registry.d.ts.map +0 -1
  355. package/dist/scene/instance-registry.js +0 -55
  356. package/dist/scene/instancers/grid.d.ts +0 -2
  357. package/dist/scene/instancers/grid.d.ts.map +0 -1
  358. package/dist/scene/instancers/grid.js +0 -36
  359. package/dist/scene/instancers/index.d.ts +0 -8
  360. package/dist/scene/instancers/index.d.ts.map +0 -1
  361. package/dist/scene/instancers/index.js +0 -7
  362. package/dist/scene/light-camera-factory.d.ts +0 -23
  363. package/dist/scene/light-camera-factory.d.ts.map +0 -1
  364. package/dist/scene/light-camera-factory.js +0 -68
  365. package/dist/scene/material-factory.d.ts +0 -17
  366. package/dist/scene/material-factory.d.ts.map +0 -1
  367. package/dist/scene/material-factory.js +0 -197
  368. package/dist/scene/material-registry.d.ts +0 -40
  369. package/dist/scene/material-registry.d.ts.map +0 -1
  370. package/dist/scene/material-registry.js +0 -44
  371. package/dist/scene/materials/index.d.ts +0 -8
  372. package/dist/scene/materials/index.d.ts.map +0 -1
  373. package/dist/scene/materials/index.js +0 -7
  374. package/dist/scene/materials/water.d.ts +0 -2
  375. package/dist/scene/materials/water.d.ts.map +0 -1
  376. package/dist/scene/materials/water.js +0 -54
  377. package/dist/scene/parse.d.ts +0 -23
  378. package/dist/scene/parse.d.ts.map +0 -1
  379. package/dist/scene/parse.js +0 -179
  380. package/dist/scene/particles-factory.d.ts +0 -33
  381. package/dist/scene/particles-factory.d.ts.map +0 -1
  382. package/dist/scene/particles-factory.js +0 -282
  383. package/dist/scene/scene-apply.d.ts +0 -109
  384. package/dist/scene/scene-apply.d.ts.map +0 -1
  385. package/dist/scene/scene-apply.js +0 -370
  386. package/dist/scene/scene-diff-schema.d.ts +0 -285
  387. package/dist/scene/scene-diff-schema.d.ts.map +0 -1
  388. package/dist/scene/scene-diff-schema.js +0 -92
  389. package/dist/scene/scene-diff-types.d.ts +0 -40
  390. package/dist/scene/scene-diff-types.d.ts.map +0 -1
  391. package/dist/scene/scene-diff-types.js +0 -14
  392. package/dist/scene/scene-loader.d.ts +0 -167
  393. package/dist/scene/scene-loader.d.ts.map +0 -1
  394. package/dist/scene/scene-loader.js +0 -1211
  395. package/dist/scene/scene-query.d.ts +0 -11
  396. package/dist/scene/scene-query.d.ts.map +0 -1
  397. package/dist/scene/scene-query.js +0 -63
  398. package/dist/scene/scene-types.d.ts +0 -10
  399. package/dist/scene/scene-types.d.ts.map +0 -1
  400. package/dist/scene/scene-types.js +0 -8
  401. package/dist/scene/scene-version.d.ts +0 -26
  402. package/dist/scene/scene-version.d.ts.map +0 -1
  403. package/dist/scene/scene-version.js +0 -34
  404. package/dist/scene/schema/animation.d.ts +0 -8
  405. package/dist/scene/schema/animation.d.ts.map +0 -1
  406. package/dist/scene/schema/animation.js +0 -42
  407. package/dist/scene/schema/audio.d.ts +0 -13
  408. package/dist/scene/schema/audio.d.ts.map +0 -1
  409. package/dist/scene/schema/audio.js +0 -22
  410. package/dist/scene/schema/camera.d.ts +0 -28
  411. package/dist/scene/schema/camera.d.ts.map +0 -1
  412. package/dist/scene/schema/camera.js +0 -17
  413. package/dist/scene/schema/collider.d.ts +0 -40
  414. package/dist/scene/schema/collider.d.ts.map +0 -1
  415. package/dist/scene/schema/collider.js +0 -55
  416. package/dist/scene/schema/entity-ref.d.ts +0 -31
  417. package/dist/scene/schema/entity-ref.d.ts.map +0 -1
  418. package/dist/scene/schema/entity-ref.js +0 -61
  419. package/dist/scene/schema/entity.d.ts +0 -1036
  420. package/dist/scene/schema/entity.d.ts.map +0 -1
  421. package/dist/scene/schema/entity.js +0 -153
  422. package/dist/scene/schema/environment.d.ts +0 -425
  423. package/dist/scene/schema/environment.d.ts.map +0 -1
  424. package/dist/scene/schema/environment.js +0 -357
  425. package/dist/scene/schema/index.d.ts +0 -37
  426. package/dist/scene/schema/index.d.ts.map +0 -1
  427. package/dist/scene/schema/index.js +0 -19
  428. package/dist/scene/schema/instances.d.ts +0 -14
  429. package/dist/scene/schema/instances.d.ts.map +0 -1
  430. package/dist/scene/schema/instances.js +0 -28
  431. package/dist/scene/schema/joint.d.ts +0 -23
  432. package/dist/scene/schema/joint.d.ts.map +0 -1
  433. package/dist/scene/schema/joint.js +0 -23
  434. package/dist/scene/schema/light.d.ts +0 -38
  435. package/dist/scene/schema/light.d.ts.map +0 -1
  436. package/dist/scene/schema/light.js +0 -26
  437. package/dist/scene/schema/material.d.ts +0 -199
  438. package/dist/scene/schema/material.d.ts.map +0 -1
  439. package/dist/scene/schema/material.js +0 -103
  440. package/dist/scene/schema/mesh.d.ts +0 -48
  441. package/dist/scene/schema/mesh.d.ts.map +0 -1
  442. package/dist/scene/schema/mesh.js +0 -82
  443. package/dist/scene/schema/particles.d.ts +0 -2178
  444. package/dist/scene/schema/particles.d.ts.map +0 -1
  445. package/dist/scene/schema/particles.js +0 -321
  446. package/dist/scene/schema/physics.d.ts +0 -56
  447. package/dist/scene/schema/physics.d.ts.map +0 -1
  448. package/dist/scene/schema/physics.js +0 -37
  449. package/dist/scene/schema/scene-file.d.ts +0 -303
  450. package/dist/scene/schema/scene-file.d.ts.map +0 -1
  451. package/dist/scene/schema/scene-file.js +0 -256
  452. package/dist/scene/schema/shadow.d.ts +0 -28
  453. package/dist/scene/schema/shadow.d.ts.map +0 -1
  454. package/dist/scene/schema/shadow.js +0 -20
  455. package/dist/scene/schema/spline.d.ts +0 -25
  456. package/dist/scene/schema/spline.d.ts.map +0 -1
  457. package/dist/scene/schema/spline.js +0 -15
  458. package/dist/scene/schema/tuples.d.ts +0 -12
  459. package/dist/scene/schema/tuples.d.ts.map +0 -1
  460. package/dist/scene/schema/tuples.js +0 -14
  461. package/dist/scene/user-data.d.ts +0 -185
  462. package/dist/scene/user-data.d.ts.map +0 -1
  463. package/dist/scene/user-data.js +0 -144
  464. package/dist/setup/setup-audio.d.ts +0 -20
  465. package/dist/setup/setup-audio.d.ts.map +0 -1
  466. package/dist/setup/setup-audio.js +0 -41
  467. package/dist/setup/setup-particles.d.ts +0 -17
  468. package/dist/setup/setup-particles.d.ts.map +0 -1
  469. package/dist/setup/setup-particles.js +0 -16
  470. package/dist/setup/setup-physics.d.ts +0 -25
  471. package/dist/setup/setup-physics.d.ts.map +0 -1
  472. package/dist/setup/setup-physics.js +0 -51
  473. package/dist/setup/setup-renderer.d.ts +0 -69
  474. package/dist/setup/setup-renderer.d.ts.map +0 -1
  475. package/dist/setup/setup-renderer.js +0 -363
  476. package/dist/tools/define-tool.d.ts +0 -130
  477. package/dist/tools/define-tool.d.ts.map +0 -1
  478. package/dist/tools/define-tool.js +0 -96
  479. package/dist/world2d/authoring-2d.d.ts +0 -80
  480. package/dist/world2d/authoring-2d.d.ts.map +0 -1
  481. package/dist/world2d/authoring-2d.js +0 -195
  482. package/dist/world2d/capture-to-scene2d.d.ts +0 -5
  483. package/dist/world2d/capture-to-scene2d.d.ts.map +0 -1
  484. package/dist/world2d/capture-to-scene2d.js +0 -49
  485. package/dist/world2d/collision-2d.d.ts +0 -52
  486. package/dist/world2d/collision-2d.d.ts.map +0 -1
  487. package/dist/world2d/collision-2d.js +0 -70
  488. package/dist/world2d/components-2d.d.ts +0 -47
  489. package/dist/world2d/components-2d.d.ts.map +0 -1
  490. package/dist/world2d/components-2d.js +0 -77
  491. package/dist/world2d/index.d.ts +0 -34
  492. package/dist/world2d/index.d.ts.map +0 -1
  493. package/dist/world2d/index.js +0 -32
  494. package/dist/world2d/ingest-iframe-2d.d.ts +0 -82
  495. package/dist/world2d/ingest-iframe-2d.d.ts.map +0 -1
  496. package/dist/world2d/ingest-iframe-2d.js +0 -166
  497. package/dist/world2d/ingest2d.d.ts +0 -97
  498. package/dist/world2d/ingest2d.d.ts.map +0 -1
  499. package/dist/world2d/ingest2d.js +0 -40
  500. package/dist/world2d/physics2d-registry.d.ts +0 -24
  501. package/dist/world2d/physics2d-registry.d.ts.map +0 -1
  502. package/dist/world2d/physics2d-registry.js +0 -38
  503. package/dist/world2d/pixi-game-adapter.d.ts +0 -107
  504. package/dist/world2d/pixi-game-adapter.d.ts.map +0 -1
  505. package/dist/world2d/pixi-game-adapter.js +0 -210
  506. package/dist/world2d/pixi-surface.d.ts +0 -39
  507. package/dist/world2d/pixi-surface.d.ts.map +0 -1
  508. package/dist/world2d/pixi-surface.js +0 -47
  509. package/dist/world2d/scene-capture-2d.d.ts +0 -43
  510. package/dist/world2d/scene-capture-2d.d.ts.map +0 -1
  511. package/dist/world2d/scene-capture-2d.js +0 -92
  512. package/dist/world2d/scene2d-loader.d.ts +0 -27
  513. package/dist/world2d/scene2d-loader.d.ts.map +0 -1
  514. package/dist/world2d/scene2d-loader.js +0 -275
  515. package/dist/world2d/schema/entity2d.d.ts +0 -102
  516. package/dist/world2d/schema/entity2d.d.ts.map +0 -1
  517. package/dist/world2d/schema/entity2d.js +0 -119
  518. package/dist/world2d/schema/physics2d.d.ts +0 -46
  519. package/dist/world2d/schema/physics2d.d.ts.map +0 -1
  520. package/dist/world2d/schema/physics2d.js +0 -45
  521. package/dist/world2d/schema/sprite.d.ts +0 -42
  522. package/dist/world2d/schema/sprite.d.ts.map +0 -1
  523. package/dist/world2d/schema/sprite.js +0 -63
  524. package/dist/world2d/schema/tilemap.d.ts +0 -15
  525. package/dist/world2d/schema/tilemap.d.ts.map +0 -1
  526. package/dist/world2d/schema/tilemap.js +0 -19
  527. package/dist/world2d/schema/tuples2d.d.ts +0 -20
  528. package/dist/world2d/schema/tuples2d.d.ts.map +0 -1
  529. package/dist/world2d/schema/tuples2d.js +0 -19
  530. package/dist/world2d/system-adapters-2d.d.ts +0 -16
  531. package/dist/world2d/system-adapters-2d.d.ts.map +0 -1
  532. package/dist/world2d/system-adapters-2d.js +0 -37
  533. package/dist/world2d/transform-writer-2d.d.ts +0 -16
  534. package/dist/world2d/transform-writer-2d.d.ts.map +0 -1
  535. package/dist/world2d/transform-writer-2d.js +0 -22
  536. package/dist/world2d/types.d.ts +0 -59
  537. package/dist/world2d/types.d.ts.map +0 -1
  538. package/dist/world2d/types.js +0 -1
@@ -1,152 +0,0 @@
1
- // E4 โ€” the S-D composer (docs/unified-world-editor/27-visual-react-editing.md
2
- // ยง7 E4; design lineage docs/unified-world-editor/26-unified-editor-spec.md
3
- // ยง5 Stage S-D). Builds ON `mount-manifest.ts`'s `mountManifestWorlds` (never
4
- // duplicates its per-kind dispatch/validation) to add the one thing that
5
- // module deliberately does NOT have: a KIND REGISTRY, so a project doesn't
6
- // have to hand-build an `entries` map inline in its own `main.ts` every time
7
- // โ€” it registers a `AdapterSurfaceFactory` per kind it uses (once, at module load)
8
- // and then mounts with a single `mountGameFromManifest(manifest, host)` call.
9
- //
10
- // Engine-core react/pixi-free discipline (mirrors `mount-manifest.ts`'s own
11
- // header comment, and the HARD INVARIANT this file was built under): this
12
- // registry is pure mechanism โ€” it holds whatever `AdapterSurfaceFactory` functions
13
- // callers register, but it registers NONE itself. In particular there is no
14
- // built-in 'pixijs'/'react' registration here (that would require this file
15
- // to value-import `pixi.js`/`react`/`react-dom`, exactly what `mount-manifest
16
- // .ts` forbids); a project that has a pixijs or react world MUST register a
17
- // factory for that kind itself โ€” see `defaultThreeAdapterFactory` below for why
18
- // even the 'threejs' convenience export is a plain function the CALLER
19
- // registers, not something this module wires up automatically.
20
- import { mountManifestWorlds, resolveManifest } from './mount-manifest';
21
- // ---------------------------------------------------------------------------
22
- // The registry
23
- // ---------------------------------------------------------------------------
24
- const registry = new Map();
25
- /**
26
- * Register a `AdapterSurfaceFactory` for a manifest world `kind` (`'threejs'` /
27
- * `'pixijs'` / `'react'`, or any future kind the manifest schema grows).
28
- * Call once, at module load โ€” mirrors `registerSceneUIRenderer()`'s existing
29
- * "call before mounting" convention (`packages/editor/template/src/main.ts`).
30
- *
31
- * Throws on double-registration of the SAME kind: an accidental duplicate
32
- * (two side-effect imports of the same registration module, or a copy-paste)
33
- * is far more likely than an intentional runtime swap โ€” a caller that really
34
- * wants to replace a registration must `unregisterAdapter` first, making
35
- * the intent explicit.
36
- */
37
- export function registerAdapter(kind, factory) {
38
- if (registry.has(kind)) {
39
- throw new Error(`registerAdapter: a factory is already registered for kind "${kind}" โ€” ` +
40
- 'call unregisterAdapter(kind) first if you intend to replace it (an accidental ' +
41
- 'double-registration, e.g. two side-effect imports of the same registration module, ' +
42
- 'is far more common than an intentional swap).');
43
- }
44
- registry.set(kind, factory);
45
- }
46
- /** Remove a kind's registration (e.g. before re-registering a replacement). */
47
- export function unregisterAdapter(kind) {
48
- registry.delete(kind);
49
- }
50
- /** Whether a factory is currently registered for `kind`. */
51
- export function isAdapterRegistered(kind) {
52
- return registry.has(kind);
53
- }
54
- /**
55
- * Test-only escape hatch: clears every registration. Registrations are
56
- * meant to be one-time, process-lifetime โ€” production code should never
57
- * call this; it exists so unit tests can start each case from a clean
58
- * registry without cross-test leakage.
59
- */
60
- export function __clearAdapterSurfaceRegistryForTests() {
61
- registry.clear();
62
- }
63
- /**
64
- * A ready-to-register {@link AdapterSurfaceFactory} for `kind: 'threejs'` roots
65
- * that follow the first-party entry-module convention (`export const
66
- * adapter` and/or `export async function setup`) or are plain scene files
67
- * with an optional named `componentRegistry` export. Threejs is safe to
68
- * ship as an exported convenience (unlike pixijs/react) because `three`/
69
- * `VgaiSceneGameAdapter` are already unconditional engine dependencies โ€”
70
- * see `mount-manifest.ts`'s header comment. Still never auto-registered:
71
- * the registry itself stays zero-policy (see this file's header comment) โ€”
72
- * a caller opts in with `registerAdapter('threejs', defaultThreeAdapterFactory)`.
73
- *
74
- * Resolution mirrors `mount-manifest.ts`'s own `resolveThreeAdapter` branch
75
- * order: an entry module's `adapter` export wins outright; else its `setup`
76
- * export (wrapping via `fromSetup` happens inside `mountManifestWorlds`
77
- * itself โ€” this factory just returns the `MountEntry` shape); else (no
78
- * `entry` at all) a scene-driven world, forwarding `componentRegistry` if
79
- * the entry module supplied one.
80
- */
81
- export const defaultThreeAdapterFactory = (world, ctx) => {
82
- const mod = ctx.entryModule;
83
- if (mod?.adapter)
84
- return { kind: 'threejs', adapter: mod.adapter };
85
- if (mod?.setup)
86
- return { kind: 'threejs', setup: mod.setup };
87
- if (world.entry !== undefined) {
88
- throw new Error(`defaultThreeAdapterFactory: entry module "${world.entry}" for world "${world.id}" exports ` +
89
- 'neither `adapter` nor `setup` โ€” every first-party entry module exports at least one ' +
90
- '(export one from the declared entry module).');
91
- }
92
- return { kind: 'threejs', componentRegistry: mod?.componentRegistry };
93
- };
94
- /** True for the one shape `mountManifestWorlds` can ALREADY mount with zero
95
- * `entries[id]` at all (a plain `default`-adapter, scene-driven, no-`entry`
96
- * threejs world โ€” `resolveThreeAdapter`'s own scene branch, which needs
97
- * nothing beyond the manifest itself). Every other shape (pixijs, react, an
98
- * entry-declaring or module/ingest-adapter threejs world) needs SOMETHING
99
- * in `entries[id]` to succeed. */
100
- function worldIsSelfSufficient(world) {
101
- return (world.surface === 'threejs' && world.adapter.type === 'builtin' && world.entry === undefined);
102
- }
103
- /**
104
- * Mount every world declared by a `vgai.game.json` manifest onto `host
105
- * .container`, resolving each world's kind through the `registerAdapter`
106
- * registry โ€” falling back to an explicit `opts.entries[id]` where supplied,
107
- * exactly like `mountManifestWorlds` (so a caller can migrate one world at a
108
- * time, or never touch the registry if it prefers hand-building entries).
109
- *
110
- * This is the "one call" scaffold/example projects mount through (E4
111
- * acceptance): register whatever kinds you need once, then
112
- * `await mountGameFromManifest(manifest, host)` โ€” see
113
- * `packages/editor/template/src/main.ts` for the worked single-world
114
- * example and `examples/tri-world/src/main.ts` for a multi-kind one.
115
- *
116
- * Degrades loudly (`docs/WAVE3-ADAPTER-PLUMBING-DESIGN.md` D-Z2, carried
117
- * into E4): a world whose kind has no registered factory AND no explicit
118
- * entry, and which cannot self-mount from the manifest alone, throws a named
119
- * `Error` identifying the world id + kind and BOTH ways to fix it
120
- * (`registerAdapter` or `opts.entries`) โ€” never a silent skip.
121
- */
122
- export async function mountGameFromManifest(manifestInput, host, opts = {}) {
123
- const manifest = resolveManifest(manifestInput);
124
- const entries = { ...opts.entries };
125
- for (const world of manifest.roots) {
126
- if (entries[world.id] !== undefined)
127
- continue; // explicit entry always wins
128
- const factory = registry.get(world.adapter.identity);
129
- if (factory) {
130
- const entryModule = world.entry !== undefined && host.loadEntryModule
131
- ? await host.loadEntryModule(world.entry)
132
- : undefined;
133
- entries[world.id] = await factory(world, { host, entryModule });
134
- continue;
135
- }
136
- if (worldIsSelfSufficient(world))
137
- continue; // mountManifestWorlds needs nothing further
138
- throw new Error(`mountGameFromManifest: root "${world.id}" (adapter "${world.adapter.identity}") has no registered ` +
139
- `adapter factory and no explicit entries["${world.id}"] โ€” call ` +
140
- `registerAdapter("${world.adapter.identity}", factory) before mounting (see ` +
141
- '`defaultThreeAdapterFactory` for a worked threejs example), or pass ' +
142
- `opts.entries["${world.id}"] directly (see mount-manifest.ts's \`MountEntry\`).`);
143
- }
144
- return mountManifestWorlds({
145
- manifest,
146
- container: host.container,
147
- entries,
148
- width: host.width,
149
- height: host.height,
150
- headless: host.headless,
151
- });
152
- }
@@ -1,173 +0,0 @@
1
- import type { GameAdapter } from '../adapter/game-adapter';
2
- import { type ResolvedGameManifest } from '../manifest/load';
3
- import type { ComponentRegistry } from '../scene/component-registry';
4
- import { type GameSession, type Pixi2DGameAdapter, type ReactRootAdapter } from './create-runtime';
5
- import { type DebugBridgeWindowTarget } from './debug-bridge';
6
- import type { GameSetupFn } from './types';
7
- /**
8
- * A caller-supplied entry for a `kind: 'threejs'` world โ€” three ways to
9
- * satisfy it, matching exactly what `tri-world`'s manifest actually declares
10
- * (a scene-driven world with a project component registry) plus the two
11
- * other shapes `resolveDefaultThreeAdapter` supports (an `entry`-module
12
- * `setup`, or full caller control via a pre-built adapter):
13
- *
14
- * - `{ adapter }` โ€” a fully-constructed {@link GameAdapter} (first-party or
15
- * not). Always wins if present, regardless of the world's `scene`/`entry`
16
- * fields โ€” full caller control, including for a `{ module }`-adapter world
17
- * (mountManifestWorlds cannot import an arbitrary module path itself).
18
- * - `{ setup }` โ€” for an `entry`-declaring world: the project's own
19
- * `entry` module's exported `setup` function (the same `GameSetupFn`
20
- * shape `loadProjectScripts` extracts editor-side). Wrapped in a
21
- * `VgaiSceneGameAdapter` here, mirroring `resolveDefaultThreeAdapter`'s
22
- * entry branch exactly.
23
- * - `{ componentRegistry }` (or nothing at all) โ€” for a `scene`-declaring
24
- * world: mirrors `resolveDefaultThreeAdapter`'s scene branch, fetching
25
- * `world.scene` itself via `VgaiSceneGameAdapter`'s own `scenePath`
26
- * support. `componentRegistry` is optional โ€” omit it if the scene
27
- * authors no named `components:` entries.
28
- */
29
- export interface ThreeMountEntry {
30
- readonly kind: 'threejs';
31
- readonly adapter?: GameAdapter | undefined;
32
- readonly setup?: GameSetupFn | undefined;
33
- readonly componentRegistry?: ComponentRegistry | undefined;
34
- }
35
- /**
36
- * A caller-supplied entry for a `kind: 'pixijs'` world โ€” ALWAYS a
37
- * fully-constructed {@link Pixi2DGameAdapter} (e.g. `new
38
- * PixiSceneGameAdapter({ id, sceneData })`, built exactly like `tri-world`'s
39
- * original hand-mount built it โ€” fetch+parse the `.scn2d.json` yourself,
40
- * mirroring `resolveDefaultPixiAdapter`'s `fetchScene2DFile` helper, if the
41
- * world declares `scene`). There is no "mountManifestWorlds builds it for
42
- * you" branch here โ€” doing so would require this file to value-import
43
- * `pixi.js`, which it deliberately never does (see this file's header
44
- * comment).
45
- */
46
- export interface PixiMountEntry {
47
- readonly kind: 'pixijs';
48
- readonly adapter: Pixi2DGameAdapter;
49
- }
50
- /**
51
- * A caller-supplied entry for a `kind: 'react'` world โ€” ALWAYS a
52
- * fully-constructed {@link ReactRootAdapter} (the caller's own module graph
53
- * calls `createRoot(host.container).render(<GameProvider game={host.game}>
54
- * <Entry/></GameProvider>)` itself, exactly like `tri-world`'s original
55
- * hand-mount did). A standalone build has ONE module graph, so there is no
56
- * context-identity hazard the editor's per-project `GameProvider`
57
- * indirection exists to solve (`docs/REACT-STATE-BRIDGE.md` ยง2) โ€” the
58
- * caller's own `<GameProvider>` import is already the single canonical
59
- * instance its `Entry` component's own hooks resolve against. This file
60
- * never value-imports `react`/`react-dom` itself (see this file's header
61
- * comment) โ€” building the adapter is entirely the caller's job.
62
- */
63
- export interface ReactMountEntry {
64
- readonly kind: 'react';
65
- readonly adapter: ReactRootAdapter;
66
- }
67
- export type MountEntry = ThreeMountEntry | PixiMountEntry | ReactMountEntry;
68
- export interface MountManifestOptions {
69
- /**
70
- * A raw (unparsed) manifest value OR an already-`loadGameManifest`d
71
- * {@link ResolvedGameManifest}. `mountManifestWorlds` NEVER fetches or
72
- * fs-reads the manifest itself (stays environment-neutral โ€” Node CLI,
73
- * browser, or headless test alike): the caller owns getting the JSON off
74
- * disk/network (`loadGameManifestFile` for Node, a plain `fetch()` for a
75
- * browser build) and may pass either the raw parsed JSON (run through the
76
- * pure `loadGameManifest` here) or its own already-resolved manifest.
77
- */
78
- readonly manifest: unknown;
79
- /** The host creates one absolutely-positioned surface per world inside
80
- * this element โ€” see `WorldsRuntimeConfig.container`. */
81
- readonly container: HTMLElement;
82
- /** Caller-supplied, already-imported entries keyed by manifest world id.
83
- * Optional overall โ€” a manifest whose every world is scene-driven
84
- * threejs with no custom component registry needs none at all. */
85
- readonly entries?: Readonly<Record<string, MountEntry>> | undefined;
86
- /** Defaults to the manifest's own `resolution` field if declared, else
87
- * the container's own size (`WorldsRuntimeConfig`'s existing default). */
88
- readonly width?: number | undefined;
89
- readonly height?: number | undefined;
90
- /** Forwarded to `createGameRuntime` โ€” Node/headless test harnesses only,
91
- * never a real host. See `WorldsRuntimeConfig.headless`. */
92
- readonly headless?: boolean | undefined;
93
- /**
94
- * Task 2.1 (`docs/ACCEPTANCE-DRIVER-BUILD-PLAN.md`,
95
- * `docs/SYNTHETIC-PLAYER-SPEC.md` ยง3.4): overrides for the `?vgai-debug=1`
96
- * bridge `mountManifestWorlds` installs at the tail of every mount โ€” the
97
- * engine-owned install point so every standalone project gets it with zero
98
- * template edits. Omit both in a real host (defaults to `window.location`/
99
- * `window`); a headless test supplies fakes here instead of touching the
100
- * global object, mirroring `render-control.ts`'s own `location`/`target`
101
- * override precedent.
102
- */
103
- readonly debugBridge?: {
104
- readonly url?: {
105
- readonly search: string;
106
- } | undefined;
107
- readonly window?: DebugBridgeWindowTarget | undefined;
108
- } | undefined;
109
- /**
110
- * D15 (T-D15.1) โ€” the "explicit config" leg of the boot-time seed
111
- * precedence (`manifest.determinism.defaultSeed` โ†’ `?vgai-seed=` โ†’ this),
112
- * highest-precedence, for a caller that already knows the exact seed it
113
- * wants (a future CLI `--seed`/probe fixture `seed` option, T-D15.6).
114
- * Ignored entirely unless the manifest declares
115
- * `determinism.seededRandom` โ€” see `resolveDeterminismSeed` below.
116
- */
117
- readonly seed?: number | undefined;
118
- /** Where to read `?vgai-seed=` from for the boot-time seed reader. Same
119
- * override precedent as `debugBridge.url` (defaults to `window.location`
120
- * when a real `window` exists; a headless caller with no override gets no
121
- * query-param seed, same as `maybeInstallDebugBridge`'s own url default). */
122
- readonly seedUrl?: {
123
- readonly search: string;
124
- } | undefined;
125
- }
126
- /**
127
- * D15 (T-D15.1) boot-time seed reader โ€” resolves the root seed
128
- * `mountManifestWorlds` threads into `createGameRuntime` (and therefore
129
- * `createGame`, BEFORE any world's `mount()`/`setup()` runs). Returns
130
- * `undefined` when the manifest doesn't declare `determinism.seededRandom`
131
- * at all โ€” `?vgai-seed=` and `defaultSeed` are both ignored in that case
132
- * (ยง2.a: "the mount path seeds ctx.random ... iff declared"; an undeclared
133
- * project's `ctx.random` still exists, just boots from `createGame`'s own
134
- * fixed default, unaffected by the manifest or the URL).
135
- *
136
- * Precedence when declared (highest wins): `explicitSeed` (a caller-supplied
137
- * config value) โ†’ `?vgai-seed=<int>` on `url` โ†’ `manifest.determinism
138
- * .defaultSeed`.
139
- */
140
- export declare function resolveDeterminismSeed(opts: {
141
- readonly determinism: ResolvedGameManifest['determinism'];
142
- readonly explicitSeed: number | undefined;
143
- readonly url: {
144
- readonly search: string;
145
- } | undefined;
146
- }): number | undefined;
147
- export type MountedManifestSession = GameSession;
148
- /**
149
- * Exported (E4, docs/unified-world-editor/27-visual-react-editing.md ยง7) so
150
- * `mount-game.ts`'s `mountGameFromManifest` composer can share this exact
151
- * raw-vs-resolved detection instead of re-implementing it โ€” the two modules
152
- * must always agree on what "already resolved" means.
153
- */
154
- export declare function resolveManifest(raw: unknown): ResolvedGameManifest;
155
- /**
156
- * Mount every world declared by a `vgai.game.json` manifest onto `container`,
157
- * standalone โ€” no editor, no dev server. The generalization of
158
- * `examples/tri-world/src/main.ts`'s hand-built `WorldMountSpec[]` (D-Z2,
159
- * docs/WAVE3-ADAPTER-PLUMBING-DESIGN.md). Reuses the pure `loadGameManifest`
160
- * + `createGameRuntime({ roots })` and mirrors `resolveAllWorlds`'s per-kind
161
- * dispatch โ€” but every entry the manifest needs beyond what a `default`-
162
- * adapter scene/entry can express on its own comes from the caller's OWN
163
- * already-imported module graph (`opts.entries`), never a dynamic import
164
- * this file performs itself.
165
- *
166
- * Degrades loudly (docs/WAVE3-ADAPTER-PLUMBING-DESIGN.md D-Z2): a missing
167
- * entry, a kind/shape mismatch, a `{ module }`/`{ ingest }` adapter with no
168
- * caller-supplied adapter, or an empty manifest all throw a named `Error`
169
- * identifying the world id, its kind, and what was expected โ€” never a silent
170
- * skip or a partially-mounted session.
171
- */
172
- export declare function mountManifestWorlds(opts: MountManifestOptions): Promise<GameSession>;
173
- //# sourceMappingURL=mount-manifest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mount-manifest.d.ts","sourceRoot":"","sources":["../../src/runtime/mount-manifest.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAEtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,uBAAuB,EAA2B,MAAM,gBAAgB,CAAC;AAIvF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAM3C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;CAC5D;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;CACrC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;CACpC;AAED,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,cAAc,GAAG,eAAe,CAAC;AAM5E,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;OAQG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B;8DAC0D;IAC1D,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAChC;;uEAEmE;IACnE,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAAG,SAAS,CAAC;IACpE;+EAC2E;IAC3E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC;iEAC6D;IAC7D,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACxC;;;;;;;;;OASG;IACH,QAAQ,CAAC,WAAW,CAAC,EACjB;QACE,QAAQ,CAAC,GAAG,CAAC,EAAE;YAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;SAAE,GAAG,SAAS,CAAC;QACvD,QAAQ,CAAC,MAAM,CAAC,EAAE,uBAAuB,GAAG,SAAS,CAAC;KACvD,GACD,SAAS,CAAC;IACd;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;;kFAG8E;IAC9E,QAAQ,CAAC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CAC5D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,QAAQ,CAAC,WAAW,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC1D,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,GAAG,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACvD,GAAG,MAAM,GAAG,SAAS,CAIrB;AAkBD,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC;AA8BjD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,oBAAoB,CAGlE;AAsID;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC,CAiF1F"}
@@ -1,297 +0,0 @@
1
- // D-Z2 (docs/WAVE3-ADAPTER-PLUMBING-DESIGN.md) โ€” the standalone manifest-mount
2
- // helper: an ENGINE-side generalization of `examples/tri-world/src/main.ts`'s
3
- // hand-built `WorldMountSpec[]`.
4
- //
5
- // `resolveAllWorlds`/`resolveRootAdapter` (`packages/editor/src/
6
- // adapter-resolver.ts`) already do this translation for the EDITOR, but they
7
- // are Vite-coupled by construction (`/@fs/` dynamic imports of project files
8
- // through the dev server, ยง0.1/ยง0.5 of the design doc) โ€” unusable from a
9
- // plain static build. This module mirrors their per-kind dispatch
10
- // (`default-three`/`default-pixi`/`default-react`, `{ module }`, `{ ingest }`)
11
- // but never imports a project file itself: the caller's OWN bundler already
12
- // resolved whatever module graph the manifest's roots need, and hands the
13
- // already-built pieces in via `entries` (keyed by world id) โ€” no `/@fs/`, no
14
- // dev server, no editor import.
15
- //
16
- // Engine-core react/pixi-free discipline (ยง0.6, mirrored from
17
- // `create-runtime.ts`'s own documented rule for its `Pixi2DGameAdapter`/
18
- // `ReactRootAdapter` type-only imports): this file never value-imports
19
- // `pixi.js`, `world2d/pixi-game-adapter.ts`, `react`, or `react-dom` โ€” a
20
- // pixijs or react world's adapter is ALWAYS supplied already-constructed via
21
- // `entries[id].adapter` (the caller's own module graph built it, exactly like
22
- // `tri-world`'s original hand-mount built `new PixiSceneGameAdapter(...)` and
23
- // a hand-rolled `ReactRootAdapter` itself). Threejs is different: `three`/
24
- // `VgaiSceneGameAdapter` are already unconditional dependencies of every
25
- // caller of `createGameRuntime`'s legacy path (this same file's sibling,
26
- // immediately below in this directory), so building a `VgaiSceneGameAdapter`
27
- // here for the common scene-driven/`setup`-driven cases adds no NEW bundle
28
- // weight โ€” only pixi/react are avoided.
29
- import { fromSetup, VgaiSceneGameAdapter } from '../adapter';
30
- import { assertNever } from '../adapter/adapter-surface';
31
- import { loadGameManifest, } from '../manifest/load';
32
- import { createGameRuntime, } from './create-runtime';
33
- import { maybeInstallDebugBridge } from './debug-bridge';
34
- import { getDebugRegistry } from './debug-registry';
35
- import { getGameplayRngTrapControl } from './gameplay-rng-trap';
36
- import { RENDER_SEED_QUERY_PARAM } from './render-seed';
37
- /**
38
- * D15 (T-D15.1) boot-time seed reader โ€” resolves the root seed
39
- * `mountManifestWorlds` threads into `createGameRuntime` (and therefore
40
- * `createGame`, BEFORE any world's `mount()`/`setup()` runs). Returns
41
- * `undefined` when the manifest doesn't declare `determinism.seededRandom`
42
- * at all โ€” `?vgai-seed=` and `defaultSeed` are both ignored in that case
43
- * (ยง2.a: "the mount path seeds ctx.random ... iff declared"; an undeclared
44
- * project's `ctx.random` still exists, just boots from `createGame`'s own
45
- * fixed default, unaffected by the manifest or the URL).
46
- *
47
- * Precedence when declared (highest wins): `explicitSeed` (a caller-supplied
48
- * config value) โ†’ `?vgai-seed=<int>` on `url` โ†’ `manifest.determinism
49
- * .defaultSeed`.
50
- */
51
- export function resolveDeterminismSeed(opts) {
52
- if (opts.determinism?.seededRandom !== true)
53
- return undefined;
54
- const querySeed = opts.url ? readSeedQueryParam(opts.url) : undefined;
55
- return opts.explicitSeed ?? querySeed ?? opts.determinism.defaultSeed;
56
- }
57
- function readSeedQueryParam(url) {
58
- const raw = new URLSearchParams(url.search).get(RENDER_SEED_QUERY_PARAM);
59
- if (raw === null || raw === '')
60
- return undefined;
61
- const parsed = Number(raw);
62
- return Number.isFinite(parsed) ? parsed : undefined;
63
- }
64
- function hasRealWindow() {
65
- return typeof window !== 'undefined';
66
- }
67
- // ---------------------------------------------------------------------------
68
- // Raw-vs-resolved manifest detection
69
- // ---------------------------------------------------------------------------
70
- /**
71
- * Distinguish an already-`loadGameManifest`d {@link ResolvedGameManifest}
72
- * from a raw (pre-Zod-parse) manifest value. The two shapes differ in
73
- * exactly one load-bearing way for this check: a `ResolvedAdapterRoot.adapter`
74
- * is `{ type: 'default' | 'module' | 'ingest', identity, ... }`, while a raw
75
- * `AdapterRoot.adapter` is the literal string `'default'` or a bare `{module}`/
76
- * `{ingest}` object with NO `type`/`identity` fields (`schema.ts`'s
77
- * `RootAdapterSchema`). An empty `roots` array is treated as "not resolved"
78
- * (falls through to `loadGameManifest`, whose own Zod validation reports the
79
- * empty-array error, if any, more precisely than a guess here could).
80
- */
81
- function looksAlreadyResolved(value) {
82
- if (typeof value !== 'object' || value === null)
83
- return false;
84
- const roots = value.roots;
85
- if (!Array.isArray(roots) || roots.length === 0)
86
- return false;
87
- return roots.every((world) => {
88
- if (typeof world !== 'object' || world === null)
89
- return false;
90
- const adapter = world.adapter;
91
- if (typeof adapter !== 'object' || adapter === null)
92
- return false;
93
- const type = adapter.type;
94
- return type === 'builtin' || type === 'module' || type === 'ingest';
95
- });
96
- }
97
- /**
98
- * Exported (E4, docs/unified-world-editor/27-visual-react-editing.md ยง7) so
99
- * `mount-game.ts`'s `mountGameFromManifest` composer can share this exact
100
- * raw-vs-resolved detection instead of re-implementing it โ€” the two modules
101
- * must always agree on what "already resolved" means.
102
- */
103
- export function resolveManifest(raw) {
104
- if (looksAlreadyResolved(raw))
105
- return raw;
106
- return loadGameManifest(raw);
107
- }
108
- // ---------------------------------------------------------------------------
109
- // Per-kind entry -> adapter resolution (mirrors `resolveRootAdapter`'s
110
- // per-identity dispatch, `packages/editor/src/adapter-resolver.ts`)
111
- // ---------------------------------------------------------------------------
112
- function resolveThreeAdapter(world, entry) {
113
- if (entry?.adapter)
114
- return entry.adapter;
115
- if (world.adapter.type === 'module') {
116
- throw new Error(`mountManifestWorlds: world "${world.id}" (threejs) declares a { module } adapter ` +
117
- `("${world.adapter.module}") โ€” mountManifestWorlds never imports an arbitrary module ` +
118
- 'path itself (no `/@fs/`, no dev server). Import the module yourself and supply the ' +
119
- `constructed adapter via entries["${world.id}"] = { kind: 'threejs', adapter }.`);
120
- }
121
- if (world.adapter.type === 'ingest') {
122
- throw new Error(`mountManifestWorlds: world "${world.id}" (threejs) declares an { ingest } adapter โ€” ` +
123
- "ingest roots require the editor's dev-server-backed mount machinery (an EditorStore " +
124
- "plus iframe/DOM capture, see adapter-resolver.ts's resolveIngestThreeAdapter) and are " +
125
- 'not supported by mountManifestWorlds (docs/WAVE3-ADAPTER-PLUMBING-DESIGN.md D-Z7 โ€” no ' +
126
- 'porting aids, no hosted ingest routes).');
127
- }
128
- // type === 'default'
129
- if (world.entry !== undefined) {
130
- if (!entry?.setup) {
131
- throw new Error(`mountManifestWorlds: world "${world.id}" (threejs) declares \`entry\` "${world.entry}" ` +
132
- `โ€” supply entries["${world.id}"] = { kind: 'threejs', setup } (the entry module's ` +
133
- "exported `setup` function) or { kind: 'threejs', adapter } for full control. Got " +
134
- `${entry === undefined ? 'no entry at all' : 'an entry with neither `setup` nor `adapter`'}.`);
135
- }
136
- return fromSetup(world.id, entry.setup);
137
- }
138
- if (world.scene !== undefined) {
139
- return new VgaiSceneGameAdapter({
140
- id: world.id,
141
- scenePath: world.scene,
142
- componentRegistry: entry?.componentRegistry,
143
- });
144
- }
145
- // Unreachable in practice: `load.ts`'s `checkAdapterSceneEntryRules`
146
- // requires `scene` or `entry` for every 'default' adapter world at
147
- // manifest-load time โ€” see `resolveDefaultThreeAdapter`'s identical guard.
148
- throw new Error(`mountManifestWorlds: world "${world.id}" is default-three with neither \`scene\` nor ` +
149
- '`entry` โ€” this should have been rejected by manifest validation.');
150
- }
151
- function resolvePixiAdapter(world, entry) {
152
- if (entry?.adapter)
153
- return entry.adapter;
154
- throw new Error(`mountManifestWorlds: world "${world.id}" (pixijs) has no entries["${world.id}"] โ€” a pixijs ` +
155
- 'world always needs a caller-supplied, already-constructed adapter ' +
156
- `(entries["${world.id}"] = { kind: 'pixijs', adapter }, e.g. \`new PixiSceneGameAdapter(...)\` ` +
157
- "built from your own already-imported '@engine/world2d') โ€” mountManifestWorlds never " +
158
- "value-imports pixi.js (mirrors create-runtime.ts's own pixi-free-core discipline).");
159
- }
160
- function resolveReactAdapter(world, entry) {
161
- if (entry?.adapter)
162
- return entry.adapter;
163
- throw new Error(`mountManifestWorlds: world "${world.id}" (react) has no entries["${world.id}"] โ€” a react ` +
164
- 'world always needs a caller-supplied, already-constructed `ReactRootAdapter` ' +
165
- `(entries["${world.id}"] = { kind: 'react', adapter }, mounting via your own already-imported ` +
166
- 'react-dom `createRoot` + your own `<GameProvider>`) โ€” mountManifestWorlds never ' +
167
- "value-imports react/react-dom (mirrors create-runtime.ts's own react-free-core discipline; " +
168
- 'see docs/REACT-STATE-BRIDGE.md ยง2-3).');
169
- }
170
- function buildWorldMountSpec(world, entry) {
171
- if (entry !== undefined && entry.kind !== world.surface) {
172
- throw new Error(`mountManifestWorlds: entries["${world.id}"] declares kind "${entry.kind}" but the ` +
173
- `manifest's root "${world.id}" uses surface "${world.surface}" โ€” fix the entries key (or the ` +
174
- 'manifest) so the two agree.');
175
- }
176
- const base = {
177
- id: world.id,
178
- zOrder: world.zOrder,
179
- pausable: world.pausable,
180
- loop: world.loop,
181
- };
182
- // `entry`'s `kind` is guaranteed to agree with `world.kind` past the guard
183
- // above (or `entry` is `undefined`) โ€” TS can't narrow a `Record` lookup
184
- // through that runtime check, so each branch casts to its own entry shape;
185
- // the actual safety comes from the mismatch guard, not from the cast.
186
- if (world.surface === 'threejs') {
187
- const threeEntry = entry;
188
- return { ...base, kind: 'threejs', adapter: resolveThreeAdapter(world, threeEntry) };
189
- }
190
- if (world.surface === 'pixijs') {
191
- const pixiEntry = entry;
192
- return { ...base, kind: 'pixijs', adapter: resolvePixiAdapter(world, pixiEntry) };
193
- }
194
- if (world.surface === 'react') {
195
- const reactEntry = entry;
196
- return { ...base, kind: 'react', adapter: resolveReactAdapter(world, reactEntry) };
197
- }
198
- // Exhaustiveness guard (ยง7.4-2, same idiom as `resolveAllWorlds`'s own
199
- // dispatch loop): `world.kind` is the closed `AdapterRoot['kind']` union
200
- // (`z.enum(['threejs','pixijs','react'])`), so a hypothetical 4th kind
201
- // must fail to compile here, not silently fall through.
202
- return assertNever(world.surface, 'mountManifestWorlds');
203
- }
204
- // ---------------------------------------------------------------------------
205
- // Entry point
206
- // ---------------------------------------------------------------------------
207
- /**
208
- * Mount every world declared by a `vgai.game.json` manifest onto `container`,
209
- * standalone โ€” no editor, no dev server. The generalization of
210
- * `examples/tri-world/src/main.ts`'s hand-built `WorldMountSpec[]` (D-Z2,
211
- * docs/WAVE3-ADAPTER-PLUMBING-DESIGN.md). Reuses the pure `loadGameManifest`
212
- * + `createGameRuntime({ roots })` and mirrors `resolveAllWorlds`'s per-kind
213
- * dispatch โ€” but every entry the manifest needs beyond what a `default`-
214
- * adapter scene/entry can express on its own comes from the caller's OWN
215
- * already-imported module graph (`opts.entries`), never a dynamic import
216
- * this file performs itself.
217
- *
218
- * Degrades loudly (docs/WAVE3-ADAPTER-PLUMBING-DESIGN.md D-Z2): a missing
219
- * entry, a kind/shape mismatch, a `{ module }`/`{ ingest }` adapter with no
220
- * caller-supplied adapter, or an empty manifest all throw a named `Error`
221
- * identifying the world id, its kind, and what was expected โ€” never a silent
222
- * skip or a partially-mounted session.
223
- */
224
- export async function mountManifestWorlds(opts) {
225
- const manifest = resolveManifest(opts.manifest);
226
- if (manifest.roots.length === 0) {
227
- throw new Error('mountManifestWorlds: manifest declares no roots โ€” nothing to mount.');
228
- }
229
- const entries = opts.entries ?? {};
230
- const roots = manifest.roots.map((world) => buildWorldMountSpec(world, entries[world.id]));
231
- // D15 (T-D15.1) โ€” resolved BEFORE `createGameRuntime` (which constructs the
232
- // Game, and therefore `ctx.random`, before any world's `mount()`/`setup()`
233
- // runs โ€” see `createGame`'s own doc comment): the seed must be baked in at
234
- // construction time, not patched in afterward, or a world's `setup()`
235
- // would already have drawn from the wrong (default) sequence before any
236
- // post-hoc reseed could take effect.
237
- const seedUrl = opts.seedUrl ?? (hasRealWindow() ? window.location : undefined);
238
- const resolvedSeed = resolveDeterminismSeed({
239
- determinism: manifest.determinism,
240
- explicitSeed: opts.seed,
241
- url: seedUrl,
242
- });
243
- const session = await createGameRuntime({
244
- container: opts.container,
245
- roots,
246
- width: opts.width ?? manifest.resolution?.width,
247
- height: opts.height ?? manifest.resolution?.height,
248
- headless: opts.headless,
249
- seed: resolvedSeed,
250
- });
251
- // D15 (T-D15.3) โ€” the dev-mode Math.random phase trap: only while the
252
- // manifest declares the contract AND this is a dev build (mirrors D18's
253
- // debug-bridge gate โ€” `import.meta.env.DEV`, never a production build
254
- // unless something ELSE explicitly opts in, which this trap has no
255
- // opt-in for at all: it is dev-only, full stop). `getGameplayRngTrapControl`
256
- // returns `null` only for a bare `Game`-shaped test stand-in predating
257
- // T7.1 โ€” real mounts always have one (same precedent as `getDebugRegistry`
258
- // just below).
259
- if (manifest.determinism?.seededRandom === true && Boolean(import.meta.env?.DEV)) {
260
- getGameplayRngTrapControl(session.game)?.setEnabled(true);
261
- }
262
- // Task 2.1 โ€” install the `?vgai-debug=1` bridge at the TAIL of every
263
- // manifest mount (engine-owned, so a standalone project gets it with zero
264
- // template edits). `getDebugRegistry` returns `null` only for a bare
265
- // `Game`-shaped test stand-in predating T7.1 โ€” real mounts always have one.
266
- const debugRegistry = getDebugRegistry(session.game);
267
- if (debugRegistry) {
268
- // Defect 3 fix: `setRoomDeclared` (the locus-required rule โ€” a project
269
- // with a Colyseus room must declare `locus: 'client' | 'server'` on every
270
- // debug command, docs/SYNTHETIC-PLAYER-SPEC.md ยง3.1) was never actually
271
- // called from a real mount path โ€” this is that wiring. `manifest.server`
272
- // (`ResolvedGameManifest.server`, `manifest/load.ts`) is `{ room, module }
273
- // | undefined`; its mere presence is the "this project declares a room"
274
- // signal, independent of whether/when the game actually joins it.
275
- if (manifest.server) {
276
- debugRegistry.setRoomDeclared(true);
277
- }
278
- // Defect 5 fix: `maybeInstallDebugBridge` adds `window` listeners and
279
- // publishes `window.__vgai` with no way to undo either โ€” wire its
280
- // `uninstall()` into THIS session's own `stop()` so a caller that tears
281
- // this mount down doesn't leave the bridge (and its listeners) live.
282
- const bridgeHandle = maybeInstallDebugBridge({
283
- registry: debugRegistry,
284
- manifest,
285
- url: opts.debugBridge?.url,
286
- window: opts.debugBridge?.window,
287
- });
288
- if (bridgeHandle) {
289
- const stopSession = session.stop;
290
- session.stop = () => {
291
- bridgeHandle.uninstall();
292
- stopSession();
293
- };
294
- }
295
- }
296
- return session;
297
- }