@vgai/engine 0.5.14 → 0.5.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/dist/adapter/adapter-module.d.ts +228 -17
  2. package/dist/adapter/adapter-module.d.ts.map +1 -1
  3. package/dist/adapter/adapter-module.js +224 -42
  4. package/dist/adapter/authoring-seam-contract.d.ts +530 -0
  5. package/dist/adapter/authoring-seam-contract.d.ts.map +1 -0
  6. package/dist/adapter/authoring-seam-contract.js +162 -0
  7. package/dist/adapter/authoring.d.ts +237 -50
  8. package/dist/adapter/authoring.d.ts.map +1 -1
  9. package/dist/adapter/authoring.js +2 -1
  10. package/dist/adapter/entrypoint-selection-source.d.ts +35 -0
  11. package/dist/adapter/entrypoint-selection-source.d.ts.map +1 -0
  12. package/dist/adapter/entrypoint-selection-source.js +151 -0
  13. package/dist/adapter/finders/scenes-from-entrypoint-selection.d.ts +7 -1
  14. package/dist/adapter/finders/scenes-from-entrypoint-selection.d.ts.map +1 -1
  15. package/dist/adapter/finders/scenes-from-entrypoint-selection.js +142 -21
  16. package/dist/adapter/first-party-systems.d.ts +13 -3
  17. package/dist/adapter/first-party-systems.d.ts.map +1 -1
  18. package/dist/adapter/first-party-systems.js +10 -3
  19. package/dist/adapter/index.d.ts +7 -2
  20. package/dist/adapter/index.d.ts.map +1 -1
  21. package/dist/adapter/index.js +4 -0
  22. package/dist/adapter/ingest/contract-system-adapters.d.ts +1 -1
  23. package/dist/adapter/ingest/contract-system-adapters.d.ts.map +1 -1
  24. package/dist/adapter/ingest/contract-system-adapters.js +13 -25
  25. package/dist/adapter/ingest/game-contract-seams.d.ts +214 -0
  26. package/dist/adapter/ingest/game-contract-seams.d.ts.map +1 -0
  27. package/dist/adapter/ingest/game-contract-seams.js +62 -0
  28. package/dist/adapter/ingest/game-contract.d.ts +5 -3
  29. package/dist/adapter/ingest/game-contract.d.ts.map +1 -1
  30. package/dist/adapter/ingest/game-contract.js +4 -1
  31. package/dist/adapter/ingest/merge-debug-adapters.d.ts +52 -0
  32. package/dist/adapter/ingest/merge-debug-adapters.d.ts.map +1 -0
  33. package/dist/adapter/ingest/merge-debug-adapters.js +141 -0
  34. package/dist/adapter/ingest/observation-debug-adapter.d.ts +56 -0
  35. package/dist/adapter/ingest/observation-debug-adapter.d.ts.map +1 -0
  36. package/dist/adapter/ingest/observation-debug-adapter.js +131 -0
  37. package/dist/adapter/ingest/scene-capture.d.ts +38 -13
  38. package/dist/adapter/ingest/scene-capture.d.ts.map +1 -1
  39. package/dist/adapter/ingest/scene-capture.js +101 -24
  40. package/dist/adapter/ingest/visible-capture-window.d.ts +22 -5
  41. package/dist/adapter/ingest/visible-capture-window.d.ts.map +1 -1
  42. package/dist/adapter/ingest/visible-capture-window.js +46 -7
  43. package/dist/adapter/native-debug-module.d.ts +43 -0
  44. package/dist/adapter/native-debug-module.d.ts.map +1 -0
  45. package/dist/adapter/native-debug-module.js +230 -0
  46. package/dist/adapter/object3d-authoring-subject.d.ts +32 -0
  47. package/dist/adapter/object3d-authoring-subject.d.ts.map +1 -0
  48. package/dist/adapter/object3d-authoring-subject.js +25 -0
  49. package/dist/adapter/root-adapter.d.ts +21 -56
  50. package/dist/adapter/root-adapter.d.ts.map +1 -1
  51. package/dist/adapter/root-adapter.js +4 -20
  52. package/dist/adapter/root-seam-contract.d.ts +124 -0
  53. package/dist/adapter/root-seam-contract.d.ts.map +1 -0
  54. package/dist/adapter/root-seam-contract.js +36 -0
  55. package/dist/adapter/seam-evidence.d.ts +118 -0
  56. package/dist/adapter/seam-evidence.d.ts.map +1 -0
  57. package/dist/adapter/seam-evidence.js +231 -0
  58. package/dist/adapter/setup-three-root-adapter.d.ts +2 -3
  59. package/dist/adapter/setup-three-root-adapter.d.ts.map +1 -1
  60. package/dist/adapter/setup-three-root-adapter.js +2 -3
  61. package/dist/adapter/system-adapter.d.ts +6 -1
  62. package/dist/adapter/system-adapter.d.ts.map +1 -1
  63. package/dist/adapter/system-seam-contract.d.ts +354 -0
  64. package/dist/adapter/system-seam-contract.d.ts.map +1 -0
  65. package/dist/adapter/system-seam-contract.js +95 -0
  66. package/dist/animation/xstate-animation-binding.d.ts +6 -0
  67. package/dist/animation/xstate-animation-binding.d.ts.map +1 -1
  68. package/dist/animation/xstate-animation-binding.js +142 -4
  69. package/dist/asset-formats/collider.d.ts +1 -1
  70. package/dist/asset-formats/mesh.d.ts +2 -2
  71. package/dist/asset-formats/particles.d.ts +1 -1
  72. package/dist/canvas-react/engine-bridge.d.ts +6 -6
  73. package/dist/canvas-react/engine-bridge.d.ts.map +1 -1
  74. package/dist/canvas-react/engine-bridge.js +2 -2
  75. package/dist/canvas-react/index.d.ts +2 -2
  76. package/dist/canvas-react/index.d.ts.map +1 -1
  77. package/dist/canvas-react/index.js +1 -1
  78. package/dist/canvas-react/pixi-react-adapter.d.ts +15 -9
  79. package/dist/canvas-react/pixi-react-adapter.d.ts.map +1 -1
  80. package/dist/canvas-react/pixi-react-adapter.js +43 -29
  81. package/dist/canvas-react/pixi-react-root-factory.d.ts.map +1 -1
  82. package/dist/canvas-react/pixi-react-root-factory.js +4 -0
  83. package/dist/canvas-react/world-context.d.ts +22 -12
  84. package/dist/canvas-react/world-context.d.ts.map +1 -1
  85. package/dist/canvas-react/world-context.js +12 -51
  86. package/dist/ecs/user-data.d.ts +5 -0
  87. package/dist/ecs/user-data.d.ts.map +1 -1
  88. package/dist/ecs/user-data.js +3 -0
  89. package/dist/input/input-manager.d.ts +49 -0
  90. package/dist/input/input-manager.d.ts.map +1 -1
  91. package/dist/input/input-manager.js +127 -0
  92. package/dist/manifest/schema.d.ts +9 -9
  93. package/dist/manifest/schema.js +1 -1
  94. package/dist/pixi/authoring.d.ts.map +1 -1
  95. package/dist/pixi/authoring.js +220 -1
  96. package/dist/pixi/ingest.d.ts +2 -1
  97. package/dist/pixi/ingest.d.ts.map +1 -1
  98. package/dist/pixi/ingest.js +4 -2
  99. package/dist/pixi/scene-capture.d.ts +9 -1
  100. package/dist/pixi/scene-capture.d.ts.map +1 -1
  101. package/dist/pixi/scene-capture.js +9 -6
  102. package/dist/render/particles-factory.d.ts +13 -6
  103. package/dist/render/particles-factory.d.ts.map +1 -1
  104. package/dist/render/particles-factory.js +6 -3
  105. package/dist/runtime/create-runtime.d.ts +23 -46
  106. package/dist/runtime/create-runtime.d.ts.map +1 -1
  107. package/dist/runtime/create-runtime.js +22 -67
  108. package/dist/runtime/game.d.ts +29 -71
  109. package/dist/runtime/game.d.ts.map +1 -1
  110. package/dist/runtime/game.js +15 -54
  111. package/dist/runtime/mount-game.d.ts.map +1 -1
  112. package/dist/runtime/mount-game.js +12 -1
  113. package/dist/runtime/mount-manifest.d.ts.map +1 -1
  114. package/dist/runtime/mount-manifest.js +4 -5
  115. package/dist/runtime/types.d.ts +18 -0
  116. package/dist/runtime/types.d.ts.map +1 -1
  117. package/dist/setup/setup-renderer.d.ts +3 -4
  118. package/dist/setup/setup-renderer.d.ts.map +1 -1
  119. package/dist/setup/setup-renderer.js +3 -4
  120. package/dist/world3d-react/engine-bridge.d.ts +1 -1
  121. package/dist/world3d-react/engine-bridge.js +1 -1
  122. package/dist/world3d-react/r3f-adapter.d.ts +7 -0
  123. package/dist/world3d-react/r3f-adapter.d.ts.map +1 -1
  124. package/dist/world3d-react/r3f-adapter.js +50 -21
  125. package/dist/world3d-react/r3f-root-factory.d.ts.map +1 -1
  126. package/dist/world3d-react/r3f-root-factory.js +4 -0
  127. package/dist/world3d-react/world-context.d.ts +9 -3
  128. package/dist/world3d-react/world-context.d.ts.map +1 -1
  129. package/dist/world3d-react/world-context.js +5 -18
  130. package/package.json +1 -1
  131. package/schemas/engine-capabilities.json +8 -8
  132. package/schemas/vgai-project.schema.json +1 -1
  133. package/src/adapter/adapter-module.ts +407 -50
  134. package/src/adapter/authoring-seam-contract.ts +211 -0
  135. package/src/adapter/authoring.ts +242 -50
  136. package/src/adapter/entrypoint-selection-source.ts +159 -0
  137. package/src/adapter/finders/scenes-from-entrypoint-selection.ts +159 -28
  138. package/src/adapter/first-party-systems.ts +17 -3
  139. package/src/adapter/index.ts +51 -1
  140. package/src/adapter/ingest/contract-system-adapters.ts +26 -30
  141. package/src/adapter/ingest/game-contract-seams.ts +85 -0
  142. package/src/adapter/ingest/game-contract.ts +9 -4
  143. package/src/adapter/ingest/merge-debug-adapters.ts +193 -0
  144. package/src/adapter/ingest/observation-debug-adapter.ts +158 -0
  145. package/src/adapter/ingest/scene-capture.ts +126 -23
  146. package/src/adapter/ingest/visible-capture-window.ts +63 -9
  147. package/src/adapter/native-debug-module.ts +307 -0
  148. package/src/adapter/object3d-authoring-subject.ts +50 -0
  149. package/src/adapter/root-adapter.ts +21 -56
  150. package/src/adapter/root-seam-contract.ts +56 -0
  151. package/src/adapter/seam-evidence.ts +336 -0
  152. package/src/adapter/setup-three-root-adapter.ts +4 -6
  153. package/src/adapter/system-adapter.ts +6 -1
  154. package/src/adapter/system-seam-contract.ts +121 -0
  155. package/src/animation/xstate-animation-binding.ts +151 -4
  156. package/src/canvas-react/engine-bridge.ts +6 -6
  157. package/src/canvas-react/index.ts +2 -1
  158. package/src/canvas-react/pixi-react-adapter.tsx +55 -34
  159. package/src/canvas-react/pixi-react-root-factory.tsx +4 -0
  160. package/src/canvas-react/world-context.ts +26 -101
  161. package/src/ecs/user-data.ts +5 -0
  162. package/src/input/input-manager.ts +122 -0
  163. package/src/manifest/schema.ts +1 -1
  164. package/src/pixi/authoring.ts +236 -1
  165. package/src/pixi/ingest.ts +9 -2
  166. package/src/pixi/scene-capture.ts +20 -5
  167. package/src/render/particles-factory.ts +16 -6
  168. package/src/runtime/create-runtime.ts +41 -106
  169. package/src/runtime/game.ts +41 -111
  170. package/src/runtime/mount-game.ts +19 -1
  171. package/src/runtime/mount-manifest.ts +4 -5
  172. package/src/runtime/types.ts +22 -0
  173. package/src/setup/setup-renderer.ts +3 -4
  174. package/src/world3d-react/engine-bridge.ts +1 -1
  175. package/src/world3d-react/r3f-adapter.tsx +64 -24
  176. package/src/world3d-react/r3f-root-factory.tsx +4 -0
  177. package/src/world3d-react/world-context.ts +11 -36
