@reicek/neataptic-ts 0.1.25 → 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 (210) 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/package.json +19 -13
  8. package/plans/Flappy_Bird_Folder_Documentation_Pass.md +4 -4
  9. package/plans/README.md +24 -0
  10. package/plans/Roadmap.md +62 -40
  11. package/plans/analyze-trace-solid-split.plans.md +66 -0
  12. package/plans/architecture-solid-split.plans.md +9 -15
  13. package/plans/asciiMaze-typescript-repair.plans.md +1 -1
  14. package/plans/generate-docs-solid-split.plans.md +87 -0
  15. package/plans/methods-docs.plans.md +25 -1
  16. package/plans/methods-solid-split.plans.md +14 -14
  17. package/plans/neat-docs.plans.md +9 -1
  18. package/plans/neat-test-surface-repair.plans.md +1 -1
  19. package/plans/render-docs-html-solid-split.plans.md +68 -0
  20. package/plans/src-no-explicit-any-cleanup.plans.md +1 -1
  21. package/plans/utils-docs.plans.md +6 -1
  22. package/scripts/analyze-trace/analyze-trace.analysis.ts +479 -0
  23. package/scripts/analyze-trace/analyze-trace.constants.ts +35 -0
  24. package/scripts/analyze-trace/analyze-trace.io.ts +69 -0
  25. package/scripts/analyze-trace/analyze-trace.report.ts +100 -0
  26. package/scripts/analyze-trace/analyze-trace.shared.ts +116 -0
  27. package/scripts/analyze-trace/analyze-trace.ts +45 -0
  28. package/scripts/analyze-trace/analyze-trace.types.ts +72 -0
  29. package/scripts/assets/theme.css +80 -23
  30. package/scripts/copy-examples.ts +239 -0
  31. package/scripts/export-onnx.ts +223 -0
  32. package/scripts/generate-bench-tables.ts +378 -37
  33. package/scripts/generate-docs/generate-docs.constants.ts +107 -0
  34. package/scripts/generate-docs/generate-docs.order.ts +355 -0
  35. package/scripts/generate-docs/generate-docs.state.ts +31 -0
  36. package/scripts/generate-docs/generate-docs.targets.ts +165 -0
  37. package/scripts/generate-docs/generate-docs.ts +63 -0
  38. package/scripts/generate-docs/generate-docs.types.ts +112 -0
  39. package/scripts/generate-docs/output/generate-docs.output.folder-index.utils.ts +167 -0
  40. package/scripts/generate-docs/output/generate-docs.output.ordering.utils.ts +353 -0
  41. package/scripts/generate-docs/output/generate-docs.output.readme.utils.ts +420 -0
  42. package/scripts/generate-docs/output/generate-docs.output.ts +123 -0
  43. package/scripts/generate-docs/output/generate-docs.output.warnings.utils.ts +219 -0
  44. package/scripts/generate-docs/symbols/generate-docs.symbols.collection.utils.ts +365 -0
  45. package/scripts/generate-docs/symbols/generate-docs.symbols.jsdoc.utils.ts +373 -0
  46. package/scripts/generate-docs/symbols/generate-docs.symbols.normalize.utils.ts +155 -0
  47. package/scripts/generate-docs/symbols/generate-docs.symbols.render.utils.ts +149 -0
  48. package/scripts/generate-docs/symbols/generate-docs.symbols.signature.utils.ts +289 -0
  49. package/scripts/generate-docs/symbols/generate-docs.symbols.ts +11 -0
  50. package/scripts/mermaid-cli.mjs +102 -22
  51. package/scripts/mermaid-cli.ts +736 -0
  52. package/scripts/render-docs-html/render-docs-html.assets.ts +54 -0
  53. package/scripts/render-docs-html/render-docs-html.mermaid.ts +245 -0
  54. package/scripts/{render-docs-html.sidebar.ts → render-docs-html/render-docs-html.navigation.ts} +141 -144
  55. package/scripts/render-docs-html/render-docs-html.pages.ts +333 -0
  56. package/scripts/render-docs-html/render-docs-html.shared.ts +333 -0
  57. package/scripts/render-docs-html/render-docs-html.types.ts +42 -0
  58. package/scripts/render-docs-html.ts +23 -587
  59. package/scripts/run-docs.ts +238 -0
  60. package/scripts/write-dist-docs-pkg.ts +40 -0
  61. package/src/README.md +75 -75
  62. package/src/architecture/connection/README.md +5 -5
  63. package/src/architecture/layer/README.md +508 -508
  64. package/src/architecture/network/README.md +1458 -1458
  65. package/src/architecture/network/activate/README.md +694 -694
  66. package/src/architecture/network/bootstrap/README.md +77 -77
  67. package/src/architecture/network/connect/README.md +74 -74
  68. package/src/architecture/network/deterministic/README.md +135 -135
  69. package/src/architecture/network/evolve/README.md +364 -364
  70. package/src/architecture/network/gating/README.md +130 -130
  71. package/src/architecture/network/genetic/README.md +399 -399
  72. package/src/architecture/network/mutate/README.md +897 -897
  73. package/src/architecture/network/onnx/README.md +720 -720
  74. package/src/architecture/network/onnx/export/README.md +728 -728
  75. package/src/architecture/network/onnx/export/layers/README.md +450 -450
  76. package/src/architecture/network/onnx/import/README.md +618 -618
  77. package/src/architecture/network/onnx/schema/README.md +32 -32
  78. package/src/architecture/network/prune/README.md +245 -245
  79. package/src/architecture/network/remove/README.md +135 -135
  80. package/src/architecture/network/runtime/README.md +106 -106
  81. package/src/architecture/network/serialize/README.md +542 -542
  82. package/src/architecture/network/slab/README.md +608 -608
  83. package/src/architecture/network/standalone/README.md +212 -212
  84. package/src/architecture/network/stats/README.md +84 -84
  85. package/src/architecture/network/topology/README.md +465 -465
  86. package/src/architecture/network/training/README.md +200 -200
  87. package/src/architecture/node/README.md +5 -5
  88. package/src/architecture/nodePool/README.md +14 -14
  89. package/src/methods/README.md +99 -99
  90. package/src/methods/activation/README.md +189 -189
  91. package/src/methods/cost/README.md +131 -131
  92. package/src/methods/rate/README.md +86 -86
  93. package/src/multithreading/README.md +77 -77
  94. package/src/multithreading/workers/browser/README.md +8 -8
  95. package/src/multithreading/workers/node/README.md +8 -8
  96. package/src/neat/README.md +148 -148
  97. package/src/neat/adaptive/README.md +120 -120
  98. package/src/neat/adaptive/acceptance/README.md +40 -40
  99. package/src/neat/adaptive/complexity/README.md +137 -137
  100. package/src/neat/adaptive/core/README.md +197 -197
  101. package/src/neat/adaptive/lineage/README.md +90 -90
  102. package/src/neat/adaptive/mutation/README.md +284 -284
  103. package/src/neat/compat/README.md +43 -43
  104. package/src/neat/compat/core/README.md +90 -90
  105. package/src/neat/diversity/README.md +35 -35
  106. package/src/neat/diversity/core/README.md +88 -88
  107. package/src/neat/evaluate/README.md +85 -85
  108. package/src/neat/evaluate/auto-distance/README.md +75 -75
  109. package/src/neat/evaluate/entropy-compat/README.md +37 -37
  110. package/src/neat/evaluate/entropy-sharing/README.md +43 -43
  111. package/src/neat/evaluate/fitness/README.md +23 -23
  112. package/src/neat/evaluate/novelty/README.md +120 -120
  113. package/src/neat/evaluate/objectives/README.md +17 -17
  114. package/src/neat/evaluate/shared/README.md +94 -94
  115. package/src/neat/evolve/README.md +96 -96
  116. package/src/neat/evolve/adaptive/README.md +60 -60
  117. package/src/neat/evolve/objectives/README.md +63 -63
  118. package/src/neat/evolve/offspring/README.md +56 -56
  119. package/src/neat/evolve/population/README.md +171 -171
  120. package/src/neat/evolve/runtime/README.md +79 -79
  121. package/src/neat/evolve/speciation/README.md +74 -74
  122. package/src/neat/evolve/warnings/README.md +10 -10
  123. package/src/neat/export/README.md +114 -114
  124. package/src/neat/helpers/README.md +50 -50
  125. package/src/neat/init/README.md +9 -9
  126. package/src/neat/lineage/core/README.md +101 -101
  127. package/src/neat/multiobjective/category/README.md +74 -74
  128. package/src/neat/multiobjective/crowding/README.md +272 -272
  129. package/src/neat/multiobjective/dominance/README.md +171 -171
  130. package/src/neat/multiobjective/fronts/README.md +68 -68
  131. package/src/neat/multiobjective/metrics/README.md +43 -43
  132. package/src/neat/multiobjective/objectives/README.md +31 -31
  133. package/src/neat/multiobjective/shared/README.md +27 -27
  134. package/src/neat/mutation/README.md +97 -97
  135. package/src/neat/mutation/add-conn/README.md +115 -115
  136. package/src/neat/mutation/add-node/README.md +126 -126
  137. package/src/neat/mutation/flow/README.md +149 -149
  138. package/src/neat/mutation/repair/README.md +185 -185
  139. package/src/neat/mutation/select/README.md +117 -117
  140. package/src/neat/mutation/shared/README.md +32 -32
  141. package/src/neat/objectives/README.md +25 -25
  142. package/src/neat/objectives/core/README.md +67 -67
  143. package/src/neat/pruning/README.md +40 -40
  144. package/src/neat/pruning/core/README.md +171 -171
  145. package/src/neat/pruning/facade/README.md +32 -32
  146. package/src/neat/rng/README.md +104 -104
  147. package/src/neat/rng/core/README.md +137 -137
  148. package/src/neat/rng/facade/README.md +50 -50
  149. package/src/neat/selection/README.md +111 -111
  150. package/src/neat/selection/core/README.md +227 -227
  151. package/src/neat/selection/facade/README.md +61 -61
  152. package/src/neat/shared/README.md +163 -163
  153. package/src/neat/speciation/README.md +31 -31
  154. package/src/neat/speciation/threshold/README.md +35 -35
  155. package/src/neat/species/README.md +25 -25
  156. package/src/neat/species/core/README.md +20 -20
  157. package/src/neat/species/core/shared/README.md +18 -18
  158. package/src/neat/species/history/context/README.md +22 -22
  159. package/src/neat/telemetry/accessors/README.md +58 -58
  160. package/src/neat/telemetry/exports/README.md +233 -233
  161. package/src/neat/telemetry/facade/README.md +252 -252
  162. package/src/neat/telemetry/facade/archive/README.md +57 -57
  163. package/src/neat/telemetry/facade/buffer/README.md +43 -43
  164. package/src/neat/telemetry/facade/lineage/README.md +12 -12
  165. package/src/neat/telemetry/facade/objectives/README.md +44 -44
  166. package/src/neat/telemetry/facade/runtime/README.md +26 -26
  167. package/src/neat/telemetry/facade/species/README.md +27 -27
  168. package/src/neat/telemetry/metrics/README.md +696 -696
  169. package/src/neat/telemetry/recorder/README.md +57 -57
  170. package/src/neat/telemetry/types/README.md +32 -32
  171. package/src/neat/topology-intent/README.md +75 -75
  172. package/src/utils/README.md +193 -193
  173. package/test/examples/asciiMaze/browser-entry/README.md +92 -92
  174. package/test/examples/asciiMaze/dashboardManager/README.md +109 -109
  175. package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +28 -28
  176. package/test/examples/asciiMaze/evolutionEngine/README.md +1527 -1527
  177. package/test/examples/asciiMaze/mazeMovement/README.md +105 -105
  178. package/test/examples/asciiMaze/mazeMovement/finalization/README.md +16 -16
  179. package/test/examples/asciiMaze/mazeMovement/policy/README.md +57 -57
  180. package/test/examples/asciiMaze/mazeMovement/runtime/README.md +52 -52
  181. package/test/examples/asciiMaze/mazeMovement/shaping/README.md +46 -46
  182. package/test/examples/flappy_bird/browser-entry/README.md +508 -508
  183. package/test/examples/flappy_bird/browser-entry/host/README.md +101 -101
  184. package/test/examples/flappy_bird/browser-entry/host/resize/README.md +144 -144
  185. package/test/examples/flappy_bird/browser-entry/network-view/README.md +194 -194
  186. package/test/examples/flappy_bird/browser-entry/playback/README.md +278 -278
  187. package/test/examples/flappy_bird/browser-entry/playback/background/README.md +129 -129
  188. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +502 -502
  189. package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +139 -139
  190. package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +10 -10
  191. package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +43 -43
  192. package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +30 -30
  193. package/test/examples/flappy_bird/browser-entry/runtime/README.md +59 -59
  194. package/test/examples/flappy_bird/browser-entry/visualization/README.md +276 -276
  195. package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +16 -16
  196. package/test/examples/flappy_bird/constants/README.md +1070 -1070
  197. package/test/examples/flappy_bird/environment/README.md +22 -22
  198. package/test/examples/flappy_bird/evaluation/README.md +32 -32
  199. package/test/examples/flappy_bird/evaluation/rollout/README.md +141 -141
  200. package/test/examples/flappy_bird/flappy-evolution-worker/README.md +425 -425
  201. package/test/examples/flappy_bird/simulation-shared/README.md +170 -170
  202. package/test/examples/flappy_bird/simulation-shared/observation/README.md +109 -109
  203. package/test/examples/flappy_bird/trainer/README.md +325 -325
  204. package/test/examples/flappy_bird/trainer/evaluation/README.md +74 -74
  205. package/scripts/analyze-trace.ts +0 -590
  206. package/scripts/copy-examples.mjs +0 -114
  207. package/scripts/export-onnx.mjs +0 -86
  208. package/scripts/generate-bench-tables.mjs +0 -182
  209. package/scripts/generate-docs.ts +0 -2900
  210. package/scripts/write-dist-docs-pkg.mjs +0 -16
