aiecsjs 0.3.1 → 0.4.0
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/CHANGELOG.md +18 -1
- package/README.md +16 -14
- package/README_ZHTW.md +16 -14
- package/STABILITY.md +11 -8
- package/STABILITY_ZHTW.md +12 -9
- package/api.json +41 -16
- package/dist/{chunk-AGHSWLNQ.cjs → chunk-B777DQR7.cjs} +2 -2
- package/dist/{chunk-AGHSWLNQ.cjs.map → chunk-B777DQR7.cjs.map} +1 -1
- package/dist/{chunk-QOKIEF7C.js → chunk-CTESP3XL.js} +2 -2
- package/dist/{chunk-QOKIEF7C.js.map → chunk-CTESP3XL.js.map} +1 -1
- package/dist/{chunk-L5CMKMIP.js → chunk-F7KNZ27O.js} +2 -2
- package/dist/{chunk-L5CMKMIP.js.map → chunk-F7KNZ27O.js.map} +1 -1
- package/dist/{chunk-37HMYMJG.cjs → chunk-RHH5JA74.cjs} +2 -2
- package/dist/{chunk-37HMYMJG.cjs.map → chunk-RHH5JA74.cjs.map} +1 -1
- package/dist/{chunk-4RPFOVQC.cjs → chunk-SJDWI3OZ.cjs} +2 -2
- package/dist/{chunk-4RPFOVQC.cjs.map → chunk-SJDWI3OZ.cjs.map} +1 -1
- package/dist/{chunk-FDXCXNZK.js → chunk-SQWZUC2Q.js} +2 -2
- package/dist/{chunk-FDXCXNZK.js.map → chunk-SQWZUC2Q.js.map} +1 -1
- package/dist/commands.cjs +1 -1
- package/dist/commands.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/observers.cjs +1 -1
- package/dist/observers.js +1 -1
- package/dist/relations.cjs +1 -1
- package/dist/relations.cjs.map +1 -1
- package/dist/relations.d.cts +20 -1
- package/dist/relations.d.ts +20 -1
- package/dist/relations.js +1 -1
- package/dist/relations.js.map +1 -1
- package/dist/serialize.cjs +1 -1
- package/dist/serialize.js +1 -1
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +1 -1
- package/llms-full.txt +45 -23
- package/package.json +7 -5
package/llms-full.txt
CHANGED
|
@@ -341,21 +341,22 @@ forEachEntity(world, q, (e) => { cb.remove(e, SomeTag) })
|
|
|
341
341
|
flush(cb)
|
|
342
342
|
```
|
|
343
343
|
|
|
344
|
-
### Relations and hierarchies
|
|
344
|
+
### Relations and hierarchies
|
|
345
345
|
|
|
346
|
-
>
|
|
346
|
+
> The Relations API is **stable since 0.4.0**. The graph API (`defineRelation` / `addRelation` / `removeRelation` / `getRelationTargets` / `getRelationData`) and the built-in `ChildOf` relation are frozen for the 1.x track.
|
|
347
347
|
|
|
348
348
|
```ts
|
|
349
|
-
import { defineRelation, addRelation, ChildOf, getRelationTargets } from 'aiecsjs/relations'
|
|
349
|
+
import { defineRelation, addRelation, ChildOf, getRelationTargets, getRelationData } from 'aiecsjs/relations'
|
|
350
350
|
|
|
351
|
-
const Likes = defineRelation()
|
|
352
|
-
addRelation(world, alice, Likes, bob)
|
|
351
|
+
const Likes = defineRelation<{ since: number }>()
|
|
352
|
+
addRelation(world, alice, Likes, bob, { since: 2020 })
|
|
353
353
|
addRelation(world, alice, ChildOf, parent)
|
|
354
354
|
|
|
355
355
|
const parentOfAlice = getRelationTargets(world, alice, ChildOf)
|
|
356
|
+
const likedSince = getRelationData(world, alice, Likes, bob) // { since: 2020 }
|
|
356
357
|
```
|
|
357
358
|
|
|
358
|
-
|
|
359
|
+
Exclusive relations (one target only) and the `getRelationData` reader are stable as of 0.4.0. Wildcard relation queries and serialisation of relation graphs remain future work and are not part of the frozen surface.
|
|
359
360
|
|
|
360
361
|
## API Reference
|
|
361
362
|
|
|
@@ -479,15 +480,16 @@ const Types = { i8, u8, i16, u16, i32, u32, f32, f64, eid, bool } as const
|
|
|
479
480
|
| `attachWorld` | `(buffer, opts?) => World` | experimental |
|
|
480
481
|
| `detachWorld` | `(world) => void` | experimental |
|
|
481
482
|
|
|
482
|
-
### Relations — `aiecsjs/relations`
|
|
483
|
+
### Relations — `aiecsjs/relations`
|
|
483
484
|
|
|
484
485
|
| Function | Signature | Stability |
|
|
485
486
|
|---|---|---|
|
|
486
|
-
| `defineRelation` | `<T>(opts?) => Relation<T>` |
|
|
487
|
-
| `addRelation` | `(world, src, rel, tgt, data?) => void` |
|
|
488
|
-
| `removeRelation` | `(world, src, rel, tgt) => void` |
|
|
489
|
-
| `getRelationTargets` | `(world, src, rel) => readonly EntityId[]` |
|
|
490
|
-
| `
|
|
487
|
+
| `defineRelation` | `<T>(opts?) => Relation<T>` | stable |
|
|
488
|
+
| `addRelation` | `(world, src, rel, tgt, data?) => void` | stable |
|
|
489
|
+
| `removeRelation` | `(world, src, rel, tgt) => void` | stable |
|
|
490
|
+
| `getRelationTargets` | `(world, src, rel) => readonly EntityId[]` | stable |
|
|
491
|
+
| `getRelationData` | `<T>(world, src, rel, tgt) => T \| undefined` | stable (since 0.4.0) |
|
|
492
|
+
| `ChildOf` (constant) | `Relation` | stable |
|
|
491
493
|
|
|
492
494
|
### Utility — `aiecsjs`
|
|
493
495
|
|
|
@@ -864,7 +866,7 @@ if (VERSION.startsWith('0.')) {
|
|
|
864
866
|
|
|
865
867
|
### Stability contract
|
|
866
868
|
|
|
867
|
-
See [`STABILITY.md`](./STABILITY.md). In short: imports from `aiecsjs` (root) are **stable** within 0.x minors.
|
|
869
|
+
See [`STABILITY.md`](./STABILITY.md). In short: imports from `aiecsjs` (root) are **stable** within 0.x minors. `aiecsjs/relations` is **stable** since 0.4.0; `aiecsjs/worker` is **experimental**. Anything in `aiecsjs/internal` is **internal** — do not import.
|
|
868
870
|
|
|
869
871
|
### Telemetry / privacy
|
|
870
872
|
|
|
@@ -909,7 +911,7 @@ A: It will be on first stable publish. Until then, the docs are the contract.
|
|
|
909
911
|
|
|
910
912
|
- **Max entity count** is capped by `indexBits` × `generationBits`. Default 24 + 8 = 16M entities × 256 recycles.
|
|
911
913
|
- **No automatic system scheduler / parallel execution** in 0.1. Systems run in `pipe()` order on one thread (you can launch additional workers manually).
|
|
912
|
-
- **Relations API is
|
|
914
|
+
- **Relations API (`aiecsjs/relations`) is stable since 0.4.0.** Wildcard relation queries and relation-graph serialisation remain future work.
|
|
913
915
|
- **AoS components** not SAB-shareable across workers.
|
|
914
916
|
- **Network delta serializer** wire format is experimental in 0.1; may change.
|
|
915
917
|
- **WebGPU integration is one-way** (CPU → GPU). No compute-shader system generation.
|
|
@@ -939,6 +941,23 @@ All notable changes to `aiecsjs` are recorded in this file.
|
|
|
939
941
|
|
|
940
942
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
941
943
|
|
|
944
|
+
## [0.4.0] - 2026-05-29
|
|
945
|
+
|
|
946
|
+
### Added
|
|
947
|
+
|
|
948
|
+
- **`getRelationData(world, source, rel, target)`**: new stable export on `aiecsjs/relations`. Returns the `data` payload attached via `addRelation`, or `undefined` when no such edge exists or no data was stored. Closes the write-only-data asymmetry present since 0.1: `addRelation` accepted a data argument but there was no corresponding public read path.
|
|
949
|
+
|
|
950
|
+
### Changed
|
|
951
|
+
|
|
952
|
+
- **`aiecsjs/relations` graduated from experimental to stable.** The graph API (`defineRelation`, `addRelation`, `removeRelation`, `getRelationTargets`, `getRelationData`) and the built-in `ChildOf` relation are now frozen for the 1.x track. See [`STABILITY.md`](./STABILITY.md) for the full stability contract, including the raw slot-keying ABA semantic.
|
|
953
|
+
- **`aiecsjs/worker` remains experimental.** True SAB shared-memory column aliasing is deferred; the worker sub-path continues on snapshot-copy semantics.
|
|
954
|
+
|
|
955
|
+
### Build & Tooling
|
|
956
|
+
|
|
957
|
+
- **size-limit → `scripts/check-size.mjs`**: replaced the `size-limit` + `@size-limit/file` dev dependencies with a zero-dependency script that measures transitive chunk-closure gzip size per ESM entry. Required because `tsup splitting: true` (introduced in 0.3.1) makes each entry a thin re-export shell; the vanilla single-file measurement reported ~899 B for index when the true closure is ~7295 B. The new script resolves chunk imports recursively via BFS, sums per-file gzip, and enforces per-entry budgets.
|
|
958
|
+
- **npm → pnpm**: migrated from `package-lock.json` to `pnpm-lock.yaml`. Added `"packageManager": "pnpm@9.12.3"` and `"publishConfig": { "access": "public" }`. CI and publish workflows updated to use `pnpm/action-setup@v6` + `pnpm install --frozen-lockfile`. `npm publish --provenance --access public` in the publish workflow is intentionally preserved (OIDC trusted publishing requires npm CLI, not pnpm publish).
|
|
959
|
+
- **Coverage tests added + unreachable gaps documented**: new tests cover previously-unreachable paths in `serialize.ts`, `component.ts`, `query.ts`, and `loop.ts`. Thresholds updated to the honestly-achieved floor (statements 95 / branches 81 / functions 98 / lines 99). Unreachable-by-design gaps are now documented in `vitest.config.ts` with Chesterton rationale.
|
|
960
|
+
|
|
942
961
|
## [0.3.1] - 2026-05-29
|
|
943
962
|
|
|
944
963
|
### Fixed
|
|
@@ -970,7 +989,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
970
989
|
|
|
971
990
|
- Add `pipeAsync` for async system composition.
|
|
972
991
|
- Doc-test harness so README code blocks are mechanically verified.
|
|
973
|
-
- Promote `aiecsjs/
|
|
992
|
+
- Promote `aiecsjs/worker` to `stable` once true SAB shared-memory column aliasing is implemented.
|
|
974
993
|
- Document the 8-bit generation wrap caveat in [STABILITY.md](./STABILITY.md): with the
|
|
975
994
|
default `generationBits=8`, a single slot recycled 256 times wraps back to its
|
|
976
995
|
starting generation, briefly re-opening the ABA window. Safe for v0.5 shmup
|
|
@@ -1326,17 +1345,20 @@ The entire subpath is **experimental** in 0.x. **In 0.x the implementation is a
|
|
|
1326
1345
|
| `attachWorld` | experimental | 0.1.0 | |
|
|
1327
1346
|
| `detachWorld` | experimental | 0.1.0 | |
|
|
1328
1347
|
|
|
1329
|
-
### `aiecsjs/relations` (
|
|
1348
|
+
### `aiecsjs/relations` (stable sub-path since 0.4.0)
|
|
1349
|
+
|
|
1350
|
+
The relations sub-path is **stable** as of 0.4.0. The graph API (`defineRelation`, `addRelation`, `removeRelation`, `getRelationTargets`, `getRelationData`) and the built-in `ChildOf` relation are frozen for the 1.x track.
|
|
1330
1351
|
|
|
1331
|
-
|
|
1352
|
+
**Raw slot-keying ABA semantic:** relation storage keys edges by raw entity slot index (`entityId & indexMask`), not by the full packed EntityId (which includes a generation counter). If entity A is destroyed and a different entity B is later created occupying the same slot, B will inherit A's outgoing and incoming edges unless the destroy cleanup hook ran. The cleanup hook fires automatically when `destroyEntity` is called, so normal usage is safe. Callers holding cached EntityId values across destroy/recreate cycles should validate liveness with `entityExists` before reading relation data if ABA is a concern.
|
|
1332
1353
|
|
|
1333
1354
|
| Export | Stability | Since | Notes |
|
|
1334
1355
|
|---|---|---|---|
|
|
1335
|
-
| `defineRelation` |
|
|
1336
|
-
| `addRelation` |
|
|
1337
|
-
| `removeRelation` |
|
|
1338
|
-
| `getRelationTargets` |
|
|
1339
|
-
| `ChildOf` (constant) |
|
|
1356
|
+
| `defineRelation` | stable | 0.1.0 | |
|
|
1357
|
+
| `addRelation` | stable | 0.1.0 | |
|
|
1358
|
+
| `removeRelation` | stable | 0.1.0 | |
|
|
1359
|
+
| `getRelationTargets` | stable | 0.1.0 | |
|
|
1360
|
+
| `ChildOf` (constant) | stable | 0.1.0 | Built-in exclusive relation. |
|
|
1361
|
+
| `getRelationData` | stable | 0.4.0 | Returns the data payload attached via `addRelation`, or `undefined` if no such edge or no data was stored. Subject to the raw slot-keying ABA semantic described above. |
|
|
1340
1362
|
|
|
1341
1363
|
### `aiecsjs/internal/*`
|
|
1342
1364
|
|
|
@@ -1349,7 +1371,7 @@ Everything under this prefix is **internal**. It exists for the implementation's
|
|
|
1349
1371
|
| 0.1.x | Core surface (world, entity, component, query, system, loop, commands, observers, serialize) | Initial publish; all marked experimental at the package level but per-export stable where listed. |
|
|
1350
1372
|
| 0.2.0 | Safety + alignment | Prototype-pollution hardening, observer `{ signal? }`, `disposeWorld` alias, `getEntityGeneration` / `packEntity` re-labelled experimental, `verify:llms` gate. See [CHANGELOG.md](./CHANGELOG.md#020---2026-05-28). |
|
|
1351
1373
|
| 0.3.x | EntityRef + generation packing | ABA-safe; `getEntityGeneration` / `packEntity` → stable. |
|
|
1352
|
-
| 0.4
|
|
1374
|
+
| 0.4.0 | Relations stabilisation | `aiecsjs/relations` graduated to stable; `getRelationData` added. `aiecsjs/worker` remains experimental (true SAB shared-memory columns deferred). |
|
|
1353
1375
|
| 0.6+ | Multi-World snapshot diff transport (placeholder) | experimental — design TBD. |
|
|
1354
1376
|
| 1.0.0 | API freeze | All `stable` exports frozen for 1.x. |
|
|
1355
1377
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiecsjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "TypeScript-first archetype ECS with TypedArray SoA, SAB-ready snapshot transport, and AI-readable docs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -87,19 +87,21 @@
|
|
|
87
87
|
"verify:dist": "node scripts/check-dist-subpaths.mjs",
|
|
88
88
|
"build:llms": "node scripts/build-llms-full.mjs",
|
|
89
89
|
"verify:llms": "node scripts/build-llms-full.mjs --check",
|
|
90
|
-
"size": "size
|
|
90
|
+
"check:size": "node scripts/check-size.mjs",
|
|
91
91
|
"coverage": "vitest run --coverage",
|
|
92
|
-
"prepublishOnly": "
|
|
92
|
+
"prepublishOnly": "pnpm typecheck && pnpm lint && pnpm coverage && pnpm build && pnpm verify:dist && pnpm verify:exports && pnpm verify:llms && pnpm check:size"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"@biomejs/biome": "^1.9.4",
|
|
96
|
-
"@size-limit/file": "^12.1.0",
|
|
97
96
|
"@vitest/coverage-v8": "^4.1.7",
|
|
98
97
|
"fast-check": "^4.8.0",
|
|
99
|
-
"size-limit": "^12.1.0",
|
|
100
98
|
"tsup": "^8.0.0",
|
|
101
99
|
"typescript": "^5.5.0",
|
|
102
100
|
"vite": "^8.0.14",
|
|
103
101
|
"vitest": "^4.1.7"
|
|
102
|
+
},
|
|
103
|
+
"packageManager": "pnpm@9.12.3",
|
|
104
|
+
"publishConfig": {
|
|
105
|
+
"access": "public"
|
|
104
106
|
}
|
|
105
107
|
}
|