@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,118 +0,0 @@
1
- /**
2
- * `applyVgaiOverlay` — the T3.8 deliverable (docs/DECISIONS-PENDING.md §D9):
3
- * the opt-in runtime overlay applier a game owner adds to THEIR OWN deployment
4
- * so an adapted (ingested-then-edited) game ships with the editor's edits
5
- * visible, with zero involvement from the editor at runtime.
6
- *
7
- * The opt-in shape (D9's "minimal source opt-in, consistent with the
8
- * zero-diff-unless-opted-in invariant"): one import + one call, placed before
9
- * the game's own entry point runs (so the capture trap below is installed
10
- * before the game's `WebGLRenderer` is constructed):
11
- *
12
- * import * as THREE from 'three';
13
- * import { applyVgaiOverlay } from '@vgai/engine/adapter/ingest/overlay-applier';
14
- *
15
- * applyVgaiOverlay({ three: THREE, gameId: 'my-game' }); // fire-and-forget
16
- * import('./my-game-entry.js'); // the UNMODIFIED game, unchanged
17
- *
18
- * No scene is passed manually — this reuses the SAME render-accessor trap
19
- * (`./scene-capture.ts`) the editor's ingest mode uses to obtain the game's
20
- * live `Scene`/camera the moment it first renders, so this works for ANY
21
- * unmodified three.js game the SAME way ingestion already captures it (per
22
- * `scene-capture.ts`'s own caveat, this requires the game to share the host's
23
- * `three` module instance — a bundled/vendored copy of `three` cannot be
24
- * captured this way, matching the editor's own capture ceiling).
25
- *
26
- * Failure modes are all graceful (the game always keeps running unmodified)
27
- * but never silent — every one is logged via `console.warn` under the shared
28
- * `overlay-report` prefix (`./overlay-report.ts`) so ops can grep one string
29
- * for every overlay-related issue across both the editor and the ship path:
30
- * - no overlay file at `overlayUrl` (never authored, or a 404/network
31
- * error) → nothing applied, logged, scene never even captured;
32
- * - the game never renders within `captureTimeoutMs` (bundled/non-shared
33
- * three, or the game simply never boots) → nothing applied, logged;
34
- * - a version mismatch and/or orphaned overlay ids (D9) → whatever DOES
35
- * resolve is still applied; the report names what didn't.
36
- *
37
- * Precedence (D9 "overlay-vs-game-save-system precedence"): the overlay is
38
- * applied exactly ONCE, synchronously, in the continuation of the game's
39
- * FIRST captured render call — i.e. between that frame finishing and the
40
- * game's own next frame starting. Any later mutation of the SAME
41
- * property by the game's own logic (its own save/load system, a per-frame
42
- * animation, etc.) therefore wins from then on purely by construction: this
43
- * applier never re-applies and never re-reads the overlay after this one
44
- * pass. A property the game's own logic never revisits stays overlaid for
45
- * the life of the session; a property the game's own logic re-derives every
46
- * frame reverts to the game's own value on the very next frame. This
47
- * ordering is exercised directly by `overlay-applier.test.ts`'s "precedence"
48
- * case (apply, then simulate one more game-owned mutation frame).
49
- */
50
- import type * as THREE from 'three';
51
- import { type OverlayApplyReport } from './overlay-report';
52
- export interface ApplyVgaiOverlayOptions {
53
- /**
54
- * The game's own `three` module namespace — pass `import * as THREE from
55
- * 'three'` from the SAME module instance the game imports (required for the
56
- * capture trap to see the game's renderer; see `scene-capture.ts`).
57
- */
58
- three: unknown;
59
- /** Stable id for this game — namespaces the overlay file (matches the editor's `overlayPath(gameId)`). */
60
- gameId: string;
61
- /** Where to fetch the saved overlay from. Defaults to `overlayPath(gameId)` (`.vgai/overlays/<gameId>.json`, resolved relative to the deployed page — the editor saves to `<projectRoot>/.vgai/overlays/`; a deployment copies that file next to the built page). */
62
- overlayUrl?: string | undefined;
63
- /**
64
- * The deployed game's own version, if known — compared against the
65
- * overlay's `authoredAgainst.gameVersion` for drift reporting. Omit/null:
66
- * never fabricated (anti-shim) — a mismatch is only ever reported when
67
- * BOTH sides are known (`./overlay-report.ts`).
68
- */
69
- gameVersion?: string | null | undefined;
70
- /**
71
- * R5 (docs/MASTER-ARCHITECTURE-REVIEW.md §4(c)): the deployed game's own
72
- * `UPSTREAM.md` pin, if the game owner happens to know it (e.g. baked in at
73
- * build time from their own vendoring step). Compared against the overlay's
74
- * `authoredAgainst.upstreamPin` for the same drift reporting `gameVersion`
75
- * gets, but catches a same-slot SUBSTITUTION that `gameVersion` alone
76
- * cannot (see `./upstream-pin.ts` + `./overlay-report.ts`'s header).
77
- * DELIBERATE NO-OP by default: this ship-path applier runs in the game
78
- * owner's OWN deployed build, which has no filesystem access to the
79
- * `UPSTREAM.md` that lived in the vgai monorepo/editor project at
80
- * ingest-authoring time — there is no way for this applier to discover the
81
- * pin itself, so it is never fabricated (anti-shim) and the check silently
82
- * skips (report's `upstreamPin.mismatch` stays `false`) unless the caller
83
- * supplies this option explicitly.
84
- */
85
- upstreamPin?: string | null | undefined;
86
- /** How long to wait for the game's first captured render call before giving up (ms). Defaults to `installSceneCapture`'s own default (10s). */
87
- captureTimeoutMs?: number | undefined;
88
- /** Injectable `fetch` (tests / non-browser hosts). Defaults to the global `fetch`. */
89
- fetchImpl?: typeof fetch | undefined;
90
- }
91
- export interface ApplyVgaiOverlayResult {
92
- /** Whether the game's scene was actually captured (false only when capture itself timed out or no overlay was found — either way the game runs unmodified). */
93
- captured: boolean;
94
- /** The D9 apply report, or `null` when there was no overlay to apply at all (not an error — the game runs unmodified). */
95
- report: OverlayApplyReport | null;
96
- /**
97
- * The captured scene/camera, present only when `captured` is true. Most
98
- * callers (a game's own entry point) have no reason to touch this — it's
99
- * surfaced for diagnostics/tooling (and for tests, which use it to inspect
100
- * the live post-apply scene the same way the editor's ingest proof pages do)
101
- * rather than requiring a second, independent capture.
102
- */
103
- scene?: THREE.Scene | undefined;
104
- camera?: THREE.Camera | undefined;
105
- }
106
- /**
107
- * The opt-in ship-path applier — see this module's header for the full
108
- * contract. Installs the scene-capture trap SYNCHRONOUSLY (before the first
109
- * `await`), so a caller that follows the documented pattern (call this, THEN
110
- * import/boot the game) never races the trap against the game's first frame
111
- * — the trap's `captured` slot latches on the game's first render regardless
112
- * of when (or whether) this function later calls `waitForCapture` on it.
113
- * Only PROCEEDS to actually wait for that capture once an overlay has been
114
- * found (fetched first, deliberately) — the common "never edited this game"
115
- * case then costs one fetch, never a multi-second capture-timeout wait.
116
- */
117
- export declare function applyVgaiOverlay(options: ApplyVgaiOverlayOptions): Promise<ApplyVgaiOverlayResult>;
118
- //# sourceMappingURL=overlay-applier.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"overlay-applier.d.ts","sourceRoot":"","sources":["../../../src/adapter/ingest/overlay-applier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAGpC,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,KAAK,EAAE,OAAO,CAAC;IACf,0GAA0G;IAC1G,MAAM,EAAE,MAAM,CAAC;IACf,qQAAqQ;IACrQ,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC;;;;;;;;;;;;;;OAcG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,+IAA+I;IAC/I,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,sFAAsF;IACtF,SAAS,CAAC,EAAE,OAAO,KAAK,GAAG,SAAS,CAAC;CACtC;AAED,MAAM,WAAW,sBAAsB;IACrC,+JAA+J;IAC/J,QAAQ,EAAE,OAAO,CAAC;IAClB,0HAA0H;IAC1H,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAClC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC;IAChC,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;CACnC;AA8BD;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,sBAAsB,CAAC,CAgDjC"}
@@ -1,132 +0,0 @@
1
- /**
2
- * `applyVgaiOverlay` — the T3.8 deliverable (docs/DECISIONS-PENDING.md §D9):
3
- * the opt-in runtime overlay applier a game owner adds to THEIR OWN deployment
4
- * so an adapted (ingested-then-edited) game ships with the editor's edits
5
- * visible, with zero involvement from the editor at runtime.
6
- *
7
- * The opt-in shape (D9's "minimal source opt-in, consistent with the
8
- * zero-diff-unless-opted-in invariant"): one import + one call, placed before
9
- * the game's own entry point runs (so the capture trap below is installed
10
- * before the game's `WebGLRenderer` is constructed):
11
- *
12
- * import * as THREE from 'three';
13
- * import { applyVgaiOverlay } from '@vgai/engine/adapter/ingest/overlay-applier';
14
- *
15
- * applyVgaiOverlay({ three: THREE, gameId: 'my-game' }); // fire-and-forget
16
- * import('./my-game-entry.js'); // the UNMODIFIED game, unchanged
17
- *
18
- * No scene is passed manually — this reuses the SAME render-accessor trap
19
- * (`./scene-capture.ts`) the editor's ingest mode uses to obtain the game's
20
- * live `Scene`/camera the moment it first renders, so this works for ANY
21
- * unmodified three.js game the SAME way ingestion already captures it (per
22
- * `scene-capture.ts`'s own caveat, this requires the game to share the host's
23
- * `three` module instance — a bundled/vendored copy of `three` cannot be
24
- * captured this way, matching the editor's own capture ceiling).
25
- *
26
- * Failure modes are all graceful (the game always keeps running unmodified)
27
- * but never silent — every one is logged via `console.warn` under the shared
28
- * `overlay-report` prefix (`./overlay-report.ts`) so ops can grep one string
29
- * for every overlay-related issue across both the editor and the ship path:
30
- * - no overlay file at `overlayUrl` (never authored, or a 404/network
31
- * error) → nothing applied, logged, scene never even captured;
32
- * - the game never renders within `captureTimeoutMs` (bundled/non-shared
33
- * three, or the game simply never boots) → nothing applied, logged;
34
- * - a version mismatch and/or orphaned overlay ids (D9) → whatever DOES
35
- * resolve is still applied; the report names what didn't.
36
- *
37
- * Precedence (D9 "overlay-vs-game-save-system precedence"): the overlay is
38
- * applied exactly ONCE, synchronously, in the continuation of the game's
39
- * FIRST captured render call — i.e. between that frame finishing and the
40
- * game's own next frame starting. Any later mutation of the SAME
41
- * property by the game's own logic (its own save/load system, a per-frame
42
- * animation, etc.) therefore wins from then on purely by construction: this
43
- * applier never re-applies and never re-reads the overlay after this one
44
- * pass. A property the game's own logic never revisits stays overlaid for
45
- * the life of the session; a property the game's own logic re-derives every
46
- * frame reverts to the game's own value on the very next frame. This
47
- * ordering is exercised directly by `overlay-applier.test.ts`'s "precedence"
48
- * case (apply, then simulate one more game-owned mutation frame).
49
- */
50
- import { applyOverlayToObjects, assignStructuralIds } from './overlay-apply';
51
- import { overlayPath, parseOverlayFile } from './overlay-file';
52
- import { buildOverlayApplyReport, logOverlayApplyReport, OVERLAY_REPORT_PREFIX, } from './overlay-report';
53
- import { installSceneCapture } from './scene-capture';
54
- /** Shared warn helper — every graceful-failure path below logs through here. */
55
- function warn(gameId, message) {
56
- // biome-ignore lint/suspicious/noConsole: deliberate, greppable (mirrors overlay-report.ts's own console.warn)
57
- console.warn(`${OVERLAY_REPORT_PREFIX} game "${gameId}": ${message}`);
58
- }
59
- async function fetchOverlayFile(url, gameId, fetchImpl) {
60
- const doFetch = fetchImpl ?? (typeof fetch === 'function' ? fetch : undefined);
61
- if (!doFetch) {
62
- warn(gameId, 'no fetch implementation available — overlay not applied, running unmodified.');
63
- return null;
64
- }
65
- try {
66
- const res = await doFetch(url);
67
- if (!res.ok)
68
- throw new Error(`HTTP ${res.status}`);
69
- const raw = await res.json();
70
- return parseOverlayFile(raw);
71
- }
72
- catch (err) {
73
- const reason = err instanceof Error ? err.message : String(err);
74
- warn(gameId, `no overlay applied (${reason}) — running unmodified.`);
75
- return null;
76
- }
77
- }
78
- /**
79
- * The opt-in ship-path applier — see this module's header for the full
80
- * contract. Installs the scene-capture trap SYNCHRONOUSLY (before the first
81
- * `await`), so a caller that follows the documented pattern (call this, THEN
82
- * import/boot the game) never races the trap against the game's first frame
83
- * — the trap's `captured` slot latches on the game's first render regardless
84
- * of when (or whether) this function later calls `waitForCapture` on it.
85
- * Only PROCEEDS to actually wait for that capture once an overlay has been
86
- * found (fetched first, deliberately) — the common "never edited this game"
87
- * case then costs one fetch, never a multi-second capture-timeout wait.
88
- */
89
- export async function applyVgaiOverlay(options) {
90
- const { three, gameId, gameVersion = null, upstreamPin = null, fetchImpl } = options;
91
- const overlayUrl = options.overlayUrl ?? overlayPath(gameId);
92
- // Install the capture trap before anything else in this function (and
93
- // before returning control to the caller's microtask queue) — see the
94
- // header comment's ordering guarantee.
95
- const capture = installSceneCapture(three);
96
- const overlayFile = await fetchOverlayFile(overlayUrl, gameId, fetchImpl);
97
- if (!overlayFile) {
98
- // Nothing to apply (never authored, 404, network error — already logged
99
- // by fetchOverlayFile) — don't bother waiting for a render at all.
100
- capture.uninstall();
101
- return { captured: false, report: null };
102
- }
103
- let rt;
104
- try {
105
- rt = await capture.waitForCapture(options.captureTimeoutMs);
106
- }
107
- catch (err) {
108
- capture.uninstall();
109
- const reason = err instanceof Error ? err.message : String(err);
110
- warn(gameId, `scene capture failed (${reason}) — overlay not applied, running unmodified.`);
111
- return { captured: false, report: null };
112
- }
113
- capture.uninstall(); // one-shot: we have what we need, stop wrapping future renders.
114
- const { byId } = assignStructuralIds(rt.scene, rt.camera);
115
- const { applied, orphanedIds } = applyOverlayToObjects(byId, overlayFile.overrides);
116
- const report = buildOverlayApplyReport({
117
- gameId,
118
- authoredAgainst: overlayFile.authoredAgainst.gameVersion,
119
- currentVersion: gameVersion,
120
- applied,
121
- orphanedIds,
122
- // R5: `authoredUpstreamPin` passes through undefined for a legacy overlay
123
- // (the key was never in `authoredAgainst` at all — see overlay-file.ts),
124
- // preserving the "never checked" vs. "checked, found nothing" distinction
125
- // all the way from disk. `currentUpstreamPin` is this no-op-by-default
126
- // option (see its doc comment above) — `null` unless a game owner passes it.
127
- authoredUpstreamPin: overlayFile.authoredAgainst.upstreamPin,
128
- currentUpstreamPin: upstreamPin,
129
- });
130
- logOverlayApplyReport(report);
131
- return { captured: true, report, scene: rt.scene, camera: rt.camera };
132
- }
@@ -1,60 +0,0 @@
1
- /**
2
- * Ingest overlay application core — the structural-path identity scheme and
3
- * override-application loop shared by the EDITOR's `IngestAuthoringAdapter`
4
- * (`packages/editor/src/authoring/ingest-authoring-adapter.ts`, which layers
5
- * hierarchy/selection/undo bookkeeping over it) and the T3.8 runtime ship-path
6
- * applier (`./overlay-applier.ts`, which uses it directly with none of that
7
- * editor bookkeeping). Extracted here (rather than duplicated) per D9's task
8
- * split (docs/DECISIONS-PENDING.md §D9) — the editor re-exports/reuses this
9
- * module so its behavior (and the ids it mints) stay byte-for-byte identical
10
- * between "authored in the editor" and "reapplied at ship time".
11
- *
12
- * Identity: each object gets a deterministic **structural-path id** — stable
13
- * for a given scene shape (position in the tree + three.js type + name), so
14
- * the SAME id re-binds to the SAME object after an independent fresh walk of
15
- * an unmodified game's rebuilt scene (a reload, or a separate page entirely —
16
- * this is what lets an overlay authored in the editor apply cleanly in a
17
- * shipped build that never ran the editor). It is also written to
18
- * `userData.entityId` so the editor's object map / gizmo / selection (which
19
- * key on `entityId`) bind to foreign objects with no further shim.
20
- */
21
- import type * as THREE from 'three';
22
- import type { IngestOverlay } from './overlay-file';
23
- /** Fixed id for the captured render camera (not a scene child, so no structural path). */
24
- export declare const CAMERA_ID = "ingest:camera";
25
- /** The single (non-array) standard-ish material of a mesh, if it has a color. */
26
- export declare function colorMaterialOf(o: THREE.Object3D): THREE.MeshStandardMaterial | null;
27
- /** Result of a structural-path walk: the id→object map plus a few reflection stats. */
28
- export interface StructuralIdWalk {
29
- byId: Map<string, THREE.Object3D>;
30
- count: number;
31
- meshes: number;
32
- lights: number;
33
- }
34
- /**
35
- * (Re)assign structural-path ids to every object under `scene` (and, if
36
- * given, the separately-captured render `camera`, under the fixed
37
- * {@link CAMERA_ID}). Idempotent and deterministic from scene structure
38
- * (position + type + name) — the prerequisite for overlay reapplication
39
- * across an independent fresh walk (editor reload, or a shipped build that
40
- * never ran the editor at all).
41
- */
42
- export declare function assignStructuralIds(scene: THREE.Object3D, camera?: THREE.Object3D | undefined): StructuralIdWalk;
43
- /** Result of applying a saved overlay onto a structural-id-walked scene. */
44
- export interface OverlayApplyOutcome {
45
- applied: number;
46
- orphanedIds: string[];
47
- }
48
- /**
49
- * Apply a saved overlay's overrides onto the live objects in `byId` (from
50
- * {@link assignStructuralIds}). Ids absent from the map are "orphaned" — e.g. a
51
- * dynamic child that didn't respawn, or the vendored game was bumped and
52
- * restructured — never an error; the caller reports them (never silently) via
53
- * `./overlay-report.ts`. Mutates matched objects in place; does not mutate
54
- * `overlay` itself or track dirty/undo state — that bookkeeping is the
55
- * editor-side `IngestAuthoringAdapter`'s job (persistable-edit tracking, so
56
- * orphans round-trip on the next save) and is irrelevant to the ship-path
57
- * applier (which never saves).
58
- */
59
- export declare function applyOverlayToObjects(byId: Map<string, THREE.Object3D>, overlay: IngestOverlay): OverlayApplyOutcome;
60
- //# sourceMappingURL=overlay-apply.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"overlay-apply.d.ts","sourceRoot":"","sources":["../../../src/adapter/ingest/overlay-apply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,0FAA0F;AAC1F,eAAO,MAAM,SAAS,kBAAkB,CAAC;AAEzC,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,oBAAoB,GAAG,IAAI,CAKpF;AAED,uFAAuF;AACvF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,KAAK,CAAC,QAAQ,EACrB,MAAM,CAAC,EAAE,KAAK,CAAC,QAAQ,GAAG,SAAS,GAClC,gBAAgB,CA4BlB;AAED,4EAA4E;AAC5E,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,EACjC,OAAO,EAAE,aAAa,GACrB,mBAAmB,CAkBrB"}
@@ -1,101 +0,0 @@
1
- /**
2
- * Ingest overlay application core — the structural-path identity scheme and
3
- * override-application loop shared by the EDITOR's `IngestAuthoringAdapter`
4
- * (`packages/editor/src/authoring/ingest-authoring-adapter.ts`, which layers
5
- * hierarchy/selection/undo bookkeeping over it) and the T3.8 runtime ship-path
6
- * applier (`./overlay-applier.ts`, which uses it directly with none of that
7
- * editor bookkeeping). Extracted here (rather than duplicated) per D9's task
8
- * split (docs/DECISIONS-PENDING.md §D9) — the editor re-exports/reuses this
9
- * module so its behavior (and the ids it mints) stay byte-for-byte identical
10
- * between "authored in the editor" and "reapplied at ship time".
11
- *
12
- * Identity: each object gets a deterministic **structural-path id** — stable
13
- * for a given scene shape (position in the tree + three.js type + name), so
14
- * the SAME id re-binds to the SAME object after an independent fresh walk of
15
- * an unmodified game's rebuilt scene (a reload, or a separate page entirely —
16
- * this is what lets an overlay authored in the editor apply cleanly in a
17
- * shipped build that never ran the editor). It is also written to
18
- * `userData.entityId` so the editor's object map / gizmo / selection (which
19
- * key on `entityId`) bind to foreign objects with no further shim.
20
- */
21
- import { setUserData } from '../../scene/user-data';
22
- /** Fixed id for the captured render camera (not a scene child, so no structural path). */
23
- export const CAMERA_ID = 'ingest:camera';
24
- /** The single (non-array) standard-ish material of a mesh, if it has a color. */
25
- export function colorMaterialOf(o) {
26
- const mat = o.material;
27
- if (!mat || Array.isArray(mat))
28
- return null;
29
- const m = mat;
30
- return m.color ? m : null;
31
- }
32
- /**
33
- * (Re)assign structural-path ids to every object under `scene` (and, if
34
- * given, the separately-captured render `camera`, under the fixed
35
- * {@link CAMERA_ID}). Idempotent and deterministic from scene structure
36
- * (position + type + name) — the prerequisite for overlay reapplication
37
- * across an independent fresh walk (editor reload, or a shipped build that
38
- * never ran the editor at all).
39
- */
40
- export function assignStructuralIds(scene, camera) {
41
- const byId = new Map();
42
- let count = 0;
43
- let meshes = 0;
44
- let lights = 0;
45
- const visit = (o, path) => {
46
- const id = `ingest:${path}:${o.type}:${o.name || ''}`;
47
- setUserData(o, 'entityId', id);
48
- byId.set(id, o);
49
- count++;
50
- if (o.isLight)
51
- lights++;
52
- else if (o.isMesh)
53
- meshes++;
54
- o.children.forEach((c, i) => {
55
- visit(c, `${path}/${i}`);
56
- });
57
- };
58
- scene.children.forEach((c, i) => {
59
- visit(c, `${i}`);
60
- });
61
- if (camera) {
62
- setUserData(camera, 'entityId', CAMERA_ID);
63
- byId.set(CAMERA_ID, camera);
64
- count++;
65
- }
66
- return { byId, count, meshes, lights };
67
- }
68
- /**
69
- * Apply a saved overlay's overrides onto the live objects in `byId` (from
70
- * {@link assignStructuralIds}). Ids absent from the map are "orphaned" — e.g. a
71
- * dynamic child that didn't respawn, or the vendored game was bumped and
72
- * restructured — never an error; the caller reports them (never silently) via
73
- * `./overlay-report.ts`. Mutates matched objects in place; does not mutate
74
- * `overlay` itself or track dirty/undo state — that bookkeeping is the
75
- * editor-side `IngestAuthoringAdapter`'s job (persistable-edit tracking, so
76
- * orphans round-trip on the next save) and is irrelevant to the ship-path
77
- * applier (which never saves).
78
- */
79
- export function applyOverlayToObjects(byId, overlay) {
80
- let applied = 0;
81
- const orphanedIds = [];
82
- for (const [id, ov] of Object.entries(overlay)) {
83
- const o = byId.get(id);
84
- if (!o) {
85
- orphanedIds.push(id);
86
- continue;
87
- }
88
- if (ov.position)
89
- o.position.set(ov.position[0], ov.position[1], ov.position[2]);
90
- if (ov.rotation)
91
- o.quaternion.set(ov.rotation[0], ov.rotation[1], ov.rotation[2], ov.rotation[3]);
92
- if (ov.scale)
93
- o.scale.set(ov.scale[0], ov.scale[1], ov.scale[2]);
94
- if (ov.color)
95
- colorMaterialOf(o)?.color.set(ov.color);
96
- if (ov.visible !== undefined)
97
- o.visible = ov.visible;
98
- applied++;
99
- }
100
- return { applied, orphanedIds };
101
- }
@@ -1,79 +0,0 @@
1
- /**
2
- * Ingest overlay envelope — the on-disk shape shared by every consumer of a
3
- * saved ingest overlay: the editor (`packages/editor/src/authoring/ingest-overlay.ts`,
4
- * which persists it through the storage-backend seam) AND the T3.8 runtime ship-path
5
- * applier (`./overlay-applier.ts`, which fetches it over plain HTTP in a deployed
6
- * game with no editor/storage-backend dependency at all).
7
- *
8
- * This module is the dependency-free core (types + pure parsing) both share — moved
9
- * here (from the editor-only module that used to own it) per D9's task split
10
- * (docs/DECISIONS-PENDING.md §D9): the editor keeps the storage-backend-aware
11
- * `loadOverlay`/`saveOverlay` and re-exports everything below unchanged so its
12
- * existing import sites don't churn.
13
- */
14
- /** A single object's persisted overrides (only the fields the user changed). */
15
- export interface IngestOverride {
16
- position?: [number, number, number];
17
- rotation?: [number, number, number, number];
18
- scale?: [number, number, number];
19
- color?: string;
20
- visible?: boolean;
21
- }
22
- /** id (structural-path) → overrides. */
23
- export type IngestOverlay = Record<string, IngestOverride>;
24
- /** Current on-disk envelope format version (D9, docs/DECISIONS-PENDING.md §D9). */
25
- export declare const OVERLAY_FORMAT_VERSION = 1;
26
- /**
27
- * The on-disk overlay envelope (D9 — overlay versioning + orphan reporting).
28
- * Wraps the flat `IngestOverlay` (id → overrides) with save-time provenance:
29
- * which game version the edits were authored against, so a later mount (editor
30
- * OR shipped runtime) can detect drift and report it (`./overlay-report.ts`'s
31
- * `OverlayApplyReport`).
32
- *
33
- * `formatVersion` distinguishes this from the PRE-D9 flat file (the whole JSON
34
- * file WAS the `IngestOverlay`): {@link parseOverlayFile} recognizes both. An
35
- * object with `formatVersion` + `overrides` parses as the real envelope; any
36
- * other shape (or unparseable content) parses as a legacy flat file, wrapped as
37
- * `{ formatVersion: 0, authoredAgainst: { gameVersion: null }, overrides: <the flat object> }`
38
- * — never rejected, never warned about by itself.
39
- *
40
- * `authoredAgainst.upstreamPin` (R5, docs/MASTER-ARCHITECTURE-REVIEW.md
41
- * §4(c)/§7.1 item 9 — the overlay-identity gap `gameVersion` alone doesn't
42
- * close: `gameVersion` is the manifest's own `version` field, which a
43
- * re-vendor of the upstream game need not bump — see every `public/ingest/*`
44
- * game's `vgai.game.json`, all pinned at `"version": "0.1.0"` regardless of
45
- * upstream commit) is an OPTIONAL sibling key, deliberately absent from this
46
- * type's older call sites' literal shape: its ABSENCE (the key missing from
47
- * `authoredAgainst` entirely) is the "legacy overlay" signal — saved by code
48
- * that predates this field, so the pin concept never existed for it, and
49
- * `./overlay-report.ts`'s apply-time check must skip it (not treat it as a
50
- * guaranteed mismatch OR a guaranteed match — anti-shim, no guessing). A
51
- * `null` VALUE (key present, value `null`) means R5-aware save-time code DID
52
- * look for a pin and honestly found none (e.g. an externally-authored,
53
- * non-vendored project opened via the CLI-on-folder route, which has no
54
- * `UPSTREAM.md` at all). See `./upstream-pin.ts` for the pure extraction, and
55
- * `packages/editor/src/ingest-mode.ts` for where it's read at save/apply
56
- * time. This is purely additive — {@link parseOverlayFile} never invents the
57
- * key for an envelope that didn't have it.
58
- */
59
- export interface OverlayFile {
60
- formatVersion: number;
61
- authoredAgainst: {
62
- gameVersion: string | null;
63
- upstreamPin?: string | null;
64
- };
65
- overrides: IngestOverlay;
66
- }
67
- /** Where a game's overlay lives, project-root-relative (also the ship path's default fetch URL). */
68
- export declare function overlayPath(gameId: string): string;
69
- /** The empty envelope — no overlay found / nothing authored yet. */
70
- export declare function emptyOverlayFile(): OverlayFile;
71
- /**
72
- * Parse a loaded/fetched overlay's raw JSON into the {@link OverlayFile} shape,
73
- * transparently upgrading a legacy (pre-D9) flat file — the whole parsed value
74
- * IS the `IngestOverlay` in that case. Pure — no I/O, no storage backend, so
75
- * it's usable from any context (editor `loadOverlay`, the ship-path applier's
76
- * `fetch().then(r => r.json())`).
77
- */
78
- export declare function parseOverlayFile(raw: unknown): OverlayFile;
79
- //# sourceMappingURL=overlay-file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"overlay-file.d.ts","sourceRoot":"","sources":["../../../src/adapter/ingest/overlay-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,gFAAgF;AAChF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wCAAwC;AACxC,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAE3D,mFAAmF;AACnF,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE;QAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAC7E,SAAS,EAAE,aAAa,CAAC;CAC1B;AAED,oGAAoG;AACpG,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,oEAAoE;AACpE,wBAAgB,gBAAgB,IAAI,WAAW,CAM9C;AAYD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,WAAW,CA0B1D"}
@@ -1,66 +0,0 @@
1
- /**
2
- * Ingest overlay envelope — the on-disk shape shared by every consumer of a
3
- * saved ingest overlay: the editor (`packages/editor/src/authoring/ingest-overlay.ts`,
4
- * which persists it through the storage-backend seam) AND the T3.8 runtime ship-path
5
- * applier (`./overlay-applier.ts`, which fetches it over plain HTTP in a deployed
6
- * game with no editor/storage-backend dependency at all).
7
- *
8
- * This module is the dependency-free core (types + pure parsing) both share — moved
9
- * here (from the editor-only module that used to own it) per D9's task split
10
- * (docs/DECISIONS-PENDING.md §D9): the editor keeps the storage-backend-aware
11
- * `loadOverlay`/`saveOverlay` and re-exports everything below unchanged so its
12
- * existing import sites don't churn.
13
- */
14
- /** Current on-disk envelope format version (D9, docs/DECISIONS-PENDING.md §D9). */
15
- export const OVERLAY_FORMAT_VERSION = 1;
16
- /** Where a game's overlay lives, project-root-relative (also the ship path's default fetch URL). */
17
- export function overlayPath(gameId) {
18
- return `.vgai/overlays/${gameId}.json`;
19
- }
20
- /** The empty envelope — no overlay found / nothing authored yet. */
21
- export function emptyOverlayFile() {
22
- return {
23
- formatVersion: OVERLAY_FORMAT_VERSION,
24
- authoredAgainst: { gameVersion: null },
25
- overrides: {},
26
- };
27
- }
28
- /** An envelope has both its distinguishing keys — anything else is a legacy flat file. */
29
- function isEnvelope(raw) {
30
- return (!!raw &&
31
- typeof raw === 'object' &&
32
- 'formatVersion' in raw &&
33
- 'overrides' in raw);
34
- }
35
- /**
36
- * Parse a loaded/fetched overlay's raw JSON into the {@link OverlayFile} shape,
37
- * transparently upgrading a legacy (pre-D9) flat file — the whole parsed value
38
- * IS the `IngestOverlay` in that case. Pure — no I/O, no storage backend, so
39
- * it's usable from any context (editor `loadOverlay`, the ship-path applier's
40
- * `fetch().then(r => r.json())`).
41
- */
42
- export function parseOverlayFile(raw) {
43
- if (isEnvelope(raw)) {
44
- const rawAuthored = (raw.authoredAgainst ?? { gameVersion: null });
45
- const authoredAgainst = {
46
- gameVersion: rawAuthored.gameVersion ?? null,
47
- };
48
- // Preserve ABSENCE vs. explicit `null` (see this field's doc comment
49
- // above) — only copy the key over if the raw JSON actually had it, rather
50
- // than defaulting it in (which would make every pre-R5 saved overlay look
51
- // like a "checked, found nothing" R5 save instead of "never checked").
52
- if ('upstreamPin' in rawAuthored)
53
- authoredAgainst.upstreamPin = rawAuthored.upstreamPin ?? null;
54
- return {
55
- formatVersion: raw.formatVersion,
56
- authoredAgainst,
57
- overrides: raw.overrides ?? {},
58
- };
59
- }
60
- // Legacy flat file (pre-D9): the whole parsed object IS the overrides map.
61
- return {
62
- formatVersion: 0,
63
- authoredAgainst: { gameVersion: null },
64
- overrides: (raw ?? {}),
65
- };
66
- }