@reicek/neataptic-ts 0.1.24 → 0.1.26

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 (215) hide show
  1. package/.github/copilot-instructions.md +11 -0
  2. package/.github/skills/trace-analyzer-extension/SKILL.md +3 -3
  3. package/.github/skills/trace-analyzer-extension/assets/extension-checklist.md +1 -1
  4. package/.github/skills/trace-analyzer-extension/references/analyzer-extension-workflow.md +1 -1
  5. package/.github/skills/trace-audit-reporting/SKILL.md +3 -3
  6. package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +1 -1
  7. package/.github/workflows/ci.yml +3 -3
  8. package/.github/workflows/deploy-pages.yml +6 -6
  9. package/.github/workflows/manual_release_pipeline.yml +3 -3
  10. package/.github/workflows/publish.yml +18 -19
  11. package/.github/workflows/release_dispatch.yml +3 -3
  12. package/package.json +26 -20
  13. package/plans/Flappy_Bird_Folder_Documentation_Pass.md +4 -4
  14. package/plans/README.md +24 -0
  15. package/plans/Roadmap.md +62 -40
  16. package/plans/analyze-trace-solid-split.plans.md +66 -0
  17. package/plans/architecture-solid-split.plans.md +9 -15
  18. package/plans/asciiMaze-typescript-repair.plans.md +1 -1
  19. package/plans/generate-docs-solid-split.plans.md +87 -0
  20. package/plans/methods-docs.plans.md +25 -1
  21. package/plans/methods-solid-split.plans.md +14 -14
  22. package/plans/neat-docs.plans.md +9 -1
  23. package/plans/neat-test-surface-repair.plans.md +1 -1
  24. package/plans/render-docs-html-solid-split.plans.md +68 -0
  25. package/plans/src-no-explicit-any-cleanup.plans.md +1 -1
  26. package/plans/utils-docs.plans.md +6 -1
  27. package/scripts/analyze-trace/analyze-trace.analysis.ts +479 -0
  28. package/scripts/analyze-trace/analyze-trace.constants.ts +35 -0
  29. package/scripts/analyze-trace/analyze-trace.io.ts +69 -0
  30. package/scripts/analyze-trace/analyze-trace.report.ts +100 -0
  31. package/scripts/analyze-trace/analyze-trace.shared.ts +116 -0
  32. package/scripts/analyze-trace/analyze-trace.ts +45 -0
  33. package/scripts/analyze-trace/analyze-trace.types.ts +72 -0
  34. package/scripts/assets/theme.css +80 -23
  35. package/scripts/copy-examples.ts +239 -0
  36. package/scripts/export-onnx.ts +223 -0
  37. package/scripts/generate-bench-tables.ts +378 -37
  38. package/scripts/generate-docs/generate-docs.constants.ts +107 -0
  39. package/scripts/generate-docs/generate-docs.order.ts +355 -0
  40. package/scripts/generate-docs/generate-docs.state.ts +31 -0
  41. package/scripts/generate-docs/generate-docs.targets.ts +165 -0
  42. package/scripts/generate-docs/generate-docs.ts +63 -0
  43. package/scripts/generate-docs/generate-docs.types.ts +112 -0
  44. package/scripts/generate-docs/output/generate-docs.output.folder-index.utils.ts +167 -0
  45. package/scripts/generate-docs/output/generate-docs.output.ordering.utils.ts +353 -0
  46. package/scripts/generate-docs/output/generate-docs.output.readme.utils.ts +420 -0
  47. package/scripts/generate-docs/output/generate-docs.output.ts +123 -0
  48. package/scripts/generate-docs/output/generate-docs.output.warnings.utils.ts +219 -0
  49. package/scripts/generate-docs/symbols/generate-docs.symbols.collection.utils.ts +365 -0
  50. package/scripts/generate-docs/symbols/generate-docs.symbols.jsdoc.utils.ts +373 -0
  51. package/scripts/generate-docs/symbols/generate-docs.symbols.normalize.utils.ts +155 -0
  52. package/scripts/generate-docs/symbols/generate-docs.symbols.render.utils.ts +149 -0
  53. package/scripts/generate-docs/symbols/generate-docs.symbols.signature.utils.ts +289 -0
  54. package/scripts/generate-docs/symbols/generate-docs.symbols.ts +11 -0
  55. package/scripts/mermaid-cli.mjs +102 -22
  56. package/scripts/mermaid-cli.ts +736 -0
  57. package/scripts/render-docs-html/render-docs-html.assets.ts +54 -0
  58. package/scripts/render-docs-html/render-docs-html.mermaid.ts +245 -0
  59. package/scripts/{render-docs-html.sidebar.ts → render-docs-html/render-docs-html.navigation.ts} +141 -144
  60. package/scripts/render-docs-html/render-docs-html.pages.ts +333 -0
  61. package/scripts/render-docs-html/render-docs-html.shared.ts +333 -0
  62. package/scripts/render-docs-html/render-docs-html.types.ts +42 -0
  63. package/scripts/render-docs-html.ts +23 -587
  64. package/scripts/run-docs.ts +238 -0
  65. package/scripts/write-dist-docs-pkg.ts +40 -0
  66. package/src/README.md +75 -75
  67. package/src/architecture/connection/README.md +5 -5
  68. package/src/architecture/layer/README.md +508 -508
  69. package/src/architecture/network/README.md +1458 -1458
  70. package/src/architecture/network/activate/README.md +694 -694
  71. package/src/architecture/network/bootstrap/README.md +77 -77
  72. package/src/architecture/network/connect/README.md +74 -74
  73. package/src/architecture/network/deterministic/README.md +135 -135
  74. package/src/architecture/network/evolve/README.md +364 -364
  75. package/src/architecture/network/gating/README.md +130 -130
  76. package/src/architecture/network/genetic/README.md +399 -399
  77. package/src/architecture/network/mutate/README.md +897 -897
  78. package/src/architecture/network/onnx/README.md +720 -720
  79. package/src/architecture/network/onnx/export/README.md +728 -728
  80. package/src/architecture/network/onnx/export/layers/README.md +450 -450
  81. package/src/architecture/network/onnx/import/README.md +618 -618
  82. package/src/architecture/network/onnx/schema/README.md +32 -32
  83. package/src/architecture/network/prune/README.md +245 -245
  84. package/src/architecture/network/remove/README.md +135 -135
  85. package/src/architecture/network/runtime/README.md +106 -106
  86. package/src/architecture/network/serialize/README.md +542 -542
  87. package/src/architecture/network/slab/README.md +608 -608
  88. package/src/architecture/network/standalone/README.md +212 -212
  89. package/src/architecture/network/stats/README.md +84 -84
  90. package/src/architecture/network/topology/README.md +465 -465
  91. package/src/architecture/network/training/README.md +200 -200
  92. package/src/architecture/node/README.md +5 -5
  93. package/src/architecture/nodePool/README.md +14 -14
  94. package/src/methods/README.md +99 -99
  95. package/src/methods/activation/README.md +189 -189
  96. package/src/methods/cost/README.md +131 -131
  97. package/src/methods/rate/README.md +86 -86
  98. package/src/multithreading/README.md +77 -77
  99. package/src/multithreading/workers/browser/README.md +8 -8
  100. package/src/multithreading/workers/node/README.md +8 -8
  101. package/src/neat/README.md +148 -148
  102. package/src/neat/adaptive/README.md +120 -120
  103. package/src/neat/adaptive/acceptance/README.md +40 -40
  104. package/src/neat/adaptive/complexity/README.md +137 -137
  105. package/src/neat/adaptive/core/README.md +197 -197
  106. package/src/neat/adaptive/lineage/README.md +90 -90
  107. package/src/neat/adaptive/mutation/README.md +284 -284
  108. package/src/neat/compat/README.md +43 -43
  109. package/src/neat/compat/core/README.md +90 -90
  110. package/src/neat/diversity/README.md +35 -35
  111. package/src/neat/diversity/core/README.md +88 -88
  112. package/src/neat/evaluate/README.md +85 -85
  113. package/src/neat/evaluate/auto-distance/README.md +75 -75
  114. package/src/neat/evaluate/entropy-compat/README.md +37 -37
  115. package/src/neat/evaluate/entropy-sharing/README.md +43 -43
  116. package/src/neat/evaluate/fitness/README.md +23 -23
  117. package/src/neat/evaluate/novelty/README.md +120 -120
  118. package/src/neat/evaluate/objectives/README.md +17 -17
  119. package/src/neat/evaluate/shared/README.md +94 -94
  120. package/src/neat/evolve/README.md +96 -96
  121. package/src/neat/evolve/adaptive/README.md +60 -60
  122. package/src/neat/evolve/objectives/README.md +63 -63
  123. package/src/neat/evolve/offspring/README.md +56 -56
  124. package/src/neat/evolve/population/README.md +171 -171
  125. package/src/neat/evolve/runtime/README.md +79 -79
  126. package/src/neat/evolve/speciation/README.md +74 -74
  127. package/src/neat/evolve/warnings/README.md +10 -10
  128. package/src/neat/export/README.md +114 -114
  129. package/src/neat/helpers/README.md +50 -50
  130. package/src/neat/init/README.md +9 -9
  131. package/src/neat/lineage/core/README.md +101 -101
  132. package/src/neat/multiobjective/category/README.md +74 -74
  133. package/src/neat/multiobjective/crowding/README.md +272 -272
  134. package/src/neat/multiobjective/dominance/README.md +171 -171
  135. package/src/neat/multiobjective/fronts/README.md +68 -68
  136. package/src/neat/multiobjective/metrics/README.md +43 -43
  137. package/src/neat/multiobjective/objectives/README.md +31 -31
  138. package/src/neat/multiobjective/shared/README.md +27 -27
  139. package/src/neat/mutation/README.md +97 -97
  140. package/src/neat/mutation/add-conn/README.md +115 -115
  141. package/src/neat/mutation/add-node/README.md +126 -126
  142. package/src/neat/mutation/flow/README.md +149 -149
  143. package/src/neat/mutation/repair/README.md +185 -185
  144. package/src/neat/mutation/select/README.md +117 -117
  145. package/src/neat/mutation/shared/README.md +32 -32
  146. package/src/neat/objectives/README.md +25 -25
  147. package/src/neat/objectives/core/README.md +67 -67
  148. package/src/neat/pruning/README.md +40 -40
  149. package/src/neat/pruning/core/README.md +171 -171
  150. package/src/neat/pruning/facade/README.md +32 -32
  151. package/src/neat/rng/README.md +104 -104
  152. package/src/neat/rng/core/README.md +137 -137
  153. package/src/neat/rng/facade/README.md +50 -50
  154. package/src/neat/selection/README.md +111 -111
  155. package/src/neat/selection/core/README.md +227 -227
  156. package/src/neat/selection/facade/README.md +61 -61
  157. package/src/neat/shared/README.md +163 -163
  158. package/src/neat/speciation/README.md +31 -31
  159. package/src/neat/speciation/threshold/README.md +35 -35
  160. package/src/neat/species/README.md +25 -25
  161. package/src/neat/species/core/README.md +20 -20
  162. package/src/neat/species/core/shared/README.md +18 -18
  163. package/src/neat/species/history/context/README.md +22 -22
  164. package/src/neat/telemetry/accessors/README.md +58 -58
  165. package/src/neat/telemetry/exports/README.md +233 -233
  166. package/src/neat/telemetry/facade/README.md +252 -252
  167. package/src/neat/telemetry/facade/archive/README.md +57 -57
  168. package/src/neat/telemetry/facade/buffer/README.md +43 -43
  169. package/src/neat/telemetry/facade/lineage/README.md +12 -12
  170. package/src/neat/telemetry/facade/objectives/README.md +44 -44
  171. package/src/neat/telemetry/facade/runtime/README.md +26 -26
  172. package/src/neat/telemetry/facade/species/README.md +27 -27
  173. package/src/neat/telemetry/metrics/README.md +696 -696
  174. package/src/neat/telemetry/recorder/README.md +57 -57
  175. package/src/neat/telemetry/types/README.md +32 -32
  176. package/src/neat/topology-intent/README.md +75 -75
  177. package/src/utils/README.md +193 -193
  178. package/test/examples/asciiMaze/browser-entry/README.md +92 -92
  179. package/test/examples/asciiMaze/dashboardManager/README.md +109 -109
  180. package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +28 -28
  181. package/test/examples/asciiMaze/evolutionEngine/README.md +1527 -1527
  182. package/test/examples/asciiMaze/mazeMovement/README.md +105 -105
  183. package/test/examples/asciiMaze/mazeMovement/finalization/README.md +16 -16
  184. package/test/examples/asciiMaze/mazeMovement/policy/README.md +57 -57
  185. package/test/examples/asciiMaze/mazeMovement/runtime/README.md +52 -52
  186. package/test/examples/asciiMaze/mazeMovement/shaping/README.md +46 -46
  187. package/test/examples/flappy_bird/browser-entry/README.md +508 -508
  188. package/test/examples/flappy_bird/browser-entry/host/README.md +101 -101
  189. package/test/examples/flappy_bird/browser-entry/host/resize/README.md +144 -144
  190. package/test/examples/flappy_bird/browser-entry/network-view/README.md +194 -194
  191. package/test/examples/flappy_bird/browser-entry/playback/README.md +278 -278
  192. package/test/examples/flappy_bird/browser-entry/playback/background/README.md +129 -129
  193. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +502 -502
  194. package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +139 -139
  195. package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +10 -10
  196. package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +43 -43
  197. package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +30 -30
  198. package/test/examples/flappy_bird/browser-entry/runtime/README.md +59 -59
  199. package/test/examples/flappy_bird/browser-entry/visualization/README.md +276 -276
  200. package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +16 -16
  201. package/test/examples/flappy_bird/constants/README.md +1070 -1070
  202. package/test/examples/flappy_bird/environment/README.md +22 -22
  203. package/test/examples/flappy_bird/evaluation/README.md +32 -32
  204. package/test/examples/flappy_bird/evaluation/rollout/README.md +141 -141
  205. package/test/examples/flappy_bird/flappy-evolution-worker/README.md +425 -425
  206. package/test/examples/flappy_bird/simulation-shared/README.md +170 -170
  207. package/test/examples/flappy_bird/simulation-shared/observation/README.md +109 -109
  208. package/test/examples/flappy_bird/trainer/README.md +325 -325
  209. package/test/examples/flappy_bird/trainer/evaluation/README.md +74 -74
  210. package/scripts/analyze-trace.ts +0 -590
  211. package/scripts/copy-examples.mjs +0 -114
  212. package/scripts/export-onnx.mjs +0 -86
  213. package/scripts/generate-bench-tables.mjs +0 -182
  214. package/scripts/generate-docs.ts +0 -2900
  215. package/scripts/write-dist-docs-pkg.mjs +0 -16
