@timmeck/brain-core 2.36.19 → 2.36.21
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/README.md +93 -135
- package/command-center.html +163 -18
- package/dist/consciousness/__tests__/thought-stream.test.d.ts +1 -0
- package/dist/consciousness/__tests__/thought-stream.test.js +62 -0
- package/dist/consciousness/__tests__/thought-stream.test.js.map +1 -0
- package/dist/consciousness/thought-stream.d.ts +2 -0
- package/dist/consciousness/thought-stream.js +4 -0
- package/dist/consciousness/thought-stream.js.map +1 -1
- package/dist/dashboard/__tests__/command-center-server.test.js +8 -2
- package/dist/dashboard/__tests__/command-center-server.test.js.map +1 -1
- package/dist/dashboard/command-center-server.d.ts +5 -0
- package/dist/dashboard/command-center-server.js +39 -1
- package/dist/dashboard/command-center-server.js.map +1 -1
- package/dist/debate/debate-engine.js +1 -1
- package/dist/debate/debate-engine.js.map +1 -1
- package/dist/missions/__tests__/mission-engine.test.d.ts +1 -0
- package/dist/missions/__tests__/mission-engine.test.js +67 -0
- package/dist/missions/__tests__/mission-engine.test.js.map +1 -0
- package/dist/missions/mission-engine.js +5 -0
- package/dist/missions/mission-engine.js.map +1 -1
- package/dist/narrative/narrative-engine.js +5 -5
- package/dist/narrative/narrative-engine.js.map +1 -1
- package/dist/plugin/example-plugin.d.ts +40 -0
- package/dist/plugin/example-plugin.js +91 -0
- package/dist/plugin/example-plugin.js.map +1 -0
- package/dist/prediction/prediction-engine.js +1 -1
- package/dist/research/research-orchestrator.d.ts +4 -1
- package/dist/research/research-orchestrator.js +42 -11
- package/dist/research/research-orchestrator.js.map +1 -1
- package/dist/utils/__tests__/logger.test.js +26 -0
- package/dist/utils/__tests__/logger.test.js.map +1 -1
- package/dist/utils/logger.js +10 -3
- package/dist/utils/logger.js.map +1 -1
- package/dist/watchdog/watchdog-service.d.ts +4 -0
- package/dist/watchdog/watchdog-service.js +42 -2
- package/dist/watchdog/watchdog-service.js.map +1 -1
- package/package.json +1 -1
|
@@ -74,6 +74,8 @@ export class ResearchOrchestrator {
|
|
|
74
74
|
lastSuggestionsHash = '';
|
|
75
75
|
/** Cycle number of last written suggestions — write at most once per cycle. */
|
|
76
76
|
lastSuggestionsCycle = -1;
|
|
77
|
+
/** Recent debate topic keys to prevent repeating the same debate. */
|
|
78
|
+
recentDebateTopics = [];
|
|
77
79
|
constructor(db, config, causalGraph) {
|
|
78
80
|
this.db = db;
|
|
79
81
|
this.brainName = config.brainName;
|
|
@@ -113,6 +115,15 @@ export class ResearchOrchestrator {
|
|
|
113
115
|
setThoughtStream(stream) {
|
|
114
116
|
this.thoughtStream = stream;
|
|
115
117
|
this.autoResponder.setThoughtStream(stream);
|
|
118
|
+
// Register all known engines so they appear in getEngineActivity() from the start
|
|
119
|
+
const engineNames = [
|
|
120
|
+
'orchestrator', 'self_observer', 'adaptive_strategy', 'experiment',
|
|
121
|
+
'cross_domain', 'counterfactual', 'knowledge_distiller', 'research_agenda',
|
|
122
|
+
'anomaly_detective', 'journal', 'hypothesis', 'prediction', 'mission_engine',
|
|
123
|
+
];
|
|
124
|
+
for (const name of engineNames) {
|
|
125
|
+
stream.registerEngine(name);
|
|
126
|
+
}
|
|
116
127
|
}
|
|
117
128
|
/** Set the SignalScanner — feeds scan results into journal/predictions. */
|
|
118
129
|
setSignalScanner(scanner) {
|
|
@@ -1657,32 +1668,46 @@ export class ResearchOrchestrator {
|
|
|
1657
1668
|
/** Analyze Brain's own state and generate concrete improvement suggestions.
|
|
1658
1669
|
* Tracks suggestion history — if a suggestion repeats 3+ times without resolution,
|
|
1659
1670
|
* Brain tries alternative strategies instead of repeating itself. */
|
|
1660
|
-
/** Pick a debate topic from recent attention, anomalies, or journal insights.
|
|
1671
|
+
/** Pick a debate topic from recent attention, anomalies, or journal insights.
|
|
1672
|
+
* Avoids repeating the same topic within the last 10 debates. */
|
|
1661
1673
|
pickDebateTopic() {
|
|
1662
|
-
|
|
1674
|
+
const maxHistory = 10;
|
|
1675
|
+
const isRecent = (key) => this.recentDebateTopics.includes(key);
|
|
1676
|
+
const recordTopic = (key, topic) => {
|
|
1677
|
+
this.recentDebateTopics.push(key);
|
|
1678
|
+
if (this.recentDebateTopics.length > maxHistory)
|
|
1679
|
+
this.recentDebateTopics.shift();
|
|
1680
|
+
return topic;
|
|
1681
|
+
};
|
|
1682
|
+
// Try attention-based topics — pick first non-recent one
|
|
1663
1683
|
if (this.attentionEngine) {
|
|
1664
1684
|
try {
|
|
1665
|
-
const topics = this.attentionEngine.getTopTopics(
|
|
1666
|
-
|
|
1667
|
-
|
|
1685
|
+
const topics = this.attentionEngine.getTopTopics(5);
|
|
1686
|
+
for (const t of topics) {
|
|
1687
|
+
if (!isRecent(`attention:${t.topic}`)) {
|
|
1688
|
+
return recordTopic(`attention:${t.topic}`, `What should ${this.brainName} prioritize regarding "${t.topic}"?`);
|
|
1689
|
+
}
|
|
1668
1690
|
}
|
|
1669
1691
|
}
|
|
1670
1692
|
catch { /* not wired */ }
|
|
1671
1693
|
}
|
|
1672
|
-
// Try recent anomalies
|
|
1694
|
+
// Try recent anomalies — pick first non-recent one
|
|
1673
1695
|
try {
|
|
1674
1696
|
const anomalies = this.anomalyDetective.getAnomalies(undefined, 5);
|
|
1675
|
-
|
|
1676
|
-
|
|
1697
|
+
for (const a of anomalies) {
|
|
1698
|
+
if (!isRecent(`anomaly:${a.title}`)) {
|
|
1699
|
+
return recordTopic(`anomaly:${a.title}`, `How should we respond to the anomaly: "${a.title}"?`);
|
|
1700
|
+
}
|
|
1677
1701
|
}
|
|
1678
1702
|
}
|
|
1679
1703
|
catch { /* empty */ }
|
|
1680
1704
|
// Try recent journal breakthroughs
|
|
1681
1705
|
try {
|
|
1682
1706
|
const entries = this.journal.search('breakthrough', 5);
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1707
|
+
for (const e of entries) {
|
|
1708
|
+
if (e.significance === 'breakthrough' && !isRecent(`journal:${e.title}`)) {
|
|
1709
|
+
return recordTopic(`journal:${e.title}`, `What are the implications of: "${e.title}"?`);
|
|
1710
|
+
}
|
|
1686
1711
|
}
|
|
1687
1712
|
}
|
|
1688
1713
|
catch { /* empty */ }
|
|
@@ -1999,9 +2024,15 @@ export class ResearchOrchestrator {
|
|
|
1999
2024
|
}
|
|
2000
2025
|
history.count++;
|
|
2001
2026
|
history.lastCycle = this.cycleCount;
|
|
2027
|
+
// Max repeats: after stalledThreshold + alternatives exhausted twice, suppress silently
|
|
2028
|
+
const maxRepeats = this.stalledThreshold + Math.max(item.alternatives.length, 1) * 2;
|
|
2002
2029
|
if (history.count <= this.stalledThreshold) {
|
|
2003
2030
|
suggestions.push(item.suggestion);
|
|
2004
2031
|
}
|
|
2032
|
+
else if (history.count > maxRepeats) {
|
|
2033
|
+
// Silently suppress — user has seen this enough times
|
|
2034
|
+
continue;
|
|
2035
|
+
}
|
|
2005
2036
|
else if (item.alternatives.length > 0) {
|
|
2006
2037
|
const altIndex = (history.count - this.stalledThreshold - 1) % item.alternatives.length;
|
|
2007
2038
|
const alt = item.alternatives[altIndex];
|