@forgeax/engine-ecs 0.0.0-dev.8d955ade1c79

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 (383) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +278 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/__fixtures__/field-shape-fixture.d.ts +16 -0
  5. package/dist/__fixtures__/field-shape-fixture.d.ts.map +1 -0
  6. package/dist/__tests__/__fixtures__/inspect-scripts.snapshot.d.ts +3 -0
  7. package/dist/__tests__/__fixtures__/inspect-scripts.snapshot.d.ts.map +1 -0
  8. package/dist/__tests__/archetype.unit.test.d.ts +2 -0
  9. package/dist/__tests__/archetype.unit.test.d.ts.map +1 -0
  10. package/dist/__tests__/array-handle-element.test-d.d.ts +2 -0
  11. package/dist/__tests__/array-handle-element.test-d.d.ts.map +1 -0
  12. package/dist/__tests__/buffer-array-vocab.test-d.d.ts +2 -0
  13. package/dist/__tests__/buffer-array-vocab.test-d.d.ts.map +1 -0
  14. package/dist/__tests__/buffer-field-input-widen.unit.test.d.ts +2 -0
  15. package/dist/__tests__/buffer-field-input-widen.unit.test.d.ts.map +1 -0
  16. package/dist/__tests__/buffer-pool.test-d.d.ts +2 -0
  17. package/dist/__tests__/buffer-pool.test-d.d.ts.map +1 -0
  18. package/dist/__tests__/change-detection.unit.test.d.ts +2 -0
  19. package/dist/__tests__/change-detection.unit.test.d.ts.map +1 -0
  20. package/dist/__tests__/command-buffer.test.d.ts +2 -0
  21. package/dist/__tests__/command-buffer.test.d.ts.map +1 -0
  22. package/dist/__tests__/commands-deferred.unit.test.d.ts +2 -0
  23. package/dist/__tests__/commands-deferred.unit.test.d.ts.map +1 -0
  24. package/dist/__tests__/component-catalog.test.d.ts +2 -0
  25. package/dist/__tests__/component-catalog.test.d.ts.map +1 -0
  26. package/dist/__tests__/component-definition-identity.unit.test.d.ts +2 -0
  27. package/dist/__tests__/component-definition-identity.unit.test.d.ts.map +1 -0
  28. package/dist/__tests__/component-nan-preflight.unit.test.d.ts +2 -0
  29. package/dist/__tests__/component-nan-preflight.unit.test.d.ts.map +1 -0
  30. package/dist/__tests__/component-schema.test-d.d.ts +2 -0
  31. package/dist/__tests__/component-schema.test-d.d.ts.map +1 -0
  32. package/dist/__tests__/component-schema.test.d.ts +2 -0
  33. package/dist/__tests__/component-schema.test.d.ts.map +1 -0
  34. package/dist/__tests__/define-component-options.test-d.d.ts +2 -0
  35. package/dist/__tests__/define-component-options.test-d.d.ts.map +1 -0
  36. package/dist/__tests__/deprecated-vocab-rejection.unit.test.d.ts +2 -0
  37. package/dist/__tests__/deprecated-vocab-rejection.unit.test.d.ts.map +1 -0
  38. package/dist/__tests__/despawn-all.unit.test.d.ts +2 -0
  39. package/dist/__tests__/despawn-all.unit.test.d.ts.map +1 -0
  40. package/dist/__tests__/ecs-core-reduction.characterization.test.d.ts +2 -0
  41. package/dist/__tests__/ecs-core-reduction.characterization.test.d.ts.map +1 -0
  42. package/dist/__tests__/ecs-core-reduction.perf.test.d.ts +2 -0
  43. package/dist/__tests__/ecs-core-reduction.perf.test.d.ts.map +1 -0
  44. package/dist/__tests__/ecs-error-code-31.test-d.d.ts +2 -0
  45. package/dist/__tests__/ecs-error-code-31.test-d.d.ts.map +1 -0
  46. package/dist/__tests__/entity-disabling.unit.test.d.ts +2 -0
  47. package/dist/__tests__/entity-disabling.unit.test.d.ts.map +1 -0
  48. package/dist/__tests__/entity-handle-codec-parity.unit.test.d.ts +2 -0
  49. package/dist/__tests__/entity-handle-codec-parity.unit.test.d.ts.map +1 -0
  50. package/dist/__tests__/errors.unit.test.d.ts +2 -0
  51. package/dist/__tests__/errors.unit.test.d.ts.map +1 -0
  52. package/dist/__tests__/execution-conflict-boundary.unit.test.d.ts +2 -0
  53. package/dist/__tests__/execution-conflict-boundary.unit.test.d.ts.map +1 -0
  54. package/dist/__tests__/execution-shared-storage.unit.test.d.ts +2 -0
  55. package/dist/__tests__/execution-shared-storage.unit.test.d.ts.map +1 -0
  56. package/dist/__tests__/externalization-portable-value.unit.test.d.ts +2 -0
  57. package/dist/__tests__/externalization-portable-value.unit.test.d.ts.map +1 -0
  58. package/dist/__tests__/externalization-projection.unit.test.d.ts +2 -0
  59. package/dist/__tests__/externalization-projection.unit.test.d.ts.map +1 -0
  60. package/dist/__tests__/externalization-render-read-lease.test-d.d.ts +2 -0
  61. package/dist/__tests__/externalization-render-read-lease.test-d.d.ts.map +1 -0
  62. package/dist/__tests__/externalization-render-read-lease.unit.test.d.ts +2 -0
  63. package/dist/__tests__/externalization-render-read-lease.unit.test.d.ts.map +1 -0
  64. package/dist/__tests__/externalization-root-surface.unit.test.d.ts +2 -0
  65. package/dist/__tests__/externalization-root-surface.unit.test.d.ts.map +1 -0
  66. package/dist/__tests__/field-enum-labels-reflection.test.d.ts +2 -0
  67. package/dist/__tests__/field-enum-labels-reflection.test.d.ts.map +1 -0
  68. package/dist/__tests__/field-shape-fixture.test.d.ts +2 -0
  69. package/dist/__tests__/field-shape-fixture.test.d.ts.map +1 -0
  70. package/dist/__tests__/field-transient-reflection.test.d.ts +2 -0
  71. package/dist/__tests__/field-transient-reflection.test.d.ts.map +1 -0
  72. package/dist/__tests__/field-value-type.test-d.d.ts +2 -0
  73. package/dist/__tests__/field-value-type.test-d.d.ts.map +1 -0
  74. package/dist/__tests__/fixed-update.unit.test.d.ts +2 -0
  75. package/dist/__tests__/fixed-update.unit.test.d.ts.map +1 -0
  76. package/dist/__tests__/handle.test-d.d.ts +2 -0
  77. package/dist/__tests__/handle.test-d.d.ts.map +1 -0
  78. package/dist/__tests__/hierarchy.unit.test.d.ts +2 -0
  79. package/dist/__tests__/hierarchy.unit.test.d.ts.map +1 -0
  80. package/dist/__tests__/managed-array-vocab.test-d.d.ts +2 -0
  81. package/dist/__tests__/managed-array-vocab.test-d.d.ts.map +1 -0
  82. package/dist/__tests__/minimal-example.test-d.d.ts +2 -0
  83. package/dist/__tests__/minimal-example.test-d.d.ts.map +1 -0
  84. package/dist/__tests__/name-read-types.test-d.d.ts +2 -0
  85. package/dist/__tests__/name-read-types.test-d.d.ts.map +1 -0
  86. package/dist/__tests__/plugin-service.test.d.ts +2 -0
  87. package/dist/__tests__/plugin-service.test.d.ts.map +1 -0
  88. package/dist/__tests__/query-combinations.unit.test.d.ts +2 -0
  89. package/dist/__tests__/query-combinations.unit.test.d.ts.map +1 -0
  90. package/dist/__tests__/query-light-extract-flat-column-ratio.perf.test.d.ts +2 -0
  91. package/dist/__tests__/query-light-extract-flat-column-ratio.perf.test.d.ts.map +1 -0
  92. package/dist/__tests__/query-storage-trends.perf.test.d.ts +2 -0
  93. package/dist/__tests__/query-storage-trends.perf.test.d.ts.map +1 -0
  94. package/dist/__tests__/query-trs-flat-column-ratio.perf.test.d.ts +2 -0
  95. package/dist/__tests__/query-trs-flat-column-ratio.perf.test.d.ts.map +1 -0
  96. package/dist/__tests__/query.unit.test.d.ts +2 -0
  97. package/dist/__tests__/query.unit.test.d.ts.map +1 -0
  98. package/dist/__tests__/relationship-index.perf.test.d.ts +2 -0
  99. package/dist/__tests__/relationship-index.perf.test.d.ts.map +1 -0
  100. package/dist/__tests__/relationship-index.test.d.ts +2 -0
  101. package/dist/__tests__/relationship-index.test.d.ts.map +1 -0
  102. package/dist/__tests__/scalar-field-type-owner.test-d.d.ts +2 -0
  103. package/dist/__tests__/scalar-field-type-owner.test-d.d.ts.map +1 -0
  104. package/dist/__tests__/schedule-determinism.unit.test.d.ts +2 -0
  105. package/dist/__tests__/schedule-determinism.unit.test.d.ts.map +1 -0
  106. package/dist/__tests__/schedule-inspection.unit.test.d.ts +2 -0
  107. package/dist/__tests__/schedule-inspection.unit.test.d.ts.map +1 -0
  108. package/dist/__tests__/schedule-scope-error.unit.test.d.ts +2 -0
  109. package/dist/__tests__/schedule-scope-error.unit.test.d.ts.map +1 -0
  110. package/dist/__tests__/schedule-token.unit.test.d.ts +2 -0
  111. package/dist/__tests__/schedule-token.unit.test.d.ts.map +1 -0
  112. package/dist/__tests__/schema-vocab.test-d.d.ts +2 -0
  113. package/dist/__tests__/schema-vocab.test-d.d.ts.map +1 -0
  114. package/dist/__tests__/serialization.unit.test.d.ts +2 -0
  115. package/dist/__tests__/serialization.unit.test.d.ts.map +1 -0
  116. package/dist/__tests__/shared-kernel-eligibility.test-d.d.ts +2 -0
  117. package/dist/__tests__/shared-kernel-eligibility.test-d.d.ts.map +1 -0
  118. package/dist/__tests__/shared-kernel-eligibility.unit.test.d.ts +2 -0
  119. package/dist/__tests__/shared-kernel-eligibility.unit.test.d.ts.map +1 -0
  120. package/dist/__tests__/shared-ref-store.unit.test.d.ts +2 -0
  121. package/dist/__tests__/shared-ref-store.unit.test.d.ts.map +1 -0
  122. package/dist/__tests__/sparse-tag.unit.test.d.ts +2 -0
  123. package/dist/__tests__/sparse-tag.unit.test.d.ts.map +1 -0
  124. package/dist/__tests__/spawn-field-error.test-d.d.ts +2 -0
  125. package/dist/__tests__/spawn-field-error.test-d.d.ts.map +1 -0
  126. package/dist/__tests__/stale-error.test-d.d.ts +2 -0
  127. package/dist/__tests__/stale-error.test-d.d.ts.map +1 -0
  128. package/dist/__tests__/string-view-symmetry.test-d.d.ts +2 -0
  129. package/dist/__tests__/string-view-symmetry.test-d.d.ts.map +1 -0
  130. package/dist/__tests__/string-vocab.test-d.d.ts +2 -0
  131. package/dist/__tests__/string-vocab.test-d.d.ts.map +1 -0
  132. package/dist/__tests__/structure-epoch-boundaries.unit.test.d.ts +2 -0
  133. package/dist/__tests__/structure-epoch-boundaries.unit.test.d.ts.map +1 -0
  134. package/dist/__tests__/structure-epoch.unit.test.d.ts +2 -0
  135. package/dist/__tests__/structure-epoch.unit.test.d.ts.map +1 -0
  136. package/dist/__tests__/table-archetype-mapping.unit.test.d.ts +2 -0
  137. package/dist/__tests__/table-archetype-mapping.unit.test.d.ts.map +1 -0
  138. package/dist/__tests__/time.unit.test.d.ts +2 -0
  139. package/dist/__tests__/time.unit.test.d.ts.map +1 -0
  140. package/dist/__tests__/types.test-d.d.ts +2 -0
  141. package/dist/__tests__/types.test-d.d.ts.map +1 -0
  142. package/dist/__tests__/unique-ref-store.unit.test.d.ts +2 -0
  143. package/dist/__tests__/unique-ref-store.unit.test.d.ts.map +1 -0
  144. package/dist/__tests__/utils/handle-numeric.d.ts +14 -0
  145. package/dist/__tests__/utils/handle-numeric.d.ts.map +1 -0
  146. package/dist/__tests__/validation-root-surface.unit.test.d.ts +2 -0
  147. package/dist/__tests__/validation-root-surface.unit.test.d.ts.map +1 -0
  148. package/dist/__tests__/visibility-atomic-write.unit.test.d.ts +2 -0
  149. package/dist/__tests__/visibility-atomic-write.unit.test.d.ts.map +1 -0
  150. package/dist/__tests__/world-change-journal.unit.test.d.ts +2 -0
  151. package/dist/__tests__/world-change-journal.unit.test.d.ts.map +1 -0
  152. package/dist/__tests__/world-characterization.unit.test.d.ts +2 -0
  153. package/dist/__tests__/world-characterization.unit.test.d.ts.map +1 -0
  154. package/dist/__tests__/world-consumer-inference.test-d.d.ts +2 -0
  155. package/dist/__tests__/world-consumer-inference.test-d.d.ts.map +1 -0
  156. package/dist/__tests__/world-health.contract.test.d.ts +2 -0
  157. package/dist/__tests__/world-health.contract.test.d.ts.map +1 -0
  158. package/dist/__tests__/world-inspection.test.d.ts +2 -0
  159. package/dist/__tests__/world-inspection.test.d.ts.map +1 -0
  160. package/dist/__tests__/world-internal-identity.unit.test.d.ts +2 -0
  161. package/dist/__tests__/world-internal-identity.unit.test.d.ts.map +1 -0
  162. package/dist/__tests__/world-managed-roundtrip.unit.test.d.ts +2 -0
  163. package/dist/__tests__/world-managed-roundtrip.unit.test.d.ts.map +1 -0
  164. package/dist/__tests__/world-scheduling.m4.test.d.ts +2 -0
  165. package/dist/__tests__/world-scheduling.m4.test.d.ts.map +1 -0
  166. package/dist/__tests__/world-unique-roundtrip.unit.test.d.ts +2 -0
  167. package/dist/__tests__/world-unique-roundtrip.unit.test.d.ts.map +1 -0
  168. package/dist/__tests__/world.test-d.d.ts +2 -0
  169. package/dist/__tests__/world.test-d.d.ts.map +1 -0
  170. package/dist/buffer-pool.d.ts +109 -0
  171. package/dist/buffer-pool.d.ts.map +1 -0
  172. package/dist/commands.d.ts +93 -0
  173. package/dist/commands.d.ts.map +1 -0
  174. package/dist/component-default-fallback.d.ts +88 -0
  175. package/dist/component-default-fallback.d.ts.map +1 -0
  176. package/dist/component-schema.d.ts +34 -0
  177. package/dist/component-schema.d.ts.map +1 -0
  178. package/dist/component-value-validate.d.ts +29 -0
  179. package/dist/component-value-validate.d.ts.map +1 -0
  180. package/dist/component.d.ts +581 -0
  181. package/dist/component.d.ts.map +1 -0
  182. package/dist/entity-handle.d.ts +68 -0
  183. package/dist/entity-handle.d.ts.map +1 -0
  184. package/dist/entity.d.ts +86 -0
  185. package/dist/entity.d.ts.map +1 -0
  186. package/dist/errors/query-and-component-errors.d.ts +132 -0
  187. package/dist/errors/query-and-component-errors.d.ts.map +1 -0
  188. package/dist/errors/relationship-errors.d.ts +112 -0
  189. package/dist/errors/relationship-errors.d.ts.map +1 -0
  190. package/dist/errors/sprite-and-shared-errors.d.ts +107 -0
  191. package/dist/errors/sprite-and-shared-errors.d.ts.map +1 -0
  192. package/dist/errors/validation-errors.d.ts +229 -0
  193. package/dist/errors/validation-errors.d.ts.map +1 -0
  194. package/dist/errors.d.ts +763 -0
  195. package/dist/errors.d.ts.map +1 -0
  196. package/dist/execution/shared-kernel.d.ts +106 -0
  197. package/dist/execution/shared-kernel.d.ts.map +1 -0
  198. package/dist/externalization/index.d.ts +31 -0
  199. package/dist/externalization/index.d.ts.map +1 -0
  200. package/dist/externalization/index.mjs +298 -0
  201. package/dist/externalization/index.mjs.map +1 -0
  202. package/dist/index.d.ts +261 -0
  203. package/dist/index.d.ts.map +1 -0
  204. package/dist/index.mjs +7422 -0
  205. package/dist/index.mjs.map +1 -0
  206. package/dist/internal.mjs +479 -0
  207. package/dist/internal.mjs.map +1 -0
  208. package/dist/plugin-service.d.ts +11 -0
  209. package/dist/plugin-service.d.ts.map +1 -0
  210. package/dist/projection/index.d.ts +103 -0
  211. package/dist/projection/index.d.ts.map +1 -0
  212. package/dist/projection/index.mjs +615 -0
  213. package/dist/projection/index.mjs.map +1 -0
  214. package/dist/query/query.d.ts +58 -0
  215. package/dist/query/query.d.ts.map +1 -0
  216. package/dist/relationship-index.d.ts +81 -0
  217. package/dist/relationship-index.d.ts.map +1 -0
  218. package/dist/resource.d.ts +70 -0
  219. package/dist/resource.d.ts.map +1 -0
  220. package/dist/schedule-token.d.ts +16 -0
  221. package/dist/schedule-token.d.ts.map +1 -0
  222. package/dist/schedule.d.ts +271 -0
  223. package/dist/schedule.d.ts.map +1 -0
  224. package/dist/shared-ref-store.d.ts +144 -0
  225. package/dist/shared-ref-store.d.ts.map +1 -0
  226. package/dist/shared.d.ts +3 -0
  227. package/dist/shared.d.ts.map +1 -0
  228. package/dist/shared.mjs +364 -0
  229. package/dist/shared.mjs.map +1 -0
  230. package/dist/storage/archetype-graph.d.ts +54 -0
  231. package/dist/storage/archetype-graph.d.ts.map +1 -0
  232. package/dist/storage/archetype.d.ts +23 -0
  233. package/dist/storage/archetype.d.ts.map +1 -0
  234. package/dist/storage/change-detection.d.ts +40 -0
  235. package/dist/storage/change-detection.d.ts.map +1 -0
  236. package/dist/storage/column.d.ts +111 -0
  237. package/dist/storage/column.d.ts.map +1 -0
  238. package/dist/storage/table.d.ts +29 -0
  239. package/dist/storage/table.d.ts.map +1 -0
  240. package/dist/time.d.ts +57 -0
  241. package/dist/time.d.ts.map +1 -0
  242. package/dist/unique-ref-store.d.ts +105 -0
  243. package/dist/unique-ref-store.d.ts.map +1 -0
  244. package/dist/world-change-journal.d.ts +34 -0
  245. package/dist/world-change-journal.d.ts.map +1 -0
  246. package/dist/world-component-access.d.ts +265 -0
  247. package/dist/world-component-access.d.ts.map +1 -0
  248. package/dist/world-component-storage.d.ts +282 -0
  249. package/dist/world-component-storage.d.ts.map +1 -0
  250. package/dist/world-core.d.ts +39 -0
  251. package/dist/world-core.d.ts.map +1 -0
  252. package/dist/world-entity-lifecycle.d.ts +30 -0
  253. package/dist/world-entity-lifecycle.d.ts.map +1 -0
  254. package/dist/world-internal.d.ts +14 -0
  255. package/dist/world-internal.d.ts.map +1 -0
  256. package/dist/world-scheduling.d.ts +30 -0
  257. package/dist/world-scheduling.d.ts.map +1 -0
  258. package/dist/world.d.ts +620 -0
  259. package/dist/world.d.ts.map +1 -0
  260. package/package.json +77 -0
  261. package/src/__fixtures__/field-shape-fixture.ts +30 -0
  262. package/src/__tests__/__fixtures__/inspect-scripts.snapshot.ts +2 -0
  263. package/src/__tests__/archetype.unit.test.ts +1837 -0
  264. package/src/__tests__/array-handle-element.test-d.ts +34 -0
  265. package/src/__tests__/buffer-array-vocab.test-d.ts +53 -0
  266. package/src/__tests__/buffer-field-input-widen.unit.test.ts +99 -0
  267. package/src/__tests__/buffer-pool.test-d.ts +32 -0
  268. package/src/__tests__/change-detection.unit.test.ts +86 -0
  269. package/src/__tests__/command-buffer.test.ts +179 -0
  270. package/src/__tests__/commands-deferred.unit.test.ts +68 -0
  271. package/src/__tests__/component-catalog.test.ts +59 -0
  272. package/src/__tests__/component-definition-identity.unit.test.ts +24 -0
  273. package/src/__tests__/component-nan-preflight.unit.test.ts +186 -0
  274. package/src/__tests__/component-schema.test-d.ts +119 -0
  275. package/src/__tests__/component-schema.test.ts +55 -0
  276. package/src/__tests__/define-component-options.test-d.ts +35 -0
  277. package/src/__tests__/deprecated-vocab-rejection.unit.test.ts +59 -0
  278. package/src/__tests__/despawn-all.unit.test.ts +17 -0
  279. package/src/__tests__/ecs-core-reduction.characterization.test.ts +130 -0
  280. package/src/__tests__/ecs-core-reduction.perf.test.ts +260 -0
  281. package/src/__tests__/ecs-error-code-31.test-d.ts +42 -0
  282. package/src/__tests__/entity-disabling.unit.test.ts +37 -0
  283. package/src/__tests__/entity-handle-codec-parity.unit.test.ts +126 -0
  284. package/src/__tests__/errors.unit.test.ts +1456 -0
  285. package/src/__tests__/execution-conflict-boundary.unit.test.ts +123 -0
  286. package/src/__tests__/execution-shared-storage.unit.test.ts +40 -0
  287. package/src/__tests__/externalization-portable-value.unit.test.ts +275 -0
  288. package/src/__tests__/externalization-projection.unit.test.ts +325 -0
  289. package/src/__tests__/externalization-render-read-lease.test-d.ts +30 -0
  290. package/src/__tests__/externalization-render-read-lease.unit.test.ts +79 -0
  291. package/src/__tests__/externalization-root-surface.unit.test.ts +33 -0
  292. package/src/__tests__/field-enum-labels-reflection.test.ts +66 -0
  293. package/src/__tests__/field-shape-fixture.test.ts +61 -0
  294. package/src/__tests__/field-transient-reflection.test.ts +59 -0
  295. package/src/__tests__/field-value-type.test-d.ts +57 -0
  296. package/src/__tests__/fixed-update.unit.test.ts +78 -0
  297. package/src/__tests__/handle.test-d.ts +86 -0
  298. package/src/__tests__/hierarchy.unit.test.ts +2534 -0
  299. package/src/__tests__/managed-array-vocab.test-d.ts +137 -0
  300. package/src/__tests__/minimal-example.test-d.ts +42 -0
  301. package/src/__tests__/name-read-types.test-d.ts +72 -0
  302. package/src/__tests__/plugin-service.test.ts +13 -0
  303. package/src/__tests__/query-combinations.unit.test.ts +42 -0
  304. package/src/__tests__/query-light-extract-flat-column-ratio.perf.test.ts +252 -0
  305. package/src/__tests__/query-storage-trends.perf.test.ts +104 -0
  306. package/src/__tests__/query-trs-flat-column-ratio.perf.test.ts +194 -0
  307. package/src/__tests__/query.unit.test.ts +196 -0
  308. package/src/__tests__/relationship-index.perf.test.ts +126 -0
  309. package/src/__tests__/relationship-index.test.ts +70 -0
  310. package/src/__tests__/scalar-field-type-owner.test-d.ts +71 -0
  311. package/src/__tests__/schedule-determinism.unit.test.ts +36 -0
  312. package/src/__tests__/schedule-inspection.unit.test.ts +81 -0
  313. package/src/__tests__/schedule-scope-error.unit.test.ts +63 -0
  314. package/src/__tests__/schedule-token.unit.test.ts +54 -0
  315. package/src/__tests__/schema-vocab.test-d.ts +103 -0
  316. package/src/__tests__/serialization.unit.test.ts +2740 -0
  317. package/src/__tests__/shared-kernel-eligibility.test-d.ts +18 -0
  318. package/src/__tests__/shared-kernel-eligibility.unit.test.ts +78 -0
  319. package/src/__tests__/shared-ref-store.unit.test.ts +646 -0
  320. package/src/__tests__/sparse-tag.unit.test.ts +201 -0
  321. package/src/__tests__/spawn-field-error.test-d.ts +41 -0
  322. package/src/__tests__/stale-error.test-d.ts +208 -0
  323. package/src/__tests__/string-view-symmetry.test-d.ts +26 -0
  324. package/src/__tests__/string-vocab.test-d.ts +49 -0
  325. package/src/__tests__/structure-epoch-boundaries.unit.test.ts +39 -0
  326. package/src/__tests__/structure-epoch.unit.test.ts +48 -0
  327. package/src/__tests__/table-archetype-mapping.unit.test.ts +78 -0
  328. package/src/__tests__/time.unit.test.ts +79 -0
  329. package/src/__tests__/types.test-d.ts +38 -0
  330. package/src/__tests__/unique-ref-store.unit.test.ts +348 -0
  331. package/src/__tests__/utils/handle-numeric.ts +30 -0
  332. package/src/__tests__/validation-root-surface.unit.test.ts +15 -0
  333. package/src/__tests__/visibility-atomic-write.unit.test.ts +82 -0
  334. package/src/__tests__/world-change-journal.unit.test.ts +97 -0
  335. package/src/__tests__/world-characterization.unit.test.ts +408 -0
  336. package/src/__tests__/world-consumer-inference.test-d.ts +16 -0
  337. package/src/__tests__/world-health.contract.test.ts +87 -0
  338. package/src/__tests__/world-inspection.test.ts +37 -0
  339. package/src/__tests__/world-internal-identity.unit.test.ts +17 -0
  340. package/src/__tests__/world-managed-roundtrip.unit.test.ts +98 -0
  341. package/src/__tests__/world-scheduling.m4.test.ts +52 -0
  342. package/src/__tests__/world-unique-roundtrip.unit.test.ts +357 -0
  343. package/src/__tests__/world.test-d.ts +156 -0
  344. package/src/buffer-pool.ts +357 -0
  345. package/src/commands.ts +644 -0
  346. package/src/component-default-fallback.ts +236 -0
  347. package/src/component-schema.ts +92 -0
  348. package/src/component-value-validate.ts +135 -0
  349. package/src/component.ts +1268 -0
  350. package/src/entity-handle.ts +104 -0
  351. package/src/entity.ts +140 -0
  352. package/src/errors/query-and-component-errors.ts +200 -0
  353. package/src/errors/relationship-errors.ts +198 -0
  354. package/src/errors/sprite-and-shared-errors.ts +231 -0
  355. package/src/errors/validation-errors.ts +506 -0
  356. package/src/errors.ts +1464 -0
  357. package/src/execution/shared-kernel.ts +392 -0
  358. package/src/externalization/index.ts +170 -0
  359. package/src/index.ts +414 -0
  360. package/src/plugin-service.ts +35 -0
  361. package/src/projection/index.ts +318 -0
  362. package/src/query/query.ts +606 -0
  363. package/src/relationship-index.ts +175 -0
  364. package/src/resource.ts +106 -0
  365. package/src/schedule-token.ts +40 -0
  366. package/src/schedule.ts +846 -0
  367. package/src/shared-ref-store.ts +418 -0
  368. package/src/shared.ts +23 -0
  369. package/src/storage/archetype-graph.ts +166 -0
  370. package/src/storage/archetype.ts +78 -0
  371. package/src/storage/change-detection.ts +231 -0
  372. package/src/storage/column.ts +247 -0
  373. package/src/storage/table.ts +153 -0
  374. package/src/time.ts +122 -0
  375. package/src/unique-ref-store.ts +278 -0
  376. package/src/world-change-journal.ts +84 -0
  377. package/src/world-component-access.ts +1421 -0
  378. package/src/world-component-storage.ts +1178 -0
  379. package/src/world-core.ts +74 -0
  380. package/src/world-entity-lifecycle.ts +539 -0
  381. package/src/world-internal.ts +75 -0
  382. package/src/world-scheduling.ts +499 -0
  383. package/src/world.ts +1399 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/handle.test-d.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=hierarchy.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hierarchy.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/hierarchy.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=managed-array-vocab.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"managed-array-vocab.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/managed-array-vocab.test-d.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=minimal-example.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"minimal-example.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/minimal-example.test-d.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=name-read-types.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"name-read-types.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/name-read-types.test-d.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=plugin-service.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-service.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/plugin-service.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=query-combinations.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-combinations.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/query-combinations.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=query-light-extract-flat-column-ratio.perf.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-light-extract-flat-column-ratio.perf.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/query-light-extract-flat-column-ratio.perf.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=query-storage-trends.perf.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-storage-trends.perf.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/query-storage-trends.perf.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=query-trs-flat-column-ratio.perf.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-trs-flat-column-ratio.perf.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/query-trs-flat-column-ratio.perf.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=query.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/query.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=relationship-index.perf.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relationship-index.perf.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/relationship-index.perf.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=relationship-index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relationship-index.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/relationship-index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=scalar-field-type-owner.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scalar-field-type-owner.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/scalar-field-type-owner.test-d.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=schedule-determinism.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule-determinism.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/schedule-determinism.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=schedule-inspection.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule-inspection.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/schedule-inspection.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=schedule-scope-error.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule-scope-error.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/schedule-scope-error.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=schedule-token.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule-token.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/schedule-token.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=schema-vocab.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-vocab.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/schema-vocab.test-d.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=serialization.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialization.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/serialization.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=shared-kernel-eligibility.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-kernel-eligibility.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/shared-kernel-eligibility.test-d.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=shared-kernel-eligibility.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-kernel-eligibility.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/shared-kernel-eligibility.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=shared-ref-store.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-ref-store.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/shared-ref-store.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sparse-tag.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sparse-tag.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/sparse-tag.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=spawn-field-error.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawn-field-error.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/spawn-field-error.test-d.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=stale-error.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stale-error.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/stale-error.test-d.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=string-view-symmetry.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-view-symmetry.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/string-view-symmetry.test-d.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=string-vocab.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-vocab.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/string-vocab.test-d.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=structure-epoch-boundaries.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structure-epoch-boundaries.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/structure-epoch-boundaries.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=structure-epoch.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structure-epoch.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/structure-epoch.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=table-archetype-mapping.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-archetype-mapping.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/table-archetype-mapping.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=time.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/time.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/types.test-d.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=unique-ref-store.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unique-ref-store.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/unique-ref-store.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Unwrap a phantom-branded numeric id (`Handle<T, M>`, `Entity`,
