@forgeax/engine-app 0.1.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 (354) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +418 -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__/app-rebuild.test.d.ts +2 -0
  7. package/dist/__tests__/app-rebuild.test.d.ts.map +1 -0
  8. package/dist/__tests__/asset-registry-types.test-d.d.ts +2 -0
  9. package/dist/__tests__/asset-registry-types.test-d.d.ts.map +1 -0
  10. package/dist/__tests__/assets-runtime-assembly.integration.test.d.ts +2 -0
  11. package/dist/__tests__/assets-runtime-assembly.integration.test.d.ts.map +1 -0
  12. package/dist/__tests__/callback-deletion.unit.test.d.ts +2 -0
  13. package/dist/__tests__/callback-deletion.unit.test.d.ts.map +1 -0
  14. package/dist/__tests__/callback-inference.test-d.d.ts +2 -0
  15. package/dist/__tests__/callback-inference.test-d.d.ts.map +1 -0
  16. package/dist/__tests__/component-introspection.unit.test.d.ts +2 -0
  17. package/dist/__tests__/component-introspection.unit.test.d.ts.map +1 -0
  18. package/dist/__tests__/consumer-migration.unit.test.d.ts +2 -0
  19. package/dist/__tests__/consumer-migration.unit.test.d.ts.map +1 -0
  20. package/dist/__tests__/create-app-features.test.d.ts +2 -0
  21. package/dist/__tests__/create-app-features.test.d.ts.map +1 -0
  22. package/dist/__tests__/create-app-listener-sync.test.d.ts +2 -0
  23. package/dist/__tests__/create-app-listener-sync.test.d.ts.map +1 -0
  24. package/dist/__tests__/create-app-lock-provider.test.d.ts +2 -0
  25. package/dist/__tests__/create-app-lock-provider.test.d.ts.map +1 -0
  26. package/dist/__tests__/create-app-plugin.test.d.ts +2 -0
  27. package/dist/__tests__/create-app-plugin.test.d.ts.map +1 -0
  28. package/dist/__tests__/create-app-stop.test.d.ts +2 -0
  29. package/dist/__tests__/create-app-stop.test.d.ts.map +1 -0
  30. package/dist/__tests__/create-app-time.unit.test.d.ts +2 -0
  31. package/dist/__tests__/create-app-time.unit.test.d.ts.map +1 -0
  32. package/dist/__tests__/create-app.test-d.d.ts +2 -0
  33. package/dist/__tests__/create-app.test-d.d.ts.map +1 -0
  34. package/dist/__tests__/create-app.test.d.ts +2 -0
  35. package/dist/__tests__/create-app.test.d.ts.map +1 -0
  36. package/dist/__tests__/create-renderer-error.integration.test.d.ts +2 -0
  37. package/dist/__tests__/create-renderer-error.integration.test.d.ts.map +1 -0
  38. package/dist/__tests__/create-renderer-lifecycle.integration.test.d.ts +2 -0
  39. package/dist/__tests__/create-renderer-lifecycle.integration.test.d.ts.map +1 -0
  40. package/dist/__tests__/docs-gate-green.unit.test.d.ts +2 -0
  41. package/dist/__tests__/docs-gate-green.unit.test.d.ts.map +1 -0
  42. package/dist/__tests__/draw-source-headless-full-chain.test.d.ts +2 -0
  43. package/dist/__tests__/draw-source-headless-full-chain.test.d.ts.map +1 -0
  44. package/dist/__tests__/draw-source-injected-world-update-visibility.test.d.ts +2 -0
  45. package/dist/__tests__/draw-source-injected-world-update-visibility.test.d.ts.map +1 -0
  46. package/dist/__tests__/draw-source-single-world-regression.test.d.ts +2 -0
  47. package/dist/__tests__/draw-source-single-world-regression.test.d.ts.map +1 -0
  48. package/dist/__tests__/ecs-import.unit.test.d.ts +2 -0
  49. package/dist/__tests__/ecs-import.unit.test.d.ts.map +1 -0
  50. package/dist/__tests__/engine-worker-bootstrap-channel.unit.test.d.ts +2 -0
  51. package/dist/__tests__/engine-worker-bootstrap-channel.unit.test.d.ts.map +1 -0
  52. package/dist/__tests__/engine-worker-world-swap.unit.test.d.ts +2 -0
  53. package/dist/__tests__/engine-worker-world-swap.unit.test.d.ts.map +1 -0
  54. package/dist/__tests__/errors-pointer-lock-failed.test.d.ts +2 -0
  55. package/dist/__tests__/errors-pointer-lock-failed.test.d.ts.map +1 -0
  56. package/dist/__tests__/execution-bootstrap-isolation.unit.test.d.ts +2 -0
  57. package/dist/__tests__/execution-bootstrap-isolation.unit.test.d.ts.map +1 -0
  58. package/dist/__tests__/execution-error-detail.test-d.d.ts +2 -0
  59. package/dist/__tests__/execution-error-detail.test-d.d.ts.map +1 -0
  60. package/dist/__tests__/execution-error-detail.unit.test.d.ts +2 -0
  61. package/dist/__tests__/execution-error-detail.unit.test.d.ts.map +1 -0
  62. package/dist/__tests__/execution-frame-order.unit.test.d.ts +2 -0
  63. package/dist/__tests__/execution-frame-order.unit.test.d.ts.map +1 -0
  64. package/dist/__tests__/execution-frame-protocol.unit.test.d.ts +2 -0
  65. package/dist/__tests__/execution-frame-protocol.unit.test.d.ts.map +1 -0
  66. package/dist/__tests__/execution-input-sample.contract.test.d.ts +2 -0
  67. package/dist/__tests__/execution-input-sample.contract.test.d.ts.map +1 -0
  68. package/dist/__tests__/execution-measurement.unit.test.d.ts +2 -0
  69. package/dist/__tests__/execution-measurement.unit.test.d.ts.map +1 -0
  70. package/dist/__tests__/execution-public-api.test-d.d.ts +2 -0
  71. package/dist/__tests__/execution-public-api.test-d.d.ts.map +1 -0
  72. package/dist/__tests__/execution-public-api.unit.test.d.ts +2 -0
  73. package/dist/__tests__/execution-public-api.unit.test.d.ts.map +1 -0
  74. package/dist/__tests__/execution-rebuild.contract.test.d.ts +2 -0
  75. package/dist/__tests__/execution-rebuild.contract.test.d.ts.map +1 -0
  76. package/dist/__tests__/execution-report.contract.test.d.ts +2 -0
  77. package/dist/__tests__/execution-report.contract.test.d.ts.map +1 -0
  78. package/dist/__tests__/execution-report.types.test-d.d.ts +2 -0
  79. package/dist/__tests__/execution-report.types.test-d.d.ts.map +1 -0
  80. package/dist/__tests__/execution-schema-freshness.unit.test.d.ts +2 -0
  81. package/dist/__tests__/execution-schema-freshness.unit.test.d.ts.map +1 -0
  82. package/dist/__tests__/execution-selector.unit.test.d.ts +2 -0
  83. package/dist/__tests__/execution-selector.unit.test.d.ts.map +1 -0
  84. package/dist/__tests__/execution-shared-kernel.unit.test.d.ts +2 -0
  85. package/dist/__tests__/execution-shared-kernel.unit.test.d.ts.map +1 -0
  86. package/dist/__tests__/execution-world-health-owner.test-d.d.ts +2 -0
  87. package/dist/__tests__/execution-world-health-owner.test-d.d.ts.map +1 -0
  88. package/dist/__tests__/fallback-camera.unit.test.d.ts +2 -0
  89. package/dist/__tests__/fallback-camera.unit.test.d.ts.map +1 -0
  90. package/dist/__tests__/frame-loop-time-elapsed.test.d.ts +2 -0
  91. package/dist/__tests__/frame-loop-time-elapsed.test.d.ts.map +1 -0
  92. package/dist/__tests__/frame-loop-time.unit.test.d.ts +2 -0
  93. package/dist/__tests__/frame-loop-time.unit.test.d.ts.map +1 -0
  94. package/dist/__tests__/frame-loop-world-array.test.d.ts +2 -0
  95. package/dist/__tests__/frame-loop-world-array.test.d.ts.map +1 -0
  96. package/dist/__tests__/kernel-worker-runtime.unit.test.d.ts +2 -0
  97. package/dist/__tests__/kernel-worker-runtime.unit.test.d.ts.map +1 -0
  98. package/dist/__tests__/migration-surface-inventory.unit.test.d.ts +2 -0
  99. package/dist/__tests__/migration-surface-inventory.unit.test.d.ts.map +1 -0
  100. package/dist/__tests__/plugin-policy.integration.test.d.ts +2 -0
  101. package/dist/__tests__/plugin-policy.integration.test.d.ts.map +1 -0
  102. package/dist/__tests__/plugin-profiles.unit.test.d.ts +2 -0
  103. package/dist/__tests__/plugin-profiles.unit.test.d.ts.map +1 -0
  104. package/dist/__tests__/profiler-default-off.test.d.ts +2 -0
  105. package/dist/__tests__/profiler-default-off.test.d.ts.map +1 -0
  106. package/dist/__tests__/profiler-frame-token.test.d.ts +2 -0
  107. package/dist/__tests__/profiler-frame-token.test.d.ts.map +1 -0
  108. package/dist/__tests__/profiler-phase-catalog.test.d.ts +2 -0
  109. package/dist/__tests__/profiler-phase-catalog.test.d.ts.map +1 -0
  110. package/dist/__tests__/profiler-phase-integration.test.d.ts +2 -0
  111. package/dist/__tests__/profiler-phase-integration.test.d.ts.map +1 -0
  112. package/dist/__tests__/profiler-remote-bridge.test.d.ts +2 -0
  113. package/dist/__tests__/profiler-remote-bridge.test.d.ts.map +1 -0
  114. package/dist/__tests__/remote-integration.test.d.ts +2 -0
  115. package/dist/__tests__/remote-integration.test.d.ts.map +1 -0
  116. package/dist/__tests__/remote-serve-flag.test.d.ts +2 -0
  117. package/dist/__tests__/remote-serve-flag.test.d.ts.map +1 -0
  118. package/dist/__tests__/rhi-capture-capability.test-d.d.ts +2 -0
  119. package/dist/__tests__/rhi-capture-capability.test-d.d.ts.map +1 -0
  120. package/dist/__tests__/rhi-capture-host.integration.test.d.ts +2 -0
  121. package/dist/__tests__/rhi-capture-host.integration.test.d.ts.map +1 -0
  122. package/dist/__tests__/rhi-capture.browser.test.d.ts +2 -0
  123. package/dist/__tests__/rhi-capture.browser.test.d.ts.map +1 -0
  124. package/dist/__tests__/surface-handoff.test.d.ts +2 -0
  125. package/dist/__tests__/surface-handoff.test.d.ts.map +1 -0
  126. package/dist/__tests__/types-m2.test-d.d.ts +2 -0
  127. package/dist/__tests__/types-m2.test-d.d.ts.map +1 -0
  128. package/dist/__tests__/visibility-remote.integration.test.d.ts +2 -0
  129. package/dist/__tests__/visibility-remote.integration.test.d.ts.map +1 -0
  130. package/dist/__tests__/worker-execution-stop.test.d.ts +2 -0
  131. package/dist/__tests__/worker-execution-stop.test.d.ts.map +1 -0
  132. package/dist/animation-asset-lookup.d.ts +8 -0
  133. package/dist/animation-asset-lookup.d.ts.map +1 -0
  134. package/dist/assets-runtime-assembly.d.ts +19 -0
  135. package/dist/assets-runtime-assembly.d.ts.map +1 -0
  136. package/dist/canvas-policy.d.ts +4 -0
  137. package/dist/canvas-policy.d.ts.map +1 -0
  138. package/dist/create-app.d.ts +57 -0
  139. package/dist/create-app.d.ts.map +1 -0
  140. package/dist/engine-worker-runtime.mjs +884 -0
  141. package/dist/engine-worker-runtime.mjs.map +1 -0
  142. package/dist/errors.d.ts +263 -0
  143. package/dist/errors.d.ts.map +1 -0
  144. package/dist/execution/attached-world-swap.d.ts +21 -0
  145. package/dist/execution/attached-world-swap.d.ts.map +1 -0
  146. package/dist/execution/bootstrap-entry.d.ts +30 -0
  147. package/dist/execution/bootstrap-entry.d.ts.map +1 -0
  148. package/dist/execution/capabilities.d.ts +5 -0
  149. package/dist/execution/capabilities.d.ts.map +1 -0
  150. package/dist/execution/control.d.ts +14 -0
  151. package/dist/execution/control.d.ts.map +1 -0
  152. package/dist/execution/engine-worker-runtime.d.ts +2 -0
  153. package/dist/execution/engine-worker-runtime.d.ts.map +1 -0
  154. package/dist/execution/engine-worker.d.ts +23 -0
  155. package/dist/execution/engine-worker.d.ts.map +1 -0
  156. package/dist/execution/host-controller.d.ts +16 -0
  157. package/dist/execution/host-controller.d.ts.map +1 -0
  158. package/dist/execution/index.d.ts +10 -0
  159. package/dist/execution/index.d.ts.map +1 -0
  160. package/dist/execution/kernel-pool.d.ts +14 -0
  161. package/dist/execution/kernel-pool.d.ts.map +1 -0
  162. package/dist/execution/kernel-worker-runtime.d.ts +2 -0
  163. package/dist/execution/kernel-worker-runtime.d.ts.map +1 -0
  164. package/dist/execution/measurement.d.ts +7 -0
  165. package/dist/execution/measurement.d.ts.map +1 -0
  166. package/dist/execution/protocol.d.ts +84 -0
  167. package/dist/execution/protocol.d.ts.map +1 -0
  168. package/dist/execution/report.d.ts +5 -0
  169. package/dist/execution/report.d.ts.map +1 -0
  170. package/dist/execution/schema.d.ts +4 -0
  171. package/dist/execution/schema.d.ts.map +1 -0
  172. package/dist/execution/selector.d.ts +10 -0
  173. package/dist/execution/selector.d.ts.map +1 -0
  174. package/dist/execution/types.d.ts +107 -0
  175. package/dist/execution/types.d.ts.map +1 -0
  176. package/dist/fallback-camera.d.ts +8 -0
  177. package/dist/fallback-camera.d.ts.map +1 -0
  178. package/dist/game-context.d.ts +98 -0
  179. package/dist/game-context.d.ts.map +1 -0
  180. package/dist/index.d.ts +24 -0
  181. package/dist/index.d.ts.map +1 -0
  182. package/dist/index.mjs +3985 -0
  183. package/dist/index.mjs.map +1 -0
  184. package/dist/input-map-plugin.d.ts +5 -0
  185. package/dist/input-map-plugin.d.ts.map +1 -0
  186. package/dist/input-plugin.d.ts +4 -0
  187. package/dist/input-plugin.d.ts.map +1 -0
  188. package/dist/internal/assembled-engine-profile.d.ts +5 -0
  189. package/dist/internal/assembled-engine-profile.d.ts.map +1 -0
  190. package/dist/internal/assets-world-plugin.d.ts +21 -0
  191. package/dist/internal/assets-world-plugin.d.ts.map +1 -0
  192. package/dist/internal/browser-remote-bridge.d.ts +25 -0
  193. package/dist/internal/browser-remote-bridge.d.ts.map +1 -0
  194. package/dist/internal/browser-rhi-debug-runtime.d.ts +18 -0
  195. package/dist/internal/browser-rhi-debug-runtime.d.ts.map +1 -0
  196. package/dist/internal/component-introspection.d.ts +24 -0
  197. package/dist/internal/component-introspection.d.ts.map +1 -0
  198. package/dist/internal/ecs-import.d.ts +6 -0
  199. package/dist/internal/ecs-import.d.ts.map +1 -0
  200. package/dist/internal/engine-profile-common.d.ts +9 -0
  201. package/dist/internal/engine-profile-common.d.ts.map +1 -0
  202. package/dist/internal/error-fanout.d.ts +66 -0
  203. package/dist/internal/error-fanout.d.ts.map +1 -0
  204. package/dist/internal/frame-loop.d.ts +35 -0
  205. package/dist/internal/frame-loop.d.ts.map +1 -0
  206. package/dist/internal/input-attach.d.ts +44 -0
  207. package/dist/internal/input-attach.d.ts.map +1 -0
  208. package/dist/internal/main-engine-profile.d.ts +15 -0
  209. package/dist/internal/main-engine-profile.d.ts.map +1 -0
  210. package/dist/internal/remote-serve-flag.d.ts +23 -0
  211. package/dist/internal/remote-serve-flag.d.ts.map +1 -0
  212. package/dist/internal/remote-server-plugin.d.ts +8 -0
  213. package/dist/internal/remote-server-plugin.d.ts.map +1 -0
  214. package/dist/internal/rhi-capture.d.ts +19 -0
  215. package/dist/internal/rhi-capture.d.ts.map +1 -0
  216. package/dist/internal/rhi-debug-flag.d.ts +18 -0
  217. package/dist/internal/rhi-debug-flag.d.ts.map +1 -0
  218. package/dist/internal/worker-engine-profile.d.ts +13 -0
  219. package/dist/internal/worker-engine-profile.d.ts.map +1 -0
  220. package/dist/kernel-worker-runtime.mjs +69 -0
  221. package/dist/kernel-worker-runtime.mjs.map +1 -0
  222. package/dist/load-game-errors.d.ts +131 -0
  223. package/dist/load-game-errors.d.ts.map +1 -0
  224. package/dist/load-game.d.ts +34 -0
  225. package/dist/load-game.d.ts.map +1 -0
  226. package/dist/plugin-factories.d.ts +3 -0
  227. package/dist/plugin-factories.d.ts.map +1 -0
  228. package/dist/tool-preview/bootstrap.d.ts +113 -0
  229. package/dist/tool-preview/bootstrap.d.ts.map +1 -0
  230. package/dist/tool-preview/evidence.d.ts +20 -0
  231. package/dist/tool-preview/evidence.d.ts.map +1 -0
  232. package/dist/tool-preview/framing.d.ts +13 -0
  233. package/dist/tool-preview/framing.d.ts.map +1 -0
  234. package/dist/tool-preview/recipe.d.ts +54 -0
  235. package/dist/tool-preview/recipe.d.ts.map +1 -0
  236. package/dist/types.d.ts +444 -0
  237. package/dist/types.d.ts.map +1 -0
  238. package/package.json +86 -0
  239. package/schema/execution-report.schema.json +168 -0
  240. package/src/__tests__/animation-asset-lookup.unit.test.ts +20 -0
  241. package/src/__tests__/app-rebuild.test.ts +31 -0
  242. package/src/__tests__/asset-registry-types.test-d.ts +16 -0
  243. package/src/__tests__/assets-runtime-assembly.integration.test.ts +68 -0
  244. package/src/__tests__/callback-deletion.unit.test.ts +14 -0
  245. package/src/__tests__/callback-inference.test-d.ts +32 -0
  246. package/src/__tests__/component-introspection.unit.test.ts +56 -0
  247. package/src/__tests__/consumer-migration.unit.test.ts +21 -0
  248. package/src/__tests__/create-app-features.test.ts +40 -0
  249. package/src/__tests__/create-app-listener-sync.test.ts +377 -0
  250. package/src/__tests__/create-app-lock-provider.test.ts +212 -0
  251. package/src/__tests__/create-app-plugin.test.ts +217 -0
  252. package/src/__tests__/create-app-stop.test.ts +617 -0
  253. package/src/__tests__/create-app-time.unit.test.ts +26 -0
  254. package/src/__tests__/create-app.test-d.ts +82 -0
  255. package/src/__tests__/create-app.test.ts +346 -0
  256. package/src/__tests__/create-renderer-error.integration.test.ts +24 -0
  257. package/src/__tests__/create-renderer-lifecycle.integration.test.ts +19 -0
  258. package/src/__tests__/docs-gate-green.unit.test.ts +61 -0
  259. package/src/__tests__/draw-source-headless-full-chain.test.ts +226 -0
  260. package/src/__tests__/draw-source-injected-world-update-visibility.test.ts +182 -0
  261. package/src/__tests__/draw-source-single-world-regression.test.ts +185 -0
  262. package/src/__tests__/ecs-import.unit.test.ts +40 -0
  263. package/src/__tests__/engine-worker-bootstrap-channel.unit.test.ts +74 -0
  264. package/src/__tests__/engine-worker-world-swap.unit.test.ts +76 -0
  265. package/src/__tests__/errors-pointer-lock-failed.test.ts +268 -0
  266. package/src/__tests__/execution-bootstrap-isolation.unit.test.ts +80 -0
  267. package/src/__tests__/execution-error-detail.test-d.ts +13 -0
  268. package/src/__tests__/execution-error-detail.unit.test.ts +35 -0
  269. package/src/__tests__/execution-frame-order.unit.test.ts +38 -0
  270. package/src/__tests__/execution-frame-protocol.unit.test.ts +61 -0
  271. package/src/__tests__/execution-input-sample.contract.test.ts +23 -0
  272. package/src/__tests__/execution-measurement.unit.test.ts +20 -0
  273. package/src/__tests__/execution-public-api.test-d.ts +10 -0
  274. package/src/__tests__/execution-public-api.unit.test.ts +9 -0
  275. package/src/__tests__/execution-rebuild.contract.test.ts +36 -0
  276. package/src/__tests__/execution-report.contract.test.ts +50 -0
  277. package/src/__tests__/execution-report.types.test-d.ts +16 -0
  278. package/src/__tests__/execution-schema-freshness.unit.test.ts +20 -0
  279. package/src/__tests__/execution-selector.unit.test.ts +72 -0
  280. package/src/__tests__/execution-shared-kernel.unit.test.ts +180 -0
  281. package/src/__tests__/execution-world-health-owner.test-d.ts +9 -0
  282. package/src/__tests__/fallback-camera.unit.test.ts +32 -0
  283. package/src/__tests__/frame-loop-time-elapsed.test.ts +115 -0
  284. package/src/__tests__/frame-loop-time.unit.test.ts +61 -0
  285. package/src/__tests__/frame-loop-world-array.test.ts +441 -0
  286. package/src/__tests__/kernel-worker-runtime.unit.test.ts +50 -0
  287. package/src/__tests__/migration-surface-inventory.unit.test.ts +13 -0
  288. package/src/__tests__/plugin-policy.integration.test.ts +15 -0
  289. package/src/__tests__/plugin-profiles.unit.test.ts +190 -0
  290. package/src/__tests__/profiler-default-off.test.ts +53 -0
  291. package/src/__tests__/profiler-frame-token.test.ts +248 -0
  292. package/src/__tests__/profiler-phase-catalog.test.ts +30 -0
  293. package/src/__tests__/profiler-phase-integration.test.ts +129 -0
  294. package/src/__tests__/profiler-remote-bridge.test.ts +31 -0
  295. package/src/__tests__/remote-integration.test.ts +224 -0
  296. package/src/__tests__/remote-serve-flag.test.ts +24 -0
  297. package/src/__tests__/rhi-capture-capability.test-d.ts +22 -0
  298. package/src/__tests__/rhi-capture-host.integration.test.ts +157 -0
  299. package/src/__tests__/rhi-capture.browser.test.ts +51 -0
  300. package/src/__tests__/surface-handoff.test.ts +92 -0
  301. package/src/__tests__/types-m2.test-d.ts +81 -0
  302. package/src/__tests__/visibility-remote.integration.test.ts +119 -0
  303. package/src/__tests__/worker-execution-stop.test.ts +116 -0
  304. package/src/animation-asset-lookup.ts +13 -0
  305. package/src/assets-runtime-assembly.ts +70 -0
  306. package/src/canvas-policy.ts +16 -0
  307. package/src/create-app.ts +1351 -0
  308. package/src/errors.ts +454 -0
  309. package/src/execution/attached-world-swap.ts +67 -0
  310. package/src/execution/bootstrap-entry.ts +122 -0
  311. package/src/execution/capabilities.ts +102 -0
  312. package/src/execution/control.ts +52 -0
  313. package/src/execution/engine-worker-runtime.ts +400 -0
  314. package/src/execution/engine-worker.ts +161 -0
  315. package/src/execution/host-controller.ts +454 -0
  316. package/src/execution/index.ts +43 -0
  317. package/src/execution/kernel-pool.ts +236 -0
  318. package/src/execution/kernel-worker-runtime.ts +103 -0
  319. package/src/execution/measurement.ts +39 -0
  320. package/src/execution/protocol.ts +131 -0
  321. package/src/execution/report.ts +66 -0
  322. package/src/execution/schema.ts +168 -0
  323. package/src/execution/selector.ts +98 -0
  324. package/src/execution/types.ts +146 -0
  325. package/src/fallback-camera.ts +20 -0
  326. package/src/game-context.ts +126 -0
  327. package/src/index.ts +176 -0
  328. package/src/input-map-plugin.ts +21 -0
  329. package/src/input-plugin.ts +26 -0
  330. package/src/internal/assembled-engine-profile.ts +22 -0
  331. package/src/internal/assets-world-plugin.ts +79 -0
  332. package/src/internal/browser-remote-bridge.ts +267 -0
  333. package/src/internal/browser-rhi-debug-runtime.ts +67 -0
  334. package/src/internal/component-introspection.ts +116 -0
  335. package/src/internal/ecs-import.ts +41 -0
  336. package/src/internal/engine-profile-common.ts +10 -0
  337. package/src/internal/error-fanout.ts +129 -0
  338. package/src/internal/frame-loop.ts +525 -0
  339. package/src/internal/input-attach.ts +104 -0
  340. package/src/internal/main-engine-profile.ts +80 -0
  341. package/src/internal/remote-serve-flag.ts +50 -0
  342. package/src/internal/remote-server-plugin.ts +16 -0
  343. package/src/internal/rhi-capture.ts +211 -0
  344. package/src/internal/rhi-debug-flag.ts +40 -0
  345. package/src/internal/worker-engine-profile.ts +47 -0
  346. package/src/load-game-errors.ts +211 -0
  347. package/src/load-game.ts +115 -0
  348. package/src/plugin-factories.ts +2 -0
  349. package/src/tool-preview/bootstrap.ts +848 -0
  350. package/src/tool-preview/evidence.ts +59 -0
  351. package/src/tool-preview/framing.ts +52 -0
  352. package/src/tool-preview/recipe.ts +137 -0
  353. package/src/types.ts +505 -0
  354. package/src/vite-env.d.ts +12 -0
