@timmeck/brain-core 2.4.0 → 2.6.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.
Files changed (35) hide show
  1. package/dist/index.d.ts +20 -0
  2. package/dist/index.js +20 -0
  3. package/dist/index.js.map +1 -1
  4. package/dist/research/adaptive-strategy.d.ts +56 -0
  5. package/dist/research/adaptive-strategy.js +236 -0
  6. package/dist/research/adaptive-strategy.js.map +1 -0
  7. package/dist/research/agenda-engine.d.ts +46 -0
  8. package/dist/research/agenda-engine.js +264 -0
  9. package/dist/research/agenda-engine.js.map +1 -0
  10. package/dist/research/anomaly-detective.d.ts +62 -0
  11. package/dist/research/anomaly-detective.js +318 -0
  12. package/dist/research/anomaly-detective.js.map +1 -0
  13. package/dist/research/autonomous-scheduler.d.ts +124 -0
  14. package/dist/research/autonomous-scheduler.js +411 -0
  15. package/dist/research/autonomous-scheduler.js.map +1 -0
  16. package/dist/research/counterfactual-engine.d.ts +63 -0
  17. package/dist/research/counterfactual-engine.js +263 -0
  18. package/dist/research/counterfactual-engine.js.map +1 -0
  19. package/dist/research/cross-domain-engine.d.ts +52 -0
  20. package/dist/research/cross-domain-engine.js +283 -0
  21. package/dist/research/cross-domain-engine.js.map +1 -0
  22. package/dist/research/experiment-engine.d.ts +77 -0
  23. package/dist/research/experiment-engine.js +328 -0
  24. package/dist/research/experiment-engine.js.map +1 -0
  25. package/dist/research/journal.d.ts +62 -0
  26. package/dist/research/journal.js +262 -0
  27. package/dist/research/journal.js.map +1 -0
  28. package/dist/research/knowledge-distiller.d.ts +95 -0
  29. package/dist/research/knowledge-distiller.js +426 -0
  30. package/dist/research/knowledge-distiller.js.map +1 -0
  31. package/dist/research/self-observer.d.ts +55 -0
  32. package/dist/research/self-observer.js +268 -0
  33. package/dist/research/self-observer.js.map +1 -0
  34. package/package.json +2 -1
  35. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,268 @@
