@forgeax/engine-app 0.0.0-dev.8d955ade1c79

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 (348) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +424 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/__tests__/animation-asset-lookup.unit.test.d.ts +2 -0
  5. package/dist/__tests__/animation-asset-lookup.unit.test.d.ts.map +1 -0
  6. package/dist/__tests__/callback-deletion.unit.test.d.ts +2 -0
  7. package/dist/__tests__/callback-deletion.unit.test.d.ts.map +1 -0
  8. package/dist/__tests__/callback-inference.test-d.d.ts +2 -0
  9. package/dist/__tests__/callback-inference.test-d.d.ts.map +1 -0
  10. package/dist/__tests__/component-introspection.unit.test.d.ts +2 -0
  11. package/dist/__tests__/component-introspection.unit.test.d.ts.map +1 -0
  12. package/dist/__tests__/consumer-migration.unit.test.d.ts +2 -0
  13. package/dist/__tests__/consumer-migration.unit.test.d.ts.map +1 -0
  14. package/dist/__tests__/create-app-error-retention.integration.test.d.ts +2 -0
  15. package/dist/__tests__/create-app-error-retention.integration.test.d.ts.map +1 -0
  16. package/dist/__tests__/create-app-features.test.d.ts +2 -0
  17. package/dist/__tests__/create-app-features.test.d.ts.map +1 -0
  18. package/dist/__tests__/create-app-listener-sync.test.d.ts +2 -0
  19. package/dist/__tests__/create-app-listener-sync.test.d.ts.map +1 -0
  20. package/dist/__tests__/create-app-lock-provider.test.d.ts +2 -0
  21. package/dist/__tests__/create-app-lock-provider.test.d.ts.map +1 -0
  22. package/dist/__tests__/create-app-physics-plugin-failure.integration.test.d.ts +2 -0
  23. package/dist/__tests__/create-app-physics-plugin-failure.integration.test.d.ts.map +1 -0
  24. package/dist/__tests__/create-app-plugin.test.d.ts +2 -0
  25. package/dist/__tests__/create-app-plugin.test.d.ts.map +1 -0
  26. package/dist/__tests__/create-app-stop.test.d.ts +2 -0
  27. package/dist/__tests__/create-app-stop.test.d.ts.map +1 -0
  28. package/dist/__tests__/create-app-time.unit.test.d.ts +2 -0
  29. package/dist/__tests__/create-app-time.unit.test.d.ts.map +1 -0
  30. package/dist/__tests__/create-app.test-d.d.ts +2 -0
  31. package/dist/__tests__/create-app.test-d.d.ts.map +1 -0
  32. package/dist/__tests__/create-app.test.d.ts +2 -0
  33. package/dist/__tests__/create-app.test.d.ts.map +1 -0
  34. package/dist/__tests__/create-renderer-error.integration.test.d.ts +2 -0
  35. package/dist/__tests__/create-renderer-error.integration.test.d.ts.map +1 -0
  36. package/dist/__tests__/create-renderer-lifecycle.integration.test.d.ts +2 -0
  37. package/dist/__tests__/create-renderer-lifecycle.integration.test.d.ts.map +1 -0
  38. package/dist/__tests__/docs-gate-green.unit.test.d.ts +2 -0
  39. package/dist/__tests__/docs-gate-green.unit.test.d.ts.map +1 -0
  40. package/dist/__tests__/draw-source-injected-world-update-visibility.test.d.ts +2 -0
  41. package/dist/__tests__/draw-source-injected-world-update-visibility.test.d.ts.map +1 -0
  42. package/dist/__tests__/draw-source-single-world-regression.test.d.ts +2 -0
  43. package/dist/__tests__/draw-source-single-world-regression.test.d.ts.map +1 -0
  44. package/dist/__tests__/engine-worker-bootstrap-channel.unit.test.d.ts +2 -0
  45. package/dist/__tests__/engine-worker-bootstrap-channel.unit.test.d.ts.map +1 -0
  46. package/dist/__tests__/engine-worker-world-swap.unit.test.d.ts +2 -0
  47. package/dist/__tests__/engine-worker-world-swap.unit.test.d.ts.map +1 -0
  48. package/dist/__tests__/errors-pointer-lock-failed.test.d.ts +2 -0
  49. package/dist/__tests__/errors-pointer-lock-failed.test.d.ts.map +1 -0
  50. package/dist/__tests__/execution-bootstrap-isolation.unit.test.d.ts +2 -0
  51. package/dist/__tests__/execution-bootstrap-isolation.unit.test.d.ts.map +1 -0
  52. package/dist/__tests__/execution-error-detail.test-d.d.ts +2 -0
  53. package/dist/__tests__/execution-error-detail.test-d.d.ts.map +1 -0
  54. package/dist/__tests__/execution-error-detail.unit.test.d.ts +2 -0
  55. package/dist/__tests__/execution-error-detail.unit.test.d.ts.map +1 -0
  56. package/dist/__tests__/execution-frame-order.unit.test.d.ts +2 -0
  57. package/dist/__tests__/execution-frame-order.unit.test.d.ts.map +1 -0
  58. package/dist/__tests__/execution-frame-protocol.unit.test.d.ts +2 -0
  59. package/dist/__tests__/execution-frame-protocol.unit.test.d.ts.map +1 -0
  60. package/dist/__tests__/execution-input-sample.contract.test.d.ts +2 -0
  61. package/dist/__tests__/execution-input-sample.contract.test.d.ts.map +1 -0
  62. package/dist/__tests__/execution-measurement.unit.test.d.ts +2 -0
  63. package/dist/__tests__/execution-measurement.unit.test.d.ts.map +1 -0
  64. package/dist/__tests__/execution-public-api.test-d.d.ts +2 -0
  65. package/dist/__tests__/execution-public-api.test-d.d.ts.map +1 -0
  66. package/dist/__tests__/execution-public-api.unit.test.d.ts +2 -0
  67. package/dist/__tests__/execution-public-api.unit.test.d.ts.map +1 -0
  68. package/dist/__tests__/execution-rebuild.contract.test.d.ts +2 -0
  69. package/dist/__tests__/execution-rebuild.contract.test.d.ts.map +1 -0
  70. package/dist/__tests__/execution-report.contract.test.d.ts +2 -0
  71. package/dist/__tests__/execution-report.contract.test.d.ts.map +1 -0
  72. package/dist/__tests__/execution-report.types.test-d.d.ts +2 -0
  73. package/dist/__tests__/execution-report.types.test-d.d.ts.map +1 -0
  74. package/dist/__tests__/execution-schema-freshness.unit.test.d.ts +2 -0
  75. package/dist/__tests__/execution-schema-freshness.unit.test.d.ts.map +1 -0
  76. package/dist/__tests__/execution-selector.unit.test.d.ts +2 -0
  77. package/dist/__tests__/execution-selector.unit.test.d.ts.map +1 -0
  78. package/dist/__tests__/execution-shared-kernel.unit.test.d.ts +2 -0
  79. package/dist/__tests__/execution-shared-kernel.unit.test.d.ts.map +1 -0
  80. package/dist/__tests__/fallback-camera.unit.test.d.ts +2 -0
  81. package/dist/__tests__/fallback-camera.unit.test.d.ts.map +1 -0
  82. package/dist/__tests__/frame-loop-time-elapsed.test.d.ts +2 -0
  83. package/dist/__tests__/frame-loop-time-elapsed.test.d.ts.map +1 -0
  84. package/dist/__tests__/frame-loop-time.unit.test.d.ts +2 -0
  85. package/dist/__tests__/frame-loop-time.unit.test.d.ts.map +1 -0
  86. package/dist/__tests__/frame-loop-world-array.test.d.ts +2 -0
  87. package/dist/__tests__/frame-loop-world-array.test.d.ts.map +1 -0
  88. package/dist/__tests__/kernel-worker-runtime.unit.test.d.ts +2 -0
  89. package/dist/__tests__/kernel-worker-runtime.unit.test.d.ts.map +1 -0
  90. package/dist/__tests__/migration-surface-inventory.unit.test.d.ts +2 -0
  91. package/dist/__tests__/migration-surface-inventory.unit.test.d.ts.map +1 -0
  92. package/dist/__tests__/plugin-policy.integration.test.d.ts +2 -0
  93. package/dist/__tests__/plugin-policy.integration.test.d.ts.map +1 -0
  94. package/dist/__tests__/plugin-profiles.unit.test.d.ts +2 -0
  95. package/dist/__tests__/plugin-profiles.unit.test.d.ts.map +1 -0
  96. package/dist/__tests__/profiler-default-off.test.d.ts +2 -0
  97. package/dist/__tests__/profiler-default-off.test.d.ts.map +1 -0
  98. package/dist/__tests__/profiler-frame-token.test.d.ts +2 -0
  99. package/dist/__tests__/profiler-frame-token.test.d.ts.map +1 -0
  100. package/dist/__tests__/profiler-phase-catalog.test.d.ts +2 -0
  101. package/dist/__tests__/profiler-phase-catalog.test.d.ts.map +1 -0
  102. package/dist/__tests__/profiler-phase-integration.test.d.ts +2 -0
  103. package/dist/__tests__/profiler-phase-integration.test.d.ts.map +1 -0
  104. package/dist/__tests__/profiler-remote-bridge.test.d.ts +2 -0
  105. package/dist/__tests__/profiler-remote-bridge.test.d.ts.map +1 -0
  106. package/dist/__tests__/remote-integration.test.d.ts +2 -0
  107. package/dist/__tests__/remote-integration.test.d.ts.map +1 -0
  108. package/dist/__tests__/rhi-capture-capability.test-d.d.ts +2 -0
  109. package/dist/__tests__/rhi-capture-capability.test-d.d.ts.map +1 -0
  110. package/dist/__tests__/rhi-capture-host.integration.test.d.ts +2 -0
  111. package/dist/__tests__/rhi-capture-host.integration.test.d.ts.map +1 -0
  112. package/dist/__tests__/rhi-capture.browser.test.d.ts +2 -0
  113. package/dist/__tests__/rhi-capture.browser.test.d.ts.map +1 -0
  114. package/dist/__tests__/surface-handoff.test.d.ts +2 -0
  115. package/dist/__tests__/surface-handoff.test.d.ts.map +1 -0
  116. package/dist/__tests__/types-m2.test-d.d.ts +2 -0
  117. package/dist/__tests__/types-m2.test-d.d.ts.map +1 -0
  118. package/dist/__tests__/visibility-remote.integration.test.d.ts +2 -0
  119. package/dist/__tests__/visibility-remote.integration.test.d.ts.map +1 -0
  120. package/dist/__tests__/worker-execution-stop.test.d.ts +2 -0
  121. package/dist/__tests__/worker-execution-stop.test.d.ts.map +1 -0
  122. package/dist/animation-asset-lookup.d.ts +7 -0
  123. package/dist/animation-asset-lookup.d.ts.map +1 -0
  124. package/dist/browser-frame-signal.d.ts +17 -0
  125. package/dist/browser-frame-signal.d.ts.map +1 -0
  126. package/dist/canvas-policy.d.ts +4 -0
  127. package/dist/canvas-policy.d.ts.map +1 -0
  128. package/dist/create-app.d.ts +78 -0
  129. package/dist/create-app.d.ts.map +1 -0
  130. package/dist/engine-worker-runtime.mjs +827 -0
  131. package/dist/engine-worker-runtime.mjs.map +1 -0
  132. package/dist/errors.d.ts +254 -0
  133. package/dist/errors.d.ts.map +1 -0
  134. package/dist/execution/attached-world-swap.d.ts +10 -0
  135. package/dist/execution/attached-world-swap.d.ts.map +1 -0
  136. package/dist/execution/bootstrap-entry.d.ts +30 -0
  137. package/dist/execution/bootstrap-entry.d.ts.map +1 -0
  138. package/dist/execution/bootstrap-url.d.ts +5 -0
  139. package/dist/execution/bootstrap-url.d.ts.map +1 -0
  140. package/dist/execution/capabilities.d.ts +5 -0
  141. package/dist/execution/capabilities.d.ts.map +1 -0
  142. package/dist/execution/control.d.ts +12 -0
  143. package/dist/execution/control.d.ts.map +1 -0
  144. package/dist/execution/engine-worker-runtime.d.ts +2 -0
  145. package/dist/execution/engine-worker-runtime.d.ts.map +1 -0
  146. package/dist/execution/engine-worker.d.ts +24 -0
  147. package/dist/execution/engine-worker.d.ts.map +1 -0
  148. package/dist/execution/host-controller.d.ts +16 -0
  149. package/dist/execution/host-controller.d.ts.map +1 -0
  150. package/dist/execution/index.d.ts +10 -0
  151. package/dist/execution/index.d.ts.map +1 -0
  152. package/dist/execution/kernel-pool.d.ts +14 -0
  153. package/dist/execution/kernel-pool.d.ts.map +1 -0
  154. package/dist/execution/kernel-worker-runtime.d.ts +2 -0
  155. package/dist/execution/kernel-worker-runtime.d.ts.map +1 -0
  156. package/dist/execution/measurement.d.ts +7 -0
  157. package/dist/execution/measurement.d.ts.map +1 -0
  158. package/dist/execution/protocol.d.ts +87 -0
  159. package/dist/execution/protocol.d.ts.map +1 -0
  160. package/dist/execution/report.d.ts +5 -0
  161. package/dist/execution/report.d.ts.map +1 -0
  162. package/dist/execution/schema.d.ts +4 -0
  163. package/dist/execution/schema.d.ts.map +1 -0
  164. package/dist/execution/selector.d.ts +10 -0
  165. package/dist/execution/selector.d.ts.map +1 -0
  166. package/dist/execution/types.d.ts +123 -0
  167. package/dist/execution/types.d.ts.map +1 -0
  168. package/dist/fallback-camera.d.ts +8 -0
  169. package/dist/fallback-camera.d.ts.map +1 -0
  170. package/dist/game-context.d.ts +98 -0
  171. package/dist/game-context.d.ts.map +1 -0
  172. package/dist/index.d.ts +27 -0
  173. package/dist/index.d.ts.map +1 -0
  174. package/dist/index.mjs +3980 -0
  175. package/dist/index.mjs.map +1 -0
  176. package/dist/input-map-plugin.d.ts +5 -0
  177. package/dist/input-map-plugin.d.ts.map +1 -0
  178. package/dist/input-plugin.d.ts +4 -0
  179. package/dist/input-plugin.d.ts.map +1 -0
  180. package/dist/internal/assembled-engine-profile.d.ts +5 -0
  181. package/dist/internal/assembled-engine-profile.d.ts.map +1 -0
  182. package/dist/internal/assets-world-plugin.d.ts +7 -0
  183. package/dist/internal/assets-world-plugin.d.ts.map +1 -0
  184. package/dist/internal/browser-remote-bridge.d.ts +24 -0
  185. package/dist/internal/browser-remote-bridge.d.ts.map +1 -0
  186. package/dist/internal/browser-rhi-debug-runtime.d.ts +18 -0
  187. package/dist/internal/browser-rhi-debug-runtime.d.ts.map +1 -0
  188. package/dist/internal/component-introspection.d.ts +24 -0
  189. package/dist/internal/component-introspection.d.ts.map +1 -0
  190. package/dist/internal/debug-draw.d.ts +9 -0
  191. package/dist/internal/debug-draw.d.ts.map +1 -0
  192. package/dist/internal/ecs-import.d.ts +6 -0
  193. package/dist/internal/ecs-import.d.ts.map +1 -0
  194. package/dist/internal/engine-profile-common.d.ts +9 -0
  195. package/dist/internal/engine-profile-common.d.ts.map +1 -0
  196. package/dist/internal/error-fanout.d.ts +66 -0
  197. package/dist/internal/error-fanout.d.ts.map +1 -0
  198. package/dist/internal/frame-loop.d.ts +38 -0
  199. package/dist/internal/frame-loop.d.ts.map +1 -0
  200. package/dist/internal/input-attach.d.ts +44 -0
  201. package/dist/internal/input-attach.d.ts.map +1 -0
  202. package/dist/internal/main-engine-profile.d.ts +19 -0
  203. package/dist/internal/main-engine-profile.d.ts.map +1 -0
  204. package/dist/internal/remote-serve-flag.d.ts +19 -0
  205. package/dist/internal/remote-serve-flag.d.ts.map +1 -0
  206. package/dist/internal/remote-server-plugin.d.ts +8 -0
  207. package/dist/internal/remote-server-plugin.d.ts.map +1 -0
  208. package/dist/internal/rhi-capture.d.ts +19 -0
  209. package/dist/internal/rhi-capture.d.ts.map +1 -0
  210. package/dist/internal/rhi-debug-flag.d.ts +18 -0
  211. package/dist/internal/rhi-debug-flag.d.ts.map +1 -0
  212. package/dist/internal/worker-engine-profile.d.ts +15 -0
  213. package/dist/internal/worker-engine-profile.d.ts.map +1 -0
  214. package/dist/kernel-worker-runtime.mjs +69 -0
  215. package/dist/kernel-worker-runtime.mjs.map +1 -0
  216. package/dist/load-game-errors.d.ts +131 -0
  217. package/dist/load-game-errors.d.ts.map +1 -0
  218. package/dist/load-game.d.ts +34 -0
  219. package/dist/load-game.d.ts.map +1 -0
  220. package/dist/plugin-factories.d.ts +3 -0
  221. package/dist/plugin-factories.d.ts.map +1 -0
  222. package/dist/renderer-plugin.d.ts +25 -0
  223. package/dist/renderer-plugin.d.ts.map +1 -0
  224. package/dist/tool-preview/bootstrap.d.ts +113 -0
  225. package/dist/tool-preview/bootstrap.d.ts.map +1 -0
  226. package/dist/tool-preview/evidence.d.ts +20 -0
  227. package/dist/tool-preview/evidence.d.ts.map +1 -0
  228. package/dist/tool-preview/framing.d.ts +13 -0
  229. package/dist/tool-preview/framing.d.ts.map +1 -0
  230. package/dist/tool-preview/recipe.d.ts +54 -0
  231. package/dist/tool-preview/recipe.d.ts.map +1 -0
  232. package/dist/types.d.ts +404 -0
  233. package/dist/types.d.ts.map +1 -0
  234. package/package.json +85 -0
  235. package/schema/execution-report.schema.json +168 -0
  236. package/src/__tests__/animation-asset-lookup.unit.test.ts +20 -0
  237. package/src/__tests__/callback-deletion.unit.test.ts +14 -0
  238. package/src/__tests__/callback-inference.test-d.ts +36 -0
  239. package/src/__tests__/component-introspection.unit.test.ts +56 -0
  240. package/src/__tests__/consumer-migration.unit.test.ts +34 -0
  241. package/src/__tests__/create-app-error-retention.integration.test.ts +125 -0
  242. package/src/__tests__/create-app-features.test.ts +51 -0
  243. package/src/__tests__/create-app-listener-sync.test.ts +381 -0
  244. package/src/__tests__/create-app-lock-provider.test.ts +212 -0
  245. package/src/__tests__/create-app-physics-plugin-failure.integration.test.ts +142 -0
  246. package/src/__tests__/create-app-plugin.test.ts +217 -0
  247. package/src/__tests__/create-app-stop.test.ts +609 -0
  248. package/src/__tests__/create-app-time.unit.test.ts +26 -0
  249. package/src/__tests__/create-app.test-d.ts +83 -0
  250. package/src/__tests__/create-app.test.ts +287 -0
  251. package/src/__tests__/create-renderer-error.integration.test.ts +25 -0
  252. package/src/__tests__/create-renderer-lifecycle.integration.test.ts +24 -0
  253. package/src/__tests__/docs-gate-green.unit.test.ts +61 -0
  254. package/src/__tests__/draw-source-injected-world-update-visibility.test.ts +176 -0
  255. package/src/__tests__/draw-source-single-world-regression.test.ts +184 -0
  256. package/src/__tests__/engine-worker-bootstrap-channel.unit.test.ts +82 -0
  257. package/src/__tests__/engine-worker-world-swap.unit.test.ts +69 -0
  258. package/src/__tests__/errors-pointer-lock-failed.test.ts +265 -0
  259. package/src/__tests__/execution-bootstrap-isolation.unit.test.ts +79 -0
  260. package/src/__tests__/execution-error-detail.test-d.ts +13 -0
  261. package/src/__tests__/execution-error-detail.unit.test.ts +35 -0
  262. package/src/__tests__/execution-frame-order.unit.test.ts +38 -0
  263. package/src/__tests__/execution-frame-protocol.unit.test.ts +60 -0
  264. package/src/__tests__/execution-input-sample.contract.test.ts +23 -0
  265. package/src/__tests__/execution-measurement.unit.test.ts +20 -0
  266. package/src/__tests__/execution-public-api.test-d.ts +14 -0
  267. package/src/__tests__/execution-public-api.unit.test.ts +9 -0
  268. package/src/__tests__/execution-rebuild.contract.test.ts +36 -0
  269. package/src/__tests__/execution-report.contract.test.ts +50 -0
  270. package/src/__tests__/execution-report.types.test-d.ts +16 -0
  271. package/src/__tests__/execution-schema-freshness.unit.test.ts +20 -0
  272. package/src/__tests__/execution-selector.unit.test.ts +72 -0
  273. package/src/__tests__/execution-shared-kernel.unit.test.ts +180 -0
  274. package/src/__tests__/fallback-camera.unit.test.ts +32 -0
  275. package/src/__tests__/frame-loop-time-elapsed.test.ts +115 -0
  276. package/src/__tests__/frame-loop-time.unit.test.ts +61 -0
  277. package/src/__tests__/frame-loop-world-array.test.ts +450 -0
  278. package/src/__tests__/kernel-worker-runtime.unit.test.ts +50 -0
  279. package/src/__tests__/migration-surface-inventory.unit.test.ts +13 -0
  280. package/src/__tests__/plugin-policy.integration.test.ts +15 -0
  281. package/src/__tests__/plugin-profiles.unit.test.ts +190 -0
  282. package/src/__tests__/profiler-default-off.test.ts +53 -0
  283. package/src/__tests__/profiler-frame-token.test.ts +235 -0
  284. package/src/__tests__/profiler-phase-catalog.test.ts +30 -0
  285. package/src/__tests__/profiler-phase-integration.test.ts +117 -0
  286. package/src/__tests__/profiler-remote-bridge.test.ts +31 -0
  287. package/src/__tests__/remote-integration.test.ts +224 -0
  288. package/src/__tests__/rhi-capture-capability.test-d.ts +22 -0
  289. package/src/__tests__/rhi-capture-host.integration.test.ts +157 -0
  290. package/src/__tests__/rhi-capture.browser.test.ts +51 -0
  291. package/src/__tests__/surface-handoff.test.ts +89 -0
  292. package/src/__tests__/types-m2.test-d.ts +81 -0
  293. package/src/__tests__/visibility-remote.integration.test.ts +116 -0
  294. package/src/__tests__/worker-execution-stop.test.ts +173 -0
  295. package/src/animation-asset-lookup.ts +13 -0
  296. package/src/browser-frame-signal.ts +44 -0
  297. package/src/canvas-policy.ts +16 -0
  298. package/src/create-app.ts +1264 -0
  299. package/src/errors.ts +442 -0
  300. package/src/execution/attached-world-swap.ts +33 -0
  301. package/src/execution/bootstrap-entry.ts +122 -0
  302. package/src/execution/bootstrap-url.ts +25 -0
  303. package/src/execution/capabilities.ts +102 -0
  304. package/src/execution/control.ts +48 -0
  305. package/src/execution/engine-worker-runtime.ts +383 -0
  306. package/src/execution/engine-worker.ts +163 -0
  307. package/src/execution/host-controller.ts +460 -0
  308. package/src/execution/index.ts +44 -0
  309. package/src/execution/kernel-pool.ts +236 -0
  310. package/src/execution/kernel-worker-runtime.ts +103 -0
  311. package/src/execution/measurement.ts +39 -0
  312. package/src/execution/protocol.ts +134 -0
  313. package/src/execution/report.ts +66 -0
  314. package/src/execution/schema.ts +168 -0
  315. package/src/execution/selector.ts +98 -0
  316. package/src/execution/types.ts +163 -0
  317. package/src/fallback-camera.ts +20 -0
  318. package/src/game-context.ts +126 -0
  319. package/src/index.ts +190 -0
  320. package/src/input-map-plugin.ts +21 -0
  321. package/src/input-plugin.ts +26 -0
  322. package/src/internal/assembled-engine-profile.ts +14 -0
  323. package/src/internal/assets-world-plugin.ts +33 -0
  324. package/src/internal/browser-remote-bridge.ts +269 -0
  325. package/src/internal/browser-rhi-debug-runtime.ts +67 -0
  326. package/src/internal/component-introspection.ts +116 -0
  327. package/src/internal/debug-draw.ts +38 -0
  328. package/src/internal/ecs-import.ts +41 -0
  329. package/src/internal/engine-profile-common.ts +9 -0
  330. package/src/internal/error-fanout.ts +129 -0
  331. package/src/internal/frame-loop.ts +539 -0
  332. package/src/internal/input-attach.ts +104 -0
  333. package/src/internal/main-engine-profile.ts +84 -0
  334. package/src/internal/remote-serve-flag.ts +41 -0
  335. package/src/internal/remote-server-plugin.ts +16 -0
  336. package/src/internal/rhi-capture.ts +211 -0
  337. package/src/internal/rhi-debug-flag.ts +40 -0
  338. package/src/internal/worker-engine-profile.ts +47 -0
  339. package/src/load-game-errors.ts +211 -0
  340. package/src/load-game.ts +115 -0
  341. package/src/plugin-factories.ts +2 -0
  342. package/src/renderer-plugin.ts +96 -0
  343. package/src/tool-preview/bootstrap.ts +835 -0
  344. package/src/tool-preview/evidence.ts +59 -0
  345. package/src/tool-preview/framing.ts +52 -0
  346. package/src/tool-preview/recipe.ts +137 -0
  347. package/src/types.ts +450 -0
  348. package/src/vite-env.d.ts +10 -0