@@ -100,6 +100,41 @@ adjustCompatibilityThreshold(
100
100
  );
101
101
  ```
102
102
 
103
+ ### clampCompatibilityThreshold
104
+
105
+ ```ts
106
+ clampCompatibilityThreshold(
107
+ options: SpeciationOptions,
108
+ minCompatibilityThreshold: number,
109
+ maxCompatibilityThreshold: number,
110
+ ): void
111
+ ```
112
+
113
+ Clamp the compatibility threshold to configured bounds.
114
+
115
+ This is the final safety rail for callers that already have a threshold value
116
+ but need to ensure it remains inside the allowed range. Unlike the PID clamp
117
+ above, this helper only limits the option value itself; it does not interpret
118
+ species-count error or recalculate the integral term.
119
+
120
+ Read this as the small "no surprises" helper at the end of the loop. Once
121
+ the controller has chosen a new threshold candidate, this function makes the
122
+ public option safe to persist into the next generation even if the caller did
123
+ not come through the full PID path.
124
+
125
+ Parameters:
126
+ - `options` - - Speciation options.
127
+ - `minCompatibilityThreshold` - - Lower clamp bound.
128
+ - `maxCompatibilityThreshold` - - Upper clamp bound.
129
+
130
+ Returns: Nothing.
131
+
132
+ Example:
133
+
134
+ ```ts
135
+ clampCompatibilityThreshold(neat.options, 1, 10);
136
+ ```
137
+
103
138
  ### computePidThreshold
104
139
 
105
140
  ```ts
