@oasys/oecs 0.3.1 → 0.5.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.
Files changed (324) hide show
  1. package/CHANGELOG.md +553 -0
  2. package/README.md +207 -267
  3. package/dist/core/ecs/access_check.d.cts +77 -0
  4. package/dist/core/ecs/access_check.d.ts +77 -0
  5. package/dist/core/ecs/access_check.d.ts.map +1 -0
  6. package/dist/core/ecs/archetype.d.cts +486 -0
  7. package/dist/core/ecs/archetype.d.ts +486 -0
  8. package/dist/core/ecs/archetype.d.ts.map +1 -0
  9. package/dist/core/ecs/archetype_graph.d.cts +96 -0
  10. package/dist/core/ecs/archetype_graph.d.ts +96 -0
  11. package/dist/core/ecs/archetype_graph.d.ts.map +1 -0
  12. package/dist/core/ecs/builtin_relations.d.cts +43 -0
  13. package/dist/core/ecs/builtin_relations.d.ts +43 -0
  14. package/dist/core/ecs/builtin_relations.d.ts.map +1 -0
  15. package/dist/core/ecs/command_log.d.cts +116 -0
  16. package/dist/core/ecs/command_log.d.ts +116 -0
  17. package/dist/core/ecs/command_log.d.ts.map +1 -0
  18. package/dist/core/ecs/component.d.cts +176 -0
  19. package/dist/core/ecs/component.d.ts +176 -0
  20. package/dist/core/ecs/component.d.ts.map +1 -0
  21. package/dist/core/ecs/compute_backend.d.cts +37 -0
  22. package/dist/core/ecs/compute_backend.d.ts +37 -0
  23. package/dist/core/ecs/compute_backend.d.ts.map +1 -0
  24. package/dist/core/ecs/debug_names.d.cts +7 -0
  25. package/dist/core/ecs/debug_names.d.ts +7 -0
  26. package/dist/core/ecs/debug_names.d.ts.map +1 -0
  27. package/dist/core/ecs/deferred_commands.d.cts +55 -0
  28. package/dist/core/ecs/deferred_commands.d.ts +55 -0
  29. package/dist/core/ecs/deferred_commands.d.ts.map +1 -0
  30. package/dist/core/ecs/dispatch_trace.d.cts +93 -0
  31. package/dist/core/ecs/dispatch_trace.d.ts +93 -0
  32. package/dist/core/ecs/dispatch_trace.d.ts.map +1 -0
  33. package/dist/core/ecs/ecs.d.cts +562 -0
  34. package/dist/core/ecs/ecs.d.ts +562 -0
  35. package/dist/core/ecs/ecs.d.ts.map +1 -0
  36. package/dist/core/ecs/ecs_memory.d.cts +179 -0
  37. package/dist/core/ecs/ecs_memory.d.ts +179 -0
  38. package/dist/core/ecs/ecs_memory.d.ts.map +1 -0
  39. package/dist/core/ecs/entity.d.cts +34 -0
  40. package/dist/core/ecs/entity.d.ts +34 -0
  41. package/dist/core/ecs/entity.d.ts.map +1 -0
  42. package/dist/core/ecs/entity_allocator.d.cts +59 -0
  43. package/dist/core/ecs/entity_allocator.d.ts +59 -0
  44. package/dist/core/ecs/entity_allocator.d.ts.map +1 -0
  45. package/dist/core/ecs/event.d.cts +79 -0
  46. package/dist/core/ecs/event.d.ts +79 -0
  47. package/dist/core/ecs/event.d.ts.map +1 -0
  48. package/dist/core/ecs/event_registry.d.cts +22 -0
  49. package/dist/core/ecs/event_registry.d.ts +22 -0
  50. package/dist/core/ecs/event_registry.d.ts.map +1 -0
  51. package/dist/core/ecs/facades.d.cts +158 -0
  52. package/dist/core/ecs/facades.d.ts +158 -0
  53. package/dist/core/ecs/facades.d.ts.map +1 -0
  54. package/dist/core/ecs/frame_stepper.d.cts +58 -0
  55. package/dist/core/ecs/frame_stepper.d.ts +58 -0
  56. package/dist/core/ecs/frame_stepper.d.ts.map +1 -0
  57. package/dist/core/ecs/frame_trace.d.cts +133 -0
  58. package/dist/core/ecs/frame_trace.d.ts +133 -0
  59. package/dist/core/ecs/frame_trace.d.ts.map +1 -0
  60. package/dist/core/ecs/host_commands.d.cts +274 -0
  61. package/dist/core/ecs/host_commands.d.ts +274 -0
  62. package/dist/core/ecs/host_commands.d.ts.map +1 -0
  63. package/dist/core/ecs/index.d.cts +46 -0
  64. package/dist/core/ecs/index.d.ts +46 -0
  65. package/dist/core/ecs/index.d.ts.map +1 -0
  66. package/dist/core/ecs/observer.d.cts +173 -0
  67. package/dist/core/ecs/observer.d.ts +173 -0
  68. package/dist/core/ecs/observer.d.ts.map +1 -0
  69. package/dist/core/ecs/query.d.cts +718 -0
  70. package/dist/core/ecs/query.d.ts +718 -0
  71. package/dist/core/ecs/query.d.ts.map +1 -0
  72. package/dist/core/ecs/ref.d.cts +31 -0
  73. package/dist/core/ecs/ref.d.ts +31 -0
  74. package/dist/core/ecs/ref.d.ts.map +1 -0
  75. package/dist/core/ecs/relation.d.cts +243 -0
  76. package/dist/core/ecs/relation.d.ts +243 -0
  77. package/dist/core/ecs/relation.d.ts.map +1 -0
  78. package/dist/core/ecs/relation_service.d.cts +235 -0
  79. package/dist/core/ecs/relation_service.d.ts +235 -0
  80. package/dist/core/ecs/relation_service.d.ts.map +1 -0
  81. package/dist/core/ecs/resource.d.cts +53 -0
  82. package/dist/core/ecs/resource.d.ts +53 -0
  83. package/dist/core/ecs/resource.d.ts.map +1 -0
  84. package/dist/core/ecs/resource_registry.d.cts +20 -0
  85. package/dist/core/ecs/resource_registry.d.ts +20 -0
  86. package/dist/core/ecs/resource_registry.d.ts.map +1 -0
  87. package/dist/core/ecs/resume.d.cts +85 -0
  88. package/dist/core/ecs/resume.d.ts +85 -0
  89. package/dist/core/ecs/resume.d.ts.map +1 -0
  90. package/dist/core/ecs/run_condition.d.cts +81 -0
  91. package/dist/core/ecs/run_condition.d.ts +81 -0
  92. package/dist/core/ecs/run_condition.d.ts.map +1 -0
  93. package/dist/core/ecs/schedule.d.cts +142 -0
  94. package/dist/core/ecs/schedule.d.ts +142 -0
  95. package/dist/core/ecs/schedule.d.ts.map +1 -0
  96. package/dist/core/ecs/snapshot_service.d.cts +94 -0
  97. package/dist/core/ecs/snapshot_service.d.ts +94 -0
  98. package/dist/core/ecs/snapshot_service.d.ts.map +1 -0
  99. package/dist/core/ecs/sparse_store.d.cts +110 -0
  100. package/dist/core/ecs/sparse_store.d.ts +110 -0
  101. package/dist/core/ecs/sparse_store.d.ts.map +1 -0
  102. package/dist/core/ecs/store.d.cts +950 -0
  103. package/dist/core/ecs/store.d.ts +950 -0
  104. package/dist/core/ecs/store.d.ts.map +1 -0
  105. package/dist/core/ecs/store_layout_listener.d.cts +23 -0
  106. package/dist/core/ecs/store_layout_listener.d.ts +23 -0
  107. package/dist/core/ecs/store_layout_listener.d.ts.map +1 -0
  108. package/dist/core/ecs/system.d.cts +250 -0
  109. package/dist/core/ecs/system.d.ts +250 -0
  110. package/dist/core/ecs/system.d.ts.map +1 -0
  111. package/dist/core/ecs/utils/arrays.d.cts +7 -0
  112. package/dist/{utils → core/ecs/utils}/arrays.d.ts +2 -1
  113. package/dist/core/ecs/utils/arrays.d.ts.map +1 -0
  114. package/dist/core/ecs/utils/constants.d.ts +12 -0
  115. package/dist/core/ecs/utils/constants.d.ts.map +1 -0
  116. package/dist/core/ecs/utils/error.d.cts +61 -0
  117. package/dist/core/ecs/utils/error.d.ts +61 -0
  118. package/dist/core/ecs/utils/error.d.ts.map +1 -0
  119. package/dist/core/store/action_ring.d.cts +136 -0
  120. package/dist/core/store/action_ring.d.ts +136 -0
  121. package/dist/core/store/action_ring.d.ts.map +1 -0
  122. package/dist/core/store/allocator.d.cts +238 -0
  123. package/dist/core/store/allocator.d.ts +238 -0
  124. package/dist/core/store/allocator.d.ts.map +1 -0
  125. package/dist/core/store/buffer_backed_column.d.cts +69 -0
  126. package/dist/core/store/buffer_backed_column.d.ts +69 -0
  127. package/dist/core/store/buffer_backed_column.d.ts.map +1 -0
  128. package/dist/core/store/column_store.d.cts +273 -0
  129. package/dist/core/store/column_store.d.ts +273 -0
  130. package/dist/core/store/column_store.d.ts.map +1 -0
  131. package/dist/core/store/command_dispatch.d.cts +52 -0
  132. package/dist/core/store/command_dispatch.d.ts +52 -0
  133. package/dist/core/store/command_dispatch.d.ts.map +1 -0
  134. package/dist/core/store/command_ring.d.cts +107 -0
  135. package/dist/core/store/command_ring.d.ts +107 -0
  136. package/dist/core/store/command_ring.d.ts.map +1 -0
  137. package/dist/core/store/descriptor.d.cts +80 -0
  138. package/dist/core/store/descriptor.d.ts +80 -0
  139. package/dist/core/store/descriptor.d.ts.map +1 -0
  140. package/dist/core/store/entity_index.d.cts +108 -0
  141. package/dist/core/store/entity_index.d.ts +108 -0
  142. package/dist/core/store/entity_index.d.ts.map +1 -0
  143. package/dist/core/store/event_ring.d.cts +95 -0
  144. package/dist/core/store/event_ring.d.ts +95 -0
  145. package/dist/core/store/event_ring.d.ts.map +1 -0
  146. package/dist/core/store/extend.d.cts +39 -0
  147. package/dist/core/store/extend.d.ts +39 -0
  148. package/dist/core/store/extend.d.ts.map +1 -0
  149. package/dist/core/store/grow.d.cts +34 -0
  150. package/dist/core/store/grow.d.ts +34 -0
  151. package/dist/core/store/grow.d.ts.map +1 -0
  152. package/dist/core/store/header.d.cts +64 -0
  153. package/dist/core/store/header.d.ts +64 -0
  154. package/dist/core/store/header.d.ts.map +1 -0
  155. package/dist/core/store/index.d.cts +17 -0
  156. package/dist/core/store/index.d.ts +17 -0
  157. package/dist/core/store/index.d.ts.map +1 -0
  158. package/dist/core/store/layout_ops.d.cts +152 -0
  159. package/dist/core/store/layout_ops.d.ts +152 -0
  160. package/dist/core/store/layout_ops.d.ts.map +1 -0
  161. package/dist/core/store/region_table.d.cts +74 -0
  162. package/dist/core/store/region_table.d.ts +74 -0
  163. package/dist/core/store/region_table.d.ts.map +1 -0
  164. package/dist/core/store/snapshot.d.cts +43 -0
  165. package/dist/core/store/snapshot.d.ts +43 -0
  166. package/dist/core/store/snapshot.d.ts.map +1 -0
  167. package/dist/core/store/state_hash.d.cts +38 -0
  168. package/dist/core/store/state_hash.d.ts +38 -0
  169. package/dist/core/store/state_hash.d.ts.map +1 -0
  170. package/dist/core/store/store_regions.d.cts +38 -0
  171. package/dist/core/store/store_regions.d.ts +38 -0
  172. package/dist/core/store/store_regions.d.ts.map +1 -0
  173. package/dist/core/store/vendored_abi/abi.d.cts +43 -0
  174. package/dist/core/store/vendored_abi/abi.d.ts +43 -0
  175. package/dist/core/store/vendored_abi/abi.d.ts.map +1 -0
  176. package/dist/dev_flag.d.cts +17 -0
  177. package/dist/dev_flag.d.ts +17 -0
  178. package/dist/dev_flag.d.ts.map +1 -0
  179. package/dist/extensions/editor/editor.d.cts +170 -0
  180. package/dist/extensions/editor/editor.d.ts +170 -0
  181. package/dist/extensions/editor/editor.d.ts.map +1 -0
  182. package/dist/extensions/editor/field_handle.d.cts +40 -0
  183. package/dist/extensions/editor/field_handle.d.ts +40 -0
  184. package/dist/extensions/editor/field_handle.d.ts.map +1 -0
  185. package/dist/extensions/editor/index.cjs +1 -0
  186. package/dist/extensions/editor/index.d.cts +21 -0
  187. package/dist/extensions/editor/index.d.ts +21 -0
  188. package/dist/extensions/editor/index.d.ts.map +1 -0
  189. package/dist/extensions/editor/index.js +237 -0
  190. package/dist/extensions/reactive/ecs_sync.d.cts +214 -0
  191. package/dist/extensions/reactive/ecs_sync.d.ts +214 -0
  192. package/dist/extensions/reactive/ecs_sync.d.ts.map +1 -0
  193. package/dist/extensions/reactive/index.cjs +1 -0
  194. package/dist/extensions/reactive/index.d.cts +23 -0
  195. package/dist/extensions/reactive/index.d.ts +23 -0
  196. package/dist/extensions/reactive/index.d.ts.map +1 -0
  197. package/dist/extensions/reactive/index.js +215 -0
  198. package/dist/extensions/solid/index.cjs +1 -0
  199. package/dist/extensions/solid/index.d.cts +6 -0
  200. package/dist/extensions/solid/index.d.ts +6 -0
  201. package/dist/extensions/solid/index.d.ts.map +1 -0
  202. package/dist/extensions/solid/index.js +36 -0
  203. package/dist/extensions/solid/kernel_solid.d.cts +45 -0
  204. package/dist/extensions/solid/kernel_solid.d.ts +45 -0
  205. package/dist/extensions/solid/kernel_solid.d.ts.map +1 -0
  206. package/dist/host_commands-BF8QMi3c.cjs +1 -0
  207. package/dist/host_commands-i4cAeyL5.js +2318 -0
  208. package/dist/index.cjs +1 -1
  209. package/dist/index.d.cts +66 -0
  210. package/dist/index.d.ts +65 -12
  211. package/dist/index.d.ts.map +1 -1
  212. package/dist/index.js +7080 -1289
  213. package/dist/internal.cjs +2 -0
  214. package/dist/internal.d.cts +20 -0
  215. package/dist/internal.d.ts +20 -0
  216. package/dist/internal.d.ts.map +1 -0
  217. package/dist/internal.js +141 -0
  218. package/dist/interop-CT-REx0W.cjs +1 -0
  219. package/dist/interop-CcY6ASQc.js +18 -0
  220. package/dist/kernel-DgyrLFjW.js +227 -0
  221. package/dist/kernel-yWV3XnAb.cjs +1 -0
  222. package/dist/primitives.cjs +1 -0
  223. package/dist/primitives.d.cts +18 -0
  224. package/dist/primitives.d.ts +18 -0
  225. package/dist/primitives.d.ts.map +1 -0
  226. package/dist/primitives.js +45 -0
  227. package/dist/reactive/array.d.cts +24 -0
  228. package/dist/reactive/array.d.ts +24 -0
  229. package/dist/reactive/array.d.ts.map +1 -0
  230. package/dist/reactive/index.cjs +1 -0
  231. package/dist/reactive/index.d.cts +11 -0
  232. package/dist/reactive/index.d.ts +11 -0
  233. package/dist/reactive/index.d.ts.map +1 -0
  234. package/dist/reactive/index.js +18 -0
  235. package/dist/reactive/interop.d.cts +19 -0
  236. package/dist/reactive/interop.d.ts +19 -0
  237. package/dist/reactive/interop.d.ts.map +1 -0
  238. package/dist/reactive/kernel.d.cts +73 -0
  239. package/dist/reactive/kernel.d.ts +73 -0
  240. package/dist/reactive/kernel.d.ts.map +1 -0
  241. package/dist/reactive/map.d.cts +16 -0
  242. package/dist/reactive/map.d.ts +16 -0
  243. package/dist/reactive/map.d.ts.map +1 -0
  244. package/dist/reactive/shallow.d.cts +11 -0
  245. package/dist/reactive/shallow.d.ts +11 -0
  246. package/dist/reactive/shallow.d.ts.map +1 -0
  247. package/dist/reactive/struct.d.cts +10 -0
  248. package/dist/reactive/struct.d.ts +10 -0
  249. package/dist/reactive/struct.d.ts.map +1 -0
  250. package/dist/shallow-DQ8aG51_.cjs +1 -0
  251. package/dist/shallow-DfnAm9vG.js +150 -0
  252. package/dist/shared-BU1Cd40h.js +103 -0
  253. package/dist/shared-BymrGTyR.cjs +1 -0
  254. package/dist/shared.cjs +1 -0
  255. package/dist/shared.d.cts +22 -0
  256. package/dist/shared.d.ts +22 -0
  257. package/dist/shared.d.ts.map +1 -0
  258. package/dist/shared.js +7 -0
  259. package/dist/topological_sort-BDvEyb9W.cjs +1 -0
  260. package/dist/topological_sort-DK6EjpWa.js +135 -0
  261. package/dist/type_primitives/assertions.d.cts +32 -0
  262. package/dist/type_primitives/assertions.d.ts +25 -9
  263. package/dist/type_primitives/assertions.d.ts.map +1 -1
  264. package/dist/type_primitives/binary_heap/binary_heap.d.cts +37 -0
  265. package/dist/type_primitives/binary_heap/binary_heap.d.ts +6 -2
  266. package/dist/type_primitives/binary_heap/binary_heap.d.ts.map +1 -1
  267. package/dist/type_primitives/bitset/bitset.d.cts +54 -0
  268. package/dist/type_primitives/bitset/bitset.d.ts +16 -4
  269. package/dist/type_primitives/bitset/bitset.d.ts.map +1 -1
  270. package/dist/type_primitives/brand.d.cts +23 -0
  271. package/dist/type_primitives/brand.d.ts +6 -1
  272. package/dist/type_primitives/brand.d.ts.map +1 -1
  273. package/dist/type_primitives/error.d.cts +16 -0
  274. package/dist/type_primitives/error.d.ts +8 -3
  275. package/dist/type_primitives/error.d.ts.map +1 -1
  276. package/dist/type_primitives/index.d.cts +13 -0
  277. package/dist/type_primitives/index.d.ts +12 -9
  278. package/dist/type_primitives/index.d.ts.map +1 -1
  279. package/dist/type_primitives/sparse_map/sparse_map.d.cts +30 -0
  280. package/dist/type_primitives/sparse_map/sparse_map.d.ts +7 -3
  281. package/dist/type_primitives/sparse_map/sparse_map.d.ts.map +1 -1
  282. package/dist/type_primitives/sparse_set/sparse_set.d.cts +28 -0
  283. package/dist/type_primitives/sparse_set/sparse_set.d.ts +4 -0
  284. package/dist/type_primitives/sparse_set/sparse_set.d.ts.map +1 -1
  285. package/dist/type_primitives/topological_sort/topological_sort.d.cts +29 -0
  286. package/dist/type_primitives/topological_sort/topological_sort.d.ts +7 -3
  287. package/dist/type_primitives/topological_sort/topological_sort.d.ts.map +1 -1
  288. package/dist/type_primitives/typed_arrays/typed_arrays.d.cts +127 -0
  289. package/dist/type_primitives/typed_arrays/typed_arrays.d.ts +53 -16
  290. package/dist/type_primitives/typed_arrays/typed_arrays.d.ts.map +1 -1
  291. package/dist/typed_arrays-BcXcnzB4.js +258 -0
  292. package/dist/typed_arrays-D3NmwtCG.cjs +1 -0
  293. package/dist/utils/error.d.cts +6 -0
  294. package/dist/utils/error.d.ts +2 -20
  295. package/dist/utils/error.d.ts.map +1 -1
  296. package/dist/version.d.cts +10 -0
  297. package/dist/version.d.ts +10 -0
  298. package/dist/version.d.ts.map +1 -0
  299. package/package.json +115 -5
  300. package/dist/archetype.d.ts +0 -108
  301. package/dist/archetype.d.ts.map +0 -1
  302. package/dist/component.d.ts +0 -45
  303. package/dist/component.d.ts.map +0 -1
  304. package/dist/ecs.d.ts +0 -104
  305. package/dist/ecs.d.ts.map +0 -1
  306. package/dist/entity.d.ts +0 -11
  307. package/dist/entity.d.ts.map +0 -1
  308. package/dist/event.d.ts +0 -30
  309. package/dist/event.d.ts.map +0 -1
  310. package/dist/query.d.ts +0 -94
  311. package/dist/query.d.ts.map +0 -1
  312. package/dist/ref.d.ts +0 -23
  313. package/dist/ref.d.ts.map +0 -1
  314. package/dist/resource.d.ts +0 -23
  315. package/dist/resource.d.ts.map +0 -1
  316. package/dist/schedule.d.ts +0 -45
  317. package/dist/schedule.d.ts.map +0 -1
  318. package/dist/store.d.ts +0 -118
  319. package/dist/store.d.ts.map +0 -1
  320. package/dist/system.d.ts +0 -16
  321. package/dist/system.d.ts.map +0 -1
  322. package/dist/utils/arrays.d.ts.map +0 -1
  323. package/dist/utils/constants.d.ts.map +0 -1
  324. /package/dist/{utils/constants.d.ts → core/ecs/utils/constants.d.cts} +0 -0