@@ -17,16 +17,6 @@ contract is what makes deterministic stepping and reward debugging practical.
17
17
 
18
18
  ## environment/environment.types.ts
19
19
 
20
- ### FlappyPipe
21
-
22
- Pipe obstacle definition.
23
-
24
- Pipes move from right to left. The bird scores once per pipe when the pipe
25
- completely crosses the bird x-position.
26
-
27
- This is the environment-owned pipe state, distinct from the packed snapshot
28
- transport shapes used by the browser worker.
29
-
30
20
  ### FlappyBird
31
21
 
32
22
  Bird kinematic state for one simulation frame.
@@ -34,6 +24,16 @@ Bird kinematic state for one simulation frame.
34
24
  The environment keeps only the minimum physics state needed to advance the
35
25
  episode: vertical position and vertical velocity.
36
26
 
27
+ ### FlappyDifficultyScale
28
+
29
+ Difficulty scale used by the curriculum scheduler.
30
+
31
+ - `0` means easiest profile (wide gaps, slower pipes).
32
+ - `1` means fully adaptive profile based on passed pipes.
33
+
34
+ Values between `0` and `1` interpolate between those extremes, which lets the
35
+ trainer or environment caller dial curriculum strength continuously.
36
+
37
37
  ### FlappyGameState
