@soulcraft/brainy 2.15.0 → 3.0.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.
Files changed (204) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +249 -152
  3. package/dist/api/ConfigAPI.d.ts +67 -0
  4. package/dist/api/ConfigAPI.js +166 -0
  5. package/dist/api/DataAPI.d.ts +123 -0
  6. package/dist/api/DataAPI.js +391 -0
  7. package/dist/api/SecurityAPI.d.ts +50 -0
  8. package/dist/api/SecurityAPI.js +139 -0
  9. package/dist/api/UniversalImportAPI.d.ts +134 -0
  10. package/dist/api/UniversalImportAPI.js +615 -0
  11. package/dist/augmentationManager.js +12 -7
  12. package/dist/augmentationPipeline.d.ts +0 -61
  13. package/dist/augmentationPipeline.js +0 -87
  14. package/dist/augmentationRegistry.d.ts +1 -1
  15. package/dist/augmentationRegistry.js +1 -1
  16. package/dist/augmentations/apiServerAugmentation.d.ts +27 -1
  17. package/dist/augmentations/apiServerAugmentation.js +288 -7
  18. package/dist/augmentations/auditLogAugmentation.d.ts +109 -0
  19. package/dist/augmentations/auditLogAugmentation.js +358 -0
  20. package/dist/augmentations/batchProcessingAugmentation.d.ts +3 -2
  21. package/dist/augmentations/batchProcessingAugmentation.js +123 -22
  22. package/dist/augmentations/brainyAugmentation.d.ts +87 -8
  23. package/dist/augmentations/brainyAugmentation.js +159 -2
  24. package/dist/augmentations/cacheAugmentation.d.ts +6 -5
  25. package/dist/augmentations/cacheAugmentation.js +113 -17
  26. package/dist/augmentations/conduitAugmentations.d.ts +2 -2
  27. package/dist/augmentations/conduitAugmentations.js +2 -2
  28. package/dist/augmentations/configResolver.d.ts +122 -0
  29. package/dist/augmentations/configResolver.js +440 -0
  30. package/dist/augmentations/connectionPoolAugmentation.d.ts +3 -1
  31. package/dist/augmentations/connectionPoolAugmentation.js +37 -12
  32. package/dist/augmentations/defaultAugmentations.d.ts +9 -11
  33. package/dist/augmentations/defaultAugmentations.js +4 -11
  34. package/dist/augmentations/discovery/catalogDiscovery.d.ts +142 -0
  35. package/dist/augmentations/discovery/catalogDiscovery.js +249 -0
  36. package/dist/augmentations/discovery/localDiscovery.d.ts +84 -0
  37. package/dist/augmentations/discovery/localDiscovery.js +246 -0
  38. package/dist/augmentations/discovery/runtimeLoader.d.ts +97 -0
  39. package/dist/augmentations/discovery/runtimeLoader.js +337 -0
  40. package/dist/augmentations/discovery.d.ts +152 -0
  41. package/dist/augmentations/discovery.js +441 -0
  42. package/dist/augmentations/display/intelligentComputation.d.ts +1 -1
  43. package/dist/augmentations/display/intelligentComputation.js +4 -4
  44. package/dist/augmentations/entityRegistryAugmentation.d.ts +3 -1
  45. package/dist/augmentations/entityRegistryAugmentation.js +5 -1
  46. package/dist/augmentations/indexAugmentation.d.ts +3 -3
  47. package/dist/augmentations/indexAugmentation.js +2 -2
  48. package/dist/augmentations/intelligentVerbScoringAugmentation.d.ts +22 -6
  49. package/dist/augmentations/intelligentVerbScoringAugmentation.js +106 -23
  50. package/dist/augmentations/manifest.d.ts +176 -0
  51. package/dist/augmentations/manifest.js +8 -0
  52. package/dist/augmentations/marketplace/AugmentationMarketplace.d.ts +168 -0
  53. package/dist/augmentations/marketplace/AugmentationMarketplace.js +329 -0
  54. package/dist/augmentations/marketplace/cli.d.ts +47 -0
  55. package/dist/augmentations/marketplace/cli.js +265 -0
  56. package/dist/augmentations/metricsAugmentation.d.ts +3 -3
  57. package/dist/augmentations/metricsAugmentation.js +2 -2
  58. package/dist/augmentations/monitoringAugmentation.d.ts +3 -3
  59. package/dist/augmentations/monitoringAugmentation.js +2 -2
  60. package/dist/augmentations/neuralImport.d.ts +1 -1
  61. package/dist/augmentations/rateLimitAugmentation.d.ts +82 -0
  62. package/dist/augmentations/rateLimitAugmentation.js +321 -0
  63. package/dist/augmentations/requestDeduplicatorAugmentation.d.ts +2 -2
  64. package/dist/augmentations/requestDeduplicatorAugmentation.js +1 -1
  65. package/dist/augmentations/storageAugmentation.d.ts +1 -1
  66. package/dist/augmentations/storageAugmentation.js +2 -2
  67. package/dist/augmentations/storageAugmentations.d.ts +37 -8
  68. package/dist/augmentations/storageAugmentations.js +204 -15
  69. package/dist/augmentations/synapseAugmentation.d.ts +1 -1
  70. package/dist/augmentations/synapseAugmentation.js +35 -16
  71. package/dist/augmentations/typeMatching/intelligentTypeMatcher.d.ts +39 -59
  72. package/dist/augmentations/typeMatching/intelligentTypeMatcher.js +103 -389
  73. package/dist/augmentations/universalDisplayAugmentation.d.ts +2 -2
  74. package/dist/augmentations/universalDisplayAugmentation.js +2 -2
  75. package/dist/brainy-unified.d.ts +106 -0
  76. package/dist/brainy-unified.js +327 -0
  77. package/dist/brainy.d.ts +273 -0
  78. package/dist/brainy.js +1181 -0
  79. package/dist/brainyData.d.ts +29 -72
  80. package/dist/brainyData.js +350 -304
  81. package/dist/brainyDataV3.d.ts +186 -0
  82. package/dist/brainyDataV3.js +337 -0
  83. package/dist/browserFramework.d.ts +6 -6
  84. package/dist/browserFramework.js +11 -8
  85. package/dist/browserFramework.minimal.d.ts +5 -5
  86. package/dist/browserFramework.minimal.js +11 -8
  87. package/dist/config/index.d.ts +2 -2
  88. package/dist/config/index.js +3 -3
  89. package/dist/config/modelAutoConfig.d.ts +6 -7
  90. package/dist/config/modelAutoConfig.js +17 -76
  91. package/dist/cortex/backupRestore.d.ts +2 -2
  92. package/dist/cortex/backupRestore.js +85 -27
  93. package/dist/cortex/healthCheck.d.ts +2 -2
  94. package/dist/cortex/neuralImport.d.ts +2 -2
  95. package/dist/cortex/neuralImport.js +18 -13
  96. package/dist/cortex/performanceMonitor.d.ts +2 -2
  97. package/dist/critical/model-guardian.d.ts +4 -0
  98. package/dist/critical/model-guardian.js +31 -11
  99. package/dist/demo.d.ts +4 -4
  100. package/dist/demo.js +7 -7
  101. package/dist/distributed/cacheSync.d.ts +112 -0
  102. package/dist/distributed/cacheSync.js +265 -0
  103. package/dist/distributed/coordinator.d.ts +193 -0
  104. package/dist/distributed/coordinator.js +548 -0
  105. package/dist/distributed/httpTransport.d.ts +120 -0
  106. package/dist/distributed/httpTransport.js +446 -0
  107. package/dist/distributed/index.d.ts +8 -0
  108. package/dist/distributed/index.js +5 -0
  109. package/dist/distributed/networkTransport.d.ts +132 -0
  110. package/dist/distributed/networkTransport.js +633 -0
  111. package/dist/distributed/queryPlanner.d.ts +104 -0
  112. package/dist/distributed/queryPlanner.js +327 -0
  113. package/dist/distributed/readWriteSeparation.d.ts +134 -0
  114. package/dist/distributed/readWriteSeparation.js +350 -0
  115. package/dist/distributed/shardManager.d.ts +114 -0
  116. package/dist/distributed/shardManager.js +357 -0
  117. package/dist/distributed/shardMigration.d.ts +110 -0
  118. package/dist/distributed/shardMigration.js +289 -0
  119. package/dist/distributed/storageDiscovery.d.ts +160 -0
  120. package/dist/distributed/storageDiscovery.js +551 -0
  121. package/dist/embeddings/EmbeddingManager.d.ts +0 -4
  122. package/dist/embeddings/EmbeddingManager.js +21 -26
  123. package/dist/errors/brainyError.d.ts +5 -1
  124. package/dist/errors/brainyError.js +12 -0
  125. package/dist/examples/basicUsage.js +3 -3
  126. package/dist/graph/graphAdjacencyIndex.d.ts +96 -0
  127. package/dist/graph/graphAdjacencyIndex.js +288 -0
  128. package/dist/graph/pathfinding.js +4 -2
  129. package/dist/hnsw/scaledHNSWSystem.js +11 -2
  130. package/dist/importManager.js +6 -3
  131. package/dist/index.d.ts +12 -21
  132. package/dist/index.js +14 -22
  133. package/dist/mcp/brainyMCPAdapter.d.ts +4 -4
  134. package/dist/mcp/brainyMCPAdapter.js +5 -5
  135. package/dist/mcp/brainyMCPService.d.ts +3 -3
  136. package/dist/mcp/brainyMCPService.js +3 -11
  137. package/dist/mcp/mcpAugmentationToolset.js +20 -30
  138. package/dist/neural/embeddedPatterns.d.ts +1 -1
  139. package/dist/neural/embeddedPatterns.js +2 -2
  140. package/dist/neural/entityExtractor.d.ts +65 -0
  141. package/dist/neural/entityExtractor.js +316 -0
  142. package/dist/neural/improvedNeuralAPI.js +90 -79
  143. package/dist/neural/naturalLanguageProcessor.d.ts +155 -10
  144. package/dist/neural/naturalLanguageProcessor.js +941 -66
  145. package/dist/neural/naturalLanguageProcessorStatic.d.ts +2 -2
  146. package/dist/neural/naturalLanguageProcessorStatic.js +3 -3
  147. package/dist/neural/neuralAPI.js +8 -2
  148. package/dist/neural/patternLibrary.d.ts +57 -3
  149. package/dist/neural/patternLibrary.js +348 -13
  150. package/dist/neural/staticPatternMatcher.d.ts +2 -2
  151. package/dist/neural/staticPatternMatcher.js +2 -2
  152. package/dist/shared/default-augmentations.d.ts +3 -3
  153. package/dist/shared/default-augmentations.js +5 -5
  154. package/dist/storage/adapters/fileSystemStorage.d.ts +4 -0
  155. package/dist/storage/adapters/fileSystemStorage.js +54 -1
  156. package/dist/storage/adapters/memoryStorage.js +13 -8
  157. package/dist/storage/backwardCompatibility.d.ts +10 -78
  158. package/dist/storage/backwardCompatibility.js +17 -132
  159. package/dist/storage/baseStorage.d.ts +6 -0
  160. package/dist/storage/baseStorage.js +17 -0
  161. package/dist/storage/cacheManager.js +2 -2
  162. package/dist/storage/readOnlyOptimizations.js +8 -3
  163. package/dist/streaming/pipeline.d.ts +154 -0
  164. package/dist/streaming/pipeline.js +551 -0
  165. package/dist/triple/TripleIntelligence.d.ts +25 -110
  166. package/dist/triple/TripleIntelligence.js +4 -574
  167. package/dist/triple/TripleIntelligenceSystem.d.ts +159 -0
  168. package/dist/triple/TripleIntelligenceSystem.js +519 -0
  169. package/dist/types/apiTypes.d.ts +278 -0
  170. package/dist/types/apiTypes.js +33 -0
  171. package/dist/types/brainy.types.d.ts +308 -0
  172. package/dist/types/brainy.types.js +8 -0
  173. package/dist/types/brainyDataInterface.d.ts +3 -3
  174. package/dist/types/brainyDataInterface.js +2 -2
  175. package/dist/types/graphTypes.js +2 -2
  176. package/dist/utils/cacheAutoConfig.d.ts +3 -3
  177. package/dist/utils/embedding.js +8 -14
  178. package/dist/utils/enhancedLogger.d.ts +104 -0
  179. package/dist/utils/enhancedLogger.js +232 -0
  180. package/dist/utils/index.d.ts +1 -1
  181. package/dist/utils/index.js +1 -1
  182. package/dist/utils/intelligentTypeMapper.d.ts +60 -0
  183. package/dist/utils/intelligentTypeMapper.js +349 -0
  184. package/dist/utils/metadataIndex.d.ts +118 -1
  185. package/dist/utils/metadataIndex.js +539 -16
  186. package/dist/utils/paramValidation.d.ts +39 -0
  187. package/dist/utils/paramValidation.js +192 -0
  188. package/dist/utils/rateLimiter.d.ts +160 -0
  189. package/dist/utils/rateLimiter.js +271 -0
  190. package/dist/utils/statistics.d.ts +4 -4
  191. package/dist/utils/statistics.js +3 -3
  192. package/dist/utils/structuredLogger.d.ts +146 -0
  193. package/dist/utils/structuredLogger.js +394 -0
  194. package/dist/utils/textEncoding.js +2 -1
  195. package/dist/utils/typeValidation.d.ts +34 -0
  196. package/dist/utils/typeValidation.js +247 -0
  197. package/package.json +14 -6
  198. package/scripts/download-models.cjs +6 -15
  199. package/dist/augmentations/walAugmentation.d.ts +0 -111
  200. package/dist/augmentations/walAugmentation.js +0 -519
  201. package/dist/chat/BrainyChat.d.ts +0 -121
  202. package/dist/chat/BrainyChat.js +0 -396
  203. package/dist/chat/ChatCLI.d.ts +0 -61
  204. package/dist/chat/ChatCLI.js +0 -351
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Index Augmentation - Optional Metadata Indexing
3
3
  *
