@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.
- package/.github/copilot-instructions.md +11 -0
- package/.github/skills/trace-analyzer-extension/SKILL.md +3 -3
- package/.github/skills/trace-analyzer-extension/assets/extension-checklist.md +1 -1
- package/.github/skills/trace-analyzer-extension/references/analyzer-extension-workflow.md +1 -1
- package/.github/skills/trace-audit-reporting/SKILL.md +3 -3
- package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +1 -1
- package/package.json +19 -13
- package/plans/Flappy_Bird_Folder_Documentation_Pass.md +4 -4
- package/plans/README.md +24 -0
- package/plans/Roadmap.md +62 -40
- package/plans/analyze-trace-solid-split.plans.md +66 -0
- package/plans/architecture-solid-split.plans.md +9 -15
- package/plans/asciiMaze-typescript-repair.plans.md +1 -1
- package/plans/generate-docs-solid-split.plans.md +87 -0
- package/plans/methods-docs.plans.md +25 -1
- package/plans/methods-solid-split.plans.md +14 -14
- package/plans/neat-docs.plans.md +9 -1
- package/plans/neat-test-surface-repair.plans.md +1 -1
- package/plans/render-docs-html-solid-split.plans.md +68 -0
- package/plans/src-no-explicit-any-cleanup.plans.md +1 -1
- package/plans/utils-docs.plans.md +6 -1
- package/scripts/analyze-trace/analyze-trace.analysis.ts +479 -0
- package/scripts/analyze-trace/analyze-trace.constants.ts +35 -0
- package/scripts/analyze-trace/analyze-trace.io.ts +69 -0
- package/scripts/analyze-trace/analyze-trace.report.ts +100 -0
- package/scripts/analyze-trace/analyze-trace.shared.ts +116 -0
- package/scripts/analyze-trace/analyze-trace.ts +45 -0
- package/scripts/analyze-trace/analyze-trace.types.ts +72 -0
- package/scripts/assets/theme.css +80 -23
- package/scripts/copy-examples.ts +239 -0
- package/scripts/export-onnx.ts +223 -0
- package/scripts/generate-bench-tables.ts +378 -37
- package/scripts/generate-docs/generate-docs.constants.ts +107 -0
- package/scripts/generate-docs/generate-docs.order.ts +355 -0
- package/scripts/generate-docs/generate-docs.state.ts +31 -0
- package/scripts/generate-docs/generate-docs.targets.ts +165 -0
- package/scripts/generate-docs/generate-docs.ts +63 -0
- package/scripts/generate-docs/generate-docs.types.ts +112 -0
- package/scripts/generate-docs/output/generate-docs.output.folder-index.utils.ts +167 -0
- package/scripts/generate-docs/output/generate-docs.output.ordering.utils.ts +353 -0
- package/scripts/generate-docs/output/generate-docs.output.readme.utils.ts +420 -0
- package/scripts/generate-docs/output/generate-docs.output.ts +123 -0
- package/scripts/generate-docs/output/generate-docs.output.warnings.utils.ts +219 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.collection.utils.ts +365 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.jsdoc.utils.ts +373 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.normalize.utils.ts +155 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.render.utils.ts +149 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.signature.utils.ts +289 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.ts +11 -0
- package/scripts/mermaid-cli.mjs +102 -22
- package/scripts/mermaid-cli.ts +736 -0
- package/scripts/render-docs-html/render-docs-html.assets.ts +54 -0
- package/scripts/render-docs-html/render-docs-html.mermaid.ts +245 -0
- package/scripts/{render-docs-html.sidebar.ts → render-docs-html/render-docs-html.navigation.ts} +141 -144
- package/scripts/render-docs-html/render-docs-html.pages.ts +333 -0
- package/scripts/render-docs-html/render-docs-html.shared.ts +333 -0
- package/scripts/render-docs-html/render-docs-html.types.ts +42 -0
- package/scripts/render-docs-html.ts +23 -587
- package/scripts/run-docs.ts +238 -0
- package/scripts/write-dist-docs-pkg.ts +40 -0
- package/src/README.md +75 -75
- package/src/architecture/connection/README.md +5 -5
- package/src/architecture/layer/README.md +508 -508
- package/src/architecture/network/README.md +1458 -1458
- package/src/architecture/network/activate/README.md +694 -694
- package/src/architecture/network/bootstrap/README.md +77 -77
- package/src/architecture/network/connect/README.md +74 -74
- package/src/architecture/network/deterministic/README.md +135 -135
- package/src/architecture/network/evolve/README.md +364 -364
- package/src/architecture/network/gating/README.md +130 -130
- package/src/architecture/network/genetic/README.md +399 -399
- package/src/architecture/network/mutate/README.md +897 -897
- package/src/architecture/network/onnx/README.md +720 -720
- package/src/architecture/network/onnx/export/README.md +728 -728
- package/src/architecture/network/onnx/export/layers/README.md +450 -450
- package/src/architecture/network/onnx/import/README.md +618 -618
- package/src/architecture/network/onnx/schema/README.md +32 -32
- package/src/architecture/network/prune/README.md +245 -245
- package/src/architecture/network/remove/README.md +135 -135
- package/src/architecture/network/runtime/README.md +106 -106
- package/src/architecture/network/serialize/README.md +542 -542
- package/src/architecture/network/slab/README.md +608 -608
- package/src/architecture/network/standalone/README.md +212 -212
- package/src/architecture/network/stats/README.md +84 -84
- package/src/architecture/network/topology/README.md +465 -465
- package/src/architecture/network/training/README.md +200 -200
- package/src/architecture/node/README.md +5 -5
- package/src/architecture/nodePool/README.md +14 -14
- package/src/methods/README.md +99 -99
- package/src/methods/activation/README.md +189 -189
- package/src/methods/cost/README.md +131 -131
- package/src/methods/rate/README.md +86 -86
- package/src/multithreading/README.md +77 -77
- package/src/multithreading/workers/browser/README.md +8 -8
- package/src/multithreading/workers/node/README.md +8 -8
- package/src/neat/README.md +148 -148
- package/src/neat/adaptive/README.md +120 -120
- package/src/neat/adaptive/acceptance/README.md +40 -40
- package/src/neat/adaptive/complexity/README.md +137 -137
- package/src/neat/adaptive/core/README.md +197 -197
- package/src/neat/adaptive/lineage/README.md +90 -90
- package/src/neat/adaptive/mutation/README.md +284 -284
- package/src/neat/compat/README.md +43 -43
- package/src/neat/compat/core/README.md +90 -90
- package/src/neat/diversity/README.md +35 -35
- package/src/neat/diversity/core/README.md +88 -88
- package/src/neat/evaluate/README.md +85 -85
- package/src/neat/evaluate/auto-distance/README.md +75 -75
- package/src/neat/evaluate/entropy-compat/README.md +37 -37
- package/src/neat/evaluate/entropy-sharing/README.md +43 -43
- package/src/neat/evaluate/fitness/README.md +23 -23
- package/src/neat/evaluate/novelty/README.md +120 -120
- package/src/neat/evaluate/objectives/README.md +17 -17
- package/src/neat/evaluate/shared/README.md +94 -94
- package/src/neat/evolve/README.md +96 -96
- package/src/neat/evolve/adaptive/README.md +60 -60
- package/src/neat/evolve/objectives/README.md +63 -63
- package/src/neat/evolve/offspring/README.md +56 -56
- package/src/neat/evolve/population/README.md +171 -171
- package/src/neat/evolve/runtime/README.md +79 -79
- package/src/neat/evolve/speciation/README.md +74 -74
- package/src/neat/evolve/warnings/README.md +10 -10
- package/src/neat/export/README.md +114 -114
- package/src/neat/helpers/README.md +50 -50
- package/src/neat/init/README.md +9 -9
- package/src/neat/lineage/core/README.md +101 -101
- package/src/neat/multiobjective/category/README.md +74 -74
- package/src/neat/multiobjective/crowding/README.md +272 -272
- package/src/neat/multiobjective/dominance/README.md +171 -171
- package/src/neat/multiobjective/fronts/README.md +68 -68
- package/src/neat/multiobjective/metrics/README.md +43 -43
- package/src/neat/multiobjective/objectives/README.md +31 -31
- package/src/neat/multiobjective/shared/README.md +27 -27
- package/src/neat/mutation/README.md +97 -97
- package/src/neat/mutation/add-conn/README.md +115 -115
- package/src/neat/mutation/add-node/README.md +126 -126
- package/src/neat/mutation/flow/README.md +149 -149
- package/src/neat/mutation/repair/README.md +185 -185
- package/src/neat/mutation/select/README.md +117 -117
- package/src/neat/mutation/shared/README.md +32 -32
- package/src/neat/objectives/README.md +25 -25
- package/src/neat/objectives/core/README.md +67 -67
- package/src/neat/pruning/README.md +40 -40
- package/src/neat/pruning/core/README.md +171 -171
- package/src/neat/pruning/facade/README.md +32 -32
- package/src/neat/rng/README.md +104 -104
- package/src/neat/rng/core/README.md +137 -137
- package/src/neat/rng/facade/README.md +50 -50
- package/src/neat/selection/README.md +111 -111
- package/src/neat/selection/core/README.md +227 -227
- package/src/neat/selection/facade/README.md +61 -61
- package/src/neat/shared/README.md +163 -163
- package/src/neat/speciation/README.md +31 -31
- package/src/neat/speciation/threshold/README.md +35 -35
- package/src/neat/species/README.md +25 -25
- package/src/neat/species/core/README.md +20 -20
- package/src/neat/species/core/shared/README.md +18 -18
- package/src/neat/species/history/context/README.md +22 -22
- package/src/neat/telemetry/accessors/README.md +58 -58
- package/src/neat/telemetry/exports/README.md +233 -233
- package/src/neat/telemetry/facade/README.md +252 -252
- package/src/neat/telemetry/facade/archive/README.md +57 -57
- package/src/neat/telemetry/facade/buffer/README.md +43 -43
- package/src/neat/telemetry/facade/lineage/README.md +12 -12
- package/src/neat/telemetry/facade/objectives/README.md +44 -44
- package/src/neat/telemetry/facade/runtime/README.md +26 -26
- package/src/neat/telemetry/facade/species/README.md +27 -27
- package/src/neat/telemetry/metrics/README.md +696 -696
- package/src/neat/telemetry/recorder/README.md +57 -57
- package/src/neat/telemetry/types/README.md +32 -32
- package/src/neat/topology-intent/README.md +75 -75
- package/src/utils/README.md +193 -193
- package/test/examples/asciiMaze/browser-entry/README.md +92 -92
- package/test/examples/asciiMaze/dashboardManager/README.md +109 -109
- package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +28 -28
- package/test/examples/asciiMaze/evolutionEngine/README.md +1527 -1527
- package/test/examples/asciiMaze/mazeMovement/README.md +105 -105
- package/test/examples/asciiMaze/mazeMovement/finalization/README.md +16 -16
- package/test/examples/asciiMaze/mazeMovement/policy/README.md +57 -57
- package/test/examples/asciiMaze/mazeMovement/runtime/README.md +52 -52
- package/test/examples/asciiMaze/mazeMovement/shaping/README.md +46 -46
- package/test/examples/flappy_bird/browser-entry/README.md +508 -508
- package/test/examples/flappy_bird/browser-entry/host/README.md +101 -101
- package/test/examples/flappy_bird/browser-entry/host/resize/README.md +144 -144
- package/test/examples/flappy_bird/browser-entry/network-view/README.md +194 -194
- package/test/examples/flappy_bird/browser-entry/playback/README.md +278 -278
- package/test/examples/flappy_bird/browser-entry/playback/background/README.md +129 -129
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +502 -502
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +139 -139
- package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +10 -10
- package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +43 -43
- package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +30 -30
- package/test/examples/flappy_bird/browser-entry/runtime/README.md +59 -59
- package/test/examples/flappy_bird/browser-entry/visualization/README.md +276 -276
- package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +16 -16
- package/test/examples/flappy_bird/constants/README.md +1070 -1070
- package/test/examples/flappy_bird/environment/README.md +22 -22
- package/test/examples/flappy_bird/evaluation/README.md +32 -32
- package/test/examples/flappy_bird/evaluation/rollout/README.md +141 -141
- package/test/examples/flappy_bird/flappy-evolution-worker/README.md +425 -425
- package/test/examples/flappy_bird/simulation-shared/README.md +170 -170
- package/test/examples/flappy_bird/simulation-shared/observation/README.md +109 -109
- package/test/examples/flappy_bird/trainer/README.md +325 -325
- package/test/examples/flappy_bird/trainer/evaluation/README.md +74 -74
- package/scripts/analyze-trace.ts +0 -590
- package/scripts/copy-examples.mjs +0 -114
- package/scripts/export-onnx.mjs +0 -86
- package/scripts/generate-bench-tables.mjs +0 -182
- package/scripts/generate-docs.ts +0 -2900
- package/scripts/write-dist-docs-pkg.mjs +0 -16
|
@@ -52,101 +52,94 @@ flowchart LR
|
|
|
52
52
|
|
|
53
53
|
## neat/telemetry/exports/telemetry.exports.ts
|
|
54
54
|
|
|
55
|
-
###
|
|
55
|
+
### buildSpeciesHistoryCsv
|
|
56
56
|
|
|
57
57
|
```ts
|
|
58
|
-
|
|
58
|
+
buildSpeciesHistoryCsv(
|
|
59
|
+
recentHistory: SpeciesHistoryEntry[],
|
|
60
|
+
headers: string[],
|
|
61
|
+
): string
|
|
59
62
|
```
|
|
60
63
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
JSONL keeps the export path almost lossless: each telemetry entry is emitted
|
|
64
|
-
as one JSON object on one line, which makes the format easy to append to a
|
|
65
|
-
file, stream through command-line tools, or reload in notebook code without
|
|
66
|
-
flattening nested structures first.
|
|
64
|
+
Build the full CSV string for species history entries.
|
|
67
65
|
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
Species history exports are row-expanded: each generation snapshot can produce
|
|
67
|
+
multiple rows, one for each species stat recorded inside that generation. The
|
|
68
|
+
helper therefore writes a single shared header line and then flattens the
|
|
69
|
+
nested history structure into one CSV row per species snapshot.
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
The important teaching point is that species history is not a one-row-per-
|
|
72
|
+
generation export. A generation can contain several contemporaneous species,
|
|
73
|
+
so the serializer preserves that multiplicity instead of forcing species data
|
|
74
|
+
into one over-packed cell.
|
|
72
75
|
|
|
73
|
-
|
|
76
|
+
Parameters:
|
|
77
|
+
- `recentHistory` - - History entries to export.
|
|
78
|
+
- `headers` - - Ordered headers for the export window.
|
|
74
79
|
|
|
75
|
-
|
|
76
|
-
const jsonl = exportTelemetryJSONL.call(neat);
|
|
77
|
-
console.log(jsonl.split('\n').length);
|
|
78
|
-
```
|
|
80
|
+
Returns: Complete CSV payload.
|
|
79
81
|
|
|
80
|
-
###
|
|
82
|
+
### buildTelemetryHeaders
|
|
81
83
|
|
|
82
84
|
```ts
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
): string
|
|
85
|
+
buildTelemetryHeaders(
|
|
86
|
+
info: TelemetryHeaderInfo,
|
|
87
|
+
): string[]
|
|
86
88
|
```
|
|
87
89
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
This is the human-scanning export path. Instead of preserving the exact
|
|
91
|
-
object graph like JSONL does, it discovers a stable column set across the
|
|
92
|
-
sampled window and then flattens grouped metrics into prefixed columns.
|
|
90
|
+
Build the ordered header list for telemetry CSV output.
|
|
93
91
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
the sampled window,
|
|
99
|
-
- the most recent `maxEntries` records are exported to keep output bounded.
|
|
92
|
+
Once discovery is complete, this helper turns the collected key sets into the
|
|
93
|
+
final column order. Group prefixes such as `complexity.` and `perf.` preserve
|
|
94
|
+
meaning after flattening so spreadsheet readers can still tell which runtime
|
|
95
|
+
family a value came from.
|
|
100
96
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
97
|
+
The output order is intentionally grouped rather than purely alphabetical. It
|
|
98
|
+
keeps top-level run facts first, then nested metric families, then sparse
|
|
99
|
+
optional payload columns that behave more like attachments.
|
|
104
100
|
|
|
105
101
|
Parameters:
|
|
106
|
-
- `
|
|
107
|
-
- `maxEntries` - - Maximum number of recent telemetry rows to include.
|
|
102
|
+
- `info` - - Collected header discovery state.
|
|
108
103
|
|
|
109
|
-
Returns:
|
|
104
|
+
Returns: Ordered header names used for serialization.
|
|
110
105
|
|
|
111
|
-
|
|
106
|
+
### collectTelemetryHeaderInfo
|
|
112
107
|
|
|
113
108
|
```ts
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
collectTelemetryHeaderInfo(
|
|
110
|
+
entries: TelemetryEntry[],
|
|
111
|
+
): TelemetryHeaderInfo
|
|
116
112
|
```
|
|
117
113
|
|
|
118
|
-
|
|
114
|
+
Collect header metadata from the sampled telemetry entries.
|
|
119
115
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
```
|
|
116
|
+
This is the discovery pass that makes CSV exports deterministic. Instead of
|
|
117
|
+
assuming every telemetry entry has the same shape, the helper scans the
|
|
118
|
+
window first and records which base fields, grouped metrics, and optional
|
|
119
|
+
columns actually appear anywhere in the sample.
|
|
125
120
|
|
|
126
|
-
|
|
121
|
+
Conceptually, this is where an irregular event stream becomes a table plan.
|
|
122
|
+
The rest of the CSV path is simpler because this helper commits to one export
|
|
123
|
+
shape before row serialization starts.
|
|
127
124
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
recorded yet but live species data exists, the helper synthesizes a minimal
|
|
131
|
-
snapshot so early-run CSV exports remain deterministic.
|
|
125
|
+
Parameters:
|
|
126
|
+
- `entries` - - Telemetry entries included in the export window.
|
|
132
127
|
|
|
133
|
-
|
|
134
|
-
per telemetry entry, it expands each generation snapshot into one row per
|
|
135
|
-
species so a reader can inspect turnover, stagnation, and size changes with
|
|
136
|
-
ordinary tabular tools.
|
|
128
|
+
Returns: Flattened header discovery state.
|
|
137
129
|
|
|
138
|
-
|
|
139
|
-
- `this` - - Neat instance exposing species history and optional live species.
|
|
140
|
-
- `maxEntries` - - Maximum number of recent history snapshots to include.
|
|
130
|
+
### DEFAULT_SPECIES_BEST_SCORE
|
|
141
131
|
|
|
142
|
-
|
|
132
|
+
Default fallback best score when a synthesized history row lacks a score.
|
|
143
133
|
|
|
144
|
-
|
|
134
|
+
This preserves a numeric best-score column even when the runtime only has a
|
|
135
|
+
minimally reconstructed species snapshot.
|
|
145
136
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
137
|
+
### DEFAULT_SPECIES_HISTORY_GENERATION
|
|
138
|
+
|
|
139
|
+
Default fallback generation used when backfilling an early species snapshot.
|
|
140
|
+
|
|
141
|
+
The synthetic row still prefers the controller's live generation when it is
|
|
142
|
+
available. This constant is the final floor for partially initialized hosts.
|
|
150
143
|
|
|
151
144
|
### DEFAULT_SPECIES_HISTORY_MAX_ENTRIES
|
|
152
145
|
|
|
@@ -167,6 +160,14 @@ Default fallback species id when a synthesized history row lacks an id.
|
|
|
167
160
|
This only appears in the synthetic early-history path where live species
|
|
168
161
|
exist but a formal history snapshot has not been archived yet.
|
|
169
162
|
|
|
163
|
+
### DEFAULT_SPECIES_LAST_IMPROVED
|
|
164
|
+
|
|
165
|
+
Default fallback last-improved generation when a synthesized row lacks one.
|
|
166
|
+
|
|
167
|
+
A neutral default keeps the CSV shape deterministic without pretending the
|
|
168
|
+
exporter knows more improvement history than the controller has actually
|
|
169
|
+
recorded.
|
|
170
|
+
|
|
170
171
|
### DEFAULT_SPECIES_SIZE
|
|
171
172
|
|
|
172
173
|
Default fallback species size when a synthesized history row lacks a size.
|
|
@@ -175,84 +176,101 @@ The exporter prefers an explicit neutral size over leaving the cell absent so
|
|
|
175
176
|
spreadsheets and notebooks can still treat the backfilled row as a stable
|
|
176
177
|
member of the same column contract.
|
|
177
178
|
|
|
178
|
-
###
|
|
179
|
-
|
|
180
|
-
Default fallback best score when a synthesized history row lacks a score.
|
|
181
|
-
|
|
182
|
-
This preserves a numeric best-score column even when the runtime only has a
|
|
183
|
-
minimally reconstructed species snapshot.
|
|
184
|
-
|
|
185
|
-
### DEFAULT_SPECIES_LAST_IMPROVED
|
|
179
|
+
### exportSpeciesHistoryCSV
|
|
186
180
|
|
|
187
|
-
|
|
181
|
+
```ts
|
|
182
|
+
exportSpeciesHistoryCSV(
|
|
183
|
+
maxEntries: number,
|
|
184
|
+
): string
|
|
185
|
+
```
|
|
188
186
|
|
|
189
|
-
|
|
190
|
-
exporter knows more improvement history than the controller has actually
|
|
191
|
-
recorded.
|
|
187
|
+
Export species history snapshots to CSV.
|
|
192
188
|
|
|
193
|
-
|
|
189
|
+
The exporter preserves runtime-added species stat fields by discovering the
|
|
190
|
+
union of keys across the requested history window. When history has not been
|
|
191
|
+
recorded yet but live species data exists, the helper synthesizes a minimal
|
|
192
|
+
snapshot so early-run CSV exports remain deterministic.
|
|
194
193
|
|
|
195
|
-
|
|
194
|
+
This is the most timeline-oriented export in the chapter. Instead of one row
|
|
195
|
+
per telemetry entry, it expands each generation snapshot into one row per
|
|
196
|
+
species so a reader can inspect turnover, stagnation, and size changes with
|
|
197
|
+
ordinary tabular tools.
|
|
196
198
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
+
Parameters:
|
|
200
|
+
- `this` - - Neat instance exposing species history and optional live species.
|
|
201
|
+
- `maxEntries` - - Maximum number of recent history snapshots to include.
|
|
199
202
|
|
|
200
|
-
|
|
203
|
+
Returns: CSV payload describing one species row per generation snapshot.
|
|
201
204
|
|
|
202
|
-
|
|
205
|
+
Example:
|
|
203
206
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
207
|
+
```ts
|
|
208
|
+
const csv = exportSpeciesHistoryCSV.call(neat, 25);
|
|
209
|
+
console.log(csv.split('\n').slice(0, 2).join('\n'));
|
|
210
|
+
```
|
|
208
211
|
|
|
209
|
-
###
|
|
212
|
+
### exportTelemetryCSV
|
|
210
213
|
|
|
211
214
|
```ts
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
):
|
|
215
|
+
exportTelemetryCSV(
|
|
216
|
+
maxEntries: number,
|
|
217
|
+
): string
|
|
215
218
|
```
|
|
216
219
|
|
|
217
|
-
|
|
220
|
+
Export recent telemetry entries to a CSV string.
|
|
218
221
|
|
|
219
|
-
This is the
|
|
220
|
-
|
|
221
|
-
window
|
|
222
|
-
columns actually appear anywhere in the sample.
|
|
222
|
+
This is the human-scanning export path. Instead of preserving the exact
|
|
223
|
+
object graph like JSONL does, it discovers a stable column set across the
|
|
224
|
+
sampled window and then flattens grouped metrics into prefixed columns.
|
|
223
225
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
226
|
+
Flattening rules:
|
|
227
|
+
- nested `complexity`, `perf`, `lineage`, and selected `diversity` fields
|
|
228
|
+
become `group.key` columns,
|
|
229
|
+
- optional arrays and maps are serialized as JSON cells only when present in
|
|
230
|
+
the sampled window,
|
|
231
|
+
- the most recent `maxEntries` records are exported to keep output bounded.
|
|
232
|
+
|
|
233
|
+
Use this path when the reader question is comparative rather than archival:
|
|
234
|
+
you want to sort, filter, chart, or diff recent runtime behavior in a tool
|
|
235
|
+
that understands rows and columns better than nested objects.
|
|
227
236
|
|
|
228
237
|
Parameters:
|
|
229
|
-
- `
|
|
238
|
+
- `this` - - Neat instance exposing the internal telemetry buffer.
|
|
239
|
+
- `maxEntries` - - Maximum number of recent telemetry rows to include.
|
|
230
240
|
|
|
231
|
-
Returns:
|
|
241
|
+
Returns: CSV string containing headers plus one row per exported entry.
|
|
232
242
|
|
|
233
|
-
|
|
243
|
+
Example:
|
|
234
244
|
|
|
235
245
|
```ts
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
): string[]
|
|
246
|
+
const csv = exportTelemetryCSV.call(neat, 50);
|
|
247
|
+
console.log(csv.split('\n')[0]);
|
|
239
248
|
```
|
|
240
249
|
|
|
241
|
-
|
|
250
|
+
### exportTelemetryJSONL
|
|
242
251
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
family a value came from.
|
|
252
|
+
```ts
|
|
253
|
+
exportTelemetryJSONL(): string
|
|
254
|
+
```
|
|
247
255
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
256
|
+
Serialize telemetry as JSON Lines for stream-friendly log exports.
|
|
257
|
+
|
|
258
|
+
JSONL keeps the export path almost lossless: each telemetry entry is emitted
|
|
259
|
+
as one JSON object on one line, which makes the format easy to append to a
|
|
260
|
+
file, stream through command-line tools, or reload in notebook code without
|
|
261
|
+
flattening nested structures first.
|
|
251
262
|
|
|
252
263
|
Parameters:
|
|
253
|
-
- `
|
|
264
|
+
- `this` - - Neat instance exposing the internal telemetry buffer.
|
|
254
265
|
|
|
255
|
-
Returns:
|
|
266
|
+
Returns: JSONL payload with one telemetry object per line.
|
|
267
|
+
|
|
268
|
+
Example:
|
|
269
|
+
|
|
270
|
+
```ts
|
|
271
|
+
const jsonl = exportTelemetryJSONL.call(neat);
|
|
272
|
+
console.log(jsonl.split('\n').length);
|
|
273
|
+
```
|
|
256
274
|
|
|
257
275
|
### serializeTelemetryEntry
|
|
258
276
|
|
|
@@ -281,32 +299,14 @@ Parameters:
|
|
|
281
299
|
|
|
282
300
|
Returns: CSV row string.
|
|
283
301
|
|
|
284
|
-
###
|
|
285
|
-
|
|
286
|
-
```ts
|
|
287
|
-
buildSpeciesHistoryCsv(
|
|
288
|
-
recentHistory: SpeciesHistoryEntry[],
|
|
289
|
-
headers: string[],
|
|
290
|
-
): string
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
Build the full CSV string for species history entries.
|
|
294
|
-
|
|
295
|
-
Species history exports are row-expanded: each generation snapshot can produce
|
|
296
|
-
multiple rows, one for each species stat recorded inside that generation. The
|
|
297
|
-
helper therefore writes a single shared header line and then flattens the
|
|
298
|
-
nested history structure into one CSV row per species snapshot.
|
|
299
|
-
|
|
300
|
-
The important teaching point is that species history is not a one-row-per-
|
|
301
|
-
generation export. A generation can contain several contemporaneous species,
|
|
302
|
-
so the serializer preserves that multiplicity instead of forcing species data
|
|
303
|
-
into one over-packed cell.
|
|
302
|
+
### TelemetryHeaderInfo
|
|
304
303
|
|
|
305
|
-
|
|
306
|
-
- `recentHistory` - - History entries to export.
|
|
307
|
-
- `headers` - - Ordered headers for the export window.
|
|
304
|
+
Shape describing collected telemetry header discovery info.
|
|
308
305
|
|
|
309
|
-
|
|
306
|
+
Think of this as the temporary export blueprint for one CSV window. Before a
|
|
307
|
+
telemetry entry can be flattened into cells, the exporter needs to know which
|
|
308
|
+
top-level fields exist, which nested metric groups need prefixed columns, and
|
|
309
|
+
which optional arrays or maps appeared anywhere in the sampled window.
|
|
310
310
|
|
|
311
311
|
## neat/telemetry/exports/telemetry.exports.utils.ts
|
|
312
312
|
|
|
@@ -324,6 +324,39 @@ functions first answer the low-level questions: which columns exist in this
|
|
|
324
324
|
window, which optional structures actually appeared, which species-history
|
|
325
325
|
fields must be backfilled, and how should one value become one safe CSV cell.
|
|
326
326
|
|
|
327
|
+
### buildSpeciesHistoryStats
|
|
328
|
+
|
|
329
|
+
```ts
|
|
330
|
+
buildSpeciesHistoryStats(
|
|
331
|
+
speciesList: SpeciesHistoryStat[],
|
|
332
|
+
defaultSpeciesId: number,
|
|
333
|
+
defaultSpeciesSize: number,
|
|
334
|
+
defaultBestScore: number,
|
|
335
|
+
defaultLastImproved: number,
|
|
336
|
+
): SpeciesHistoryStat[]
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
Normalize raw species records into exportable history stats.
|
|
340
|
+
|
|
341
|
+
Runtime species objects can arrive with slightly different shapes depending
|
|
342
|
+
on when they were recorded or which legacy path produced them. This helper
|
|
343
|
+
converts those permissive records into one compact export-ready model with
|
|
344
|
+
explicit fallbacks for id, size, score, and last-improved generation.
|
|
345
|
+
|
|
346
|
+
Parameters:
|
|
347
|
+
- `speciesList` - - Raw species records to normalize.
|
|
348
|
+
- `defaultSpeciesId` - - Default species id when missing.
|
|
349
|
+
- `defaultSpeciesSize` - - Default species size when missing.
|
|
350
|
+
- `defaultBestScore` - - Default best score when missing.
|
|
351
|
+
- `defaultLastImproved` - - Default last improved when missing.
|
|
352
|
+
|
|
353
|
+
Returns: Normalized stats for CSV export.
|
|
354
|
+
|
|
355
|
+
Example:
|
|
356
|
+
|
|
357
|
+
const stats = buildSpeciesHistoryStats(neat._species ?? [], -1, 0, 0, 0);
|
|
358
|
+
console.log(stats.length);
|
|
359
|
+
|
|
327
360
|
### collectBaseKeys
|
|
328
361
|
|
|
329
362
|
```ts
|
|
@@ -347,47 +380,47 @@ Parameters:
|
|
|
347
380
|
|
|
348
381
|
Returns: void. Mutates `state.baseKeys`.
|
|
349
382
|
|
|
350
|
-
###
|
|
383
|
+
### collectDiversityLineageMetrics
|
|
351
384
|
|
|
352
385
|
```ts
|
|
353
|
-
|
|
386
|
+
collectDiversityLineageMetrics(
|
|
354
387
|
entry: TelemetryEntry,
|
|
355
388
|
state: TelemetryHeaderCollectionState,
|
|
356
389
|
): void
|
|
357
390
|
```
|
|
358
391
|
|
|
359
|
-
Collect
|
|
392
|
+
Collect curated diversity lineage metrics for stable CSV exports.
|
|
360
393
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
394
|
+
Diversity objects can contain more information than the CSV surface needs.
|
|
395
|
+
This helper intentionally exports only the lineage-related diversity metrics
|
|
396
|
+
that are useful and stable enough to deserve fixed columns.
|
|
364
397
|
|
|
365
398
|
Parameters:
|
|
366
399
|
- `entry` - - Telemetry entry to inspect.
|
|
367
400
|
- `state` - - Mutable header collection state.
|
|
368
401
|
|
|
369
|
-
Returns: void. Mutates
|
|
402
|
+
Returns: void. Mutates diversity lineage key set.
|
|
370
403
|
|
|
371
|
-
###
|
|
404
|
+
### collectGroupedMetricKeys
|
|
372
405
|
|
|
373
406
|
```ts
|
|
374
|
-
|
|
407
|
+
collectGroupedMetricKeys(
|
|
375
408
|
entry: TelemetryEntry,
|
|
376
409
|
state: TelemetryHeaderCollectionState,
|
|
377
410
|
): void
|
|
378
411
|
```
|
|
379
412
|
|
|
380
|
-
Collect
|
|
413
|
+
Collect nested metric keys for grouped telemetry fields.
|
|
381
414
|
|
|
382
|
-
|
|
383
|
-
This helper
|
|
384
|
-
|
|
415
|
+
Grouped telemetry objects such as `complexity`, `perf`, and `lineage` become
|
|
416
|
+
prefixed CSV columns. This helper discovers those nested keys without mixing
|
|
417
|
+
them into the base top-level header set.
|
|
385
418
|
|
|
386
419
|
Parameters:
|
|
387
420
|
- `entry` - - Telemetry entry to inspect.
|
|
388
421
|
- `state` - - Mutable header collection state.
|
|
389
422
|
|
|
390
|
-
Returns: void. Mutates
|
|
423
|
+
Returns: void. Mutates complexity/perf/lineage key sets.
|
|
391
424
|
|
|
392
425
|
### collectOptionalColumnPresence
|
|
393
426
|
|
|
@@ -411,24 +444,26 @@ Parameters:
|
|
|
411
444
|
|
|
412
445
|
Returns: void. Mutates optional-column flags.
|
|
413
446
|
|
|
414
|
-
###
|
|
447
|
+
### collectSpeciesHistoryHeaders
|
|
415
448
|
|
|
416
449
|
```ts
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
450
|
+
collectSpeciesHistoryHeaders(
|
|
451
|
+
history: SpeciesHistoryEntry[],
|
|
452
|
+
generationHeader: string,
|
|
453
|
+
): string[]
|
|
420
454
|
```
|
|
421
455
|
|
|
422
|
-
|
|
456
|
+
Collect ordered header keys for species history CSV export.
|
|
423
457
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
458
|
+
Species history rows can grow new fields over time. This helper scans the
|
|
459
|
+
selected history window and builds the union of all encountered stat keys so
|
|
460
|
+
every emitted row follows one shared, predictable column order.
|
|
427
461
|
|
|
428
462
|
Parameters:
|
|
429
|
-
- `
|
|
463
|
+
- `history` - - Recent species history entries.
|
|
464
|
+
- `generationHeader` - - Header label for generation column.
|
|
430
465
|
|
|
431
|
-
Returns:
|
|
466
|
+
Returns: Ordered header list for CSV output.
|
|
432
467
|
|
|
433
468
|
### ensureMinimalSpeciesSnapshot
|
|
434
469
|
|
|
@@ -467,85 +502,24 @@ Example:
|
|
|
467
502
|
const history = ensureSpeciesHistoryArray(neat);
|
|
468
503
|
ensureMinimalSpeciesSnapshot(neat, history, 0, -1, 0, 0, 0);
|
|
469
504
|
|
|
470
|
-
###
|
|
471
|
-
|
|
472
|
-
```ts
|
|
473
|
-
collectSpeciesHistoryHeaders(
|
|
474
|
-
history: SpeciesHistoryEntry[],
|
|
475
|
-
generationHeader: string,
|
|
476
|
-
): string[]
|
|
477
|
-
```
|
|
478
|
-
|
|
479
|
-
Collect ordered header keys for species history CSV export.
|
|
480
|
-
|
|
481
|
-
Species history rows can grow new fields over time. This helper scans the
|
|
482
|
-
selected history window and builds the union of all encountered stat keys so
|
|
483
|
-
every emitted row follows one shared, predictable column order.
|
|
484
|
-
|
|
485
|
-
Parameters:
|
|
486
|
-
- `history` - - Recent species history entries.
|
|
487
|
-
- `generationHeader` - - Header label for generation column.
|
|
488
|
-
|
|
489
|
-
Returns: Ordered header list for CSV output.
|
|
490
|
-
|
|
491
|
-
### buildSpeciesHistoryStats
|
|
492
|
-
|
|
493
|
-
```ts
|
|
494
|
-
buildSpeciesHistoryStats(
|
|
495
|
-
speciesList: SpeciesHistoryStat[],
|
|
496
|
-
defaultSpeciesId: number,
|
|
497
|
-
defaultSpeciesSize: number,
|
|
498
|
-
defaultBestScore: number,
|
|
499
|
-
defaultLastImproved: number,
|
|
500
|
-
): SpeciesHistoryStat[]
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
Normalize raw species records into exportable history stats.
|
|
504
|
-
|
|
505
|
-
Runtime species objects can arrive with slightly different shapes depending
|
|
506
|
-
on when they were recorded or which legacy path produced them. This helper
|
|
507
|
-
converts those permissive records into one compact export-ready model with
|
|
508
|
-
explicit fallbacks for id, size, score, and last-improved generation.
|
|
509
|
-
|
|
510
|
-
Parameters:
|
|
511
|
-
- `speciesList` - - Raw species records to normalize.
|
|
512
|
-
- `defaultSpeciesId` - - Default species id when missing.
|
|
513
|
-
- `defaultSpeciesSize` - - Default species size when missing.
|
|
514
|
-
- `defaultBestScore` - - Default best score when missing.
|
|
515
|
-
- `defaultLastImproved` - - Default last improved when missing.
|
|
516
|
-
|
|
517
|
-
Returns: Normalized stats for CSV export.
|
|
518
|
-
|
|
519
|
-
Example:
|
|
520
|
-
|
|
521
|
-
const stats = buildSpeciesHistoryStats(neat._species ?? [], -1, 0, 0, 0);
|
|
522
|
-
console.log(stats.length);
|
|
523
|
-
|
|
524
|
-
### serializeSpeciesHistoryRow
|
|
505
|
+
### ensureSpeciesHistoryArray
|
|
525
506
|
|
|
526
507
|
```ts
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
orderedHeaders: string[],
|
|
531
|
-
generationHeader: string,
|
|
532
|
-
): string
|
|
508
|
+
ensureSpeciesHistoryArray(
|
|
509
|
+
neatInstance: NeatLike & { _speciesHistory?: SpeciesHistoryEntry[] | undefined; },
|
|
510
|
+
): SpeciesHistoryEntry[]
|
|
533
511
|
```
|
|
534
512
|
|
|
535
|
-
|
|
513
|
+
Ensure the species history array exists on the Neat instance.
|
|
536
514
|
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
omit optional fields.
|
|
515
|
+
This helper gives the CSV path one stable backing array to work with, even in
|
|
516
|
+
early or partially initialized controller states. It keeps later export code
|
|
517
|
+
focused on serialization instead of defensive host checks.
|
|
541
518
|
|
|
542
519
|
Parameters:
|
|
543
|
-
- `
|
|
544
|
-
- `speciesStat` - - A single species stat record for that generation.
|
|
545
|
-
- `orderedHeaders` - - Ordered header list for stable CSV.
|
|
546
|
-
- `generationHeader` - - Column header name for generation.
|
|
520
|
+
- `neatInstance` - - Neat instance holding species history.
|
|
547
521
|
|
|
548
|
-
Returns:
|
|
522
|
+
Returns: Species history backing array (ensured on instance).
|
|
549
523
|
|
|
550
524
|
### resolveSpeciesHistoryCellValue
|
|
551
525
|
|
|
@@ -591,6 +565,32 @@ Parameters:
|
|
|
591
565
|
|
|
592
566
|
Returns: JSON string or empty string when JSON.stringify returns undefined.
|
|
593
567
|
|
|
568
|
+
### serializeSpeciesHistoryRow
|
|
569
|
+
|
|
570
|
+
```ts
|
|
571
|
+
serializeSpeciesHistoryRow(
|
|
572
|
+
historyEntry: SpeciesHistoryEntry,
|
|
573
|
+
speciesStat: SpeciesHistoryStat,
|
|
574
|
+
orderedHeaders: string[],
|
|
575
|
+
generationHeader: string,
|
|
576
|
+
): string
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
Serialize one species history row using the provided headers.
|
|
580
|
+
|
|
581
|
+
Species history CSV output is built row by row from one generation snapshot
|
|
582
|
+
plus one species stat record. This helper guarantees that each row follows
|
|
583
|
+
the same previously collected header order, even when some species records
|
|
584
|
+
omit optional fields.
|
|
585
|
+
|
|
586
|
+
Parameters:
|
|
587
|
+
- `historyEntry` - - A single generation snapshot.
|
|
588
|
+
- `speciesStat` - - A single species stat record for that generation.
|
|
589
|
+
- `orderedHeaders` - - Ordered header list for stable CSV.
|
|
590
|
+
- `generationHeader` - - Column header name for generation.
|
|
591
|
+
|
|
592
|
+
Returns: CSV row string matching the provided header order.
|
|
593
|
+
|
|
594
594
|
### TelemetryHeaderCollectionState
|
|
595
595
|
|
|
596
596
|
Mutable state container used while collecting telemetry header metadata.
|