38
38
 
39
39
  Full simulation state for one Flappy episode.
@@ -50,24 +50,18 @@ Structured observation features used to build the neural-network input vector.
50
50
  Re-exported from shared simulation utilities so trainer and browser paths
51
51
  stay synchronized as the observation schema evolves.
52
52
 
53
- ### FlappyDifficultyScale
53
+ ### FlappyPipe
54
54
 
55
- Difficulty scale used by the curriculum scheduler.
55
+ Pipe obstacle definition.
56
56
 
57
- - `0` means easiest profile (wide gaps, slower pipes).
58
- - `1` means fully adaptive profile based on passed pipes.
57
+ Pipes move from right to left. The bird scores once per pipe when the pipe
58
+ completely crosses the bird x-position.
59
59
 
60
- Values between `0` and `1` interpolate between those extremes, which lets the
61
- trainer or environment caller dial curriculum strength continuously.
60
+ This is the environment-owned pipe state, distinct from the packed snapshot
61
+ transport shapes used by the browser worker.
62
62
 
63
63
  ## environment/environment.constants.ts
64
64
 
65
- ### FLAPPY_ENVIRONMENT_DEFAULT_DIFFICULTY_SCALE
66
-
67
- Default curriculum difficulty scale used by environment stepping.
68
-
69
- A value of `1` means the environment uses the full adaptive difficulty ramp.
70
-
71
65
  ### FLAPPY_ENVIRONMENT_DEFAULT_CONTROL_SUBSTEPS_PER_FRAME
