@volter/editor-game 0.5.66 → 0.5.68

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 (239) hide show
  1. package/contributions/audio-unlock.service.ts +2 -2
  2. package/contributions/autoplay.service.ts +1 -1
  3. package/contributions/bridge.command.ts +3 -3
  4. package/contributions/build-player.document.tsx +95 -0
  5. package/contributions/canvas/component-board.service.ts +16 -0
  6. package/contributions/canvas/design-time-mount.service.ts +45 -0
  7. package/contributions/canvas-story-capture.service.ts +12 -0
  8. package/contributions/edit-mode-audio.service.ts +2 -2
  9. package/contributions/edit-mode-networking.service.ts +1 -1
  10. package/contributions/gameplay.command.ts +4 -4
  11. package/contributions/generation.service.ts +1 -1
  12. package/contributions/godot.style.ts +26 -6
  13. package/contributions/godot.view.ts +6 -0
  14. package/contributions/ingest.service.ts +2 -2
  15. package/contributions/instances.command.ts +1 -1
  16. package/contributions/navmesh.menu.ts +1 -1
  17. package/contributions/network-observer.service.ts +14 -0
  18. package/contributions/play.command.ts +10 -4
  19. package/contributions/react/component-board.service.ts +1 -1
  20. package/contributions/react/design-time-mount.service.ts +1 -1
  21. package/contributions/scene-document.service.ts +3 -3
  22. package/contributions/state-watch.menu.ts +1 -1
  23. package/contributions/state-watch.utility.tsx +1 -1
  24. package/contributions/team-playtest.service.ts +4 -4
  25. package/contributions/three/component-board.service.ts +1 -1
  26. package/contributions/three/component-verbs.command.ts +6 -6
  27. package/contributions/three/three-authoring.service.ts +8 -5
  28. package/contributions/three-story-capture.service.ts +12 -0
  29. package/contributions/unity.style.ts +17 -7
  30. package/contributions/unity.view.ts +6 -0
  31. package/contributions/unreal.style.ts +10 -2
  32. package/contributions/unreal.view.ts +5 -0
  33. package/package.json +21 -10
  34. package/src/asset-budget/AssetBudgetPanel.tsx +1 -1
  35. package/src/asset-budget/asset-budget-model.ts +1 -1
  36. package/src/audio/AudioDebuggerPanel.tsx +1 -1
  37. package/src/bridge/dispatch.ts +14 -14
  38. package/src/bridge/live-frames.ts +1 -1
  39. package/src/bridge/screenshot.ts +3 -3
  40. package/src/build/BuildProfilesPanel.tsx +14 -3
  41. package/src/build/build-session.ts +35 -0
  42. package/src/canvas/canvas-board/CanvasBoardDocument.tsx +749 -0
  43. package/src/canvas/canvas-board/canvas-board-model.ts +407 -0
  44. package/src/canvas/canvas-board/canvas-component-board.ts +56 -0
  45. package/src/canvas/canvas-design-mount.ts +524 -0
  46. package/src/canvas/design-time-canvas-mount.ts +79 -0
  47. package/src/coverage/live-authoring-surface.ts +5 -5
  48. package/src/coverage/live-project-verbs.ts +1 -1
  49. package/src/coverage/native-system-coverage.ts +5 -5
  50. package/src/coverage/root-coverage.ts +1 -1
  51. package/src/coverage/session-coverage.ts +3 -3
  52. package/src/design-system-stories/ApplicationChrome.stories.tsx +5 -5
  53. package/src/design-system-stories/InspectorNarrowBodies.stories.tsx +7 -7
  54. package/src/edit-mode/edit-mode-audio.ts +4 -4
  55. package/src/edit-mode/edit-mode-networking.ts +2 -2
  56. package/src/game-document/GameCaptureFrameButton.tsx +1 -1
  57. package/src/game-document/GameDocument.tsx +2 -2
  58. package/src/game-document/GamePanel.tsx +4 -4
  59. package/src/game-document/InstanceInspectorPicker.tsx +2 -2
  60. package/src/game-document/crowd-debug.ts +1 -1
  61. package/src/game-document/device-preview.ts +10 -11
  62. package/src/game-document/physics-debug.ts +1 -1
  63. package/src/generation/GenerationActivity.tsx +3 -3
  64. package/src/generation/generation-documents.tsx +5 -5
  65. package/src/generation/generation-jobs.ts +1 -1
  66. package/src/host/adapter-runtime-bindings.ts +96 -5
  67. package/src/host/authoring/babylon-authoring-adapter.ts +6 -6
  68. package/src/host/authoring/gesture-persist.ts +1 -1
  69. package/src/host/authoring/ingest-data-writer.ts +1 -1
  70. package/src/host/authoring/ingest-source-persistence.ts +4 -4
  71. package/src/host/authoring/mounted-authoring.ts +4 -4
  72. package/src/host/authoring/phaser-live-authoring-adapter.ts +4 -4
  73. package/src/host/authoring/pixi-authoring-adapter.ts +178 -31
  74. package/src/host/authoring/pixi-creatable-kinds.ts +62 -0
  75. package/src/host/authoring/pixi-creation-site-write-target.ts +2 -2
  76. package/src/host/authoring/pixi-live-write-target.ts +4 -4
  77. package/src/host/authoring/pixi-source-identity.ts +3 -3
  78. package/src/host/authoring/pixi-source-write-target.ts +1709 -0
  79. package/src/host/authoring/pixi-still-presentation.ts +1 -1
  80. package/src/host/authoring/pixi-structure-history.ts +2 -2
  81. package/src/host/authoring/pixi-transform-channels.ts +16 -14
  82. package/src/host/authoring/source-persistence-backend.ts +3 -3
  83. package/src/host/authoring/struct-write-pipe.ts +1 -1
  84. package/src/host/binding-resolver.ts +8 -9
  85. package/src/host/browser-transpile.ts +1 -1
  86. package/src/host/canvas-entry-runtime.ts +58 -47
  87. package/src/host/canvas-preview-frames.ts +482 -0
  88. package/src/host/components/CameraAuthoringOverlay.tsx +1 -1
  89. package/src/host/components/HeaderTelemetry.tsx +4 -4
  90. package/src/host/components/PixiIsolationSceneContent.tsx +11 -11
  91. package/src/host/components/ThreeIsolationSceneContent.tsx +3 -3
  92. package/src/host/components/frame-debugger-model.ts +2 -2
  93. package/src/host/components/header-telemetry-model.ts +2 -2
  94. package/src/host/components/scene-document.tsx +14 -14
  95. package/src/host/components/utility-view-state.ts +1 -1
  96. package/src/host/components/world-root-stage-binding.tsx +12 -12
  97. package/src/host/components/world-root-stage.ts +70 -49
  98. package/src/host/coverage/system-adapter-coverage.ts +3 -4
  99. package/src/host/design-system-stories/fixtures/editor-runtime.tsx +9 -11
  100. package/src/host/document-preview-three.ts +1 -1
  101. package/src/host/entry-adjudication.ts +6 -6
  102. package/src/host/game-css-scope-transform.ts +4 -0
  103. package/src/host/game-realm-page.ts +1 -1
  104. package/src/host/gameplay-export.ts +25 -14
  105. package/src/host/gameplay-recording.ts +5 -5
  106. package/src/host/gated-globals.ts +2 -2
  107. package/src/host/history/json-history-resource.ts +1 -1
  108. package/src/host/projection/pixi.ts +24 -2
  109. package/src/host/r3f-entry-runtime.ts +65 -34
  110. package/src/host/react-mount-runtime.ts +7 -48
  111. package/src/host/realm-services.ts +1 -1
  112. package/src/host/roots/canvas-root.tsx +373 -0
  113. package/src/host/roots/r3f-root.tsx +473 -0
  114. package/src/host/roots/react-root.ts +9 -43
  115. package/src/host/served-bundle-runtime-modules.ts +3 -19
  116. package/src/host/server-log-bridge.ts +2 -2
  117. package/src/host/stories/mounted-story-viewport-source.ts +1 -1
  118. package/src/host/stories/pixi-story-model.ts +30 -0
  119. package/src/host/stories/story-media-captures.ts +46 -0
  120. package/src/host/stories/story-media-presence.ts +3 -3
  121. package/src/host/stories/story-pixi-preview.ts +408 -0
  122. package/src/host/stories/story-three-preview.ts +806 -0
  123. package/src/host/stories/three-story-captures.ts +35 -0
  124. package/src/host/story-three-preview-runtime.ts +56 -0
  125. package/src/host/use-active-performance-source.ts +2 -2
  126. package/src/host/viewport-pose-memory.ts +1 -1
  127. package/src/host/viewport-root-presentation.ts +6 -5
  128. package/src/ingest/active-ingest.ts +1 -1
  129. package/src/ingest/authoring/ingest-dom-surface-authoring.ts +4 -4
  130. package/src/ingest/authoring/ingest-root-adapter.ts +8 -8
  131. package/src/ingest/deferred-ingest-play.ts +6 -6
  132. package/src/ingest/discovery-public-ingest.ts +2 -2
  133. package/src/ingest/ingest-boot-viewport.ts +2 -2
  134. package/src/ingest/ingest-canvas-scene-document.tsx +9 -9
  135. package/src/ingest/ingest-canvas-scene.ts +3 -3
  136. package/src/ingest/ingest-evidence-hook.ts +1 -1
  137. package/src/ingest/ingest-frame-snapshot.ts +1 -1
  138. package/src/ingest/ingest-play-control.ts +1 -1
  139. package/src/ingest/ingest-render-debug.ts +10 -10
  140. package/src/ingest/ingest-siblings.ts +13 -25
  141. package/src/ingest/module-mode.ts +14 -14
  142. package/src/ingest/mount-canvas-ingest-root.ts +21 -21
  143. package/src/ingest/mount-coverage.ts +2 -2
  144. package/src/ingest/mount-dom-ingest-root.ts +11 -11
  145. package/src/ingest/mount-ingest-root.ts +8 -8
  146. package/src/ingest/mount-three-ingest-root.ts +8 -8
  147. package/src/ingest/resolve-canvas.ts +1 -1
  148. package/src/ingest/served-html-boot.ts +1 -1
  149. package/src/ingest/surface-canvas.ts +1 -1
  150. package/src/ingest/unmount-ingest-root.ts +5 -5
  151. package/src/navmesh/navmesh-handler.ts +24 -16
  152. package/src/network/NetworkInspectorPanel.tsx +939 -37
  153. package/src/network/network-inspector-model.ts +20 -2
  154. package/src/play/play-log-events.ts +1 -1
  155. package/src/play/play-mode.ts +76 -133
  156. package/src/play/play-recording.ts +1 -1
  157. package/src/play/react-play-live-authoring.ts +3 -3
  158. package/src/play/run-selection.ts +93 -0
  159. package/src/play-bar/PlayBar.tsx +20 -39
  160. package/src/profiler/FrameDebuggerPanel.tsx +1 -1
  161. package/src/profiler/PerformancePanel.tsx +3 -3
  162. package/src/react/design-time-react-mount.ts +23 -65
  163. package/src/react/dom-authoring-adapter.ts +9 -9
  164. package/src/react/react-inspector-section.tsx +5 -5
  165. package/src/react/react-world-authoring-adapter.ts +11 -11
  166. package/src/react/story-documents/story-documents.tsx +9 -9
  167. package/src/react/ui-board-document.tsx +7 -7
  168. package/src/react/ui-component-board.ts +2 -2
  169. package/src/runtime/adapter/audio-meter.ts +21 -0
  170. package/src/runtime/adapter/first-party-audio-system.ts +230 -0
  171. package/src/runtime/adapter/ingest/contract-debug-adapter.ts +114 -0
  172. package/src/runtime/adapter/ingest/contract-system-adapters.ts +256 -0
  173. package/src/runtime/adapter/ingest/merge-debug-adapters.ts +197 -0
  174. package/src/runtime/adapter/ingest/observation-debug-adapter.ts +162 -0
  175. package/src/runtime/adapter/ingest/upstream-pin.ts +51 -0
  176. package/src/runtime/adapter/native-debug-module.ts +498 -0
  177. package/src/runtime/audio/bus-mixer.ts +161 -0
  178. package/src/runtime/audio/pose-guard.ts +80 -0
  179. package/src/runtime/core/frame-pacing.ts +126 -0
  180. package/src/runtime/core/game-loop.ts +225 -0
  181. package/src/runtime/core/game-scoped-slot.ts +28 -0
  182. package/src/runtime/core/seeded-random.ts +162 -0
  183. package/src/runtime/core/sim-clock.ts +391 -0
  184. package/src/runtime/core/system-runner.ts +269 -0
  185. package/src/runtime/core/types.ts +104 -0
  186. package/src/runtime/create-runtime.ts +1128 -0
  187. package/src/runtime/debug-bridge.ts +570 -0
  188. package/src/runtime/debug-registry.ts +899 -0
  189. package/src/runtime/dev/chrome-trace.ts +153 -0
  190. package/src/runtime/dev/instruments.ts +403 -0
  191. package/src/runtime/dev/logger.ts +119 -0
  192. package/src/runtime/dev/performance-profiler.ts +367 -0
  193. package/src/runtime/dev/register-render-vitals.ts +276 -0
  194. package/src/runtime/dev/render-census.ts +354 -0
  195. package/src/runtime/dev/render-debug-adapter.ts +218 -0
  196. package/src/runtime/dev/render-memory.ts +226 -0
  197. package/src/runtime/dev/render-vitals.ts +338 -0
  198. package/src/runtime/dev/static-batch-advisor.ts +188 -0
  199. package/src/runtime/dev/webgl-frame-capture.ts +366 -0
  200. package/src/runtime/dev/webgl-gpu-timer.ts +53 -0
  201. package/src/runtime/dev-build.ts +47 -0
  202. package/src/runtime/game.ts +1636 -0
  203. package/src/runtime/gameplay-rng-trap.ts +135 -0
  204. package/src/runtime/host-context.ts +64 -0
  205. package/src/runtime/input-router.ts +182 -0
  206. package/src/runtime/mount-manifest.ts +480 -0
  207. package/src/runtime/pixi/authoring.ts +706 -0
  208. package/src/runtime/pixi/ingest.ts +116 -0
  209. package/src/runtime/pixi/physics-registry.ts +49 -0
  210. package/src/runtime/pixi/render-pass-bracket.ts +117 -0
  211. package/src/runtime/pixi/scene-capture.ts +179 -0
  212. package/src/runtime/pixi/system-adapters.ts +69 -0
  213. package/src/runtime/playtest.ts +22 -0
  214. package/src/runtime/presentation.ts +141 -0
  215. package/src/runtime/render-control.ts +642 -0
  216. package/src/runtime/render-seed.ts +77 -0
  217. package/src/runtime/run-ticks-settled.ts +73 -0
  218. package/src/runtime/setup/setup-audio.ts +72 -0
  219. package/src/services/audio-pose-guard.ts +2 -2
  220. package/src/services/game-audio.ts +152 -0
  221. package/src/services/game-network.ts +767 -0
  222. package/src/services/game-physics.ts +334 -0
  223. package/src/state-watch/StateWatchPanel.tsx +1 -1
  224. package/src/three/authoring/camera-runtime-inspector-section.tsx +3 -2
  225. package/src/three/authoring/constraint-inspector-section.tsx +6 -5
  226. package/src/three/authoring/model-asset-inspector-section.tsx +7 -6
  227. package/src/three/authoring/oid-source-persistence.ts +7 -7
  228. package/src/three/authoring/r3f-design-session.ts +58 -54
  229. package/src/three/authoring/r3f-source-authoring-adapter.ts +95 -91
  230. package/src/three/authoring/reflection-probe-inspector-section.tsx +3 -2
  231. package/src/three/authoring/three-authoring-adapter.ts +29 -29
  232. package/src/three/component-verbs/extract-menu.ts +7 -6
  233. package/src/three/component-verbs/fork-menu.ts +7 -6
  234. package/src/three/component-verbs/internals-menu.ts +2 -2
  235. package/src/three/story-documents/three-story-documents.tsx +13 -13
  236. package/src/three/three-board/ThreeBoardDocument.tsx +13 -12
  237. package/src/three/three-board/board-scene.ts +6 -6
  238. package/src/three/three-board/three-component-board.ts +2 -2
  239. package/src/services/game-audio-unlock.ts +0 -48
