@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,110 +0,0 @@
1
- /**
2
- * Data-asset integrity core — the PURE half of W5 enforcement
3
- * (docs/DATA-TOOLS-DESIGN.md §6.6 "dangling `file#key` ref" / §6.7 build-path
4
- * validation). No filesystem, no vite, no zod: plain parsed-JSON in, findings
5
- * out, so BOTH consumers — `vgai doctor`'s data checks
6
- * (`packages/editor/src/doctor/data-checks.ts`) and the build-time plugin
7
- * (`./vite-plugin-data.ts`) — share one definition of "what is a ref" and
8
- * "what counts as dangling" and can never drift apart.
9
- *
10
- * What is a ref (§2.2): a cross-asset reference is a plain string
11
- * `"file#key"` — optionally with a field path, `"tuning#economy.slotGrowth"`
12
- * (file `#` key `.` field-path). There is no branded-ref Zod helper shipped
13
- * yet (W1 deferred it), so ref DETECTION is by convention, tuned against
14
- * false positives: a string is treated as a ref IFF it matches
15
- * {@link DATA_REF_PATTERN} AND its `file` prefix names a data asset that
16
- * actually exists in the project (`src/data/<file>.data.json`). Strings that
17
- * merely contain `#` — hex colors (`"#ff0000"`, no prefix), URLs with
18
- * fragments (`/` and `:` never match), musical pitches (`"C#4"` only matches
19
- * if a `C.data.json` exists) — never fire. The flip side is deliberate and
20
- * honest: a ref whose file prefix names a NONEXISTENT asset is
21
- * indistinguishable from an arbitrary string and is NOT flagged ("error if
22
- * refs exist yet" — the check only bites once the target file exists).
23
- *
24
- * `dataRef` (`./data-ref.ts`) now exists, closing that flip side for anyone
25
- * who adopts it: a `dataRef(target)` field's EMITTED schema carries
26
- * `"x-vgai-ref": target` — a declared intent, independent of whether the
27
- * target file currently exists. {@link collectDeclaredRefFields} /
28
- * {@link findMissingRefTargets} below walk that (zod-free — plain emitted
29
- * JSON Schema in, findings out, same purity contract as the rest of this
30
- * module) to catch the §9.4 hole for DECLARED refs: renaming/deleting a
31
- * target file used to silently un-check every ref into it; now a declared
32
- * ref's target is checked by NAME, not by "does a string happen to look
33
- * like one right now." Undeclared conventional-string refs keep the
34
- * calibrated behavior above, unchanged.
35
- */
36
- /**
37
- * `file#key(.field)*` — prefix must look like an asset stem (letters,
38
- * digits, `_`, `-`), key path is dot-separated segments of the same alphabet.
39
- */
40
- export declare const DATA_REF_PATTERN: RegExp;
41
- /** One ref-shaped string found while walking a data file's parsed JSON. */
42
- export interface DataRefOccurrence {
43
- /** Asset stem of the data file the ref string was found IN (e.g. `"tuning"`). */
44
- readonly inAsset: string;
45
- /** JSON path of the string inside that file (e.g. `"rows.goblin.drops[2]"`). */
46
- readonly atPath: string;
47
- /** The full ref string, verbatim (e.g. `"enemies#goblin"`). */
48
- readonly ref: string;
49
- /** Parsed target asset stem (`"enemies"`). */
50
- readonly targetAsset: string;
51
- /** Parsed dot-separated key path into the target (`["goblin"]`). */
52
- readonly targetKeyPath: readonly string[];
53
- }
54
- /** One dangling ref: the target FILE exists but the key path does not resolve in it. */
55
- export interface DanglingRefFinding extends DataRefOccurrence {
56
- /** The first key-path segment that failed to resolve, for the teaching message. */
57
- readonly missingSegment: string;
58
- }
59
- /**
60
- * Walk one data file's parsed JSON and collect every ref-shaped string whose
61
- * file prefix names an asset in `assetNames`. The top-level `"$schema"`
62
- * interchange line is skipped (it is wiring, not data — same special-casing
63
- * as `parseDataJson`'s strip).
64
- */
65
- export declare function collectDataRefs(inAsset: string, json: unknown, assetNames: ReadonlySet<string>): DataRefOccurrence[];
66
- /**
67
- * Find every dangling `file#key(.field)*` ref across a project's data assets.
68
- *
69
- * @param files parsed `.data.json` payloads keyed by asset stem (the
70
- * filename minus `.data.json` — the same name the ref's prefix uses, §2.2).
71
- * Pass only files that parsed as JSON; unparseable files are already an
72
- * error in their own right and can't be resolved against anyway.
73
- * @returns one finding per ref whose target FILE is in `files` but whose key
74
- * path does not fully resolve inside it (a table row that doesn't exist, a
75
- * singleton field path that walks off the object).
76
- */
77
- export declare function findDanglingDataRefs(files: ReadonlyMap<string, unknown>): DanglingRefFinding[];
78
- /** One `dataRef` field declared in an emitted JSON Schema. */
79
- export interface DeclaredRefField {
80
- /** Dot-separated field path within the schema (e.g. `"drop"`, `"loot.dropTable"`). A table's row-schema fields are reported WITHOUT a row-key segment — the declaration applies to every row alike. */
81
- readonly fieldPath: string;
82
- /** The asset stem the field's `dataRef(...)` call named. */
83
- readonly targetStem: string;
84
- }
85
- /** One declared ref whose target stem names no asset that currently exists. */
86
- export interface MissingRefTargetFinding {
87
- readonly fieldPath: string;
88
- readonly targetStem: string;
89
- }
90
- /**
91
- * Walk an emitted data-asset JSON Schema (`toDataJsonSchema`'s output, or the
92
- * committed `.schema.json` twin — same shape either way) and collect every
93
- * field stamped `"x-vgai-ref": <target>` by `dataRef` (`./data-ref.ts`).
94
- * Handles both blessed shapes (spec §2.1): a singleton's `properties`, and a
95
- * table's `additionalProperties` row schema — walked with the SAME field
96
- * path (a table's declared ref applies uniformly to every row, there is no
97
- * per-row schema variation). Nested `properties` inside a ref-declaring
98
- * field are not walked further (a ref leaf has no children); nested groups
99
- * elsewhere recurse via their own `properties`.
100
- */
101
- export declare function collectDeclaredRefFields(schema: unknown): DeclaredRefField[];
102
- /**
103
- * Every declared ref field whose target stem names no asset in
104
- * `assetNames` — the §9.4 fix: a `dataRef('items')` field stays flagged if
105
- * `items.data.json` is renamed or deleted, independent of whether any
106
- * CURRENT value happens to look like an `items#...` string (the gap the
107
- * conventional-string calibration above deliberately leaves open).
108
- */
109
- export declare function findMissingRefTargets(declared: readonly DeclaredRefField[], assetNames: ReadonlySet<string>): MissingRefTargetFinding[];
110
- //# sourceMappingURL=data-check-core.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-check-core.d.ts","sourceRoot":"","sources":["../../src/data/data-check-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAA6D,CAAC;AAE3F,2EAA2E;AAC3E,MAAM,WAAW,iBAAiB;IAChC,iFAAiF;IACjF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,gFAAgF;IAChF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C;AAED,wFAAwF;AACxF,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,mFAAmF;IACnF,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAMD;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,GAC9B,iBAAiB,EAAE,CAOrB;AA6CD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,kBAAkB,EAAE,CAU9F;AAYD,8DAA8D;AAC9D,MAAM,WAAW,gBAAgB;IAC/B,uMAAuM;IACvM,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,4DAA4D;IAC5D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,+EAA+E;AAC/E,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAeD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,OAAO,GAAG,gBAAgB,EAAE,CAI5E;AAwBD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,EACrC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,GAC9B,uBAAuB,EAAE,CAI3B"}
@@ -1,178 +0,0 @@
1
- /**
2
- * Data-asset integrity core — the PURE half of W5 enforcement
3
- * (docs/DATA-TOOLS-DESIGN.md §6.6 "dangling `file#key` ref" / §6.7 build-path
4
- * validation). No filesystem, no vite, no zod: plain parsed-JSON in, findings
5
- * out, so BOTH consumers — `vgai doctor`'s data checks
6
- * (`packages/editor/src/doctor/data-checks.ts`) and the build-time plugin
7
- * (`./vite-plugin-data.ts`) — share one definition of "what is a ref" and
8
- * "what counts as dangling" and can never drift apart.
9
- *
10
- * What is a ref (§2.2): a cross-asset reference is a plain string
11
- * `"file#key"` — optionally with a field path, `"tuning#economy.slotGrowth"`
12
- * (file `#` key `.` field-path). There is no branded-ref Zod helper shipped
13
- * yet (W1 deferred it), so ref DETECTION is by convention, tuned against
14
- * false positives: a string is treated as a ref IFF it matches
15
- * {@link DATA_REF_PATTERN} AND its `file` prefix names a data asset that
16
- * actually exists in the project (`src/data/<file>.data.json`). Strings that
17
- * merely contain `#` — hex colors (`"#ff0000"`, no prefix), URLs with
18
- * fragments (`/` and `:` never match), musical pitches (`"C#4"` only matches
19
- * if a `C.data.json` exists) — never fire. The flip side is deliberate and
20
- * honest: a ref whose file prefix names a NONEXISTENT asset is
21
- * indistinguishable from an arbitrary string and is NOT flagged ("error if
22
- * refs exist yet" — the check only bites once the target file exists).
23
- *
24
- * `dataRef` (`./data-ref.ts`) now exists, closing that flip side for anyone
25
- * who adopts it: a `dataRef(target)` field's EMITTED schema carries
26
- * `"x-vgai-ref": target` — a declared intent, independent of whether the
27
- * target file currently exists. {@link collectDeclaredRefFields} /
28
- * {@link findMissingRefTargets} below walk that (zod-free — plain emitted
29
- * JSON Schema in, findings out, same purity contract as the rest of this
30
- * module) to catch the §9.4 hole for DECLARED refs: renaming/deleting a
31
- * target file used to silently un-check every ref into it; now a declared
32
- * ref's target is checked by NAME, not by "does a string happen to look
33
- * like one right now." Undeclared conventional-string refs keep the
34
- * calibrated behavior above, unchanged.
35
- */
36
- /**
37
- * `file#key(.field)*` — prefix must look like an asset stem (letters,
38
- * digits, `_`, `-`), key path is dot-separated segments of the same alphabet.
39
- */
40
- export const DATA_REF_PATTERN = /^([A-Za-z0-9_-]+)#([A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*)$/;
41
- function isPlainObject(value) {
42
- return value !== null && typeof value === 'object' && !Array.isArray(value);
43
- }
44
- /**
45
- * Walk one data file's parsed JSON and collect every ref-shaped string whose
46
- * file prefix names an asset in `assetNames`. The top-level `"$schema"`
47
- * interchange line is skipped (it is wiring, not data — same special-casing
48
- * as `parseDataJson`'s strip).
49
- */
50
- export function collectDataRefs(inAsset, json, assetNames) {
51
- const out = [];
52
- visitForRefs(json, '', true, (node, path) => {
53
- const occurrence = asRefOccurrence(inAsset, node, path, assetNames);
54
- if (occurrence)
55
- out.push(occurrence);
56
- });
57
- return out;
58
- }
59
- /** Depth-first walk over parsed JSON, calling `onString` for every string leaf with its JSON path. */
60
- function visitForRefs(node, path, topLevel, onString) {
61
- if (typeof node === 'string') {
62
- onString(node, path);
63
- return;
64
- }
65
- if (Array.isArray(node)) {
66
- node.forEach((item, i) => {
67
- visitForRefs(item, `${path}[${i}]`, false, onString);
68
- });
69
- return;
70
- }
71
- if (isPlainObject(node)) {
72
- for (const [key, value] of Object.entries(node)) {
73
- if (topLevel && key === '$schema')
74
- continue;
75
- visitForRefs(value, path ? `${path}.${key}` : key, false, onString);
76
- }
77
- }
78
- }
79
- /** The string is a ref iff it matches the pattern AND its file prefix names a real asset. */
80
- function asRefOccurrence(inAsset, value, path, assetNames) {
81
- const m = DATA_REF_PATTERN.exec(value);
82
- if (!m || !assetNames.has(m[1]))
83
- return null;
84
- return {
85
- inAsset,
86
- atPath: path || '(root)',
87
- ref: value,
88
- targetAsset: m[1],
89
- targetKeyPath: m[2].split('.'),
90
- };
91
- }
92
- /**
93
- * Find every dangling `file#key(.field)*` ref across a project's data assets.
94
- *
95
- * @param files parsed `.data.json` payloads keyed by asset stem (the
96
- * filename minus `.data.json` — the same name the ref's prefix uses, §2.2).
97
- * Pass only files that parsed as JSON; unparseable files are already an
98
- * error in their own right and can't be resolved against anyway.
99
- * @returns one finding per ref whose target FILE is in `files` but whose key
100
- * path does not fully resolve inside it (a table row that doesn't exist, a
101
- * singleton field path that walks off the object).
102
- */
103
- export function findDanglingDataRefs(files) {
104
- const assetNames = new Set(files.keys());
105
- const findings = [];
106
- for (const [name, json] of files) {
107
- for (const occurrence of collectDataRefs(name, json, assetNames)) {
108
- const missing = firstUnresolvedSegment(files.get(occurrence.targetAsset), occurrence);
109
- if (missing !== null)
110
- findings.push({ ...occurrence, missingSegment: missing });
111
- }
112
- }
113
- return findings;
114
- }
115
- /** The first key-path segment that fails to resolve in the target payload, or `null` if the whole path resolves. */
116
- function firstUnresolvedSegment(target, ref) {
117
- let node = target;
118
- for (const segment of ref.targetKeyPath) {
119
- if (!isPlainObject(node) || !(segment in node))
120
- return segment;
121
- node = node[segment];
122
- }
123
- return null;
124
- }
125
- function asSchemaNode(value) {
126
- return value && typeof value === 'object' && !Array.isArray(value)
127
- ? value
128
- : null;
129
- }
130
- /**
131
- * Walk an emitted data-asset JSON Schema (`toDataJsonSchema`'s output, or the
132
- * committed `.schema.json` twin — same shape either way) and collect every
133
- * field stamped `"x-vgai-ref": <target>` by `dataRef` (`./data-ref.ts`).
134
- * Handles both blessed shapes (spec §2.1): a singleton's `properties`, and a
135
- * table's `additionalProperties` row schema — walked with the SAME field
136
- * path (a table's declared ref applies uniformly to every row, there is no
137
- * per-row schema variation). Nested `properties` inside a ref-declaring
138
- * field are not walked further (a ref leaf has no children); nested groups
139
- * elsewhere recurse via their own `properties`.
140
- */
141
- export function collectDeclaredRefFields(schema) {
142
- const out = [];
143
- walkForDeclaredRefs(schema, '', out);
144
- return out;
145
- }
146
- function walkForDeclaredRefs(raw, path, out) {
147
- const node = asSchemaNode(raw);
148
- if (!node)
149
- return;
150
- if (typeof node['x-vgai-ref'] === 'string') {
151
- out.push({ fieldPath: path || '(root)', targetStem: node['x-vgai-ref'] });
152
- return; // a ref leaf — nothing further to walk under it
153
- }
154
- if (isPlainObject(node.properties)) {
155
- for (const [key, child] of Object.entries(node.properties)) {
156
- if (key === '$schema')
157
- continue;
158
- walkForDeclaredRefs(child, path ? `${path}.${key}` : key, out);
159
- }
160
- }
161
- // A table's row schema (`z.record(rowSchema)` emits an object-valued
162
- // `additionalProperties`) — same field-path grammar, no row-key segment.
163
- if (isPlainObject(node.additionalProperties)) {
164
- walkForDeclaredRefs(node.additionalProperties, path, out);
165
- }
166
- }
167
- /**
168
- * Every declared ref field whose target stem names no asset in
169
- * `assetNames` — the §9.4 fix: a `dataRef('items')` field stays flagged if
170
- * `items.data.json` is renamed or deleted, independent of whether any
171
- * CURRENT value happens to look like an `items#...` string (the gap the
172
- * conventional-string calibration above deliberately leaves open).
173
- */
174
- export function findMissingRefTargets(declared, assetNames) {
175
- return declared
176
- .filter((d) => !assetNames.has(d.targetStem))
177
- .map((d) => ({ fieldPath: d.fieldPath, targetStem: d.targetStem }));
178
- }
@@ -1,79 +0,0 @@
1
- /**
2
- * `file#key` refs — the resolvable half (docs/DATA-TOOLS-DESIGN.md §2.2).
3
- *
4
- * Cross-asset references (`"enemies#goblin"`, `"tuning#economy.slotGrowth"`)
5
- * have been DETECTED and VALIDATED since W5 (`data-check-core.ts`'s
6
- * `DATA_REF_PATTERN` + `findDanglingDataRefs`, enforced by both `vgai doctor`
7
- * and the build plugin) — but nothing could actually RESOLVE one at runtime,
8
- * and nothing declared a field AS a ref in its schema (detection was by
9
- * string-shape convention alone). This module closes both halves:
10
- *
11
- * - {@link dataRef} — a typed Zod schema for a ref FIELD. Stamps the emitted
12
- * JSON Schema with a precise `pattern` (the target stem is baked into the
13
- * regex, so VS Code validates the prefix for free) and a machine-readable
14
- * `"x-vgai-ref": target` marker (a Zod `.meta()` that survives
15
- * `toDataJsonSchema`, including inside a table's `additionalProperties` row
16
- * schema — no emitter changes needed). The editor's Data panel
17
- * (`json-schema-fields.ts`'s `'ref'` kind) reads that marker to render a
18
- * `stem#key` PICKER instead of free text.
19
- * - {@link getRef} — lazy, read-time resolution. The caller names the target
20
- * HANDLE explicitly (`getRef(items, goblin.drop)`), so the resolved type is
21
- * the handle's own row type — no stem→handle registry, no load-order
22
- * problem, no cycle hazard (nothing walks a graph; two refs resolved when
23
- * you choose to resolve them isn't a cycle), and it's HMR-correct for free
24
- * (it reads `target.get()` at CALL time, same doctrine as every other data
25
- * read — "read every frame", never cache across frames).
26
- *
27
- * Deliberately NOT built (see docs/DATA-TOOLS-DESIGN.md §2.2 and the design
28
- * note this module's history carries): eager resolution inside `defineData`
29
- * (would change `get()`'s shipped output type and entangle HMR — an edit to
30
- * `enemies.data.json` would have to re-notify every OTHER asset that
31
- * references it), and a global `resolveRef(addressString)` (needs a runtime
32
- * stem→handle registry that `src/data/assets.ts` — side-effect-free,
33
- * config-load-time, schemas-only by its own module doc — must not become).
34
- */
35
- import { z } from 'zod';
36
- import type { DataHandle } from './data-asset';
37
- /** An asset-stem-tagged `file#key` string — `` `${Stem}#${string}` ``. */
38
- export type DataRef<Stem extends string = string> = `${Stem}#${string}`;
39
- /**
40
- * A Zod schema for a data-asset FIELD that references another asset by
41
- * `"<target>#<key>(.<field>)*"`. Use it in a `.schema.ts`:
42
- *
43
- * ```ts
44
- * export const EnemyRowSchema = z.object({
45
- * name: z.string(),
46
- * drop: dataRef('items'), // -> "items#potion"
47
- * });
48
- * ```
49
- *
50
- * The emitted JSON Schema (`toDataJsonSchema`) carries both a precise
51
- * `pattern` (VS Code validates the target-stem prefix for free) and
52
- * `"x-vgai-ref": target` (the editor's Data panel picker keys off this).
53
- * Detection by `data-check-core.ts`'s conventional-string calibration still
54
- * applies at the VALUE level (a `dataRef` field's actual string still has to
55
- * look like `target#key` to resolve) — this only makes the field's INTENT
56
- * declared in the schema, closing the §9.4 "renamed target file silently
57
- * un-checks its refs" hole for anything that adopts it (see
58
- * `collectDeclaredRefFields`/`findMissingRefTargets` in `data-check-core.ts`).
59
- */
60
- export declare function dataRef<Stem extends string>(target: Stem): z.ZodType<DataRef<Stem>>;
61
- /**
62
- * Resolve a `"target#key(.field)*"` ref against the named target HANDLE,
63
- * read live (`target.get()` at call time — HMR-correct, no caching across
64
- * frames, same doctrine as any other data read).
65
- *
66
- * `ref`'s stem prefix should name `target`'s own asset — when `target` was
67
- * built with a `sourcePath` (every `defineData` call populates it), a
68
- * mismatch throws a teaching error instead of silently walking the wrong
69
- * handle's data. Without a `sourcePath` (a hand-rolled `DataHandle`, or an
70
- * older one built before this field existed) the mismatch check is skipped —
71
- * resolution still proceeds against `target`, since the caller named it
72
- * explicitly and that's the actual contract.
73
- *
74
- * Throws a teaching error naming the ref and the first key-path segment that
75
- * doesn't resolve (a deleted row, a typo'd key) — never returns `undefined`
76
- * silently, matching `parseDataJson`'s "errors teach" doctrine (§6.5).
77
- */
78
- export declare function getRef<T>(target: DataHandle<Record<string, T>>, ref: string): T;
79
- //# sourceMappingURL=data-ref.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-ref.d.ts","sourceRoot":"","sources":["../../src/data/data-ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,0EAA0E;AAC1E,MAAM,MAAM,OAAO,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,IAAI,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC;AAOxE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,OAAO,CAAC,IAAI,SAAS,MAAM,EAAE,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CASnF;AAcD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,CAoC/E"}
@@ -1,130 +0,0 @@
1
- /**
2
- * `file#key` refs — the resolvable half (docs/DATA-TOOLS-DESIGN.md §2.2).
3
- *
4
- * Cross-asset references (`"enemies#goblin"`, `"tuning#economy.slotGrowth"`)
5
- * have been DETECTED and VALIDATED since W5 (`data-check-core.ts`'s
6
- * `DATA_REF_PATTERN` + `findDanglingDataRefs`, enforced by both `vgai doctor`
7
- * and the build plugin) — but nothing could actually RESOLVE one at runtime,
8
- * and nothing declared a field AS a ref in its schema (detection was by
9
- * string-shape convention alone). This module closes both halves:
10
- *
11
- * - {@link dataRef} — a typed Zod schema for a ref FIELD. Stamps the emitted
12
- * JSON Schema with a precise `pattern` (the target stem is baked into the
13
- * regex, so VS Code validates the prefix for free) and a machine-readable
14
- * `"x-vgai-ref": target` marker (a Zod `.meta()` that survives
15
- * `toDataJsonSchema`, including inside a table's `additionalProperties` row
16
- * schema — no emitter changes needed). The editor's Data panel
17
- * (`json-schema-fields.ts`'s `'ref'` kind) reads that marker to render a
18
- * `stem#key` PICKER instead of free text.
19
- * - {@link getRef} — lazy, read-time resolution. The caller names the target
20
- * HANDLE explicitly (`getRef(items, goblin.drop)`), so the resolved type is
21
- * the handle's own row type — no stem→handle registry, no load-order
22
- * problem, no cycle hazard (nothing walks a graph; two refs resolved when
23
- * you choose to resolve them isn't a cycle), and it's HMR-correct for free
24
- * (it reads `target.get()` at CALL time, same doctrine as every other data
25
- * read — "read every frame", never cache across frames).
26
- *
27
- * Deliberately NOT built (see docs/DATA-TOOLS-DESIGN.md §2.2 and the design
28
- * note this module's history carries): eager resolution inside `defineData`
29
- * (would change `get()`'s shipped output type and entangle HMR — an edit to
30
- * `enemies.data.json` would have to re-notify every OTHER asset that
31
- * references it), and a global `resolveRef(addressString)` (needs a runtime
32
- * stem→handle registry that `src/data/assets.ts` — side-effect-free,
33
- * config-load-time, schemas-only by its own module doc — must not become).
34
- */
35
- import { z } from 'zod';
36
- import { DATA_REF_PATTERN } from './data-check-core';
37
- /** Prefix/key-path grammar a ref must match, parameterized by target stem (mirrors `DATA_REF_PATTERN` in `data-check-core.ts`, minus the alternation — this one is anchored to ONE target). */
38
- function refPattern(target) {
39
- return new RegExp(`^${target}#[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)*$`);
40
- }
41
- /**
42
- * A Zod schema for a data-asset FIELD that references another asset by
43
- * `"<target>#<key>(.<field>)*"`. Use it in a `.schema.ts`:
44
- *
45
- * ```ts
46
- * export const EnemyRowSchema = z.object({
47
- * name: z.string(),
48
- * drop: dataRef('items'), // -> "items#potion"
49
- * });
50
- * ```
51
- *
52
- * The emitted JSON Schema (`toDataJsonSchema`) carries both a precise
53
- * `pattern` (VS Code validates the target-stem prefix for free) and
54
- * `"x-vgai-ref": target` (the editor's Data panel picker keys off this).
55
- * Detection by `data-check-core.ts`'s conventional-string calibration still
56
- * applies at the VALUE level (a `dataRef` field's actual string still has to
57
- * look like `target#key` to resolve) — this only makes the field's INTENT
58
- * declared in the schema, closing the §9.4 "renamed target file silently
59
- * un-checks its refs" hole for anything that adopts it (see
60
- * `collectDeclaredRefFields`/`findMissingRefTargets` in `data-check-core.ts`).
61
- */
62
- export function dataRef(target) {
63
- return z
64
- .string()
65
- .regex(refPattern(target), {
66
- message: `must be a "${target}#<key>" reference (docs/DATA-TOOLS-DESIGN.md §2.2) — ` +
67
- `expected the target asset stem "${target}", e.g. "${target}#some-key".`,
68
- })
69
- .meta({ 'x-vgai-ref': target });
70
- }
71
- /** First failing key-path segment, or `null` if the whole path resolves — same walk `data-check-core.ts`'s `firstUnresolvedSegment` does over parsed JSON, here over a live handle's value. */
72
- function firstMissingSegment(root, keyPath) {
73
- let node = root;
74
- for (const segment of keyPath) {
75
- if (node === null || typeof node !== 'object' || Array.isArray(node) || !(segment in node)) {
76
- return segment;
77
- }
78
- node = node[segment];
79
- }
80
- return null;
81
- }
82
- /**
83
- * Resolve a `"target#key(.field)*"` ref against the named target HANDLE,
84
- * read live (`target.get()` at call time — HMR-correct, no caching across
85
- * frames, same doctrine as any other data read).
86
- *
87
- * `ref`'s stem prefix should name `target`'s own asset — when `target` was
88
- * built with a `sourcePath` (every `defineData` call populates it), a
89
- * mismatch throws a teaching error instead of silently walking the wrong
90
- * handle's data. Without a `sourcePath` (a hand-rolled `DataHandle`, or an
91
- * older one built before this field existed) the mismatch check is skipped —
92
- * resolution still proceeds against `target`, since the caller named it
93
- * explicitly and that's the actual contract.
94
- *
95
- * Throws a teaching error naming the ref and the first key-path segment that
96
- * doesn't resolve (a deleted row, a typo'd key) — never returns `undefined`
97
- * silently, matching `parseDataJson`'s "errors teach" doctrine (§6.5).
98
- */
99
- export function getRef(target, ref) {
100
- const m = DATA_REF_PATTERN.exec(ref);
101
- if (!m) {
102
- throw new Error(`getRef: "${ref}" is not a "file#key" reference (docs/DATA-TOOLS-DESIGN.md §2.2) — ` +
103
- 'expected a string shaped like "some-file#some-key".');
104
- }
105
- const refStem = m[1];
106
- const keyPathStr = m[2];
107
- const targetStem = target.sourcePath
108
- ?.split('\\')
109
- .join('/')
110
- .split('/')
111
- .pop()
112
- ?.replace(/\.data\.json$/, '');
113
- if (targetStem !== undefined && targetStem !== refStem) {
114
- throw new Error(`getRef: ref "${ref}" names target asset "${refStem}", but the handle passed in is ` +
115
- `"${targetStem}" (${target.sourcePath}). Pass the handle ` +
116
- `"${refStem}#..." actually names — getRef(${refStem}, ...), not getRef(${targetStem}, ...).`);
117
- }
118
- const keyPath = keyPathStr.split('.');
119
- const root = target.get();
120
- const missing = firstMissingSegment(root, keyPath);
121
- if (missing !== null) {
122
- throw new Error(`getRef: dangling ref "${ref}" — "${missing}" does not exist` +
123
- (targetStem ? ` in ${targetStem}.data.json` : '') +
124
- '. Fix the key or remove the ref (refs are "file#key" strings — docs/DATA-TOOLS-DESIGN.md §2.2).');
125
- }
126
- let node = root;
127
- for (const segment of keyPath)
128
- node = node[segment];
129
- return node;
130
- }
@@ -1,79 +0,0 @@
1
- /**
2
- * `vgaiDataCheck` — build-path validation for data assets and project tools
3
- * (docs/DATA-TOOLS-DESIGN.md §6.7, the enforcement half of W5). A Vite plugin
4
- * for the PROJECT's own `vite.config.ts` (the template wires it; the editor
5
- * dev server boots Vite from the ENGINE's config and never runs this — its
6
- * surface is covered by `vgai doctor` instead). Build-only (`apply: 'build'`):
7
- * in dev, `defineData`'s parse-on-load already fails loud in the console.
8
- *
9
- * Three checks, all failing the build loud:
10
- *
11
- * 1. **Schema integrity** (`buildStart`): every registered asset's
12
- * `.data.json` is read fresh from disk and validated through
13
- * {@link parseDataJson} — the EXACT parse `defineData` runs at load (§9.1:
14
- * an emitted-JSON-Schema validator here could disagree with runtime; the
15
- * Zod schema itself never can). The schemas arrive EXECUTABLE because
16
- * `vite.config.ts` statically imports the project's data-asset registry
17
- * (`src/data/assets.ts` in the template) — Vite's config loader bundles
18
- * config-relative TS imports, which is what makes this the one build-side
19
- * place project Zod schemas can run.
20
- * 2. **Ref integrity** (`buildStart`): every `file#key(.field)*` string in
21
- * every `src/data/*.data.json` (registered or not) must resolve — shared
22
- * definition with `vgai doctor` via {@link findDanglingDataRefs}, so the
23
- * two surfaces can never disagree about what "dangling" means. A second,
24
- * narrower ref check runs alongside it for REGISTERED assets only: any
25
- * field declared with `dataRef(target)` (`./data-ref.ts`) whose `target`
26
- * names no asset currently on disk fails loud too (§9.4's "renamed the
27
- * target file" hole, closed for declared refs — see
28
- * `collectDeclaredRefFields`/`findMissingRefTargets` in `data-check-core.ts`).
29
- * 3. **Tools never ship** (`generateBundle`): no emitted chunk may contain a
30
- * module from `src/tools/` or a `*.tool.*` file (§4: tester serves and
31
- * standalone builds strip tools entirely; W4 made this true by
32
- * construction — nothing imports tools — and this check PINS it against
33
- * the day some game module imports a tool "just for a helper").
34
- *
35
- * Unregistered data files (a `.data.json` with no entry in the passed
36
- * `assets` list) are a WARNING, not an error: they still get ref-integrity
37
- * and runtime parse-on-load, but no build-time schema check — the warning
38
- * names the registry file to fix.
39
- */
40
- import type { Plugin } from 'vite';
41
- import type { z } from 'zod';
42
- /** One registered data asset: its executable Zod schema + the project-relative path of its `.data.json`. */
43
- export interface DataCheckAsset {
44
- readonly schema: z.ZodType;
45
- /** e.g. `'src/data/tuning.data.json'` — read fresh from disk at buildStart. */
46
- readonly sourcePath: string;
47
- }
48
- export interface VgaiDataCheckOptions {
49
- readonly assets: readonly DataCheckAsset[];
50
- /** Project root the `sourcePath`s resolve against. Default: `process.cwd()` (vite build's cwd). */
51
- readonly root?: string;
52
- }
53
- /**
54
- * The fs half of checks 1 + 2, extracted from the plugin hook so it is
55
- * directly unit-testable against a fixture folder (no rollup context needed).
56
- */
57
- export declare function collectDataCheckProblems(options: VgaiDataCheckOptions): {
58
- errors: string[];
59
- warnings: string[];
60
- };
61
- /** True iff a bundled module id is tool code that must never ship (§4). Pure, unit-tested. */
62
- export declare function isToolModuleId(id: string): boolean;
63
- /**
64
- * Build-path validation plugin — see the module doc. Wire it in the project's
65
- * `vite.config.ts`, passing the data-asset registry:
66
- *
67
- * ```ts
68
- * import { vgaiDataCheck } from '@vgai/engine/data/vite-plugin-data';
69
- * import { dataAssets } from './src/data/assets';
70
- * export default defineConfig({
71
- * plugins: [vgaiDataCheck({
72
- * root: __dirname,
73
- * assets: dataAssets.map((a) => ({ schema: a.schema, sourcePath: `src/data/${a.name}.data.json` })),
74
- * })],
75
- * });
76
- * ```
77
- */
78
- export declare function vgaiDataCheck(options: VgaiDataCheckOptions): Plugin;
79
- //# sourceMappingURL=vite-plugin-data.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vite-plugin-data.d.ts","sourceRoot":"","sources":["../../src/data/vite-plugin-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQ7B,4GAA4G;AAC5G,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3C,mGAAmG;IACnG,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAuGD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,oBAAoB,GAAG;IACvE,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CA2DA;AAED,8FAA8F;AAC9F,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAGlD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAmCnE"}