@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
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* Default Augmentations Registration
|
|
3
3
|
*
|
|
4
4
|
* Maintains zero-config philosophy by automatically registering
|
|
5
|
-
* core augmentations that were previously hardcoded in
|
|
5
|
+
* core augmentations that were previously hardcoded in Brainy.
|
|
6
6
|
*
|
|
7
7
|
* These augmentations are optional but enabled by default for
|
|
8
8
|
* backward compatibility and optimal performance.
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
10
|
+
import { Brainy } from '../brainy.js';
|
|
11
11
|
import { BaseAugmentation } from './brainyAugmentation.js';
|
|
12
12
|
import { CacheAugmentation } from './cacheAugmentation.js';
|
|
13
|
-
import { IndexAugmentation } from './indexAugmentation.js';
|
|
14
13
|
import { MetricsAugmentation } from './metricsAugmentation.js';
|
|
15
14
|
import { MonitoringAugmentation } from './monitoringAugmentation.js';
|
|
15
|
+
import { UniversalDisplayAugmentation } from './universalDisplayAugmentation.js';
|
|
16
16
|
/**
|
|
17
17
|
* Create default augmentations for zero-config operation
|
|
18
18
|
* Returns an array of augmentations to be registered
|
|
@@ -22,14 +22,14 @@ import { MonitoringAugmentation } from './monitoringAugmentation.js';
|
|
|
22
22
|
*/
|
|
23
23
|
export declare function createDefaultAugmentations(config?: {
|
|
24
24
|
cache?: boolean | Record<string, any>;
|
|
25
|
-
index?: boolean | Record<string, any>;
|
|
26
25
|
metrics?: boolean | Record<string, any>;
|
|
27
26
|
monitoring?: boolean | Record<string, any>;
|
|
27
|
+
display?: boolean | Record<string, any>;
|
|
28
28
|
}): BaseAugmentation[];
|
|
29
29
|
/**
|
|
30
30
|
* Get augmentation by name with type safety
|
|
31
31
|
*/
|
|
32
|
-
export declare function getAugmentation<T>(brain:
|
|
32
|
+
export declare function getAugmentation<T>(brain: Brainy, name: string): T | null;
|
|
33
33
|
/**
|
|
34
34
|
* Compatibility helpers for migrating from hardcoded features
|
|
35
35
|
*/
|
|
@@ -37,17 +37,21 @@ export declare const AugmentationHelpers: {
|
|
|
37
37
|
/**
|
|
38
38
|
* Get cache augmentation
|
|
39
39
|
*/
|
|
40
|
-
getCache(brain:
|
|
40
|
+
getCache(brain: Brainy): CacheAugmentation | null;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Note: Index augmentation removed - metadata indexing is now core functionality
|
|
43
|
+
* Use brain.metadataIndex directly instead
|
|
43
44
|
*/
|
|
44
|
-
getIndex(brain: BrainyData): IndexAugmentation | null;
|
|
45
45
|
/**
|
|
46
46
|
* Get metrics augmentation
|
|
47
47
|
*/
|
|
48
|
-
getMetrics(brain:
|
|
48
|
+
getMetrics(brain: Brainy): MetricsAugmentation | null;
|
|
49
49
|
/**
|
|
50
50
|
* Get monitoring augmentation
|
|
51
51
|
*/
|
|
52
|
-
getMonitoring(brain:
|
|
52
|
+
getMonitoring(brain: Brainy): MonitoringAugmentation | null;
|
|
53
|
+
/**
|
|
54
|
+
* Get display augmentation
|
|
55
|
+
*/
|
|
56
|
+
getDisplay(brain: Brainy): UniversalDisplayAugmentation | null;
|
|
53
57
|
};
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* Default Augmentations Registration
|
|
3
3
|
*
|
|
4
4
|
* Maintains zero-config philosophy by automatically registering
|
|
5
|
-
* core augmentations that were previously hardcoded in
|
|
5
|
+
* core augmentations that were previously hardcoded in Brainy.
|
|
6
6
|
*
|
|
7
7
|
* These augmentations are optional but enabled by default for
|
|
8
8
|
* backward compatibility and optimal performance.
|
|
9
9
|
*/
|
|
10
10
|
import { CacheAugmentation } from './cacheAugmentation.js';
|
|
11
|
-
import { IndexAugmentation } from './indexAugmentation.js';
|
|
12
11
|
import { MetricsAugmentation } from './metricsAugmentation.js';
|
|
13
12
|
import { MonitoringAugmentation } from './monitoringAugmentation.js';
|
|
13
|
+
import { UniversalDisplayAugmentation } from './universalDisplayAugmentation.js';
|
|
14
14
|
/**
|
|
15
15
|
* Create default augmentations for zero-config operation
|
|
16
16
|
* Returns an array of augmentations to be registered
|
|
@@ -25,16 +25,17 @@ export function createDefaultAugmentations(config = {}) {
|
|
|
25
25
|
const cacheConfig = typeof config.cache === 'object' ? config.cache : {};
|
|
26
26
|
augmentations.push(new CacheAugmentation(cacheConfig));
|
|
27
27
|
}
|
|
28
|
-
// Index augmentation
|
|
29
|
-
if (config.index !== false) {
|
|
30
|
-
const indexConfig = typeof config.index === 'object' ? config.index : {};
|
|
31
|
-
augmentations.push(new IndexAugmentation(indexConfig));
|
|
32
|
-
}
|
|
28
|
+
// Note: Index augmentation removed - metadata indexing is now core functionality
|
|
33
29
|
// Metrics augmentation (was StatisticsCollector)
|
|
34
30
|
if (config.metrics !== false) {
|
|
35
31
|
const metricsConfig = typeof config.metrics === 'object' ? config.metrics : {};
|
|
36
32
|
augmentations.push(new MetricsAugmentation(metricsConfig));
|
|
37
33
|
}
|
|
34
|
+
// Display augmentation (AI-powered intelligent display fields)
|
|
35
|
+
if (config.display !== false) {
|
|
36
|
+
const displayConfig = typeof config.display === 'object' ? config.display : {};
|
|
37
|
+
augmentations.push(new UniversalDisplayAugmentation(displayConfig));
|
|
38
|
+
}
|
|
38
39
|
// Monitoring augmentation (was HealthMonitor)
|
|
39
40
|
// Only enable by default in distributed mode
|
|
40
41
|
const isDistributed = process.env.BRAINY_MODE === 'distributed' ||
|
|
@@ -67,11 +68,9 @@ export const AugmentationHelpers = {
|
|
|
67
68
|
return getAugmentation(brain, 'cache');
|
|
68
69
|
},
|
|
69
70
|
/**
|
|
70
|
-
*
|
|
71
|
+
* Note: Index augmentation removed - metadata indexing is now core functionality
|
|
72
|
+
* Use brain.metadataIndex directly instead
|
|
71
73
|
*/
|
|
72
|
-
getIndex(brain) {
|
|
73
|
-
return getAugmentation(brain, 'index');
|
|
74
|
-
},
|
|
75
74
|
/**
|
|
76
75
|
* Get metrics augmentation
|
|
77
76
|
*/
|
|
@@ -83,6 +82,12 @@ export const AugmentationHelpers = {
|
|
|
83
82
|
*/
|
|
84
83
|
getMonitoring(brain) {
|
|
85
84
|
return getAugmentation(brain, 'monitoring');
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* Get display augmentation
|
|
88
|
+
*/
|
|
89
|
+
getDisplay(brain) {
|
|
90
|
+
return getAugmentation(brain, 'display');
|
|
86
91
|
}
|
|
87
92
|
};
|
|
88
93
|
//# sourceMappingURL=defaultAugmentations.js.map
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brain-Cloud Catalog Discovery
|
|
3
|
+
*
|
|
4
|
+
* Discovers augmentations available in the brain-cloud catalog
|
|
5
|
+
* Handles free, premium, and community augmentations
|
|
6
|
+
*/
|
|
7
|
+
import { AugmentationManifest } from '../manifest.js';
|
|
8
|
+
export interface CatalogAugmentation {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
longDescription?: string;
|
|
13
|
+
category: string;
|
|
14
|
+
status: 'available' | 'coming_soon' | 'deprecated';
|
|
15
|
+
tier: 'free' | 'premium' | 'enterprise';
|
|
16
|
+
price?: {
|
|
17
|
+
monthly?: number;
|
|
18
|
+
yearly?: number;
|
|
19
|
+
oneTime?: number;
|
|
20
|
+
};
|
|
21
|
+
manifest?: AugmentationManifest;
|
|
22
|
+
source: 'catalog';
|
|
23
|
+
cdnUrl?: string;
|
|
24
|
+
npmPackage?: string;
|
|
25
|
+
githubRepo?: string;
|
|
26
|
+
author?: {
|
|
27
|
+
name: string;
|
|
28
|
+
url?: string;
|
|
29
|
+
};
|
|
30
|
+
metrics?: {
|
|
31
|
+
installations: number;
|
|
32
|
+
rating: number;
|
|
33
|
+
reviews: number;
|
|
34
|
+
};
|
|
35
|
+
requirements?: {
|
|
36
|
+
minBrainyVersion?: string;
|
|
37
|
+
maxBrainyVersion?: string;
|
|
38
|
+
dependencies?: string[];
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface CatalogOptions {
|
|
42
|
+
apiUrl?: string;
|
|
43
|
+
apiKey?: string;
|
|
44
|
+
cache?: boolean;
|
|
45
|
+
cacheTimeout?: number;
|
|
46
|
+
}
|
|
47
|
+
export interface CatalogFilters {
|
|
48
|
+
category?: string;
|
|
49
|
+
tier?: 'free' | 'premium' | 'enterprise';
|
|
50
|
+
status?: 'available' | 'coming_soon' | 'deprecated';
|
|
51
|
+
search?: string;
|
|
52
|
+
installed?: boolean;
|
|
53
|
+
minRating?: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Brain-Cloud Catalog Discovery
|
|
57
|
+
*/
|
|
58
|
+
export declare class CatalogDiscovery {
|
|
59
|
+
private apiUrl;
|
|
60
|
+
private apiKey?;
|
|
61
|
+
private cache;
|
|
62
|
+
private cacheTimeout;
|
|
63
|
+
constructor(options?: CatalogOptions);
|
|
64
|
+
/**
|
|
65
|
+
* Discover augmentations from catalog
|
|
66
|
+
*/
|
|
67
|
+
discover(filters?: CatalogFilters): Promise<CatalogAugmentation[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Get specific augmentation details
|
|
70
|
+
*/
|
|
71
|
+
getAugmentation(id: string): Promise<CatalogAugmentation | null>;
|
|
72
|
+
/**
|
|
73
|
+
* Get augmentation manifest
|
|
74
|
+
*/
|
|
75
|
+
getManifest(id: string): Promise<AugmentationManifest | null>;
|
|
76
|
+
/**
|
|
77
|
+
* Get CDN URL for dynamic loading
|
|
78
|
+
*/
|
|
79
|
+
getCDNUrl(id: string): Promise<string | null>;
|
|
80
|
+
/**
|
|
81
|
+
* Check if user has access to augmentation
|
|
82
|
+
*/
|
|
83
|
+
checkAccess(id: string): Promise<{
|
|
84
|
+
hasAccess: boolean;
|
|
85
|
+
requiresPurchase?: boolean;
|
|
86
|
+
requiredTier?: string;
|
|
87
|
+
}>;
|
|
88
|
+
/**
|
|
89
|
+
* Purchase/activate augmentation
|
|
90
|
+
*/
|
|
91
|
+
purchase(id: string, licenseKey?: string): Promise<{
|
|
92
|
+
success: boolean;
|
|
93
|
+
cdnUrl?: string;
|
|
94
|
+
npmPackage?: string;
|
|
95
|
+
licenseKey?: string;
|
|
96
|
+
}>;
|
|
97
|
+
/**
|
|
98
|
+
* Get user's purchased augmentations
|
|
99
|
+
*/
|
|
100
|
+
getPurchased(): Promise<CatalogAugmentation[]>;
|
|
101
|
+
/**
|
|
102
|
+
* Get categories
|
|
103
|
+
*/
|
|
104
|
+
getCategories(): Promise<Array<{
|
|
105
|
+
id: string;
|
|
106
|
+
name: string;
|
|
107
|
+
description: string;
|
|
108
|
+
icon?: string;
|
|
109
|
+
}>>;
|
|
110
|
+
/**
|
|
111
|
+
* Search augmentations
|
|
112
|
+
*/
|
|
113
|
+
search(query: string): Promise<CatalogAugmentation[]>;
|
|
114
|
+
/**
|
|
115
|
+
* Get trending augmentations
|
|
116
|
+
*/
|
|
117
|
+
getTrending(limit?: number): Promise<CatalogAugmentation[]>;
|
|
118
|
+
/**
|
|
119
|
+
* Get recommended augmentations
|
|
120
|
+
*/
|
|
121
|
+
getRecommended(): Promise<CatalogAugmentation[]>;
|
|
122
|
+
/**
|
|
123
|
+
* Transform catalog data
|
|
124
|
+
*/
|
|
125
|
+
private transformCatalogData;
|
|
126
|
+
/**
|
|
127
|
+
* Transform single augmentation
|
|
128
|
+
*/
|
|
129
|
+
private transformAugmentation;
|
|
130
|
+
/**
|
|
131
|
+
* Get request headers
|
|
132
|
+
*/
|
|
133
|
+
private getHeaders;
|
|
134
|
+
/**
|
|
135
|
+
* Clear cache
|
|
136
|
+
*/
|
|
137
|
+
clearCache(): void;
|
|
138
|
+
/**
|
|
139
|
+
* Set API key
|
|
140
|
+
*/
|
|
141
|
+
setApiKey(apiKey: string): void;
|
|
142
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brain-Cloud Catalog Discovery
|
|
3
|
+
*
|
|
4
|
+
* Discovers augmentations available in the brain-cloud catalog
|
|
5
|
+
* Handles free, premium, and community augmentations
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Brain-Cloud Catalog Discovery
|
|
9
|
+
*/
|
|
10
|
+
export class CatalogDiscovery {
|
|
11
|
+
constructor(options = {}) {
|
|
12
|
+
this.cache = new Map();
|
|
13
|
+
this.apiUrl = options.apiUrl || 'https://api.soulcraft.com/brain-cloud';
|
|
14
|
+
this.apiKey = options.apiKey;
|
|
15
|
+
this.cacheTimeout = options.cacheTimeout || 5 * 60 * 1000; // 5 minutes
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Discover augmentations from catalog
|
|
19
|
+
*/
|
|
20
|
+
async discover(filters = {}) {
|
|
21
|
+
const cacheKey = JSON.stringify(filters);
|
|
22
|
+
// Check cache
|
|
23
|
+
if (this.cache.has(cacheKey)) {
|
|
24
|
+
const cached = this.cache.get(cacheKey);
|
|
25
|
+
if (Date.now() - cached.timestamp < this.cacheTimeout) {
|
|
26
|
+
return cached.data;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// Build query parameters
|
|
30
|
+
const params = new URLSearchParams();
|
|
31
|
+
if (filters.category)
|
|
32
|
+
params.append('category', filters.category);
|
|
33
|
+
if (filters.tier)
|
|
34
|
+
params.append('tier', filters.tier);
|
|
35
|
+
if (filters.status)
|
|
36
|
+
params.append('status', filters.status);
|
|
37
|
+
if (filters.search)
|
|
38
|
+
params.append('q', filters.search);
|
|
39
|
+
if (filters.minRating)
|
|
40
|
+
params.append('minRating', filters.minRating.toString());
|
|
41
|
+
// Fetch from API
|
|
42
|
+
const response = await fetch(`${this.apiUrl}/augmentations/discover?${params}`, {
|
|
43
|
+
headers: this.getHeaders()
|
|
44
|
+
});
|
|
45
|
+
if (!response.ok) {
|
|
46
|
+
throw new Error(`Failed to fetch catalog: ${response.statusText}`);
|
|
47
|
+
}
|
|
48
|
+
const data = await response.json();
|
|
49
|
+
const augmentations = this.transformCatalogData(data);
|
|
50
|
+
// Cache result
|
|
51
|
+
this.cache.set(cacheKey, {
|
|
52
|
+
data: augmentations,
|
|
53
|
+
timestamp: Date.now()
|
|
54
|
+
});
|
|
55
|
+
return augmentations;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get specific augmentation details
|
|
59
|
+
*/
|
|
60
|
+
async getAugmentation(id) {
|
|
61
|
+
const response = await fetch(`${this.apiUrl}/augmentations/${id}`, {
|
|
62
|
+
headers: this.getHeaders()
|
|
63
|
+
});
|
|
64
|
+
if (!response.ok) {
|
|
65
|
+
if (response.status === 404)
|
|
66
|
+
return null;
|
|
67
|
+
throw new Error(`Failed to fetch augmentation: ${response.statusText}`);
|
|
68
|
+
}
|
|
69
|
+
const data = await response.json();
|
|
70
|
+
return this.transformAugmentation(data);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get augmentation manifest
|
|
74
|
+
*/
|
|
75
|
+
async getManifest(id) {
|
|
76
|
+
const response = await fetch(`${this.apiUrl}/augmentations/${id}/manifest`, {
|
|
77
|
+
headers: this.getHeaders()
|
|
78
|
+
});
|
|
79
|
+
if (!response.ok) {
|
|
80
|
+
if (response.status === 404)
|
|
81
|
+
return null;
|
|
82
|
+
throw new Error(`Failed to fetch manifest: ${response.statusText}`);
|
|
83
|
+
}
|
|
84
|
+
return response.json();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get CDN URL for dynamic loading
|
|
88
|
+
*/
|
|
89
|
+
async getCDNUrl(id) {
|
|
90
|
+
const aug = await this.getAugmentation(id);
|
|
91
|
+
return aug?.cdnUrl || null;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Check if user has access to augmentation
|
|
95
|
+
*/
|
|
96
|
+
async checkAccess(id) {
|
|
97
|
+
if (!this.apiKey) {
|
|
98
|
+
// No API key, only free augmentations
|
|
99
|
+
const aug = await this.getAugmentation(id);
|
|
100
|
+
return {
|
|
101
|
+
hasAccess: aug?.tier === 'free',
|
|
102
|
+
requiresPurchase: aug?.tier !== 'free',
|
|
103
|
+
requiredTier: aug?.tier
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const response = await fetch(`${this.apiUrl}/augmentations/${id}/access`, {
|
|
107
|
+
headers: this.getHeaders()
|
|
108
|
+
});
|
|
109
|
+
if (!response.ok) {
|
|
110
|
+
throw new Error(`Failed to check access: ${response.statusText}`);
|
|
111
|
+
}
|
|
112
|
+
return response.json();
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Purchase/activate augmentation
|
|
116
|
+
*/
|
|
117
|
+
async purchase(id, licenseKey) {
|
|
118
|
+
const body = licenseKey ? { licenseKey } : {};
|
|
119
|
+
const response = await fetch(`${this.apiUrl}/augmentations/${id}/purchase`, {
|
|
120
|
+
method: 'POST',
|
|
121
|
+
headers: {
|
|
122
|
+
...this.getHeaders(),
|
|
123
|
+
'Content-Type': 'application/json'
|
|
124
|
+
},
|
|
125
|
+
body: JSON.stringify(body)
|
|
126
|
+
});
|
|
127
|
+
if (!response.ok) {
|
|
128
|
+
throw new Error(`Failed to purchase: ${response.statusText}`);
|
|
129
|
+
}
|
|
130
|
+
return response.json();
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Get user's purchased augmentations
|
|
134
|
+
*/
|
|
135
|
+
async getPurchased() {
|
|
136
|
+
if (!this.apiKey) {
|
|
137
|
+
return [];
|
|
138
|
+
}
|
|
139
|
+
const response = await fetch(`${this.apiUrl}/user/augmentations`, {
|
|
140
|
+
headers: this.getHeaders()
|
|
141
|
+
});
|
|
142
|
+
if (!response.ok) {
|
|
143
|
+
throw new Error(`Failed to fetch purchased: ${response.statusText}`);
|
|
144
|
+
}
|
|
145
|
+
const data = await response.json();
|
|
146
|
+
return this.transformCatalogData(data);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Get categories
|
|
150
|
+
*/
|
|
151
|
+
async getCategories() {
|
|
152
|
+
const response = await fetch(`${this.apiUrl}/augmentations/categories`, {
|
|
153
|
+
headers: this.getHeaders()
|
|
154
|
+
});
|
|
155
|
+
if (!response.ok) {
|
|
156
|
+
throw new Error(`Failed to fetch categories: ${response.statusText}`);
|
|
157
|
+
}
|
|
158
|
+
return response.json();
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Search augmentations
|
|
162
|
+
*/
|
|
163
|
+
async search(query) {
|
|
164
|
+
return this.discover({ search: query });
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Get trending augmentations
|
|
168
|
+
*/
|
|
169
|
+
async getTrending(limit = 10) {
|
|
170
|
+
const response = await fetch(`${this.apiUrl}/augmentations/trending?limit=${limit}`, {
|
|
171
|
+
headers: this.getHeaders()
|
|
172
|
+
});
|
|
173
|
+
if (!response.ok) {
|
|
174
|
+
throw new Error(`Failed to fetch trending: ${response.statusText}`);
|
|
175
|
+
}
|
|
176
|
+
const data = await response.json();
|
|
177
|
+
return this.transformCatalogData(data);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Get recommended augmentations
|
|
181
|
+
*/
|
|
182
|
+
async getRecommended() {
|
|
183
|
+
if (!this.apiKey) {
|
|
184
|
+
// Return popular free augmentations
|
|
185
|
+
return this.discover({ tier: 'free', minRating: 4 });
|
|
186
|
+
}
|
|
187
|
+
const response = await fetch(`${this.apiUrl}/augmentations/recommended`, {
|
|
188
|
+
headers: this.getHeaders()
|
|
189
|
+
});
|
|
190
|
+
if (!response.ok) {
|
|
191
|
+
throw new Error(`Failed to fetch recommended: ${response.statusText}`);
|
|
192
|
+
}
|
|
193
|
+
const data = await response.json();
|
|
194
|
+
return this.transformCatalogData(data);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Transform catalog data
|
|
198
|
+
*/
|
|
199
|
+
transformCatalogData(data) {
|
|
200
|
+
return data.map(item => this.transformAugmentation(item));
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Transform single augmentation
|
|
204
|
+
*/
|
|
205
|
+
transformAugmentation(item) {
|
|
206
|
+
return {
|
|
207
|
+
id: item.id,
|
|
208
|
+
name: item.name,
|
|
209
|
+
description: item.description,
|
|
210
|
+
longDescription: item.longDescription,
|
|
211
|
+
category: item.category,
|
|
212
|
+
status: item.status || 'available',
|
|
213
|
+
tier: item.tier || 'free',
|
|
214
|
+
price: item.price,
|
|
215
|
+
manifest: item.manifest,
|
|
216
|
+
source: 'catalog',
|
|
217
|
+
cdnUrl: item.cdnUrl || `https://cdn.soulcraft.com/augmentations/${item.id}@latest`,
|
|
218
|
+
npmPackage: item.npmPackage,
|
|
219
|
+
githubRepo: item.githubRepo,
|
|
220
|
+
author: item.author,
|
|
221
|
+
metrics: item.metrics,
|
|
222
|
+
requirements: item.requirements
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Get request headers
|
|
227
|
+
*/
|
|
228
|
+
getHeaders() {
|
|
229
|
+
const headers = {};
|
|
230
|
+
if (this.apiKey) {
|
|
231
|
+
headers['Authorization'] = `Bearer ${this.apiKey}`;
|
|
232
|
+
}
|
|
233
|
+
return headers;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Clear cache
|
|
237
|
+
*/
|
|
238
|
+
clearCache() {
|
|
239
|
+
this.cache.clear();
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Set API key
|
|
243
|
+
*/
|
|
244
|
+
setApiKey(apiKey) {
|
|
245
|
+
this.apiKey = apiKey;
|
|
246
|
+
this.clearCache(); // Clear cache when API key changes
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=catalogDiscovery.js.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local Augmentation Discovery
|
|
3
|
+
*
|
|
4
|
+
* Discovers augmentations installed locally in node_modules
|
|
5
|
+
* and built-in augmentations that ship with Brainy
|
|
6
|
+
*/
|
|
7
|
+
import { AugmentationManifest } from '../manifest.js';
|
|
8
|
+
export interface LocalAugmentation {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
source: 'builtin' | 'npm' | 'local';
|
|
12
|
+
path: string;
|
|
13
|
+
manifest?: AugmentationManifest;
|
|
14
|
+
package?: {
|
|
15
|
+
name: string;
|
|
16
|
+
version: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Discovers augmentations installed locally
|
|
22
|
+
*/
|
|
23
|
+
export declare class LocalAugmentationDiscovery {
|
|
24
|
+
private options;
|
|
25
|
+
private builtInAugmentations;
|
|
26
|
+
private installedAugmentations;
|
|
27
|
+
constructor(options?: {
|
|
28
|
+
brainyPath?: string;
|
|
29
|
+
projectPath?: string;
|
|
30
|
+
scanNodeModules?: boolean;
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* Register built-in augmentations that ship with Brainy
|
|
34
|
+
*/
|
|
35
|
+
private registerBuiltIn;
|
|
36
|
+
/**
|
|
37
|
+
* Find Brainy installation path
|
|
38
|
+
*/
|
|
39
|
+
private findBrainyPath;
|
|
40
|
+
/**
|
|
41
|
+
* Discover all augmentations
|
|
42
|
+
*/
|
|
43
|
+
discoverAll(): Promise<LocalAugmentation[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Scan node_modules for installed augmentations
|
|
46
|
+
*/
|
|
47
|
+
private scanNodeModules;
|
|
48
|
+
/**
|
|
49
|
+
* Scan local project for augmentations
|
|
50
|
+
*/
|
|
51
|
+
private scanLocalProject;
|
|
52
|
+
/**
|
|
53
|
+
* Load augmentation from package
|
|
54
|
+
*/
|
|
55
|
+
private loadPackageAugmentation;
|
|
56
|
+
/**
|
|
57
|
+
* Load package.json
|
|
58
|
+
*/
|
|
59
|
+
private loadPackageJson;
|
|
60
|
+
/**
|
|
61
|
+
* Convert name to human-readable format
|
|
62
|
+
*/
|
|
63
|
+
private humanizeName;
|
|
64
|
+
/**
|
|
65
|
+
* Get built-in augmentations
|
|
66
|
+
*/
|
|
67
|
+
getBuiltIn(): LocalAugmentation[];
|
|
68
|
+
/**
|
|
69
|
+
* Get installed augmentations
|
|
70
|
+
*/
|
|
71
|
+
getInstalled(): LocalAugmentation[];
|
|
72
|
+
/**
|
|
73
|
+
* Check if augmentation is installed
|
|
74
|
+
*/
|
|
75
|
+
isInstalled(id: string): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Get import path for augmentation
|
|
78
|
+
*/
|
|
79
|
+
getImportPath(id: string): string | null;
|
|
80
|
+
/**
|
|
81
|
+
* Load augmentation module dynamically
|
|
82
|
+
*/
|
|
83
|
+
loadAugmentation(id: string): Promise<any>;
|
|
84
|
+
}
|