package/src/types.ts ADDED
@@ -0,0 +1,505 @@
1
+ // @forgeax/engine-app -- shared types for createApp double-SSOT entry.
2
+ //
3
+ // AI users: see packages/app/src/index.ts for the public surface and
4
+ // packages/app/src/create-app.ts for the runtime implementation.
5
+ //
6
+ // M1 (this milestone) ships the skeleton: interfaces are final-shape, but
7
+ // start / stop / pause / resume / onError on the returned App are stubs
8
+ // that return Result.ok(undefined) and a no-op unsubscribe. The rAF main
9
+ // loop, dt clamp, error fan-out, and input attach internals land in
10
+ // later milestones (M2..M5 per plan-strategy section 7).
11
+
12
+ import type { AssetRegistry, CatalogSource } from '@forgeax/engine-assets-runtime';
13
+ import type { AudioBackend } from '@forgeax/engine-audio';
14
+ import type { DebugDraw } from '@forgeax/engine-debug-draw';
15
+ import type { TimePolicy, World } from '@forgeax/engine-ecs';
16
+ import type {
17
+ ActionConfig,
18
+ InputBackend,
19
+ PointerLockProvider,
20
+ VirtualJoystickConfig,
21
+ } from '@forgeax/engine-input';
22
+ import type { PhysicsWorld, PhysicsWorld2D } from '@forgeax/engine-physics';
23
+ import type { Context, Plugin } from '@forgeax/engine-plugin';
24
+ import type { Profiler } from '@forgeax/engine-profiler';
25
+ import type {
26
+ MembershipTimingOptions,
27
+ Renderer,
28
+ RendererError,
29
+ RenderFeature,
30
+ } from '@forgeax/engine-render';
31
+ import type { RhiBackendInstrumentation } from '@forgeax/engine-render/internal';
32
+ import type { RhiError, RhiInstance } from '@forgeax/engine-rhi';
33
+ import type { CaptureFrameOptions, RhiDebugError } from '@forgeax/engine-rhi-debug';
34
+ import type { EngineEnvironmentError } from '@forgeax/engine-runtime';
35
+ import type { AssetDecoderContributionRef, ImportTransport, Result } from '@forgeax/engine-types';
36
+ import type { AssetRuntimeAssemblyError } from './assets-runtime-assembly';
37
+ import type { AppError, AppErrorCode } from './errors';
38
+ import type { ExecutionControl, ExecutionOptions } from './execution';
39
+ import type { RhiCapture } from './internal/rhi-capture';
40
+
41
+ // Re-export AppError + AppErrorCode (the canonical SSOT lives in
42
+ // `./errors`). Pre-M5 (M1..M4) referenced these as type-only declarations
43
+ // inside this file; M5 collapses to the single SSOT in `./errors.ts` per
44
+ // plan-strategy section 7 + research section 2.7.
45
+ export type { AppError, AppErrorCode };
46
+
47
+ /**
48
+ * Structured error union surfaced through the App `onError` fan-out + the
49
+ * assemble-form construction Result. Derived from the `Renderer.onError`
50
+ * channel contract `RendererError` (feat-20260704-runtime-tier1-decomposition
51
+ * M2 / w14 / D-4) so a runtime-layer error fanned out by the renderer (e.g.
52
+ * `'equirect-projection-failed'`) reaches host App listeners verbatim, plus the
53
+ * App-layer `AppError`. `RendererError` = `RhiError | RenderError |
54
+ * AssetRuntimeError | SkinError | PostProcessError`, so this equals the
55
+ * pre-decomposition `AppError | RhiError | RuntimeError | PostProcessError`
56
+ * exactly (RuntimeError was RenderError | AssetRuntimeError | SkinError). AI
57
+ * users `switch (err.code)` over the union: the disjoint `AppErrorCode` /
58
+ * `RhiErrorCode` / per-cluster `*ErrorCode` / `PostProcessErrorCode` literal
59
+ * sets let TS narrow each arm to the concrete class.
60
+ */
61
+ export type AppDispatchError = AppError | RendererError;
62
+
63
+ /**
64
+ * Per-frame draw description pulled from the host each frame
65
+ * (feat-20260709-editor-world-partition-editorworld-super-composite / M2 / D-3).
66
+ *
67
+ * - `worlds` — the exact world list to render this frame, in draw order.
68
+ * - `cameraOwner` — index into `worlds` whose cameras drive the frame.
69
+ * - `resourceOwner`— index into `worlds` whose singleton render resources
70
+ * (skylight / skybox / postProcessParams) drive the frame.
71
+ *
72
+ * The two owners are independent (M1 owner-split): an editor can render a scene
73
+ * world's geometry through an editor world's camera while sourcing lighting from
74
+ * a third. `cameraOwner === resourceOwner` is the single-owner degenerate case.
75
+ *
76
+ * @see {@link DrawSource}
77
+ */
78
+ export interface DrawSourceResult {
79
+ readonly worlds: readonly World[];
80
+ readonly cameraOwner: number;
81
+ readonly resourceOwner: number;
82
+ }
83
+
84
+ /**
85
+ * Stable frame-loop phase vocabulary for opt-in performance diagnostics.
86
+ *
87
+ * Local and Worker execution record these phases through the same optional
88
+ * Profiler capability. When omitted, the frame loop keeps its normal path and
89
+ * does not allocate capture records.
90
+ */
91
+ export const APP_PHASE_CATALOG = [
92
+ 'frame-total',
93
+ 'draw-source',
94
+ 'world-update-primary',
95
+ 'world-update-injected',
96
+ 'renderer-draw',
97
+ 'host-frame',
98
+ 'engine-update',
99
+ 'kernel-wait',
100
+ 'host-audio',
101
+ ] as const;
102
+
103
+ /**
104
+ * Optional per-frame draw-source injection seam
105
+ * (feat-20260709-editor-world-partition-editorworld-super-composite / M2 / D-3).
106
+ *
107
+ * The frame-loop invokes this callback once per frame (a "pull"). It lets a host
108
+ * (e.g. the editor) decide, each frame, WHICH worlds to render and which owner
109
+ * indices to use — without the engine knowing anything about editor world
110
+ * partitioning.
111
+ *
112
+ * - Returns `undefined` → the frame-loop degrades to the single-world path,
113
+ * byte-identical to `renderer.draw([world], { cameraOwner: 0, resourceOwner: 0 })` where `world` is
114
+ * the App's own world (the single-world AI-user default). A host that wires
115
+ * the seam but has nothing multi-world to inject this frame returns
116
+ * `undefined`.
117
+ * - Returns a {@link DrawSourceResult} → the frame-loop runs `world.update(1 / 60).unwrap()`
118
+ * on EVERY returned world (so transform propagation writes each world's
119
+ * derived `Transform.world` mat4 before extract reads it — no stale matrix),
120
+ * then calls `renderer.draw(worlds, { cameraOwner, resourceOwner })`.
121
+ *
122
+ * When omitted entirely, the App never consults a seam and always renders its
123
+ * own single world (legacy behaviour unchanged).
124
+ */
125
+ export type DrawSource = () => DrawSourceResult | undefined;
126
+
127
+ /**
128
+ * Options for the assemble-form entry createApp({ renderer, world, ... }).
129
+ *
130
+ * Field semantics (final shape -- runtime use lands in M2..M5):
131
+ * - renderer: caller-owned Renderer (host already invoked createRenderer).
132
+ * - world: caller-owned World (host already invoked new World()).
133
+ * - input: InputBackend handle the host-side attached. When omitted the
134
+ * assemble entry skips input attach (caller manages input).
135
+ * - silenceUnhandledErrors: when true, suppresses the console.error
136
+ * fallback inside the error fan-out (M4).
137
+ */
138
+ export interface AppAssembleArgs {
139
+ readonly renderer: Renderer;
140
+ readonly world: World;
141
+ /** One immutable Catalog scope for this App realm. */
142
+ readonly assetCatalog?: CatalogSource;
143
+ /** Explicit owner contributions installed into this realm's Registry. */
144
+ readonly assetDecoders?: readonly AssetDecoderContributionRef[];
145
+ /** Unified plugin list (M1 feat-20260623-plugin-system-unify-build-world-protocol). */
146
+ readonly plugins?: readonly Plugin[];
147
+ readonly silenceUnhandledErrors?: boolean;
148
+ /**
149
+ * Per-frame draw-source injection seam (M2 / D-3). When supplied, the
150
+ * frame-loop pulls it each frame to decide which worlds to render + which
151
+ * owner indices to use; when omitted the App renders its own single world
152
+ * (legacy behaviour). See {@link DrawSource}.
153
+ */
154
+ readonly drawSource?: DrawSource;
155
+ /** Explicit profiler capability shared by the host and renderer. */
156
+ readonly profiler?: Profiler;
157
+ /** Explicit opt-in for Render-owned HDRP membership timing evidence. */
158
+ readonly membershipTiming?: MembershipTimingOptions;
159
+ }
160
+
161
+ /** Effective physical canvas size transported to an Engine Worker frame. */
162
+ export interface CanvasDrawingBufferSize {
163
+ readonly width: number;
164
+ readonly height: number;
165
+ }
166
+
167
+ /**
168
+ * Options for the canvas-form thin wrapper createApp(canvas, opts?, bundler?).
169
+ *
170
+ * feat-20260608-create-app-param-surface-trim / M2 / D-3: self-describing
171
+ * surface -- no longer `extends RendererOptions`. The 7 app-only fields
172
+ * (input / audio / physics / silenceUnhandledErrors) plus the 2 RHI escape-hatch
173
+ * fields (rhi / rawDeviceForContextConfigure) are
174
+ * listed inline, so IDE autocomplete shows AI users a clean surface
175
+ * without inheriting now-disallowed slots like clearColor (M1, on Camera)
176
+ * and shaderManifestUrl (M2, on BundlerOptions / 3rd arg). The escape
177
+ * hatches stay discoverable for the RHI debugging path (charter P1 -- not
178
+ * default noise, but reachable when the AI user scrolls the type).
179
+ */
180
+ export interface CreateAppOptions {
181
+ /**
182
+ * Optional positive Host-owned upper bound for the canvas device pixel ratio.
183
+ * Values below 1 intentionally downsample GPU-bound surfaces. The default is
184
+ * the current devicePixelRatio; the Engine never reads URL or game-specific
185
+ * settings to derive this value.
186
+ */
187
+ readonly maxCanvasPixelRatio?: number | undefined;
188
+ /** One immutable Catalog scope for this App realm. */
189
+ readonly assetCatalog?: CatalogSource;
190
+ /** Explicit owner contributions installed into this realm's Registry. */
191
+ readonly assetDecoders?: readonly AssetDecoderContributionRef[];
192
+ /** Opt into realm-local engine execution. Omission preserves the existing local assembly path. */
193
+ readonly execution?: ExecutionOptions;
194
+ /** Host-owned UI root whose events do not enter gameplay input. */
195
+ readonly uiRoot?: Node;
196
+ /** Producer-owned render features forwarded to the renderer unchanged. */
197
+ readonly features?: readonly RenderFeature<unknown>[];
198
+ /** Unified plugin list (M1 feat-20260623-plugin-system-unify-build-world-protocol). */
199
+ readonly plugins?: readonly Plugin[];
200
+ /**
201
+ * A host-owned input backend for this canvas. When supplied, createApp inserts
202
+ * it into the World instead of attaching a second browser listener set. The
203
+ * host retains its lifecycle; this app only consumes snapshots from the view.
204
+ */
205
+ readonly input?: InputBackend;
206
+ /**
207
+ * World-owned time policy supplied to the canvas-form World constructor.
208
+ * Assemble-form callers retain their pre-existing World policy.
209
+ */
210
+ readonly time?: TimePolicy;
211
+ /**
212
+ * When true, suppresses the console.error fallback inside the error
213
+ * fan-out for hosts that prefer total silence (M4 default: false).
214
+ */
215
+ readonly silenceUnhandledErrors?: boolean;
216
+ /**
217
+ * RHI escape hatch -- forwarded verbatim to createRenderer. Same semantics
218
+ * as `RendererOptions.rhi` (the createRenderer third-party-RHI-instance
219
+ * injection point). Use only for testing / pinning a specific backend /
220
+ * advanced AI users that ship their own RhiInstance shim.
221
+ */
222
+ readonly rhi?: RhiInstance | undefined;
223
+ /** @internal Runtime-owned instrumentation seam for a recorder attachment. */
224
+ readonly rhiInstrumentation?: RhiBackendInstrumentation;
225
+ /**
226
+ * D-S1 raw GPUDevice escape hatch -- forwarded verbatim to createRenderer.
227
+ * Same semantics as `RendererOptions.rawDeviceForContextConfigure`. Used
228
+ * by the apps/hello/triangle bootstrap, where the host configures the
229
+ * canvas's GPUCanvasContext outside the RHI surface.
230
+ */
231
+ readonly rawDeviceForContextConfigure?: unknown | (() => unknown | undefined);
232
+ /**
233
+ * Neutral PointerLock gate forwarded verbatim to the canvas-form input
234
+ * attach (attachInputAuto → attachBrowserInputBackend). When it returns
235
+ * false, a canvas click does NOT capture the cursor. Absent => always-lock
236
+ * (standalone game behaviour). The engine never learns WHY locking is
237
+ * (dis)allowed — the host owns that decision (e.g. an editor viewport that
238
+ * only allows lock in its play·game quadrant). Ignored by the assemble form
239
+ * (host-managed input owns its own lock policy).
240
+ */
241
+ readonly pointerLockAllowed?: () => boolean;
242
+ /**
243
+ * Virtual joystick configs forwarded verbatim to the canvas-form input
244
+ * attach (attachInputAuto -> attachBrowserInputBackend). Each config derives
245
+ * a normalized 2D axis readable via `snap.virtualAxis(name)`. Absent => no
246
+ * virtual joysticks. Ignored by the assemble form (host-managed input wires
247
+ * its own backend). Mirrors `pointerLockAllowed`: the canvas-form entry must
248
+ * expose every backend option the standard recipe needs, or the config path
249
+ * dead-ends before reaching the backend that already supports it.
250
+ */
251
+ readonly virtualJoysticks?: readonly VirtualJoystickConfig[];
252
+ /**
253
+ * Action mapping configuration (M1: action semantic abstraction layer).
254
+ *
255
+ * Declares named actions (e.g. 'jump', 'moveRight') bound to raw input sources
256
+ * (key, mouseButton, gamepadButton, gamepadAxis). The engine derives per-frame
257
+ * action states via `deriveActionStates()` and exposes them via
258
+ * `snap.action(name).isPressed()`. Duplicate action names follow last-wins
259
+ * semantics (D-8).
260
+ *
261
+ * This is canvas-form only. Assemble-form hosts insert the
262
+ * `INPUT_MAP_KEY` Resource directly.
263
+ */
264
+ readonly inputMap?: readonly ActionConfig[] | undefined;
265
+ /**
266
+ * M2: pointer-lock provider injected by the host (e.g. editor play-runtime).
267
+ * Forwarded verbatim through InputAttachOptions to BrowserInputBackendOptions.
268
+ * When absent, the backend falls back to the W3C requestPointerLock() path.
269
+ * Type SSOT is @forgeax/engine-input's PointerLockProvider.
270
+ * Ignored by the assemble form (host-managed input owns its own lock policy).
271
+ */
272
+ readonly lockProvider?: PointerLockProvider;
273
+ /**
274
+ * Per-frame draw-source injection seam (M2 / D-3). When supplied, the
275
+ * frame-loop pulls it each frame to decide which worlds to render + which
276
+ * owner indices to use; when omitted the canvas-form App renders its own
277
+ * single world (legacy behaviour unchanged). See {@link DrawSource}.
278
+ */
279
+ readonly drawSource?: DrawSource;
280
+ /** Explicit profiler capability shared by the host and renderer. */
281
+ readonly profiler?: Profiler;
282
+ /** Explicit opt-in for Render-owned HDRP membership timing evidence. */
283
+ readonly membershipTiming?: MembershipTimingOptions;
284
+ }
285
+
286
+ /**
287
+ * Bundler-layer injection for the canvas-form createApp(canvas, opts, bundler?)
288
+ * and createRenderer(canvas, opts, bundler?).
289
+ *
290
+ * feat-20260608-create-app-param-surface-trim / M2 / D-3: this is the SSOT
291
+ * for build-tool emit knowledge that the engine consumes at runtime.
292
+ * Aggregates two host-injected channels:
293
+ *
294
+ * - importTransport: dev-only ImportTransport that the engine threads to
295
+ * the AssetRegistry third ctor slot so a DDC miss can lazy-import.
296
+ * Absent => shipped form (DDC miss fails fast with `asset-not-imported`).
297
+ *
298
+ * - shaderManifestUrl: the path the host's vite-plugin-shader emit step
299
+ * wrote `manifest.json` to. Absent (or `BundlerOptions` itself omitted)
300
+ * => createRenderer falls back to '/shaders/manifest.json'
301
+ * (createRenderer.ts D-2 q5-A) so the LO 1.1 zero-config takeoff path
302
+ * keeps working without any explicit injection.
303
+ *
304
+ * Both fields are optional so `BundlerOptions = {}` is a valid call shape.
305
+ * M3 collapses the typical demo callsite to `forgeaxBundlerAdapter()` (a
306
+ * factory exported by `virtual:forgeax/bundler`), which returns an object
307
+ * with this same structural shape -- type compatibility is enforced by
308
+ * TypeScript structural typing (D-4: vite-plugin-shader does NOT import
309
+ * `@forgeax/engine-app`, so this interface is the consumer-side SSOT).
310
+ */
311
+ export interface BundlerOptions {
312
+ /**
313
+ * Dev-only ImportTransport forwarded verbatim to createRenderer (and thence
314
+ * to the AssetRegistry third ctor slot). Absent => shipped form (a DDC miss
315
+ * fails fast with `asset-not-imported`).
316
+ *
317
+ * The `| undefined` widening is necessary because exactOptionalPropertyTypes
318
+ * is enabled at the workspace level (tsconfig.base.json); it lets tests
319
+ * (and demos that gate on a build-mode flag) write `{ importTransport:
320
+ * undefined }` without a TS2379 error.
321
+ */
322
+ readonly importTransport?: ImportTransport | undefined;
323
+ /**
324
+ * vite-plugin-shader emit URL (the path the build wrote `manifest.json`
325
+ * to). Absent => createRenderer falls back to '/shaders/manifest.json'.
326
+ * Tests can inject via a `data:application/json,...` URL to bypass fetch.
327
+ *
328
+ * The `| undefined` widening lets tests opt into the zero-entry mode by
329
+ * writing `{ shaderManifestUrl: undefined }` (the createRenderer body
330
+ * checks `'shaderManifestUrl' in bundler` to distinguish "absent" from
331
+ * "explicitly undefined"; see D-2 q5-A in plan-strategy).
332
+ */
333
+ readonly shaderManifestUrl?: string | undefined;
334
+ }
335
+
336
+ /**
337
+ * App handle returned by createApp(...). Host owns the lifecycle and
338
+ * interacts with the rAF loop through start / stop / pause / resume +
339
+ * the structured error fan-out via onError.
340
+ *
341
+ * M1 skeleton: start / stop / pause / resume return Result.ok(undefined)
342
+ * synchronously and onError returns a no-op unsubscribe. The 4-state
343
+ * machine + idempotent transitions land in M2 (plan-strategy section 7).
344
+ */
345
+ export interface App {
346
+ /** Caller-owned Renderer (reference equality with the assemble input). */
347
+ readonly renderer: Renderer;
348
+ /** App-owned single-scope runtime Registry; disposed with the Cordis realm. */
349
+ readonly assets: AssetRegistry;
350
+ /** Caller-owned World (reference equality with the assemble input). */
351
+ readonly world: World;
352
+ /** Host-side lifecycle and immutable diagnostics for the selected execution tier. */
353
+ readonly execution: ExecutionControl;
354
+ /**
355
+ * Pause frame submission and relinquish the renderer presentation surface
356
+ * without replacing World, Renderer, AssetRegistry, plugins, or history.
357
+ */
358
+ releaseSurfacePreserveWorld(): Promise<Result<void, RhiError>>;
359
+ /** Restore the same surface and resume only when release paused a running App. */
360
+ restoreSurface(): Promise<Result<void, RhiError>>;
361
+ /** Native Cordis realm that owns this App's capability fibers and effects. */
362
+ readonly pluginContext: Context;
363
+ /** InputBackend handle when input attach is enabled; undefined otherwise. */
364
+ readonly input?: InputBackend;
365
+ /** AudioBackend handle when audio attach is enabled; undefined otherwise. */
366
+ readonly audio?: AudioBackend;
367
+ /**
368
+ * PhysicsWorld handle when physicsPlugin is loaded; undefined
369
+ * otherwise. physicsPlugin.build awaits the WASM import -- createApp
370
+ * resolves ONLY after the WASM module is loaded, so this field is
371
+ * populated immediately when createApp returns (AC-06: no timing gap).
372
+ */
373
+ readonly physics?: PhysicsWorld | PhysicsWorld2D | undefined;
374
+ /**
375
+ * Immediate-mode debug-draw overlay instance (feat-20260615 debug-draw M5).
376
+ *
377
+ * Created automatically during createApp (canvas form). AI users call
378
+ * `app.debugDraw.line(a, b, RED)` in any system and the overlay renders
379
+ * at frame-end via the render-graph's debug-overlay pass. Shape calls are
380
+ * immediate-mode — vertices accumulate per-frame and are flushed at the
381
+ * tonemap suffix; stale data from frame N-1 is never visible in frame N.
382
+ *
383
+ * Undefined when debug-draw is not wired (assemble-form createApp with
384
+ * no explicit debugDraw creation — the auto-attach is canvas-form only).
385
+ */
386
+ readonly debugDraw?: DebugDraw | undefined;
387
+ /**
388
+ * Begin rAF scheduling. Idempotent guard lands in M2:
389
+ * - first call: Result.ok(undefined)
390
+ * - second call (already running): Result.err({ code: 'app-already-running' })
391
+ * M1 stub returns Result.ok(undefined) unconditionally.
392
+ */
393
+ start(): Result<void, AppError>;
394
+ /**
395
+ * Stop rAF scheduling. State-machine semantics land in M2:
396
+ * - 'idle' / 'stopped' state: Result.err({ code: 'app-not-started' })
397
+ * - 'running' / 'paused' state: Result.ok(undefined)
398
+ * M1 stub returns Result.ok(undefined) unconditionally.
399
+ */
400
+ stop(): Result<void, AppError>;
401
+ /** Tear down plugins, host resources, and renderer ownership. */
402
+ dispose(): Promise<Result<void, AppError>>;
403
+ /**
404
+ * Pause rAF scheduling. Idempotent in 'paused' state. M1 stub returns
405
+ * Result.ok(undefined) unconditionally; full state machine in M2.
406
+ */
407
+ pause(): Result<void, AppError>;
408
+ /**
409
+ * Resume rAF scheduling from paused state. M1 stub returns
410
+ * Result.ok(undefined) unconditionally; full state machine in M2.
411
+ */
412
+ resume(): Result<void, AppError>;
413
+ /**
414
+ * Advance one complete update/draw frame through the App-owned frame authority.
415
+ * The App must be paused; deterministic tools supply the explicit delta.
416
+ */
417
+ stepFrame(deltaSeconds: number): Result<void, AppDispatchError>;
418
+ /**
419
+ * Subscribe to structured errors fan-out from the rAF loop. Returns an
420
+ * unsubscribe handle. The callback signature deliberately excludes raw
421
+ * Error (charter P3 -- AI users walk .code, not message strings).
422
+ *
423
+ * M1 stub: registers nothing and returns a no-op unsubscribe; full
424
+ * fan-out registry lands in M4 (plan-strategy section 7).
425
+ */
426
+ onError(cb: (err: AppDispatchError) => void): () => void;
427
+ /**
428
+ * Replace the per-frame world routing pull. `undefined` restores the
429
+ * single-world path; an injected result updates every returned secondary
430
+ * World before drawing it with the declared owners. This changes routing,
431
+ * not scheduling or time ownership.
432
+ */
433
+ setDrawSource(drawSource: DrawSource | undefined): void;
434
+ /**
435
+ * Most recent device-loss error retained for host self-inspection without
436
+ * requiring an onError listener up front.
437
+ */
438
+ readonly lastError?: AppDispatchError | undefined;
439
+ /**
440
+ * Optional single-frame RHI capture capability.
441
+ *
442
+ * A successful capture returns one `{ kind: 'rhi-tape', digest, bytes }`
443
+ * artifact. Pass that same artifact to DevKit summary and inspect
444
+ * operations; the selection key is `FrameModel.works[].workIndex`.
445
+ */
446
+ readonly rhiCapture?: RhiCapture | undefined;
447
+ /**
448
+ * Handle for the remote eval server started by createApp (dev mode).
449
+ *
450
+ * `undefined` in production builds and headless/dawn-node without explicit
451
+ * opt-in. When present, the host can read `app.remote.port` for WS connection
452
+ * details or call `await app.remote.close()` to tear down the server
453
+ * (feat-20260629-inspector-two-layer-model M4 / w20).
454
+ *
455
+ * Typed as {@link RemoteHandle} from `@forgeax/engine-types` — a neutral
456
+ * package with no dependency on `@forgeax/engine-remote`.
457
+ */
458
+ readonly remote?: import('@forgeax/engine-types').RemoteHandle | undefined;
459
+ }
460
+
461
+ /** Host control returned by the unified execution path. Engine-owned objects remain realm-local. */
462
+ export type ExecutionApp = Pick<
463
+ App,
464
+ | 'execution'
465
+ | 'input'
466
+ | 'audio'
467
+ | 'rhiCapture'
468
+ | 'start'
469
+ | 'stop'
470
+ | 'pause'
471
+ | 'resume'
472
+ | 'onError'
473
+ | 'lastError'
474
+ >;
475
+
476
+ /** Artifact returned by the browser RHI-debug capture capability. */
477
+ export interface RhiCaptureArtifact {
478
+ readonly kind: 'rhi-tape';
479
+ readonly digest: string;
480
+ readonly bytes: Uint8Array;
481
+ }
482
+
483
+ /** Same-origin browser hook shared by main-serial and Worker execution. */
484
+ export interface RhiCaptureHook {
485
+ captureFrame(options?: CaptureFrameOptions): Promise<Result<RhiCaptureArtifact, RhiDebugError>>;
486
+ }
487
+
488
+ /**
489
+ * Error union returned by the assemble-form entry. The canvas-form thin
490
+ * wrapper widens this with EngineEnvironmentError (createRenderer
491
+ * construction-time failure path -- plan-strategy D-5 / requirements AC-01).
492
+ *
493
+ * Cordis activation failures are projected into AppError at this boundary.
494
+ */
495
+ export type AssembleAppError = AppError | RhiError | AssetRuntimeAssemblyError;
496
+
497
+ /**
498
+ * Error union returned by the canvas-form thin wrapper. Extends
499
+ * AssembleAppError with EngineEnvironmentError to surface
500
+ * createRenderer construction-time failures unchanged (preserves
501
+ * .detail.webgpuError per requirements section 6.1).
502
+ *
503
+ * The canvas form adds renderer construction failures.
504
+ */
505
+ export type CanvasAppError = AssembleAppError | EngineEnvironmentError;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Vite replaces this one import-meta key in browser hosts. The app package
3
+ * also ships to Dawn/Node, where the property is simply absent at runtime.
4
+ */
5
+ interface ImportMeta {
6
+ readonly env?: {
7
+ readonly DEV?: boolean;
8
+ readonly FORGEAX_ENGINE_RHI_DEBUG?: string;
9
+ /** Explicit opt-in for bounded producer-owned semantic observations. */
10
+ readonly VITE_FORGEAX_ENGINE_RHI_SEMANTIC?: string;
11
+ };
12
+ }