@reicek/neataptic-ts 0.1.21 → 0.1.23

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 (361) hide show
  1. package/.github/agents/boundary-mapper.agent.md +31 -0
  2. package/.github/agents/docs-scout.agent.md +29 -0
  3. package/.github/agents/plan-scout.agent.md +31 -0
  4. package/.github/agents/solid-split.agent.md +143 -0
  5. package/.github/copilot-instructions.md +119 -0
  6. package/.github/skills/solid-split-playbook/SKILL.md +220 -0
  7. package/.github/skills/solid-split-playbook/assets/docs-checklist.md +34 -0
  8. package/.github/skills/solid-split-playbook/assets/split-plan-template.md +48 -0
  9. package/.github/skills/solid-split-playbook/assets/split-workflow-checklist.md +51 -0
  10. package/.github/skills/trace-analyzer-extension/SKILL.md +63 -0
  11. package/.github/skills/trace-analyzer-extension/assets/extension-checklist.md +24 -0
  12. package/.github/skills/trace-analyzer-extension/references/analyzer-extension-workflow.md +101 -0
  13. package/.github/skills/trace-audit-reporting/SKILL.md +96 -0
  14. package/.github/skills/trace-audit-reporting/assets/performance-report-template.md +123 -0
  15. package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +132 -0
  16. package/package.json +7 -3
  17. package/plans/ES2023 migration +13 -8
  18. package/plans/Evolution_Training_Interoperability_Contracts.md +1 -1
  19. package/plans/Flappy_Bird_Folder_Documentation_Pass.md +53 -0
  20. package/plans/Flappy_Evolution_Worker_Documentation_Pass.md +58 -0
  21. package/plans/Interactive_Examples_and_Learning_Path.md +10 -2
  22. package/plans/Memory_Optimization.md +3 -3
  23. package/plans/README.md +63 -0
  24. package/plans/Roadmap.md +15 -3
  25. package/plans/asciiMaze_SOLID_split.done.md +130 -0
  26. package/plans/flappy_bird_SOLID_split.done.md +67 -0
  27. package/scripts/analyze-trace.ts +590 -0
  28. package/scripts/assets/theme.css +221 -34
  29. package/scripts/copy-examples.mjs +9 -5
  30. package/scripts/export-onnx.mjs +3 -3
  31. package/scripts/generate-bench-tables.mjs +10 -10
  32. package/scripts/generate-bench-tables.ts +10 -10
  33. package/scripts/generate-docs.ts +1415 -449
  34. package/scripts/render-docs-html.ts +15 -8
  35. package/src/README.md +127 -222
  36. package/src/architecture/README.md +117 -184
  37. package/src/architecture/architect.ts +6 -0
  38. package/src/architecture/layer/README.md +38 -38
  39. package/src/architecture/network/README.md +49 -31
  40. package/src/architecture/network/activate/README.md +77 -77
  41. package/src/architecture/network/connect/README.md +15 -13
  42. package/src/architecture/network/deterministic/README.md +7 -7
  43. package/src/architecture/network/evolve/README.md +44 -44
  44. package/src/architecture/network/gating/README.md +20 -20
  45. package/src/architecture/network/genetic/README.md +51 -51
  46. package/src/architecture/network/mutate/README.md +97 -97
  47. package/src/architecture/network/network.types.ts +39 -0
  48. package/src/architecture/network/onnx/README.md +264 -264
  49. package/src/architecture/network/prune/README.md +39 -39
  50. package/src/architecture/network/remove/README.md +26 -26
  51. package/src/architecture/network/serialize/README.md +56 -56
  52. package/src/architecture/network/serialize/network.serialize.json.utils.ts +1 -0
  53. package/src/architecture/network/serialize/network.serialize.utils.ts +6 -1
  54. package/src/architecture/network/serialize/network.serialize.utils.types.ts +1 -1
  55. package/src/architecture/network/slab/README.md +61 -61
  56. package/src/architecture/network/standalone/README.md +24 -24
  57. package/src/architecture/network/stats/README.md +9 -9
  58. package/src/architecture/network/topology/README.md +46 -46
  59. package/src/architecture/network/training/README.md +21 -21
  60. package/src/architecture/network.ts +114 -10
  61. package/src/methods/README.md +9 -87
  62. package/src/multithreading/README.md +8 -77
  63. package/src/multithreading/workers/README.md +2 -2
  64. package/src/multithreading/workers/browser/README.md +0 -6
  65. package/src/multithreading/workers/node/README.md +0 -3
  66. package/src/neat/README.md +623 -568
  67. package/src/neat/neat.evolve.population.utils.ts +29 -5
  68. package/src/neat/neat.helpers.ts +16 -0
  69. package/src/neat/neat.topology-intent.utils.ts +160 -0
  70. package/src/utils/README.md +18 -18
  71. package/test/examples/asciiMaze/README.md +59 -59
  72. package/test/examples/asciiMaze/asciiMaze.e2e.test.ts +14 -9
  73. package/test/examples/asciiMaze/browser-entry/README.md +196 -0
  74. package/test/examples/asciiMaze/browser-entry/browser-entry.abort.services.ts +95 -0
  75. package/test/examples/asciiMaze/browser-entry/browser-entry.constants.ts +23 -0
  76. package/test/examples/asciiMaze/browser-entry/browser-entry.curriculum.services.ts +115 -0
  77. package/test/examples/asciiMaze/browser-entry/browser-entry.globals.services.ts +106 -0
  78. package/test/examples/asciiMaze/browser-entry/browser-entry.host.services.ts +157 -0
  79. package/test/examples/asciiMaze/browser-entry/browser-entry.services.ts +14 -0
  80. package/test/examples/asciiMaze/browser-entry/browser-entry.ts +129 -0
  81. package/test/examples/asciiMaze/browser-entry/browser-entry.types.ts +120 -0
  82. package/test/examples/asciiMaze/browser-entry/browser-entry.utils.ts +98 -0
  83. package/test/examples/asciiMaze/browser-entry.ts +10 -576
  84. package/test/examples/asciiMaze/dashboardManager/README.md +276 -0
  85. package/test/examples/asciiMaze/dashboardManager/archive/README.md +16 -0
  86. package/test/examples/asciiMaze/dashboardManager/archive/dashboardManager.archive.services.ts +267 -0
  87. package/test/examples/asciiMaze/dashboardManager/dashboardManager.constants.ts +35 -0
  88. package/test/examples/asciiMaze/dashboardManager/dashboardManager.services.ts +103 -0
  89. package/test/examples/asciiMaze/dashboardManager/dashboardManager.ts +181 -0
  90. package/test/examples/asciiMaze/dashboardManager/dashboardManager.types.ts +267 -0
  91. package/test/examples/asciiMaze/dashboardManager/dashboardManager.utils.ts +254 -0
  92. package/test/examples/asciiMaze/dashboardManager/live/README.md +14 -0
  93. package/test/examples/asciiMaze/dashboardManager/live/dashboardManager.live.services.ts +264 -0
  94. package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +47 -0
  95. package/test/examples/asciiMaze/dashboardManager/telemetry/dashboardManager.telemetry.services.ts +513 -0
  96. package/test/examples/asciiMaze/dashboardManager.ts +13 -2335
  97. package/test/examples/asciiMaze/evolutionEngine/README.md +1058 -0
  98. package/test/examples/asciiMaze/evolutionEngine/curriculumPhase.ts +90 -0
  99. package/test/examples/asciiMaze/evolutionEngine/engineState.constants.ts +36 -0
  100. package/test/examples/asciiMaze/evolutionEngine/engineState.ts +58 -513
  101. package/test/examples/asciiMaze/evolutionEngine/engineState.types.ts +212 -0
  102. package/test/examples/asciiMaze/evolutionEngine/engineState.utils.ts +301 -0
  103. package/test/examples/asciiMaze/evolutionEngine/evolutionEngine.types.ts +445 -0
  104. package/test/examples/asciiMaze/evolutionEngine/evolutionLoop.ts +81 -50
  105. package/test/examples/asciiMaze/evolutionEngine/optionsAndSetup.ts +2 -4
  106. package/test/examples/asciiMaze/evolutionEngine/populationDynamics.ts +17 -33
  107. package/test/examples/asciiMaze/evolutionEngine/populationPruning.ts +1 -1
  108. package/test/examples/asciiMaze/evolutionEngine/rngAndTiming.ts +1 -2
  109. package/test/examples/asciiMaze/evolutionEngine/sampling.ts +1 -1
  110. package/test/examples/asciiMaze/evolutionEngine/scratchPools.ts +2 -5
  111. package/test/examples/asciiMaze/evolutionEngine/setupHelpers.ts +30 -37
  112. package/test/examples/asciiMaze/evolutionEngine/telemetryMetrics.ts +16 -58
  113. package/test/examples/asciiMaze/evolutionEngine/trainingWarmStart.ts +2 -2
  114. package/test/examples/asciiMaze/evolutionEngine.ts +55 -55
  115. package/test/examples/asciiMaze/fitness.ts +2 -2
  116. package/test/examples/asciiMaze/fitness.types.ts +65 -0
  117. package/test/examples/asciiMaze/interfaces.ts +64 -1352
  118. package/test/examples/asciiMaze/mazeMovement/README.md +356 -0
  119. package/test/examples/asciiMaze/mazeMovement/finalization/README.md +49 -0
  120. package/test/examples/asciiMaze/mazeMovement/finalization/mazeMovement.finalization.ts +138 -0
  121. package/test/examples/asciiMaze/mazeMovement/mazeMovement.constants.ts +101 -0
  122. package/test/examples/asciiMaze/mazeMovement/mazeMovement.services.ts +230 -0
  123. package/test/examples/asciiMaze/mazeMovement/mazeMovement.ts +299 -0
  124. package/test/examples/asciiMaze/mazeMovement/mazeMovement.types.ts +185 -0
  125. package/test/examples/asciiMaze/mazeMovement/mazeMovement.utils.ts +153 -0
  126. package/test/examples/asciiMaze/mazeMovement/policy/README.md +91 -0
  127. package/test/examples/asciiMaze/mazeMovement/policy/mazeMovement.policy.ts +467 -0
  128. package/test/examples/asciiMaze/mazeMovement/runtime/README.md +95 -0
  129. package/test/examples/asciiMaze/mazeMovement/runtime/mazeMovement.runtime.ts +354 -0
  130. package/test/examples/asciiMaze/mazeMovement/shaping/README.md +124 -0
  131. package/test/examples/asciiMaze/mazeMovement/shaping/mazeMovement.shaping.ts +459 -0
  132. package/test/examples/asciiMaze/mazeMovement.ts +12 -2978
  133. package/test/examples/flappy_bird/README.md +193 -88
  134. package/test/examples/flappy_bird/browser-entry/README.md +1441 -0
  135. package/test/examples/flappy_bird/browser-entry/browser-entry.host.utils.ts +4 -324
  136. package/test/examples/flappy_bird/browser-entry/browser-entry.network-view.utils.ts +9 -396
  137. package/test/examples/flappy_bird/browser-entry/browser-entry.playback.utils.ts +6 -714
  138. package/test/examples/flappy_bird/browser-entry/browser-entry.render.types.ts +26 -3
  139. package/test/examples/flappy_bird/browser-entry/browser-entry.runtime.types.ts +16 -1
  140. package/test/examples/flappy_bird/browser-entry/browser-entry.simulation.types.ts +39 -5
  141. package/test/examples/flappy_bird/browser-entry/browser-entry.spawn.utils.ts +11 -31
  142. package/test/examples/flappy_bird/browser-entry/browser-entry.stats.types.ts +32 -4
  143. package/test/examples/flappy_bird/browser-entry/browser-entry.ts +11 -0
  144. package/test/examples/flappy_bird/browser-entry/browser-entry.types.ts +8 -0
  145. package/test/examples/flappy_bird/browser-entry/browser-entry.visualization.types.ts +50 -7
  146. package/test/examples/flappy_bird/browser-entry/browser-entry.visualization.utils.ts +21 -893
  147. package/test/examples/flappy_bird/browser-entry/browser-entry.worker.types.ts +91 -10
  148. package/test/examples/flappy_bird/browser-entry/host/README.md +318 -0
  149. package/test/examples/flappy_bird/browser-entry/host/host.canvas.service.ts +16 -0
  150. package/test/examples/flappy_bird/browser-entry/host/host.constants.ts +20 -0
  151. package/test/examples/flappy_bird/browser-entry/host/host.dom.service.ts +10 -0
  152. package/test/examples/flappy_bird/browser-entry/host/host.resize.service.ts +1 -295
  153. package/test/examples/flappy_bird/browser-entry/host/host.stats.service.ts +14 -0
  154. package/test/examples/flappy_bird/browser-entry/host/host.ts +592 -6
  155. package/test/examples/flappy_bird/browser-entry/host/host.types.ts +13 -0
  156. package/test/examples/flappy_bird/browser-entry/host/resize/README.md +309 -0
  157. package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.constants.ts +47 -0
  158. package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.services.ts +392 -0
  159. package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.ts +132 -0
  160. package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.types.ts +92 -0
  161. package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.utils.ts +272 -0
  162. package/test/examples/flappy_bird/browser-entry/network-view/README.md +389 -0
  163. package/test/examples/flappy_bird/browser-entry/network-view/network-view.draw.service.ts +13 -0
  164. package/test/examples/flappy_bird/browser-entry/network-view/network-view.labels.utils.ts +12 -0
  165. package/test/examples/flappy_bird/browser-entry/network-view/network-view.layout.utils.ts +14 -0
  166. package/test/examples/flappy_bird/browser-entry/network-view/network-view.topology.utils.ts +267 -0
  167. package/test/examples/flappy_bird/browser-entry/network-view/network-view.ts +823 -7
  168. package/test/examples/flappy_bird/browser-entry/network-view/network-view.types.ts +11 -0
  169. package/test/examples/flappy_bird/browser-entry/playback/README.md +845 -0
  170. package/test/examples/flappy_bird/browser-entry/playback/background/README.md +355 -0
  171. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +1068 -0
  172. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.batch.services.ts +64 -0
  173. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.cache.services.ts +207 -0
  174. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.constants.ts +197 -0
  175. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.batch.utils.ts +114 -0
  176. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.layout.utils.test.ts +96 -0
  177. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.layout.utils.ts +204 -0
  178. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.services.ts +49 -0
  179. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.utils.ts +313 -0
  180. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.layer.services.ts +81 -0
  181. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.math.utils.test.ts +33 -0
  182. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.math.utils.ts +201 -0
  183. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.pulse.selection.utils.ts +171 -0
  184. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.pulse.timing.utils.ts +124 -0
  185. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.pulse.utils.test.ts +279 -0
  186. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.pulse.utils.ts +132 -0
  187. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.scene.services.ts +26 -0
  188. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.services.ts +65 -0
  189. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.ts +48 -0
  190. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.types.ts +342 -0
  191. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.utils.ts +10 -0
  192. package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.cache.services.ts +96 -0
  193. package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.constants.ts +127 -0
  194. package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.draw.services.ts +184 -0
  195. package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.scene.services.ts +64 -0
  196. package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.services.ts +6 -0
  197. package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.ts +53 -0
  198. package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.types.ts +105 -0
  199. package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.utils.ts +100 -0
  200. package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +541 -0
  201. package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.bird.utils.ts +180 -0
  202. package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.canvas.services.ts +77 -0
  203. package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.entity.services.ts +167 -0
  204. package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.scene.services.ts +57 -0
  205. package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.service.test.ts +176 -0
  206. package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.service.ts +113 -0
  207. package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.services.ts +35 -0
  208. package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.trail.utils.ts +248 -0
  209. package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.types.ts +103 -0
  210. package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.utils.ts +11 -0
  211. package/test/examples/flappy_bird/browser-entry/playback/playback.constants.ts +1 -1
  212. package/test/examples/flappy_bird/browser-entry/playback/playback.frame-render.service.ts +10 -0
  213. package/test/examples/flappy_bird/browser-entry/playback/playback.iteration.services.ts +192 -0
  214. package/test/examples/flappy_bird/browser-entry/playback/playback.loop.service.ts +12 -0
  215. package/test/examples/flappy_bird/browser-entry/playback/playback.orchestration.types.ts +78 -0
  216. package/test/examples/flappy_bird/browser-entry/playback/playback.render.pipe-outline.service.ts +128 -0
  217. package/test/examples/flappy_bird/browser-entry/playback/playback.render.service.ts +1 -116
  218. package/test/examples/flappy_bird/browser-entry/playback/playback.session.services.ts +184 -0
  219. package/test/examples/flappy_bird/browser-entry/playback/playback.snapshot.utils.test.ts +121 -0
  220. package/test/examples/flappy_bird/browser-entry/playback/playback.snapshot.utils.ts +8 -0
  221. package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.layer.services.ts +36 -0
  222. package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.service.ts +11 -128
  223. package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.services.ts +268 -0
  224. package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.types.ts +91 -0
  225. package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.utils.ts +11 -4
  226. package/test/examples/flappy_bird/browser-entry/playback/playback.trail.utils.ts +9 -86
  227. package/test/examples/flappy_bird/browser-entry/playback/playback.ts +75 -7
  228. package/test/examples/flappy_bird/browser-entry/playback/playback.types.ts +12 -9
  229. package/test/examples/flappy_bird/browser-entry/playback/playback.worker-channel.utils.ts +11 -123
  230. package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +55 -0
  231. package/test/examples/flappy_bird/browser-entry/playback/snapshot/playback.snapshot.services.ts +103 -0
  232. package/test/examples/flappy_bird/browser-entry/playback/snapshot/playback.snapshot.summary.utils.test.ts +45 -0
  233. package/test/examples/flappy_bird/browser-entry/playback/snapshot/playback.snapshot.summary.utils.ts +28 -0
  234. package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +95 -0
  235. package/test/examples/flappy_bird/browser-entry/playback/trail/playback.trail.history.services.test.ts +35 -0
  236. package/test/examples/flappy_bird/browser-entry/playback/trail/playback.trail.history.services.ts +64 -0
  237. package/test/examples/flappy_bird/browser-entry/playback/trail/playback.trail.opacity.utils.test.ts +37 -0
  238. package/test/examples/flappy_bird/browser-entry/playback/trail/playback.trail.opacity.utils.ts +74 -0
  239. package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +71 -0
  240. package/test/examples/flappy_bird/browser-entry/playback/worker-channel/playback.worker-channel.request.services.ts +45 -0
  241. package/test/examples/flappy_bird/browser-entry/playback/worker-channel/playback.worker-channel.summary.services.ts +74 -0
  242. package/test/examples/flappy_bird/browser-entry/playback/worker-channel/playback.worker-channel.types.ts +53 -0
  243. package/test/examples/flappy_bird/browser-entry/runtime/README.md +304 -0
  244. package/test/examples/flappy_bird/browser-entry/runtime/runtime.browser-globals.service.ts +15 -0
  245. package/test/examples/flappy_bird/browser-entry/runtime/runtime.errors.ts +17 -0
  246. package/test/examples/flappy_bird/browser-entry/runtime/runtime.evolution-launch.service.ts +56 -0
  247. package/test/examples/flappy_bird/browser-entry/runtime/runtime.evolution-loop.service.ts +19 -0
  248. package/test/examples/flappy_bird/browser-entry/runtime/runtime.lifecycle.service.ts +96 -0
  249. package/test/examples/flappy_bird/browser-entry/runtime/runtime.startup.service.ts +92 -0
  250. package/test/examples/flappy_bird/browser-entry/runtime/runtime.telemetry.service.ts +24 -0
  251. package/test/examples/flappy_bird/browser-entry/runtime/runtime.ts +31 -121
  252. package/test/examples/flappy_bird/browser-entry/runtime/runtime.types.ts +65 -0
  253. package/test/examples/flappy_bird/browser-entry/visualization/README.md +568 -0
  254. package/test/examples/flappy_bird/browser-entry/visualization/visualization.colors.utils.ts +26 -0
  255. package/test/examples/flappy_bird/browser-entry/visualization/visualization.constants.ts +110 -0
  256. package/test/examples/flappy_bird/browser-entry/visualization/visualization.draw.service.ts +979 -19
  257. package/test/examples/flappy_bird/browser-entry/visualization/visualization.legend.utils.ts +157 -3
  258. package/test/examples/flappy_bird/browser-entry/visualization/visualization.topology.utils.ts +13 -27
  259. package/test/examples/flappy_bird/browser-entry/visualization/visualization.ts +7 -20
  260. package/test/examples/flappy_bird/browser-entry/visualization/visualization.types.ts +14 -0
  261. package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +238 -0
  262. package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.errors.ts +11 -0
  263. package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.generation.service.ts +12 -0
  264. package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.playback.service.test.ts +143 -0
  265. package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.playback.service.ts +140 -14
  266. package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.request.service.ts +27 -0
  267. package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.ts +8 -0
  268. package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.types.ts +23 -0
  269. package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.url.service.ts +5 -0
  270. package/test/examples/flappy_bird/constants/README.md +1163 -0
  271. package/test/examples/flappy_bird/constants/constants.birds.ts +16 -38
  272. package/test/examples/flappy_bird/constants/constants.difficulty.ts +21 -0
  273. package/test/examples/flappy_bird/constants/constants.network-view.ts +24 -0
  274. package/test/examples/flappy_bird/constants/constants.network.ts +1 -1
  275. package/test/examples/flappy_bird/constants/constants.observation.ts +7 -0
  276. package/test/examples/flappy_bird/constants/constants.palette.ts +9 -2
  277. package/test/examples/flappy_bird/constants/constants.physics.ts +9 -0
  278. package/test/examples/flappy_bird/constants/constants.pipe-render.ts +3 -0
  279. package/test/examples/flappy_bird/constants/constants.pipes.ts +22 -3
  280. package/test/examples/flappy_bird/constants/constants.runtime.ts +28 -4
  281. package/test/examples/flappy_bird/constants/constants.starfield.ts +78 -3
  282. package/test/examples/flappy_bird/constants/constants.ts +6 -0
  283. package/test/examples/flappy_bird/environment/README.md +182 -0
  284. package/test/examples/flappy_bird/environment/environment.collision.utils.ts +7 -0
  285. package/test/examples/flappy_bird/environment/environment.constants.ts +16 -3
  286. package/test/examples/flappy_bird/environment/environment.observation.utils.ts +12 -19
  287. package/test/examples/flappy_bird/environment/environment.state.service.ts +10 -0
  288. package/test/examples/flappy_bird/environment/environment.step.service.ts +15 -66
  289. package/test/examples/flappy_bird/environment/environment.types.ts +14 -0
  290. package/test/examples/flappy_bird/evaluation/README.md +155 -0
  291. package/test/examples/flappy_bird/evaluation/evaluation.constants.ts +23 -4
  292. package/test/examples/flappy_bird/evaluation/evaluation.fitness.utils.ts +16 -1
  293. package/test/examples/flappy_bird/evaluation/evaluation.rollout.service.ts +7 -374
  294. package/test/examples/flappy_bird/evaluation/evaluation.seed.utils.ts +4 -0
  295. package/test/examples/flappy_bird/evaluation/evaluation.types.ts +18 -2
  296. package/test/examples/flappy_bird/evaluation/rollout/README.md +355 -0
  297. package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.constants.ts +38 -0
  298. package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.service.ts +71 -0
  299. package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.services.ts +338 -0
  300. package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.types.ts +69 -0
  301. package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.utils.ts +399 -0
  302. package/test/examples/flappy_bird/flappy-evolution-worker/README.md +845 -0
  303. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.constants.ts +49 -7
  304. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.errors.ts +34 -3
  305. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.evolution.service.ts +22 -0
  306. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.playback.service.ts +62 -26
  307. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.protocol.service.ts +27 -1
  308. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.runtime.service.ts +23 -0
  309. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.frame.service.ts +378 -0
  310. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.types.ts +22 -0
  311. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.utils.ts +20 -203
  312. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.snapshot.utils.test.ts +94 -0
  313. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.snapshot.utils.ts +78 -13
  314. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.ts +235 -344
  315. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types.ts +170 -22
  316. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.warm-start.service.ts +314 -0
  317. package/test/examples/flappy_bird/flappy.simulation.shared.utils.ts +17 -0
  318. package/test/examples/flappy_bird/flappyEnvironment.ts +21 -0
  319. package/test/examples/flappy_bird/flappyEvaluation.ts +12 -0
  320. package/test/examples/flappy_bird/flappyEvolution.worker.ts +7 -0
  321. package/test/examples/flappy_bird/index.ts +8 -2
  322. package/test/examples/flappy_bird/rng.ts +10 -0
  323. package/test/examples/flappy_bird/simulation-shared/README.md +518 -0
  324. package/test/examples/flappy_bird/simulation-shared/observation/README.md +255 -0
  325. package/test/examples/flappy_bird/simulation-shared/observation/observation.features.utils.ts +339 -0
  326. package/test/examples/flappy_bird/simulation-shared/observation/observation.ts +19 -0
  327. package/test/examples/flappy_bird/simulation-shared/observation/observation.vector.utils.ts +81 -0
  328. package/test/examples/flappy_bird/simulation-shared/simulation-shared.constants.ts +3 -0
  329. package/test/examples/flappy_bird/simulation-shared/simulation-shared.control.utils.ts +6 -0
  330. package/test/examples/flappy_bird/simulation-shared/simulation-shared.difficulty.utils.ts +9 -0
  331. package/test/examples/flappy_bird/simulation-shared/simulation-shared.errors.ts +10 -1
  332. package/test/examples/flappy_bird/simulation-shared/simulation-shared.memory.utils.ts +18 -0
  333. package/test/examples/flappy_bird/simulation-shared/simulation-shared.observation.utils.ts +7 -402
  334. package/test/examples/flappy_bird/simulation-shared/simulation-shared.spawn.utils.ts +36 -6
  335. package/test/examples/flappy_bird/{evaluation/evaluation.statistics.utils.ts → simulation-shared/simulation-shared.statistics.utils.ts} +30 -9
  336. package/test/examples/flappy_bird/simulation-shared/simulation-shared.types.ts +38 -5
  337. package/test/examples/flappy_bird/trainFlappyBird.ts +13 -0
  338. package/test/examples/flappy_bird/trainer/README.md +676 -0
  339. package/test/examples/flappy_bird/trainer/evaluation/README.md +253 -0
  340. package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.constants.ts +15 -0
  341. package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.services.ts +86 -0
  342. package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.ts +187 -0
  343. package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.types.ts +32 -0
  344. package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.utils.ts +182 -0
  345. package/test/examples/flappy_bird/trainer/trainer.evaluation.service.ts +13 -0
  346. package/test/examples/flappy_bird/trainer/trainer.fitness.service.ts +23 -1
  347. package/test/examples/flappy_bird/trainer/trainer.loop.service.ts +17 -1
  348. package/test/examples/flappy_bird/trainer/trainer.report.service.services.ts +181 -0
  349. package/test/examples/flappy_bird/trainer/trainer.report.service.ts +136 -0
  350. package/test/examples/flappy_bird/trainer/trainer.selection.utils.ts +89 -0
  351. package/test/examples/flappy_bird/trainer/trainer.setup.service.ts +22 -0
  352. package/test/examples/flappy_bird/trainer/trainer.signals.service.ts +8 -0
  353. package/test/examples/flappy_bird/trainer/trainer.ts +38 -553
  354. package/test/examples/flappy_bird/trainer/trainer.types.ts +44 -7
  355. package/test/neat/neat.topology-intent.test.ts +129 -0
  356. package/test/network/network.topology-intent.test.ts +44 -0
  357. package/test/examples/flappy_bird/browser-entry/browser-entry.utils.ts +0 -12
  358. package/test/examples/flappy_bird/environment/environment.ts +0 -7
  359. package/test/examples/flappy_bird/evaluation/evaluation.ts +0 -7
  360. package/test/examples/flappy_bird/simulation-shared/simulation-shared.ts +0 -15
  361. package/test/examples/flappy_bird/trainer/trainer.statistics.utils.ts +0 -78