72
66
 
73
67
  Default number of control/physics substeps executed per simulation frame.
@@ -75,6 +69,12 @@ Default number of control/physics substeps executed per simulation frame.
75
69
  Reusing the shared control-substep count keeps the environment and browser
76
70
  playback aligned on the same stepping granularity.
77
71
 
72
+ ### FLAPPY_ENVIRONMENT_DEFAULT_DIFFICULTY_SCALE
73
+
74
+ Default curriculum difficulty scale used by environment stepping.
75
+
76
+ A value of `1` means the environment uses the full adaptive difficulty ramp.
77
+
78
78
  ### FLAPPY_ENVIRONMENT_MAX_FRAMES_PER_EPISODE
79
79
 
80
80
  Maximum frame budget before the environment forces timeout termination.
@@ -20,6 +20,13 @@ Read the exports in that order:
20
20
 
21
21
  ## evaluation/evaluation.types.ts
22
22
 
23
+ ### FlappyEpisodeResult
24
+
25
+ Summary metrics for a single Flappy episode rollout.
26
+
27
+ The result intentionally keeps both a single scalar `fitness` and the channel
28
+ breakdown that produced it, which makes reward debugging much easier.
29
+
23
30
  ### FlappyNetworkLike
24
31
 
25
32
  Minimal network contract required by Flappy evaluation.
@@ -34,13 +41,6 @@ Runtime controls for one rollout evaluation.
34
41
  This is the public control surface for evaluation callers. The rollout layer
35
42
  later normalizes these options into execution-safe context values.
36
43
 
37
- ### FlappyEpisodeResult
38
-
39
- Summary metrics for a single Flappy episode rollout.
40
-
41
- The result intentionally keeps both a single scalar `fitness` and the channel
42
- breakdown that produced it, which makes reward debugging much easier.
43
-
44
44
  ### FlappySeedBatchEvaluation
45
45
 
46
46
  Aggregate statistics from evaluating one network across shared seeds.
@@ -60,14 +60,14 @@ Default difficulty scale for rollouts when caller does not provide one.
60
60
 
61
61
  A value of `1` means full adaptive difficulty is enabled during evaluation.
62
62
 
63
- ### FLAPPY_EVALUATION_DEFAULT_EARLY_TERMINATION_GRACE_FRAMES
64
-
65
- Default grace period (frames) before early termination checks begin.
66
-
67
63
  ### FLAPPY_EVALUATION_DEFAULT_EARLY_TERMINATION_CONSECUTIVE_FRAMES
68
64
 
69
65
  Default consecutive unrecoverable frames required for early termination.
70
66
 
67
+ ### FLAPPY_EVALUATION_DEFAULT_EARLY_TERMINATION_GRACE_FRAMES
68
+
69
+ Default grace period (frames) before early termination checks begin.
70
+
71
71
  ### FLAPPY_EVALUATION_DEFAULT_PIPE_PROGRESS_TARGET
72
72
 
73
73
  Default pipe-progress target used when normalizing rollout fitness.
@@ -79,17 +79,17 @@ even when individual episodes vary widely in difficulty and duration.
79
79
 
80
80
  Dense shaping normalization factor per survived frame.
81
81
 
82
- ### FLAPPY_EVALUATION_NORMALIZED_SURVIVAL_WEIGHT
82
+ ### FLAPPY_EVALUATION_NORMALIZED_DENSE_WEIGHT
83
83
 
84
- Survival channel weight in normalized fitness composition.
84
+ Dense-shaping channel weight in normalized fitness composition.
85
85
 
86
86
  ### FLAPPY_EVALUATION_NORMALIZED_PROGRESS_WEIGHT
87
87
 