@@ -0,0 +1,562 @@
1
+ import { Template, TemplateEntries, TemplateOverrides } from './store.js';
2
+ import { FrameTraceSink } from './frame_trace.js';
3
+ import { ObserverHandle, EntitySetObserverConfig, ArchetypeSetObserverConfig, StructuralObserverConfig } from './observer.js';
4
+ import { ColumnStore, ColumnStoreRegionHandle, StoreRegionSpec } from '../store/index.js';
5
+ import { ECSRelations, ECSEvents, ECSResources, ECSSnapshots } from './facades.js';
6
+ import { SCHEDULE, SystemEntry, SystemSet, SystemSetConfig } from './schedule.js';
7
+ import { Archetype, ArchetypeID } from './archetype.js';
8
+ import { SystemContext, Query, QueryBuilder, QueryCache, QueryResolver } from './query.js';
9
+ import { EntityID } from './entity.js';
10
+ import { ReadonlyComponentRef } from './ref.js';
11
+ import { ComponentDef, ComponentHandle, ComponentRegisterOptions, ComponentSchema, CompleteFieldValues, Bundle, BundleOrDef } from './component.js';
12
+ import { SparseComponentDef, SparseComponentID } from './sparse_store.js';
13
+ import { RelationDef } from './relation.js';
14
+ import { SystemFn, SystemConfig, SystemDescriptor, TypedSystemConfig, DenseAccessDecl, SpawnsAccessDecl, DespawnsAccessDecl, TransitionsAccessDecl, SparseAccessDecl, RelationsAccessDecl, ResourcesAccessDecl } from './system.js';
15
+ import { BitSet, TypedArrayTag } from '../../type_primitives/index.js';
16
+ import { StoreLayoutListener } from './store_layout_listener.js';
17
+ import { ComputeBackend } from './compute_backend.js';
18
+ import { ResolvedECSMemory, ECSMemoryOptions } from './ecs_memory.js';
19
+ export interface ECSOptions {
20
+ fixedTimestep?: number;
21
+ maxFixedSteps?: number;
22
+ /** Sink for dev-mode engine diagnostics (currently the schedule's
23
+ * dropped-ordering-edge warning). Defaults to `console.warn`. Mirrors the
24
+ * `FrameTraceSink` seam's injectable style — no global logger. */
25
+ onWarn?: (message: string) => void;
26
+ /** How the world's memory is sized and backed (#682) — the single
27
+ * sizing surface, replacing the pre-release `initialCapacity` +
28
+ * `bufferAllocator` pair. Express intent through exactly one arm:
29
+ * `{ budget: { entities } }` (derive everything), `{ maxBytes }`
30
+ * (explicit cap), `{ wasm: { memory } | { maximumPages } }` (the SAB
31
+ * IS a WebAssembly.Memory — zero-copy with a WASM `ComputeBackend`), or
32
+ * `{ allocator }` (expert escape hatch, in-place-typed per ADR-0008).
33
+ * Omitted ⇒ growable backing with a 256 MiB cap and 1024-row columns.
34
+ * The resolved plan is exposed as `ECS.memoryPlan`. */
35
+ memory?: ECSMemoryOptions;
36
+ /** Consumer-declared SAB regions (#623), forwarded to `Store`. Each
37
+ * `StoreRegionSpec` carries an opaque `region_id`, a precomputed byte size,
38
+ * and an `init` closure; the engine lays them out generically and exposes
39
+ * them via `regionHandle(id)` / `regionOffset(id)`. A game (e.g.
40
+ * `@internal/sim`'s region specs) supplies these — the engine ships no
41
+ * game regions of its own. Replaces the eight game-named region options
42
+ * (`terrain_map_radius`, `spatial_grid_*`, `army_*`, `flow_field_*`,
43
+ * `actionRingCapacitySlots`) the ECS used to carry. (ADR-0018.) */
44
+ regions?: readonly StoreRegionSpec[];
45
+ /** Byte size of the opt-in sim-bindings region (#625), forwarded to `Store`.
46
+ * A consumer that attaches a WASM `ComputeBackend` passes its own size — for
47
+ * this game, `@internal/sim`'s `SIM_BINDINGS_BYTES` (computed from the binding
48
+ * manifest) — so the host can publish the `(component_id, field_id)` IDs the
49
+ * accelerated systems read. Omitted / 0 ⇒ no region: a pure-TS world pays
50
+ * nothing for the WASM seam. The size is a runtime input, not an engine ABI
51
+ * constant, since #625 de-welded it from the generated ABI. */
52
+ bindingsRegionBytes?: number;
53
+ /** Opt into the **determinism surface** (#626 / ADR-0020), forwarded to
54
+ * `Store`. Default `false`. When `false`, the canonical-ordering methods
55
+ * (`stateHash`, `snapshotSparse`, `restoreSparse`) throw
56
+ * `DETERMINISM_DISABLED`; when `true`, today's replay/hash behavior is
57
+ * reproduced bit-for-bit. Determinism is the implementer's choice — our
58
+ * server match opts in (replay verification), the client stays off (it rolls
59
+ * back via diffs, not re-sim). The flag gates ONLY that surface: memory-safety
60
+ * invariants (the in-place SAB allocator, ADR-0008) and the `enabled_count`
61
+ * partition are always-on regardless. */
62
+ deterministic?: boolean;
63
+ }
64
+ export declare class ECS implements QueryResolver {
65
+ private readonly store;
66
+ private readonly schedule;
67
+ private readonly ctx;
68
+ /** Component observers (#517 §1 / ADR-0013). Inert until `observe(...)` is
69
+ * called — the structural-flush fast path is byte-for-byte unchanged. */
70
+ private readonly _observers;
71
+ /** Relations: register/add/remove/has, wildcard + traversal reads,
72
+ * reverse-index compaction. See `ECSRelations`. */
73
+ readonly relations: ECSRelations;
74
+ /** Host-side event channels + signals: register/registerSignal/emit/read
75
+ * (system-side `ctx.emit` is unchanged). See `ECSEvents`. */
76
+ readonly events: ECSEvents;
77
+ /** World resources: register/get/set/remove/has. See `ECSResources`. */
78
+ readonly resources: ECSResources;
79
+ /** Determinism surface: capture/restore (full + sparse), stateHash,
80
+ * the `deterministic` flag. See `ECSSnapshots`. */
81
+ readonly snapshots: ECSSnapshots;
82
+ private readonly systems;
83
+ private nextSystemId;
84
+ private _tick;
85
+ private _updating;
86
+ private _fixedTimestep;
87
+ private _accumulator;
88
+ private _maxFixedSteps;
89
+ private readonly scratchMask;
90
+ private _nextQueryIdCounter;
91
+ /** @internal Query-composition caches (QueryResolver seam) — not public API. */
92
+ readonly _caches: QueryCache;
93
+ private readonly _layoutSubscribers;
94
+ private _backend;
95
+ private readonly _memory;
96
+ /** What `ECSOptions.memory` resolved to (#682): backing allocator kind,
97
+ * column capacity, entity-index reservation, byte cap, and a
98
+ * human-readable derivation trace. Diagnostics surface — log it when
99
+ * sizing questions come up instead of reverse-engineering the SAB. */
100
+ get memoryPlan(): ResolvedECSMemory;
101
+ /** The backing `WebAssembly.Memory` when `memory.wasm` was used (both
102
+ * bring-your-own and engine-constructed), else `null`. A consumer hands
103
+ * this to its WASM `ComputeBackend` so the sim and the live columns
104
+ * share the same bytes. */
105
+ get wasmMemory(): WebAssembly.Memory | null;
106
+ constructor(options?: ECSOptions);
107
+ /** Batch variant of `regionHandle` for hosts wiring several consumer
108
+ * regions at startup: returns the handles in argument order, never null —
109
+ * throws ONE `REGION_NOT_DECLARED` naming every missing region id instead
110
+ * of a null-guard per region. Same staleness rule as `regionHandle`:
111
+ * re-fetch after a SAB grow. */
112
+ regionHandles(...regionIds: number[]): ColumnStoreRegionHandle[];
113
+ /** Subscribe to SAB-layout publications. `listener.setLayout(0)` is
114
+ * called immediately to seed the initial layout, then again after
115
+ * every SAB grow / extend (the `view_stamp` republish protocol).
116
+ * Returns an unsubscribe function.
117
+ *
118
+ * The engine has no concept of what subscribes — it publishes SAB layouts
119
+ * and walks away. A consumer subscribes whatever wrapper it owns (a compute
120
+ * backend, a Worker proxy, a debug recorder) and drives it from its own
121
+ * code. A `ComputeBackend` is subscribed automatically by `attachBackend`,
122
+ * so most consumers call that rather than this directly. */
123
+ onStoreLayoutPublished(listener: StoreLayoutListener): () => void;
124
+ /** Attach an opt-in compute backend (#622). Default is none: a bare `ECS`
125
+ * runs pure-TS systems and the schedule's dispatch is byte-for-byte the
126
+ * no-backend path. Once attached, a scheduled system carrying a
127
+ * `backendHandle` (its `SystemConfig`) is executed via `backend.run(handle)`
128
+ * instead of its `fn` closure; systems without a handle are unaffected.
129
+ *
130
+ * The backend is also subscribed as a SAB-layout listener (seeded now, then
131
+ * republished on every grow), folding in the `onStoreLayoutPublished` seam.
132
+ * Returns a detach function that unsubscribes the layout listener and reverts
133
+ * the schedule to the pure-TS path.
134
+ *
135
+ * One backend per ECS: attaching while one is already attached throws in
136
+ * `DEV` (detach first). The engine never inspects the backend beyond
137
+ * `setLayout` / `run` — it carries no game vocabulary. */
138
+ attachBackend(backend: ComputeBackend): () => void;
139
+ get fixedTimestep(): number;
140
+ set fixedTimestep(value: number);
141
+ get fixedAlpha(): number;
142
+ /** Attach (or detach with `null`) a per-world frame-trace sink (ADR-0030):
143
+ * the engine then fires structured `FrameTraceSink` events at each system,
144
+ * flush, command, observer firing, and event during `update()`, so a consumer
145
+ * can reconstruct exactly what travelled through the ECS each frame. The sink
146
+ * also receives a `phaseBoundary(phase)` at each phase's post-flush settle
147
+ * point — the safe seam to read `stateHash()` between phases of one frame and
148
+ * bisect a divergence to the exact phase (#797 / ADR-0032). The seam is
149
+ * `DEV`-gated end to end — in a production build this setter keeps an empty
150
+ * body and the world never retains a sink. The sink only observes; it does not
151
+ * perturb `stateHash`, ordering, or any behaviour. */
152
+ setTrace(sink: FrameTraceSink | null): void;
153
+ /**
154
+ * Register a dense component and get back its typed handle. Record syntax
155
+ * gives per-field type control; the array shorthand types every field the
156
+ * same (default `"f64"` — rejected on a `{ deterministic: true }` world
157
+ * (#777), pass an explicit integer type there). An empty schema `{}` is a
158
+ * tag. `opts.name` labels dev-mode diagnostics (`'Pos' (component 5)`
159
+ * instead of `component 5`) — diagnostic only, no behavioural effect.
160
+ *
161
+ * The handle is *callable*: `Pos({ x: 1 })` mints a `Bundle` for the
162
+ * attach surfaces (`spawnBundle`, `ctx.commands.spawn`, `addComponent`).
163
+ *
164
+ * @example
165
+ * const Pos = ecs.registerComponent({ x: "f64", y: "f64" });
166
+ * const Hp = ecs.registerComponent(["current", "max"], "i32");
167
+ * const Frozen = ecs.registerComponent({}, { name: "Frozen" }); // tag
168
+ * ecs.getField(e, Pos, "x"); // field names/types flow from the schema
169
+ */
170
+ registerComponent<S extends Record<string, TypedArrayTag>>(schema: S, opts?: ComponentRegisterOptions): ComponentDef<S>;
171
+ registerComponent<const F extends readonly string[], T extends TypedArrayTag = "f64">(fields: F, type?: T, opts?: ComponentRegisterOptions): ComponentDef<{
172
+ readonly [K in F[number]]: T;
173
+ }>;
174
+ registerSparseComponent<S extends Record<string, TypedArrayTag>>(schema: S, opts?: ComponentRegisterOptions): SparseComponentDef<S>;
175
+ registerSparseComponent<const F extends readonly string[], T extends TypedArrayTag = "f64">(fields: F, type?: T, opts?: ComponentRegisterOptions): SparseComponentDef<{
176
+ readonly [K in F[number]]: T;
177
+ }>;
178
+ /**
179
+ * Spawn an entity, immediately. Bare `spawn()` creates an empty entity —
180
+ * attach components afterward. `spawn(template, overrides?)` lands
181
+ * directly in the template's archetype with zero archetype transitions,
182
+ * applying optional flat per-field overrides on top of the template
183
+ * defaults. Inside a system use `ctx.commands.spawn(...)` instead.
184
+ *
185
+ * @example
186
+ * const e = ecs.spawn();
187
+ * ecs.addComponent(e, Pos, { x: 0, y: 0 });
188
+ *
189
+ * const Bullet = ecs.template([{ def: Pos, values: { x: 0, y: 0 } }]);
190
+ * const b = ecs.spawn(Bullet, { x: 5 }); // override a template default
191
+ */
192
+ spawn(): EntityID;
193
+ spawn<Defs extends readonly ComponentDef[]>(template: Template<Defs>, overrides?: TemplateOverrides<Defs>): EntityID;
194
+ /**
195
+ * Spawn an entity from varargs bundles (§bundles) — the immediate
196
+ * host-side analog of `ctx.commands.spawn`. `ecs.spawnBundle(bundle(Pos,{x,y}),
197
+ * bundle(Vel,{vx:1}), IsEnemy)` collapses the five attach shapes into one. Each
198
+ * bundle is applied immediately; a single combined-archetype insertion (one
199
+ * transition instead of one-per-component) is a later optimization — for the
200
+ * prototype this mirrors the existing per-component `addComponent` path.
201
+ */
202
+ spawnBundle(...items: BundleOrDef[]): EntityID;
203
+ /** DEV-only: throw when an *immediate* host structural mutator is called
204
+ * from inside one of THIS world's system bodies (or an observer / onAdded
205
+ * hook — they run in the same access spans). One rule for every host
206
+ * mutator, not just despawn: an immediate structural op mid-schedule can
207
+ * move or swap rows a running query is walking, and it is invisible to
208
+ * observers. The archetype-level `_iterDepth` guard only catches mutations
209
+ * touching the archetype currently being iterated — an op landing elsewhere
210
+ * would silently skip observers, so the receiver rule ("inside a system,
211
+ * use ctx.commands") is enforced wholesale here.
212
+ *
213
+ * `_updating` scopes the guard to THIS world: the accessCheck slot is
214
+ * process-global, so without it a system of world A mutating world B (a
215
+ * supported #785 pattern — B is not mid-iteration) would false-throw. */
216
+ private _assertHostMutationOutsideSystem;
217
+ /** Immediately destroy an entity — `ecs.despawn(e); ecs.isAlive(e)` is
218
+ * `false` on the next line, matching the immediacy of every other host
219
+ * facade mutation. Inside a system the buffered path is
220
+ * `ctx.commands.despawn` (applied at the phase flush); calling this from
221
+ * a system body throws in DEV, since an immediate destroy mid-iteration
222
+ * can invalidate rows the running query is walking. */
223
+ despawn(id: EntityID): void;
224
+ /** Disable `id` (idempotent). Excluded from default queries until re-enabled. */
225
+ disable(id: EntityID): this;
226
+ /** Re-enable a disabled `id` (idempotent). */
227
+ enable(id: EntityID): this;
228
+ /**
229
+ * Attach a component to an entity, immediately (inside a system, use the
230
+ * deferred `ctx.commands.add`). Three shapes: a bare def attaches a tag; a
231
+ * bundle (`Pos({ x: 1 })`) zero-fills omitted fields; the explicit
232
+ * `(e, def, values)` form demands every field, so a typo'd or missing
233
+ * field is a compile error.
234
+ *
235
+ * @example
236
+ * ecs.addComponent(e, Frozen); // tag
237
+ * ecs.addComponent(e, Pos({ x: 1 })); // bundle — y zero-fills
238
+ * ecs.addComponent(e, Pos, { x: 1, y: 2 }); // complete values
239
+ */
240
+ addComponent(entityId: EntityID, def: ComponentDef<Record<string, never>>): this;
241
+ addComponent<S extends ComponentSchema>(entityId: EntityID, bundle: Bundle<S>): this;
242
+ addComponent<S extends ComponentSchema>(entityId: EntityID, def: ComponentDef<S>, values: CompleteFieldValues<S>): this;
243
+ /** Batch-attach several components in one archetype transition. Each
244
+ * entry's `values` is checked against its own def's schema (a misspelled
245
+ * field is a compile error; tags refuse `values`) — same typing as
246
+ * `ECS.template` entries. Omitted fields zero-fill. */
247
+ addComponents<Defs extends readonly ComponentDef[]>(entityId: EntityID, entries: TemplateEntries<Defs>): this;
248
+ removeComponent(entityId: EntityID, def: ComponentDef): this;
249
+ removeComponents(entityId: EntityID, defs: ComponentDef[]): this;
250
+ /**
251
+ * Bulk add a component to ALL entities in the given archetype.
252
+ * O(columns) via TypedArray.set() instead of O(N×columns).
253
+ *
254
+ * Takes an `ArchetypeID` (from `ArchetypeView.id`) rather than a concrete
255
+ * `Archetype` — the concrete type is internal (issue #378).
256
+ */
257
+ batchAddComponent(src: ArchetypeID, def: ComponentDef<Record<string, never>>): this;
258
+ batchAddComponent<S extends ComponentSchema>(src: ArchetypeID, def: ComponentDef<S>, values: CompleteFieldValues<S>): this;
259
+ /**
260
+ * Bulk remove a component from ALL entities in the given archetype.
261
+ * O(columns) via TypedArray.set() instead of O(N×columns).
262
+ *
263
+ * Takes an `ArchetypeID` (from `ArchetypeView.id`); see `batchAddComponent`.
264
+ */
265
+ batchRemoveComponent(src: ArchetypeID, def: ComponentDef): this;
266
+ getField<S extends ComponentSchema>(entityId: EntityID, def: ComponentDef<S>, field: string & keyof S): number;
267
+ /** Host-side parity with `SystemContext.refRead` (POLISH_AUDIT M7): a
268
+ * read-only whole-component view for tooling/tests, instead of reading
269
+ * field-by-field. Same advisory-`readonly` semantics as the ctx variant;
270
+ * no `_changedTick` bump. Dev-throws on a dead entity, or when the entity
271
+ * doesn't hold the component (tags included — no fields, nothing to ref).
272
+ *
273
+ * **Staleness:** unlike ctx refs (protected by deferred structural changes
274
+ * until the phase flush), host-side structural mutations apply immediately —
275
+ * any `addComponent`/`removeComponent`/`despawn` after creating the ref can
276
+ * row-swap so the old ref silently reads *another entity's* data. The ref is
277
+ * only valid until the next structural mutation; treat it as an immediate
278
+ * single-expression read and re-create it after any structural change. */
279
+ refRead<S extends ComponentSchema>(def: ComponentDef<S>, entityId: EntityID): ReadonlyComponentRef<S>;
280
+ /** Total sibling of {@link getField} (POLISH_AUDIT #9): `undefined` when the
281
+ * entity is dead or doesn't hold the component, instead of a dev throw /
282
+ * prod garbage read. The safe way to probe-and-read in one call:
283
+ * `ecs.tryGetField(e, Health, "current") ?? 0`. */
284
+ tryGetField<S extends ComponentSchema>(entityId: EntityID, def: ComponentDef<S>, field: string & keyof S): number | undefined;
285
+ setField<S extends ComponentSchema>(entityId: EntityID, def: ComponentDef<S>, field: string & keyof S, value: number): void;
286
+ /** Read-modify-write one field: `updateField(e, Gold, "value", v => v - cost)`
287
+ * is the one-line form of the `getField` → compute → `setField` round trip.
288
+ * Returns the written value. Same access-check and observer semantics as the
289
+ * two calls it composes. */
290
+ updateField<S extends ComponentSchema>(entityId: EntityID, def: ComponentDef<S>, field: string & keyof S, fn: (current: number) => number): number;
291
+ /**
292
+ * Get the live, cached query matching entities that have **all** of
293
+ * `defs`. Queries are deduplicated by mask — calling this twice with the
294
+ * same terms returns the same instance — so build once at setup and reuse;
295
+ * the view stays live as archetypes appear. Refine with `.and()` /
296
+ * `.without()` / `.anyOf()`; iterate with `eachChunk` (mutating hot path),
297
+ * `forEach` (per-archetype), or `forEachEntity` (per-entity).
298
+ *
299
+ * @example
300
+ * const movers = ecs.query(Pos, Vel);
301
+ * movers.eachChunk((cols, count) => {
302
+ * const { x, y } = cols.mut(Pos);
303
+ * const { vx, vy } = cols.read(Vel);
304
+ * for (let i = 0; i < count; i++) { x[i] += vx[i]; y[i] += vy[i]; }
305
+ * });
306
+ */
307
+ query<T extends ComponentDef[]>(...defs: T): Query<T>;
308
+ _nextQueryId(): number;
309
+ /** QueryResolver implementation — creates or retrieves a cached Query. */
310
+ _resolveQuery(include: BitSet, exclude: BitSet | null, anyOf: BitSet | null, defs: readonly ComponentDef[]): Query<any>;
311
+ /**
312
+ * Register a system and get its scheduling handle. The config form is the
313
+ * production shape: it declares the access surface (`reads` / `writes` are
314
+ * mandatory; `spawns` / `despawns` / resource and sparse/relation terms
315
+ * optional), which is enforced at runtime in dev *and* narrows `ctx` at
316
+ * the type level so undeclared access fails to compile. Registration does
317
+ * not schedule — pass the returned descriptor to
318
+ * `ecs.addSystems(SCHEDULE.UPDATE, ...)`.
319
+ *
320
+ * @example
321
+ * // Full config — declared access, dev-checked and compile-checked
322
+ * const move = ecs.registerSystem({
323
+ * reads: [Vel],
324
+ * writes: [Pos],
325
+ * fn(ctx, dt) {
326
+ * movers.eachChunk((cols, count) => { ... });
327
+ * },
328
+ * });
329
+ * ecs.addSystems(SCHEDULE.UPDATE, move);
330
+ *
331
+ * @example
332
+ * // Bare function (no declared access — any component touch throws in dev)
333
+ * ecs.registerSystem((ctx, dt) => { ... });
334
+ * // Function + query builder (query resolved at registration time)
335
+ * ecs.registerSystem((q, ctx, dt) => { q.forEach((arch) => { ... }); }, (qb) => qb.with(Pos, Vel));
336
+ */
337
+ registerSystem(fn: SystemFn): SystemDescriptor;
338
+ registerSystem<Defs extends readonly ComponentDef[]>(fn: (q: Query<Defs>, ctx: SystemContext, dt: number) => void, queryFn: (qb: QueryBuilder) => Query<Defs>): SystemDescriptor;
339
+ /** `exclusive: true` grants full world access at runtime (§system.ts), so
340
+ * the context stays fully permissive at the type layer too. Declared BEFORE
341
+ * the typed-config overload so exclusive configs never get narrowed. */
342
+ registerSystem(config: SystemConfig & {
343
+ readonly exclusive: true;
344
+ }): SystemDescriptor;
345
+ /** Config form (§typestate, system.ts): the declaration lists are inferred
346
+ * as literal tuples and `fn` / `onAdded` receive
347
+ * `SystemContext<DeclaredAccess<…>>` — undeclared access fails to compile
348
+ * with the same taxonomy the runtime `accessCheck` throws with in
349
+ * `DEV`. A config VALUE typed as plain `SystemConfig` (dynamically
350
+ * built) still matches: its erased declaration lists compute a permissive
351
+ * access record. Escape hatch: annotate `fn(ctx: SystemContext, dt)`
352
+ * explicitly to keep a system permissive at compile time. */
353
+ registerSystem<R extends DenseAccessDecl, W extends DenseAccessDecl, Sp extends SpawnsAccessDecl = readonly never[], De extends DespawnsAccessDecl = readonly never[], Tr extends TransitionsAccessDecl = readonly never[], SR extends SparseAccessDecl = readonly never[], SW extends SparseAccessDecl = readonly never[], RR extends RelationsAccessDecl = readonly never[], RW extends RelationsAccessDecl = readonly never[], QR extends ResourcesAccessDecl = readonly never[], QW extends ResourcesAccessDecl = readonly never[]>(config: TypedSystemConfig<R, W, Sp, De, Tr, SR, SW, RR, RW, QR, QW>): SystemDescriptor;
354
+ removeSystem(system: SystemDescriptor): void;
355
+ get systemCount(): number;
356
+ /**
357
+ * Run the startup phases, once, before the first `update()`. Prewarms
358
+ * every archetype the registered systems/observers can produce, runs each
359
+ * system's `onAdded` hook, then the `PRE_STARTUP` → `STARTUP` →
360
+ * `POST_STARTUP` schedule. Events emitted during startup are drained at
361
+ * its tail — they do not leak into frame 1.
362
+ *
363
+ * @example
364
+ * ecs.addSystems(SCHEDULE.UPDATE, move);
365
+ * ecs.startup();
366
+ * ecs.update(1 / 60); // now tick every frame
367
+ */
368
+ startup(): void;
369
+ /** Compute the archetype closure from every registered system's AND
370
+ * observer's `spawns` + `transitions` and ask the store to plant the
371
+ * whole set in one `extendColumnStore` call. Observers carry the same
372
+ * access shape systems do (a synthesized `SystemDescriptor`), so an
373
+ * observer that spawns/transitions gets its target archetype prewarmed
374
+ * too rather than first-touching lazily mid-tick (#768). Exposed as
375
+ * `private` because the only caller is `startup()`; visible to tests via
376
+ * the `archetype_count` delta on the public ECS facade. */
377
+ private prewarmArchetypes;
378
+ /**
379
+ * Advance the world one frame. Runs the fixed-timestep accumulator loop
380
+ * (`FIXED_UPDATE`, when any fixed system is registered), then
381
+ * `PRE_UPDATE` → `UPDATE` → `POST_UPDATE`, flushing deferred structural
382
+ * commands at each phase boundary. Events emitted this tick are readable
383
+ * for the rest of the tick and cleared at the tail. `dt` is in seconds.
384
+ *
385
+ * @example
386
+ * let last = performance.now();
387
+ * function frame(now: number) {
388
+ * ecs.update((now - last) / 1000);
389
+ * last = now;
390
+ * requestAnimationFrame(frame);
391
+ * }
392
+ * requestAnimationFrame(frame);
393
+ */
394
+ update(dt: number): void;
395
+ dispose(): void;
396
+ /** Resolve a consumer-declared SAB region's byte offset by `region_id`, or
397
+ * 0 when absent. Generic, de-gamed replacement (#623) for the removed
398
+ * game-named accessors; pair with the consumer's own region module to
399
+ * materialise a typed view. Delegates to `Store.regionOffset`. */
400
+ regionOffset(regionId: number): number;
401
+ /** A handle (`{ buffer, view, offset, bytes }`) to a consumer-declared SAB
402
+ * region resolved by `region_id`, or `null` when absent. A consumer's
403
+ * region module builds a TypedArray view over the region's span from this.
404
+ * Re-fetch after a SAB grow. Delegates to `Store.regionHandle`. (#623) */
405
+ regionHandle(regionId: number): ColumnStoreRegionHandle | null;
406
+ /** Look up the field index a component reserves for `fieldName`. The
407
+ * index is assigned by `registerComponent` in insertion order and is
408
+ * stable for the lifetime of the ECS. Used by systems that need to
409
+ * pass `(component_id, field_id)` pairs across the WASM FFI — the Zig
410
+ * side identifies columns by these numeric IDs. */
411
+ fieldId<S extends Record<string, TypedArrayTag>>(def: ComponentDef<S>, fieldName: Extract<keyof S, string>): number;
412
+ /** Resolve an archetype's row index to the `EntityID` at that slot.
413
+ * A WASM system that drains events from the event ring as
414
+ * `(archId, row, …)` payloads uses this to convert the (archId, row)
415
+ * pair into the `EntityID` the `ctx.emit(...)` API expects.
416
+ * Throws if the (archId, row) pair is out of range. (#250 / Phase 4
417
+ * PR 4D) */
418
+ entityIdAtRow(archetypeId: number, row: number): EntityID;
419
+ /** The single SAB backing every archetype's column views. Exposed for
420
+ * snapshot/restore, `columnStoreStateHash`-based determinism checks, and
421
+ * Phase 2+ WASM/worker hand-off paths. Mutation flows through the
422
+ * usual `addComponent` / `removeComponent` / `flush` APIs; readers
423
+ * that hold a column view across a grow must consult
424
+ * `header.view_stamp` to detect a republish (#171 §8.1). */
425
+ get columnStore(): ColumnStore;
426
+ /** Count of live archetypes (including the empty one). Surfaces the
427
+ * Store-side `archetype_count` so Phase C tests can assert the
428
+ * pre-warmed closure was materialised; equally useful for diagnostics. */
429
+ get archetypeCount(): number;
430
+ registerTag(): ComponentDef<Record<string, never>>;
431
+ /** Register a sparse tag (empty schema) — membership only, no data. */
432
+ registerSparseTag(): SparseComponentDef<Record<string, never>>;
433
+ /** Register an archetype template (#462). Resolves the component set +
434
+ * default field values to a target archetype once (creating it if absent —
435
+ * fits the prewarm model), so later `spawn` / `spawnMany` calls land
436
+ * entities directly in that archetype with **zero archetype transitions**.
437
+ *
438
+ * const Bullet = ecs.template([
439
+ * { def: Position, values: { x: 0, y: 0 } },
440
+ * { def: Velocity, values: { vx: 0, vy: 0 } },
441
+ * ]);
442
+ *
443
+ * The big win is multi-component entities and bulk spawns; a single-
444
+ * component spawn is no faster than `spawn` + `addComponent`, which
445
+ * already bump-allocates a fresh entity into the target archetype. See
446
+ * ADR-0010. */
447
+ template<Defs extends readonly ComponentDef[]>(entries: TemplateEntries<Defs>): Template<Defs>;
448
+ /** Bulk-spawn `count` entities from `template`, optionally applying one
449
+ * shared `overrides` object to every spawned row (same typed keys as
450
+ * `spawn`). Field writes are O(columns) (one `TypedArray.fill` per
451
+ * column), not O(count×columns). Returns the new ids in spawn order. */
452
+ spawnMany<Defs extends readonly ComponentDef[]>(template: Template<Defs>, count: number, overrides?: TemplateOverrides<Defs>): EntityID[];
453
+ isAlive(id: EntityID): boolean;
454
+ get entityCount(): number;
455
+ hasComponent(entityId: EntityID, def: ComponentDef): boolean;
456
+ /** Whether `id` is currently disabled. Toggle via `disable` / `enable`
457
+ * (immediate, above the band — they carry the in-system dev guard). */
458
+ isDisabled(id: EntityID): boolean;
459
+ addSparse(entityId: EntityID, def: SparseComponentDef<Record<string, never>>): this;
460
+ addSparse<S extends ComponentSchema>(entityId: EntityID, def: SparseComponentDef<S>, values: CompleteFieldValues<S>): this;
461
+ removeSparse(entityId: EntityID, def: SparseComponentDef): this;
462
+ hasSparse(entityId: EntityID, def: SparseComponentDef): boolean;
463
+ getSparseField<S extends ComponentSchema>(entityId: EntityID, def: SparseComponentDef<S>, field: string & keyof S): number;
464
+ setSparseField<S extends ComponentSchema>(entityId: EntityID, def: SparseComponentDef<S>, field: string & keyof S, value: number): void;
465
+ _getLastRunTick(): number;
466
+ /** Current ECS write tick — the tick `eachChunk` stamps via `cols.mut` (§eachChunk). */
467
+ _getCurrentTick(): number;
468
+ _getQueryDirtyEpoch(): number;
469
+ /** QueryResolver implementation — sparse-membership match path (#469). */
470
+ _forEachSparseMatch(include: BitSet, exclude: BitSet | null, anyOf: BitSet | null, sparseInclude: readonly SparseComponentID[], sparseExclude: readonly SparseComponentID[], denseArchetypes: readonly Archetype[], cb: (entityId: EntityID) => void, includeDisabled: boolean): void;
471
+ /** QueryResolver implementation — backing sparse id of a relation, for the
472
+ * `(R, *)` wildcard term (`Query.withRelation`, #579). */
473
+ _relationBackingSparseId(def: RelationDef): SparseComponentID;
474
+ /** QueryResolver implementation — `(*, T)` wildcard match path (#579). */
475
+ _forEachRelationTargetMatch(target: EntityID, include: BitSet, exclude: BitSet | null, anyOf: BitSet | null, sparseInclude: readonly SparseComponentID[], sparseExclude: readonly SparseComponentID[], includeDisabled: boolean, cb: (entityId: EntityID) => void): void;
476
+ /** QueryResolver implementation — depth-ordered hierarchy match path (#581). */
477
+ _forEachHierarchyMatch(include: BitSet, exclude: BitSet | null, anyOf: BitSet | null, sparseInclude: readonly SparseComponentID[], sparseExclude: readonly SparseComponentID[], denseArchetypes: readonly Archetype[], relation: RelationDef, maxDepth: number, includeDisabled: boolean, cb: (entityId: EntityID) => void): void;
478
+ addSystems(label: SCHEDULE, ...entries: (SystemDescriptor | SystemEntry)[]): this;
479
+ /**
480
+ * Configure a `SystemSet` (#576) — the shared run condition and/or ordering
481
+ * every member inherits. Additive and order-independent with respect to
482
+ * `addSystems`: see `Schedule.configureSet`. Returns `this` to chain.
483
+ */
484
+ configureSet(set: SystemSet, config: SystemSetConfig): this;
485
+ /**
486
+ * Register a per-component observer (#517 §1 / ADR-0013). Reactions that were
487
+ * hand-polled every tick — "on `Death` added → spawn corpse", "on `HexPos`
488
+ * set → mark the spatial index" — become declarative.
489
+ *
490
+ * - **`onAdd` / `onRemove`** `(eid, ctx)` fire at the structural-flush
491
+ * boundary, after the batch commits, in canonical order (access-topological
492
+ * across observers, entity-id order within), looping to a fixed point so
493
+ * cascades settle. Determinism: a `stateHash` replay reproduces regardless
494
+ * of the order ops were queued.
495
+ * - **`onDisable` / `onEnable`** `(eid, ctx)` fire at the same flush boundary
496
+ * when an entity carrying the component is *disabled* / *enabled* (#577,
497
+ * ADR-0023), once per net transition, for every component the entity carries
498
+ * (a disable is a soft remove of the whole mask from default queries). Like
499
+ * `onAdd`/`onRemove`, an *immediate* `ecs.disable()` does not fire — only
500
+ * the deferred `ctx.commands.disable()` toggle does. `yieldExisting` seeds enabled
501
+ * members only, so a disabled entity is correctly absent at seed.
502
+ * - **`onSet`** fires at the post-update detection point. Default
503
+ * `granularity: "archetype"` fires `(arch, ctx)` once per changed
504
+ * archetype-column (the consumer iterates `arch.entityCount` rows) — free,
505
+ * reusing the change tick. `granularity: "entity"` fires `(eid, ctx)` once
506
+ * per changed entity, draining the opt-in per-row dirty list (registering it
507
+ * enables dirty tracking for the component; the producer records via
508
+ * `ctx.setField` automatically, or `ctx.markChanged` in a `getColumn`
509
+ * hot loop).
510
+ *
511
+ * Observer callbacks that touch ECS state must declare it via `access`
512
+ * (merged over an all-empty declaration) — undeclared access throws in
513
+ * `DEV`, and those decls drive the firing order. `yieldExisting` replays
514
+ * `onAdd` over current matches on registration. Register at world-build time
515
+ * (before `startup()`); the returned handle's `dispose()` unregisters.
516
+ */
517
+ observe(def: ComponentHandle, config: StructuralObserverConfig): ObserverHandle;
518
+ observe(def: ComponentHandle, config: EntitySetObserverConfig): ObserverHandle;
519
+ observe(def: ComponentHandle, config: ArchetypeSetObserverConfig): ObserverHandle;
520
+ /**
521
+ * Stamp every SAB-backed archetype's live `length` into its SAB
522
+ * descriptor's `row_count` field. **You usually don't need to call
523
+ * this directly** — `update()` publishes at tick start and
524
+ * `SystemContext.flush()` publishes at every phase boundary, so any
525
+ * WASM scan running inside the schedule sees fresh counts for free.
526
+ * This is an escape hatch for code that mutates archetype state
527
+ * outside the system framework and wants to force a republish without
528
+ * going through `flush()`. No in-repo callers today.
529
+ *
530
+ * Cheap: walks the descriptor region once, does no column I/O.
531
+ */
532
+ publishArchetypeRowCounts(): void;
533
+ flush(): void;
534
+ }
535
+ /** Phase C of issue #213 — archetype closure from a descriptor set.
536
+ *
537
+ * Each descriptor is a system or an observer's synthesized `SystemDescriptor`
538
+ * (#768) — both carry `spawns` + `transitions`. Seeds the worklist with every
539
+ * descriptor's `spawns`; iteratively applies every descriptor's `transitions`
540
+ * to every discovered mask whose components cover the transition's `whenHas`.
541
+ * Returns the union of seeds + reachable targets, deduplicated by hash-bucketed
542
+ * mask equality.
543
+ *
544
+ * Termination: every transition either monotonically grows the mask (add
545
+ * outpacing remove), monotonically shrinks it, or returns a mask the
546
+ * `seen` map already holds. Because the universe of masks is bounded by
547
+ * `2^|components|` (and in practice the in-tree spawn/transition set is
548
+ * tiny — ~20 masks at most), the worklist is finite and we exit when it
549
+ * empties.
550
+ *
551
+ * Liberal `whenHas` per design doc §6.6 — over-approximation is fine; an
552
+ * unreachable transition target costs one descriptor row at the SAB tail,
553
+ * not column bytes. Empty `spawns` + `transitions` short-circuit to zero.
554
+ */
555
+ declare function computeArchetypeClosure(descriptors: Iterable<SystemDescriptor>): BitSet[];
556
+ /** @internal — test seam for the closure walk. Exposed so the prewarm
557
+ * tests can exercise the BFS without standing up a full Store. */
558
+ export declare const _ecsInternals: {
559
+ computeArchetypeClosure: typeof computeArchetypeClosure;
560
+ };
561
+ export {};
562
+ //# sourceMappingURL=ecs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ecs.d.ts","sourceRoot":"","sources":["../../../src/core/ecs/ecs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8DK;AAEL,OAAO,EAAS,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAGN,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE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