@@ -0,0 +1,845 @@
1
+ # flappy-evolution-worker
2
+
3
+ ## flappy-evolution-worker/flappy-evolution-worker.types.ts
4
+
5
+ ### SerializedNetwork
6
+
7
+ Loose JSON-compatible network payload used by worker messages.
8
+
9
+ The worker never posts live `Network` instances back to the browser host.
10
+ Instead it sends the result of `network.toJSON()` so the payload stays
11
+ structured-clone safe and easy to inspect in devtools.
12
+
13
+ ### WorkerErrorMessage
14
+
15
+ Worker error response message.
16
+
17
+ Errors are normalized into a display-safe string so the host UI can surface
18
+ failures without depending on worker-specific exception classes.
19
+
20
+ ### WorkerFrameBirdSnapshot
21
+
22
+ Render-only bird snapshot DTO posted to host.
23
+
24
+ This shape is useful conceptually, but the current transport uses the packed
25
+ typed-array variant for lower allocation and transfer cost.
26
+
27
+ ### WorkerFramePipeSnapshot
28
+
29
+ Render-only pipe snapshot DTO posted to host.
30
+
31
+ Like `WorkerFrameBirdSnapshot`, this documents the logical payload shape even
32
+ though the worker currently sends the packed transport form.
33
+
34
+ ### WorkerGenerationReadyMessage
35
+
36
+ Worker generation-ready response message.
37
+
38
+ The browser host uses this message to refresh HUD state and optionally render
39
+ the current best network visualization.
40
+
41
+ ### WorkerHeuristicObservationFeatures
42
+
43
+ Structured features used by heuristic generation-0 teacher policy.
44
+
45
+ The warm-start service reuses the same high-level observation semantics as the
46
+ real policy inference path, which keeps the heuristic teacher aligned with the
47
+ features evolved networks will later see.
48
+
49
+ ### WorkerInitMessage
50
+
51
+ Worker init request message.
52
+
53
+ This is the first message the host should send. It seeds deterministic RNG
54
+ state and configures the worker-local NEAT runtime.
55
+
56
+ ### WorkerPackedPlaybackBirdSnapshot
57
+
58
+ Packed typed-array payload for playback bird snapshot transport.
59
+
60
+ The host can reconstruct renderer-friendly bird views from these arrays while
61
+ the worker keeps the authoritative mutable simulation objects private.
62
+
63
+ ### WorkerPackedPlaybackPipeSnapshot
64
+
65
+ Packed typed-array payload for playback pipe snapshot transport.
66
+
67
+ Packing the per-pipe fields into column-oriented typed arrays makes the
68
+ browser/worker boundary cheaper than sending large arrays of object literals
69
+ on every animation frame.
70
+
71
+ ### WorkerPlaybackFrameSnapshot
72
+
73
+ Full frame snapshot payload posted to host.
74
+
75
+ Educational note:
76
+ `packed-v1` is a transport contract, not a rendering primitive. The versioned
77
+ format string gives the browser host a stable way to decode snapshots even if
78
+ the worker later gains additional packed fields or alternate transport modes.
79
+
80
+ ### WorkerPlaybackState
81
+
82
+ Mutable simulation state stored between worker playback requests.
83
+
84
+ A `start-playback` message creates this state once, and each
85
+ `request-playback-step` message advances it by a host-selected number of
86
+ simulation steps.
87
+
88
+ ### WorkerPlaybackStepMessage
89
+
90
+ Worker playback-step response message.
91
+
92
+ The message carries the packed frame snapshot plus optional instrumentation
93
+ and end-of-run summary statistics when the whole simulated population has
94
+ been eliminated.
95
+
96
+ The split between per-frame snapshot data and end-of-run summary fields keeps
97
+ the hot path compact while still giving the host enough telemetry to update
98
+ HUD metrics when a playback session completes.
99
+
100
+ ### WorkerPopulationBird
101
+
102
+ Mutable bird state tracked by the worker playback simulation.
103
+
104
+ Educational note:
105
+ Each bird keeps both physics state and policy state. The observation-memory
106
+ field lets feed-forward networks approximate short-term temporal memory by
107
+ carrying previous observation features between simulation steps.
108
+
109
+ ### WorkerPopulationPipe
110
+
111
+ Mutable pipe state tracked by the worker playback simulation.
112
+
113
+ These objects exist only inside the worker runtime. The host later receives a
114
+ packed snapshot derived from them rather than these live mutable records.
115
+
116
+ ### WorkerRequestGenerationMessage
117
+
118
+ Worker request asking to evolve one generation.
119
+
120
+ The worker responds with `generation-ready` once the NEAT runtime finishes
121
+ one evolution pass.
122
+
123
+ ### WorkerRequestMessage
124
+
125
+ Union of inbound worker request messages.
126
+
127
+ Reading this union top-to-bottom is the quickest way to understand the worker
128
+ protocol: initialize, evolve, start playback, step playback, then stop.
129
+
130
+ ### WorkerRequestPlaybackStepMessage
131
+
132
+ Worker request asking to advance playback by N simulation steps.
133
+
134
+ The host typically sends this once per animation frame and chooses
135
+ `simulationSteps` based on how much simulation throughput it wants relative to
136
+ rendering smoothness.
137
+
138
+ ### WorkerResponseMessage
139
+
140
+ Union of outbound worker response messages.
141
+
142
+ Together with `WorkerRequestMessage`, this forms the full host/worker
143
+ protocol contract for the demo.
144
+
145
+ ### WorkerStartPlaybackMessage
146
+
147
+ Worker request asking to initialize playback state.
148
+
149
+ This materializes the mutable world state for the current evolved population.
150
+ After this message succeeds, the host can begin issuing playback-step
151
+ requests.
152
+
153
+ ### WorkerStopMessage
154
+
155
+ Worker stop request message.
156
+
157
+ This is a cooperative shutdown signal. Long-running worker flows can observe
158
+ the stopped flag and fail fast instead of continuing work the UI no longer
159
+ cares about.
160
+
161
+ ## flappy-evolution-worker/flappy-evolution-worker.simulation.types.ts
162
+
163
+ ### WorkerPlaybackFrameContext
164
+
165
+ Shared mutable inputs for one worker playback frame simulation pass.
166
+
167
+ Educational note:
168
+ The frame service computes several derived geometry values once per logical
169
+ frame and threads them through the substep helpers in this context object.
170
+ That keeps the top-level simulation flow declarative while avoiding repeated
171
+ argument sprawl across helper calls.
172
+
173
+ ## flappy-evolution-worker/flappy-evolution-worker.ts
174
+
175
+ ### beginWorkerGenerationRequest
176
+
177
+ `(workerMutableRuntimeState: WorkerMutableRuntimeState) => void`
178
+
179
+ Begins one asynchronous generation request and captures failures.
180
+
181
+ This is intentionally fire-and-forget from the protocol perspective. The
182
+ actual completion signal is the later `generation-ready` or `error` message
183
+ posted back to the host.
184
+
185
+ Parameters:
186
+ - `workerMutableRuntimeState` - - Mutable worker runtime state.
187
+
188
+ Returns: Nothing.
189
+
190
+ ### beginWorkerInitialization
191
+
192
+ `(workerMutableRuntimeState: WorkerMutableRuntimeState, initPayload: { populationSize: number; elitismCount: number; rngSeed: number; }) => void`
193
+
194
+ Begins worker initialization and captures asynchronous failures.
195
+
196
+ The worker retains the initialization promise so later generation requests can
197
+ await setup completion instead of racing against it.
198
+
199
+ Parameters:
200
+ - `workerMutableRuntimeState` - - Mutable worker runtime state.
201
+ - `initPayload` - - Initialization payload.
202
+
203
+ Returns: Nothing.
204
+
205
+ ### beginWorkerPlayback
206
+
207
+ `(workerMutableRuntimeState: WorkerMutableRuntimeState, payload: { visibleWorldWidthPx: number; visibleWorldHeightPx: number; }) => void`
208
+
209
+ Begins a new playback session from the current evolved population.
210
+
211
+ A playback session is a deterministic simulation snapshot seeded from the
212
+ current population. Each new session resets playback RNG and world state so
213
+ the host can replay generations cleanly.
214
+
215
+ Parameters:
216
+ - `workerMutableRuntimeState` - - Mutable worker runtime state.
217
+ - `payload` - - Playback start payload.
218
+
219
+ Returns: Nothing.
220
+
221
+ ### createWorkerMessageHandler
222
+
223
+ `(workerMutableRuntimeState: WorkerMutableRuntimeState) => (event: MessageEvent<import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerRequestMessage>) => void`
224
+
225
+ Creates the top-level worker message handler.
226
+
227
+ The returned function is intentionally thin. All protocol decisions are
228
+ delegated to the router service so the worker entrypoint stays readable as a
229
+ high-level orchestration module.
230
+
231
+ Parameters:
232
+ - `workerMutableRuntimeState` - - Mutable worker runtime state.
233
+
234
+ Returns: Worker message handler.
235
+
236
+ ### createWorkerMutableRuntimeState
237
+
238
+ `() => WorkerMutableRuntimeState`
239
+
240
+ Creates the mutable worker runtime state container.
241
+
242
+ Educational note:
243
+ The worker keeps one small mutable state bag instead of scattering globals.
244
+ That makes the protocol flow easier to explain and lets the entrypoint pass a
245
+ single dependency object through the orchestration helpers.
246
+
247
+ Returns: Mutable worker runtime state.
248
+
249
+ ### createWorkerProtocolHandlers
250
+
251
+ `(workerMutableRuntimeState: WorkerMutableRuntimeState) => { markStopped: () => void; beginInitialization: (payload: { populationSize: number; elitismCount: number; rngSeed: number; }) => void; beginGenerationRequest: () => void; hasPopulation: () => boolean; startPlayback: (payload: { visibleWorldWidthPx: number; visibleWorldHeightPx: number; }) => void; hasPlaybackState: () => boolean; processPlaybackStep: (payload: { requestId: number; simulationSteps: number; visibleWorldWidthPx: number; visibleWorldHeightPx: number; }) => void; postWorkerMessage: typeof postWorkerMessage; }`
252
+
253
+ Creates protocol handlers bound to the mutable worker runtime state.
254
+
255
+ This helper is the bridge between the pure protocol router and the impure
256
+ worker runtime. Each callback closes over the same mutable state bag so the
257
+ protocol layer can remain small and declarative.
258
+
259
+ Parameters:
260
+ - `workerMutableRuntimeState` - - Mutable worker runtime state.
261
+
262
+ Returns: Protocol handler bundle.
263
+
264
+ ### evolveAndPublishGeneration
265
+
266
+ `(workerMutableRuntimeState: WorkerMutableRuntimeState) => Promise<void>`
267
+
268
+ Evolves one generation and publishes the best-network summary message.
269
+
270
+ Educational note:
271
+ This method is the orchestration seam between evolutionary search and
272
+ browser rendering: it runs evolution, snapshots the population, and emits
273
+ a compact payload for UI state updates.
274
+
275
+ Returns: Promise resolved after generation payload is posted.
276
+
277
+ ### initializeRuntime
278
+
279
+ `(workerMutableRuntimeState: WorkerMutableRuntimeState, initPayload: { populationSize: number; elitismCount: number; rngSeed: number; }) => Promise<void>`
280
+
281
+ Initializes the worker-local NEAT runtime used by browser evolution playback.
282
+
283
+ Educational note:
284
+ The runtime is configured once with deterministic RNG state and a lightweight
285
+ early-termination fitness rollout. Keeping this setup centralized helps ensure
286
+ reproducibility between runs and keeps host<->worker contracts simple.
287
+
288
+ This function only prepares the evolutionary controller. It does not start
289
+ playback and it does not evolve a generation yet; those remain separate
290
+ protocol steps so the host can control them explicitly.
291
+
292
+ Parameters:
293
+ - `initPayload` - - Initialization values from the browser host.
294
+
295
+ Returns: Promise resolved when runtime setup is complete.
296
+
297
+ ### postWorkerMessage
298
+
299
+ `(workerMessage: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerResponseMessage, transferList: Transferable[] | undefined) => void`
300
+
301
+ Posts a typed message from worker to host.
302
+
303
+ This is the narrowest possible transport helper: all message construction is
304
+ done elsewhere so the README can point to one stable worker-to-host boundary.
305
+
306
+ Parameters:
307
+ - `workerMessage` - - Outbound worker response payload.
308
+ - `transferList` - - Optional transferable buffers moved with the payload.
309
+
310
+ Returns: Nothing.
311
+
312
+ ### processWorkerPlaybackStepRequest
313
+
314
+ `(workerMutableRuntimeState: WorkerMutableRuntimeState, playbackStepPayload: { requestId: number; simulationSteps: number; visibleWorldWidthPx: number; visibleWorldHeightPx: number; }) => void`
315
+
316
+ Advances playback by a host-requested number of simulation steps.
317
+
318
+ Educational note:
319
+ The browser host can request multiple simulation steps per RAF to trade visual
320
+ smoothness against throughput. This function keeps that loop deterministic and
321
+ emits one compact snapshot payload per request.
322
+
323
+ Importantly, the worker remains authoritative for deciding when the run is
324
+ over and which bird should be treated as the playback winner.
325
+
326
+ Parameters:
327
+ - `playbackStepPayload` - - Host-selected simulation-step budget and viewport.
328
+
329
+ Returns: Nothing.
330
+
331
+ ## flappy-evolution-worker/flappy-evolution-worker.errors.ts
332
+
333
+ ### createWorkerErrorMessage
334
+
335
+ `(message: string) => import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerErrorMessage`
336
+
337
+ Creates a typed worker error response payload from a message string.
338
+
339
+ Parameters:
340
+ - `message` - - Error message text.
341
+
342
+ Returns: Worker error response message.
343
+
344
+ ### createWorkerErrorMessageFromUnknown
345
+
346
+ `(error: unknown) => import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerErrorMessage`
347
+
348
+ Creates a typed worker error response payload from an unknown thrown value.
349
+
350
+ This helper keeps the protocol boundary narrow: worker internals can use
351
+ regular exceptions, while the browser host still receives one predictable
352
+ `WorkerErrorMessage` shape.
353
+
354
+ Parameters:
355
+ - `error` - - Unknown thrown value.
356
+
357
+ Returns: Worker error response message.
358
+
359
+ ### FLAPPY_WORKER_INIT_FAILED_ERROR_MESSAGE
360
+
361
+ ### FLAPPY_WORKER_PLAYBACK_START_REQUIRES_GENERATION_ERROR_MESSAGE
362
+
363
+ ### FLAPPY_WORKER_PLAYBACK_STEP_REQUIRES_START_ERROR_MESSAGE
364
+
365
+ ### resolveWorkerUnknownErrorMessage
366
+
367
+ `(error: unknown) => string`
368
+
369
+ Resolves unknown error-like values into display-safe worker error messages.
370
+
371
+ Educational note:
372
+ Browser workers can throw anything, including strings or arbitrary objects.
373
+ Normalizing that value here gives the rest of the protocol a simple
374
+ `string`-only error surface.
375
+
376
+ Parameters:
377
+ - `error` - - Unknown error value thrown by worker logic.
378
+
379
+ Returns: Normalized error message string.
380
+
381
+ ## flappy-evolution-worker/flappy-evolution-worker.constants.ts
382
+
383
+ ### flappy-evolution-worker.constants
384
+
385
+ Synthetic sample count used for generation-0 warm-start pretraining.
386
+
387
+ Educational note:
388
+ The warm-start service briefly trains a template network on a heuristic
389
+ teacher before the first NEAT generation is evolved. This value controls how
390
+ many synthetic state/action examples are generated for that bootstrap pass.
391
+ Larger values usually make the teacher signal more stable, but they also
392
+ increase startup latency inside the worker.
393
+
394
+ ### FLAPPY_WORKER_GEN0_PRETRAIN_BATCH_SIZE
395
+
396
+ ### FLAPPY_WORKER_GEN0_PRETRAIN_BIAS_NOISE_STDDEV
397
+
398
+ ### FLAPPY_WORKER_GEN0_PRETRAIN_ITERATIONS
399
+
400
+ ### FLAPPY_WORKER_GEN0_PRETRAIN_RATE
401
+
402
+ ### FLAPPY_WORKER_GEN0_PRETRAIN_SAMPLE_COUNT
403
+
404
+ ### FLAPPY_WORKER_GEN0_PRETRAIN_VISIBLE_WORLD_WIDTH_PX
405
+
406
+ ### FLAPPY_WORKER_GEN0_PRETRAIN_WEIGHT_NOISE_STDDEV
407
+
408
+ ## flappy-evolution-worker/flappy-evolution-worker.runtime.service.ts
409
+
410
+ ### createInitializedWorkerRuntime
411
+
412
+ `(initPayload: { populationSize: number; elitismCount: number; rngSeed: number; }) => import("src/neat").default`
413
+
414
+ Creates and configures the worker-local NEAT runtime used by browser evolution playback.
415
+
416
+ Educational note:
417
+ The browser worker reuses the same core NeatapticTS runtime as the Node-side
418
+ trainer, but trims configuration down to the pieces needed for an interactive
419
+ example: deterministic seeding, feed-forward mutation policy, and a fitness
420
+ function that favors quick browser-visible iteration.
421
+
422
+ The resulting runtime is both the evolution engine and the source of the
423
+ population that later playback requests visualize.
424
+
425
+ For background reading, the Wikipedia article on "Neuroevolution of
426
+ augmenting topologies" is a useful overview of the family of ideas this demo
427
+ is exercising, even though the repository implements its own detailed runtime
428
+ behavior and modern extensions.
429
+
430
+ Parameters:
431
+ - `initPayload` - - Initialization values from the browser host.
432
+
433
+ Returns: Initialized NEAT runtime.
434
+
435
+ ## flappy-evolution-worker/flappy-evolution-worker.playback.service.ts
436
+
437
+ ### beginWorkerPlaybackSession
438
+
439
+ `(options: { currentPopulation: import("src/architecture/network").default[]; payload: { visibleWorldWidthPx: number; visibleWorldHeightPx: number; }; createPopulationRenderState: (networks: import("src/architecture/network").default[], rng: import("test/examples/flappy_bird/rng").FlappyRng, initialVisibleWorldWidthPx: number, initialVisibleWorldHeightPx: number) => import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPlaybackState; }) => { currentPlaybackState: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPlaybackState; currentPlaybackRng: import("test/examples/flappy_bird/rng").FlappyRng; playbackWinnerIndex: number; }`
440
+
441
+ Creates a fresh worker playback session state from the current evolved population.
442
+
443
+ Educational note:
444
+ Evolution and playback are intentionally separated. Evolution produces a new
445
+ population, then playback freezes that population into a deterministic
446
+ simulation state that the host can step frame-by-frame for rendering.
447
+
448
+ Parameters:
449
+ - `currentPopulation` - - Current evolved population.
450
+ - `payload` - - Playback start viewport payload.
451
+ - `createPopulationRenderState` - - Callback that builds initial simulation state.
452
+
453
+ Returns: Playback runtime state and deterministic RNG.
454
+
455
+ ### processWorkerPlaybackStep
456
+
457
+ `(options: { playbackStepPayload: { requestId: number; simulationSteps: number; visibleWorldWidthPx: number; visibleWorldHeightPx: number; }; currentPlaybackState: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPlaybackState; currentPlaybackRng: import("test/examples/flappy_bird/rng").FlappyRng; currentPopulation: import("src/architecture/network").default[]; neatRuntime: import("src/neat").default | undefined; stepPopulationFrame: (renderState: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPlaybackState, rng: import("test/examples/flappy_bird/rng").FlappyRng, difficultyProfile: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedDifficultyProfile) => number; createPlaybackSnapshot: (playbackState: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPlaybackState) => import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPlaybackFrameSnapshot; resolvePlaybackSnapshotTransferList: (snapshot: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPlaybackFrameSnapshot) => Transferable[]; postWorkerMessage: (workerMessage: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerResponseMessage, transferList?: Transferable[] | undefined) => void; }) => { currentPlaybackState: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPlaybackState | undefined; currentPlaybackRng: import("test/examples/flappy_bird/rng").FlappyRng | undefined; currentPopulation: import("src/architecture/network").default[]; playbackWinnerIndex: number; }`
458
+
459
+ Processes one worker playback-step request including completion/finalization logic.
460
+
461
+ Educational note:
462
+ One playback request may advance multiple simulation steps. This lets the
463
+ host trade visual smoothness against throughput while keeping the worker in
464
+ control of simulation correctness, winner selection, and packed snapshot
465
+ publishing.
466
+
467
+ Parameters:
468
+ - `options` - - Playback step dependencies and mutable runtime state.
469
+
470
+ Returns: Updated playback runtime state after processing this step.
471
+
472
+ ## flappy-evolution-worker/flappy-evolution-worker.protocol.service.ts
473
+
474
+ ### routeWorkerProtocolMessage
475
+
476
+ `(workerMessage: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerRequestMessage, handlers: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.protocol.service").WorkerProtocolHandlers) => void`
477
+
478
+ Routes one inbound worker request message to the corresponding runtime action.
479
+
480
+ Educational note:
481
+ This router is the protocol gatekeeper for the worker. It enforces the two
482
+ important sequencing rules in the demo:
483
+ - playback requires a previously evolved population,
484
+ - playback stepping requires an active playback session.
485
+
486
+ In practice this acts like a tiny finite-state machine. If you want a quick
487
+ conceptual refresher, the Wikipedia article on "finite-state machine" maps
488
+ well onto the worker's init -> evolve -> start playback -> step playback flow.
489
+
490
+ Parameters:
491
+ - `workerMessage` - - Inbound worker request payload.
492
+ - `handlers` - - Runtime action callbacks and state probes.
493
+
494
+ Returns: Nothing.
495
+
496
+ ### WorkerProtocolHandlers
497
+
498
+ Callback bundle used by worker protocol routing.
499
+
500
+ Each callback corresponds to one legal transition in the worker message
501
+ protocol. Keeping the router dependent on this narrow interface makes the
502
+ protocol easy to read in generated docs and easy to test independently from
503
+ the worker-global `self.onmessage` hook.
504
+
505
+ ## flappy-evolution-worker/flappy-evolution-worker.evolution.service.ts
506
+
507
+ ### evolveAndBuildGenerationReadyMessage
508
+
509
+ `(options: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.evolution.service").WorkerEvolutionServiceOptions) => Promise<import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerGenerationReadyMessage>`
510
+
511
+ Evolves one generation and creates the compact generation-ready response payload.
512
+
513
+ Educational note:
514
+ The worker does not stream the whole population back to the UI after each
515
+ evolution step. Instead it emits a compact summary containing the generation
516
+ index, best fitness, and a serializable best-network snapshot for inspection.
517
+
518
+ Parameters:
519
+ - `options` - - Evolution dependencies and runtime state accessors.
520
+
521
+ Returns: Generation-ready worker response payload.
522
+
523
+ ### WorkerEvolutionServiceOptions
524
+
525
+ Dependencies required to evolve one generation and prepare host payload output.
526
+
527
+ Educational note:
528
+ This interface isolates the evolution step from the worker entrypoint. That
529
+ makes the README easier to follow: the entrypoint owns protocol orchestration,
530
+ while this service owns one well-defined "run generation -> publish summary"
531
+ slice of behavior.
532
+
533
+ ## flappy-evolution-worker/flappy-evolution-worker.warm-start.service.ts
534
+
535
+ ### applyTemplateWeightsWithNoise
536
+
537
+ `(genome: import("src/architecture/network").default, template: import("src/architecture/network").default, rng: import("test/examples/flappy_bird/rng").FlappyRng, noise: { weightStdDev: number; biasStdDev: number; }) => void`
538
+
539
+ Copies template parameters into a genome and injects small Gaussian noise.
540
+
541
+ Educational note:
542
+ The template network gives generation 0 a shared prior, while the noise terms
543
+ restore diversity so the population is still worth evolving.
544
+
545
+ Parameters:
546
+ - `genome` - - Target genome to mutate in-place.
547
+ - `template` - - Trained template source network.
548
+ - `rng` - - Deterministic random source for noise sampling.
549
+ - `noise` - - Standard deviations for weight and bias perturbations.
550
+
551
+ Returns: Nothing.
552
+
553
+ ### buildHeuristicPretrainSet
554
+
555
+ `(rng: import("test/examples/flappy_bird/rng").FlappyRng, sampleCount: number) => { input: number[]; output: number[]; }[]`
556
+
557
+ Builds synthetic supervised samples for generation-0 behavior cloning.
558
+
559
+ Educational note:
560
+ These samples are not recorded gameplay traces. They are synthetic states
561
+ generated from the same observation pipeline used during real playback so the
562
+ teacher labels and the evolved policy inputs stay in the same feature space.
563
+
564
+ Parameters:
565
+ - `rng` - - Deterministic random source.
566
+ - `sampleCount` - - Requested number of synthetic samples.
567
+
568
+ Returns: Supervised dataset of input/output pairs.
569
+
570
+ ### resolveHeuristicTeacherFlapDecision
571
+
572
+ `(features: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationFeatures) => boolean`
573
+
574
+ Heuristic teacher policy used to label synthetic pretraining samples.
575
+
576
+ The rule intentionally stays simple and interpretable: flap when the bird is
577
+ meaningfully below the next gap center, not already rising fast, and either
578
+ close to the gap entry or in an urgent approach state.
579
+
580
+ Parameters:
581
+ - `features` - - Structured observation features for one synthetic state.
582
+
583
+ Returns: True when the teacher says to flap.
584
+
585
+ ### sampleGaussian
586
+
587
+ `(rng: import("test/examples/flappy_bird/rng").FlappyRng) => number`
588
+
589
+ Samples one standard-normal value using the Box-Muller transform.
590
+
591
+ If you are unfamiliar with the transform, the Wikipedia article on
592
+ "Box-Muller transform" is a useful short background read. The worker uses it
593
+ here because it is deterministic, dependency-light, and good enough for small
594
+ noise injection during warm-start diversification.
595
+
596
+ Parameters:
597
+ - `rng` - - Deterministic random source.
598
+
599
+ Returns: One approximately standard-normal random value.
600
+
601
+ ### warmStartWorkerGenerationZeroIfNeeded
602
+
603
+ `(neatController: import("src/neat").default, warmStartState: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.warm-start.service").WorkerWarmStartState) => Promise<void>`
604
+
605
+ Applies a one-time generation-0 warm-start to improve initial demo quality.
606
+
607
+ Educational note:
608
+ The worker entry should stay protocol-first. This service owns the short
609
+ supervised bootstrap pass that nudges generation 0 away from pure noise while
610
+ preserving the later NEAT-driven search loop.
611
+
612
+ Conceptually this is a lightweight behavior-cloning pass. If you want more
613
+ background, the Wikipedia article on "imitation learning" is a helpful bridge
614
+ between the heuristic teacher used here and the later evolutionary search.
615
+
616
+ Parameters:
617
+ - `neatController` - - Initialized NEAT runtime.
618
+ - `warmStartState` - - Mutable warm-start lifecycle state.
619
+
620
+ Returns: Promise resolved when warm-start evaluation finishes.
621
+
622
+ ### WorkerWarmStartState
623
+
624
+ State carried between generation requests for one worker runtime.
625
+
626
+ The warm-start service is intentionally one-shot. These fields let the worker
627
+ remember whether generation 0 has already been bootstrapped and which initial
628
+ RNG seed should be reused for deterministic synthetic sample generation.
629
+
630
+ ## flappy-evolution-worker/flappy-evolution-worker.simulation.frame.service.ts
631
+
632
+ ### advanceBirdPhysics
633
+
634
+ `(frameContext: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.types").WorkerPlaybackFrameContext) => void`
635
+
636
+ Integrates bird velocity and vertical motion for one control substep.
637
+
638
+ Parameters:
639
+ - `frameContext` - - Shared frame context for this logical frame.
640
+
641
+ Returns: Nothing.
642
+
643
+ ### advancePipes
644
+
645
+ `(frameContext: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.types").WorkerPlaybackFrameContext) => void`
646
+
647
+ Advances all visible pipes and culls those that have left the camera window.
648
+
649
+ Parameters:
650
+ - `frameContext` - - Shared frame context for this logical frame.
651
+
652
+ Returns: Nothing.
653
+
654
+ ### commitPassedPipeProgress
655
+
656
+ `(bird: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPopulationBird, pipe: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPopulationPipe) => void`
657
+
658
+ Commits one passed-pipe progress increment for a bird when eligible.
659
+
660
+ Parameters:
661
+ - `bird` - - Mutable bird state.
662
+ - `pipe` - - Pipe candidate to mark as passed.
663
+
664
+ Returns: Nothing.
665
+
666
+ ### incrementLivingBirdFrameCounters
667
+
668
+ `(renderState: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPlaybackState) => void`
669
+
670
+ Increments survival counters for birds that remain active at frame start.
671
+
672
+ Parameters:
673
+ - `renderState` - - Mutable playback state.
674
+
675
+ Returns: Nothing.
676
+
677
+ ### resolveBirdCollisionAgainstPipe
678
+
679
+ `(bird: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPopulationBird, pipe: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPopulationPipe, frameContext: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.types").WorkerPlaybackFrameContext) => boolean`
680
+
681
+ Resolves whether a bird collides with one pipe corridor during this substep.
682
+
683
+ Parameters:
684
+ - `bird` - - Mutable bird state.
685
+ - `pipe` - - Pipe candidate to test.
686
+ - `frameContext` - - Shared frame context for this logical frame.
687
+
688
+ Returns: `true` when the bird overlaps the pipe body instead of the gap.
689
+
690
+ ### resolveBirdControlActions
691
+
692
+ `(frameContext: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.types").WorkerPlaybackFrameContext) => number`
693
+
694
+ Runs policy evaluation and commits the resulting observation memory updates.
695
+
696
+ Parameters:
697
+ - `frameContext` - - Shared frame context for this logical frame.
698
+
699
+ Returns: Number of activation calls performed in the substep.
700
+
701
+ ### resolveBirdOutOfBounds
702
+
703
+ `(bird: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPopulationBird, visibleWorldHeightPx: number) => boolean`
704
+
705
+ Resolves whether a bird has exceeded the vertical play area.
706
+
707
+ Parameters:
708
+ - `bird` - - Mutable bird state.
709
+ - `visibleWorldHeightPx` - - Current visible world height.
710
+
711
+ Returns: `true` when the bird is outside the vertical bounds.
712
+
713
+ ### resolveBirdTerminationAndProgress
714
+
715
+ `(frameContext: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.types").WorkerPlaybackFrameContext) => void`
716
+
717
+ Resolves bird deaths and passed-pipe progress after motion is applied.
718
+
719
+ Parameters:
720
+ - `frameContext` - - Shared frame context for this logical frame.
721
+
722
+ Returns: Nothing.
723
+
724
+ ### resolveCameraLeftXPx
725
+
726
+ `(visibleWorldWidthPx: number) => number`
727
+
728
+ Resolves the current left-edge of the visible world in world-space pixels.
729
+
730
+ Parameters:
731
+ - `visibleWorldWidthPx` - - Current visible world width.
732
+
733
+ Returns: Left edge x-position in world coordinates.
734
+
735
+ ### runWorkerPopulationControlSubstep
736
+
737
+ `(frameContext: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.types").WorkerPlaybackFrameContext) => number`
738
+
739
+ Advances one control substep of the worker playback simulation.
740
+
741
+ Parameters:
742
+ - `frameContext` - - Shared frame context for this logical frame.
743
+
744
+ Returns: Number of activation calls performed in the substep.
745
+
746
+ ### spawnPipeIfNeeded
747
+
748
+ `(frameContext: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.types").WorkerPlaybackFrameContext) => void`
749
+
750
+ Spawns a new pipe when the substep budget crosses the spawn boundary.
751
+
752
+ Parameters:
753
+ - `frameContext` - - Shared frame context for this logical frame.
754
+
755
+ Returns: Nothing.
756
+
757
+ ### stepWorkerPopulationFrame
758
+
759
+ `(renderState: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPlaybackState, rng: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").RngLike, difficultyProfile: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedDifficultyProfile) => number`
760
+
761
+ Advances the whole population simulation by one logical frame.
762
+
763
+ Educational note:
764
+ One logical frame is internally split into smaller control substeps so the
765
+ worker can make flap decisions, apply gravity, move pipes, spawn new pipes,
766
+ and resolve collisions with better numerical stability than a single large
767
+ integration jump.
768
+
769
+ This function is the main simulation ownership boundary for the folder.
770
+ The companion `simulation.utils` file creates initial state; this service is
771
+ responsible for mutating that state over time.
772
+
773
+ Parameters:
774
+ - `renderState` - - Mutable simulation state.
775
+ - `rng` - - Deterministic random source for spawn variation.
776
+ - `difficultyProfile` - - Active dynamic difficulty profile.
777
+
778
+ Returns: Number of policy activation calls made in this frame.
779
+
780
+ ## flappy-evolution-worker/flappy-evolution-worker.snapshot.utils.ts
781
+
782
+ ### createWorkerPlaybackSnapshot
783
+
784
+ `(playbackState: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPlaybackState) => import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPlaybackFrameSnapshot`
785
+
786
+ Creates a serializable snapshot of current playback state.
787
+
788
+ Workers should send only structured-clone-safe payloads. This helper strips
789
+ runtime-only references (e.g., network instances, sets) and keeps only
790
+ renderer-relevant fields.
791
+
792
+ Educational note:
793
+ The snapshot is intentionally column-oriented. By packing values into typed
794
+ arrays, the worker can transfer large bird populations to the host with much
795
+ lower overhead than a per-frame array of nested objects.
796
+
797
+ This is a small example of a structure-of-arrays transport layout. If that
798
+ pattern is unfamiliar, the Wikipedia article on "AoS and SoA" is a good short
799
+ reference for why packed columns are often friendlier to hot-path data
800
+ movement than arrays of rich objects.
801
+
802
+ Parameters:
803
+ - `playbackState` - - Current mutable playback state.
804
+
805
+ Returns: Immutable frame snapshot for the host.
806
+
807
+ ### resolveWorkerPlaybackSnapshotTransferList
808
+
809
+ `(snapshot: import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPlaybackFrameSnapshot) => Transferable[]`
810
+
811
+ Resolves transferable buffers for one packed playback snapshot.
812
+
813
+ The returned buffers should be passed as the second argument to
814
+ `postMessage(...)` so ownership moves to the host thread instead of copying
815
+ the typed-array contents.
816
+
817
+ That ownership transfer is a large part of why the worker can stream full
818
+ population snapshots without forcing the main thread to pay unnecessary copy
819
+ costs every frame.
820
+
821
+ Parameters:
822
+ - `snapshot` - - Packed playback snapshot posted back to the browser host.
823
+
824
+ Returns: Transfer list used to move typed-array buffers without copying.
825
+
826
+ ## flappy-evolution-worker/flappy-evolution-worker.simulation.utils.ts
827
+
828
+ ### createWorkerPopulationRenderState
829
+
830
+ `(networks: import("src/architecture/network").default[], rng: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").RngLike, initialVisibleWorldWidthPx: number, initialVisibleWorldHeightPx: number) => import("test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types").WorkerPlaybackState`
831
+
832
+ Creates initial playback state for a population of networks.
833
+
834
+ Educational note:
835
+ This is the ownership boundary for worker playback initialization. The frame
836
+ simulation service mutates the returned state on every step, but only this
837
+ helper decides how a fresh population is placed into the world at time zero.
838
+
839
+ Parameters:
840
+ - `networks` - - Population to visualize.
841
+ - `rng` - - Deterministic random source.
842
+ - `initialVisibleWorldWidthPx` - - Initial viewport width from host.
843
+ - `initialVisibleWorldHeightPx` - - Initial viewport height from host.
844
+
845
+ Returns: Fresh mutable playback state.