@@ -152,38 +187,3 @@ const nextThreshold = computePidThreshold(
152
187
  10,
153
188
  );
154
189
  ```
155
-
156
- ### clampCompatibilityThreshold
157
-
158
- ```ts
159
- clampCompatibilityThreshold(
160
- options: SpeciationOptions,
161
- minCompatibilityThreshold: number,
162
- maxCompatibilityThreshold: number,
163
- ): void
164
- ```
165
-
166
- Clamp the compatibility threshold to configured bounds.
167
-
168
- This is the final safety rail for callers that already have a threshold value
169
- but need to ensure it remains inside the allowed range. Unlike the PID clamp
170
- above, this helper only limits the option value itself; it does not interpret
171
- species-count error or recalculate the integral term.
172
-
173
- Read this as the small "no surprises" helper at the end of the loop. Once
174
- the controller has chosen a new threshold candidate, this function makes the
175
- public option safe to persist into the next generation even if the caller did
176
- not come through the full PID path.
177
-
178
- Parameters:
179
- - `options` - - Speciation options.
180
- - `minCompatibilityThreshold` - - Lower clamp bound.
181
- - `maxCompatibilityThreshold` - - Upper clamp bound.
182
-
183
- Returns: Nothing.
184
-
185
- Example:
186
-
187
- ```ts
188
- clampCompatibilityThreshold(neat.options, 1, 10);
189
- ```
@@ -53,31 +53,6 @@ const history = neat.getSpeciesHistory();
53
53
 
54
54
  ## neat/species/species.ts
55
55
 
56
- ### getSpeciesStats
57
-
58
- ```ts
59
- getSpeciesStats(): { id: number; size: number; bestScore: number; lastImproved: number; }[]
60
- ```
61
-
62
- Get lightweight per-species statistics for the current population.
63
-
64
- This is the shortest read path into the species system. It is useful when a
65
- caller needs dashboard-friendly snapshots such as current species sizes,
66
- recent improvement timestamps, or the best score per species without pulling
67
- the heavier generation-by-generation history buffer.
68
-
69
- Parameters:
70
- - `this` - - NEAT host exposing the internal species registry.
71
-
72
- Returns: Compact per-species summaries suitable for reporting.
73
-
74
- Example:
75
-
76
- ```ts
77
- const speciesSummaries = neat.getSpeciesStats();
78
- console.table(speciesSummaries);
79
- ```
80
-
81
56
  ### getSpeciesHistory
82
57
 
83
58
  ```ts