@@ -23,7 +23,7 @@ import { documentVisibilityClock, startVisibleCaptureWindow, } from '../adapter/
23
23
  * host's `pixi.js` namespace so a shared-instance game is trapped. Install once per
24
24
  * ingest session; `uninstall()` on teardown.
25
25
  */
26
- export function installSceneCapture2D(pixiNamespace) {
26
+ export function installSceneCapture2D(pixiNamespace, options = {}) {
27
27
  const PIXI = pixiNamespace;
28
28
  const proto = PIXI.Application.prototype;
29
29
  let captured = null;
@@ -38,9 +38,12 @@ export function installSceneCapture2D(pixiNamespace) {
38
38
  drawCount++;
39
39
  const stage = this['stage'];
40
40
  if (!captured && stage) {
41
- captured = { stage, renderer: this['renderer'], app: this };
42
- for (const resolve of waiters.splice(0))
43
- resolve(captured);
41
+ const candidate = { stage, renderer: this['renderer'], app: this };
42
+ if (options.accept?.(candidate) ?? true) {
43
+ captured = candidate;
44
+ for (const resolve of waiters.splice(0))
45
+ resolve(captured);
46
+ }
44
47
  }
45
48
  return realRender?.apply(this, args);
46
49
  },
@@ -76,8 +79,8 @@ export function installSceneCapture2D(pixiNamespace) {
76
79
  waiters.splice(i, 1);
77
80
  opts.onWait?.(null);
78
81
  reject(new Error(`pixi scene capture timed out after ${timeoutMs}ms of VISIBLE time ` +
79
- `(${Math.round(captureWindow.elapsedHiddenMs())}ms hidden, which is not counted — ` +
80
- 'a hidden tab cannot render) — the game never rendered, or it bundles its own ' +
82
+ `(${Math.round(captureWindow.elapsedHiddenMs())}ms browser-suspended, which is ` +
83
+ 'not counted because no frame can be presented) — the game never rendered, or it bundles its own ' +
81
84
  '(un-shared) copy of pixi.js.'));
82
85
  },
83
86
  });
