@forgeax/engine-scene 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +55 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/__tests__/asset-owner.integration.test.d.ts +2 -0
  5. package/dist/__tests__/asset-owner.integration.test.d.ts.map +1 -0
  6. package/dist/__tests__/components.unit.test.d.ts +2 -0
  7. package/dist/__tests__/components.unit.test.d.ts.map +1 -0
  8. package/dist/__tests__/diagnostic-type-surface.test-d.d.ts +3 -0
  9. package/dist/__tests__/diagnostic-type-surface.test-d.d.ts.map +1 -0
  10. package/dist/__tests__/direct-child-of-import.unit.test.d.ts +2 -0
  11. package/dist/__tests__/direct-child-of-import.unit.test.d.ts.map +1 -0
  12. package/dist/__tests__/fixtures/malformed-hierarchy-edge.d.ts +8 -0
  13. package/dist/__tests__/fixtures/malformed-hierarchy-edge.d.ts.map +1 -0
  14. package/dist/__tests__/hierarchy-projection-contract.unit.test.d.ts +2 -0
  15. package/dist/__tests__/hierarchy-projection-contract.unit.test.d.ts.map +1 -0
  16. package/dist/__tests__/hierarchy-projection.unit.test.d.ts +2 -0
  17. package/dist/__tests__/hierarchy-projection.unit.test.d.ts.map +1 -0
  18. package/dist/__tests__/plugin.integration.test.d.ts +2 -0
  19. package/dist/__tests__/plugin.integration.test.d.ts.map +1 -0
  20. package/dist/__tests__/propagation.unit.test.d.ts +2 -0
  21. package/dist/__tests__/propagation.unit.test.d.ts.map +1 -0
  22. package/dist/__tests__/transform-change-journal.unit.test.d.ts +2 -0
  23. package/dist/__tests__/transform-change-journal.unit.test.d.ts.map +1 -0
  24. package/dist/assets/instantiate-scene.d.ts +7 -0
  25. package/dist/assets/instantiate-scene.d.ts.map +1 -0
  26. package/dist/assets/publication-observer.d.ts +13 -0
  27. package/dist/assets/publication-observer.d.ts.map +1 -0
  28. package/dist/assets/scene-decoder.d.ts +8 -0
  29. package/dist/assets/scene-decoder.d.ts.map +1 -0
  30. package/dist/assets/scene-projection.d.ts +70 -0
  31. package/dist/assets/scene-projection.d.ts.map +1 -0
  32. package/dist/components/child-of.d.ts +31 -0
  33. package/dist/components/child-of.d.ts.map +1 -0
  34. package/dist/components/children.d.ts +48 -0
  35. package/dist/components/children.d.ts.map +1 -0
  36. package/dist/components/morph-weights.d.ts +5 -0
  37. package/dist/components/morph-weights.d.ts.map +1 -0
  38. package/dist/components/name.d.ts +4 -0
  39. package/dist/components/name.d.ts.map +1 -0
  40. package/dist/components/transform.d.ts +52 -0
  41. package/dist/components/transform.d.ts.map +1 -0
  42. package/dist/errors.d.ts +22 -0
  43. package/dist/errors.d.ts.map +1 -0
  44. package/dist/index.d.ts +15 -0
  45. package/dist/index.d.ts.map +1 -0
  46. package/dist/index.mjs +2167 -0
  47. package/dist/index.mjs.map +1 -0
  48. package/dist/instances/collect-profile.d.ts +7 -0
  49. package/dist/instances/collect-profile.d.ts.map +1 -0
  50. package/dist/instances/externalization.d.ts +14 -0
  51. package/dist/instances/externalization.d.ts.map +1 -0
  52. package/dist/instances/scene-instances.d.ts +349 -0
  53. package/dist/instances/scene-instances.d.ts.map +1 -0
  54. package/dist/plugin.d.ts +3 -0
  55. package/dist/plugin.d.ts.map +1 -0
  56. package/dist/systems/hierarchy-projection.d.ts +16 -0
  57. package/dist/systems/hierarchy-projection.d.ts.map +1 -0
  58. package/dist/systems/index.d.ts +3 -0
  59. package/dist/systems/index.d.ts.map +1 -0
  60. package/dist/systems/propagate-transforms.d.ts +15 -0
  61. package/dist/systems/propagate-transforms.d.ts.map +1 -0
  62. package/package.json +59 -0
  63. package/src/__tests__/asset-owner.integration.test.ts +245 -0
  64. package/src/__tests__/components.unit.test.ts +26 -0
  65. package/src/__tests__/diagnostic-type-surface.test-d.ts +11 -0
  66. package/src/__tests__/direct-child-of-import.unit.test.ts +13 -0
  67. package/src/__tests__/fixtures/malformed-hierarchy-edge.ts +15 -0
  68. package/src/__tests__/hierarchy-projection-contract.unit.test.ts +45 -0
  69. package/src/__tests__/hierarchy-projection.unit.test.ts +92 -0
  70. package/src/__tests__/plugin.integration.test.ts +23 -0
  71. package/src/__tests__/propagation.unit.test.ts +163 -0
  72. package/src/__tests__/transform-change-journal.unit.test.ts +105 -0
  73. package/src/assets/instantiate-scene.ts +14 -0
  74. package/src/assets/publication-observer.ts +24 -0
  75. package/src/assets/scene-decoder.ts +153 -0
  76. package/src/assets/scene-projection.ts +644 -0
  77. package/src/components/child-of.ts +90 -0
  78. package/src/components/children.ts +113 -0
  79. package/src/components/morph-weights.ts +6 -0
  80. package/src/components/name.ts +22 -0
  81. package/src/components/transform.ts +89 -0
  82. package/src/errors.ts +34 -0
  83. package/src/index.ts +78 -0
  84. package/src/instances/collect-profile.ts +10 -0
  85. package/src/instances/externalization.ts +137 -0
  86. package/src/instances/scene-instances.ts +1565 -0
  87. package/src/plugin.ts +28 -0
  88. package/src/systems/hierarchy-projection.ts +134 -0
  89. package/src/systems/index.ts +11 -0
  90. package/src/systems/propagate-transforms.ts +376 -0