@@ -111,3 +86,28 @@ Example:
111
86
  const speciesHistory = neat.getSpeciesHistory();
112
87
  console.log(speciesHistory.at(-1));
113
88
  ```
89
+
90
+ ### getSpeciesStats
91
+
92
+ ```ts
93
+ getSpeciesStats(): { id: number; size: number; bestScore: number; lastImproved: number; }[]
94
+ ```
95
+
96
+ Get lightweight per-species statistics for the current population.
97
+
98
+ This is the shortest read path into the species system. It is useful when a
99
+ caller needs dashboard-friendly snapshots such as current species sizes,
100
+ recent improvement timestamps, or the best score per species without pulling
101
+ the heavier generation-by-generation history buffer.
102
+
103
+ Parameters:
104
+ - `this` - - NEAT host exposing the internal species registry.
105
+
106
+ Returns: Compact per-species summaries suitable for reporting.
107
+
108
+ Example:
109
+
110
+ ```ts
111
+ const speciesSummaries = neat.getSpeciesStats();
112
+ console.table(speciesSummaries);
113
+ ```
@@ -36,26 +36,6 @@ flowchart TD
36
36
 
37
37
  ## neat/species/core/species.core.ts
38
38
 
39
- ### shouldAugmentExtendedHistory
40
-
41
- ```ts
42
- shouldAugmentExtendedHistory(
43
- options: NeatOptions | undefined,
44
- ): boolean
45
- ```
46
-
47
- Check whether extended species history should be augmented.
48
-
49
- This is the policy gate for the whole chapter. The read-side species history
50
- flow uses it to decide whether returning the recorded rows is already enough
51
- or whether the caller explicitly asked for the richer innovation-range and
52
- enabled-ratio view.
53
-
54
- Parameters:
55
- - `options` - - Current NEAT options.
56
-
57
- Returns: `true` when extended history is enabled.
58
-
59
39
  ### backfillExtendedHistory
60
40
 
61
41
  ```ts
