@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.
- package/LICENSE +202 -0
- package/README.md +418 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/__tests__/animation-asset-lookup.unit.test.d.ts +2 -0
- package/dist/__tests__/animation-asset-lookup.unit.test.d.ts.map +1 -0
- package/dist/__tests__/app-rebuild.test.d.ts +2 -0
- package/dist/__tests__/app-rebuild.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry-types.test-d.d.ts +2 -0
- package/dist/__tests__/asset-registry-types.test-d.d.ts.map +1 -0
- package/dist/__tests__/assets-runtime-assembly.integration.test.d.ts +2 -0
- package/dist/__tests__/assets-runtime-assembly.integration.test.d.ts.map +1 -0
- package/dist/__tests__/callback-deletion.unit.test.d.ts +2 -0
- package/dist/__tests__/callback-deletion.unit.test.d.ts.map +1 -0
- package/dist/__tests__/callback-inference.test-d.d.ts +2 -0
- package/dist/__tests__/callback-inference.test-d.d.ts.map +1 -0
- package/dist/__tests__/component-introspection.unit.test.d.ts +2 -0
- package/dist/__tests__/component-introspection.unit.test.d.ts.map +1 -0
- package/dist/__tests__/consumer-migration.unit.test.d.ts +2 -0
- package/dist/__tests__/consumer-migration.unit.test.d.ts.map +1 -0
- package/dist/__tests__/create-app-features.test.d.ts +2 -0
- package/dist/__tests__/create-app-features.test.d.ts.map +1 -0
- package/dist/__tests__/create-app-listener-sync.test.d.ts +2 -0
- package/dist/__tests__/create-app-listener-sync.test.d.ts.map +1 -0
- package/dist/__tests__/create-app-lock-provider.test.d.ts +2 -0
- package/dist/__tests__/create-app-lock-provider.test.d.ts.map +1 -0
- package/dist/__tests__/create-app-plugin.test.d.ts +2 -0
- package/dist/__tests__/create-app-plugin.test.d.ts.map +1 -0
- package/dist/__tests__/create-app-stop.test.d.ts +2 -0
- package/dist/__tests__/create-app-stop.test.d.ts.map +1 -0
- package/dist/__tests__/create-app-time.unit.test.d.ts +2 -0
- package/dist/__tests__/create-app-time.unit.test.d.ts.map +1 -0
- package/dist/__tests__/create-app.test-d.d.ts +2 -0
- package/dist/__tests__/create-app.test-d.d.ts.map +1 -0
- package/dist/__tests__/create-app.test.d.ts +2 -0
- package/dist/__tests__/create-app.test.d.ts.map +1 -0
- package/dist/__tests__/create-renderer-error.integration.test.d.ts +2 -0
- package/dist/__tests__/create-renderer-error.integration.test.d.ts.map +1 -0
- package/dist/__tests__/create-renderer-lifecycle.integration.test.d.ts +2 -0
- package/dist/__tests__/create-renderer-lifecycle.integration.test.d.ts.map +1 -0
- package/dist/__tests__/docs-gate-green.unit.test.d.ts +2 -0
- package/dist/__tests__/docs-gate-green.unit.test.d.ts.map +1 -0
- package/dist/__tests__/draw-source-headless-full-chain.test.d.ts +2 -0
- package/dist/__tests__/draw-source-headless-full-chain.test.d.ts.map +1 -0
- package/dist/__tests__/draw-source-injected-world-update-visibility.test.d.ts +2 -0
- package/dist/__tests__/draw-source-injected-world-update-visibility.test.d.ts.map +1 -0
- package/dist/__tests__/draw-source-single-world-regression.test.d.ts +2 -0
- package/dist/__tests__/draw-source-single-world-regression.test.d.ts.map +1 -0
- package/dist/__tests__/ecs-import.unit.test.d.ts +2 -0
- package/dist/__tests__/ecs-import.unit.test.d.ts.map +1 -0
- package/dist/__tests__/engine-worker-bootstrap-channel.unit.test.d.ts +2 -0
- package/dist/__tests__/engine-worker-bootstrap-channel.unit.test.d.ts.map +1 -0
- package/dist/__tests__/engine-worker-world-swap.unit.test.d.ts +2 -0
- package/dist/__tests__/engine-worker-world-swap.unit.test.d.ts.map +1 -0
- package/dist/__tests__/errors-pointer-lock-failed.test.d.ts +2 -0
- package/dist/__tests__/errors-pointer-lock-failed.test.d.ts.map +1 -0
- package/dist/__tests__/execution-bootstrap-isolation.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-bootstrap-isolation.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-error-detail.test-d.d.ts +2 -0
- package/dist/__tests__/execution-error-detail.test-d.d.ts.map +1 -0
- package/dist/__tests__/execution-error-detail.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-error-detail.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-frame-order.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-frame-order.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-frame-protocol.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-frame-protocol.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-input-sample.contract.test.d.ts +2 -0
- package/dist/__tests__/execution-input-sample.contract.test.d.ts.map +1 -0
- package/dist/__tests__/execution-measurement.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-measurement.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-public-api.test-d.d.ts +2 -0
- package/dist/__tests__/execution-public-api.test-d.d.ts.map +1 -0
- package/dist/__tests__/execution-public-api.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-public-api.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-rebuild.contract.test.d.ts +2 -0
- package/dist/__tests__/execution-rebuild.contract.test.d.ts.map +1 -0
- package/dist/__tests__/execution-report.contract.test.d.ts +2 -0
- package/dist/__tests__/execution-report.contract.test.d.ts.map +1 -0
- package/dist/__tests__/execution-report.types.test-d.d.ts +2 -0
- package/dist/__tests__/execution-report.types.test-d.d.ts.map +1 -0
- package/dist/__tests__/execution-schema-freshness.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-schema-freshness.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-selector.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-selector.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-shared-kernel.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-shared-kernel.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-world-health-owner.test-d.d.ts +2 -0
- package/dist/__tests__/execution-world-health-owner.test-d.d.ts.map +1 -0
- package/dist/__tests__/fallback-camera.unit.test.d.ts +2 -0
- package/dist/__tests__/fallback-camera.unit.test.d.ts.map +1 -0
- package/dist/__tests__/frame-loop-time-elapsed.test.d.ts +2 -0
- package/dist/__tests__/frame-loop-time-elapsed.test.d.ts.map +1 -0
- package/dist/__tests__/frame-loop-time.unit.test.d.ts +2 -0
- package/dist/__tests__/frame-loop-time.unit.test.d.ts.map +1 -0
- package/dist/__tests__/frame-loop-world-array.test.d.ts +2 -0
- package/dist/__tests__/frame-loop-world-array.test.d.ts.map +1 -0
- package/dist/__tests__/kernel-worker-runtime.unit.test.d.ts +2 -0
- package/dist/__tests__/kernel-worker-runtime.unit.test.d.ts.map +1 -0
- package/dist/__tests__/migration-surface-inventory.unit.test.d.ts +2 -0
- package/dist/__tests__/migration-surface-inventory.unit.test.d.ts.map +1 -0
- package/dist/__tests__/plugin-policy.integration.test.d.ts +2 -0
- package/dist/__tests__/plugin-policy.integration.test.d.ts.map +1 -0
- package/dist/__tests__/plugin-profiles.unit.test.d.ts +2 -0
- package/dist/__tests__/plugin-profiles.unit.test.d.ts.map +1 -0
- package/dist/__tests__/profiler-default-off.test.d.ts +2 -0
- package/dist/__tests__/profiler-default-off.test.d.ts.map +1 -0
- package/dist/__tests__/profiler-frame-token.test.d.ts +2 -0
- package/dist/__tests__/profiler-frame-token.test.d.ts.map +1 -0
- package/dist/__tests__/profiler-phase-catalog.test.d.ts +2 -0
- package/dist/__tests__/profiler-phase-catalog.test.d.ts.map +1 -0
- package/dist/__tests__/profiler-phase-integration.test.d.ts +2 -0
- package/dist/__tests__/profiler-phase-integration.test.d.ts.map +1 -0
- package/dist/__tests__/profiler-remote-bridge.test.d.ts +2 -0
- package/dist/__tests__/profiler-remote-bridge.test.d.ts.map +1 -0
- package/dist/__tests__/remote-integration.test.d.ts +2 -0
- package/dist/__tests__/remote-integration.test.d.ts.map +1 -0
- package/dist/__tests__/remote-serve-flag.test.d.ts +2 -0
- package/dist/__tests__/remote-serve-flag.test.d.ts.map +1 -0
- package/dist/__tests__/rhi-capture-capability.test-d.d.ts +2 -0
- package/dist/__tests__/rhi-capture-capability.test-d.d.ts.map +1 -0
- package/dist/__tests__/rhi-capture-host.integration.test.d.ts +2 -0
- package/dist/__tests__/rhi-capture-host.integration.test.d.ts.map +1 -0
- package/dist/__tests__/rhi-capture.browser.test.d.ts +2 -0
- package/dist/__tests__/rhi-capture.browser.test.d.ts.map +1 -0
- package/dist/__tests__/surface-handoff.test.d.ts +2 -0
- package/dist/__tests__/surface-handoff.test.d.ts.map +1 -0
- package/dist/__tests__/types-m2.test-d.d.ts +2 -0
- package/dist/__tests__/types-m2.test-d.d.ts.map +1 -0
- package/dist/__tests__/visibility-remote.integration.test.d.ts +2 -0
- package/dist/__tests__/visibility-remote.integration.test.d.ts.map +1 -0
- package/dist/__tests__/worker-execution-stop.test.d.ts +2 -0
- package/dist/__tests__/worker-execution-stop.test.d.ts.map +1 -0
- package/dist/animation-asset-lookup.d.ts +8 -0
- package/dist/animation-asset-lookup.d.ts.map +1 -0
- package/dist/assets-runtime-assembly.d.ts +19 -0
- package/dist/assets-runtime-assembly.d.ts.map +1 -0
- package/dist/canvas-policy.d.ts +4 -0
- package/dist/canvas-policy.d.ts.map +1 -0
- package/dist/create-app.d.ts +57 -0
- package/dist/create-app.d.ts.map +1 -0
- package/dist/engine-worker-runtime.mjs +884 -0
- package/dist/engine-worker-runtime.mjs.map +1 -0
- package/dist/errors.d.ts +263 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/execution/attached-world-swap.d.ts +21 -0
- package/dist/execution/attached-world-swap.d.ts.map +1 -0
- package/dist/execution/bootstrap-entry.d.ts +30 -0
- package/dist/execution/bootstrap-entry.d.ts.map +1 -0
- package/dist/execution/capabilities.d.ts +5 -0
- package/dist/execution/capabilities.d.ts.map +1 -0
- package/dist/execution/control.d.ts +14 -0
- package/dist/execution/control.d.ts.map +1 -0
- package/dist/execution/engine-worker-runtime.d.ts +2 -0
- package/dist/execution/engine-worker-runtime.d.ts.map +1 -0
- package/dist/execution/engine-worker.d.ts +23 -0
- package/dist/execution/engine-worker.d.ts.map +1 -0
- package/dist/execution/host-controller.d.ts +16 -0
- package/dist/execution/host-controller.d.ts.map +1 -0
- package/dist/execution/index.d.ts +10 -0
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/kernel-pool.d.ts +14 -0
- package/dist/execution/kernel-pool.d.ts.map +1 -0
- package/dist/execution/kernel-worker-runtime.d.ts +2 -0
- package/dist/execution/kernel-worker-runtime.d.ts.map +1 -0
- package/dist/execution/measurement.d.ts +7 -0
- package/dist/execution/measurement.d.ts.map +1 -0
- package/dist/execution/protocol.d.ts +84 -0
- package/dist/execution/protocol.d.ts.map +1 -0
- package/dist/execution/report.d.ts +5 -0
- package/dist/execution/report.d.ts.map +1 -0
- package/dist/execution/schema.d.ts +4 -0
- package/dist/execution/schema.d.ts.map +1 -0
- package/dist/execution/selector.d.ts +10 -0
- package/dist/execution/selector.d.ts.map +1 -0
- package/dist/execution/types.d.ts +107 -0
- package/dist/execution/types.d.ts.map +1 -0
- package/dist/fallback-camera.d.ts +8 -0
- package/dist/fallback-camera.d.ts.map +1 -0
- package/dist/game-context.d.ts +98 -0
- package/dist/game-context.d.ts.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +3985 -0
- package/dist/index.mjs.map +1 -0
- package/dist/input-map-plugin.d.ts +5 -0
- package/dist/input-map-plugin.d.ts.map +1 -0
- package/dist/input-plugin.d.ts +4 -0
- package/dist/input-plugin.d.ts.map +1 -0
- package/dist/internal/assembled-engine-profile.d.ts +5 -0
- package/dist/internal/assembled-engine-profile.d.ts.map +1 -0
- package/dist/internal/assets-world-plugin.d.ts +21 -0
- package/dist/internal/assets-world-plugin.d.ts.map +1 -0
- package/dist/internal/browser-remote-bridge.d.ts +25 -0
- package/dist/internal/browser-remote-bridge.d.ts.map +1 -0
- package/dist/internal/browser-rhi-debug-runtime.d.ts +18 -0
- package/dist/internal/browser-rhi-debug-runtime.d.ts.map +1 -0
- package/dist/internal/component-introspection.d.ts +24 -0
- package/dist/internal/component-introspection.d.ts.map +1 -0
- package/dist/internal/ecs-import.d.ts +6 -0
- package/dist/internal/ecs-import.d.ts.map +1 -0
- package/dist/internal/engine-profile-common.d.ts +9 -0
- package/dist/internal/engine-profile-common.d.ts.map +1 -0
- package/dist/internal/error-fanout.d.ts +66 -0
- package/dist/internal/error-fanout.d.ts.map +1 -0
- package/dist/internal/frame-loop.d.ts +35 -0
- package/dist/internal/frame-loop.d.ts.map +1 -0
- package/dist/internal/input-attach.d.ts +44 -0
- package/dist/internal/input-attach.d.ts.map +1 -0
- package/dist/internal/main-engine-profile.d.ts +15 -0
- package/dist/internal/main-engine-profile.d.ts.map +1 -0
- package/dist/internal/remote-serve-flag.d.ts +23 -0
- package/dist/internal/remote-serve-flag.d.ts.map +1 -0
- package/dist/internal/remote-server-plugin.d.ts +8 -0
- package/dist/internal/remote-server-plugin.d.ts.map +1 -0
- package/dist/internal/rhi-capture.d.ts +19 -0
- package/dist/internal/rhi-capture.d.ts.map +1 -0
- package/dist/internal/rhi-debug-flag.d.ts +18 -0
- package/dist/internal/rhi-debug-flag.d.ts.map +1 -0
- package/dist/internal/worker-engine-profile.d.ts +13 -0
- package/dist/internal/worker-engine-profile.d.ts.map +1 -0
- package/dist/kernel-worker-runtime.mjs +69 -0
- package/dist/kernel-worker-runtime.mjs.map +1 -0
- package/dist/load-game-errors.d.ts +131 -0
- package/dist/load-game-errors.d.ts.map +1 -0
- package/dist/load-game.d.ts +34 -0
- package/dist/load-game.d.ts.map +1 -0
- package/dist/plugin-factories.d.ts +3 -0
- package/dist/plugin-factories.d.ts.map +1 -0
- package/dist/tool-preview/bootstrap.d.ts +113 -0
- package/dist/tool-preview/bootstrap.d.ts.map +1 -0
- package/dist/tool-preview/evidence.d.ts +20 -0
- package/dist/tool-preview/evidence.d.ts.map +1 -0
- package/dist/tool-preview/framing.d.ts +13 -0
- package/dist/tool-preview/framing.d.ts.map +1 -0
- package/dist/tool-preview/recipe.d.ts +54 -0
- package/dist/tool-preview/recipe.d.ts.map +1 -0
- package/dist/types.d.ts +444 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +86 -0
- package/schema/execution-report.schema.json +168 -0
- package/src/__tests__/animation-asset-lookup.unit.test.ts +20 -0
- package/src/__tests__/app-rebuild.test.ts +31 -0
- package/src/__tests__/asset-registry-types.test-d.ts +16 -0
- package/src/__tests__/assets-runtime-assembly.integration.test.ts +68 -0
- package/src/__tests__/callback-deletion.unit.test.ts +14 -0
- package/src/__tests__/callback-inference.test-d.ts +32 -0
- package/src/__tests__/component-introspection.unit.test.ts +56 -0
- package/src/__tests__/consumer-migration.unit.test.ts +21 -0
- package/src/__tests__/create-app-features.test.ts +40 -0
- package/src/__tests__/create-app-listener-sync.test.ts +377 -0
- package/src/__tests__/create-app-lock-provider.test.ts +212 -0
- package/src/__tests__/create-app-plugin.test.ts +217 -0
- package/src/__tests__/create-app-stop.test.ts +617 -0
- package/src/__tests__/create-app-time.unit.test.ts +26 -0
- package/src/__tests__/create-app.test-d.ts +82 -0
- package/src/__tests__/create-app.test.ts +346 -0
- package/src/__tests__/create-renderer-error.integration.test.ts +24 -0
- package/src/__tests__/create-renderer-lifecycle.integration.test.ts +19 -0
- package/src/__tests__/docs-gate-green.unit.test.ts +61 -0
- package/src/__tests__/draw-source-headless-full-chain.test.ts +226 -0
- package/src/__tests__/draw-source-injected-world-update-visibility.test.ts +182 -0
- package/src/__tests__/draw-source-single-world-regression.test.ts +185 -0
- package/src/__tests__/ecs-import.unit.test.ts +40 -0
- package/src/__tests__/engine-worker-bootstrap-channel.unit.test.ts +74 -0
- package/src/__tests__/engine-worker-world-swap.unit.test.ts +76 -0
- package/src/__tests__/errors-pointer-lock-failed.test.ts +268 -0
- package/src/__tests__/execution-bootstrap-isolation.unit.test.ts +80 -0
- package/src/__tests__/execution-error-detail.test-d.ts +13 -0
- package/src/__tests__/execution-error-detail.unit.test.ts +35 -0
- package/src/__tests__/execution-frame-order.unit.test.ts +38 -0
- package/src/__tests__/execution-frame-protocol.unit.test.ts +61 -0
- package/src/__tests__/execution-input-sample.contract.test.ts +23 -0
- package/src/__tests__/execution-measurement.unit.test.ts +20 -0
- package/src/__tests__/execution-public-api.test-d.ts +10 -0
- package/src/__tests__/execution-public-api.unit.test.ts +9 -0
- package/src/__tests__/execution-rebuild.contract.test.ts +36 -0
- package/src/__tests__/execution-report.contract.test.ts +50 -0
- package/src/__tests__/execution-report.types.test-d.ts +16 -0
- package/src/__tests__/execution-schema-freshness.unit.test.ts +20 -0
- package/src/__tests__/execution-selector.unit.test.ts +72 -0
- package/src/__tests__/execution-shared-kernel.unit.test.ts +180 -0
- package/src/__tests__/execution-world-health-owner.test-d.ts +9 -0
- package/src/__tests__/fallback-camera.unit.test.ts +32 -0
- package/src/__tests__/frame-loop-time-elapsed.test.ts +115 -0
- package/src/__tests__/frame-loop-time.unit.test.ts +61 -0
- package/src/__tests__/frame-loop-world-array.test.ts +441 -0
- package/src/__tests__/kernel-worker-runtime.unit.test.ts +50 -0
- package/src/__tests__/migration-surface-inventory.unit.test.ts +13 -0
- package/src/__tests__/plugin-policy.integration.test.ts +15 -0
- package/src/__tests__/plugin-profiles.unit.test.ts +190 -0
- package/src/__tests__/profiler-default-off.test.ts +53 -0
- package/src/__tests__/profiler-frame-token.test.ts +248 -0
- package/src/__tests__/profiler-phase-catalog.test.ts +30 -0
- package/src/__tests__/profiler-phase-integration.test.ts +129 -0
- package/src/__tests__/profiler-remote-bridge.test.ts +31 -0
- package/src/__tests__/remote-integration.test.ts +224 -0
- package/src/__tests__/remote-serve-flag.test.ts +24 -0
- package/src/__tests__/rhi-capture-capability.test-d.ts +22 -0
- package/src/__tests__/rhi-capture-host.integration.test.ts +157 -0
- package/src/__tests__/rhi-capture.browser.test.ts +51 -0
- package/src/__tests__/surface-handoff.test.ts +92 -0
- package/src/__tests__/types-m2.test-d.ts +81 -0
- package/src/__tests__/visibility-remote.integration.test.ts +119 -0
- package/src/__tests__/worker-execution-stop.test.ts +116 -0
- package/src/animation-asset-lookup.ts +13 -0
- package/src/assets-runtime-assembly.ts +70 -0
- package/src/canvas-policy.ts +16 -0
- package/src/create-app.ts +1351 -0
- package/src/errors.ts +454 -0
- package/src/execution/attached-world-swap.ts +67 -0
- package/src/execution/bootstrap-entry.ts +122 -0
- package/src/execution/capabilities.ts +102 -0
- package/src/execution/control.ts +52 -0
- package/src/execution/engine-worker-runtime.ts +400 -0
- package/src/execution/engine-worker.ts +161 -0
- package/src/execution/host-controller.ts +454 -0
- package/src/execution/index.ts +43 -0
- package/src/execution/kernel-pool.ts +236 -0
- package/src/execution/kernel-worker-runtime.ts +103 -0
- package/src/execution/measurement.ts +39 -0
- package/src/execution/protocol.ts +131 -0
- package/src/execution/report.ts +66 -0
- package/src/execution/schema.ts +168 -0
- package/src/execution/selector.ts +98 -0
- package/src/execution/types.ts +146 -0
- package/src/fallback-camera.ts +20 -0
- package/src/game-context.ts +126 -0
- package/src/index.ts +176 -0
- package/src/input-map-plugin.ts +21 -0
- package/src/input-plugin.ts +26 -0
- package/src/internal/assembled-engine-profile.ts +22 -0
- package/src/internal/assets-world-plugin.ts +79 -0
- package/src/internal/browser-remote-bridge.ts +267 -0
- package/src/internal/browser-rhi-debug-runtime.ts +67 -0
- package/src/internal/component-introspection.ts +116 -0
- package/src/internal/ecs-import.ts +41 -0
- package/src/internal/engine-profile-common.ts +10 -0
- package/src/internal/error-fanout.ts +129 -0
- package/src/internal/frame-loop.ts +525 -0
- package/src/internal/input-attach.ts +104 -0
- package/src/internal/main-engine-profile.ts +80 -0
- package/src/internal/remote-serve-flag.ts +50 -0
- package/src/internal/remote-server-plugin.ts +16 -0
- package/src/internal/rhi-capture.ts +211 -0
- package/src/internal/rhi-debug-flag.ts +40 -0
- package/src/internal/worker-engine-profile.ts +47 -0
- package/src/load-game-errors.ts +211 -0
- package/src/load-game.ts +115 -0
- package/src/plugin-factories.ts +2 -0
- package/src/tool-preview/bootstrap.ts +848 -0
- package/src/tool-preview/evidence.ts +59 -0
- package/src/tool-preview/framing.ts +52 -0
- package/src/tool-preview/recipe.ts +137 -0
- package/src/types.ts +505 -0
- package/src/vite-env.d.ts +12 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { World } from '@forgeax/engine-ecs';
|
|
2
|
+
import type { Renderer } from '@forgeax/engine-render';
|
|
3
|
+
import { Visibility } from '@forgeax/engine-render';
|
|
4
|
+
import { defaultConnect } from '@forgeax/engine-types/inspector-client';
|
|
5
|
+
import { describe, expect, it } from 'vitest';
|
|
6
|
+
import { WebSocket } from 'ws';
|
|
7
|
+
import { createApp } from '../create-app';
|
|
8
|
+
|
|
9
|
+
async function introspect(port: number): Promise<Record<string, unknown>> {
|
|
10
|
+
const ws = new WebSocket(`ws://127.0.0.1:${port}/inspector`);
|
|
11
|
+
await new Promise<void>((resolve, reject) => {
|
|
12
|
+
ws.once('open', () => resolve());
|
|
13
|
+
ws.once('error', reject);
|
|
14
|
+
});
|
|
15
|
+
try {
|
|
16
|
+
return await new Promise<Record<string, unknown>>((resolve, reject) => {
|
|
17
|
+
ws.once('message', (raw) => {
|
|
18
|
+
try {
|
|
19
|
+
const response = JSON.parse(raw.toString()) as { result: Record<string, unknown> };
|
|
20
|
+
resolve(response.result);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
reject(error);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
ws.send(JSON.stringify({ jsonrpc: '2.0', method: 'introspect', id: 1 }));
|
|
26
|
+
});
|
|
27
|
+
} finally {
|
|
28
|
+
ws.close();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function makeRendererStub(): Renderer {
|
|
33
|
+
return {
|
|
34
|
+
backend: 'webgpu',
|
|
35
|
+
ready: Promise.resolve({ ok: true, value: undefined }),
|
|
36
|
+
draw: () => ({ ok: true, value: undefined }),
|
|
37
|
+
onError: () => () => {},
|
|
38
|
+
onLost: () => () => {},
|
|
39
|
+
dispose: () => {},
|
|
40
|
+
visibilityStats: { explicitlyHidden: 1 },
|
|
41
|
+
} as unknown as Renderer;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
describe('createApp to remote visibility discovery', () => {
|
|
45
|
+
it('introspects then evaluates a Query, recovers an invalid write, and reads stats', async () => {
|
|
46
|
+
const previous = process.env.FORGEAX_ENGINE_REMOTE_SERVE;
|
|
47
|
+
process.env.FORGEAX_ENGINE_REMOTE_SERVE = '1';
|
|
48
|
+
const world = new World();
|
|
49
|
+
world.components.register(Visibility).unwrap();
|
|
50
|
+
const result = await createApp({ renderer: makeRendererStub(), world });
|
|
51
|
+
expect(result.ok).toBe(true);
|
|
52
|
+
if (!result.ok) return;
|
|
53
|
+
expect(result.value.remote).toBeDefined();
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
const port = result.value.remote?.port;
|
|
57
|
+
expect(port).toBeGreaterThan(0);
|
|
58
|
+
if (port === undefined) return;
|
|
59
|
+
const doc = await introspect(port);
|
|
60
|
+
const schemas = (doc.components as { schemas: Record<string, unknown> }).schemas;
|
|
61
|
+
expect(schemas.Visibility).toBeDefined();
|
|
62
|
+
expect((doc.methods as Array<{ name: string }>).map((method) => method.name)).toEqual([
|
|
63
|
+
'eval',
|
|
64
|
+
'introspect',
|
|
65
|
+
]);
|
|
66
|
+
|
|
67
|
+
const connection = await defaultConnect(`ws://127.0.0.1:${port}/inspector`);
|
|
68
|
+
expect(connection.ok).toBe(true);
|
|
69
|
+
if (!connection.ok) return;
|
|
70
|
+
try {
|
|
71
|
+
const value = await connection.value.eval(`(async () => {
|
|
72
|
+
const render = await _import('@forgeax/engine-render');
|
|
73
|
+
const entity = world.spawn({
|
|
74
|
+
component: render.Visibility,
|
|
75
|
+
data: { state: render.VisibilityStateValue.hidden },
|
|
76
|
+
}).unwrap();
|
|
77
|
+
const query = world.query({ read: [render.Visibility] }).unwrap();
|
|
78
|
+
let current;
|
|
79
|
+
for (const row of query) {
|
|
80
|
+
current = render.visibilityStateFromU32(row.get(render.Visibility).state);
|
|
81
|
+
}
|
|
82
|
+
const effective = render.resolveVisibility(world).effective(entity);
|
|
83
|
+
const invalid = world.set(entity, render.Visibility, { state: 99 });
|
|
84
|
+
const recovered = world.set(entity, render.Visibility, {
|
|
85
|
+
state: render.VisibilityStateValue.visible,
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
current,
|
|
89
|
+
effective,
|
|
90
|
+
invalid: invalid.ok ? undefined : {
|
|
91
|
+
code: invalid.error.code,
|
|
92
|
+
expected: invalid.error.expected,
|
|
93
|
+
hint: invalid.error.hint,
|
|
94
|
+
detail: invalid.error.detail,
|
|
95
|
+
},
|
|
96
|
+
recovered: recovered.ok,
|
|
97
|
+
restored: render.resolveVisibility(world).effective(entity),
|
|
98
|
+
visibilityStats: renderer.visibilityStats,
|
|
99
|
+
};
|
|
100
|
+
})()`);
|
|
101
|
+
expect(value).toMatchObject({
|
|
102
|
+
current: 'hidden',
|
|
103
|
+
effective: 'hidden',
|
|
104
|
+
invalid: { code: 'component-field-invalid-value' },
|
|
105
|
+
recovered: true,
|
|
106
|
+
restored: 'visible',
|
|
107
|
+
visibilityStats: { explicitlyHidden: 1 },
|
|
108
|
+
});
|
|
109
|
+
expect((value as { invalid: { hint: string } }).invalid.hint.length).toBeGreaterThan(0);
|
|
110
|
+
} finally {
|
|
111
|
+
await connection.value.dispose();
|
|
112
|
+
}
|
|
113
|
+
} finally {
|
|
114
|
+
await result.value.remote?.close();
|
|
115
|
+
if (previous === undefined) delete process.env.FORGEAX_ENGINE_REMOTE_SERVE;
|
|
116
|
+
else process.env.FORGEAX_ENGINE_REMOTE_SERVE = previous;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
});
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
|
|
3
|
+
const probes = vi.hoisted(() => ({
|
|
4
|
+
audioDispose: vi.fn(),
|
|
5
|
+
inputDetach: vi.fn(),
|
|
6
|
+
sessionDispose: vi.fn(),
|
|
7
|
+
sessionListen: vi.fn(() => () => {}),
|
|
8
|
+
sessionPost: vi.fn(),
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
vi.mock('../execution/engine-worker', async () => {
|
|
12
|
+
const { ok } = await import('@forgeax/engine-types');
|
|
13
|
+
return {
|
|
14
|
+
startEngineWorker: vi.fn(async () =>
|
|
15
|
+
ok({
|
|
16
|
+
worker: {},
|
|
17
|
+
ready: {
|
|
18
|
+
kind: 'ready' as const,
|
|
19
|
+
worldIdentity: 'worker-world',
|
|
20
|
+
realm: 'worker' as const,
|
|
21
|
+
workerWebGpu: true,
|
|
22
|
+
},
|
|
23
|
+
post: probes.sessionPost,
|
|
24
|
+
listen: probes.sessionListen,
|
|
25
|
+
dispose: probes.sessionDispose,
|
|
26
|
+
}),
|
|
27
|
+
),
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
vi.mock('@forgeax/engine-input', () => ({
|
|
32
|
+
attachBrowserInputBackend: vi.fn(() => {
|
|
33
|
+
const detach = probes.inputDetach as typeof probes.inputDetach & {
|
|
34
|
+
backend: { sample(): object; detach(): void };
|
|
35
|
+
};
|
|
36
|
+
detach.backend = {
|
|
37
|
+
sample: () => ({
|
|
38
|
+
downKeys: new Set(),
|
|
39
|
+
upKeys: new Set(),
|
|
40
|
+
buttons: [false, false, false],
|
|
41
|
+
movementX: 0,
|
|
42
|
+
movementY: 0,
|
|
43
|
+
wheelDelta: 0,
|
|
44
|
+
focused: true,
|
|
45
|
+
pointerLocked: false,
|
|
46
|
+
}),
|
|
47
|
+
detach: probes.inputDetach,
|
|
48
|
+
};
|
|
49
|
+
return detach;
|
|
50
|
+
}),
|
|
51
|
+
}));
|
|
52
|
+
|
|
53
|
+
vi.mock('@forgeax/engine-audio-webaudio', () => ({
|
|
54
|
+
createHostAudioConsumer: vi.fn(() => ({
|
|
55
|
+
consume: vi.fn(),
|
|
56
|
+
dispose: probes.audioDispose,
|
|
57
|
+
state: () => ({ contextState: 'suspended', activeSourceCount: 0, lastError: null }),
|
|
58
|
+
})),
|
|
59
|
+
}));
|
|
60
|
+
|
|
61
|
+
import { createWorkerExecutionApp } from '../execution/host-controller';
|
|
62
|
+
|
|
63
|
+
const capabilities = {
|
|
64
|
+
worker: { available: true, reason: 'test' },
|
|
65
|
+
offscreenCanvas: { available: true, reason: 'test' },
|
|
66
|
+
workerAnimationFrame: { available: true, reason: 'test' },
|
|
67
|
+
workerWebGpu: { available: true, reason: 'test' },
|
|
68
|
+
crossOriginIsolated: { available: false, reason: 'test' },
|
|
69
|
+
sharedArrayBuffer: { available: false, reason: 'test' },
|
|
70
|
+
atomicsWait: { available: false, reason: 'test' },
|
|
71
|
+
} as const;
|
|
72
|
+
|
|
73
|
+
describe('Worker ExecutionApp terminal stop', () => {
|
|
74
|
+
beforeEach(() => {
|
|
75
|
+
vi.clearAllMocks();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('cleans every host owner once when stopped while paused and cannot restart', async () => {
|
|
79
|
+
const raf = vi.fn(() => 7);
|
|
80
|
+
const cancelRaf = vi.fn();
|
|
81
|
+
vi.stubGlobal('requestAnimationFrame', raf);
|
|
82
|
+
vi.stubGlobal('cancelAnimationFrame', cancelRaf);
|
|
83
|
+
|
|
84
|
+
const result = await createWorkerExecutionApp({
|
|
85
|
+
canvas: {} as HTMLCanvasElement,
|
|
86
|
+
appOptions: { execution: { bootstrap: 'https://example.test/game.js' } } as never,
|
|
87
|
+
capabilities,
|
|
88
|
+
selection: {
|
|
89
|
+
requestedTier: 'engine-worker',
|
|
90
|
+
actualTier: 'engine-worker',
|
|
91
|
+
selectionReason: 'explicit-request',
|
|
92
|
+
missingCapabilities: [],
|
|
93
|
+
sharedEvidencePassed: false,
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
expect(result.ok).toBe(true);
|
|
97
|
+
if (!result.ok) return;
|
|
98
|
+
|
|
99
|
+
expect(result.value.start().ok).toBe(true);
|
|
100
|
+
expect(raf).toHaveBeenCalledTimes(1);
|
|
101
|
+
expect(result.value.pause().ok).toBe(true);
|
|
102
|
+
expect(cancelRaf).toHaveBeenCalledTimes(1);
|
|
103
|
+
|
|
104
|
+
expect(result.value.stop().ok).toBe(true);
|
|
105
|
+
expect(probes.inputDetach).toHaveBeenCalledTimes(1);
|
|
106
|
+
expect(probes.audioDispose).toHaveBeenCalledTimes(1);
|
|
107
|
+
expect(probes.sessionDispose).toHaveBeenCalledTimes(1);
|
|
108
|
+
expect(raf).toHaveBeenCalledTimes(1);
|
|
109
|
+
expect(cancelRaf).toHaveBeenCalledTimes(1);
|
|
110
|
+
|
|
111
|
+
const restart = result.value.start();
|
|
112
|
+
expect(restart.ok).toBe(false);
|
|
113
|
+
if (!restart.ok) expect(restart.error.code).toBe('app-not-started');
|
|
114
|
+
expect(raf).toHaveBeenCalledTimes(1);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AnimationPayloadLookup } from '@forgeax/engine-animation';
|
|
2
|
+
import type { AnimationClip, Asset } from '@forgeax/engine-types';
|
|
3
|
+
|
|
4
|
+
export interface AnimationPayloadSource {
|
|
5
|
+
lookup<T extends Asset = Asset>(guid: string): T | undefined;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Bridge the renderer-owned GUID catalogue into the animation plugin. */
|
|
9
|
+
export function createAnimationPayloadLookup(
|
|
10
|
+
source: AnimationPayloadSource | undefined,
|
|
11
|
+
): AnimationPayloadLookup {
|
|
12
|
+
return (guid) => source?.lookup<AnimationClip>(guid);
|
|
13
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { AssetDecoderLease, AssetRegistry } from '@forgeax/engine-assets-runtime';
|
|
2
|
+
import { defaultAssetDecoderContributions } from '@forgeax/engine-runtime';
|
|
3
|
+
import {
|
|
4
|
+
type AssetDecoderContributionRef,
|
|
5
|
+
type AssetKind,
|
|
6
|
+
err,
|
|
7
|
+
ok,
|
|
8
|
+
type Result,
|
|
9
|
+
} from '@forgeax/engine-types';
|
|
10
|
+
|
|
11
|
+
export interface AssetRuntimeAssemblyError {
|
|
12
|
+
readonly code: 'asset-assembly-failed';
|
|
13
|
+
readonly expected: string;
|
|
14
|
+
readonly hint: string;
|
|
15
|
+
readonly detail: { readonly kind: string; readonly cause: unknown };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface AssetRuntimeAssembly {
|
|
19
|
+
readonly registry: AssetRegistry;
|
|
20
|
+
readonly leases: readonly AssetDecoderLease[];
|
|
21
|
+
dispose(): void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Install owner decoder contributions into the realm's one asset registry. */
|
|
25
|
+
export function assembleAssetRuntime(
|
|
26
|
+
registry: AssetRegistry,
|
|
27
|
+
contributions: readonly AssetDecoderContributionRef[],
|
|
28
|
+
): Result<AssetRuntimeAssembly, AssetRuntimeAssemblyError> {
|
|
29
|
+
const leases: AssetDecoderLease[] = [];
|
|
30
|
+
const overrides = new Set(contributions.map((contribution) => contribution.kind.kind));
|
|
31
|
+
const defaults = defaultAssetDecoderContributions ?? [];
|
|
32
|
+
const assembledContributions = [
|
|
33
|
+
...defaults.filter((contribution) => !overrides.has(contribution.kind.kind)),
|
|
34
|
+
...contributions,
|
|
35
|
+
];
|
|
36
|
+
try {
|
|
37
|
+
const installedKinds = new Set<string>();
|
|
38
|
+
for (const contribution of assembledContributions) {
|
|
39
|
+
if (installedKinds.has(contribution.kind.kind)) {
|
|
40
|
+
throw new TypeError(`duplicate decoder kind "${contribution.kind.kind}"`);
|
|
41
|
+
}
|
|
42
|
+
installedKinds.add(contribution.kind.kind);
|
|
43
|
+
leases.push(
|
|
44
|
+
registry.installDecoder(
|
|
45
|
+
contribution.kind as AssetKind<unknown, string>,
|
|
46
|
+
contribution.decoder,
|
|
47
|
+
),
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
} catch (cause) {
|
|
51
|
+
for (const lease of leases) lease.dispose();
|
|
52
|
+
const failed = assembledContributions[leases.length];
|
|
53
|
+
return err({
|
|
54
|
+
code: 'asset-assembly-failed',
|
|
55
|
+
expected: 'each owner decoder contribution to install exactly once in the realm registry',
|
|
56
|
+
hint: 'remove the conflicting owner contribution and assemble the current realm again',
|
|
57
|
+
detail: { kind: failed?.kind.kind ?? 'unknown', cause },
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
let disposed = false;
|
|
61
|
+
return ok({
|
|
62
|
+
registry,
|
|
63
|
+
leases: Object.freeze([...leases]),
|
|
64
|
+
dispose() {
|
|
65
|
+
if (disposed) return;
|
|
66
|
+
disposed = true;
|
|
67
|
+
for (const lease of leases) lease.dispose();
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { World } from '@forgeax/engine-ecs';
|
|
2
|
+
import { CAMERA_PROJECTION_PERSPECTIVE, Camera } from '@forgeax/engine-render';
|
|
3
|
+
|
|
4
|
+
/** Keep host-owned perspective camera aspect policy in one execution-tier seam. */
|
|
5
|
+
export function syncCameraAspect(world: World, canvasW: number, canvasH: number): void {
|
|
6
|
+
if (canvasW <= 0 || canvasH <= 0) return;
|
|
7
|
+
const aspect = canvasW / canvasH;
|
|
8
|
+
const query = world.query({ with: [Camera] }).unwrap();
|
|
9
|
+
for (const row of query) {
|
|
10
|
+
const camera = world.get(row.entity, Camera);
|
|
11
|
+
if (!camera.ok) continue;
|
|
12
|
+
if (camera.value.autoAspect !== true) continue;
|
|
13
|
+
if (camera.value.projection !== CAMERA_PROJECTION_PERSPECTIVE) continue;
|
|
14
|
+
world.set(row.entity, Camera, { aspect });
|
|
15
|
+
}
|
|
16
|
+
}
|