88
88
  Pipe-progress channel weight in normalized fitness composition.
89
89
 
90
- ### FLAPPY_EVALUATION_NORMALIZED_DENSE_WEIGHT
90
+ ### FLAPPY_EVALUATION_NORMALIZED_SURVIVAL_WEIGHT
91
91
 
92
- Dense-shaping channel weight in normalized fitness composition.
92
+ Survival channel weight in normalized fitness composition.
93
93
 
94
94
  ### FLAPPY_EVALUATION_NORMALIZED_TERMINAL_WEIGHT
95
95
 
@@ -102,40 +102,40 @@ Robust fitness penalty multiplier applied to standard deviation.
102
102
  A higher value penalizes instability more strongly when computing robust
103
103
  fitness from a shared-seed batch.
104
104
 
105
- ### FLAPPY_EVALUATION_UNRECOVERABLE_CLEARANCE_THRESHOLD
105
+ ### FLAPPY_EVALUATION_SEED_MIX_MULTIPLIER_A
106
106
 
107
- Unrecoverable clearance threshold used by early termination heuristic.
107
+ Seed-mix first multiplicative avalanche constant.
108
108
 
109
- ### FLAPPY_EVALUATION_UNRECOVERABLE_BELOW_GAP_DELTA
109
+ ### FLAPPY_EVALUATION_SEED_MIX_MULTIPLIER_B
110
110
 
111
- Lower-gap delta threshold used by early termination heuristic.
111
+ Seed-mix second multiplicative avalanche constant.
112
112
 
113
- ### FLAPPY_EVALUATION_UNRECOVERABLE_FALLING_VELOCITY
113
+ ### FLAPPY_EVALUATION_SEED_MIX_XOR_SALT
114
114
 
115
- Falling-speed threshold used by early termination heuristic.
115
+ Seed-mix additive constant used to decorrelate nearby genome ids.
116
+
117
+ Together with the multiplicative constants below, this creates a small
118
+ avalanche-style mixing pipeline for deterministic seed derivation.
116
119
 
117
120
  ### FLAPPY_EVALUATION_UNRECOVERABLE_ABOVE_GAP_DELTA
118
121
 
119
122
  Upper-gap delta threshold used by early termination heuristic.
120
123
 
121
- ### FLAPPY_EVALUATION_UNRECOVERABLE_RISING_VELOCITY
122
-
123
- Rising-speed threshold used by early termination heuristic.
124
+ ### FLAPPY_EVALUATION_UNRECOVERABLE_BELOW_GAP_DELTA
124
125
 
125
- ### FLAPPY_EVALUATION_SEED_MIX_XOR_SALT
126
+ Lower-gap delta threshold used by early termination heuristic.
126
127
 
127
- Seed-mix additive constant used to decorrelate nearby genome ids.
128
+ ### FLAPPY_EVALUATION_UNRECOVERABLE_CLEARANCE_THRESHOLD
128
129
 
129
- Together with the multiplicative constants below, this creates a small
130
- avalanche-style mixing pipeline for deterministic seed derivation.
130
+ Unrecoverable clearance threshold used by early termination heuristic.
131
131
 
132
- ### FLAPPY_EVALUATION_SEED_MIX_MULTIPLIER_A
132
+ ### FLAPPY_EVALUATION_UNRECOVERABLE_FALLING_VELOCITY
133
133
 
134
- Seed-mix first multiplicative avalanche constant.
134
+ Falling-speed threshold used by early termination heuristic.
135
135
 
136
- ### FLAPPY_EVALUATION_SEED_MIX_MULTIPLIER_B
136
+ ### FLAPPY_EVALUATION_UNRECOVERABLE_RISING_VELOCITY
137
137
 
138
- Seed-mix second multiplicative avalanche constant.
138
+ Rising-speed threshold used by early termination heuristic.
139
139
 
140
140
  ## evaluation/evaluation.fitness.utils.ts
141
141
 
@@ -89,25 +89,29 @@ finalizeRolloutEpisodeState(
89
89
  );
90
90
  ```
91
91
 
92
- ### resolveRolloutEpisodeContext
92
+ ### applyRolloutEarlyTerminationIfNeeded
93
93
 
94
94
  ```ts