@@ -90,3 +70,23 @@ if (shouldAugmentExtendedHistory(neat.options)) {
90
70
  backfillExtendedHistory(history, neat);
91
71
  }
92
72
  ```
73
+
74
+ ### shouldAugmentExtendedHistory
75
+
76
+ ```ts
77
+ shouldAugmentExtendedHistory(
78
+ options: NeatOptions | undefined,
79
+ ): boolean
80
+ ```
81
+
82
+ Check whether extended species history should be augmented.
83
+
84
+ This is the policy gate for the whole chapter. The read-side species history
85
+ flow uses it to decide whether returning the recorded rows is already enough
86
+ or whether the caller explicitly asked for the richer innovation-range and
87
+ enabled-ratio view.
88
+
89
+ Parameters:
90
+ - `options` - - Current NEAT options.
91
+
92
+ Returns: `true` when extended history is enabled.
@@ -33,6 +33,24 @@ flowchart TD
33
33
 
34
34
  ## neat/species/core/shared/species.core.shared.ts
35
35
 
36
+ ### SpeciesConnectionSummary
37
+
38
+ Aggregated innovation coverage for the genomes currently assigned to one species.
39
+
40
+ The history backfill path uses this compact shape to answer two questions that
41
+ are useful in telemetry dashboards:
42
+
43
+ - how wide the inherited innovation span is across the species members,
44
+ - how many of those structural genes are still enabled.
45
+
46
+ Those two values are enough to make extended history rows much more
47
+ explanatory without forcing the species-reporting surface to retain every
48
+ connection-level detail from every generation.
49
+
50
+ Treat it as a reporting summary, not as a lossless reconstruction format.
51
+ The goal is to explain structural breadth and retention at a glance, not to
52
+ preserve every innovation id for downstream mutation logic.
53
+
36
54
  ### summarizeSpeciesConnections
37
55
 
38
56
  ```ts
