@vgai/engine 0.5.21 → 0.5.23

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 (339) hide show
  1. package/README.md +6 -3
  2. package/dist/adapter/adapter-module.d.ts.map +1 -1
  3. package/dist/adapter/adapter-module.js +2 -4
  4. package/dist/adapter/adapter-surface.d.ts +1 -1
  5. package/dist/adapter/adapter-surface.js +1 -1
  6. package/dist/adapter/authoring.d.ts +19 -21
  7. package/dist/adapter/authoring.d.ts.map +1 -1
  8. package/dist/adapter/authoring.js +2 -2
  9. package/dist/adapter/binding.d.ts +341 -0
  10. package/dist/adapter/binding.d.ts.map +1 -0
  11. package/dist/adapter/binding.js +148 -0
  12. package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -1
  13. package/dist/adapter/colyseus-networking-adapter.js +23 -4
  14. package/dist/adapter/entrypoint-selection-readers.d.ts +24 -0
  15. package/dist/adapter/entrypoint-selection-readers.d.ts.map +1 -0
  16. package/dist/adapter/entrypoint-selection-readers.js +63 -0
  17. package/dist/adapter/entrypoint-selection-source.d.ts.map +1 -1
  18. package/dist/adapter/entrypoint-selection-source.js +1 -44
  19. package/dist/adapter/finders/scenes-from-entrypoint-selection.d.ts.map +1 -1
  20. package/dist/adapter/finders/scenes-from-entrypoint-selection.js +1 -52
  21. package/dist/adapter/host-context.d.ts +46 -15
  22. package/dist/adapter/host-context.d.ts.map +1 -1
  23. package/dist/adapter/host-context.js +2 -9
  24. package/dist/adapter/index.d.ts +11 -12
  25. package/dist/adapter/index.d.ts.map +1 -1
  26. package/dist/adapter/index.js +9 -10
  27. package/dist/adapter/ingest/game-contract.d.ts +0 -3
  28. package/dist/adapter/ingest/game-contract.d.ts.map +1 -1
  29. package/dist/adapter/ingest/game-contract.js +0 -3
  30. package/dist/adapter/ingest/scene-capture.d.ts +19 -23
  31. package/dist/adapter/ingest/scene-capture.d.ts.map +1 -1
  32. package/dist/adapter/ingest/scene-capture.js +143 -17
  33. package/dist/adapter/ingest/visible-capture-window.d.ts +34 -0
  34. package/dist/adapter/ingest/visible-capture-window.d.ts.map +1 -1
  35. package/dist/adapter/manifest-interpreter.d.ts +59 -0
  36. package/dist/adapter/manifest-interpreter.d.ts.map +1 -0
  37. package/dist/adapter/manifest-interpreter.js +50 -0
  38. package/dist/adapter/native-debug-module.d.ts +71 -3
  39. package/dist/adapter/native-debug-module.d.ts.map +1 -1
  40. package/dist/adapter/native-debug-module.js +146 -10
  41. package/dist/adapter/rapier-physics-adapter.d.ts +31 -1
  42. package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -1
  43. package/dist/adapter/rapier-physics-adapter.js +50 -36
  44. package/dist/adapter/renderer-config.d.ts +3 -3
  45. package/dist/adapter/renderer-config.js +3 -3
  46. package/dist/adapter/root-adapter.d.ts +7 -7
  47. package/dist/adapter/root-adapter.js +4 -4
  48. package/dist/adapter/system-adapter.d.ts +45 -7
  49. package/dist/adapter/system-adapter.d.ts.map +1 -1
  50. package/dist/adapter/system-seam-contract.d.ts +3 -3
  51. package/dist/adapter/system-seam-contract.js +3 -3
  52. package/dist/adapter/system-slot.d.ts +168 -0
  53. package/dist/adapter/system-slot.d.ts.map +1 -0
  54. package/dist/adapter/system-slot.js +229 -0
  55. package/dist/adapter/transform.d.ts +11 -1
  56. package/dist/adapter/transform.d.ts.map +1 -1
  57. package/dist/ai/navigation.d.ts +17 -1
  58. package/dist/ai/navigation.d.ts.map +1 -1
  59. package/dist/ai/navigation.js +26 -5
  60. package/dist/animation/anim-graph-types.d.ts +11 -3
  61. package/dist/animation/anim-graph-types.d.ts.map +1 -1
  62. package/dist/animation/theatre-clock-binding.d.ts +4 -4
  63. package/dist/animation/theatre-clock-binding.js +4 -4
  64. package/dist/animation/xstate-animation-binding.d.ts.map +1 -1
  65. package/dist/animation/xstate-animation-binding.js +2 -2
  66. package/dist/animation/xstate-animation-meta.d.ts +13 -0
  67. package/dist/animation/xstate-animation-meta.d.ts.map +1 -1
  68. package/dist/animation/xstate-animation-meta.js +14 -0
  69. package/dist/asset-formats/index.d.ts +4 -7
  70. package/dist/asset-formats/index.d.ts.map +1 -1
  71. package/dist/asset-formats/index.js +4 -7
  72. package/dist/asset-formats/render-env.d.ts +5 -8
  73. package/dist/asset-formats/render-env.d.ts.map +1 -1
  74. package/dist/asset-formats/render-env.js +3 -6
  75. package/dist/asset-parse-error.d.ts +2 -5
  76. package/dist/asset-parse-error.d.ts.map +1 -1
  77. package/dist/asset-parse-error.js +2 -5
  78. package/dist/audio/bus-mixer.d.ts +101 -0
  79. package/dist/audio/bus-mixer.d.ts.map +1 -0
  80. package/dist/audio/bus-mixer.js +115 -0
  81. package/dist/canvas-react/index.d.ts +5 -12
  82. package/dist/canvas-react/index.d.ts.map +1 -1
  83. package/dist/canvas-react/index.js +5 -12
  84. package/dist/canvas-react/pixi-react-root-factory.d.ts +34 -21
  85. package/dist/canvas-react/pixi-react-root-factory.d.ts.map +1 -1
  86. package/dist/canvas-react/pixi-react-root-factory.js +274 -36
  87. package/dist/core/countdown-timer.d.ts +118 -0
  88. package/dist/core/countdown-timer.d.ts.map +1 -0
  89. package/dist/core/countdown-timer.js +137 -0
  90. package/dist/core/deferred-commands.d.ts +127 -0
  91. package/dist/core/deferred-commands.d.ts.map +1 -0
  92. package/dist/core/deferred-commands.js +132 -0
  93. package/dist/core/frame-pacing.d.ts +1 -1
  94. package/dist/core/frame-pacing.js +2 -2
  95. package/dist/core/game-loop.d.ts +1 -3
  96. package/dist/core/game-loop.d.ts.map +1 -1
  97. package/dist/core/game-loop.js +1 -3
  98. package/dist/core/seeded-random.d.ts +1 -1
  99. package/dist/core/sim-clock.d.ts +19 -8
  100. package/dist/core/sim-clock.d.ts.map +1 -1
  101. package/dist/core/sim-clock.js +18 -7
  102. package/dist/core/types.d.ts +1 -3
  103. package/dist/core/types.d.ts.map +1 -1
  104. package/dist/defaults.d.ts +6 -14
  105. package/dist/defaults.d.ts.map +1 -1
  106. package/dist/defaults.js +6 -14
  107. package/dist/dev/instruments.d.ts +38 -11
  108. package/dist/dev/instruments.d.ts.map +1 -1
  109. package/dist/dev/instruments.js +81 -11
  110. package/dist/dev/register-render-vitals.d.ts +1 -4
  111. package/dist/dev/register-render-vitals.d.ts.map +1 -1
  112. package/dist/dev/register-render-vitals.js +1 -4
  113. package/dist/dev/render-debug-adapter.d.ts +2 -3
  114. package/dist/dev/render-debug-adapter.d.ts.map +1 -1
  115. package/dist/dev/render-debug-adapter.js +2 -3
  116. package/dist/dev/render-vitals.d.ts +3 -3
  117. package/dist/dev/render-vitals.js +3 -3
  118. package/dist/dev/webgl-frame-capture.d.ts +1 -1
  119. package/dist/dev/webgl-frame-capture.js +1 -1
  120. package/dist/index.d.ts +2 -5
  121. package/dist/index.d.ts.map +1 -1
  122. package/dist/index.js +2 -4
  123. package/dist/input/host-pointer.d.ts +122 -0
  124. package/dist/input/host-pointer.d.ts.map +1 -0
  125. package/dist/input/host-pointer.js +160 -0
  126. package/dist/input/input-manager.d.ts +33 -5
  127. package/dist/input/input-manager.d.ts.map +1 -1
  128. package/dist/input/input-manager.js +48 -13
  129. package/dist/input/rebind-controller.d.ts.map +1 -1
  130. package/dist/input/rebind-controller.js +6 -8
  131. package/dist/input/schema.d.ts.map +1 -1
  132. package/dist/input/schema.js +56 -28
  133. package/dist/manifest/filename.d.ts.map +1 -1
  134. package/dist/manifest/filename.js +8 -12
  135. package/dist/manifest/load.d.ts +10 -10
  136. package/dist/manifest/load.d.ts.map +1 -1
  137. package/dist/manifest/load.js +9 -6
  138. package/dist/manifest/schema.d.ts +17 -21
  139. package/dist/manifest/schema.d.ts.map +1 -1
  140. package/dist/manifest/schema.js +45 -35
  141. package/dist/physics/collider-dimensions.d.ts +8 -12
  142. package/dist/physics/collider-dimensions.d.ts.map +1 -1
  143. package/dist/physics/collider-dimensions.js +8 -12
  144. package/dist/pixi/scene-capture.d.ts +11 -13
  145. package/dist/pixi/scene-capture.d.ts.map +1 -1
  146. package/dist/react/world-state.d.ts +1 -1
  147. package/dist/react/world-state.d.ts.map +1 -1
  148. package/dist/render/directional-shadow-fit.d.ts +88 -0
  149. package/dist/render/directional-shadow-fit.d.ts.map +1 -0
  150. package/dist/render/directional-shadow-fit.js +133 -0
  151. package/dist/render/environment-capture.d.ts +68 -0
  152. package/dist/render/environment-capture.d.ts.map +1 -0
  153. package/dist/render/environment-capture.js +90 -0
  154. package/dist/render/ibl-override-material.d.ts +97 -0
  155. package/dist/render/ibl-override-material.d.ts.map +1 -0
  156. package/dist/render/ibl-override-material.js +114 -0
  157. package/dist/render/light-camera-factory.d.ts +5 -7
  158. package/dist/render/light-camera-factory.d.ts.map +1 -1
  159. package/dist/render/light-camera-factory.js +8 -11
  160. package/dist/render/material-factory.js +1 -1
  161. package/dist/render/render-batch-system.d.ts.map +1 -1
  162. package/dist/render/render-features.d.ts +17 -6
  163. package/dist/render/render-features.d.ts.map +1 -1
  164. package/dist/render/render-features.js +0 -28
  165. package/dist/runtime/create-runtime.d.ts +34 -25
  166. package/dist/runtime/create-runtime.d.ts.map +1 -1
  167. package/dist/runtime/create-runtime.js +218 -93
  168. package/dist/runtime/debug-registry.d.ts +77 -8
  169. package/dist/runtime/debug-registry.d.ts.map +1 -1
  170. package/dist/runtime/debug-registry.js +3 -3
  171. package/dist/runtime/dev-build.d.ts +2 -2
  172. package/dist/runtime/dev-build.js +2 -2
  173. package/dist/runtime/game-input-seams.d.ts +51 -0
  174. package/dist/runtime/game-input-seams.d.ts.map +1 -0
  175. package/dist/runtime/game-input-seams.js +86 -0
  176. package/dist/runtime/game.d.ts +104 -40
  177. package/dist/runtime/game.d.ts.map +1 -1
  178. package/dist/runtime/game.js +119 -61
  179. package/dist/runtime/mount-game.d.ts +0 -16
  180. package/dist/runtime/mount-game.d.ts.map +1 -1
  181. package/dist/runtime/mount-game.js +26 -41
  182. package/dist/runtime/mount-manifest.d.ts +22 -14
  183. package/dist/runtime/mount-manifest.d.ts.map +1 -1
  184. package/dist/runtime/mount-manifest.js +22 -20
  185. package/dist/runtime/playtest.d.ts +22 -0
  186. package/dist/runtime/playtest.d.ts.map +1 -0
  187. package/dist/runtime/playtest.js +12 -0
  188. package/dist/runtime/state-bridge.d.ts +2 -3
  189. package/dist/runtime/state-bridge.d.ts.map +1 -1
  190. package/dist/runtime/state-bridge.js +1 -0
  191. package/dist/setup/setup-audio.d.ts +12 -0
  192. package/dist/setup/setup-audio.d.ts.map +1 -1
  193. package/dist/setup/setup-audio.js +9 -10
  194. package/dist/setup/setup-renderer.d.ts +2 -25
  195. package/dist/setup/setup-renderer.d.ts.map +1 -1
  196. package/dist/setup/setup-renderer.js +2 -31
  197. package/dist/world3d-react/index.d.ts +15 -25
  198. package/dist/world3d-react/index.d.ts.map +1 -1
  199. package/dist/world3d-react/index.js +15 -25
  200. package/dist/world3d-react/r3f-root-factory.d.ts +28 -34
  201. package/dist/world3d-react/r3f-root-factory.d.ts.map +1 -1
  202. package/dist/world3d-react/r3f-root-factory.js +403 -57
  203. package/dist/world3d-react/rapier-physics-bridge.d.ts +30 -17
  204. package/dist/world3d-react/rapier-physics-bridge.d.ts.map +1 -1
  205. package/dist/world3d-react/rapier-physics-bridge.js +143 -58
  206. package/package.json +1 -1
  207. package/schemas/engine-capabilities.json +16 -14
  208. package/schemas/vgai-project.schema.json +35 -26
  209. package/src/adapter/adapter-module.ts +2 -4
  210. package/src/adapter/adapter-surface.ts +1 -1
  211. package/src/adapter/authoring.ts +19 -21
  212. package/src/adapter/binding.ts +468 -0
  213. package/src/adapter/colyseus-networking-adapter.ts +20 -5
  214. package/src/adapter/entrypoint-selection-readers.ts +66 -0
  215. package/src/adapter/entrypoint-selection-source.ts +1 -40
  216. package/src/adapter/finders/scenes-from-entrypoint-selection.ts +1 -48
  217. package/src/adapter/host-context.ts +45 -15
  218. package/src/adapter/index.ts +23 -11
  219. package/src/adapter/ingest/game-contract.ts +0 -3
  220. package/src/adapter/ingest/scene-capture.ts +190 -39
  221. package/src/adapter/ingest/visible-capture-window.ts +35 -0
  222. package/src/adapter/manifest-interpreter.ts +64 -0
  223. package/src/adapter/native-debug-module.ts +248 -15
  224. package/src/adapter/rapier-physics-adapter.ts +76 -20
  225. package/src/adapter/renderer-config.ts +3 -3
  226. package/src/adapter/root-adapter.ts +7 -7
  227. package/src/adapter/system-adapter.ts +43 -8
  228. package/src/adapter/system-seam-contract.ts +3 -3
  229. package/src/adapter/system-slot.ts +291 -0
  230. package/src/adapter/transform.ts +18 -1
  231. package/src/ai/navigation.ts +30 -3
  232. package/src/animation/anim-graph-types.ts +11 -3
  233. package/src/animation/theatre-clock-binding.ts +4 -4
  234. package/src/animation/xstate-animation-binding.ts +2 -2
  235. package/src/animation/xstate-animation-meta.ts +16 -0
  236. package/src/asset-formats/index.ts +4 -7
  237. package/src/asset-formats/render-env.ts +3 -6
  238. package/src/asset-parse-error.ts +2 -5
  239. package/src/audio/bus-mixer.ts +161 -0
  240. package/src/canvas-react/index.ts +5 -21
  241. package/src/canvas-react/pixi-react-root-factory.tsx +301 -39
  242. package/src/core/countdown-timer.ts +188 -0
  243. package/src/core/deferred-commands.ts +174 -0
  244. package/src/core/frame-pacing.ts +2 -2
  245. package/src/core/game-loop.ts +1 -3
  246. package/src/core/seeded-random.ts +1 -1
  247. package/src/core/sim-clock.ts +19 -8
  248. package/src/core/types.ts +1 -3
  249. package/src/defaults.ts +6 -14
  250. package/src/dev/instruments.ts +108 -11
  251. package/src/dev/register-render-vitals.ts +1 -4
  252. package/src/dev/render-debug-adapter.ts +2 -3
  253. package/src/dev/render-vitals.ts +3 -3
  254. package/src/dev/webgl-frame-capture.ts +1 -1
  255. package/src/index.ts +2 -5
  256. package/src/input/host-pointer.ts +230 -0
  257. package/src/input/input-manager.ts +49 -13
  258. package/src/input/input-types.ts +1 -1
  259. package/src/input/rebind-controller.ts +6 -8
  260. package/src/input/schema.ts +216 -188
  261. package/src/manifest/filename.ts +8 -12
  262. package/src/manifest/load.ts +17 -13
  263. package/src/manifest/schema.ts +55 -47
  264. package/src/physics/collider-dimensions.ts +8 -12
  265. package/src/pixi/scene-capture.ts +12 -15
  266. package/src/react/world-state.tsx +1 -1
  267. package/src/render/directional-shadow-fit.ts +156 -0
  268. package/src/render/environment-capture.ts +102 -0
  269. package/src/render/ibl-override-material.ts +170 -0
  270. package/src/render/light-camera-factory.ts +8 -11
  271. package/src/render/material-factory.ts +1 -1
  272. package/src/render/render-batch-system.ts +14 -6
  273. package/src/render/render-features.ts +17 -35
  274. package/src/runtime/create-runtime.ts +270 -108
  275. package/src/runtime/debug-registry.ts +84 -8
  276. package/src/runtime/dev-build.ts +2 -2
  277. package/src/runtime/game-input-seams.ts +108 -0
  278. package/src/runtime/game.ts +231 -85
  279. package/src/runtime/mount-game.ts +31 -57
  280. package/src/runtime/mount-manifest.ts +47 -36
  281. package/src/runtime/playtest.ts +22 -0
  282. package/src/runtime/state-bridge.ts +3 -3
  283. package/src/setup/setup-audio.ts +21 -11
  284. package/src/setup/setup-renderer.ts +2 -61
  285. package/src/world3d-react/index.ts +15 -31
  286. package/src/world3d-react/r3f-root-factory.tsx +451 -60
  287. package/src/world3d-react/rapier-physics-bridge.tsx +154 -58
  288. package/dist/adapter/setup-three-root-adapter.d.ts +0 -86
  289. package/dist/adapter/setup-three-root-adapter.d.ts.map +0 -1
  290. package/dist/adapter/setup-three-root-adapter.js +0 -908
  291. package/dist/animation/clip-map.d.ts +0 -12
  292. package/dist/animation/clip-map.d.ts.map +0 -1
  293. package/dist/animation/clip-map.js +0 -31
  294. package/dist/asset-registry.d.ts +0 -38
  295. package/dist/asset-registry.d.ts.map +0 -1
  296. package/dist/asset-registry.js +0 -66
  297. package/dist/canvas-react/engine-bridge.d.ts +0 -45
  298. package/dist/canvas-react/engine-bridge.d.ts.map +0 -1
  299. package/dist/canvas-react/engine-bridge.js +0 -45
  300. package/dist/canvas-react/pixi-react-adapter.d.ts +0 -77
  301. package/dist/canvas-react/pixi-react-adapter.d.ts.map +0 -1
  302. package/dist/canvas-react/pixi-react-adapter.js +0 -294
  303. package/dist/canvas-react/world-context.d.ts +0 -98
  304. package/dist/canvas-react/world-context.d.ts.map +0 -1
  305. package/dist/canvas-react/world-context.js +0 -173
  306. package/dist/dev/debug-draw.d.ts +0 -24
  307. package/dist/dev/debug-draw.d.ts.map +0 -1
  308. package/dist/dev/debug-draw.js +0 -73
  309. package/dist/render/auto-batcher.d.ts +0 -34
  310. package/dist/render/auto-batcher.d.ts.map +0 -1
  311. package/dist/render/auto-batcher.js +0 -140
  312. package/dist/render/lod.d.ts +0 -13
  313. package/dist/render/lod.d.ts.map +0 -1
  314. package/dist/render/lod.js +0 -16
  315. package/dist/runtime/types.d.ts +0 -303
  316. package/dist/runtime/types.d.ts.map +0 -1
  317. package/dist/runtime/types.js +0 -1
  318. package/dist/world3d-react/engine-bridge.d.ts +0 -47
  319. package/dist/world3d-react/engine-bridge.d.ts.map +0 -1
  320. package/dist/world3d-react/engine-bridge.js +0 -73
  321. package/dist/world3d-react/r3f-adapter.d.ts +0 -58
  322. package/dist/world3d-react/r3f-adapter.d.ts.map +0 -1
  323. package/dist/world3d-react/r3f-adapter.js +0 -634
  324. package/dist/world3d-react/world-context.d.ts +0 -182
  325. package/dist/world3d-react/world-context.d.ts.map +0 -1
  326. package/dist/world3d-react/world-context.js +0 -235
  327. package/src/adapter/setup-three-root-adapter.ts +0 -1032
  328. package/src/animation/clip-map.ts +0 -34
  329. package/src/asset-registry.ts +0 -89
  330. package/src/canvas-react/engine-bridge.ts +0 -59
  331. package/src/canvas-react/pixi-react-adapter.tsx +0 -356
  332. package/src/canvas-react/world-context.ts +0 -253
  333. package/src/dev/debug-draw.ts +0 -80
  334. package/src/render/auto-batcher.ts +0 -168
  335. package/src/render/lod.ts +0 -17
  336. package/src/runtime/types.ts +0 -328
  337. package/src/world3d-react/engine-bridge.ts +0 -86
  338. package/src/world3d-react/r3f-adapter.tsx +0 -717
  339. package/src/world3d-react/world-context.ts +0 -358