95
- resolveRolloutEpisodeContext(
96
- network: FlappyNetworkLike,
97
- rolloutOptions: FlappyRolloutOptions,
98
- ): RolloutEpisodeContext
95
+ applyRolloutEarlyTerminationIfNeeded(
96
+ rolloutEpisodeContext: RolloutEpisodeContext,
97
+ rolloutEpisodeRuntimeState: RolloutEpisodeRuntimeState,
98
+ currentObservationFeatures: SharedObservationFeatures,
99
+ ): void
99
100
  ```
100
101
 
101
- Resolves normalized rollout configuration from user options.
102
+ Applies the optional early-termination heuristic for unrecoverable starts.
102
103
 
103
- This is the rollout safety boundary: caller-provided values are clamped into
104
- deterministic, execution-safe ranges before the main loop touches them.
104
+ Educational note:
105
+ Early termination is an evaluation-speed heuristic, not a gameplay rule. It
106
+ exists to stop obviously doomed warmup trajectories from consuming excessive
107
+ rollout budget.
105
108
 
106
109
  Parameters:
107
- - `network` - - Genome/network to evaluate.
108
- - `rolloutOptions` - - Optional rollout controls.
110
+ - `rolloutEpisodeContext` - - Normalized rollout configuration.
111
+ - `rolloutEpisodeRuntimeState` - - Mutable runtime state.
112
+ - `currentObservationFeatures` - - Post-step observation features.
109
113
 
110
- Returns: Normalized rollout configuration.
114
+ Returns: Nothing.
111
115
 
112
116
  ### createRolloutEpisodeRuntimeState
113
117
 
@@ -128,28 +132,6 @@ Parameters:
128
132
 
129
133
  Returns: Mutable runtime state.
130
134
 
131
- ### runRolloutEpisodeLoop
132
-
133
- ```ts
134
- runRolloutEpisodeLoop(
135
- network: FlappyNetworkLike,
136
- rolloutEpisodeContext: RolloutEpisodeContext,
137
- rolloutEpisodeRuntimeState: RolloutEpisodeRuntimeState,
138
- ): void
139
- ```
140
-
141
- Runs the main rollout loop until termination or frame-budget exhaustion.
142
-
143
- This is the episode heartbeat: keep stepping while the bird is alive and the
144
- rollout still has budget left.
145
-
146
- Parameters:
147
- - `network` - - Genome/network to evaluate.
148
- - `rolloutEpisodeContext` - - Normalized rollout configuration.
149
- - `rolloutEpisodeRuntimeState` - - Mutable runtime state.
150
-
151
- Returns: Nothing.
152
-
153
135
  ### finalizeRolloutEpisodeState
154
136
 
155
137
  ```ts
@@ -170,28 +152,25 @@ Parameters:
170
152
 
171
153
  Returns: Nothing.
172
154
 
173
- ### runRolloutEpisodeFrame
155
+ ### resolveRolloutEpisodeContext
174
156
 
175
157
  ```ts
176
- runRolloutEpisodeFrame(
158
+ resolveRolloutEpisodeContext(
177
159
  network: FlappyNetworkLike,
178
- rolloutEpisodeContext: RolloutEpisodeContext,
179
- rolloutEpisodeRuntimeState: RolloutEpisodeRuntimeState,
180
- ): void
160
+ rolloutOptions: FlappyRolloutOptions,
161
+ ): RolloutEpisodeContext
181
162
  ```
182
163
 
183
- Runs one rollout frame including control, shaping, and early termination.
164
+ Resolves normalized rollout configuration from user options.
184
165
 
185
- Educational note:
186
- Each frame follows a compact pipeline: observe, act, step the environment,
187
- accumulate shaping reward, then optionally prune the trajectory.
166
+ This is the rollout safety boundary: caller-provided values are clamped into
167
+ deterministic, execution-safe ranges before the main loop touches them.
188
168
 
189
169
  Parameters:
190
170
  - `network` - - Genome/network to evaluate.
191
- - `rolloutEpisodeContext` - - Normalized rollout configuration.
192
- - `rolloutEpisodeRuntimeState` - - Mutable runtime state.
171
+ - `rolloutOptions` - - Optional rollout controls.
193
172
 
194
- Returns: Nothing.
173
+ Returns: Normalized rollout configuration.
195
174
 
196
175
  ### resolveRolloutFrameFlapDecision
197
176
 
@@ -215,27 +194,48 @@ Parameters:
215
194
 
216
195
  Returns: Whether the bird should flap.
217
196
 
218
- ### applyRolloutEarlyTerminationIfNeeded
197
+ ### runRolloutEpisodeFrame
219
198
 
220
199
  ```ts
221
- applyRolloutEarlyTerminationIfNeeded(
200
+ runRolloutEpisodeFrame(
201
+ network: FlappyNetworkLike,
222
202
  rolloutEpisodeContext: RolloutEpisodeContext,
223
203
  rolloutEpisodeRuntimeState: RolloutEpisodeRuntimeState,
224
- currentObservationFeatures: SharedObservationFeatures,
225
204
  ): void
226
205
  ```
227
206
 
228
- Applies the optional early-termination heuristic for unrecoverable starts.
207
+ Runs one rollout frame including control, shaping, and early termination.
229
208
 
230
209
  Educational note:
231
- Early termination is an evaluation-speed heuristic, not a gameplay rule. It
232
- exists to stop obviously doomed warmup trajectories from consuming excessive
233
- rollout budget.
210
+ Each frame follows a compact pipeline: observe, act, step the environment,
211
+ accumulate shaping reward, then optionally prune the trajectory.
234
212
 
235
213
  Parameters:
214
+ - `network` - - Genome/network to evaluate.
215
+ - `rolloutEpisodeContext` - - Normalized rollout configuration.
216
+ - `rolloutEpisodeRuntimeState` - - Mutable runtime state.
217
+
218
+ Returns: Nothing.
219
+
220
+ ### runRolloutEpisodeLoop
221
+
222
+ ```ts
223
+ runRolloutEpisodeLoop(
224
+ network: FlappyNetworkLike,
225
+ rolloutEpisodeContext: RolloutEpisodeContext,
226
+ rolloutEpisodeRuntimeState: RolloutEpisodeRuntimeState,
227
+ ): void
228
+ ```
229
+
230
+ Runs the main rollout loop until termination or frame-budget exhaustion.
231
+
232
+ This is the episode heartbeat: keep stepping while the bird is alive and the
233
+ rollout still has budget left.
234
+
235
+ Parameters:
236
+ - `network` - - Genome/network to evaluate.
236
237
  - `rolloutEpisodeContext` - - Normalized rollout configuration.
