@timmeck/brain-core 2.36.54 → 2.36.56
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/command-center.html +111 -0
- package/dist/causal/causal-planner.d.ts +45 -0
- package/dist/causal/causal-planner.js +135 -0
- package/dist/causal/causal-planner.js.map +1 -0
- package/dist/creative/creative-engine.d.ts +81 -0
- package/dist/creative/creative-engine.js +289 -0
- package/dist/creative/creative-engine.js.map +1 -0
- package/dist/creative/index.d.ts +2 -0
- package/dist/creative/index.js +2 -0
- package/dist/creative/index.js.map +1 -0
- package/dist/dashboard/command-center-server.d.ts +6 -0
- package/dist/dashboard/command-center-server.js +58 -1
- package/dist/dashboard/command-center-server.js.map +1 -1
- package/dist/goals/research-roadmap.d.ts +73 -0
- package/dist/goals/research-roadmap.js +231 -0
- package/dist/goals/research-roadmap.js.map +1 -0
- package/dist/guardrails/guardrail-engine.d.ts +82 -0
- package/dist/guardrails/guardrail-engine.js +279 -0
- package/dist/guardrails/guardrail-engine.js.map +1 -0
- package/dist/guardrails/index.d.ts +2 -0
- package/dist/guardrails/index.js +2 -0
- package/dist/guardrails/index.js.map +1 -0
- package/dist/index.d.ts +12 -2
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/llm/anthropic-provider.d.ts +2 -0
- package/dist/llm/anthropic-provider.js +27 -2
- package/dist/llm/anthropic-provider.js.map +1 -1
- package/dist/llm/index.d.ts +2 -2
- package/dist/llm/ollama-provider.d.ts +3 -0
- package/dist/llm/ollama-provider.js +28 -6
- package/dist/llm/ollama-provider.js.map +1 -1
- package/dist/llm/provider.d.ts +3 -1
- package/dist/llm/provider.js.map +1 -1
- package/dist/llm/structured-output.d.ts +6 -1
- package/dist/llm/structured-output.js.map +1 -1
- package/dist/mcp/vision-tools.d.ts +64 -0
- package/dist/mcp/vision-tools.js +106 -0
- package/dist/mcp/vision-tools.js.map +1 -0
- package/dist/research/research-orchestrator.d.ts +12 -0
- package/dist/research/research-orchestrator.js +103 -2
- package/dist/research/research-orchestrator.js.map +1 -1
- package/dist/self-modification/self-modification-engine.js +14 -1
- package/dist/self-modification/self-modification-engine.js.map +1 -1
- package/package.json +1 -1
|
@@ -76,6 +76,10 @@ export class ResearchOrchestrator {
|
|
|
76
76
|
userModelEngine = null;
|
|
77
77
|
consensusEngine = null;
|
|
78
78
|
traceCollector = null;
|
|
79
|
+
guardrailEngine = null;
|
|
80
|
+
causalPlanner = null;
|
|
81
|
+
researchRoadmap = null;
|
|
82
|
+
creativeEngine = null;
|
|
79
83
|
lastAutoMissionTime = 0;
|
|
80
84
|
lastGoalMissionTime = 0;
|
|
81
85
|
onSuggestionCallback = null;
|
|
@@ -257,6 +261,14 @@ export class ResearchOrchestrator {
|
|
|
257
261
|
setConsensusEngine(engine) { this.consensusEngine = engine; }
|
|
258
262
|
/** Set the TraceCollector — auto-instrumentation of research cycles. */
|
|
259
263
|
setTraceCollector(collector) { this.traceCollector = collector; }
|
|
264
|
+
/** Set the GuardrailEngine — safety checks for parameter changes. */
|
|
265
|
+
setGuardrailEngine(engine) { this.guardrailEngine = engine; }
|
|
266
|
+
/** Set the CausalPlanner — diagnose stagnant goals via causal analysis. */
|
|
267
|
+
setCausalPlanner(planner) { this.causalPlanner = planner; }
|
|
268
|
+
/** Set the ResearchRoadmap — multi-step goal decomposition. */
|
|
269
|
+
setResearchRoadmap(roadmap) { this.researchRoadmap = roadmap; }
|
|
270
|
+
/** Set the CreativeEngine — cross-domain idea generation. */
|
|
271
|
+
setCreativeEngine(engine) { this.creativeEngine = engine; }
|
|
260
272
|
/** Set the LLMService — propagates to all engines that can use LLM. */
|
|
261
273
|
setLLMService(llm) {
|
|
262
274
|
this.llmService = llm;
|
|
@@ -1699,7 +1711,9 @@ export class ResearchOrchestrator {
|
|
|
1699
1711
|
}
|
|
1700
1712
|
}
|
|
1701
1713
|
// Step 36: EvolutionEngine — evolve parameter configurations (every generationEvery cycles, default 20)
|
|
1702
|
-
|
|
1714
|
+
// Skip if circuit breaker tripped (guardrails)
|
|
1715
|
+
if (this.evolutionEngine && this.cycleCount % this.evolutionEngine.generationEvery === 0
|
|
1716
|
+
&& !(this.guardrailEngine?.isCircuitBreakerTripped())) {
|
|
1703
1717
|
try {
|
|
1704
1718
|
ts?.emit('evolution', 'reflecting', 'Step 36: Running evolution generation...', 'routine');
|
|
1705
1719
|
const gen = this.evolutionEngine.runGeneration();
|
|
@@ -1826,7 +1840,9 @@ export class ResearchOrchestrator {
|
|
|
1826
1840
|
}
|
|
1827
1841
|
}
|
|
1828
1842
|
// Step 40: SelfModification — propose and test code changes (every 20 cycles)
|
|
1829
|
-
|
|
1843
|
+
// Skip if circuit breaker tripped (guardrails)
|
|
1844
|
+
if (this.selfModificationEngine && this.cycleCount % 20 === 0
|
|
1845
|
+
&& !(this.guardrailEngine?.isCircuitBreakerTripped())) {
|
|
1830
1846
|
try {
|
|
1831
1847
|
// Skip if there are already pending modifications
|
|
1832
1848
|
const pending = this.selfModificationEngine.getPending();
|
|
@@ -2302,6 +2318,91 @@ export class ResearchOrchestrator {
|
|
|
2302
2318
|
}
|
|
2303
2319
|
catch { /* not critical */ }
|
|
2304
2320
|
}
|
|
2321
|
+
// Step 55: GuardrailEngine — health check (every 50 cycles)
|
|
2322
|
+
if (this.guardrailEngine && this.cycleCount % 50 === 0) {
|
|
2323
|
+
try {
|
|
2324
|
+
ts?.emit('guardrails', 'analyzing', 'Step 55: Running health check...', 'routine');
|
|
2325
|
+
const health = this.guardrailEngine.checkHealth();
|
|
2326
|
+
if (health.warnings.length > 0) {
|
|
2327
|
+
this.journal.write({
|
|
2328
|
+
title: `Health Check: ${health.warnings.length} warnings`,
|
|
2329
|
+
content: `Score: ${health.score.toFixed(2)} | ${health.warnings.map(w => `[${w.severity}] ${w.message}`).join('; ')}`,
|
|
2330
|
+
type: 'insight',
|
|
2331
|
+
significance: health.circuitBreakerTripped ? 'breakthrough' : 'notable',
|
|
2332
|
+
tags: [this.brainName, 'guardrails', 'health'],
|
|
2333
|
+
references: [],
|
|
2334
|
+
data: { score: health.score, warningCount: health.warnings.length, circuitBreaker: health.circuitBreakerTripped },
|
|
2335
|
+
});
|
|
2336
|
+
}
|
|
2337
|
+
// Check for auto-rollback
|
|
2338
|
+
this.guardrailEngine.checkAutoRollback();
|
|
2339
|
+
}
|
|
2340
|
+
catch (err) {
|
|
2341
|
+
this.log.warn(`[orchestrator] Step 55 (guardrails) error: ${err.message}`);
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
// Step 56: CausalPlanner — diagnose stagnant goals (every 20 cycles)
|
|
2345
|
+
if (this.causalPlanner && this.cycleCount % 20 === 0) {
|
|
2346
|
+
try {
|
|
2347
|
+
ts?.emit('causal_planner', 'analyzing', 'Step 56: Diagnosing stagnant goals...', 'routine');
|
|
2348
|
+
const diagnoses = this.causalPlanner.diagnoseStagnantGoals();
|
|
2349
|
+
for (const { goal, diagnosis } of diagnoses.slice(0, 3)) {
|
|
2350
|
+
const topCause = diagnosis.rootCauses[0];
|
|
2351
|
+
if (topCause) {
|
|
2352
|
+
this.journal.write({
|
|
2353
|
+
title: `Causal Diagnosis: ${goal.title}`,
|
|
2354
|
+
content: `Root cause: ${topCause.event} (strength: ${topCause.strength.toFixed(2)}, confidence: ${topCause.confidence.toFixed(2)})` +
|
|
2355
|
+
(diagnosis.suggestedInterventions[0] ? ` | Intervention: ${diagnosis.suggestedInterventions[0].action}` : ''),
|
|
2356
|
+
type: 'discovery',
|
|
2357
|
+
significance: 'notable',
|
|
2358
|
+
tags: [this.brainName, 'causal', 'diagnosis'],
|
|
2359
|
+
references: [],
|
|
2360
|
+
data: { goalId: goal.id, rootCause: topCause.event, strength: topCause.strength },
|
|
2361
|
+
});
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
catch (err) {
|
|
2366
|
+
this.log.warn(`[orchestrator] Step 56 (causal planner) error: ${err.message}`);
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
// Step 57: ResearchRoadmap — check roadmap progress (every 10 cycles)
|
|
2370
|
+
if (this.researchRoadmap && this.goalEngine && this.cycleCount % 10 === 0) {
|
|
2371
|
+
try {
|
|
2372
|
+
ts?.emit('roadmap', 'analyzing', 'Step 57: Checking roadmap progress...', 'routine');
|
|
2373
|
+
// Check blocked goals — only evaluate goals that can start
|
|
2374
|
+
const readyGoals = this.researchRoadmap.getReadyGoals();
|
|
2375
|
+
if (readyGoals.length > 0) {
|
|
2376
|
+
ts?.emit('roadmap', 'reflecting', `${readyGoals.length} goals ready to start`, 'routine');
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
catch (err) {
|
|
2380
|
+
this.log.warn(`[orchestrator] Step 57 (roadmap) error: ${err.message}`);
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
// Step 58: CreativeEngine — cross-pollination (every 20 cycles)
|
|
2384
|
+
if (this.creativeEngine && this.cycleCount % 20 === 0) {
|
|
2385
|
+
try {
|
|
2386
|
+
ts?.emit('creative', 'discovering', 'Step 58: Cross-pollinating ideas...', 'routine');
|
|
2387
|
+
const insights = this.creativeEngine.crossPollinate();
|
|
2388
|
+
if (insights.length > 0) {
|
|
2389
|
+
// Convert top insights to hypotheses
|
|
2390
|
+
const converted = this.creativeEngine.convertTopInsights(0.5);
|
|
2391
|
+
this.journal.write({
|
|
2392
|
+
title: `Creative Cross-Pollination: ${insights.length} insights`,
|
|
2393
|
+
content: `Generated ${insights.length} cross-domain insights, ${converted} converted to hypotheses`,
|
|
2394
|
+
type: 'discovery',
|
|
2395
|
+
significance: insights.length > 3 ? 'notable' : 'routine',
|
|
2396
|
+
tags: [this.brainName, 'creative', 'cross-pollination'],
|
|
2397
|
+
references: [],
|
|
2398
|
+
data: { insightCount: insights.length, converted },
|
|
2399
|
+
});
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
catch (err) {
|
|
2403
|
+
this.log.warn(`[orchestrator] Step 58 (creative) error: ${err.message}`);
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2305
2406
|
const duration = Date.now() - start;
|
|
2306
2407
|
ts?.emit('orchestrator', 'reflecting', `Feedback Cycle #${this.cycleCount} complete (${duration}ms)`);
|
|
2307
2408
|
this.log.info(`[orchestrator] ─── Feedback Cycle #${this.cycleCount} complete (${duration}ms) ───`);
|