@forgeax/engine-ecs 0.1.33 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -18
- package/dist/__tests__/query-idle.unit.test.d.ts +2 -0
- package/dist/__tests__/query-idle.unit.test.d.ts.map +1 -0
- package/dist/__tests__/set-allocation.unit.test.d.ts +2 -0
- package/dist/__tests__/set-allocation.unit.test.d.ts.map +1 -0
- package/dist/__tests__/state-projection.unit.test.d.ts +2 -0
- package/dist/__tests__/state-projection.unit.test.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +579 -623
- package/dist/index.mjs.map +1 -1
- package/dist/projection/index.d.ts +2 -18
- package/dist/projection/index.d.ts.map +1 -1
- package/dist/projection/index.mjs +433 -23
- package/dist/projection/index.mjs.map +1 -1
- package/dist/projection/state-projection.d.ts +37 -0
- package/dist/projection/state-projection.d.ts.map +1 -0
- package/dist/query/query.d.ts.map +1 -1
- package/dist/shared-ref-store.d.ts +0 -24
- package/dist/shared-ref-store.d.ts.map +1 -1
- package/dist/shared.mjs.map +1 -1
- package/dist/storage/archetype-graph.d.ts +2 -0
- package/dist/storage/archetype-graph.d.ts.map +1 -1
- package/dist/storage/change-detection.d.ts +4 -0
- package/dist/storage/change-detection.d.ts.map +1 -1
- package/dist/storage/table.d.ts +6 -3
- package/dist/storage/table.d.ts.map +1 -1
- package/dist/world-internal.d.ts +0 -2
- package/dist/world-internal.d.ts.map +1 -1
- package/dist/world.d.ts +0 -2
- package/dist/world.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/__tests__/component-version-surface.test.ts +1 -7
- package/src/__tests__/derived-range-writer.contract.test.ts +6 -0
- package/src/__tests__/ecs-core-reduction.characterization.test.ts +2 -3
- package/src/__tests__/execution-conflict-boundary.unit.test.ts +4 -0
- package/src/__tests__/externalization-render-read-lease.unit.test.ts +4 -10
- package/src/__tests__/query-idle.unit.test.ts +19 -0
- package/src/__tests__/set-allocation.unit.test.ts +30 -0
- package/src/__tests__/shared-ref-lifetime.unit.test.ts +1 -2
- package/src/__tests__/shared-ref-store.unit.test.ts +2 -34
- package/src/__tests__/state-projection.unit.test.ts +159 -0
- package/src/__tests__/world-health.contract.test.ts +0 -23
- package/src/index.ts +1 -1
- package/src/projection/index.ts +9 -39
- package/src/projection/state-projection.ts +250 -0
- package/src/query/query.ts +23 -16
- package/src/shared-ref-store.ts +0 -70
- package/src/storage/archetype-graph.ts +15 -1
- package/src/storage/change-detection.ts +36 -4
- package/src/storage/table.ts +20 -1
- package/src/world-internal.ts +0 -2
- package/src/world.ts +35 -38
- package/dist/__tests__/structural-evidence.contract.test-d.d.ts +0 -2
- package/dist/__tests__/structural-evidence.contract.test-d.d.ts.map +0 -1
- package/dist/__tests__/structural-evidence.contract.test.d.ts +0 -2
- package/dist/__tests__/structural-evidence.contract.test.d.ts.map +0 -1
- package/dist/storage/structural-evidence.d.ts +0 -30
- package/dist/storage/structural-evidence.d.ts.map +0 -1
- package/src/__tests__/structural-evidence.contract.test-d.ts +0 -6
- package/src/__tests__/structural-evidence.contract.test.ts +0 -49
- package/src/storage/structural-evidence.ts +0 -64
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ mutation, two schedules, resources, time, and optional shared numeric kernels.
|
|
|
11
11
|
> domains.
|
|
12
12
|
|
|
13
13
|
`World` directly owns its graph, entity records, managed stores, relationship
|
|
14
|
-
indexes,
|
|
14
|
+
indexes, row/block revisions, and execution health. Query, command, and
|
|
15
15
|
lifecycle helpers receive only the typed package-internal capabilities they
|
|
16
16
|
actually consume; there is no `WorldCore`, `WorldData`, or second state bag.
|
|
17
17
|
|
|
@@ -199,7 +199,9 @@ for (const span of writable.spans().unwrap()) {
|
|
|
199
199
|
Incremental owners keep their own `changed` Query. Component row versions are
|
|
200
200
|
the value-change authority; `World.getStructureEpoch()` invalidates caches when
|
|
201
201
|
entity/component membership changes. There is no parallel value-event journal
|
|
202
|
-
or projection-change object vocabulary.
|
|
202
|
+
or projection-change object vocabulary. A changed query uses the existing
|
|
203
|
+
component mutation epochs to skip row scans when any required changed input
|
|
204
|
+
has no unobserved write; row versions still select the exact result otherwise.
|
|
203
205
|
|
|
204
206
|
```ts
|
|
205
207
|
const structureEpoch = world.getStructureEpoch();
|
|
@@ -220,24 +222,38 @@ const added = world.query({ read: [Position], added: [Position] }).unwrap();
|
|
|
220
222
|
for (const row of added) initializeProjection(row.entity, row.get(Position));
|
|
221
223
|
```
|
|
222
224
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
225
|
+
State consumers use `createStateProjection` from the projection subpath. A consumer
|
|
226
|
+
retains accepted identities per 256-row block; current membership and component
|
|
227
|
+
revisions discover the next unique source-index work set. Deletion, migration,
|
|
228
|
+
sparse tags and generation reuse reconcile against final World records, without
|
|
229
|
+
a structural event history or an overflow recovery mode.
|
|
226
230
|
|
|
227
231
|
```ts
|
|
228
|
-
import {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
cursor = evidence.cursor;
|
|
235
|
-
} else {
|
|
236
|
-
for (const event of evidence.events) applyStructuralEvent(event);
|
|
237
|
-
cursor = evidence.cursor;
|
|
232
|
+
import { createStateProjection } from '@forgeax/engine-ecs/projection';
|
|
233
|
+
|
|
234
|
+
const projection = createStateProjection(world, [Position]);
|
|
235
|
+
const candidate = projection.read();
|
|
236
|
+
for (const index of candidate.indices) {
|
|
237
|
+
reconcileCurrentEntity(index, projection.entity(index));
|
|
238
238
|
}
|
|
239
|
+
candidate.accept(); // Only after the consumer successfully applies its changes.
|
|
239
240
|
```
|
|
240
241
|
|
|
242
|
+
| Boundary | Contract |
|
|
243
|
+
|:--|:--|
|
|
244
|
+
| Discovery | Enumerates current nonempty relevant tables plus retained deleted blocks; unchanged blocks skip row reads. |
|
|
245
|
+
| Acceptance | Synchronous, consumer-local; a new read, invalidation, or World mutation expires an outstanding candidate. |
|
|
246
|
+
| Failure | Leave the batch unaccepted and read again; poisoned Worlds reject projection. |
|
|
247
|
+
| Scratch | `indices` is borrowed until the next `read`; do not retain it as a snapshot. |
|
|
248
|
+
| Invalidation | Preserves prior identities so deleted sources can still leave the consumer. |
|
|
249
|
+
| Fast check | `isCurrent()` compares accepted World epochs without allocating a batch; unrelated writes may return false. |
|
|
250
|
+
| Root facts | `membershipChanged` and `changedComponents` conservatively identify work domains; `changed(entity, component)` checks a surviving value against acceptance. Removed components require current-membership reconciliation. |
|
|
251
|
+
|
|
252
|
+
The optional third argument selects candidate table membership (any listed
|
|
253
|
+
component); it defaults to the observed components. Sparse candidates conservatively
|
|
254
|
+
include current tables. Consumers still inspect final component membership and
|
|
255
|
+
values: the work set is conservative, never an event stream.
|
|
256
|
+
|
|
241
257
|
The `@forgeax/engine-ecs/world-read` seam is a read-only owner capability for
|
|
242
258
|
hot semantic scalar/array probes. `World.getStructureEpoch()` remains the
|
|
243
259
|
public cache-invalidation primitive; the seam never returns tables, archetypes,
|
|
@@ -296,8 +312,9 @@ runs one update step, and flushes each system's command buffer. Clock readers
|
|
|
296
312
|
receive a stable read view; the scheduler owns writes. Resources are non-owning
|
|
297
313
|
values: Cordis/plugin owners dispose external payloads, not `World`.
|
|
298
314
|
Final shared-reference `release()` returns the payload to its caller.
|
|
299
|
-
|
|
300
|
-
|
|
315
|
+
The store retains no release journal or content-change versions. Runtime content
|
|
316
|
+
uses managed ECS components owned by `assets-runtime`; final release does not
|
|
317
|
+
retain the external payload.
|
|
301
318
|
|
|
302
319
|
## Failure and recovery
|
|
303
320
|
|
|
@@ -369,7 +386,7 @@ their owner instead of being forwarded through the root.
|
|
|
369
386
|
| Entry | Purpose |
|
|
370
387
|
|:--|:--|
|
|
371
388
|
| `@forgeax/engine-ecs` | World, components, relationships, queries, schedules, resources, errors |
|
|
372
|
-
| `@forgeax/engine-ecs/projection` |
|
|
389
|
+
| `@forgeax/engine-ecs/projection` | Current-state block projection, render read versions, and numeric spans |
|
|
373
390
|
| `@forgeax/engine-ecs/shared` | Shared numeric kernel contracts |
|
|
374
391
|
| `@forgeax/engine-ecs/world-read` | Safe semantic scalar/array reads for owner-package hot paths |
|
|
375
392
|
| `@forgeax/engine-ecs/externalization` | Generic component projection and entity remap |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-idle.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/query-idle.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-allocation.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/set-allocation.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-projection.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/state-projection.unit.test.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -137,7 +137,7 @@ export type { Query, QueryCreationError, QueryDescriptor, QueryRow, QuerySpan, }
|
|
|
137
137
|
* // the SharedRefStore publishes release evidence at rc=0.
|
|
138
138
|
* ```
|
|
139
139
|
*/
|
|
140
|
-
export type { SharedRefReleaseEvidence
|
|
140
|
+
export type { SharedRefReleaseEvidence } from './shared-ref-store.js';
|
|
141
141
|
/**
|
|
142
142
|
* ECS-managed handle store (M1). Owns the lifecycle of every
|
|
143
143
|
* `Handle<T, 'unique'>` derived from `ref<T>` schema fields - World hooks
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA0DH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAerF;;;;;;GAMG;AACH,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAA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