@vgai/engine 0.2.0 → 0.3.0

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 (541) hide show
  1. package/README.md +3 -1
  2. package/dist/adapter/authoring.d.ts +404 -0
  3. package/dist/adapter/authoring.d.ts.map +1 -0
  4. package/dist/adapter/authoring.js +22 -0
  5. package/dist/adapter/colyseus-networking-adapter.d.ts +43 -0
  6. package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -0
  7. package/dist/adapter/colyseus-networking-adapter.js +38 -0
  8. package/dist/adapter/first-party-systems.d.ts +38 -0
  9. package/dist/adapter/first-party-systems.d.ts.map +1 -0
  10. package/dist/adapter/first-party-systems.js +77 -0
  11. package/dist/adapter/game-adapter.d.ts +133 -0
  12. package/dist/adapter/game-adapter.d.ts.map +1 -0
  13. package/dist/adapter/game-adapter.js +10 -0
  14. package/dist/adapter/host-context.d.ts +73 -0
  15. package/dist/adapter/host-context.d.ts.map +1 -0
  16. package/dist/adapter/host-context.js +16 -0
  17. package/dist/adapter/index.d.ts +22 -0
  18. package/dist/adapter/index.d.ts.map +1 -0
  19. package/dist/adapter/index.js +15 -0
  20. package/dist/adapter/ingest/game-contract.d.ts +53 -0
  21. package/dist/adapter/ingest/game-contract.d.ts.map +1 -0
  22. package/dist/adapter/ingest/game-contract.js +30 -0
  23. package/dist/adapter/ingest/overlay-applier.d.ts +118 -0
  24. package/dist/adapter/ingest/overlay-applier.d.ts.map +1 -0
  25. package/dist/adapter/ingest/overlay-applier.js +132 -0
  26. package/dist/adapter/ingest/overlay-apply.d.ts +60 -0
  27. package/dist/adapter/ingest/overlay-apply.d.ts.map +1 -0
  28. package/dist/adapter/ingest/overlay-apply.js +101 -0
  29. package/dist/adapter/ingest/overlay-file.d.ts +79 -0
  30. package/dist/adapter/ingest/overlay-file.d.ts.map +1 -0
  31. package/dist/adapter/ingest/overlay-file.js +66 -0
  32. package/dist/adapter/ingest/overlay-report.d.ts +113 -0
  33. package/dist/adapter/ingest/overlay-report.d.ts.map +1 -0
  34. package/dist/adapter/ingest/overlay-report.js +103 -0
  35. package/dist/adapter/ingest/scene-capture.d.ts +97 -0
  36. package/dist/adapter/ingest/scene-capture.d.ts.map +1 -0
  37. package/dist/adapter/ingest/scene-capture.js +248 -0
  38. package/dist/adapter/ingest/upstream-pin.d.ts +47 -0
  39. package/dist/adapter/ingest/upstream-pin.d.ts.map +1 -0
  40. package/dist/adapter/ingest/upstream-pin.js +50 -0
  41. package/dist/adapter/loop-gate-report.d.ts +34 -0
  42. package/dist/adapter/loop-gate-report.d.ts.map +1 -0
  43. package/dist/adapter/loop-gate-report.js +37 -0
  44. package/dist/adapter/rapier-physics-adapter.d.ts +12 -0
  45. package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -0
  46. package/dist/adapter/rapier-physics-adapter.js +46 -0
  47. package/dist/adapter/system-adapter.d.ts +133 -0
  48. package/dist/adapter/system-adapter.d.ts.map +1 -0
  49. package/dist/adapter/system-adapter.js +13 -0
  50. package/dist/adapter/transform.d.ts +18 -0
  51. package/dist/adapter/transform.d.ts.map +1 -0
  52. package/dist/adapter/transform.js +1 -0
  53. package/dist/adapter/vgai-scene-game-adapter.d.ts +116 -0
  54. package/dist/adapter/vgai-scene-game-adapter.d.ts.map +1 -0
  55. package/dist/adapter/vgai-scene-game-adapter.js +714 -0
  56. package/dist/adapter/world-kind.d.ts +30 -0
  57. package/dist/adapter/world-kind.d.ts.map +1 -0
  58. package/dist/adapter/world-kind.js +18 -0
  59. package/dist/ai/navigation.d.ts +64 -0
  60. package/dist/ai/navigation.d.ts.map +1 -0
  61. package/dist/ai/navigation.js +133 -0
  62. package/dist/animation/anim-graph-types.d.ts +25 -0
  63. package/dist/animation/anim-graph-types.d.ts.map +1 -0
  64. package/dist/animation/anim-graph-types.js +1 -0
  65. package/dist/animation/animation-clock.d.ts +213 -0
  66. package/dist/animation/animation-clock.d.ts.map +1 -0
  67. package/dist/animation/animation-clock.js +301 -0
  68. package/dist/animation/blend-node.d.ts +22 -0
  69. package/dist/animation/blend-node.d.ts.map +1 -0
  70. package/dist/animation/blend-node.js +97 -0
  71. package/dist/animation/camera-ownership.d.ts +250 -0
  72. package/dist/animation/camera-ownership.d.ts.map +1 -0
  73. package/dist/animation/camera-ownership.js +169 -0
  74. package/dist/animation/cinematic-cues.d.ts +200 -0
  75. package/dist/animation/cinematic-cues.d.ts.map +1 -0
  76. package/dist/animation/cinematic-cues.js +213 -0
  77. package/dist/animation/clip-map.d.ts +12 -0
  78. package/dist/animation/clip-map.d.ts.map +1 -0
  79. package/dist/animation/clip-map.js +37 -0
  80. package/dist/animation/gsap-registration.d.ts +119 -0
  81. package/dist/animation/gsap-registration.d.ts.map +1 -0
  82. package/dist/animation/gsap-registration.js +92 -0
  83. package/dist/animation/theatre-clock-binding.d.ts +89 -0
  84. package/dist/animation/theatre-clock-binding.d.ts.map +1 -0
  85. package/dist/animation/theatre-clock-binding.js +29 -0
  86. package/dist/animation/theatre-director.d.ts +242 -0
  87. package/dist/animation/theatre-director.d.ts.map +1 -0
  88. package/dist/animation/theatre-director.js +235 -0
  89. package/dist/animation/theatre-object-binding.d.ts +305 -0
  90. package/dist/animation/theatre-object-binding.d.ts.map +1 -0
  91. package/dist/animation/theatre-object-binding.js +351 -0
  92. package/dist/animation/xstate-animation-binding.d.ts +111 -0
  93. package/dist/animation/xstate-animation-binding.d.ts.map +1 -0
  94. package/dist/animation/xstate-animation-binding.js +307 -0
  95. package/dist/animation/xstate-animation-meta.d.ts +228 -0
  96. package/dist/animation/xstate-animation-meta.d.ts.map +1 -0
  97. package/dist/animation/xstate-animation-meta.js +221 -0
  98. package/dist/assets.d.ts +26 -0
  99. package/dist/assets.d.ts.map +1 -0
  100. package/dist/assets.js +55 -0
  101. package/dist/audio/index.d.ts +4 -0
  102. package/dist/audio/index.d.ts.map +1 -0
  103. package/dist/audio/index.js +24 -0
  104. package/dist/audio/tone-clock-binding.d.ts +75 -0
  105. package/dist/audio/tone-clock-binding.d.ts.map +1 -0
  106. package/dist/audio/tone-clock-binding.js +29 -0
  107. package/dist/audio/tone-context.d.ts +114 -0
  108. package/dist/audio/tone-context.d.ts.map +1 -0
  109. package/dist/audio/tone-context.js +39 -0
  110. package/dist/audio/tone-offline-render.d.ts +90 -0
  111. package/dist/audio/tone-offline-render.d.ts.map +1 -0
  112. package/dist/audio/tone-offline-render.js +56 -0
  113. package/dist/audio/wav-encode.d.ts +38 -0
  114. package/dist/audio/wav-encode.d.ts.map +1 -0
  115. package/dist/audio/wav-encode.js +97 -0
  116. package/dist/core/game-loop.d.ts +21 -0
  117. package/dist/core/game-loop.d.ts.map +1 -0
  118. package/dist/core/game-loop.js +130 -0
  119. package/dist/core/system-runner.d.ts +120 -0
  120. package/dist/core/system-runner.d.ts.map +1 -0
  121. package/dist/core/system-runner.js +286 -0
  122. package/dist/core/types.d.ts +58 -0
  123. package/dist/core/types.d.ts.map +1 -0
  124. package/dist/core/types.js +25 -0
  125. package/dist/data/data-asset.d.ts +101 -0
  126. package/dist/data/data-asset.d.ts.map +1 -0
  127. package/dist/data/data-asset.js +122 -0
  128. package/dist/data/data-check-core.d.ts +110 -0
  129. package/dist/data/data-check-core.d.ts.map +1 -0
  130. package/dist/data/data-check-core.js +178 -0
  131. package/dist/data/data-ref.d.ts +79 -0
  132. package/dist/data/data-ref.d.ts.map +1 -0
  133. package/dist/data/data-ref.js +130 -0
  134. package/dist/data/vite-plugin-data.d.ts +79 -0
  135. package/dist/data/vite-plugin-data.d.ts.map +1 -0
  136. package/dist/data/vite-plugin-data.js +217 -0
  137. package/dist/dev/console-bridge.d.ts +22 -0
  138. package/dist/dev/console-bridge.d.ts.map +1 -0
  139. package/dist/dev/console-bridge.js +71 -0
  140. package/dist/dev/debug-draw.d.ts +24 -0
  141. package/dist/dev/debug-draw.d.ts.map +1 -0
  142. package/dist/dev/debug-draw.js +73 -0
  143. package/dist/dev/logger.d.ts +30 -0
  144. package/dist/dev/logger.d.ts.map +1 -0
  145. package/dist/dev/logger.js +90 -0
  146. package/dist/ecs/component-manager.d.ts +189 -0
  147. package/dist/ecs/component-manager.d.ts.map +1 -0
  148. package/dist/ecs/component-manager.js +676 -0
  149. package/dist/ecs/game-component.d.ts +97 -0
  150. package/dist/ecs/game-component.d.ts.map +1 -0
  151. package/dist/ecs/game-component.js +80 -0
  152. package/dist/ecs/hmr-swap-report.d.ts +53 -0
  153. package/dist/ecs/hmr-swap-report.d.ts.map +1 -0
  154. package/dist/ecs/hmr-swap-report.js +55 -0
  155. package/dist/index.d.ts +37 -0
  156. package/dist/index.d.ts.map +1 -0
  157. package/dist/index.js +30 -0
  158. package/dist/input/input-manager.d.ts +596 -0
  159. package/dist/input/input-manager.d.ts.map +1 -0
  160. package/dist/input/input-manager.js +1564 -0
  161. package/dist/input/input-types.d.ts +171 -0
  162. package/dist/input/input-types.d.ts.map +1 -0
  163. package/dist/input/input-types.js +1 -0
  164. package/dist/input/prompt-labels.d.ts +21 -0
  165. package/dist/input/prompt-labels.d.ts.map +1 -0
  166. package/dist/input/prompt-labels.js +121 -0
  167. package/dist/input/rebind-controller.d.ts +59 -0
  168. package/dist/input/rebind-controller.d.ts.map +1 -0
  169. package/dist/input/rebind-controller.js +85 -0
  170. package/dist/input/schema.d.ts +16 -0
  171. package/dist/input/schema.d.ts.map +1 -0
  172. package/dist/input/schema.js +228 -0
  173. package/dist/loader.d.ts +43 -0
  174. package/dist/loader.d.ts.map +1 -0
  175. package/dist/loader.js +59 -0
  176. package/dist/manifest/index.d.ts +5 -0
  177. package/dist/manifest/index.d.ts.map +1 -0
  178. package/dist/manifest/index.js +8 -0
  179. package/dist/manifest/load-file.d.ts +4 -0
  180. package/dist/manifest/load-file.d.ts.map +1 -0
  181. package/dist/manifest/load-file.js +14 -0
  182. package/dist/manifest/load.d.ts +117 -0
  183. package/dist/manifest/load.d.ts.map +1 -0
  184. package/dist/manifest/load.js +255 -0
  185. package/dist/manifest/schema.d.ts +173 -0
  186. package/dist/manifest/schema.d.ts.map +1 -0
  187. package/dist/manifest/schema.js +302 -0
  188. package/dist/physics/collision-system.d.ts +41 -0
  189. package/dist/physics/collision-system.d.ts.map +1 -0
  190. package/dist/physics/collision-system.js +64 -0
  191. package/dist/physics/physics-registry.d.ts +45 -0
  192. package/dist/physics/physics-registry.d.ts.map +1 -0
  193. package/dist/physics/physics-registry.js +65 -0
  194. package/dist/physics/transform-writer.d.ts +16 -0
  195. package/dist/physics/transform-writer.d.ts.map +1 -0
  196. package/dist/physics/transform-writer.js +38 -0
  197. package/dist/physics/trigger-dispatch.d.ts +24 -0
  198. package/dist/physics/trigger-dispatch.d.ts.map +1 -0
  199. package/dist/physics/trigger-dispatch.js +80 -0
  200. package/dist/react/game-state.d.ts +105 -0
  201. package/dist/react/game-state.d.ts.map +1 -0
  202. package/dist/react/game-state.js +144 -0
  203. package/dist/react/use-data.d.ts +60 -0
  204. package/dist/react/use-data.d.ts.map +1 -0
  205. package/dist/react/use-data.js +96 -0
  206. package/dist/react/use-selection.d.ts +75 -0
  207. package/dist/react/use-selection.d.ts.map +1 -0
  208. package/dist/react/use-selection.js +90 -0
  209. package/dist/render/auto-batcher.d.ts +34 -0
  210. package/dist/render/auto-batcher.d.ts.map +1 -0
  211. package/dist/render/auto-batcher.js +140 -0
  212. package/dist/render/render-batch-system.d.ts +33 -0
  213. package/dist/render/render-batch-system.d.ts.map +1 -0
  214. package/dist/render/render-batch-system.js +230 -0
  215. package/dist/render/render-features.d.ts +47 -0
  216. package/dist/render/render-features.d.ts.map +1 -0
  217. package/dist/render/render-features.js +105 -0
  218. package/dist/render/render-settings.d.ts +36 -0
  219. package/dist/render/render-settings.d.ts.map +1 -0
  220. package/dist/render/render-settings.js +51 -0
  221. package/dist/runtime/create-runtime.d.ts +280 -0
  222. package/dist/runtime/create-runtime.d.ts.map +1 -0
  223. package/dist/runtime/create-runtime.js +795 -0
  224. package/dist/runtime/frame-selector-cache.d.ts +41 -0
  225. package/dist/runtime/frame-selector-cache.d.ts.map +1 -0
  226. package/dist/runtime/frame-selector-cache.js +65 -0
  227. package/dist/runtime/game.d.ts +433 -0
  228. package/dist/runtime/game.d.ts.map +1 -0
  229. package/dist/runtime/game.js +569 -0
  230. package/dist/runtime/input-router.d.ts +78 -0
  231. package/dist/runtime/input-router.d.ts.map +1 -0
  232. package/dist/runtime/input-router.js +171 -0
  233. package/dist/runtime/mount-game.d.ts +129 -0
  234. package/dist/runtime/mount-game.d.ts.map +1 -0
  235. package/dist/runtime/mount-game.js +152 -0
  236. package/dist/runtime/mount-manifest.d.ts +119 -0
  237. package/dist/runtime/mount-manifest.d.ts.map +1 -0
  238. package/dist/runtime/mount-manifest.js +204 -0
  239. package/dist/runtime/render-audio-control.d.ts +110 -0
  240. package/dist/runtime/render-audio-control.d.ts.map +1 -0
  241. package/dist/runtime/render-audio-control.js +111 -0
  242. package/dist/runtime/render-control.d.ts +291 -0
  243. package/dist/runtime/render-control.d.ts.map +1 -0
  244. package/dist/runtime/render-control.js +264 -0
  245. package/dist/runtime/render-seed.d.ts +57 -0
  246. package/dist/runtime/render-seed.d.ts.map +1 -0
  247. package/dist/runtime/render-seed.js +74 -0
  248. package/dist/runtime/scene-ui-bridge.d.ts +69 -0
  249. package/dist/runtime/scene-ui-bridge.d.ts.map +1 -0
  250. package/dist/runtime/scene-ui-bridge.js +23 -0
  251. package/dist/runtime/scene-ui-data.d.ts +13 -0
  252. package/dist/runtime/scene-ui-data.d.ts.map +1 -0
  253. package/dist/runtime/scene-ui-data.js +92 -0
  254. package/dist/runtime/state-bridge.d.ts +47 -0
  255. package/dist/runtime/state-bridge.d.ts.map +1 -0
  256. package/dist/runtime/state-bridge.js +53 -0
  257. package/dist/runtime/types.d.ts +179 -0
  258. package/dist/runtime/types.d.ts.map +1 -0
  259. package/dist/runtime/types.js +1 -0
  260. package/dist/scene/asset-loaders.d.ts +79 -0
  261. package/dist/scene/asset-loaders.d.ts.map +1 -0
  262. package/dist/scene/asset-loaders.js +141 -0
  263. package/dist/scene/asset-paths.d.ts +11 -0
  264. package/dist/scene/asset-paths.d.ts.map +1 -0
  265. package/dist/scene/asset-paths.js +108 -0
  266. package/dist/scene/asset-ref-check.d.ts +88 -0
  267. package/dist/scene/asset-ref-check.d.ts.map +1 -0
  268. package/dist/scene/asset-ref-check.js +214 -0
  269. package/dist/scene/asset-registry.d.ts +30 -0
  270. package/dist/scene/asset-registry.d.ts.map +1 -0
  271. package/dist/scene/asset-registry.js +50 -0
  272. package/dist/scene/collider-dimensions.d.ts +63 -0
  273. package/dist/scene/collider-dimensions.d.ts.map +1 -0
  274. package/dist/scene/collider-dimensions.js +98 -0
  275. package/dist/scene/component-registry.d.ts +17 -0
  276. package/dist/scene/component-registry.d.ts.map +1 -0
  277. package/dist/scene/component-registry.js +28 -0
  278. package/dist/scene/defaults.d.ts +252 -0
  279. package/dist/scene/defaults.d.ts.map +1 -0
  280. package/dist/scene/defaults.js +151 -0
  281. package/dist/scene/geometries/index.d.ts +8 -0
  282. package/dist/scene/geometries/index.d.ts.map +1 -0
  283. package/dist/scene/geometries/index.js +7 -0
  284. package/dist/scene/geometries/terrain.d.ts +2 -0
  285. package/dist/scene/geometries/terrain.d.ts.map +1 -0
  286. package/dist/scene/geometries/terrain.js +37 -0
  287. package/dist/scene/geometry-registry.d.ts +24 -0
  288. package/dist/scene/geometry-registry.d.ts.map +1 -0
  289. package/dist/scene/geometry-registry.js +20 -0
  290. package/dist/scene/instance-registry.d.ts +36 -0
  291. package/dist/scene/instance-registry.d.ts.map +1 -0
  292. package/dist/scene/instance-registry.js +55 -0
  293. package/dist/scene/instancers/grid.d.ts +2 -0
  294. package/dist/scene/instancers/grid.d.ts.map +1 -0
  295. package/dist/scene/instancers/grid.js +36 -0
  296. package/dist/scene/instancers/index.d.ts +8 -0
  297. package/dist/scene/instancers/index.d.ts.map +1 -0
  298. package/dist/scene/instancers/index.js +7 -0
  299. package/dist/scene/light-camera-factory.d.ts +23 -0
  300. package/dist/scene/light-camera-factory.d.ts.map +1 -0
  301. package/dist/scene/light-camera-factory.js +68 -0
  302. package/dist/scene/material-factory.d.ts +17 -0
  303. package/dist/scene/material-factory.d.ts.map +1 -0
  304. package/dist/scene/material-factory.js +197 -0
  305. package/dist/scene/material-registry.d.ts +40 -0
  306. package/dist/scene/material-registry.d.ts.map +1 -0
  307. package/dist/scene/material-registry.js +44 -0
  308. package/dist/scene/materials/index.d.ts +8 -0
  309. package/dist/scene/materials/index.d.ts.map +1 -0
  310. package/dist/scene/materials/index.js +7 -0
  311. package/dist/scene/materials/water.d.ts +2 -0
  312. package/dist/scene/materials/water.d.ts.map +1 -0
  313. package/dist/scene/materials/water.js +54 -0
  314. package/dist/scene/parse.d.ts +23 -0
  315. package/dist/scene/parse.d.ts.map +1 -0
  316. package/dist/scene/parse.js +179 -0
  317. package/dist/scene/particles-factory.d.ts +33 -0
  318. package/dist/scene/particles-factory.d.ts.map +1 -0
  319. package/dist/scene/particles-factory.js +282 -0
  320. package/dist/scene/scene-apply.d.ts +109 -0
  321. package/dist/scene/scene-apply.d.ts.map +1 -0
  322. package/dist/scene/scene-apply.js +326 -0
  323. package/dist/scene/scene-diff-schema.d.ts +285 -0
  324. package/dist/scene/scene-diff-schema.d.ts.map +1 -0
  325. package/dist/scene/scene-diff-schema.js +92 -0
  326. package/dist/scene/scene-diff-types.d.ts +40 -0
  327. package/dist/scene/scene-diff-types.d.ts.map +1 -0
  328. package/dist/scene/scene-diff-types.js +14 -0
  329. package/dist/scene/scene-loader.d.ts +177 -0
  330. package/dist/scene/scene-loader.d.ts.map +1 -0
  331. package/dist/scene/scene-loader.js +1213 -0
  332. package/dist/scene/scene-query.d.ts +11 -0
  333. package/dist/scene/scene-query.d.ts.map +1 -0
  334. package/dist/scene/scene-query.js +63 -0
  335. package/dist/scene/scene-types.d.ts +10 -0
  336. package/dist/scene/scene-types.d.ts.map +1 -0
  337. package/dist/scene/scene-types.js +8 -0
  338. package/dist/scene/scene-version.d.ts +26 -0
  339. package/dist/scene/scene-version.d.ts.map +1 -0
  340. package/dist/scene/scene-version.js +34 -0
  341. package/dist/scene/schema/animation.d.ts +8 -0
  342. package/dist/scene/schema/animation.d.ts.map +1 -0
  343. package/dist/scene/schema/animation.js +42 -0
  344. package/dist/scene/schema/audio.d.ts +13 -0
  345. package/dist/scene/schema/audio.d.ts.map +1 -0
  346. package/dist/scene/schema/audio.js +22 -0
  347. package/dist/scene/schema/camera.d.ts +28 -0
  348. package/dist/scene/schema/camera.d.ts.map +1 -0
  349. package/dist/scene/schema/camera.js +17 -0
  350. package/dist/scene/schema/collider.d.ts +40 -0
  351. package/dist/scene/schema/collider.d.ts.map +1 -0
  352. package/dist/scene/schema/collider.js +55 -0
  353. package/dist/scene/schema/entity-ref.d.ts +31 -0
  354. package/dist/scene/schema/entity-ref.d.ts.map +1 -0
  355. package/dist/scene/schema/entity-ref.js +61 -0
  356. package/dist/scene/schema/entity.d.ts +1036 -0
  357. package/dist/scene/schema/entity.d.ts.map +1 -0
  358. package/dist/scene/schema/entity.js +153 -0
  359. package/dist/scene/schema/environment.d.ts +425 -0
  360. package/dist/scene/schema/environment.d.ts.map +1 -0
  361. package/dist/scene/schema/environment.js +357 -0
  362. package/dist/scene/schema/index.d.ts +39 -0
  363. package/dist/scene/schema/index.d.ts.map +1 -0
  364. package/dist/scene/schema/index.js +20 -0
  365. package/dist/scene/schema/instances.d.ts +14 -0
  366. package/dist/scene/schema/instances.d.ts.map +1 -0
  367. package/dist/scene/schema/instances.js +28 -0
  368. package/dist/scene/schema/joint.d.ts +23 -0
  369. package/dist/scene/schema/joint.d.ts.map +1 -0
  370. package/dist/scene/schema/joint.js +23 -0
  371. package/dist/scene/schema/light.d.ts +38 -0
  372. package/dist/scene/schema/light.d.ts.map +1 -0
  373. package/dist/scene/schema/light.js +26 -0
  374. package/dist/scene/schema/material.d.ts +199 -0
  375. package/dist/scene/schema/material.d.ts.map +1 -0
  376. package/dist/scene/schema/material.js +99 -0
  377. package/dist/scene/schema/mesh.d.ts +48 -0
  378. package/dist/scene/schema/mesh.d.ts.map +1 -0
  379. package/dist/scene/schema/mesh.js +82 -0
  380. package/dist/scene/schema/particles.d.ts +2178 -0
  381. package/dist/scene/schema/particles.d.ts.map +1 -0
  382. package/dist/scene/schema/particles.js +321 -0
  383. package/dist/scene/schema/physics.d.ts +56 -0
  384. package/dist/scene/schema/physics.d.ts.map +1 -0
  385. package/dist/scene/schema/physics.js +37 -0
  386. package/dist/scene/schema/scene-file.d.ts +304 -0
  387. package/dist/scene/schema/scene-file.d.ts.map +1 -0
  388. package/dist/scene/schema/scene-file.js +262 -0
  389. package/dist/scene/schema/shadow.d.ts +28 -0
  390. package/dist/scene/schema/shadow.d.ts.map +1 -0
  391. package/dist/scene/schema/shadow.js +20 -0
  392. package/dist/scene/schema/spline.d.ts +25 -0
  393. package/dist/scene/schema/spline.d.ts.map +1 -0
  394. package/dist/scene/schema/spline.js +15 -0
  395. package/dist/scene/schema/tuples.d.ts +12 -0
  396. package/dist/scene/schema/tuples.d.ts.map +1 -0
  397. package/dist/scene/schema/tuples.js +14 -0
  398. package/dist/scene/schema/ui.d.ts +880 -0
  399. package/dist/scene/schema/ui.d.ts.map +1 -0
  400. package/dist/scene/schema/ui.js +506 -0
  401. package/dist/scene/user-data.d.ts +171 -0
  402. package/dist/scene/user-data.d.ts.map +1 -0
  403. package/dist/scene/user-data.js +137 -0
  404. package/dist/setup/setup-audio.d.ts +20 -0
  405. package/dist/setup/setup-audio.d.ts.map +1 -0
  406. package/dist/setup/setup-audio.js +41 -0
  407. package/dist/setup/setup-particles.d.ts +17 -0
  408. package/dist/setup/setup-particles.d.ts.map +1 -0
  409. package/dist/setup/setup-particles.js +16 -0
  410. package/dist/setup/setup-physics.d.ts +25 -0
  411. package/dist/setup/setup-physics.d.ts.map +1 -0
  412. package/dist/setup/setup-physics.js +51 -0
  413. package/dist/setup/setup-renderer.d.ts +69 -0
  414. package/dist/setup/setup-renderer.d.ts.map +1 -0
  415. package/dist/setup/setup-renderer.js +363 -0
  416. package/dist/tools/define-tool.d.ts +105 -0
  417. package/dist/tools/define-tool.d.ts.map +1 -0
  418. package/dist/tools/define-tool.js +82 -0
  419. package/dist/world2d/authoring-2d.d.ts +76 -0
  420. package/dist/world2d/authoring-2d.d.ts.map +1 -0
  421. package/dist/world2d/authoring-2d.js +176 -0
  422. package/dist/world2d/capture-to-scene2d.d.ts +5 -0
  423. package/dist/world2d/capture-to-scene2d.d.ts.map +1 -0
  424. package/dist/world2d/capture-to-scene2d.js +49 -0
  425. package/dist/world2d/collision-2d.d.ts +52 -0
  426. package/dist/world2d/collision-2d.d.ts.map +1 -0
  427. package/dist/world2d/collision-2d.js +70 -0
  428. package/dist/world2d/components-2d.d.ts +47 -0
  429. package/dist/world2d/components-2d.d.ts.map +1 -0
  430. package/dist/world2d/components-2d.js +77 -0
  431. package/dist/world2d/index.d.ts +34 -0
  432. package/dist/world2d/index.d.ts.map +1 -0
  433. package/dist/world2d/index.js +32 -0
  434. package/dist/world2d/ingest-iframe-2d.d.ts +82 -0
  435. package/dist/world2d/ingest-iframe-2d.d.ts.map +1 -0
  436. package/dist/world2d/ingest-iframe-2d.js +166 -0
  437. package/dist/world2d/ingest2d.d.ts +97 -0
  438. package/dist/world2d/ingest2d.d.ts.map +1 -0
  439. package/dist/world2d/ingest2d.js +40 -0
  440. package/dist/world2d/physics2d-registry.d.ts +24 -0
  441. package/dist/world2d/physics2d-registry.d.ts.map +1 -0
  442. package/dist/world2d/physics2d-registry.js +38 -0
  443. package/dist/world2d/pixi-game-adapter.d.ts +107 -0
  444. package/dist/world2d/pixi-game-adapter.d.ts.map +1 -0
  445. package/dist/world2d/pixi-game-adapter.js +211 -0
  446. package/dist/world2d/pixi-surface.d.ts +39 -0
  447. package/dist/world2d/pixi-surface.d.ts.map +1 -0
  448. package/dist/world2d/pixi-surface.js +47 -0
  449. package/dist/world2d/scene-capture-2d.d.ts +43 -0
  450. package/dist/world2d/scene-capture-2d.d.ts.map +1 -0
  451. package/dist/world2d/scene-capture-2d.js +92 -0
  452. package/dist/world2d/scene2d-loader.d.ts +27 -0
  453. package/dist/world2d/scene2d-loader.d.ts.map +1 -0
  454. package/dist/world2d/scene2d-loader.js +274 -0
  455. package/dist/world2d/schema/entity2d.d.ts +102 -0
  456. package/dist/world2d/schema/entity2d.d.ts.map +1 -0
  457. package/dist/world2d/schema/entity2d.js +119 -0
  458. package/dist/world2d/schema/physics2d.d.ts +46 -0
  459. package/dist/world2d/schema/physics2d.d.ts.map +1 -0
  460. package/dist/world2d/schema/physics2d.js +45 -0
  461. package/dist/world2d/schema/sprite.d.ts +42 -0
  462. package/dist/world2d/schema/sprite.d.ts.map +1 -0
  463. package/dist/world2d/schema/sprite.js +63 -0
  464. package/dist/world2d/schema/tilemap.d.ts +15 -0
  465. package/dist/world2d/schema/tilemap.d.ts.map +1 -0
  466. package/dist/world2d/schema/tilemap.js +19 -0
  467. package/dist/world2d/schema/tuples2d.d.ts +20 -0
  468. package/dist/world2d/schema/tuples2d.d.ts.map +1 -0
  469. package/dist/world2d/schema/tuples2d.js +19 -0
  470. package/dist/world2d/system-adapters-2d.d.ts +16 -0
  471. package/dist/world2d/system-adapters-2d.d.ts.map +1 -0
  472. package/dist/world2d/system-adapters-2d.js +37 -0
  473. package/dist/world2d/transform-writer-2d.d.ts +16 -0
  474. package/dist/world2d/transform-writer-2d.d.ts.map +1 -0
  475. package/dist/world2d/transform-writer-2d.js +22 -0
  476. package/dist/world2d/types.d.ts +53 -0
  477. package/dist/world2d/types.d.ts.map +1 -0
  478. package/dist/world2d/types.js +1 -0
  479. package/package.json +18 -4
  480. package/src/adapter/authoring.ts +10 -0
  481. package/src/adapter/first-party-systems.ts +23 -34
  482. package/src/adapter/index.ts +1 -3
  483. package/src/adapter/system-adapter.ts +15 -22
  484. package/src/adapter/vgai-scene-game-adapter.ts +5 -14
  485. package/src/animation/anim-graph-types.ts +12 -43
  486. package/src/animation/animation-clock.ts +479 -0
  487. package/src/animation/camera-ownership.ts +467 -0
  488. package/src/animation/cinematic-cues.ts +451 -0
  489. package/src/animation/clip-map.ts +41 -0
  490. package/src/animation/gsap-registration.ts +184 -0
  491. package/src/animation/theatre-clock-binding.ts +111 -0
  492. package/src/animation/theatre-director.ts +347 -0
  493. package/src/animation/theatre-object-binding.ts +661 -0
  494. package/src/animation/xstate-animation-binding.ts +398 -0
  495. package/src/animation/xstate-animation-meta.ts +282 -0
  496. package/src/audio/index.ts +39 -7
  497. package/src/audio/tone-clock-binding.ts +98 -0
  498. package/src/audio/tone-context.ts +129 -0
  499. package/src/audio/tone-offline-render.ts +167 -0
  500. package/src/audio/wav-encode.ts +119 -0
  501. package/src/core/game-loop.ts +17 -0
  502. package/src/core/types.ts +13 -0
  503. package/src/data/data-asset.ts +167 -0
  504. package/src/data/data-check-core.ts +242 -0
  505. package/src/data/data-ref.ts +145 -0
  506. package/src/data/vite-plugin-data.ts +290 -0
  507. package/src/index.ts +48 -0
  508. package/src/input/input-manager.ts +1206 -32
  509. package/src/input/input-types.ts +155 -3
  510. package/src/input/prompt-labels.ts +122 -0
  511. package/src/input/rebind-controller.ts +105 -0
  512. package/src/input/schema.ts +206 -52
  513. package/src/react/use-data.ts +114 -0
  514. package/src/react/use-selection.tsx +135 -0
  515. package/src/runtime/create-runtime.ts +30 -9
  516. package/src/runtime/render-audio-control.ts +168 -0
  517. package/src/runtime/render-control.ts +522 -0
  518. package/src/runtime/render-seed.ts +79 -0
  519. package/src/runtime/types.ts +0 -5
  520. package/src/scene/asset-loaders.ts +10 -36
  521. package/src/scene/asset-paths.ts +0 -2
  522. package/src/scene/asset-ref-check.ts +248 -0
  523. package/src/scene/parse.ts +133 -0
  524. package/src/scene/scene-loader.ts +81 -96
  525. package/src/scene/schema/animation.ts +30 -79
  526. package/src/scene/schema/entity.ts +20 -0
  527. package/src/scene/schema/index.ts +2 -12
  528. package/src/scene/user-data.ts +8 -9
  529. package/src/setup/setup-renderer.ts +9 -2
  530. package/src/tools/define-tool.ts +152 -0
  531. package/src/animation/anim-graph.ts +0 -406
  532. package/src/animation/anim-system.ts +0 -28
  533. package/src/animation/property-track.ts +0 -178
  534. package/src/animation/schema.ts +0 -204
  535. package/src/audio/ambient.ts +0 -300
  536. package/src/audio/impacts.ts +0 -212
  537. package/src/audio/movement.ts +0 -140
  538. package/src/audio/musical.ts +0 -200
  539. package/src/audio/ui-sounds.ts +0 -171
  540. package/src/audio/vehicle.ts +0 -235
  541. package/src/audio/weapons.ts +0 -152