@@ -1,8 +1,8 @@
1
1
  // The standalone manifest-mount helper: an ENGINE-side generalization of
2
2
  // `examples/tri-world/src/main.ts`'s hand-built `RootMountSpec[]`.
3
3
  //
4
- // `resolveAllRoots`/`resolveRootAdapter` (`packages/editor/src/
5
- // adapter-resolver.ts`) already do this translation for the EDITOR, but they
4
+ // `resolveAllRoots`/`resolveRootBinding` (`packages/editor/src/
5
+ // binding-resolver.ts`) already do this translation for the EDITOR, but they
6
6
  // are Vite-coupled by construction (`/@fs/` dynamic imports of project files
7
7
  // through the dev server, §0.1/§0.5 of the design doc) — unusable from a
8
8
  // plain static build. This module mirrors their per-kind dispatch
@@ -17,15 +17,12 @@
17
17
  // type-only import): this file never value-imports
18
18
  // `pixi.js`, `react`, or `react-dom` — a
19
19
  // canvas or react world's adapter is ALWAYS supplied already-constructed via
20
- // `entries[id].adapter` (the caller's own module graph built it). Threejs is
21
- // different: `three`/
22
- // `SetupThreeRootAdapter` are already unconditional dependencies of every
23
- // caller of `createGameRuntime`, so wrapping a `setup` with
24
- // `fromSetup` here adds no NEW bundle weight — only pixi/react are avoided.
20
+ // `entries[id].adapter` (the caller's own module graph built it), so no
21
+ // surface's library is pulled into a game that has no world on it.
25
22
  import { assertNever } from '../adapter/adapter-surface';
