@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.
- package/LICENSE +202 -0
- package/README.md +424 -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__/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-error-retention.integration.test.d.ts +2 -0
- package/dist/__tests__/create-app-error-retention.integration.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-physics-plugin-failure.integration.test.d.ts +2 -0
- package/dist/__tests__/create-app-physics-plugin-failure.integration.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-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__/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__/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__/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 +7 -0
- package/dist/animation-asset-lookup.d.ts.map +1 -0
- package/dist/browser-frame-signal.d.ts +17 -0
- package/dist/browser-frame-signal.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 +78 -0
- package/dist/create-app.d.ts.map +1 -0
- package/dist/engine-worker-runtime.mjs +827 -0
- package/dist/engine-worker-runtime.mjs.map +1 -0
- package/dist/errors.d.ts +254 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/execution/attached-world-swap.d.ts +10 -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/bootstrap-url.d.ts +5 -0
- package/dist/execution/bootstrap-url.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 +12 -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 +24 -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 +87 -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 +123 -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 +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +3980 -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 +7 -0
- package/dist/internal/assets-world-plugin.d.ts.map +1 -0
- package/dist/internal/browser-remote-bridge.d.ts +24 -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/debug-draw.d.ts +9 -0
- package/dist/internal/debug-draw.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 +38 -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 +19 -0
- package/dist/internal/main-engine-profile.d.ts.map +1 -0
- package/dist/internal/remote-serve-flag.d.ts +19 -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 +15 -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/renderer-plugin.d.ts +25 -0
- package/dist/renderer-plugin.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 +404 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +85 -0
- package/schema/execution-report.schema.json +168 -0
- package/src/__tests__/animation-asset-lookup.unit.test.ts +20 -0
- package/src/__tests__/callback-deletion.unit.test.ts +14 -0
- package/src/__tests__/callback-inference.test-d.ts +36 -0
- package/src/__tests__/component-introspection.unit.test.ts +56 -0
- package/src/__tests__/consumer-migration.unit.test.ts +34 -0
- package/src/__tests__/create-app-error-retention.integration.test.ts +125 -0
- package/src/__tests__/create-app-features.test.ts +51 -0
- package/src/__tests__/create-app-listener-sync.test.ts +381 -0
- package/src/__tests__/create-app-lock-provider.test.ts +212 -0
- package/src/__tests__/create-app-physics-plugin-failure.integration.test.ts +142 -0
- package/src/__tests__/create-app-plugin.test.ts +217 -0
- package/src/__tests__/create-app-stop.test.ts +609 -0
- package/src/__tests__/create-app-time.unit.test.ts +26 -0
- package/src/__tests__/create-app.test-d.ts +83 -0
- package/src/__tests__/create-app.test.ts +287 -0
- package/src/__tests__/create-renderer-error.integration.test.ts +25 -0
- package/src/__tests__/create-renderer-lifecycle.integration.test.ts +24 -0
- package/src/__tests__/docs-gate-green.unit.test.ts +61 -0
- package/src/__tests__/draw-source-injected-world-update-visibility.test.ts +176 -0
- package/src/__tests__/draw-source-single-world-regression.test.ts +184 -0
- package/src/__tests__/engine-worker-bootstrap-channel.unit.test.ts +82 -0
- package/src/__tests__/engine-worker-world-swap.unit.test.ts +69 -0
- package/src/__tests__/errors-pointer-lock-failed.test.ts +265 -0
- package/src/__tests__/execution-bootstrap-isolation.unit.test.ts +79 -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 +60 -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 +14 -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__/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 +450 -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 +235 -0
- package/src/__tests__/profiler-phase-catalog.test.ts +30 -0
- package/src/__tests__/profiler-phase-integration.test.ts +117 -0
- package/src/__tests__/profiler-remote-bridge.test.ts +31 -0
- package/src/__tests__/remote-integration.test.ts +224 -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 +89 -0
- package/src/__tests__/types-m2.test-d.ts +81 -0
- package/src/__tests__/visibility-remote.integration.test.ts +116 -0
- package/src/__tests__/worker-execution-stop.test.ts +173 -0
- package/src/animation-asset-lookup.ts +13 -0
- package/src/browser-frame-signal.ts +44 -0
- package/src/canvas-policy.ts +16 -0
- package/src/create-app.ts +1264 -0
- package/src/errors.ts +442 -0
- package/src/execution/attached-world-swap.ts +33 -0
- package/src/execution/bootstrap-entry.ts +122 -0
- package/src/execution/bootstrap-url.ts +25 -0
- package/src/execution/capabilities.ts +102 -0
- package/src/execution/control.ts +48 -0
- package/src/execution/engine-worker-runtime.ts +383 -0
- package/src/execution/engine-worker.ts +163 -0
- package/src/execution/host-controller.ts +460 -0
- package/src/execution/index.ts +44 -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 +134 -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 +163 -0
- package/src/fallback-camera.ts +20 -0
- package/src/game-context.ts +126 -0
- package/src/index.ts +190 -0
- package/src/input-map-plugin.ts +21 -0
- package/src/input-plugin.ts +26 -0
- package/src/internal/assembled-engine-profile.ts +14 -0
- package/src/internal/assets-world-plugin.ts +33 -0
- package/src/internal/browser-remote-bridge.ts +269 -0
- package/src/internal/browser-rhi-debug-runtime.ts +67 -0
- package/src/internal/component-introspection.ts +116 -0
- package/src/internal/debug-draw.ts +38 -0
- package/src/internal/ecs-import.ts +41 -0
- package/src/internal/engine-profile-common.ts +9 -0
- package/src/internal/error-fanout.ts +129 -0
- package/src/internal/frame-loop.ts +539 -0
- package/src/internal/input-attach.ts +104 -0
- package/src/internal/main-engine-profile.ts +84 -0
- package/src/internal/remote-serve-flag.ts +41 -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/renderer-plugin.ts +96 -0
- package/src/tool-preview/bootstrap.ts +835 -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 +450 -0
- package/src/vite-env.d.ts +10 -0
|
@@ -0,0 +1,116 @@
|
|
|
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
|
+
} as unknown as Renderer;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
describe('createApp to remote visibility discovery', () => {
|
|
44
|
+
it('introspects then evaluates a Query and recovers an invalid write', async () => {
|
|
45
|
+
const previous = process.env.FORGEAX_ENGINE_REMOTE_SERVE;
|
|
46
|
+
process.env.FORGEAX_ENGINE_REMOTE_SERVE = '1';
|
|
47
|
+
const world = new World();
|
|
48
|
+
world.components.register(Visibility).unwrap();
|
|
49
|
+
const result = await createApp({ renderer: makeRendererStub(), world });
|
|
50
|
+
expect(result.ok).toBe(true);
|
|
51
|
+
if (!result.ok) return;
|
|
52
|
+
expect(result.value.remote).toBeDefined();
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
const port = result.value.remote?.port;
|
|
56
|
+
expect(port).toBeGreaterThan(0);
|
|
57
|
+
if (port === undefined) return;
|
|
58
|
+
const doc = await introspect(port);
|
|
59
|
+
const schemas = (doc.components as { schemas: Record<string, unknown> }).schemas;
|
|
60
|
+
expect(schemas.Visibility).toBeDefined();
|
|
61
|
+
expect((doc.methods as Array<{ name: string }>).map((method) => method.name)).toEqual([
|
|
62
|
+
'eval',
|
|
63
|
+
'introspect',
|
|
64
|
+
]);
|
|
65
|
+
|
|
66
|
+
const connection = await defaultConnect(`ws://127.0.0.1:${port}/inspector`);
|
|
67
|
+
expect(connection.ok).toBe(true);
|
|
68
|
+
if (!connection.ok) return;
|
|
69
|
+
try {
|
|
70
|
+
const value = await connection.value.eval(`(async () => {
|
|
71
|
+
const render = await _import('@forgeax/engine-render');
|
|
72
|
+
const entity = world.spawn({
|
|
73
|
+
component: render.Visibility,
|
|
74
|
+
data: { state: render.VisibilityStateValue.hidden },
|
|
75
|
+
}).unwrap();
|
|
76
|
+
const query = world.query({ read: [render.Visibility] }).unwrap();
|
|
77
|
+
let current;
|
|
78
|
+
for (const row of query) {
|
|
79
|
+
current = ['inherited', 'hidden', 'visible'][row.get(render.Visibility).state];
|
|
80
|
+
}
|
|
81
|
+
const effective = render.resolveVisibility(world).effective(entity);
|
|
82
|
+
const invalid = world.set(entity, render.Visibility, { state: 99 });
|
|
83
|
+
const recovered = world.set(entity, render.Visibility, {
|
|
84
|
+
state: render.VisibilityStateValue.visible,
|
|
85
|
+
});
|
|
86
|
+
return {
|
|
87
|
+
current,
|
|
88
|
+
effective,
|
|
89
|
+
invalid: invalid.ok ? undefined : {
|
|
90
|
+
code: invalid.error.code,
|
|
91
|
+
expected: invalid.error.expected,
|
|
92
|
+
hint: invalid.error.hint,
|
|
93
|
+
detail: invalid.error.detail,
|
|
94
|
+
},
|
|
95
|
+
recovered: recovered.ok,
|
|
96
|
+
restored: render.resolveVisibility(world).effective(entity),
|
|
97
|
+
};
|
|
98
|
+
})()`);
|
|
99
|
+
expect(value).toMatchObject({
|
|
100
|
+
current: 'hidden',
|
|
101
|
+
effective: 'hidden',
|
|
102
|
+
invalid: { code: 'component-field-invalid-value' },
|
|
103
|
+
recovered: true,
|
|
104
|
+
restored: 'visible',
|
|
105
|
+
});
|
|
106
|
+
expect((value as { invalid: { hint: string } }).invalid.hint.length).toBeGreaterThan(0);
|
|
107
|
+
} finally {
|
|
108
|
+
await connection.value.dispose();
|
|
109
|
+
}
|
|
110
|
+
} finally {
|
|
111
|
+
await result.value.remote?.close();
|
|
112
|
+
if (previous === undefined) delete process.env.FORGEAX_ENGINE_REMOTE_SERVE;
|
|
113
|
+
else process.env.FORGEAX_ENGINE_REMOTE_SERVE = previous;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
});
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import type { EngineToHostMessage } from '../execution/protocol';
|
|
3
|
+
|
|
4
|
+
type SessionListener = (message: EngineToHostMessage) => void;
|
|
5
|
+
|
|
6
|
+
const probes = vi.hoisted(() => {
|
|
7
|
+
const sessionListeners: SessionListener[] = [];
|
|
8
|
+
return {
|
|
9
|
+
audioDispose: vi.fn(),
|
|
10
|
+
inputDetach: vi.fn(),
|
|
11
|
+
sessionDispose: vi.fn(),
|
|
12
|
+
sessionListen: vi.fn((listener: SessionListener) => {
|
|
13
|
+
sessionListeners.push(listener);
|
|
14
|
+
return () => {};
|
|
15
|
+
}),
|
|
16
|
+
sessionListeners,
|
|
17
|
+
sessionPost: vi.fn(),
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
vi.mock('../execution/engine-worker', async () => {
|
|
22
|
+
const { ok } = await import('@forgeax/engine-types');
|
|
23
|
+
return {
|
|
24
|
+
startEngineWorker: vi.fn(async () =>
|
|
25
|
+
ok({
|
|
26
|
+
worker: {},
|
|
27
|
+
ready: {
|
|
28
|
+
kind: 'ready' as const,
|
|
29
|
+
worldIdentity: 'worker-world',
|
|
30
|
+
realm: 'worker' as const,
|
|
31
|
+
workerWebGpu: true,
|
|
32
|
+
},
|
|
33
|
+
post: probes.sessionPost,
|
|
34
|
+
listen: probes.sessionListen,
|
|
35
|
+
dispose: probes.sessionDispose,
|
|
36
|
+
}),
|
|
37
|
+
),
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
vi.mock('@forgeax/engine-input', () => ({
|
|
42
|
+
attachBrowserInputBackend: vi.fn(() => {
|
|
43
|
+
const detach = probes.inputDetach as typeof probes.inputDetach & {
|
|
44
|
+
backend: { sample(): object; detach(): void };
|
|
45
|
+
};
|
|
46
|
+
detach.backend = {
|
|
47
|
+
sample: () => ({
|
|
48
|
+
downKeys: new Set(),
|
|
49
|
+
upKeys: new Set(),
|
|
50
|
+
buttons: [false, false, false],
|
|
51
|
+
movementX: 0,
|
|
52
|
+
movementY: 0,
|
|
53
|
+
wheelDelta: 0,
|
|
54
|
+
focused: true,
|
|
55
|
+
pointerLocked: false,
|
|
56
|
+
}),
|
|
57
|
+
detach: probes.inputDetach,
|
|
58
|
+
};
|
|
59
|
+
return detach;
|
|
60
|
+
}),
|
|
61
|
+
}));
|
|
62
|
+
|
|
63
|
+
vi.mock('@forgeax/engine-audio-webaudio', () => ({
|
|
64
|
+
createHostAudioConsumer: vi.fn(() => ({
|
|
65
|
+
consume: vi.fn(),
|
|
66
|
+
dispose: probes.audioDispose,
|
|
67
|
+
state: () => ({ contextState: 'suspended', activeSourceCount: 0, lastError: null }),
|
|
68
|
+
})),
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
import { createWorkerExecutionApp } from '../execution/host-controller';
|
|
72
|
+
|
|
73
|
+
const capabilities = {
|
|
74
|
+
worker: { available: true, reason: 'test' },
|
|
75
|
+
offscreenCanvas: { available: true, reason: 'test' },
|
|
76
|
+
workerAnimationFrame: { available: true, reason: 'test' },
|
|
77
|
+
workerWebGpu: { available: true, reason: 'test' },
|
|
78
|
+
crossOriginIsolated: { available: false, reason: 'test' },
|
|
79
|
+
sharedArrayBuffer: { available: false, reason: 'test' },
|
|
80
|
+
atomicsWait: { available: false, reason: 'test' },
|
|
81
|
+
} as const;
|
|
82
|
+
|
|
83
|
+
describe('Worker ExecutionApp terminal stop', () => {
|
|
84
|
+
beforeEach(() => {
|
|
85
|
+
vi.clearAllMocks();
|
|
86
|
+
probes.sessionListeners.length = 0;
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('cleans every host owner once when stopped while paused and cannot restart', async () => {
|
|
90
|
+
const raf = vi.fn(() => 7);
|
|
91
|
+
const cancelRaf = vi.fn();
|
|
92
|
+
vi.stubGlobal('requestAnimationFrame', raf);
|
|
93
|
+
vi.stubGlobal('cancelAnimationFrame', cancelRaf);
|
|
94
|
+
|
|
95
|
+
const result = await createWorkerExecutionApp({
|
|
96
|
+
canvas: {} as HTMLCanvasElement,
|
|
97
|
+
appOptions: { execution: { bootstrap: 'https://example.test/game.js' } } as never,
|
|
98
|
+
capabilities,
|
|
99
|
+
selection: {
|
|
100
|
+
requestedTier: 'engine-worker',
|
|
101
|
+
actualTier: 'engine-worker',
|
|
102
|
+
selectionReason: 'explicit-request',
|
|
103
|
+
missingCapabilities: [],
|
|
104
|
+
sharedEvidencePassed: false,
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
expect(result.ok).toBe(true);
|
|
108
|
+
if (!result.ok) return;
|
|
109
|
+
|
|
110
|
+
expect(result.value.start().ok).toBe(true);
|
|
111
|
+
expect(raf).toHaveBeenCalledTimes(1);
|
|
112
|
+
expect(result.value.pause().ok).toBe(true);
|
|
113
|
+
expect(cancelRaf).toHaveBeenCalledTimes(1);
|
|
114
|
+
|
|
115
|
+
expect(result.value.stop().ok).toBe(true);
|
|
116
|
+
expect(probes.inputDetach).toHaveBeenCalledTimes(1);
|
|
117
|
+
expect(probes.audioDispose).toHaveBeenCalledTimes(1);
|
|
118
|
+
expect(probes.sessionDispose).toHaveBeenCalledTimes(1);
|
|
119
|
+
expect(raf).toHaveBeenCalledTimes(1);
|
|
120
|
+
expect(cancelRaf).toHaveBeenCalledTimes(1);
|
|
121
|
+
|
|
122
|
+
const restart = result.value.start();
|
|
123
|
+
expect(restart.ok).toBe(false);
|
|
124
|
+
if (!restart.ok) expect(restart.error.code).toBe('app-not-started');
|
|
125
|
+
expect(raf).toHaveBeenCalledTimes(1);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('retains the existing terminal fault identity for host inspection', async () => {
|
|
129
|
+
vi.stubGlobal(
|
|
130
|
+
'requestAnimationFrame',
|
|
131
|
+
vi.fn(() => 7),
|
|
132
|
+
);
|
|
133
|
+
vi.stubGlobal('cancelAnimationFrame', vi.fn());
|
|
134
|
+
const result = await createWorkerExecutionApp({
|
|
135
|
+
canvas: {} as HTMLCanvasElement,
|
|
136
|
+
appOptions: { execution: { bootstrap: 'https://example.test/game.js' } } as never,
|
|
137
|
+
capabilities,
|
|
138
|
+
selection: {
|
|
139
|
+
requestedTier: 'engine-worker',
|
|
140
|
+
actualTier: 'engine-worker',
|
|
141
|
+
selectionReason: 'explicit-request',
|
|
142
|
+
missingCapabilities: [],
|
|
143
|
+
sharedEvidencePassed: false,
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
expect(result.ok).toBe(true);
|
|
147
|
+
if (!result.ok) return;
|
|
148
|
+
let observed: unknown;
|
|
149
|
+
result.value.onError((error) => {
|
|
150
|
+
observed = error;
|
|
151
|
+
});
|
|
152
|
+
const listener = probes.sessionListeners[0];
|
|
153
|
+
expect(listener).toBeTypeOf('function');
|
|
154
|
+
|
|
155
|
+
listener?.({
|
|
156
|
+
kind: 'fault',
|
|
157
|
+
worldIdentity: 'worker-world',
|
|
158
|
+
source: 'world',
|
|
159
|
+
code: 'app-system-update-failed',
|
|
160
|
+
expected: 'worker world update succeeds',
|
|
161
|
+
hint: 'inspect the retained cause',
|
|
162
|
+
detail: { cause: 'worker boom' },
|
|
163
|
+
partialWrite: true,
|
|
164
|
+
retryable: false,
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
expect(result.value.lastError).toBe(observed);
|
|
168
|
+
expect(result.value.lastError).toMatchObject({
|
|
169
|
+
code: 'app-system-update-failed',
|
|
170
|
+
detail: { cause: { cause: 'worker boom' } },
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AnimationPayloadLookup } from '@forgeax/engine-animation';
|
|
2
|
+
import type { AnimationClip } from '@forgeax/engine-types';
|
|
3
|
+
|
|
4
|
+
export interface AnimationPayloadSource {
|
|
5
|
+
lookup<T = unknown>(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,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-visible render progress owned by the App frame loop.
|
|
3
|
+
*
|
|
4
|
+
* The Renderer already emits `frame-submitted` after its sole queue-submit
|
|
5
|
+
* boundary. This adapter projects that event onto the document without
|
|
6
|
+
* exposing a renderer handle or creating a second readiness registry. DevKit
|
|
7
|
+
* capture waits on the same projection, then verifies compositor pixels.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export const FORGEAX_FRAME_SUBMITTED_DATASET = 'forgeaxFrameSubmitted';
|
|
11
|
+
export const FORGEAX_FRAME_SUBMITTED_EVENT = 'forgeax:frame-submitted';
|
|
12
|
+
|
|
13
|
+
export interface BrowserFrameSubmitted {
|
|
14
|
+
readonly frameId: number;
|
|
15
|
+
readonly deviceGeneration: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function resetBrowserFrameSubmitted(canvas: HTMLCanvasElement): void {
|
|
19
|
+
const documentElement = canvas.ownerDocument?.documentElement;
|
|
20
|
+
if (documentElement !== undefined) {
|
|
21
|
+
delete documentElement.dataset[FORGEAX_FRAME_SUBMITTED_DATASET];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function publishBrowserFrameSubmitted(
|
|
26
|
+
canvas: HTMLCanvasElement,
|
|
27
|
+
event: BrowserFrameSubmitted,
|
|
28
|
+
): void {
|
|
29
|
+
const documentElement = canvas.ownerDocument?.documentElement;
|
|
30
|
+
if (documentElement !== undefined) {
|
|
31
|
+
documentElement.dataset[FORGEAX_FRAME_SUBMITTED_DATASET] = String(event.frameId);
|
|
32
|
+
}
|
|
33
|
+
// Native/Web test canvases may be structural objects without DOM event
|
|
34
|
+
// methods. The dataset projection above remains optional as well, so the
|
|
35
|
+
// signal must stay a no-op outside a browser host instead of poisoning the
|
|
36
|
+
// frame loop with a listener exception.
|
|
37
|
+
if (typeof CustomEvent === 'function' && typeof canvas.dispatchEvent === 'function') {
|
|
38
|
+
canvas.dispatchEvent(
|
|
39
|
+
new CustomEvent(FORGEAX_FRAME_SUBMITTED_EVENT, {
|
|
40
|
+
detail: Object.freeze({ ...event }),
|
|
41
|
+
}),
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -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
|
+
}
|