1
+ import { getLogger } from '../utils/logger.js';
2
+ // ── Migration ───────────────────────────────────────────
3
+ export function runSelfObserverMigration(db) {
4
+ db.exec(`
5
+ CREATE TABLE IF NOT EXISTS self_observations (
6
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
7
+ timestamp INTEGER NOT NULL,
8
+ category TEXT NOT NULL,
9
+ event_type TEXT NOT NULL,
10
+ metrics TEXT NOT NULL,
11
+ context TEXT,
12
+ created_at TEXT DEFAULT (datetime('now'))
13
+ );
14
+ CREATE INDEX IF NOT EXISTS idx_self_obs_category ON self_observations(category);
15
+ CREATE INDEX IF NOT EXISTS idx_self_obs_event ON self_observations(event_type);
16
+ CREATE INDEX IF NOT EXISTS idx_self_obs_ts ON self_observations(timestamp);
17
+
18
+ CREATE TABLE IF NOT EXISTS self_insights (
19
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
20
+ timestamp INTEGER NOT NULL,
21
+ type TEXT NOT NULL,
22
+ title TEXT NOT NULL,
23
+ description TEXT NOT NULL,
24
+ evidence TEXT NOT NULL,
25
+ confidence REAL NOT NULL,
26
+ actionable INTEGER DEFAULT 0,
27
+ created_at TEXT DEFAULT (datetime('now'))
28
+ );
29
+ CREATE INDEX IF NOT EXISTS idx_self_insights_type ON self_insights(type);
30
+ `);
31
+ }
32
+ // ── Engine ──────────────────────────────────────────────
33
+ export class SelfObserver {
34
+ db;
35
+ config;
36
+ log = getLogger();
37
+ constructor(db, config) {
38
+ this.db = db;
39
+ this.config = {
40
+ brainName: config.brainName,
41
+ minObservationsForInsight: config.minObservationsForInsight ?? 10,
42
+ analysisWindow: config.analysisWindow ?? 500,
43
+ };
44
+ runSelfObserverMigration(db);
45
+ }
46
+ /** Record a self-observation about tool usage, query quality, etc. */
47
+ record(obs) {
48
+ const timestamp = Date.now();
49
+ this.db.prepare(`
50
+ INSERT INTO self_observations (timestamp, category, event_type, metrics, context)
51
+ VALUES (?, ?, ?, ?, ?)
52
+ `).run(timestamp, obs.category, obs.event_type, JSON.stringify(obs.metrics), obs.context ? JSON.stringify(obs.context) : null);
53
+ }
54
+ /** Get observation statistics grouped by category and event type. */
55
+ getStats() {
56
+ const byCategory = this.db.prepare(`
57
+ SELECT category, COUNT(*) as count,
58
+ AVG(json_extract(metrics, '$.duration_ms')) as avg_duration,
59
+ AVG(json_extract(metrics, '$.result_count')) as avg_results,
60
+ AVG(json_extract(metrics, '$.success')) as success_rate
61
+ FROM self_observations
62
+ GROUP BY category
63
+ ORDER BY count DESC
64
+ `).all();
65
+ const byEventType = this.db.prepare(`
66
+ SELECT event_type, COUNT(*) as count,
67
+ AVG(json_extract(metrics, '$.duration_ms')) as avg_duration,
68
+ AVG(json_extract(metrics, '$.result_count')) as avg_results
69
+ FROM self_observations
70
+ GROUP BY event_type
71
+ ORDER BY count DESC
72
+ LIMIT 20
73
+ `).all();
74
+ const total = this.db.prepare(`SELECT COUNT(*) as count FROM self_observations`).get();
75
+ return {
76
+ totalObservations: total.count,
77
+ byCategory,
78
+ topEventTypes: byEventType,
79
+ };
80
+ }
81
+ /** Analyze observations and generate insights. */
82
+ analyze() {
83
+ const total = this.db.prepare(`SELECT COUNT(*) as c FROM self_observations`).get().c;
84
+ if (total < this.config.minObservationsForInsight)
85
+ return [];
86
+ const insights = [];
87
+ // 1. Usage pattern insights — which tools are used most/least
88
+ const usagePatterns = this.db.prepare(`
89
+ SELECT event_type, COUNT(*) as count
90
+ FROM self_observations
91
+ WHERE category = 'tool_usage'
92
+ GROUP BY event_type
93
+ ORDER BY count DESC
94
+ `).all();
95
+ if (usagePatterns.length >= 2) {
96
+ const top = usagePatterns[0];
97
+ const bottom = usagePatterns[usagePatterns.length - 1];
98
+ if (top.count > bottom.count * 5) {
99
+ insights.push(this.createInsight('usage_pattern', `${top.event_type} is used ${Math.round(top.count / bottom.count)}x more than ${bottom.event_type}`, `Users strongly prefer ${top.event_type} (${top.count} calls) over ${bottom.event_type} (${bottom.count} calls). Consider optimizing the popular tool or investigating why the other is underused.`, { top, bottom, ratio: top.count / bottom.count }, Math.min(0.9, 0.5 + (top.count / (top.count + bottom.count))), true));
100
+ }
101
+ }
102
+ // 2. Quality insights — tools that return empty results
103
+ const qualityIssues = this.db.prepare(`
104
+ SELECT event_type,
105
+ COUNT(*) as total,
106
+ SUM(CASE WHEN json_extract(metrics, '$.result_count') = 0 THEN 1 ELSE 0 END) as empty_count
107
+ FROM self_observations
108
+ WHERE category = 'query_quality' AND json_extract(metrics, '$.result_count') IS NOT NULL
109
+ GROUP BY event_type
110
+ HAVING total >= 5
111
+ `).all();
112
+ for (const q of qualityIssues) {
113
+ const emptyRate = q.empty_count / q.total;
114
+ if (emptyRate > 0.5) {
115
+ insights.push(this.createInsight('quality_issue', `${(emptyRate * 100).toFixed(0)}% of ${q.event_type} calls return empty results`, `${q.event_type} returns no results in ${q.empty_count}/${q.total} calls (${(emptyRate * 100).toFixed(0)}%). The underlying algorithm may need improvement.`, { event_type: q.event_type, total: q.total, empty_count: q.empty_count, empty_rate: emptyRate }, Math.min(0.95, 0.5 + emptyRate * 0.4), true));
116
+ }
117
+ }
118
+ // 3. Latency insights — slow operations
119
+ const latencyIssues = this.db.prepare(`
120
+ SELECT event_type,
121
+ COUNT(*) as total,
122
+ AVG(json_extract(metrics, '$.duration_ms')) as avg_ms,
123
+ MAX(json_extract(metrics, '$.duration_ms')) as max_ms
124
+ FROM self_observations
125
+ WHERE category = 'latency' AND json_extract(metrics, '$.duration_ms') IS NOT NULL
126
+ GROUP BY event_type
127
+ HAVING total >= 3
128
+ ORDER BY avg_ms DESC
129
+ LIMIT 5
130
+ `).all();
131
+ const overallAvg = this.db.prepare(`
132
+ SELECT AVG(json_extract(metrics, '$.duration_ms')) as avg
133
+ FROM self_observations
134
+ WHERE category = 'latency' AND json_extract(metrics, '$.duration_ms') IS NOT NULL
135
+ `).get();
136
+ if (overallAvg?.avg && latencyIssues.length > 0) {
137
+ for (const l of latencyIssues) {
138
+ if (l.avg_ms > overallAvg.avg * 3) {
139
+ insights.push(this.createInsight('optimization_opportunity', `${l.event_type} is ${(l.avg_ms / overallAvg.avg).toFixed(1)}x slower than average`, `${l.event_type} averages ${l.avg_ms.toFixed(0)}ms (overall avg: ${overallAvg.avg.toFixed(0)}ms). Peak: ${l.max_ms.toFixed(0)}ms. Consider optimizing.`, { event_type: l.event_type, avg_ms: l.avg_ms, max_ms: l.max_ms, overall_avg: overallAvg.avg }, 0.8, true));
140
+ }
141
+ }
142
+ }
143
+ // 4. Resolution rate insights
144
+ const resolutionData = this.db.prepare(`
145
+ SELECT json_extract(metrics, '$.tag') as tag,
146
+ COUNT(*) as total,
147
+ SUM(CASE WHEN json_extract(metrics, '$.resolved') = 1 THEN 1 ELSE 0 END) as resolved
148
+ FROM self_observations
149
+ WHERE category = 'resolution_rate' AND json_extract(metrics, '$.tag') IS NOT NULL
150
+ GROUP BY tag
151
+ HAVING total >= 3
152
+ `).all();
153
+ for (const r of resolutionData) {
154
+ const rate = r.resolved / r.total;
155
+ if (rate < 0.3) {
156
+ insights.push(this.createInsight('quality_issue', `Low resolution rate for "${r.tag}" errors: ${(rate * 100).toFixed(0)}%`, `Errors tagged "${r.tag}" are resolved only ${(rate * 100).toFixed(0)}% of the time (${r.resolved}/${r.total}). Knowledge in this area is weak.`, { tag: r.tag, total: r.total, resolved: r.resolved, rate }, Math.min(0.9, 0.6 + (1 - rate) * 0.3), true));
157
+ }
158
+ }
159
+ // Persist insights
160
+ for (const insight of insights) {
161
+ this.persistInsight(insight);
162
+ }
163
+ return insights;
164
+ }
165
+ /** Get all insights, optionally filtered by type. */
166
+ getInsights(type, limit = 20) {
167
+ let sql = `SELECT * FROM self_insights`;
168
+ const params = [];
169
+ if (type) {
170
+ sql += ` WHERE type = ?`;
171
+ params.push(type);
172
+ }
173
+ sql += ` ORDER BY timestamp DESC LIMIT ?`;
174
+ params.push(limit);
175
+ return this.db.prepare(sql).all(...params).map(row => ({
176
+ id: row.id,
177
+ timestamp: row.timestamp,
178
+ type: row.type,
179
+ title: row.title,
180
+ description: row.description,
181
+ evidence: JSON.parse(row.evidence),
182
+ confidence: row.confidence,
183
+ actionable: row.actionable === 1,
184
+ }));
185
+ }
186
+ /** Generate an improvement plan based on insights. */
187
+ getImprovementPlan() {
188
+ const insights = this.getInsights(undefined, 50);
189
+ const suggestions = [];
190
+ for (const insight of insights) {
191
+ if (!insight.actionable)
192
+ continue;
193
+ let suggestion;
194
+ switch (insight.type) {
195
+ case 'quality_issue':
196
+ suggestion = {
197
+ area: 'Quality',
198
+ problem: insight.title,
199
+ suggestion: `Improve the algorithm or data behind this operation. ${insight.description}`,
200
+ evidence: insight.evidence,
201
+ priority: insight.confidence * 0.9,
202
+ estimated_impact: 'medium',
203
+ };
204
+ break;
205
+ case 'optimization_opportunity':
206
+ suggestion = {
207
+ area: 'Performance',
208
+ problem: insight.title,
209
+ suggestion: `Optimize this operation to reduce latency. ${insight.description}`,
210
+ evidence: insight.evidence,
211
+ priority: insight.confidence * 0.7,
212
+ estimated_impact: 'low',
213
+ };
214
+ break;
215
+ case 'usage_pattern':
216
+ suggestion = {
217
+ area: 'UX',
218
+ problem: insight.title,
219
+ suggestion: `Investigate why certain tools are underused. ${insight.description}`,
220
+ evidence: insight.evidence,
221
+ priority: insight.confidence * 0.5,
222
+ estimated_impact: 'medium',
223
+ };
224
+ break;
225
+ case 'anomaly':
226
+ suggestion = {
227
+ area: 'Reliability',
228
+ problem: insight.title,
229
+ suggestion: `Investigate this anomaly. ${insight.description}`,
230
+ evidence: insight.evidence,
231
+ priority: insight.confidence * 0.8,
232
+ estimated_impact: 'high',
233
+ };
234
+ break;
235
+ default:
236
+ continue;
237
+ }
238
+ suggestions.push(suggestion);
239
+ }
240
+ return suggestions.sort((a, b) => b.priority - a.priority);
241
+ }
242
+ createInsight(type, title, description, evidence, confidence, actionable) {
243
+ return {
244
+ timestamp: Date.now(),
245
+ type,
246
+ title,
247
+ description,
248
+ evidence,
249
+ confidence,
250
+ actionable,
251
+ };
252
+ }
253
+ persistInsight(insight) {
254
+ // Avoid duplicates: check if similar insight exists recently (last 24h)
255
+ const existing = this.db.prepare(`
256
+ SELECT id FROM self_insights
257
+ WHERE title = ? AND timestamp > ?
258
+ LIMIT 1
259
+ `).get(insight.title, Date.now() - 86_400_000);
260
+ if (existing)
261
+ return;
262
+ this.db.prepare(`
263
+ INSERT INTO self_insights (timestamp, type, title, description, evidence, confidence, actionable)
264
+ VALUES (?, ?, ?, ?, ?, ?, ?)
265
+ `).run(insight.timestamp, insight.type, insight.title, insight.description, JSON.stringify(insight.evidence), insight.confidence, insight.actionable ? 1 : 0);
266
+ }
267
+ }
268
+ //# sourceMappingURL=self-observer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"self-observer.js","sourceRoot":"","sources":["../../src/research/self-observer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA4C/C,2DAA2D;AAE3D,MAAM,UAAU,wBAAwB,CAAC,EAAqB;IAC5D,EAAE,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BP,CAAC,CAAC;AACL,CAAC;AAED,2DAA2D;AAE3D,MAAM,OAAO,YAAY;IACf,EAAE,CAAoB;IACtB,MAAM,CAA+B;IACrC,GAAG,GAAG,SAAS,EAAE,CAAC;IAE1B,YAAY,EAAqB,EAAE,MAA0B;QAC3D,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,MAAM,GAAG;YACZ,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,yBAAyB,EAAE,MAAM,CAAC,yBAAyB,IAAI,EAAE;YACjE,cAAc,EAAE,MAAM,CAAC,cAAc,IAAI,GAAG;SAC7C,CAAC;QACF,wBAAwB,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;IAED,sEAAsE;IACtE,MAAM,CAAC,GAA8C;QACnD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC;;;KAGf,CAAC,CAAC,GA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ED,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC7D,CAAC;IAEO,aAAa,CACnB,IAAiB,EAAE,KAAa,EAAE,WAAmB,EACrD,QAAiC,EAAE,UAAkB,EAAE,UAAmB;QAE1E,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,IAAI;YACJ,KAAK;YACL,WAAW;YACX,QAAQ;YACR,UAAU;YACV,UAAU;SACX,CAAC;IACJ,CAAC;IAEO,cAAc,CAAC,OAAoB;QACzC,wEAAwE;QACxE,MAAM,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC;;;;KAIhC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,CAAC;QAE/C,IAAI,QAAQ;YAAE,OAAO;QAErB,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC;;;KAGf,CAAC,CAAC,GAAG,CACJ,OAAO,CAAC,SAAS,EACjB,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,KAAK,EACb,OAAO,CAAC,WAAW,EACnB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAChC,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC3B,CAAC;IACJ,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timmeck/brain-core",
3
- "version": "2.4.0",
3
+ "version": "2.6.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",
@@ -44,6 +44,7 @@
44
44
  "./webhooks/service": "./dist/webhooks/service.js",
45
45
  "./export/service": "./dist/export/service.js",
46
46
  "./backup/service": "./dist/backup/service.js",
47
+ "./research/autonomous-scheduler": "./dist/research/autonomous-scheduler.js",
47
48
  "./meta-learning/engine": "./dist/meta-learning/engine.js",
48
49
  "./causal/engine": "./dist/causal/engine.js",
49
50
  "./hypothesis/engine": "./dist/hypothesis/engine.js"
@@ -1 +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/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"}
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"}