@timmeck/brain-core 2.3.0 → 2.5.0

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.
@@ -0,0 +1,411 @@
1
+ import { getLogger } from '../utils/logger.js';
2
+ import { MetaLearningEngine } from '../meta-learning/engine.js';
3
+ import { CausalGraph } from '../causal/engine.js';
4
+ import { HypothesisEngine } from '../hypothesis/engine.js';
5
+ // ── Migration ───────────────────────────────────────────
6
+ export function runResearchDiscoveryMigration(db) {
7
+ db.exec(`
8
+ CREATE TABLE IF NOT EXISTS research_discoveries (
9
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
10
+ type TEXT NOT NULL,
11
+ title TEXT NOT NULL,
12
+ description TEXT NOT NULL,
13
+ confidence REAL NOT NULL DEFAULT 0,
14
+ impact REAL NOT NULL DEFAULT 0,
15
+ source TEXT NOT NULL,
16
+ data TEXT NOT NULL DEFAULT '{}',
17
+ created_at TEXT NOT NULL DEFAULT (datetime('now'))
18
+ );
19
+
20
+ CREATE TABLE IF NOT EXISTS research_cycle_reports (
21
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
22
+ cycle INTEGER NOT NULL,
23
+ timestamp INTEGER NOT NULL,
24
+ causal_edges_found INTEGER NOT NULL DEFAULT 0,
25
+ causal_chains_found INTEGER NOT NULL DEFAULT 0,
26
+ hypotheses_generated INTEGER NOT NULL DEFAULT 0,
27
+ hypotheses_tested INTEGER NOT NULL DEFAULT 0,
28
+ hypotheses_confirmed INTEGER NOT NULL DEFAULT 0,
29
+ hypotheses_rejected INTEGER NOT NULL DEFAULT 0,
30
+ parameters_optimized INTEGER NOT NULL DEFAULT 0,
31
+ discoveries_produced INTEGER NOT NULL DEFAULT 0,
32
+ duration INTEGER NOT NULL DEFAULT 0,
33
+ created_at TEXT NOT NULL DEFAULT (datetime('now'))
34
+ );
35
+
36
+ CREATE INDEX IF NOT EXISTS idx_discoveries_type ON research_discoveries(type);
37
+ CREATE INDEX IF NOT EXISTS idx_discoveries_confidence ON research_discoveries(confidence DESC);
38
+ CREATE INDEX IF NOT EXISTS idx_cycle_reports_cycle ON research_cycle_reports(cycle);
39
+ `);
40
+ }
41
+ // ── Scheduler ───────────────────────────────────────────
42
+ /**
43
+ * Autonomous Research Scheduler: orchestrates the three research engines
44
+ * into a self-running discovery pipeline.
45
+ *
46
+ * Flow:
47
+ * 1. External code calls onLearningCycleComplete() after each learning cycle
48
+ * → feeds metrics into MetaLearningEngine
49
+ * → records causal events
50
+ * → records observations for hypothesis engine
51
+ *
52
+ * 2. On a timer (every intervalMs), runs a full research cycle:
53
+ * a. Run causal analysis → detect cause-effect relationships
54
+ * b. Auto-generate hypotheses from observation patterns
55
+ * c. Test all pending hypotheses
56
+ * d. Run meta-learning optimization (if enough data)
57
+ * e. Produce discoveries from confirmed hypotheses + causal chains
58
+ * f. Store everything in SQLite
59
+ */
60
+ export class AutonomousResearchScheduler {
61
+ db;
62
+ logger = getLogger();
63
+ timer = null;
64
+ delayTimer = null;
65
+ cycleCount = 0;
66
+ running = false;
67
+ metaLearning;
68
+ causalGraph;
69
+ hypothesisEngine;
70
+ brainName;
71
+ intervalMs;
72
+ initialDelayMs;
73
+ minCausalStrength;
74
+ maxDiscoveriesPerCycle;
75
+ constructor(db, config) {
76
+ this.db = db;
77
+ runResearchDiscoveryMigration(db);
78
+ this.brainName = config.brainName;
79
+ this.intervalMs = config.intervalMs ?? 600_000;
80
+ this.initialDelayMs = config.initialDelayMs ?? 30_000;
81
+ this.minCausalStrength = config.minCausalStrength ?? 0.3;
82
+ this.maxDiscoveriesPerCycle = config.maxDiscoveriesPerCycle ?? 10;
83
+ // Default hyperparameters if none provided
84
+ const hyperParams = config.hyperParams ?? [
85
+ { name: 'learningRate', value: 0.1, min: 0.01, max: 0.5, step: 0.02 },
86
+ { name: 'decayRate', value: 0.05, min: 0.01, max: 0.2, step: 0.01 },
87
+ { name: 'pruneThreshold', value: 0.1, min: 0.01, max: 0.5, step: 0.02 },
88
+ ];
89
+ this.metaLearning = new MetaLearningEngine(db, hyperParams);
90
+ this.causalGraph = new CausalGraph(db);
91
+ this.hypothesisEngine = new HypothesisEngine(db);
92
+ }
93
+ /** Start the autonomous research timer. */
94
+ start() {
95
+ if (this.timer)
96
+ return;
97
+ this.logger.info(`[research] Autonomous research scheduler starting (interval: ${this.intervalMs}ms, delay: ${this.initialDelayMs}ms)`);
98
+ if (this.initialDelayMs > 0) {
99
+ this.delayTimer = setTimeout(() => {
100
+ this.safeRunCycle();
101
+ this.timer = setInterval(() => this.safeRunCycle(), this.intervalMs);
102
+ }, this.initialDelayMs);
103
+ }
104
+ else {
105
+ this.timer = setInterval(() => this.safeRunCycle(), this.intervalMs);
106
+ }
107
+ }
108
+ /** Stop the autonomous research timer. */
109
+ stop() {
110
+ if (this.delayTimer) {
111
+ clearTimeout(this.delayTimer);
112
+ this.delayTimer = null;
113
+ }
114
+ if (this.timer) {
115
+ clearInterval(this.timer);
116
+ this.timer = null;
117
+ }
118
+ }
119
+ /**
120
+ * Call this after each learning cycle completes.
121
+ * Feeds the cycle results into all three research engines.
122
+ */
123
+ onLearningCycleComplete(metrics, score, eventType = 'learning:cycle_complete') {
124
+ // 1. Feed meta-learning
125
+ this.metaLearning.step(metrics, score);
126
+ // 2. Record causal event
127
+ this.causalGraph.recordEvent(this.brainName, eventType, metrics);
128
+ // 3. Record observations for hypothesis engine
129
+ for (const [key, value] of Object.entries(metrics)) {
130
+ this.hypothesisEngine.observe({
131
+ source: this.brainName,
132
+ type: `metric:${key}`,
133
+ value,
134
+ timestamp: Date.now(),
135
+ metadata: { eventType },
136
+ });
137
+ }
138
+ this.logger.debug(`[research] Learning cycle recorded: score=${score.toFixed(3)}, metrics=${Object.keys(metrics).length}`);
139
+ }
140
+ /**
141
+ * Record a domain event for causal + hypothesis tracking.
142
+ * Call this from event listeners in each brain.
143
+ */
144
+ recordEvent(eventType, data) {
145
+ this.causalGraph.recordEvent(this.brainName, eventType, data);
146
+ // Also record as observation with value 1 (occurrence)
147
+ this.hypothesisEngine.observe({
148
+ source: this.brainName,
149
+ type: eventType,
150
+ value: 1,
151
+ timestamp: Date.now(),
152
+ metadata: data,
153
+ });
154
+ }
155
+ /**
156
+ * Run one full autonomous research cycle.
157
+ * This is the core algorithm — the system thinking about itself.
158
+ */
159
+ runCycle() {
160
+ if (this.running) {
161
+ this.logger.warn('[research] Cycle already running, skipping');
162
+ return this.emptyReport();
163
+ }
164
+ this.running = true;
165
+ this.cycleCount++;
166
+ const startTime = Date.now();
167
+ this.logger.info(`[research] ═══ Autonomous Research Cycle #${this.cycleCount} ═══`);
168
+ try {
169
+ // Phase 1: Causal Analysis — detect cause-effect relationships
170
+ const edges = this.causalGraph.analyze();
171
+ const chains = this.causalGraph.findChains();
172
+ this.logger.info(`[research] Phase 1: ${edges.length} causal edges, ${chains.length} chains detected`);
173
+ // Phase 2: Hypothesis Generation — form theories from data
174
+ const generated = this.hypothesisEngine.generate();
175
+ this.logger.info(`[research] Phase 2: ${generated.length} new hypotheses generated`);
176
+ // Phase 3: Hypothesis Testing — test all pending theories
177
+ const tested = this.hypothesisEngine.testAll();
178
+ const confirmed = tested.filter(t => t.newStatus === 'confirmed');
179
+ const rejected = tested.filter(t => t.newStatus === 'rejected');
180
+ this.logger.info(`[research] Phase 3: ${tested.length} tested, ${confirmed.length} confirmed, ${rejected.length} rejected`);
181
+ // Phase 4: Meta-Learning Optimization — tune parameters
182
+ const optimized = this.metaLearning.optimize();
183
+ if (optimized.length > 0) {
184
+ this.logger.info(`[research] Phase 4: ${optimized.length} parameters optimized`);
185
+ }
186
+ // Phase 5: Discovery Production — synthesize findings
187
+ const discoveries = this.produceDiscoveries(edges, chains, confirmed, optimized);
188
+ this.logger.info(`[research] Phase 5: ${discoveries.length} discoveries produced`);
189
+ const duration = Date.now() - startTime;
190
+ const report = {
191
+ cycle: this.cycleCount,
192
+ timestamp: startTime,
193
+ causalEdgesFound: edges.length,
194
+ causalChainsFound: chains.length,
195
+ hypothesesGenerated: generated.length,
196
+ hypothesesTested: tested.length,
197
+ hypothesesConfirmed: confirmed.length,
198
+ hypothesesRejected: rejected.length,
199
+ parametersOptimized: optimized.length,
200
+ discoveriesProduced: discoveries.length,
201
+ duration,
202
+ };
203
+ // Store cycle report
204
+ this.storeCycleReport(report);
205
+ this.logger.info(`[research] ═══ Cycle #${this.cycleCount} complete (${duration}ms) ═══`);
206
+ return report;
207
+ }
208
+ finally {
209
+ this.running = false;
210
+ }
211
+ }
212
+ /** Get all discoveries, optionally filtered by type. */
213
+ getDiscoveries(type, limit = 20) {
214
+ let rows;
215
+ if (type) {
216
+ rows = this.db.prepare('SELECT * FROM research_discoveries WHERE type = ? ORDER BY confidence DESC LIMIT ?').all(type, limit);
217
+ }
218
+ else {
219
+ rows = this.db.prepare('SELECT * FROM research_discoveries ORDER BY created_at DESC LIMIT ?').all(limit);
220
+ }
221
+ return rows.map(r => ({
222
+ ...r,
223
+ data: JSON.parse(r.data),
224
+ }));
225
+ }
226
+ /** Get cycle reports. */
227
+ getCycleReports(limit = 20) {
228
+ return this.db.prepare('SELECT * FROM research_cycle_reports ORDER BY cycle DESC LIMIT ?').all(limit);
229
+ }
230
+ /** Get a comprehensive research status. */
231
+ getStatus() {
232
+ const discoveryRows = this.db.prepare('SELECT type, COUNT(*) as count FROM research_discoveries GROUP BY type').all();
233
+ const breakdown = {};
234
+ let total = 0;
235
+ for (const row of discoveryRows) {
236
+ breakdown[row.type] = row.count;
237
+ total += row.count;
238
+ }
239
+ const reports = this.getCycleReports(1);
240
+ return {
241
+ cyclesCompleted: this.cycleCount,
242
+ totalDiscoveries: total,
243
+ discoveryBreakdown: breakdown,
244
+ metaLearningStatus: this.metaLearning.getStatus(),
245
+ causalAnalysis: this.causalGraph.getAnalysis(),
246
+ hypothesisSummary: this.hypothesisEngine.getSummary(),
247
+ lastCycleReport: reports.length > 0 ? reports[0] : null,
248
+ isRunning: this.running,
249
+ };
250
+ }
251
+ // ── Private ───────────────────────────────────────────
252
+ safeRunCycle() {
253
+ try {
254
+ this.runCycle();
255
+ }
256
+ catch (err) {
257
+ this.logger.error('[research] Autonomous research cycle error', { error: String(err) });
258
+ }
259
+ }
260
+ /**
261
+ * Produce discoveries from research findings.
262
+ * This is where data becomes insight.
263
+ */
264
+ produceDiscoveries(edges, chains, confirmedHypotheses, optimizations) {
265
+ const discoveries = [];
266
+ // 1. Strong causal chains → discoveries
267
+ for (const chain of chains) {
268
+ if (chain.totalStrength < this.minCausalStrength)
269
+ continue;
270
+ if (discoveries.length >= this.maxDiscoveriesPerCycle)
271
+ break;
272
+ const discovery = {
273
+ type: 'causal_chain',
274
+ title: `Causal chain: ${chain.chain.join(' → ')}`,
275
+ description: `Events follow this causal sequence with average strength ${chain.totalStrength.toFixed(3)} and total lag ${(chain.totalLag / 1000).toFixed(1)}s`,
276
+ confidence: Math.min(1, chain.totalStrength),
277
+ impact: Math.min(1, chain.chain.length / 4),
278
+ source: this.brainName,
279
+ data: { chain: chain.chain, strength: chain.totalStrength, lagMs: chain.totalLag },
280
+ };
281
+ if (!this.isDuplicateDiscovery(discovery)) {
282
+ this.storeDiscovery(discovery);
283
+ discoveries.push(discovery);
284
+ }
285
+ }
286
+ // 2. Root causes (causal nodes that cause but aren't caused) → discoveries
287
+ const roots = this.findSignificantRoots(edges);
288
+ for (const root of roots) {
289
+ if (discoveries.length >= this.maxDiscoveriesPerCycle)
290
+ break;
291
+ const effects = edges.filter(e => e.cause === root.cause);
292
+ const discovery = {
293
+ type: 'root_cause',
294
+ title: `Root cause identified: "${root.cause}"`,
295
+ description: `"${root.cause}" causes ${effects.length} downstream effects with average strength ${root.avgStrength.toFixed(3)}`,
296
+ confidence: root.avgConfidence,
297
+ impact: Math.min(1, effects.length / 5),
298
+ source: this.brainName,
299
+ data: { rootCause: root.cause, effectCount: effects.length, effects: effects.map(e => e.effect) },
300
+ };
301
+ if (!this.isDuplicateDiscovery(discovery)) {
302
+ this.storeDiscovery(discovery);
303
+ discoveries.push(discovery);
304
+ }
305
+ }
306
+ // 3. Confirmed hypotheses → discoveries
307
+ for (const result of confirmedHypotheses) {
308
+ if (discoveries.length >= this.maxDiscoveriesPerCycle)
309
+ break;
310
+ const hyp = this.hypothesisEngine.get(result.hypothesisId);
311
+ if (!hyp)
312
+ continue;
313
+ const discovery = {
314
+ type: 'confirmed_hypothesis',
315
+ title: `Hypothesis confirmed: ${hyp.statement}`,
316
+ description: `Confirmed with p-value ${result.pValue.toFixed(4)}, confidence ${result.confidence.toFixed(3)} (${result.evidenceFor} supporting, ${result.evidenceAgainst} opposing observations)`,
317
+ confidence: result.confidence,
318
+ impact: Math.min(1, (result.evidenceFor + result.evidenceAgainst) / 50),
319
+ source: this.brainName,
320
+ data: {
321
+ hypothesisId: result.hypothesisId,
322
+ statement: hyp.statement,
323
+ type: hyp.type,
324
+ pValue: result.pValue,
325
+ evidenceFor: result.evidenceFor,
326
+ evidenceAgainst: result.evidenceAgainst,
327
+ },
328
+ };
329
+ if (!this.isDuplicateDiscovery(discovery)) {
330
+ this.storeDiscovery(discovery);
331
+ discoveries.push(discovery);
332
+ }
333
+ }
334
+ // 4. Parameter optimizations → discoveries
335
+ for (const opt of optimizations) {
336
+ if (discoveries.length >= this.maxDiscoveriesPerCycle)
337
+ break;
338
+ if (opt.confidence < 0.5)
339
+ continue; // only high-confidence optimizations
340
+ const discovery = {
341
+ type: 'parameter_optimization',
342
+ title: `Parameter "${opt.name}" optimized: ${opt.currentValue.toFixed(4)} → ${opt.recommendedValue.toFixed(4)}`,
343
+ description: `Expected improvement: ${(opt.expectedImprovement * 100).toFixed(1)}% (confidence: ${opt.confidence.toFixed(3)}, based on ${opt.evidence} observations)`,
344
+ confidence: opt.confidence,
345
+ impact: Math.min(1, Math.abs(opt.expectedImprovement)),
346
+ source: this.brainName,
347
+ data: {
348
+ parameter: opt.name,
349
+ oldValue: opt.currentValue,
350
+ newValue: opt.recommendedValue,
351
+ improvement: opt.expectedImprovement,
352
+ evidence: opt.evidence,
353
+ },
354
+ };
355
+ if (!this.isDuplicateDiscovery(discovery)) {
356
+ this.storeDiscovery(discovery);
357
+ discoveries.push(discovery);
358
+ }
359
+ }
360
+ return discoveries;
361
+ }
362
+ findSignificantRoots(edges) {
363
+ const causes = new Set(edges.map(e => e.cause));
364
+ const effects = new Set(edges.map(e => e.effect));
365
+ const roots = [...causes].filter(c => !effects.has(c));
366
+ return roots
367
+ .map(root => {
368
+ const rootEdges = edges.filter(e => e.cause === root);
369
+ const avgStrength = rootEdges.reduce((s, e) => s + e.strength, 0) / rootEdges.length;
370
+ const avgConfidence = rootEdges.reduce((s, e) => s + e.confidence, 0) / rootEdges.length;
371
+ return { cause: root, avgStrength, avgConfidence };
372
+ })
373
+ .filter(r => r.avgStrength >= this.minCausalStrength)
374
+ .sort((a, b) => b.avgStrength - a.avgStrength)
375
+ .slice(0, 5);
376
+ }
377
+ isDuplicateDiscovery(discovery) {
378
+ const existing = this.db.prepare('SELECT id FROM research_discoveries WHERE type = ? AND title = ?').get(discovery.type, discovery.title);
379
+ return !!existing;
380
+ }
381
+ storeDiscovery(discovery) {
382
+ this.db.prepare(`
383
+ INSERT INTO research_discoveries (type, title, description, confidence, impact, source, data)
384
+ VALUES (?, ?, ?, ?, ?, ?, ?)
385
+ `).run(discovery.type, discovery.title, discovery.description, discovery.confidence, discovery.impact, discovery.source, JSON.stringify(discovery.data));
386
+ }
387
+ storeCycleReport(report) {
388
+ this.db.prepare(`
389
+ INSERT INTO research_cycle_reports (cycle, timestamp, causal_edges_found, causal_chains_found,
390
+ hypotheses_generated, hypotheses_tested, hypotheses_confirmed, hypotheses_rejected,
391
+ parameters_optimized, discoveries_produced, duration)
392
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
393
+ `).run(report.cycle, report.timestamp, report.causalEdgesFound, report.causalChainsFound, report.hypothesesGenerated, report.hypothesesTested, report.hypothesesConfirmed, report.hypothesesRejected, report.parametersOptimized, report.discoveriesProduced, report.duration);
394
+ }
395
+ emptyReport() {
396
+ return {
397
+ cycle: this.cycleCount,
398
+ timestamp: Date.now(),
399
+ causalEdgesFound: 0,
400
+ causalChainsFound: 0,
401
+ hypothesesGenerated: 0,
402
+ hypothesesTested: 0,
403
+ hypothesesConfirmed: 0,
404
+ hypothesesRejected: 0,
405
+ parametersOptimized: 0,
406
+ discoveriesProduced: 0,
407
+ duration: 0,
408
+ };
409
+ }
410
+ }
411
+ //# sourceMappingURL=autonomous-scheduler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autonomous-scheduler.js","sourceRoot":"","sources":["../../src/research/autonomous-scheduler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AA8C3D,2DAA2D;AAE3D,MAAM,UAAU,6BAA6B,CAAC,EAAqB;IACjE,EAAE,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCP,CAAC,CAAC;AACL,CAAC;AAED,2DAA2D;AAE3D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,2BAA2B;IAkB5B;IAjBF,MAAM,GAAG,SAAS,EAAE,CAAC;IACrB,KAAK,GAA0C,IAAI,CAAC;IACpD,UAAU,GAAyC,IAAI,CAAC;IACxD,UAAU,GAAG,CAAC,CAAC;IACf,OAAO,GAAG,KAAK,CAAC;IAEf,YAAY,CAAqB;IACjC,WAAW,CAAc;IACzB,gBAAgB,CAAmB;IAEpC,SAAS,CAAS;IAClB,UAAU,CAAS;IACnB,cAAc,CAAS;IACvB,iBAAiB,CAAS;IAC1B,sBAAsB,CAAS;IAEvC,YACU,EAAqB,EAC7B,MAAgC;QADxB,OAAE,GAAF,EAAE,CAAmB;QAG7B,6BAA6B,CAAC,EAAE,CAAC,C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B,gBAAgB,EAAE,CAAC;YACnB,iBAAiB,EAAE,CAAC;YACpB,mBAAmB,EAAE,CAAC;YACtB,gBAAgB,EAAE,CAAC;YACnB,mBAAmB,EAAE,CAAC;YACtB,kBAAkB,EAAE,CAAC;YACrB,mBAAmB,EAAE,CAAC;YACtB,mBAAmB,EAAE,CAAC;YACtB,QAAQ,EAAE,CAAC;SACZ,CAAC;IACJ,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timmeck/brain-core",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "description": "Shared core infrastructure for the Brain ecosystem — IPC, MCP, CLI, DB connection, and utilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -43,7 +43,11 @@
43
43
  "./embeddings/engine": "./dist/embeddings/engine.js",