23
+ import { declaredRoots } from '../adapter/manifest-interpreter';
26
24
  // Value-imported from the implementer's OWN path, not the type-only
27
25
  // `../adapter` barrel (P-6).
28
- import { fromSetup } from '../adapter/setup-three-root-adapter';
29
26
  import { loadGameManifest, } from '../manifest/load';
30
27
  import { createGameRuntime } from './create-runtime';
31
28
  import { maybeInstallDebugBridge } from './debug-bridge';
@@ -103,8 +100,8 @@ export function resolveManifest(raw) {
103
100
  return loadGameManifest(raw);
104
101
  }
105
102
  // ---------------------------------------------------------------------------
106
- // Per-kind entry -> adapter resolution (mirrors `resolveRootAdapter`'s
107
- // per-identity dispatch, `packages/editor/src/adapter-resolver.ts`)
103
+ // Per-kind entry -> adapter resolution (mirrors `resolveRootBinding`'s
104
+ // per-identity dispatch, `packages/editor/src/binding-resolver.ts`)
108
105
  // ---------------------------------------------------------------------------
109
106
  function resolveThreeAdapter(world, entry) {
110
107
  if (entry?.adapter)
@@ -124,17 +121,15 @@ function resolveThreeAdapter(world, entry) {
124
121
  }
125
122
  // type === 'default'
126
123
  if (world.entry !== undefined) {
127
- if (!entry?.setup) {
128
- throw new Error(`mountManifestRoots: world "${world.id}" (three) declares \`entry\` "${world.entry}" ` +
129
- `— supply entries["${world.id}"] = { kind: 'three', setup } (the entry module's ` +
130
- "exported `setup` function) or { kind: 'three', adapter } for full control. Got " +
131
- `${entry === undefined ? 'no entry at all' : 'an entry with neither `setup` nor `adapter`'}.`);
132
- }
133
- return fromSetup(world.id, entry.setup);
124
+ throw new Error(`mountManifestRoots: world "${world.id}" (three) declares \`entry\` "${world.entry}" ` +
125
+ `— supply entries["${world.id}"] = { kind: 'three', adapter } (for a default-exported ` +
126
+ 'world, build it with `resolveR3FEntryAdapter(entryModule, worldId)` from ' +
127
+ '`@vgai/engine/world3d-react`). Got ' +
128
+ `${entry === undefined ? 'no entry at all' : 'an entry with no `adapter`'}.`);
134
129
  }
135
130
  // Unreachable in practice: `load.ts`'s `checkAdapterSceneEntryRules` requires
136
131
  // `entry` for every 'default' THREE adapter world at manifest-load time (and
137
- // rejects `scene` outright the `.vscn.json` format was removed in WO-8).
132
+ // rejects any other content declaration on one outright).
138
133
  throw new Error(`mountManifestRoots: world "${world.id}" is default-three with no \`entry\` — this ` +
139
134
  'should have been rejected by manifest validation.');
140
135
  }
