@timmeck/brain-core 2.36.63 → 2.36.65
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 +59 -2
- package/dist/action/handlers/index.d.ts +2 -0
- package/dist/action/handlers/index.js +1 -0
- package/dist/action/handlers/index.js.map +1 -1
- package/dist/action/handlers/mission-handler.d.ts +17 -0
- package/dist/action/handlers/mission-handler.js +49 -0
- package/dist/action/handlers/mission-handler.js.map +1 -0
- package/dist/action/index.d.ts +2 -2
- package/dist/action/index.js +1 -1
- package/dist/action/index.js.map +1 -1
- package/dist/dashboard/command-center-server.d.ts +1 -0
- package/dist/dashboard/command-center-server.js +13 -1
- package/dist/dashboard/command-center-server.js.map +1 -1
- package/dist/governance/engine-registry.d.ts +61 -0
- package/dist/governance/engine-registry.js +301 -0
- package/dist/governance/engine-registry.js.map +1 -0
- package/dist/governance/governance-layer.d.ts +75 -0
- package/dist/governance/governance-layer.js +231 -0
- package/dist/governance/governance-layer.js.map +1 -0
- package/dist/governance/index.d.ts +8 -0
- package/dist/governance/index.js +5 -0
- package/dist/governance/index.js.map +1 -0
- package/dist/governance/loop-detector.d.ts +46 -0
- package/dist/governance/loop-detector.js +266 -0
- package/dist/governance/loop-detector.js.map +1 -0
- package/dist/governance/runtime-influence-tracker.d.ts +50 -0
- package/dist/governance/runtime-influence-tracker.js +163 -0
- package/dist/governance/runtime-influence-tracker.js.map +1 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/metacognition/evolution-engine.d.ts +3 -0
- package/dist/metacognition/evolution-engine.js +25 -1
- package/dist/metacognition/evolution-engine.js.map +1 -1
- package/dist/narrative/narrative-engine.d.ts +4 -0
- package/dist/narrative/narrative-engine.js +17 -0
- package/dist/narrative/narrative-engine.js.map +1 -1
- package/dist/research/research-orchestrator.d.ts +12 -0
- package/dist/research/research-orchestrator.js +124 -5
- package/dist/research/research-orchestrator.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { EngineRegistry, runEngineRegistryMigration, getDefaultEngineProfiles } from './engine-registry.js';
|
|
2
|
+
export type { EngineProfile, EngineRegistryStatus } from './engine-registry.js';
|
|
3
|
+
export { RuntimeInfluenceTracker, runRuntimeInfluenceMigration } from './runtime-influence-tracker.js';
|
|
4
|
+
export type { InfluenceEdge, InfluenceGraph, RuntimeInfluenceStatus } from './runtime-influence-tracker.js';
|
|
5
|
+
export { LoopDetector, runLoopDetectorMigration } from './loop-detector.js';
|
|
6
|
+
export type { LoopDetection, LoopType, LoopSeverity, LoopDetectorStatus } from './loop-detector.js';
|
|
7
|
+
export { GovernanceLayer, runGovernanceMigration } from './governance-layer.js';
|
|
8
|
+
export type { GovernanceAction, GovernanceActionType, GovernanceDecision, GovernanceLayerStatus } from './governance-layer.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { EngineRegistry, runEngineRegistryMigration, getDefaultEngineProfiles } from './engine-registry.js';
|
|
2
|
+
export { RuntimeInfluenceTracker, runRuntimeInfluenceMigration } from './runtime-influence-tracker.js';
|
|
3
|
+
export { LoopDetector, runLoopDetectorMigration } from './loop-detector.js';
|
|
4
|
+
export { GovernanceLayer, runGovernanceMigration } from './governance-layer.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/governance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAG5G,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAGvG,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAG5E,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LoopDetector — Anti-pattern detection for the engine ecosystem.
|
|
3
|
+
* Detects: retrigger spirals, stagnation, KPI gaming, epistemic drift.
|
|
4
|
+
*/
|
|
5
|
+
import type Database from 'better-sqlite3';
|
|
6
|
+
import type { RuntimeInfluenceTracker } from './runtime-influence-tracker.js';
|
|
7
|
+
export type LoopType = 'retrigger_spiral' | 'stagnation' | 'kpi_gaming' | 'epistemic_drift';
|
|
8
|
+
export type LoopSeverity = 'low' | 'medium' | 'high' | 'critical';
|
|
9
|
+
export interface LoopDetection {
|
|
10
|
+
id: number;
|
|
11
|
+
loopType: LoopType;
|
|
12
|
+
severity: LoopSeverity;
|
|
13
|
+
enginesInvolved: string[];
|
|
14
|
+
description: string;
|
|
15
|
+
evidence: Record<string, unknown>;
|
|
16
|
+
cycle: number;
|
|
17
|
+
resolved: boolean;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
}
|
|
20
|
+
export interface LoopDetectorStatus {
|
|
21
|
+
totalDetections: number;
|
|
22
|
+
activeDetections: number;
|
|
23
|
+
byType: Record<LoopType, number>;
|
|
24
|
+
}
|
|
25
|
+
export declare function runLoopDetectorMigration(db: Database.Database): void;
|
|
26
|
+
export declare class LoopDetector {
|
|
27
|
+
private db;
|
|
28
|
+
private log;
|
|
29
|
+
private influenceTracker;
|
|
30
|
+
constructor(db: Database.Database);
|
|
31
|
+
setInfluenceTracker(tracker: RuntimeInfluenceTracker): void;
|
|
32
|
+
/** Run all 4 detectors and record findings. Returns new detections. */
|
|
33
|
+
detect(cycle: number): LoopDetection[];
|
|
34
|
+
/** Get all active (unresolved) detections. */
|
|
35
|
+
getActive(): LoopDetection[];
|
|
36
|
+
/** Resolve a detection. */
|
|
37
|
+
resolve(id: number): void;
|
|
38
|
+
/** Get status summary. */
|
|
39
|
+
getStatus(): LoopDetectorStatus;
|
|
40
|
+
private detectRetriggerSpirals;
|
|
41
|
+
private detectStagnation;
|
|
42
|
+
private detectKpiGaming;
|
|
43
|
+
private detectEpistemicDrift;
|
|
44
|
+
private record;
|
|
45
|
+
private rowToDetection;
|
|
46
|
+
}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { getLogger } from '../utils/logger.js';
|
|
2
|
+
// ── Migration ───────────────────────────────────────────
|
|
3
|
+
export function runLoopDetectorMigration(db) {
|
|
4
|
+
db.exec(`
|
|
5
|
+
CREATE TABLE IF NOT EXISTS loop_detections (
|
|
6
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
7
|
+
loop_type TEXT NOT NULL,
|
|
8
|
+
severity TEXT NOT NULL,
|
|
9
|
+
engines_involved TEXT NOT NULL,
|
|
10
|
+
description TEXT NOT NULL,
|
|
11
|
+
evidence_json TEXT NOT NULL DEFAULT '{}',
|
|
12
|
+
cycle INTEGER NOT NULL,
|
|
13
|
+
resolved INTEGER NOT NULL DEFAULT 0,
|
|
14
|
+
created_at TEXT DEFAULT (datetime('now'))
|
|
15
|
+
);
|
|
16
|
+
CREATE INDEX IF NOT EXISTS idx_loop_detections_cycle ON loop_detections(cycle, resolved);
|
|
17
|
+
`);
|
|
18
|
+
}
|
|
19
|
+
// ── LoopDetector ────────────────────────────────────────
|
|
20
|
+
export class LoopDetector {
|
|
21
|
+
db;
|
|
22
|
+
log = getLogger();
|
|
23
|
+
influenceTracker = null;
|
|
24
|
+
constructor(db) {
|
|
25
|
+
this.db = db;
|
|
26
|
+
runLoopDetectorMigration(db);
|
|
27
|
+
}
|
|
28
|
+
setInfluenceTracker(tracker) {
|
|
29
|
+
this.influenceTracker = tracker;
|
|
30
|
+
}
|
|
31
|
+
/** Run all 4 detectors and record findings. Returns new detections. */
|
|
32
|
+
detect(cycle) {
|
|
33
|
+
const detections = [];
|
|
34
|
+
detections.push(...this.detectRetriggerSpirals(cycle));
|
|
35
|
+
detections.push(...this.detectStagnation(cycle));
|
|
36
|
+
detections.push(...this.detectKpiGaming(cycle));
|
|
37
|
+
detections.push(...this.detectEpistemicDrift(cycle));
|
|
38
|
+
return detections;
|
|
39
|
+
}
|
|
40
|
+
/** Get all active (unresolved) detections. */
|
|
41
|
+
getActive() {
|
|
42
|
+
const rows = this.db.prepare('SELECT * FROM loop_detections WHERE resolved = 0 ORDER BY cycle DESC LIMIT 50').all();
|
|
43
|
+
return rows.map(r => this.rowToDetection(r));
|
|
44
|
+
}
|
|
45
|
+
/** Resolve a detection. */
|
|
46
|
+
resolve(id) {
|
|
47
|
+
this.db.prepare('UPDATE loop_detections SET resolved = 1 WHERE id = ?').run(id);
|
|
48
|
+
}
|
|
49
|
+
/** Get status summary. */
|
|
50
|
+
getStatus() {
|
|
51
|
+
const total = this.db.prepare('SELECT COUNT(*) as c FROM loop_detections').get().c;
|
|
52
|
+
const active = this.db.prepare('SELECT COUNT(*) as c FROM loop_detections WHERE resolved = 0').get().c;
|
|
53
|
+
const byTypeRows = this.db.prepare('SELECT loop_type, COUNT(*) as c FROM loop_detections WHERE resolved = 0 GROUP BY loop_type').all();
|
|
54
|
+
const byType = { retrigger_spiral: 0, stagnation: 0, kpi_gaming: 0, epistemic_drift: 0 };
|
|
55
|
+
for (const r of byTypeRows)
|
|
56
|
+
byType[r.loop_type] = r.c;
|
|
57
|
+
return { totalDetections: total, activeDetections: active, byType: byType };
|
|
58
|
+
}
|
|
59
|
+
// ── Detector 1: Retrigger Spirals ───────────────────────
|
|
60
|
+
detectRetriggerSpirals(cycle) {
|
|
61
|
+
if (!this.influenceTracker)
|
|
62
|
+
return [];
|
|
63
|
+
const graph = this.influenceTracker.buildInfluenceGraph(30);
|
|
64
|
+
const detections = [];
|
|
65
|
+
// Build adjacency from influence edges (engine → metric → engine that reads it)
|
|
66
|
+
const adj = new Map();
|
|
67
|
+
for (const edge of graph.edges) {
|
|
68
|
+
if (!adj.has(edge.source))
|
|
69
|
+
adj.set(edge.source, new Set());
|
|
70
|
+
// edge.target is a metric, find engines that also influence the same metric
|
|
71
|
+
for (const other of graph.edges) {
|
|
72
|
+
if (other.source !== edge.source && other.target === edge.target) {
|
|
73
|
+
adj.get(edge.source).add(other.source);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// DFS cycle detection
|
|
78
|
+
const visited = new Set();
|
|
79
|
+
const stack = new Set();
|
|
80
|
+
const cycles = [];
|
|
81
|
+
const dfs = (node, path) => {
|
|
82
|
+
if (stack.has(node)) {
|
|
83
|
+
const cycleStart = path.indexOf(node);
|
|
84
|
+
if (cycleStart >= 0)
|
|
85
|
+
cycles.push(path.slice(cycleStart));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (visited.has(node))
|
|
89
|
+
return;
|
|
90
|
+
visited.add(node);
|
|
91
|
+
stack.add(node);
|
|
92
|
+
for (const neighbor of adj.get(node) ?? []) {
|
|
93
|
+
dfs(neighbor, [...path, node]);
|
|
94
|
+
}
|
|
95
|
+
stack.delete(node);
|
|
96
|
+
};
|
|
97
|
+
for (const node of adj.keys()) {
|
|
98
|
+
dfs(node, []);
|
|
99
|
+
}
|
|
100
|
+
for (const c of cycles.slice(0, 3)) {
|
|
101
|
+
const detection = this.record({
|
|
102
|
+
loopType: 'retrigger_spiral',
|
|
103
|
+
severity: c.length > 3 ? 'high' : 'medium',
|
|
104
|
+
enginesInvolved: c,
|
|
105
|
+
description: `Retrigger spiral detected: ${c.join(' → ')} → ${c[0]}`,
|
|
106
|
+
evidence: { cycleLength: c.length, path: c },
|
|
107
|
+
cycle,
|
|
108
|
+
});
|
|
109
|
+
detections.push(detection);
|
|
110
|
+
}
|
|
111
|
+
return detections;
|
|
112
|
+
}
|
|
113
|
+
// ── Detector 2: Stagnation ──────────────────────────────
|
|
114
|
+
detectStagnation(cycle) {
|
|
115
|
+
const detections = [];
|
|
116
|
+
// Check engine_metrics for identical values over last 5 cycles
|
|
117
|
+
try {
|
|
118
|
+
const engines = this.db.prepare(`
|
|
119
|
+
SELECT DISTINCT engine FROM engine_metrics
|
|
120
|
+
WHERE cycle > ? - 6 AND cycle <= ?
|
|
121
|
+
`).all(cycle, cycle);
|
|
122
|
+
for (const { engine } of engines) {
|
|
123
|
+
const rows = this.db.prepare(`
|
|
124
|
+
SELECT insights, anomalies, predictions FROM engine_metrics
|
|
125
|
+
WHERE engine = ? AND cycle > ? - 6 AND cycle <= ?
|
|
126
|
+
ORDER BY cycle ASC
|
|
127
|
+
`).all(engine, cycle, cycle);
|
|
128
|
+
if (rows.length >= 5) {
|
|
129
|
+
const allSame = rows.every(r => r.insights === rows[0].insights &&
|
|
130
|
+
r.anomalies === rows[0].anomalies &&
|
|
131
|
+
r.predictions === rows[0].predictions);
|
|
132
|
+
if (allSame && rows[0].insights === 0 && rows[0].predictions === 0) {
|
|
133
|
+
detections.push(this.record({
|
|
134
|
+
loopType: 'stagnation',
|
|
135
|
+
severity: 'medium',
|
|
136
|
+
enginesInvolved: [engine],
|
|
137
|
+
description: `Engine "${engine}" produced no output for 5+ cycles`,
|
|
138
|
+
evidence: { consecutiveCycles: rows.length, metrics: rows[0] },
|
|
139
|
+
cycle,
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
// engine_metrics table may not exist
|
|
147
|
+
}
|
|
148
|
+
return detections;
|
|
149
|
+
}
|
|
150
|
+
// ── Detector 3: KPI Gaming ──────────────────────────────
|
|
151
|
+
detectKpiGaming(cycle) {
|
|
152
|
+
const detections = [];
|
|
153
|
+
try {
|
|
154
|
+
// Check if any engine's combined_score rises while system knowledge_quality drops
|
|
155
|
+
const recentCards = this.db.prepare(`
|
|
156
|
+
SELECT engine, combined_score FROM engine_report_cards
|
|
157
|
+
WHERE rowid > (SELECT MAX(rowid) - 20 FROM engine_report_cards)
|
|
158
|
+
ORDER BY engine, rowid ASC
|
|
159
|
+
`).all();
|
|
160
|
+
// Group by engine
|
|
161
|
+
const byEngine = new Map();
|
|
162
|
+
for (const r of recentCards) {
|
|
163
|
+
if (!byEngine.has(r.engine))
|
|
164
|
+
byEngine.set(r.engine, []);
|
|
165
|
+
byEngine.get(r.engine).push(r.combined_score);
|
|
166
|
+
}
|
|
167
|
+
// Check knowledge_quality trend via meta_trends (if available)
|
|
168
|
+
let kqTrend = 0;
|
|
169
|
+
try {
|
|
170
|
+
const kqRows = this.db.prepare(`
|
|
171
|
+
SELECT value FROM meta_trends WHERE metric = 'knowledge_quality'
|
|
172
|
+
ORDER BY rowid DESC LIMIT 5
|
|
173
|
+
`).all();
|
|
174
|
+
if (kqRows.length >= 3) {
|
|
175
|
+
kqTrend = kqRows[0].value - kqRows[kqRows.length - 1].value;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
catch { /* meta_trends may not exist */ }
|
|
179
|
+
// KPI gaming: engine score rising but system quality declining
|
|
180
|
+
if (kqTrend < -0.05) {
|
|
181
|
+
for (const [engine, scores] of byEngine) {
|
|
182
|
+
if (scores.length >= 3) {
|
|
183
|
+
const trend = scores[scores.length - 1] - scores[0];
|
|
184
|
+
if (trend > 0.1) {
|
|
185
|
+
detections.push(this.record({
|
|
186
|
+
loopType: 'kpi_gaming',
|
|
187
|
+
severity: 'high',
|
|
188
|
+
enginesInvolved: [engine],
|
|
189
|
+
description: `Engine "${engine}" score rising (+${trend.toFixed(2)}) while knowledge_quality falling (${kqTrend.toFixed(2)})`,
|
|
190
|
+
evidence: { engineTrend: trend, kqTrend, scores },
|
|
191
|
+
cycle,
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
// tables may not exist
|
|
200
|
+
}
|
|
201
|
+
return detections;
|
|
202
|
+
}
|
|
203
|
+
// ── Detector 4: Epistemic Drift ─────────────────────────
|
|
204
|
+
detectEpistemicDrift(cycle) {
|
|
205
|
+
const detections = [];
|
|
206
|
+
try {
|
|
207
|
+
// Rising contradictions + falling confidence over window
|
|
208
|
+
const contradictionCount = this.db.prepare("SELECT COUNT(*) as c FROM contradictions WHERE created_at > datetime('now', '-24 hours')").get().c;
|
|
209
|
+
const oldContradictionCount = this.db.prepare("SELECT COUNT(*) as c FROM contradictions WHERE created_at > datetime('now', '-48 hours') AND created_at <= datetime('now', '-24 hours')").get().c;
|
|
210
|
+
// Average hypothesis confidence
|
|
211
|
+
let avgConfidence = 0.5;
|
|
212
|
+
try {
|
|
213
|
+
const confRow = this.db.prepare("SELECT AVG(confidence) as avg FROM hypotheses WHERE status = 'active'").get();
|
|
214
|
+
avgConfidence = confRow?.avg ?? 0.5;
|
|
215
|
+
}
|
|
216
|
+
catch { /* ignore */ }
|
|
217
|
+
if (contradictionCount > oldContradictionCount + 2 && avgConfidence < 0.4) {
|
|
218
|
+
detections.push(this.record({
|
|
219
|
+
loopType: 'epistemic_drift',
|
|
220
|
+
severity: contradictionCount > oldContradictionCount + 5 ? 'critical' : 'high',
|
|
221
|
+
enginesInvolved: ['knowledge_graph', 'hypothesis_engine', 'contradiction_resolver'],
|
|
222
|
+
description: `Epistemic drift: contradictions rising (${oldContradictionCount}→${contradictionCount}), avg confidence ${avgConfidence.toFixed(2)}`,
|
|
223
|
+
evidence: { contradictionCount, oldContradictionCount, avgConfidence },
|
|
224
|
+
cycle,
|
|
225
|
+
}));
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
// tables may not exist
|
|
230
|
+
}
|
|
231
|
+
return detections;
|
|
232
|
+
}
|
|
233
|
+
// ── Private ─────────────────────────────────────────────
|
|
234
|
+
record(params) {
|
|
235
|
+
const result = this.db.prepare(`
|
|
236
|
+
INSERT INTO loop_detections (loop_type, severity, engines_involved, description, evidence_json, cycle)
|
|
237
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
238
|
+
`).run(params.loopType, params.severity, JSON.stringify(params.enginesInvolved), params.description, JSON.stringify(params.evidence), params.cycle);
|
|
239
|
+
this.log.info(`[loop-detector] ${params.loopType} (${params.severity}): ${params.description}`);
|
|
240
|
+
return {
|
|
241
|
+
id: Number(result.lastInsertRowid),
|
|
242
|
+
loopType: params.loopType,
|
|
243
|
+
severity: params.severity,
|
|
244
|
+
enginesInvolved: params.enginesInvolved,
|
|
245
|
+
description: params.description,
|
|
246
|
+
evidence: params.evidence,
|
|
247
|
+
cycle: params.cycle,
|
|
248
|
+
resolved: false,
|
|
249
|
+
createdAt: new Date().toISOString(),
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
rowToDetection(row) {
|
|
253
|
+
return {
|
|
254
|
+
id: row.id,
|
|
255
|
+
loopType: row.loop_type,
|
|
256
|
+
severity: row.severity,
|
|
257
|
+
enginesInvolved: JSON.parse(row.engines_involved),
|
|
258
|
+
description: row.description,
|
|
259
|
+
evidence: JSON.parse(row.evidence_json),
|
|
260
|
+
cycle: row.cycle,
|
|
261
|
+
resolved: row.resolved === 1,
|
|
262
|
+
createdAt: row.created_at,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
//# sourceMappingURL=loop-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop-detector.js","sourceRoot":"","sources":["../../src/governance/loop-detector.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA0B/C,2DAA2D;AAE3D,MAAM,UAAU,wBAAwB,CAAC,EAAqB;IAC5D,EAAE,CAAC,IAAI,CAAC;;;;;;;;;;;;;GAaP,CAAC,CAAC;AACL,CAAC;AAED,2DAA2D;AAE3D,MAAM,OAAO,YAAY;IACf,EAAE,CAAoB;IACtB,GAAG,GAAG,SAAS,EAAE,CAAC;IAClB,gBAAgB,GAAmC,IAAI,CAAC;IAEhE,YAAY,EAAqB;QAC/B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,wBAAwB,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;IAED,mBAAmB,CAAC,OAAgC;QAClD,IAAI,CAAC,gBAA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;YAC5B,SAAS,EAAE,GAAG,CAAC,UAAoB;SACpC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RuntimeInfluenceTracker — Before/After snapshots per engine step.
|
|
3
|
+
* Observes actual metric changes to build an influence graph.
|
|
4
|
+
*/
|
|
5
|
+
import type Database from 'better-sqlite3';
|
|
6
|
+
export interface InfluenceEdge {
|
|
7
|
+
source: string;
|
|
8
|
+
target: string;
|
|
9
|
+
strength: number;
|
|
10
|
+
direction: number;
|
|
11
|
+
observations: number;
|
|
12
|
+
}
|
|
13
|
+
export interface InfluenceGraph {
|
|
14
|
+
edges: InfluenceEdge[];
|
|
15
|
+
hubs: string[];
|
|
16
|
+
sinks: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface RuntimeInfluenceStatus {
|
|
19
|
+
totalSnapshots: number;
|
|
20
|
+
totalInfluences: number;
|
|
21
|
+
trackedEngines: number;
|
|
22
|
+
}
|
|
23
|
+
export declare function runRuntimeInfluenceMigration(db: Database.Database): void;
|
|
24
|
+
export declare class RuntimeInfluenceTracker {
|
|
25
|
+
private db;
|
|
26
|
+
private log;
|
|
27
|
+
private pendingSnapshots;
|
|
28
|
+
constructor(db: Database.Database);
|
|
29
|
+
/** Capture metrics before an engine step. */
|
|
30
|
+
snapshotBefore(engineId: string, cycle: number): void;
|
|
31
|
+
/** Capture metrics after an engine step, compute deltas, record influences. */
|
|
32
|
+
snapshotAfter(engineId: string, cycle: number): void;
|
|
33
|
+
/** Build an influence graph from recent observations. */
|
|
34
|
+
buildInfluenceGraph(windowCycles?: number): InfluenceGraph;
|
|
35
|
+
/** Feed engine influence data into the existing CausalGraph. */
|
|
36
|
+
feedIntoCausalGraph(causalGraph: {
|
|
37
|
+
recordEvent: (source: string, type: string, data?: unknown) => void;
|
|
38
|
+
}): void;
|
|
39
|
+
/** Get recent influences for a specific engine. */
|
|
40
|
+
getInfluences(engineId: string, limit?: number): Array<{
|
|
41
|
+
metric: string;
|
|
42
|
+
delta: number;
|
|
43
|
+
cycle: number;
|
|
44
|
+
confidence: number;
|
|
45
|
+
}>;
|
|
46
|
+
/** Get status summary. */
|
|
47
|
+
getStatus(): RuntimeInfluenceStatus;
|
|
48
|
+
/** Capture current metric counts from key tables. */
|
|
49
|
+
private captureMetrics;
|
|
50
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { getLogger } from '../utils/logger.js';
|
|
2
|
+
// ── Migration ───────────────────────────────────────────
|
|
3
|
+
export function runRuntimeInfluenceMigration(db) {
|
|
4
|
+
db.exec(`
|
|
5
|
+
CREATE TABLE IF NOT EXISTS engine_influences (
|
|
6
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
7
|
+
source_engine TEXT NOT NULL,
|
|
8
|
+
affected_metric TEXT NOT NULL,
|
|
9
|
+
delta REAL NOT NULL,
|
|
10
|
+
cycle INTEGER NOT NULL,
|
|
11
|
+
direction INTEGER NOT NULL DEFAULT 1,
|
|
12
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
13
|
+
created_at TEXT DEFAULT (datetime('now'))
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
CREATE TABLE IF NOT EXISTS engine_snapshots (
|
|
17
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
18
|
+
engine TEXT NOT NULL,
|
|
19
|
+
cycle INTEGER NOT NULL,
|
|
20
|
+
phase TEXT NOT NULL,
|
|
21
|
+
metrics_json TEXT NOT NULL,
|
|
22
|
+
created_at TEXT DEFAULT (datetime('now'))
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
CREATE INDEX IF NOT EXISTS idx_engine_influences_source ON engine_influences(source_engine, cycle);
|
|
26
|
+
CREATE INDEX IF NOT EXISTS idx_engine_snapshots_engine ON engine_snapshots(engine, cycle, phase);
|
|
27
|
+
`);
|
|
28
|
+
}
|
|
29
|
+
// ── Tracker ─────────────────────────────────────────────
|
|
30
|
+
export class RuntimeInfluenceTracker {
|
|
31
|
+
db;
|
|
32
|
+
log = getLogger();
|
|
33
|
+
pendingSnapshots = new Map();
|
|
34
|
+
constructor(db) {
|
|
35
|
+
this.db = db;
|
|
36
|
+
runRuntimeInfluenceMigration(db);
|
|
37
|
+
}
|
|
38
|
+
/** Capture metrics before an engine step. */
|
|
39
|
+
snapshotBefore(engineId, cycle) {
|
|
40
|
+
const metrics = this.captureMetrics();
|
|
41
|
+
this.pendingSnapshots.set(`${engineId}:${cycle}`, metrics);
|
|
42
|
+
this.db.prepare(`
|
|
43
|
+
INSERT INTO engine_snapshots (engine, cycle, phase, metrics_json) VALUES (?, ?, 'before', ?)
|
|
44
|
+
`).run(engineId, cycle, JSON.stringify(metrics));
|
|
45
|
+
}
|
|
46
|
+
/** Capture metrics after an engine step, compute deltas, record influences. */
|
|
47
|
+
snapshotAfter(engineId, cycle) {
|
|
48
|
+
const afterMetrics = this.captureMetrics();
|
|
49
|
+
this.db.prepare(`
|
|
50
|
+
INSERT INTO engine_snapshots (engine, cycle, phase, metrics_json) VALUES (?, ?, 'after', ?)
|
|
51
|
+
`).run(engineId, cycle, JSON.stringify(afterMetrics));
|
|
52
|
+
const beforeMetrics = this.pendingSnapshots.get(`${engineId}:${cycle}`);
|
|
53
|
+
if (!beforeMetrics)
|
|
54
|
+
return;
|
|
55
|
+
this.pendingSnapshots.delete(`${engineId}:${cycle}`);
|
|
56
|
+
// Compute deltas
|
|
57
|
+
const insertStmt = this.db.prepare(`
|
|
58
|
+
INSERT INTO engine_influences (source_engine, affected_metric, delta, cycle, direction, confidence)
|
|
59
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
60
|
+
`);
|
|
61
|
+
const allKeys = new Set([...Object.keys(beforeMetrics), ...Object.keys(afterMetrics)]);
|
|
62
|
+
for (const metric of allKeys) {
|
|
63
|
+
const before = beforeMetrics[metric] ?? 0;
|
|
64
|
+
const after = afterMetrics[metric] ?? 0;
|
|
65
|
+
const delta = after - before;
|
|
66
|
+
if (delta !== 0) {
|
|
67
|
+
const direction = delta > 0 ? 1 : -1;
|
|
68
|
+
const confidence = Math.min(Math.abs(delta) / Math.max(before, 1), 1);
|
|
69
|
+
insertStmt.run(engineId, metric, delta, cycle, direction, confidence);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/** Build an influence graph from recent observations. */
|
|
74
|
+
buildInfluenceGraph(windowCycles = 50) {
|
|
75
|
+
const rows = this.db.prepare(`
|
|
76
|
+
SELECT source_engine, affected_metric,
|
|
77
|
+
AVG(delta) as avg_delta,
|
|
78
|
+
AVG(direction) as avg_direction,
|
|
79
|
+
COUNT(*) as obs,
|
|
80
|
+
AVG(confidence) as avg_conf
|
|
81
|
+
FROM engine_influences
|
|
82
|
+
WHERE cycle > (SELECT COALESCE(MAX(cycle), 0) FROM engine_influences) - ?
|
|
83
|
+
GROUP BY source_engine, affected_metric
|
|
84
|
+
HAVING COUNT(*) >= 2
|
|
85
|
+
`).all(windowCycles);
|
|
86
|
+
const edges = rows.map(r => ({
|
|
87
|
+
source: r.source_engine,
|
|
88
|
+
target: r.affected_metric,
|
|
89
|
+
strength: Math.abs(r.avg_delta) * r.avg_conf,
|
|
90
|
+
direction: r.avg_direction >= 0 ? 1 : -1,
|
|
91
|
+
observations: r.obs,
|
|
92
|
+
}));
|
|
93
|
+
// Hubs: engines with many outgoing edges
|
|
94
|
+
const engineEdgeCount = new Map();
|
|
95
|
+
for (const e of edges) {
|
|
96
|
+
engineEdgeCount.set(e.source, (engineEdgeCount.get(e.source) ?? 0) + 1);
|
|
97
|
+
}
|
|
98
|
+
const hubs = [...engineEdgeCount.entries()]
|
|
99
|
+
.filter(([, count]) => count >= 3)
|
|
100
|
+
.sort((a, b) => b[1] - a[1])
|
|
101
|
+
.map(([engine]) => engine);
|
|
102
|
+
// Sinks: metrics affected by many engines
|
|
103
|
+
const metricEdgeCount = new Map();
|
|
104
|
+
for (const e of edges) {
|
|
105
|
+
metricEdgeCount.set(e.target, (metricEdgeCount.get(e.target) ?? 0) + 1);
|
|
106
|
+
}
|
|
107
|
+
const sinks = [...metricEdgeCount.entries()]
|
|
108
|
+
.filter(([, count]) => count >= 3)
|
|
109
|
+
.sort((a, b) => b[1] - a[1])
|
|
110
|
+
.map(([metric]) => metric);
|
|
111
|
+
return { edges, hubs, sinks };
|
|
112
|
+
}
|
|
113
|
+
/** Feed engine influence data into the existing CausalGraph. */
|
|
114
|
+
feedIntoCausalGraph(causalGraph) {
|
|
115
|
+
const graph = this.buildInfluenceGraph(50);
|
|
116
|
+
for (const edge of graph.edges) {
|
|
117
|
+
try {
|
|
118
|
+
causalGraph.recordEvent(`engine:${edge.source}`, edge.target, { value: edge.strength * edge.direction, observations: edge.observations, fromInfluenceTracker: true });
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
// best effort
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (graph.edges.length > 0) {
|
|
125
|
+
this.log.debug(`[influence-tracker] Fed ${graph.edges.length} edges into CausalGraph`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/** Get recent influences for a specific engine. */
|
|
129
|
+
getInfluences(engineId, limit = 20) {
|
|
130
|
+
return this.db.prepare(`
|
|
131
|
+
SELECT affected_metric as metric, delta, cycle, confidence
|
|
132
|
+
FROM engine_influences WHERE source_engine = ?
|
|
133
|
+
ORDER BY cycle DESC LIMIT ?
|
|
134
|
+
`).all(engineId, limit);
|
|
135
|
+
}
|
|
136
|
+
/** Get status summary. */
|
|
137
|
+
getStatus() {
|
|
138
|
+
const snapshots = this.db.prepare('SELECT COUNT(*) as c FROM engine_snapshots').get().c;
|
|
139
|
+
const influences = this.db.prepare('SELECT COUNT(*) as c FROM engine_influences').get().c;
|
|
140
|
+
const engines = this.db.prepare('SELECT COUNT(DISTINCT source_engine) as c FROM engine_influences').get().c;
|
|
141
|
+
return { totalSnapshots: snapshots, totalInfluences: influences, trackedEngines: engines };
|
|
142
|
+
}
|
|
143
|
+
// ── Private ─────────────────────────────────────────────
|
|
144
|
+
/** Capture current metric counts from key tables. */
|
|
145
|
+
captureMetrics() {
|
|
146
|
+
const metrics = {};
|
|
147
|
+
const tables = [
|
|
148
|
+
'insights', 'anomalies', 'hypotheses', 'journal_entries',
|
|
149
|
+
'predictions', 'principles', 'causal_edges',
|
|
150
|
+
];
|
|
151
|
+
for (const table of tables) {
|
|
152
|
+
try {
|
|
153
|
+
const row = this.db.prepare(`SELECT COUNT(*) as c FROM ${table}`).get();
|
|
154
|
+
metrics[table] = row?.c ?? 0;
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
// Table may not exist in all brains
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return metrics;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=runtime-influence-tracker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-influence-tracker.js","sourceRoot":"","sources":["../../src/governance/runtime-influence-tracker.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAwB/C,2DAA2D;AAE3D,MAAM,UAAU,4BAA4B,CAAC,EAAqB;IAChE,EAAE,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;GAuBP,CAAC,CAAC;AACL,CAAC;AAED,2DAA2D;AAE3D,MAAM,OAAO,uBAAuB;IAC1B,EAAE,CAAoB;IACtB,GAAG,GAAG,SAAS,EAAE,CAAC;IAClB,gBAAgB,GAAwC,IAAI,GAAG,EAAE,CAAC;IAE1E,YAAY,EAAqB;QAC/B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,4BAA4B,CAAC,EAAE,CAAC,CAAC;IACnC,CAAC;IAED,6CAA6C;IAC7C,cAAc,CAAC,QAAgB,EAAE,KAAa;QAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QACtC,IAAI,CAAC,gBAAgB,CA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;IAE3D,qDAAqD;IAC7C,cAAc;QACpB,MAAM,OAAO,GAA2B,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAG;YACb,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB;YACxD,aAAa,EAAE,YAAY,EAAE,cAAc;SAC5C,CAAC;QACF,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,6BAA6B,KAAK,EAAE,CAAC,CAAC,GAAG,EAA+B,CAAC;gBACrG,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;YAAC,MAAM,CAAC;gBACP,oCAAoC;YACtC,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -271,7 +271,7 @@ export { ResearchRoadmap, runRoadmapMigration } from './goals/research-roadmap.j
|
|
|
271
271
|
export type { Roadmap, GoalNode, GoalEdge, RoadmapDAG, RoadmapProgress, } from './goals/research-roadmap.js';
|
|
272
272
|
export { CreativeEngine, runCreativeMigration } from './creative/index.js';
|
|
273
273
|
export type { CreativeInsight, Analogy as CreativeAnalogy, SpeculativeHypothesis, CreativeEngineConfig, CreativeEngineStatus, } from './creative/index.js';
|
|
274
|
-
export { ActionBridgeEngine, runActionBridgeMigration, createTradeHandler, createContentHandler, createCreativeSeedHandler, createAdjustParameterHandler } from './action/index.js';
|
|
274
|
+
export { ActionBridgeEngine, runActionBridgeMigration, createTradeHandler, createContentHandler, createCreativeSeedHandler, createAdjustParameterHandler, createMissionHandler } from './action/index.js';
|
|
275
275
|
export type { ProposedAction, ActionOutcome, ActionBridgeConfig, ActionBridgeStatus, TradeActionPayload, TradeHandlerDeps, TradeHandlerResult, ContentHandlerDeps, ContentHandlerResult, CreativeSeedPayload, CreativeSeedHandlerDeps, CreativeSeedHandlerResult, AdjustParameterPayload, AdjustParameterHandlerDeps, AdjustParameterHandlerResult, } from './action/index.js';
|
|
276
276
|
export { ContentForge, runContentForgeMigration, AutoPublisher } from './content/index.js';
|
|
277
277
|
export type { ContentPiece, ContentEngagement, ContentForgeConfig, ContentForgeStatus, AutoPublisherConfig, AutoPublisherStats, } from './content/index.js';
|
|
@@ -281,3 +281,11 @@ export { StrategyForge, runStrategyForgeMigration, StrategyMutator } from './str
|
|
|
281
281
|
export type { Strategy as ForgeStrategy, StrategyRule, StrategyPerformance, BacktestResult, StrategyForgeConfig, StrategyForgeStatus, MutationConfig, MutationResult, } from './strategy/index.js';
|
|
282
282
|
export { ChatEngine, runChatMigration } from './chat/index.js';
|
|
283
283
|
export type { ChatMessage, ChatEngineConfig, ChatEngineStatus } from './chat/index.js';
|
|
284
|
+
export { EngineRegistry, runEngineRegistryMigration, getDefaultEngineProfiles } from './governance/index.js';
|
|
285
|
+
export type { EngineProfile, EngineRegistryStatus } from './governance/index.js';
|
|
286
|
+
export { RuntimeInfluenceTracker, runRuntimeInfluenceMigration } from './governance/index.js';
|
|
287
|
+
export type { InfluenceEdge, InfluenceGraph, RuntimeInfluenceStatus } from './governance/index.js';
|
|
288
|
+
export { LoopDetector, runLoopDetectorMigration } from './governance/index.js';
|
|
289
|
+
export type { LoopDetection, LoopType, LoopSeverity, LoopDetectorStatus } from './governance/index.js';
|
|
290
|
+
export { GovernanceLayer, runGovernanceMigration } from './governance/index.js';
|
|
291
|
+
export type { GovernanceAction, GovernanceActionType, GovernanceDecision, GovernanceLayerStatus } from './governance/index.js';
|
package/dist/index.js
CHANGED
|
@@ -234,7 +234,7 @@ export { ResearchRoadmap, runRoadmapMigration } from './goals/research-roadmap.j
|
|
|
234
234
|
// ── Creative Engine ─────────────────────────────────────────
|
|
235
235
|
export { CreativeEngine, runCreativeMigration } from './creative/index.js';
|
|
236
236
|
// ── Action Bridge ─────────────────────────────────────────
|
|
237
|
-
export { ActionBridgeEngine, runActionBridgeMigration, createTradeHandler, createContentHandler, createCreativeSeedHandler, createAdjustParameterHandler } from './action/index.js';
|
|
237
|
+
export { ActionBridgeEngine, runActionBridgeMigration, createTradeHandler, createContentHandler, createCreativeSeedHandler, createAdjustParameterHandler, createMissionHandler } from './action/index.js';
|
|
238
238
|
// ── Content Forge ─────────────────────────────────────────
|
|
239
239
|
export { ContentForge, runContentForgeMigration, AutoPublisher } from './content/index.js';
|
|
240
240
|
// ── Code Forge ────────────────────────────────────────────
|
|
@@ -243,4 +243,9 @@ export { CodeForge, runCodeForgeMigration } from './codegen/code-forge.js';
|
|
|
243
243
|
export { StrategyForge, runStrategyForgeMigration, StrategyMutator } from './strategy/index.js';
|
|
244
244
|
// ── Chat Engine ──────────────────────────────────────────
|
|
245
245
|
export { ChatEngine, runChatMigration } from './chat/index.js';
|
|
246
|
+
// ── Governance ──────────────────────────────────────────
|
|
247
|
+
export { EngineRegistry, runEngineRegistryMigration, getDefaultEngineProfiles } from './governance/index.js';
|
|
248
|
+
export { RuntimeInfluenceTracker, runRuntimeInfluenceMigration } from './governance/index.js';
|
|
249
|
+
export { LoopDetector, runLoopDetectorMigration } from './governance/index.js';
|
|
250
|
+
export { GovernanceLayer, runGovernanceMigration } from './governance/index.js';
|
|
246
251
|
//# sourceMappingURL=index.js.map
|