44
44
  "./webhooks/service": "./dist/webhooks/service.js",
45
45
  "./export/service": "./dist/export/service.js",
46
- "./backup/service": "./dist/backup/service.js"
46
+ "./backup/service": "./dist/backup/service.js",
47
+ "./research/autonomous-scheduler": "./dist/research/autonomous-scheduler.js",
48
+ "./meta-learning/engine": "./dist/meta-learning/engine.js",
49
+ "./causal/engine": "./dist/causal/engine.js",
50
+ "./hypothesis/engine": "./dist/hypothesis/engine.js"
47
51
  },
48
52
  "scripts": {
49
53
  "build": "tsc",
@@ -0,0 +1 @@
1
+ {"root":["./src/index.ts","./src/api/middleware.ts","./src/api/server.ts","./src/backup/service.ts","./src/causal/engine.ts","./src/cli/colors.ts","./src/config/loader.ts","./src/config/__tests__/loader.test.ts","./src/cross-brain/client.ts","./src/cross-brain/correlator.ts","./src/cross-brain/notifications.ts","./src/cross-brain/subscription.ts","./src/cross-brain/__tests__/client.test.ts","./src/cross-brain/__tests__/notifications.test.ts","./src/cross-brain/__tests__/subscription.test.ts","./src/dashboard/hub-server.ts","./src/dashboard/server.ts","./src/dashboard/__tests__/server.test.ts","./src/db/connection.ts","./src/db/__tests__/connection.test.ts","./src/ecosystem/service.ts","./src/embeddings/engine.ts","./src/embeddings/__tests__/engine.test.ts","./src/export/service.ts","./src/hypothesis/engine.ts","./src/ipc/client.ts","./src/ipc/errors.ts","./src/ipc/protocol.ts","./src/ipc/server.ts","./src/ipc/validation.ts","./src/ipc/__tests__/integration.test.ts","./src/ipc/__tests__/protocol.test.ts","./src/learning/base-engine.ts","./src/learning/__tests__/base-engine.test.ts","./src/math/time-decay.ts","./src/math/wilson-score.ts","./src/math/__tests__/time-decay.test.ts","./src/math/__tests__/wilson-score.test.ts","./src/mcp/http-server.ts","./src/mcp/server.ts","./src/memory/base-memory-engine.ts","./src/memory/types.ts","./src/memory/__tests__/base-memory-engine.test.ts","./src/meta-learning/engine.ts","./src/research/autonomous-scheduler.ts","./src/research/base-engine.ts","./src/research/__tests__/base-engine.test.ts","./src/synapses/activation.ts","./src/synapses/decay.ts","./src/synapses/hebbian.ts","./src/synapses/pathfinder.ts","./src/synapses/synapse-manager.ts","./src/synapses/types.ts","./src/synapses/__tests__/activation.test.ts","./src/synapses/__tests__/decay.test.ts","./src/synapses/__tests__/hebbian.test.ts","./src/synapses/__tests__/pathfinder.test.ts","./src/synapses/__tests__/synapse-manager.test.ts","./src/types/ipc.types.ts","./src/utils/events.ts","./src/utils/hash.ts","./src/utils/logger.ts","./src/utils/paths.ts","./src/utils/__tests__/events.test.ts","./src/utils/__tests__/hash.test.ts","./src/utils/__tests__/logger.test.ts","./src/utils/__tests__/paths.test.ts","./src/webhooks/service.ts"],"version":"5.9.3"}