@timmeck/brain-core 2.10.0 → 2.11.1
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/consciousness-dashboard.html +146 -8
- package/dist/consciousness/consciousness-server.d.ts +1 -0
- package/dist/consciousness/consciousness-server.js +19 -0
- package/dist/consciousness/consciousness-server.js.map +1 -1
- package/dist/consciousness/types.d.ts +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/prediction/forecaster.d.ts +22 -0
- package/dist/prediction/forecaster.js +120 -0
- package/dist/prediction/forecaster.js.map +1 -0
- package/dist/prediction/index.d.ts +4 -0
- package/dist/prediction/index.js +4 -0
- package/dist/prediction/index.js.map +1 -0
- package/dist/prediction/prediction-engine.d.ts +59 -0
- package/dist/prediction/prediction-engine.js +301 -0
- package/dist/prediction/prediction-engine.js.map +1 -0
- package/dist/prediction/tracker.d.ts +27 -0
- package/dist/prediction/tracker.js +221 -0
- package/dist/prediction/tracker.js.map +1 -0
- package/dist/prediction/types.d.ts +85 -0
- package/dist/prediction/types.js +3 -0
- package/dist/prediction/types.js.map +1 -0
- package/dist/research/research-orchestrator.d.ts +8 -0
- package/dist/research/research-orchestrator.js +123 -0
- package/dist/research/research-orchestrator.js.map +1 -1
- package/package.json +1 -1
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
.dashboard {
|
|
40
40
|
display: grid;
|
|
41
41
|
grid-template-columns: 280px 1fr 280px;
|
|
42
|
-
grid-template-rows: 1fr 48px;
|
|
42
|
+
grid-template-rows: 1fr 140px 48px;
|
|
43
43
|
height: 100vh;
|
|
44
44
|
gap: 2px;
|
|
45
45
|
}
|
|
@@ -157,6 +157,10 @@
|
|
|
157
157
|
.engine-counterfactual .thought-engine { color: #80d8ff; }
|
|
158
158
|
.engine-data_miner { border-left-color: #ccff90; }
|
|
159
159
|
.engine-data_miner .thought-engine { color: #ccff90; }
|
|
160
|
+
.engine-prediction { border-left-color: #00e5ff; }
|
|
161
|
+
.engine-prediction .thought-engine { color: #00e5ff; }
|
|
162
|
+
.engine-self_improvement { border-left-color: #ffd700; }
|
|
163
|
+
.engine-self_improvement .thought-engine { color: #ffd700; }
|
|
160
164
|
|
|
161
165
|
/* ── Neural Canvas (Center) ─────────────────── */
|
|
162
166
|
.neural-canvas {
|
|
@@ -254,12 +258,78 @@
|
|
|
254
258
|
.engine-metric-value { color: var(--text-secondary); font-weight: 600; }
|
|
255
259
|
|
|
256
260
|
/* ── Status Bar (Bottom) ────────────────────── */
|
|
257
|
-
|
|
261
|
+
/* ── Brain Insights (Bottom) ───────────────── */
|
|
262
|
+
.insights-panel {
|
|
258
263
|
grid-row: 2;
|
|
259
264
|
grid-column: 1 / -1;
|
|
260
265
|
background: var(--bg-secondary);
|
|
261
266
|
border-top: 1px solid var(--border);
|
|
262
267
|
display: flex;
|
|
268
|
+
flex-direction: column;
|
|
269
|
+
overflow: hidden;
|
|
270
|
+
}
|
|
271
|
+
.insights-header {
|
|
272
|
+
padding: 6px 16px;
|
|
273
|
+
font-size: 10px;
|
|
274
|
+
text-transform: uppercase;
|
|
275
|
+
letter-spacing: 1.5px;
|
|
276
|
+
color: var(--gold);
|
|
277
|
+
border-bottom: 1px solid var(--border);
|
|
278
|
+
flex-shrink: 0;
|
|
279
|
+
display: flex;
|
|
280
|
+
align-items: center;
|
|
281
|
+
gap: 8px;
|
|
282
|
+
}
|
|
283
|
+
.insights-list {
|
|
284
|
+
flex: 1;
|
|
285
|
+
overflow-y: auto;
|
|
286
|
+
padding: 6px 16px;
|
|
287
|
+
display: flex;
|
|
288
|
+
flex-wrap: wrap;
|
|
289
|
+
gap: 6px;
|
|
290
|
+
align-content: flex-start;
|
|
291
|
+
}
|
|
292
|
+
.insight-chip {
|
|
293
|
+
font-size: 10px;
|
|
294
|
+
padding: 3px 10px;
|
|
295
|
+
border-radius: 12px;
|
|
296
|
+
background: rgba(255, 215, 0, 0.08);
|
|
297
|
+
border: 1px solid rgba(255, 215, 0, 0.2);
|
|
298
|
+
color: var(--text-primary);
|
|
299
|
+
animation: thought-in 0.3s ease;
|
|
300
|
+
max-width: 400px;
|
|
301
|
+
overflow: hidden;
|
|
302
|
+
text-overflow: ellipsis;
|
|
303
|
+
white-space: nowrap;
|
|
304
|
+
}
|
|
305
|
+
.insight-chip.anomaly { background: rgba(255, 82, 82, 0.1); border-color: rgba(255, 82, 82, 0.3); }
|
|
306
|
+
.insight-chip.prediction { background: rgba(0, 229, 255, 0.08); border-color: rgba(0, 229, 255, 0.2); }
|
|
307
|
+
.insight-chip.experiment { background: rgba(105, 240, 174, 0.08); border-color: rgba(105, 240, 174, 0.2); }
|
|
308
|
+
.insight-chip.self_improvement { background: rgba(234, 128, 252, 0.08); border-color: rgba(234, 128, 252, 0.2); }
|
|
309
|
+
.trigger-btn {
|
|
310
|
+
margin-left: auto;
|
|
311
|
+
padding: 2px 12px;
|
|
312
|
+
font-size: 10px;
|
|
313
|
+
font-family: inherit;
|
|
314
|
+
background: rgba(0, 229, 255, 0.1);
|
|
315
|
+
border: 1px solid rgba(0, 229, 255, 0.3);
|
|
316
|
+
border-radius: 10px;
|
|
317
|
+
color: var(--cyan);
|
|
318
|
+
cursor: pointer;
|
|
319
|
+
transition: all 0.2s;
|
|
320
|
+
text-transform: uppercase;
|
|
321
|
+
letter-spacing: 1px;
|
|
322
|
+
}
|
|
323
|
+
.trigger-btn:hover { background: rgba(0, 229, 255, 0.2); box-shadow: var(--glow-cyan); }
|
|
324
|
+
.trigger-btn:active { transform: scale(0.95); }
|
|
325
|
+
.trigger-btn.running { color: var(--gold); border-color: rgba(255, 215, 0, 0.3); background: rgba(255, 215, 0, 0.1); pointer-events: none; }
|
|
326
|
+
|
|
327
|
+
.status-bar {
|
|
328
|
+
grid-row: 3;
|
|
329
|
+
grid-column: 1 / -1;
|
|
330
|
+
background: var(--bg-secondary);
|
|
331
|
+
border-top: 1px solid var(--border);
|
|
332
|
+
display: flex;
|
|
263
333
|
align-items: center;
|
|
264
334
|
justify-content: space-between;
|
|
265
335
|
padding: 0 16px;
|
|
@@ -352,11 +422,12 @@
|
|
|
352
422
|
<div class="flash-overlay" id="flash-overlay"></div>
|
|
353
423
|
<div class="canvas-overlay" id="canvas-info">Neural Network — Loading...</div>
|
|
354
424
|
<div class="canvas-legend">
|
|
355
|
-
<div class="legend-item"><div class="legend-dot" style="background
|
|
356
|
-
<div class="legend-item"><div class="legend-dot" style="background
|
|
357
|
-
<div class="legend-item"><div class="legend-dot" style="background
|
|
358
|
-
<div class="legend-item"><div class="legend-dot" style="background
|
|
359
|
-
<div class="legend-item"><div class="legend-dot" style="background
|
|
425
|
+
<div class="legend-item"><div class="legend-dot" style="background:#448aff"></div>Project</div>
|
|
426
|
+
<div class="legend-item"><div class="legend-dot" style="background:#ff5252"></div>Error</div>
|
|
427
|
+
<div class="legend-item"><div class="legend-dot" style="background:#69f0ae"></div>Solution</div>
|
|
428
|
+
<div class="legend-item"><div class="legend-dot" style="background:#80d8ff"></div>Module</div>
|
|
429
|
+
<div class="legend-item"><div class="legend-dot" style="background:#00ff88"></div>Insight</div>
|
|
430
|
+
<div class="legend-item"><div class="legend-dot" style="background:#00e5ff"></div>Memory</div>
|
|
360
431
|
</div>
|
|
361
432
|
</div>
|
|
362
433
|
|
|
@@ -370,6 +441,16 @@
|
|
|
370
441
|
</div>
|
|
371
442
|
|
|
372
443
|
<!-- Bottom: Status Bar -->
|
|
444
|
+
<!-- Bottom: Brain Insights -->
|
|
445
|
+
<div class="insights-panel">
|
|
446
|
+
<div class="insights-header">
|
|
447
|
+
<span>Brain Insights</span>
|
|
448
|
+
<span id="insight-count" style="color:var(--text-muted)">0</span>
|
|
449
|
+
<button class="trigger-btn" id="trigger-btn" onclick="triggerFeedbackCycle()">⚡ Trigger Cycle</button>
|
|
450
|
+
</div>
|
|
451
|
+
<div class="insights-list" id="insights-list"></div>
|
|
452
|
+
</div>
|
|
453
|
+
|
|
373
454
|
<div class="status-bar">
|
|
374
455
|
<div class="status-left">
|
|
375
456
|
<div class="status-item">
|
|
@@ -448,6 +529,8 @@
|
|
|
448
529
|
research_agenda: '#ea80fc',
|
|
449
530
|
counterfactual: '#80d8ff',
|
|
450
531
|
data_miner: '#ccff90',
|
|
532
|
+
prediction: '#00e5ff',
|
|
533
|
+
self_improvement: '#ffd700',
|
|
451
534
|
};
|
|
452
535
|
|
|
453
536
|
const nodeColors = {
|
|
@@ -473,6 +556,7 @@
|
|
|
473
556
|
dreaming: '💭',
|
|
474
557
|
reflecting: '📝',
|
|
475
558
|
correlating: '🔗',
|
|
559
|
+
predicting: '🔮',
|
|
476
560
|
};
|
|
477
561
|
|
|
478
562
|
// ── DOM ────────────────────────────────────────────────
|
|
@@ -770,6 +854,9 @@
|
|
|
770
854
|
// Activate nodes on canvas related to this thought
|
|
771
855
|
activateRelatedNodes(thought);
|
|
772
856
|
|
|
857
|
+
// Extract insights for bottom panel
|
|
858
|
+
extractInsightsFromThought(thought);
|
|
859
|
+
|
|
773
860
|
// Dream mode detection
|
|
774
861
|
if (thought.engine === 'dream') {
|
|
775
862
|
isDreaming = true;
|
|
@@ -805,13 +892,64 @@
|
|
|
805
892
|
}
|
|
806
893
|
}
|
|
807
894
|
|
|
895
|
+
// ── Brain Insights Panel ─────────────────────────────
|
|
896
|
+
const insightsList = document.getElementById('insights-list');
|
|
897
|
+
const insightCountEl = document.getElementById('insight-count');
|
|
898
|
+
let brainInsights = [];
|
|
899
|
+
|
|
900
|
+
function triggerFeedbackCycle() {
|
|
901
|
+
const btn = document.getElementById('trigger-btn');
|
|
902
|
+
btn.classList.add('running');
|
|
903
|
+
btn.textContent = '⏳ Running...';
|
|
904
|
+
fetch('/api/trigger', { method: 'POST' })
|
|
905
|
+
.then(r => r.json())
|
|
906
|
+
.then(d => {
|
|
907
|
+
btn.textContent = d.triggered ? '✓ Triggered' : '✗ Failed';
|
|
908
|
+
setTimeout(() => { btn.classList.remove('running'); btn.textContent = '⚡ Trigger Cycle'; }, 5000);
|
|
909
|
+
})
|
|
910
|
+
.catch(() => {
|
|
911
|
+
btn.textContent = '✗ Error';
|
|
912
|
+
setTimeout(() => { btn.classList.remove('running'); btn.textContent = '⚡ Trigger Cycle'; }, 3000);
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
function addInsight(text, category) {
|
|
917
|
+
// Deduplicate
|
|
918
|
+
if (brainInsights.some(i => i.text === text)) return;
|
|
919
|
+
brainInsights.unshift({ text, category, time: Date.now() });
|
|
920
|
+
if (brainInsights.length > 50) brainInsights.pop();
|
|
921
|
+
|
|
922
|
+
const chip = document.createElement('div');
|
|
923
|
+
chip.className = `insight-chip ${category || ''}`;
|
|
924
|
+
chip.textContent = text;
|
|
925
|
+
chip.title = text;
|
|
926
|
+
insightsList.insertBefore(chip, insightsList.firstChild);
|
|
927
|
+
while (insightsList.children.length > 50) insightsList.removeChild(insightsList.lastChild);
|
|
928
|
+
insightCountEl.textContent = brainInsights.length;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
function extractInsightsFromThought(thought) {
|
|
932
|
+
// Notable and breakthrough thoughts → insights
|
|
933
|
+
if (thought.significance === 'breakthrough') {
|
|
934
|
+
addInsight(`${thought.engine}: ${thought.content}`, 'breakthrough');
|
|
935
|
+
} else if (thought.significance === 'notable') {
|
|
936
|
+
// Categorize by engine type
|
|
937
|
+
const cat = thought.engine === 'anomaly_detective' ? 'anomaly'
|
|
938
|
+
: thought.engine === 'prediction' || thought.type === 'predicting' ? 'prediction'
|
|
939
|
+
: thought.engine === 'experiment' ? 'experiment'
|
|
940
|
+
: thought.engine === 'self_observer' || thought.engine === 'adaptive_strategy' || thought.engine === 'self_improvement' ? 'self_improvement'
|
|
941
|
+
: '';
|
|
942
|
+
addInsight(`${thought.content}`, cat);
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
|
|
808
946
|
// ── Engine Status Rendering ────────────────────────────
|
|
809
947
|
function renderEngines(engineData) {
|
|
810
948
|
engineList.innerHTML = '';
|
|
811
949
|
const allEngines = [
|
|
812
950
|
'orchestrator', 'self_observer', 'anomaly_detective', 'cross_domain',
|
|
813
951
|
'adaptive_strategy', 'experiment', 'knowledge_distiller', 'research_agenda',
|
|
814
|
-
'counterfactual', 'dream', 'journal', 'data_miner',
|
|
952
|
+
'counterfactual', 'dream', 'journal', 'data_miner', 'prediction', 'self_improvement',
|
|
815
953
|
];
|
|
816
954
|
|
|
817
955
|
const engineMap = new Map((engineData || []).map(e => [e.engine, e]));
|
|
@@ -55,6 +55,25 @@ export class ConsciousnessServer {
|
|
|
55
55
|
res.end(JSON.stringify(state));
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
+
// Trigger feedback cycle
|
|
59
|
+
if (url.pathname === '/api/trigger' && req.method === 'POST') {
|
|
60
|
+
if (this.options.onTriggerFeedback) {
|
|
61
|
+
try {
|
|
62
|
+
this.options.onTriggerFeedback();
|
|
63
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
64
|
+
res.end(JSON.stringify({ triggered: true }));
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
68
|
+
res.end(JSON.stringify({ error: err.message }));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
res.writeHead(501, { 'Content-Type': 'application/json' });
|
|
73
|
+
res.end(JSON.stringify({ error: 'Feedback trigger not configured' }));
|
|
74
|
+
}
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
58
77
|
// SSE stream
|
|
59
78
|
if (url.pathname === '/events') {
|
|
60
79
|
res.writeHead(200, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consciousness-server.js","sourceRoot":"","sources":["../../src/consciousness/consciousness-server.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAA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CAAC,CAAC,YAAY,CAAC,CAAC;QAC9C,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QAErB,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;IACtD,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAEO,SAAS,CAAC,KAAa,EAAE,IAAa;QAC5C,MAAM,GAAG,GAAG,UAAU,KAAK,WAAW,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;QACjE,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClC,IAAI,CAAC;gBACH,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACpB,CAAC;YAAC,MAAM,CAAC;gBACP,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ThoughtType = 'perceiving' | 'analyzing' | 'discovering' | 'hypothesizing' | 'experimenting' | 'dreaming' | 'reflecting' | 'correlating';
|
|
1
|
+
export type ThoughtType = 'perceiving' | 'analyzing' | 'discovering' | 'hypothesizing' | 'experimenting' | 'dreaming' | 'reflecting' | 'correlating' | 'predicting';
|
|
2
2
|
export type ThoughtSignificance = 'routine' | 'notable' | 'breakthrough';
|
|
3
3
|
export interface Thought {
|
|
4
4
|
id: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -97,3 +97,7 @@ export { DreamConsolidator } from './dream/index.js';
|
|
|
97
97
|
export type { DreamEngineConfig, DreamCycleReport, DreamStatus, DreamHistoryEntry, DreamTrigger, MemoryReplayResult, SynapsePruneResult, MemoryCompressionResult, MemoryCluster, ImportanceDecayResult } from './dream/index.js';
|
|
98
98
|
export { ThoughtStream, ConsciousnessServer } from './consciousness/index.js';
|
|
99
99
|
export type { ConsciousnessServerOptions, Thought, ThoughtType, ThoughtSignificance, ConsciousnessConfig, ConsciousnessStatus, EngineActivity } from './consciousness/index.js';
|
|
100
|
+
export { PredictionEngine, runPredictionMigration } from './prediction/index.js';
|
|
101
|
+
export { PredictionTracker } from './prediction/index.js';
|
|
102
|
+
export { holtWintersForecast, ewmaForecast, calibrateConfidence } from './prediction/index.js';
|
|
103
|
+
export type { PredictionDomain, PredictionStatus, PredictionEngineConfig, Prediction, PredictionAccuracy, PredictionSummary, ForecastResult, PredictionInput, MetricDataPoint, CalibrationBucket } from './prediction/index.js';
|
package/dist/index.js
CHANGED
|
@@ -88,4 +88,8 @@ export { DreamEngine, runDreamMigration } from './dream/index.js';
|
|
|
88
88
|
export { DreamConsolidator } from './dream/index.js';
|
|
89
89
|
// ── Consciousness ───────────────────────────────────
|
|
90
90
|
export { ThoughtStream, ConsciousnessServer } from './consciousness/index.js';
|
|
91
|
+
// ── Prediction Engine ──────────────────────────────
|
|
92
|
+
export { PredictionEngine, runPredictionMigration } from './prediction/index.js';
|
|
93
|
+
export { PredictionTracker } from './prediction/index.js';
|
|
94
|
+
export { holtWintersForecast, ewmaForecast, calibrateConfidence } from './prediction/index.js';
|
|
91
95
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,8DAA8D;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEzE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,mBA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,MAAM,iCAAiC,CAAC;AAGjG,0DAA0D;AAC1D,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG7E,yDAAyD;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAG3E,wDAAwD;AACxD,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAEzH,uDAAuD;AACvD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,uDAAuD;AACvD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG9E,sDAAsD;AACtD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ForecastResult, CalibrationBucket } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Holt-Winters Double Exponential Smoothing.
|
|
4
|
+
* Requires ≥ 5 data points. Returns forecast + trend + confidence.
|
|
5
|
+
*
|
|
6
|
+
* Level: l_t = α * y_t + (1-α) * (l_{t-1} + b_{t-1})
|
|
7
|
+
* Trend: b_t = β * (l_t - l_{t-1}) + (1-β) * b_{t-1}
|
|
8
|
+
* Forecast: ŷ_{t+h} = l_t + h * b_t
|
|
9
|
+
*/
|
|
10
|
+
export declare function holtWintersForecast(data: number[], stepsAhead: number, alpha?: number, beta?: number): ForecastResult;
|
|
11
|
+
/**
|
|
12
|
+
* Exponentially Weighted Moving Average.
|
|
13
|
+
* Fallback for < 5 data points.
|
|
14
|
+
*/
|
|
15
|
+
export declare function ewmaForecast(data: number[], alpha?: number): ForecastResult;
|
|
16
|
+
/**
|
|
17
|
+
* Calibrate raw confidence using historical accuracy buckets.
|
|
18
|
+
* If the model was overconfident in a range, it adjusts downward — and vice versa.
|
|
19
|
+
*
|
|
20
|
+
* Returns value clamped to [0.01, 0.99].
|
|
21
|
+
*/
|
|
22
|
+
export declare function calibrateConfidence(rawConfidence: number, buckets: CalibrationBucket[]): number;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// ── Prediction Forecaster — Pure Math ────────────────────────
|
|
2
|
+
//
|
|
3
|
+
// Holt-Winters Double Exponential Smoothing + EWMA fallback.
|
|
4
|
+
// No DB dependency — pure functions, easy to test.
|
|
5
|
+
/**
|
|
6
|
+
* Holt-Winters Double Exponential Smoothing.
|
|
7
|
+
* Requires ≥ 5 data points. Returns forecast + trend + confidence.
|
|
8
|
+
*
|
|
9
|
+
* Level: l_t = α * y_t + (1-α) * (l_{t-1} + b_{t-1})
|
|
10
|
+
* Trend: b_t = β * (l_t - l_{t-1}) + (1-β) * b_{t-1}
|
|
11
|
+
* Forecast: ŷ_{t+h} = l_t + h * b_t
|
|
12
|
+
*/
|
|
13
|
+
export function holtWintersForecast(data, stepsAhead, alpha = 0.3, beta = 0.1) {
|
|
14
|
+
if (data.length < 2) {
|
|
15
|
+
return { value: data[0] ?? 0, trend: 0, confidence: 0.1, direction: 'stable', method: 'holt_winters', dataPoints: data.length };
|
|
16
|
+
}
|
|
17
|
+
// Initialize level and trend
|
|
18
|
+
let level = data[0];
|
|
19
|
+
let trend = data[1] - data[0];
|
|
20
|
+
const residuals = [];
|
|
21
|
+
for (let t = 1; t < data.length; t++) {
|
|
22
|
+
const y = data[t];
|
|
23
|
+
const prevLevel = level;
|
|
24
|
+
// Update level
|
|
25
|
+
level = alpha * y + (1 - alpha) * (prevLevel + trend);
|
|
26
|
+
// Update trend
|
|
27
|
+
trend = beta * (level - prevLevel) + (1 - beta) * trend;
|
|
28
|
+
// Track residuals for confidence calculation
|
|
29
|
+
const predicted = prevLevel + trend;
|
|
30
|
+
residuals.push(Math.abs(y - predicted));
|
|
31
|
+
}
|
|
32
|
+
// Forecast
|
|
33
|
+
const value = level + stepsAhead * trend;
|
|
34
|
+
// Confidence based on normalized MAE (1 - MAE/range)
|
|
35
|
+
const mae = residuals.length > 0
|
|
36
|
+
? residuals.reduce((a, b) => a + b, 0) / residuals.length
|
|
37
|
+
: 0;
|
|
38
|
+
const range = Math.max(...data) - Math.min(...data);
|
|
39
|
+
const normalizedMae = range > 0 ? mae / range : 0;
|
|
40
|
+
const confidence = Math.max(0.05, Math.min(0.95, 1 - normalizedMae));
|
|
41
|
+
// Direction
|
|
42
|
+
const trendRatio = range > 0 ? Math.abs(trend) / range : 0;
|
|
43
|
+
let direction;
|
|
44
|
+
if (trendRatio < 0.02) {
|
|
45
|
+
direction = 'stable';
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
direction = trend > 0 ? 'up' : 'down';
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
value,
|
|
52
|
+
trend,
|
|
53
|
+
confidence,
|
|
54
|
+
direction,
|
|
55
|
+
method: 'holt_winters',
|
|
56
|
+
dataPoints: data.length,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Exponentially Weighted Moving Average.
|
|
61
|
+
* Fallback for < 5 data points.
|
|
62
|
+
*/
|
|
63
|
+
export function ewmaForecast(data, alpha = 0.3) {
|
|
64
|
+
if (data.length === 0) {
|
|
65
|
+
return { value: 0, trend: 0, confidence: 0.1, direction: 'stable', method: 'ewma', dataPoints: 0 };
|
|
66
|
+
}
|
|
67
|
+
if (data.length === 1) {
|
|
68
|
+
return { value: data[0], trend: 0, confidence: 0.15, direction: 'stable', method: 'ewma', dataPoints: 1 };
|
|
69
|
+
}
|
|
70
|
+
let ewma = data[0];
|
|
71
|
+
for (let i = 1; i < data.length; i++) {
|
|
72
|
+
ewma = alpha * data[i] + (1 - alpha) * ewma;
|
|
73
|
+
}
|
|
74
|
+
// Simple trend from last two values
|
|
75
|
+
const last = data[data.length - 1];
|
|
76
|
+
const prev = data[data.length - 2];
|
|
77
|
+
const trend = last - prev;
|
|
78
|
+
// Low confidence for few data points
|
|
79
|
+
const confidence = Math.min(0.5, 0.15 + data.length * 0.08);
|
|
80
|
+
// Direction
|
|
81
|
+
const range = Math.max(...data) - Math.min(...data);
|
|
82
|
+
const trendRatio = range > 0 ? Math.abs(trend) / range : 0;
|
|
83
|
+
let direction;
|
|
84
|
+
if (trendRatio < 0.05) {
|
|
85
|
+
direction = 'stable';
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
direction = trend > 0 ? 'up' : 'down';
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
value: ewma,
|
|
92
|
+
trend,
|
|
93
|
+
confidence,
|
|
94
|
+
direction,
|
|
95
|
+
method: 'ewma',
|
|
96
|
+
dataPoints: data.length,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Calibrate raw confidence using historical accuracy buckets.
|
|
101
|
+
* If the model was overconfident in a range, it adjusts downward — and vice versa.
|
|
102
|
+
*
|
|
103
|
+
* Returns value clamped to [0.01, 0.99].
|
|
104
|
+
*/
|
|
105
|
+
export function calibrateConfidence(rawConfidence, buckets) {
|
|
106
|
+
if (buckets.length === 0)
|
|
107
|
+
return Math.max(0.01, Math.min(0.99, rawConfidence));
|
|
108
|
+
// Find the matching bucket
|
|
109
|
+
const bucket = buckets.find(b => rawConfidence >= b.range_start && rawConfidence < b.range_end);
|
|
110
|
+
if (!bucket || bucket.predicted_count < 3) {
|
|
111
|
+
// Not enough data in this bucket — return raw
|
|
112
|
+
return Math.max(0.01, Math.min(0.99, rawConfidence));
|
|
113
|
+
}
|
|
114
|
+
// Adjust: if predicted 0.8 confidence but actual accuracy was 0.6, offset = -0.2
|
|
115
|
+
const midpoint = (bucket.range_start + bucket.range_end) / 2;
|
|
116
|
+
const offset = bucket.actual_accuracy - midpoint;
|
|
117
|
+
const adjusted = rawConfidence + offset;
|
|
118
|
+
return Math.max(0.01, Math.min(0.99, adjusted));
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=forecaster.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forecaster.js","sourceRoot":"","sources":["../../src/prediction/forecaster.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,EAAE;AACF,6DAA6D;AAC7D,mDAAmD;AAInD;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAc,EACd,UAAkB,EAClB,KAAK,GAAG,GAAG,EACX,IAAI,GAAG,GAAG;IAEV,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IAClI,CAAC;IAED,6BAA6B;IAC7B,IAAI,KAAK,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;IACrB,IAAI,KAAK,GAAG,IAAI,CAAC,CAAC,CAAE,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;IAEhC,MAAM,SAAS,GAAa,EAAE,CAAC;IAE/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;QACnB,MAAM,SAAS,GAAG,KAAK,CAAC;QAExB,eAAe;QACf,KAAK,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,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,WAAW,IAAI,aAAa,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC;IAChG,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,eAAe,GAAG,CAAC,EAAE,CAAC;QAC1C,8CAA8C;QAC9C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,iFAAiF;IACjF,MAAM,QAAQ,GAAG,CAAC,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,MAAM,CAAC,eAAe,GAAG,QAAQ,CAAC;IACjD,MAAM,QAAQ,GAAG,aAAa,GAAG,MAAM,CAAC;IAExC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { PredictionEngine, runPredictionMigration } from './prediction-engine.js';
|
|
2
|
+
export { PredictionTracker } from './tracker.js';
|
|
3
|
+
export { holtWintersForecast, ewmaForecast, calibrateConfidence } from './forecaster.js';
|
|
4
|
+
export type { PredictionDomain, PredictionStatus, PredictionEngineConfig, Prediction, PredictionAccuracy, PredictionSummary, ForecastResult, PredictionInput, MetricDataPoint, CalibrationBucket, } from './types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prediction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type Database from 'better-sqlite3';
|
|
2
|
+
import type { ThoughtStream } from '../consciousness/thought-stream.js';
|
|
3
|
+
import type { ResearchJournal } from '../research/journal.js';
|
|
4
|
+
import type { PredictionEngineConfig, Prediction, PredictionDomain, PredictionStatus, PredictionAccuracy, PredictionSummary, PredictionInput, ForecastResult, MetricDataPoint } from './types.js';
|
|
5
|
+
export declare function runPredictionMigration(db: Database.Database): void;
|
|
6
|
+
export declare class PredictionEngine {
|
|
7
|
+
private db;
|
|
8
|
+
private config;
|
|
9
|
+
private tracker;
|
|
10
|
+
private thoughtStream;
|
|
11
|
+
private journal;
|
|
12
|
+
private timer;
|
|
13
|
+
private calibrationOffset;
|
|
14
|
+
private log;
|
|
15
|
+
constructor(db: Database.Database, config: PredictionEngineConfig);
|
|
16
|
+
/** Set the ThoughtStream for consciousness integration. */
|
|
17
|
+
setThoughtStream(stream: ThoughtStream): void;
|
|
18
|
+
/** Set the Research Journal for logging notable predictions. */
|
|
19
|
+
setJournal(journal: ResearchJournal): void;
|
|
20
|
+
/** Start periodic resolution timer. */
|
|
21
|
+
start(): void;
|
|
22
|
+
/** Stop the resolution timer. */
|
|
23
|
+
stop(): void;
|
|
24
|
+
/** Record a metric data point. Called by domain event handlers. */
|
|
25
|
+
recordMetric(metric: string, value: number, domain?: PredictionDomain): void;
|
|
26
|
+
/**
|
|
27
|
+
* Generate a prediction for a specific metric.
|
|
28
|
+
* Returns null if insufficient data or confidence too low.
|
|
29
|
+
*/
|
|
30
|
+
predict(input: PredictionInput): Prediction | null;
|
|
31
|
+
/**
|
|
32
|
+
* Auto-predict for all tracked metrics that have enough data.
|
|
33
|
+
* Skips metrics with pending predictions. Respects maxPredictionsPerCycle.
|
|
34
|
+
*/
|
|
35
|
+
autoPredictAll(): Prediction[];
|
|
36
|
+
/**
|
|
37
|
+
* Resolve expired/due predictions against current metric values.
|
|
38
|
+
* Returns count of resolved predictions.
|
|
39
|
+
*/
|
|
40
|
+
resolveExpired(): number;
|
|
41
|
+
/** List predictions with optional filters. */
|
|
42
|
+
list(domain?: PredictionDomain, status?: PredictionStatus, limit?: number): Prediction[];
|
|
43
|
+
/** Get accuracy statistics. */
|
|
44
|
+
getAccuracy(domain?: PredictionDomain): PredictionAccuracy[];
|
|
45
|
+
/** Get full prediction summary. */
|
|
46
|
+
getSummary(): PredictionSummary;
|
|
47
|
+
/** Run a forecast on raw data. Uses Holt-Winters (≥ minDataPoints) or EWMA. */
|
|
48
|
+
forecast(data: number[], _horizonMs: number): ForecastResult;
|
|
49
|
+
/** Get metric history as time series. */
|
|
50
|
+
getMetricHistory(metric: string, limit?: number): MetricDataPoint[];
|
|
51
|
+
/** Periodic cycle: resolve + auto-predict. */
|
|
52
|
+
private cycle;
|
|
53
|
+
/** Recalibrate confidence offset based on historical accuracy. */
|
|
54
|
+
private recalibrate;
|
|
55
|
+
/** Apply calibration to raw confidence. */
|
|
56
|
+
private applyCalibration;
|
|
57
|
+
/** Get all unique tracked metrics with their domains. */
|
|
58
|
+
private getTrackedMetrics;
|
|
59
|
+
}
|