@timmeck/brain-core 2.6.0 → 2.8.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,243 @@
1
+ import { getLogger } from '../utils/logger.js';
2
+ import { SelfObserver } from './self-observer.js';
3
+ import { AdaptiveStrategyEngine } from './adaptive-strategy.js';
4
+ import { ExperimentEngine } from './experiment-engine.js';
5
+ import { CrossDomainEngine } from './cross-domain-engine.js';
6
+ import { CounterfactualEngine } from './counterfactual-engine.js';
7
+ import { KnowledgeDistiller } from './knowledge-distiller.js';
8
+ import { ResearchAgendaEngine } from './agenda-engine.js';
9
+ import { AnomalyDetective } from './anomaly-detective.js';
10
+ import { ResearchJournal } from './journal.js';
11
+ // ── Orchestrator ────────────────────────────────────────
12
+ export class ResearchOrchestrator {
13
+ selfObserver;
14
+ adaptiveStrategy;
15
+ experimentEngine;
16
+ crossDomain;
17
+ counterfactual;
18
+ knowledgeDistiller;
19
+ researchAgenda;
20
+ anomalyDetective;
21
+ journal;
22
+ dataMiner = null;
23
+ brainName;
24
+ feedbackTimer = null;
25
+ cycleCount = 0;
26
+ distillEvery;
27
+ agendaEvery;
28
+ reflectEvery;
29
+ log = getLogger();
30
+ constructor(db, config, causalGraph) {
31
+ this.brainName = config.brainName;
32
+ this.distillEvery = config.distillEvery ?? 5;
33
+ this.agendaEvery = config.agendaEvery ?? 3;
34
+ this.reflectEvery = config.reflectEvery ?? 10;
35
+ this.selfObserver = new SelfObserver(db, { brainName: config.brainName });
36
+ this.adaptiveStrategy = new AdaptiveStrategyEngine(db, { brainName: config.brainName });
37
+ this.experimentEngine = new ExperimentEngine(db, { brainName: config.brainName });
38
+ this.crossDomain = new CrossDomainEngine(db);
39
+ this.counterfactual = new CounterfactualEngine(db, causalGraph ?? null);
40
+ this.knowledgeDistiller = new KnowledgeDistiller(db, { brainName: config.brainName });
41
+ this.researchAgenda = new ResearchAgendaEngine(db, { brainName: config.brainName });
42
+ this.anomalyDetective = new AnomalyDetective(db, { brainName: config.brainName });
43
+ this.journal = new ResearchJournal(db, { brainName: config.brainName });
44
+ }
45
+ /** Set the DataMiner instance for DB-driven engine feeding. */
46
+ setDataMiner(miner) {
47
+ this.dataMiner = miner;
48
+ }
49
+ /** Start the autonomous feedback loop timer. */
50
+ start(intervalMs = 300_000) {
51
+ if (this.feedbackTimer)
52
+ return;
53
+ this.feedbackTimer = setInterval(() => {
54
+ try {
55
+ this.runFeedbackCycle();
56
+ }
57
+ catch (err) {
58
+ this.log.error('[orchestrator] Feedback cycle error', { error: err.message });
59
+ }
60
+ }, intervalMs);
61
+ this.log.info(`[orchestrator] Research orchestrator started (feedback every ${intervalMs}ms)`);
62
+ }
63
+ /** Stop the feedback loop. */
64
+ stop() {
65
+ if (this.feedbackTimer) {
66
+ clearInterval(this.feedbackTimer);
67
+ this.feedbackTimer = null;
68
+ }
69
+ }
70
+ /**
71
+ * Feed a domain event from the brain's EventBus.
72
+ * Routes to: SelfObserver, AnomalyDetective, CrossDomain.
73
+ */
74
+ onEvent(eventType, data = {}) {
75
+ this.selfObserver.record({
76
+ category: categorize(eventType),
77
+ event_type: eventType,
78
+ metrics: data,
79
+ });
80
+ this.anomalyDetective.recordMetric(eventType, 1);
81
+ this.crossDomain.recordEvent(this.brainName, eventType, data);
82
+ }
83
+ /**
84
+ * Feed a cross-brain event from CrossBrainSubscription.
85
+ * Routes to: CrossDomainEngine, AnomalyDetective.
86
+ */
87
+ onCrossBrainEvent(sourceBrain, eventType, data = {}) {
88
+ this.crossDomain.recordEvent(sourceBrain, eventType, data);
89
+ this.anomalyDetective.recordMetric(`cross:${sourceBrain}:${eventType}`, 1);
90
+ }
91
+ /**
92
+ * Hook into AutonomousResearchScheduler cycle completion.
93
+ * Records discoveries in journal and feeds metrics to anomaly detection.
94
+ */
95
+ onResearchCycleComplete(report) {
96
+ // Record cycle metrics for anomaly detection
97
+ this.anomalyDetective.recordMetric('research_discoveries', report.discoveriesProduced);
98
+ this.anomalyDetective.recordMetric('research_hypotheses_tested', report.hypothesesTested);
99
+ this.anomalyDetective.recordMetric('research_confirmed', report.hypothesesConfirmed);
100
+ this.anomalyDetective.recordMetric('research_duration_ms', report.duration);
101
+ // Self-observe the research cycle
102
+ this.selfObserver.record({
103
+ category: 'latency',
104
+ event_type: 'research:cycle_complete',
105
+ metrics: {
106
+ cycle: report.cycle,
107
+ discoveries: report.discoveriesProduced,
108
+ duration_ms: report.duration,
109
+ confirmed: report.hypothesesConfirmed,
110
+ rejected: report.hypothesesRejected,
111
+ },
112
+ });
113
+ // Journal the cycle
114
+ if (report.discoveriesProduced > 0 || report.hypothesesConfirmed > 0) {
115
+ this.journal.recordDiscovery(`Research Cycle #${report.cycle}`, `Cycle completed: ${report.discoveriesProduced} discoveries, ${report.hypothesesConfirmed} hypotheses confirmed, ${report.hypothesesRejected} rejected, ${report.causalEdgesFound} causal edges. Duration: ${report.duration}ms.`, { report }, report.hypothesesConfirmed > 0 ? 'notable' : 'routine');
116
+ }
117
+ }
118
+ /**
119
+ * Run one autonomous feedback cycle.
120
+ * This is where the engines talk to each other.
121
+ */
122
+ runFeedbackCycle() {
123
+ this.cycleCount++;
124
+ const start = Date.now();
125
+ this.log.info(`[orchestrator] ─── Feedback Cycle #${this.cycleCount} ───`);
126
+ // 0. DataMiner: mine new data from DB into engines
127
+ if (this.dataMiner) {
128
+ try {
129
+ this.dataMiner.mine();
130
+ }
131
+ catch (err) {
132
+ this.log.error(`[orchestrator] DataMiner error: ${err.message}`);
133
+ }
134
+ }
135
+ // 1. Self-observer analyzes accumulated observations → insights
136
+ const insights = this.selfObserver.analyze();
137
+ if (insights.length > 0) {
138
+ this.log.info(`[orchestrator] Self-observer: ${insights.length} insights`);
139
+ for (const insight of insights) {
140
+ this.journal.recordDiscovery(insight.title, insight.description, { ...insight.evidence, type: insight.type, confidence: insight.confidence }, insight.confidence > 0.8 ? 'notable' : 'routine');
141
+ }
142
+ }
143
+ // 2. Anomaly detection
144
+ const anomalies = this.anomalyDetective.detect();
145
+ if (anomalies.length > 0) {
146
+ this.log.info(`[orchestrator] Anomalies detected: ${anomalies.length}`);
147
+ for (const a of anomalies) {
148
+ this.journal.write({
149
+ type: 'anomaly',
150
+ title: a.title,
151
+ content: a.description,
152
+ tags: [this.brainName, 'anomaly', a.type, a.severity],
153
+ references: [],
154
+ significance: a.severity === 'critical' ? 'breakthrough' : a.severity === 'high' ? 'notable' : 'routine',
155
+ data: { metric: a.metric, expected: a.expected_value, actual: a.actual_value, deviation: a.deviation },
156
+ });
157
+ }
158
+ }
159
+ // 3. Cross-domain correlation analysis
160
+ const correlations = this.crossDomain.analyze();
161
+ const significant = correlations.filter(c => Math.abs(c.correlation) > 0.5 && c.p_value < 0.05);
162
+ if (significant.length > 0) {
163
+ this.log.info(`[orchestrator] Cross-domain: ${significant.length} significant correlations`);
164
+ for (const corr of significant) {
165
+ this.journal.recordDiscovery(`Cross-domain: ${corr.source_brain}:${corr.source_event} → ${corr.target_brain}:${corr.target_event}`, corr.narrative, { correlation: corr.correlation, pValue: corr.p_value, lag: corr.lag_seconds }, 'notable');
166
+ }
167
+ }
168
+ // 4. Adaptive strategy: check for regressions and revert
169
+ const reverted = this.adaptiveStrategy.checkAndRevert(this.cycleCount);
170
+ for (const r of reverted) {
171
+ this.journal.write({
172
+ type: 'adaptation',
173
+ title: `Reverted: ${r.strategy}/${r.parameter}`,
174
+ content: `Strategy adaptation reverted: ${r.parameter} from ${r.new_value} back to ${r.old_value}. Reason: ${r.reason}`,
175
+ tags: [this.brainName, 'revert', r.strategy],
176
+ references: [],
177
+ significance: 'notable',
178
+ data: { adaptation: r },
179
+ });
180
+ }
181
+ // 5. Check running experiments
182
+ const experiments = this.experimentEngine.list();
183
+ for (const exp of experiments) {
184
+ if (exp.status === 'analyzing' && exp.id) {
185
+ const result = this.experimentEngine.analyze(exp.id);
186
+ if (result?.conclusion) {
187
+ const sig = result.conclusion.significant;
188
+ this.journal.recordExperiment(exp.name, sig ? (result.conclusion.direction === 'positive' ? 'confirmed' : 'rejected') : 'inconclusive', { conclusion: result.conclusion, hypothesis: exp.hypothesis }, sig);
189
+ this.log.info(`[orchestrator] Experiment "${exp.name}": ${sig ? result.conclusion.direction : 'inconclusive'} (p=${result.conclusion.p_value.toFixed(4)}, d=${result.conclusion.effect_size.toFixed(2)})`);
190
+ }
191
+ }
192
+ }
193
+ // 6. Knowledge distillation (periodic)
194
+ if (this.cycleCount % this.distillEvery === 0) {
195
+ const { principles, antiPatterns, strategies } = this.knowledgeDistiller.distill();
196
+ if (principles.length + antiPatterns.length + strategies.length > 0) {
197
+ this.log.info(`[orchestrator] Knowledge distilled: ${principles.length} principles, ${antiPatterns.length} anti-patterns, ${strategies.length} strategies`);
198
+ }
199
+ }
200
+ // 7. Research agenda generation (periodic)
201
+ if (this.cycleCount % this.agendaEvery === 0) {
202
+ const agenda = this.researchAgenda.generate();
203
+ if (agenda.length > 0) {
204
+ this.log.info(`[orchestrator] Research agenda: ${agenda.length} items generated`);
205
+ }
206
+ }
207
+ // 8. Journal reflection (periodic)
208
+ if (this.cycleCount % this.reflectEvery === 0) {
209
+ this.journal.reflect();
210
+ }
211
+ const duration = Date.now() - start;
212
+ this.log.info(`[orchestrator] ─── Feedback Cycle #${this.cycleCount} complete (${duration}ms) ───`);
213
+ }
214
+ /** Get a comprehensive research summary for dashboards/API. */
215
+ getSummary() {
216
+ return {
217
+ brainName: this.brainName,
218
+ feedbackCycles: this.cycleCount,
219
+ dataMiner: this.dataMiner?.getState() ?? null,
220
+ selfInsights: this.selfObserver.getInsights(undefined, 10),
221
+ anomalies: this.anomalyDetective.getAnomalies(undefined, 10),
222
+ experiments: this.experimentEngine.list(undefined, 10),
223
+ agenda: this.researchAgenda.getAgenda(10),
224
+ journal: this.journal.getSummary(),
225
+ knowledge: this.knowledgeDistiller.getSummary(),
226
+ correlations: this.crossDomain.getCorrelations(10),
227
+ strategy: this.adaptiveStrategy.getStatus(),
228
+ };
229
+ }
230
+ }
231
+ // ── Helpers ─────────────────────────────────────────────
232
+ function categorize(eventType) {
233
+ if (eventType.includes('cross_brain') || eventType.includes('cross:'))
234
+ return 'cross_brain';
235
+ if (eventType.includes('latency') || eventType.includes('duration'))
236
+ return 'latency';
237
+ if (eventType.includes('resolution') || eventType.includes('solved'))
238
+ return 'resolution_rate';
239
+ if (eventType.includes('query') || eventType.includes('search') || eventType.includes('recall'))
240
+ return 'query_quality';
241
+ return 'tool_usage';
242
+ }
243
+ //# sourceMappingURL=research-orchestrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"research-orchestrator.js","sourceRoot":"","sources":["../../src/research/research-orchestrator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAA4B,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAmB/C,2DAA2D;AAE3D,MAAM,OAAO,oBAAoB;IACtB,YAAY,CAAe;IAC3B,gBAAgB,CAAyB;IACzC,gBAAgB,CAAmB;IACnC,WAAW,CAAoB;IAC/B,cAAc,CAAuB;IACrC,kBAAkB,CAAqB;IACvC,cAAc,CAAuB;IACrC,gBAAgB,CAAmB;IACnC,OAAO,CAAkB;IAE1B,SAAS,GAAqB,IAAI,CAAC;IAEnC,SAAS,CAAS;IAClB,aAAa,GAA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ACxH,OAAO,YAAY,CAAC;AACtB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timmeck/brain-core",
3
- "version": "2.6.0",
3
+ "version": "2.8.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",