237
238
  - `rolloutEpisodeRuntimeState` - - Mutable runtime state.
238
- - `currentObservationFeatures` - - Post-step observation features.
239
239
 
240
240
  Returns: Nothing.
241
241
 
@@ -252,6 +252,35 @@ The rollout subsystem separates simulation from scoring on purpose. The
252
252
  services file determines what happened; this file determines how that episode
253
253
  should be interpreted as fitness.
254
254
 
255
+ ### composeNormalizedFitness
256
+
257
+ ```ts
258
+ composeNormalizedFitness(
259
+ framesValue: number,
260
+ pipesPassedValue: number,
261
+ denseShapingValue: number,
262
+ terminalShapingValue: number,
263
+ maxFramesValue: number,
264
+ pipeProgressTarget: number | undefined,
265
+ ): number
266
+ ```
267
+
268
+ Normalize and cap fitness channels so no single reward term dominates.
269
+
270
+ Educational note:
271
+ Channel normalization is a pragmatic way to keep the objective balanced across
272
+ episodes of different lengths and levels of progress.
273
+
274
+ Parameters:
275
+ - `framesValue` - - Frames survived for the episode.
276
+ - `pipesPassedValue` - - Pipes passed during the episode.
277
+ - `denseShapingValue` - - Accumulated dense shaping reward.
278
+ - `terminalShapingValue` - - Terminal shaping reward.
279
+ - `maxFramesValue` - - Frame budget used for the episode.
280
+ - `pipeProgressTarget` - - Optional target used to normalize pipe progress.
281
+
282
+ Returns: Normalized composite fitness.
283
+
255
284
  ### composeRolloutEpisodeResult
256
285
 
257
286
  ```ts
@@ -293,6 +322,26 @@ Parameters:
293
322
 
294
323
  Returns: Per-step shaped reward.
295
324
 
325
+ ### computeTerminalShapingFitness
326
+
327
+ ```ts
328
+ computeTerminalShapingFitness(
329
+ episodeState: FlappyGameState,
330
+ difficultyScale: number,
331
+ ): number
332
+ ```
333
+
334
+ Adds small terminal bonuses from final progress/alignment signals.
335
+
336
+ Terminal bonuses refine the final ranking, but they are intentionally smaller
337
+ than the main survival and pipe-progress channels.
338
+
339
+ Parameters:
340
+ - `episodeState` - - Final rollout state.
341
+ - `difficultyScale` - - Active rollout difficulty scale.
342
+
343
+ Returns: Terminal shaping reward.
344
+
296
345
  ### isBirdLikelyUnrecoverable
297
346
 
298
347
  ```ts
@@ -311,6 +360,26 @@ Parameters:
311
360
 
312
361
  Returns: Whether the current trajectory appears unrecoverable.
313
362
 
363
+ ### resolveDenseShapingRewardComponents
364
+
365
+ ```ts
366
+ resolveDenseShapingRewardComponents(
367
+ previousFeatures: SharedObservationFeatures,
368
+ currentFeatures: SharedObservationFeatures,
369
+ ): DenseShapingRewardComponents
370
+ ```
371
+
372
+ Resolves every dense-shaping reward component from consecutive observations.
373
+
374
+ If you want background reading, the Wikipedia article on "reward shaping" is
375
+ a good high-level companion concept for why these components exist.
376
+
377
+ Parameters:
378
+ - `previousFeatures` - - Observation before stepping the environment.
379
+ - `currentFeatures` - - Observation after stepping the environment.
380
+
381
+ Returns: Dense-shaping reward components.
382
+
314
383
  ### resolveRolloutFitnessBreakdown
315
384
 