3
+ * `SceneInstanceId`, ...) to its underlying `number` representation. Used
4
+ * by test fixtures that need to compare brand-erased numeric values via
5
+ * `Object.is` / `===`.
6
+ *
7
+ * The constraint `H extends number` keeps the helper aligned with the
8
+ * brand idiom (`number & {brand}`) used throughout the codebase without
9
+ * coupling to any specific brand class.
10
+ *
11
+ * @internal
12
+ */
13
+ export declare const handleNumeric: <H extends number>(h: H) => number;
14
+ //# sourceMappingURL=handle-numeric.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-numeric.d.ts","sourceRoot":"","sources":["../../../src/__tests__/utils/handle-numeric.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,MAAM,EAAE,GAAG,CAAC,KAAG,MAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=validation-root-surface.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-root-surface.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/validation-root-surface.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=visibility-atomic-write.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visibility-atomic-write.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/visibility-atomic-write.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=world-change-journal.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"world-change-journal.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-change-journal.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=world-characterization.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"world-characterization.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-characterization.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=world-consumer-inference.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"world-consumer-inference.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-consumer-inference.test-d.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=world-health.contract.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"world-health.contract.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-health.contract.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=world-inspection.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"world-inspection.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-inspection.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=world-internal-identity.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"world-internal-identity.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-internal-identity.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=world-managed-roundtrip.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"world-managed-roundtrip.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-managed-roundtrip.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=world-scheduling.m4.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"world-scheduling.m4.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-scheduling.m4.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=world-unique-roundtrip.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"world-unique-roundtrip.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-unique-roundtrip.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=world.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"world.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/world.test-d.ts"],"names":[],"mappings":""}
@@ -0,0 +1,109 @@
1
+ import { type Result } from '@forgeax/engine-types';
2
+ import { ManagedBufferOutOfBoundsError, ManagedBufferShrinkNotSupportedError } from './errors';
3
+ /**
4
+ * Size-class bucket boundaries in bytes (D-5, radix 4). Frozen tuple - the
5
+ * order is load-bearing: bucket index = ascending position in the array.
6
+ *
7
+ * `alloc(byteLength)` rounds up to `SIZE_CLASSES[i]` for the smallest `i`
8
+ * with `byteLength <= SIZE_CLASSES[i]`. byteLength === 0 is the special path
9
+ * (no bucket); byteLength > SIZE_CLASSES[7] (262_144) returns
10
+ * `managed-buffer-out-of-bounds`.
11
+ */
12
+ export declare const SIZE_CLASSES: readonly number[];
13
+ /** Result envelope for a fresh alloc - id + initial view. */
14
+ export interface BufferAllocResult {
15
+ /** Stable slot id; archetype columns store this u32 in their `buffer:<N>` field. */
16
+ readonly id: number;
17
+ /** Live Uint8Array view of length `byteLength` (D-5 rounding visible only via `view.buffer.byteLength`). */
18
+ readonly view: Uint8Array;
19
+ }
20
+ /**
21
+ * Per-(slot id) managed Uint8Array store backing the `buffer:<bytes>` schema
22
+ * vocab keyword. Eight size-class free-lists (radix 4); cross-bucket growth
23
+ * uses `ArrayBuffer.transfer` when available with a copy fallback for older
24
+ * runtimes.
25
+ *
26
+ * AI users do not interact with `BufferPool` directly - it sits behind
27
+ * `world.get(e, C).<bufferField>` and the M4 carry-over migrate path. The
28
+ * pool is exposed as a class so World can hold one instance per
29
+ * `new World()` (D-2 per-World lifecycle).
30
+ */
31
+ export declare class BufferPool {
32
+ private readonly slots;
33
+ /**
34
+ * Per-bucket free-lists: `freeBuckets[i]` is a LIFO stack of slot ids
35
+ * whose backing buffer is parked on bucket `i`. Released slots stay on
36
+ * their original bucket's free-list - v1 never moves a slot between
37
+ * buckets on release (D-7 no trim).
38
+ */
39
+ private readonly freeBuckets;
40
+ private nextId;
41
+ /**
42
+ * Allocate a managed buffer slot of at least `byteLength` bytes.
43
+ *
44
+ * Routes:
45
+ * - byteLength < 0 -> not in current contract (caller responsibility).
46
+ * - byteLength == 0 -> ok({ id, view: zero-length Uint8Array }) (no bucket).
47
+ * - byteLength <= 262144 -> ok({ id, view }), bucket = smallest >= byteLength.
48
+ * - byteLength > 262144 -> err(managed-buffer-out-of-bounds).
49
+ *
50
+ * D-5: size classes are radix-4 (16 / 64 / 256 / 1K / 4K / 16K / 64K / 256K).
51
+ * Free-list pop reuses the most recently released slot id at the same bucket;
52
+ * miss falls through to a fresh allocation.
53
+ */
54
+ alloc(byteLength: number): Result<BufferAllocResult, ManagedBufferOutOfBoundsError>;
55
+ /**
56
+ * Grow slot `id` to `newBytes`. Returns the post-grow Uint8Array view.
57
+ *
58
+ * Routes (D-6 / D-7):
59
+ * - newBytes < current -> err(managed-buffer-shrink-not-supported).
60
+ * - newBytes == current -> ok(current view) (no-op, identity preserved).
61
+ * - newBytes > current && same bucket -> ok(re-sliced view) (no transfer).
62
+ * - newBytes > current && cross bucket -> ok(new view) backed by a fresh
63
+ * bucket buffer; the prior ArrayBuffer is detached via transfer (ES2024)
64
+ * or replaced via allocate-and-copy fallback. Old `view`s captured by
65
+ * the caller become detached / orphaned - callers must use `pool.view(id)`
66
+ * after grow to read the refreshed view (the `release` loop refreshes
67
+ * automatically).
68
+ * - newBytes > 262144 -> err(managed-buffer-out-of-bounds).
69
+ */
70
+ grow(id: number, newBytes: number): Result<Uint8Array, ManagedBufferShrinkNotSupportedError | ManagedBufferOutOfBoundsError>;
71
+ /**
72
+ * Release slot `id` back to its bucket's free-list. Releasing an unknown id
73
+ * is a no-op - World's release loop drives this and idempotency keeps the
74
+ * despawn chain free of bookkeeping noise. Bucket free-lists are NEVER
75
+ * trimmed in v1 (D-7 no trim).
76
+ */
77
+ release(id: number): Result<void, never>;
78
+ /**
79
+ * Return the live view for slot `id`. Used by World after `grow` to
80
+ * refresh the column's stored view reference. Returns a zero-length view
81
+ * for unknown / released ids so callers never crash on use-after-release.
82
+ */
83
+ view(id: number): Uint8Array;
84
+ /**
85
+ * Return the bucket-rounded byte capacity for slot `id` --- i.e.
86
+ * `SIZE_CLASSES[slot.sizeClassIdx]`. Used by managed-buffer view callers
87
+ * (D-4 no-cache: re-queried per accessor). Returns `0` for the zero-length
88
+ * (`alloc(0)`) slot; returns `0` for unknown / released ids (mirrors
89
+ * `view(id)` use-after-release semantics).
90
+ */
91
+ byteCapacity(id: number): number;
92
+ /**
93
+ * Reset the logical byteLength of slot `id` to `newByteLength` while
94
+ * keeping the same bucket allocation (no transfer, no release). Only
95
+ * legal when `newByteLength <= bucketBytes`; the slot's bucket index
96
+ * does not move (D-7 v1 forbids cross-bucket shrink). Used by managed-
97
+ * buffer clear paths so the slot retains its `byteCapacity` while the
98
+ * live view becomes zero-length. Bytes past the new logical length are
99
+ * zero-filled defensively.
100
+ *
101
+ * Returns `err(ManagedBufferShrinkNotSupportedError)` when called on a
102
+ * `sizeClassIdx === -1` slot (alloc(0)) with `newByteLength > 0`, or
103
+ * when `newByteLength` exceeds the bucket capacity.
104
+ */
105
+ setLogicalLength(id: number, newByteLength: number): Result<Uint8Array, ManagedBufferShrinkNotSupportedError | ManagedBufferOutOfBoundsError>;
106
+ /** @internal Diagnostic count of live slots. Exposed for tests + inspector. */
107
+ _liveCount(): number;
108
+ }
109
+ //# sourceMappingURL=buffer-pool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buffer-pool.d.ts","sourceRoot":"","sources":["../src/buffer-pool.ts"],"names":[],"mappings":"AA2CA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,6BAA6B,EAAE,oCAAoC,EAAE,MAAM,UAAU,CAAC;AAE/F;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAExC,CAAC;AAEH,6DAA6D;AAC7D,MAAM,WAAW,iBAAiB;IAChC,oFAAoF;IACpF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,4GAA4G;IAC5G,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAyCD;;;;;;;;;;GAUG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;IACtD;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAsD;IAClF,OAAO,CAAC,MAAM,CAAK;IAEnB;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC,iBAAiB,EAAE,6BAA6B,CAAC;IAoDnF;;;;;;;;;;;;;;OAcG;IACH,IAAI,CACF,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,GACf,MAAM,CAAC,UAAU,EAAE,oCAAoC,GAAG,6BAA6B,CAAC;IAgD3F;;;;;OAKG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC;IAgBxC;;;;OAIG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU;IAM5B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAOhC;;;;;;;;;;;;OAYG;IACH,gBAAgB,CACd,EAAE,EAAE,MAAM,EACV,aAAa,EAAE,MAAM,GACpB,MAAM,CAAC,UAAU,EAAE,oCAAoC,GAAG,6BAA6B,CAAC;IA4B3F,+EAA+E;IAC/E,UAAU,IAAI,MAAM;CAKrB"}
@@ -0,0 +1,93 @@
1
+ import type { Result } from '@forgeax/engine-types';
2
+ import type { Component, ComponentSchema } from './component';
3
+ import { type EntityHandle } from './entity-handle';
4
+ import { type CommandKind } from './errors';
5
+ import type { ComponentData, EcsError } from './world';
6
+ import { type WorldInternal, worldInternal } from './world-internal';
7
+ export type Command = {
8
+ type: 'spawn';
9
+ componentDatas: ComponentData[];
10
+ entity: EntityHandle;
11
+ } | {
12
+ type: 'despawn';
13
+ entity: EntityHandle;
14
+ } | {
15
+ type: 'addComponent';
16
+ entity: EntityHandle;
17
+ componentData: ComponentData;
18
+ } | {
19
+ type: 'removeComponent';
20
+ entity: EntityHandle;
21
+ component: Component;
22
+ };
23
+ /**
24
+ * CommandBuffer queues structural changes (spawn/despawn/addComponent/removeComponent)
25
+ * during system execution. Flushed at end of world.update().
26
+ */
27
+ export interface CommandBuffer {
28
+ readonly status: 'open' | 'committed' | 'aborted';
29
+ /** Deferred spawn: returns pending Entity handle. */
30
+ spawn(...componentDatas: ComponentData[]): EntityHandle;
31
+ /** Deferred despawn. */
32
+ despawn(entity: EntityHandle): unknown;
33
+ /** Deferred addComponent. */
34
+ addComponent<S extends ComponentSchema>(entity: EntityHandle, componentData: ComponentData<S>): unknown;
35
+ /** Deferred removeComponent. */
36
+ removeComponent<S extends ComponentSchema>(entity: EntityHandle, component: Component<string, S>): unknown;
37
+ /** Check if an entity is pending (deferred spawn, not yet flushed). */
38
+ isDeferred(entity: EntityHandle): boolean;
39
+ commit(): void;
40
+ abort(error?: unknown): void;
41
+ }
42
+ /** Minimal world interface needed by CommandBuffer for entity allocation. */
43
+ export interface WorldForCommands {
44
+ readonly [worldInternal]: WorldInternal;
45
+ /**
46
+ * Allocate a pending entity index, returning [entity handle, index slot].
47
+ * @internal
48
+ */
49
+ /**
50
+ * Mark a pending entity as materialized (flush phase).
51
+ * @internal
52
+ */
53
+ /** Execute despawn directly (flush phase). */
54
+ despawn(entity: EntityHandle): Result<void, EcsError>;
55
+ /** Execute addComponent directly (flush phase). */
56
+ addComponent<S extends ComponentSchema>(entity: EntityHandle, componentData: ComponentData<S>): Result<void, EcsError>;
57
+ /** Execute removeComponent directly (flush phase). */
58
+ removeComponent<S extends ComponentSchema>(entity: EntityHandle, component: Component<string, S>): Result<void, EcsError>;
59
+ /** Fast membership probe used by command preflight. */
60
+ hasComponent(entity: EntityHandle, component: Component): boolean;
61
+ }
62
+ export interface CommandBufferImpl extends CommandBuffer {
63
+ /** @internal */
64
+ _queue: Command[];
65
+ /** @internal */
66
+ _pendingEntities: Set<number>;
67
+ /** @internal First validation failure captured while the system was staging commands. */
68
+ _queueError: {
69
+ readonly index: number;
70
+ readonly kind: CommandKind;
71
+ readonly cause: unknown;
72
+ } | null;
73
+ /** @internal */
74
+ readonly _systemName: string;
75
+ /** @internal */
76
+ readonly _scheduleName: string;
77
+ /** @internal */
78
+ _setStatus(status: 'committed' | 'aborted'): void;
79
+ }
80
+ /**
81
+ * Create a CommandBuffer bound to a World.
82
+ * @param world - the World (for pending entity allocation)
83
+ */
84
+ export declare function createCommandBuffer(world: WorldForCommands, context?: {
85
+ readonly systemName?: string;
86
+ readonly scheduleName?: string;
87
+ }): CommandBufferImpl;
88
+ /**
89
+ * Flush all queued commands against the World.
90
+ * Uses while(queue.length > 0) to support cascade (commands spawned during flush).
91
+ */
92
+ export declare function flushCommands(buffer: CommandBufferImpl, world: WorldForCommands): void;
93
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"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"}