@@ -72,21 +90,3 @@ Example:
72
90
  const summary = summarizeSpeciesConnections(species.members, neat._fallbackInnov);
73
91
  console.log(summary.innovationRange, summary.enabledRatio);
74
92
  ```
75
-
76
- ### SpeciesConnectionSummary
77
-
78
- Aggregated innovation coverage for the genomes currently assigned to one species.
79
-
80
- The history backfill path uses this compact shape to answer two questions that
81
- are useful in telemetry dashboards:
82
-
83
- - how wide the inherited innovation span is across the species members,
84
- - how many of those structural genes are still enabled.
85
-
86
- Those two values are enough to make extended history rows much more
87
- explanatory without forcing the species-reporting surface to retain every
88
- connection-level detail from every generation.
89
-
90
- Treat it as a reporting summary, not as a lossless reconstruction format.
91
- The goal is to explain structural breadth and retention at a glance, not to
92
- preserve every innovation id for downstream mutation logic.
@@ -23,6 +23,28 @@ Read this chapter in two steps:
23
23
 
24
24
  ## neat/species/history/context/species.history.context.ts
25
25
 
26
+ ### ResolvedSpeciesHistoryContext
27
+
28
+ Resolved host data needed to serve a species-history read.
29
+
30
+ The public `getSpeciesHistory()` facade should not need to know how the NEAT
31
+ controller stores its history buffer or which internal fields are required to
32
+ support optional extended-history augmentation. This context keeps that
33
+ plumbing in one place.
34
+
35
+ The three fields map to the three setup concerns behind a history read:
36
+
37
+ - `speciesHistory` is the stored generation-by-generation buffer,
38
+ - `backfillContext` carries the internal data needed only when extended
39
+ history enrichment is allowed,
40
+ - `neatOptions` carries the policy switches that decide whether that
41
+ enrichment path should run.
42
+
43
+ Read this type as the boundary between raw controller storage and the richer
44
+ history-read logic. Once this object has been resolved, later helpers can ask
45
+ "should we augment?" and "what data do we already have?" without knowing
46
+ where the controller originally stored each ingredient.
47
+
26
48
  ### resolveSpeciesHistoryContext
27
49
 
28
50
  ```ts