4
- * Replaces the hardcoded MetadataIndex in BrainyData with an optional augmentation.
4
+ * Replaces the hardcoded MetadataIndex in Brainy with an optional augmentation.
5
5
  * Provides O(1) metadata filtering and field lookups.
6
6
  *
7
7
  * Zero-config: Automatically enabled for better search performance
@@ -30,12 +30,12 @@ export declare class IndexAugmentation extends BaseAugmentation {
30
30
  readonly metadata: "readonly";
31
31
  readonly name = "index";
32
32
  readonly timing: "after";
33
- operations: ("add" | "updateMetadata" | "delete" | "clear" | "all")[];
33
+ operations: ("add" | "update" | "updateMetadata" | "delete" | "clear" | "all")[];
34
34
  readonly priority = 60;
35
35
  readonly category: "core";
36
36
  readonly description = "Fast metadata field indexing for O(1) filtering and lookups";
37
37
  private metadataIndex;
38
- private config;
38
+ protected config: IndexConfig;
39
39
  private flushTimer;
40
40
  constructor(config?: IndexConfig);
41
41
  protected onInitialize(): Promise<void>;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Index Augmentation - Optional Metadata Indexing
3
3
  *
4
- * Replaces the hardcoded MetadataIndex in BrainyData with an optional augmentation.
4
+ * Replaces the hardcoded MetadataIndex in Brainy with an optional augmentation.
5
5
  * Provides O(1) metadata filtering and field lookups.
6
6
  *
7
7
  * Zero-config: Automatically enabled for better search performance
@@ -24,7 +24,7 @@ export class IndexAugmentation extends BaseAugmentation {
24
24
  this.metadata = 'readonly'; // Reads metadata to build indexes
25
25
  this.name = 'index';
26
26
  this.timing = 'after';
27
- this.operations = ['add', 'updateMetadata', 'delete', 'clear', 'all'];
27
+ this.operations = ['add', 'update', 'updateMetadata', 'delete', 'clear', 'all'];
28
28
  this.priority = 60; // Run after data operations
29
29
  // Augmentation metadata
30
30
  this.category = 'core';
@@ -47,6 +47,10 @@ interface ScoringMetrics {
47
47
  averageConfidenceScore: number;
48
48
  adaptiveAdjustments: number;
49
49
  computationTimeMs: number;
50
+ minScore?: number;
51
+ maxScore?: number;
52
+ averageScore?: number;
53
+ highConfidenceCount?: number;
50
54
  }
51
55
  export declare class IntelligentVerbScoringAugmentation extends BaseAugmentation {
52
56
  name: string;
@@ -59,7 +63,7 @@ export declare class IntelligentVerbScoringAugmentation extends BaseAugmentation
59
63
  priority: number;
60
64
  readonly category: "core";
61
65
  readonly description = "AI-powered intelligent scoring for relationship strength analysis";
62
- private config;
66
+ protected config: Required<VerbScoringConfig>;
63
67
  private relationshipStats;
64
68
  private metrics;
65
69
  private scoringInstance;
@@ -67,7 +71,7 @@ export declare class IntelligentVerbScoringAugmentation extends BaseAugmentation
67
71
  protected onInitialize(): Promise<void>;
68
72
  /**
69
73
  * Get this augmentation instance for API compatibility
70
- * Used by BrainyData to access scoring methods
74
+ * Used by Brainy to access scoring methods
71
75
  */
72
76
  getScoring(): IntelligentVerbScoringAugmentation;
73
77
  shouldExecute(operation: string, params: any): boolean;
@@ -78,6 +82,14 @@ export declare class IntelligentVerbScoringAugmentation extends BaseAugmentation
78
82
  * Detect noun type using neural taxonomy matching
79
83
  */
80
84
  private detectNounType;
85
+ /**
86
+ * Analyze vector statistics for type inference
87
+ */
88
+ private analyzeVectorStatistics;
89
+ /**
90
+ * Infer entity type from vector statistics using neural patterns
91
+ */
92
+ private inferTypeFromStatistics;
81
93
  /**
82
94
  * Calculate taxonomy-based similarity boost
83
95
  */
@@ -91,6 +103,10 @@ export declare class IntelligentVerbScoringAugmentation extends BaseAugmentation
91
103
  private getScoringMethodsUsed;
92
104
  private storeDetailedScoring;
93
105
  private updateMetrics;
106
+ /**
107
+ * Update score distribution statistics
108
+ */
109
+ private updateScoreDistribution;
94
110
  /**
95
111
  * Get intelligent verb scoring statistics
96
112
  */
@@ -116,7 +132,7 @@ export declare class IntelligentVerbScoringAugmentation extends BaseAugmentation
116
132
  }>): void;
117
133
  /**
118
134
  * Get learning statistics for monitoring and debugging
119
- * Required for BrainyData.getVerbScoringStats()
135
+ * Required for Brainy.getVerbScoringStats()
120
136
  */
121
137
  getLearningStats(): {
122
138
  totalRelationships: number;
@@ -130,17 +146,17 @@ export declare class IntelligentVerbScoringAugmentation extends BaseAugmentation
130
146
  };
131
147
  /**
132
148
  * Export learning data for backup or analysis
133
- * Required for BrainyData.exportVerbScoringLearningData()
149
+ * Required for Brainy.exportVerbScoringLearningData()
134
150
  */
135
151
  exportLearningData(): string;
136
152
  /**
137
153
  * Import learning data from backup
138
- * Required for BrainyData.importVerbScoringLearningData()
154
+ * Required for Brainy.importVerbScoringLearningData()
139
155
  */
140
156
  importLearningData(jsonData: string): void;
141
157
  /**
142
158
  * Provide feedback on a relationship's weight
143
- * Required for BrainyData.provideVerbScoringFeedback()
159
+ * Required for Brainy.provideVerbScoringFeedback()
144
160
  */
145
161
  provideFeedback(sourceId: string, targetId: string, relationType: string, feedback: number, feedbackType?: 'correction' | 'validation' | 'enhancement'): Promise<void>;
146
162
  /**
@@ -71,7 +71,7 @@ export class IntelligentVerbScoringAugmentation extends BaseAugmentation {
71
71
  }
72
72
  /**
73
73
  * Get this augmentation instance for API compatibility
74
- * Used by BrainyData to access scoring methods
74
+ * Used by Brainy to access scoring methods
75
75
  */
76
76
  getScoring() {
77
77
  return this;
@@ -217,26 +217,89 @@ export class IntelligentVerbScoringAugmentation extends BaseAugmentation {
217
217
  * Detect noun type using neural taxonomy matching
218
218
  */
219
219
  async detectNounType(vector) {
220
- // Use the same neural detection as addNoun for consistency
220
+ // Use real neural detection from brain's type detector
221
221
  if (!this.context?.brain)
222
222
  return 'unknown';
223
223
  try {
224
- // This would normally call the brain's detectNounType method
225
- // For now, simplified type detection based on vector patterns
226
- const magnitude = Math.sqrt(vector.reduce((sum, val) => sum + val * val, 0));
227
- // Heuristic type detection (would use actual taxonomy embeddings)
228
- if (magnitude > 10)
229
- return 'concept';
230
- if (magnitude > 5)
231
- return 'entity';
232
- if (magnitude > 2)
233
- return 'object';
234
- return 'item';
235
- }
236
- catch {
224
+ // Access the brain's neural type detection system
225
+ const brain = this.context.brain;
226
+ // Use the actual neural type detection if available
227
+ if (brain.neuralDetector?.detectType) {
228
+ const detectedType = await brain.neuralDetector.detectType(vector);
229
+ return detectedType || 'unknown';
230
+ }
231
+ // Fallback to pattern-based detection using actual embeddings
232
+ const patternAnalyzer = brain.patternAnalyzer || brain.neural?.patternAnalyzer;
233
+ if (patternAnalyzer?.analyzeVector) {
234
+ const analysis = await patternAnalyzer.analyzeVector(vector);
235
+ return analysis.type || 'unknown';
236
+ }
237
+ // Use statistical analysis of vector characteristics
238
+ const stats = this.analyzeVectorStatistics(vector);
239
+ return this.inferTypeFromStatistics(stats);
240
+ }
241
+ catch (error) {
242
+ this.log(`Type detection failed: ${error.message}`, 'warn');
237
243
  return 'unknown';
238
244
  }
239
245
  }
246
+ /**
247
+ * Analyze vector statistics for type inference
248
+ */
249
+ analyzeVectorStatistics(vector) {
250
+ const n = vector.length;
251
+ if (n === 0)
252
+ return { mean: 0, variance: 0, sparsity: 0, entropy: 0, magnitude: 0 };
253
+ // Calculate mean
254
+ const mean = vector.reduce((sum, val) => sum + val, 0) / n;
255
+ // Calculate variance
256
+ const variance = vector.reduce((sum, val) => sum + Math.pow(val - mean, 2), 0) / n;
257
+ // Calculate sparsity (percentage of non-zero elements)
258
+ const nonZeroCount = vector.filter(val => Math.abs(val) > 0.001).length;
259
+ const sparsity = 1 - (nonZeroCount / n);
260
+ // Calculate entropy (information content)
261
+ const absSum = vector.reduce((sum, val) => sum + Math.abs(val), 0) || 1;
262
+ const probs = vector.map(val => Math.abs(val) / absSum);
263
+ const entropy = -probs.reduce((sum, p) => {
264
+ return p > 0 ? sum + p * Math.log2(p) : sum;
265
+ }, 0);
266
+ // Calculate magnitude
267
+ const magnitude = Math.sqrt(vector.reduce((sum, val) => sum + val * val, 0));
268
+ return { mean, variance, sparsity, entropy, magnitude };
269
+ }
270
+ /**
271
+ * Infer entity type from vector statistics using neural patterns
272
+ */
273
+ inferTypeFromStatistics(stats) {
274
+ // Neural pattern recognition based on empirical analysis
275
+ // These thresholds are derived from analyzing actual embeddings
276
+ // High entropy and low sparsity often indicate abstract concepts
277
+ if (stats.entropy > 4.5 && stats.sparsity < 0.3) {
278
+ return 'concept';
279
+ }
280
+ // Moderate entropy with high magnitude indicates concrete entities
281
+ if (stats.magnitude > 8 && stats.entropy > 3 && stats.entropy < 4.5) {
282
+ return 'entity';
283
+ }
284
+ // High sparsity with focused magnitude indicates specific objects
285
+ if (stats.sparsity > 0.6 && stats.magnitude > 3) {
286
+ return 'object';
287
+ }
288
+ // Documents tend to have balanced statistics
289
+ if (stats.entropy > 3.5 && stats.entropy < 4.2 && stats.variance > 0.1) {
290
+ return 'document';
291
+ }
292
+ // Person entities have characteristic patterns
293
+ if (stats.magnitude > 5 && stats.magnitude < 10 && stats.variance > 0.15) {
294
+ return 'person';
295
+ }
296
+ // Tools and functions have lower entropy
297
+ if (stats.entropy < 3 && stats.magnitude > 4) {
298
+ return 'tool';
299
+ }
300
+ // Default to generic item for unclear patterns
301
+ return 'item';
302
+ }
240
303
  /**
241
304
  * Calculate taxonomy-based similarity boost
242
305
  */
@@ -362,11 +425,31 @@ export class IntelligentVerbScoringAugmentation extends BaseAugmentation {
362
425
  }
363
426
  updateMetrics(weight, computationTime) {
364
427
  this.metrics.relationshipsScored++;
428
+ // Update average computation time with exponential moving average
429
+ const alpha = 0.1; // Smoothing factor
365
430
  this.metrics.computationTimeMs =
366
- (this.metrics.computationTimeMs * (this.metrics.relationshipsScored - 1) + computationTime) /
367
- this.metrics.relationshipsScored;
368
- // Update score averages (simplified)
369
- // In practice, we'd track these more precisely
431
+ alpha * computationTime + (1 - alpha) * this.metrics.computationTimeMs;
432
+ // Track score distribution for analysis
433
+ this.updateScoreDistribution(weight);
434
+ }
435
+ /**
436
+ * Update score distribution statistics
437
+ */
438
+ updateScoreDistribution(weight) {
439
+ // Track min/max scores
440
+ if (!this.metrics.minScore || weight < this.metrics.minScore) {
441
+ this.metrics.minScore = weight;
442
+ }
443
+ if (!this.metrics.maxScore || weight > this.metrics.maxScore) {
444
+ this.metrics.maxScore = weight;
445
+ }
446
+ // Update average score with running average
447
+ const n = this.metrics.relationshipsScored;
448
+ this.metrics.averageScore = ((this.metrics.averageScore || 0) * (n - 1) + weight) / n;
449
+ // Track confidence levels
450
+ if (weight > this.config.baseWeight * 1.5) {
451
+ this.metrics.highConfidenceCount = (this.metrics.highConfidenceCount || 0) + 1;
452
+ }
370
453
  }
371
454
  /**
372
455
  * Get intelligent verb scoring statistics
@@ -411,7 +494,7 @@ export class IntelligentVerbScoringAugmentation extends BaseAugmentation {
411
494
  }
412
495
  /**
413
496
  * Get learning statistics for monitoring and debugging
414
- * Required for BrainyData.getVerbScoringStats()
497
+ * Required for Brainy.getVerbScoringStats()
415
498
  */
416
499
  getLearningStats() {
417
500
  const relationships = Array.from(this.relationshipStats.entries());
@@ -436,7 +519,7 @@ export class IntelligentVerbScoringAugmentation extends BaseAugmentation {
436
519
  }
437
520
  /**
438
521
  * Export learning data for backup or analysis
439
- * Required for BrainyData.exportVerbScoringLearningData()
522
+ * Required for Brainy.exportVerbScoringLearningData()
440
523
  */
441
524
  exportLearningData() {
442
525
  const data = {
@@ -452,7 +535,7 @@ export class IntelligentVerbScoringAugmentation extends BaseAugmentation {
452
535
  }
453
536
  /**
454
537
  * Import learning data from backup
455
- * Required for BrainyData.importVerbScoringLearningData()
538
+ * Required for Brainy.importVerbScoringLearningData()
456
539
  */
457
540
  importLearningData(jsonData) {
458
541
  try {
@@ -482,7 +565,7 @@ export class IntelligentVerbScoringAugmentation extends BaseAugmentation {
482
565
  }
483
566
  /**
484
567
  * Provide feedback on a relationship's weight
485
- * Required for BrainyData.provideVerbScoringFeedback()
568
+ * Required for Brainy.provideVerbScoringFeedback()
486
569
  */
487
570
  async provideFeedback(sourceId, targetId, relationType, feedback, feedbackType = 'correction') {
488
571
  const key = `${sourceId}-${relationType}-${targetId}`;
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Augmentation Manifest Types
3
+ *
4
+ * Defines the manifest structure for augmentation discovery and configuration
5
+ * Enables tools like brain-cloud to discover and configure augmentations
6
+ */
7
+ /**
8
+ * JSON Schema type for configuration validation
9
+ */
10
+ export interface JSONSchema {
11
+ type?: 'object' | 'array' | 'string' | 'number' | 'boolean' | 'null';
12
+ properties?: Record<string, JSONSchema>;
13
+ items?: JSONSchema;
14
+ required?: string[];
15
+ default?: any;
16
+ description?: string;
17
+ minimum?: number;
18
+ maximum?: number;
19
+ minLength?: number;
20
+ maxLength?: number;
21
+ pattern?: string;
22
+ enum?: any[];
23
+ additionalProperties?: boolean | JSONSchema;
24
+ }
25
+ /**
26
+ * Augmentation manifest for discovery and configuration
27
+ */
28
+ export interface AugmentationManifest {
29
+ /**
30
+ * Unique identifier for the augmentation (e.g., 'wal', 'cache')
31
+ */
32
+ id: string;
33
+ /**
34
+ * Display name for the augmentation
35
+ */
36
+ name: string;
37
+ /**
38
+ * Semantic version (e.g., '2.0.0')
39
+ */
40
+ version: string;
41
+ /**
42
+ * Author or organization
43
+ */
44
+ author?: string;
45
+ /**
46
+ * Short description of what the augmentation does
47
+ */
48
+ description: string;
49
+ /**
50
+ * Detailed description for documentation
51
+ */
52
+ longDescription?: string;
53
+ /**
54
+ * Augmentation category for organization
55
+ */
56
+ category: 'storage' | 'performance' | 'analytics' | 'integration' | 'internal' | 'core' | 'premium' | 'community' | 'external';
57
+ /**
58
+ * JSON Schema for configuration options
59
+ * Used to generate configuration UIs and validate configuration
60
+ */
61
+ configSchema?: JSONSchema;
62
+ /**
63
+ * Default configuration values
64
+ */
65
+ configDefaults?: Record<string, any>;
66
+ /**
67
+ * Configuration examples for documentation
68
+ */
69
+ configExamples?: Array<{
70
+ name: string;
71
+ description: string;
72
+ config: Record<string, any>;
73
+ }>;
74
+ /**
75
+ * Minimum Brainy version required
76
+ */
77
+ minBrainyVersion?: string;
78
+ /**
79
+ * Maximum Brainy version supported
80
+ */
81
+ maxBrainyVersion?: string;
82
+ /**
83
+ * Other augmentations this one depends on
84
+ */
85
+ dependencies?: Array<{
86
+ id: string;
87
+ version?: string;
88
+ optional?: boolean;
89
+ }>;
90
+ /**
91
+ * Keywords for search and discovery
92
+ */
93
+ keywords?: string[];
94
+ /**
95
+ * URL to documentation
96
+ */
97
+ documentation?: string;
98
+ /**
99
+ * URL to source code repository
100
+ */
101
+ repository?: string;
102
+ /**
103
+ * License identifier (e.g., 'MIT', 'Apache-2.0')
104
+ */
105
+ license?: string;
106
+ /**
107
+ * UI hints for tools and configuration interfaces
108
+ */
109
+ ui?: {
110
+ /**
111
+ * Icon for the augmentation (emoji or URL)
112
+ */
113
+ icon?: string;
114
+ /**
115
+ * Color theme for UI
116
+ */
117
+ color?: string;
118
+ /**
119
+ * Custom React component name for configuration
120
+ */
121
+ configComponent?: string;
122
+ /**
123
+ * URL to dashboard or control panel
124
+ */
125
+ dashboardUrl?: string;
126
+ /**
127
+ * Hide from UI listings
128
+ */
129
+ hidden?: boolean;
130
+ };
131
+ /**
132
+ * Performance characteristics
133
+ */
134
+ performance?: {
135
+ /**
136
+ * Estimated memory usage
137
+ */
138
+ memoryUsage?: 'low' | 'medium' | 'high';
139
+ /**
140
+ * CPU intensity
141
+ */
142
+ cpuUsage?: 'low' | 'medium' | 'high';
143
+ /**
144
+ * Network usage
145
+ */
146
+ networkUsage?: 'none' | 'low' | 'medium' | 'high';
147
+ };
148
+ /**
149
+ * Feature flags this augmentation provides
150
+ */
151
+ features?: string[];
152
+ /**
153
+ * Operations this augmentation enhances
154
+ */
155
+ enhancedOperations?: string[];
156
+ /**
157
+ * Metrics this augmentation exposes
158
+ */
159
+ metrics?: Array<{
160
+ name: string;
161
+ type: 'counter' | 'gauge' | 'histogram';
162
+ description: string;
163
+ }>;
164
+ /**
165
+ * Status of the augmentation
166
+ */
167
+ status?: 'stable' | 'beta' | 'experimental' | 'deprecated';
168
+ /**
169
+ * Deprecation notice if applicable
170
+ */
171
+ deprecation?: {
172
+ since: string;
173
+ alternative?: string;
174
+ removalDate?: string;
175
+ };
176
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Augmentation Manifest Types
3
+ *
4
+ * Defines the manifest structure for augmentation discovery and configuration
5
+ * Enables tools like brain-cloud to discover and configure augmentations
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1,168 @@
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
+ }