@soulcraft/brainy 3.0.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.
- package/CHANGELOG.md +53 -3
- package/README.md +353 -110
- package/bin/brainy.js +340 -62
- package/dist/api/ConfigAPI.d.ts +67 -0
- package/dist/api/ConfigAPI.js +166 -0
- package/dist/api/DataAPI.d.ts +123 -0
- package/dist/api/DataAPI.js +391 -0
- package/dist/api/SecurityAPI.d.ts +50 -0
- package/dist/api/SecurityAPI.js +139 -0
- package/dist/api/UniversalImportAPI.d.ts +134 -0
- package/dist/api/UniversalImportAPI.js +615 -0
- package/dist/augmentationManager.js +12 -7
- package/dist/augmentationPipeline.d.ts +0 -61
- package/dist/augmentationPipeline.js +0 -87
- package/dist/augmentationRegistry.d.ts +1 -1
- package/dist/augmentationRegistry.js +1 -1
- package/dist/augmentations/apiServerAugmentation.d.ts +27 -1
- package/dist/augmentations/apiServerAugmentation.js +290 -9
- package/dist/augmentations/auditLogAugmentation.d.ts +109 -0
- package/dist/augmentations/auditLogAugmentation.js +358 -0
- package/dist/augmentations/batchProcessingAugmentation.d.ts +3 -2
- package/dist/augmentations/batchProcessingAugmentation.js +123 -22
- package/dist/augmentations/brainyAugmentation.d.ts +142 -8
- package/dist/augmentations/brainyAugmentation.js +179 -2
- package/dist/augmentations/cacheAugmentation.d.ts +8 -5
- package/dist/augmentations/cacheAugmentation.js +116 -17
- package/dist/augmentations/conduitAugmentations.d.ts +2 -2
- package/dist/augmentations/conduitAugmentations.js +2 -2
- package/dist/augmentations/configResolver.d.ts +122 -0
- package/dist/augmentations/configResolver.js +440 -0
- package/dist/augmentations/connectionPoolAugmentation.d.ts +3 -1
- package/dist/augmentations/connectionPoolAugmentation.js +37 -12
- package/dist/augmentations/defaultAugmentations.d.ts +14 -10
- package/dist/augmentations/defaultAugmentations.js +16 -11
- package/dist/augmentations/discovery/catalogDiscovery.d.ts +142 -0
- package/dist/augmentations/discovery/catalogDiscovery.js +249 -0
- package/dist/augmentations/discovery/localDiscovery.d.ts +84 -0
- package/dist/augmentations/discovery/localDiscovery.js +246 -0
- package/dist/augmentations/discovery/runtimeLoader.d.ts +97 -0
- package/dist/augmentations/discovery/runtimeLoader.js +337 -0
- package/dist/augmentations/discovery.d.ts +152 -0
- package/dist/augmentations/discovery.js +441 -0
- package/dist/augmentations/display/cache.d.ts +130 -0
- package/dist/augmentations/display/cache.js +319 -0
- package/dist/augmentations/display/fieldPatterns.d.ts +52 -0
- package/dist/augmentations/display/fieldPatterns.js +393 -0
- package/dist/augmentations/display/iconMappings.d.ts +57 -0
- package/dist/augmentations/display/iconMappings.js +68 -0
- package/dist/augmentations/display/intelligentComputation.d.ts +109 -0
- package/dist/augmentations/display/intelligentComputation.js +462 -0
- package/dist/augmentations/display/types.d.ts +203 -0
- package/dist/augmentations/display/types.js +7 -0
- package/dist/augmentations/entityRegistryAugmentation.d.ts +3 -1
- package/dist/augmentations/entityRegistryAugmentation.js +5 -1
- package/dist/augmentations/indexAugmentation.d.ts +5 -3
- package/dist/augmentations/indexAugmentation.js +5 -2
- package/dist/augmentations/intelligentVerbScoringAugmentation.d.ts +24 -7
- package/dist/augmentations/intelligentVerbScoringAugmentation.js +111 -27
- package/dist/augmentations/manifest.d.ts +176 -0
- package/dist/augmentations/manifest.js +8 -0
- package/dist/augmentations/marketplace/AugmentationMarketplace.d.ts +168 -0
- package/dist/augmentations/marketplace/AugmentationMarketplace.js +329 -0
- package/dist/augmentations/marketplace/cli.d.ts +47 -0
- package/dist/augmentations/marketplace/cli.js +265 -0
- package/dist/augmentations/metricsAugmentation.d.ts +3 -3
- package/dist/augmentations/metricsAugmentation.js +2 -2
- package/dist/augmentations/monitoringAugmentation.d.ts +3 -3
- package/dist/augmentations/monitoringAugmentation.js +2 -2
- package/dist/augmentations/neuralImport.d.ts +1 -1
- package/dist/augmentations/neuralImport.js +4 -4
- package/dist/augmentations/rateLimitAugmentation.d.ts +82 -0
- package/dist/augmentations/rateLimitAugmentation.js +321 -0
- package/dist/augmentations/requestDeduplicatorAugmentation.d.ts +2 -2
- package/dist/augmentations/requestDeduplicatorAugmentation.js +1 -1
- package/dist/augmentations/storageAugmentation.d.ts +1 -1
- package/dist/augmentations/storageAugmentation.js +2 -2
- package/dist/augmentations/storageAugmentations.d.ts +37 -8
- package/dist/augmentations/storageAugmentations.js +204 -15
- package/dist/augmentations/synapseAugmentation.d.ts +1 -1
- package/dist/augmentations/synapseAugmentation.js +35 -16
- package/dist/augmentations/typeMatching/brainyTypes.d.ts +83 -0
- package/dist/augmentations/typeMatching/brainyTypes.js +425 -0
- package/dist/augmentations/typeMatching/intelligentTypeMatcher.d.ts +39 -59
- package/dist/augmentations/typeMatching/intelligentTypeMatcher.js +103 -389
- package/dist/augmentations/universalDisplayAugmentation.d.ts +191 -0
- package/dist/augmentations/universalDisplayAugmentation.js +371 -0
- package/dist/brainy-unified.d.ts +106 -0
- package/dist/brainy-unified.js +327 -0
- package/dist/brainy.d.ts +273 -0
- package/dist/brainy.js +1181 -0
- package/dist/brainyData.d.ts +56 -111
- package/dist/brainyData.js +912 -756
- package/dist/brainyDataV3.d.ts +186 -0
- package/dist/brainyDataV3.js +337 -0
- package/dist/browserFramework.d.ts +6 -6
- package/dist/browserFramework.js +11 -8
- package/dist/browserFramework.minimal.d.ts +5 -5
- package/dist/browserFramework.minimal.js +11 -8
- package/dist/config/distributedPresets-new.d.ts +118 -0
- package/dist/config/distributedPresets-new.js +318 -0
- package/dist/config/distributedPresets.d.ts +118 -0
- package/dist/config/distributedPresets.js +318 -0
- package/dist/config/extensibleConfig.d.ts +99 -0
- package/dist/config/extensibleConfig.js +268 -0
- package/dist/config/index.d.ts +17 -0
- package/dist/config/index.js +35 -0
- package/dist/config/modelAutoConfig.d.ts +32 -0
- package/dist/config/modelAutoConfig.js +139 -0
- package/dist/config/modelPrecisionManager.d.ts +42 -0
- package/dist/config/modelPrecisionManager.js +98 -0
- package/dist/config/sharedConfigManager.d.ts +67 -0
- package/dist/config/sharedConfigManager.js +215 -0
- package/dist/config/storageAutoConfig.d.ts +41 -0
- package/dist/config/storageAutoConfig.js +328 -0
- package/dist/config/zeroConfig.d.ts +68 -0
- package/dist/config/zeroConfig.js +301 -0
- package/dist/cortex/backupRestore.d.ts +2 -2
- package/dist/cortex/backupRestore.js +85 -27
- package/dist/cortex/healthCheck.d.ts +2 -2
- package/dist/cortex/neuralImport.d.ts +2 -2
- package/dist/cortex/neuralImport.js +18 -13
- package/dist/cortex/performanceMonitor.d.ts +2 -2
- package/dist/critical/model-guardian.d.ts +4 -0
- package/dist/critical/model-guardian.js +31 -11
- package/dist/demo.d.ts +4 -4
- package/dist/demo.js +7 -7
- package/dist/distributed/cacheSync.d.ts +112 -0
- package/dist/distributed/cacheSync.js +265 -0
- package/dist/distributed/coordinator.d.ts +193 -0
- package/dist/distributed/coordinator.js +548 -0
- package/dist/distributed/httpTransport.d.ts +120 -0
- package/dist/distributed/httpTransport.js +446 -0
- package/dist/distributed/index.d.ts +8 -0
- package/dist/distributed/index.js +5 -0
- package/dist/distributed/networkTransport.d.ts +132 -0
- package/dist/distributed/networkTransport.js +633 -0
- package/dist/distributed/queryPlanner.d.ts +104 -0
- package/dist/distributed/queryPlanner.js +327 -0
- package/dist/distributed/readWriteSeparation.d.ts +134 -0
- package/dist/distributed/readWriteSeparation.js +350 -0
- package/dist/distributed/shardManager.d.ts +114 -0
- package/dist/distributed/shardManager.js +357 -0
- package/dist/distributed/shardMigration.d.ts +110 -0
- package/dist/distributed/shardMigration.js +289 -0
- package/dist/distributed/storageDiscovery.d.ts +160 -0
- package/dist/distributed/storageDiscovery.js +551 -0
- package/dist/embeddings/CachedEmbeddings.d.ts +40 -0
- package/dist/embeddings/CachedEmbeddings.js +146 -0
- package/dist/embeddings/EmbeddingManager.d.ts +102 -0
- package/dist/embeddings/EmbeddingManager.js +291 -0
- package/dist/embeddings/SingletonModelManager.d.ts +95 -0
- package/dist/embeddings/SingletonModelManager.js +220 -0
- package/dist/embeddings/index.d.ts +12 -0
- package/dist/embeddings/index.js +16 -0
- package/dist/embeddings/lightweight-embedder.d.ts +0 -1
- package/dist/embeddings/lightweight-embedder.js +4 -12
- package/dist/embeddings/model-manager.d.ts +11 -0
- package/dist/embeddings/model-manager.js +43 -7
- package/dist/embeddings/universal-memory-manager.d.ts +1 -1
- package/dist/embeddings/universal-memory-manager.js +27 -67
- package/dist/embeddings/worker-embedding.js +4 -8
- package/dist/errors/brainyError.d.ts +5 -1
- package/dist/errors/brainyError.js +12 -0
- package/dist/examples/basicUsage.js +7 -4
- package/dist/graph/graphAdjacencyIndex.d.ts +96 -0
- package/dist/graph/graphAdjacencyIndex.js +288 -0
- package/dist/graph/pathfinding.js +4 -2
- package/dist/hnsw/scaledHNSWSystem.js +11 -2
- package/dist/importManager.js +8 -5
- package/dist/index.d.ts +17 -22
- package/dist/index.js +37 -23
- package/dist/mcp/brainyMCPAdapter.d.ts +4 -4
- package/dist/mcp/brainyMCPAdapter.js +5 -5
- package/dist/mcp/brainyMCPService.d.ts +3 -3
- package/dist/mcp/brainyMCPService.js +3 -11
- package/dist/mcp/mcpAugmentationToolset.js +20 -30
- package/dist/neural/embeddedPatterns.d.ts +1 -1
- package/dist/neural/embeddedPatterns.js +2 -2
- package/dist/neural/entityExtractor.d.ts +65 -0
- package/dist/neural/entityExtractor.js +316 -0
- package/dist/neural/improvedNeuralAPI.d.ts +357 -0
- package/dist/neural/improvedNeuralAPI.js +2628 -0
- package/dist/neural/naturalLanguageProcessor.d.ts +155 -10
- package/dist/neural/naturalLanguageProcessor.js +941 -66
- package/dist/neural/naturalLanguageProcessorStatic.d.ts +2 -2
- package/dist/neural/naturalLanguageProcessorStatic.js +3 -3
- package/dist/neural/neuralAPI.js +8 -2
- package/dist/neural/patternLibrary.d.ts +57 -3
- package/dist/neural/patternLibrary.js +348 -13
- package/dist/neural/staticPatternMatcher.d.ts +2 -2
- package/dist/neural/staticPatternMatcher.js +2 -2
- package/dist/neural/types.d.ts +287 -0
- package/dist/neural/types.js +24 -0
- package/dist/shared/default-augmentations.d.ts +3 -3
- package/dist/shared/default-augmentations.js +5 -5
- package/dist/storage/adapters/baseStorageAdapter.d.ts +42 -0
- package/dist/storage/adapters/fileSystemStorage.d.ts +26 -2
- package/dist/storage/adapters/fileSystemStorage.js +218 -15
- package/dist/storage/adapters/memoryStorage.d.ts +4 -4
- package/dist/storage/adapters/memoryStorage.js +17 -12
- package/dist/storage/adapters/opfsStorage.d.ts +2 -2
- package/dist/storage/adapters/opfsStorage.js +2 -2
- package/dist/storage/adapters/s3CompatibleStorage.d.ts +2 -2
- package/dist/storage/adapters/s3CompatibleStorage.js +2 -2
- package/dist/storage/backwardCompatibility.d.ts +10 -78
- package/dist/storage/backwardCompatibility.js +17 -132
- package/dist/storage/baseStorage.d.ts +18 -2
- package/dist/storage/baseStorage.js +74 -3
- package/dist/storage/cacheManager.js +2 -2
- package/dist/storage/readOnlyOptimizations.js +8 -3
- package/dist/streaming/pipeline.d.ts +154 -0
- package/dist/streaming/pipeline.js +551 -0
- package/dist/triple/TripleIntelligence.d.ts +25 -110
- package/dist/triple/TripleIntelligence.js +4 -574
- package/dist/triple/TripleIntelligenceSystem.d.ts +159 -0
- package/dist/triple/TripleIntelligenceSystem.js +519 -0
- package/dist/types/apiTypes.d.ts +278 -0
- package/dist/types/apiTypes.js +33 -0
- package/dist/types/brainy.types.d.ts +308 -0
- package/dist/types/brainy.types.js +8 -0
- package/dist/types/brainyDataInterface.d.ts +5 -8
- package/dist/types/brainyDataInterface.js +2 -2
- package/dist/types/graphTypes.js +2 -2
- package/dist/utils/brainyTypes.d.ts +217 -0
- package/dist/utils/brainyTypes.js +261 -0
- package/dist/utils/cacheAutoConfig.d.ts +3 -3
- package/dist/utils/embedding.d.ts +9 -4
- package/dist/utils/embedding.js +89 -26
- package/dist/utils/enhancedLogger.d.ts +104 -0
- package/dist/utils/enhancedLogger.js +232 -0
- package/dist/utils/hybridModelManager.d.ts +19 -28
- package/dist/utils/hybridModelManager.js +36 -200
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/intelligentTypeMapper.d.ts +60 -0
- package/dist/utils/intelligentTypeMapper.js +349 -0
- package/dist/utils/metadataIndex.d.ts +118 -1
- package/dist/utils/metadataIndex.js +539 -16
- package/dist/utils/nodeVersionCheck.d.ts +24 -0
- package/dist/utils/nodeVersionCheck.js +65 -0
- package/dist/utils/paramValidation.d.ts +39 -0
- package/dist/utils/paramValidation.js +192 -0
- package/dist/utils/rateLimiter.d.ts +160 -0
- package/dist/utils/rateLimiter.js +271 -0
- package/dist/utils/statistics.d.ts +4 -4
- package/dist/utils/statistics.js +3 -3
- package/dist/utils/structuredLogger.d.ts +146 -0
- package/dist/utils/structuredLogger.js +394 -0
- package/dist/utils/textEncoding.js +2 -1
- package/dist/utils/typeValidation.d.ts +59 -0
- package/dist/utils/typeValidation.js +374 -0
- package/dist/utils/version.js +19 -3
- package/package.json +15 -4
- package/scripts/download-models.cjs +94 -20
- package/dist/augmentations/walAugmentation.d.ts +0 -109
- package/dist/augmentations/walAugmentation.js +0 -516
- package/dist/chat/BrainyChat.d.ts +0 -121
- package/dist/chat/BrainyChat.js +0 -396
- package/dist/chat/ChatCLI.d.ts +0 -61
- package/dist/chat/ChatCLI.js +0 -351
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Augmentation Marketplace CLI Commands
|
|
3
|
+
*
|
|
4
|
+
* Provides command-line interface for managing augmentations
|
|
5
|
+
* Similar to npm/yarn but for Brainy augmentations
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Format augmentation for display
|
|
9
|
+
*/
|
|
10
|
+
function formatAugmentation(aug) {
|
|
11
|
+
const price = aug.price ? `$${aug.price}` : 'Free';
|
|
12
|
+
const rating = '⭐'.repeat(Math.round(aug.rating));
|
|
13
|
+
return `
|
|
14
|
+
${aug.displayName} v${aug.version} by ${aug.author}
|
|
15
|
+
${aug.description}
|
|
16
|
+
Category: ${aug.category} | Price: ${price} | Rating: ${rating} (${aug.reviews} reviews)
|
|
17
|
+
Downloads: ${aug.downloads.toLocaleString()} | Size: ${formatBytes(aug.size)}
|
|
18
|
+
Tags: ${aug.tags.join(', ')}
|
|
19
|
+
`.trim();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Format bytes to human readable
|
|
23
|
+
*/
|
|
24
|
+
function formatBytes(bytes) {
|
|
25
|
+
if (bytes < 1024)
|
|
26
|
+
return bytes + ' B';
|
|
27
|
+
if (bytes < 1024 * 1024)
|
|
28
|
+
return (bytes / 1024).toFixed(1) + ' KB';
|
|
29
|
+
if (bytes < 1024 * 1024 * 1024)
|
|
30
|
+
return (bytes / 1024 / 1024).toFixed(1) + ' MB';
|
|
31
|
+
return (bytes / 1024 / 1024 / 1024).toFixed(1) + ' GB';
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* List installed augmentations
|
|
35
|
+
*/
|
|
36
|
+
export async function listCommand(marketplace) {
|
|
37
|
+
const installed = marketplace.getInstalled();
|
|
38
|
+
if (installed.length === 0) {
|
|
39
|
+
console.log('No augmentations installed');
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
console.log('\nInstalled Augmentations:');
|
|
43
|
+
console.log('========================\n');
|
|
44
|
+
for (const aug of installed) {
|
|
45
|
+
const status = aug.enabled ? '✅ Enabled' : '❌ Disabled';
|
|
46
|
+
const autoUpdate = aug.autoUpdate ? '🔄' : '';
|
|
47
|
+
console.log(`${aug.name} v${aug.version} ${status} ${autoUpdate}`);
|
|
48
|
+
console.log(` Installed: ${new Date(aug.installedAt).toLocaleDateString()}`);
|
|
49
|
+
console.log(` From: ${aug.installedFrom}`);
|
|
50
|
+
if (aug.cloudId) {
|
|
51
|
+
console.log(` Cloud ID: ${aug.cloudId}`);
|
|
52
|
+
}
|
|
53
|
+
console.log('');
|
|
54
|
+
}
|
|
55
|
+
// Check for updates
|
|
56
|
+
console.log('Checking for updates...');
|
|
57
|
+
const updates = await marketplace.checkForUpdates();
|
|
58
|
+
if (updates.length > 0) {
|
|
59
|
+
console.log(`\n⚠️ ${updates.length} update(s) available:`);
|
|
60
|
+
for (const update of updates) {
|
|
61
|
+
console.log(` ${update.augmentation.name}: ${update.augmentation.version} → ${update.newVersion}`);
|
|
62
|
+
}
|
|
63
|
+
console.log('\nRun "brainy augment update <name>" to update');
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
console.log('All augmentations are up to date ✨');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Search cloud registry
|
|
71
|
+
*/
|
|
72
|
+
export async function searchCommand(marketplace, query, options = {}) {
|
|
73
|
+
console.log(`Searching for "${query}"...`);
|
|
74
|
+
const filters = {};
|
|
75
|
+
if (options.category)
|
|
76
|
+
filters.category = options.category;
|
|
77
|
+
if (options.free !== undefined)
|
|
78
|
+
filters.free = options.free;
|
|
79
|
+
const results = await marketplace.searchCloud(query, filters, 1, options.limit || 10);
|
|
80
|
+
if (results.total === 0) {
|
|
81
|
+
console.log('No augmentations found');
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
console.log(`\nFound ${results.total} augmentation(s):`);
|
|
85
|
+
console.log('================================\n');
|
|
86
|
+
for (const aug of results.results) {
|
|
87
|
+
console.log(formatAugmentation(aug));
|
|
88
|
+
console.log('---');
|
|
89
|
+
}
|
|
90
|
+
if (results.pages > 1) {
|
|
91
|
+
console.log(`\nShowing page ${results.page} of ${results.pages}`);
|
|
92
|
+
console.log('Use --page flag to see more results');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Show augmentation details
|
|
97
|
+
*/
|
|
98
|
+
export async function infoCommand(marketplace, nameOrId) {
|
|
99
|
+
// Check if it's installed locally first
|
|
100
|
+
const installed = marketplace.getInstalled().find(a => a.name === nameOrId);
|
|
101
|
+
if (installed) {
|
|
102
|
+
console.log('\n📦 Installed Augmentation:');
|
|
103
|
+
console.log('=========================\n');
|
|
104
|
+
console.log(`Name: ${installed.name}`);
|
|
105
|
+
console.log(`Version: ${installed.version}`);
|
|
106
|
+
console.log(`Status: ${installed.enabled ? 'Enabled' : 'Disabled'}`);
|
|
107
|
+
console.log(`Auto-update: ${installed.autoUpdate ? 'Yes' : 'No'}`);
|
|
108
|
+
console.log(`Installed: ${new Date(installed.installedAt).toLocaleString()}`);
|
|
109
|
+
console.log(`Path: ${installed.path}`);
|
|
110
|
+
if (installed.cloudId) {
|
|
111
|
+
console.log('\nFetching cloud details...');
|
|
112
|
+
try {
|
|
113
|
+
const cloudAug = await marketplace.getCloudDetails(installed.cloudId);
|
|
114
|
+
console.log('\n' + formatAugmentation(cloudAug));
|
|
115
|
+
if (cloudAug.documentationUrl) {
|
|
116
|
+
console.log(`\n📚 Documentation: ${cloudAug.documentationUrl}`);
|
|
117
|
+
}
|
|
118
|
+
if (cloudAug.repositoryUrl) {
|
|
119
|
+
console.log(`📦 Repository: ${cloudAug.repositoryUrl}`);
|
|
120
|
+
}
|
|
121
|
+
if (cloudAug.supportUrl) {
|
|
122
|
+
console.log(`🆘 Support: ${cloudAug.supportUrl}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
console.log('Could not fetch cloud details');
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
// Try to find in cloud
|
|
132
|
+
try {
|
|
133
|
+
const cloudAug = await marketplace.getCloudDetails(nameOrId);
|
|
134
|
+
console.log('\n☁️ Cloud Augmentation:');
|
|
135
|
+
console.log('=====================\n');
|
|
136
|
+
console.log(formatAugmentation(cloudAug));
|
|
137
|
+
if (cloudAug.longDescription) {
|
|
138
|
+
console.log(`\n${cloudAug.longDescription}`);
|
|
139
|
+
}
|
|
140
|
+
if (cloudAug.requirements.length > 0) {
|
|
141
|
+
console.log('\n📋 Requirements:');
|
|
142
|
+
cloudAug.requirements.forEach(req => console.log(` - ${req}`));
|
|
143
|
+
}
|
|
144
|
+
if (cloudAug.permissions.length > 0) {
|
|
145
|
+
console.log('\n🔐 Permissions:');
|
|
146
|
+
cloudAug.permissions.forEach(perm => console.log(` - ${perm}`));
|
|
147
|
+
}
|
|
148
|
+
if (cloudAug.documentationUrl) {
|
|
149
|
+
console.log(`\n📚 Documentation: ${cloudAug.documentationUrl}`);
|
|
150
|
+
}
|
|
151
|
+
if (cloudAug.repositoryUrl) {
|
|
152
|
+
console.log(`📦 Repository: ${cloudAug.repositoryUrl}`);
|
|
153
|
+
}
|
|
154
|
+
if (cloudAug.supportUrl) {
|
|
155
|
+
console.log(`🆘 Support: ${cloudAug.supportUrl}`);
|
|
156
|
+
}
|
|
157
|
+
console.log('\nTo install, run: brainy augment install ' + nameOrId);
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
console.error(`Augmentation "${nameOrId}" not found`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Install augmentation
|
|
166
|
+
*/
|
|
167
|
+
export async function installCommand(marketplace, nameOrId, options = {}) {
|
|
168
|
+
console.log(`Installing ${nameOrId}...`);
|
|
169
|
+
try {
|
|
170
|
+
const installed = await marketplace.installFromCloud(nameOrId, {
|
|
171
|
+
version: options.version,
|
|
172
|
+
enable: !options.noEnable,
|
|
173
|
+
autoUpdate: !options.noAutoUpdate
|
|
174
|
+
});
|
|
175
|
+
console.log(`✅ Successfully installed ${installed.name} v${installed.version}`);
|
|
176
|
+
if (installed.enabled) {
|
|
177
|
+
console.log(' Augmentation is enabled and ready to use');
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
console.log(' Run "brainy augment enable ' + installed.name + '" to enable');
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
console.error(`❌ Failed to install: ${error.message}`);
|
|
185
|
+
process.exit(1);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Uninstall augmentation
|
|
190
|
+
*/
|
|
191
|
+
export async function uninstallCommand(marketplace, name) {
|
|
192
|
+
console.log(`Uninstalling ${name}...`);
|
|
193
|
+
try {
|
|
194
|
+
await marketplace.uninstall(name);
|
|
195
|
+
console.log(`✅ Successfully uninstalled ${name}`);
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
console.error(`❌ Failed to uninstall: ${error.message}`);
|
|
199
|
+
process.exit(1);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Enable augmentation
|
|
204
|
+
*/
|
|
205
|
+
export async function enableCommand(marketplace, name) {
|
|
206
|
+
try {
|
|
207
|
+
await marketplace.enable(name);
|
|
208
|
+
console.log(`✅ Enabled ${name}`);
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
console.error(`❌ Failed to enable: ${error.message}`);
|
|
212
|
+
process.exit(1);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Disable augmentation
|
|
217
|
+
*/
|
|
218
|
+
export async function disableCommand(marketplace, name) {
|
|
219
|
+
try {
|
|
220
|
+
await marketplace.disable(name);
|
|
221
|
+
console.log(`✅ Disabled ${name}`);
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
console.error(`❌ Failed to disable: ${error.message}`);
|
|
225
|
+
process.exit(1);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Update augmentation
|
|
230
|
+
*/
|
|
231
|
+
export async function updateCommand(marketplace, name) {
|
|
232
|
+
if (name) {
|
|
233
|
+
// Update specific augmentation
|
|
234
|
+
console.log(`Updating ${name}...`);
|
|
235
|
+
try {
|
|
236
|
+
await marketplace.update(name);
|
|
237
|
+
console.log(`✅ Successfully updated ${name}`);
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
console.error(`❌ Failed to update: ${error.message}`);
|
|
241
|
+
process.exit(1);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
// Update all augmentations
|
|
246
|
+
console.log('Checking for updates...');
|
|
247
|
+
const updates = await marketplace.checkForUpdates();
|
|
248
|
+
if (updates.length === 0) {
|
|
249
|
+
console.log('All augmentations are up to date ✨');
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
console.log(`Found ${updates.length} update(s)`);
|
|
253
|
+
for (const update of updates) {
|
|
254
|
+
console.log(`\nUpdating ${update.augmentation.name}: ${update.augmentation.version} → ${update.newVersion}`);
|
|
255
|
+
try {
|
|
256
|
+
await marketplace.update(update.augmentation.name);
|
|
257
|
+
console.log(`✅ Updated successfully`);
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
console.error(`❌ Failed: ${error.message}`);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Metrics Augmentation - Optional Performance & Usage Metrics
|
|
3
3
|
*
|
|
4
|
-
* Replaces the hardcoded StatisticsCollector in
|
|
4
|
+
* Replaces the hardcoded StatisticsCollector in Brainy with an optional augmentation.
|
|
5
5
|
* Tracks performance metrics, usage patterns, and system statistics.
|
|
6
6
|
*
|
|
7
7
|
* Zero-config: Automatically enabled for observability
|
|
@@ -30,10 +30,10 @@ export declare class MetricsAugmentation extends BaseAugmentation {
|
|
|
30
30
|
readonly metadata: "readonly";
|
|
31
31
|
readonly name = "metrics";
|
|
32
32
|
readonly timing: "after";
|
|
33
|
-
operations: ("add" | "search" | "delete" | "clear" | "all")[];
|
|
33
|
+
operations: ("add" | "update" | "search" | "find" | "similar" | "delete" | "relate" | "unrelate" | "clear" | "all")[];
|
|
34
34
|
readonly priority = 40;
|
|
35
35
|
private statisticsCollector;
|
|
36
|
-
|
|
36
|
+
protected config: MetricsConfig;
|
|
37
37
|
private metricsTimer;
|
|
38
38
|
constructor(config?: MetricsConfig);
|
|
39
39
|
protected onInitialize(): Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Metrics Augmentation - Optional Performance & Usage Metrics
|
|
3
3
|
*
|
|
4
|
-
* Replaces the hardcoded StatisticsCollector in
|
|
4
|
+
* Replaces the hardcoded StatisticsCollector in Brainy with an optional augmentation.
|
|
5
5
|
* Tracks performance metrics, usage patterns, and system statistics.
|
|
6
6
|
*
|
|
7
7
|
* Zero-config: Automatically enabled for observability
|
|
@@ -24,7 +24,7 @@ export class MetricsAugmentation extends BaseAugmentation {
|
|
|
24
24
|
this.metadata = 'readonly'; // Reads metadata for metrics
|
|
25
25
|
this.name = 'metrics';
|
|
26
26
|
this.timing = 'after';
|
|
27
|
-
this.operations = ['add', 'search', 'delete', 'clear', 'all'];
|
|
27
|
+
this.operations = ['add', 'update', 'search', 'find', 'similar', 'delete', 'relate', 'unrelate', 'clear', 'all'];
|
|
28
28
|
this.priority = 40; // Low priority, runs after other augmentations
|
|
29
29
|
this.statisticsCollector = null;
|
|
30
30
|
this.metricsTimer = null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Monitoring Augmentation - Optional Health & Performance Monitoring
|
|
3
3
|
*
|
|
4
|
-
* Replaces the hardcoded HealthMonitor in
|
|
4
|
+
* Replaces the hardcoded HealthMonitor in Brainy with an optional augmentation.
|
|
5
5
|
* Provides health checks, performance monitoring, and distributed system tracking.
|
|
6
6
|
*
|
|
7
7
|
* Zero-config: Automatically enabled for distributed deployments
|
|
@@ -31,11 +31,11 @@ export declare class MonitoringAugmentation extends BaseAugmentation {
|
|
|
31
31
|
readonly metadata: "readonly";
|
|
32
32
|
readonly name = "monitoring";
|
|
33
33
|
readonly timing: "after";
|
|
34
|
-
operations: ("search" | "add" | "delete" | "all")[];
|
|
34
|
+
operations: ("search" | "find" | "similar" | "add" | "update" | "delete" | "relate" | "unrelate" | "all")[];
|
|
35
35
|
readonly priority = 30;
|
|
36
36
|
private healthMonitor;
|
|
37
37
|
private configManager;
|
|
38
|
-
|
|
38
|
+
protected config: MonitoringConfig;
|
|
39
39
|
private requestStartTimes;
|
|
40
40
|
constructor(config?: MonitoringConfig);
|
|
41
41
|
protected onInitialize(): Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Monitoring Augmentation - Optional Health & Performance Monitoring
|
|
3
3
|
*
|
|
4
|
-
* Replaces the hardcoded HealthMonitor in
|
|
4
|
+
* Replaces the hardcoded HealthMonitor in Brainy with an optional augmentation.
|
|
5
5
|
* Provides health checks, performance monitoring, and distributed system tracking.
|
|
6
6
|
*
|
|
7
7
|
* Zero-config: Automatically enabled for distributed deployments
|
|
@@ -26,7 +26,7 @@ export class MonitoringAugmentation extends BaseAugmentation {
|
|
|
26
26
|
this.metadata = 'readonly'; // Reads metadata for monitoring
|
|
27
27
|
this.name = 'monitoring';
|
|
28
28
|
this.timing = 'after';
|
|
29
|
-
this.operations = ['search', 'add', 'delete', 'all'];
|
|
29
|
+
this.operations = ['search', 'find', 'similar', 'add', 'update', 'delete', 'relate', 'unrelate', 'all'];
|
|
30
30
|
this.priority = 30; // Low priority, observability layer
|
|
31
31
|
this.healthMonitor = null;
|
|
32
32
|
this.configManager = null;
|
|
@@ -61,7 +61,7 @@ export declare class NeuralImportAugmentation extends BaseAugmentation {
|
|
|
61
61
|
};
|
|
62
62
|
operations: ("add" | "addNoun" | "addVerb" | "all")[];
|
|
63
63
|
readonly priority = 80;
|
|
64
|
-
|
|
64
|
+
protected config: NeuralImportConfig;
|
|
65
65
|
private analysisCache;
|
|
66
66
|
private typeMatcher;
|
|
67
67
|
constructor(config?: Partial<NeuralImportConfig>);
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { BaseAugmentation } from './brainyAugmentation.js';
|
|
10
10
|
import * as path from '../universal/path.js';
|
|
11
|
-
import {
|
|
11
|
+
import { getBrainyTypes } from './typeMatching/brainyTypes.js';
|
|
12
12
|
import { prodLog } from '../utils/logger.js';
|
|
13
13
|
/**
|
|
14
14
|
* Neural Import Augmentation - Unified Implementation
|
|
@@ -37,7 +37,7 @@ export class NeuralImportAugmentation extends BaseAugmentation {
|
|
|
37
37
|
}
|
|
38
38
|
async onInitialize() {
|
|
39
39
|
try {
|
|
40
|
-
this.typeMatcher = await
|
|
40
|
+
this.typeMatcher = await getBrainyTypes();
|
|
41
41
|
this.log('🧠 Neural Import augmentation initialized with intelligent type matching');
|
|
42
42
|
}
|
|
43
43
|
catch (error) {
|
|
@@ -378,7 +378,7 @@ export class NeuralImportAugmentation extends BaseAugmentation {
|
|
|
378
378
|
async inferNounType(obj) {
|
|
379
379
|
if (!this.typeMatcher) {
|
|
380
380
|
// Initialize type matcher if not available
|
|
381
|
-
this.typeMatcher = await
|
|
381
|
+
this.typeMatcher = await getBrainyTypes();
|
|
382
382
|
}
|
|
383
383
|
const result = await this.typeMatcher.matchNounType(obj);
|
|
384
384
|
// Log if confidence is low for debugging
|
|
@@ -428,7 +428,7 @@ export class NeuralImportAugmentation extends BaseAugmentation {
|
|
|
428
428
|
async inferVerbType(fieldName, sourceObj, targetObj) {
|
|
429
429
|
if (!this.typeMatcher) {
|
|
430
430
|
// Initialize type matcher if not available
|
|
431
|
-
this.typeMatcher = await
|
|
431
|
+
this.typeMatcher = await getBrainyTypes();
|
|
432
432
|
}
|
|
433
433
|
const result = await this.typeMatcher.matchVerbType(sourceObj, targetObj, fieldName);
|
|
434
434
|
// Log if confidence is low for debugging
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rate Limiting Augmentation
|
|
3
|
+
* Provides configurable rate limiting for Brainy operations
|
|
4
|
+
*/
|
|
5
|
+
import { BaseAugmentation } from './brainyAugmentation.js';
|
|
6
|
+
import { AugmentationManifest } from './manifest.js';
|
|
7
|
+
export interface RateLimitConfig {
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
limits?: {
|
|
10
|
+
searches?: number;
|
|
11
|
+
writes?: number;
|
|
12
|
+
reads?: number;
|
|
13
|
+
deletes?: number;
|
|
14
|
+
};
|
|
15
|
+
windowMs?: number;
|
|
16
|
+
skipSuccessfulRequests?: boolean;
|
|
17
|
+
skipFailedRequests?: boolean;
|
|
18
|
+
keyGenerator?: (context: any) => string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Rate Limit Augmentation
|
|
22
|
+
*/
|
|
23
|
+
export declare class RateLimitAugmentation extends BaseAugmentation {
|
|
24
|
+
readonly name = "rateLimiter";
|
|
25
|
+
readonly timing: "before";
|
|
26
|
+
readonly metadata: "none";
|
|
27
|
+
operations: any;
|
|
28
|
+
readonly priority = 10;
|
|
29
|
+
readonly category: "core";
|
|
30
|
+
readonly description = "Provides rate limiting for Brainy operations";
|
|
31
|
+
private limiters;
|
|
32
|
+
private windowMs;
|
|
33
|
+
constructor(config?: RateLimitConfig);
|
|
34
|
+
getManifest(): AugmentationManifest;
|
|
35
|
+
/**
|
|
36
|
+
* Initialize rate limiters for each operation type
|
|
37
|
+
*/
|
|
38
|
+
private initializeLimiters;
|
|
39
|
+
/**
|
|
40
|
+
* Default key generator (could be IP, user ID, etc.)
|
|
41
|
+
*/
|
|
42
|
+
private defaultKeyGenerator;
|
|
43
|
+
/**
|
|
44
|
+
* Check if request should be rate limited
|
|
45
|
+
*/
|
|
46
|
+
private checkRateLimit;
|
|
47
|
+
/**
|
|
48
|
+
* Get remaining requests for an operation
|
|
49
|
+
*/
|
|
50
|
+
private getRemainingRequests;
|
|
51
|
+
/**
|
|
52
|
+
* Get time until reset
|
|
53
|
+
*/
|
|
54
|
+
private getResetTime;
|
|
55
|
+
protected onInitialize(): Promise<void>;
|
|
56
|
+
protected onShutdown(): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Execute augmentation - apply rate limiting
|
|
59
|
+
*/
|
|
60
|
+
execute<T = any>(operation: string, params: any, next: () => Promise<T>): Promise<T>;
|
|
61
|
+
/**
|
|
62
|
+
* Get rate limit statistics
|
|
63
|
+
*/
|
|
64
|
+
getStats(): {
|
|
65
|
+
operations: Record<string, {
|
|
66
|
+
activeKeys: number;
|
|
67
|
+
totalRequests: number;
|
|
68
|
+
}>;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Clear all rate limit entries
|
|
72
|
+
*/
|
|
73
|
+
clear(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Clear expired entries (cleanup)
|
|
76
|
+
*/
|
|
77
|
+
cleanup(): void;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Create rate limit augmentation
|
|
81
|
+
*/
|
|
82
|
+
export declare function createRateLimitAugmentation(config?: RateLimitConfig): RateLimitAugmentation;
|