@claude-flow/plugin-cognitive-kernel 3.0.0-alpha.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/README.md +315 -0
- package/dist/bridges/cognitive-bridge.d.ts +137 -0
- package/dist/bridges/cognitive-bridge.d.ts.map +1 -0
- package/dist/bridges/cognitive-bridge.js +355 -0
- package/dist/bridges/cognitive-bridge.js.map +1 -0
- package/dist/bridges/index.d.ts +8 -0
- package/dist/bridges/index.d.ts.map +1 -0
- package/dist/bridges/index.js +8 -0
- package/dist/bridges/index.js.map +1 -0
- package/dist/bridges/sona-bridge.d.ts +162 -0
- package/dist/bridges/sona-bridge.d.ts.map +1 -0
- package/dist/bridges/sona-bridge.js +358 -0
- package/dist/bridges/sona-bridge.js.map +1 -0
- package/dist/index.d.ts +77 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +128 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-tools.d.ts +22 -0
- package/dist/mcp-tools.d.ts.map +1 -0
- package/dist/mcp-tools.js +945 -0
- package/dist/mcp-tools.js.map +1 -0
- package/dist/types.d.ts +561 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +230 -0
- package/dist/types.js.map +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cognitive Bridge
|
|
3
|
+
*
|
|
4
|
+
* Bridge to cognitum-gate-kernel for cognitive computation including
|
|
5
|
+
* working memory, attention control, meta-cognition, and scaffolding.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Default configuration
|
|
9
|
+
*/
|
|
10
|
+
const DEFAULT_CONFIG = {
|
|
11
|
+
workingMemorySize: 7,
|
|
12
|
+
attentionSpan: 10,
|
|
13
|
+
metaCognitionEnabled: true,
|
|
14
|
+
scaffoldingLevel: 'light',
|
|
15
|
+
decayRate: 0.1,
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Cognitive Bridge implementation
|
|
19
|
+
*/
|
|
20
|
+
export class CognitiveBridge {
|
|
21
|
+
name = 'cognitum-gate-kernel';
|
|
22
|
+
version = '0.1.0';
|
|
23
|
+
_status = 'unloaded';
|
|
24
|
+
_module = null;
|
|
25
|
+
config;
|
|
26
|
+
constructor(config) {
|
|
27
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
28
|
+
}
|
|
29
|
+
get status() {
|
|
30
|
+
return this._status;
|
|
31
|
+
}
|
|
32
|
+
get initialized() {
|
|
33
|
+
return this._status === 'ready';
|
|
34
|
+
}
|
|
35
|
+
async init() {
|
|
36
|
+
if (this._status === 'ready')
|
|
37
|
+
return;
|
|
38
|
+
if (this._status === 'loading')
|
|
39
|
+
return;
|
|
40
|
+
this._status = 'loading';
|
|
41
|
+
try {
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
+
const wasmModule = await import('@ruvector/cognitum-gate-kernel').catch(() => null);
|
|
44
|
+
if (wasmModule) {
|
|
45
|
+
this._module = wasmModule;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this._module = this.createMockModule();
|
|
49
|
+
}
|
|
50
|
+
this._status = 'ready';
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
this._status = 'error';
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async destroy() {
|
|
58
|
+
this._module = null;
|
|
59
|
+
this._status = 'unloaded';
|
|
60
|
+
}
|
|
61
|
+
isReady() {
|
|
62
|
+
return this._status === 'ready';
|
|
63
|
+
}
|
|
64
|
+
getModule() {
|
|
65
|
+
return this._module;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Store item in working memory
|
|
69
|
+
*/
|
|
70
|
+
store(item) {
|
|
71
|
+
if (!this._module)
|
|
72
|
+
throw new Error('Cognitive module not initialized');
|
|
73
|
+
return this._module.store(item);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Retrieve item from working memory
|
|
77
|
+
*/
|
|
78
|
+
retrieve(id) {
|
|
79
|
+
if (!this._module)
|
|
80
|
+
throw new Error('Cognitive module not initialized');
|
|
81
|
+
return this._module.retrieve(id);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Search working memory
|
|
85
|
+
*/
|
|
86
|
+
search(query, k) {
|
|
87
|
+
if (!this._module)
|
|
88
|
+
throw new Error('Cognitive module not initialized');
|
|
89
|
+
return this._module.search(query, k);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Apply memory decay
|
|
93
|
+
*/
|
|
94
|
+
decay(deltaTime) {
|
|
95
|
+
if (!this._module)
|
|
96
|
+
throw new Error('Cognitive module not initialized');
|
|
97
|
+
this._module.decay(deltaTime);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Consolidate working memory to long-term
|
|
101
|
+
*/
|
|
102
|
+
consolidate() {
|
|
103
|
+
if (!this._module)
|
|
104
|
+
throw new Error('Cognitive module not initialized');
|
|
105
|
+
this._module.consolidate();
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Focus attention on specific items
|
|
109
|
+
*/
|
|
110
|
+
focus(ids) {
|
|
111
|
+
if (!this._module)
|
|
112
|
+
throw new Error('Cognitive module not initialized');
|
|
113
|
+
return this._module.focus(ids);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Broaden attention
|
|
117
|
+
*/
|
|
118
|
+
broaden() {
|
|
119
|
+
if (!this._module)
|
|
120
|
+
throw new Error('Cognitive module not initialized');
|
|
121
|
+
return this._module.broaden();
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Narrow attention
|
|
125
|
+
*/
|
|
126
|
+
narrow() {
|
|
127
|
+
if (!this._module)
|
|
128
|
+
throw new Error('Cognitive module not initialized');
|
|
129
|
+
return this._module.narrow();
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Get current attention state
|
|
133
|
+
*/
|
|
134
|
+
getAttentionState() {
|
|
135
|
+
if (!this._module)
|
|
136
|
+
throw new Error('Cognitive module not initialized');
|
|
137
|
+
return this._module.getAttentionState();
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Perform meta-cognitive assessment
|
|
141
|
+
*/
|
|
142
|
+
assess() {
|
|
143
|
+
if (!this._module)
|
|
144
|
+
throw new Error('Cognitive module not initialized');
|
|
145
|
+
return this._module.assess();
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Monitor task performance
|
|
149
|
+
*/
|
|
150
|
+
monitor(task) {
|
|
151
|
+
if (!this._module)
|
|
152
|
+
throw new Error('Cognitive module not initialized');
|
|
153
|
+
return this._module.monitor(task);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Apply cognitive regulation strategy
|
|
157
|
+
*/
|
|
158
|
+
regulate(strategy) {
|
|
159
|
+
if (!this._module)
|
|
160
|
+
throw new Error('Cognitive module not initialized');
|
|
161
|
+
this._module.regulate(strategy);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Get scaffolding for task
|
|
165
|
+
*/
|
|
166
|
+
scaffold(task, difficulty) {
|
|
167
|
+
if (!this._module)
|
|
168
|
+
throw new Error('Cognitive module not initialized');
|
|
169
|
+
return this._module.scaffold(task, difficulty);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Adapt scaffolding based on performance
|
|
173
|
+
*/
|
|
174
|
+
adapt(performance) {
|
|
175
|
+
if (!this._module)
|
|
176
|
+
throw new Error('Cognitive module not initialized');
|
|
177
|
+
this._module.adapt(performance);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Create mock module for development
|
|
181
|
+
*/
|
|
182
|
+
createMockModule() {
|
|
183
|
+
const workingMemory = new Map();
|
|
184
|
+
let attentionState = {
|
|
185
|
+
focus: [],
|
|
186
|
+
breadth: 0.5,
|
|
187
|
+
intensity: 0.7,
|
|
188
|
+
distractors: [],
|
|
189
|
+
};
|
|
190
|
+
let scaffoldingMultiplier = 1.0;
|
|
191
|
+
const self = this;
|
|
192
|
+
return {
|
|
193
|
+
store(item) {
|
|
194
|
+
if (workingMemory.size >= self.config.workingMemorySize) {
|
|
195
|
+
// Remove lowest salience item (Miller's law)
|
|
196
|
+
let lowestId = '';
|
|
197
|
+
let lowestSalience = Infinity;
|
|
198
|
+
for (const [id, stored] of workingMemory) {
|
|
199
|
+
if (stored.salience < lowestSalience) {
|
|
200
|
+
lowestSalience = stored.salience;
|
|
201
|
+
lowestId = id;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (lowestId)
|
|
205
|
+
workingMemory.delete(lowestId);
|
|
206
|
+
}
|
|
207
|
+
workingMemory.set(item.id, item);
|
|
208
|
+
return true;
|
|
209
|
+
},
|
|
210
|
+
retrieve(id) {
|
|
211
|
+
const item = workingMemory.get(id);
|
|
212
|
+
if (item) {
|
|
213
|
+
// Boost salience on retrieval
|
|
214
|
+
item.salience = Math.min(1, item.salience + 0.1);
|
|
215
|
+
}
|
|
216
|
+
return item ?? null;
|
|
217
|
+
},
|
|
218
|
+
search(query, k) {
|
|
219
|
+
const results = [];
|
|
220
|
+
for (const item of workingMemory.values()) {
|
|
221
|
+
let score = 0;
|
|
222
|
+
for (let i = 0; i < Math.min(query.length, item.content.length); i++) {
|
|
223
|
+
score += (query[i] ?? 0) * (item.content[i] ?? 0);
|
|
224
|
+
}
|
|
225
|
+
results.push({ item, score: score * item.salience });
|
|
226
|
+
}
|
|
227
|
+
results.sort((a, b) => b.score - a.score);
|
|
228
|
+
return results.slice(0, k).map(r => r.item);
|
|
229
|
+
},
|
|
230
|
+
decay(deltaTime) {
|
|
231
|
+
const decayRate = self.config.decayRate * deltaTime;
|
|
232
|
+
for (const [id, item] of workingMemory) {
|
|
233
|
+
item.salience *= 1 - decayRate * item.decay;
|
|
234
|
+
if (item.salience < 0.1) {
|
|
235
|
+
workingMemory.delete(id);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
consolidate() {
|
|
240
|
+
for (const item of workingMemory.values()) {
|
|
241
|
+
if (item.salience > 0.8) {
|
|
242
|
+
item.metadata = { ...item.metadata, consolidated: true };
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
focus(ids) {
|
|
247
|
+
attentionState = {
|
|
248
|
+
focus: ids,
|
|
249
|
+
breadth: 1 / Math.max(1, ids.length),
|
|
250
|
+
intensity: Math.min(1, 0.5 + ids.length * 0.1),
|
|
251
|
+
distractors: [],
|
|
252
|
+
};
|
|
253
|
+
return attentionState;
|
|
254
|
+
},
|
|
255
|
+
broaden() {
|
|
256
|
+
attentionState.breadth = Math.min(1, attentionState.breadth + 0.2);
|
|
257
|
+
attentionState.intensity = Math.max(0.3, attentionState.intensity - 0.1);
|
|
258
|
+
return attentionState;
|
|
259
|
+
},
|
|
260
|
+
narrow() {
|
|
261
|
+
attentionState.breadth = Math.max(0.1, attentionState.breadth - 0.2);
|
|
262
|
+
attentionState.intensity = Math.min(1, attentionState.intensity + 0.1);
|
|
263
|
+
return attentionState;
|
|
264
|
+
},
|
|
265
|
+
getAttentionState() {
|
|
266
|
+
return { ...attentionState };
|
|
267
|
+
},
|
|
268
|
+
assess() {
|
|
269
|
+
const itemCount = workingMemory.size;
|
|
270
|
+
const avgSalience = Array.from(workingMemory.values())
|
|
271
|
+
.reduce((s, i) => s + i.salience, 0) / Math.max(1, itemCount);
|
|
272
|
+
const cognitiveLoad = itemCount / self.config.workingMemorySize;
|
|
273
|
+
const knowledgeGaps = [];
|
|
274
|
+
const suggestedStrategies = [];
|
|
275
|
+
if (cognitiveLoad > 0.8) {
|
|
276
|
+
suggestedStrategies.push('consolidate');
|
|
277
|
+
suggestedStrategies.push('chunk information');
|
|
278
|
+
}
|
|
279
|
+
else if (cognitiveLoad < 0.3) {
|
|
280
|
+
suggestedStrategies.push('explore new information');
|
|
281
|
+
}
|
|
282
|
+
if (avgSalience < 0.5) {
|
|
283
|
+
suggestedStrategies.push('refresh memory');
|
|
284
|
+
suggestedStrategies.push('increase rehearsal');
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
confidence: avgSalience,
|
|
288
|
+
uncertainty: 1 - avgSalience,
|
|
289
|
+
coherence: avgSalience * 0.9 + 0.1,
|
|
290
|
+
cognitiveLoad,
|
|
291
|
+
errorsDetected: 0,
|
|
292
|
+
knowledgeGaps,
|
|
293
|
+
suggestedStrategies,
|
|
294
|
+
};
|
|
295
|
+
},
|
|
296
|
+
monitor(task) {
|
|
297
|
+
// Return simulated performance score
|
|
298
|
+
return 0.7 + Math.random() * 0.2;
|
|
299
|
+
},
|
|
300
|
+
regulate(strategy) {
|
|
301
|
+
if (strategy === 'consolidate') {
|
|
302
|
+
this.consolidate();
|
|
303
|
+
}
|
|
304
|
+
else if (strategy === 'focus') {
|
|
305
|
+
this.narrow();
|
|
306
|
+
}
|
|
307
|
+
else if (strategy === 'broaden') {
|
|
308
|
+
this.broaden();
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
scaffold(task, difficulty) {
|
|
312
|
+
const steps = [];
|
|
313
|
+
const numSteps = Math.ceil(difficulty * 5 * scaffoldingMultiplier);
|
|
314
|
+
const scaffoldLevels = {
|
|
315
|
+
none: 0,
|
|
316
|
+
light: 0.5,
|
|
317
|
+
moderate: 1,
|
|
318
|
+
heavy: 1.5,
|
|
319
|
+
};
|
|
320
|
+
const level = scaffoldLevels[self.config.scaffoldingLevel] ?? 1;
|
|
321
|
+
for (let i = 1; i <= numSteps; i++) {
|
|
322
|
+
if (level >= 0.5) {
|
|
323
|
+
steps.push(`Step ${i}: Analyze the sub-problem of "${task}"`);
|
|
324
|
+
}
|
|
325
|
+
if (level >= 1) {
|
|
326
|
+
steps.push(`Step ${i}.1: Consider alternative approaches`);
|
|
327
|
+
}
|
|
328
|
+
if (level >= 1.5) {
|
|
329
|
+
steps.push(`Step ${i}.2: Validate assumptions`);
|
|
330
|
+
steps.push(`Step ${i}.3: Check for edge cases`);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return steps.slice(0, Math.max(2, numSteps * (level + 0.5)));
|
|
334
|
+
},
|
|
335
|
+
adapt(performance) {
|
|
336
|
+
if (performance < 0.5) {
|
|
337
|
+
// Increase scaffolding
|
|
338
|
+
scaffoldingMultiplier = Math.min(2, scaffoldingMultiplier + 0.2);
|
|
339
|
+
}
|
|
340
|
+
else if (performance > 0.8) {
|
|
341
|
+
// Fade scaffolding
|
|
342
|
+
scaffoldingMultiplier = Math.max(0.5, scaffoldingMultiplier - 0.1);
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Create a new cognitive bridge
|
|
350
|
+
*/
|
|
351
|
+
export function createCognitiveBridge(config) {
|
|
352
|
+
return new CognitiveBridge(config);
|
|
353
|
+
}
|
|
354
|
+
export default CognitiveBridge;
|
|
355
|
+
//# sourceMappingURL=cognitive-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cognitive-bridge.js","sourceRoot":"","sources":["../../src/bridges/cognitive-bridge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyBH;;GAEG;AACH,MAAM,cAAc,GAAoB;IACtC,iBAAiB,EAAE,CAAC;IACpB,aAAa,EAAE,EAAE;IACjB,oBAAoB,EAAE,IAAI;IAC1B,gBAAgB,EAAE,OAAO;IACzB,SAAS,EAAE,GAAG;CACf,CAAC;AAuCF;;GAEG;AACH,MAAM,OAAO,eAAe;IACjB,IAAI,GAAG,sBAAsB,CAAC;IAC9B,OAAO,GAAG,OAAO,CAAC;IAEnB,OAAO,GAAqB,UAAU,CAAC;IACvC,OAAO,GAA2B,IAAI,CAAC;IACvC,MAAM,CAAkB;IAEhC,YAAY,MAAiC;QAC3C,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,cAAc,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;oBACD,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;wBACjB,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC;wBAChD,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC;oBAClD,CAAC;gBACH,CAAC;gBAED,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;YAC/D,CAAC;YAED,KAAK,CAAC,WAAmB;gBACvB,IAAI,WAAW,GAAG,GAAG,EAAE,CAAC;oBACtB,uBAAuB;oBACvB,qBAAqB,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,qBAAqB,GAAG,GAAG,CAAC,CAAC;gBACnE,CAAC;qBAAM,IAAI,WAAW,GAAG,GAAG,EAAE,CAAC;oBAC7B,mBAAmB;oBACnB,qBAAqB,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,qBAAqB,GAAG,GAAG,CAAC,CAAC;gBACrE,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAiC;IACrE,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cognitive Kernel Bridges Index
|
|
3
|
+
*
|
|
4
|
+
* Exports all WASM bridges for cognitive augmentation.
|
|
5
|
+
*/
|
|
6
|
+
export { CognitiveBridge, createCognitiveBridge, type WasmModuleStatus, type CognitiveConfig, type AttentionState, } from './cognitive-bridge.js';
|
|
7
|
+
export { SonaBridge, createSonaBridge, type SonaConfig, type SonaTrajectory, type SonaStep, type LoRAWeights, type EWCState, type SonaPrediction, } from './sona-bridge.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bridges/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,cAAc,GACpB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cognitive Kernel Bridges Index
|
|
3
|
+
*
|
|
4
|
+
* Exports all WASM bridges for cognitive augmentation.
|
|
5
|
+
*/
|
|
6
|
+
export { CognitiveBridge, createCognitiveBridge, } from './cognitive-bridge.js';
|
|
7
|
+
export { SonaBridge, createSonaBridge, } from './sona-bridge.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bridges/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,qBAAqB,GAItB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,UAAU,EACV,gBAAgB,GAOjB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SONA Bridge
|
|
3
|
+
*
|
|
4
|
+
* Bridge to SONA (Self-Optimizing Neural Architecture) for continuous
|
|
5
|
+
* learning with LoRA fine-tuning and EWC++ memory preservation.
|
|
6
|
+
*/
|
|
7
|
+
import type { SonaPattern } from '../types.js';
|
|
8
|
+
/**
|
|
9
|
+
* WASM module status
|
|
10
|
+
*/
|
|
11
|
+
export type WasmModuleStatus = 'unloaded' | 'loading' | 'ready' | 'error';
|
|
12
|
+
/**
|
|
13
|
+
* SONA configuration
|
|
14
|
+
*/
|
|
15
|
+
export interface SonaConfig {
|
|
16
|
+
/** Operating mode */
|
|
17
|
+
mode: 'real-time' | 'balanced' | 'research' | 'edge' | 'batch';
|
|
18
|
+
/** LoRA rank for fine-tuning */
|
|
19
|
+
loraRank: number;
|
|
20
|
+
/** Learning rate */
|
|
21
|
+
learningRate: number;
|
|
22
|
+
/** EWC++ lambda (memory preservation strength) */
|
|
23
|
+
ewcLambda: number;
|
|
24
|
+
/** Batch size for training */
|
|
25
|
+
batchSize: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* SONA trajectory for learning
|
|
29
|
+
*/
|
|
30
|
+
export interface SonaTrajectory {
|
|
31
|
+
id: string;
|
|
32
|
+
domain: string;
|
|
33
|
+
steps: SonaStep[];
|
|
34
|
+
qualityScore: number;
|
|
35
|
+
metadata?: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* SONA learning step
|
|
39
|
+
*/
|
|
40
|
+
export interface SonaStep {
|
|
41
|
+
stateBefore: Float32Array;
|
|
42
|
+
action: string;
|
|
43
|
+
stateAfter: Float32Array;
|
|
44
|
+
reward: number;
|
|
45
|
+
timestamp: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* LoRA weights
|
|
49
|
+
*/
|
|
50
|
+
export interface LoRAWeights {
|
|
51
|
+
A: Map<string, Float32Array>;
|
|
52
|
+
B: Map<string, Float32Array>;
|
|
53
|
+
rank: number;
|
|
54
|
+
alpha: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* EWC state
|
|
58
|
+
*/
|
|
59
|
+
export interface EWCState {
|
|
60
|
+
fisher: Map<string, Float32Array>;
|
|
61
|
+
means: Map<string, Float32Array>;
|
|
62
|
+
lambda: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* SONA prediction result
|
|
66
|
+
*/
|
|
67
|
+
export interface SonaPrediction {
|
|
68
|
+
action: string;
|
|
69
|
+
confidence: number;
|
|
70
|
+
alternativeActions?: Array<{
|
|
71
|
+
action: string;
|
|
72
|
+
confidence: number;
|
|
73
|
+
}>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* SONA WASM module interface
|
|
77
|
+
*/
|
|
78
|
+
interface SonaModule {
|
|
79
|
+
learn(trajectories: SonaTrajectory[], config: SonaConfig): number;
|
|
80
|
+
predict(state: Float32Array): SonaPrediction;
|
|
81
|
+
storePattern(pattern: SonaPattern): void;
|
|
82
|
+
findPatterns(query: Float32Array, k: number): SonaPattern[];
|
|
83
|
+
updatePatternSuccess(patternId: string, success: boolean): void;
|
|
84
|
+
applyLoRA(input: Float32Array, weights: LoRAWeights): Float32Array;
|
|
85
|
+
updateLoRA(gradients: Float32Array, config: SonaConfig): LoRAWeights;
|
|
86
|
+
computeFisher(trajectories: SonaTrajectory[]): Map<string, Float32Array>;
|
|
87
|
+
consolidate(ewcState: EWCState): void;
|
|
88
|
+
setMode(mode: SonaConfig['mode']): void;
|
|
89
|
+
getMode(): SonaConfig['mode'];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* SONA Bridge implementation
|
|
93
|
+
*/
|
|
94
|
+
export declare class SonaBridge {
|
|
95
|
+
readonly name = "sona";
|
|
96
|
+
readonly version = "0.1.0";
|
|
97
|
+
private _status;
|
|
98
|
+
private _module;
|
|
99
|
+
private config;
|
|
100
|
+
constructor(config?: Partial<SonaConfig>);
|
|
101
|
+
get status(): WasmModuleStatus;
|
|
102
|
+
get initialized(): boolean;
|
|
103
|
+
init(): Promise<void>;
|
|
104
|
+
destroy(): Promise<void>;
|
|
105
|
+
isReady(): boolean;
|
|
106
|
+
getModule(): SonaModule | null;
|
|
107
|
+
/**
|
|
108
|
+
* Learn from trajectories
|
|
109
|
+
* Returns improvement score (0-1)
|
|
110
|
+
*/
|
|
111
|
+
learn(trajectories: SonaTrajectory[], config?: Partial<SonaConfig>): number;
|
|
112
|
+
/**
|
|
113
|
+
* Predict next action
|
|
114
|
+
*/
|
|
115
|
+
predict(state: Float32Array): SonaPrediction;
|
|
116
|
+
/**
|
|
117
|
+
* Store a pattern
|
|
118
|
+
*/
|
|
119
|
+
storePattern(pattern: SonaPattern): void;
|
|
120
|
+
/**
|
|
121
|
+
* Find similar patterns
|
|
122
|
+
*/
|
|
123
|
+
findPatterns(query: Float32Array, k: number): SonaPattern[];
|
|
124
|
+
/**
|
|
125
|
+
* Update pattern success rate
|
|
126
|
+
*/
|
|
127
|
+
updatePatternSuccess(patternId: string, success: boolean): void;
|
|
128
|
+
/**
|
|
129
|
+
* Apply LoRA transformation
|
|
130
|
+
*/
|
|
131
|
+
applyLoRA(input: Float32Array, weights: LoRAWeights): Float32Array;
|
|
132
|
+
/**
|
|
133
|
+
* Update LoRA weights from gradients
|
|
134
|
+
*/
|
|
135
|
+
updateLoRA(gradients: Float32Array, config?: Partial<SonaConfig>): LoRAWeights;
|
|
136
|
+
/**
|
|
137
|
+
* Compute Fisher information matrix
|
|
138
|
+
*/
|
|
139
|
+
computeFisher(trajectories: SonaTrajectory[]): Map<string, Float32Array>;
|
|
140
|
+
/**
|
|
141
|
+
* Consolidate memory with EWC++
|
|
142
|
+
*/
|
|
143
|
+
consolidate(ewcState: EWCState): void;
|
|
144
|
+
/**
|
|
145
|
+
* Set operating mode
|
|
146
|
+
*/
|
|
147
|
+
setMode(mode: SonaConfig['mode']): void;
|
|
148
|
+
/**
|
|
149
|
+
* Get current mode
|
|
150
|
+
*/
|
|
151
|
+
getMode(): SonaConfig['mode'];
|
|
152
|
+
/**
|
|
153
|
+
* Create mock module for development
|
|
154
|
+
*/
|
|
155
|
+
private createMockModule;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Create a new SONA bridge
|
|
159
|
+
*/
|
|
160
|
+
export declare function createSonaBridge(config?: Partial<SonaConfig>): SonaBridge;
|
|
161
|
+
export default SonaBridge;
|
|
162
|
+
//# sourceMappingURL=sona-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sona-bridge.d.ts","sourceRoot":"","sources":["../../src/bridges/sona-bridge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,qBAAqB;IACrB,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;IAC/D,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;AAaD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,YAAY,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,YAAY,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC7B,CAAC,EAAE,GAAG,CAAC,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