@soulcraft/brainy 3.20.2 → 3.20.3

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/bin/brainy-interactive.js +2 -2
  3. package/dist/brainy.d.ts +1 -1
  4. package/dist/mcp/brainyMCPAdapter.d.ts +1 -1
  5. package/dist/mcp/brainyMCPService.d.ts +1 -1
  6. package/dist/neural/embeddedPatterns.d.ts +1 -1
  7. package/dist/neural/embeddedPatterns.js +1 -1
  8. package/dist/shared/default-augmentations.d.ts +1 -1
  9. package/dist/types/{brainyDataInterface.js → brainyInterface.js} +1 -1
  10. package/package.json +1 -1
  11. package/dist/augmentationFactory.d.ts +0 -86
  12. package/dist/augmentationFactory.js +0 -342
  13. package/dist/augmentationRegistry.d.ts +0 -38
  14. package/dist/augmentationRegistry.js +0 -54
  15. package/dist/augmentationRegistryLoader.d.ts +0 -146
  16. package/dist/augmentationRegistryLoader.js +0 -213
  17. package/dist/augmentations/KnowledgeAugmentation.d.ts +0 -40
  18. package/dist/augmentations/KnowledgeAugmentation.js +0 -251
  19. package/dist/augmentations/intelligentVerbScoring.d.ts +0 -158
  20. package/dist/augmentations/intelligentVerbScoring.js +0 -377
  21. package/dist/augmentations/marketplace/AugmentationMarketplace.d.ts +0 -168
  22. package/dist/augmentations/marketplace/AugmentationMarketplace.js +0 -329
  23. package/dist/augmentations/marketplace/cli.d.ts +0 -47
  24. package/dist/augmentations/marketplace/cli.js +0 -265
  25. package/dist/augmentations/memoryAugmentations.d.ts +0 -72
  26. package/dist/augmentations/memoryAugmentations.js +0 -280
  27. package/dist/augmentations/serverSearchAugmentations.d.ts +0 -190
  28. package/dist/augmentations/serverSearchAugmentations.js +0 -586
  29. package/dist/brainy-unified.d.ts +0 -106
  30. package/dist/brainy-unified.js +0 -327
  31. package/dist/brainyData.d.ts +0 -1832
  32. package/dist/brainyData.js +0 -6443
  33. package/dist/brainyDataV3.d.ts +0 -186
  34. package/dist/brainyDataV3.js +0 -337
  35. package/dist/config/distributedPresets-new.d.ts +0 -118
  36. package/dist/config/distributedPresets-new.js +0 -318
  37. package/dist/config/modelPrecisionManager.d.ts +0 -42
  38. package/dist/config/modelPrecisionManager.js +0 -98
  39. package/dist/connectors/interfaces/IConnector.d.ts +0 -143
  40. package/dist/connectors/interfaces/IConnector.js +0 -8
  41. package/dist/demo.d.ts +0 -106
  42. package/dist/demo.js +0 -201
  43. package/dist/embeddings/SingletonModelManager.d.ts +0 -95
  44. package/dist/embeddings/SingletonModelManager.js +0 -220
  45. package/dist/embeddings/lightweight-embedder.d.ts +0 -22
  46. package/dist/embeddings/lightweight-embedder.js +0 -128
  47. package/dist/embeddings/model-manager.d.ts +0 -39
  48. package/dist/embeddings/model-manager.js +0 -245
  49. package/dist/embeddings/universal-memory-manager.d.ts +0 -38
  50. package/dist/embeddings/universal-memory-manager.js +0 -166
  51. package/dist/embeddings/worker-embedding.d.ts +0 -7
  52. package/dist/embeddings/worker-embedding.js +0 -73
  53. package/dist/embeddings/worker-manager.d.ts +0 -28
  54. package/dist/embeddings/worker-manager.js +0 -162
  55. package/dist/examples/basicUsage.d.ts +0 -4
  56. package/dist/examples/basicUsage.js +0 -121
  57. package/dist/indices/fieldIndex.d.ts +0 -76
  58. package/dist/indices/fieldIndex.js +0 -357
  59. package/dist/mcp/brainyMCPBroadcast.d.ts +0 -82
  60. package/dist/mcp/brainyMCPBroadcast.js +0 -303
  61. package/dist/mcp/brainyMCPClient.d.ts +0 -92
  62. package/dist/mcp/brainyMCPClient.js +0 -258
  63. package/dist/scripts/precomputePatternEmbeddings.d.ts +0 -19
  64. package/dist/scripts/precomputePatternEmbeddings.js +0 -100
  65. package/dist/utils/cacheAutoConfig.d.ts +0 -63
  66. package/dist/utils/cacheAutoConfig.js +0 -261
  67. package/dist/utils/hybridModelManager.d.ts +0 -64
  68. package/dist/utils/hybridModelManager.js +0 -95
  69. package/dist/utils/statistics.d.ts +0 -28
  70. package/dist/utils/statistics.js +0 -25
  71. package/dist/vfs/ConceptSystem.d.ts +0 -203
  72. package/dist/vfs/ConceptSystem.js +0 -545
  73. package/dist/vfs/EntityManager.d.ts +0 -75
  74. package/dist/vfs/EntityManager.js +0 -216
  75. package/dist/vfs/EventRecorder.d.ts +0 -84
  76. package/dist/vfs/EventRecorder.js +0 -269
  77. package/dist/vfs/GitBridge.d.ts +0 -167
  78. package/dist/vfs/GitBridge.js +0 -537
  79. package/dist/vfs/KnowledgeAugmentation.d.ts +0 -104
  80. package/dist/vfs/KnowledgeAugmentation.js +0 -146
  81. package/dist/vfs/KnowledgeLayer.d.ts +0 -35
  82. package/dist/vfs/KnowledgeLayer.js +0 -443
  83. package/dist/vfs/PersistentEntitySystem.d.ts +0 -165
  84. package/dist/vfs/PersistentEntitySystem.js +0 -503
  85. package/dist/vfs/SemanticVersioning.d.ts +0 -105
  86. package/dist/vfs/SemanticVersioning.js +0 -309
  87. package/dist/vfs/VFSHealthCheck.d.ts +0 -78
  88. package/dist/vfs/VFSHealthCheck.js +0 -299
  89. /package/dist/types/{brainyDataInterface.d.ts → brainyInterface.d.ts} +0 -0
