noormme 1.2.3 → 1.2.5
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/dist/cjs/agentic/ActionJournal.d.ts +6 -6
- package/dist/cjs/agentic/ActionJournal.js +10 -10
- package/dist/cjs/agentic/CapabilityManager.d.ts +5 -5
- package/dist/cjs/agentic/CapabilityManager.js +35 -24
- package/dist/cjs/agentic/Cortex.js +12 -13
- package/dist/cjs/agentic/EpisodicMemory.js +4 -3
- package/dist/cjs/agentic/PersonaManager.d.ts +4 -4
- package/dist/cjs/agentic/PersonaManager.js +19 -15
- package/dist/cjs/agentic/PolicyEnforcer.d.ts +4 -8
- package/dist/cjs/agentic/PolicyEnforcer.js +26 -26
- package/dist/cjs/agentic/ResourceMonitor.js +2 -1
- package/dist/cjs/agentic/SessionManager.js +7 -6
- package/dist/cjs/agentic/improvement/AblationEngine.d.ts +3 -3
- package/dist/cjs/agentic/improvement/AblationEngine.js +41 -24
- package/dist/cjs/agentic/improvement/ActionRefiner.d.ts +1 -1
- package/dist/cjs/agentic/improvement/ActionRefiner.js +21 -15
- package/dist/cjs/agentic/improvement/ConflictResolver.js +4 -3
- package/dist/cjs/agentic/improvement/EvolutionRitual.js +2 -1
- package/dist/cjs/agentic/improvement/EvolutionaryPilot.d.ts +1 -1
- package/dist/cjs/agentic/improvement/EvolutionaryPilot.js +17 -19
- package/dist/cjs/agentic/improvement/GoalArchitect.js +10 -9
- package/dist/cjs/agentic/improvement/GovernanceManager.d.ts +5 -5
- package/dist/cjs/agentic/improvement/GovernanceManager.js +12 -22
- package/dist/cjs/agentic/improvement/HiveLink.d.ts +3 -3
- package/dist/cjs/agentic/improvement/HiveLink.js +15 -157
- package/dist/cjs/agentic/improvement/KnowledgeDistiller.d.ts +15 -29
- package/dist/cjs/agentic/improvement/KnowledgeDistiller.js +69 -351
- package/dist/cjs/agentic/improvement/QuotaManager.d.ts +1 -1
- package/dist/cjs/agentic/improvement/QuotaManager.js +11 -11
- package/dist/cjs/agentic/improvement/RecursiveReasoner.d.ts +4 -4
- package/dist/cjs/agentic/improvement/RecursiveReasoner.js +10 -10
- package/dist/cjs/agentic/improvement/ReflectionEngine.d.ts +2 -2
- package/dist/cjs/agentic/improvement/ReflectionEngine.js +2 -2
- package/dist/cjs/agentic/improvement/RitualOrchestrator.d.ts +3 -3
- package/dist/cjs/agentic/improvement/RitualOrchestrator.js +12 -9
- package/dist/cjs/agentic/improvement/SelfEvolution.d.ts +1 -1
- package/dist/cjs/agentic/improvement/SelfEvolution.js +21 -18
- package/dist/cjs/agentic/improvement/SelfTestRegistry.d.ts +1 -1
- package/dist/cjs/agentic/improvement/SelfTestRegistry.js +27 -19
- package/dist/cjs/agentic/improvement/SovereignMetrics.d.ts +6 -6
- package/dist/cjs/agentic/improvement/SovereignMetrics.js +12 -12
- package/dist/cjs/agentic/improvement/StrategicPlanner.d.ts +10 -54
- package/dist/cjs/agentic/improvement/StrategicPlanner.js +43 -396
- package/dist/cjs/agentic/improvement/distillation/ConflictChallenger.d.ts +3 -0
- package/dist/cjs/agentic/improvement/distillation/ConflictChallenger.js +54 -0
- package/dist/cjs/agentic/improvement/distillation/FactDistiller.d.ts +10 -0
- package/dist/cjs/agentic/improvement/distillation/FactDistiller.js +115 -0
- package/dist/cjs/agentic/improvement/distillation/KnowledgeConsolidator.d.ts +6 -0
- package/dist/cjs/agentic/improvement/distillation/KnowledgeConsolidator.js +63 -0
- package/dist/cjs/agentic/improvement/distillation/RelationshipArchitect.d.ts +6 -0
- package/dist/cjs/agentic/improvement/distillation/RelationshipArchitect.js +73 -0
- package/dist/cjs/agentic/improvement/governance/MaintenanceOracle.js +5 -5
- package/dist/cjs/agentic/improvement/governance/PersonaAuditor.js +7 -11
- package/dist/cjs/agentic/improvement/governance/RemediationEngine.js +8 -3
- package/dist/cjs/agentic/improvement/hive/DomainMaster.d.ts +4 -0
- package/dist/cjs/agentic/improvement/hive/DomainMaster.js +19 -0
- package/dist/cjs/agentic/improvement/hive/KnowledgePromoter.d.ts +6 -0
- package/dist/cjs/agentic/improvement/hive/KnowledgePromoter.js +57 -0
- package/dist/cjs/agentic/improvement/hive/SkillPropagator.d.ts +6 -0
- package/dist/cjs/agentic/improvement/hive/SkillPropagator.js +91 -0
- package/dist/cjs/agentic/improvement/strategy/EvolutionVerificator.d.ts +6 -0
- package/dist/cjs/agentic/improvement/strategy/EvolutionVerificator.js +48 -0
- package/dist/cjs/agentic/improvement/strategy/MutationEngine.d.ts +10 -0
- package/dist/cjs/agentic/improvement/strategy/MutationEngine.js +119 -0
- package/dist/cjs/agentic/improvement/strategy/PerformanceAnalyst.d.ts +6 -0
- package/dist/cjs/agentic/improvement/strategy/PerformanceAnalyst.js +84 -0
- package/dist/cjs/agentic/util/db-utils.d.ts +4 -0
- package/dist/cjs/agentic/util/db-utils.js +27 -0
- package/dist/cjs/cli/index.js +0 -0
- package/dist/cjs/helpers/agent-schema.js +1 -0
- package/dist/cjs/testing/test-utils.js +2 -0
- package/dist/cjs/types/index.d.ts +8 -0
- package/dist/esm/agentic/ActionJournal.d.ts +6 -6
- package/dist/esm/agentic/ActionJournal.js +10 -10
- package/dist/esm/agentic/CapabilityManager.d.ts +5 -5
- package/dist/esm/agentic/CapabilityManager.js +35 -24
- package/dist/esm/agentic/Cortex.js +12 -13
- package/dist/esm/agentic/EpisodicMemory.js +4 -3
- package/dist/esm/agentic/PersonaManager.d.ts +4 -4
- package/dist/esm/agentic/PersonaManager.js +19 -15
- package/dist/esm/agentic/PolicyEnforcer.d.ts +4 -8
- package/dist/esm/agentic/PolicyEnforcer.js +26 -26
- package/dist/esm/agentic/ResourceMonitor.js +2 -1
- package/dist/esm/agentic/SessionManager.js +7 -6
- package/dist/esm/agentic/improvement/AblationEngine.d.ts +3 -3
- package/dist/esm/agentic/improvement/AblationEngine.js +41 -24
- package/dist/esm/agentic/improvement/ActionRefiner.d.ts +1 -1
- package/dist/esm/agentic/improvement/ActionRefiner.js +21 -15
- package/dist/esm/agentic/improvement/ConflictResolver.js +4 -3
- package/dist/esm/agentic/improvement/EvolutionRitual.js +2 -1
- package/dist/esm/agentic/improvement/EvolutionaryPilot.d.ts +1 -1
- package/dist/esm/agentic/improvement/EvolutionaryPilot.js +17 -19
- package/dist/esm/agentic/improvement/GoalArchitect.js +10 -9
- package/dist/esm/agentic/improvement/GovernanceManager.d.ts +5 -5
- package/dist/esm/agentic/improvement/GovernanceManager.js +12 -22
- package/dist/esm/agentic/improvement/HiveLink.d.ts +3 -3
- package/dist/esm/agentic/improvement/HiveLink.js +15 -157
- package/dist/esm/agentic/improvement/KnowledgeDistiller.d.ts +15 -29
- package/dist/esm/agentic/improvement/KnowledgeDistiller.js +69 -351
- package/dist/esm/agentic/improvement/QuotaManager.d.ts +1 -1
- package/dist/esm/agentic/improvement/QuotaManager.js +11 -11
- package/dist/esm/agentic/improvement/RecursiveReasoner.d.ts +4 -4
- package/dist/esm/agentic/improvement/RecursiveReasoner.js +10 -10
- package/dist/esm/agentic/improvement/ReflectionEngine.d.ts +2 -2
- package/dist/esm/agentic/improvement/ReflectionEngine.js +2 -2
- package/dist/esm/agentic/improvement/RitualOrchestrator.d.ts +3 -3
- package/dist/esm/agentic/improvement/RitualOrchestrator.js +12 -9
- package/dist/esm/agentic/improvement/SelfEvolution.d.ts +1 -1
- package/dist/esm/agentic/improvement/SelfEvolution.js +21 -18
- package/dist/esm/agentic/improvement/SelfTestRegistry.d.ts +1 -1
- package/dist/esm/agentic/improvement/SelfTestRegistry.js +27 -19
- package/dist/esm/agentic/improvement/SovereignMetrics.d.ts +6 -6
- package/dist/esm/agentic/improvement/SovereignMetrics.js +12 -12
- package/dist/esm/agentic/improvement/StrategicPlanner.d.ts +10 -54
- package/dist/esm/agentic/improvement/StrategicPlanner.js +43 -396
- package/dist/esm/agentic/improvement/distillation/ConflictChallenger.d.ts +3 -0
- package/dist/esm/agentic/improvement/distillation/ConflictChallenger.js +51 -0
- package/dist/esm/agentic/improvement/distillation/FactDistiller.d.ts +10 -0
- package/dist/esm/agentic/improvement/distillation/FactDistiller.js +112 -0
- package/dist/esm/agentic/improvement/distillation/KnowledgeConsolidator.d.ts +6 -0
- package/dist/esm/agentic/improvement/distillation/KnowledgeConsolidator.js +60 -0
- package/dist/esm/agentic/improvement/distillation/RelationshipArchitect.d.ts +6 -0
- package/dist/esm/agentic/improvement/distillation/RelationshipArchitect.js +70 -0
- package/dist/esm/agentic/improvement/governance/MaintenanceOracle.js +5 -5
- package/dist/esm/agentic/improvement/governance/PersonaAuditor.js +7 -11
- package/dist/esm/agentic/improvement/governance/RemediationEngine.js +8 -3
- package/dist/esm/agentic/improvement/hive/DomainMaster.d.ts +4 -0
- package/dist/esm/agentic/improvement/hive/DomainMaster.js +16 -0
- package/dist/esm/agentic/improvement/hive/KnowledgePromoter.d.ts +6 -0
- package/dist/esm/agentic/improvement/hive/KnowledgePromoter.js +54 -0
- package/dist/esm/agentic/improvement/hive/SkillPropagator.d.ts +6 -0
- package/dist/esm/agentic/improvement/hive/SkillPropagator.js +88 -0
- package/dist/esm/agentic/improvement/strategy/EvolutionVerificator.d.ts +6 -0
- package/dist/esm/agentic/improvement/strategy/EvolutionVerificator.js +45 -0
- package/dist/esm/agentic/improvement/strategy/MutationEngine.d.ts +10 -0
- package/dist/esm/agentic/improvement/strategy/MutationEngine.js +116 -0
- package/dist/esm/agentic/improvement/strategy/PerformanceAnalyst.d.ts +6 -0
- package/dist/esm/agentic/improvement/strategy/PerformanceAnalyst.js +81 -0
- package/dist/esm/agentic/util/db-utils.d.ts +4 -0
- package/dist/esm/agentic/util/db-utils.js +25 -0
- package/dist/esm/helpers/agent-schema.js +1 -0
- package/dist/esm/testing/test-utils.js +2 -0
- package/dist/esm/types/index.d.ts +8 -0
- package/package.json +40 -44
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HiveLink = void 0;
|
|
4
|
-
const
|
|
4
|
+
const KnowledgePromoter_js_1 = require("./hive/KnowledgePromoter.js");
|
|
5
|
+
const SkillPropagator_js_1 = require("./hive/SkillPropagator.js");
|
|
6
|
+
const DomainMaster_js_1 = require("./hive/DomainMaster.js");
|
|
5
7
|
/**
|
|
6
8
|
* HiveLink facilitates "Collective Intelligence" by synchronizing
|
|
7
9
|
* knowledge and lessons learned across different agent personas.
|
|
@@ -11,108 +13,53 @@ class HiveLink {
|
|
|
11
13
|
cortex;
|
|
12
14
|
config;
|
|
13
15
|
knowledgeTable;
|
|
16
|
+
promoter;
|
|
17
|
+
propagator;
|
|
18
|
+
domainMaster;
|
|
14
19
|
constructor(db, cortex, config = {}) {
|
|
15
20
|
this.db = db;
|
|
16
21
|
this.cortex = cortex;
|
|
17
22
|
this.config = config;
|
|
18
23
|
this.knowledgeTable = config.knowledgeTable || 'agent_knowledge_base';
|
|
24
|
+
this.promoter = new KnowledgePromoter_js_1.KnowledgePromoter();
|
|
25
|
+
this.propagator = new SkillPropagator_js_1.SkillPropagator();
|
|
26
|
+
this.domainMaster = new DomainMaster_js_1.DomainMaster();
|
|
19
27
|
}
|
|
20
28
|
get typedDb() {
|
|
21
29
|
return this.db;
|
|
22
30
|
}
|
|
23
31
|
/**
|
|
24
32
|
* Promote high-confidence local knowledge to global "Hive" knowledge.
|
|
25
|
-
* This creates a new, session-agnostic entry or updates an existing global one.
|
|
26
33
|
*/
|
|
27
34
|
async broadcastKnowledge(options = {}) {
|
|
28
35
|
const minConfidence = options.minConfidence ?? 0.9;
|
|
29
36
|
const limit = options.limit ?? 100;
|
|
30
37
|
const offset = options.offset ?? 0;
|
|
31
38
|
console.log(`[HiveLink] Broadcasting knowledge (limit=${limit}, offset=${offset}) with confidence >= ${minConfidence}`);
|
|
32
|
-
// Find high-confidence items that are "local" (have a source_session_id)
|
|
33
39
|
const items = (await this.typedDb
|
|
34
40
|
.selectFrom(this.knowledgeTable)
|
|
35
41
|
.selectAll()
|
|
36
42
|
.where('confidence', '>=', minConfidence)
|
|
37
|
-
.where('source_session_id', 'is not', null)
|
|
43
|
+
.where('source_session_id', 'is not', null)
|
|
38
44
|
.limit(limit)
|
|
39
45
|
.offset(offset)
|
|
40
46
|
.execute());
|
|
41
47
|
let promotedCount = 0;
|
|
42
48
|
for (const item of items) {
|
|
43
|
-
await this.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
.selectFrom(this.knowledgeTable)
|
|
47
|
-
.selectAll()
|
|
48
|
-
.where('entity', '=', item.entity)
|
|
49
|
-
.where('fact', '=', item.fact)
|
|
50
|
-
.where('source_session_id', 'is', null)
|
|
51
|
-
.forUpdate() // Audit Phase 15: prevent concurrent promotion duplication
|
|
52
|
-
.executeTakeFirst();
|
|
53
|
-
if (existingGlobal) {
|
|
54
|
-
// Reinforce existing global knowledge
|
|
55
|
-
const newConfidence = Math.min(0.99, Math.max(existingGlobal.confidence, item.confidence) + 0.01);
|
|
56
|
-
await trx
|
|
57
|
-
.updateTable(this.knowledgeTable)
|
|
58
|
-
.set({
|
|
59
|
-
confidence: newConfidence,
|
|
60
|
-
updated_at: new Date(),
|
|
61
|
-
})
|
|
62
|
-
.where('id', '=', existingGlobal.id)
|
|
63
|
-
.execute();
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
// Create new global knowledge
|
|
67
|
-
const tags = item.tags ? [...item.tags] : [];
|
|
68
|
-
if (!tags.includes('hive_mind'))
|
|
69
|
-
tags.push('hive_mind');
|
|
70
|
-
await trx
|
|
71
|
-
.insertInto(this.knowledgeTable)
|
|
72
|
-
.values({
|
|
73
|
-
entity: item.entity,
|
|
74
|
-
fact: item.fact,
|
|
75
|
-
confidence: item.confidence,
|
|
76
|
-
source_session_id: null,
|
|
77
|
-
tags: JSON.stringify(tags),
|
|
78
|
-
metadata: JSON.stringify({
|
|
79
|
-
...item.metadata,
|
|
80
|
-
promoted_from: item.id,
|
|
81
|
-
promoted_at: new Date(),
|
|
82
|
-
}),
|
|
83
|
-
created_at: new Date(),
|
|
84
|
-
updated_at: new Date(),
|
|
85
|
-
})
|
|
86
|
-
.execute();
|
|
87
|
-
promotedCount++;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
49
|
+
const promoted = await this.promoter.promote(this.db, this.cortex, this.config, this.knowledgeTable, item);
|
|
50
|
+
if (promoted)
|
|
51
|
+
promotedCount++;
|
|
90
52
|
}
|
|
91
53
|
return promotedCount;
|
|
92
54
|
}
|
|
93
55
|
/**
|
|
94
56
|
* Strengthen knowledge related to a specific domain (tag).
|
|
95
|
-
* Increases confidence of all items with this tag, representing "domain mastery".
|
|
96
57
|
*/
|
|
97
58
|
async syncDomain(domainTag, boostFactor = 0.05) {
|
|
98
|
-
|
|
99
|
-
// Use a single SQL update for high throughput
|
|
100
|
-
const result = await this.db
|
|
101
|
-
.updateTable(this.knowledgeTable)
|
|
102
|
-
.set({
|
|
103
|
-
confidence: (0, sql_js_1.sql) `MIN(1.0, confidence + ${boostFactor})`,
|
|
104
|
-
updated_at: new Date(),
|
|
105
|
-
})
|
|
106
|
-
.where('tags', 'like', `%"${domainTag}"%`)
|
|
107
|
-
.where('confidence', '<', 1.0)
|
|
108
|
-
.execute();
|
|
109
|
-
// Kysely update .execute() returns an array of results or similar depending on adapter
|
|
110
|
-
// For simple update, we might just return the count if supported or 1
|
|
111
|
-
return Number(result[0]?.numUpdatedRows ?? 1);
|
|
59
|
+
return this.domainMaster.boostDomain(this.db, this.knowledgeTable, domainTag, boostFactor);
|
|
112
60
|
}
|
|
113
61
|
/**
|
|
114
62
|
* Propagate high-performing capabilities globally using the "Sovereign Draft" protocol.
|
|
115
|
-
* Uses Bayesian Convergence and Shadow Promotion to avoid deadlocks.
|
|
116
63
|
*/
|
|
117
64
|
async broadcastSkills() {
|
|
118
65
|
if (!this.config.evolution?.enableHiveLink &&
|
|
@@ -121,96 +68,7 @@ class HiveLink {
|
|
|
121
68
|
return 0;
|
|
122
69
|
}
|
|
123
70
|
console.log(`[HiveLink] Executing Sovereign Draft for emergent skills...`);
|
|
124
|
-
|
|
125
|
-
const capTable = this.config.capabilitiesTable || 'agent_capabilities';
|
|
126
|
-
// 1. Resolve Verified Skills with Bayesian "Alpha" selection
|
|
127
|
-
const verifiedSkills = await this.cortex.capabilities.getCapabilities('verified');
|
|
128
|
-
// Group verified skills by lineage (base tool name)
|
|
129
|
-
const lineageGroups = new Map();
|
|
130
|
-
for (const skill of verifiedSkills) {
|
|
131
|
-
const meta = typeof skill.metadata === 'string' ? JSON.parse(skill.metadata) : (skill.metadata || {});
|
|
132
|
-
const lineage = meta.lineage || skill.name;
|
|
133
|
-
if (!lineageGroups.has(lineage))
|
|
134
|
-
lineageGroups.set(lineage, []);
|
|
135
|
-
lineageGroups.get(lineage).push({ skill, meta });
|
|
136
|
-
}
|
|
137
|
-
for (const [lineage, variants] of lineageGroups.entries()) {
|
|
138
|
-
// Bayesian Winner Selection
|
|
139
|
-
// Score = (anchored_reliability * totalCount + K * prior) / (totalCount + K)
|
|
140
|
-
// For simplicity, we use anchored_reliability which already incorporates this weighting
|
|
141
|
-
const alphaCandidate = variants.reduce((prev, curr) => {
|
|
142
|
-
const pAnchored = prev.meta.anchored_reliability ?? 0;
|
|
143
|
-
const cAnchored = curr.meta.anchored_reliability ?? 0;
|
|
144
|
-
return cAnchored > pAnchored ? curr : prev;
|
|
145
|
-
});
|
|
146
|
-
// Non-Blocking Set Update: Flag Alpha and Shadow versions
|
|
147
|
-
await this.db.transaction().execute(async (trx) => {
|
|
148
|
-
const currentMeta = alphaCandidate.meta || {};
|
|
149
|
-
const updatedMeta = {
|
|
150
|
-
...currentMeta,
|
|
151
|
-
is_alpha: true,
|
|
152
|
-
broadcasted: true,
|
|
153
|
-
broadcasted_at: new Date()
|
|
154
|
-
};
|
|
155
|
-
// Flag the winner as Alpha
|
|
156
|
-
// Audit Phase 15: Lock candidate before promotion
|
|
157
|
-
const winner = await trx
|
|
158
|
-
.selectFrom(capTable)
|
|
159
|
-
.select('id')
|
|
160
|
-
.where('id', '=', alphaCandidate.skill.id)
|
|
161
|
-
.forUpdate()
|
|
162
|
-
.executeTakeFirst();
|
|
163
|
-
if (winner) {
|
|
164
|
-
await trx
|
|
165
|
-
.updateTable(capTable)
|
|
166
|
-
.set({
|
|
167
|
-
metadata: JSON.stringify(updatedMeta),
|
|
168
|
-
})
|
|
169
|
-
.where('id', '=', winner.id)
|
|
170
|
-
.execute();
|
|
171
|
-
}
|
|
172
|
-
// Flag others in the same lineage as Shadow (Dialect-safe approach)
|
|
173
|
-
const shadowIds = variants
|
|
174
|
-
.filter(v => v.skill.id !== alphaCandidate.skill.id)
|
|
175
|
-
.map(v => v.skill.id);
|
|
176
|
-
if (shadowIds.length > 0) {
|
|
177
|
-
// We fetch and update individually or use a bulk update if the dialect supports complex JSON manipulation.
|
|
178
|
-
// For maximum compatibility (Postgres/SQLite), we do it in a loop for the shadows if the count is small.
|
|
179
|
-
for (const sid of shadowIds) {
|
|
180
|
-
const sMatch = variants.find(v => v.skill.id === sid);
|
|
181
|
-
const sMeta = sMatch?.meta || {};
|
|
182
|
-
await trx.updateTable(capTable)
|
|
183
|
-
.set({
|
|
184
|
-
metadata: JSON.stringify({ ...sMeta, is_alpha: false, is_shadow: true }),
|
|
185
|
-
status: 'experimental'
|
|
186
|
-
})
|
|
187
|
-
.where('id', '=', sid)
|
|
188
|
-
.execute();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
broadcastCount += variants.length;
|
|
193
|
-
}
|
|
194
|
-
// 2. Broadcast Blacklisted Skills (Immune Prophet)
|
|
195
|
-
const blacklisted = await this.cortex.capabilities.getCapabilities('blacklisted');
|
|
196
|
-
const blackIDs = blacklisted
|
|
197
|
-
.filter(s => {
|
|
198
|
-
const meta = typeof s.metadata === 'string' ? JSON.parse(s.metadata) : (s.metadata || {});
|
|
199
|
-
return !meta.broadcasted;
|
|
200
|
-
})
|
|
201
|
-
.map(s => s.id);
|
|
202
|
-
if (blackIDs.length > 0) {
|
|
203
|
-
await this.db
|
|
204
|
-
.updateTable(capTable)
|
|
205
|
-
.set({
|
|
206
|
-
metadata: (0, sql_js_1.sql) `json_set(metadata, '$.broadcasted', true, '$.hive_blacklisted', true)`,
|
|
207
|
-
updated_at: new Date()
|
|
208
|
-
})
|
|
209
|
-
.where('id', 'in', blackIDs)
|
|
210
|
-
.execute();
|
|
211
|
-
broadcastCount += blackIDs.length;
|
|
212
|
-
}
|
|
213
|
-
return broadcastCount;
|
|
71
|
+
return this.propagator.propagate(this.db, this.cortex, this.config);
|
|
214
72
|
}
|
|
215
73
|
/**
|
|
216
74
|
* Simple semver-style version comparison.
|
|
@@ -35,50 +35,33 @@ export declare class KnowledgeDistiller {
|
|
|
35
35
|
private knowledgeTable;
|
|
36
36
|
private linksTable;
|
|
37
37
|
private bloomFilter;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
private get typedDb();
|
|
38
|
+
private distiller;
|
|
39
|
+
private challenger;
|
|
40
|
+
private architect;
|
|
41
|
+
private consolidator;
|
|
42
|
+
constructor(db: Kysely<any>, config?: AgenticConfig);
|
|
44
43
|
/**
|
|
45
44
|
* Add or update a knowledge item with robust merging and transaction support.
|
|
46
45
|
*/
|
|
47
46
|
distill(entity: string, fact: string, confidence: number, sourceSessionId?: string | number, tags?: string[], metadata?: Record<string, any>, source?: 'user' | 'assistant' | 'system'): Promise<KnowledgeItem>;
|
|
47
|
+
/**
|
|
48
|
+
* Manually challenge an existing fact with competing information.
|
|
49
|
+
*/
|
|
50
|
+
challengeKnowledge(entity: string, fact: string, confidence: number, trxOrDb?: any): Promise<void>;
|
|
48
51
|
/**
|
|
49
52
|
* Verify and reinforce existing knowledge.
|
|
50
|
-
* Increases confidence if the fact matches.
|
|
51
53
|
*/
|
|
52
54
|
verifyKnowledge(id: number | string, reinforcement?: number): Promise<KnowledgeItem | null>;
|
|
53
55
|
/**
|
|
54
56
|
* Search knowledge by entity with optional tag filtering.
|
|
55
|
-
* Records a "hit" for each retrieved item to track utility.
|
|
56
57
|
*/
|
|
57
58
|
getKnowledgeByEntity(entity: string, filterTags?: string[]): Promise<KnowledgeItem[]>;
|
|
58
59
|
/**
|
|
59
|
-
* Record a retrieval hit for a knowledge item.
|
|
60
|
+
* Record a retrieval hit for a knowledge item and emit hotspot telemetry.
|
|
60
61
|
*/
|
|
61
62
|
recordHit(id: number | string): Promise<void>;
|
|
62
|
-
/**
|
|
63
|
-
* Calculate the "Fitness" of a memory item.
|
|
64
|
-
* Score = (Confidence * 0.4) + (SignalToNoise * 0.4) + (SourceMultiplier * 0.2)
|
|
65
|
-
*/
|
|
66
|
-
calculateFitness(item: KnowledgeItem): number;
|
|
67
|
-
/**
|
|
68
|
-
* Challenge existing knowledge with new evidence.
|
|
69
|
-
* If confidence of new fact is high and contradicts existing ones (same entity, different fact),
|
|
70
|
-
* we degrade the confidence of the old facts.
|
|
71
|
-
*/
|
|
72
|
-
challengeKnowledge(entity: string, competingFact: string, confidence: number, trxOrDb?: any): Promise<void>;
|
|
73
|
-
/**
|
|
74
|
-
* Automatic Semantic Linking
|
|
75
|
-
* Scans for entity mentions in facts and creates links.
|
|
76
|
-
* Production Hardening: Uses batched cross-similarity and NER-style tokenization.
|
|
77
|
-
*/
|
|
78
|
-
private autoLinkKnowledge;
|
|
79
63
|
/**
|
|
80
64
|
* Link two knowledge items together with a relationship.
|
|
81
|
-
* Transaction-aware version.
|
|
82
65
|
*/
|
|
83
66
|
linkKnowledge(sourceId: number | string, targetId: number | string, relationship: string, metadata?: Record<string, any>, trxOrDb?: any): Promise<void>;
|
|
84
67
|
/**
|
|
@@ -97,10 +80,13 @@ export declare class KnowledgeDistiller {
|
|
|
97
80
|
pruneLowConfidence(threshold?: number): Promise<number>;
|
|
98
81
|
/**
|
|
99
82
|
* Consolidate knowledge by merging similar facts for the same entity.
|
|
100
|
-
* Production Hardening: Iterative bucketed approach to avoid recursive stack issues.
|
|
101
83
|
*/
|
|
102
84
|
consolidateKnowledge(): Promise<number>;
|
|
103
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Calculate the "Fitness" of a knowledge item.
|
|
87
|
+
* Score = (Confidence * 0.4) + (SignalToNoise * 0.4) + (SourceMultiplier * 0.2)
|
|
88
|
+
*/
|
|
89
|
+
calculateFitness(item: KnowledgeItem): number;
|
|
104
90
|
private bloomHash;
|
|
105
91
|
private parseKnowledge;
|
|
106
92
|
}
|