@timmeck/brain-core 2.36.29 → 2.36.31
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 +185 -4
- package/dist/codegen/feature-extractor.d.ts +91 -0
- package/dist/codegen/feature-extractor.js +601 -0
- package/dist/codegen/feature-extractor.js.map +1 -0
- package/dist/codegen/index.d.ts +2 -0
- package/dist/codegen/index.js +1 -0
- package/dist/codegen/index.js.map +1 -1
- package/dist/codegen/repo-absorber.d.ts +4 -0
- package/dist/codegen/repo-absorber.js +11 -1
- package/dist/codegen/repo-absorber.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/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/command-center.html
CHANGED
|
@@ -234,6 +234,7 @@ canvas{display:block;width:100%;height:100%}
|
|
|
234
234
|
<div class="nav-item" data-page="learning"><span class="nav-icon">🧠</span><span class="nav-label" data-t="Lern-Kreislauf">Lern-Kreislauf</span></div>
|
|
235
235
|
<div class="nav-item" data-page="trading"><span class="nav-icon">📈</span><span class="nav-label">Trading Flow</span></div>
|
|
236
236
|
<div class="nav-item" data-page="marketing"><span class="nav-icon">📣</span><span class="nav-label">Marketing Flow</span></div>
|
|
237
|
+
<div class="nav-item" data-page="intelligence"><span class="nav-icon">💡</span><span class="nav-label" data-t="Intelligenz">Intelligenz</span></div>
|
|
237
238
|
<div class="nav-section">System</div>
|
|
238
239
|
<div class="nav-item" data-page="crossbrain"><span class="nav-icon">🔗</span><span class="nav-label">Cross-Brain</span></div>
|
|
239
240
|
<div class="nav-item" data-page="debates"><span class="nav-icon">⚖</span><span class="nav-label">Debates</span></div>
|
|
@@ -473,7 +474,76 @@ canvas{display:block;width:100%;height:100%}
|
|
|
473
474
|
</div>
|
|
474
475
|
</div>
|
|
475
476
|
|
|
476
|
-
<!-- ════ Page 5:
|
|
477
|
+
<!-- ════ Page 5: Intelligence ═══════════════════════ -->
|
|
478
|
+
<div class="page" id="page-intelligence">
|
|
479
|
+
<!-- RAG Pipeline -->
|
|
480
|
+
<div class="section">
|
|
481
|
+
<div class="section-title"><span class="icon">🔍</span> RAG Pipeline — <span data-t="Vektor-Suche">Vektor-Suche</span></div>
|
|
482
|
+
<p style="font-size:12px;color:var(--text-dim);margin-bottom:12px" data-t="Alles Wissen als Vektoren indexiert. Semantische Suche über Insights, Memories, Principles, Errors, Solutions und absorbierten Code.">Alles Wissen als Vektoren indexiert. Semantische Suche über Insights, Memories, Principles, Errors, Solutions und absorbierten Code.</p>
|
|
483
|
+
<div class="grid grid-3">
|
|
484
|
+
<div class="card" style="text-align:center"><div class="card-value" id="int-rag-total" style="color:var(--cyan)">0</div><div class="card-sub" data-t="Vektoren gesamt">Vektoren gesamt</div></div>
|
|
485
|
+
<div class="card" style="text-align:center"><div class="card-value" id="int-rag-collections" style="color:var(--green)">0</div><div class="card-sub">Collections</div></div>
|
|
486
|
+
<div class="card" style="text-align:center"><div class="card-value" id="int-rag-indexed" style="color:var(--purple);font-size:14px">—</div><div class="card-sub" data-t="Letzte Indexierung">Letzte Indexierung</div></div>
|
|
487
|
+
</div>
|
|
488
|
+
<div id="ragCollections" style="margin-top:12px"></div>
|
|
489
|
+
</div>
|
|
490
|
+
|
|
491
|
+
<!-- Knowledge Graph -->
|
|
492
|
+
<div class="section">
|
|
493
|
+
<div class="section-title"><span class="icon">🕸</span> Knowledge Graph — <span data-t="Fakten-Netzwerk">Fakten-Netzwerk</span></div>
|
|
494
|
+
<p style="font-size:12px;color:var(--text-dim);margin-bottom:12px" data-t="Typisierte Relationen: Subjekt → Prädikat → Objekt. Automatisch extrahiert aus Insights, Error-Solutions und assimilierten Repos.">Typisierte Relationen: Subjekt → Prädikat → Objekt. Automatisch extrahiert aus Insights, Error-Solutions und assimilierten Repos.</p>
|
|
495
|
+
<div class="grid grid-3">
|
|
496
|
+
<div class="card" style="text-align:center"><div class="card-value" id="int-kg-facts" style="color:var(--cyan)">0</div><div class="card-sub" data-t="Fakten gesamt">Fakten gesamt</div></div>
|
|
497
|
+
<div class="card" style="text-align:center"><div class="card-value" id="int-kg-predicates" style="color:var(--green)">0</div><div class="card-sub" data-t="Prädikate">Prädikate</div></div>
|
|
498
|
+
<div class="card" style="text-align:center"><div class="card-value" id="int-kg-confidence" style="color:var(--yellow)">0%</div><div class="card-sub" data-t="Ø Konfidenz">Ø Konfidenz</div></div>
|
|
499
|
+
</div>
|
|
500
|
+
<div id="kgPredicates" style="margin-top:12px"></div>
|
|
501
|
+
</div>
|
|
502
|
+
|
|
503
|
+
<!-- Tool Learning -->
|
|
504
|
+
<div class="section">
|
|
505
|
+
<div class="section-title"><span class="icon">🛠</span> Tool Learning — <span data-t="Nutzungsmuster">Nutzungsmuster</span></div>
|
|
506
|
+
<p style="font-size:12px;color:var(--text-dim);margin-bottom:12px" data-t="Trackt jeden IPC-Call: welche Tools werden wie oft und wie erfolgreich genutzt.">Trackt jeden IPC-Call: welche Tools werden wie oft und wie erfolgreich genutzt.</p>
|
|
507
|
+
<div id="toolStats" style="margin-top:8px"><div class="empty" data-t="Keine Tool-Daten">Keine Tool-Daten</div></div>
|
|
508
|
+
</div>
|
|
509
|
+
|
|
510
|
+
<!-- Feedback & Proactive Row -->
|
|
511
|
+
<div class="grid grid-2">
|
|
512
|
+
<!-- Feedback Learning -->
|
|
513
|
+
<div class="section" style="margin:0">
|
|
514
|
+
<div class="section-title"><span class="icon">💬</span> Feedback</div>
|
|
515
|
+
<div class="grid grid-2" style="gap:8px">
|
|
516
|
+
<div class="card" style="text-align:center;padding:8px"><div class="card-value" id="int-fb-positive" style="color:var(--green);font-size:20px">0</div><div class="card-sub">Positive</div></div>
|
|
517
|
+
<div class="card" style="text-align:center;padding:8px"><div class="card-value" id="int-fb-negative" style="color:var(--red);font-size:20px">0</div><div class="card-sub">Negative</div></div>
|
|
518
|
+
</div>
|
|
519
|
+
<div class="card" style="text-align:center;margin-top:8px;padding:8px"><div class="card-value" id="int-fb-reward" style="font-size:16px">0</div><div class="card-sub" data-t="Ø Reward Score">Ø Reward Score</div></div>
|
|
520
|
+
</div>
|
|
521
|
+
|
|
522
|
+
<!-- Proactive Suggestions -->
|
|
523
|
+
<div class="section" style="margin:0">
|
|
524
|
+
<div class="section-title"><span class="icon">💡</span> <span data-t="Proaktive Vorschläge">Proaktive Vorschläge</span></div>
|
|
525
|
+
<div class="grid grid-2" style="gap:8px">
|
|
526
|
+
<div class="card" style="text-align:center;padding:8px"><div class="card-value" id="int-pr-active" style="color:var(--cyan);font-size:20px">0</div><div class="card-sub" data-t="Offen">Offen</div></div>
|
|
527
|
+
<div class="card" style="text-align:center;padding:8px"><div class="card-value" id="int-pr-dismissed" style="color:var(--text-dim);font-size:20px">0</div><div class="card-sub" data-t="Verworfen">Verworfen</div></div>
|
|
528
|
+
</div>
|
|
529
|
+
<div class="card" style="text-align:center;margin-top:8px;padding:8px"><div class="card-value" id="int-pr-total" style="font-size:16px">0</div><div class="card-sub" data-t="Vorschläge gesamt">Vorschläge gesamt</div></div>
|
|
530
|
+
</div>
|
|
531
|
+
</div>
|
|
532
|
+
|
|
533
|
+
<!-- User Model -->
|
|
534
|
+
<div class="section">
|
|
535
|
+
<div class="section-title"><span class="icon">👤</span> User Model — <span data-t="Dein Profil">Dein Profil</span></div>
|
|
536
|
+
<p style="font-size:12px;color:var(--text-dim);margin-bottom:12px" data-t="Brain lernt dein Verhalten: Skill-Domains, bevorzugte Tools, Arbeitszeiten.">Brain lernt dein Verhalten: Skill-Domains, bevorzugte Tools, Arbeitszeiten.</p>
|
|
537
|
+
<div class="grid grid-3">
|
|
538
|
+
<div class="card" style="text-align:center"><div class="card-value" id="int-um-domains" style="color:var(--cyan)">0</div><div class="card-sub" data-t="Skill-Domains">Skill-Domains</div></div>
|
|
539
|
+
<div class="card" style="text-align:center"><div class="card-value" id="int-um-keys" style="color:var(--green)">0</div><div class="card-sub" data-t="Profil-Keys">Profil-Keys</div></div>
|
|
540
|
+
<div class="card" style="text-align:center"><div class="card-value" id="int-um-updated" style="color:var(--purple);font-size:14px">—</div><div class="card-sub" data-t="Zuletzt aktualisiert">Zuletzt aktualisiert</div></div>
|
|
541
|
+
</div>
|
|
542
|
+
<div id="userTopTools" style="margin-top:12px"></div>
|
|
543
|
+
</div>
|
|
544
|
+
</div>
|
|
545
|
+
|
|
546
|
+
<!-- ════ Page 6: Cross-Brain & Borg ═════════════════ -->
|
|
477
547
|
<div class="page" id="page-crossbrain">
|
|
478
548
|
<div class="section">
|
|
479
549
|
<div class="section-title"><span class="icon">🔗</span> <span data-t="So kommunizieren die Brains">So kommunizieren die Brains</span></div>
|
|
@@ -660,6 +730,21 @@ const translations = { en: {
|
|
|
660
730
|
'Brain klont Open-Source-Repos, extrahiert Patterns und Wissen, indexiert alles in RAG + Knowledge Graph, und löscht den Clone wieder.':'Brain clones open-source repos, extracts patterns and knowledge, indexes everything into RAG + Knowledge Graph, then deletes the clone.',
|
|
661
731
|
'Repos assimiliert':'Repos Assimilated','In der Warteschlange':'In Queue','Zuletzt assimiliert':'Last Assimilated',
|
|
662
732
|
'Noch keine Repos assimiliert':'No repos assimilated yet','Dateien':'Files',
|
|
733
|
+
'Intelligenz':'Intelligence','Vektor-Suche':'Vector Search',
|
|
734
|
+
'Alles Wissen als Vektoren indexiert. Semantische Suche über Insights, Memories, Principles, Errors, Solutions und absorbierten Code.':'All knowledge indexed as vectors. Semantic search across insights, memories, principles, errors, solutions and absorbed code.',
|
|
735
|
+
'Vektoren gesamt':'Total Vectors','Letzte Indexierung':'Last Indexed','Vektoren':'Vectors',
|
|
736
|
+
'Fakten-Netzwerk':'Fact Network',
|
|
737
|
+
'Typisierte Relationen: Subjekt → Prädikat → Objekt. Automatisch extrahiert aus Insights, Error-Solutions und assimilierten Repos.':'Typed relations: Subject → Predicate → Object. Auto-extracted from insights, error-solutions and assimilated repos.',
|
|
738
|
+
'Fakten gesamt':'Total Facts','Prädikate':'Predicates','Ø Konfidenz':'Avg Confidence',
|
|
739
|
+
'Nutzungsmuster':'Usage Patterns',
|
|
740
|
+
'Trackt jeden IPC-Call: welche Tools werden wie oft und wie erfolgreich genutzt.':'Tracks every IPC call: which tools are used how often and how successfully.',
|
|
741
|
+
'Keine Tool-Daten':'No tool data','Aufrufe':'Calls','Erfolg':'Success',
|
|
742
|
+
'Proaktive Vorschläge':'Proactive Suggestions','Offen':'Open','Verworfen':'Dismissed','Vorschläge gesamt':'Total Suggestions',
|
|
743
|
+
'Ø Reward Score':'Avg Reward Score',
|
|
744
|
+
'Dein Profil':'Your Profile',
|
|
745
|
+
'Brain lernt dein Verhalten: Skill-Domains, bevorzugte Tools, Arbeitszeiten.':'Brain learns your behavior: skill domains, preferred tools, working hours.',
|
|
746
|
+
'Skill-Domains':'Skill Domains','Profil-Keys':'Profile Keys','Zuletzt aktualisiert':'Last Updated',
|
|
747
|
+
'Deine Top-Tools:':'Your Top Tools:',
|
|
663
748
|
'Multi-Perspektiven-Debatten zu Schlüsselfragen. Jeder Brain liefert seine Sichtweise basierend auf Prinzipien, Hypothesen und Vorhersagen.':'Multi-perspective debates on key questions. Each brain provides its viewpoint based on principles, hypotheses, and predictions.',
|
|
664
749
|
'Debatten gesamt':'Total Debates','Offen':'Open','Synthesiert':'Synthesized','Letzte Debatten':'Recent Debates',
|
|
665
750
|
'Advocatus Diaboli — Prinzip-Challenges':'Advocatus Diaboli — Principle Challenges',
|
|
@@ -726,7 +811,7 @@ function getLocale() { return currentLang === 'de' ? 'de-DE' : 'en-US'; }
|
|
|
726
811
|
function getTitle(page) {
|
|
727
812
|
const titles = {
|
|
728
813
|
overview:'Ecosystem Overview', learning:t('Der Lern-Kreislauf'), trading:'Trading Flow',
|
|
729
|
-
marketing:'Marketing Flow', crossbrain:'Cross-Brain & Borg', activity:t('Aktivität & Missionen'),
|
|
814
|
+
marketing:'Marketing Flow', intelligence:t('Intelligenz'), crossbrain:'Cross-Brain & Borg', activity:t('Aktivität & Missionen'),
|
|
730
815
|
debates:'Debates & Challenges', infra:t('Infrastruktur')
|
|
731
816
|
}; return titles[page] || '';
|
|
732
817
|
}
|
|
@@ -735,6 +820,7 @@ const titles = {
|
|
|
735
820
|
learning:'Der Lern-Kreislauf',
|
|
736
821
|
trading:'Trading Flow',
|
|
737
822
|
marketing:'Marketing Flow',
|
|
823
|
+
intelligence:'Intelligenz',
|
|
738
824
|
crossbrain:'Cross-Brain & Borg',
|
|
739
825
|
activity:'Aktivität & Missionen',
|
|
740
826
|
debates:'Debates & Challenges',
|
|
@@ -765,6 +851,7 @@ function connectSSE() {
|
|
|
765
851
|
es.addEventListener('selfmod', e => { state.selfmod = JSON.parse(e.data); renderSelfMod(); });
|
|
766
852
|
es.addEventListener('missions', e => { state.missions = JSON.parse(e.data); renderMissions(); });
|
|
767
853
|
es.addEventListener('repoAbsorber', e => { state.repoAbsorber = JSON.parse(e.data); renderRepoAbsorber(); });
|
|
854
|
+
es.addEventListener('intelligence', e => { state.intelligence = JSON.parse(e.data); renderIntelligence(); });
|
|
768
855
|
es.addEventListener('knowledge', e => { state.knowledge = JSON.parse(e.data); renderKnowledge(); });
|
|
769
856
|
es.addEventListener('debates', e => { state.debates = JSON.parse(e.data); renderDebates(); });
|
|
770
857
|
es.onerror = () => { state.connected = false; updateConnection(); };
|
|
@@ -784,12 +871,12 @@ async function loadInitial() {
|
|
|
784
871
|
state.watchdog = data.watchdog || []; state.plugins = data.plugins || [];
|
|
785
872
|
state.borg = data.borg; state.analytics = data.analytics; state.llm = data.llm;
|
|
786
873
|
state.errors = data.errors; state.selfmod = data.selfmod;
|
|
787
|
-
state.missions = data.missions; state.knowledge = data.knowledge; state.repoAbsorber = data.repoAbsorber;
|
|
874
|
+
state.missions = data.missions; state.knowledge = data.knowledge; state.repoAbsorber = data.repoAbsorber; state.intelligence = data.intelligence;
|
|
788
875
|
state.debates = data.debates;
|
|
789
876
|
if (data.thoughts) { state.thoughts = data.thoughts; renderThoughts(); }
|
|
790
877
|
renderEcosystem(); renderEngines(); renderWatchdog(); renderPlugins();
|
|
791
878
|
renderBorg(); renderAnalytics(); renderLLM(); renderErrors();
|
|
792
|
-
renderSelfMod(); renderMissions(); renderRepoAbsorber(); renderKnowledge(); renderDebates();
|
|
879
|
+
renderSelfMod(); renderMissions(); renderRepoAbsorber(); renderIntelligence(); renderKnowledge(); renderDebates();
|
|
793
880
|
} catch {}
|
|
794
881
|
}
|
|
795
882
|
|
|
@@ -996,6 +1083,100 @@ function renderRepoAbsorber() {
|
|
|
996
1083
|
</div>`).join('');
|
|
997
1084
|
}
|
|
998
1085
|
|
|
1086
|
+
// ── Intelligence ─────────────────────────────────────────
|
|
1087
|
+
function renderIntelligence() {
|
|
1088
|
+
const d = state.intelligence;
|
|
1089
|
+
if (!d) return;
|
|
1090
|
+
|
|
1091
|
+
// RAG
|
|
1092
|
+
if (d.rag) {
|
|
1093
|
+
setText('int-rag-total', (d.rag.totalVectors || 0).toLocaleString());
|
|
1094
|
+
const cols = d.rag.collections || [];
|
|
1095
|
+
setText('int-rag-collections', cols.length);
|
|
1096
|
+
setText('int-rag-indexed', d.rag.lastIndexedAt ? new Date(d.rag.lastIndexedAt).toLocaleString(getLocale(), {day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit'}) : '—');
|
|
1097
|
+
const el = document.getElementById('ragCollections');
|
|
1098
|
+
if (cols.length) {
|
|
1099
|
+
el.innerHTML = cols.map(c => `<div class="card" style="padding:6px 12px;margin-bottom:4px;display:flex;justify-content:space-between">
|
|
1100
|
+
<span style="color:var(--cyan)">${escHtml(c.collection)}</span>
|
|
1101
|
+
<span style="color:var(--text-dim)">${(c.count||0).toLocaleString()} ${t('Vektoren')}</span>
|
|
1102
|
+
</div>`).join('');
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
// Knowledge Graph
|
|
1107
|
+
if (d.kg) {
|
|
1108
|
+
setText('int-kg-facts', (d.kg.totalFacts || 0).toLocaleString());
|
|
1109
|
+
const preds = d.kg.predicateDistribution || {};
|
|
1110
|
+
const predKeys = Object.keys(preds);
|
|
1111
|
+
setText('int-kg-predicates', predKeys.length);
|
|
1112
|
+
setText('int-kg-confidence', ((d.kg.avgConfidence || 0) * 100).toFixed(0) + '%');
|
|
1113
|
+
const el = document.getElementById('kgPredicates');
|
|
1114
|
+
if (predKeys.length) {
|
|
1115
|
+
const sorted = predKeys.sort((a,b) => preds[b] - preds[a]).slice(0, 10);
|
|
1116
|
+
el.innerHTML = sorted.map(k => `<div class="card" style="padding:6px 12px;margin-bottom:4px;display:flex;justify-content:space-between">
|
|
1117
|
+
<span style="color:var(--green)">${escHtml(k)}</span>
|
|
1118
|
+
<span style="color:var(--text-dim)">${preds[k]}</span>
|
|
1119
|
+
</div>`).join('');
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
// Tool Learning
|
|
1124
|
+
const tools = Array.isArray(d.toolStats) ? d.toolStats : [];
|
|
1125
|
+
const toolEl = document.getElementById('toolStats');
|
|
1126
|
+
if (tools.length) {
|
|
1127
|
+
const top = tools.slice(0, 10);
|
|
1128
|
+
toolEl.innerHTML = `<div style="display:grid;grid-template-columns:1fr 60px 70px 60px;gap:4px;font-size:12px;padding:0 4px">
|
|
1129
|
+
<div style="color:var(--text-dim);font-weight:600">Tool</div>
|
|
1130
|
+
<div style="color:var(--text-dim);font-weight:600;text-align:right">${t('Aufrufe')}</div>
|
|
1131
|
+
<div style="color:var(--text-dim);font-weight:600;text-align:right">${t('Erfolg')}</div>
|
|
1132
|
+
<div style="color:var(--text-dim);font-weight:600;text-align:right">Avg ms</div>
|
|
1133
|
+
</div>` + top.map(t => {
|
|
1134
|
+
const rate = (t.successRate * 100).toFixed(0);
|
|
1135
|
+
const rateColor = t.successRate >= 0.9 ? 'var(--green)' : t.successRate >= 0.7 ? 'var(--yellow)' : 'var(--red)';
|
|
1136
|
+
return `<div class="card" style="padding:4px 8px;margin-bottom:2px;display:grid;grid-template-columns:1fr 60px 70px 60px;gap:4px;font-size:12px">
|
|
1137
|
+
<span style="color:var(--cyan);overflow:hidden;text-overflow:ellipsis;white-space:nowrap" title="${escHtml(t.tool)}">${escHtml(t.tool)}</span>
|
|
1138
|
+
<span style="text-align:right">${t.totalUses}</span>
|
|
1139
|
+
<span style="text-align:right;color:${rateColor}">${rate}%</span>
|
|
1140
|
+
<span style="text-align:right;color:var(--text-dim)">${Math.round(t.avgDuration)}</span>
|
|
1141
|
+
</div>`;
|
|
1142
|
+
}).join('');
|
|
1143
|
+
} else {
|
|
1144
|
+
toolEl.innerHTML = `<div class="empty">${t('Keine Tool-Daten')}</div>`;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
// Feedback
|
|
1148
|
+
if (d.feedback) {
|
|
1149
|
+
setText('int-fb-positive', d.feedback.positiveCount || 0);
|
|
1150
|
+
setText('int-fb-negative', d.feedback.negativeCount || 0);
|
|
1151
|
+
const reward = d.feedback.avgRewardScore || 0;
|
|
1152
|
+
const rewardEl = document.getElementById('int-fb-reward');
|
|
1153
|
+
rewardEl.textContent = reward.toFixed(2);
|
|
1154
|
+
rewardEl.style.color = reward > 0 ? 'var(--green)' : reward < 0 ? 'var(--red)' : 'var(--text-dim)';
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
// Proactive
|
|
1158
|
+
if (d.proactive) {
|
|
1159
|
+
setText('int-pr-active', d.proactive.activeSuggestions || 0);
|
|
1160
|
+
setText('int-pr-dismissed', d.proactive.dismissedCount || 0);
|
|
1161
|
+
setText('int-pr-total', d.proactive.totalSuggestions || 0);
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
// User Model
|
|
1165
|
+
if (d.userModel) {
|
|
1166
|
+
setText('int-um-domains', d.userModel.domains || 0);
|
|
1167
|
+
setText('int-um-keys', d.userModel.totalKeys || 0);
|
|
1168
|
+
setText('int-um-updated', d.userModel.lastUpdated ? new Date(d.userModel.lastUpdated).toLocaleString(getLocale(), {day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit'}) : '—');
|
|
1169
|
+
}
|
|
1170
|
+
if (d.userProfile && d.userProfile.topTools) {
|
|
1171
|
+
const el = document.getElementById('userTopTools');
|
|
1172
|
+
const tools = d.userProfile.topTools.slice(0, 5);
|
|
1173
|
+
if (tools.length) {
|
|
1174
|
+
el.innerHTML = `<div style="font-size:12px;color:var(--text-dim);margin-bottom:6px">${t('Deine Top-Tools:')}</div>` +
|
|
1175
|
+
tools.map((t,i) => `<span class="badge badge-ok" style="margin:2px">${i+1}. ${escHtml(t)}</span>`).join('');
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
|
|
999
1180
|
// ── Knowledge Growth ──────────────────────────────────────
|
|
1000
1181
|
function renderKnowledge() {
|
|
1001
1182
|
const d = state.knowledge;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type Database from 'better-sqlite3';
|
|
2
|
+
import type { RAGEngine } from '../rag/rag-engine.js';
|
|
3
|
+
import type { KnowledgeGraphEngine } from '../knowledge-graph/graph-engine.js';
|
|
4
|
+
import type { LLMService } from '../llm/llm-service.js';
|
|
5
|
+
export interface ExtractedFeature {
|
|
6
|
+
id: number;
|
|
7
|
+
repo: string;
|
|
8
|
+
name: string;
|
|
9
|
+
category: FeatureCategory;
|
|
10
|
+
description: string;
|
|
11
|
+
codeSnippet: string;
|
|
12
|
+
filePath: string;
|
|
13
|
+
language: string;
|
|
14
|
+
usefulness: number;
|
|
15
|
+
applicability: string;
|
|
16
|
+
tags: string[];
|
|
17
|
+
extractedAt: string;
|
|
18
|
+
}
|
|
19
|
+
export type FeatureCategory = 'utility_function' | 'design_pattern' | 'architecture' | 'error_handling' | 'testing_pattern' | 'performance' | 'api_pattern' | 'data_structure' | 'config_pattern' | 'cli_pattern';
|
|
20
|
+
export interface FeatureExtractionResult {
|
|
21
|
+
repo: string;
|
|
22
|
+
featuresExtracted: number;
|
|
23
|
+
categories: Record<string, number>;
|
|
24
|
+
durationMs: number;
|
|
25
|
+
}
|
|
26
|
+
export interface FeatureSearchOptions {
|
|
27
|
+
category?: FeatureCategory;
|
|
28
|
+
repo?: string;
|
|
29
|
+
minUsefulness?: number;
|
|
30
|
+
limit?: number;
|
|
31
|
+
query?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface FeatureStats {
|
|
34
|
+
totalFeatures: number;
|
|
35
|
+
byCategory: Record<string, number>;
|
|
36
|
+
byRepo: Record<string, number>;
|
|
37
|
+
topFeatures: ExtractedFeature[];
|
|
38
|
+
avgUsefulness: number;
|
|
39
|
+
}
|
|
40
|
+
export declare class FeatureExtractor {
|
|
41
|
+
private readonly db;
|
|
42
|
+
private readonly log;
|
|
43
|
+
private ragEngine;
|
|
44
|
+
private knowledgeGraph;
|
|
45
|
+
private llmService;
|
|
46
|
+
constructor(db: Database.Database);
|
|
47
|
+
setRAGEngine(rag: RAGEngine): void;
|
|
48
|
+
setKnowledgeGraph(kg: KnowledgeGraphEngine): void;
|
|
49
|
+
setLLMService(llm: LLMService): void;
|
|
50
|
+
private ensureTable;
|
|
51
|
+
/**
|
|
52
|
+
* Extract features from absorbed code via RAG search.
|
|
53
|
+
* Searches for interesting patterns in the absorbed_code collection.
|
|
54
|
+
*/
|
|
55
|
+
extractFromAbsorbedCode(repo?: string): Promise<FeatureExtractionResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Extract features from a raw code string.
|
|
58
|
+
*/
|
|
59
|
+
extractFeaturesFromCode(content: string, filePath: string, repo: string, ext: string): Array<Omit<ExtractedFeature, 'id' | 'extractedAt'>>;
|
|
60
|
+
/**
|
|
61
|
+
* Extract features from code and save them to the database.
|
|
62
|
+
* Returns the number of features saved.
|
|
63
|
+
*/
|
|
64
|
+
extractAndSave(content: string, filePath: string, repo: string, ext: string): number;
|
|
65
|
+
/**
|
|
66
|
+
* Search for features matching criteria.
|
|
67
|
+
*/
|
|
68
|
+
search(options?: FeatureSearchOptions): ExtractedFeature[];
|
|
69
|
+
/**
|
|
70
|
+
* Semantic search for features using RAG.
|
|
71
|
+
*/
|
|
72
|
+
semanticSearch(query: string, limit?: number): Promise<ExtractedFeature[]>;
|
|
73
|
+
/**
|
|
74
|
+
* Suggest features that could help improve Brain based on current weaknesses.
|
|
75
|
+
*/
|
|
76
|
+
suggest(context?: string): Promise<ExtractedFeature[]>;
|
|
77
|
+
/**
|
|
78
|
+
* Get statistics about extracted features.
|
|
79
|
+
*/
|
|
80
|
+
getStats(): FeatureStats;
|
|
81
|
+
private getAbsorbedCode;
|
|
82
|
+
private extractCodeBlock;
|
|
83
|
+
private calculateUsefulness;
|
|
84
|
+
private extractTags;
|
|
85
|
+
private generateBasicDescription;
|
|
86
|
+
private saveFeature;
|
|
87
|
+
/**
|
|
88
|
+
* Use LLM to enrich top features with better descriptions and applicability.
|
|
89
|
+
*/
|
|
90
|
+
private enrichTopFeatures;
|
|
91
|
+
}
|