@@ -1,158 +0,0 @@
1
- import { ICognitionAugmentation, AugmentationResponse } from '../types/augmentations.js';
2
- /**
3
- * Configuration options for the Intelligent Verb Scoring augmentation
4
- */
5
- export interface IVerbScoringConfig {
6
- /** Enable semantic proximity scoring based on entity embeddings */
7
- enableSemanticScoring: boolean;
8
- /** Enable frequency-based weight amplification */
9
- enableFrequencyAmplification: boolean;
10
- /** Enable temporal decay for weights */
11
- enableTemporalDecay: boolean;
12
- /** Decay rate per day for temporal scoring (0-1) */
13
- temporalDecayRate: number;
14
- /** Minimum weight threshold */
15
- minWeight: number;
16
- /** Maximum weight threshold */
17
- maxWeight: number;
18
- /** Base confidence score for new relationships */
19
- baseConfidence: number;
20
- /** Learning rate for adaptive scoring (0-1) */
21
- learningRate: number;
22
- }
23
- /**
24
- * Default configuration for the Intelligent Verb Scoring augmentation
25
- */
26
- export declare const DEFAULT_VERB_SCORING_CONFIG: IVerbScoringConfig;
27
- /**
28
- * Relationship statistics for learning and adaptation
29
- */
30
- interface RelationshipStats {
31
- count: number;
32
- totalWeight: number;
33
- averageWeight: number;
34
- lastSeen: Date;
35
- firstSeen: Date;
36
- semanticSimilarity?: number;
37
- }
38
- /**
39
- * Intelligent Verb Scoring Cognition Augmentation
40
- *
41
- * Automatically generates intelligent weight and confidence scores for verb relationships
42
- * using semantic analysis, frequency patterns, and temporal factors.
43
- */
44
- export declare class IntelligentVerbScoring implements ICognitionAugmentation {
45
- readonly name = "intelligent-verb-scoring";
46
- readonly description = "Automatically generates intelligent weight and confidence scores for verb relationships";
47
- enabled: boolean;
48
- private config;
49
- private relationshipStats;
50
- private brainyInstance;
51
- private isInitialized;
52
- constructor(config?: Partial<IVerbScoringConfig>);
53
- initialize(): Promise<void>;
54
- shutDown(): Promise<void>;
55
- getStatus(): Promise<'active' | 'inactive' | 'error'>;
56
- /**
57
- * Set reference to the BrainyData instance for accessing graph data
58
- */
59
- setBrainyInstance(instance: any): void;
60
- /**
61
- * Main reasoning method for generating intelligent verb scores
62
- */
63
- reason(query: string, context?: Record<string, unknown>): AugmentationResponse<{
64
- inference: string;
65
- confidence: number;
66
- }>;
67
- infer(dataSubset: Record<string, unknown>): AugmentationResponse<Record<string, unknown>>;
68
- executeLogic(ruleId: string, input: Record<string, unknown>): AugmentationResponse<boolean>;
69
- /**
70
- * Generate intelligent weight and confidence scores for a verb relationship
71
- *
72
- * @param sourceId - ID of the source entity
73
- * @param targetId - ID of the target entity
74
- * @param verbType - Type of the relationship
75
- * @param existingWeight - Existing weight if any
76
- * @param metadata - Additional metadata about the relationship
77
- * @returns Computed weight and confidence scores
78
- */
79
- computeVerbScores(sourceId: string, targetId: string, verbType: string, existingWeight?: number, metadata?: any): Promise<{
80
- weight: number;
81
- confidence: number;
82
- reasoning: string[];
83
- }>;
84
- /**
85
- * Calculate semantic similarity between two entities using their embeddings
86
- */
87
- private calculateSemanticScore;
88
- /**
89
- * Calculate frequency-based boost for repeated relationships
90
- */
91
- private calculateFrequencyBoost;
92
- /**
93
- * Calculate temporal decay factor based on recency
94
- */
95
- private calculateTemporalFactor;
96
- /**
97
- * Calculate learning-based adjustment using historical patterns
98
- */
99
- private calculateLearningAdjustment;
100
- /**
101
- * Update relationship statistics for learning
102
- */
103
- private updateRelationshipStats;
104
- /**
105
- * Blend two scores using a weighted average
106
- */
107
- private blendScores;
108
- /**
109
- * Get current configuration
110
- */
111
- getConfig(): IVerbScoringConfig;
112
- /**
113
- * Update configuration
114
- */
115
- updateConfig(newConfig: Partial<IVerbScoringConfig>): void;
116
- /**
117
- * Get relationship statistics (for debugging/monitoring)
118
- */
119
- getRelationshipStats(): Map<string, RelationshipStats>;
120
- /**
121
- * Clear relationship statistics
122
- */
123
- clearStats(): void;
124
- /**
125
- * Provide feedback to improve future scoring
126
- * This allows the system to learn from user corrections or validation
127
- *
128
- * @param sourceId - Source entity ID
129
- * @param targetId - Target entity ID
130
- * @param verbType - Relationship type
131
- * @param feedbackWeight - The corrected/validated weight (0-1)
132
- * @param feedbackConfidence - The corrected/validated confidence (0-1)
133
- * @param feedbackType - Type of feedback ('correction', 'validation', 'enhancement')
134
- */
135
- provideFeedback(sourceId: string, targetId: string, verbType: string, feedbackWeight: number, feedbackConfidence?: number, feedbackType?: 'correction' | 'validation' | 'enhancement'): Promise<void>;
136
- /**
137
- * Get learning statistics for monitoring and debugging
138
- */
139
- getLearningStats(): {
140
- totalRelationships: number;
141
- averageConfidence: number;
142
- feedbackCount: number;
143
- topRelationships: Array<{
144
- relationship: string;
145
- count: number;
146
- averageWeight: number;
147
- }>;
148
- };
149
- /**
150
- * Export learning data for backup or analysis
151
- */
152
- exportLearningData(): string;
153
- /**
154
- * Import learning data from backup
155
- */
156
- importLearningData(jsonData: string): void;
157
- }
158
- export {};
@@ -1,377 +0,0 @@
1
- import { cosineDistance } from '../utils/distance.js';
2
- /**
3
- * Default configuration for the Intelligent Verb Scoring augmentation
4
- */
5
- export const DEFAULT_VERB_SCORING_CONFIG = {
6
- enableSemanticScoring: true,
7
- enableFrequencyAmplification: true,
8
- enableTemporalDecay: true,
9
- temporalDecayRate: 0.01, // 1% decay per day
10
- minWeight: 0.1,
11
- maxWeight: 1.0,
12
- baseConfidence: 0.5,
13
- learningRate: 0.1
14
- };
15
- /**
16
- * Intelligent Verb Scoring Cognition Augmentation
17
- *
18
- * Automatically generates intelligent weight and confidence scores for verb relationships
19
- * using semantic analysis, frequency patterns, and temporal factors.
20
- */
21
- export class IntelligentVerbScoring {
22
- constructor(config = {}) {
23
- this.name = 'intelligent-verb-scoring';
24
- this.description = 'Automatically generates intelligent weight and confidence scores for verb relationships';
25
- this.enabled = false; // Off by default as requested
26
- this.relationshipStats = new Map();
27
- this.isInitialized = false;
28
- this.config = { ...DEFAULT_VERB_SCORING_CONFIG, ...config };
29
- }
30
- async initialize() {
31
- if (this.isInitialized)
32
- return;
33
- this.isInitialized = true;
34
- }
35
- async shutDown() {
36
- this.relationshipStats.clear();
37
- this.isInitialized = false;
38
- }
39
- async getStatus() {
40
- return this.enabled && this.isInitialized ? 'active' : 'inactive';
41
- }
42
- /**
43
- * Set reference to the BrainyData instance for accessing graph data
44
- */
45
- setBrainyInstance(instance) {
46
- this.brainyInstance = instance;
47
- }
48
- /**
49
- * Main reasoning method for generating intelligent verb scores
50
- */
51
- reason(query, context) {
52
- if (!this.enabled) {
53
- return {
54
- success: false,
55
- data: { inference: 'Augmentation is disabled', confidence: 0 },
56
- error: 'Intelligent verb scoring is disabled'
57
- };
58
- }
59
- return {
60
- success: true,
61
- data: {
62
- inference: 'Intelligent verb scoring active',
63
- confidence: 1.0
64
- }
65
- };
66
- }
67
- infer(dataSubset) {
68
- return {
69
- success: true,
70
- data: dataSubset
71
- };
72
- }
73
- executeLogic(ruleId, input) {
74
- return {
75
- success: true,
76
- data: true
77
- };
78
- }
79
- /**
80
- * Generate intelligent weight and confidence scores for a verb relationship
81
- *
82
- * @param sourceId - ID of the source entity
83
- * @param targetId - ID of the target entity
84
- * @param verbType - Type of the relationship
85
- * @param existingWeight - Existing weight if any
86
- * @param metadata - Additional metadata about the relationship
87
- * @returns Computed weight and confidence scores
88
- */
89
- async computeVerbScores(sourceId, targetId, verbType, existingWeight, metadata) {
90
- if (!this.enabled || !this.brainyInstance) {
91
- return {
92
- weight: existingWeight ?? 0.5,
93
- confidence: this.config.baseConfidence,
94
- reasoning: ['Intelligent scoring disabled']
95
- };
96
- }
97
- const reasoning = [];
98
- let weight = existingWeight ?? 0.5;
99
- let confidence = this.config.baseConfidence;
100
- try {
101
- // Get relationship key for statistics
102
- const relationKey = `${sourceId}-${verbType}-${targetId}`;
103
- // Update relationship statistics
104
- this.updateRelationshipStats(relationKey, weight, metadata);
105
- // Apply semantic scoring if enabled
106
- if (this.config.enableSemanticScoring) {
107
- const semanticScore = await this.calculateSemanticScore(sourceId, targetId);
108
- if (semanticScore !== null) {
109
- weight = this.blendScores(weight, semanticScore, 0.3);
110
- confidence = Math.min(confidence + semanticScore * 0.2, 1.0);
111
- reasoning.push(`Semantic similarity: ${semanticScore.toFixed(3)}`);
112
- }
113
- }
114
- // Apply frequency amplification if enabled
115
- if (this.config.enableFrequencyAmplification) {
116
- const frequencyBoost = this.calculateFrequencyBoost(relationKey);
117
- weight = this.blendScores(weight, frequencyBoost, 0.2);
118
- if (frequencyBoost > 0.5) {
119
- confidence = Math.min(confidence + 0.1, 1.0);
120
- reasoning.push(`Frequency boost: ${frequencyBoost.toFixed(3)}`);
121
- }
122
- }
123
- // Apply temporal decay if enabled
124
- if (this.config.enableTemporalDecay) {
125
- const temporalFactor = this.calculateTemporalFactor(relationKey);
126
- weight *= temporalFactor;
127
- reasoning.push(`Temporal factor: ${temporalFactor.toFixed(3)}`);
128
- }
129
- // Apply learning adjustments
130
- const learningAdjustment = this.calculateLearningAdjustment(relationKey);
131
- weight = this.blendScores(weight, learningAdjustment, this.config.learningRate);
132
- // Clamp values to configured bounds
133
- weight = Math.max(this.config.minWeight, Math.min(this.config.maxWeight, weight));
134
- confidence = Math.max(0, Math.min(1, confidence));
135
- reasoning.push(`Final weight: ${weight.toFixed(3)}, confidence: ${confidence.toFixed(3)}`);
136
- return { weight, confidence, reasoning };
137
- }
138
- catch (error) {
139
- console.warn('Error computing verb scores:', error);
140
- return {
141
- weight: existingWeight ?? 0.5,
142
- confidence: this.config.baseConfidence,
143
- reasoning: [`Error in scoring: ${error}`]
144
- };
145
- }
146
- }
147
- /**
148
- * Calculate semantic similarity between two entities using their embeddings
149
- */
150
- async calculateSemanticScore(sourceId, targetId) {
151
- try {
152
- if (!this.brainyInstance?.storage)
153
- return null;
154
- // Get noun embeddings from storage
155
- const sourceNoun = await this.brainyInstance.storage.getNoun(sourceId);
156
- const targetNoun = await this.brainyInstance.storage.getNoun(targetId);
157
- if (!sourceNoun?.vector || !targetNoun?.vector)
158
- return null;
159
- // Calculate cosine similarity (1 - distance)
160
- const distance = cosineDistance(sourceNoun.vector, targetNoun.vector);
161
- return Math.max(0, 1 - distance);
162
- }
163
- catch (error) {
164
- console.warn('Error calculating semantic score:', error);
165
- return null;
166
- }
167
- }
168
- /**
169
- * Calculate frequency-based boost for repeated relationships
170
- */
171
- calculateFrequencyBoost(relationKey) {
172
- const stats = this.relationshipStats.get(relationKey);
173
- if (!stats || stats.count <= 1)
174
- return 0.5;
175
- // Logarithmic scaling: more occurrences = higher weight, but with diminishing returns
176
- const boost = Math.log(stats.count + 1) / Math.log(10); // Log base 10
177
- return Math.min(boost, 1.0);
178
- }
179
- /**
180
- * Calculate temporal decay factor based on recency
181
- */
182
- calculateTemporalFactor(relationKey) {
183
- const stats = this.relationshipStats.get(relationKey);
184
- if (!stats)
185
- return 1.0;
186
- const daysSinceLastSeen = (Date.now() - stats.lastSeen.getTime()) / (1000 * 60 * 60 * 24);
187
- const decayFactor = Math.exp(-this.config.temporalDecayRate * daysSinceLastSeen);
188
- return Math.max(0.1, decayFactor); // Minimum 10% of original weight
189
- }
190
- /**
191
- * Calculate learning-based adjustment using historical patterns
192
- */
193
- calculateLearningAdjustment(relationKey) {
194
- const stats = this.relationshipStats.get(relationKey);
195
- if (!stats || stats.count <= 1)
196
- return 0.5;
197
- // Use moving average of weights as learned baseline
198
- return Math.max(0, Math.min(1, stats.averageWeight));
199
- }
200
- /**
201
- * Update relationship statistics for learning
202
- */
203
- updateRelationshipStats(relationKey, weight, metadata) {
204
- const now = new Date();
205
- const existing = this.relationshipStats.get(relationKey);
206
- if (existing) {
207
- // Update existing stats
208
- existing.count++;
209
- existing.totalWeight += weight;
210
- existing.averageWeight = existing.totalWeight / existing.count;
211
- existing.lastSeen = now;
212
- }
213
- else {
214
- // Create new stats entry
215
- this.relationshipStats.set(relationKey, {
216
- count: 1,
217
- totalWeight: weight,
218
- averageWeight: weight,
219
- lastSeen: now,
220
- firstSeen: now
221
- });
222
- }
223
- }
224
- /**
225
- * Blend two scores using a weighted average
226
- */
227
- blendScores(score1, score2, weight2) {
228
- const weight1 = 1 - weight2;
229
- return score1 * weight1 + score2 * weight2;
230
- }
231
- /**
232
- * Get current configuration
233
- */
234
- getConfig() {
235
- return { ...this.config };
236
- }
237
- /**
238
- * Update configuration
239
- */
240
- updateConfig(newConfig) {
241
- this.config = { ...this.config, ...newConfig };
242
- }
243
- /**
244
- * Get relationship statistics (for debugging/monitoring)
245
- */
246
- getRelationshipStats() {
247
- return new Map(this.relationshipStats);
248
- }
249
- /**
250
- * Clear relationship statistics
251
- */
252
- clearStats() {
253
- this.relationshipStats.clear();
254
- }
255
- /**
256
- * Provide feedback to improve future scoring
257
- * This allows the system to learn from user corrections or validation
258
- *
259
- * @param sourceId - Source entity ID
260
- * @param targetId - Target entity ID
261
- * @param verbType - Relationship type
262
- * @param feedbackWeight - The corrected/validated weight (0-1)
263
- * @param feedbackConfidence - The corrected/validated confidence (0-1)
264
- * @param feedbackType - Type of feedback ('correction', 'validation', 'enhancement')
265
- */
266
- async provideFeedback(sourceId, targetId, verbType, feedbackWeight, feedbackConfidence, feedbackType = 'correction') {
267
- if (!this.enabled)
268
- return;
269
- const relationKey = `${sourceId}-${verbType}-${targetId}`;
270
- const existing = this.relationshipStats.get(relationKey);
271
- if (existing) {
272
- // Apply feedback with learning rate
273
- const newWeight = existing.averageWeight * (1 - this.config.learningRate) +
274
- feedbackWeight * this.config.learningRate;
275
- // Update the running average with feedback
276
- existing.totalWeight = (existing.totalWeight * existing.count + feedbackWeight) / (existing.count + 1);
277
- existing.averageWeight = existing.totalWeight / existing.count;
278
- existing.count += 1;
279
- existing.lastSeen = new Date();
280
- if (this.brainyInstance?.loggingConfig?.verbose) {
281
- console.log(`Feedback applied for ${relationKey}: ${feedbackType}, ` +
282
- `old weight: ${existing.averageWeight.toFixed(3)}, ` +
283
- `feedback: ${feedbackWeight.toFixed(3)}, ` +
284
- `new weight: ${newWeight.toFixed(3)}`);
285
- }
286
- }
287
- else {
288
- // Create new entry with feedback as initial data
289
- this.relationshipStats.set(relationKey, {
290
- count: 1,
291
- totalWeight: feedbackWeight,
292
- averageWeight: feedbackWeight,
293
- lastSeen: new Date(),
294
- firstSeen: new Date()
295
- });
296
- }
297
- }
298
- /**
299
- * Get learning statistics for monitoring and debugging
300
- */
301
- getLearningStats() {
302
- const relationships = Array.from(this.relationshipStats.entries());
303
- const totalRelationships = relationships.length;
304
- const feedbackCount = relationships.reduce((sum, [, stats]) => sum + stats.count, 0);
305
- // Calculate average confidence (approximated from weight patterns)
306
- const averageWeight = relationships.reduce((sum, [, stats]) => sum + stats.averageWeight, 0) / totalRelationships || 0;
307
- const averageConfidence = Math.min(averageWeight + 0.2, 1.0); // Heuristic: confidence typically higher than weight
308
- // Get top relationships by count
309
- const topRelationships = relationships
310
- .map(([key, stats]) => ({
311
- relationship: key,
312
- count: stats.count,
313
- averageWeight: stats.averageWeight
314
- }))
315
- .sort((a, b) => b.count - a.count)
316
- .slice(0, 10);
317
- return {
318
- totalRelationships,
319
- averageConfidence,
320
- feedbackCount,
321
- topRelationships
322
- };
323
- }
324
- /**
325
- * Export learning data for backup or analysis
326
- */
327
- exportLearningData() {
328
- const data = {
329
- config: this.config,
330
- stats: Array.from(this.relationshipStats.entries()).map(([key, stats]) => ({
331
- relationship: key,
332
- ...stats,
333
- firstSeen: stats.firstSeen.toISOString(),
334
- lastSeen: stats.lastSeen.toISOString()
335
- })),
336
- exportedAt: new Date().toISOString(),
337
- version: '1.0'
338
- };
339
- return JSON.stringify(data, null, 2);
340
- }
341
- /**
342
- * Import learning data from backup
343
- */
344
- importLearningData(jsonData) {
345
- try {
346
- const data = JSON.parse(jsonData);
347
- if (data.version !== '1.0') {
348
- console.warn('Learning data version mismatch, importing anyway');
349
- }
350
- // Update configuration if provided
351
- if (data.config) {
352
- this.config = { ...this.config, ...data.config };
353
- }
354
- // Import relationship statistics
355
- if (data.stats && Array.isArray(data.stats)) {
356
- for (const stat of data.stats) {
357
- if (stat.relationship) {
358
- this.relationshipStats.set(stat.relationship, {
359
- count: stat.count || 1,
360
- totalWeight: stat.totalWeight || stat.averageWeight || 0.5,
361
- averageWeight: stat.averageWeight || 0.5,
362
- firstSeen: new Date(stat.firstSeen || Date.now()),
363
- lastSeen: new Date(stat.lastSeen || Date.now()),
364
- semanticSimilarity: stat.semanticSimilarity
365
- });
366
- }
367
- }
368
- }
369
- console.log(`Imported learning data: ${this.relationshipStats.size} relationships`);
370
- }
371
- catch (error) {
372
- console.error('Failed to import learning data:', error);
373
- throw new Error(`Failed to import learning data: ${error}`);
374
- }
375
- }
376
- }
377
- //# sourceMappingURL=intelligentVerbScoring.js.map
@@ -1,168 +0,0 @@
1
- /**
2
- * Augmentation Marketplace
3
- *
4
- * A VS Code/WebStorm-style plugin marketplace for Brainy augmentations
5
- * Integrates with Soulcraft Brain-Cloud API for premium augmentations
6
- *
7
- * Features:
8
- * - Browse and search augmentations
9
- * - Install from cloud registry
10
- * - Manage local augmentations
11
- * - Auto-updates and licensing
12
- */
13
- import { AugmentationManifest } from '../manifest.js';
14
- /**
15
- * Cloud augmentation metadata from Brain-Cloud API
16
- */
17
- export interface CloudAugmentation {
18
- id: string;
19
- name: string;
20
- displayName: string;
21
- author: string;
22
- authorUrl?: string;
23
- version: string;
24
- description: string;
25
- longDescription?: string;
26
- category: 'premium' | 'community' | 'official' | 'enterprise';
27
- tags: string[];
28
- price?: number;
29
- currency?: string;
30
- rating: number;
31
- reviews: number;
32
- downloads: number;
33
- lastUpdated: string;
34
- minBrainyVersion: string;
35
- maxBrainyVersion?: string;
36
- requirements: string[];
37
- permissions: string[];
38
- screenshots?: string[];
39
- repositoryUrl?: string;
40
- documentationUrl?: string;
41
- supportUrl?: string;
42
- license: string;
43
- size: number;
44
- }
45
- /**
46
- * Local augmentation installation info
47
- */
48
- export interface InstalledAugmentation {
49
- id: string;
50
- name: string;
51
- version: string;
52
- installedAt: string;
53
- installedFrom: 'local' | 'cloud' | 'file';
54
- cloudId?: string;
55
- enabled: boolean;
56
- autoUpdate: boolean;
57
- config?: Record<string, any>;
58
- path: string;
59
- }
60
- /**
61
- * Installation options
62
- */
63
- export interface InstallOptions {
64
- version?: string;
65
- autoUpdate?: boolean;
66
- enable?: boolean;
67
- config?: Record<string, any>;
68
- }
69
- /**
70
- * Search filters
71
- */
72
- export interface SearchFilters {
73
- category?: CloudAugmentation['category'];
74
- tags?: string[];
75
- minRating?: number;
76
- free?: boolean;
77
- verified?: boolean;
78
- compatible?: boolean;
79
- }
80
- /**
81
- * Marketplace configuration
82
- */
83
- export interface MarketplaceConfig {
84
- apiUrl?: string;
85
- apiKey?: string;
86
- cacheDir?: string;
87
- augmentationsDir?: string;
88
- autoUpdate?: boolean;
89
- checkInterval?: number;
90
- }
91
- /**
92
- * Augmentation Marketplace - Main class
93
- */
94
- export declare class AugmentationMarketplace {
95
- private config;
96
- private installedCache;
97
- private cloudCache;
98
- private updateCheckTimer?;
99
- constructor(config?: MarketplaceConfig);
100
- /**
101
- * Get all installed augmentations
102
- */
103
- getInstalled(): InstalledAugmentation[];
104
- /**
105
- * Get available local augmentations (built-in)
106
- */
107
- getAvailableLocal(): Promise<AugmentationManifest[]>;
108
- /**
109
- * Search cloud registry
110
- */
111
- searchCloud(query?: string, filters?: SearchFilters, page?: number, limit?: number): Promise<{
112
- results: CloudAugmentation[];
113
- total: number;
114
- page: number;
115
- pages: number;
116
- }>;
117
- /**
118
- * Get detailed information about a cloud augmentation
119
- */
120
- getCloudDetails(id: string): Promise<CloudAugmentation>;
121
- /**
122
- * Install augmentation from cloud
123
- */
124
- installFromCloud(id: string, options?: InstallOptions): Promise<InstalledAugmentation>;
125
- /**
126
- * Install from local file
127
- */
128
- installFromFile(filePath: string, options?: InstallOptions): Promise<InstalledAugmentation>;
129
- /**
130
- * Enable an installed augmentation
131
- */
132
- enable(name: string): Promise<void>;
133
- /**
134
- * Disable an installed augmentation
135
- */
136
- disable(name: string): Promise<void>;
137
- /**
138
- * Uninstall an augmentation
139
- */
140
- uninstall(name: string): Promise<void>;
141
- /**
142
- * Update an augmentation
143
- */
144
- update(name: string): Promise<void>;
145
- /**
146
- * Check for updates for all installed augmentations
147
- */
148
- checkForUpdates(): Promise<Array<{
149
- augmentation: InstalledAugmentation;
150
- newVersion: string;
151
- }>>;
152
- private getBrainyVersion;
153
- private isCompatible;
154
- private getInstalledByName;
155
- private getInstalledByCloudId;
156
- private downloadPackage;
157
- private extractPackage;
158
- private loadAugmentation;
159
- private unloadAugmentation;
160
- private removeAugmentationFiles;
161
- private loadInstalledAugmentations;
162
- private saveInstalledAugmentations;
163
- private startUpdateChecker;
164
- /**
165
- * Cleanup resources
166
- */
167
- destroy(): void;
168
- }