@timmeck/brain-core 2.28.1 → 2.29.1
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/dist/dream/dream-engine.d.ts +5 -0
- package/dist/dream/dream-engine.js +75 -0
- package/dist/dream/dream-engine.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/metacognition/evolution-engine.d.ts +113 -0
- package/dist/metacognition/evolution-engine.js +450 -0
- package/dist/metacognition/evolution-engine.js.map +1 -0
- package/dist/metacognition/index.d.ts +2 -0
- package/dist/metacognition/index.js +1 -0
- package/dist/metacognition/index.js.map +1 -1
- package/dist/research/research-orchestrator.d.ts +11 -0
- package/dist/research/research-orchestrator.js +267 -44
- package/dist/research/research-orchestrator.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
// ── Migration ───────────────────────────────────────────
|
|
2
|
+
export function runEvolutionMigration(db) {
|
|
3
|
+
db.exec(`
|
|
4
|
+
CREATE TABLE IF NOT EXISTS evolution_generations (
|
|
5
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
6
|
+
generation INTEGER NOT NULL,
|
|
7
|
+
best_fitness REAL NOT NULL DEFAULT 0,
|
|
8
|
+
avg_fitness REAL NOT NULL DEFAULT 0,
|
|
9
|
+
worst_fitness REAL NOT NULL DEFAULT 0,
|
|
10
|
+
population_size INTEGER NOT NULL DEFAULT 0,
|
|
11
|
+
diversity REAL NOT NULL DEFAULT 0,
|
|
12
|
+
timestamp TEXT NOT NULL DEFAULT (datetime('now'))
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
CREATE TABLE IF NOT EXISTS evolution_individuals (
|
|
16
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
17
|
+
generation INTEGER NOT NULL,
|
|
18
|
+
genome_json TEXT NOT NULL,
|
|
19
|
+
fitness REAL NOT NULL DEFAULT 0,
|
|
20
|
+
rank INTEGER NOT NULL DEFAULT 0,
|
|
21
|
+
is_active INTEGER NOT NULL DEFAULT 0,
|
|
22
|
+
parent_a_id INTEGER,
|
|
23
|
+
parent_b_id INTEGER,
|
|
24
|
+
mutation_count INTEGER NOT NULL DEFAULT 0,
|
|
25
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
CREATE TABLE IF NOT EXISTS evolution_lineage (
|
|
29
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
30
|
+
child_id INTEGER NOT NULL,
|
|
31
|
+
parent_id INTEGER NOT NULL,
|
|
32
|
+
crossover_point TEXT NOT NULL DEFAULT '',
|
|
33
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
34
|
+
);
|
|
35
|
+
`);
|
|
36
|
+
}
|
|
37
|
+
// ── Engine ──────────────────────────────────────────────
|
|
38
|
+
export class EvolutionEngine {
|
|
39
|
+
db;
|
|
40
|
+
registry;
|
|
41
|
+
brainName;
|
|
42
|
+
populationSize;
|
|
43
|
+
mutationRate;
|
|
44
|
+
eliteCount;
|
|
45
|
+
tournamentSize;
|
|
46
|
+
generationEvery;
|
|
47
|
+
thoughtStream = null;
|
|
48
|
+
dataSources = null;
|
|
49
|
+
currentGeneration = 0;
|
|
50
|
+
constructor(db, registry, config) {
|
|
51
|
+
this.db = db;
|
|
52
|
+
this.registry = registry;
|
|
53
|
+
this.brainName = config.brainName;
|
|
54
|
+
this.populationSize = config.populationSize ?? 15;
|
|
55
|
+
this.mutationRate = config.mutationRate ?? 0.15;
|
|
56
|
+
this.eliteCount = config.eliteCount ?? 2;
|
|
57
|
+
this.tournamentSize = config.tournamentSize ?? 3;
|
|
58
|
+
this.generationEvery = config.generationEvery ?? 20;
|
|
59
|
+
runEvolutionMigration(db);
|
|
60
|
+
// Restore generation counter from DB
|
|
61
|
+
const row = db.prepare('SELECT MAX(generation) AS gen FROM evolution_generations').get();
|
|
62
|
+
if (row?.gen)
|
|
63
|
+
this.currentGeneration = row.gen;
|
|
64
|
+
}
|
|
65
|
+
setThoughtStream(stream) {
|
|
66
|
+
this.thoughtStream = stream;
|
|
67
|
+
}
|
|
68
|
+
setDataSources(sources) {
|
|
69
|
+
this.dataSources = sources;
|
|
70
|
+
}
|
|
71
|
+
// ── Population Initialization ─────────────────────────
|
|
72
|
+
initializePopulation() {
|
|
73
|
+
// Idempotent — skip if we already have individuals
|
|
74
|
+
const existing = this.db.prepare('SELECT COUNT(*) AS cnt FROM evolution_individuals').get();
|
|
75
|
+
if (existing.cnt > 0)
|
|
76
|
+
return;
|
|
77
|
+
const currentGenome = this.getCurrentGenome();
|
|
78
|
+
if (Object.keys(currentGenome).length === 0)
|
|
79
|
+
return;
|
|
80
|
+
// Individual 0: current parameter configuration
|
|
81
|
+
this.insertIndividual(0, currentGenome, 0, null, null, 0, true);
|
|
82
|
+
// Remaining: random variants around current genome
|
|
83
|
+
for (let i = 1; i < this.populationSize; i++) {
|
|
84
|
+
const variant = this.randomVariant(currentGenome);
|
|
85
|
+
this.insertIndividual(0, variant.genome, 0, null, null, variant.mutations, false);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// ── Fitness Evaluation ────────────────────────────────
|
|
89
|
+
evaluateFitness(individual) {
|
|
90
|
+
// Apply this individual's genome temporarily — we just score it
|
|
91
|
+
// Fitness = weighted combination of data source metrics
|
|
92
|
+
if (!this.dataSources)
|
|
93
|
+
return 0;
|
|
94
|
+
let metaCogScore = 0;
|
|
95
|
+
try {
|
|
96
|
+
const cards = this.dataSources.getReportCards();
|
|
97
|
+
if (cards.length > 0) {
|
|
98
|
+
metaCogScore = cards.reduce((sum, c) => sum + c.combined_score, 0) / cards.length;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch { /* empty */ }
|
|
102
|
+
let goalProgress = 0;
|
|
103
|
+
try {
|
|
104
|
+
goalProgress = this.dataSources.getGoalProgress();
|
|
105
|
+
}
|
|
106
|
+
catch { /* empty */ }
|
|
107
|
+
let predAccuracy = 0;
|
|
108
|
+
try {
|
|
109
|
+
predAccuracy = this.dataSources.getPredictionAccuracy();
|
|
110
|
+
}
|
|
111
|
+
catch { /* empty */ }
|
|
112
|
+
let knowledgeQuality = 0;
|
|
113
|
+
try {
|
|
114
|
+
const principles = this.dataSources.getPrincipleCount();
|
|
115
|
+
const hypotheses = this.dataSources.getHypothesisCount();
|
|
116
|
+
knowledgeQuality = Math.min(1, (principles + hypotheses) / 100);
|
|
117
|
+
}
|
|
118
|
+
catch { /* empty */ }
|
|
119
|
+
const novelty = this.computeNovelty(individual.genome);
|
|
120
|
+
const fitness = metaCogScore * 0.4
|
|
121
|
+
+ goalProgress * 0.2
|
|
122
|
+
+ predAccuracy * 0.2
|
|
123
|
+
+ knowledgeQuality * 0.1
|
|
124
|
+
+ novelty * 0.1;
|
|
125
|
+
return Math.max(0, Math.min(1, fitness));
|
|
126
|
+
}
|
|
127
|
+
// ── Run a Generation ──────────────────────────────────
|
|
128
|
+
runGeneration() {
|
|
129
|
+
this.currentGeneration++;
|
|
130
|
+
const ts = this.thoughtStream;
|
|
131
|
+
ts?.emit('evolution', 'reflecting', `Running Evolution Generation #${this.currentGeneration}...`, 'notable');
|
|
132
|
+
// 1. Get current population (or initialize if empty)
|
|
133
|
+
let population = this.getPopulationInternal(this.currentGeneration - 1);
|
|
134
|
+
if (population.length === 0) {
|
|
135
|
+
// Re-initialize if somehow empty
|
|
136
|
+
this.initializePopulation();
|
|
137
|
+
population = this.getPopulationInternal(0);
|
|
138
|
+
}
|
|
139
|
+
// 2. Evaluate fitness for each individual
|
|
140
|
+
for (const ind of population) {
|
|
141
|
+
ind.fitness = this.evaluateFitness(ind);
|
|
142
|
+
}
|
|
143
|
+
// 3. Sort by fitness descending
|
|
144
|
+
population.sort((a, b) => b.fitness - a.fitness);
|
|
145
|
+
for (let i = 0; i < population.length; i++) {
|
|
146
|
+
population[i].rank = i + 1;
|
|
147
|
+
}
|
|
148
|
+
// 4. Build next generation
|
|
149
|
+
const nextPop = [];
|
|
150
|
+
// 4a. Elitism — carry top N unchanged
|
|
151
|
+
for (let i = 0; i < Math.min(this.eliteCount, population.length); i++) {
|
|
152
|
+
const elite = population[i];
|
|
153
|
+
nextPop.push({
|
|
154
|
+
generation: this.currentGeneration,
|
|
155
|
+
genome: { ...elite.genome },
|
|
156
|
+
fitness: elite.fitness,
|
|
157
|
+
rank: 0,
|
|
158
|
+
isActive: false,
|
|
159
|
+
parentAId: elite.id ?? null,
|
|
160
|
+
parentBId: null,
|
|
161
|
+
mutationCount: 0,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
// 4b. Fill rest via tournament selection + crossover + mutation
|
|
165
|
+
while (nextPop.length < this.populationSize) {
|
|
166
|
+
const parentA = this.tournamentSelect(population, this.tournamentSize);
|
|
167
|
+
const parentB = this.tournamentSelect(population, this.tournamentSize);
|
|
168
|
+
const { child, crossoverPoints } = this.crossover(parentA, parentB);
|
|
169
|
+
const { genome: mutated, mutations } = this.mutateGenome(child, this.mutationRate);
|
|
170
|
+
nextPop.push({
|
|
171
|
+
generation: this.currentGeneration,
|
|
172
|
+
genome: mutated,
|
|
173
|
+
fitness: 0,
|
|
174
|
+
rank: 0,
|
|
175
|
+
isActive: false,
|
|
176
|
+
parentAId: parentA.id ?? null,
|
|
177
|
+
parentBId: parentB.id ?? null,
|
|
178
|
+
mutationCount: mutations,
|
|
179
|
+
_crossoverPoints: crossoverPoints,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
// 5. Deactivate all previous individuals
|
|
183
|
+
this.db.prepare('UPDATE evolution_individuals SET is_active = 0').run();
|
|
184
|
+
// 6. Insert new population and record lineage
|
|
185
|
+
for (const ind of nextPop) {
|
|
186
|
+
const id = this.insertIndividual(ind.generation, ind.genome, ind.fitness, ind.parentAId, ind.parentBId, ind.mutationCount, false);
|
|
187
|
+
// Record lineage
|
|
188
|
+
const points = ind._crossoverPoints;
|
|
189
|
+
if (ind.parentAId) {
|
|
190
|
+
this.db.prepare('INSERT INTO evolution_lineage (child_id, parent_id, crossover_point) VALUES (?, ?, ?)').run(id, ind.parentAId, points?.join(',') ?? 'elite');
|
|
191
|
+
}
|
|
192
|
+
if (ind.parentBId) {
|
|
193
|
+
this.db.prepare('INSERT INTO evolution_lineage (child_id, parent_id, crossover_point) VALUES (?, ?, ?)').run(id, ind.parentBId, points?.join(',') ?? 'crossover');
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
// 7. Activate best individual (apply its genome to registry)
|
|
197
|
+
const best = nextPop[0]; // Elites are first
|
|
198
|
+
this.activate(best.genome);
|
|
199
|
+
// Mark as active in DB
|
|
200
|
+
const bestRow = this.db.prepare('SELECT id FROM evolution_individuals WHERE generation = ? ORDER BY fitness DESC LIMIT 1').get(this.currentGeneration);
|
|
201
|
+
if (bestRow) {
|
|
202
|
+
this.db.prepare('UPDATE evolution_individuals SET is_active = 1 WHERE id = ?').run(bestRow.id);
|
|
203
|
+
}
|
|
204
|
+
// 8. Record generation stats
|
|
205
|
+
const fitnesses = population.map(p => p.fitness);
|
|
206
|
+
const avgFitness = fitnesses.length > 0 ? fitnesses.reduce((a, b) => a + b, 0) / fitnesses.length : 0;
|
|
207
|
+
const bestFitness = fitnesses.length > 0 ? Math.max(...fitnesses) : 0;
|
|
208
|
+
const worstFitness = fitnesses.length > 0 ? Math.min(...fitnesses) : 0;
|
|
209
|
+
const diversity = this.computeDiversity(nextPop.map(i => i.genome));
|
|
210
|
+
this.db.prepare(`
|
|
211
|
+
INSERT INTO evolution_generations (generation, best_fitness, avg_fitness, worst_fitness, population_size, diversity)
|
|
212
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
213
|
+
`).run(this.currentGeneration, bestFitness, avgFitness, worstFitness, nextPop.length, diversity);
|
|
214
|
+
const gen = {
|
|
215
|
+
generation: this.currentGeneration,
|
|
216
|
+
bestFitness,
|
|
217
|
+
avgFitness,
|
|
218
|
+
worstFitness,
|
|
219
|
+
populationSize: nextPop.length,
|
|
220
|
+
diversity,
|
|
221
|
+
};
|
|
222
|
+
ts?.emit('evolution', 'reflecting', `Generation #${this.currentGeneration}: best=${bestFitness.toFixed(3)} avg=${avgFitness.toFixed(3)} diversity=${diversity.toFixed(3)}`, bestFitness > avgFitness * 1.2 ? 'notable' : 'routine');
|
|
223
|
+
return gen;
|
|
224
|
+
}
|
|
225
|
+
// ── Selection ─────────────────────────────────────────
|
|
226
|
+
tournamentSelect(population, size) {
|
|
227
|
+
const contestants = [];
|
|
228
|
+
for (let i = 0; i < Math.min(size, population.length); i++) {
|
|
229
|
+
const idx = Math.floor(Math.random() * population.length);
|
|
230
|
+
contestants.push(population[idx]);
|
|
231
|
+
}
|
|
232
|
+
contestants.sort((a, b) => b.fitness - a.fitness);
|
|
233
|
+
return contestants[0];
|
|
234
|
+
}
|
|
235
|
+
// ── Crossover ─────────────────────────────────────────
|
|
236
|
+
crossover(parentA, parentB) {
|
|
237
|
+
const child = {};
|
|
238
|
+
const crossoverPoints = [];
|
|
239
|
+
const keys = new Set([...Object.keys(parentA.genome), ...Object.keys(parentB.genome)]);
|
|
240
|
+
for (const key of keys) {
|
|
241
|
+
const fromA = Math.random() < 0.5;
|
|
242
|
+
if (fromA && key in parentA.genome) {
|
|
243
|
+
child[key] = parentA.genome[key];
|
|
244
|
+
}
|
|
245
|
+
else if (key in parentB.genome) {
|
|
246
|
+
child[key] = parentB.genome[key];
|
|
247
|
+
crossoverPoints.push(key);
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
child[key] = parentA.genome[key];
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return { child, crossoverPoints };
|
|
254
|
+
}
|
|
255
|
+
// ── Mutation ──────────────────────────────────────────
|
|
256
|
+
mutateGenome(genome, rate) {
|
|
257
|
+
const mutated = { ...genome };
|
|
258
|
+
let mutations = 0;
|
|
259
|
+
const params = this.registry.list();
|
|
260
|
+
for (const key of Object.keys(mutated)) {
|
|
261
|
+
if (Math.random() >= rate)
|
|
262
|
+
continue;
|
|
263
|
+
const [engine, name] = key.split(':');
|
|
264
|
+
const def = params.find(p => p.engine === engine && p.name === name);
|
|
265
|
+
if (!def)
|
|
266
|
+
continue;
|
|
267
|
+
const range = def.max - def.min;
|
|
268
|
+
const noise = this.gaussianNoise() * range * 0.1; // σ = 10% of range
|
|
269
|
+
let newVal = mutated[key] + noise;
|
|
270
|
+
// Clamp to bounds
|
|
271
|
+
newVal = Math.max(def.min, Math.min(def.max, newVal));
|
|
272
|
+
mutated[key] = newVal;
|
|
273
|
+
mutations++;
|
|
274
|
+
}
|
|
275
|
+
return { genome: mutated, mutations };
|
|
276
|
+
}
|
|
277
|
+
// ── Genome Application ────────────────────────────────
|
|
278
|
+
activate(genome) {
|
|
279
|
+
for (const [key, value] of Object.entries(genome)) {
|
|
280
|
+
const [engine, name] = key.split(':');
|
|
281
|
+
if (engine && name) {
|
|
282
|
+
this.registry.set(engine, name, value, 'evolution', `Generation #${this.currentGeneration}`);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
// ── Queries ───────────────────────────────────────────
|
|
287
|
+
getStatus() {
|
|
288
|
+
const totalIndividuals = this.db.prepare('SELECT COUNT(*) AS cnt FROM evolution_individuals').get().cnt;
|
|
289
|
+
const champion = this.getBestIndividual();
|
|
290
|
+
// Get latest generation stats
|
|
291
|
+
const latestGen = this.db.prepare('SELECT * FROM evolution_generations ORDER BY generation DESC LIMIT 1').get();
|
|
292
|
+
return {
|
|
293
|
+
currentGeneration: this.currentGeneration,
|
|
294
|
+
populationSize: this.populationSize,
|
|
295
|
+
bestFitness: latestGen?.best_fitness ?? 0,
|
|
296
|
+
avgFitness: latestGen?.avg_fitness ?? 0,
|
|
297
|
+
totalIndividuals,
|
|
298
|
+
isInitialized: totalIndividuals > 0,
|
|
299
|
+
config: {
|
|
300
|
+
populationSize: this.populationSize,
|
|
301
|
+
mutationRate: this.mutationRate,
|
|
302
|
+
eliteCount: this.eliteCount,
|
|
303
|
+
tournamentSize: this.tournamentSize,
|
|
304
|
+
generationEvery: this.generationEvery,
|
|
305
|
+
},
|
|
306
|
+
champion,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
getHistory(limit = 20) {
|
|
310
|
+
const rows = this.db.prepare('SELECT * FROM evolution_generations ORDER BY generation DESC LIMIT ?').all(limit);
|
|
311
|
+
return rows.map(r => ({
|
|
312
|
+
id: r.id,
|
|
313
|
+
generation: r.generation,
|
|
314
|
+
bestFitness: r.best_fitness,
|
|
315
|
+
avgFitness: r.avg_fitness,
|
|
316
|
+
worstFitness: r.worst_fitness,
|
|
317
|
+
populationSize: r.population_size,
|
|
318
|
+
diversity: r.diversity,
|
|
319
|
+
timestamp: r.timestamp,
|
|
320
|
+
}));
|
|
321
|
+
}
|
|
322
|
+
getBestIndividual() {
|
|
323
|
+
const row = this.db.prepare('SELECT * FROM evolution_individuals ORDER BY fitness DESC LIMIT 1').get();
|
|
324
|
+
if (!row)
|
|
325
|
+
return null;
|
|
326
|
+
return this.rowToIndividual(row);
|
|
327
|
+
}
|
|
328
|
+
getPopulation(generation) {
|
|
329
|
+
const gen = generation ?? this.currentGeneration;
|
|
330
|
+
return this.getPopulationInternal(gen);
|
|
331
|
+
}
|
|
332
|
+
getLineage(individualId) {
|
|
333
|
+
const rows = this.db.prepare('SELECT * FROM evolution_lineage WHERE child_id = ? ORDER BY id').all(individualId);
|
|
334
|
+
return rows.map(r => ({
|
|
335
|
+
id: r.id,
|
|
336
|
+
childId: r.child_id,
|
|
337
|
+
parentId: r.parent_id,
|
|
338
|
+
crossoverPoint: r.crossover_point,
|
|
339
|
+
createdAt: r.created_at,
|
|
340
|
+
}));
|
|
341
|
+
}
|
|
342
|
+
// ── Private Helpers ───────────────────────────────────
|
|
343
|
+
getCurrentGenome() {
|
|
344
|
+
const genome = {};
|
|
345
|
+
const params = this.registry.list();
|
|
346
|
+
for (const p of params) {
|
|
347
|
+
genome[`${p.engine}:${p.name}`] = p.value;
|
|
348
|
+
}
|
|
349
|
+
return genome;
|
|
350
|
+
}
|
|
351
|
+
randomVariant(base) {
|
|
352
|
+
const variant = { ...base };
|
|
353
|
+
let mutations = 0;
|
|
354
|
+
const params = this.registry.list();
|
|
355
|
+
for (const key of Object.keys(variant)) {
|
|
356
|
+
// Each parameter has a 40% chance of mutation for initial diversity
|
|
357
|
+
if (Math.random() >= 0.4)
|
|
358
|
+
continue;
|
|
359
|
+
const [engine, name] = key.split(':');
|
|
360
|
+
const def = params.find(p => p.engine === engine && p.name === name);
|
|
361
|
+
if (!def)
|
|
362
|
+
continue;
|
|
363
|
+
const range = def.max - def.min;
|
|
364
|
+
// Wider noise for initialization: σ = 20% of range
|
|
365
|
+
const noise = this.gaussianNoise() * range * 0.2;
|
|
366
|
+
variant[key] = Math.max(def.min, Math.min(def.max, variant[key] + noise));
|
|
367
|
+
mutations++;
|
|
368
|
+
}
|
|
369
|
+
return { genome: variant, mutations };
|
|
370
|
+
}
|
|
371
|
+
insertIndividual(generation, genome, fitness, parentAId, parentBId, mutationCount, isActive) {
|
|
372
|
+
const result = this.db.prepare(`
|
|
373
|
+
INSERT INTO evolution_individuals (generation, genome_json, fitness, rank, is_active, parent_a_id, parent_b_id, mutation_count)
|
|
374
|
+
VALUES (?, ?, ?, 0, ?, ?, ?, ?)
|
|
375
|
+
`).run(generation, JSON.stringify(genome), fitness, isActive ? 1 : 0, parentAId, parentBId, mutationCount);
|
|
376
|
+
return Number(result.lastInsertRowid);
|
|
377
|
+
}
|
|
378
|
+
computeNovelty(genome) {
|
|
379
|
+
// Compare to existing population — how different is this genome?
|
|
380
|
+
const rows = this.db.prepare('SELECT genome_json FROM evolution_individuals WHERE generation = ? LIMIT 50').all(this.currentGeneration);
|
|
381
|
+
if (rows.length === 0)
|
|
382
|
+
return 0.5; // Neutral novelty for first individual
|
|
383
|
+
const keys = Object.keys(genome);
|
|
384
|
+
if (keys.length === 0)
|
|
385
|
+
return 0;
|
|
386
|
+
let totalDist = 0;
|
|
387
|
+
for (const row of rows) {
|
|
388
|
+
const other = JSON.parse(row.genome_json);
|
|
389
|
+
let dist = 0;
|
|
390
|
+
for (const key of keys) {
|
|
391
|
+
const a = genome[key] ?? 0;
|
|
392
|
+
const b = other[key] ?? 0;
|
|
393
|
+
const [engine, name] = key.split(':');
|
|
394
|
+
const def = this.registry.list().find(p => p.engine === engine && p.name === name);
|
|
395
|
+
const range = def ? (def.max - def.min) : 1;
|
|
396
|
+
dist += range > 0 ? Math.abs(a - b) / range : 0;
|
|
397
|
+
}
|
|
398
|
+
totalDist += keys.length > 0 ? dist / keys.length : 0;
|
|
399
|
+
}
|
|
400
|
+
return Math.min(1, totalDist / rows.length);
|
|
401
|
+
}
|
|
402
|
+
computeDiversity(genomes) {
|
|
403
|
+
if (genomes.length < 2)
|
|
404
|
+
return 0;
|
|
405
|
+
const keys = Object.keys(genomes[0] ?? {});
|
|
406
|
+
if (keys.length === 0)
|
|
407
|
+
return 0;
|
|
408
|
+
let totalVariance = 0;
|
|
409
|
+
for (const key of keys) {
|
|
410
|
+
const values = genomes.map(g => g[key] ?? 0);
|
|
411
|
+
const mean = values.reduce((a, b) => a + b, 0) / values.length;
|
|
412
|
+
const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / values.length;
|
|
413
|
+
const [engine, name] = key.split(':');
|
|
414
|
+
const def = this.registry.list().find(p => p.engine === engine && p.name === name);
|
|
415
|
+
const range = def ? (def.max - def.min) : 1;
|
|
416
|
+
// Normalize variance by range^2
|
|
417
|
+
totalVariance += range > 0 ? variance / (range * range) : 0;
|
|
418
|
+
}
|
|
419
|
+
return Math.min(1, Math.sqrt(totalVariance / keys.length));
|
|
420
|
+
}
|
|
421
|
+
getPopulationInternal(generation) {
|
|
422
|
+
const rows = this.db.prepare('SELECT * FROM evolution_individuals WHERE generation = ? ORDER BY fitness DESC').all(generation);
|
|
423
|
+
return rows.map(r => this.rowToIndividual(r));
|
|
424
|
+
}
|
|
425
|
+
rowToIndividual(r) {
|
|
426
|
+
return {
|
|
427
|
+
id: r.id,
|
|
428
|
+
generation: r.generation,
|
|
429
|
+
genome: JSON.parse(r.genome_json),
|
|
430
|
+
fitness: r.fitness,
|
|
431
|
+
rank: r.rank,
|
|
432
|
+
isActive: r.is_active === 1,
|
|
433
|
+
parentAId: r.parent_a_id,
|
|
434
|
+
parentBId: r.parent_b_id,
|
|
435
|
+
mutationCount: r.mutation_count,
|
|
436
|
+
createdAt: r.created_at,
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
/** Box-Muller transform for Gaussian noise with mean=0, σ=1 */
|
|
440
|
+
gaussianNoise() {
|
|
441
|
+
let u = 0;
|
|
442
|
+
let v = 0;
|
|
443
|
+
while (u === 0)
|
|
444
|
+
u = Math.random();
|
|
445
|
+
while (v === 0)
|
|
446
|
+
v = Math.random();
|
|
447
|
+
return Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
//# sourceMappingURL=evolution-engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evolution-engine.js","sourceRoot":"","sources":["../../src/metacognition/evolution-engine.ts"],"names":[],"mappings":"AA4EA,2DAA2D;AAE3D,MAAM,UAAU,qBAAqB,CAAC,EAAqB;IACzD,EAAE,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCP,CAAC,CAAC;AACL,CAAC;AAED,2DAA2D;AAE3D,MAAM,OAAO,eAAe;IACT,EAAE,CAAoB;IACtB,QAAQ,CAAoB;IAC5B,SAAS,CAAS;IAClB,cAAc,CAAS;IACvB,YAAY,CAAS;IACrB,UAAU,CAAS;IACnB,cAAc,CAAS;IAC/B,eAAe,CAAS;IACzB,aAAa,GAAyB,IAAI,CAAC;IAC3C,WAAW,GAAgC,IAAI,CAAC;IAChD,iBAAiB,GAAG,CAAC,CAAC;IAE9B,YAAY,E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AE,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC;YAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IACrE,CAAC;CACF"}
|
|
@@ -10,3 +10,5 @@ export { TeachEngine, runTeachEngineMigration } from './teach-engine.js';
|
|
|
10
10
|
export type { TeachingPackage, TeachEngineStatus } from './teach-engine.js';
|
|
11
11
|
export { SimulationEngine, runSimulationMigration } from './simulation-engine.js';
|
|
12
12
|
export type { Simulation, SimulationOutcome, SimulationStatus } from './simulation-engine.js';
|
|
13
|
+
export { EvolutionEngine, runEvolutionMigration } from './evolution-engine.js';
|
|
14
|
+
export type { EvolutionConfig, Genome, Individual, Generation, LineageEntry, EvolutionDataSources, EvolutionStatus } from './evolution-engine.js';
|
|
@@ -4,4 +4,5 @@ export { AutoExperimentEngine, runAutoExperimentMigration } from './auto-experim
|
|
|
4
4
|
export { SelfTestEngine, runSelfTestMigration } from './self-test-engine.js';
|
|
5
5
|
export { TeachEngine, runTeachEngineMigration } from './teach-engine.js';
|
|
6
6
|
export { SimulationEngine, runSimulationMigration } from './simulation-engine.js';
|
|
7
|
+
export { EvolutionEngine, runEvolutionMigration } from './evolution-engine.js';
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/metacognition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAG3F,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAG1F,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAG/F,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG7E,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAGzE,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/metacognition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAG3F,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAG1F,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAG/F,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG7E,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAGzE,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGlF,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -33,6 +33,7 @@ import type { DataScout } from './data-scout.js';
|
|
|
33
33
|
import type { SimulationEngine } from '../metacognition/simulation-engine.js';
|
|
34
34
|
import type { MemoryPalace } from '../memory-palace/memory-palace.js';
|
|
35
35
|
import type { GoalEngine } from '../goals/goal-engine.js';
|
|
36
|
+
import type { EvolutionEngine } from '../metacognition/evolution-engine.js';
|
|
36
37
|
import { AutoResponder } from './auto-responder.js';
|
|
37
38
|
export interface ResearchOrchestratorConfig {
|
|
38
39
|
brainName: string;
|
|
@@ -79,6 +80,7 @@ export declare class ResearchOrchestrator {
|
|
|
79
80
|
private simulationEngine;
|
|
80
81
|
private memoryPalace;
|
|
81
82
|
private goalEngine;
|
|
83
|
+
private evolutionEngine;
|
|
82
84
|
private brainName;
|
|
83
85
|
private feedbackTimer;
|
|
84
86
|
private cycleCount;
|
|
@@ -134,6 +136,8 @@ export declare class ResearchOrchestrator {
|
|
|
134
136
|
setMemoryPalace(palace: MemoryPalace): void;
|
|
135
137
|
/** Set the GoalEngine — autonomous goal setting and tracking. */
|
|
136
138
|
setGoalEngine(engine: GoalEngine): void;
|
|
139
|
+
/** Set the EvolutionEngine — evolves parameter configurations via genetic algorithm. */
|
|
140
|
+
setEvolutionEngine(engine: EvolutionEngine): void;
|
|
137
141
|
/** Set the PredictionEngine — wires journal into it. */
|
|
138
142
|
setPredictionEngine(engine: PredictionEngine): void;
|
|
139
143
|
/** Start the autonomous feedback loop timer. */
|
|
@@ -166,6 +170,13 @@ export declare class ResearchOrchestrator {
|
|
|
166
170
|
/** Pick a debate topic from recent attention, anomalies, or journal insights. */
|
|
167
171
|
private pickDebateTopic;
|
|
168
172
|
private generateSelfImprovementSuggestions;
|
|
173
|
+
/** Check which optional engines are actually installed. */
|
|
174
|
+
getInstalledCapabilities(): {
|
|
175
|
+
installed: string[];
|
|
176
|
+
missing: string[];
|
|
177
|
+
};
|
|
178
|
+
/** Generate dynamic meta-suggestions based on actual engine state instead of hardcoded feature requests. */
|
|
179
|
+
private generateDynamicMetaSuggestions;
|
|
169
180
|
/** Auto-propose an experiment on Brain's own parameters. */
|
|
170
181
|
private proposeAutoExperiment;
|
|
171
182
|
/** Feed cycle measurements into running experiments. */
|