@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
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Orchestrates the docs pipeline with one docs-scripts build and parallelized
|
|
3
|
+
* independent steps.
|
|
4
|
+
*
|
|
5
|
+
* This keeps the user-facing `npm run docs` and `npm run docs:folders`
|
|
6
|
+
* commands simple while removing repeated `docs:build-scripts` work and
|
|
7
|
+
* parallelizing the safe parts of the pipeline.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { spawn, type ChildProcess } from 'node:child_process';
|
|
11
|
+
|
|
12
|
+
const ALL_MODE = 'all';
|
|
13
|
+
const FOLDERS_MODE = 'folders';
|
|
14
|
+
const SUPPORTED_MODES = new Set([ALL_MODE, FOLDERS_MODE]);
|
|
15
|
+
|
|
16
|
+
interface ScriptTask {
|
|
17
|
+
label: string;
|
|
18
|
+
scriptName: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface RunningTask {
|
|
22
|
+
childProcess: ChildProcess;
|
|
23
|
+
command: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface SpawnedCommand {
|
|
27
|
+
command: string;
|
|
28
|
+
executable: string;
|
|
29
|
+
argumentsToPass: string[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function main(): Promise<void> {
|
|
33
|
+
const requestedMode = process.argv[2] ?? ALL_MODE;
|
|
34
|
+
ensureSupportedMode(requestedMode);
|
|
35
|
+
|
|
36
|
+
if (requestedMode === FOLDERS_MODE) {
|
|
37
|
+
await runFoldersWorkflow();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
await runFullDocsWorkflow();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function runFullDocsWorkflow(): Promise<void> {
|
|
45
|
+
// Step 1: Build the browser example bundles in parallel.
|
|
46
|
+
await runScriptTasksInParallel([
|
|
47
|
+
{ label: 'ASCII Maze bundle', scriptName: 'build:ascii-maze' },
|
|
48
|
+
{ label: 'Flappy worker bundle', scriptName: 'build:flappy-worker' },
|
|
49
|
+
{ label: 'Flappy Bird bundle', scriptName: 'build:flappy-bird' },
|
|
50
|
+
]);
|
|
51
|
+
|
|
52
|
+
// Step 2: Generate copied example assets and folder docs in parallel.
|
|
53
|
+
await runScriptTasksInParallel([
|
|
54
|
+
{ label: 'Examples copy', scriptName: 'docs:examples:built' },
|
|
55
|
+
{ label: 'Source folder docs', scriptName: 'docs:folders:src:built' },
|
|
56
|
+
{
|
|
57
|
+
label: 'ASCII Maze folder docs',
|
|
58
|
+
scriptName: 'docs:folders:asciiMaze:built',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: 'Flappy Bird folder docs',
|
|
62
|
+
scriptName: 'docs:folders:flappy-bird:built',
|
|
63
|
+
},
|
|
64
|
+
]);
|
|
65
|
+
|
|
66
|
+
// Step 3: Render the final HTML site after content generation finishes.
|
|
67
|
+
await runScriptTask({
|
|
68
|
+
label: 'HTML docs render',
|
|
69
|
+
scriptName: 'docs:html:built',
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function runFoldersWorkflow(): Promise<void> {
|
|
74
|
+
await runScriptTasksInParallel([
|
|
75
|
+
{ label: 'Source folder docs', scriptName: 'docs:folders:src:built' },
|
|
76
|
+
{
|
|
77
|
+
label: 'ASCII Maze folder docs',
|
|
78
|
+
scriptName: 'docs:folders:asciiMaze:built',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
label: 'Flappy Bird folder docs',
|
|
82
|
+
scriptName: 'docs:folders:flappy-bird:built',
|
|
83
|
+
},
|
|
84
|
+
]);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function ensureSupportedMode(
|
|
88
|
+
requestedMode: string,
|
|
89
|
+
): asserts requestedMode is 'all' | 'folders' {
|
|
90
|
+
if (!SUPPORTED_MODES.has(requestedMode)) {
|
|
91
|
+
throw new Error(
|
|
92
|
+
`Unsupported docs mode "${requestedMode}". Expected one of: ${[...SUPPORTED_MODES].join(', ')}`,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async function runScriptTasksInParallel(
|
|
98
|
+
scriptTasks: readonly ScriptTask[],
|
|
99
|
+
): Promise<void> {
|
|
100
|
+
if (scriptTasks.length === 0) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
await new Promise<void>((resolve, reject) => {
|
|
105
|
+
const runningTasks: RunningTask[] = [];
|
|
106
|
+
let completedTaskCount = 0;
|
|
107
|
+
let hasSettled = false;
|
|
108
|
+
|
|
109
|
+
for (const scriptTask of scriptTasks) {
|
|
110
|
+
const spawnedCommand = createNpmRunCommand(scriptTask.scriptName);
|
|
111
|
+
const childProcess = spawn(
|
|
112
|
+
spawnedCommand.executable,
|
|
113
|
+
spawnedCommand.argumentsToPass,
|
|
114
|
+
{
|
|
115
|
+
stdio: 'inherit',
|
|
116
|
+
},
|
|
117
|
+
);
|
|
118
|
+
runningTasks.push({ childProcess, command: spawnedCommand.command });
|
|
119
|
+
|
|
120
|
+
childProcess.once('error', (error) => {
|
|
121
|
+
if (hasSettled) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
hasSettled = true;
|
|
126
|
+
stopSiblingProcesses(runningTasks, childProcess);
|
|
127
|
+
reject(
|
|
128
|
+
new Error(
|
|
129
|
+
`Failed to start ${scriptTask.label} (${scriptTask.scriptName}): ${error.message}`,
|
|
130
|
+
{ cause: error },
|
|
131
|
+
),
|
|
132
|
+
);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
childProcess.once('exit', (exitCode, signal) => {
|
|
136
|
+
if (hasSettled) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (exitCode === 0) {
|
|
141
|
+
completedTaskCount += 1;
|
|
142
|
+
if (completedTaskCount === scriptTasks.length) {
|
|
143
|
+
hasSettled = true;
|
|
144
|
+
resolve();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
hasSettled = true;
|
|
151
|
+
stopSiblingProcesses(runningTasks, childProcess);
|
|
152
|
+
reject(
|
|
153
|
+
new Error(
|
|
154
|
+
`${scriptTask.label} (${scriptTask.scriptName}) failed with exit code ${exitCode ?? 'null'}${signal ? ` and signal ${signal}` : ''}.`,
|
|
155
|
+
),
|
|
156
|
+
);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async function runScriptTask(scriptTask: ScriptTask): Promise<void> {
|
|
163
|
+
await runScriptTasksInParallel([scriptTask]);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function createNpmRunCommand(scriptName: string): SpawnedCommand {
|
|
167
|
+
const npmExecutablePath = process.env.npm_execpath;
|
|
168
|
+
|
|
169
|
+
if (npmExecutablePath) {
|
|
170
|
+
const argumentsToPass = [npmExecutablePath, 'run', scriptName];
|
|
171
|
+
|
|
172
|
+
return {
|
|
173
|
+
command: `${process.execPath} ${argumentsToPass.join(' ')}`,
|
|
174
|
+
executable: process.execPath,
|
|
175
|
+
argumentsToPass,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (process.platform === 'win32') {
|
|
180
|
+
const executable = process.env.ComSpec ?? 'cmd.exe';
|
|
181
|
+
const argumentsToPass = ['/d', '/s', '/c', 'npm.cmd', 'run', scriptName];
|
|
182
|
+
|
|
183
|
+
return {
|
|
184
|
+
command: `${executable} ${argumentsToPass.join(' ')}`,
|
|
185
|
+
executable,
|
|
186
|
+
argumentsToPass,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const executable = 'npm';
|
|
191
|
+
const argumentsToPass = ['run', scriptName];
|
|
192
|
+
|
|
193
|
+
return {
|
|
194
|
+
command: `${executable} ${argumentsToPass.join(' ')}`,
|
|
195
|
+
executable,
|
|
196
|
+
argumentsToPass,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function stopSiblingProcesses(
|
|
201
|
+
runningTasks: readonly RunningTask[],
|
|
202
|
+
excludedProcess: ChildProcess,
|
|
203
|
+
): void {
|
|
204
|
+
for (const { childProcess } of runningTasks) {
|
|
205
|
+
if (childProcess === excludedProcess || childProcess.killed) {
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
try {
|
|
210
|
+
stopProcess(childProcess);
|
|
211
|
+
} catch {
|
|
212
|
+
// Best-effort shutdown only.
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function stopProcess(childProcess: ChildProcess): void {
|
|
218
|
+
const processId = childProcess.pid;
|
|
219
|
+
|
|
220
|
+
if (processId === undefined) {
|
|
221
|
+
childProcess.kill();
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (process.platform === 'win32') {
|
|
226
|
+
spawn('taskkill', ['/pid', String(processId), '/t', '/f'], {
|
|
227
|
+
stdio: 'ignore',
|
|
228
|
+
}).unref();
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
childProcess.kill();
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
main().catch((error) => {
|
|
236
|
+
console.error(error);
|
|
237
|
+
process.exit(1);
|
|
238
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Writes a minimal package.json into dist-docs designating ESM for generated
|
|
3
|
+
* scripts.
|
|
4
|
+
*
|
|
5
|
+
* Keeping this as a tiny compiled TypeScript utility aligns the scripts folder
|
|
6
|
+
* on one file type while preserving the same post-compile behavior.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import fs from 'node:fs';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
|
|
12
|
+
const DIST_DOCS_DIRECTORY_PATH = path.resolve('dist-docs');
|
|
13
|
+
const DIST_DOCS_PACKAGE_PATH = path.join(
|
|
14
|
+
DIST_DOCS_DIRECTORY_PATH,
|
|
15
|
+
'package.json',
|
|
16
|
+
);
|
|
17
|
+
const DIST_DOCS_PACKAGE_JSON = {
|
|
18
|
+
type: 'module',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Writes the `dist-docs/package.json` manifest.
|
|
23
|
+
*
|
|
24
|
+
* @returns Nothing.
|
|
25
|
+
*/
|
|
26
|
+
function main(): void {
|
|
27
|
+
try {
|
|
28
|
+
fs.mkdirSync(DIST_DOCS_DIRECTORY_PATH, { recursive: true });
|
|
29
|
+
fs.writeFileSync(
|
|
30
|
+
DIST_DOCS_PACKAGE_PATH,
|
|
31
|
+
`${JSON.stringify(DIST_DOCS_PACKAGE_JSON, null, 2)}\n`,
|
|
32
|
+
);
|
|
33
|
+
console.log('[docs] Wrote dist-docs/package.json (type=module)');
|
|
34
|
+
} catch (error) {
|
|
35
|
+
console.error('[docs] Failed to write dist-docs/package.json', error);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
main();
|
package/src/README.md
CHANGED
|
@@ -38,40 +38,6 @@ Recommended reading after this root chapter:
|
|
|
38
38
|
|
|
39
39
|
## neat.ts
|
|
40
40
|
|
|
41
|
-
### NeatOptions
|
|
42
|
-
|
|
43
|
-
Public configuration bag for `Neat` evolutionary runs.
|
|
44
|
-
|
|
45
|
-
`NeatOptions` collects the knobs that shape how search pressure is applied.
|
|
46
|
-
In practice, readers can think about the options in four teaching-friendly groups:
|
|
47
|
-
|
|
48
|
-
- search size and tempo: `popsize`, `elitism`, `provenance`, `mutationRate`, `mutationAmount`
|
|
49
|
-
- species formation: compatibility threshold plus the excess, disjoint, and weight-difference coefficients
|
|
50
|
-
- observability: telemetry, lineage, diversity sampling, species history, Pareto archive controls
|
|
51
|
-
- reproducibility: `seed`, imported RNG state, and exported run state
|
|
52
|
-
|
|
53
|
-
That organization matters because most experiment tuning questions are really
|
|
54
|
-
questions about pressure: how many candidates compete, how disruptive mutation
|
|
55
|
-
should feel, how aggressively genomes split into species, and how much evidence
|
|
56
|
-
you want to retain while the run is unfolding.
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
const options: NeatOptions = {
|
|
60
|
-
popsize: 150,
|
|
61
|
-
elitism: 5,
|
|
62
|
-
mutationRate: 0.6,
|
|
63
|
-
compatibilityThreshold: 3,
|
|
64
|
-
fastMode: true,
|
|
65
|
-
seed: 42,
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const neat = new Neat(3, 1, fitness, options);
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
This alias stays intentionally permissive for compatibility with legacy callers.
|
|
72
|
-
Prefer treating it as the stable front door and the narrower helper-level types in
|
|
73
|
-
`src/neat/**` as implementation detail.
|
|
74
|
-
|
|
75
41
|
### DEFAULT_COMPATIBILITY_THRESHOLD
|
|
76
42
|
|
|
77
43
|
Default compatibility threshold controlling speciation distance.
|
|
@@ -1189,6 +1155,40 @@ reconstructed by other means.
|
|
|
1189
1155
|
|
|
1190
1156
|
Returns: JSON-safe metadata snapshot useful for innovation-history persistence.
|
|
1191
1157
|
|
|
1158
|
+
### NeatOptions
|
|
1159
|
+
|
|
1160
|
+
Public configuration bag for `Neat` evolutionary runs.
|
|
1161
|
+
|
|
1162
|
+
`NeatOptions` collects the knobs that shape how search pressure is applied.
|
|
1163
|
+
In practice, readers can think about the options in four teaching-friendly groups:
|
|
1164
|
+
|
|
1165
|
+
- search size and tempo: `popsize`, `elitism`, `provenance`, `mutationRate`, `mutationAmount`
|
|
1166
|
+
- species formation: compatibility threshold plus the excess, disjoint, and weight-difference coefficients
|
|
1167
|
+
- observability: telemetry, lineage, diversity sampling, species history, Pareto archive controls
|
|
1168
|
+
- reproducibility: `seed`, imported RNG state, and exported run state
|
|
1169
|
+
|
|
1170
|
+
That organization matters because most experiment tuning questions are really
|
|
1171
|
+
questions about pressure: how many candidates compete, how disruptive mutation
|
|
1172
|
+
should feel, how aggressively genomes split into species, and how much evidence
|
|
1173
|
+
you want to retain while the run is unfolding.
|
|
1174
|
+
|
|
1175
|
+
```ts
|
|
1176
|
+
const options: NeatOptions = {
|
|
1177
|
+
popsize: 150,
|
|
1178
|
+
elitism: 5,
|
|
1179
|
+
mutationRate: 0.6,
|
|
1180
|
+
compatibilityThreshold: 3,
|
|
1181
|
+
fastMode: true,
|
|
1182
|
+
seed: 42,
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
const neat = new Neat(3, 1, fitness, options);
|
|
1186
|
+
```
|
|
1187
|
+
|
|
1188
|
+
This alias stays intentionally permissive for compatibility with legacy callers.
|
|
1189
|
+
Prefer treating it as the stable front door and the narrower helper-level types in
|
|
1190
|
+
`src/neat/**` as implementation detail.
|
|
1191
|
+
|
|
1192
1192
|
## config.ts
|
|
1193
1193
|
|
|
1194
1194
|
Global NeatapticTS configuration contract & default instance.
|
|
@@ -1241,6 +1241,47 @@ DESIGN NOTES
|
|
|
1241
1241
|
|
|
1242
1242
|
## neataptic.ts
|
|
1243
1243
|
|
|
1244
|
+
### neataptic
|
|
1245
|
+
|
|
1246
|
+
Node (Neuron)
|
|
1247
|
+
=============
|
|
1248
|
+
Fundamental computational unit: aggregates weighted inputs, applies an activation
|
|
1249
|
+
function (squash) and emits an activation value. Supports:
|
|
1250
|
+
- Types: 'input' | 'hidden' | 'output' (affects bias initialization & error handling)
|
|
1251
|
+
- Recurrent self‑connections & gated connections (for dynamic / RNN behavior)
|
|
1252
|
+
- Dropout mask (`mask`), momentum terms, eligibility & extended traces (for
|
|
1253
|
+
a variety of learning rules beyond simple backprop).
|
|
1254
|
+
|
|
1255
|
+
Educational note: Traces (`eligibility` and `xtrace`) illustrate how recurrent credit
|
|
1256
|
+
assignment works in algorithms like RTRL / policy gradients. They are updated only when
|
|
1257
|
+
using the traced activation path (`activate`) vs `noTraceActivate` (inference fast path).
|
|
1258
|
+
|
|
1259
|
+
Examples:
|
|
1260
|
+
|
|
1261
|
+
```ts
|
|
1262
|
+
const encoderBlock = new Group(4);
|
|
1263
|
+
const decoderBlock = new Group(4);
|
|
1264
|
+
|
|
1265
|
+
encoderBlock.connect(
|
|
1266
|
+
decoderBlock,
|
|
1267
|
+
methods.groupConnection.ONE_TO_ONE,
|
|
1268
|
+
);
|
|
1269
|
+
```
|
|
1270
|
+
|
|
1271
|
+
```ts
|
|
1272
|
+
const source = new Node('input');
|
|
1273
|
+
const target = new Node('output');
|
|
1274
|
+
const edge = new Connection(source, target, 0.42);
|
|
1275
|
+
|
|
1276
|
+
edge.gain = 1.5;
|
|
1277
|
+
edge.enabled = true;
|
|
1278
|
+
```
|
|
1279
|
+
|
|
1280
|
+
```ts
|
|
1281
|
+
const network = Architect.perceptron(2, 4, 1);
|
|
1282
|
+
const output = network.activate([0, 1]);
|
|
1283
|
+
```
|
|
1284
|
+
|
|
1244
1285
|
### Neat
|
|
1245
1286
|
|
|
1246
1287
|
High-level NEAT controller that keeps the public workflow linear while the implementation stays chaptered.
|
|
@@ -2236,47 +2277,6 @@ reconstructed by other means.
|
|
|
2236
2277
|
|
|
2237
2278
|
Returns: JSON-safe metadata snapshot useful for innovation-history persistence.
|
|
2238
2279
|
|
|
2239
|
-
### neataptic
|
|
2240
|
-
|
|
2241
|
-
Node (Neuron)
|
|
2242
|
-
=============
|
|
2243
|
-
Fundamental computational unit: aggregates weighted inputs, applies an activation
|
|
2244
|
-
function (squash) and emits an activation value. Supports:
|
|
2245
|
-
- Types: 'input' | 'hidden' | 'output' (affects bias initialization & error handling)
|
|
2246
|
-
- Recurrent self‑connections & gated connections (for dynamic / RNN behavior)
|
|
2247
|
-
- Dropout mask (`mask`), momentum terms, eligibility & extended traces (for
|
|
2248
|
-
a variety of learning rules beyond simple backprop).
|
|
2249
|
-
|
|
2250
|
-
Educational note: Traces (`eligibility` and `xtrace`) illustrate how recurrent credit
|
|
2251
|
-
assignment works in algorithms like RTRL / policy gradients. They are updated only when
|
|
2252
|
-
using the traced activation path (`activate`) vs `noTraceActivate` (inference fast path).
|
|
2253
|
-
|
|
2254
|
-
Examples:
|
|
2255
|
-
|
|
2256
|
-
```ts
|
|
2257
|
-
const encoderBlock = new Group(4);
|
|
2258
|
-
const decoderBlock = new Group(4);
|
|
2259
|
-
|
|
2260
|
-
encoderBlock.connect(
|
|
2261
|
-
decoderBlock,
|
|
2262
|
-
methods.groupConnection.ONE_TO_ONE,
|
|
2263
|
-
);
|
|
2264
|
-
```
|
|
2265
|
-
|
|
2266
|
-
```ts
|
|
2267
|
-
const source = new Node('input');
|
|
2268
|
-
const target = new Node('output');
|
|
2269
|
-
const edge = new Connection(source, target, 0.42);
|
|
2270
|
-
|
|
2271
|
-
edge.gain = 1.5;
|
|
2272
|
-
edge.enabled = true;
|
|
2273
|
-
```
|
|
2274
|
-
|
|
2275
|
-
```ts
|
|
2276
|
-
const network = Architect.perceptron(2, 4, 1);
|
|
2277
|
-
const output = network.activate([0, 1]);
|
|
2278
|
-
```
|
|
2279
|
-
|
|
2280
2280
|
### default
|
|
2281
2281
|
|
|
2282
2282
|
#### _activateCore
|
|
@@ -29,11 +29,6 @@ edge.enabled = true;
|
|
|
29
29
|
|
|
30
30
|
## architecture/connection/connection.ts
|
|
31
31
|
|
|
32
|
-
### ConnectionSymbolProps
|
|
33
|
-
|
|
34
|
-
Internal interface for accessing symbol-keyed properties on Connection instances.
|
|
35
|
-
Used for type-safe access to dynamic symbol properties.
|
|
36
|
-
|
|
37
32
|
### Connection
|
|
38
33
|
|
|
39
34
|
Connection (Synapse / Edge)
|
|
@@ -61,6 +56,11 @@ edge.gain = 1.5;
|
|
|
61
56
|
edge.enabled = true;
|
|
62
57
|
```
|
|
63
58
|
|
|
59
|
+
### ConnectionSymbolProps
|
|
60
|
+
|
|
61
|
+
Internal interface for accessing symbol-keyed properties on Connection instances.
|
|
62
|
+
Used for type-safe access to dynamic symbol properties.
|
|
63
|
+
|
|
64
64
|
### default
|
|
65
65
|
|
|
66
66
|
#### _flags
|