@@ -0,0 +1,7 @@
1
+ /** Immutable Scene collection policy shared by runtime collectors. */
2
+ export interface SceneCollectProfile {
3
+ readonly includeComponent: (componentName: string, transient: boolean) => boolean;
4
+ readonly includeField: (componentName: string, fieldName: string, transient: boolean) => boolean;
5
+ }
6
+ export declare const SCENE_COLLECT_PROFILE: SceneCollectProfile;
7
+ //# sourceMappingURL=collect-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collect-profile.d.ts","sourceRoot":"","sources":["../../src/instances/collect-profile.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,OAAO,CAAC;IAClF,QAAQ,CAAC,YAAY,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,OAAO,CAAC;CAClG;AAED,eAAO,MAAM,qBAAqB,EAAE,mBAGlC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { AssetRef, SceneAsset } from '@forgeax/engine-types';
2
+ import { type Result } from '@forgeax/engine-types';
3
+ export type SceneComponentSchemaResolver = (componentName: string) => Readonly<Record<string, string>> | undefined;
4
+ export interface SceneExternalizationError {
5
+ readonly field: string;
6
+ readonly value: unknown;
7
+ }
8
+ export interface ExternalizedSceneAsset {
9
+ readonly payload: Record<string, unknown>;
10
+ readonly refs: readonly AssetRef[];
11
+ }
12
+ /** Project a SceneAsset's shared asset fields into a payload plus indexed refs. */
13
+ export declare function externalizeSceneAsset(scene: SceneAsset, resolveSchema: SceneComponentSchemaResolver): Result<ExternalizedSceneAsset, SceneExternalizationError>;
14
+ //# sourceMappingURL=externalization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"externalization.d.ts","sourceRoot":"","sources":["../../src/instances/externalization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAiB,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,MAAM,4BAA4B,GAAG,CACzC,aAAa,EAAE,MAAM,KAClB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;AAElD,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,QAAQ,CAAC,IAAI,EAAE,SAAS,QAAQ,EAAE,CAAC;CACpC;AA+BD,mFAAmF;AACnF,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,UAAU,EACjB,aAAa,EAAE,4BAA4B,GAC1C,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,CAsF3D"}
@@ -0,0 +1,349 @@
1
+ import { type Component, type ComponentData, type ComponentSchema, type EcsError, type EntityHandle, type ShapeOf, type World } from '@forgeax/engine-ecs';
2
+ import type { Handle, LocalEntityId, MountOverride, SceneAsset, SceneInstanceMount } from '@forgeax/engine-types';
3
+ import { type Result } from '@forgeax/engine-types';
4
+ /**
5
+ * C-R2 (feat-20260622-s5 / studio-issues): one structured, non-fatal record of
6
+ * a SceneAsset payload field that did NOT match the target component's schema.
7
+ *
8
+ * Scene data is loader-fed and may carry a stale / deprecated / typo'd field
9
+ * (an editor renames a field, an old `.pack.json` lags). `worldInstantiateScene`
10
+ * does NOT blank the whole scene over one such field (#478 lesson: a
11
+ * prod-silent strip re-introduced an invisible-entity class) and does NOT abort
12
+ * fatally. Instead it skips the unknown key (no write, no input mutation) and
13
+ * surfaces this record on the success value's `diagnostics[]` — observable in
14
+ * production (NOT NODE_ENV-gated), consumed by property access (no string parse):
15
+ *
16
+ * const r = worldInstantiateScene(world, handle);
17
+ * if (r.ok) for (const d of r.value.diagnostics)
18
+ * console.warn(`unknown field ${d.component}.${d.field} on localId ${d.localId}`);
19
+ *
20
+ * Direct `world.spawn` / `world.addComponent` / `Commands.spawn` stay fail-fast
21
+ * with `SpawnDataUnknownFieldError` — those are explicit API calls where a typo
22
+ * is a programming error, not loader-fed data.
23
+ */
24
+ export type SceneInstantiateDiagnostic = {
25
+ /** Component name (schema key) the unknown field appeared under. */
26
+ readonly component: string;
27
+ /** The offending field name not declared in the component schema. */
28
+ readonly field: string;
29
+ /** LocalEntityId (within its owning SceneAsset) of the carrying entity. */
30
+ readonly localId: number;
31
+ };
32
+ /**
33
+ * Success value of `worldInstantiateScene`. `root` is the synthetic scene-root
34
+ * EntityHandle (carries `SceneInstance`); `diagnostics` is the (possibly empty)
35
+ * list of non-fatal unknown-field records aggregated across this scene and every
36
+ * recursively mounted sub-scene (C-R2). Empty array = no diagnostics.
37
+ */
38
+ export type SceneInstantiateOk = {
39
+ readonly root: EntityHandle;
40
+ readonly diagnostics: readonly SceneInstantiateDiagnostic[];
41
+ };
42
+ /**
43
+ * Success value of `worldInstantiateSceneFlat` — the "edit the scene itself"
44
+ * primitive. Unlike `instantiateScene`, NO synthetic SceneInstance root is
45
+ * minted and NO `ChildOf` is forced onto top-level members: the scene's own
46
+ * entities become plain top-level world entities whose hierarchy is exactly
47
+ * their authored `ChildOf` (an entity with no `ChildOf` stays a root). `roots`
48
+ * is the set of those top-level handles (own rootless entities + top-level
49
+ * mount carriers). Nested prefabs inside the scene STILL materialise as their
50
+ * own SceneInstance anchors (charter P4: instance == entity-with-SceneInstance)
51
+ * — only THIS scene is flat.
52
+ */
53
+ export type SceneInstantiateFlatOk = {
54
+ readonly roots: EntityHandle[];
55
+ /**
56
+ * All mount carrier entities spawned while flattening this scene. These are
57
+ * separate from `roots`: carriers with an authored parent are not roots,
58
+ * but still delimit a nested prefab subtree for post-spawn hooks.
59
+ */
60
+ readonly mountEntities: EntityHandle[];
61
+ readonly diagnostics: readonly SceneInstantiateDiagnostic[];
62
+ };
63
+ /**
64
+ * @internal Intermediate produced by `_spawnSceneMembers` and consumed by both
65
+ * the anchor finisher (`_instantiateSceneAsset`) and the flat finisher
66
+ * (`_instantiateSceneAssetFlat`). Holds everything the shared member-spawn
67
+ * (mounts recursion + own-entity spawn + deferred owned-parent wiring) computes,
68
+ * before either finisher decides whether to wrap the members in a synthetic
69
+ * SceneInstance root.
70
+ */
71
+ export interface SceneMembersSpawn {
72
+ /** LocalEntityId → live Entity u32 (ENTITY_NULL_RAW for unspawned slots). */
73
+ readonly mapping: Uint32Array;
74
+ /** Reverse map live Entity → LocalEntityId for override / detach bookkeeping. */
75
+ readonly entityToLocalId: Map<EntityHandle, LocalEntityId>;
76
+ /** Own entities that carried no `ChildOf` — the scene's authored top-level roots. */
77
+ readonly rootEntities: EntityHandle[];
78
+ /** Mount carriers whose `mount.parent === undefined` (default-parented). */
79
+ readonly mountEntitiesNeedingRootParent: EntityHandle[];
80
+ /** Every mount carrier spawned by this scene, including explicitly parented carriers. */
81
+ readonly mountEntities: EntityHandle[];
82
+ /**
83
+ * The child anchor and mapping for each mount. Flat scene opening has no
84
+ * outer SceneInstance state to own parent-namespace mount overrides, so it
85
+ * records those overrides on this child anchor after the shared spawn pass.
86
+ */
87
+ readonly mountInstances: readonly {
88
+ readonly mount: SceneInstanceMount;
89
+ readonly root: EntityHandle;
90
+ readonly mapping: Uint32Array;
91
+ }[];
92
+ /** `entities.length + mounts + Σ memberCount`, captured at instantiate-time. */
93
+ readonly totalSlots: number;
94
+ }
95
+ export type SceneAssetResolver = (source: number | string, parentHandle: Handle<'SceneAsset', 'shared'>) => Result<Handle<'SceneAsset', 'shared'>, unknown>;
96
+ export type SceneInstantiateHook = (world: World, root: EntityHandle) => {
97
+ readonly ok: true;
98
+ } | {
99
+ readonly ok: false;
100
+ readonly error: unknown;
101
+ };
102
+ /** @internal */
103
+ export declare function worldSetSceneAssetResolver(world: World, resolver: SceneAssetResolver): void;
104
+ /** @internal */
105
+ export declare function worldGetSceneAssetResolver(world: World): SceneAssetResolver | null;
106
+ /** @internal Install the owner post-instantiate boundary for one World. */
107
+ export declare function worldSetSceneInstantiateHook(world: World, hook: SceneInstantiateHook | null): void;
108
+ /**
109
+ * Materialise a SceneAsset (and any nested SceneAsset references via
110
+ * `mounts[]`) into live entities. Returns the synthetic root Entity that
111
+ * carries the `SceneInstance` ECS component (charter P4: instance ==
112
+ * entity-with-SceneInstance).
113
+ *
114
+ * Recursion path is closed inside `_instantiateSceneRec(handle, parent,
115
+ * stack)` (D-3); cycle detection is fail-fast `pack-cyclic-reference +
116
+ * detail.kind:'mount-asset'` (D-1 mirror, plan-strategy §D-3). The
117
+ * caller-supplied `parent` flows to the synthetic root's `ChildOf` so the
118
+ * full sub-tree attaches under the AI user's host entity.
119
+ *
120
+ * @example
121
+ * const r = worldInstantiateScene(world, handle);
122
+ * if (!r.ok) return r;
123
+ * const { root, diagnostics } = r.value;
124
+ * for (const d of diagnostics) // C-R2: unknown-field records, non-fatal
125
+ * console.warn(`unknown field ${d.component}.${d.field} on localId ${d.localId}`);
126
+ * const inst = world.get(root, SceneInstance).value;
127
+ * const member = inst.mapping[0]; // first member entity
128
+ */
129
+ export declare function worldInstantiateScene(world: World, handle: Handle<'SceneAsset', 'shared'>, parent?: EntityHandle): Result<SceneInstantiateOk, EcsError>;
130
+ /**
131
+ * Materialise a SceneAsset FLAT — the "edit the scene itself" primitive.
132
+ * Unlike `instantiateScene`, this mints NO synthetic SceneInstance root and
133
+ * forces NO `ChildOf` onto top-level members: the scene's own entities become
134
+ * plain top-level world entities whose hierarchy is exactly their authored
135
+ * `ChildOf` (an entity with no `ChildOf` is a root). Use this to OPEN a scene
136
+ * for editing; use `instantiateScene` (anchor) at runtime / for nested
137
+ * prefabs where an instance boundary + override isolation is wanted.
138
+ *
139
+ * Nested prefabs referenced via `mounts[]` STILL materialise as their own
140
+ * SceneInstance anchors (charter P4 preserved) — only THIS top scene is flat.
141
+ *
142
+ * @example
143
+ * const r = worldInstantiateSceneFlat(world, handle);
144
+ * if (!r.ok) return r;
145
+ * const { roots, diagnostics } = r.value; // roots = top-level handles
146
+ */
147
+ export declare function worldInstantiateSceneFlat(world: World, handle: Handle<'SceneAsset', 'shared'>): Result<SceneInstantiateFlatOk, EcsError>;
148
+ /**
149
+ * @internal Recursive helper carrying the cycle-detection stack. Sugar /
150
+ * other public callers must not see this mechanic — use `instantiateScene`
151
+ * (D-3 / charter P1).
152
+ */
153
+ export declare function worldInstantiateSceneRec(world: World, handle: Handle<'SceneAsset', 'shared'>, parent: EntityHandle | undefined, stack: Set<number>, diagnostics: SceneInstantiateDiagnostic[]): Result<EntityHandle, EcsError>;
154
+ /**
155
+ * @internal Resolve a SceneAsset handle through the SharedRefStore.
156
+ * The handle u32 is the SharedRefStore slot id (`world.allocSharedRef
157
+ * ('SceneAsset', asset)` is the producer; rc starts at 1, the SceneInstance
158
+ * spawn retains to rc=2 in M4 / w13). Errors propagate as EcsError so the
159
+ * instantiateScene chain returns a single closed union.
160
+ */
161
+ export declare function worldResolveSceneAsset(world: World, handle: Handle<'SceneAsset', 'shared'>): Result<SceneAsset, EcsError>;
162
+ /**
163
+ * @internal Spawn one SceneAsset's members — the shared body of both scene
164
+ * finishers. Recurses into `mounts[]` (each nested prefab becomes its own
165
+ * SceneInstance anchor), spawns `entities[]` honouring their authored
166
+ * `ChildOf`, and wires deferred owned-parent mount edges. Does NOT create a
167
+ * synthetic root or force any `ChildOf` — that is the caller's (finisher's)
168
+ * job. `_instantiateSceneRec` owns cycle bookkeeping.
169
+ */
170
+ export declare function worldSpawnSceneMembers(world: World, handle: Handle<'SceneAsset', 'shared'>, asset: SceneAsset, stack: Set<number>, diagnostics: SceneInstantiateDiagnostic[]): Result<SceneMembersSpawn, EcsError>;
171
+ /**
172
+ * @internal Spawn one SceneAsset's entities + apply mounts recursively, then
173
+ * wrap them in a synthetic SceneInstance root (the anchor). This is the
174
+ * runtime / Play / nested-mount finisher (charter P4: instance ==
175
+ * entity-with-SceneInstance). Caller (`_instantiateSceneRec`) owns cycle
176
+ * bookkeeping.
177
+ */
178
+ export declare function worldInstantiateSceneAsset(world: World, handle: Handle<'SceneAsset', 'shared'>, asset: SceneAsset, parent: EntityHandle | undefined, stack: Set<number>, diagnostics: SceneInstantiateDiagnostic[]): Result<EntityHandle, EcsError>;
179
+ /**
180
+ * @internal Flat finisher — spawn one SceneAsset's members WITHOUT wrapping
181
+ * them in a synthetic SceneInstance root and WITHOUT forcing `ChildOf` onto
182
+ * top-level members. Used for "opening a scene to edit": the scene's own
183
+ * entities become plain top-level world entities whose hierarchy is exactly
184
+ * their authored `ChildOf`. Nested prefabs inside still materialise as their
185
+ * own SceneInstance anchors (the mount recursion in `_spawnSceneMembers` is
186
+ * always anchored). Returns the top-level handles (own rootless entities +
187
+ * top-level mount carriers).
188
+ */
189
+ export declare function worldInstantiateSceneAssetFlat(world: World, handle: Handle<'SceneAsset', 'shared'>, asset: SceneAsset, stack: Set<number>, diagnostics: SceneInstantiateDiagnostic[]): Result<{
190
+ roots: EntityHandle[];
191
+ mountEntities: EntityHandle[];
192
+ }, EcsError>;
193
+ /** @internal Build ComponentData[] for one SceneEntity, remapping localIds.
194
+ *
195
+ * C-R2 (feat-20260622-s5 M6): unknown fields on a SceneAsset payload are NOT
196
+ * fatal. Unlike `world.spawn` (an explicit API call where a typo is a
197
+ * programming error -> `SpawnDataUnknownFieldError`), scene data is loader-fed
198
+ * and may carry a stale / deprecated / typo'd field. The remap below builds a
199
+ * fresh `remappedRaw` and simply SKIPS keys absent from the schema (no input
200
+ * mutation — the source `raw` is never deleted-from), recording each skipped
201
+ * key as a non-fatal `SceneInstantiateDiagnostic` into the passed accumulator.
202
+ * All known fields still write through, so one bad field cannot blank the
203
+ * entity or the scene (C-AC-02/03/04).
204
+ */
205
+ export declare function worldBuildSceneEntityComponentDatas(world: World, node: import('@forgeax/engine-types').SceneEntity, mapping: Uint32Array, diagnostics: SceneInstantiateDiagnostic[]): Result<ComponentData[], EcsError>;
206
+ /**
207
+ * @internal feat-20260713 M2 / w8: apply one MountOverride to a live member
208
+ * entity column. The `field?` shape is the add-or-patch discriminant:
209
+ *
210
+ * - `field` present -> PATCH one field: `world.set(member, comp, {[field]:
211
+ * value})`. Omitted fields keep their authored / existing values.
212
+ * - `field` absent -> ADD/UPSERT the whole component: `value` is the
213
+ * per-field value map for `comp`. When the member already carries `comp`
214
+ * it is upserted (set-over each supplied field + schema defaults for the
215
+ * omitted ones — the whole component is rewritten from the value map +
216
+ * defaults, never a `component-already-present` error). When absent it is
217
+ * added fresh via `addComponent` (fillComponentDefaults fills omitted
218
+ * fields). The value-map is fed through `fillComponentDefaults` so the
219
+ * add and upsert paths write byte-identical rows.
220
+ *
221
+ * Component registration + value-key validation happened at
222
+ * `_validateMountOverrides` (fail-fast before any spawn); by this point the
223
+ * comp resolves through the World-local catalog and the value keys are schema-valid.
224
+ * still guards defensively (an unregistered comp is a no-op skip, matching
225
+ * the prior field-patch behaviour). Returns the underlying set / addComponent
226
+ * Result so a shared-field value gate (D-4) or any other write error
227
+ * propagates unchanged.
228
+ */
229
+ export declare function worldApplyMountOverride(world: World, member: EntityHandle, ov: MountOverride): Result<void, EcsError>;
230
+ /**
231
+ * @internal R2/B-3 + R2/B-4: validate `mount.overrides[]` BEFORE any
232
+ * spawn so a malformed override fails fast with no observable side
233
+ * effects (charter P3 explicit-failure). Two checks:
234
+ *
235
+ * 1. `override.localId` must address a slot inside the parent-namespace
236
+ * member window `[memberFirst, memberFirst + memberCount)` (AC-06).
237
+ * 2. `override.field` must exist in the resolved component schema
238
+ * (AC-07). When the component is unregistered we cannot validate the
239
+ * field shape; let the existing fall-through path proceed (the
240
+ * catalog guard inside the override-application loop
241
+ * will skip the write).
242
+ */
243
+ export declare function worldValidateMountOverrides(world: World, mount: SceneInstanceMount): Result<void, EcsError>;
244
+ /** @internal Spawn the mount-entity slot carrying mount.components (if any).
245
+ *
246
+ * R2/B-1: the mount entity is a structural intermediate in the ChildOf
247
+ * chain `cube -> innerSyntheticRoot -> mountEntity -> outerSyntheticRoot`,
248
+ * so it MUST carry Transform whenever Transform is registered (mirrors
249
+ * the D-V-0 synthetic-root invariant). Otherwise propagateTransforms
250
+ * walking the chain hits a Transform-less parent and emits per-frame
251
+ * `RhiError(hierarchy-broken)` (verify R1 root cause of the
252
+ * hello-scene-nesting demo black frames).
253
+ */
254
+ export declare function worldSpawnMountEntity(world: World, mount: SceneInstanceMount, mapping: Uint32Array, diagnostics: SceneInstantiateDiagnostic[]): Result<EntityHandle, EcsError>;
255
+ /** @internal Resolve mount.source through the wired SceneAssetResolver. */
256
+ export declare function worldResolveMountSource(world: World, source: number | string, parentHandle: Handle<'SceneAsset', 'shared'>): Result<Handle<'SceneAsset', 'shared'>, EcsError>;
257
+ /** @internal Convert mount.overrides Map shape to the SceneInstanceState shape.
258
+ *
259
+ * feat-20260713 M1 / w4: `field` is optional (add-or-patch discriminant). In
260
+ * M1 only the field-patch form reaches this builder (the component-add form
261
+ * fails fast in the apply loops); the record type stays `field?: string` so
262
+ * the M2 add path can flow through untouched. `exactOptionalPropertyTypes`
263
+ * forbids writing an explicit `field: undefined`, so omit the key when absent.
264
+ */
265
+ export declare function worldMountOverridesToStateMap(src: Map<LocalEntityId, Map<string, MountOverride>>): Map<LocalEntityId, Map<string, {
266
+ comp: string;
267
+ field?: string;
268
+ value: unknown;
269
+ }>>;
270
+ /** @internal Set the payload of an already-allocated SceneInstance state ref. */
271
+ export declare function worldSetUniqueRefPayload<T>(world: World, handle: Handle<string, 'unique'>, payload: T): void;
272
+ /**
273
+ * @internal Resolve the SceneInstanceState payload behind the
274
+ * `SceneInstance.state` ref column on `root`. Returns Err when `root`
275
+ * does not carry SceneInstance or the ref slot is dead.
276
+ */
277
+ export declare function worldResolveSceneInstanceStatePayload(world: World, root: EntityHandle): Result<SceneInstanceStatePayload, EcsError>;
278
+ /**
279
+ * Public sugar — get the SceneInstanceState payload (Map / Set view) for
280
+ * `root`. Equivalent to `world.get(root, SceneInstance)` followed by a
281
+ * managed-ref resolution; provided so AI users do not have to learn the
282
+ * `ref<T>` slot resolution mechanic for the common read path.
283
+ */
284
+ export declare function worldGetSceneInstanceState(world: World, root: EntityHandle): Result<SceneInstanceStatePayload, EcsError>;
285
+ /**
286
+ * Despawn a SceneInstance root + all its members. `opts.keepDetached`
287
+ * preserves members marked via `worldDetachSceneMember` (plan-strategy
288
+ * §D-5). Returns the count of entities actually despawned (root + each
289
+ * non-detached member).
290
+ *
291
+ * For a plain entity (no SceneInstance), behaviour matches
292
+ * `world.despawn(entity)` followed by `despawnDescendants(entity)` — i.e.
293
+ * `keepDetached` is a no-op.
294
+ */
295
+ export declare function worldDespawnScene(world: World, root: EntityHandle, opts?: {
296
+ keepDetached?: boolean;
297
+ }): Result<number, EcsError>;
298
+ /**
299
+ * Despawn every descendant of `root` reachable through Children mirror /
300
+ * SceneInstance.mapping. `opts.keepDetached` is honoured only when `root`
301
+ * carries a SceneInstance (otherwise the option is ignored — there is no
302
+ * detached set on a plain entity).
303
+ *
304
+ * Returns the count of entities despawned. The `root` itself is NOT
305
+ * despawned (that is `despawnScene`'s extra step).
306
+ */
307
+ export declare function worldDespawnDescendants(world: World, root: EntityHandle, opts?: {
308
+ keepDetached?: boolean;
309
+ }): Result<number, EcsError>;
310
+ /**
311
+ * Write a runtime override to a member entity belonging to `root`. Routes
312
+ * through `world.set(member, comp, { [field]: value })` after an entity-
313
+ * scope guard so cross-instance writes fail-fast. Type-mismatch surfaces
314
+ * `EcsErrorCode = 'scene-override-type-mismatch'` (D-9).
315
+ */
316
+ export declare function worldSetSceneOverride<S extends ComponentSchema>(world: World, root: EntityHandle, member: EntityHandle, component: Component<string, S>, field: keyof ShapeOf<S> & string, value: unknown): Result<void, EcsError>;
317
+ /**
318
+ * Drop a runtime override (and any mount-time override for the same
319
+ * (member, comp, field) triple); roll the live column value back to the
320
+ * source SceneAsset's layer-1 explicit value (M2 v1 — M3+ widens to layer
321
+ * 2/3 defaults via fillComponentDefaults).
322
+ */
323
+ export declare function worldRemoveSceneOverride<S extends ComponentSchema>(world: World, root: EntityHandle, member: EntityHandle, component: Component<string, S>, field: keyof ShapeOf<S> & string): Result<void, EcsError>;
324
+ /** Mark a member entity detached. Idempotent (set semantics). */
325
+ export declare function worldDetachSceneMember(world: World, root: EntityHandle, member: EntityHandle): Result<void, EcsError>;
326
+ /** Clear a detached mark. Idempotent (set semantics). */
327
+ export declare function worldReattachSceneMember(world: World, root: EntityHandle, member: EntityHandle): Result<void, EcsError>;
328
+ /**
329
+ * Get the SceneAsset handle a SceneInstance root was instantiated from.
330
+ * Returns Err on a plain entity (no SceneInstance component).
331
+ */
332
+ export declare function worldGetSceneAssetForInstance(world: World, root: EntityHandle): Result<Handle<'SceneAsset', 'shared'>, EcsError>;
333
+ /** @internal Structural payload behind `SceneInstance.state` ref column. */
334
+ export interface SceneInstanceStatePayload {
335
+ readonly source: Handle<'SceneAsset', 'shared'>;
336
+ readonly entityToLocalId: Map<EntityHandle, LocalEntityId>;
337
+ readonly detachedLocalIds: Set<LocalEntityId>;
338
+ readonly overrides: Map<LocalEntityId, Map<string, {
339
+ readonly comp: string;
340
+ readonly field?: string;
341
+ readonly value: unknown;
342
+ }>>;
343
+ readonly rootEntities: EntityHandle[];
344
+ /** Synthetic roots of recursively mounted SceneAssets owned by this instance. */
345
+ readonly mountRoots: EntityHandle[];
346
+ readonly totalSlots: number;
347
+ readonly mountTimeOverrides: readonly MountOverride[];
348
+ }
349
+ //# sourceMappingURL=scene-instances.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scene-instances.d.ts","sourceRoot":"","sources":["../../src/instances/scene-instances.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,QAAQ,EAEb,KAAK,YAAY,EAEjB,KAAK,OAAO,EACZ,KAAK,KAAK,EACX,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACb,aAAa,EAGb,UAAU,EACV,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAIL,KAAK,MAAM,EAGZ,MAAM,uBAAuB,CAAC;AAM/B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,oEAAoE;IACpE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAA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MAAM,CAAC;IAC5B,QAAQ,CAAC,kBAAkB,EAAE,SAAS,aAAa,EAAE,CAAC;CACvD"}
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from '@forgeax/engine-plugin';
2
+ export declare function scenePlugin(): Plugin;
3
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAiBrD,wBAAgB,WAAW,IAAI,MAAM,CASpC"}
@@ -0,0 +1,16 @@
1
+ import { type EntityHandle, type World } from '@forgeax/engine-ecs';
2
+ import type { SceneErrorCode, SceneErrorDetail } from '../errors';
3
+ export interface SceneHierarchyDiagnostic {
4
+ readonly code: SceneErrorCode;
5
+ readonly expected: string;
6
+ readonly hint: string;
7
+ readonly detail: SceneErrorDetail;
8
+ }
9
+ export interface SceneHierarchySnapshot {
10
+ readonly parentOf: ReadonlyMap<EntityHandle, EntityHandle>;
11
+ readonly diagnostics: readonly SceneHierarchyDiagnostic[];
12
+ getParent(entity: EntityHandle): EntityHandle | undefined;
13
+ }
14
+ /** Build the only World-local projection of ChildOf parent facts. */
15
+ export declare function projectHierarchy(world: World): SceneHierarchySnapshot;
16
+ //# sourceMappingURL=hierarchy-projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hierarchy-projection.d.ts","sourceRoot":"","sources":["../../src/systems/hierarchy-projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,YAAY,EAAE,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5E,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;CACnC;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IAC3D,QAAQ,CAAC,WAAW,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAC1D,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,GAAG,SAAS,CAAC;CAC3D;AAqCD,qEAAqE;AACrE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,sBAAsB,CA+ErE"}
@@ -0,0 +1,3 @@
1
+ export { projectHierarchy, type SceneHierarchyDiagnostic, type SceneHierarchySnapshot, } from './hierarchy-projection';
2
+ export { PROPAGATE_TRANSFORMS_SYSTEM, propagateTransforms, registerPropagateTransforms, TransformSet, } from './propagate-transforms';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/systems/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,GAC5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,2BAA2B,EAC3B,YAAY,GACb,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { type SystemHandle, type World } from '@forgeax/engine-ecs';
2
+ import { type Result } from '@forgeax/engine-types';
3
+ import { SceneError } from '../errors';
4
+ import { type SceneHierarchySnapshot } from './hierarchy-projection';
5
+ export declare const PROPAGATE_TRANSFORMS_SYSTEM: "propagateTransforms";
6
+ export declare const PROPAGATE_TRANSFORMS_FIXED_SYSTEM: "propagateTransformsFixed";
7
+ export declare const TransformSet: import("@forgeax/engine-ecs").SystemSet;
8
+ export declare const TransformFixedSet: import("@forgeax/engine-ecs").SystemSet;
9
+ export declare function propagateTransforms(world: World, _hierarchy?: SceneHierarchySnapshot): Result<void, SceneError>;
10
+ export declare const PropagateTransforms: SystemHandle<readonly []>;
11
+ export declare const PropagateTransformsFixed: SystemHandle<readonly []>;
12
+ export declare function registerPropagateTransforms(world: World, options?: {
13
+ beforeSystemName?: string;
14
+ }): () => void;
15
+ //# sourceMappingURL=propagate-transforms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propagate-transforms.d.ts","sourceRoot":"","sources":["../../src/systems/propagate-transforms.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,YAAY,EAEjB,KAAK,KAAK,EACX,MAAM,qBAAqB,CAAC;AAO7B,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAoB,KAAK,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEvF,eAAO,MAAM,2BAA2B,EAAG,qBAA8B,CAAC;AAC1E,eAAO,MAAM,iCAAiC,EAAG,0BAAmC,CAAC;AACrF,eAAO,MAAM,YAAY,yCAAyC,CAAC;AACnE,eAAO,MAAM,iBAAiB,yCAA+C,CAAC;AAgM9E,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,KAAK,EACZ,UAAU,CAAC,EAAE,sBAAsB,GAClC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,CA2F1B;AAED,eAAO,MAAM,mBAAmB,EAAE,YAAY,CAAC,SAAS,EAAE,CAOxD,CAAC;AAEH,eAAO,MAAM,wBAAwB,EAAE,YAAY,CAAC,SAAS,EAAE,CAI7D,CAAC;AAEH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,KAAK,EACZ,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAO,GAC1C,MAAM,IAAI,CA6CZ"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@forgeax/engine-scene",
3
+ "version": "0.1.2",
4
+ "private": false,
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "sideEffects": false,
8
+ "description": "Scene identity, hierarchy, and world transform propagation.",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.mjs"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
16
+ "main": "./dist/index.mjs",
17
+ "types": "./dist/index.d.ts",
18
+ "files": [
19
+ "dist",
20
+ "src",
21
+ "README.md",
22
+ "LICENSE"
23
+ ],
24
+ "dependencies": {
25
+ "@forgeax/engine-ecs": "0.1.2",
26
+ "@forgeax/engine-math": "0.1.2",
27
+ "@forgeax/engine-pack": "0.1.2",
28
+ "@forgeax/engine-plugin": "0.1.2"
29
+ },
30
+ "forgeax": {
31
+ "metrics": {
32
+ "bundle-size": {
33
+ "enabled": true,
34
+ "path": "dist/index.mjs",
35
+ "compression": "gzip"
36
+ },
37
+ "fps": {
38
+ "enabled": false,
39
+ "reason": "headless scene package"
40
+ },
41
+ "bench": {
42
+ "enabled": false,
43
+ "reason": "scene propagation covered by unit tests"
44
+ },
45
+ "gate": {
46
+ "enabled": false,
47
+ "reason": "no package binary gate"
48
+ },
49
+ "spike-report": {
50
+ "enabled": false,
51
+ "reason": "not a spike package"
52
+ }
53
+ }
54
+ },
55
+ "scripts": {
56
+ "build": "tsup",
57
+ "test": "vitest run"
58
+ }
59
+ }