316
385
  ```ts
@@ -353,75 +422,6 @@ Parameters:
353
422
 
354
423
  Returns: Raw unnormalized fitness.
355
424
 
356
- ### resolveDenseShapingRewardComponents
357
-
358
- ```ts
359
- resolveDenseShapingRewardComponents(
360
- previousFeatures: SharedObservationFeatures,
361
- currentFeatures: SharedObservationFeatures,
362
- ): DenseShapingRewardComponents
363
- ```
364
-
365
- Resolves every dense-shaping reward component from consecutive observations.
366
-
367
- If you want background reading, the Wikipedia article on "reward shaping" is
368
- a good high-level companion concept for why these components exist.
369
-
370
- Parameters:
371
- - `previousFeatures` - - Observation before stepping the environment.
372
- - `currentFeatures` - - Observation after stepping the environment.
373
-
374
- Returns: Dense-shaping reward components.
375
-
376
- ### computeTerminalShapingFitness
377
-
378
- ```ts
379
- computeTerminalShapingFitness(
380
- episodeState: FlappyGameState,
381
- difficultyScale: number,
382
- ): number
383
- ```
384
-
385
- Adds small terminal bonuses from final progress/alignment signals.
386
-
387
- Terminal bonuses refine the final ranking, but they are intentionally smaller
388
- than the main survival and pipe-progress channels.
389
-
390
- Parameters:
391
- - `episodeState` - - Final rollout state.
392
- - `difficultyScale` - - Active rollout difficulty scale.
393
-
394
- Returns: Terminal shaping reward.
395
-
396
- ### composeNormalizedFitness
397
-
398
- ```ts
399
- composeNormalizedFitness(
400
- framesValue: number,
401
- pipesPassedValue: number,
402
- denseShapingValue: number,
403
- terminalShapingValue: number,
404
- maxFramesValue: number,
405
- pipeProgressTarget: number | undefined,
406
- ): number
407
- ```
408
-
409
- Normalize and cap fitness channels so no single reward term dominates.
410
-
411
- Educational note:
412
- Channel normalization is a pragmatic way to keep the objective balanced across
413
- episodes of different lengths and levels of progress.
414
-
415
- Parameters:
416
- - `framesValue` - - Frames survived for the episode.
417
- - `pipesPassedValue` - - Pipes passed during the episode.
418
- - `denseShapingValue` - - Accumulated dense shaping reward.
419
- - `terminalShapingValue` - - Terminal shaping reward.
420
- - `maxFramesValue` - - Frame budget used for the episode.
421
- - `pipeProgressTarget` - - Optional target used to normalize pipe progress.
422
-
423
- Returns: Normalized composite fitness.
424
-
425
425
  ## evaluation/rollout/evaluation.rollout.types.ts
426
426
 
427
427
  Rollout-internal type contracts.
@@ -436,6 +436,13 @@ Read them as three layers:
436
436
  - `RolloutEpisodeRuntimeState`: mutable execution state.
437
437
  - fitness and shaping types: named reward channels used during folding.
438
438
 
439
+ ### DenseShapingRewardComponents
440
+
441
+ Per-frame dense shaping channels resolved from consecutive observations.
442
+
443
+ The shaping system rewards more than survival: it also tracks approach,
444
+ centering, clearance, and stable motion.
445
+
439
446
  ### RolloutEpisodeContext
440
447
 
441
448
  Immutable rollout options normalized into execution-safe ranges.
@@ -455,13 +462,6 @@ Fitness-channel breakdown used to compose the public episode result.
455
462
 
456
463
  Named channels make reward design easier to audit than a single opaque number.
457
464
 
458
- ### DenseShapingRewardComponents
459
-
460
- Per-frame dense shaping channels resolved from consecutive observations.
461
-
462
- The shaping system rewards more than survival: it also tracks approach,
463
- centering, clearance, and stable motion.
464
-
465
465
  ## evaluation/rollout/evaluation.rollout.constants.ts
466
466
 
467
467
  Rollout-local constants.
@@ -477,29 +477,29 @@ sea of raw `0`, `1`, and string literals.
477
477
 
478
478
  Default genome id used when a network does not expose one.
479
479
 
480
- ### FLAPPY_ROLLOUT_MIN_MAX_FRAMES
480
+ ### FLAPPY_ROLLOUT_DONE_REASON_COLLISION
481
481
 
482
- Minimum positive frame-like scalar used by rollout normalization.
482
+ Rollout done reason used by heuristic early termination.
483
483
 
484
- ### FLAPPY_ROLLOUT_MIN_EARLY_TERMINATION_GRACE_FRAMES
484
+ ### FLAPPY_ROLLOUT_DONE_REASON_TIMEOUT
485
485
 
486
- Minimum grace period allowed before early termination can activate.
486
+ Rollout done reason used when the episode exhausts its frame budget.
487
487
 
488
488
  ### FLAPPY_ROLLOUT_MIN_EARLY_TERMINATION_CONSECUTIVE_FRAMES
489
489
 
490
490
  Minimum unrecoverable-frame streak required for early termination.
491
491
 
492
- ### FLAPPY_ROLLOUT_ZERO_FITNESS
492
+ ### FLAPPY_ROLLOUT_MIN_EARLY_TERMINATION_GRACE_FRAMES
493
493
 
494
- Shared zero baseline used across rollout fitness and counters.
494
+ Minimum grace period allowed before early termination can activate.
495
495
 
496
- This acts as the semantic baseline for both shaping accumulation and several
497
- rollout guard conditions.
496
+ ### FLAPPY_ROLLOUT_MIN_MAX_FRAMES
498
497
 
499
- ### FLAPPY_ROLLOUT_DONE_REASON_COLLISION
498
+ Minimum positive frame-like scalar used by rollout normalization.
500
499
 
501
- Rollout done reason used by heuristic early termination.
500
+ ### FLAPPY_ROLLOUT_ZERO_FITNESS
502
501
 
503
- ### FLAPPY_ROLLOUT_DONE_REASON_TIMEOUT
502
+ Shared zero baseline used across rollout fitness and counters.
504
503
 
505
- Rollout done reason used when the episode exhausts its frame budget.
504
+ This acts as the semantic baseline for both shaping accumulation and several
505
+ rollout guard conditions.