@@ -62,25 +84,3 @@ if (historyContext.neatOptions?.enableSpeciesAugmentation) {
62
84
 
63
85
  console.log(historyContext.speciesHistory.length);
64
86
  ```
65
-
66
- ### ResolvedSpeciesHistoryContext
67
-
68
- Resolved host data needed to serve a species-history read.
69
-
70
- The public `getSpeciesHistory()` facade should not need to know how the NEAT
71
- controller stores its history buffer or which internal fields are required to
72
- support optional extended-history augmentation. This context keeps that
73
- plumbing in one place.
74
-
75
- The three fields map to the three setup concerns behind a history read:
76
-
77
- - `speciesHistory` is the stored generation-by-generation buffer,
78
- - `backfillContext` carries the internal data needed only when extended
79
- history enrichment is allowed,
80
- - `neatOptions` carries the policy switches that decide whether that
81
- enrichment path should run.
82
-
83
- Read this type as the boundary between raw controller storage and the richer
84
- history-read logic. Once this object has been resolved, later helpers can ask
85
- "should we augment?" and "what data do we already have?" without knowing
86
- where the controller originally stored each ingredient.
@@ -26,30 +26,32 @@ exposes cached diversity and coarse timing data.
26
26
 
27
27
  ## neat/telemetry/accessors/telemetry.accessors.ts
28
28
 
29
- ### getTelemetryBuffer
29
+ ### buildLineageSnapshot
30
30
 
31
31
  ```ts
32
- getTelemetryBuffer(
33
- host: TelemetryAccessorHost,
34
- ): TelemetryEntry[]
32
+ buildLineageSnapshot(
33
+ population: { _id?: number | undefined; _parents?: number[] | undefined; }[],
34
+ limit: number,
35
+ ): { id: number; parents: number[]; }[]
35
36
  ```
36
37
 
37
- Return the telemetry buffer, defaulting to an empty array when missing.
38
+ Snapshot lineage metadata for the first `limit` genomes.
38
39
 
39
- This is the lowest-level read for recent telemetry history. It gives callers
40
- a stable way to inspect the current in-memory buffer without forcing every
41
- consumer to reimplement null checks.
40
+ The accessor deliberately returns only `{ id, parents }` pairs. That keeps
41
+ lineage snapshots lightweight enough for telemetry entries, tests, and quick
42
+ debugging while still exposing the key teaching signal: which genomes share
43
+ ancestry and how recent offspring connect back to parents.
42
44
 
43
45
  Parameters:
44
- - `host` - - Telemetry host that may or may not have initialized its buffer.
46
+ - `population` - - Population slice containing optional runtime lineage metadata.
47
+ - `limit` - - Maximum number of genomes to sample from the front of the population.
45
48
 
46
- Returns: Telemetry entries recorded so far, or an empty array when telemetry
47
- has not been started yet.
49
+ Returns: Compact lineage entries with genome ids and parent ids.
48
50
 
49
51
  Example:
50
52
 
51
- const recentEntries = getTelemetryBuffer(neat).slice(-3);
52
- console.log(recentEntries.length);
53
+ const lineage = buildLineageSnapshot(neat.population, 5);
54
+ console.log(lineage.map((entry) => entry.parents));
53
55
 
54
56
  ### clearTelemetryBuffer
55
57
 
@@ -70,6 +72,25 @@ Parameters:
70
72
 
71
73
  Returns: Nothing. The host buffer is replaced with an empty array.
72
74
 
75
+ ### getCachedDiversityStats
76
+
77
+ ```ts
78
+ getCachedDiversityStats(
79
+ host: TelemetryAccessorHost,
80
+ ): DiversityStats | undefined
81
+ ```
82
+
83
+ Read cached diversity statistics.
84
+
85
+ This accessor does not compute diversity on demand. Its job is only to expose
86
+ the last cached snapshot so callers can distinguish between "no diversity has
87
+ been computed yet" and "diversity was computed and here is the result."
88
+
89
+ Parameters:
90
+ - `host` - - Telemetry host exposing an optional cached diversity snapshot.
91
+
92
+ Returns: Cached diversity statistics when available, otherwise `undefined`.
93
+
73
94
  ### getObjectiveEventsSnapshot
74
95
 
75
96
  ```ts
@@ -94,75 +115,54 @@ Example:
94
115
  const events = getObjectiveEventsSnapshot(neat);
95
116
  console.table(events);
96
117
 
97
- ### buildLineageSnapshot
118
+ ### getPerformanceStatsSnapshot
98
119
 
99
120
  ```ts
100
- buildLineageSnapshot(
101
- population: { _id?: number | undefined; _parents?: number[] | undefined; }[],
102
- limit: number,
103
- ): { id: number; parents: number[]; }[]
121
+ getPerformanceStatsSnapshot(
122
+ host: TelemetryAccessorHost,
123
+ ): { lastEvalMs: number | undefined; lastEvolveMs: number | undefined; }
104
124
  ```
105
125
 
106
- Snapshot lineage metadata for the first `limit` genomes.
126
+ Snapshot performance timings for evaluation and evolution steps.
107
127
 
108
- The accessor deliberately returns only `{ id, parents }` pairs. That keeps
109
- lineage snapshots lightweight enough for telemetry entries, tests, and quick
110
- debugging while still exposing the key teaching signal: which genomes share
111
- ancestry and how recent offspring connect back to parents.
128
+ These timings are intentionally coarse. They are useful for telemetry reads,
129
+ simple dashboards, and regression tests that need to know which phase was
130
+ recently expensive, but they are not meant to replace a profiler trace.
112
131
 
113
132
  Parameters:
114
- - `population` - - Population slice containing optional runtime lineage metadata.
115
- - `limit` - - Maximum number of genomes to sample from the front of the population.
133
+ - `host` - - Telemetry host storing the last evaluation and evolution durations.
116
134
 
117
- Returns: Compact lineage entries with genome ids and parent ids.
135
+ Returns: Object containing the most recent evaluation and evolution timings.
118
136
 
119
137
  Example:
120
138
 
121
- const lineage = buildLineageSnapshot(neat.population, 5);
122
- console.log(lineage.map((entry) => entry.parents));
123
-
124
- ### getCachedDiversityStats
125
-
126
- ```ts
127
- getCachedDiversityStats(
128
- host: TelemetryAccessorHost,
129
- ): DiversityStats | undefined
130
- ```
131
-
132
- Read cached diversity statistics.
133
-
134
- This accessor does not compute diversity on demand. Its job is only to expose
135
- the last cached snapshot so callers can distinguish between "no diversity has
136
- been computed yet" and "diversity was computed and here is the result."
137
-
138
- Parameters:
139
- - `host` - - Telemetry host exposing an optional cached diversity snapshot.
140
-
141
- Returns: Cached diversity statistics when available, otherwise `undefined`.
139
+ const timings = getPerformanceStatsSnapshot(neat);
140
+ console.log(timings.lastEvalMs, timings.lastEvolveMs);
142
141
 
143
- ### getPerformanceStatsSnapshot
142
+ ### getTelemetryBuffer
144
143
 
145
144
  ```ts
146
- getPerformanceStatsSnapshot(
145
+ getTelemetryBuffer(
147
146
  host: TelemetryAccessorHost,
148
- ): { lastEvalMs: number | undefined; lastEvolveMs: number | undefined; }
147
+ ): TelemetryEntry[]
149
148
  ```
150
149
 
151
- Snapshot performance timings for evaluation and evolution steps.
150
+ Return the telemetry buffer, defaulting to an empty array when missing.
152
151
 
153
- These timings are intentionally coarse. They are useful for telemetry reads,
154
- simple dashboards, and regression tests that need to know which phase was
155
- recently expensive, but they are not meant to replace a profiler trace.
152
+ This is the lowest-level read for recent telemetry history. It gives callers
153
+ a stable way to inspect the current in-memory buffer without forcing every
154
+ consumer to reimplement null checks.
156
155
 
157
156
  Parameters:
158
- - `host` - - Telemetry host storing the last evaluation and evolution durations.
157
+ - `host` - - Telemetry host that may or may not have initialized its buffer.
159
158
 
160
- Returns: Object containing the most recent evaluation and evolution timings.
159
+ Returns: Telemetry entries recorded so far, or an empty array when telemetry
160
+ has not been started yet.
161
161
 
162
162
  Example:
163
163
 
164
- const timings = getPerformanceStatsSnapshot(neat);
165
- console.log(timings.lastEvalMs, timings.lastEvolveMs);
164
+ const recentEntries = getTelemetryBuffer(neat).slice(-3);
165
+ console.log(recentEntries.length);
166
166
 
167
167
  ### LINEAGE_SNAPSHOT_DEFAULT_LIMIT
168
168