@@ -0,0 +1,77 @@
1
+ /**
2
+ * First-party implementations of the remaining `SystemAdapters` — input, assets,
3
+ * navigation — each a thin coordination/introspection boundary over the real
4
+ * engine subsystem (the original vision named these as first-class System
5
+ * adapters; physics + networking shipped earlier). The editor speaks only the
6
+ * interfaces; these wrap `InputManager`, the asset loader, and `NavMeshManager`
7
+ * so an external game could supply its own equivalents. (The former
8
+ * `AnimationAdapter`/`createAnimationAdapter` over the `AnimGraph` map was
9
+ * removed by E5 — AnimGraph no longer exists; see
10
+ * docs/AI-NATIVE-AUTHORING-IMPLEMENTATION-SPEC.md §3.3/§11 E5.)
11
+ */
12
+ import { resolveUrl } from '../loader';
13
+ /** First-party `InputAdapter` over the engine `InputManager`. Reads each action through
14
+ * `InputManager.readAction`, dispatched on that action's OWN declared `valueType`
15
+ * (`getActionValueType`) — never a hardcoded getter — so a scalar/Vector2/pointer action
16
+ * surfaces its real typed value instead of being coerced through `isPressed` (F1-followup;
17
+ * `readAction` on the wrong type would throw, so dispatch must follow the declared type). */
18
+ export function createInputManagerAdapter(input) {
19
+ return {
20
+ poll: () => input.poll(),
21
+ actions: () => {
22
+ const out = {};
23
+ for (const name of input.actionNames()) {
24
+ const type = input.getActionValueType(name);
25
+ // `readAction`'s return type is inferred from a literal `expectedType`; with `type`
26
+ // widened to `ActionValueType` here it collapses to `boolean | number | Vector2`, so
27
+ // digital's `boolean` is normalized to the adapter's 1/0 the same way the old digital-
28
+ // only adapter did — every other value type already reads as `number | Vector2`.
29
+ const raw = input.readAction(name, type);
30
+ out[name] = { type, value: typeof raw === 'boolean' ? (raw ? 1 : 0) : raw };
31
+ }
32
+ return out;
33
+ },
34
+ };
35
+ }
36
+ /** First-party `AssetAdapter` — resolves URLs through the engine loader (which
37
+ * applies the project base + downloaded-asset remap). External/ingest games can
38
+ * supply their own to redirect relative paths. */
39
+ export function createVgaiAssetAdapter() {
40
+ return { resolve: (url) => resolveUrl(url) };
41
+ }
42
+ /**
43
+ * First-party `AudioAdapter` over the engine's master-gain bus
44
+ * (`setup-audio.ts`'s `AudioContext.masterGain`) — the seam `Game.play.pause()`
45
+ * (D10, T7.6) calls to silence a first-party world's audio. Restoring after a
46
+ * mute puts the gain back at whatever value it held right before muting (not
47
+ * a hardcoded `1`) — this composes correctly with an independent manual mute
48
+ * (the editor's `MuteButton`, `PlayBar.tsx`): pausing while already
49
+ * user-muted resumes muted, exactly as a user would expect.
50
+ */
51
+ export function createAudioSystemAdapter(audio) {
52
+ let muted = false;
53
+ let priorGain = audio.masterGain.gain.value;
54
+ return {
55
+ setMuted(next) {
56
+ if (next === muted)
57
+ return;
58
+ muted = next;
59
+ if (next) {
60
+ priorGain = audio.masterGain.gain.value;
61
+ audio.masterGain.gain.value = 0;
62
+ }
63
+ else {
64
+ audio.masterGain.gain.value = priorGain;
65
+ }
66
+ },
67
+ isMuted: () => muted,
68
+ };
69
+ }
70
+ /** First-party `NavigationAdapter` over the engine `NavMeshManager`. */
71
+ export function createNavigationAdapter(nav) {
72
+ return {
73
+ hasNavMesh: () => nav.hasNavMesh(),
74
+ findPath: (start, end) => nav.findPath(start, end),
75
+ debugMesh: (scene) => nav.getDebugMesh(scene),
76
+ };
77
+ }
@@ -0,0 +1,133 @@
1
+ /**
2
+ * GameAdapter — the host ⇄ runtime contract. A "game" is *anything that mounts*.
3
+ *
4
+ * This is the interface the HOST depends on. It replaces the old
5
+ * `{ setup, components }` shape: the host no longer knows about `GameSetupFn`,
6
+ * `.vscn`, or `GameComponent` — those are the internals of ONE implementer
7
+ * (`VgaiSceneGameAdapter`). First-party content and an unmodified external game
8
+ * are peer implementers of THIS interface; the host has no branch on which.
9
+ */
10
+ import type { Container } from 'pixi.js';
11
+ import type * as THREE from 'three';
12
+ import type { AuthoringAdapter } from './authoring';
13
+ import type { HostContext } from './host-context';
14
+ import type { SystemAdapters } from './system-adapter';
15
+ import type { WorldKind } from './world-kind';
16
+ /**
17
+ * The ingested-world observation contract (T7.4 slice 2 — `docs/
18
+ * REACT-STATE-BRIDGE.md` §4, "the must-answer"). Cross-world data flow with a
19
+ * foreign game is observation via an adapter-provided interface, not ordinary
20
+ * component access (that's D7's answer for first-party↔first-party flow —
21
+ * foreign games host no `GameComponent`s). Optional on {@link MountedGame} —
22
+ * absence means the adapter has nothing genuinely observable to expose (the
23
+ * anti-shim rule: never fabricate state), and the world takes the honest
24
+ * "no state bridge" tier hit (see `Game.registerWorld` in `runtime/game.ts`)
25
+ * rather than silently offering an `undefined`-forever subscription.
26
+ */
27
+ export interface WorldStateObserver {
28
+ /**
29
+ * Notified at most once per frame IF the adapter can hook the game's own
30
+ * update (`loop: 'gated'` worlds, `docs/CAPABILITY-TIERS.md` §(d));
31
+ * self-driven worlds (`loop: 'self-driven'`, raw-rAF) may notify on their
32
+ * OWN rAF cadence instead — consumers must not assume our frame timing.
33
+ * Returns an unsubscribe function.
34
+ */
35
+ subscribe(onChange: () => void): () => void;
36
+ /**
37
+ * A cheap, adapter-chosen snapshot of this world's observable state.
38
+ * Returns a STABLE reference while nothing has changed (so a selector run
39
+ * over it can cheaply bail out by reference, same spirit as
40
+ * `GameStateBridge`'s frame-version cache). Shape is adapter-defined —
41
+ * not centrally schematized in v1 (see `docs/REACT-STATE-BRIDGE.md` §6).
42
+ */
43
+ snapshot(): unknown;
44
+ }
45
+ /**
46
+ * Everything a mounted world provides EXCEPT its render surface (T7.5,
47
+ * `docs/BACKBONE-TASKS.md`'s D6 row — "replace THREE.Scene/THREE.Camera
48
+ * typing with kind-tagged world surfaces"). Split out of the old flat
49
+ * `MountedGame` so a non-threejs world can carry its own kind-appropriate
50
+ * surface field (a pixi `stage`, a react `container`) instead of being
51
+ * force-fit through THREE `scene`/`camera` fields it doesn't have.
52
+ */
53
+ export interface MountedWorldBase {
54
+ /**
55
+ * Loop model:
56
+ * - `false` (host-driven): first-party + "clean" externals. The host ticks
57
+ * `update(dt)` in its loop.
58
+ * - `true` (self-driven): an unmodified game that owns its renderer + rAF.
59
+ * The host does NOT tick it. Pause/step control is a DECLARED CAPABILITY,
60
+ * not a promise: implement `setPaused`/`step` only where the game exposes
61
+ * a sanctioned pause/step mechanism. Gating a raw-rAF loop from outside
62
+ * was demonstrated and REJECTED (D5, docs/COMPOSITION-DESIGN.md §5.2 —
63
+ * it halts the loop rather than pausing it); such games are the
64
+ * "composited, unsynchronized" tier: `setPaused` absent, host degrades
65
+ * loudly (T7.6 owns the tier surface).
66
+ */
67
+ readonly drivesOwnLoop: boolean;
68
+ update?(dt: number): void;
69
+ fixedUpdate?(dt: number): void;
70
+ setPaused?(paused: boolean): void;
71
+ step?(): void;
72
+ resize?(width: number, height: number): void;
73
+ dispose(): void;
74
+ /** Optional capability providers — absence = "not supported", host degrades. */
75
+ readonly authoring?: AuthoringAdapter;
76
+ readonly systems?: SystemAdapters;
77
+ /** Optional state-observation capability (T7.4 slice 2, §4) — absent means
78
+ * "no state bridge"; `Game.registerWorld` reports this loudly, once, for
79
+ * any non-first-party mount. First-party mounts are exempt — their state
80
+ * is observed through `Game.state`/`useGameState` instead (§3), not this
81
+ * field. */
82
+ readonly observe?: WorldStateObserver;
83
+ }
84
+ /** A live, mounted threejs world. The host obtains `scene`/`camera` to
85
+ * render+author. This is what `MountedGame` (the permanent alias every
86
+ * pre-T7.5 threejs-world call site still names) now means. */
87
+ export interface MountedThreeWorld extends MountedWorldBase {
88
+ readonly kind: 'threejs';
89
+ /** The live scene + camera the editor inspects/renders for authoring. */
90
+ readonly scene: THREE.Scene;
91
+ readonly camera: THREE.Camera;
92
+ }
93
+ /** A live, mounted pixijs world (T7.3) — the pixi analog of
94
+ * {@link MountedThreeWorld}. `stage` is the pixi world container the host
95
+ * renders/authors, the surface `WorldInstance.pixiRoot()` returns. */
96
+ export interface MountedPixiWorld extends MountedWorldBase {
97
+ readonly kind: 'pixijs';
98
+ readonly stage: Container;
99
+ }
100
+ /** A live, mounted react world (T6.2) — the react analog of
101
+ * {@link MountedThreeWorld}. `container` is the DOM-root layer the host
102
+ * handed the adapter's `mount` (the SAME element `WorldInstance.reactRoot()`
103
+ * returns) — a react world's tree renders into it via `createRoot`. */
104
+ export interface MountedReactWorld extends MountedWorldBase {
105
+ readonly kind: 'react';
106
+ readonly container: HTMLElement;
107
+ }
108
+ /** Every kind of live, mounted world (T7.5) — the union `WorldInstance.mounted`
109
+ * is typed against now, replacing the THREE-only `MountedGame`. */
110
+ export type MountedWorld = MountedThreeWorld | MountedPixiWorld | MountedReactWorld;
111
+ /** Map a {@link WorldKind} to its mounted-world shape (mirrors `NodeOf`/
112
+ * `BodyOf`/`ColliderOf` in `ecs/game-component.ts`) — lets generic code over
113
+ * `K extends WorldKind` name the right surface without a manual union. */
114
+ export type MountedWorldFor<K extends WorldKind> = K extends 'threejs' ? MountedThreeWorld : K extends 'pixijs' ? MountedPixiWorld : K extends 'react' ? MountedReactWorld : never;
115
+ /**
116
+ * Permanent alias (T7.1 precedent — old names stay valid forever once a
117
+ * generalization lands): `MountedGame` now means "a mounted THREEJS world."
118
+ * Every pre-T7.5 threejs-only call site (`VgaiMountedGame extends MountedGame`,
119
+ * `registerThreeWorld`, ingest adapters, …) keeps compiling unchanged.
120
+ */
121
+ export type MountedGame = MountedThreeWorld;
122
+ /** The interface every game implements to run on the host. Generic over
123
+ * {@link WorldKind} (T7.5) so a non-threejs implementer's `mount` returns its
124
+ * OWN kind-tagged surface instead of being cast through the threejs shape —
125
+ * defaults to `'threejs'` so every pre-T7.5 implementer/call site
126
+ * (`GameAdapter`, unparameterized) keeps compiling unchanged. */
127
+ export interface GameAdapter<K extends WorldKind = 'threejs'> {
128
+ /** Stable id (telemetry/registry/conformance). */
129
+ readonly id: string;
130
+ /** Build/start the game against a host-provided context; return the handle. */
131
+ mount(host: HostContext): Promise<MountedWorldFor<K>>;
132
+ }
133
+ //# sourceMappingURL=game-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"game-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/game-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IAC5C;;;;;;OAMG;IACH,QAAQ,IAAI,OAAO,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAEhC,MAAM,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IAClC,IAAI,CAAC,IAAI,IAAI,CAAC;IAEd,MAAM,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,OAAO,IAAI,IAAI,CAAC;IAEhB,gFAAgF;IAChF,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC;IAClC;;;;iBAIa;IACb,QAAQ,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC;CACvC;AAED;;+DAE+D;AAC/D,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,yEAAyE;IACzE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;CAC/B;AAED;;uEAEuE;AACvE,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;CAC3B;AAED;;;wEAGwE;AACxE,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;CACjC;AAED;oEACoE;AACpE,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAEpF;;2EAE2E;AAC3E,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,SAAS,IAAI,CAAC,SAAS,SAAS,GAClE,iBAAiB,GACjB,CAAC,SAAS,QAAQ,GAChB,gBAAgB,GAChB,CAAC,SAAS,OAAO,GACf,iBAAiB,GACjB,KAAK,CAAC;AAEd;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAE5C;;;;kEAIkE;AAClE,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS;IAC1D,kDAAkD;IAClD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,KAAK,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;CACvD"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * GameAdapter — the host ⇄ runtime contract. A "game" is *anything that mounts*.
3
+ *
4
+ * This is the interface the HOST depends on. It replaces the old
5
+ * `{ setup, components }` shape: the host no longer knows about `GameSetupFn`,
6
+ * `.vscn`, or `GameComponent` — those are the internals of ONE implementer
7
+ * (`VgaiSceneGameAdapter`). First-party content and an unmodified external game
8
+ * are peer implementers of THIS interface; the host has no branch on which.
9
+ */
10
+ export {};
@@ -0,0 +1,73 @@
1
+ /**
2
+ * HostContext — the NEUTRAL primitives the host hands a game when mounting it.
3
+ *
4
+ * This generalizes the old `GameContext`, which baked in first-party system
5
+ * choices (a Rapier world, the postprocessing composer, the InputManager, …).
6
+ * `HostContext` provides only what ANY game needs — the shared three instance, a
7
+ * surface, a renderer, a loop, assets, a UI overlay — and lets a game *ask* for
8
+ * a first-party subsystem via `requestSystem`, which the host may or may not
9
+ * supply. The host never assumes Rapier/Colyseus; those live behind
10
+ * `SystemAdapters` owned by the first-party implementer.
11
+ *
12
+ * Migration note: `VgaiSceneGameAdapter.mount` builds today's `GameContext`
13
+ * (Rapier world, composer, …) internally from a `HostContext`. New code targets
14
+ * `HostContext`; `GameContext` is now a first-party implementation detail.
15
+ */
16
+ import type * as THREE from 'three';
17
+ import type { AssetCache } from '../assets';
18
+ import type { GameInternal } from '../runtime/game';
19
+ /** The canvas/container the game renders into, plus its size. */
20
+ export interface HostSurface {
21
+ readonly canvas: HTMLCanvasElement;
22
+ readonly width: number;
23
+ readonly height: number;
24
+ }
25
+ /** Host-owned scheduling. A game may register extra per-frame callbacks; the
26
+ * host owns when they run. (First-party ticks its own system runner inside
27
+ * `MountedGame.update`, so it does not need this — it exists for games that
28
+ * want to hook the host loop directly.) */
29
+ export interface LoopHandle {
30
+ /** Register a per-frame callback; returns an unregister fn. */
31
+ onUpdate(fn: (dt: number) => void): () => void;
32
+ }
33
+ /**
34
+ * First-party subsystems a game MAY request from the host. The host returns
35
+ * `null` when it does not provide the kind, so a game must tolerate absence —
36
+ * the host never forces a subsystem on a game. Extended as new first-party
37
+ * systems become host-provisioned.
38
+ */
39
+ export interface SystemRegistry {
40
+ }
41
+ export interface HostContext {
42
+ /** The ONE shared three instance — identity matters for capture (see ingest). */
43
+ readonly three: typeof THREE;
44
+ /** Canvas/container + size; a self-driven game may take the surface over. */
45
+ readonly surface: HostSurface;
46
+ /** Host renderer — host-driven games render through it. */
47
+ readonly renderer: THREE.WebGLRenderer;
48
+ /** Host-owned loop scheduling. */
49
+ readonly loop: LoopHandle;
50
+ /** Shared GLTF/texture cache. */
51
+ readonly assets: AssetCache;
52
+ /** HUD overlay container (pointer-events:none by default). */
53
+ readonly ui: HTMLElement;
54
+ /**
55
+ * No GPU/DOM/audio available (Node conformance tests). A first-party adapter
56
+ * skips postprocessing/render/audio/input-map loading but still builds the
57
+ * scene + Rapier + components, so its scene/authoring/physics can be exercised
58
+ * headlessly. Browser hosts leave this false/undefined → full behavior.
59
+ */
60
+ readonly headless?: boolean;
61
+ /** Ask the host for a first-party subsystem; `null` if not provided. */
62
+ requestSystem<T extends keyof SystemRegistry>(kind: T): SystemRegistry[T] | null;
63
+ /**
64
+ * The Game root (T7.1 slice 1 — GAME-ROOT-DESIGN.md D6). The host
65
+ * constructs the Game shell BEFORE mounting a `GameAdapter` and hands it
66
+ * down here so an adapter can expose `ctx.game`/`ctx.worlds` to the game it
67
+ * mounts. Absent in headless harnesses and foreign hosts that predate the
68
+ * Game root — everything must keep working when this is undefined (the
69
+ * zero-break guarantee for this slice).
70
+ */
71
+ readonly game?: GameInternal | undefined;
72
+ }
73
+ //# sourceMappingURL=host-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-context.d.ts","sourceRoot":"","sources":["../../src/adapter/host-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,iEAAiE;AACjE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;4CAG4C;AAC5C,MAAM,WAAW,UAAU;IACzB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CAChD;AAED;;;;;GAKG;AAEH,MAAM,WAAW,cAAc;CAAG;AAElC,MAAM,WAAW,WAAW;IAC1B,iFAAiF;IACjF,QAAQ,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC;IAC7B,6EAA6E;IAC7E,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC;IACvC,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,iCAAiC;IACjC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC;IACzB;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,wEAAwE;IACxE,aAAa,CAAC,CAAC,SAAS,MAAM,cAAc,EAAE,IAAI,EAAE,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACjF;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CAC1C"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * HostContext — the NEUTRAL primitives the host hands a game when mounting it.
3
+ *
4
+ * This generalizes the old `GameContext`, which baked in first-party system
5
+ * choices (a Rapier world, the postprocessing composer, the InputManager, …).
6
+ * `HostContext` provides only what ANY game needs — the shared three instance, a
7
+ * surface, a renderer, a loop, assets, a UI overlay — and lets a game *ask* for
8
+ * a first-party subsystem via `requestSystem`, which the host may or may not
9
+ * supply. The host never assumes Rapier/Colyseus; those live behind
10
+ * `SystemAdapters` owned by the first-party implementer.
11
+ *
12
+ * Migration note: `VgaiSceneGameAdapter.mount` builds today's `GameContext`
13
+ * (Rapier world, composer, …) internally from a `HostContext`. New code targets
14
+ * `HostContext`; `GameContext` is now a first-party implementation detail.
15
+ */
16
+ export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Adapter interfaces — the seams the engine host and the editor DEPEND ON.
3
+ *
4
+ * host → GameAdapter ← { VgaiSceneGameAdapter, IngestGameAdapter, … }
5
+ * editor → AuthoringAdapter ← { VgaiSceneAuthoringAdapter, IngestAuthoringAdapter, … }
6
+ * game → SystemAdapters (physics/networking/input/assets)
7
+ *
8
+ * The first-party `.vscn`/`GameComponent`/Rapier/Colyseus stack is ONE
9
+ * implementer of these interfaces, not the engine's vocabulary. See
10
+ * docs/ADAPTER-ARCHITECTURE.md.
11
+ */
12
+ export type { AssetDropProvider, AuthoringAdapter, AuthoringCapabilities, BoxEditProvider, ColorSampleProvider, ComponentsProvider, DOMRectLike, EditorNode, FileMapProvider, HierarchyProvider, InspectorProvider, LayoutProvider, PersistenceProvider, PickProvider, PropertyDescriptor, RectProvider, RootGroup, RootGroupsProvider, SelectionProvider, StoriesProvider, StoryRef, StructureProvider, TextProvider, TransformProvider, } from './authoring';
13
+ export { type ColyseusNetworkingConfig, createColyseusNetworkingAdapter, } from './colyseus-networking-adapter';
14
+ export { createInputManagerAdapter, createNavigationAdapter, createVgaiAssetAdapter, } from './first-party-systems';
15
+ export type { GameAdapter, MountedGame, MountedPixiWorld, MountedReactWorld, MountedThreeWorld, MountedWorld, MountedWorldBase, MountedWorldFor, WorldStateObserver, } from './game-adapter';
16
+ export type { HostContext, HostSurface, LoopHandle, SystemRegistry } from './host-context';
17
+ export { createRapierPhysicsAdapter } from './rapier-physics-adapter';
18
+ export type { ActionValueSnapshot, AssetAdapter, ConnectionState, InputAdapter, NavigationAdapter, NavPoint, NetPeer, NetworkingAdapter, PhysicsAdapter, ReplicationStats, RoomInfo, SystemAdapters, Unsubscribe, } from './system-adapter';
19
+ export type { Transform, TransformOwner } from './transform';
20
+ export { fromSetup, type VgaiMountedGame, type VgaiSceneConfig, VgaiSceneGameAdapter, } from './vgai-scene-game-adapter';
21
+ export type { WorldKind } from './world-kind';
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapter/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,wBAAwB,EAC7B,+BAA+B,GAChC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,YAAY,EACV,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,QAAQ,EACR,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,QAAQ,EACR,cAAc,EACd,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,SAAS,EACT,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Adapter interfaces — the seams the engine host and the editor DEPEND ON.
3
+ *
4
+ * host → GameAdapter ← { VgaiSceneGameAdapter, IngestGameAdapter, … }
5
+ * editor → AuthoringAdapter ← { VgaiSceneAuthoringAdapter, IngestAuthoringAdapter, … }
6
+ * game → SystemAdapters (physics/networking/input/assets)
7
+ *
8
+ * The first-party `.vscn`/`GameComponent`/Rapier/Colyseus stack is ONE
9
+ * implementer of these interfaces, not the engine's vocabulary. See
10
+ * docs/ADAPTER-ARCHITECTURE.md.
11
+ */
12
+ export { createColyseusNetworkingAdapter, } from './colyseus-networking-adapter';
13
+ export { createInputManagerAdapter, createNavigationAdapter, createVgaiAssetAdapter, } from './first-party-systems';
14
+ export { createRapierPhysicsAdapter } from './rapier-physics-adapter';
15
+ export { fromSetup, VgaiSceneGameAdapter, } from './vgai-scene-game-adapter';
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The game→host contract: ONE pre-defined interface an external game may
3
+ * declare on `window.vgaiGame` to let the editor work with it like native
4
+ * content. Capabilities are by PRESENCE — every field is optional, and a game
5
+ * that declares nothing runs exactly as before (doctrine: adaptation enables
6
+ * editor features; it never bends a game around host internals). This file is
7
+ * the single source of truth for the contract's shape — host code reads it
8
+ * through {@link readGameContract} instead of ad-hoc `window` casts, so the
9
+ * spec and the implementation cannot drift apart.
10
+ *
11
+ * Relationship to the native engine: first-party content implements the SAME
12
+ * conceptual surface (mount root, lifecycle, loop gating) through
13
+ * `GameAdapter`/`MountedGame` — the native engine is the premade 100%
14
+ * implementation of this contract. An ingested game climbs the same ladder
15
+ * endpoint by endpoint: capture infers what it can (the scene), the game
16
+ * declares what inference can't reach (its DOM root, its session lifecycle).
17
+ *
18
+ * Origin: docs/FTUE-EXTERNAL-R3F-GAME.md F16 (root), F17+F21 (lifecycle).
19
+ */
20
+ /**
21
+ * Session lifecycle endpoints. Declaring `start` means "I support cold
22
+ * mount": when the host sets `window.__vgaiMountCold` before the game's entry
23
+ * executes, the game may defer its session side-effects (backend connections,
24
+ * narrative, audio) and render a quiet, inspectable scene; the host calls
25
+ * `start()` — at most once per mount — when the user presses ▶. Declaring
26
+ * `pause`/`resume` means the game can genuinely freeze/unfreeze itself; the
27
+ * host prefers these over its outside-in loop gate (which cannot gate a raw
28
+ * requestAnimationFrame loop at all — R3F games, notably).
29
+ */
30
+ export interface VgaiGameLifecycle {
31
+ start?(): void;
32
+ pause?(): void;
33
+ resume?(): void;
34
+ }
35
+ export interface VgaiGameContract {
36
+ /** Bump only on breaking shape changes; additive endpoints keep version 1. */
37
+ contractVersion: 1;
38
+ /**
39
+ * The element that OWNS the game's whole DOM (canvas + HUD + overlay
40
+ * portals). The host adopts it wholesale into the game pane, so DOM-hybrid
41
+ * games keep their UI instead of stranding it at page level. The host
42
+ * verifies it actually contains the captured canvas before adopting.
43
+ */
44
+ root?: HTMLElement;
45
+ lifecycle?: VgaiGameLifecycle;
46
+ }
47
+ /**
48
+ * Read the declared contract, if any. The `contractVersion` gate is the
49
+ * forward-compatibility hinge: a future v2 game on a v1 host is ignored
50
+ * (pre-contract fallbacks apply) rather than half-interpreted.
51
+ */
52
+ export declare function readGameContract(): VgaiGameContract | null;
53
+ //# sourceMappingURL=game-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"game-contract.d.ts","sourceRoot":"","sources":["../../../src/adapter/ingest/game-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,IAAI,IAAI,CAAC;IACf,KAAK,CAAC,IAAI,IAAI,CAAC;IACf,MAAM,CAAC,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,8EAA8E;IAC9E,eAAe,EAAE,CAAC,CAAC;IACnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,gBAAgB,GAAG,IAAI,CAI1D"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The game→host contract: ONE pre-defined interface an external game may
3
+ * declare on `window.vgaiGame` to let the editor work with it like native
4
+ * content. Capabilities are by PRESENCE — every field is optional, and a game
5
+ * that declares nothing runs exactly as before (doctrine: adaptation enables
6
+ * editor features; it never bends a game around host internals). This file is
7
+ * the single source of truth for the contract's shape — host code reads it
8
+ * through {@link readGameContract} instead of ad-hoc `window` casts, so the
9
+ * spec and the implementation cannot drift apart.
10
+ *
11
+ * Relationship to the native engine: first-party content implements the SAME
12
+ * conceptual surface (mount root, lifecycle, loop gating) through
13
+ * `GameAdapter`/`MountedGame` — the native engine is the premade 100%
14
+ * implementation of this contract. An ingested game climbs the same ladder
15
+ * endpoint by endpoint: capture infers what it can (the scene), the game
16
+ * declares what inference can't reach (its DOM root, its session lifecycle).
17
+ *
18
+ * Origin: docs/FTUE-EXTERNAL-R3F-GAME.md F16 (root), F17+F21 (lifecycle).
19
+ */
20
+ /**
21
+ * Read the declared contract, if any. The `contractVersion` gate is the
22
+ * forward-compatibility hinge: a future v2 game on a v1 host is ignored
23
+ * (pre-contract fallbacks apply) rather than half-interpreted.
24
+ */
25
+ export function readGameContract() {
26
+ const declared = window.vgaiGame;
27
+ if (!declared || declared.contractVersion !== 1)
28
+ return null;
29
+ return declared;
30
+ }
@@ -0,0 +1,118 @@
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
@@ -0,0 +1 @@
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"}