@@ -0,0 +1,5 @@
1
+ import { type ActionConfig } from '@forgeax/engine-input';
2
+ import type { Plugin } from '@forgeax/engine-plugin';
3
+ /** Install the canvas-form action map as an App-owned World contribution. */
4
+ export declare function inputMapPlugin(configs: readonly ActionConfig[]): Plugin;
5
+ //# sourceMappingURL=input-map-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-map-plugin.d.ts","sourceRoot":"","sources":["../src/input-map-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAiB,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,CAgBvE"}
@@ -0,0 +1,4 @@
1
+ import type { Plugin } from '@forgeax/engine-plugin';
2
+ /** Project one Host-owned input provider into reversible World contributions. */
3
+ export declare function inputPlugin(): Plugin;
4
+ //# sourceMappingURL=input-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-plugin.d.ts","sourceRoot":"","sources":["../src/input-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,iFAAiF;AACjF,wBAAgB,WAAW,IAAI,MAAM,CAoBpC"}
@@ -0,0 +1,5 @@
1
+ import type { Plugin } from '@forgeax/engine-plugin';
2
+ import type { EngineProfileBase } from './engine-profile-common';
3
+ /** Assemble-form roots plus explicitly selected host capabilities. */
4
+ export declare function assembledEngineProfile(options: EngineProfileBase): Plugin[];
5
+ //# sourceMappingURL=assembled-engine-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assembled-engine-profile.d.ts","sourceRoot":"","sources":["../../src/internal/assembled-engine-profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,sEAAsE;AACtE,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,EAAE,CAO3E"}
@@ -0,0 +1,7 @@
1
+ import type { AssetRegistry } from '@forgeax/engine-assets-runtime';
2
+ import type { Plugin } from '@forgeax/engine-plugin';
3
+ /** Project the Renderer-owned AssetRegistry as a declared dependent service. */
4
+ export declare function rendererAssetsPlugin(assets: AssetRegistry | undefined): Plugin;
5
+ /** Project the realm AssetRegistry into legacy World resource lookup reversibly. */
6
+ export declare function assetsWorldPlugin(): Plugin;
7
+ //# sourceMappingURL=assets-world-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets-world-plugin.d.ts","sourceRoot":"","sources":["../../src/internal/assets-world-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAIrD,gFAAgF;AAChF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,GAAG,SAAS,GAAG,MAAM,CAS9E;AAED,oFAAoF;AACpF,wBAAgB,iBAAiB,IAAI,MAAM,CAc1C"}
@@ -0,0 +1,24 @@
1
+ import { type World } from '@forgeax/engine-ecs';
2
+ export interface BrowserRemoteBridgeDeps {
3
+ readonly world: World;
4
+ readonly renderer: unknown;
5
+ readonly assets: unknown;
6
+ /** The host's already-loaded runtime namespace; preserves component-token identity. */
7
+ readonly runtimeModule: unknown;
8
+ readonly rhiCapture?: unknown;
9
+ /** The host's explicit CPU profiler capability, when opted in. */
10
+ readonly profiler?: unknown;
11
+ readonly execution?: unknown;
12
+ /** Relay port. */
13
+ readonly port: string;
14
+ }
15
+ /**
16
+ * Install the DEV-only browser remote bridge. Idempotent per call site; the
17
+ * caller gates on import.meta.env.DEV so this never runs in production.
18
+ *
19
+ * Returns a teardown function that stops reconnection and closes the socket —
20
+ * the caller wires it to import.meta.hot.dispose so a vite HMR of the host app
21
+ * does not stack duplicate bridges.
22
+ */
23
+ export declare function installBrowserRemoteBridge(deps: BrowserRemoteBridgeDeps): Promise<() => void>;
24
+ //# sourceMappingURL=browser-remote-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-remote-bridge.d.ts","sourceRoot":"","sources":["../../src/internal/browser-remote-bridge.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAU,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AA8CzD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,uFAAuF;IACvF,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,kBAAkB;IAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AA0BD;;;;;;;GAOG;AACH,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,MAAM,IAAI,CAAC,CAqJrB"}
@@ -0,0 +1,18 @@
1
+ import type { Renderer } from '@forgeax/engine-render';
2
+ import type { RhiDevice, RhiInstance } from '@forgeax/engine-rhi';
3
+ import type { CreateShaderModuleFn, RecorderAttachment } from '@forgeax/engine-rhi-debug';
4
+ export interface BrowserRhiDebugRuntime {
5
+ readonly rhi: RhiInstance;
6
+ readonly attachment: RecorderAttachment;
7
+ readonly createReplayDevice: () => Promise<import('@forgeax/engine-types').Result<RhiDevice, unknown>>;
8
+ readonly createShaderModule: CreateShaderModuleFn;
9
+ readonly rhiInstrumentation: import('@forgeax/engine-render/internal/construct-renderer').RhiBackendInstrumentation;
10
+ attachRenderer(renderer: Renderer): () => void;
11
+ }
12
+ /**
13
+ * Assemble the browser preview's recorder at the Runtime seam. The preview
14
+ * host owns the attachment and consumes only the encoded tape; it does not
15
+ * reach into recorder state or reintroduce the removed DebugRhi facade.
16
+ */
17
+ export declare function createBrowserRhiDebugRuntime(): Promise<BrowserRhiDebugRuntime>;
18
+ //# sourceMappingURL=browser-rhi-debug-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-rhi-debug-runtime.d.ts","sourceRoot":"","sources":["../../src/internal/browser-rhi-debug-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EACV,oBAAoB,EAEpB,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AAInC,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;IACxC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,OAAO,CACxC,OAAO,uBAAuB,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAC3D,CAAC;IACF,QAAQ,CAAC,kBAAkB,EAAE,oBAAoB,CAAC;IAClD,QAAQ,CAAC,kBAAkB,EAAE,OAAO,oDAAoD,EAAE,yBAAyB,CAAC;IACpH,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAC;CAChD;AAmBD;;;;GAIG;AACH,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAuBpF"}
@@ -0,0 +1,24 @@
1
+ import { type Component } from '@forgeax/engine-ecs';
2
+ export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
3
+ readonly [key: string]: JsonValue;
4
+ };
5
+ export interface ComponentIntrospectionField {
6
+ readonly type: string;
7
+ readonly default?: JsonValue;
8
+ readonly shape?: string;
9
+ readonly transient?: boolean;
10
+ readonly arrayMeta?: {
11
+ readonly elementType: string;
12
+ readonly length?: number;
13
+ };
14
+ readonly labels?: Readonly<Record<string, number>>;
15
+ }
16
+ export interface ComponentIntrospectionDescriptor {
17
+ readonly name: string;
18
+ readonly schema: Readonly<Record<string, string>>;
19
+ readonly fields: Readonly<Record<string, ComponentIntrospectionField>>;
20
+ readonly meta: Readonly<Record<string, JsonValue>>;
21
+ }
22
+ /** Project one World-local component catalog into transport-safe data. */
23
+ export declare function projectComponentIntrospection(components: ReadonlyMap<string, Component>): readonly ComponentIntrospectionDescriptor[];
24
+ //# sourceMappingURL=component-introspection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-introspection.d.ts","sourceRoot":"","sources":["../../src/internal/component-introspection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA6C,MAAM,qBAAqB,CAAC;AAGhG,MAAM,MAAM,SAAS,GACjB,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,SAAS,SAAS,EAAE,GACpB;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE1C,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE;QACnB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC,CAAC;IACvE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;CACpD;AA8ED,0EAA0E;AAC1E,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,GACzC,SAAS,gCAAgC,EAAE,CAM7C"}
@@ -0,0 +1,9 @@
1
+ import type { DebugDraw } from '@forgeax/engine-debug-draw';
2
+ import type { RendererHostAssembly } from '@forgeax/engine-render/internal/construct-renderer';
3
+ import type { TextureFormat } from '@forgeax/engine-rhi';
4
+ export type RendererDebugDrawHost = Pick<RendererHostAssembly['debugDrawHost'], 'initialization' | 'device' | '_internal_createShaderModule' | '_internal_setRenderOverlay'>;
5
+ /** Create the App-owned debug overlay after the renderer has initialized. */
6
+ export declare function createDebugDrawOnReady(context: RendererDebugDrawHost, format?: TextureFormat): Promise<DebugDraw>;
7
+ /** Release the App-owned debug overlay and clear its Render capability. */
8
+ export declare function releaseDebugDraw(context: RendererDebugDrawHost, debugDraw: DebugDraw): void;
9
+ //# sourceMappingURL=debug-draw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-draw.d.ts","sourceRoot":"","sources":["../../src/internal/debug-draw.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,oBAAoB,CAAC,eAAe,CAAC,EACrC,gBAAgB,GAAG,QAAQ,GAAG,8BAA8B,GAAG,4BAA4B,CAC5F,CAAC;AAEF,6EAA6E;AAC7E,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,qBAAqB,EAC9B,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,SAAS,CAAC,CAgBpB;AAED,2EAA2E;AAC3E,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CAG3F"}
@@ -0,0 +1,6 @@
1
+ export declare const ECS_PUBLIC_SYMBOLS: readonly ["World", "Entity", "Update", "FixedUpdate", "Time", "FixedTime"];
2
+ export type EcsPublicSymbol = (typeof ECS_PUBLIC_SYMBOLS)[number];
3
+ export type EcsPublicModule = Readonly<Partial<Record<EcsPublicSymbol, unknown>>>;
4
+ export declare function projectEcsPublicModule(value: unknown): EcsPublicModule;
5
+ export declare function createEcsImportModule(importModule: (specifier: string) => Promise<unknown>): (specifier: string) => Promise<unknown>;
6
+ //# sourceMappingURL=ecs-import.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ecs-import.d.ts","sourceRoot":"","sources":["../../src/internal/ecs-import.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,kBAAkB,4EAOpB,CAAC;AAEZ,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAClE,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AAMlF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAOtE;AAED,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GACpD,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAKzC"}
@@ -0,0 +1,9 @@
1
+ import type { AssetRegistry } from '@forgeax/engine-assets-runtime';
2
+ import type { Plugin } from '@forgeax/engine-plugin';
3
+ import type { Renderer } from '@forgeax/engine-render';
4
+ export interface EngineProfileBase {
5
+ readonly renderer: Renderer;
6
+ readonly assets?: AssetRegistry;
7
+ readonly extensions?: readonly Plugin[];
8
+ }
9
+ //# sourceMappingURL=engine-profile-common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-profile-common.d.ts","sourceRoot":"","sources":["../../src/internal/engine-profile-common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC"}
@@ -0,0 +1,66 @@
1
+ import type { AppDispatchError } from '../types';
2
+ /**
3
+ * Listener callback for app-shell error fan-out.
4
+ *
5
+ * The narrow union (`AppDispatchError` = AppError | RhiError | RuntimeError)
6
+ * deliberately excludes raw `Error` (charter P3 explicit failure: AI users
7
+ * walk `.code` not message strings). `RuntimeError` is included so a
8
+ * runtime-layer error fanned out by `Renderer.onError` (e.g.
9
+ * `'equirect-projection-failed'`) reaches host App listeners verbatim
10
+ * (feat-20260531-skybox-env-background F-1). `EngineEnvironmentError` does not
11
+ * appear here because construction-time failure flows through
12
+ * `Promise<Result<App, ...>>` of `createApp(canvas)` before the App handle
13
+ * exists; once an App handle is alive, only frame-time errors (this union)
14
+ * reach onError.
15
+ */
16
+ export type ErrorFanoutListener = (err: AppDispatchError) => void;
17
+ /**
18
+ * Constructor options for ErrorFanoutRegistry. Mirrors the
19
+ * `silenceUnhandledErrors` field on CreateAppOptions / AppAssembleArgs;
20
+ * createApp threads the field down into the registry verbatim.
21
+ */
22
+ export interface ErrorFanoutOptions {
23
+ readonly silenceUnhandledErrors?: boolean;
24
+ }
25
+ /**
26
+ * ErrorFanoutRegistry shares its shape with the LostListenerRegistry
27
+ * implementation in `packages/runtime/src/createRenderer.ts:532-566` per
28
+ * plan-strategy D-9 -- listener set + fan-out fire + idempotent unsubscribe.
29
+ * The two divergences from the runtime registry are intentional:
30
+ *
31
+ * 1. Late-attach replay is NOT implemented -- rAF errors are a frame-time
32
+ * stream (each tick produces fresh state) so replay semantics are
33
+ * meaningless and would mislead newly registered listeners.
34
+ * 2. `console.error(err)` fallback fires when the listener set is empty
35
+ * and `silenceUnhandledErrors !== true` -- a charter P3 tribute that
36
+ * makes "unhandled" errors loud rather than silent.
37
+ */
38
+ export declare class ErrorFanoutRegistry {
39
+ private readonly listeners;
40
+ private readonly silenceUnhandledErrors;
41
+ constructor(opts?: ErrorFanoutOptions);
42
+ /**
43
+ * Register a listener. Returns an unsubscribe function. Calling
44
+ * unsubscribe more than once is a safe no-op (Set.delete returns
45
+ * false on the second call but does not throw). Re-registering the
46
+ * same listener function is a no-op (Set semantics).
47
+ */
48
+ add(cb: ErrorFanoutListener): () => void;
49
+ /**
50
+ * Iterate over a snapshot of the listener set so a listener that
51
+ * mutates the set mid-fire does not perturb the iteration. When the
52
+ * set is empty AND silenceUnhandledErrors !== true, call
53
+ * console.error(err) so the unhandled error is visible in devtools
54
+ * (charter P3 explicit failure: silent drop is a footgun).
55
+ */
56
+ fire(err: AppDispatchError): void;
57
+ /**
58
+ * Number of currently registered listeners. Reserved for diagnostics +
59
+ * test fixtures (e.g. asserting cleanup paths reach the registry); not
60
+ * part of the public app-shell surface.
61
+ *
62
+ * @internal
63
+ */
64
+ _size(): number;
65
+ }
66
+ //# sourceMappingURL=error-fanout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-fanout.d.ts","sourceRoot":"","sources":["../../src/internal/error-fanout.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAElE;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAC3C;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAuC;IACjE,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAU;gBAErC,IAAI,GAAE,kBAAuB;IAIzC;;;;;OAKG;IACH,GAAG,CAAC,EAAE,EAAE,mBAAmB,GAAG,MAAM,IAAI;IAOxC;;;;;;OAMG;IACH,IAAI,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI;IAcjC;;;;;;OAMG;IACH,KAAK,IAAI,MAAM;CAGhB"}
@@ -0,0 +1,38 @@
1
+ import type { World } from '@forgeax/engine-ecs';
2
+ import type { Profiler } from '@forgeax/engine-profiler';
3
+ import type { RenderError, Renderer } from '@forgeax/engine-render';
4
+ import { type Result } from '@forgeax/engine-types';
5
+ import { AppError } from '../errors';
6
+ export type FrameState = 'idle' | 'running' | 'paused' | 'stopped';
7
+ export interface FrameLoopOptions {
8
+ readonly world: World;
9
+ readonly renderer: Renderer;
10
+ readonly onError?: (e: AppError | RenderError) => void;
11
+ /** Optional dev-only RHI recorder hook; called once after each frame draw. */
12
+ readonly debugRhi?: {
13
+ onFrameEnd(): void;
14
+ };
15
+ readonly now?: () => number;
16
+ readonly raf?: (cb: (t: number) => void) => number;
17
+ readonly caf?: (id: number) => void;
18
+ readonly profiler?: Profiler;
19
+ readonly drawSource?: () => {
20
+ worlds: readonly World[];
21
+ cameraOwner: number;
22
+ resourceOwner: number;
23
+ } | undefined;
24
+ }
25
+ export interface FrameLoopHandle {
26
+ start(): Result<void, AppError>;
27
+ stop(): Result<void, AppError>;
28
+ pause(): Result<void, AppError>;
29
+ resume(): Result<void, AppError>;
30
+ /** Run one complete update/draw frame through this loop while paused. */
31
+ stepFrame(deltaSeconds: number): Result<void, AppError | RenderError>;
32
+ /** Replace the per-frame world routing pull without replacing the loop. */
33
+ setDrawSource(drawSource: FrameLoopOptions['drawSource']): void;
34
+ getState(): FrameState;
35
+ setStopped(): void;
36
+ }
37
+ export declare function createFrameLoop(opts: FrameLoopOptions): FrameLoopHandle;
38
+ //# sourceMappingURL=frame-loop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame-loop.d.ts","sourceRoot":"","sources":["../../src/internal/frame-loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAqB,QAAQ,EAAmB,MAAM,0BAA0B,CAAC;AAC7F,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAoB,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAGrC,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEnE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,GAAG,WAAW,KAAK,IAAI,CAAC;IACvD,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAAE,UAAU,IAAI,IAAI,CAAA;KAAE,CAAC;IAC3C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,KAAK,MAAM,CAAC;IACnD,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAClB;QAAE,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,GACxE,SAAS,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,IAAI,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAChC,IAAI,IAAI,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/B,KAAK,IAAI,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAChC,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACjC,yEAAyE;IACzE,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,WAAW,CAAC,CAAC;IACtE,2EAA2E;IAC3E,aAAa,CAAC,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;IAChE,QAAQ,IAAI,UAAU,CAAC;IACvB,UAAU,IAAI,IAAI,CAAC;CACpB;AA+HD,wBAAgB,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,eAAe,CAsXvE"}
@@ -0,0 +1,44 @@
1
+ import { type InputBackend, type PointerLockProvider, type VirtualJoystickConfig } from '@forgeax/engine-input';
2
+ import { AppError } from '../errors';
3
+ /**
4
+ * Handle returned by attachInputAuto. Captures the backend (exposed via
5
+ * App.input), the detach callable, and a cleanup() funnel that the
6
+ * frame-loop / app-stop / device-lost paths share (R-4).
7
+ */
8
+ export interface InputAttachHandle {
9
+ readonly backend: InputBackend;
10
+ cleanup(): void;
11
+ /**
12
+ * M2: install the error dispatch callback for onLockError events.
13
+ * Must be called by createApp after the ErrorFanoutRegistry is created
14
+ * (the dispatch function is created after attachInputAuto returns).
15
+ * Idempotent — subsequent calls replace the previous callback.
16
+ */
17
+ setOnErrorDispatch(fn: (err: AppError) => void): void;
18
+ }
19
+ /**
20
+ * Acquire a browser input backend. This Host helper owns only DOM listeners;
21
+ * the Cordis input plugin owns every World resource and system contribution.
22
+ */
23
+ /**
24
+ * Options forwarded to attachBrowserInputBackend at attach time. Currently only
25
+ * the neutral PointerLock gate (host decides whether a canvas click captures the
26
+ * cursor); the backend stays host-opaque. Optional so existing call sites are
27
+ * unchanged.
28
+ */
29
+ export interface InputAttachOptions {
30
+ /** Host-owned UI root used to route Shadow DOM events away from gameplay. */
31
+ readonly uiRoot?: Node;
32
+ readonly pointerLockAllowed?: () => boolean;
33
+ /** M3: virtual joystick configurations passed through to browser backend. */
34
+ readonly virtualJoysticks?: readonly VirtualJoystickConfig[];
35
+ /**
36
+ * M2: pointer-lock provider injected by the host (e.g. editor play-runtime).
37
+ * Forwarded to BrowserInputBackendOptions.lockProvider. When absent, the
38
+ * backend falls back to the W3C requestPointerLock() path.
39
+ * Type SSOT is @forgeax/engine-input's PointerLockProvider.
40
+ */
41
+ readonly lockProvider?: PointerLockProvider;
42
+ }
43
+ export declare function attachInputAuto(canvas: HTMLCanvasElement, options?: InputAttachOptions): InputAttachHandle;
44
+ //# sourceMappingURL=input-attach.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-attach.d.ts","sourceRoot":"","sources":["../../src/internal/input-attach.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC3B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAiC,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEpE;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,OAAO,IAAI,IAAI,CAAC;IAChB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,GAAG,IAAI,CAAC;CACvD;AAED;;;GAGG;AACH;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC;IAC5C,6EAA6E;IAC7E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC7D;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,mBAAmB,CAAC;CAC7C;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,iBAAiB,EACzB,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,CAgDnB"}
@@ -0,0 +1,19 @@
1
+ import { type AnimationPayloadLookup } from '@forgeax/engine-animation';
2
+ import type { DebugDraw } from '@forgeax/engine-debug-draw';
3
+ import { type ActionConfig, type InputBackend } from '@forgeax/engine-input';
4
+ import type { Plugin } from '@forgeax/engine-plugin';
5
+ import { type RenderFeatureHost } from '../renderer-plugin';
6
+ import { type RendererDebugDrawHost } from './debug-draw';
7
+ import type { EngineProfileBase } from './engine-profile-common';
8
+ export interface MainEngineProfileOptions extends EngineProfileBase {
9
+ readonly rendererDebugDrawHost?: RendererDebugDrawHost;
10
+ readonly rendererFeatureHost?: RenderFeatureHost;
11
+ readonly animationPayloads: AnimationPayloadLookup;
12
+ readonly onDebugDrawReady?: (debugDraw: DebugDraw) => void;
13
+ readonly input?: InputBackend;
14
+ readonly inputDispose?: () => void;
15
+ readonly inputMap?: readonly ActionConfig[];
16
+ }
17
+ /** Static browser-main selection; dependency order remains owned by inject/provide. */
18
+ export declare function mainEngineProfile(options: MainEngineProfileOptions): Plugin[];
19
+ //# sourceMappingURL=main-engine-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main-engine-profile.d.ts","sourceRoot":"","sources":["../../src/internal/main-engine-profile.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAG5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,YAAY,EAGlB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAMrD,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAA0B,KAAK,qBAAqB,EAAoB,MAAM,cAAc,CAAC;AACpG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IACjE,QAAQ,CAAC,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IACvD,QAAQ,CAAC,mBAAmB,CAAC,EAAE,iBAAiB,CAAC;IACjD,QAAQ,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;IACnD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IAC3D,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;CAC7C;AAoBD,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,MAAM,EAAE,CA2B7E"}
@@ -0,0 +1,19 @@
1
+ /** Minimal structural view of an env bag carrying the serve flag. */
2
+ interface RemoteServeEnv {
3
+ readonly FORGEAX_ENGINE_REMOTE_SERVE?: string | undefined;
4
+ }
5
+ /**
6
+ * Resolve whether the remote eval server should be started.
7
+ *
8
+ * Returns `true` when:
9
+ * - vite dev mode (import.meta.env.DEV === true), OR
10
+ * - headless/dawn-node with FORGEAX_ENGINE_REMOTE_SERVE=1 opt-in
11
+ *
12
+ * Returns `false` in production builds and headless without explicit opt-in.
13
+ *
14
+ * @param isDev flag from import.meta.env.DEV (undefined when import.meta absent)
15
+ * @param processEnv globalThis.process?.env when present, else undefined
16
+ */
17
+ export declare function resolveRemoteServeFlag(isDev: boolean | undefined, processEnv: RemoteServeEnv | undefined): boolean;
18
+ export {};
19
+ //# sourceMappingURL=remote-serve-flag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-serve-flag.d.ts","sourceRoot":"","sources":["../../src/internal/remote-serve-flag.ts"],"names":[],"mappings":"AAgBA,qEAAqE;AACrE,UAAU,cAAc;IACtB,QAAQ,CAAC,2BAA2B,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,GAAG,SAAS,EAC1B,UAAU,EAAE,cAAc,GAAG,SAAS,GACrC,OAAO,CAIT"}
@@ -0,0 +1,8 @@
1
+ import type { Plugin } from '@forgeax/engine-plugin';
2
+ export interface RemoteServerHandle {
3
+ readonly port: number;
4
+ close(): Promise<void>;
5
+ }
6
+ /** Own a Node remote server with the App Fiber while App still exposes its handle. */
7
+ export declare function remoteServerPlugin(handle: RemoteServerHandle): Plugin;
8
+ //# sourceMappingURL=remote-server-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-server-plugin.d.ts","sourceRoot":"","sources":["../../src/internal/remote-server-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,sFAAsF;AACtF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAOrE"}
@@ -0,0 +1,19 @@
1
+ import type { RhiBackendInstrumentation } from '@forgeax/engine-render/internal/construct-renderer';
2
+ import type { CaptureFrameOptions, RecorderAttachment, RhiDebugError } from '@forgeax/engine-rhi-debug';
3
+ import { type Result } from '@forgeax/engine-types';
4
+ import type { FrameLoopHandle } from './frame-loop';
5
+ export interface RhiTapeArtifactRef {
6
+ readonly kind: 'rhi-tape';
7
+ readonly digest: string;
8
+ readonly bytes: Uint8Array;
9
+ }
10
+ export interface RhiCapture {
11
+ captureFrame(options?: CaptureFrameOptions): Promise<Result<RhiTapeArtifactRef, RhiDebugError>>;
12
+ }
13
+ type CaptureFrameDriver = Pick<FrameLoopHandle, 'getState' | 'pause' | 'resume' | 'stepFrame'>;
14
+ export declare function createRhiCapture(attachment: RecorderAttachment): RhiCapture;
15
+ /** Bind the App-owned frame authority to its host capture capability. */
16
+ export declare function bindRhiCaptureFrameDriver(capture: RhiCapture, driver: CaptureFrameDriver): void;
17
+ export declare function createRhiInstrumentation(attachment: RecorderAttachment): RhiBackendInstrumentation;
18
+ export {};
19
+ //# sourceMappingURL=rhi-capture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rhi-capture.d.ts","sourceRoot":"","sources":["../../src/internal/rhi-capture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAEpG,OAAO,KAAK,EACV,mBAAmB,EAEnB,kBAAkB,EAClB,aAAa,EACd,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAAC,CAAC;CACjG;AAGD,KAAK,kBAAkB,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC,CAAC;AAI/F,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,kBAAkB,GAAG,UAAU,CA8B3E;AAED,yEAAyE;AACzE,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAE/F;AAsHD,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,kBAAkB,GAC7B,yBAAyB,CAoB3B"}
@@ -0,0 +1,18 @@
1
+ /** Minimal structural view of an env bag carrying the flag. */
2
+ interface RhiDebugEnv {
3
+ readonly FORGEAX_ENGINE_RHI_DEBUG?: string | undefined;
4
+ }
5
+ /**
6
+ * Resolve the raw FORGEAX_ENGINE_RHI_DEBUG flag from the two sources.
7
+ *
8
+ * Precedence: `import.meta.env` wins; `globalThis.process.env` is the fallback.
9
+ * Returns the raw string (or undefined); the caller compares `=== '1'`.
10
+ *
11
+ * @param importMetaEnv `import.meta.env` when `import.meta` is defined,
12
+ * else `undefined` (models the `typeof import.meta !== 'undefined'` prefix
13
+ * short-circuiting to a falsy first operand).
14
+ * @param processEnv `globalThis.process?.env` when present, else `undefined`.
15
+ */
16
+ export declare function resolveRhiDebugFlag(importMetaEnv: RhiDebugEnv | undefined, processEnv: RhiDebugEnv | undefined): string | undefined;
17
+ export {};
18
+ //# sourceMappingURL=rhi-debug-flag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rhi-debug-flag.d.ts","sourceRoot":"","sources":["../../src/internal/rhi-debug-flag.ts"],"names":[],"mappings":"AAkBA,+DAA+D;AAC/D,UAAU,WAAW;IACnB,QAAQ,CAAC,wBAAwB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,WAAW,GAAG,SAAS,EACtC,UAAU,EAAE,WAAW,GAAG,SAAS,GAClC,MAAM,GAAG,SAAS,CAEpB"}
@@ -0,0 +1,15 @@
1
+ import { type AnimationPayloadLookup } from '@forgeax/engine-animation';
2
+ import { type AudioBackend } from '@forgeax/engine-audio';
3
+ import { type InputBackend } from '@forgeax/engine-input';
4
+ import type { Plugin } from '@forgeax/engine-plugin';
5
+ import { type RenderFeatureHost } from '../renderer-plugin';
6
+ import type { EngineProfileBase } from './engine-profile-common';
7
+ export interface WorkerEngineProfileOptions extends EngineProfileBase {
8
+ readonly animationPayloads: AnimationPayloadLookup;
9
+ readonly input: InputBackend;
10
+ readonly audio: AudioBackend;
11
+ readonly rendererFeatureHost?: RenderFeatureHost;
12
+ }
13
+ /** Static Engine Worker selection; Host-only acquisition stays outside this realm. */
14
+ export declare function workerEngineProfile(options: WorkerEngineProfileOptions): Plugin[];
15
+ //# sourceMappingURL=worker-engine-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-engine-profile.d.ts","sourceRoot":"","sources":["../../src/internal/worker-engine-profile.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAG5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,uBAAuB,CAAC;AAC9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAKrD,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,WAAW,0BAA2B,SAAQ,iBAAiB;IACnE,QAAQ,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;IACnD,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,iBAAiB,CAAC;CAClD;AAED,sFAAsF;AACtF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,MAAM,EAAE,CAkBjF"}
@@ -0,0 +1,69 @@
1
+ // src/execution/kernel-worker-runtime.ts
2
+ var scope = globalThis;
3
+ var loadedKernels = /* @__PURE__ */ new Map();
4
+ async function loadKernel(moduleUrl) {
5
+ const module = await import(
6
+ /* @vite-ignore */
7
+ moduleUrl
8
+ );
9
+ const candidate = module.default ?? module;
10
+ if (typeof candidate.run !== "function") {
11
+ throw new TypeError("SharedKernel module default export has no run function.");
12
+ }
13
+ return candidate;
14
+ }
15
+ function spanFromBinding(binding) {
16
+ return {
17
+ entities: binding.entities,
18
+ length: binding.length,
19
+ get(component) {
20
+ const fields = binding.read[component.name];
21
+ if (fields === void 0)
22
+ throw new Error(`Kernel read access is not declared for ${component.name}.`);
23
+ return fields;
24
+ },
25
+ mut(component) {
26
+ const fields = binding.write[component.name];
27
+ if (fields === void 0)
28
+ throw new Error(`Kernel write access is not declared for ${component.name}.`);
29
+ return fields;
30
+ }
31
+ };
32
+ }
33
+ scope.onmessage = (event) => {
34
+ const job = event.data;
35
+ if (job.kind === "kernel-init") {
36
+ Atomics.add(job.ready, 0, 1);
37
+ Atomics.notify(job.ready, 0);
38
+ return;
39
+ }
40
+ if (job.kind === "kernel-preload") {
41
+ void loadKernel(job.moduleUrl).then((kernel) => {
42
+ loadedKernels.set(job.moduleUrl, kernel);
43
+ Atomics.store(job.status, job.jobIndex, 1);
44
+ }).catch(() => {
45
+ Atomics.store(job.status, job.jobIndex, -1);
46
+ }).finally(() => {
47
+ Atomics.add(job.control, 0, 1);
48
+ Atomics.notify(job.control, 0);
49
+ });
50
+ return;
51
+ }
52
+ if (job.kind !== "kernel-job") return;
53
+ try {
54
+ const kernel = loadedKernels.get(job.moduleUrl);
55
+ if (kernel === void 0) {
56
+ throw new Error(`SharedKernel module was not preloaded: ${job.moduleUrl}`);
57
+ }
58
+ const returned = kernel.run([spanFromBinding(job.binding)]);
59
+ if (returned instanceof Promise) throw new TypeError("SharedKernel run must be synchronous.");
60
+ Atomics.store(job.status, job.jobIndex, 1);
61
+ } catch {
62
+ Atomics.store(job.status, job.jobIndex, -1);
63
+ } finally {
64
+ Atomics.add(job.control, 0, 1);
65
+ Atomics.notify(job.control, 0);
66
+ }
67
+ };
68
+ //# sourceMappingURL=kernel-worker-runtime.mjs.map
69
+ //# sourceMappingURL=kernel-worker-runtime.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/execution/kernel-worker-runtime.ts"],"names":[],"mappings":"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","file":"kernel-worker-runtime.mjs","sourcesContent":["import type { QuerySpan } from '@forgeax/engine-ecs';\nimport type { SharedSpanBinding } from '@forgeax/engine-ecs/shared';\n\ninterface KernelJobMessage {\n readonly kind: 'kernel-job';\n readonly moduleUrl: string;\n readonly binding: SharedSpanBinding;\n readonly control: Int32Array;\n readonly status: Int32Array;\n readonly jobIndex: number;\n}\n\ninterface KernelInitMessage {\n readonly kind: 'kernel-init';\n readonly ready: Int32Array;\n}\n\ninterface KernelPreloadMessage {\n readonly kind: 'kernel-preload';\n readonly moduleUrl: string;\n readonly control: Int32Array;\n readonly status: Int32Array;\n readonly jobIndex: number;\n}\n\ninterface LoadedKernel {\n readonly run: (spans: readonly QuerySpan[]) => unknown;\n}\n\nconst scope = globalThis as unknown as {\n onmessage:\n | ((event: MessageEvent<KernelJobMessage | KernelInitMessage | KernelPreloadMessage>) => void)\n | null;\n};\n\nconst loadedKernels = new Map<string, LoadedKernel>();\n\nasync function loadKernel(moduleUrl: string): Promise<LoadedKernel> {\n const module = await import(/* @vite-ignore */ moduleUrl);\n const candidate = (module.default ?? module) as { run?: unknown };\n if (typeof candidate.run !== 'function') {\n throw new TypeError('SharedKernel module default export has no run function.');\n }\n return candidate as LoadedKernel;\n}\n\nfunction spanFromBinding(binding: SharedSpanBinding): QuerySpan {\n return {\n entities: binding.entities,\n length: binding.length,\n get(component) {\n const fields = binding.read[component.name];\n if (fields === undefined)\n throw new Error(`Kernel read access is not declared for ${component.name}.`);\n return fields as never;\n },\n mut(component) {\n const fields = binding.write[component.name];\n if (fields === undefined)\n throw new Error(`Kernel write access is not declared for ${component.name}.`);\n return fields as never;\n },\n };\n}\n\nscope.onmessage = (event): void => {\n const job = event.data;\n if (job.kind === 'kernel-init') {\n Atomics.add(job.ready, 0, 1);\n Atomics.notify(job.ready, 0);\n return;\n }\n if (job.kind === 'kernel-preload') {\n void loadKernel(job.moduleUrl)\n .then((kernel) => {\n loadedKernels.set(job.moduleUrl, kernel);\n Atomics.store(job.status, job.jobIndex, 1);\n })\n .catch(() => {\n Atomics.store(job.status, job.jobIndex, -1);\n })\n .finally(() => {\n Atomics.add(job.control, 0, 1);\n Atomics.notify(job.control, 0);\n });\n return;\n }\n if (job.kind !== 'kernel-job') return;\n try {\n const kernel = loadedKernels.get(job.moduleUrl);\n if (kernel === undefined) {\n throw new Error(`SharedKernel module was not preloaded: ${job.moduleUrl}`);\n }\n const returned = kernel.run([spanFromBinding(job.binding)]);\n if (returned instanceof Promise) throw new TypeError('SharedKernel run must be synchronous.');\n Atomics.store(job.status, job.jobIndex, 1);\n } catch {\n Atomics.store(job.status, job.jobIndex, -1);\n } finally {\n Atomics.add(job.control, 0, 1);\n Atomics.notify(job.control, 0);\n }\n};\n"]}