A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
refactor(sdk): scene, prefab, app assembly and the shared helpers find their shelf
esengine199ce0c0eac1
diff --git a/sdk/src/ai/bt/BtPlugin.ts b/sdk/src/ai/bt/BtPlugin.tsindex d8d213ec7..616b5288d 100644--- a/sdk/src/ai/bt/BtPlugin.ts+++ b/sdk/src/ai/bt/BtPlugin.ts@@ -11,14 +11,14 @@* unit-test against a fake world. Gated to play mode; runs before nav follow.*/-import type { App, Plugin } from '../../app';+import type { App, Plugin } from '../../app/app';import type { Entity } from '../../types';import type { World } from '../../ecs/world';import { defineSystem, Schedule, GetWorld } from '../../ecs/system';import { Res, Time, type TimeData } from '../../ecs/resource';import { defineResource } from '../../ecs/resource';import { Commands, type CommandsInstance } from '../../ecs/commands';-import { playModeOnly } from '../../env';+import { playModeOnly } from '../../util/env';import type { AnyComponentDef, ComponentData } from '../../ecs/component';import { Assets } from '../../asset/AssetPlugin';import { resolveAssetKey } from '../../asset/resolveAssetKey';diff --git a/sdk/src/ai/builtins.ts b/sdk/src/ai/builtins.tsindex da988dfaa..ed93f9de8 100644--- a/sdk/src/ai/builtins.ts+++ b/sdk/src/ai/builtins.ts@@ -17,7 +17,7 @@ import { aiRegistry, type AiContext } from './fsm/AiContext';import type { AiAction, AiCondition, AiParamValue } from './fsm/registry';import { TimelinePlayer } from '../timeline/TimelinePlugin';import { SpriteAnimator } from '../animation/SpriteAnimator';-import { setEntityProperty } from '../propertyPath';+import { setEntityProperty } from '../util/propertyPath';/*** Register the engine's built-in actions/conditions. Idempotent (and safe afterdiff --git a/sdk/src/ai/fsm/FsmPlugin.ts b/sdk/src/ai/fsm/FsmPlugin.tsindex 0fbb97f4c..71b4336c5 100644--- a/sdk/src/ai/fsm/FsmPlugin.ts+++ b/sdk/src/ai/fsm/FsmPlugin.ts@@ -11,14 +11,14 @@* NavAgent the same frame.*/-import type { App, Plugin } from '../../app';+import type { App, Plugin } from '../../app/app';import type { Entity } from '../../types';import type { World } from '../../ecs/world';import { defineSystem, Schedule, GetWorld } from '../../ecs/system';import { Res, Time, type TimeData } from '../../ecs/resource';import { defineResource } from '../../ecs/resource';import { Commands, type CommandsInstance } from '../../ecs/commands';-import { playModeOnly } from '../../env';+import { playModeOnly } from '../../util/env';import type { AnyComponentDef, ComponentData } from '../../ecs/component';import { Assets } from '../../asset/AssetPlugin';import { resolveAssetKey } from '../../asset/resolveAssetKey';diff --git a/sdk/src/ai/nav/NavPlugin.ts b/sdk/src/ai/nav/NavPlugin.tsindex 4f0f6695a..747e78c9f 100644--- a/sdk/src/ai/nav/NavPlugin.ts+++ b/sdk/src/ai/nav/NavPlugin.ts@@ -12,7 +12,7 @@* (REARCH_GAMEPLAY_AI.md AI4) — the grid path already clears static blockers.*/-import type { App, Plugin } from '../../app';+import type { App, Plugin } from '../../app/app';import type { Entity } from '../../types';import { defineSystem, Schedule, GetWorld } from '../../ecs/system';import { Res, Time, type TimeData } from '../../ecs/resource';@@ -21,7 +21,7 @@ import {type AnyComponentDef,type ComponentData,} from '../../ecs/component';-import { playModeOnly } from '../../env';+import { playModeOnly } from '../../util/env';import { Navigation, Nav } from './Navigation';import { NavAgent } from './NavAgent';import { advanceAlongPath } from './follow';diff --git a/sdk/src/ai/perception/PerceptionPlugin.ts b/sdk/src/ai/perception/PerceptionPlugin.tsindex 1b697aa70..1f543018f 100644--- a/sdk/src/ai/perception/PerceptionPlugin.ts+++ b/sdk/src/ai/perception/PerceptionPlugin.ts@@ -11,10 +11,10 @@* skipped (range + FOV only) otherwise — no hard physics dependency.*/-import type { App, Plugin } from '../../app';+import type { App, Plugin } from '../../app/app';import type { Entity } from '../../types';import { defineSystem, Schedule, GetWorld } from '../../ecs/system';-import { playModeOnly } from '../../env';+import { playModeOnly } from '../../util/env';import { Transform } from '../../ecs/component';import type { AnyComponentDef, ComponentData } from '../../ecs/component';import { Physics, type PhysicsAPI } from '../../physics';diff --git a/sdk/src/animation/AnimClipLoader.ts b/sdk/src/animation/AnimClipLoader.tsindex 75796ce40..076929026 100644--- a/sdk/src/animation/AnimClipLoader.ts+++ b/sdk/src/animation/AnimClipLoader.ts@@ -6,7 +6,7 @@*/import type { SpriteAnimClip, SpriteAnimFrame } from './SpriteAnimator';-import { log } from '../logger';+import { log } from '../util/logger';// =============================================================================// .esanim File Formatdiff --git a/sdk/src/animation/AnimationPlugin.ts b/sdk/src/animation/AnimationPlugin.tsindex 2679c4588..07f484f42 100644--- a/sdk/src/animation/AnimationPlugin.ts+++ b/sdk/src/animation/AnimationPlugin.ts@@ -5,21 +5,21 @@* @brief Animation plugin registering Tween and SpriteAnimator systems*/-import type { App, Plugin } from '../app';+import type { App, Plugin } from '../app/app';import { defineSystem, Schedule } from '../ecs/system';import { Res } from '../ecs/resource';import { Time, type TimeData } from '../ecs/resource';import type { Entity } from '../types';import type { CppRegistry } from '../wasm';import { engineApi } from '../ecs/bridge/engineApi';-import { log } from '../logger';+import { log } from '../util/logger';import type { AnimCore } from './Tween';import { Tween, TweenAPI } from './Tween';import { SpriteAnimation, SpriteAnimationAPI } from './SpriteAnimator';import { AnimatorController, AnimatorControllerAPI } from './Animator';import { Assets } from '../asset/AssetPlugin';import { resolveAssetKey } from '../asset/resolveAssetKey';-import { playModeOnly } from '../env';+import { playModeOnly } from '../util/env';import { SystemLabel } from '../ecs/systemLabels';export class AnimationPlugin implements Plugin {diff --git a/sdk/src/app.ts b/sdk/src/app/app.tssimilarity index 97%rename from sdk/src/app.tsrename to sdk/src/app/app.tsindex f84ae4a1a..e3096fcd6 100644--- a/sdk/src/app.ts+++ b/sdk/src/app/app.ts@@ -5,32 +5,32 @@* @brief Application builder and web platform integration*/-import { World } from './ecs/world';-import { Schedule, SystemDef, SystemRunner, SystemSet, type RunCondition } from './ecs/system';-import { ResourceStorage, Time, TimeData, type ResourceDef } from './ecs/resource';-import { EventRegistry, type EventDef } from './ecs/event';-import type { ESEngineModule, CppRegistry } from './wasm';-import type { BridgeConnectOptions } from './ecs/bridge/BuiltinBridge';-import { UICameraInfo } from './ui/core/ui-camera-info';-import { inputPlugin, Input } from './input/input';-import { assetPlugin } from './asset';-import { prefabsPlugin } from './prefabServer';-import { setWasmErrorHandler } from './wasm/wasmError';+import { World } from '../ecs/world';+import { Schedule, SystemDef, SystemRunner, SystemSet, type RunCondition } from '../ecs/system';+import { ResourceStorage, Time, TimeData, type ResourceDef } from '../ecs/resource';+import { EventRegistry, type EventDef } from '../ecs/event';+import type { ESEngineModule, CppRegistry } from '../wasm';+import type { BridgeConnectOptions } from '../ecs/bridge/BuiltinBridge';+import { UICameraInfo } from '../ui/core/ui-camera-info';+import { inputPlugin, Input } from '../input/input';+import { assetPlugin } from '../asset';+import { prefabsPlugin } from '../prefab/prefabServer';+import { setWasmErrorHandler } from '../wasm/wasmError';import { corePlugin, DEFAULT_UI_CAMERA_INFO } from './corePlugin';-import { platformNow } from './platform';-import { RenderPipeline } from './render/renderPipeline';-import type { SceneConfig } from './sceneManager';-import { SceneManager } from './sceneManager';-import { sceneManagerPlugin } from './scenePlugin';-import { getDefaultContext } from './ecs/context';-import { setLinearColorSpace } from './env';-import { seedEngineComponents } from './ecs/component';-import { cameraPlugin } from './camera/CameraPlugin';-import { ScreenScaling, SCREEN_FIT_OFF, type ScreenScalingData } from './camera/ScreenScaling';-import { PhysicsRuntime } from './physics/PhysicsRuntime';+import { platformNow } from '../platform';+import { RenderPipeline } from '../render/renderPipeline';+import type { SceneConfig } from '../scene/sceneManager';+import { SceneManager } from '../scene/sceneManager';+import { sceneManagerPlugin } from '../scene/scenePlugin';+import { getDefaultContext } from '../ecs/context';+import { setLinearColorSpace } from '../util/env';+import { seedEngineComponents } from '../ecs/component';+import { cameraPlugin } from '../camera/CameraPlugin';+import { ScreenScaling, SCREEN_FIT_OFF, type ScreenScalingData } from '../camera/ScreenScaling';+import { PhysicsRuntime } from '../physics/PhysicsRuntime';import { SubsystemRegistry } from './subsystems';-import type { SideModuleHost } from './sideModules/host';-import { log } from './logger';+import type { SideModuleHost } from '../sideModules/host';+import { log } from '../util/logger';// =============================================================================// Plugin Interfacediff --git a/sdk/src/corePlugin.ts b/sdk/src/app/corePlugin.tssimilarity index 72%rename from sdk/src/corePlugin.tsrename to sdk/src/app/corePlugin.tsindex 55d7367c8..0997aaba0 100644--- a/sdk/src/corePlugin.ts+++ b/sdk/src/app/corePlugin.ts@@ -1,17 +1,17 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport type { Plugin } from './app';-import { initResourceManager, shutdownResourceManager, setTextureBudget, trimTextureCache } from './wasm/resourceManager';-import { platformOnMemoryWarning } from './platform/base';-import { RuntimeConfig } from './defaults';-import { initDrawAPI, shutdownDrawAPI } from './render/draw';-import { clearDrawCallbacks } from './render/customDraw';-import { initMaterialAPI, shutdownMaterialAPI } from './render/material';-import { initGeometryAPI, shutdownGeometryAPI } from './render/geometry';-import { initPostProcessAPI, shutdownPostProcessAPI } from './postprocess';-import { initRendererAPI, shutdownRendererAPI } from './render/renderer';-import { initGLDebugAPI, shutdownGLDebugAPI } from './render/glDebug';-import { CameraView, CameraViewAPI } from './camera/Camera';+import { initResourceManager, shutdownResourceManager, setTextureBudget, trimTextureCache } from '../wasm/resourceManager';+import { platformOnMemoryWarning } from '../platform/base';+import { RuntimeConfig } from '../defaults';+import { initDrawAPI, shutdownDrawAPI } from '../render/draw';+import { clearDrawCallbacks } from '../render/customDraw';+import { initMaterialAPI, shutdownMaterialAPI } from '../render/material';+import { initGeometryAPI, shutdownGeometryAPI } from '../render/geometry';+import { initPostProcessAPI, shutdownPostProcessAPI } from '../postprocess';+import { initRendererAPI, shutdownRendererAPI } from '../render/renderer';+import { initGLDebugAPI, shutdownGLDebugAPI } from '../render/glDebug';+import { CameraView, CameraViewAPI } from '../camera/Camera';let offMemoryWarning: (() => void) | null = null;diff --git a/sdk/src/pluginSets.ts b/sdk/src/app/pluginSets.tssimilarity index 79%rename from sdk/src/pluginSets.tsrename to sdk/src/app/pluginSets.tsindex 71b0d8dda..cdfc98400 100644--- a/sdk/src/pluginSets.ts+++ b/sdk/src/app/pluginSets.ts@@ -21,21 +21,21 @@* out. Internal: the factories are the public surface, not the lists.*/import type { Plugin } from './app';-import { animationPlugin } from './animation';-import { audioPlugin } from './audio';-import { videoPlugin } from './video';-import { particlePlugin } from './particle';-import { trailPlugin } from './trail';-import { mesh2dPlugin } from './render/mesh2d';-import { tilemapPlugin } from './tilemap';-import { postProcessPlugin } from './postprocess';-import { timelinePlugin } from './timeline';-import { timerPlugin } from './timer';-import { velocityPlugin } from './velocity';-import { lifecyclePlugin } from './ecs/lifecycle';-import { navPlugin, fsmPlugin, btPlugin, perceptionPlugin } from './ai';-import { eventBindingPlugin } from './eventBinding';-import { replicationPlugin } from './net/replication';+import { animationPlugin } from '../animation';+import { audioPlugin } from '../audio';+import { videoPlugin } from '../video';+import { particlePlugin } from '../particle';+import { trailPlugin } from '../trail';+import { mesh2dPlugin } from '../render/mesh2d';+import { tilemapPlugin } from '../tilemap';+import { postProcessPlugin } from '../postprocess';+import { timelinePlugin } from '../timeline';+import { timerPlugin } from '../util/timer';+import { velocityPlugin } from '../velocity';+import { lifecyclePlugin } from '../ecs/lifecycle';+import { navPlugin, fsmPlugin, btPlugin, perceptionPlugin } from '../ai';+import { eventBindingPlugin } from '../eventBinding';+import { replicationPlugin } from '../net/replication';/*** The simulation: timers/lifecycle, gameplay AI, audio (silent on a host with nodiff --git a/sdk/src/subsystems.ts b/sdk/src/app/subsystems.tssimilarity index 100%rename from sdk/src/subsystems.tsrename to sdk/src/app/subsystems.tsdiff --git a/sdk/src/uiPlugins.ts b/sdk/src/app/uiPlugins.tssimilarity index 89%rename from sdk/src/uiPlugins.tsrename to sdk/src/app/uiPlugins.tsindex 4b5a1ed89..6c0115752 100644--- a/sdk/src/uiPlugins.ts+++ b/sdk/src/app/uiPlugins.ts@@ -1,6 +1,6 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import { uiPlugin } from './ui/ui-plugin';+import { uiPlugin } from '../ui/ui-plugin';import type { Plugin } from './app';// The ten hand-ordered UI concept plugins are now composed intodiff --git a/sdk/src/asset/AssetPlugin.ts b/sdk/src/asset/AssetPlugin.tsindex 9ca265a41..a99962491 100644--- a/sdk/src/asset/AssetPlugin.ts+++ b/sdk/src/asset/AssetPlugin.ts@@ -1,6 +1,6 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { App, Plugin } from '../app';+import type { App, Plugin } from '../app/app';import { defineResource } from '../ecs/resource';import { Assets as AssetsClass } from './Assets';import { HttpBackend } from './Backend';@@ -9,7 +9,7 @@ import { AssetRefCounter } from './AssetRefCounter';import { Audio, type AudioAPI } from '../audio/Audio';import { SpriteAnimation, type SpriteAnimationAPI } from '../animation/SpriteAnimator';import { Localization, type LocalizationAPI } from '../i18n/Localization';-import { log } from '../logger';+import { log } from '../util/logger';export type AssetsData = AssetsClass;diff --git a/sdk/src/asset/Assets.ts b/sdk/src/asset/Assets.tsindex 3515cdfc2..6a5f53e61 100644--- a/sdk/src/asset/Assets.ts+++ b/sdk/src/asset/Assets.ts@@ -33,15 +33,15 @@ import { BtAssetLoader } from './loaders/BtAssetLoader';import { LocaleAssetLoader } from './loaders/LocaleAssetLoader';import type { SpineModuleController } from '../spine/SpineController';import { getComponentDefaults } from '../ecs/component';-import { getComponentAssetFieldDescriptors } from '../scene';+import { getComponentAssetFieldDescriptors } from '../scene/scene';import { discoverSceneAssets } from './discoverAssets';import { fetchDecodePixels } from './imageDecode';-import type { SceneData } from '../scene';+import type { SceneData } from '../scene/scene';import { SceneHandle, type ReleaseCallback } from './SceneHandle';import type { AssetRegistry } from './AssetRegistry';import { UUID_REF_PREFIX } from './AssetRegistry';import type { AssetRefCounter } from './AssetRefCounter';-import { log } from '../logger';+import { log } from '../util/logger';/** Callback fired when `Assets.invalidate(ref)` actually dropped cache entries.* `oldTextureHandle` is the texture handle that was bound before the drop (0 whendiff --git a/sdk/src/asset/AsyncCache.ts b/sdk/src/asset/AsyncCache.tsindex 7b8f53ebd..4621b5566 100644--- a/sdk/src/asset/AsyncCache.ts+++ b/sdk/src/asset/AsyncCache.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { RuntimeConfig } from '../defaults';-import { log } from '../logger';+import { log } from '../util/logger';interface PendingEntry<T> {promise: Promise<T>;diff --git a/sdk/src/asset/discoverAssets.ts b/sdk/src/asset/discoverAssets.tsindex 40e44f2f5..4fc3cd377 100644--- a/sdk/src/asset/discoverAssets.ts+++ b/sdk/src/asset/discoverAssets.ts@@ -23,7 +23,7 @@*/import { getComponent } from '../ecs/component';-import type { SceneData, AssetFieldType } from '../scene';+import type { SceneData, AssetFieldType } from '../scene/scene';export interface SpineAssetRef {skeleton: string;diff --git a/sdk/src/asset/loaders/AnimClipAssetLoader.ts b/sdk/src/asset/loaders/AnimClipAssetLoader.tsindex 6b876f43b..8a565728f 100644--- a/sdk/src/asset/loaders/AnimClipAssetLoader.ts+++ b/sdk/src/asset/loaders/AnimClipAssetLoader.ts@@ -2,7 +2,7 @@// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport type { AssetLoader, LoadContext, AnimClipResult } from '../AssetLoader';import { extractAnimClipTexturePaths, parseAnimClipAsset, parseAnimClipData } from '../../animation/AnimClipLoader';-import { log } from '../../logger';+import { log } from '../../util/logger';export class AnimClipAssetLoader implements AssetLoader<AnimClipResult> {readonly type = 'anim-clip';diff --git a/sdk/src/asset/loaders/AudioAssetLoader.ts b/sdk/src/asset/loaders/AudioAssetLoader.tsindex 3b3f8e155..19493f5f5 100644--- a/sdk/src/asset/loaders/AudioAssetLoader.ts+++ b/sdk/src/asset/loaders/AudioAssetLoader.ts@@ -2,7 +2,7 @@// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport type { AssetLoader, LoadContext, AudioResult } from '../AssetLoader';import type { AudioAPI } from '../../audio/Audio';-import { log } from '../../logger';+import { log } from '../../util/logger';export class AudioAssetLoader implements AssetLoader<AudioResult> {readonly type = 'audio';diff --git a/sdk/src/asset/loaders/MaterialAssetLoader.ts b/sdk/src/asset/loaders/MaterialAssetLoader.tsindex 7e2365fe8..a6ecdc63b 100644--- a/sdk/src/asset/loaders/MaterialAssetLoader.ts+++ b/sdk/src/asset/loaders/MaterialAssetLoader.ts@@ -5,7 +5,7 @@ import type { MaterialAssetData, ShaderHandle } from '../../render/material';import { Material } from '../../render/material';import { builtinShaderTemplate } from '../../render/builtinShaders';import { AsyncCache } from '../AsyncCache';-import { log } from '../../logger';+import { log } from '../../util/logger';// A `builtin:<id>` shader ref names a stock template compiled from its in-code source (no file);// anything else is a path to a project `.esshader`. Kept a literal (not a shared export) so itdiff --git a/sdk/src/asset/loaders/PrefabAssetLoader.ts b/sdk/src/asset/loaders/PrefabAssetLoader.tsindex ab50a4d4e..5d5aeab17 100644--- a/sdk/src/asset/loaders/PrefabAssetLoader.ts+++ b/sdk/src/asset/loaders/PrefabAssetLoader.ts@@ -2,7 +2,7 @@// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport type { AssetLoader, LoadContext, PrefabResult } from '../AssetLoader';import { migratePrefabData } from '../../prefab';-import { log } from '../../logger';+import { log } from '../../util/logger';export class PrefabAssetLoader implements AssetLoader<PrefabResult> {readonly type = 'prefab';diff --git a/sdk/src/asset/loaders/SpineAssetLoader.ts b/sdk/src/asset/loaders/SpineAssetLoader.tsindex dfeef827a..f95c10e3d 100644--- a/sdk/src/asset/loaders/SpineAssetLoader.ts+++ b/sdk/src/asset/loaders/SpineAssetLoader.ts@@ -6,7 +6,7 @@ import { getAssetTypeEntry } from '../../assetTypes';import type { ESEngineModule } from '../../wasm';import type { SpineModuleController } from '../../spine/SpineController';import { parseSpineAtlasPages } from '../../spine/atlasPages';-import { log } from '../../logger';+import { log } from '../../util/logger';export class SpineAssetLoader implements AssetLoader<SpineResult> {readonly type = 'spine';diff --git a/sdk/src/asset/loaders/TextureLoader.ts b/sdk/src/asset/loaders/TextureLoader.tsindex 9938ebeab..a8e81d23a 100644--- a/sdk/src/asset/loaders/TextureLoader.ts+++ b/sdk/src/asset/loaders/TextureLoader.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport type { AssetLoader, LoadContext, TextureResult } from '../AssetLoader';-import { linearColorSpace } from '../../env';+import { linearColorSpace } from '../../util/env';import { platformCreateCanvas, platformCreateImage } from '../../platform/base';import type { PlatformCanvas, PlatformCanvas2DContext, PlatformImage } from '../../platform/types';import { decodeImageBitmap } from '../imageDecode';diff --git a/sdk/src/asset/loaders/TilemapAssetLoader.ts b/sdk/src/asset/loaders/TilemapAssetLoader.tsindex c5e574579..5360cc928 100644--- a/sdk/src/asset/loaders/TilemapAssetLoader.ts+++ b/sdk/src/asset/loaders/TilemapAssetLoader.ts@@ -6,7 +6,7 @@ import {type TiledMapData, type TiledTilesetData,} from '../../tilemap/tiledLoader';import { registerTilemapSource, unregisterTilemapSource, type LoadedTilemapTileset } from '../../tilemap/tilesetCache';-import { log } from '../../logger';+import { log } from '../../util/logger';export class TilemapAssetLoader implements AssetLoader<TilemapResult> {readonly type = 'tilemap';diff --git a/sdk/src/asset/loaders/TilesetAssetLoader.ts b/sdk/src/asset/loaders/TilesetAssetLoader.tsindex 943826b04..7377e81a3 100644--- a/sdk/src/asset/loaders/TilesetAssetLoader.ts+++ b/sdk/src/asset/loaders/TilesetAssetLoader.ts@@ -9,7 +9,7 @@import type { AssetLoader, LoadContext, TilesetResult } from '../AssetLoader';import { parseTileset } from '../../tilemap/tilesetAsset';import { registerResolvedTileset } from '../../tilemap/tilesetCache';-import { log } from '../../logger';+import { log } from '../../util/logger';export class TilesetAssetLoader implements AssetLoader<TilesetResult> {readonly type = 'tileset';diff --git a/sdk/src/asset/loaders/TimelineAssetLoader.ts b/sdk/src/asset/loaders/TimelineAssetLoader.tsindex 96fcc5517..d16d7ddf4 100644--- a/sdk/src/asset/loaders/TimelineAssetLoader.ts+++ b/sdk/src/asset/loaders/TimelineAssetLoader.ts@@ -3,7 +3,7 @@import type { AssetLoader, LoadContext, TimelineResult } from '../AssetLoader';import { parseTimelineAsset, extractTimelineAssetPaths } from '../../timeline/TimelineLoader';import { registerTimelineAsset, registerTimelineTextureHandles } from '../../timeline/TimelineAssetRegistry';-import { log } from '../../logger';+import { log } from '../../util/logger';export class TimelineAssetLoader implements AssetLoader<TimelineResult> {readonly type = 'timeline';diff --git a/sdk/src/audio/Audio.ts b/sdk/src/audio/Audio.tsindex c4bc612c6..06c2bf325 100644--- a/sdk/src/audio/Audio.ts+++ b/sdk/src/audio/Audio.ts@@ -5,7 +5,7 @@ import type { AudioMixer, BusDuckRule } from './AudioMixer';import type { BusEffectDef } from './BusEffects';import { defineResource } from '../ecs/resource';import { RuntimeConfig } from '../defaults';-import { log } from '../logger';+import { log } from '../util/logger';/*** One decoded buffer's residency record. Mirrors the texture pool'sdiff --git a/sdk/src/audio/AudioPlugin.ts b/sdk/src/audio/AudioPlugin.tsindex 626f51a4d..c89773a6a 100644--- a/sdk/src/audio/AudioPlugin.ts+++ b/sdk/src/audio/AudioPlugin.ts@@ -1,6 +1,6 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { App, Plugin } from '../app';+import type { App, Plugin } from '../app/app';import type { Entity } from '../types';import { defineSystem, Schedule } from '../ecs/system';import { Res, Time, type TimeData } from '../ecs/resource';@@ -10,8 +10,8 @@ import { WorldTransform, type WorldTransformData } from '../ecs/component';import { platformCreateAudioBackend, platformOnMemoryWarning } from '../platform/base';import { calculateAttenuation, calculatePanning, type SpatialAudioConfig, AttenuationModel } from './SpatialAudio';import type { AudioHandle } from './PlatformAudioBackend';-import { isEditor, isPlayMode } from '../env';-import { log } from '../logger';+import { isEditor, isPlayMode } from '../util/env';+import { log } from '../util/logger';export interface AudioPluginConfig {initialPoolSize?: number;diff --git a/sdk/src/audio/MiniGameAudioBackend.ts b/sdk/src/audio/MiniGameAudioBackend.tsindex 6f90787fc..6410eae33 100644--- a/sdk/src/audio/MiniGameAudioBackend.ts+++ b/sdk/src/audio/MiniGameAudioBackend.ts@@ -15,7 +15,7 @@ import type { AudioHandle, AudioBufferHandle, PlayConfig, PlatformAudioBackend,import type { AudioMixer } from './AudioMixer';import type { MiniGameGlobal, MiniGameInnerAudioContext } from '../platform/minigame/api';import { scalar } from '../math/scalar';-import { log } from '../logger';+import { log } from '../util/logger';class MiniGameAudioHandle implements AudioHandle {readonly id: number;diff --git a/sdk/src/camera/Camera.ts b/sdk/src/camera/Camera.tsindex c9b4aac45..b8ed0806a 100644--- a/sdk/src/camera/Camera.ts+++ b/sdk/src/camera/Camera.ts@@ -1,6 +1,6 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { App } from '../app';+import type { App } from '../app/app';import { defineResource } from '../ecs/resource';import { UICameraInfo, type UICameraData } from '../ui/core/ui-camera-info';import { screenToWorld, worldToScreen, createInvVPCache } from '../ui/util/math';diff --git a/sdk/src/camera/CameraDirector.ts b/sdk/src/camera/CameraDirector.tsindex e58f439f3..7dce75104 100644--- a/sdk/src/camera/CameraDirector.ts+++ b/sdk/src/camera/CameraDirector.ts@@ -10,7 +10,7 @@* builds into the rendered view. Cameras stay declarative view defs; the* director is the runtime that selects + transitions between them.*/-import type { App } from '../app';+import type { App } from '../app/app';import { defineResource } from '../ecs/resource';import { applyEasing, EasingType } from '../animation/Easing';import type { CameraPOV } from './CameraPlugin';diff --git a/sdk/src/camera/CameraPlugin.ts b/sdk/src/camera/CameraPlugin.tsindex e1d15a708..15cde1bad 100644--- a/sdk/src/camera/CameraPlugin.ts+++ b/sdk/src/camera/CameraPlugin.ts@@ -5,11 +5,11 @@* @brief Camera system plugin — collects cameras, computes view-projection, drives rendering*/-import type { App, Plugin } from '../app';+import type { App, Plugin } from '../app/app';import type { SystemDef } from '../ecs/system';import { Schedule, defineSystem } from '../ecs/system';import { Res, Time, type TimeData } from '../ecs/resource';-import { playModeOnly } from '../env';+import { playModeOnly } from '../util/env';import { followUpdate } from './FollowTarget';import type { ESEngineModule, CppRegistry } from '../wasm';import type { World } from '../ecs/world';@@ -23,7 +23,7 @@ import { CameraDirector, createDirectorState, resolveMainPOV } from './CameraDirimport { RenderPipeline } from '../render/renderPipeline';import { Renderer } from '../render/renderer';import { platformNow, platformDevicePixelRatio } from '../platform';-import { SceneManager } from '../sceneManager';+import { SceneManager } from '../scene/sceneManager';import { ortho, perspective, invertViewZ, multiply, IDENTITY } from '../math/mat4';// =============================================================================diff --git a/sdk/src/camera/editorGridRenderer.ts b/sdk/src/camera/editorGridRenderer.tsindex 816e98c9c..2ae379944 100644--- a/sdk/src/camera/editorGridRenderer.ts+++ b/sdk/src/camera/editorGridRenderer.ts@@ -25,7 +25,7 @@* Frontends just install this once and flip the `EditorGrid` resource — the web* editor and the headless render host (pixel verification) get the grid for free.*/-import type { App } from '../app';+import type { App } from '../app/app';import { Draw } from '../render/draw';import { Geometry, type GeometryHandle } from '../render/geometry';import { Material, type MaterialHandle } from '../render/material';diff --git a/sdk/src/core-content.ts b/sdk/src/core-content.tsindex 533cab584..3e2e09d99 100644--- a/sdk/src/core-content.ts+++ b/sdk/src/core-content.ts@@ -130,7 +130,7 @@ export {type MissingAssetCallback,MissingAssetsError,type SliceBorder,-} from './scene';+} from './scene/scene';// =============================================================================// Scene Manager@@ -145,7 +145,7 @@ export {type SceneContext,type SceneStatus,type TransitionOptions,-} from './sceneManager';+} from './scene/sceneManager';export {SceneStreaming,@@ -156,14 +156,14 @@ export {type StreamPolicy,type SceneStreamingConfig,type SceneStreamHost,-} from './sceneStreaming';+} from './scene/sceneStreaming';-export { sceneManagerPlugin } from './scenePlugin';+export { sceneManagerPlugin } from './scene/scenePlugin';export {transitionTo,type TransitionConfig,-} from './sceneTransition';+} from './scene/sceneTransition';// =============================================================================// Prefab@@ -225,7 +225,7 @@ export {type ExternalEntityRef,} from './prefab/index';-export { Prefabs, PrefabServer, PrefabsPlugin, prefabsPlugin } from './prefabServer';+export { Prefabs, PrefabServer, PrefabsPlugin, prefabsPlugin } from './prefab/prefabServer';// =============================================================================// Runtime Loaderdiff --git a/sdk/src/core-plugins.ts b/sdk/src/core-plugins.tsindex e16add825..f41ca914a 100644--- a/sdk/src/core-plugins.ts+++ b/sdk/src/core-plugins.ts@@ -19,7 +19,7 @@// The single composed UI pipeline; the concept plugins below are// re-exported for granular/advanced wiring.-export { uiPlugins } from './uiPlugins';+export { uiPlugins } from './app/uiPlugins';export { uiPlugin, UIPlugin } from './ui/ui-plugin';export { textPlugin, TextPlugin } from './ui/text/plugin';export { uiMaskPlugin, UIMaskPlugin } from './ui/render/mask';diff --git a/sdk/src/core-runtime.ts b/sdk/src/core-runtime.tsindex e25c3af54..0c810a93c 100644--- a/sdk/src/core-runtime.ts+++ b/sdk/src/core-runtime.ts@@ -195,7 +195,7 @@ export {type TimeData,} from './ecs/resource';-export { Storage } from './storage';+export { Storage } from './util/storage';// =============================================================================// Input@@ -383,19 +383,19 @@ export {type PluginDependency,type WebAppOptions,type RenderSurfaceSource,-} from './app';+} from './app/app';// =============================================================================// Subsystem observability// =============================================================================-export { SubsystemRegistry } from './subsystems';+export { SubsystemRegistry } from './app/subsystems';export type {SubsystemStatus,SubsystemPhase,SubsystemActivity,SubsystemEvent,-} from './subsystems';+} from './app/subsystems';// =============================================================================// WASM Types@@ -421,9 +421,9 @@ export {setFxEditPreview,isFxEditPreview,fxPreviewOrPlayMode,-} from './env';+} from './util/env';-export type { RunCondition } from './app';+export type { RunCondition } from './app/app';export { probeRegistrations } from './hotReload';export type { ProbedRegistrations } from './hotReload';diff --git a/sdk/src/core-sys.ts b/sdk/src/core-sys.tsindex c037782de..1e53f9994 100644--- a/sdk/src/core-sys.ts+++ b/sdk/src/core-sys.ts@@ -53,7 +53,7 @@ export {type SaveMigration,type SaveStorage,type SaveManagerOptions,-} from './saveGame';+} from './scene/saveGame';// =============================================================================// Entity Utils@@ -142,7 +142,7 @@ export {LogLevel,type LogEntry,type LogHandler,-} from './logger';+} from './util/logger';// =============================================================================// GL Debug@@ -186,7 +186,7 @@ export {TimerHandle,TimerRes,timerPlugin,-} from './timer';+} from './util/timer';export { velocityPlugin, velocitySystem } from './velocity';@@ -263,7 +263,7 @@ export {// Core Plugin// =============================================================================-export { corePlugin, DEFAULT_UI_CAMERA_INFO } from './corePlugin';+export { corePlugin, DEFAULT_UI_CAMERA_INFO } from './app/corePlugin';// The engine entry points a plugin may call, from whichever core is present (the// wasm module on the web, a native host's bindings on a device) — the parameterdiff --git a/sdk/src/dragonbones/DragonBonesController.ts b/sdk/src/dragonbones/DragonBonesController.tsindex 2108173d9..88e7ecd42 100644--- a/sdk/src/dragonbones/DragonBonesController.ts+++ b/sdk/src/dragonbones/DragonBonesController.ts@@ -19,8 +19,8 @@ import { forEachMeshBatch, type MeshBatchVisitor } from '../skeletal/meshBatchesimport type { SkeletalBounds, SkeletalController } from '../skeletal/types';import type { DragonBonesWasmModule, DragonBonesWrappedAPI } from './DragonBonesModuleLoader';import { withMalloc } from '../wasm/wasmScratch';-import { encodeUtf8 } from '../utf8';-import { log } from '../logger';+import { encodeUtf8 } from '../util/utf8';+import { log } from '../util/logger';/** Parse a `["a","b"]` the module published; a malformed one is no names, not a throw. */function parseNames(json: string): string[] {diff --git a/sdk/src/dragonbones/DragonBonesManager.ts b/sdk/src/dragonbones/DragonBonesManager.tsindex 0bfc9858b..f1cde0d46 100644--- a/sdk/src/dragonbones/DragonBonesManager.ts+++ b/sdk/src/dragonbones/DragonBonesManager.ts@@ -19,7 +19,7 @@ import type { Entity } from '../types';import { submitEntityMeshes, type SkeletalSubmitCore } from '../skeletal/submitMeshes';import type { SkeletalBounds } from '../skeletal/types';import { DragonBonesModuleController } from './DragonBonesController';-import { log } from '../logger';+import { log } from '../util/logger';/** How one entity's armature is posed and drawn. */interface EntityInfo {diff --git a/sdk/src/dragonbones/DragonBonesPlugin.ts b/sdk/src/dragonbones/DragonBonesPlugin.tsindex 60d2ca633..93bf454c4 100644--- a/sdk/src/dragonbones/DragonBonesPlugin.ts+++ b/sdk/src/dragonbones/DragonBonesPlugin.ts@@ -10,7 +10,7 @@* nothing is fetched until something asks for the manager, and an app* that never does never touches the side module at all.*/-import type { App, Plugin } from '../app';+import type { App, Plugin } from '../app/app';import { Schedule } from '../ecs/system';import type { SystemDef } from '../ecs/system';import type { Entity } from '../types';@@ -19,7 +19,7 @@ import { engineApi } from '../ecs/bridge/engineApi';import { DragonBonesManager } from './DragonBonesManager';import { DragonBonesModuleController } from './DragonBonesController';import { wrapDragonBonesModule, type DragonBonesWasmModule } from './DragonBonesModuleLoader';-import { log } from '../logger';+import { log } from '../util/logger';/** Reach the manager from a system or from gameplay code. Null until acquired. */export const DragonBones = defineResource<DragonBonesManager | null>(null, 'DragonBones');diff --git a/sdk/src/dragonbones/loadDragonBonesScene.ts b/sdk/src/dragonbones/loadDragonBonesScene.tsindex 4fa790ba6..49ec51140 100644--- a/sdk/src/dragonbones/loadDragonBonesScene.ts+++ b/sdk/src/dragonbones/loadDragonBonesScene.ts@@ -23,11 +23,11 @@*/import type { ESEngineModule } from '../wasm';import type { Entity } from '../types';-import { getComponentSkeletalFieldDescriptor, type SceneData } from '../scene';+import { getComponentSkeletalFieldDescriptor, type SceneData } from '../scene/scene';import { discoverSceneAssets } from '../asset/discoverAssets';import { getAssetTypeEntry } from '../assetTypes';import { requireResourceManager } from '../wasm/resourceManager';-import { log } from '../logger';+import { log } from '../util/logger';import { createTextureFromPixels, type RuntimeAssetSource } from '../runtime/runtimeAssets';import { isKtx2Path, type BasisTranscoder } from '../asset/compressed';import type { DragonBonesManager } from './DragonBonesManager';diff --git a/sdk/src/ecs/ScriptStorage.ts b/sdk/src/ecs/ScriptStorage.tsindex 784ca4bdd..961ea80c9 100644--- a/sdk/src/ecs/ScriptStorage.ts+++ b/sdk/src/ecs/ScriptStorage.ts@@ -7,8 +7,8 @@import { Entity } from '../types';import { ComponentDef } from './component';-import { validateComponentData, formatValidationErrors, assetFieldNames } from '../validation';-import { log } from '../logger';+import { validateComponentData, formatValidationErrors, assetFieldNames } from '../util/validation';+import { log } from '../util/logger';import { reorderMapByRank, type RankOf } from './entityOrder';export interface InsertResult<T> {diff --git a/sdk/src/ecs/bridge/BuiltinBridge.ts b/sdk/src/ecs/bridge/BuiltinBridge.tsindex 93da08786..e1e2693c0 100644--- a/sdk/src/ecs/bridge/BuiltinBridge.ts+++ b/sdk/src/ecs/bridge/BuiltinBridge.ts@@ -8,7 +8,7 @@import { Entity } from '../../types';import type { BuiltinComponentDef } from '../component';import type { CppRegistry, ESEngineModule } from '../../wasm';-import { validateComponentData, formatValidationErrors, assetFieldNames } from '../../validation';+import { validateComponentData, formatValidationErrors, assetFieldNames } from '../../util/validation';import { handleWasmError } from '../../wasm/wasmError';import { installAbortGuard, throwIfModuleAborted, isModuleAborted, WasmModuleAborted } from '../../wasm/moduleHealth';import { COMPONENT_META, ABI_LAYOUT_HASH } from '../component.generated';diff --git a/sdk/src/ecs/bridge/engineApi.ts b/sdk/src/ecs/bridge/engineApi.tsindex 4c8ed2bac..d8cf4ba37 100644--- a/sdk/src/ecs/bridge/engineApi.ts+++ b/sdk/src/ecs/bridge/engineApi.ts@@ -19,7 +19,7 @@* left a subsystem out.*/-import type { App } from '../../app';+import type { App } from '../../app/app';import type { NativeEngineApi } from './nativeEngineApi.generated';import type { NativeHeap } from './nativeHeap';diff --git a/sdk/src/ecs/bridge/nativeRuntime.ts b/sdk/src/ecs/bridge/nativeRuntime.tsindex 1bc157c9e..0b585520f 100644--- a/sdk/src/ecs/bridge/nativeRuntime.ts+++ b/sdk/src/ecs/bridge/nativeRuntime.ts@@ -10,13 +10,13 @@// authoring runs in the JS engine, writing the native C++ ECS, which the native// host renders. No wasm module: entity generations fall back to World's JS path.-import { App } from '../../app';+import { App } from '../../app/app';import { World } from '../world';import { inputPlugin } from '../../input/input';-import { prefabsPlugin } from '../../prefabServer';-import { sceneManagerPlugin } from '../../scenePlugin';+import { prefabsPlugin } from '../../prefab/prefabServer';+import { sceneManagerPlugin } from '../../scene/scenePlugin';import { headlessBasePlugins } from '../../runtime/webAppFactory';-import { presentationBasePlugins } from '../../pluginSets';+import { presentationBasePlugins } from '../../app/pluginSets';import { ensureBuiltinComponentsRegistered } from '../component';import { installNativePlatform, type NativeBridge } from '../../platform/native';import { createNativeRegistry } from './nativeRegistry';@@ -33,12 +33,12 @@ import { initDrawAPI } from '../../render/draw';import { initGeometryAPI } from '../../render/geometry';import { initMaterialAPI } from '../../render/material';import type { ESEngineModule } from '../../wasm';-import { log } from '../../logger';+import { log } from '../../util/logger';import { setRendererBackend } from '../../render/renderer';import { RenderPipeline } from '../../render/renderPipeline';import { cameraPlugin } from '../../camera/CameraPlugin';import { UICameraInfo } from '../../ui/core/ui-camera-info';-import { DEFAULT_UI_CAMERA_INFO } from '../../corePlugin';+import { DEFAULT_UI_CAMERA_INFO } from '../../app/corePlugin';import { uiPlugin } from '../../ui/ui-plugin';import { SpinePlugin } from '../../spine';import { DragonBonesPlugin } from '../../dragonbones';diff --git a/sdk/src/ecs/bridge/nativeSideModules.ts b/sdk/src/ecs/bridge/nativeSideModules.tsindex 8967da484..960e3759d 100644--- a/sdk/src/ecs/bridge/nativeSideModules.ts+++ b/sdk/src/ecs/bridge/nativeSideModules.ts@@ -23,11 +23,11 @@import { createSideModuleHost, type SideModuleHost, type SideModule } from '../../sideModules/host';import { SPINE_VERSIONS, spineModuleId, type SideModuleId } from '../../sideModules/registry';-import { log } from '../../logger';+import { log } from '../../util/logger';import { createNativeHeap, type NativeHeap } from './nativeHeap';// Not TextEncoder/TextDecoder: this file runs inside QuickJS on a device, which// has neither. See utf8.ts.-import { encodeUtf8, decodeUtf8 } from '../../utf8';+import { encodeUtf8, decodeUtf8 } from '../../util/utf8';/*** One global per subsystem that proves the host compiled it in. Picked from thediff --git a/sdk/src/ecs/commands.ts b/sdk/src/ecs/commands.tsindex 28b8ef922..1dc0ae9f8 100644--- a/sdk/src/ecs/commands.ts+++ b/sdk/src/ecs/commands.ts@@ -9,7 +9,7 @@ import { Entity } from '../types';import { AnyComponentDef, ComponentDef, isBuiltinComponent, Name } from './component';import type { World } from './world';import { ResourceDef, ResourceStorage } from './resource';-import { log } from '../logger';+import { log } from '../util/logger';// =============================================================================// Commands Descriptor (for system parameters)diff --git a/sdk/src/ecs/component.generated.ts b/sdk/src/ecs/component.generated.tsindex 6acea9cd8..08774c4b0 100644--- a/sdk/src/ecs/component.generated.ts+++ b/sdk/src/ecs/component.generated.ts@@ -4,7 +4,7 @@* @details Generated by EHT - DO NOT EDIT*/-import type { AssetFieldType } from '../scene';+import type { AssetFieldType } from '../scene/scene';import type { FieldMeta } from './component';import type { Color, Entity, Quat, Vec2, Vec3, Vec4 } from '../types';import type { Dimension, Padding } from '../wasm/wasm.generated';diff --git a/sdk/src/ecs/component.ts b/sdk/src/ecs/component.tsindex a843245dc..d482a137c 100644--- a/sdk/src/ecs/component.ts+++ b/sdk/src/ecs/component.ts@@ -6,7 +6,7 @@*/import { Entity, Vec2, Vec3, Color, Quat } from '../types';-import { deepClone } from '../deepClone';+import { deepClone } from '../util/deepClone';import { COMPONENT_META, type AssetFieldMeta, type SkeletalFieldMeta } from './component.generated';// C++-backed component data shapes, generated from the ES_COMPONENT structs (single// source — a TS field can no longer drift from C++). Re-exported below so the publicdiff --git a/sdk/src/ecs/entityEvents.ts b/sdk/src/ecs/entityEvents.tsindex 6d70f6057..4c97b7130 100644--- a/sdk/src/ecs/entityEvents.ts+++ b/sdk/src/ecs/entityEvents.ts@@ -21,8 +21,8 @@*/import { defineResource } from './resource';import type { Entity } from '../types';-import type { App } from '../app';-import { log } from '../logger';+import type { App } from '../app/app';+import { log } from '../util/logger';export interface EntityEvent<TData = unknown> {/** Event type string (e.g. `'click'`, `'change'`). */diff --git a/sdk/src/ecs/lifecycle.ts b/sdk/src/ecs/lifecycle.tsindex df3180306..37ebd397d 100644--- a/sdk/src/ecs/lifecycle.ts+++ b/sdk/src/ecs/lifecycle.ts@@ -6,9 +6,9 @@*/import { defineResource } from './resource';-import type { App, Plugin } from '../app';+import type { App, Plugin } from '../app/app';import { getPlatformType, platformOnAppShow, platformOnAppHide } from '../platform';-import { log } from '../logger';+import { log } from '../util/logger';// =============================================================================// Lifecycle Statediff --git a/sdk/src/ecs/resource.ts b/sdk/src/ecs/resource.tsindex f9d41c676..bb35dabaf 100644--- a/sdk/src/ecs/resource.ts+++ b/sdk/src/ecs/resource.ts@@ -5,7 +5,7 @@* @brief Resource system for global singleton data*/-import { deepClone } from '../deepClone';+import { deepClone } from '../util/deepClone';// =============================================================================// Resource Definitiondiff --git a/sdk/src/ecs/transaction.ts b/sdk/src/ecs/transaction.tsindex 6065dc81a..6f8c9f0da 100644--- a/sdk/src/ecs/transaction.ts+++ b/sdk/src/ecs/transaction.ts@@ -10,7 +10,7 @@* re-deriving state. TransactionManager holds the undo/redo stacks.*/-import { log } from '../logger';+import { log } from '../util/logger';// =============================================================================// Typesdiff --git a/sdk/src/ecs/world.ts b/sdk/src/ecs/world.tsindex 090f9be26..6e83042f8 100644--- a/sdk/src/ecs/world.ts+++ b/sdk/src/ecs/world.ts@@ -17,7 +17,7 @@ import { QueryCache, type QueryCacheStats } from './QueryCache';import { rankByOrder, reorderMapByRank } from './entityOrder';import { nativeEngineApi } from './bridge/engineApi';import { withScratch } from '../wasm/wasmScratch';-import { log } from '../logger';+import { log } from '../util/logger';import { getDefaultContext, type EditorBridge } from './context';/** The slice of a core {@link World.applyEntityOrder} needs: the entry point plusdiff --git a/sdk/src/eventBinding.ts b/sdk/src/eventBinding.tsindex cd619e46d..007e00b2b 100644--- a/sdk/src/eventBinding.ts+++ b/sdk/src/eventBinding.ts@@ -26,14 +26,14 @@*/import { defineComponent, Children, Name, Parent } from './ecs/component';import type { ChildrenData, NameData, ParentData } from './ecs/component';-import type { App, Plugin } from './app';+import type { App, Plugin } from './app/app';import type { Entity } from './types';import type { World } from './ecs/world';import { defineSystem, Schedule } from './ecs/system';import { Commands, type CommandsInstance } from './ecs/commands';import { Res, Time, type TimeData } from './ecs/resource';-import { playModeOnly } from './env';-import { log } from './logger';+import { playModeOnly } from './util/env';+import { log } from './util/logger';import { ensureEntityEvents, EntityEventQueue, type EntityEvent, type Unsubscribe } from './ecs/entityEvents';import { Blackboard } from './ai/fsm/Blackboard';import { aiRegistry, type AiContext } from './ai/fsm/AiContext';diff --git a/sdk/src/hotUpdateRebind.ts b/sdk/src/hotUpdateRebind.tsindex 711c8433c..4156b7046 100644--- a/sdk/src/hotUpdateRebind.ts+++ b/sdk/src/hotUpdateRebind.ts@@ -12,7 +12,7 @@* Registered once per App (initRuntime). State lives in this closure —* per install, not module-global — so realms don't share queues.*/-import type { App } from './app';+import type { App } from './app/app';import { Schedule, defineSystem } from './ecs/system';import { Query, Mut } from './ecs/query';import { Sprite, Mesh2D } from './ecs/component';diff --git a/sdk/src/i18n/LocalizationPlugin.ts b/sdk/src/i18n/LocalizationPlugin.tsindex fab624dce..6c7beebcd 100644--- a/sdk/src/i18n/LocalizationPlugin.ts+++ b/sdk/src/i18n/LocalizationPlugin.ts@@ -5,10 +5,10 @@* @brief Registers the per-App Localization resource. Opt-in: add it via* `app.addPlugin(localizationPlugin)` or with options.*/-import type { App, Plugin } from '../app';+import type { App, Plugin } from '../app/app';import { Schedule, defineSystem } from '../ecs/system';import { Assets } from '../asset/AssetPlugin';-import { log } from '../logger';+import { log } from '../util/logger';import { Localization, LocalizationAPI, type LocaleCatalog } from './Localization';export interface LocalizationOptions {diff --git a/sdk/src/input/input.ts b/sdk/src/input/input.tsindex a868f2a56..eebb51aa8 100644--- a/sdk/src/input/input.ts+++ b/sdk/src/input/input.ts@@ -2,7 +2,7 @@// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { defineResource } from '../ecs/resource';import { defineSystem, Schedule } from '../ecs/system';-import type { App, Plugin } from '../app';+import type { App, Plugin } from '../app/app';import { getPlatform, platformUnbindInputEvents } from '../platform';import type { GamepadSnapshot } from '../platform/types';import { inputRouter } from './inputRouter';diff --git a/sdk/src/input/inputMap.ts b/sdk/src/input/inputMap.tsindex 5f21ff0b0..05eb301ca 100644--- a/sdk/src/input/inputMap.ts+++ b/sdk/src/input/inputMap.ts@@ -15,7 +15,7 @@import { Schedule, defineSystem, addSystemToSchedule } from '../ecs/system';import { Res } from '../ecs/resource';import { Input, InputState, GamepadAxis, GamepadButton } from './input';-import { Storage } from '../storage';+import { Storage } from '../util/storage';// =============================================================================// Binding model (plain, serializable — also the rebind / persistence format)diff --git a/sdk/src/net/replication/ReplicationPlugin.ts b/sdk/src/net/replication/ReplicationPlugin.tsindex 58eb7dc69..62916e5c1 100644--- a/sdk/src/net/replication/ReplicationPlugin.ts+++ b/sdk/src/net/replication/ReplicationPlugin.ts@@ -9,7 +9,7 @@* not an environment flag: everything no-ops while NetRole stays* 'offline', so the plugin is safe to install unconditionally.*/-import type { App, Plugin } from '../../app';+import type { App, Plugin } from '../../app/app';import { defineSystem, Schedule } from '../../ecs/system';import { defineResource, Res, Time, type TimeData } from '../../ecs/resource';import type { NetTransport } from '../NetChannel';diff --git a/sdk/src/net/replication/client.ts b/sdk/src/net/replication/client.tsindex 8f1a361ca..3a693a264 100644--- a/sdk/src/net/replication/client.ts+++ b/sdk/src/net/replication/client.ts@@ -25,9 +25,9 @@ import type { World } from '../../ecs/world';import type { Entity } from '../../types';import { getComponent } from '../../ecs/component';import { ABI_LAYOUT_HASH } from '../../ecs/component.generated';-import { loadComponent } from '../../scene';+import { loadComponent } from '../../scene/scene';import { NetChannel, type NetTransport } from '../NetChannel';-import { log } from '../../logger';+import { log } from '../../util/logger';import {REPLICATION_CHANNEL, REPLICATION_PROTOCOL_VERSION, ReplMsg,type ReplAckMsg, type ReplDespawnBatch, type ReplHelloRequest, type ReplHelloResponse,diff --git a/sdk/src/net/replication/protocol.ts b/sdk/src/net/replication/protocol.tsindex 5c3bdf4ec..787dcbc9e 100644--- a/sdk/src/net/replication/protocol.ts+++ b/sdk/src/net/replication/protocol.ts@@ -9,7 +9,7 @@* layout). Version or schema drift refuses the connection at* handshake — never a silently mismatched simulation.*/-import type { SceneComponentData } from '../../scene';+import type { SceneComponentData } from '../../scene/scene';export const REPLICATION_PROTOCOL_VERSION = 2;diff --git a/sdk/src/net/replication/server.ts b/sdk/src/net/replication/server.tsindex 3eb27bab1..b1f7f1884 100644--- a/sdk/src/net/replication/server.ts+++ b/sdk/src/net/replication/server.ts@@ -20,9 +20,9 @@ import type { World } from '../../ecs/world';import type { Entity } from '../../types';import { Name, Parent, getComponent } from '../../ecs/component';import { ABI_LAYOUT_HASH } from '../../ecs/component.generated';-import { serializeEntityComponents, type SceneComponentData } from '../../scene';+import { serializeEntityComponents, type SceneComponentData } from '../../scene/scene';import { NetChannel, type NetTransport } from '../NetChannel';-import { log } from '../../logger';+import { log } from '../../util/logger';import {REPLICATION_CHANNEL, REPLICATION_PROTOCOL_VERSION, ReplMsg,type ReplAckMsg, type ReplDespawnBatch, type ReplHelloRequest, type ReplHelloResponse,diff --git a/sdk/src/particle/ParticlePlugin.ts b/sdk/src/particle/ParticlePlugin.tsindex 49af38848..f09fcda73 100644--- a/sdk/src/particle/ParticlePlugin.ts+++ b/sdk/src/particle/ParticlePlugin.ts@@ -1,13 +1,13 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { App, Plugin } from '../app';+import type { App, Plugin } from '../app/app';import { defineSystem, Schedule } from '../ecs/system';import { Res } from '../ecs/resource';import { Time, type TimeData } from '../ecs/resource';-import { fxPreviewOrPlayMode } from '../env';+import { fxPreviewOrPlayMode } from '../util/env';import type { CppRegistry } from '../wasm';import { engineApi } from '../ecs/bridge/engineApi';-import { registerSceneComponentCodec } from '../scene';+import { registerSceneComponentCodec } from '../scene/scene';import { Particle, ParticleAPI } from './ParticleAPI';import { bakeGradient, type Gradient } from './gradient';import { bakeCurve, type Curve } from './curve';diff --git a/sdk/src/physics/CharacterController.ts b/sdk/src/physics/CharacterController.tsindex df56d02e5..4e1f727ce 100644--- a/sdk/src/physics/CharacterController.ts+++ b/sdk/src/physics/CharacterController.ts@@ -20,13 +20,13 @@* Units: `velocity`/positions are world pixels (matching `Transform`); collider* dimensions are meters and are scaled to pixels via `PhysicsAPI.getPixelsPerUnit()`.*/-import type { App } from '../app';+import type { App } from '../app/app';import type { Entity, Vec2 } from '../types';import { defineComponent, Transform, type TransformData } from '../ecs/component';import { Schedule, defineSystem, GetWorld } from '../ecs/system';import { Query, Mut } from '../ecs/query';import { Res, Time, type TimeData } from '../ecs/resource';-import { playModeOnly } from '../env';+import { playModeOnly } from '../util/env';import { Physics, type PhysicsAPI } from './Physics';import { BoxCollider, CircleCollider, CapsuleCollider } from './PhysicsComponents';import type {diff --git a/sdk/src/physics/Physics.ts b/sdk/src/physics/Physics.tsindex e9badba0d..390f2f4af 100644--- a/sdk/src/physics/Physics.ts+++ b/sdk/src/physics/Physics.ts@@ -10,7 +10,7 @@* wasm module; instantiation before that throws.*/-import type { App } from '../app';+import type { App } from '../app/app';import type { Entity, Vec2 } from '../types';import { defineResource } from '../ecs/resource';import type { PhysicsWasmModule } from './PhysicsModuleLoader';diff --git a/sdk/src/physics/PhysicsDebugDraw.ts b/sdk/src/physics/PhysicsDebugDraw.tsindex a744db2ee..8fc857349 100644--- a/sdk/src/physics/PhysicsDebugDraw.ts+++ b/sdk/src/physics/PhysicsDebugDraw.ts@@ -1,6 +1,6 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { App } from '../app';+import type { App } from '../app/app';import type { Color } from '../types';import type { TransformData, CanvasData } from '../ecs/component';import type { ResourceDef } from '../ecs/resource';diff --git a/sdk/src/physics/PhysicsEventBridge.ts b/sdk/src/physics/PhysicsEventBridge.tsindex 841168305..93e954c13 100644--- a/sdk/src/physics/PhysicsEventBridge.ts+++ b/sdk/src/physics/PhysicsEventBridge.ts@@ -14,10 +14,10 @@* two roles (the area, and whoever walked into it) both routinely want to react;* each side receives the OTHER entity in the payload.*/-import type { App } from '../app';+import type { App } from '../app/app';import { Schedule, defineSystem } from '../ecs/system';import { Res } from '../ecs/resource';-import { playModeOnly } from '../env';+import { playModeOnly } from '../util/env';import { ensureEntityEvents } from '../ecs/entityEvents';import { PhysicsEvents, type PhysicsEventsData } from './PhysicsTypes';import type { Entity } from '../types';diff --git a/sdk/src/physics/PhysicsPlugin.ts b/sdk/src/physics/PhysicsPlugin.tsindex 43c595b69..2d76f4791 100644--- a/sdk/src/physics/PhysicsPlugin.ts+++ b/sdk/src/physics/PhysicsPlugin.ts@@ -11,7 +11,7 @@* system layer.*/-import type { Plugin, App } from '../app';+import type { Plugin, App } from '../app/app';import {loadPhysicsModule,type PhysicsWasmModule,diff --git a/sdk/src/physics/PhysicsSystem.ts b/sdk/src/physics/PhysicsSystem.tsindex cee8d5bfb..656ed5a1e 100644--- a/sdk/src/physics/PhysicsSystem.ts+++ b/sdk/src/physics/PhysicsSystem.ts@@ -10,13 +10,13 @@* the wasm module finishes loading.*/-import type { App } from '../app';+import type { App } from '../app/app';import type { Entity } from '../types';import type { TransformData, ParentData, CanvasData } from '../ecs/component';import { Transform, Parent, Canvas } from '../ecs/component';import { Res, Time, type TimeData } from '../ecs/resource';import { Schedule, defineSystem } from '../ecs/system';-import { playModeOnly } from '../env';+import { playModeOnly } from '../util/env';import type { PhysicsWasmModule } from './PhysicsModuleLoader';import { Physics } from './Physics';import {diff --git a/sdk/src/platform/minigame/adapter.ts b/sdk/src/platform/minigame/adapter.tsindex cd1b4be79..a4f8114c2 100644--- a/sdk/src/platform/minigame/adapter.ts+++ b/sdk/src/platform/minigame/adapter.ts@@ -27,7 +27,7 @@ import type {import type { PlatformAudioBackend } from '../../audio/PlatformAudioBackend';import type { PlatformVideoBackend, VideoBackendContext } from '../../video/PlatformVideoBackend';import { toBuildPath } from '../../assetTypes';-import { log } from '../../logger';+import { log } from '../../util/logger';import type { MiniGameGlobal, MiniGameProfile, MiniGameCanvas, MiniGameFileSystemManager, MiniGameTouchEvent } from './api';import { createPrimaryPointer } from '../primaryPointer';import { mgReadFileSync, mgReadTextFileSync, mgFileExistsSync } from './fs';diff --git a/sdk/src/platform/minigame/install.ts b/sdk/src/platform/minigame/install.tsindex b10e8c05c..41644ed09 100644--- a/sdk/src/platform/minigame/install.ts+++ b/sdk/src/platform/minigame/install.ts@@ -16,7 +16,7 @@ import { MiniGamePlatformAdapter } from './adapter';import { polyfillFetch } from './fetch';import { polyfillPerformance, polyfillTextEncoder } from './polyfills';import type { MiniGameProfile } from './api';-import { log } from '../../logger';+import { log } from '../../util/logger';let installed: string | null = null;diff --git a/sdk/src/platform/native/hostBridge.ts b/sdk/src/platform/native/hostBridge.tsindex 00f199c76..3bded7f00 100644--- a/sdk/src/platform/native/hostBridge.ts+++ b/sdk/src/platform/native/hostBridge.ts@@ -12,7 +12,7 @@* compiler, and identical on every platform the host runs on.*/-import { log } from '../../logger';+import { log } from '../../util/logger';import type {NativeAudioBridge, NativeBridge, NativeFetchResult, NativeInputListener,NativeTextEditorBridge, NativeTextEditorPush,diff --git a/sdk/src/postprocess/PostProcessPlugin.ts b/sdk/src/postprocess/PostProcessPlugin.tsindex 41d0f5008..3a1a30d10 100644--- a/sdk/src/postprocess/PostProcessPlugin.ts+++ b/sdk/src/postprocess/PostProcessPlugin.ts@@ -1,6 +1,6 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { App, Plugin } from '../app';+import type { App, Plugin } from '../app/app';import { Schedule } from '../ecs/system';import { Assets } from '../asset/AssetPlugin';import { PostProcess, PostProcessAPI } from './PostProcessAPI';diff --git a/sdk/src/prefab.ts b/sdk/src/prefab.tsindex 218b204f1..5fae2863e 100644--- a/sdk/src/prefab.ts+++ b/sdk/src/prefab.ts@@ -3,7 +3,7 @@import type { World } from './ecs/world';import type { Entity } from './types';import type { Assets } from './asset/Assets';-import { loadSceneWithAssets, SCENE_FORMAT_VERSION, type SceneData } from './scene';+import { loadSceneWithAssets, SCENE_FORMAT_VERSION, type SceneData } from './scene/scene';import {flattenPrefab,preloadNestedPrefabs,diff --git a/sdk/src/prefabServer.ts b/sdk/src/prefab/prefabServer.tssimilarity index 84%rename from sdk/src/prefabServer.tsrename to sdk/src/prefab/prefabServer.tsindex b7f256202..3acc88265 100644--- a/sdk/src/prefabServer.ts+++ b/sdk/src/prefab/prefabServer.ts@@ -1,17 +1,17 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { App, Plugin } from './app';-import type { World } from './ecs/world';-import type { Entity } from './types';-import type { Assets as AssetsClass } from './asset/Assets';-import { Assets } from './asset/AssetPlugin';-import { defineResource } from './ecs/resource';+import type { App, Plugin } from '../app/app';+import type { World } from '../ecs/world';+import type { Entity } from '../types';+import type { Assets as AssetsClass } from '../asset/Assets';+import { Assets } from '../asset/AssetPlugin';+import { defineResource } from '../ecs/resource';import {instantiatePrefab,type PrefabData,type PrefabOverride,type InstantiatePrefabResult,-} from './prefab';+} from '../prefab';export class PrefabServer {private readonly world_: World;diff --git a/sdk/src/preview/PreviewPlugin.ts b/sdk/src/preview/PreviewPlugin.tsindex 663f1d3f6..d3573a1ce 100644--- a/sdk/src/preview/PreviewPlugin.ts+++ b/sdk/src/preview/PreviewPlugin.ts@@ -5,18 +5,18 @@* @brief Plugin for editor preview functionality*/-import type { App, Plugin } from '../app';-import type { SceneData } from '../scene';+import type { App, Plugin } from '../app/app';+import type { SceneData } from '../scene/scene';import { loadRuntimeScene } from '../runtime/runtimeLoader';import { Transform, Camera, Canvas, ProjectionType, ClearFlags, type TransformData, type CameraData, type CanvasData } from '../ecs/component';import { DEFAULT_DESIGN_WIDTH, DEFAULT_DESIGN_HEIGHT } from '../defaults';import { platformFetch } from '../platform';-import { SceneManager } from '../sceneManager';+import { SceneManager } from '../scene/sceneManager';import { HttpBackend } from '../asset/Backend';import { fetchDecodePixels } from '../asset/imageDecode';import type { RuntimeAssetSource } from '../runtime/runtimeAssets';import { SpinePlugin } from '../spine/SpinePlugin';-import { log } from '../logger';+import { log } from '../util/logger';const PREVIEW_SCENE = '__preview__';diff --git a/sdk/src/render/draw.ts b/sdk/src/render/draw.tsindex 15fe98a08..48e2c28b7 100644--- a/sdk/src/render/draw.ts+++ b/sdk/src/render/draw.ts@@ -15,7 +15,7 @@ import { Material, isTextureRef, classifyUniformArity, type UniformValue, type Timport { BlendMode } from './blend';import { CoreApiBridge } from '../wasm/CoreApiBridge';import { handleWasmError } from '../wasm/wasmError';-import { log } from '../logger';+import { log } from '../util/logger';export { BlendMode } from './blend';diff --git a/sdk/src/render/mesh2d.ts b/sdk/src/render/mesh2d.tsindex 4121cd6dc..4daebd373 100644--- a/sdk/src/render/mesh2d.ts+++ b/sdk/src/render/mesh2d.ts@@ -5,14 +5,14 @@* engine (mesh2d_setGeometry) and carries it through scene save/load as an* out-of-band field (variable-size payloads are not C++ component fields).*/-import type { App, Plugin } from '../app';+import type { App, Plugin } from '../app/app';import type { Entity } from '../types';import type { CppRegistry } from '../wasm';import type { EngineApi } from '../ecs/bridge/engineApi';import { engineApi } from '../ecs/bridge/engineApi';import type { Mesh2DGeometry } from '../ecs/component';import { defineResource } from '../ecs/resource';-import { registerSceneComponentCodec } from '../scene';+import { registerSceneComponentCodec } from '../scene/scene';import { withScratch } from '../wasm/wasmScratch';function packRgba(colors: number[], v: number): number {diff --git a/sdk/src/render/renderPipeline.ts b/sdk/src/render/renderPipeline.tsindex d92515939..675bd17da 100644--- a/sdk/src/render/renderPipeline.ts+++ b/sdk/src/render/renderPipeline.ts@@ -16,7 +16,7 @@ import {getPreSceneDrawCallbacks,unregisterPreSceneDrawCallback,} from './customDraw';-import { log } from '../logger';+import { log } from '../util/logger';export interface Viewport {x: number;diff --git a/sdk/src/runtime/miniGameRuntime.ts b/sdk/src/runtime/miniGameRuntime.tsindex df0a8f362..aee0ed859 100644--- a/sdk/src/runtime/miniGameRuntime.ts+++ b/sdk/src/runtime/miniGameRuntime.ts@@ -25,8 +25,8 @@ import { MiniGamePlatformAdapter } from '../platform/minigame';import { loadPackagedAssetIndex, createPackagedAssetSource, applyAssetRefResolvers } from './packagedRuntime';import { createMiniGameSideModuleHost, type MiniGameSideModuleFactories } from '../sideModules';import type { Vec2 } from '../types';-import type { SceneData } from '../scene';-import { log } from '../logger';+import type { SceneData } from '../scene/scene';+import { log } from '../util/logger';// =============================================================================// Emscripten WASM Instantiationdiff --git a/sdk/src/runtime/nativeGameRuntime.ts b/sdk/src/runtime/nativeGameRuntime.tsindex 6582f8be3..4600b2cae 100644--- a/sdk/src/runtime/nativeGameRuntime.ts+++ b/sdk/src/runtime/nativeGameRuntime.ts@@ -15,16 +15,16 @@* before the async boot settles).*/-import type { App } from '../app';+import type { App } from '../app/app';import { initRuntime } from './runtimeLoader';import { createNativeApp } from '../ecs/bridge/nativeRuntime';import type { NativeBridge } from '../platform/native';import { platformReadTextFile } from '../platform';import { loadPackagedAssetIndex, createPackagedAssetSource, applyAssetRefResolvers, type PackagedGameConfig } from './packagedRuntime';-import type { SceneData } from '../scene';+import type { SceneData } from '../scene/scene';import type { ThemeOverrides } from '../ui';import { parseThemeOverrides } from '../ui';-import { log } from '../logger';+import { log } from '../util/logger';export interface NativeGameOptions {/** The host's capability bridge (packaged files, image decode, input). */diff --git a/sdk/src/runtime/packagedRuntime.ts b/sdk/src/runtime/packagedRuntime.tsindex e35475cb5..5b328012c 100644--- a/sdk/src/runtime/packagedRuntime.ts+++ b/sdk/src/runtime/packagedRuntime.ts@@ -21,7 +21,7 @@ import { FileSystemBackend, type Backend } from '../asset/Backend';import type { ParsedTextureImportSettings } from '../asset/textureImportSettings';import { Audio } from '../audio/Audio';import { VideoPlayer } from '../video/VideoAPI';-import type { App } from '../app';+import type { App } from '../app/app';import type { RuntimeAssetSource } from './runtimeAssets';/**diff --git a/sdk/src/runtime/playRealmRuntime.ts b/sdk/src/runtime/playRealmRuntime.tsindex 3584d4275..027def245 100644--- a/sdk/src/runtime/playRealmRuntime.ts+++ b/sdk/src/runtime/playRealmRuntime.ts@@ -15,7 +15,7 @@* so its defineComponent/defineSystem populate the registry this drains. This* entry only owns the runtime + snapshot + asset fetch.*/-import type { App } from '../app';+import type { App } from '../app/app';import type { ESEngineModule } from '../wasm';import { Audio } from '../audio/Audio';import { VideoPlayer } from '../video/VideoAPI';@@ -25,7 +25,7 @@ import type { RuntimeAssetSource } from './runtimeAssets';import { HttpBackend } from '../asset/Backend';import { Catalog, type CatalogData } from '../asset/Catalog';import { ManifestModel, type AddressableManifest } from '../asset/AddressableManifest';-import type { SceneData } from '../scene';+import type { SceneData } from '../scene/scene';import type { PhysicsPluginConfig } from '../physics/PhysicsPlugin';import type { AudioProjectConfig } from '../audio/AudioProjectConfig';import { fetchDecodePixels } from '../asset/imageDecode';diff --git a/sdk/src/runtime/playableRuntime.ts b/sdk/src/runtime/playableRuntime.tsindex 29d31cc01..a5a498e26 100644--- a/sdk/src/runtime/playableRuntime.ts+++ b/sdk/src/runtime/playableRuntime.ts@@ -10,7 +10,7 @@* self-gate off `app.sideModules` exactly as in every other realm. This* entry only owns the embedded asset source + the runtime boot.*/-import type { App } from '../app';+import type { App } from '../app/app';import type { ESEngineModule } from '../wasm';import type { AudioProjectConfig } from '../audio/AudioProjectConfig';import { initRuntime } from './runtimeLoader';@@ -19,7 +19,7 @@ import type { RuntimeAssetSource } from './runtimeAssets';import { EmbeddedBackend } from '../asset/Backend';import { ManifestModel, type AddressableManifest } from '../asset/AddressableManifest';import type { Vec2 } from '../types';-import type { SceneData } from '../scene';+import type { SceneData } from '../scene/scene';import { Audio } from '../audio/Audio';import { VideoPlayer } from '../video/VideoAPI';diff --git a/sdk/src/runtime/runtimeAssets.ts b/sdk/src/runtime/runtimeAssets.tsindex 94af3e64a..eff1be3e3 100644--- a/sdk/src/runtime/runtimeAssets.ts+++ b/sdk/src/runtime/runtimeAssets.ts@@ -7,10 +7,10 @@* builder runtime loader and the spine scene loader (and any editor that* drives the same load path). Kept in its own module so neither the* runtime loader nor the spine loader has to import the other.-import { linearColorSpace } from '../env';+import { linearColorSpace } from '../util/env';*/import type { ESEngineModule } from '../wasm';-import { linearColorSpace } from '../env';+import { linearColorSpace } from '../util/env';import type { Backend } from '../asset/Backend';import type { ParsedTextureImportSettings } from '../asset/textureImportSettings';import { requireResourceManager } from '../wasm/resourceManager';diff --git a/sdk/src/runtime/runtimeLoader.ts b/sdk/src/runtime/runtimeLoader.tsindex ef6c92d85..bb8b55708 100644--- a/sdk/src/runtime/runtimeLoader.ts+++ b/sdk/src/runtime/runtimeLoader.ts@@ -6,7 +6,7 @@*/import { SceneOwner } from '../ecs/component';-import { loadSceneData, updateCameraAspectRatio, sceneHasPrefabEntries, expandScenePrefabs, type SceneData } from '../scene';+import { loadSceneData, updateCameraAspectRatio, sceneHasPrefabEntries, expandScenePrefabs, type SceneData } from '../scene/scene';import type { PrefabData } from '../prefab/types';import { switchTheme, resolveThemeTokens, type ThemeOverrides } from '../ui';import { discoverSceneAssets } from '../asset/discoverAssets';@@ -17,13 +17,13 @@ import type { PhysicsWasmModule } from '../physics/PhysicsModuleLoader';import { PhysicsPlugin, type PhysicsPluginConfig } from '../physics/PhysicsPlugin';import { applyAudioProjectConfig, type AudioProjectConfig } from '../audio/AudioProjectConfig';import { SpinePlugin } from '../spine/SpinePlugin';-import type { App } from '../app';+import type { App } from '../app/app';import { Assets as AssetsClass } from '../asset/Assets';import { Assets as AssetsResource } from '../asset/AssetPlugin';import { transcoderFromModule, type BasisWasmModule } from '../asset/basisTranscoder';import type { BasisTranscoder } from '../asset/compressed';import type { TextureImportSettings } from '../asset/loaders/TextureLoader';-import { SceneManager, type SceneConfig } from '../sceneManager';+import { SceneManager, type SceneConfig } from '../scene/sceneManager';import { DEFAULT_GRAVITY, DEFAULT_FIXED_TIMESTEP } from '../defaults';import { SpriteAnimation } from '../animation/SpriteAnimator';import { Audio } from '../audio/Audio';@@ -31,10 +31,10 @@ import { VideoPlayer } from '../video/VideoAPI';import { Localization, matchLocale } from '../i18n/Localization';import { LocalizationPlugin } from '../i18n/LocalizationPlugin';import { platformLanguage } from '../platform';-import { flushPendingSystems } from '../app';+import { flushPendingSystems } from '../app/app';import { installHotUpdateRebind } from '../hotUpdateRebind';import { requireResourceManager } from '../wasm/resourceManager';-import { log } from '../logger';+import { log } from '../util/logger';import { type RuntimeAssetSource, type TextureParams } from './runtimeAssets';import { loadSpineAssets, applySpineEntities, type SpineAssetInfo } from '../spine/loadSpineScene';import { DragonBonesPlugin } from '../dragonbones/DragonBonesPlugin';diff --git a/sdk/src/runtime/webAppFactory.ts b/sdk/src/runtime/webAppFactory.tsindex 6d3939b06..a3af1a0c1 100644--- a/sdk/src/runtime/webAppFactory.ts+++ b/sdk/src/runtime/webAppFactory.ts@@ -1,13 +1,13 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import { App, createWebApp as _createWebApp, type Plugin, type WebAppOptions } from '../app';+import { App, createWebApp as _createWebApp, type Plugin, type WebAppOptions } from '../app/app';import type { CppRegistry, ESEngineModule } from '../wasm';import { assetPlugin } from '../asset';-import { prefabsPlugin } from '../prefabServer';-import { sceneManagerPlugin } from '../scenePlugin';+import { prefabsPlugin } from '../prefab/prefabServer';+import { sceneManagerPlugin } from '../scene/scenePlugin';import { seedEngineComponents } from '../ecs/component';-import { uiPlugins } from '../uiPlugins';-import { simulationBasePlugins, webBasePlugins } from '../pluginSets';+import { uiPlugins } from '../app/uiPlugins';+import { simulationBasePlugins, webBasePlugins } from '../app/pluginSets';import { SpinePlugin } from '../spine';import { DragonBonesPlugin } from '../dragonbones';import { createFetchSideModuleHost, type SideModuleHost } from '../sideModules';diff --git a/sdk/src/scene/SceneTransitionController.ts b/sdk/src/scene/SceneTransitionController.tsindex 8136b04de..1827cddd2 100644--- a/sdk/src/scene/SceneTransitionController.ts+++ b/sdk/src/scene/SceneTransitionController.ts@@ -12,7 +12,7 @@import type { Color } from '../types';import { registerDrawCallback, unregisterDrawCallback } from '../render/customDraw';import { Draw } from '../render/draw';-import { log } from '../logger';+import { log } from '../util/logger';export interface FadeTransitionOptions {readonly duration: number;diff --git a/sdk/src/saveGame.ts b/sdk/src/scene/saveGame.tssimilarity index 98%rename from sdk/src/saveGame.tsrename to sdk/src/scene/saveGame.tsindex 861467305..b36bd3fc2 100644--- a/sdk/src/saveGame.ts+++ b/sdk/src/scene/saveGame.ts@@ -8,7 +8,7 @@* shipped game can evolve its save shape without bricking old saves.*/-import { Storage } from './storage';+import { Storage } from '../util/storage';export interface SaveEnvelope<T> {/** Schema version the `data` was written at. */diff --git a/sdk/src/scene.ts b/sdk/src/scene/scene.tssimilarity index 97%rename from sdk/src/scene.tsrename to sdk/src/scene/scene.tsindex 219340865..1ee36d2ba 100644--- a/sdk/src/scene.ts+++ b/sdk/src/scene/scene.ts@@ -5,15 +5,15 @@* @brief Scene loading utilities*/-import { World } from './ecs/world';-import { Entity, INVALID_ENTITY } from './types';-import { getComponent, Name, Camera, RuntimeOnly } from './ecs/component';-import { deepClone } from './deepClone';-import { discoverSceneAssets } from './asset/discoverAssets';-import { requireResourceManager } from './wasm/resourceManager';-import { validateComponentData, formatValidationErrors, assetFieldNames } from './validation';-import { log } from './logger';-import { ESTELLA_SCENE_GENERATOR } from './provenance';+import { World } from '../ecs/world';+import { Entity, INVALID_ENTITY } from '../types';+import { getComponent, Name, Camera, RuntimeOnly } from '../ecs/component';+import { deepClone } from '../util/deepClone';+import { discoverSceneAssets } from '../asset/discoverAssets';+import { requireResourceManager } from '../wasm/resourceManager';+import { validateComponentData, formatValidationErrors, assetFieldNames } from '../util/validation';+import { log } from '../util/logger';+import { ESTELLA_SCENE_GENERATOR } from '../util/provenance';import {expandEntry,preloadNestedPrefabs,@@ -21,7 +21,7 @@ import {type PrefabData,type PrefabInstanceEntry,type ProcessedEntity,-} from './prefab/index';+} from '../prefab/index';// =============================================================================// Types@@ -72,10 +72,10 @@ export interface LoadedSceneAssets {export type SceneLoadProgressCallback = (loaded: number, total: number) => void;-export type MissingAssetCallback = (missing: import('./asset/Assets').MissingAsset[]) => void;+export type MissingAssetCallback = (missing: import('../asset/Assets').MissingAsset[]) => void;export interface SceneLoadOptions {- assets?: import('./asset/Assets').Assets;+ assets?: import('../asset/Assets').Assets;assetBaseUrl?: string;collectAssets?: LoadedSceneAssets;onProgress?: SceneLoadProgressCallback;@@ -94,8 +94,8 @@ export interface SceneLoadOptions {}export class MissingAssetsError extends Error {- readonly missing: import('./asset/Assets').MissingAsset[];- constructor(missing: import('./asset/Assets').MissingAsset[]) {+ readonly missing: import('../asset/Assets').MissingAsset[];+ constructor(missing: import('../asset/Assets').MissingAsset[]) {super(`Scene load aborted: ${missing.length} asset(s) missing`);this.name = 'MissingAssetsError';this.missing = missing;diff --git a/sdk/src/sceneManager.ts b/sdk/src/scene/sceneManager.tssimilarity index 97%rename from sdk/src/sceneManager.tsrename to sdk/src/scene/sceneManager.tsindex 792d3a459..55404b9c6 100644--- a/sdk/src/sceneManager.ts+++ b/sdk/src/scene/sceneManager.ts@@ -5,28 +5,28 @@* @brief Scene management system for loading, switching, and unloading scenes*/-import type { App } from './app';-import type { Entity, Color } from './types';+import type { App } from '../app/app';+import type { Entity, Color } from '../types';import type { SceneData, SceneLoadOptions, LoadedSceneAssets, SceneLoadProgressCallback } from './scene';-import { discoverSceneAssets } from './asset/discoverAssets';-import type { SystemDef } from './ecs/system';-import { Material } from './render/material';-import type { DrawCallback } from './render/customDraw';-import { Schedule } from './ecs/system';+import { discoverSceneAssets } from '../asset/discoverAssets';+import type { SystemDef } from '../ecs/system';+import { Material } from '../render/material';+import type { DrawCallback } from '../render/customDraw';+import { Schedule } from '../ecs/system';import { loadSceneWithAssets } from './scene';-import { registerDrawCallback, unregisterDrawCallback } from './render/customDraw';-import { PostProcess, PostProcessStack } from './postprocess';-import { defineResource } from './ecs/resource';-import { SceneTransitionController } from './scene/SceneTransitionController';+import { registerDrawCallback, unregisterDrawCallback } from '../render/customDraw';+import { PostProcess, PostProcessStack } from '../postprocess';+import { defineResource } from '../ecs/resource';+import { SceneTransitionController } from './SceneTransitionController';import {SceneOwner, Disabled, Sprite, SpineAnimation, BitmapText,ShapeRenderer, ParticleEmitter,type AnyComponentDef,-} from './ecs/component';-import { UIVisual } from './ui/core/ui-visual';-import { Assets } from './asset/AssetPlugin';-import { RuntimeConfig } from './defaults';-import { log } from './logger';+} from '../ecs/component';+import { UIVisual } from '../ui/core/ui-visual';+import { Assets } from '../asset/AssetPlugin';+import { RuntimeConfig } from '../defaults';+import { log } from '../util/logger';const RENDERABLE_COMPONENTS: AnyComponentDef[] = [Sprite, SpineAnimation, BitmapText, ShapeRenderer, ParticleEmitter, UIVisual,diff --git a/sdk/src/scenePlugin.ts b/sdk/src/scene/scenePlugin.tssimilarity index 84%rename from sdk/src/scenePlugin.tsrename to sdk/src/scene/scenePlugin.tsindex 4acf73adc..fe1f6d55d 100644--- a/sdk/src/scenePlugin.ts+++ b/sdk/src/scene/scenePlugin.ts@@ -5,16 +5,16 @@* @brief Plugin that provides scene management capabilities*/-import type { App, Plugin } from './app';+import type { App, Plugin } from '../app/app';import { SceneManager, SceneManagerState } from './sceneManager';import { SceneStreaming, SceneStreamingController } from './sceneStreaming';-import { defineSystem, Schedule, GetWorld } from './ecs/system';-import { Res, ResMut, Time } from './ecs/resource';-import { Transform, type TransformData } from './ecs/component';-import { playModeOnly } from './env';-import type { SystemDef } from './ecs/system';-import type { World } from './ecs/world';-import { log } from './logger';+import { defineSystem, Schedule, GetWorld } from '../ecs/system';+import { Res, ResMut, Time } from '../ecs/resource';+import { Transform, type TransformData } from '../ecs/component';+import { playModeOnly } from '../util/env';+import type { SystemDef } from '../ecs/system';+import type { World } from '../ecs/world';+import { log } from '../util/logger';const sceneTransitionSystem = defineSystem([ResMut(SceneManager), Res(Time)],diff --git a/sdk/src/sceneStreaming.ts b/sdk/src/scene/sceneStreaming.tssimilarity index 98%rename from sdk/src/sceneStreaming.tsrename to sdk/src/scene/sceneStreaming.tsindex 8128a7729..9024f633f 100644--- a/sdk/src/sceneStreaming.ts+++ b/sdk/src/scene/sceneStreaming.ts@@ -11,8 +11,8 @@* thrash. This is pure orchestration — it owns no loading itself, only calls the* existing `loadAdditive`/`unload`/`sleep`/`wake` primitives.*/-import { defineResource } from './ecs/resource';-import type { Entity } from './types';+import { defineResource } from '../ecs/resource';+import type { Entity } from '../types';/** A streamable cell: an additive scene with a world-space center + radius. */export interface StreamCell {diff --git a/sdk/src/sceneTransition.ts b/sdk/src/scene/sceneTransition.tssimilarity index 91%rename from sdk/src/sceneTransition.tsrename to sdk/src/scene/sceneTransition.tsindex 36118c935..05520537d 100644--- a/sdk/src/sceneTransition.ts+++ b/sdk/src/scene/sceneTransition.ts@@ -5,8 +5,8 @@* @brief Convenience wrapper for scene transitions*/-import type { App } from './app';-import type { Color } from './types';+import type { App } from '../app/app';+import type { Color } from '../types';import { SceneManager, SceneManagerState } from './sceneManager';export interface TransitionConfig {diff --git a/sdk/src/sideModules/host.ts b/sdk/src/sideModules/host.tsindex e941e4e18..24b76369f 100644--- a/sdk/src/sideModules/host.ts+++ b/sdk/src/sideModules/host.ts@@ -11,7 +11,7 @@* *transport* as an {@link SideModuleInstantiator}; the fetch / embedded* / WeChat transports live in sibling files.*/-import { log } from '../logger';+import { log } from '../util/logger';import { SIDE_MODULES, type SideModuleDescriptor, type SideModuleId } from './registry';/** The instantiated emscripten module. Consumers cwrap their own `_*` exports. */diff --git a/sdk/src/spine/ModuleBackend.ts b/sdk/src/spine/ModuleBackend.tsindex 4fbc314f0..b2a9b6549 100644--- a/sdk/src/spine/ModuleBackend.ts+++ b/sdk/src/spine/ModuleBackend.ts@@ -5,7 +5,7 @@ import type { CppRegistry } from '../wasm';import type { EngineApi } from '../ecs/bridge/engineApi';import type { SpineModuleController } from './SpineController';import type { RawSpineEvent, ConstraintList, TransformMixData, PathMixData } from './SpineController';-import { log } from '../logger';+import { log } from '../util/logger';import { submitEntityMeshes } from '../skeletal/submitMeshes';interface EntityInfo {diff --git a/sdk/src/spine/SpineController.ts b/sdk/src/spine/SpineController.tsindex 865c15087..2a45f18de 100644--- a/sdk/src/spine/SpineController.ts+++ b/sdk/src/spine/SpineController.ts@@ -8,7 +8,7 @@import type { Entity, Vec2 } from '../types';import type { SpineWasmModule, SpineWrappedAPI } from './SpineModuleLoader';import { SpineModuleBridge } from './SpineBridge';-import { log } from '../logger';+import { log } from '../util/logger';import { withMalloc, withScratch } from '../wasm/wasmScratch';import { forEachMeshBatch, type MeshBatchVisitor } from '../skeletal/meshBatches';diff --git a/sdk/src/spine/SpineManager.ts b/sdk/src/spine/SpineManager.tsindex 06073cb4e..cae1e0a2d 100644--- a/sdk/src/spine/SpineManager.ts+++ b/sdk/src/spine/SpineManager.ts@@ -8,7 +8,7 @@ import type { SpineModuleFactory } from './SpineModuleLoader';import { wrapSpineModule } from './SpineModuleLoader';import { SpineModuleController } from './SpineController';import { ModuleBackend } from './ModuleBackend';-import { log } from '../logger';+import { log } from '../util/logger';import type { SpineVersion } from '../sideModules/registry';diff --git a/sdk/src/spine/SpineModuleLoader.ts b/sdk/src/spine/SpineModuleLoader.tsindex 72fc962a5..9c829671f 100644--- a/sdk/src/spine/SpineModuleLoader.ts+++ b/sdk/src/spine/SpineModuleLoader.ts@@ -5,7 +5,7 @@* @brief Loads and initializes the standalone Spine WASM module*/-import { log } from '../logger';+import { log } from '../util/logger';export interface SpineWasmModule {_spine_loadSkeleton(skelDataPtr: number, skelDataLen: number, atlasText: number, atlasLen: number, isBinary: number): number;diff --git a/sdk/src/spine/SpinePlugin.ts b/sdk/src/spine/SpinePlugin.tsindex 1fcdb81cb..c29a43d82 100644--- a/sdk/src/spine/SpinePlugin.ts+++ b/sdk/src/spine/SpinePlugin.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { Plugin } from '../app';-import type { App } from '../app';+import type { Plugin } from '../app/app';+import type { App } from '../app/app';import { defineResource, Time } from '../ecs/resource';import { Schedule } from '../ecs/system';import type { SystemDef } from '../ecs/system';diff --git a/sdk/src/spine/loadSpineScene.ts b/sdk/src/spine/loadSpineScene.tsindex 4fe820106..eaf9e4179 100644--- a/sdk/src/spine/loadSpineScene.ts+++ b/sdk/src/spine/loadSpineScene.ts@@ -18,11 +18,11 @@*/import type { ESEngineModule } from '../wasm';import type { Entity } from '../types';-import { getComponentSkeletalFieldDescriptor, type SceneData } from '../scene';+import { getComponentSkeletalFieldDescriptor, type SceneData } from '../scene/scene';import { discoverSceneAssets } from '../asset/discoverAssets';import { getAssetTypeEntry } from '../assetTypes';import { requireResourceManager } from '../wasm/resourceManager';-import { log } from '../logger';+import { log } from '../util/logger';import { SpineManager, type SpineVersion } from './SpineManager';import { parseSpineAtlasPages } from './atlasPages';import { createTextureFromPixels, type RuntimeAssetSource } from '../runtime/runtimeAssets';diff --git a/sdk/src/stats.ts b/sdk/src/stats.tsindex 41350c5dc..b481f1815 100644--- a/sdk/src/stats.ts+++ b/sdk/src/stats.ts@@ -3,7 +3,7 @@import { Renderer } from './render/renderer';import { defineResource, Res, Time } from './ecs/resource';import { defineSystem, GetWorld, Schedule } from './ecs/system';-import type { App, Plugin } from './app';+import type { App, Plugin } from './app/app';import { StatsOverlay, type StatsPosition } from './stats-overlay';export interface FrameStats {diff --git a/sdk/src/tilemap/tiledLoader.ts b/sdk/src/tilemap/tiledLoader.tsindex 41310f7f7..06c6638ee 100644--- a/sdk/src/tilemap/tiledLoader.ts+++ b/sdk/src/tilemap/tiledLoader.ts@@ -43,7 +43,7 @@ import type { ResolvedTileCollision } from './tilesetResolve';import { mergeCollisionTiles } from './collisionMerge';import { CHUNK_SIZE } from './chunkCodec';import { tileIdOf, tileFlagsOf } from './tileBits';-import { log } from '../logger';+import { log } from '../util/logger';import { resolveRelativePath, resolveTiledRef, isLogicalAssetRef } from './tiledPath';export interface TiledChunkData {diff --git a/sdk/src/tilemap/tilemapPlugin.ts b/sdk/src/tilemap/tilemapPlugin.tsindex a96c36cb7..5c5342c26 100644--- a/sdk/src/tilemap/tilemapPlugin.ts+++ b/sdk/src/tilemap/tilemapPlugin.ts@@ -1,6 +1,6 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { App, Plugin } from '../app';+import type { App, Plugin } from '../app/app';import { engineApi } from '../ecs/bridge/engineApi';import { Transform, TilemapLayer, Sprite, Canvas, RuntimeOnly, Marker, type TilemapLayerData } from '../ecs/component';import { Schedule } from '../ecs/system';@@ -8,7 +8,7 @@ import type { SystemDef } from '../ecs/system';import { initTilemapAPI, shutdownTilemapAPI, TilemapAPI } from './tilemapAPI';import { TilemapLiveSync } from './tilemapLiveSync';import { Tilemap } from './components';-import { registerSceneComponentCodec } from '../scene';+import { registerSceneComponentCodec } from '../scene/scene';import { getTilemapSource, getResolvedTileset, type LoadedTilemapSource } from './tilesetCache';import { resolveTilesetModel } from './tilesetResolve';import { isCollisionPaletteRef, buildCollisionPaletteModel, parseCollisionMaterial } from './collisionPalette';@@ -22,8 +22,8 @@ import { decodeTilemapChunks } from './chunkCodec';import { Assets } from '../asset/AssetPlugin';import { resolveAssetKey } from '../asset/resolveAssetKey';import { Time } from '../ecs/resource';-import { playModeOnly } from '../env';-import { log } from '../logger';+import { playModeOnly } from '../util/env';+import { log } from '../util/logger';import type { Entity } from '../types';const GRID_TYPE_MAP: Record<string, number> = {diff --git a/sdk/src/timeline/TimelineLoader.ts b/sdk/src/timeline/TimelineLoader.tsindex 4b27c4d26..776e3bf74 100644--- a/sdk/src/timeline/TimelineLoader.ts+++ b/sdk/src/timeline/TimelineLoader.ts@@ -14,7 +14,7 @@ import {type CustomEventTrack,type AnimFramesTrack,} from './TimelineTypes';-import { log } from '../logger';+import { log } from '../util/logger';const CURRENT_VERSION = '1.1';diff --git a/sdk/src/timeline/TimelinePlugin.ts b/sdk/src/timeline/TimelinePlugin.tsindex b1111524e..59d9d46e1 100644--- a/sdk/src/timeline/TimelinePlugin.ts+++ b/sdk/src/timeline/TimelinePlugin.ts@@ -1,11 +1,11 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { App, Plugin } from '../app';+import type { App, Plugin } from '../app/app';import { defineSystem, Schedule } from '../ecs/system';import { Res } from '../ecs/resource';import { Time, type TimeData } from '../ecs/resource';import { defineComponent, getComponent } from '../ecs/component';-import { playModeOnly } from '../env';+import { playModeOnly } from '../util/env';import { Assets } from '../asset/AssetPlugin';import { resolveAssetKey } from '../asset/resolveAssetKey';import { Audio, type AudioAPI } from '../audio/Audio';diff --git a/sdk/src/trail/TrailPlugin.ts b/sdk/src/trail/TrailPlugin.tsindex 5ff7ffe9e..f530e717d 100644--- a/sdk/src/trail/TrailPlugin.ts+++ b/sdk/src/trail/TrailPlugin.ts@@ -1,10 +1,10 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { App, Plugin } from '../app';+import type { App, Plugin } from '../app/app';import { defineSystem, Schedule } from '../ecs/system';import { Res } from '../ecs/resource';import { Time, type TimeData } from '../ecs/resource';-import { fxPreviewOrPlayMode } from '../env';+import { fxPreviewOrPlayMode } from '../util/env';import type { CppRegistry } from '../wasm';import { engineApi } from '../ecs/bridge/engineApi';import { TrailRenderer } from '../ecs/component';diff --git a/sdk/src/ui/behavior/plugin.ts b/sdk/src/ui/behavior/plugin.tsindex edfb5d633..8cd75c697 100644--- a/sdk/src/ui/behavior/plugin.ts+++ b/sdk/src/ui/behavior/plugin.ts@@ -1,11 +1,11 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { App, Plugin } from '../../app';+import type { App, Plugin } from '../../app/app';import { Res, Time, type TimeData } from '../../ecs/resource';import { defineSystem, Schedule } from '../../ecs/system';import { Input, type InputState } from '../../input/input';import { Transform, type TransformData } from '../../ecs/component';-import { playModeOnly } from '../../env';+import { playModeOnly } from '../../util/env';import type { Entity, Vec2 } from '../../types';import { UIEvents, UIEventQueue } from '../core/events';diff --git a/sdk/src/ui/collection/data-source.ts b/sdk/src/ui/collection/data-source.tsindex 8bbd17659..491a896a1 100644--- a/sdk/src/ui/collection/data-source.ts+++ b/sdk/src/ui/collection/data-source.ts@@ -1,6 +1,6 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import { log } from '../../logger';+import { log } from '../../util/logger';/*** Change notification emitted by a DataSource.diff --git a/sdk/src/ui/collection/list-view.ts b/sdk/src/ui/collection/list-view.tsindex db040d122..3c3e1d94e 100644--- a/sdk/src/ui/collection/list-view.ts+++ b/sdk/src/ui/collection/list-view.ts@@ -7,7 +7,7 @@ import type { World } from '../../ecs/world';import type { DataSource } from './data-source';import type { LayoutProvider, Rect } from './layout-provider';import { ViewPool, type ViewPoolTemplate } from './view-pool';-import { log } from '../../logger';+import { log } from '../../util/logger';export interface ListViewItemTemplate<T = unknown> extends ViewPoolTemplate<T> {}diff --git a/sdk/src/ui/collection/scroll-container.ts b/sdk/src/ui/collection/scroll-container.tsindex 764fb4402..c3f52ef81 100644--- a/sdk/src/ui/collection/scroll-container.ts+++ b/sdk/src/ui/collection/scroll-container.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport type { Vec2 } from '../../types';-import { log } from '../../logger';+import { log } from '../../util/logger';export interface ScrollContainerOptions {viewportSize: Vec2;diff --git a/sdk/src/ui/controller/plugin.ts b/sdk/src/ui/controller/plugin.tsindex 4dba48a7d..b4614ef83 100644--- a/sdk/src/ui/controller/plugin.ts+++ b/sdk/src/ui/controller/plugin.ts@@ -10,7 +10,7 @@* (no UIInteraction is written outside play), while gear-apply still reflects each* controller's authored `current` page — that is the editor's live preview.*/-import type { App, Plugin } from '../../app';+import type { App, Plugin } from '../../app/app';import { Schedule } from '../../ecs/system';import { SystemLabel } from '../../ecs/systemLabels';import { createGearApplySystem, createInteractionControllerDriverSystem } from './gear-apply';diff --git a/sdk/src/ui/index.ts b/sdk/src/ui/index.tsindex d5d5e9c67..ec0234a5a 100644--- a/sdk/src/ui/index.ts+++ b/sdk/src/ui/index.ts@@ -424,7 +424,7 @@ export {getEntityProperty,setEntityProperty,type ParsedPropertyPath,-} from '../propertyPath';+} from '../util/propertyPath';// Rich Textexport {diff --git a/sdk/src/ui/input/drag.ts b/sdk/src/ui/input/drag.tsindex 15f6a57cc..97a2fcd82 100644--- a/sdk/src/ui/input/drag.ts+++ b/sdk/src/ui/input/drag.ts@@ -1,6 +1,6 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { App, Plugin } from '../../app';+import type { App, Plugin } from '../../app/app';import { registerComponent, Transform, Parent, Sprite } from '../../ecs/component';import type { TransformData, ParentData, SpriteData } from '../../ecs/component';import { UINode } from '../core/ui-node';@@ -19,7 +19,7 @@ import type { UIInteractionData } from './interactable';import { UIEvents, UIEventQueue } from '../core/events';import { UICameraInfo } from '../core/ui-camera-info';import type { UICameraData } from '../core/ui-camera-info';-import { playModeOnly } from '../../env';+import { playModeOnly } from '../../util/env';import { getEntityDepth } from '../util/helpers';import { SystemLabel, PluginName } from '../../ecs/systemLabels';import { quaternionToAngle2D } from '../util/math';diff --git a/sdk/src/ui/input/focus.ts b/sdk/src/ui/input/focus.tsindex 4a30c3571..c7220d8b7 100644--- a/sdk/src/ui/input/focus.ts+++ b/sdk/src/ui/input/focus.ts@@ -1,6 +1,6 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { App, Plugin } from '../../app';+import type { App, Plugin } from '../../app/app';import { registerComponent } from '../../ecs/component';import { defineSystem, Schedule } from '../../ecs/system';import { Res } from '../../ecs/resource';@@ -16,7 +16,7 @@ import type { UIInteractionData } from './interactable';import { TextInput } from '../text/text-input';import { UIDialog, isDialogOpen } from '../behavior/dialog';import { walkParentChain } from '../util/helpers';-import { playModeOnly } from '../../env';+import { playModeOnly } from '../../util/env';import { UIEvents, UIEventQueue, UIEventType } from '../core/events';import { PluginName } from '../../ecs/systemLabels';import type { CppRegistry } from '../../wasm';diff --git a/sdk/src/ui/input/interaction.ts b/sdk/src/ui/input/interaction.tsindex 76a37ea1c..6819e041b 100644--- a/sdk/src/ui/input/interaction.ts+++ b/sdk/src/ui/input/interaction.ts@@ -1,6 +1,6 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { App, Plugin } from '../../app';+import type { App, Plugin } from '../../app/app';import { registerComponent, Transform } from '../../ecs/component';import { defineSystem, Schedule } from '../../ecs/system';import { Res } from '../../ecs/resource';@@ -8,7 +8,7 @@ import { Input } from '../../input/input';import type { InputState } from '../../input/input';import type { Entity } from '../../types';import type { World } from '../../ecs/world';-import { playModeOnly } from '../../env';+import { playModeOnly } from '../../util/env';import { Interactable } from './interactable';import { UIInteraction } from './interactable';import type { UIInteractionData } from './interactable';diff --git a/sdk/src/ui/layout/layout.ts b/sdk/src/ui/layout/layout.tsindex 7c996e21a..93a5dabbe 100644--- a/sdk/src/ui/layout/layout.ts+++ b/sdk/src/ui/layout/layout.ts@@ -9,7 +9,7 @@* that re-solves after scroll/list mutations. Co-located with the* `flex`/`safe-area` schemas in this module.*/-import type { App, Plugin } from '../../app';+import type { App, Plugin } from '../../app/app';import { registerComponent } from '../../ecs/component';import { defineSystem, Schedule } from '../../ecs/system';import { SystemLabel } from '../../ecs/systemLabels';diff --git a/sdk/src/ui/layout/safe-area.ts b/sdk/src/ui/layout/safe-area.tsindex 37fcbab66..3ab441302 100644--- a/sdk/src/ui/layout/safe-area.ts+++ b/sdk/src/ui/layout/safe-area.ts@@ -5,7 +5,7 @@* @brief Safe-area concept — component + the PreUpdate system that pushes* platform safe-area insets into UINode insets, co-located.*/-import type { App, Plugin } from '../../app';+import type { App, Plugin } from '../../app/app';import { isWeChat, platformDevicePixelRatio } from '../../platform';import { defineComponent, registerComponent } from '../../ecs/component';import { Res } from '../../ecs/resource';diff --git a/sdk/src/ui/render/mask.ts b/sdk/src/ui/render/mask.tsindex c8d9f964c..e3410baac 100644--- a/sdk/src/ui/render/mask.ts+++ b/sdk/src/ui/render/mask.ts@@ -1,6 +1,6 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { App, Plugin } from '../../app';+import type { App, Plugin } from '../../app/app';import { registerComponent } from '../../ecs/component';import { UIMask } from '../core/ui-mask';import { PluginName } from '../../ecs/systemLabels';diff --git a/sdk/src/ui/render/render-order.ts b/sdk/src/ui/render/render-order.tsindex e9ba30a9e..ed6b446a2 100644--- a/sdk/src/ui/render/render-order.ts+++ b/sdk/src/ui/render/render-order.ts@@ -1,6 +1,6 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { App, Plugin } from '../../app';+import type { App, Plugin } from '../../app/app';import { defineSystem, Schedule } from '../../ecs/system';import type { CppRegistry } from '../../wasm';import { engineApi } from '../../ecs/bridge/engineApi';diff --git a/sdk/src/ui/text/inline-image-plugin.ts b/sdk/src/ui/text/inline-image-plugin.tsindex 353690ad9..b10cdc453 100644--- a/sdk/src/ui/text/inline-image-plugin.ts+++ b/sdk/src/ui/text/inline-image-plugin.ts@@ -16,7 +16,7 @@* flows the image. Textures resolve by `src` through `Assets.loadTexture`,* cached; a child stays hidden until its texture lands.*/-import type { App, Plugin } from '../../app';+import type { App, Plugin } from '../../app/app';import { defineSystem, Schedule } from '../../ecs/system';import { resolveTextFamily } from './font-registry';import type { Entity } from '../../types';@@ -31,7 +31,7 @@ import { spawnUIEntity } from '../core/compose';import { px } from '../core/dimension';import { getUINodeWidth, getUINodeHeight } from '../util/helpers';import { Assets } from '../../asset/AssetPlugin';-import { log } from '../../logger';+import { log } from '../../util/logger';import type { Assets as AssetsApi } from '../../asset/Assets';const WHITE = { r: 1, g: 1, b: 1, a: 1 };diff --git a/sdk/src/ui/text/plugin.ts b/sdk/src/ui/text/plugin.tsindex de9bb0b66..921ccbcd1 100644--- a/sdk/src/ui/text/plugin.ts+++ b/sdk/src/ui/text/plugin.ts@@ -9,7 +9,7 @@* pipelines — hinted bitmap vs SDF — routed per Text by* {@link resolveTextRenderMode}.*/-import type { App, Plugin } from '../../app';+import type { App, Plugin } from '../../app/app';import { Transform, type TransformData, registerComponent } from '../../ecs/component';import { defineSystem, Schedule } from '../../ecs/system';import type { ESEngineModule, CppRegistry } from '../../wasm';diff --git a/sdk/src/ui/text/text-input-plugin.ts b/sdk/src/ui/text/text-input-plugin.tsindex 02b5fcdf1..59ae14173 100644--- a/sdk/src/ui/text/text-input-plugin.ts+++ b/sdk/src/ui/text/text-input-plugin.ts@@ -1,6 +1,6 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import type { App, Plugin } from '../../app';+import type { App, Plugin } from '../../app/app';import type { Entity } from '../../types';import { defineSystem, Schedule } from '../../ecs/system';import { registerComponent } from '../../ecs/component';@@ -16,7 +16,7 @@ import { UICameraInfo, type UICameraData } from '../core/ui-camera-info';import { Transform, type TransformData } from '../../ecs/component';import { UIEvents, UIEventQueue } from '../core/events';import { Res } from '../../ecs/resource';-import { playModeOnly } from '../../env';+import { playModeOnly } from '../../util/env';import { ensureComponent, getUINodeWidth, getUINodeHeight } from '../util/helpers';import { spawnUIEntity } from '../core/compose';import { px } from '../core/dimension';@@ -31,7 +31,7 @@ import { uiWorldToScreen } from '../util/ui-pick';import { platformCreateTextEditor, platformDevicePixelRatio } from '../../platform';import { CURSOR_BLINK_INTERVAL, TEXT_INPUT_LINE_HEIGHT_RATIO } from '../util/constants';import { SystemLabel, PluginName } from '../../ecs/systemLabels';-import { log } from '../../logger';+import { log } from '../../util/logger';/** Masking bullet for password fields. */const PASSWORD_CHAR = '●';diff --git a/sdk/src/ui/ui-plugin.ts b/sdk/src/ui/ui-plugin.tsindex 3cc84da01..0bde71eac 100644--- a/sdk/src/ui/ui-plugin.ts+++ b/sdk/src/ui/ui-plugin.ts@@ -13,7 +13,7 @@* UIBehavior reads it at build). The concept plugins stay individually exported* for granular/advanced wiring (e.g. a layout-only test harness).*/-import type { App, Plugin } from '../app';+import type { App, Plugin } from '../app/app';import type { Entity } from '../types';import { uiLayoutPlugin } from './layout/layout';diff --git a/sdk/src/deepClone.ts b/sdk/src/util/deepClone.tssimilarity index 100%rename from sdk/src/deepClone.tsrename to sdk/src/util/deepClone.tsdiff --git a/sdk/src/env.ts b/sdk/src/util/env.tssimilarity index 98%rename from sdk/src/env.tsrename to sdk/src/util/env.tsindex 809981224..1c106065c 100644--- a/sdk/src/env.ts+++ b/sdk/src/util/env.ts@@ -9,7 +9,7 @@* functions are the stable public surface; gameplay systems gate on* {@link playModeOnly}.*/-import { getDefaultContext } from './ecs/context';+import { getDefaultContext } from '../ecs/context';export function setEditorMode(active: boolean): void {getDefaultContext().editorMode = active;diff --git a/sdk/src/logger.ts b/sdk/src/util/logger.tssimilarity index 100%rename from sdk/src/logger.tsrename to sdk/src/util/logger.tsdiff --git a/sdk/src/propertyPath.ts b/sdk/src/util/propertyPath.tssimilarity index 95%rename from sdk/src/propertyPath.tsrename to sdk/src/util/propertyPath.tsindex 6a9696387..0829355df 100644--- a/sdk/src/propertyPath.ts+++ b/sdk/src/util/propertyPath.ts@@ -14,9 +14,9 @@* path would corrupt (see TimelineEvaluator). Merging them is a real change, not* a rename.*/-import type { World } from './ecs/world';-import type { Entity } from './types';-import { getComponent } from './ecs/component';+import type { World } from '../ecs/world';+import type { Entity } from '../types';+import { getComponent } from '../ecs/component';export function getNestedProperty(obj: Record<string, any>, path: string): unknown {const parts = path.split('.');diff --git a/sdk/src/provenance.ts b/sdk/src/util/provenance.tssimilarity index 100%rename from sdk/src/provenance.tsrename to sdk/src/util/provenance.tsdiff --git a/sdk/src/storage.ts b/sdk/src/util/storage.tssimilarity index 97%rename from sdk/src/storage.tsrename to sdk/src/util/storage.tsindex b006c90fa..541bee587 100644--- a/sdk/src/storage.ts+++ b/sdk/src/util/storage.ts@@ -1,6 +1,6 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import { getPlatform } from './platform/base';+import { getPlatform } from '../platform/base';import { log } from './logger';const KEY_PREFIX = 'esengine:';diff --git a/sdk/src/timer.ts b/sdk/src/util/timer.tssimilarity index 96%rename from sdk/src/timer.tsrename to sdk/src/util/timer.tsindex b6f311f92..b41732570 100644--- a/sdk/src/timer.ts+++ b/sdk/src/util/timer.ts@@ -5,13 +5,13 @@* @brief Frame-based timer system integrated with engine loop*/-import { defineResource, Res } from './ecs/resource';-import { defineSystem } from './ecs/system';-import { Schedule } from './ecs/system';-import { Time } from './ecs/resource';+import { defineResource, Res } from '../ecs/resource';+import { defineSystem } from '../ecs/system';+import { Schedule } from '../ecs/system';+import { Time } from '../ecs/resource';import { playModeOnly } from './env';import { log } from './logger';-import type { Plugin } from './app';+import type { Plugin } from '../app/app';// =============================================================================// Timer Entrydiff --git a/sdk/src/utf8.ts b/sdk/src/util/utf8.tssimilarity index 100%rename from sdk/src/utf8.tsrename to sdk/src/util/utf8.tsdiff --git a/sdk/src/validation.ts b/sdk/src/util/validation.tssimilarity index 100%rename from sdk/src/validation.tsrename to sdk/src/util/validation.tsdiff --git a/sdk/src/velocity.ts b/sdk/src/velocity.tsindex 64c4cbcb0..1a4a02e5d 100644--- a/sdk/src/velocity.ts+++ b/sdk/src/velocity.ts@@ -4,11 +4,11 @@* @file velocity.ts* @brief Velocity concept — integrates the builtin Velocity component into Transform.*/-import type { Plugin } from './app';+import type { Plugin } from './app/app';import { defineSystem, Schedule, GetWorld } from './ecs/system';import { Query, Mut } from './ecs/query';import { Res, Time, type TimeData } from './ecs/resource';-import { playModeOnly } from './env';+import { playModeOnly } from './util/env';import { Transform, Velocity, getComponentRegistry } from './ecs/component';import type { TransformData, VelocityData } from './ecs/component';import type { Entity } from './types';diff --git a/sdk/src/video/VideoAPI.ts b/sdk/src/video/VideoAPI.tsindex e5cbd2a31..8f421a3b4 100644--- a/sdk/src/video/VideoAPI.ts+++ b/sdk/src/video/VideoAPI.ts@@ -5,7 +5,7 @@import type { ESEngineModule } from '../wasm';import type { PlatformVideoBackend, VideoStreamHandle, VideoStreamOptions } from './PlatformVideoBackend';import { defineResource } from '../ecs/resource';-import { log } from '../logger';+import { log } from '../util/logger';export type VideoHandle = VideoStreamHandle;export type VideoPlayOptions = VideoStreamOptions;diff --git a/sdk/src/video/VideoPlugin.ts b/sdk/src/video/VideoPlugin.tsindex 8ee03ae89..6762a7773 100644--- a/sdk/src/video/VideoPlugin.ts+++ b/sdk/src/video/VideoPlugin.ts@@ -2,7 +2,7 @@// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team// Wires the video system into an App: builds the backend, exposes VideoPlayer,// and runs one play-mode system that streams each Video onto its renderable.-import type { App, Plugin } from '../app';+import type { App, Plugin } from '../app/app';import type { Entity } from '../types';import type { World } from '../ecs/world';import { defineSystem, Schedule } from '../ecs/system';@@ -16,8 +16,8 @@ import type { VideoStreamHandle } from './PlatformVideoBackend';import { NullVideoBackend } from './NullVideoBackend';import { Audio } from '../audio/Audio';import { getPlatform } from '../platform/base';-import { isEditor, isPlayMode } from '../env';-import { log } from '../logger';+import { isEditor, isPlayMode } from '../util/env';+import { log } from '../util/logger';const UI_VISUAL_IMAGE = 2; // UIVisualType.Image — samples the texturediff --git a/sdk/src/video/WasmVideoBackend.ts b/sdk/src/video/WasmVideoBackend.tsindex ea2fb2d42..6de742004 100644--- a/sdk/src/video/WasmVideoBackend.ts+++ b/sdk/src/video/WasmVideoBackend.ts@@ -26,7 +26,7 @@ import type { AudioHandle } from '../audio/PlatformAudioBackend';import { createTextureFromPixels, updateTextureSubregion } from '../runtime/runtimeAssets';import { requireResourceManager } from '../wasm/resourceManager';import { getPlatform } from '../platform/base';-import { log } from '../logger';+import { log } from '../util/logger';let nextId_ = 1;diff --git a/sdk/src/video/WebVideoBackend.ts b/sdk/src/video/WebVideoBackend.tsindex 59f059af0..4330cc89a 100644--- a/sdk/src/video/WebVideoBackend.ts+++ b/sdk/src/video/WebVideoBackend.ts@@ -8,8 +8,8 @@ import type { PlatformVideoBackend, VideoStreamHandle, VideoStreamOptions } fromimport { createTextureFromPixels, updateTextureSubregion } from '../runtime/runtimeAssets';import { requireResourceManager } from '../wasm/resourceManager';import { findWebGL2Context } from '../asset/loaders/TextureLoader';-import { linearColorSpace } from '../env';-import { log } from '../logger';+import { linearColorSpace } from '../util/env';+import { log } from '../util/logger';let nextId_ = 1;diff --git a/sdk/src/wasm/wasmError.ts b/sdk/src/wasm/wasmError.tsindex aa7c169d0..09a0955cb 100644--- a/sdk/src/wasm/wasmError.ts+++ b/sdk/src/wasm/wasmError.ts@@ -1,6 +1,6 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team-import { log } from '../logger';+import { log } from '../util/logger';import { getDefaultContext, type WasmErrorHandler } from '../ecs/context';import { WasmModuleAborted } from './moduleHealth';diff --git a/sdk/tests/anim-clip-asset.test.ts b/sdk/tests/anim-clip-asset.test.tsindex 7a2299fb6..7ad196d20 100644--- a/sdk/tests/anim-clip-asset.test.ts+++ b/sdk/tests/anim-clip-asset.test.ts@@ -22,7 +22,7 @@ import {getComponentAssetFields,getComponentAssetFieldDescriptors,type AssetFieldType,-} from '../src/scene';+} from '../src/scene/scene';import { defineComponent } from '../src/ecs/component';function ensureSpriteAnimator() {diff --git a/sdk/tests/app-tick.test.ts b/sdk/tests/app-tick.test.tsindex 38f818d72..471023b10 100644--- a/sdk/tests/app-tick.test.ts+++ b/sdk/tests/app-tick.test.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { describe, it, expect } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { Schedule, defineSystem } from '../src/ecs/system';import { Time } from '../src/ecs/resource';import { defineResource, Res } from '../src/ecs/resource';diff --git a/sdk/tests/asset-missing.test.ts b/sdk/tests/asset-missing.test.tsindex 1ced6ed6b..044c18bab 100644--- a/sdk/tests/asset-missing.test.ts+++ b/sdk/tests/asset-missing.test.ts@@ -13,8 +13,8 @@ import { describe, it, expect, beforeEach } from 'vitest';import { defineComponent, clearUserComponents } from '../src/ecs/component';import { discoverSceneAssets } from '../src/asset/discoverAssets';import { AssetRegistry, makeUuidRef } from '../src/asset/AssetRegistry';-import type { SceneData } from '../src/scene';-import { MissingAssetsError } from '../src/scene';+import type { SceneData } from '../src/scene/scene';+import { MissingAssetsError } from '../src/scene/scene';const SPRITE_NAME = 'MissingTest_Sprite';diff --git a/sdk/tests/asset-refcounter-integration.test.ts b/sdk/tests/asset-refcounter-integration.test.tsindex 60733a9a3..8c4fab9c9 100644--- a/sdk/tests/asset-refcounter-integration.test.ts+++ b/sdk/tests/asset-refcounter-integration.test.ts@@ -14,7 +14,7 @@ import { defineComponent, clearUserComponents } from '../src/ecs/component';import { Assets } from '../src/asset/Assets';import { AssetRefCounter } from '../src/asset/AssetRefCounter';import type { Backend } from '../src/asset/Backend';-import type { SceneData } from '../src/scene';+import type { SceneData } from '../src/scene/scene';import type { SceneAssetResult } from '../src/asset/Assets';vi.mock('../src/wasm/resourceManager', () => ({diff --git a/sdk/tests/async-system.test.ts b/sdk/tests/async-system.test.tsindex e60187a8a..aaa8ce965 100644--- a/sdk/tests/async-system.test.ts+++ b/sdk/tests/async-system.test.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { describe, it, expect, vi, beforeEach } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { defineSystem, Schedule, SystemRunner } from '../src/ecs/system';import { defineResource, Res, ResMut, ResourceStorage } from '../src/ecs/resource';import { Commands, CommandsInstance } from '../src/ecs/commands';diff --git a/sdk/tests/behavior.test.ts b/sdk/tests/behavior.test.tsindex 319d62bf1..874a8db59 100644--- a/sdk/tests/behavior.test.ts+++ b/sdk/tests/behavior.test.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { describe, it, expect, beforeEach } from 'vitest';-import { App, flushPendingSystems } from '../src/app';+import { App, flushPendingSystems } from '../src/app/app';import { defineBehavior } from '../src/behavior';import { AppContext, setDefaultContext } from '../src/ecs/context';import { getUserComponents } from '../src/ecs/component';diff --git a/sdk/tests/discoverAssets.test.ts b/sdk/tests/discoverAssets.test.tsindex 375629c31..cf57618ae 100644--- a/sdk/tests/discoverAssets.test.ts+++ b/sdk/tests/discoverAssets.test.ts@@ -7,7 +7,7 @@ import { AssetRegistry, makeUuidRef } from '../src/asset/AssetRegistry';import { StateMachineAgent } from '../src/ai/fsm/StateMachineAgent';import { BehaviorTreeAgent } from '../src/ai/bt/BehaviorTreeAgent';import { TilemapLayer } from '../src/ecs/component';-import type { SceneData } from '../src/scene';+import type { SceneData } from '../src/scene/scene';const SPRITE_NAME = 'DiscoverTest_Sprite';const AUDIO_NAME = 'DiscoverTest_Audio';diff --git a/sdk/tests/emscripten-wrapper.test.ts b/sdk/tests/emscripten-wrapper.test.tsindex 213902d75..a0d927f34 100644--- a/sdk/tests/emscripten-wrapper.test.ts+++ b/sdk/tests/emscripten-wrapper.test.ts@@ -8,7 +8,7 @@* structs this used to probe were retired in REARCH_GUI F3).*/import { describe, it, expect, beforeAll } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { UINode, type UINodeData } from '../src/ui/core/ui-node';import type { ESEngineModule, CppRegistry } from '../src/wasm';import { loadWasmModule, HAS_WASM } from './helpers/loadWasm';diff --git a/sdk/tests/fx-despawn-cleanup.test.ts b/sdk/tests/fx-despawn-cleanup.test.tsindex d6fc1d4ae..5dbf282bc 100644--- a/sdk/tests/fx-despawn-cleanup.test.ts+++ b/sdk/tests/fx-despawn-cleanup.test.ts@@ -7,9 +7,9 @@* audio/video/spine plugins already follow.*/import { describe, it, expect, vi } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { AppContext, setDefaultContext } from '../src/ecs/context';-import { setEditorMode, setPlayMode } from '../src/env';+import { setEditorMode, setPlayMode } from '../src/util/env';import { createMockModule } from './mocks/wasm';import { Mesh2DPlugin, Meshes2D } from '../src/render/mesh2d';import { ParticlePlugin } from '../src/particle/ParticlePlugin';diff --git a/sdk/tests/fx-edit-preview.test.ts b/sdk/tests/fx-edit-preview.test.tsindex 8663cd5a1..38f87fac5 100644--- a/sdk/tests/fx-edit-preview.test.ts+++ b/sdk/tests/fx-edit-preview.test.ts@@ -8,8 +8,8 @@* irrelevant.*/import { describe, it, expect, afterEach } from 'vitest';-import { App } from '../src/app';-import { setEditorMode, setPlayMode, setFxEditPreview, isFxEditPreview } from '../src/env';+import { App } from '../src/app/app';+import { setEditorMode, setPlayMode, setFxEditPreview, isFxEditPreview } from '../src/util/env';import { particlePlugin, Particle } from '../src/particle';import { trailPlugin, Trail } from '../src/trail';diff --git a/sdk/tests/helpers/mockApp.ts b/sdk/tests/helpers/mockApp.tsindex 8cfddd996..6f2f1c60a 100644--- a/sdk/tests/helpers/mockApp.ts+++ b/sdk/tests/helpers/mockApp.ts@@ -12,9 +12,9 @@* system orchestration, event emission — and leave the native simulation* to the *-smoke.mjs runners that link the real engine.*/-import { App } from '../../src/app';+import { App } from '../../src/app/app';import { AppContext, setDefaultContext } from '../../src/ecs/context';-import { setEditorMode, setPlayMode } from '../../src/env';+import { setEditorMode, setPlayMode } from '../../src/util/env';import { createMockModule } from '../mocks/wasm';import type { ESEngineModule } from '../../src/wasm';diff --git a/sdk/tests/hot-swap-systems.test.ts b/sdk/tests/hot-swap-systems.test.tsindex ce153bd5d..f79c99a4b 100644--- a/sdk/tests/hot-swap-systems.test.ts+++ b/sdk/tests/hot-swap-systems.test.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { describe, it, expect, beforeEach } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { defineSystem, Schedule } from '../src/ecs/system';import { defineComponent, clearUserComponents, getUserComponentFingerprint, getUserComponents } from '../src/ecs/component';import { setDefaultContext, AppContext } from '../src/ecs/context';diff --git a/sdk/tests/input-fixed-step.test.ts b/sdk/tests/input-fixed-step.test.tsindex 693c97c6f..37aa8b881 100644--- a/sdk/tests/input-fixed-step.test.ts+++ b/sdk/tests/input-fixed-step.test.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { describe, it, expect } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { Schedule, defineSystem } from '../src/ecs/system';import { Res } from '../src/ecs/resource';import { Input, InputState } from '../src/input/input';diff --git a/sdk/tests/locale-table.test.ts b/sdk/tests/locale-table.test.tsindex 41ea6df97..f78f817f6 100644--- a/sdk/tests/locale-table.test.ts+++ b/sdk/tests/locale-table.test.ts@@ -13,7 +13,7 @@ import type { LoadContext } from '../src/asset/AssetLoader';import { applyTextLocalization, type TextWorldView } from '../src/ui/text/localize';import { Text, type TextData } from '../src/ui/core/text';import { sceneUsesI18n } from '../src/runtime/runtimeLoader';-import type { SceneData } from '../src/scene';+import type { SceneData } from '../src/scene/scene';import type { Entity } from '../src/types';// =============================================================================diff --git a/sdk/tests/logger.test.ts b/sdk/tests/logger.test.tsindex eee52155e..b93799ef9 100644--- a/sdk/tests/logger.test.ts+++ b/sdk/tests/logger.test.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { describe, it, expect, beforeEach, vi } from 'vitest';-import { Logger, LogLevel, ConsoleLogHandler, type LogHandler, type LogEntry } from '../src/logger';+import { Logger, LogLevel, ConsoleLogHandler, type LogHandler, type LogEntry } from '../src/util/logger';describe('Logger', () => {let logger: Logger;@@ -231,7 +231,7 @@ describe('Logger', () => {describe('global functions', () => {it('should export convenience functions', async () => {- const { getLogger, setLogLevel, debug, info, warn, error } = await import('../src/logger');+ const { getLogger, setLogLevel, debug, info, warn, error } = await import('../src/util/logger');expect(getLogger).toBeDefined();expect(setLogLevel).toBeDefined();@@ -242,12 +242,12 @@ describe('Logger', () => {});it('getLogger should return a Logger instance', async () => {- const { getLogger } = await import('../src/logger');+ const { getLogger } = await import('../src/util/logger');expect(getLogger()).toBeInstanceOf(Logger);});it('setLogLevel should change default logger level', async () => {- const { getLogger, setLogLevel } = await import('../src/logger');+ const { getLogger, setLogLevel } = await import('../src/util/logger');const l = getLogger();l.clearHandlers();l.addHandler(mockHandler);@@ -259,7 +259,7 @@ describe('Logger', () => {});it('shorthand functions should log through default logger', async () => {- const mod = await import('../src/logger');+ const mod = await import('../src/util/logger');const l = mod.getLogger();l.clearHandlers();l.addHandler(mockHandler);diff --git a/sdk/tests/loop-integration.test.ts b/sdk/tests/loop-integration.test.tsindex 4a604cbc9..98f933c15 100644--- a/sdk/tests/loop-integration.test.ts+++ b/sdk/tests/loop-integration.test.ts@@ -8,7 +8,7 @@* runtime scheduler (not just the per-unit tests).*/import { describe, it, expect, beforeEach } from 'vitest';-import { App, flushPendingSystems } from '../src/app';+import { App, flushPendingSystems } from '../src/app/app';import { Input, InputState, GamepadButton, GamepadAxis } from '../src/input/input';import { defineInputMap, Axis2D, Button, Keys2D, Stick, Key, GpButton } from '../src/input/inputMap';import { defineBehavior } from '../src/behavior';diff --git a/sdk/tests/marker-component.test.ts b/sdk/tests/marker-component.test.tsindex 40801bb7e..2bc3f49bb 100644--- a/sdk/tests/marker-component.test.ts+++ b/sdk/tests/marker-component.test.ts@@ -9,7 +9,7 @@import { describe, it, expect } from 'vitest';import { World } from '../src/ecs/world';import { Transform, Marker, markEngineComponentBaseline, seedEngineComponents } from '../src/ecs/component';-import { serializeScene } from '../src/scene';+import { serializeScene } from '../src/scene/scene';import { createMockModule } from './mocks/wasm';// Snapshot the module-level engine components (incl. Marker) as the baseline — the SDKdiff --git a/sdk/tests/plugin-sets.test.ts b/sdk/tests/plugin-sets.test.tsindex 48c099eec..8944f96b3 100644--- a/sdk/tests/plugin-sets.test.ts+++ b/sdk/tests/plugin-sets.test.ts@@ -11,7 +11,7 @@import { describe, it, expect } from 'vitest';import {simulationBasePlugins, presentationBasePlugins, webBasePlugins,-} from '../src/pluginSets';+} from '../src/app/pluginSets';const names = (plugins: { name: string }[]): string[] => plugins.map((p) => p.name).sort();diff --git a/sdk/tests/plugin-sort.test.ts b/sdk/tests/plugin-sort.test.tsindex fa62ebf08..b2490109b 100644--- a/sdk/tests/plugin-sort.test.ts+++ b/sdk/tests/plugin-sort.test.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { describe, it, expect } from 'vitest';-import { App, type Plugin } from '../src/app';+import { App, type Plugin } from '../src/app/app';function makePlugin(name: string, opts?: { dependencies?: string[]; before?: string[]; after?: string[] }): Plugin {return {diff --git a/sdk/tests/prefab.test.ts b/sdk/tests/prefab.test.tsindex 3ba1905e0..0b067ee87 100644--- a/sdk/tests/prefab.test.ts+++ b/sdk/tests/prefab.test.ts@@ -2,12 +2,12 @@// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { describe, it, expect, vi, beforeEach } from 'vitest';import type { PrefabData, PrefabOverride, InstantiatePrefabOptions } from '../src/prefab';-import type { SceneData } from '../src/scene';+import type { SceneData } from '../src/scene/scene';import type { World } from '../src/ecs/world';import type { Entity } from '../src/types';-vi.mock('../src/scene', async (importOriginal) => {- const actual = await importOriginal<typeof import('../src/scene')>();+vi.mock('../src/scene/scene', async (importOriginal) => {+ const actual = await importOriginal<typeof import('../src/scene/scene')>();return {...actual,loadSceneWithAssets: vi.fn(),@@ -15,7 +15,7 @@ vi.mock('../src/scene', async (importOriginal) => {});import { instantiatePrefab } from '../src/prefab';-import { loadSceneWithAssets } from '../src/scene';+import { loadSceneWithAssets } from '../src/scene/scene';import { defineComponent } from '../src/ecs/component';const mockLoadScene = vi.mocked(loadSceneWithAssets);diff --git a/sdk/tests/preload-ai-assets.test.ts b/sdk/tests/preload-ai-assets.test.tsindex ee3e2db1a..719ec8a31 100644--- a/sdk/tests/preload-ai-assets.test.ts+++ b/sdk/tests/preload-ai-assets.test.ts@@ -17,7 +17,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';import { Assets } from '../src/asset/Assets';import { Catalog } from '../src/asset/Catalog';import type { Backend } from '../src/asset/Backend';-import type { SceneData } from '../src/scene';+import type { SceneData } from '../src/scene/scene';import { defineComponent } from '../src/ecs/component';import { getFsm, clearFsmStore } from '../src/ai/fsm/StateMachineAgent';import { getBt, clearBtStore } from '../src/ai/bt/BehaviorTreeAgent';diff --git a/sdk/tests/preload-texture-import.test.ts b/sdk/tests/preload-texture-import.test.tsindex c5d6aa207..14442bedd 100644--- a/sdk/tests/preload-texture-import.test.ts+++ b/sdk/tests/preload-texture-import.test.ts@@ -16,7 +16,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';import { Assets } from '../src/asset/Assets';import { Catalog } from '../src/asset/Catalog';import type { Backend } from '../src/asset/Backend';-import type { SceneData } from '../src/scene';+import type { SceneData } from '../src/scene/scene';import { defineComponent } from '../src/ecs/component';const setTextureMetadata = vi.fn();diff --git a/sdk/tests/propertyPath.test.ts b/sdk/tests/propertyPath.test.tsindex 484083d00..9281da8f0 100644--- a/sdk/tests/propertyPath.test.ts+++ b/sdk/tests/propertyPath.test.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { describe, it, expect } from 'vitest';-import { getNestedProperty, setNestedProperty, parsePropertyPath } from '../src/propertyPath';+import { getNestedProperty, setNestedProperty, parsePropertyPath } from '../src/util/propertyPath';describe('propertyPath', () => {describe('getNestedProperty', () => {diff --git a/sdk/tests/replication-e2e-ws.test.ts b/sdk/tests/replication-e2e-ws.test.tsindex 7647c47ac..35392446e 100644--- a/sdk/tests/replication-e2e-ws.test.ts+++ b/sdk/tests/replication-e2e-ws.test.ts@@ -10,7 +10,7 @@*/import { describe, it, expect, beforeAll, afterAll } from 'vitest';import { WebSocketServer, type WebSocket as WsSocket } from 'ws';-import { App } from '../src/app';+import { App } from '../src/app/app';import { createHeadlessApp } from '../src/runtime/webAppFactory';import { defineComponent, clearUserComponents, Transform } from '../src/ecs/component';import type { ESEngineModule } from '../src/wasm';diff --git a/sdk/tests/replication-input.test.ts b/sdk/tests/replication-input.test.tsindex de39e36ef..16e824588 100644--- a/sdk/tests/replication-input.test.ts+++ b/sdk/tests/replication-input.test.ts@@ -8,7 +8,7 @@* process.*/import { describe, it, expect, beforeEach } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { defineComponent, clearUserComponents } from '../src/ecs/component';import { defineSystem, Schedule, GetWorld } from '../src/ecs/system';import { MemoryTransport } from '../src/net/MemoryTransport';diff --git a/sdk/tests/replication-interest.test.ts b/sdk/tests/replication-interest.test.tsindex 40dab6ea4..0b4403ab1 100644--- a/sdk/tests/replication-interest.test.ts+++ b/sdk/tests/replication-interest.test.ts@@ -8,7 +8,7 @@* (including installing/removing a policy mid-session).*/import { describe, it, expect, beforeEach } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { defineComponent, clearUserComponents, Name } from '../src/ecs/component';import { MemoryTransport } from '../src/net/MemoryTransport';import {diff --git a/sdk/tests/replication-interp.test.ts b/sdk/tests/replication-interp.test.tsindex 3809ea34f..f1184fea6 100644--- a/sdk/tests/replication-interp.test.ts+++ b/sdk/tests/replication-interp.test.ts@@ -7,7 +7,7 @@* the clock instead of teleporting the ghost.*/import { describe, it, expect, beforeEach } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { defineComponent, clearUserComponents } from '../src/ecs/component';import { MemoryTransport } from '../src/net/MemoryTransport';import {diff --git a/sdk/tests/replication-prediction.test.ts b/sdk/tests/replication-prediction.test.tsindex 2814fe561..04c04ef07 100644--- a/sdk/tests/replication-prediction.test.ts+++ b/sdk/tests/replication-prediction.test.ts@@ -10,7 +10,7 @@* the replay deterministic.*/import { describe, it, expect, beforeEach } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { defineComponent, clearUserComponents } from '../src/ecs/component';import { defineSystem, Schedule, GetWorld } from '../src/ecs/system';import { MemoryTransport } from '../src/net/MemoryTransport';diff --git a/sdk/tests/replication-wasm.test.ts b/sdk/tests/replication-wasm.test.tsindex e8880566d..b89fcd909 100644--- a/sdk/tests/replication-wasm.test.ts+++ b/sdk/tests/replication-wasm.test.ts@@ -7,7 +7,7 @@* on Transform.hpp drives the whole pipeline — no per-component code.*/import { describe, it, expect, beforeAll } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { Transform, getReplicatedFields } from '../src/ecs/component';import type { ESEngineModule, CppRegistry } from '../src/wasm';import { loadWasmModule, HAS_WASM } from './helpers/loadWasm';diff --git a/sdk/tests/replication.test.ts b/sdk/tests/replication.test.tsindex 510faba1c..ed5caf2cf 100644--- a/sdk/tests/replication.test.ts+++ b/sdk/tests/replication.test.ts@@ -9,7 +9,7 @@* reflection-driven codec round trip.*/import { describe, it, expect, beforeEach } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { defineComponent, clearUserComponents } from '../src/ecs/component';import { ABI_LAYOUT_HASH } from '../src/ecs/component.generated';import { MemoryTransport } from '../src/net/MemoryTransport';diff --git a/sdk/tests/run-mode.test.ts b/sdk/tests/run-mode.test.tsindex 7023d8916..ddad6ecb1 100644--- a/sdk/tests/run-mode.test.ts+++ b/sdk/tests/run-mode.test.ts@@ -10,9 +10,9 @@* they run.*/import { describe, expect, it, afterEach } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { Schedule, defineSystem } from '../src/ecs/system';-import { setEditorMode, setPlayMode, isEditor, isPlayMode, isRuntime, playModeOnly } from '../src/env';+import { setEditorMode, setPlayMode, isEditor, isPlayMode, isRuntime, playModeOnly } from '../src/util/env';import { getDefaultContext } from '../src/ecs/context';function namedSystem(name: string, trace: string[]) {diff --git a/sdk/tests/runtime-assets-persistence.test.ts b/sdk/tests/runtime-assets-persistence.test.tsindex 1747b0b2b..3cda57909 100644--- a/sdk/tests/runtime-assets-persistence.test.ts+++ b/sdk/tests/runtime-assets-persistence.test.ts@@ -14,10 +14,10 @@ import { Assets as AssetsResource } from '../src/asset/AssetPlugin';import { Assets as AssetsClass } from '../src/asset/Assets';import { ManifestModel } from '../src/asset/AddressableManifest';import { World } from '../src/ecs/world';-import type { App } from '../src/app';+import type { App } from '../src/app/app';import type { Backend } from '../src/asset/Backend';import type { ESEngineModule } from '../src/wasm';-import type { SceneData } from '../src/scene';+import type { SceneData } from '../src/scene/scene';const fakeModule = { _malloc: () => 0, _free: () => {} } as unknown as ESEngineModule;diff --git a/sdk/tests/runtime-only-serialize.test.ts b/sdk/tests/runtime-only-serialize.test.tsindex 610a5256f..99536e81f 100644--- a/sdk/tests/runtime-only-serialize.test.ts+++ b/sdk/tests/runtime-only-serialize.test.ts@@ -10,7 +10,7 @@import { describe, it, expect } from 'vitest';import { World } from '../src/ecs/world';import { Transform, RuntimeOnly, Name, Parent } from '../src/ecs/component';-import { serializeScene } from '../src/scene';+import { serializeScene } from '../src/scene/scene';import { createMockModule } from './mocks/wasm';// Builtin components are C++-memory-backed; the mock module gives them a homediff --git a/sdk/tests/saveGame.test.ts b/sdk/tests/saveGame.test.tsindex ae13e1b3e..e79ba9d70 100644--- a/sdk/tests/saveGame.test.ts+++ b/sdk/tests/saveGame.test.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { describe, it, expect } from 'vitest';-import { SaveManager, migrateSaveData, type SaveStorage } from '../src/saveGame';+import { SaveManager, migrateSaveData, type SaveStorage } from '../src/scene/saveGame';describe('migrateSaveData', () => {const migrations = {diff --git a/sdk/tests/scene-asset-release.test.ts b/sdk/tests/scene-asset-release.test.tsindex a73b77d33..d248c0dbc 100644--- a/sdk/tests/scene-asset-release.test.ts+++ b/sdk/tests/scene-asset-release.test.ts@@ -8,7 +8,7 @@*/import { describe, expect, it, beforeEach, vi } from 'vitest';-vi.mock('../src/scene', () => ({+vi.mock('../src/scene/scene', () => ({loadSceneWithAssets: vi.fn().mockResolvedValue(new Map()),}));vi.mock('../src/render/customDraw', () => ({@@ -24,7 +24,7 @@ vi.mock('../src/render/material', () => ({defineResource: vi.fn(),}));-import { SceneManagerState } from '../src/sceneManager';+import { SceneManagerState } from '../src/scene/sceneManager';import { Assets } from '../src/asset';import { Material } from '../src/render/material';diff --git a/sdk/tests/scene-load-failure.test.ts b/sdk/tests/scene-load-failure.test.tsindex 7c3e44d02..a41888f04 100644--- a/sdk/tests/scene-load-failure.test.ts+++ b/sdk/tests/scene-load-failure.test.ts@@ -11,7 +11,7 @@*/import { describe, expect, it, beforeEach, vi } from 'vitest';-vi.mock('../src/scene', () => ({+vi.mock('../src/scene/scene', () => ({loadSceneWithAssets: vi.fn().mockResolvedValue(new Map()),}));vi.mock('../src/render/customDraw', () => ({@@ -37,7 +37,7 @@ vi.mock('../src/asset', () => ({preloadSceneAssets: vi.fn().mockResolvedValue({ loadedTextures: new Set(), loadedFonts: new Set(), loadedMaterials: new Set(), missing: [] }),}));-import { SceneManagerState } from '../src/sceneManager';+import { SceneManagerState } from '../src/scene/sceneManager';const SCENE_DATA = { version: '1.0', name: 'Test', entities: [] };diff --git a/sdk/tests/scene-load-progress-forward.test.ts b/sdk/tests/scene-load-progress-forward.test.tsindex 84757d281..184fc6c06 100644--- a/sdk/tests/scene-load-progress-forward.test.ts+++ b/sdk/tests/scene-load-progress-forward.test.ts@@ -6,7 +6,7 @@*/import { describe, expect, it, vi } from 'vitest';-vi.mock('../src/scene', () => ({+vi.mock('../src/scene/scene', () => ({// Invoke the caller's onProgress so we can assert the manager forwarded it.loadSceneWithAssets: vi.fn((_w: unknown, _d: unknown, opts: { onProgress?: (l: number, t: number) => void }) => {opts?.onProgress?.(3, 3);@@ -17,7 +17,7 @@ vi.mock('../src/render/customDraw', () => ({ registerDrawCallback: vi.fn(), unrevi.mock('../src/postprocess', () => ({ PostProcess: { bind: vi.fn(), unbind: vi.fn() }, PostProcessStack: vi.fn() }));vi.mock('../src/render/material', () => ({ Material: { release: vi.fn(), createShader: vi.fn() }, defineResource: vi.fn() }));-import { SceneManagerState } from '../src/sceneManager';+import { SceneManagerState } from '../src/scene/sceneManager';function createMockApp() {const entities = new Map<number, Map<symbol, unknown>>();diff --git a/sdk/tests/scene-loading-progress.test.ts b/sdk/tests/scene-loading-progress.test.tsindex 384575166..fb40a6238 100644--- a/sdk/tests/scene-loading-progress.test.ts+++ b/sdk/tests/scene-loading-progress.test.ts@@ -4,7 +4,7 @@ import { describe, it, expect, vi } from 'vitest';import { Assets } from '../src/asset/Assets';import { Catalog } from '../src/asset/Catalog';import type { Backend } from '../src/asset/Backend';-import type { SceneData } from '../src/scene';+import type { SceneData } from '../src/scene/scene';vi.mock('../src/wasm/resourceManager', () => ({requireResourceManager: () => ({diff --git a/sdk/tests/scene-prefab.test.ts b/sdk/tests/scene-prefab.test.tsindex e2a5a5ee2..09ce6198b 100644--- a/sdk/tests/scene-prefab.test.ts+++ b/sdk/tests/scene-prefab.test.ts@@ -23,7 +23,7 @@ import {expandScenePrefabs,sceneHasPrefabEntries,type SceneData,-} from '../src/scene';+} from '../src/scene/scene';import {migratePrefabData,flattenPrefab,diff --git a/sdk/tests/scene-streaming.test.ts b/sdk/tests/scene-streaming.test.tsindex 7956ec83b..ecfeedd99 100644--- a/sdk/tests/scene-streaming.test.ts+++ b/sdk/tests/scene-streaming.test.ts@@ -6,7 +6,7 @@ import {SceneStreamingController,type StreamCell,type SceneStreamHost,-} from '../src/sceneStreaming';+} from '../src/scene/sceneStreaming';const flush = async () => { await Promise.resolve(); await Promise.resolve(); };diff --git a/sdk/tests/scene-transition-errors.test.ts b/sdk/tests/scene-transition-errors.test.tsindex fdeed3835..74b6b556c 100644--- a/sdk/tests/scene-transition-errors.test.ts+++ b/sdk/tests/scene-transition-errors.test.ts@@ -7,7 +7,7 @@*/import { describe, expect, it, beforeEach, vi } from 'vitest';-vi.mock('../src/scene', () => ({+vi.mock('../src/scene/scene', () => ({loadSceneWithAssets: vi.fn().mockResolvedValue(new Map()),}));vi.mock('../src/render/customDraw', () => ({@@ -33,7 +33,7 @@ vi.mock('../src/asset', () => ({preloadSceneAssets: vi.fn().mockResolvedValue({ loadedTextures: new Set(), loadedFonts: new Set(), loadedMaterials: new Set(), missing: [] }),}));-import { SceneManagerState } from '../src/sceneManager';+import { SceneManagerState } from '../src/scene/sceneManager';function waitMicrotask(): Promise<void> {return new Promise(r => setTimeout(r, 0));diff --git a/sdk/tests/scene-uses-physics.test.ts b/sdk/tests/scene-uses-physics.test.tsindex faaa7c367..57b650270 100644--- a/sdk/tests/scene-uses-physics.test.ts+++ b/sdk/tests/scene-uses-physics.test.ts@@ -9,7 +9,7 @@*/import { describe, it, expect } from 'vitest';import { sceneUsesPhysics } from '../src/runtime/runtimeLoader';-import type { SceneData } from '../src/scene';+import type { SceneData } from '../src/scene/scene';function scene(components: Array<{ type: string; data?: Record<string, unknown> }>): SceneData {return {diff --git a/sdk/tests/scene-validation.test.ts b/sdk/tests/scene-validation.test.tsindex e62183835..9019842e1 100644--- a/sdk/tests/scene-validation.test.ts+++ b/sdk/tests/scene-validation.test.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { describe, it, expect, vi, beforeEach } from 'vitest';-import { validateComponentData, formatValidationErrors } from '../src/validation';+import { validateComponentData, formatValidationErrors } from '../src/util/validation';describe('validateComponentData', () => {it('should return no errors for valid data', () => {diff --git a/sdk/tests/scene.test.ts b/sdk/tests/scene.test.tsindex 0b5d06811..5a28f69ec 100644--- a/sdk/tests/scene.test.ts+++ b/sdk/tests/scene.test.ts@@ -22,7 +22,7 @@ import {getComponentSkeletalFieldDescriptor,type SceneData,type SceneComponentData,-} from '../src/scene';+} from '../src/scene/scene';import type { Entity } from '../src/types';import { discoverSceneAssets } from '../src/asset/discoverAssets';import { initResourceManager, shutdownResourceManager } from '../src/wasm/resourceManager';diff --git a/sdk/tests/sceneManager.test.ts b/sdk/tests/sceneManager.test.tsindex a9b7bb396..5f4e74d68 100644--- a/sdk/tests/sceneManager.test.ts+++ b/sdk/tests/sceneManager.test.ts@@ -2,7 +2,7 @@// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { describe, it, expect, beforeEach, vi } from 'vitest';-vi.mock('../src/scene', () => ({+vi.mock('../src/scene/scene', () => ({loadSceneWithAssets: vi.fn().mockResolvedValue(new Map()),}));@@ -66,9 +66,9 @@ vi.mock('../src/defaults', () => ({},}));-import { SceneManagerState, SceneLoadCancelled, wrapSceneSystem } from '../src/sceneManager';+import { SceneManagerState, SceneLoadCancelled, wrapSceneSystem } from '../src/scene/sceneManager';import { SceneOwner, Sprite, SpineAnimation, BitmapText } from '../src/ecs/component';-import { loadSceneWithAssets } from '../src/scene';+import { loadSceneWithAssets } from '../src/scene/scene';import { registerDrawCallback, unregisterDrawCallback } from '../src/render/customDraw';import { PostProcess } from '../src/postprocess';import { Material } from '../src/render/material';@@ -776,7 +776,7 @@ describe('SceneManager', () => {};// We need to set up getResource to return the manager- const { SceneManager } = await import('../src/sceneManager');+ const { SceneManager } = await import('../src/scene/sceneManager');app.getResource.mockImplementation((key: any) => {if (key === SceneManager || key?._name === 'SceneManager') return manager;return undefined;@@ -800,7 +800,7 @@ describe('SceneManager', () => {_fn: innerFn,};- const { SceneManager } = await import('../src/sceneManager');+ const { SceneManager } = await import('../src/scene/sceneManager');app.getResource.mockImplementation((key: any) => {if (key === SceneManager || key?._name === 'SceneManager') return manager;return undefined;diff --git a/sdk/tests/scheduler-cycles.test.ts b/sdk/tests/scheduler-cycles.test.tsindex 498a1d95e..02836a4a5 100644--- a/sdk/tests/scheduler-cycles.test.ts+++ b/sdk/tests/scheduler-cycles.test.ts@@ -5,7 +5,7 @@* @brief Cycle detection quality + re-sort idempotence after sortSystems.*/import { describe, expect, it } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { Schedule, defineSystem } from '../src/ecs/system';function trackedSystem(name: string, trace: string[]) {diff --git a/sdk/tests/spine-apply-routing.test.ts b/sdk/tests/spine-apply-routing.test.tsindex 3c1c7a380..922a193c7 100644--- a/sdk/tests/spine-apply-routing.test.ts+++ b/sdk/tests/spine-apply-routing.test.ts@@ -10,7 +10,7 @@import { describe, it, expect, beforeEach, vi } from 'vitest';import { defineComponent, clearUserComponents } from '../src/ecs/component';import { applySpineEntities, spineEntityProps } from '../src/spine/loadSpineScene';-import type { SceneData } from '../src/scene';+import type { SceneData } from '../src/scene/scene';import type { Entity } from '../src/types';const SPINE_COMP = 'ApplyRouting_Spine';diff --git a/sdk/tests/stats.test.ts b/sdk/tests/stats.test.tsindex ae5942b9f..1c08da16c 100644--- a/sdk/tests/stats.test.ts+++ b/sdk/tests/stats.test.ts@@ -3,7 +3,7 @@import { describe, it, expect, vi, afterEach } from 'vitest';import { StatsCollector, defaultFrameStats, Stats, StatsPlugin, statsPlugin, FrameHistory, type FrameStats } from '../src/stats';import { StatsOverlay } from '../src/stats-overlay';-import { App } from '../src/app';+import { App } from '../src/app/app';import { Schedule, defineSystem, SystemRunner } from '../src/ecs/system';import { World } from '../src/ecs/world';import { ResourceStorage } from '../src/ecs/resource';diff --git a/sdk/tests/storage.test.ts b/sdk/tests/storage.test.tsindex 6d5d76668..1be932d3e 100644--- a/sdk/tests/storage.test.ts+++ b/sdk/tests/storage.test.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { describe, it, expect, beforeEach, vi } from 'vitest';-import { Storage } from '../src/storage';+import { Storage } from '../src/util/storage';import { setPlatform } from '../src/platform/base';import type { PlatformAdapter } from '../src/platform/types';diff --git a/sdk/tests/subsystems.test.ts b/sdk/tests/subsystems.test.tsindex 7b15d9fcd..f24f74fae 100644--- a/sdk/tests/subsystems.test.ts+++ b/sdk/tests/subsystems.test.ts@@ -1,8 +1,8 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { describe, it, expect, vi } from 'vitest';-import { SubsystemRegistry } from '../src/subsystems';-import { App, type Plugin } from '../src/app';+import { SubsystemRegistry } from '../src/app/subsystems';+import { App, type Plugin } from '../src/app/app';import { Schedule, defineSystem } from '../src/ecs/system';describe('SubsystemRegistry', () => {diff --git a/sdk/tests/system-ordering.test.ts b/sdk/tests/system-ordering.test.tsindex 98b5322aa..8ae3dce8d 100644--- a/sdk/tests/system-ordering.test.ts+++ b/sdk/tests/system-ordering.test.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { describe, it, expect, beforeEach } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { defineSystem, Schedule } from '../src/ecs/system';describe('System Dependency Ordering', () => {diff --git a/sdk/tests/system-set.test.ts b/sdk/tests/system-set.test.tsindex f08417aa9..dbd727dbb 100644--- a/sdk/tests/system-set.test.ts+++ b/sdk/tests/system-set.test.ts@@ -5,7 +5,7 @@* @brief SystemSet grouping, shared runIf, and set-name dep expansion.*/import { describe, expect, it } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { Schedule, defineSystem, defineSystemSet } from '../src/ecs/system';function namedSystem(name: string, trace: string[]) {diff --git a/sdk/tests/timer.test.ts b/sdk/tests/timer.test.tsindex 87bdf333e..8cdbf8b72 100644--- a/sdk/tests/timer.test.ts+++ b/sdk/tests/timer.test.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { describe, it, expect, beforeEach, vi } from 'vitest';-import { TimerManager } from '../src/timer';+import { TimerManager } from '../src/util/timer';describe('TimerManager', () => {let manager: TimerManager;diff --git a/sdk/tests/transaction.test.ts b/sdk/tests/transaction.test.tsindex 7d490d3f3..e845a24a1 100644--- a/sdk/tests/transaction.test.ts+++ b/sdk/tests/transaction.test.ts@@ -10,7 +10,7 @@*/import { describe, it, expect, vi, beforeEach } from 'vitest';import { Transaction, TransactionManager } from '../src/ecs/transaction';-import { log } from '../src/logger';+import { log } from '../src/util/logger';/** A recording op: pushes a marker on forward/reverse so ordering is observable. */function recordingOp(trace: string[], tag: string) {diff --git a/sdk/tests/ui-anchor-preset.test.ts b/sdk/tests/ui-anchor-preset.test.tsindex 837415569..b4749ebdf 100644--- a/sdk/tests/ui-anchor-preset.test.ts+++ b/sdk/tests/ui-anchor-preset.test.ts@@ -18,7 +18,7 @@ import {} from '../src/ui/layout/anchor';import { UIPositionType, UINode, type UINodeData } from '../src/ui/core/ui-node';import { DimensionUnit, px, auto } from '../src/ui/core/dimension';-import { App } from '../src/app';+import { App } from '../src/app/app';import { Canvas, Transform, Sprite } from '../src/ecs/component';import { UICameraInfo } from '../src/ui/core/ui-camera-info';import { uiLayoutPlugin } from '../src/ui/layout/layout';diff --git a/sdk/tests/ui-components.test.ts b/sdk/tests/ui-components.test.tsindex d83cec3bc..3e975bd31 100644--- a/sdk/tests/ui-components.test.ts+++ b/sdk/tests/ui-components.test.ts@@ -10,7 +10,7 @@* Run `node build-tools/cli.js build -t web` first if missing.*/import { describe, it, expect, beforeAll } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { Transform, Sprite, Canvas } from '../src/ecs/component';import { UINode, type UINodeData } from '../src/ui/core/ui-node';import { UIMask, MaskMode } from '../src/ui/core/ui-mask';diff --git a/sdk/tests/ui-dimension-transient.test.ts b/sdk/tests/ui-dimension-transient.test.tsindex 3503a8168..3423e19be 100644--- a/sdk/tests/ui-dimension-transient.test.ts+++ b/sdk/tests/ui-dimension-transient.test.ts@@ -4,7 +4,7 @@ import { describe, it, expect, beforeEach } from 'vitest';import { World } from '../src/ecs/world';import { createMockModule } from './mocks/wasm';import { defineComponent } from '../src/ecs/component';-import { serializeScene } from '../src/scene';+import { serializeScene } from '../src/scene/scene';import { DimensionUnit, px, percent, auto, isAuto } from '../src/ui/core/dimension';describe('Dimension foundation (REARCH_GUI F2)', () => {diff --git a/sdk/tests/ui-drag-plugin.test.ts b/sdk/tests/ui-drag-plugin.test.tsindex c98003169..d05e8f073 100644--- a/sdk/tests/ui-drag-plugin.test.ts+++ b/sdk/tests/ui-drag-plugin.test.ts@@ -10,8 +10,8 @@* the emitted events.*/import { describe, it, expect, beforeEach } from 'vitest';-import { flushPendingSystems } from '../src/app';-import type { App } from '../src/app';+import { flushPendingSystems } from '../src/app/app';+import type { App } from '../src/app/app';import { Transform } from '../src/ecs/component';import { Input, InputState } from '../src/input/input';import { UIEvents, UIEventQueue } from '../src/ui/core/events';diff --git a/sdk/tests/ui-focus-plugin.test.ts b/sdk/tests/ui-focus-plugin.test.tsindex a8fc85a24..1e5c0e59a 100644--- a/sdk/tests/ui-focus-plugin.test.ts+++ b/sdk/tests/ui-focus-plugin.test.ts@@ -9,8 +9,8 @@* the harness satisfies.*/import { describe, it, expect, beforeEach } from 'vitest';-import { flushPendingSystems } from '../src/app';-import type { App } from '../src/app';+import { flushPendingSystems } from '../src/app/app';+import type { App } from '../src/app/app';import { Input, InputState } from '../src/input/input';import { UIEvents, UIEventQueue } from '../src/ui/core/events';import { Focusable, FocusManager } from '../src/ui/input/focusable';diff --git a/sdk/tests/ui-layout-integration.test.ts b/sdk/tests/ui-layout-integration.test.tsindex 7b041eb18..fa8d3627d 100644--- a/sdk/tests/ui-layout-integration.test.ts+++ b/sdk/tests/ui-layout-integration.test.ts@@ -9,7 +9,7 @@* Run `node build-tools/cli.js build -t web` first if missing.*/import { describe, it, expect, beforeAll } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { UINode, type UINodeData } from '../src/ui/core/ui-node';import { FlexContainer, type FlexContainerData } from '../src/ui/layout/flex';import { Canvas } from '../src/ecs/component';diff --git a/sdk/tests/ui-list-view-widget.test.ts b/sdk/tests/ui-list-view-widget.test.tsindex 4cc0ef989..80a67d80d 100644--- a/sdk/tests/ui-list-view-widget.test.ts+++ b/sdk/tests/ui-list-view-widget.test.ts@@ -8,7 +8,7 @@* Requires pre-built WASM at desktop/public/wasm/esengine.wasm.*/import { describe, it, expect, beforeAll } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { UICameraInfo } from '../src/ui/core/ui-camera-info';import { uiPlugin } from '../src/ui/ui-plugin';import { createListView } from '../src/ui/widgets/list-view';diff --git a/sdk/tests/ui-plugin-cleanup.test.ts b/sdk/tests/ui-plugin-cleanup.test.tsindex b190361ef..826daac56 100644--- a/sdk/tests/ui-plugin-cleanup.test.ts+++ b/sdk/tests/ui-plugin-cleanup.test.ts@@ -6,12 +6,12 @@* teardown to its sub-plugins or their cleanups are unreachable.*/import { describe, it, expect, vi } from 'vitest';-import { App } from '../src/app';+import { App } from '../src/app/app';import { uiPlugin } from '../src/ui/ui-plugin';import { safeAreaPlugin } from '../src/ui/layout/safe-area';import { textInputPlugin, TextInputPlugin } from '../src/ui/text/text-input-plugin';import { AppContext, setDefaultContext } from '../src/ecs/context';-import { setEditorMode, setPlayMode } from '../src/env';+import { setEditorMode, setPlayMode } from '../src/util/env';import { createMockModule } from './mocks/wasm';import { setPlatform } from '../src/platform/base';import { webAdapter } from '../src/platform/web';diff --git a/sdk/tests/ui-plugins.test.ts b/sdk/tests/ui-plugins.test.tsindex 5c96497df..65800b33b 100644--- a/sdk/tests/ui-plugins.test.ts+++ b/sdk/tests/ui-plugins.test.ts@@ -11,7 +11,7 @@* path (headless render verification); this pins the default plugin set shape.*/import { describe, expect, it } from 'vitest';-import { uiPlugins } from '../src/uiPlugins';+import { uiPlugins } from '../src/app/uiPlugins';import { uiPlugin } from '../src/ui/ui-plugin';describe('default uiPlugins', () => {diff --git a/sdk/tests/utf8.test.ts b/sdk/tests/utf8.test.tsindex 0b54b6395..52996b26b 100644--- a/sdk/tests/utf8.test.ts+++ b/sdk/tests/utf8.test.ts@@ -8,7 +8,7 @@// checked against the platform's own answer.import { describe, it, expect, beforeAll, vi } from 'vitest';-type Utf8 = typeof import('../src/utf8');+type Utf8 = typeof import('../src/util/utf8');/** utf8.ts as a host with no TextEncoder/TextDecoder sees it. */async function importWithoutGlobals(): Promise<Utf8> {@@ -20,7 +20,7 @@ async function importWithoutGlobals(): Promise<Utf8> {delete (globalThis as { TextDecoder?: unknown }).TextDecoder;try {vi.resetModules();- return await import('../src/utf8?fallback');+ return await import('../src/util/utf8?fallback');} finally {globalThis.TextEncoder = encoder;globalThis.TextDecoder = decoder;diff --git a/sdk/tests/video-ref-resolution.test.ts b/sdk/tests/video-ref-resolution.test.tsindex 940be9cb7..06ed4e6a3 100644--- a/sdk/tests/video-ref-resolution.test.ts+++ b/sdk/tests/video-ref-resolution.test.ts@@ -12,10 +12,10 @@ import { describe, it, expect } from 'vitest';import { loadRuntimeScene } from '../src/runtime/runtimeLoader';import { VideoPlayer } from '../src/video/VideoAPI';import { World } from '../src/ecs/world';-import type { App } from '../src/app';+import type { App } from '../src/app/app';import type { Backend } from '../src/asset/Backend';import type { ESEngineModule } from '../src/wasm';-import type { SceneData } from '../src/scene';+import type { SceneData } from '../src/scene/scene';const fakeModule = { _malloc: () => 0, _free: () => {} } as unknown as ESEngineModule;