@vgai/engine 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/schemas/engine-capabilities.json +4 -4
- package/schemas/vgai-game.schema.json +2 -2
- package/src/adapter/authoring.ts +42 -0
- package/src/adapter/index.ts +3 -0
- package/src/adapter/ingest/overlay-apply.ts +50 -6
- package/src/adapter/ingest/scene-capture.ts +51 -2
- package/src/adapter/vgai-scene-game-adapter.ts +24 -0
- package/src/manifest/schema.ts +7 -3
- package/src/runtime/create-runtime.ts +97 -0
- package/src/runtime/game.ts +11 -1
- package/src/scene/asset-ref-check.ts +1 -1
- package/src/scene/scene-loader.ts +2 -2
- package/src/scene/user-data.ts +18 -0
- package/src/world3d-react/behavior.tsx +19 -11
- package/src/world3d-react/r3f-adapter.tsx +8 -0
- package/dist/adapter/adapter-surface.d.ts +0 -30
- package/dist/adapter/adapter-surface.d.ts.map +0 -1
- package/dist/adapter/adapter-surface.js +0 -18
- package/dist/adapter/authoring.d.ts +0 -461
- package/dist/adapter/authoring.d.ts.map +0 -1
- package/dist/adapter/authoring.js +0 -22
- package/dist/adapter/colyseus-networking-adapter.d.ts +0 -43
- package/dist/adapter/colyseus-networking-adapter.d.ts.map +0 -1
- package/dist/adapter/colyseus-networking-adapter.js +0 -38
- package/dist/adapter/first-party-systems.d.ts +0 -38
- package/dist/adapter/first-party-systems.d.ts.map +0 -1
- package/dist/adapter/first-party-systems.js +0 -77
- package/dist/adapter/game-adapter.d.ts +0 -133
- package/dist/adapter/game-adapter.d.ts.map +0 -1
- package/dist/adapter/game-adapter.js +0 -10
- package/dist/adapter/host-context.d.ts +0 -71
- package/dist/adapter/host-context.d.ts.map +0 -1
- package/dist/adapter/host-context.js +0 -16
- package/dist/adapter/index.d.ts +0 -22
- package/dist/adapter/index.d.ts.map +0 -1
- package/dist/adapter/index.js +0 -15
- package/dist/adapter/ingest/game-contract.d.ts +0 -53
- package/dist/adapter/ingest/game-contract.d.ts.map +0 -1
- package/dist/adapter/ingest/game-contract.js +0 -30
- package/dist/adapter/ingest/overlay-applier.d.ts +0 -118
- package/dist/adapter/ingest/overlay-applier.d.ts.map +0 -1
- package/dist/adapter/ingest/overlay-applier.js +0 -132
- package/dist/adapter/ingest/overlay-apply.d.ts +0 -60
- package/dist/adapter/ingest/overlay-apply.d.ts.map +0 -1
- package/dist/adapter/ingest/overlay-apply.js +0 -101
- package/dist/adapter/ingest/overlay-file.d.ts +0 -79
- package/dist/adapter/ingest/overlay-file.d.ts.map +0 -1
- package/dist/adapter/ingest/overlay-file.js +0 -66
- package/dist/adapter/ingest/overlay-report.d.ts +0 -113
- package/dist/adapter/ingest/overlay-report.d.ts.map +0 -1
- package/dist/adapter/ingest/overlay-report.js +0 -103
- package/dist/adapter/ingest/scene-capture.d.ts +0 -97
- package/dist/adapter/ingest/scene-capture.d.ts.map +0 -1
- package/dist/adapter/ingest/scene-capture.js +0 -248
- package/dist/adapter/ingest/upstream-pin.d.ts +0 -47
- package/dist/adapter/ingest/upstream-pin.d.ts.map +0 -1
- package/dist/adapter/ingest/upstream-pin.js +0 -50
- package/dist/adapter/loop-gate-report.d.ts +0 -34
- package/dist/adapter/loop-gate-report.d.ts.map +0 -1
- package/dist/adapter/loop-gate-report.js +0 -37
- package/dist/adapter/rapier-physics-adapter.d.ts +0 -12
- package/dist/adapter/rapier-physics-adapter.d.ts.map +0 -1
- package/dist/adapter/rapier-physics-adapter.js +0 -46
- package/dist/adapter/system-adapter.d.ts +0 -206
- package/dist/adapter/system-adapter.d.ts.map +0 -1
- package/dist/adapter/system-adapter.js +0 -13
- package/dist/adapter/transform.d.ts +0 -18
- package/dist/adapter/transform.d.ts.map +0 -1
- package/dist/adapter/transform.js +0 -1
- package/dist/adapter/vgai-scene-game-adapter.d.ts +0 -108
- package/dist/adapter/vgai-scene-game-adapter.d.ts.map +0 -1
- package/dist/adapter/vgai-scene-game-adapter.js +0 -762
- package/dist/ai/navigation.d.ts +0 -64
- package/dist/ai/navigation.d.ts.map +0 -1
- package/dist/ai/navigation.js +0 -133
- package/dist/animation/anim-graph-types.d.ts +0 -25
- package/dist/animation/anim-graph-types.d.ts.map +0 -1
- package/dist/animation/anim-graph-types.js +0 -1
- package/dist/animation/animation-clock.d.ts +0 -213
- package/dist/animation/animation-clock.d.ts.map +0 -1
- package/dist/animation/animation-clock.js +0 -301
- package/dist/animation/blend-node.d.ts +0 -22
- package/dist/animation/blend-node.d.ts.map +0 -1
- package/dist/animation/blend-node.js +0 -97
- package/dist/animation/camera-ownership.d.ts +0 -250
- package/dist/animation/camera-ownership.d.ts.map +0 -1
- package/dist/animation/camera-ownership.js +0 -169
- package/dist/animation/cinematic-cues.d.ts +0 -200
- package/dist/animation/cinematic-cues.d.ts.map +0 -1
- package/dist/animation/cinematic-cues.js +0 -213
- package/dist/animation/clip-map.d.ts +0 -12
- package/dist/animation/clip-map.d.ts.map +0 -1
- package/dist/animation/clip-map.js +0 -37
- package/dist/animation/gsap-registration.d.ts +0 -119
- package/dist/animation/gsap-registration.d.ts.map +0 -1
- package/dist/animation/gsap-registration.js +0 -92
- package/dist/animation/theatre-clock-binding.d.ts +0 -89
- package/dist/animation/theatre-clock-binding.d.ts.map +0 -1
- package/dist/animation/theatre-clock-binding.js +0 -29
- package/dist/animation/theatre-director.d.ts +0 -242
- package/dist/animation/theatre-director.d.ts.map +0 -1
- package/dist/animation/theatre-director.js +0 -235
- package/dist/animation/theatre-object-binding.d.ts +0 -305
- package/dist/animation/theatre-object-binding.d.ts.map +0 -1
- package/dist/animation/theatre-object-binding.js +0 -351
- package/dist/animation/xstate-animation-binding.d.ts +0 -56
- package/dist/animation/xstate-animation-binding.d.ts.map +0 -1
- package/dist/animation/xstate-animation-binding.js +0 -331
- package/dist/animation/xstate-animation-meta.d.ts +0 -266
- package/dist/animation/xstate-animation-meta.d.ts.map +0 -1
- package/dist/animation/xstate-animation-meta.js +0 -252
- package/dist/assets.d.ts +0 -26
- package/dist/assets.d.ts.map +0 -1
- package/dist/assets.js +0 -55
- package/dist/audio/index.d.ts +0 -4
- package/dist/audio/index.d.ts.map +0 -1
- package/dist/audio/index.js +0 -24
- package/dist/audio/tone-clock-binding.d.ts +0 -75
- package/dist/audio/tone-clock-binding.d.ts.map +0 -1
- package/dist/audio/tone-clock-binding.js +0 -29
- package/dist/audio/tone-context.d.ts +0 -114
- package/dist/audio/tone-context.d.ts.map +0 -1
- package/dist/audio/tone-context.js +0 -39
- package/dist/audio/tone-offline-render.d.ts +0 -90
- package/dist/audio/tone-offline-render.d.ts.map +0 -1
- package/dist/audio/tone-offline-render.js +0 -56
- package/dist/audio/wav-encode.d.ts +0 -38
- package/dist/audio/wav-encode.d.ts.map +0 -1
- package/dist/audio/wav-encode.js +0 -97
- package/dist/character/cloth-sim.d.ts +0 -179
- package/dist/character/cloth-sim.d.ts.map +0 -1
- package/dist/character/cloth-sim.js +0 -334
- package/dist/character/spring-chain.d.ts +0 -135
- package/dist/character/spring-chain.d.ts.map +0 -1
- package/dist/character/spring-chain.js +0 -165
- package/dist/core/game-loop.d.ts +0 -42
- package/dist/core/game-loop.d.ts.map +0 -1
- package/dist/core/game-loop.js +0 -167
- package/dist/core/seeded-random.d.ts +0 -69
- package/dist/core/seeded-random.d.ts.map +0 -1
- package/dist/core/seeded-random.js +0 -121
- package/dist/core/system-runner.d.ts +0 -120
- package/dist/core/system-runner.d.ts.map +0 -1
- package/dist/core/system-runner.js +0 -297
- package/dist/core/types.d.ts +0 -92
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js +0 -25
- package/dist/data/data-asset.d.ts +0 -101
- package/dist/data/data-asset.d.ts.map +0 -1
- package/dist/data/data-asset.js +0 -122
- package/dist/data/data-check-core.d.ts +0 -110
- package/dist/data/data-check-core.d.ts.map +0 -1
- package/dist/data/data-check-core.js +0 -178
- package/dist/data/data-ref.d.ts +0 -79
- package/dist/data/data-ref.d.ts.map +0 -1
- package/dist/data/data-ref.js +0 -130
- package/dist/data/vite-plugin-data.d.ts +0 -79
- package/dist/data/vite-plugin-data.d.ts.map +0 -1
- package/dist/data/vite-plugin-data.js +0 -217
- package/dist/dev/console-bridge.d.ts +0 -22
- package/dist/dev/console-bridge.d.ts.map +0 -1
- package/dist/dev/console-bridge.js +0 -71
- package/dist/dev/debug-draw.d.ts +0 -24
- package/dist/dev/debug-draw.d.ts.map +0 -1
- package/dist/dev/debug-draw.js +0 -73
- package/dist/dev/logger.d.ts +0 -30
- package/dist/dev/logger.d.ts.map +0 -1
- package/dist/dev/logger.js +0 -90
- package/dist/dev/performance-profiler.d.ts +0 -60
- package/dist/dev/performance-profiler.d.ts.map +0 -1
- package/dist/dev/performance-profiler.js +0 -181
- package/dist/dev/webgl-gpu-timer.d.ts +0 -8
- package/dist/dev/webgl-gpu-timer.d.ts.map +0 -1
- package/dist/dev/webgl-gpu-timer.js +0 -52
- package/dist/ecs/component-manager.d.ts +0 -205
- package/dist/ecs/component-manager.d.ts.map +0 -1
- package/dist/ecs/component-manager.js +0 -706
- package/dist/ecs/game-component.d.ts +0 -146
- package/dist/ecs/game-component.d.ts.map +0 -1
- package/dist/ecs/game-component.js +0 -141
- package/dist/ecs/hmr-swap-report.d.ts +0 -53
- package/dist/ecs/hmr-swap-report.d.ts.map +0 -1
- package/dist/ecs/hmr-swap-report.js +0 -55
- package/dist/humanoid/bake.operation.d.ts +0 -119
- package/dist/humanoid/bake.operation.d.ts.map +0 -1
- package/dist/humanoid/bake.operation.js +0 -228
- package/dist/humanoid/body.d.ts +0 -101
- package/dist/humanoid/body.d.ts.map +0 -1
- package/dist/humanoid/body.js +0 -530
- package/dist/humanoid/clips.d.ts +0 -62
- package/dist/humanoid/clips.d.ts.map +0 -1
- package/dist/humanoid/clips.js +0 -121
- package/dist/humanoid/compose.d.ts +0 -75
- package/dist/humanoid/compose.d.ts.map +0 -1
- package/dist/humanoid/compose.js +0 -176
- package/dist/humanoid/generate.d.ts +0 -92
- package/dist/humanoid/generate.d.ts.map +0 -1
- package/dist/humanoid/generate.js +0 -124
- package/dist/humanoid/index.d.ts +0 -24
- package/dist/humanoid/index.d.ts.map +0 -1
- package/dist/humanoid/index.js +0 -18
- package/dist/humanoid/schema.d.ts +0 -35
- package/dist/humanoid/schema.d.ts.map +0 -1
- package/dist/humanoid/schema.js +0 -87
- package/dist/humanoid/skeleton.d.ts +0 -103
- package/dist/humanoid/skeleton.d.ts.map +0 -1
- package/dist/humanoid/skeleton.js +0 -289
- package/dist/index.d.ts +0 -37
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -30
- package/dist/input/input-manager.d.ts +0 -945
- package/dist/input/input-manager.d.ts.map +0 -1
- package/dist/input/input-manager.js +0 -2207
- package/dist/input/input-types.d.ts +0 -174
- package/dist/input/input-types.d.ts.map +0 -1
- package/dist/input/input-types.js +0 -1
- package/dist/input/prompt-labels.d.ts +0 -21
- package/dist/input/prompt-labels.d.ts.map +0 -1
- package/dist/input/prompt-labels.js +0 -121
- package/dist/input/rebind-controller.d.ts +0 -59
- package/dist/input/rebind-controller.d.ts.map +0 -1
- package/dist/input/rebind-controller.js +0 -85
- package/dist/input/schema.d.ts +0 -16
- package/dist/input/schema.d.ts.map +0 -1
- package/dist/input/schema.js +0 -228
- package/dist/loader.d.ts +0 -43
- package/dist/loader.d.ts.map +0 -1
- package/dist/loader.js +0 -59
- package/dist/manifest/index.d.ts +0 -5
- package/dist/manifest/index.d.ts.map +0 -1
- package/dist/manifest/index.js +0 -8
- package/dist/manifest/load-file.d.ts +0 -4
- package/dist/manifest/load-file.d.ts.map +0 -1
- package/dist/manifest/load-file.js +0 -14
- package/dist/manifest/load.d.ts +0 -144
- package/dist/manifest/load.d.ts.map +0 -1
- package/dist/manifest/load.js +0 -273
- package/dist/manifest/schema.d.ts +0 -230
- package/dist/manifest/schema.d.ts.map +0 -1
- package/dist/manifest/schema.js +0 -394
- package/dist/physics/collision-system.d.ts +0 -41
- package/dist/physics/collision-system.d.ts.map +0 -1
- package/dist/physics/collision-system.js +0 -64
- package/dist/physics/physics-registry.d.ts +0 -45
- package/dist/physics/physics-registry.d.ts.map +0 -1
- package/dist/physics/physics-registry.js +0 -65
- package/dist/physics/transform-writer.d.ts +0 -16
- package/dist/physics/transform-writer.d.ts.map +0 -1
- package/dist/physics/transform-writer.js +0 -38
- package/dist/physics/trigger-dispatch.d.ts +0 -24
- package/dist/physics/trigger-dispatch.d.ts.map +0 -1
- package/dist/physics/trigger-dispatch.js +0 -80
- package/dist/react/game-state.d.ts +0 -156
- package/dist/react/game-state.d.ts.map +0 -1
- package/dist/react/game-state.js +0 -222
- package/dist/react/root-adapter.d.ts +0 -11
- package/dist/react/root-adapter.d.ts.map +0 -1
- package/dist/react/root-adapter.js +0 -41
- package/dist/react/unmanaged-root-detector.d.ts +0 -12
- package/dist/react/unmanaged-root-detector.d.ts.map +0 -1
- package/dist/react/unmanaged-root-detector.js +0 -45
- package/dist/react/use-data.d.ts +0 -60
- package/dist/react/use-data.d.ts.map +0 -1
- package/dist/react/use-data.js +0 -101
- package/dist/react/use-selection.d.ts +0 -75
- package/dist/react/use-selection.d.ts.map +0 -1
- package/dist/react/use-selection.js +0 -90
- package/dist/render/auto-batcher.d.ts +0 -34
- package/dist/render/auto-batcher.d.ts.map +0 -1
- package/dist/render/auto-batcher.js +0 -140
- package/dist/render/render-batch-system.d.ts +0 -33
- package/dist/render/render-batch-system.d.ts.map +0 -1
- package/dist/render/render-batch-system.js +0 -230
- package/dist/render/render-features.d.ts +0 -47
- package/dist/render/render-features.d.ts.map +0 -1
- package/dist/render/render-features.js +0 -105
- package/dist/render/render-settings.d.ts +0 -36
- package/dist/render/render-settings.d.ts.map +0 -1
- package/dist/render/render-settings.js +0 -51
- package/dist/runtime/create-runtime.d.ts +0 -249
- package/dist/runtime/create-runtime.d.ts.map +0 -1
- package/dist/runtime/create-runtime.js +0 -641
- package/dist/runtime/debug-bridge.d.ts +0 -257
- package/dist/runtime/debug-bridge.d.ts.map +0 -1
- package/dist/runtime/debug-bridge.js +0 -224
- package/dist/runtime/debug-registry.d.ts +0 -288
- package/dist/runtime/debug-registry.d.ts.map +0 -1
- package/dist/runtime/debug-registry.js +0 -513
- package/dist/runtime/frame-selector-cache.d.ts +0 -41
- package/dist/runtime/frame-selector-cache.d.ts.map +0 -1
- package/dist/runtime/frame-selector-cache.js +0 -65
- package/dist/runtime/game.d.ts +0 -496
- package/dist/runtime/game.d.ts.map +0 -1
- package/dist/runtime/game.js +0 -741
- package/dist/runtime/gameplay-rng-trap.d.ts +0 -48
- package/dist/runtime/gameplay-rng-trap.d.ts.map +0 -1
- package/dist/runtime/gameplay-rng-trap.js +0 -96
- package/dist/runtime/input-router.d.ts +0 -78
- package/dist/runtime/input-router.d.ts.map +0 -1
- package/dist/runtime/input-router.js +0 -171
- package/dist/runtime/mount-game.d.ts +0 -129
- package/dist/runtime/mount-game.d.ts.map +0 -1
- package/dist/runtime/mount-game.js +0 -152
- package/dist/runtime/mount-manifest.d.ts +0 -173
- package/dist/runtime/mount-manifest.d.ts.map +0 -1
- package/dist/runtime/mount-manifest.js +0 -297
- package/dist/runtime/render-audio-control.d.ts +0 -110
- package/dist/runtime/render-audio-control.d.ts.map +0 -1
- package/dist/runtime/render-audio-control.js +0 -111
- package/dist/runtime/render-control.d.ts +0 -291
- package/dist/runtime/render-control.d.ts.map +0 -1
- package/dist/runtime/render-control.js +0 -264
- package/dist/runtime/render-seed.d.ts +0 -57
- package/dist/runtime/render-seed.d.ts.map +0 -1
- package/dist/runtime/render-seed.js +0 -74
- package/dist/runtime/state-bridge.d.ts +0 -61
- package/dist/runtime/state-bridge.d.ts.map +0 -1
- package/dist/runtime/state-bridge.js +0 -63
- package/dist/runtime/types.d.ts +0 -253
- package/dist/runtime/types.d.ts.map +0 -1
- package/dist/runtime/types.js +0 -1
- package/dist/scene/asset-loaders.d.ts +0 -79
- package/dist/scene/asset-loaders.d.ts.map +0 -1
- package/dist/scene/asset-loaders.js +0 -141
- package/dist/scene/asset-paths.d.ts +0 -11
- package/dist/scene/asset-paths.d.ts.map +0 -1
- package/dist/scene/asset-paths.js +0 -108
- package/dist/scene/asset-ref-check.d.ts +0 -88
- package/dist/scene/asset-ref-check.d.ts.map +0 -1
- package/dist/scene/asset-ref-check.js +0 -214
- package/dist/scene/asset-registry.d.ts +0 -38
- package/dist/scene/asset-registry.d.ts.map +0 -1
- package/dist/scene/asset-registry.js +0 -66
- package/dist/scene/collider-dimensions.d.ts +0 -63
- package/dist/scene/collider-dimensions.d.ts.map +0 -1
- package/dist/scene/collider-dimensions.js +0 -98
- package/dist/scene/component-registry.d.ts +0 -22
- package/dist/scene/component-registry.d.ts.map +0 -1
- package/dist/scene/component-registry.js +0 -37
- package/dist/scene/defaults.d.ts +0 -252
- package/dist/scene/defaults.d.ts.map +0 -1
- package/dist/scene/defaults.js +0 -151
- package/dist/scene/geometries/index.d.ts +0 -8
- package/dist/scene/geometries/index.d.ts.map +0 -1
- package/dist/scene/geometries/index.js +0 -7
- package/dist/scene/geometries/terrain.d.ts +0 -2
- package/dist/scene/geometries/terrain.d.ts.map +0 -1
- package/dist/scene/geometries/terrain.js +0 -37
- package/dist/scene/geometry-registry.d.ts +0 -24
- package/dist/scene/geometry-registry.d.ts.map +0 -1
- package/dist/scene/geometry-registry.js +0 -20
- package/dist/scene/instance-registry.d.ts +0 -36
- package/dist/scene/instance-registry.d.ts.map +0 -1
- package/dist/scene/instance-registry.js +0 -55
- package/dist/scene/instancers/grid.d.ts +0 -2
- package/dist/scene/instancers/grid.d.ts.map +0 -1
- package/dist/scene/instancers/grid.js +0 -36
- package/dist/scene/instancers/index.d.ts +0 -8
- package/dist/scene/instancers/index.d.ts.map +0 -1
- package/dist/scene/instancers/index.js +0 -7
- package/dist/scene/light-camera-factory.d.ts +0 -23
- package/dist/scene/light-camera-factory.d.ts.map +0 -1
- package/dist/scene/light-camera-factory.js +0 -68
- package/dist/scene/material-factory.d.ts +0 -17
- package/dist/scene/material-factory.d.ts.map +0 -1
- package/dist/scene/material-factory.js +0 -197
- package/dist/scene/material-registry.d.ts +0 -40
- package/dist/scene/material-registry.d.ts.map +0 -1
- package/dist/scene/material-registry.js +0 -44
- package/dist/scene/materials/index.d.ts +0 -8
- package/dist/scene/materials/index.d.ts.map +0 -1
- package/dist/scene/materials/index.js +0 -7
- package/dist/scene/materials/water.d.ts +0 -2
- package/dist/scene/materials/water.d.ts.map +0 -1
- package/dist/scene/materials/water.js +0 -54
- package/dist/scene/parse.d.ts +0 -23
- package/dist/scene/parse.d.ts.map +0 -1
- package/dist/scene/parse.js +0 -179
- package/dist/scene/particles-factory.d.ts +0 -33
- package/dist/scene/particles-factory.d.ts.map +0 -1
- package/dist/scene/particles-factory.js +0 -282
- package/dist/scene/scene-apply.d.ts +0 -109
- package/dist/scene/scene-apply.d.ts.map +0 -1
- package/dist/scene/scene-apply.js +0 -370
- package/dist/scene/scene-diff-schema.d.ts +0 -285
- package/dist/scene/scene-diff-schema.d.ts.map +0 -1
- package/dist/scene/scene-diff-schema.js +0 -92
- package/dist/scene/scene-diff-types.d.ts +0 -40
- package/dist/scene/scene-diff-types.d.ts.map +0 -1
- package/dist/scene/scene-diff-types.js +0 -14
- package/dist/scene/scene-loader.d.ts +0 -167
- package/dist/scene/scene-loader.d.ts.map +0 -1
- package/dist/scene/scene-loader.js +0 -1211
- package/dist/scene/scene-query.d.ts +0 -11
- package/dist/scene/scene-query.d.ts.map +0 -1
- package/dist/scene/scene-query.js +0 -63
- package/dist/scene/scene-types.d.ts +0 -10
- package/dist/scene/scene-types.d.ts.map +0 -1
- package/dist/scene/scene-types.js +0 -8
- package/dist/scene/scene-version.d.ts +0 -26
- package/dist/scene/scene-version.d.ts.map +0 -1
- package/dist/scene/scene-version.js +0 -34
- package/dist/scene/schema/animation.d.ts +0 -8
- package/dist/scene/schema/animation.d.ts.map +0 -1
- package/dist/scene/schema/animation.js +0 -42
- package/dist/scene/schema/audio.d.ts +0 -13
- package/dist/scene/schema/audio.d.ts.map +0 -1
- package/dist/scene/schema/audio.js +0 -22
- package/dist/scene/schema/camera.d.ts +0 -28
- package/dist/scene/schema/camera.d.ts.map +0 -1
- package/dist/scene/schema/camera.js +0 -17
- package/dist/scene/schema/collider.d.ts +0 -40
- package/dist/scene/schema/collider.d.ts.map +0 -1
- package/dist/scene/schema/collider.js +0 -55
- package/dist/scene/schema/entity-ref.d.ts +0 -31
- package/dist/scene/schema/entity-ref.d.ts.map +0 -1
- package/dist/scene/schema/entity-ref.js +0 -61
- package/dist/scene/schema/entity.d.ts +0 -1036
- package/dist/scene/schema/entity.d.ts.map +0 -1
- package/dist/scene/schema/entity.js +0 -153
- package/dist/scene/schema/environment.d.ts +0 -425
- package/dist/scene/schema/environment.d.ts.map +0 -1
- package/dist/scene/schema/environment.js +0 -357
- package/dist/scene/schema/index.d.ts +0 -37
- package/dist/scene/schema/index.d.ts.map +0 -1
- package/dist/scene/schema/index.js +0 -19
- package/dist/scene/schema/instances.d.ts +0 -14
- package/dist/scene/schema/instances.d.ts.map +0 -1
- package/dist/scene/schema/instances.js +0 -28
- package/dist/scene/schema/joint.d.ts +0 -23
- package/dist/scene/schema/joint.d.ts.map +0 -1
- package/dist/scene/schema/joint.js +0 -23
- package/dist/scene/schema/light.d.ts +0 -38
- package/dist/scene/schema/light.d.ts.map +0 -1
- package/dist/scene/schema/light.js +0 -26
- package/dist/scene/schema/material.d.ts +0 -199
- package/dist/scene/schema/material.d.ts.map +0 -1
- package/dist/scene/schema/material.js +0 -103
- package/dist/scene/schema/mesh.d.ts +0 -48
- package/dist/scene/schema/mesh.d.ts.map +0 -1
- package/dist/scene/schema/mesh.js +0 -82
- package/dist/scene/schema/particles.d.ts +0 -2178
- package/dist/scene/schema/particles.d.ts.map +0 -1
- package/dist/scene/schema/particles.js +0 -321
- package/dist/scene/schema/physics.d.ts +0 -56
- package/dist/scene/schema/physics.d.ts.map +0 -1
- package/dist/scene/schema/physics.js +0 -37
- package/dist/scene/schema/scene-file.d.ts +0 -303
- package/dist/scene/schema/scene-file.d.ts.map +0 -1
- package/dist/scene/schema/scene-file.js +0 -256
- package/dist/scene/schema/shadow.d.ts +0 -28
- package/dist/scene/schema/shadow.d.ts.map +0 -1
- package/dist/scene/schema/shadow.js +0 -20
- package/dist/scene/schema/spline.d.ts +0 -25
- package/dist/scene/schema/spline.d.ts.map +0 -1
- package/dist/scene/schema/spline.js +0 -15
- package/dist/scene/schema/tuples.d.ts +0 -12
- package/dist/scene/schema/tuples.d.ts.map +0 -1
- package/dist/scene/schema/tuples.js +0 -14
- package/dist/scene/user-data.d.ts +0 -185
- package/dist/scene/user-data.d.ts.map +0 -1
- package/dist/scene/user-data.js +0 -144
- package/dist/setup/setup-audio.d.ts +0 -20
- package/dist/setup/setup-audio.d.ts.map +0 -1
- package/dist/setup/setup-audio.js +0 -41
- package/dist/setup/setup-particles.d.ts +0 -17
- package/dist/setup/setup-particles.d.ts.map +0 -1
- package/dist/setup/setup-particles.js +0 -16
- package/dist/setup/setup-physics.d.ts +0 -25
- package/dist/setup/setup-physics.d.ts.map +0 -1
- package/dist/setup/setup-physics.js +0 -51
- package/dist/setup/setup-renderer.d.ts +0 -69
- package/dist/setup/setup-renderer.d.ts.map +0 -1
- package/dist/setup/setup-renderer.js +0 -363
- package/dist/tools/define-tool.d.ts +0 -130
- package/dist/tools/define-tool.d.ts.map +0 -1
- package/dist/tools/define-tool.js +0 -96
- package/dist/world2d/authoring-2d.d.ts +0 -80
- package/dist/world2d/authoring-2d.d.ts.map +0 -1
- package/dist/world2d/authoring-2d.js +0 -195
- package/dist/world2d/capture-to-scene2d.d.ts +0 -5
- package/dist/world2d/capture-to-scene2d.d.ts.map +0 -1
- package/dist/world2d/capture-to-scene2d.js +0 -49
- package/dist/world2d/collision-2d.d.ts +0 -52
- package/dist/world2d/collision-2d.d.ts.map +0 -1
- package/dist/world2d/collision-2d.js +0 -70
- package/dist/world2d/components-2d.d.ts +0 -47
- package/dist/world2d/components-2d.d.ts.map +0 -1
- package/dist/world2d/components-2d.js +0 -77
- package/dist/world2d/index.d.ts +0 -34
- package/dist/world2d/index.d.ts.map +0 -1
- package/dist/world2d/index.js +0 -32
- package/dist/world2d/ingest-iframe-2d.d.ts +0 -82
- package/dist/world2d/ingest-iframe-2d.d.ts.map +0 -1
- package/dist/world2d/ingest-iframe-2d.js +0 -166
- package/dist/world2d/ingest2d.d.ts +0 -97
- package/dist/world2d/ingest2d.d.ts.map +0 -1
- package/dist/world2d/ingest2d.js +0 -40
- package/dist/world2d/physics2d-registry.d.ts +0 -24
- package/dist/world2d/physics2d-registry.d.ts.map +0 -1
- package/dist/world2d/physics2d-registry.js +0 -38
- package/dist/world2d/pixi-game-adapter.d.ts +0 -107
- package/dist/world2d/pixi-game-adapter.d.ts.map +0 -1
- package/dist/world2d/pixi-game-adapter.js +0 -210
- package/dist/world2d/pixi-surface.d.ts +0 -39
- package/dist/world2d/pixi-surface.d.ts.map +0 -1
- package/dist/world2d/pixi-surface.js +0 -47
- package/dist/world2d/scene-capture-2d.d.ts +0 -43
- package/dist/world2d/scene-capture-2d.d.ts.map +0 -1
- package/dist/world2d/scene-capture-2d.js +0 -92
- package/dist/world2d/scene2d-loader.d.ts +0 -27
- package/dist/world2d/scene2d-loader.d.ts.map +0 -1
- package/dist/world2d/scene2d-loader.js +0 -275
- package/dist/world2d/schema/entity2d.d.ts +0 -102
- package/dist/world2d/schema/entity2d.d.ts.map +0 -1
- package/dist/world2d/schema/entity2d.js +0 -119
- package/dist/world2d/schema/physics2d.d.ts +0 -46
- package/dist/world2d/schema/physics2d.d.ts.map +0 -1
- package/dist/world2d/schema/physics2d.js +0 -45
- package/dist/world2d/schema/sprite.d.ts +0 -42
- package/dist/world2d/schema/sprite.d.ts.map +0 -1
- package/dist/world2d/schema/sprite.js +0 -63
- package/dist/world2d/schema/tilemap.d.ts +0 -15
- package/dist/world2d/schema/tilemap.d.ts.map +0 -1
- package/dist/world2d/schema/tilemap.js +0 -19
- package/dist/world2d/schema/tuples2d.d.ts +0 -20
- package/dist/world2d/schema/tuples2d.d.ts.map +0 -1
- package/dist/world2d/schema/tuples2d.js +0 -19
- package/dist/world2d/system-adapters-2d.d.ts +0 -16
- package/dist/world2d/system-adapters-2d.d.ts.map +0 -1
- package/dist/world2d/system-adapters-2d.js +0 -37
- package/dist/world2d/transform-writer-2d.d.ts +0 -16
- package/dist/world2d/transform-writer-2d.d.ts.map +0 -1
- package/dist/world2d/transform-writer-2d.js +0 -22
- package/dist/world2d/types.d.ts +0 -59
- package/dist/world2d/types.d.ts.map +0 -1
- package/dist/world2d/types.js +0 -1
|
@@ -1,513 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The game-scoped debug/synthetic-player registry (`docs/SYNTHETIC-PLAYER-SPEC.md`
|
|
3
|
-
* §3.1). ONE registry per `Game` root — every world's `ctx.debug` (see
|
|
4
|
-
* `DebugCtxSurface`, `runtime/types.ts`) feeds the SAME registry via
|
|
5
|
-
* {@link DebugRegistry.forWorld}, so a name a game registers is visible (and
|
|
6
|
-
* name-collision-checked) across every world, not just the one that
|
|
7
|
-
* registered it. `createGame` (`runtime/game.ts`) constructs the registry
|
|
8
|
-
* alongside the state bridge and files it in the `Game -> DebugRegistry`
|
|
9
|
-
* WeakMap this module owns; later consumers (the react `useDebugProvider`/
|
|
10
|
-
* `useDebugCommand` hooks, editor panels) reach it via {@link getDebugRegistry}
|
|
11
|
-
* rather than threading it through every call site.
|
|
12
|
-
*
|
|
13
|
-
* Provenance note: a registration's "world" is the MOUNT's adapter id (the
|
|
14
|
-
* `fromSetup(id, ...)` / `VgaiSceneConfig.id` a project already names each
|
|
15
|
-
* world's entry with) rather than the `WorldInstance.id` `registerThreeWorld`
|
|
16
|
-
* assigns — that id isn't known until AFTER `mount()` resolves (`create-
|
|
17
|
-
* runtime.ts` calls `registerThreeWorld` with it only once `mount()` returns),
|
|
18
|
-
* which is after every `setup()`-time registration has already run. For the
|
|
19
|
-
* single-world case (nearly every project today) this is simply `'vgai-scene'`;
|
|
20
|
-
* a multi-world manifest names each world's adapter to match its declared id
|
|
21
|
-
* by convention, so collision messages stay meaningful in practice.
|
|
22
|
-
*/
|
|
23
|
-
import { z } from 'zod';
|
|
24
|
-
/** Engine-local error for the debug seam — mirrors the `code` + `data` shape
|
|
25
|
-
* `packages/vgai-sdk/src/errors.ts` uses (no import: the engine does not
|
|
26
|
-
* depend on `@vgai/sdk`). `code` is always machine-readable; nothing reading
|
|
27
|
-
* this error may key off `message` prose. */
|
|
28
|
-
export class DebugError extends Error {
|
|
29
|
-
code;
|
|
30
|
-
data;
|
|
31
|
-
constructor(code, message, data) {
|
|
32
|
-
super(message);
|
|
33
|
-
this.name = 'DebugError';
|
|
34
|
-
this.code = code;
|
|
35
|
-
this.data = data;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const REGISTRATION_HINT = 'ctx.debug.registerStateProvider(name, fn) — see the template example component';
|
|
39
|
-
/** Task 2.2 — how long `invoke()` waits for a `locus: 'server'` command's
|
|
40
|
-
* `__vgai:debugCommandResult` reply before failing loudly. */
|
|
41
|
-
const SERVER_COMMAND_TIMEOUT_MS = 10_000;
|
|
42
|
-
/** Provenance `worldId` for every registration made through the react door
|
|
43
|
-
* (`useDebugProvider`/`useDebugCommand`, `packages/engine/src/react/game-
|
|
44
|
-
* state.tsx`) — react roots have no `setup()`/`ctx.debug` of their own
|
|
45
|
-
* (spec §3.1's "react-world registration door" paragraph), so all of them
|
|
46
|
-
* share this one provenance string; a name collision between two DIFFERENT
|
|
47
|
-
* react components is therefore the same-world "replace + warn once" case,
|
|
48
|
-
* never the cross-world throw (which is reserved for a GameComponent world
|
|
49
|
-
* vs. the react door genuinely disagreeing about a name).
|
|
50
|
-
*
|
|
51
|
-
* Defect 7 fix: this used to be the bare string `'react'`, which collided in
|
|
52
|
-
* provenance with a manifest world literally named `'react'` (e.g. a
|
|
53
|
-
* `kind: 'react'` world whose `id` is `"react"`) — `forWorld('react')` and
|
|
54
|
-
* the react door would then be treated as the SAME world for collision
|
|
55
|
-
* purposes, which is wrong (they are genuinely different registrants that
|
|
56
|
-
* happen to share a display name). Namespaced like `'__engine__'` so no
|
|
57
|
-
* real project world id can ever collide with it. */
|
|
58
|
-
const REACT_WORLD_ID = '__react__';
|
|
59
|
-
function warnOnce(warned, name, kind, worldId) {
|
|
60
|
-
if (warned.has(name))
|
|
61
|
-
return;
|
|
62
|
-
warned.add(name);
|
|
63
|
-
// biome-ignore lint/suspicious/noConsole: structured, greppable — the debug seam's own duplicate-registration signal (spec §3.1)
|
|
64
|
-
console.warn(`[debug] ${kind} "${name}" re-registered (world "${worldId}")`);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Construct a fresh game-scoped debug registry. `getTick`/`getSimT` are
|
|
68
|
-
* suppliers (not values) so the built-in `time` provider always reads the
|
|
69
|
-
* CURRENT counters — `createGame` passes closures over its own mutable
|
|
70
|
-
* `tick`/`simT`, incremented in `runFrame`'s tail (T1.2). `getDefaultWorldId`
|
|
71
|
-
* (D15/T-D15.5, optional) resolves the manifest's first/default world id —
|
|
72
|
-
* `createGame` passes `() => (roots.length ? requireDefaultWorld().id :
|
|
73
|
-
* null)`; a bare `createDebugRegistry()` test stand-in with no `Game` behind
|
|
74
|
-
* it omits it (per-world resolution then falls back to "the single
|
|
75
|
-
* registered world" or "whichever registered first" — see
|
|
76
|
-
* `resolveInputWorldId`). `getLoopLiveness` (issue #175, optional) supplies
|
|
77
|
-
* the REAL `GameLoop.liveness` — `createGame` passes `() => opts.loop.
|
|
78
|
-
* liveness`; a bare `createDebugRegistry()` test stand-in with no loop
|
|
79
|
-
* behind it omits it, and the built-in `time` provider reports `null`
|
|
80
|
-
* rather than fabricating `'running'` (this module must never claim health
|
|
81
|
-
* it cannot observe, same rule the loop's own liveness getter documents).
|
|
82
|
-
*/
|
|
83
|
-
export function createDebugRegistry(opts) {
|
|
84
|
-
const providers = new Map();
|
|
85
|
-
const commands = new Map();
|
|
86
|
-
const warnedProviders = new Set();
|
|
87
|
-
const warnedCommands = new Set();
|
|
88
|
-
const ring = [];
|
|
89
|
-
const RING_CAP = 500;
|
|
90
|
-
// Run-4 friction #5 — monotonic, registry-lifetime counter backing
|
|
91
|
-
// `TickStampedEvent.seq`. Never reset, never shared by two events (unlike
|
|
92
|
-
// `tick`, which a debug-command emission and a fenced consumer's snapshot
|
|
93
|
-
// can legitimately collide on — see that field's doc comment in
|
|
94
|
-
// `adapter/system-adapter.ts`).
|
|
95
|
-
let seqCounter = 0;
|
|
96
|
-
let roomDeclared = false;
|
|
97
|
-
// D15/T-D15.5 — per-world maps (Map preserves insertion order, which
|
|
98
|
-
// `resolveInputWorldId`'s "whichever registered first" fallback relies on
|
|
99
|
-
// when no `getDefaultWorldId` is available to disambiguate).
|
|
100
|
-
const inputActionsSources = new Map();
|
|
101
|
-
const inputTraceSources = new Map();
|
|
102
|
-
const virtualInputTargets = new Map();
|
|
103
|
-
let runTicksTarget = null;
|
|
104
|
-
let attachedRoom = null;
|
|
105
|
-
const pendingServerCommands = new Map();
|
|
106
|
-
let requestCounter = 0;
|
|
107
|
-
/**
|
|
108
|
-
* The ONE resolution function every per-world input seam shares (D15
|
|
109
|
-
* review objection: the debug bridge and the editor relay must never be
|
|
110
|
-
* able to disagree about which world an unqualified actuation targets).
|
|
111
|
-
*
|
|
112
|
-
* - `explicit` given: must be a registered world id, else throws
|
|
113
|
-
* `DEBUG_INPUT_WORLD_NOT_FOUND` (a caller mistake — distinct from
|
|
114
|
-
* "nothing mounted yet", which returns `null` below instead of throwing).
|
|
115
|
-
* - `explicit` omitted: the manifest's first/default world id
|
|
116
|
-
* (`opts.getDefaultWorldId()`) iff that world has actually registered —
|
|
117
|
-
* else (no `Game`/no default resolvable, or the default world never
|
|
118
|
-
* wired one — e.g. a foreign/opaque mount) the single registered world,
|
|
119
|
-
* or, with more than one and no resolvable default, whichever registered
|
|
120
|
-
* FIRST (`Map` insertion order) — the closest analogue to this seam's
|
|
121
|
-
* pre-D15.5 single-slot behavior, but now a stable, principled choice
|
|
122
|
-
* instead of "whichever mounted last".
|
|
123
|
-
* - Nothing registered at all: `null`.
|
|
124
|
-
*/
|
|
125
|
-
function resolveInputWorldId(explicit) {
|
|
126
|
-
if (explicit !== undefined) {
|
|
127
|
-
if (!virtualInputTargets.has(explicit)) {
|
|
128
|
-
throw new DebugError('DEBUG_INPUT_WORLD_NOT_FOUND', `debug: no InputManager wired for world "${explicit}" — registered: ` +
|
|
129
|
-
(virtualInputTargets.size ? [...virtualInputTargets.keys()].join(', ') : '(none)'), { worldId: explicit, registered: [...virtualInputTargets.keys()] });
|
|
130
|
-
}
|
|
131
|
-
return explicit;
|
|
132
|
-
}
|
|
133
|
-
return resolveWorldForSource(virtualInputTargets.keys());
|
|
134
|
-
}
|
|
135
|
-
/** The same "default world, else the one registered, else whichever
|
|
136
|
-
* registered first" fallback {@link resolveInputWorldId} uses for the
|
|
137
|
-
* ACTUATION target, generalized over any per-world registration set
|
|
138
|
-
* (`inputActionsSources`/`inputTraceSources` included) — every one of
|
|
139
|
-
* these maps is keyed by the same world ids, populated at the same
|
|
140
|
-
* per-world mount seed spot, so "the default world" means the same thing
|
|
141
|
-
* for all of them. Never throws (no explicit-id case here — the two
|
|
142
|
-
* builtin providers that call this have no way to accept a caller-chosen
|
|
143
|
-
* worldId today; see their own doc comments). */
|
|
144
|
-
function resolveWorldForSource(registered) {
|
|
145
|
-
const ids = [...registered];
|
|
146
|
-
if (ids.length === 0)
|
|
147
|
-
return null;
|
|
148
|
-
const defaultId = opts.getDefaultWorldId?.() ?? null;
|
|
149
|
-
if (defaultId !== null && ids.includes(defaultId))
|
|
150
|
-
return defaultId;
|
|
151
|
-
return ids[0];
|
|
152
|
-
}
|
|
153
|
-
providers.set('time', {
|
|
154
|
-
// `loopLiveness` (issue #175): `null` when no loop is wired behind this
|
|
155
|
-
// registry (a bare `createDebugRegistry()` test stand-in) — never a
|
|
156
|
-
// fabricated `'running'`. Every real `Game` (`createGame`) wires this,
|
|
157
|
-
// so every live play session reports a real value.
|
|
158
|
-
fn: () => ({
|
|
159
|
-
simSeconds: opts.getSimT(),
|
|
160
|
-
tick: opts.getTick(),
|
|
161
|
-
loopLiveness: opts.getLoopLiveness?.() ?? null,
|
|
162
|
-
}),
|
|
163
|
-
tier: 'observable',
|
|
164
|
-
worldId: '__engine__',
|
|
165
|
-
builtin: true,
|
|
166
|
-
});
|
|
167
|
-
providers.set('input.actions', {
|
|
168
|
-
// Resolves to the DEFAULT world's action list (see `resolveInputWorldId`)
|
|
169
|
-
// — deterministic across every world that registers, rather than the
|
|
170
|
-
// pre-D15.5 "whichever mounted last" behavior.
|
|
171
|
-
fn: () => {
|
|
172
|
-
const worldId = resolveWorldForSource(inputActionsSources.keys());
|
|
173
|
-
return (worldId ? inputActionsSources.get(worldId) : undefined)?.() ?? [];
|
|
174
|
-
},
|
|
175
|
-
tier: 'observable',
|
|
176
|
-
worldId: '__engine__',
|
|
177
|
-
builtin: true,
|
|
178
|
-
});
|
|
179
|
-
// D15/T-D15.5 — the post-gate action-delta trace, readable via a provider.
|
|
180
|
-
// Absent a wired source (no world mounted yet) reads an empty, correctly-
|
|
181
|
-
// versioned trace rather than throwing. Same default-world resolution as
|
|
182
|
-
// `input.actions` immediately above.
|
|
183
|
-
providers.set('input.trace', {
|
|
184
|
-
fn: () => {
|
|
185
|
-
const worldId = resolveWorldForSource(inputTraceSources.keys());
|
|
186
|
-
return ((worldId ? inputTraceSources.get(worldId) : undefined)?.() ?? {
|
|
187
|
-
version: 1,
|
|
188
|
-
seed: null,
|
|
189
|
-
fixedDt: null,
|
|
190
|
-
ticks: [],
|
|
191
|
-
});
|
|
192
|
-
},
|
|
193
|
-
tier: 'observable',
|
|
194
|
-
worldId: '__engine__',
|
|
195
|
-
builtin: true,
|
|
196
|
-
});
|
|
197
|
-
function registerStateProvider(worldId, name, fn, tier, token) {
|
|
198
|
-
const existing = providers.get(name);
|
|
199
|
-
if (existing?.builtin) {
|
|
200
|
-
// Defect 1 fix: a builtin name (`time`, `input.actions`) must never be
|
|
201
|
-
// silently shadowed — the old `!existing.builtin` guard skipped BOTH
|
|
202
|
-
// the collision throw and the warn for this case, so
|
|
203
|
-
// `registerStateProvider('time', ...)` quietly replaced engine truth,
|
|
204
|
-
// and a later `strip()` deleted it outright (leaving NO `time`
|
|
205
|
-
// provider at all post-hot-reload). Throw loudly instead; there is no
|
|
206
|
-
// silent-replace path for a builtin.
|
|
207
|
-
throw new DebugError('DEBUG_BUILTIN_RESERVED', `debug: "${name}" is a built-in state provider (registered by "${existing.worldId}") — ` +
|
|
208
|
-
'built-in names cannot be registered over, from a world or the react door', { name, registered: existing.worldId });
|
|
209
|
-
}
|
|
210
|
-
if (existing) {
|
|
211
|
-
if (existing.worldId !== worldId) {
|
|
212
|
-
throw new DebugError('DEBUG_NAME_COLLISION', `debug: state provider "${name}" is registered by both world "${existing.worldId}" ` +
|
|
213
|
-
`and world "${worldId}" — each provider name must be unique across live roots`, { name, roots: [existing.worldId, worldId] });
|
|
214
|
-
}
|
|
215
|
-
warnOnce(warnedProviders, name, 'provider', worldId);
|
|
216
|
-
}
|
|
217
|
-
providers.set(name, { fn, tier, worldId, builtin: false, token });
|
|
218
|
-
}
|
|
219
|
-
function registerCommand(worldId, name, spec, fn, token) {
|
|
220
|
-
if (spec.locus === undefined && roomDeclared) {
|
|
221
|
-
throw new DebugError('DEBUG_COMMAND_LOCUS_REQUIRED', "this project declares a Colyseus room — declare locus: 'client' | 'server' so " +
|
|
222
|
-
'fixtures mutate authoritative state, not client prediction', { name, worldId });
|
|
223
|
-
}
|
|
224
|
-
const existing = commands.get(name);
|
|
225
|
-
if (existing) {
|
|
226
|
-
if (existing.worldId !== worldId) {
|
|
227
|
-
throw new DebugError('DEBUG_NAME_COLLISION', `debug: command "${name}" is registered by both world "${existing.worldId}" and ` +
|
|
228
|
-
`world "${worldId}" — each command name must be unique across live roots`, { name, roots: [existing.worldId, worldId] });
|
|
229
|
-
}
|
|
230
|
-
warnOnce(warnedCommands, name, 'command', worldId);
|
|
231
|
-
}
|
|
232
|
-
commands.set(name, {
|
|
233
|
-
description: spec.description,
|
|
234
|
-
argsSchema: spec.args,
|
|
235
|
-
locus: spec.locus,
|
|
236
|
-
fn,
|
|
237
|
-
worldId,
|
|
238
|
-
token,
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
function emit(event, detail) {
|
|
242
|
-
seqCounter += 1;
|
|
243
|
-
ring.push({ tick: opts.getTick(), simT: opts.getSimT(), event, detail, seq: seqCounter });
|
|
244
|
-
if (ring.length > RING_CAP)
|
|
245
|
-
ring.shift();
|
|
246
|
-
}
|
|
247
|
-
/** See `DebugAdapter.events`'s doc comment (`adapter/system-adapter.ts`)
|
|
248
|
-
* for the full contract — `sinceSeq` (when given) wins over `sinceTick`,
|
|
249
|
-
* since it's the unambiguous one. */
|
|
250
|
-
function events(sinceTick, sinceSeq) {
|
|
251
|
-
if (sinceSeq !== undefined)
|
|
252
|
-
return ring.filter((e) => e.seq > sinceSeq);
|
|
253
|
-
if (sinceTick === undefined)
|
|
254
|
-
return ring.slice();
|
|
255
|
-
return ring.filter((e) => e.tick > sinceTick);
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Task 2.2 — server-locus command routing (client leg). A `locus: 'server'`
|
|
259
|
-
* command never calls its own registered `fn` locally: `invoke()` instead
|
|
260
|
-
* sends the reserved room message `__vgai:debugCommand` and resolves on the
|
|
261
|
-
* matching `__vgai:debugCommandResult` reply, so a fixture mutates the
|
|
262
|
-
* AUTHORITATIVE (server) copy of state, not client prediction. Request ids
|
|
263
|
-
* are a monotonic per-registry counter (`dbg-<n>`), not `Math.random`/
|
|
264
|
-
* `Date.now`, so two in-flight commands never collide and correlation is
|
|
265
|
-
* trivially inspectable in logs.
|
|
266
|
-
*/
|
|
267
|
-
function invokeServerCommand(name, args) {
|
|
268
|
-
if (!attachedRoom) {
|
|
269
|
-
throw new DebugError('DEBUG_COMMAND_FAILED', `debug: command "${name}" is locus:'server' but no Colyseus room is attached ` +
|
|
270
|
-
'(call ctx.debug.attachRoom(room) once your game joins its room)', { reason: 'no room connection' });
|
|
271
|
-
}
|
|
272
|
-
const requestId = `dbg-${++requestCounter}`;
|
|
273
|
-
const room = attachedRoom;
|
|
274
|
-
return new Promise((resolve, reject) => {
|
|
275
|
-
const timer = setTimeout(() => {
|
|
276
|
-
pendingServerCommands.delete(requestId);
|
|
277
|
-
reject(new DebugError('DEBUG_COMMAND_FAILED', `debug: command "${name}" (requestId "${requestId}") timed out waiting for the server`, { reason: 'server timeout' }));
|
|
278
|
-
}, SERVER_COMMAND_TIMEOUT_MS);
|
|
279
|
-
pendingServerCommands.set(requestId, { resolve, reject, timer });
|
|
280
|
-
room.send('__vgai:debugCommand', { name, args, requestId });
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
// Defect 8 fix — the live detach() for whatever room is CURRENTLY attached
|
|
284
|
-
// (or null if none). `attachRoom` calls this itself before attaching a new
|
|
285
|
-
// room: without it, a second `attachRoom` call (no explicit `detach()` in
|
|
286
|
-
// between) left the first room's `__vgai:debugCommandResult` subscription
|
|
287
|
-
// live forever (a leak — the old room keeps getting messages dispatched to
|
|
288
|
-
// a handler nothing reads anymore) and stranded any of ITS in-flight
|
|
289
|
-
// commands riding the full 10s timeout with no way to ever be answered.
|
|
290
|
-
let detachCurrentRoom = null;
|
|
291
|
-
/** {@link DebugCtxSurface.attachRoom} — shared across every world's ctx
|
|
292
|
-
* surface (game-scoped, last-attached room wins — and, since Defect 8,
|
|
293
|
-
* actually CLEANS UP the previous attachment rather than merely
|
|
294
|
-
* overwriting the pointer). Subscribes to the reserved
|
|
295
|
-
* `__vgai:debugCommandResult` reply and resolves/rejects the matching
|
|
296
|
-
* in-flight {@link invokeServerCommand} promise by `requestId`. */
|
|
297
|
-
function attachRoom(room) {
|
|
298
|
-
// Last-wins, but with cleanup: detach whatever room was attached before
|
|
299
|
-
// (unsubscribes its listener, rejects ITS in-flight pendings — see
|
|
300
|
-
// `detach` below) rather than leaking it.
|
|
301
|
-
detachCurrentRoom?.();
|
|
302
|
-
attachedRoom = room;
|
|
303
|
-
const unsubscribe = room.onMessage('__vgai:debugCommandResult', (message) => {
|
|
304
|
-
const reply = message;
|
|
305
|
-
const requestId = reply?.requestId;
|
|
306
|
-
if (requestId === undefined)
|
|
307
|
-
return;
|
|
308
|
-
const pending = pendingServerCommands.get(requestId);
|
|
309
|
-
if (!pending)
|
|
310
|
-
return;
|
|
311
|
-
pendingServerCommands.delete(requestId);
|
|
312
|
-
clearTimeout(pending.timer);
|
|
313
|
-
if (reply?.ok) {
|
|
314
|
-
pending.resolve(reply.result);
|
|
315
|
-
}
|
|
316
|
-
else {
|
|
317
|
-
pending.reject(new DebugError('DEBUG_COMMAND_FAILED', `debug: server command failed: ${String(reply?.error)}`, { cause: reply?.error }));
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
const detach = () => {
|
|
321
|
-
// Idempotent, and a no-op if a LATER attachRoom already superseded
|
|
322
|
-
// this attachment (its own detach ran first via detachCurrentRoom?.()
|
|
323
|
-
// above) — calling this stale detach again must not clobber the new
|
|
324
|
-
// attachment's state.
|
|
325
|
-
if (detachCurrentRoom !== detach)
|
|
326
|
-
return;
|
|
327
|
-
detachCurrentRoom = null;
|
|
328
|
-
if (attachedRoom === room)
|
|
329
|
-
attachedRoom = null;
|
|
330
|
-
if (typeof unsubscribe === 'function')
|
|
331
|
-
unsubscribe();
|
|
332
|
-
// Defect 8 fix: reject every command still awaiting THIS room's reply
|
|
333
|
-
// right now, rather than let it silently ride out the full 10s
|
|
334
|
-
// `SERVER_COMMAND_TIMEOUT_MS` with no room left to ever answer it.
|
|
335
|
-
for (const [requestId, pending] of pendingServerCommands) {
|
|
336
|
-
clearTimeout(pending.timer);
|
|
337
|
-
pending.reject(new DebugError('DEBUG_COMMAND_FAILED', `debug: command (requestId "${requestId}") failed — its room was detached before a reply arrived`, { reason: 'no room connection' }));
|
|
338
|
-
}
|
|
339
|
-
pendingServerCommands.clear();
|
|
340
|
-
};
|
|
341
|
-
detachCurrentRoom = detach;
|
|
342
|
-
return detach;
|
|
343
|
-
}
|
|
344
|
-
const adapter = {
|
|
345
|
-
providers() {
|
|
346
|
-
return [...providers.entries()].map(([name, entry]) => ({ name, tier: entry.tier }));
|
|
347
|
-
},
|
|
348
|
-
state(name) {
|
|
349
|
-
const entry = providers.get(name);
|
|
350
|
-
if (!entry) {
|
|
351
|
-
throw new DebugError('STATE_PROVIDER_NOT_FOUND', `debug: no state provider registered under "${name}"`, {
|
|
352
|
-
registered: [...providers.keys()],
|
|
353
|
-
registrationHint: REGISTRATION_HINT,
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
return entry.fn();
|
|
357
|
-
},
|
|
358
|
-
stateAll() {
|
|
359
|
-
const result = {};
|
|
360
|
-
for (const [name, entry] of providers) {
|
|
361
|
-
try {
|
|
362
|
-
result[name] = entry.fn();
|
|
363
|
-
}
|
|
364
|
-
catch (err) {
|
|
365
|
-
result[name] = { __error: String(err) };
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
return result;
|
|
369
|
-
},
|
|
370
|
-
commands() {
|
|
371
|
-
return [...commands.entries()].map(([name, entry]) => ({
|
|
372
|
-
name,
|
|
373
|
-
description: entry.description,
|
|
374
|
-
argsJsonSchema: entry.argsSchema
|
|
375
|
-
? z.toJSONSchema(entry.argsSchema, { unrepresentable: 'any' })
|
|
376
|
-
: undefined,
|
|
377
|
-
locus: entry.locus ?? 'client',
|
|
378
|
-
}));
|
|
379
|
-
},
|
|
380
|
-
async invoke(name, args) {
|
|
381
|
-
const entry = commands.get(name);
|
|
382
|
-
if (!entry) {
|
|
383
|
-
throw new DebugError('DEBUG_COMMAND_NOT_REGISTERED', `debug: no command registered under "${name}"`, { registered: [...commands.keys()], registrationHint: REGISTRATION_HINT });
|
|
384
|
-
}
|
|
385
|
-
let parsedArgs = args;
|
|
386
|
-
if (entry.argsSchema) {
|
|
387
|
-
const result = entry.argsSchema.safeParse(args);
|
|
388
|
-
if (!result.success) {
|
|
389
|
-
throw new DebugError('DEBUG_COMMAND_ARGS_INVALID', `debug: command "${name}" received invalid args`, { issues: result.error.issues });
|
|
390
|
-
}
|
|
391
|
-
parsedArgs = result.data;
|
|
392
|
-
}
|
|
393
|
-
if ((entry.locus ?? 'client') === 'server') {
|
|
394
|
-
return invokeServerCommand(name, parsedArgs);
|
|
395
|
-
}
|
|
396
|
-
try {
|
|
397
|
-
return await entry.fn(...parsedArgs);
|
|
398
|
-
}
|
|
399
|
-
catch (cause) {
|
|
400
|
-
throw new DebugError('DEBUG_COMMAND_FAILED', `debug: command "${name}" threw`, { cause });
|
|
401
|
-
}
|
|
402
|
-
},
|
|
403
|
-
events(sinceTick, sinceSeq) {
|
|
404
|
-
return events(sinceTick, sinceSeq);
|
|
405
|
-
},
|
|
406
|
-
};
|
|
407
|
-
return {
|
|
408
|
-
adapter,
|
|
409
|
-
forWorld(worldId) {
|
|
410
|
-
return {
|
|
411
|
-
registerStateProvider(name, fn, providerOpts) {
|
|
412
|
-
registerStateProvider(worldId, name, fn, providerOpts?.tier ?? 'observable');
|
|
413
|
-
},
|
|
414
|
-
registerCommand(name, spec, fn) {
|
|
415
|
-
// Cast: the public generic (`DebugCtxSurface.registerCommand`,
|
|
416
|
-
// `DebugCommandArgs<T>`) exists purely for the CALLER's inference —
|
|
417
|
-
// internally, every entry is stored/invoked through the same
|
|
418
|
-
// untyped `(...args: unknown[])` shape (`invoke()` parses `args`
|
|
419
|
-
// against `argsSchema` at the seam, not at the type level).
|
|
420
|
-
registerCommand(worldId, name, spec, fn);
|
|
421
|
-
},
|
|
422
|
-
emit(event, detail) {
|
|
423
|
-
emit(event, detail);
|
|
424
|
-
},
|
|
425
|
-
attachRoom(room) {
|
|
426
|
-
return attachRoom(room);
|
|
427
|
-
},
|
|
428
|
-
};
|
|
429
|
-
},
|
|
430
|
-
emitReact(event, detail) {
|
|
431
|
-
emit(event, detail);
|
|
432
|
-
},
|
|
433
|
-
strip(worldId) {
|
|
434
|
-
// Defect 2 fix — scoped when `worldId` is given (a single mount's
|
|
435
|
-
// hot-reload re-seed), global otherwise (the whole game going away, or
|
|
436
|
-
// a test's blanket teardown). See this method's interface doc comment.
|
|
437
|
-
for (const [name, entry] of providers) {
|
|
438
|
-
if (entry.builtin)
|
|
439
|
-
continue;
|
|
440
|
-
if (worldId !== undefined && entry.worldId !== worldId)
|
|
441
|
-
continue;
|
|
442
|
-
providers.delete(name);
|
|
443
|
-
warnedProviders.delete(name);
|
|
444
|
-
}
|
|
445
|
-
for (const [name, entry] of commands) {
|
|
446
|
-
if (worldId !== undefined && entry.worldId !== worldId)
|
|
447
|
-
continue;
|
|
448
|
-
commands.delete(name);
|
|
449
|
-
warnedCommands.delete(name);
|
|
450
|
-
}
|
|
451
|
-
},
|
|
452
|
-
setRoomDeclared(declared) {
|
|
453
|
-
roomDeclared = declared;
|
|
454
|
-
},
|
|
455
|
-
setInputActionsSource(worldId, fn) {
|
|
456
|
-
inputActionsSources.set(worldId, fn);
|
|
457
|
-
},
|
|
458
|
-
setInputTraceSource(worldId, fn) {
|
|
459
|
-
inputTraceSources.set(worldId, fn);
|
|
460
|
-
},
|
|
461
|
-
setVirtualInputTarget(worldId, target) {
|
|
462
|
-
virtualInputTargets.set(worldId, target);
|
|
463
|
-
},
|
|
464
|
-
getVirtualInputTarget(worldId) {
|
|
465
|
-
const resolved = resolveInputWorldId(worldId);
|
|
466
|
-
return resolved !== null ? (virtualInputTargets.get(resolved) ?? null) : null;
|
|
467
|
-
},
|
|
468
|
-
setRunTicksTarget(target) {
|
|
469
|
-
runTicksTarget = target;
|
|
470
|
-
},
|
|
471
|
-
getRunTicksTarget() {
|
|
472
|
-
return runTicksTarget;
|
|
473
|
-
},
|
|
474
|
-
getGameTick() {
|
|
475
|
-
return opts.getTick();
|
|
476
|
-
},
|
|
477
|
-
registerReactProvider(name, fn, providerOpts) {
|
|
478
|
-
const token = Symbol(name);
|
|
479
|
-
registerStateProvider(REACT_WORLD_ID, name, fn, providerOpts?.tier ?? 'observable', token);
|
|
480
|
-
return () => {
|
|
481
|
-
const entry = providers.get(name);
|
|
482
|
-
if (entry?.token === token) {
|
|
483
|
-
providers.delete(name);
|
|
484
|
-
warnedProviders.delete(name);
|
|
485
|
-
}
|
|
486
|
-
};
|
|
487
|
-
},
|
|
488
|
-
registerReactCommand(name, spec, fn) {
|
|
489
|
-
const token = Symbol(name);
|
|
490
|
-
// See the `forWorld().registerCommand` cast above — same reason.
|
|
491
|
-
registerCommand(REACT_WORLD_ID, name, spec, fn, token);
|
|
492
|
-
return () => {
|
|
493
|
-
const entry = commands.get(name);
|
|
494
|
-
if (entry?.token === token) {
|
|
495
|
-
commands.delete(name);
|
|
496
|
-
warnedCommands.delete(name);
|
|
497
|
-
}
|
|
498
|
-
};
|
|
499
|
-
},
|
|
500
|
-
};
|
|
501
|
-
}
|
|
502
|
-
const registryByGame = new WeakMap();
|
|
503
|
-
/** Called once by `createGame`, right after both the registry and the Game
|
|
504
|
-
* shell object exist, to file the association {@link getDebugRegistry} reads. */
|
|
505
|
-
export function registerDebugRegistry(game, registry) {
|
|
506
|
-
registryByGame.set(game, registry);
|
|
507
|
-
}
|
|
508
|
-
/** The game-scoped registry backing `game.systemAdapters.debug`, or `null` for
|
|
509
|
-
* a `Game` built without one (there is always one for every `createGame`
|
|
510
|
-
* call — `null` only for a `Game`-shaped stand-in a test builds by hand). */
|
|
511
|
-
export function getDebugRegistry(game) {
|
|
512
|
-
return registryByGame.get(game) ?? null;
|
|
513
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure, react-free frame-version cache (T7.4 slice 1 — `docs/
|
|
3
|
-
* REACT-STATE-BRIDGE.md` §3). `useGameState` (`packages/editor/template/src/
|
|
4
|
-
* ui/game-state.tsx`) is a thin `useSyncExternalStore` wrapper
|
|
5
|
-
* around this: `getSnapshot` re-runs the selector once per `frameVersion`
|
|
6
|
-
* bump (`GameStateBridge`, `runtime/state-bridge.ts`), caches by version,
|
|
7
|
-
* and returns the PREVIOUS reference when `equals` holds against the fresh
|
|
8
|
-
* result — that reference stability is what lets `useSyncExternalStore`
|
|
9
|
-
* (and thus React) bail out of a re-render.
|
|
10
|
-
*
|
|
11
|
-
* Extracted to its own react-free module (no react import here, or anywhere
|
|
12
|
-
* under `runtime/`) so this cache/equality logic — the part of the hook
|
|
13
|
-
* that has real branching to get wrong — is unit-testable headlessly under
|
|
14
|
-
* `packages/engine/test/`, without needing a react test harness (none
|
|
15
|
-
* exists in this repo today; see `test/frame-selector-cache.test.ts`).
|
|
16
|
-
*/
|
|
17
|
-
/** Equality comparator for `FrameSelectorCache`/`useGameState`. Defaults to
|
|
18
|
-
* `Object.is` (T7.4 §3); pass {@link shallow} for tuples/plain objects. */
|
|
19
|
-
export type Equals<T> = (a: T, b: T) => boolean;
|
|
20
|
-
/**
|
|
21
|
-
* One-level shallow-equality helper (own enumerable keys, `Object.is` per
|
|
22
|
-
* value) — the opt-in equality for selectors that return a fresh
|
|
23
|
-
* object/array/tuple every call. Two non-object values fall back to
|
|
24
|
-
* `Object.is`; a non-object compared against an object is never equal.
|
|
25
|
-
*/
|
|
26
|
-
export declare function shallow<T>(a: T, b: T): boolean;
|
|
27
|
-
export interface FrameSelectorCache<T> {
|
|
28
|
-
/**
|
|
29
|
-
* Return the cached value for `frameVersion` if it's the SAME version as
|
|
30
|
-
* the last call (selector not re-run at all). Otherwise call `compute()`
|
|
31
|
-
* once: if the fresh result is `equals` to the previously cached value,
|
|
32
|
-
* the PREVIOUS reference is returned (and re-tagged with this
|
|
33
|
-
* `frameVersion`, so the next same-version call also short-circuits);
|
|
34
|
-
* otherwise the fresh value is cached and returned.
|
|
35
|
-
*/
|
|
36
|
-
get(frameVersion: number, compute: () => T): T;
|
|
37
|
-
}
|
|
38
|
-
/** Construct a fresh per-subscriber cache. One per `useGameState` call site
|
|
39
|
-
* (a fresh cache each mount — see the hook). */
|
|
40
|
-
export declare function createFrameSelectorCache<T>(equals?: Equals<T>): FrameSelectorCache<T>;
|
|
41
|
-
//# sourceMappingURL=frame-selector-cache.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"frame-selector-cache.d.ts","sourceRoot":"","sources":["../../src/runtime/frame-selector-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;4EAC4E;AAC5E,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC;AAEhD;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,OAAO,CAa9C;AAED,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC;;;;;;;OAOG;IACH,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;CAChD;AAED;iDACiD;AACjD,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,MAAM,GAAE,MAAM,CAAC,CAAC,CAAa,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAwBhG"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure, react-free frame-version cache (T7.4 slice 1 — `docs/
|
|
3
|
-
* REACT-STATE-BRIDGE.md` §3). `useGameState` (`packages/editor/template/src/
|
|
4
|
-
* ui/game-state.tsx`) is a thin `useSyncExternalStore` wrapper
|
|
5
|
-
* around this: `getSnapshot` re-runs the selector once per `frameVersion`
|
|
6
|
-
* bump (`GameStateBridge`, `runtime/state-bridge.ts`), caches by version,
|
|
7
|
-
* and returns the PREVIOUS reference when `equals` holds against the fresh
|
|
8
|
-
* result — that reference stability is what lets `useSyncExternalStore`
|
|
9
|
-
* (and thus React) bail out of a re-render.
|
|
10
|
-
*
|
|
11
|
-
* Extracted to its own react-free module (no react import here, or anywhere
|
|
12
|
-
* under `runtime/`) so this cache/equality logic — the part of the hook
|
|
13
|
-
* that has real branching to get wrong — is unit-testable headlessly under
|
|
14
|
-
* `packages/engine/test/`, without needing a react test harness (none
|
|
15
|
-
* exists in this repo today; see `test/frame-selector-cache.test.ts`).
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* One-level shallow-equality helper (own enumerable keys, `Object.is` per
|
|
19
|
-
* value) — the opt-in equality for selectors that return a fresh
|
|
20
|
-
* object/array/tuple every call. Two non-object values fall back to
|
|
21
|
-
* `Object.is`; a non-object compared against an object is never equal.
|
|
22
|
-
*/
|
|
23
|
-
export function shallow(a, b) {
|
|
24
|
-
if (Object.is(a, b))
|
|
25
|
-
return true;
|
|
26
|
-
if (typeof a !== 'object' || a === null || typeof b !== 'object' || b === null) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
const aKeys = Object.keys(a);
|
|
30
|
-
const bKeys = Object.keys(b);
|
|
31
|
-
if (aKeys.length !== bKeys.length)
|
|
32
|
-
return false;
|
|
33
|
-
const bRecord = b;
|
|
34
|
-
for (const key of aKeys) {
|
|
35
|
-
if (!Object.is(a[key], bRecord[key]))
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
/** Construct a fresh per-subscriber cache. One per `useGameState` call site
|
|
41
|
-
* (a fresh cache each mount — see the hook). */
|
|
42
|
-
export function createFrameSelectorCache(equals = Object.is) {
|
|
43
|
-
let hasValue = false;
|
|
44
|
-
let cachedVersion = -1;
|
|
45
|
-
let cachedValue;
|
|
46
|
-
return {
|
|
47
|
-
get(frameVersion, compute) {
|
|
48
|
-
if (hasValue && frameVersion === cachedVersion) {
|
|
49
|
-
return cachedValue;
|
|
50
|
-
}
|
|
51
|
-
const next = compute();
|
|
52
|
-
if (hasValue && equals(cachedValue, next)) {
|
|
53
|
-
// Bail-out: keep the PREVIOUS reference, but remember we're current
|
|
54
|
-
// as of this frameVersion so a repeat call at the same version
|
|
55
|
-
// doesn't even re-run `compute`.
|
|
56
|
-
cachedVersion = frameVersion;
|
|
57
|
-
return cachedValue;
|
|
58
|
-
}
|
|
59
|
-
cachedValue = next;
|
|
60
|
-
cachedVersion = frameVersion;
|
|
61
|
-
hasValue = true;
|
|
62
|
-
return cachedValue;
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
}
|