@@ -7,7 +7,7 @@
7
7
  * The schema mirrors quarks' native JSON format, so most fields pass through
8
8
  * directly to quarks' fromJSON or constructor methods.
9
9
  */
10
- import { type EmitterShape } from 'quarks.core';
10
+ import { type ColorGenerator, type EmitterShape, type FunctionColorGenerator } from 'quarks.core';
11
11
  import * as THREE from 'three';
12
12
  import { type BatchedRenderer, ParticleSystem } from 'three.quarks';
13
13
  import type { ParticlesDescriptor } from '../asset-formats/particles';
@@ -26,9 +26,9 @@ export interface ParticleSystemResult {
26
26
  * This is how a caller with fidelity a plain descriptor cannot express reaches
27
27
  * the SAME factory instead of hand-building its own `new ParticleSystem(...)`:
28
28
  * a foreign-engine carry (e.g. Godot CPUParticles) supplies its own
29
- * `EmitterShape` and an instancing geometry here, and expresses everything
30
- * else — lifecycle, start values, emission, behaviors, material — as descriptor
31
- * JSON.
29
+ * `EmitterShape`, start-colour generator, and instancing geometry here, and
30
+ * expresses everything else — lifecycle, scalar start values, emission,
31
+ * behaviors, material — as descriptor JSON.
32
32
  */
33
33
  export interface ParticleSystemObjects {
34
34
  /**
@@ -37,6 +37,12 @@ export interface ParticleSystemObjects {
37
37
  * present it REPLACES `data.shape`.
38
38
  */
39
39
  shape?: EmitterShape;
40
+ /**
41
+ * A pre-built start-colour generator for a per-particle draw the descriptor's
42
+ * JSON generator vocabulary cannot express. When present it REPLACES
43
+ * `data.startColor`.
44
+ */
45
+ startColor?: ColorGenerator | FunctionColorGenerator;
40
46
  /**
41
47
  * The geometry instanced per particle in `RenderMode.Mesh`. A
42
48
  * `BufferGeometry` is not JSON-serializable, so `renderMode: 'mesh'` requires
@@ -57,8 +63,9 @@ export interface ParticleSystemObjects {
57
63
  * Create a three.quarks ParticleSystem from ParticlesDescriptor JSON data.
58
64
  *
59
65
  * `objects` carries the pieces a JSON descriptor cannot: a plugin emitter
60
- * shape, a mesh-mode instancing geometry, and the default-sprite toggle. It is
61
- * optional and additive — a call with only `data` behaves exactly as before.
66
+ * shape, a start-colour generator, a mesh-mode instancing geometry, and the
67
+ * default-sprite toggle. It is optional and additive — a call with only `data`
68
+ * behaves exactly as before.
62
69
  */
63
70
  export declare function createParticleSystemFromData(data: ParticlesDescriptor, objects?: ParticleSystemObjects): ParticleSystemResult;
64
71
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"particles-factory.d.ts","sourceRoot":"","sources":["../../src/render/particles-factory.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AAEH,OAAO,EAQL,KAAK,YAAY,EAmBlB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,eAAe,EAAE,cAAc,EAAc,MAAM,cAAc,CAAC;AAChF,OAAO,KAAK,EAIV,mBAAmB,EAEpB,MAAM,4BAA4B,CAAC;AA4RpC,MAAM,WAAW,oBAAoB;IACnC,wDAAwD;IACxD,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC;IACxB,kEAAkE;IAClE,MAAM,EAAE,cAAc,CAAC;CACxB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC;IAC1C;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;GAMG;AAEH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,mBAAmB,EACzB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,oBAAoB,CA6DtB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAsB9F;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,SAAS,GAAG,IAAI,CAU/F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,cAAc,GACrB,IAAI,CAGN;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,eAAe,EAChC,M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SAAS,GAAG,IAAI,CAU/F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,cAAc,GACrB,IAAI,CAGN;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,cAAc,GACrB,IAAI,CAGN;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,mBAAmB,CA6B1D"}
@@ -232,8 +232,9 @@ function getDefaultSpriteTex() {
232
232
  * Create a three.quarks ParticleSystem from ParticlesDescriptor JSON data.
233
233
  *
234
234
  * `objects` carries the pieces a JSON descriptor cannot: a plugin emitter
235
- * shape, a mesh-mode instancing geometry, and the default-sprite toggle. It is
236
- * optional and additive — a call with only `data` behaves exactly as before.
235
+ * shape, a start-colour generator, a mesh-mode instancing geometry, and the
236
+ * default-sprite toggle. It is optional and additive — a call with only `data`
237
+ * behaves exactly as before.
237
238
  */
238
239
  // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: straightforward field-by-field mapping
239
240
  export function createParticleSystemFromData(data, objects) {
@@ -269,7 +270,9 @@ export function createParticleSystemFromData(data, objects) {
269
270
  params['startSize'] = valueGen(data.startSize);
270
271
  if (data.startRotation)
271
272
  params['startRotation'] = valueGen(data.startRotation);
272
- if (data.startColor)
273
+ if (objects?.startColor)
274
+ params['startColor'] = objects.startColor;
275
+ else if (data.startColor)
273
276
  params['startColor'] = colorGen(data.startColor);
274
277
  if (data.startTileIndex)
275
278
  params['startTileIndex'] = valueGen(data.startTileIndex);
@@ -1,14 +1,11 @@
1
- import * as THREE from 'three';
2
1
  import type { DomHostContext } from '../adapter/host-context';
3
- import type { MountedPixiRoot, MountedReactRoot, MountedRoot, MountedThreeRoot, RootAdapter } from '../adapter/root-adapter';
2
+ import type { MountedPixiRoot, MountedReactRoot, MountedThreeRoot, RootAdapter } from '../adapter/root-adapter';
4
3
  import { type Game, type GameInternal, type RootInstance } from './game';
5
4
  import type { PlaytestContext } from './types';
6
5
  /**
7
6
  * Register a three world onto the Game shell. `opts.id` defaults to
8
- * `'main'` — the single-world callers (`createGameRuntime`, slice-1/2 tests)
9
- * are unaffected; a second/third world (T7.1 slice 3's two-world proof, and
10
- * real multi-world manifests later) pass an explicit id. This is the ONE
11
- * registration code path for a three world, whatever its id.
7
+ * `'main'`; multi-root callers pass an explicit id. This is the one
8
+ * registration path for a three world, whatever its id.
12
9
  */
13
10
  export declare function registerThreeRoot(game: GameInternal, adapter: RootAdapter, mounted: MountedThreeRoot, opts?: {
14
11
  id?: string | undefined;
@@ -26,13 +23,13 @@ export declare function registerPixiRoot(game: GameInternal, adapter: RootAdapte
26
23
  pausable?: boolean | undefined;
27
24
  }): RootInstance;
28
25
  /**
29
- * Register a react world onto the Game shell (T6.2 slice 1) — the react
26
+ * Register a React world onto the Game shell — the DOM
30
27
  * analog of {@link registerThreeRoot}/{@link registerPixiRoot}. A react
31
28
  * world has no `frame` hooks (react's own
32
29
  * `createRoot` schedules its commits; `GameInternal.runFrame` correctly
33
30
  * leaves a world with no `frame` untouched by its opaque-`update` fallback
34
31
  * too, since `MountedReactGame` declares no `update`). `adapter` is typed
35
- * as the real {@link ReactRootAdapter} shape (T7.5, same reasoning as
32
+ * as the real {@link ReactRootAdapter} shape (same reasoning as
36
33
  * `registerPixiRoot`'s doc comment above) — `RootInstance.adapter` only
37
34
  * needs `.id`, so this passes through with zero cast.
38
35
  */
@@ -41,12 +38,12 @@ export declare function registerReactRoot(game: GameInternal, adapter: RootAdapt
41
38
  pausable?: boolean | undefined;
42
39
  }): RootInstance;
43
40
  /**
44
- * One world to mount in the {@link RootsRuntimeConfig} roots path (T6.1
45
- * slice 1) — the host-facing mirror of `manifest/load.ts`'s
46
- * `ResolvedAdapterRoot` (same `id`/`zOrder`/`pausable`/`loop` fields; the
41
+ * One world to mount in the universal host the host-facing mirror of
42
+ * `manifest/load.ts`'s `ResolvedAdapterRoot` (same identity and presentation
43
+ * fields; the
47
44
  * manifest-to-host translation itself is the editor's job, not this file's).
48
45
  *
49
- * `react` (T6.2 slice 1) mounts as a DOM-root layer `<div>` in the SAME
46
+ * A `dom` root mounts as a DOM layer `<div>` in the same
50
47
  * stack instead of a canvas — see {@link ReactRootMountSpec}/{@link
51
48
  * ReactRootAdapter} below.
52
49
  */
@@ -75,12 +72,6 @@ export interface RootMountSpecBase {
75
72
  * never sees DOM roots at all.
76
73
  */
77
74
  readonly dev?: boolean | undefined;
78
- /** `'gated'` (host-driven, default) or `'self-driven'` (this world drives
79
- * its own loop — D5's "composited, unsynchronized" tier). Carried through
80
- * for parity with `ResolvedAdapterRoot`; T6.1 slice 1 does not yet
81
- * validate it against the mounted adapter's actual `drivesOwnLoop` (that
82
- * cross-check, if ever needed, is T7.6's loop-gate surface). */
83
- readonly loop?: 'gated' | 'self-driven' | undefined;
84
75
  /**
85
76
  * Optional claim predicate for the delegating input router (D5 §2a), over
86
77
  * a point RELATIVE TO THE CONTAINER. Absent means: this world claims only
@@ -103,8 +94,8 @@ export interface PixiRootMountSpec extends RootMountSpecBase {
103
94
  readonly adapter: RootAdapter<'canvas'>;
104
95
  }
105
96
  /**
106
- * A live, mounted react world (T6.2 slice 1) — the react analog of a mounted
107
- * canvas world. React roots render from game state via the T7.4 bridge
97
+ * A live, mounted React world — the DOM analog of a mounted canvas world.
98
+ * React roots render from game state
108
99
  * instead of a per-frame `update`, so this shape carries no `update`/`fixedUpdate`/
109
100
  * `ctx`/`frame` — `drivesOwnLoop` is always `false` (react's `createRoot`
110
101
  * schedules its OWN commits; the host's fixed-step loop never drives it,
@@ -121,10 +112,10 @@ export interface PixiRootMountSpec extends RootMountSpecBase {
121
112
  * `kind: 'dom'` (§7.1-15): a react world has no `observe` BY DESIGN — that
122
113
  * hook is scoped to `useRootObservation` (the ingested/foreign-world case),
123
114
  * not `useWorldState` (`ui/game-state.tsx`), which a react world's own
124
- * mounted tree uses instead — it reads `Game.state` directly (T7.4's actual
125
- * bridge for first-party-observable state), never a per-world `observe`.
115
+ * mounted tree uses instead — it reads `Game.state` directly, never a
116
+ * per-world `observe`.
126
117
  *
127
- * `kind`/`container` (T7.5) satisfy `MountedReactRoot` (`adapter/
118
+ * `kind`/`container` satisfy `MountedReactRoot` (`adapter/
128
119
  * root-adapter.ts`) — `container` is the SAME `DomHostContext.container` the
129
120
  * adapter's `mount` was handed (identity matters, mirroring `threeScene()`/
130
121
  * `pixiStage()`'s "same instance the adapter mounted" contract); every
@@ -139,7 +130,7 @@ export interface MountedReactGame extends MountedReactRoot {
139
130
  * A react-shaped adapter — the structural contract `RootMountSpec`'s
140
131
  * `react` variant requires. Deliberately
141
132
  * NOT tied to a concrete implementer here so an editor-resolved adapter (the
142
- * `default-react` resolver branch, T6.2's editor-side follow-up) can satisfy
133
+ * `default-react` resolver branch) can satisfy
143
134
  * this shape without this file importing react-dom or any editor code.
144
135
  *
145
136
  * A genuine `RootAdapter<'dom'>` refinement (`HostContextFor<'dom'>` =
@@ -227,37 +218,23 @@ export interface RootsRuntimeConfig {
227
218
  *
228
219
  * This is the GENERIC host handle — it has no first-party concepts (no
229
220
  * `GameContext`, no `GameSetupFn`). First-party features (the live `GameContext`,
230
- * warm-restart hot reload) are reached by casting `mounted` to `MountedSetupThreeRoot`
221
+ * warm-restart hot reload) are reached through `game.defaultRoot.mounted`
222
+ * and narrowed to `MountedSetupThreeRoot`
231
223
  * (the editor does this for HMR/physics-sync — those are inherently first-party).
232
224
  *
233
- * `scene`/`camera`/`mounted` alias the Game's `defaultRoot`: it is the first
234
- * three root (else the first
235
- * world) by DECLARATION order, per `Game.defaultRoot`'s existing rule —
236
- * independent of `zOrder`/canvas stacking, which is a rendering-only concern.
225
+ * Root access is explicit through `game.roots`, `game.world(id)`, and
226
+ * `game.defaultRoot`; the session does not project a surface-specific alias.
237
227
  */
238
228
  export interface GameSession {
239
229
  stop(): void;
240
230
  pause(): void;
241
231
  resume(): void;
242
232
  step(): void;
243
- /** Resize every world's render buffer. `pixelRatio` (W2c device preview)
244
- * optionally re-pins the three renderers' DPR in the same pass; omitted,
245
- * the mount-time ratio is left untouched (legacy behavior). */
233
+ /** Resize every world's render buffer. `pixelRatio` optionally re-pins the
234
+ * three renderers' DPR in the same pass. */
246
235
  resize(width: number, height: number, pixelRatio?: number): void;
247
- readonly scene: THREE.Scene;
248
- readonly camera: THREE.PerspectiveCamera;
249
- /** The default world's mounted root, as the honest `MountedRoot` union —
250
- * narrow on `.kind` before reaching for a surface's own members (the same
251
- * discriminant `scene`/`camera` above use). This deliberately does NOT
252
- * claim `MountedThreeRoot`: a roots-path session whose default world is
253
- * canvas or dom returns that world's mount, and the old
254
- * `as MountedThreeRoot` cast made every such value a type-level lie. For a
255
- * first-party three mount, narrow to `'three'` and cast to
256
- * `MountedSetupThreeRoot` for the first-party extras. */
257
- readonly mounted: MountedRoot;
258
- /** The Game root (T6.1 slice 1) — the multi-world entry point
259
- * (`game.roots`/`game.world(id)`/`game.queryByComponent`) for callers
260
- * that need more than the default-world aliases above. */
236
+ /** The multi-root entry point. Root access stays explicit through
237
+ * `game.roots`, `game.world(id)`, and `game.defaultRoot`. */
261
238
  readonly game: Game;
262
239
  }
263
240
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"create-runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/create-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAqB,cAAc,EAAoB,MAAM,yBAAyB,CAAC;AACnG,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,WAAW,EACZ,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EAGL,KAAK,IAAI,EACT,KAAK,YAAY,EAEjB,KAAK,YAAY,EAClB,MAAM,QAAQ,CAAC;AAGhB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AA2B/C;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,I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AAI,EAAE,IAAI,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAExF"}
@@ -14,12 +14,11 @@ import { installRenderControlHarness, isRenderModeRequested } from './render-con
14
14
  * by `createGameRuntime` and every headless test harness
15
15
  * (`test/game-root.test.ts`, `test/frame-order.test.ts`,
16
16
  * `test/game-two-roots.test.ts`) so there is exactly one code path for this
17
- * wiring (T7.1 slice 1, id-generalized in slice 3 for the two-world proof — stage
18
- * 3) — `physics`/`collisions`/`camera`/ `frame` are populated from the mount's
17
+ * wiring. `physics`/`collisions`/`camera`/`frame` are populated from the mount's
19
18
  * first-party `GameContext`/ `MountedSetupThreeRoot` when available, left
20
19
  * `undefined` otherwise (an external adapter's mount has none of these
21
20
  * first-party handles — `frame` in particular is what makes
22
- * `GameInternal.runFrame` (T7.1 slice 2) fall back to a single opaque
21
+ * `GameInternal.runFrame` fall back to a single opaque
23
22
  * `mounted.update` call per substep for such a world).
24
23
  */
25
24
  function firstPartyExtras(mounted) {
@@ -34,10 +33,8 @@ function firstPartyExtras(mounted) {
34
33
  }
35
34
  /**
36
35
  * Register a three world onto the Game shell. `opts.id` defaults to
37
- * `'main'` — the single-world callers (`createGameRuntime`, slice-1/2 tests)
38
- * are unaffected; a second/third world (T7.1 slice 3's two-world proof, and
39
- * real multi-world manifests later) pass an explicit id. This is the ONE
40
- * registration code path for a three world, whatever its id.
36
+ * `'main'`; multi-root callers pass an explicit id. This is the one
37
+ * registration path for a three world, whatever its id.
41
38
  */
42
39
  export function registerThreeRoot(game, adapter, mounted, opts) {
43
40
  const world = createRootInstance({
@@ -73,13 +70,13 @@ export function registerPixiRoot(game, adapter, mounted, opts) {
73
70
  return world;
74
71
  }
75
72
  /**
76
- * Register a react world onto the Game shell (T6.2 slice 1) — the react
73
+ * Register a React world onto the Game shell — the DOM
77
74
  * analog of {@link registerThreeRoot}/{@link registerPixiRoot}. A react
78
75
  * world has no `frame` hooks (react's own
79
76
  * `createRoot` schedules its commits; `GameInternal.runFrame` correctly
80
77
  * leaves a world with no `frame` untouched by its opaque-`update` fallback
81
78
  * too, since `MountedReactGame` declares no `update`). `adapter` is typed
82
- * as the real {@link ReactRootAdapter} shape (T7.5, same reasoning as
79
+ * as the real {@link ReactRootAdapter} shape (same reasoning as
83
80
  * `registerPixiRoot`'s doc comment above) — `RootInstance.adapter` only
84
81
  * needs `.id`, so this passes through with zero cast.
85
82
  */
@@ -106,7 +103,7 @@ export async function createGameRuntime(config) {
106
103
  return createRootsGameRuntime(config);
107
104
  }
108
105
  // ---------------------------------------------------------------------------
109
- // Worlds path (T6.1 slice 1)
106
+ // Universal root host
110
107
  // ---------------------------------------------------------------------------
111
108
  /** A stand-in `THREE.WebGLRenderer` for headless (`headless:true`) three
112
109
  * roots — mirrors `SetupThreeRootAdapter.mount`'s own `headlessComposer`
@@ -162,11 +159,8 @@ async function mountOneThreeRoot(spec, ctx) {
162
159
  // resize-staleness (the roots-path `resize()` below always calls
163
160
  // `setSize(rw, rh, false)`, so nothing else was ever going to update this
164
161
  // canvas' CSS after mount). `createHostRenderer`'s own default
165
- // (`updateStyle:true`) is intentionally left alone the LEGACY
166
- // single-canvas path (editor play-mode's non-multi-world branch) still
167
- // relies on that construction-time stamp + its own later `updateStyle:true`
168
- // resizes for byte-identical behavior; this fix touches only the
169
- // roots-path canvas, after the fact.
162
+ // (`updateStyle:true`) is intentionally left alone; the host owns CSS layout
163
+ // and reasserts the container-relative size after renderer construction.
170
164
  canvas.style.width = '100%';
171
165
  canvas.style.height = '100%';
172
166
  renderer.setPixelRatio(dpr);
@@ -239,7 +233,7 @@ async function mountOnePixiRoot(spec, ctx) {
239
233
  };
240
234
  }
241
235
  /**
242
- * Mount one react `RootMountSpec` (T6.2 slice 1) — the react sibling of
236
+ * Mount one React `RootMountSpec` — the DOM sibling of
243
237
  * `mountOneThreeRoot`/`mountOnePixiRoot`. Unlike its canvas-backed siblings
244
238
  * this returns NO `routerEntry`: a react world's DOM-root layer participates in
245
239
  * D5's z-order/box stacking (the caller still creates and positions its `<div>`
@@ -269,7 +263,7 @@ layer) {
269
263
  // An absolutely-positioned layer with no width/height collapses to zero
270
264
  // content size, so a child's
271
265
  // own position:absolute offsets resolve against a degenerate containing
272
- // block (found by the T6.2 slice-3 e2e — clicks landed outside the game).
266
+ // block; otherwise clicks land outside the game.
273
267
  layer.style.width = '100%';
274
268
  layer.style.height = '100%';
275
269
  const reactHost = { container: layer, game };
@@ -289,8 +283,8 @@ layer) {
289
283
  };
290
284
  }
291
285
  /**
292
- * The roots-path implementer behind {@link createGameRuntime} (T6.1 slice
293
- * 1; react roots added T6.2 slice 1). Builds ONE surface per world — a
286
+ * The universal host implementer behind {@link createGameRuntime}. It builds
287
+ * one surface per world — a
294
288
  * canvas for three/canvas, a DOM-root `<div>` layer for react — stacked
295
289
  * per D5 §1, z-order/ties exactly matching
296
290
  * `manifest/load.ts`'s sort, ONE `Game`, and registers every world onto it
@@ -303,16 +297,11 @@ layer) {
303
297
  */
304
298
  /**
305
299
  * Dev/e2e-only `window.__vgaiScene`/`__vgaiCamera` exposure for the roots
306
- * path's DEFAULT world (E4) — split out of `createRootsGameRuntime` purely
307
- * to keep that function's own cyclomatic complexity down. Mirrors the
308
- * legacy single-world path's identical exposure (above, in this same file),
309
- * using the SAME "first three world, else none" default-world rule the
310
- * `GameSession.scene`/`.camera` getters alias (`Game.defaultRoot`): a
311
- * non-threejs default world (or none at all) publishes neither global,
312
- * exactly like those getters return `undefined` in that case. Returns a
313
- * retraction callback — identity-guarded (a newer session's globals must
314
- * never be clobbered by an older session's stop, same reason the legacy
315
- * path's own cleanup guards it) — that is a no-op when nothing was
300
+ * path's default world — split out of `createRootsGameRuntime` purely
301
+ * to keep that function's own cyclomatic complexity down. It uses the
302
+ * "first three world, else none" rule: a non-Three default world publishes
303
+ * neither global. Returns an identity-guarded retraction callback so an
304
+ * older session's stop cannot clobber a newer session's globals. It is a no-op when nothing was
316
305
  * published (non-DEV build, or non-threejs default world).
317
306
  */
318
307
  function installDefaultRootDevGlobals(game) {
@@ -451,8 +440,7 @@ async function createRootsGameRuntime(config) {
451
440
  // --- Surface stack (D5 §1): DOM/z-order follows zOrder, ties -> array order
452
441
  // — computed FIRST (bottom -> top) so both the z-index assignment below and
453
442
  // the router's default-claim rule share one definition. A react world's
454
- // DOM-root layer shares this SAME stacking pass (T6.2 slice 1 "one
455
- // stacking model, no special case") even though it is a `<div>`, not a
443
+ // DOM-root layer shares this SAME stacking pass even though it is a `<div>`, not a
456
444
  // canvas, and carries no `hitTest` (the router never sees react entries at
457
445
  // all — see the dispatch loop below). ---
458
446
  // Dev layers sit TOPMOST, above every non-dev root, whatever zOrder either
@@ -509,7 +497,7 @@ async function createRootsGameRuntime(config) {
509
497
  // too (not just in `mountOneThreeRoot`) means every surface, whatever
510
498
  // kind, starts container-relative from its very first paint, before any
511
499
  // per-kind mount work has even run.
512
- // `contain:layout paint` makes each surface the CONTAINING BLOCK for
500
+ // `contain:layout paint` makes each surface the containing block for
513
501
  // `position:fixed` descendants (and clips overflow to the world's
514
502
  // rectangle): full-screen game UI written the natural way (`fixed;
515
503
  // inset:0`) then fills the WORLD, not the page. Without it, `fixed` UI
@@ -579,17 +567,7 @@ async function createRootsGameRuntime(config) {
579
567
  const router = createInputRouter(container, routerEntries);
580
568
  started = true;
581
569
  loop.start();
582
- // Expose scene & camera for dev tools / e2e tests — mirrors the legacy
583
- // single-world path's identical dev-only exposure above, generalized to
584
- // the roots path's DEFAULT world (E4): `mountGameFromManifest`/
585
- // `mountManifestRoots` route every caller (including a
586
- // single-threejs-world scaffold project) through THIS path, so a caller
587
- // migrating off the legacy `{canvas, adapter}` call must not silently
588
- // lose `window.__vgaiScene`/`__vgaiCamera` — real e2e/dev tooling
589
- // depends on them
590
- // (`packages/editor/e2e/tests/04-standalone-game.spec.ts`). Split into
591
- // its own top-level helper (with its retraction counterpart below)
592
- // purely to keep this function's own cyclomatic complexity down.
570
+ // Expose the default Three root's scene and camera for dev/e2e tooling.
593
571
  const retractDevGlobals = installDefaultRootDevGlobals(game);
594
572
  // G3/FT-11 — publish `window.__vgaiRender` for the deterministic capture
595
573
  // host. Installed at the TAIL of the mount (same position as
@@ -626,12 +604,7 @@ async function createRootsGameRuntime(config) {
626
604
  }
627
605
  return {
628
606
  stop: fullCleanup,
629
- // D10/T7.6: `Game.play` fans out per-world pausable/loop-gate/audio-gate
630
- // semantics itself now (see the legacy path's identical comment above) —
631
- // a `pausable: false` world (a menu/HUD world) keeps ticking while every
632
- // other world freezes, which the old blind `for (const entry of
633
- // mountedEntries) entry.mounted.setPaused?.(true)` fan-out (with no
634
- // `pausable` check at all) could never express.
607
+ // `Game.play` owns per-world pause, loop-gate, and audio-gate semantics.
635
608
  pause() {
636
609
  game.play.pause();
637
610
  },
@@ -655,24 +628,6 @@ async function createRootsGameRuntime(config) {
655
628
  entry.mounted.resize?.(safeWidth, safeHeight);
656
629
  }
657
630
  },
658
- // `GameSession.scene`/`.camera`/`.mounted` alias `Game.defaultRoot` (T6.1
659
- // slice 1's "first three world, else first world" rule) — a legacy
660
- // convenience shaped for the threejs-only past. T7.5 narrows the read via
661
- // the `kind` discriminant instead of a blind `.scene`/`.camera` cast
662
- // through a nonexistent property (identical behavior to before: still
663
- // `undefined` for a roots-path session whose default world isn't
664
- // three — real per-world surface routing for that case is T7.6's).
665
- get scene() {
666
- const m = game.defaultRoot.mounted;
667
- return (m.kind === 'three' ? m.scene : undefined);
668
- },
669
- get camera() {
670
- const m = game.defaultRoot.mounted;
671
- return (m.kind === 'three' ? m.camera : undefined);
672
- },
673
- get mounted() {
674
- return game.defaultRoot.mounted;
675
- },
676
631
  game,
677
632
  };
678
633
  }