@@ -36,22 +36,22 @@ import type {
36
36
  CompositeFrame,
37
37
  ImageSnapshotCache,
38
38
  OverlayFrameCache,
39
- } from '@volter/editor-core/composite-screenshot';
39
+ } from '@volter/editor-sdk/kit/composite-screenshot';
40
40
  import {
41
41
  createImageSnapshotCache,
42
42
  createOverlayFrameCache,
43
43
  drawPlayCompositeFrame,
44
44
  isRootCanvas,
45
- } from '@volter/editor-core/composite-screenshot';
45
+ } from '@volter/editor-sdk/kit/composite-screenshot';
46
46
  import {
47
47
  abortGameplayRecordingSink,
48
48
  appendGameplayRecordingChunk,
49
49
  beginGameplayRecordingSink,
50
50
  finishGameplayRecordingSink,
51
51
  type GameplayRecordingSink,
52
- } from '@volter/editor-core/editor-api';
53
- import { type GameplayDomRecording, startGameplayDomRecording } from '@volter/editor-core/gameplay-dom-recording';
54
- import { publishToolContributionRecording } from '@volter/editor-core/gameplay-sessions';
52
+ } from '@volter/editor-sdk/kit/editor-api';
53
+ import { type GameplayDomRecording, startGameplayDomRecording } from '@volter/editor-sdk/kit/gameplay-dom-recording';
54
+ import { publishToolContributionRecording } from '@volter/editor-sdk/kit/gameplay-sessions';
55
55
  import { createRecordingPreviewEncoder } from './recording-preview';