@@ -166,6 +161,12 @@ function buildRootMountSpec(world, entry) {
166
161
  id: world.id,
167
162
  zOrder: world.zOrder,
168
163
  pausable: world.pausable,
164
+ // `root` is this file's own resolved manifest record; the rest — the
165
+ // parsed `vgai.adapter.ts`, the entry namespace, the entry's declared
166
+ // debug/systems bindings — only the caller who loaded the entry can know.
167
+ ...(entry?.declaration === undefined
168
+ ? {}
169
+ : { declaration: { root: world, ...entry.declaration } }),
169
170
  };
170
171
  // `entry`'s `kind` is guaranteed to agree with `world.kind` past the guard
171
172
  // above (or `entry` is `undefined`) — TS can't narrow a `Record` lookup
@@ -209,11 +210,12 @@ function buildRootMountSpec(world, entry) {
209
210
  */
210
211
  export async function mountManifestRoots(opts) {
211
212
  const manifest = resolveManifest(opts.manifest);
212
- if (manifest.roots.length === 0) {
213
+ const mountPlan = declaredRoots(manifest);
214
+ if (mountPlan.length === 0) {
213
215
  throw new Error('mountManifestRoots: manifest declares no roots — nothing to mount.');
214
216
  }
215
217
  const entries = opts.entries ?? {};
216
- const roots = manifest.roots.map((world) => buildRootMountSpec(world, entries[world.id]));
218
+ const roots = mountPlan.map((world) => buildRootMountSpec(world, entries[world.id]));
217
219
  // D15 (T-D15.1) — resolved BEFORE `createGameRuntime` (which constructs the
218
220
  // Game, and therefore `ctx.random`, before any world's `mount()`/`setup()`
219
221
  // runs — see `createGame`'s own doc comment): the seed must be baked in at
@@ -0,0 +1,22 @@
1
+ /**
2
+ * WHO IS PLAYING, and under what identity — the host's own declaration for one
3
+ * private play run or coordinated team test.
4
+ *
5
+ * Its own module because it is a PUBLISHED path: a project's Colyseus
6
+ * networking adapter (the `colyseus` capability, copied into every game) names
7
+ * this type, so it must live somewhere that survives. The engine never joins a
8
+ * room and never couples this authoring identity to a networking library —
9
+ * games may pass `roomKey` as a Colyseus filter/join option, and that is the
10
+ * whole of the coupling.
11
+ */
12
+ /** Host-supplied identity for one private play run or coordinated team test.
13
+ * Games may pass `roomKey` as a Colyseus filter/join option; the engine never
14
+ * joins a room or couples this authoring identity to a networking library. */
15
+ export interface PlaytestContext {
16
+ readonly mode: 'private' | 'team';
17
+ readonly id: string;
18
+ readonly roomKey: string;
19
+ readonly revision: number | null;
20
+ readonly participantId: string | null;
21
+ }
22
+ //# sourceMappingURL=playtest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"playtest.d.ts","sourceRoot":"","sources":["../../src/runtime/playtest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;8EAE8E;AAC9E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * WHO IS PLAYING, and under what identity — the host's own declaration for one
3
+ * private play run or coordinated team test.
4
+ *
5
+ * Its own module because it is a PUBLISHED path: a project's Colyseus
6
+ * networking adapter (the `colyseus` capability, copied into every game) names
7
+ * this type, so it must live somewhere that survives. The engine never joins a
8
+ * room and never couples this authoring identity to a networking library —
9
+ * games may pass `roomKey` as a Colyseus filter/join option, and that is the
10
+ * whole of the coupling.
11
+ */
12
+ export {};
@@ -46,9 +46,8 @@ export interface GameStateBridge {
46
46
  export interface GameStateBridgeInternal extends GameStateBridge {
47
47
  /** Bump `frameVersion` by one and notify every current subscriber, in
48
48
  * subscription order. Subscriber errors are isolated (per-subscriber
49
- * try/catch, loud `console.error`, never swallowed silently) — mirrors
50
- * the error-isolation idiom in `ecs/component-manager.ts`'s per-component
51
- * `update()` calls: one offending subscriber must not stop its siblings
49
+ * try/catch, loud `console.error`, never swallowed silently): one
50
+ * offending subscriber must not stop its siblings
52
51
  * from being notified, and must not break the frame loop. */
53
52
  bump(): void;
54
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"state-bridge.d.ts","sourceRoot":"","sources":["../../src/runtime/state-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B;;;;kEAI8D;IAC9D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;6EACyE;IACzE,SAAS,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC5C;AAED;;;;;mEAKmE;AACnE,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D;;;;;kEAK8D;IAC9D,IAAI,IAAI,IAAI,CAAC;CACd;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,uBAAuB,CA8B3D"}
1
+ {"version":3,"file":"state-bridge.d.ts","sourceRoot":"","sources":["../../src/runtime/state-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B;;;;kEAI8D;IAC9D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;6EACyE;IACzE,SAAS,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC5C;AAED;;;;;mEAKmE;AACnE,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D;;;;kEAI8D;IAC9D,IAAI,IAAI,IAAI,CAAC;CACd;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,uBAAuB,CA+B3D"}
@@ -54,6 +54,7 @@ export function createStateBridge() {
54
54
  onFrame();
55
55
  }
56
56
  catch (err) {
57
+ // biome-ignore lint/suspicious/noConsole: a throwing subscriber must not take the notify loop down, and the console (captured by the editor session ledger) is the engine runtime's one report channel.
57
58
  console.error('[state-bridge] subscriber threw:', err);
58
59
  }
59
60
  }
@@ -1,4 +1,5 @@
1
1
  import * as THREE from 'three';
2
+ import { type AudioBusMixer } from '../audio/bus-mixer';
2
3
  export interface AudioContext {
3
4
  listener: THREE.AudioListener;
4
5
  masterGain: GainNode;
@@ -7,6 +8,17 @@ export interface AudioContext {
7
8
  sfx: GainNode;
8
9
  voice: GainNode;
9
10
  };
11
+ /**
12
+ * The named-bus mixer the three below are buses OF (`../audio/bus-mixer.ts`).
13
+ *
14
+ * `buses` is a fixed struct because those three names are the ones the engine
15
+ * itself routes; a game with an `ambience`, a `ui` or a per-character bus asks
16
+ * the mixer for it by name — `audio.mixer.bus('ambience', 'master')` mints it
17
+ * under the master gain, `audio.mixer.setDb('ambience', -6)` sets it in
18
+ * decibels — and `audio.mixer.disconnect()` is the ONE teardown for all of
19
+ * them, the three struct members included.
20
+ */
21
+ mixer: AudioBusMixer;
10
22
  /** Call this on first user interaction (click/key) to resume audio context */
11
23
  resume: () => void;
12
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"setup-audio.d.ts","sourceRoot":"","sources":["../../src/setup/setup-audio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC;IAC9B,UAAU,EAAE,QAAQ,CAAC;IACrB,KAAK,EAAE;QACL,KAAK,EAAE,QAAQ,CAAC;QAChB,GAAG,EAAE,QAAQ,CAAC;QACd,KAAK,EAAE,QAAQ,CAAC;KACjB,CAAC;IACF,8EAA8E;IAC9E,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,YAAY,CAuC7D"}
1
+ {"version":3,"file":"setup-audio.d.ts","sourceRoot":"","sources":["../../src/setup/setup-audio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,oBAAoB,CAAC;AAE7E,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC;IAC9B,UAAU,EAAE,QAAQ,CAAC;IACrB,KAAK,EAAE;QACL,KAAK,EAAE,QAAQ,CAAC;QAChB,GAAG,EAAE,QAAQ,CAAC;QACd,KAAK,EAAE,QAAQ,CAAC;KACjB,CAAC;IACF;;;;;;;;;OASG;IACH,KAAK,EAAE,aAAa,CAAC;IACrB,8EAA8E;IAC9E,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAKD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,YAAY,CAkC7D"}
@@ -1,4 +1,7 @@
1
1
  import * as THREE from 'three';
2
+ import { createAudioBusMixer } from '../audio/bus-mixer';
3
+ /** The bus every other bus routes into, and the node `masterGain` is. */
4
+ const MASTER_BUS = 'master';
2
5
  /**
3
6
  * Creates the audio listener and bus hierarchy.
4
7
  *
@@ -9,21 +12,16 @@ export function setupAudio(camera) {
9
12
  const listener = new THREE.AudioListener();
10
13
  camera.add(listener);
11
14
  const ctx = listener.context;
12
- const masterGain = ctx.createGain();
13
- masterGain.connect(ctx.destination);
15
+ const mixer = createAudioBusMixer({ context: ctx, destination: ctx.destination });
16
+ const masterGain = mixer.bus(MASTER_BUS);
14
17
  // Route the Three.js listener through masterGain so that THREE.Audio /
15
18
  // THREE.PositionalAudio objects are also silenced by the mute button.
16
19
  listener.gain.disconnect();
17
20
  listener.gain.connect(masterGain);
18
- const musicGain = ctx.createGain();
21
+ const musicGain = mixer.bus('music', MASTER_BUS);
19
22
  musicGain.gain.value = 0.7;
20
- musicGain.connect(masterGain);
21
- const sfxGain = ctx.createGain();
22
- sfxGain.gain.value = 1.0;
23
- sfxGain.connect(masterGain);
24
- const voiceGain = ctx.createGain();
25
- voiceGain.gain.value = 1.0;
26
- voiceGain.connect(masterGain);
23
+ const sfxGain = mixer.bus('sfx', MASTER_BUS);
24
+ const voiceGain = mixer.bus('voice', MASTER_BUS);
27
25
  return {
28
26
  listener,
29
27
  masterGain,
@@ -32,6 +30,7 @@ export function setupAudio(camera) {
32
30
  sfx: sfxGain,
33
31
  voice: voiceGain,
34
32
  },
33
+ mixer,
35
34
  resume() {
36
35
  if (ctx.state === 'suspended') {
37
36
  ctx.resume();
@@ -1,13 +1,7 @@
1
- import { EffectComposer } from 'postprocessing';
1
+ import { type EffectComposer } from 'postprocessing';
2
2
  import * as THREE from 'three';
3
3
  import type { RenderEnvironment } from '../asset-formats/render-env';
4
4
  import { type RenderScope } from '../render/render-settings';
5
- export interface RendererContext {
6
- renderer: THREE.WebGLRenderer;
7
- scene: THREE.Scene;
8
- camera: THREE.PerspectiveCamera;
9
- composer: EffectComposer;
10
- }
11
5
  /**
12
6
  * Apply the live renderer-level render settings (shadows, resolution scale) from
13
7
  * the resolved cascade. `antialias`/`backend` are reload-only (renderer re-init)
@@ -22,7 +16,7 @@ export declare function applyRendererSettings(renderer: THREE.WebGLRenderer, ren
22
16
  /**
23
17
  * Create ONLY the WebGL renderer. The HOST owns the renderer (see
24
18
  * `ThreeHostContext.renderer`); the game/adapter owns the scene/camera/composer it
25
- * renders into. Split out of `setupRenderer` for the adapter inversion.
19
+ * renders into.
26
20
  *
27
21
  * `rendering` is the scene-level render scope (`env.rendering`); it seeds the
28
22
  * reload-only `antialias` option at construction and the live shadow/resolution
@@ -39,23 +33,6 @@ export declare function createHostRenderer(canvas: HTMLCanvasElement, width?: nu
39
33
  alpha?: boolean;
40
34
  preserveDrawingBuffer?: boolean;
41
35
  }): THREE.WebGLRenderer;
42
- /**
43
- * Create the scene, camera, and postprocessing composer that a first-party game
44
- * renders into, given a host-provided renderer. The GPU-only `composer` is
45
- * created here; a headless host (no GPU) skips this entirely.
46
- */
47
- export declare function createSceneView(renderer: THREE.WebGLRenderer, width?: number, height?: number): {
48
- scene: THREE.Scene;
49
- camera: THREE.PerspectiveCamera;
50
- composer: EffectComposer;
51
- };
52
- /**
53
- * Creates the Three.js renderer, scene, camera, and postprocessing pipeline.
54
- *
55
- * This is direct Three.js setup — no abstraction. Edit freely. (Now a thin
56
- * combination of {@link createHostRenderer} + {@link createSceneView}.)
57
- */
58
- export declare function setupRenderer(canvas: HTMLCanvasElement, width?: number, height?: number): RendererContext;
59
36
  /**
60
37
  * Rebuild composer passes from scene environment settings.
61
38
  * Scenes without toneMapping default to ACES (the runtime default).
@@ -1 +1 @@
1
- {"version":3,"file":"setup-renderer.d.ts","sourceR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8ao';
3
- import { BloomEffect, BrightnessContrastEffect, ChromaticAberrationEffect, ColorDepthEffect, DepthOfFieldEffect, DotScreenEffect, EffectComposer, EffectPass, GlitchEffect, GodRaysEffect, GridEffect, HueSaturationEffect, LensDistortionEffect, NoiseEffect, NormalPass, OutlineEffect, PixelationEffect, RenderPass, ScanlineEffect, SepiaEffect, ShockWaveEffect, SMAAEffect, SMAAPreset, SSAOEffect, TiltShiftEffect, VignetteEffect, } from 'postprocessing';
3
+ import { BloomEffect, BrightnessContrastEffect, ChromaticAberrationEffect, ColorDepthEffect, DepthOfFieldEffect, DotScreenEffect, EffectPass, GlitchEffect, GodRaysEffect, GridEffect, HueSaturationEffect, LensDistortionEffect, NoiseEffect, NormalPass, OutlineEffect, PixelationEffect, RenderPass, ScanlineEffect, SepiaEffect, ShockWaveEffect, SMAAEffect, SMAAPreset, SSAOEffect, TiltShiftEffect, VignetteEffect, } from 'postprocessing';
4
4
  import * as THREE from 'three';
5
5
  import { MotionBlurEffect, SSGIEffect, SSREffect, VelocityDepthNormalPass, } from '../../vendor/realism-effects/dist/index.js';
6
6
  import { DEFAULTS } from '../defaults';
@@ -25,7 +25,7 @@ export function applyRendererSettings(renderer, rendering, basePixelRatio = Math
25
25
  /**
26
26
  * Create ONLY the WebGL renderer. The HOST owns the renderer (see
27
27
  * `ThreeHostContext.renderer`); the game/adapter owns the scene/camera/composer it
28
- * renders into. Split out of `setupRenderer` for the adapter inversion.
28
+ * renders into.
29
29
  *
30
30
  * `rendering` is the scene-level render scope (`env.rendering`); it seeds the
31
31
  * reload-only `antialias` option at construction and the live shadow/resolution
@@ -63,35 +63,6 @@ export function createHostRenderer(canvas, width = window.innerWidth, height = w
63
63
  detectKtx2Support(renderer);
64
64
  return renderer;
65
65
  }
66
- /**
67
- * Create the scene, camera, and postprocessing composer that a first-party game
68
- * renders into, given a host-provided renderer. The GPU-only `composer` is
69
- * created here; a headless host (no GPU) skips this entirely.
70
- */
71
- export function createSceneView(renderer, width = window.innerWidth, height = window.innerHeight) {
72
- const safeWidth = Math.max(1, width);
73
- const safeHeight = Math.max(1, height);
74
- const scene = new THREE.Scene();
75
- scene.background = new THREE.Color(0x1a1a2e);
76
- const camera = new THREE.PerspectiveCamera(DEFAULTS.camera.fov, safeWidth / safeHeight, DEFAULTS.camera.near, DEFAULTS.camera.far);
77
- camera.position.set(0, 5, 10);
78
- camera.lookAt(0, 0, 0);
79
- const composer = new EffectComposer(renderer);
80
- composer.addPass(new RenderPass(scene, camera));
81
- composer.addPass(new EffectPass(camera, new BloomEffect({ luminanceThreshold: DEFAULTS.postProcessing.bloom.luminanceThreshold })));
82
- return { scene, camera, composer };
83
- }
84
- /**
85
- * Creates the Three.js renderer, scene, camera, and postprocessing pipeline.
86
- *
87
- * This is direct Three.js setup — no abstraction. Edit freely. (Now a thin
88
- * combination of {@link createHostRenderer} + {@link createSceneView}.)
89
- */
90
- export function setupRenderer(canvas, width = window.innerWidth, height = window.innerHeight) {
91
- const renderer = createHostRenderer(canvas, width, height);
92
- const { scene, camera, composer } = createSceneView(renderer, width, height);
93
- return { renderer, scene, camera, composer };
94
- }
95
66
  const toneMappingModes = {
96
67
  none: THREE.NoToneMapping,
97
68
  linear: THREE.LinearToneMapping,
@@ -2,11 +2,8 @@
2
2
  * world3d-react — the react-three-fiber bridge for vgai's three surface
3
3
  * (`@engine/world3d-react`).
4
4
  *
5
- * An OPT-IN module, upstreamed
6
- * from the live-proven `examples/r3f-first-party` project copies (R4;
7
- * decision D24 — R3F TSX is the blessed three.js authoring path). Mirrors how
8
- * `pixi/` is the PixiJS surface's opt-in home: a peer surface module the engine
9
- * CORE never imports (enforced by
5
+ * An OPT-IN module, mirroring how `pixi/` is the PixiJS surface's opt-in home:
6
+ * a peer surface module the engine CORE never imports (enforced by
10
7
  * `packages/engine/test/react-core-import-ban.test.ts` — this directory is an
11
8
  * allowed react-importing entry alongside `react/`, and core files may not
12
9
  * import it).
@@ -14,34 +11,27 @@
14
11
  * Peer contract: an importing PROJECT already depends on `react`,
15
12
  * `@react-three/fiber`, and `three` (fiber's three must be deduped to the
16
13
  * host's single instance — `resolve.dedupe: ['three', 'react', 'react-dom']`
17
- * in the project's Vite config; see `createR3FAdapter`'s header). The engine
18
- * package deliberately declares no hard dependency on fiber: only projects
19
- * that already mount through fiber ever import this module.
14
+ * in the project's Vite config). The engine package deliberately declares no
15
+ * hard dependency on fiber: only projects that already mount through fiber
16
+ * ever import this module.
20
17
  *
21
18
  * Surface:
22
- * - `createR3FAdapter({ id, content })` — mount an R3F tree as a first-party
23
- * `kind: "three"` world under the host's gated loop.
24
- * - `useGameContext()` this root's `R3FGameContext` (`input`, `debug`,
25
- * `random`, `game`, `roots`, …) from inside any component in the tree. This
26
- * is how an R3F world reaches engine services: behavior is components +
27
- * hooks (D26b), not a class under a string key. The subsystems an R3F world
28
- * does not build are absent from that type — see its doc comment for what
29
- * to use instead.
30
- * - `EngineBridge` / `EngineBridgeValue` — the context contract, exported
31
- * for advanced adopters building their own bridge.
19
+ * - `r3fRootFactory` / `resolveR3FEntryAdapter`what a three entry module
20
+ * MEANS: a default-exported component (`export default function World()`),
21
+ * mounted as a first-party `kind: "three"` world under the host's gated
22
+ * loop. The world's vgai surface is its entry module's static exports
23
+ * (`export { debug, systems } from './commands'`), connected by the host
24
+ * at mount.
32
25
  *
33
26
  * Deliberately NOT re-exported here: `<RapierPhysicsBridge>`
34
- * (`@engine/world3d-react/rapier-physics-bridge`), which registers an R3F
35
- * world's `@react-three/rapier` physics as the game's
36
- * `SystemAdapters.physics` — so the colliders instrument and the
37
- * editor's transform coordination can see it. It imports
27
+ * (`@engine/world3d-react/rapier-physics-bridge`), which publishes an R3F
28
+ * world's `@react-three/rapier` physics to the module slot the entry's
29
+ * `systems.physics` declaration forwards — so the colliders instrument and
30
+ * the editor's transform coordination can see it. It imports
38
31
  * `@react-three/rapier`, and only a world that already depends on that library
39
32
  * should pull it into its graph; a deep import keeps this barrel's peer
40
33
  * contract to `react`/`@react-three/fiber`/`three` alone.
41
34
  */
42
35
  export { applyWorldRendererConfig, type WorldOutputColorSpace, type WorldRendererConfig, type WorldToneMapping, } from '../adapter/renderer-config';
43
- export { EngineBridge, type EngineBridgeValue, useGameContext } from './engine-bridge';
44
- export { type CreateR3FAdapterOptions, createR3FAdapter } from './r3f-adapter';
45
36
  export { r3fRootFactory, resolveR3FEntryAdapter } from './r3f-root-factory';
46
- export { createR3FRootContext, DEFAULT_INPUT_MAP_PATH, type R3FGameContext, type R3FRootContextOptions, type R3FRootRuntime, } from './world-context';
47
37
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/world3d-react/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EACL,wBAAwB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,KAAK,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/world3d-react/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EACL,wBAAwB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -2,11 +2,8 @@
2
2
  * world3d-react — the react-three-fiber bridge for vgai's three surface
3
3
  * (`@engine/world3d-react`).
4
4
  *
5
- * An OPT-IN module, upstreamed
6
- * from the live-proven `examples/r3f-first-party` project copies (R4;
7
- * decision D24 — R3F TSX is the blessed three.js authoring path). Mirrors how
8
- * `pixi/` is the PixiJS surface's opt-in home: a peer surface module the engine
9
- * CORE never imports (enforced by
5
+ * An OPT-IN module, mirroring how `pixi/` is the PixiJS surface's opt-in home:
6
+ * a peer surface module the engine CORE never imports (enforced by
10
7
  * `packages/engine/test/react-core-import-ban.test.ts` — this directory is an
11
8
  * allowed react-importing entry alongside `react/`, and core files may not
12
9
  * import it).
@@ -14,33 +11,26 @@
14
11
  * Peer contract: an importing PROJECT already depends on `react`,
15
12
  * `@react-three/fiber`, and `three` (fiber's three must be deduped to the
16
13
  * host's single instance — `resolve.dedupe: ['three', 'react', 'react-dom']`
17
- * in the project's Vite config; see `createR3FAdapter`'s header). The engine
18
- * package deliberately declares no hard dependency on fiber: only projects
19
- * that already mount through fiber ever import this module.
14
+ * in the project's Vite config). The engine package deliberately declares no
15
+ * hard dependency on fiber: only projects that already mount through fiber
16
+ * ever import this module.
20
17
  *
21
18
  * Surface:
22
- * - `createR3FAdapter({ id, content })` — mount an R3F tree as a first-party
23
- * `kind: "three"` world under the host's gated loop.
24
- * - `useGameContext()` this root's `R3FGameContext` (`input`, `debug`,
25
- * `random`, `game`, `roots`, …) from inside any component in the tree. This
26
- * is how an R3F world reaches engine services: behavior is components +
27
- * hooks (D26b), not a class under a string key. The subsystems an R3F world
28
- * does not build are absent from that type — see its doc comment for what
29
- * to use instead.
30
- * - `EngineBridge` / `EngineBridgeValue` — the context contract, exported
31
- * for advanced adopters building their own bridge.
19
+ * - `r3fRootFactory` / `resolveR3FEntryAdapter`what a three entry module
20
+ * MEANS: a default-exported component (`export default function World()`),
21
+ * mounted as a first-party `kind: "three"` world under the host's gated
22
+ * loop. The world's vgai surface is its entry module's static exports
23
+ * (`export { debug, systems } from './commands'`), connected by the host
24
+ * at mount.
32
25
  *
33
26
  * Deliberately NOT re-exported here: `<RapierPhysicsBridge>`
34
- * (`@engine/world3d-react/rapier-physics-bridge`), which registers an R3F
35
- * world's `@react-three/rapier` physics as the game's
36
- * `SystemAdapters.physics` — so the colliders instrument and the
37
- * editor's transform coordination can see it. It imports
27
+ * (`@engine/world3d-react/rapier-physics-bridge`), which publishes an R3F
28
+ * world's `@react-three/rapier` physics to the module slot the entry's
29
+ * `systems.physics` declaration forwards — so the colliders instrument and
30
+ * the editor's transform coordination can see it. It imports
38
31
  * `@react-three/rapier`, and only a world that already depends on that library
39
32
  * should pull it into its graph; a deep import keeps this barrel's peer
40
33
  * contract to `react`/`@react-three/fiber`/`three` alone.
41
34
  */
42
35
  export { applyWorldRendererConfig, } from '../adapter/renderer-config';
43
- export { EngineBridge, useGameContext } from './engine-bridge';
44
- export { createR3FAdapter } from './r3f-adapter';
45
36
  export { r3fRootFactory, resolveR3FEntryAdapter } from './r3f-root-factory';
46
- export { createR3FRootContext, DEFAULT_INPUT_MAP_PATH, } from './world-context';
@@ -1,8 +1,6 @@
1
1
  /**
2
2
  * `r3fRootFactory` — mount a `three` root whose entry module DEFAULT-EXPORTS a
3
- * React component.
4
- *
5
- * The idiomatic-shape fix (D26). A model asked for an R3F world writes:
3
+ * React component. This is the ONE first-party three mount:
6
4
  *
7
5
  * ```tsx
8
6
  * export default function World() {
@@ -10,32 +8,33 @@
10
8
  * }
11
9
  * ```
12
10
  *
13
- * It does NOT write `export const adapter = createR3FAdapter({ id, content })`.
14
- * That export is pure vgai ceremony wrapped around a component the author
15
- * already wrote, and it is the second-largest non-idiomatic thing left in a
16
- * world file (the largest is the missing `<Canvas>`, which is a separate
17
- * question about who owns the canvas — see D26).
18
- *
19
- * The `dom` root already settled this convention: its factory reads
20
- * `entryModule.default` and wraps it. This is the same contract for three
21
- * roots, so both surfaces answer "what do I export?" the same way.
11
+ * The world is an ordinary R3F app. Everything vgai-shaped stays at the entry
12
+ * module's STATIC surface (`export { debug, systems } from './commands'`) and
13
+ * on the host's side of the seam; no vgai runtime context ever enters the
14
+ * React tree. The host controls Fiber's `frameloop: 'never'` scheduler, wires
15
+ * the game-scoped input seams from outside (`../runtime/game-input-seams.ts`),
16
+ * and installs `WorldProvider` off the Game handle so the lib-legal react
17
+ * doors (`useWorldState`, `useOptionalGame`, `useDebugProvider`) resolve.
22
18
  *
23
19
  * ## Why this is NOT in `mount-game.ts`
24
20
  *
25
- * `defaultThreeAdapterFactory` lives beside the registry, and the registry
26
- * module is deliberately dependency-free: its own doc notes threejs is safe to
27
- * ship there because `three` is already an unconditional engine dependency.
28
- * `@react-three/fiber` is NOT it is the PROJECT's dependency, and
29
- * `world3d-react` is the opt-in module that owns it. Putting this factory
30
- * there would make R3F unconditional for every game, including ones with no
31
- * React at all.
32
- *
33
- * ## Compatibility
34
- *
35
- * An `adapter` export still wins, so existing worlds are untouched and a game
36
- * needing full control over its own `RootAdapter` keeps it.
21
+ * The adapter registry module is deliberately dependency-free beyond `three`
22
+ * (already an unconditional engine dependency). `@react-three/fiber` is NOT
23
+ * it is the PROJECT's dependency, and `world3d-react` is the opt-in module
24
+ * that owns it. Putting this factory beside the registry would make R3F
25
+ * unconditional for every game, including ones with no React at all; instead
26
+ * each project's `main.ts` registers it (`registerAdapter('three',
27
+ * r3fRootFactory)`).
28
+ *
29
+ * ## The mount mechanics (fiber v9, host-gated)
30
+ *
31
+ * three.js identity: this module never imports `three` itself for scene
32
+ * objects fiber's internal `import * as THREE from 'three'` must resolve to
33
+ * the SAME instance the engine's `ThreeHostContext.three` points at, which the
34
+ * importing project guarantees via its Vite
35
+ * `resolve.dedupe: ['three', 'react', 'react-dom']`.
37
36
  */
38
- import type { RootAdapter } from '../adapter/root-adapter';
37
+ import type { RootAdapter } from '../adapter';
39
38
  import type { AdapterSurfaceFactory } from '../runtime/mount-game';
40
39
  /**
41
40
  * What a three entry module MEANS, in one place.
@@ -43,20 +42,15 @@ import type { AdapterSurfaceFactory } from '../runtime/mount-game';
43
42
  * Two callers need this answer and must never disagree about it: the runtime
44
43
  * mount ({@link r3fRootFactory}, below) and the EDITOR's design session
45
44
  * (`packages/editor/src/authoring/r3f-design-session.ts`), which design-mounts
46
- * the same entry so edit mode authors the live fiber scene. When only the
47
- * runtime knew about the default-export shape, the converted starter played
48
- * fine under `npm run game` and edit mode showed "(no scene loaded)".
45
+ * the same entry so edit mode authors the live fiber scene.
49
46
  *
50
- * Returns `null` when the module is neither shape — the callers differ on what
51
- * to do about that (the factory throws, the design session declines the world
52
- * and leaves existing paths alone).
47
+ * Returns `null` when the module has no default-exported component — the
48
+ * callers differ on what to do about that (the factory throws, the design
49
+ * session declines the world and leaves existing paths alone).
53
50
  */
54
51
  export declare function resolveR3FEntryAdapter(entryModule: unknown, rootId: string): RootAdapter | null;
55
52
  /**
56
53
  * Register with `registerAdapter('three', r3fRootFactory)`.
57
- *
58
- * Resolution order mirrors `defaultThreeAdapterFactory`'s (explicit adapter
59
- * wins) and then accepts the default-exported component.
60
54
  */
61
55
  export declare const r3fRootFactory: AdapterSurfaceFactory;
62
56
  //# sourceMappingURL=r3f-root-factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"r3f-root-factory.d.ts","sourceRoot":"","sources":["../../src/world3d-react/r3f-root-factory.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAUnE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAwB/F;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,qBAQ5B,CAAC"}
1
+ {"version":3,"file":"r3f-root-factory.d.ts","sourceRoot":"","sources":["../../src/world3d-react/r3f-root-factory.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAWH,OAAO,KAAK,EAAoB,WAAW,EAAoB,MAAM,YAAY,CAAC;AAelF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAsZnE;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAI/F;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,qBAO5B,CAAC"}