56
56
 
57
57
  export interface GameplayRecordingStartOptions {
@@ -26,7 +26,7 @@
26
26
  * Defined in a DOM-free module so the Node-side Vite plugin can import the same
27
27
  * constant — see `game-globals-prelude.ts`. Re-exported here for the browser
28
28
  * callers that already reach for it alongside the proxies. */
29
- export { GAME_GLOBALS_PRELUDE } from '@volter/editor-core/game-globals-prelude';
29
+ export { GAME_GLOBALS_PRELUDE } from '@volter/editor-sdk/kit/game-globals-prelude';
30
30
 
31
31
  import { installCreationSiteRecorder } from '@volter/editor-sdk/kit/creation-site-registry';
32
32
  import { setConsoleRealmAttribution } from '@volter/editor-sdk/kit/editor-console';
@@ -93,7 +93,7 @@ const INPUT_EVENT_TYPES = new Set<string>([
93
93
  * the keyboard and pointer, and it stopped keyup/mouseup/pointerup the same
94
94
  * way — so a key pressed while the gate was open and released after it closed
95
95
  * (Stop with W still held) left the game's OWN input manager holding KeyW for
96
- * good: the editor flushes only the session's InputManager, never a
96
+ * good: the editor flushes only the session's own input state, never a
97
97
  * project-owned one. With both vertical keys stuck the hero
98
98
  * could not move up or down while A/D worked (runhuman pass 129; Opus
99
99
  * reproduction 2026-09-03 — forcing KeyW+KeyS into `keysDown` reproduced the
@@ -1,5 +1,5 @@
1
1
  import { sha256Hex } from '@volter/editor-sdk/kit/bytes-codec';
2
- import { HistoryOperationError, type HistoryService } from '@volter/editor-core/history/history-service';
2
+ import { HistoryOperationError, type HistoryService } from '@volter/editor-sdk/kit/history/history-service';
3
3
  import type { ResourceDescriptor, ResourceDriver, ResourceKind } from '@volter/editor-sdk/kit/history-types';
4
4
 
5
5
  const encoder = new TextEncoder();
@@ -9,8 +9,8 @@
9
9
  * where an edit lands.
10
10
  */
11
11
 
12
- import type { AuthoringAdapter2D, EditorNode2D } from '@volter/game-runtime/pixi/authoring';
13
- import type { DOMRectLike } from '@volter/editor-project/adapter';
12
+ import type { AuthoringAdapter2D, EditorNode2D } from '../../runtime/pixi/authoring';
13
+ import type { DOMRectLike, FrameCorners } from '@volter/editor-project/adapter';
14
14
  import type { Container, PointData } from 'pixi.js';
15
15
  import type { ProjectedNode, Projection } from '@volter/editor-sdk/kit/projection-types';
16
16
 
@@ -214,6 +214,28 @@ export class PixiProjector {
214
214
  return { x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height };
215
215
  }
216
216
 
217
+ /** The node's local bounds carried by its global transform — its turned box's corners. */
218
+ frame(id: string): FrameCorners | null {
219
+ const object = this.object(id) as
220
+ | (Container & { getLocalBounds?: () => { x: number; y: number; width: number; height: number } })
221
+ | null;
222
+ if (!object || typeof object.getLocalBounds !== 'function') return null;
223
+ const local = object.getLocalBounds();
224
+ if (!(local.width > 0) || !(local.height > 0)) return null;
225
+ // `toGlobal` brings the transform up to date itself, as `getBounds` does; the cached
226
+ // `worldTransform` is only as fresh as the last render, and an Edit surface renders on demand.
227
+ const at = (x: number, y: number) => {
228
+ const point = object.toGlobal({ x, y });
229
+ return { x: point.x, y: point.y };
230
+ };
231
+ return {
232
+ tl: at(local.x, local.y),
233
+ tr: at(local.x + local.width, local.y),
234
+ br: at(local.x + local.width, local.y + local.height),
235
+ bl: at(local.x, local.y + local.height),
236
+ };
237
+ }
238
+
217
239
  contextRects(id: string): { parent?: DOMRectLike; siblings: DOMRectLike[] } {
218
240
  const node = this.node(id);
219
241
  if (!node) return { siblings: [] };
@@ -1,57 +1,88 @@
1
1
  /**
2
- * Resolve the R3F entry factory from the same module graph as project worlds.
3
- * The packaged editor's UI is prebuilt with its own React/Fiber instances,
4
- * while project modules are transformed by a separate project-rooted Vite
5
- * server. Building a project component's adapter with the UI bundle's factory
6
- * crosses those graphs and crashes Fiber hooks on a null React dispatcher.
2
+ * The React and Fiber a project's three world is mounted with. The packaged
3
+ * editor's UI is prebuilt with its own React/Fiber instances, while project
4
+ * modules are transformed by a separate project-rooted Vite server. Mounting a
5
+ * project component with the UI bundle's copies crosses those graphs and
6
+ * crashes Fiber hooks on a null React dispatcher, so under the packaged
7
+ * runtime the mount takes the project's own through the R3F doorway
8
+ * (`R3F_DOORWAY` in `vite-plugin-module-doorways.ts`); in a checkout one Vite
9
+ * graph already shares them, and this module's own imports are they.
7
10
  */
8
11
 
9
- import { resolveR3FEntryAdapter } from '@volter/game-runtime/world3d-react';
10
- import type { RootAdapter, ThreeHostContext } from '@volter/editor-project/adapter';
11
- import type * as THREE from 'three';
12
12
  import {
13
- R3F_ENTRY_RUNTIME_PATH,
14
- R3F_RUNTIME_PATH,
15
- } from '@volter/editor-sdk/host';
13
+ advance,
14
+ createRoot,
15
+ events,
16
+ extend,
17
+ flushSync,
18
+ } from '@react-three/fiber';
19
+ import type { RootAdapter, ThreeHostContext } from '@volter/editor-project/adapter';
20
+ import { R3F_RUNTIME_PATH } from '@volter/editor-sdk/host';
16
21
  import { isPackagedRuntime } from '@volter/editor-sdk/kit/packaged-runtime';
22
+ import { Component, createElement, Fragment, useEffect } from 'react';
23
+ import type * as THREE from 'three';
24
+ import { type R3FRuntime, resolveR3FEntryAdapter } from './roots/r3f-root';
17
25
 
18
- type R3FEntryResolver = typeof resolveR3FEntryAdapter;
26
+ const CHECKOUT_RUNTIME: R3FRuntime = {
27
+ createElement,
28
+ Fragment,
29
+ Component,
30
+ useEffect,
31
+ createRoot,
32
+ extend,
33
+ advance,
34
+ flushSync,
35
+ events,
36
+ };
19
37
 
20
38
  interface PackagedR3FRuntime {
21
- readonly resolve: R3FEntryResolver;
39
+ readonly runtime: R3FRuntime;
22
40
  readonly projectThree: typeof THREE;
23
41
  }
24
42
 
25
43
  let cachedPackagedRuntime: Promise<PackagedR3FRuntime> | null = null;
26
44
 
45
+ const RUNTIME_MEMBERS = [
46
+ 'createElement',
47
+ 'Fragment',
48
+ 'Component',
49
+ 'useEffect',
50
+ 'createR3FRoot',
51
+ 'extendThree',
52
+ 'advance',
53
+ 'flushSync',
54
+ 'events',
55
+ ] as const;
56
+
27
57
  async function packagedRuntime(): Promise<PackagedR3FRuntime> {
28
- const [entry, mod] = await Promise.all([
29
- import(/* @vite-ignore */ R3F_ENTRY_RUNTIME_PATH) as Promise<{
30
- resolveR3FEntryAdapter?: unknown;
31
- }>,
32
- import(/* @vite-ignore */ R3F_RUNTIME_PATH) as Promise<{ projectThree?: unknown }>,
33
- ]);
34
- if (typeof entry.resolveR3FEntryAdapter !== 'function') {
35
- throw new Error(
36
- "The packaged runtime's synthetic R3F entry module did not export " +
37
- '`resolveR3FEntryAdapter` — see R3F_ENTRY_DOORWAY in vite-plugin-module-doorways.ts.',
38
- );
39
- }
40
- if (typeof mod.projectThree !== 'object' || mod.projectThree === null) {
58
+ const mod = (await import(/* @vite-ignore */ R3F_RUNTIME_PATH)) as Record<string, unknown>;
59
+ const missing = RUNTIME_MEMBERS.filter((name) => mod[name] === undefined);
60
+ if (missing.length > 0 || typeof mod['projectThree'] !== 'object' || mod['projectThree'] === null) {
41
61
  throw new Error(
42
62
  "The packaged runtime's synthetic R3F module did not export " +
43
- '`projectThree` — see R3F_DOORWAY in vite-plugin-module-doorways.ts.',
63
+ `${[...missing, ...(mod['projectThree'] ? [] : ['projectThree'])].join(', ')} — see ` +
64
+ 'R3F_DOORWAY in vite-plugin-module-doorways.ts.',
44
65
  );
45
66
  }
46
67
  return {
47
- resolve: entry.resolveR3FEntryAdapter as R3FEntryResolver,
48
- projectThree: mod.projectThree as typeof THREE,
68
+ runtime: {
69
+ createElement: mod['createElement'] as R3FRuntime['createElement'],
70
+ Fragment: mod['Fragment'] as R3FRuntime['Fragment'],
71
+ Component: mod['Component'] as R3FRuntime['Component'],
72
+ useEffect: mod['useEffect'] as R3FRuntime['useEffect'],
73
+ createRoot: mod['createR3FRoot'] as R3FRuntime['createRoot'],
74
+ extend: mod['extendThree'] as R3FRuntime['extend'],
75
+ advance: mod['advance'] as R3FRuntime['advance'],
76
+ flushSync: mod['flushSync'] as R3FRuntime['flushSync'],
77
+ events: mod['events'] as R3FRuntime['events'],
78
+ },
79
+ projectThree: mod['projectThree'] as typeof THREE,
49
80
  };
50
81
  }
51
82
 
52
83
  /**
53
84
  * The packaged editor shell and project modules are separate Vite graphs. The
54
- * adapter itself comes from the project graph, so its Three host namespace
85
+ * world's Fiber comes from the project graph, so its Three host namespace
55
86
  * must come from there too: Fiber seeds its intrinsic catalogue from
56
87
  * `host.three`, and mixing in the shell's constructors makes applyProps turn a
57
88
  * typed `DirectionalLight.color` into the raw JSX string.
@@ -69,9 +100,9 @@ export function withPackagedProjectThree(
69
100
  }
70
101
 
71
102
  export async function resolveR3FEntryAdapterForEditor(entryModule: unknown, rootId: string) {
72
- if (!(await isPackagedRuntime())) return resolveR3FEntryAdapter(entryModule, rootId);
103
+ if (!(await isPackagedRuntime())) return resolveR3FEntryAdapter(entryModule, rootId, CHECKOUT_RUNTIME);
73
104
  if (!cachedPackagedRuntime) cachedPackagedRuntime = packagedRuntime();
74
- const runtime = await cachedPackagedRuntime;
75
- const adapter = runtime.resolve(entryModule, rootId);
76
- return adapter ? withPackagedProjectThree(adapter, runtime.projectThree) : null;
105
+ const { runtime, projectThree } = await cachedPackagedRuntime;
106
+ const adapter = resolveR3FEntryAdapter(entryModule, rootId, runtime);
107
+ return adapter ? withPackagedProjectThree(adapter, projectThree) : null;
77
108
  }
@@ -16,10 +16,7 @@
16
16
  * (confirmed live; see `packaged.ts`'s header).
17
17
  */
18
18
 
19
- import { WorldProvider as EngineWorldProvider } from '@volter/game-runtime/react/world-state';
20
- import type { Game } from '@volter/game-runtime/runtime/game';
21
19
  import {
22
- type ComponentType,
23
20
  createElement,
24
21
  useEffect as reactUseEffect,
25
22
  useRef as reactUseRef,
@@ -30,9 +27,8 @@ import { REACT_WORLD_RUNTIME_PATH } from '@volter/editor-sdk/host';
30
27
  import { isPackagedRuntime } from '@volter/editor-sdk/kit/packaged-runtime';
31
28
 
32
29
  /**
33
- * The pieces of "react itself" a react-world mount needs:
34
- * `createElement`/`createRoot` (to build + render the `<WorldProvider><Entry/>
35
- * </WorldProvider>` tree) and the engine-published `WorldProvider`.
30
+ * The pieces of "react itself" a react-world mount needs: `createElement`/`createRoot`
31
+ * to build and render `<Entry />`, and the hooks the editor's own wrappers use.
36
32
  */
37
33
  export interface ReactRootMountRuntime {
38
34
  createElement: typeof createElement;
@@ -43,7 +39,6 @@ export interface ReactRootMountRuntime {
43
39
  * layer mount needs it from the SAME react-dom peer as `createRoot` above
44
40
  * (both are entry points of the same installed package). */
45
41
  flushSync: typeof flushSync;
46
- engineWorldProvider: ComponentType<{ game: Game; children?: unknown }>;
47
42
  }
48
43
 
49
44
  /** The dev default: this module's own static imports. */
@@ -54,10 +49,6 @@ function staticReactRootMountRuntime(): ReactRootMountRuntime {
54
49
  useEffect: reactUseEffect,
55
50
  useRef: reactUseRef,
56
51
  flushSync,
57
- engineWorldProvider: EngineWorldProvider as unknown as ComponentType<{
58
- game: Game;
59
- children?: unknown;
60
- }>,
61
52
  };
62
53
  }
63
54
 
@@ -77,20 +68,18 @@ async function loadPackagedReactRootMountRuntime(): Promise<ReactRootMountRuntim
77
68
  useEffect?: unknown;
78
69
  useRef?: unknown;
79
70
  flushSync?: unknown;
80
- EngineWorldProvider?: unknown;
81
71
  };
82
72
  if (
83
73
  typeof mod.createElement !== 'function' ||
84
74
  typeof mod.createRoot !== 'function' ||
85
75
  typeof mod.useEffect !== 'function' ||
86
76
  typeof mod.useRef !== 'function' ||
87
- typeof mod.flushSync !== 'function' ||
88
- typeof mod.EngineWorldProvider !== 'function'
77
+ typeof mod.flushSync !== 'function'
89
78
  ) {
90
79
  throw new Error(
91
80
  "The packaged runtime's synthetic react-world-runtime module " +
92
- `("${REACT_WORLD_RUNTIME_PATH}") did not export createElement/createRoot/useEffect/useRef/flushSync/` +
93
- 'EngineWorldProvider as functions — see vite-plugin-module-doorways.ts.',
81
+ `("${REACT_WORLD_RUNTIME_PATH}") did not export createElement/createRoot/useEffect/useRef/flushSync ` +
82
+ 'as functions — see vite-plugin-module-doorways.ts.',
94
83
  );
95
84
  }
96
85
  return {
@@ -99,10 +88,6 @@ async function loadPackagedReactRootMountRuntime(): Promise<ReactRootMountRuntim
99
88
  useEffect: mod.useEffect as typeof reactUseEffect,
100
89
  useRef: mod.useRef as typeof reactUseRef,
101
90
  flushSync: mod.flushSync as typeof flushSync,
102
- engineWorldProvider: mod.EngineWorldProvider as ComponentType<{
103
- game: Game;
104
- children?: unknown;
105
- }>,
106
91
  };
107
92
  }
108
93
 
@@ -112,8 +97,8 @@ let cachedPackagedReactRootMountRuntime: Promise<ReactRootMountRuntime> | null =
112
97
  * Resolve the react-world mount's own react. A react world is an ISOLATED
113
98
  * `createRoot` (its own DOM subtree / react tree) that does NOT need to share
114
99
  * react with the editor's own UI — it only needs to be internally consistent
115
- * (the wrapper + `WorldProvider` + the project's entry component all sharing
116
- * ONE react instance), which is exactly what the packaged branch restores.
100
+ * (the editor's wrapper and the project's entry component sharing ONE react
101
+ * instance), which is exactly what the packaged branch restores.
117
102
  *
118
103
  * Memoized twice over: `isPackagedRuntime()` is itself session-memoized, and
119
104
  * the packaged module load is cached here, so this performs at most one
@@ -129,32 +114,6 @@ export async function resolveReactRootMountRuntime(): Promise<ReactRootMountRunt
129
114
  return cachedPackagedReactRootMountRuntime;
130
115
  }
131
116
 
132
- /**
133
- * `WorldProvider` is the canonical engine export from
134
- * `@volter/game-runtime/react/world-state`, reached through the mount runtime above so
135
- * the project's copy is used under the packaged runtime. Hosts and game
136
- * entries therefore share ONE module and one React context identity.
137
- *
138
- * WHY THIS IS AN ENGINE EXPORT AND NOT A PER-PROJECT FILE — a finding verified
139
- * empirically, kept because the trap it describes is still live for anyone
140
- * tempted to reintroduce a project-local provider. Back when each project
141
- * owned its own bridge module, a hand-built runtime `import('/@fs/' +
142
- * projectRoot + '/…')` for it did NOT reliably land on the same module
143
- * instance a react-world entry's own STATIC relative import resolved to:
144
- * Vite's dev server treated the two differently at the HTTP level (a
145
- * query-string divergence, confirmed by logging `import.meta.url` inside two
146
- * otherwise-identical fetches) even though both targeted the identical file on
147
- * disk, and browser ES module identity is keyed by the exact request URL. That
148
- * alone produced TWO separate `createContext()` calls. The whole apparatus is
149
- * gone: one engine module, no per-project path to diverge on.
150
- */
151
- export async function resolveWorldProviderForProject(): Promise<
152
- ComponentType<{ game: Game; children?: unknown }>
153
- > {
154
- const runtime = await resolveReactRootMountRuntime();
155
- return runtime.engineWorldProvider;
156
- }
157
-
158
117
  /** Test-only: reset the packaged react-world mount runtime cache between
159
118
  * tests that toggle `isPackagedRuntime()`'s own (separately memoized) result. */
160
119
  export function resetReactRootMountRuntimeCacheForTest(): void {
@@ -92,7 +92,7 @@ export interface RealmServices {
92
92
  readonly entryReach: 'full';
93
93
  /** The canvas doorway: turn a canvas entry namespace into its adapter. */
94
94
  readonly pixiRuntime: typeof resolveCanvasEntryAdapterForEditor;
95
- /** The react-world mount's own react/react-dom/WorldProvider. */
95
+ /** The react-world mount's own react/react-dom. */
96
96
  readonly reactDomRuntime: () => Promise<ReactRootMountRuntime>;
97
97
  /** The three-ingest doorway: the namespace an ingested three game captures
98
98
  * against. */