@soulcraft/brainy 3.0.0 → 3.1.0
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 +427 -111
- 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 +277 -0
- package/dist/brainy.js +1241 -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/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/universal/crypto.d.ts +11 -1
- package/dist/universal/crypto.js +24 -93
- package/dist/universal/events.d.ts +3 -2
- package/dist/universal/events.js +6 -75
- package/dist/universal/fs.d.ts +2 -3
- package/dist/universal/fs.js +5 -211
- package/dist/universal/path.d.ts +3 -2
- package/dist/universal/path.js +22 -78
- package/dist/universal/uuid.d.ts +1 -1
- package/dist/universal/uuid.js +1 -1
- 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 -17
- package/scripts/download-models.cjs +94 -20
- package/dist/augmentations/walAugmentation.d.ts +0 -109
- package/dist/augmentations/walAugmentation.js +0 -516
- package/dist/browserFramework.d.ts +0 -15
- package/dist/browserFramework.js +0 -31
- package/dist/browserFramework.minimal.d.ts +0 -14
- package/dist/browserFramework.minimal.js +0 -31
- 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,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Neural API Type Definitions
|
|
3
|
+
* Comprehensive interfaces for clustering, similarity, and analysis
|
|
4
|
+
*/
|
|
5
|
+
export interface Vector {
|
|
6
|
+
[index: number]: number;
|
|
7
|
+
length: number;
|
|
8
|
+
}
|
|
9
|
+
export interface SemanticCluster {
|
|
10
|
+
id: string;
|
|
11
|
+
centroid: Vector;
|
|
12
|
+
members: string[];
|
|
13
|
+
size: number;
|
|
14
|
+
confidence: number;
|
|
15
|
+
label?: string;
|
|
16
|
+
metadata?: Record<string, any>;
|
|
17
|
+
cohesion?: number;
|
|
18
|
+
level?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ClusterEdge {
|
|
21
|
+
id: string;
|
|
22
|
+
source: string;
|
|
23
|
+
target: string;
|
|
24
|
+
type: string;
|
|
25
|
+
weight?: number;
|
|
26
|
+
isInterCluster: boolean;
|
|
27
|
+
sourceCluster?: string;
|
|
28
|
+
targetCluster?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface EnhancedSemanticCluster extends SemanticCluster {
|
|
31
|
+
intraClusterEdges: ClusterEdge[];
|
|
32
|
+
interClusterEdges: ClusterEdge[];
|
|
33
|
+
relationshipSummary: {
|
|
34
|
+
totalEdges: number;
|
|
35
|
+
intraClusterEdges: number;
|
|
36
|
+
interClusterEdges: number;
|
|
37
|
+
edgeTypes: Record<string, number>;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export interface DomainCluster extends SemanticCluster {
|
|
41
|
+
domain: string;
|
|
42
|
+
domainConfidence: number;
|
|
43
|
+
crossDomainMembers?: string[];
|
|
44
|
+
}
|
|
45
|
+
export interface TemporalCluster extends SemanticCluster {
|
|
46
|
+
timeWindow: TimeWindow;
|
|
47
|
+
trend?: 'increasing' | 'decreasing' | 'stable';
|
|
48
|
+
temporal: {
|
|
49
|
+
startTime: Date;
|
|
50
|
+
endTime: Date;
|
|
51
|
+
peakTime?: Date;
|
|
52
|
+
frequency?: number;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export interface ExplainableCluster extends SemanticCluster {
|
|
56
|
+
explanation: {
|
|
57
|
+
primaryFeatures: string[];
|
|
58
|
+
commonTerms: string[];
|
|
59
|
+
reasoning: string;
|
|
60
|
+
confidence: number;
|
|
61
|
+
};
|
|
62
|
+
subClusters?: ExplainableCluster[];
|
|
63
|
+
}
|
|
64
|
+
export interface ConfidentCluster extends SemanticCluster {
|
|
65
|
+
minConfidence: number;
|
|
66
|
+
uncertainMembers: string[];
|
|
67
|
+
certainMembers: string[];
|
|
68
|
+
}
|
|
69
|
+
export interface BaseClusteringOptions {
|
|
70
|
+
maxClusters?: number;
|
|
71
|
+
minClusterSize?: number;
|
|
72
|
+
threshold?: number;
|
|
73
|
+
cacheResults?: boolean;
|
|
74
|
+
}
|
|
75
|
+
export interface ClusteringOptions extends BaseClusteringOptions {
|
|
76
|
+
algorithm?: 'auto' | 'hierarchical' | 'kmeans' | 'dbscan' | 'sample' | 'semantic' | 'graph' | 'multimodal';
|
|
77
|
+
sampleSize?: number;
|
|
78
|
+
strategy?: 'random' | 'diverse' | 'recent' | 'important';
|
|
79
|
+
memoryLimit?: string;
|
|
80
|
+
includeOutliers?: boolean;
|
|
81
|
+
maxIterations?: number;
|
|
82
|
+
tolerance?: number;
|
|
83
|
+
}
|
|
84
|
+
export interface DomainClusteringOptions extends BaseClusteringOptions {
|
|
85
|
+
domainField?: string;
|
|
86
|
+
crossDomainThreshold?: number;
|
|
87
|
+
preserveDomainBoundaries?: boolean;
|
|
88
|
+
}
|
|
89
|
+
export interface TemporalClusteringOptions extends BaseClusteringOptions {
|
|
90
|
+
timeField: string;
|
|
91
|
+
windows: TimeWindow[];
|
|
92
|
+
overlapStrategy?: 'merge' | 'separate' | 'hierarchical';
|
|
93
|
+
trendAnalysis?: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface StreamClusteringOptions extends BaseClusteringOptions {
|
|
96
|
+
batchSize?: number;
|
|
97
|
+
updateInterval?: number;
|
|
98
|
+
adaptiveThreshold?: boolean;
|
|
99
|
+
decayFactor?: number;
|
|
100
|
+
}
|
|
101
|
+
export interface SimilarityOptions {
|
|
102
|
+
detailed?: boolean;
|
|
103
|
+
metric?: 'cosine' | 'euclidean' | 'manhattan' | 'jaccard';
|
|
104
|
+
normalized?: boolean;
|
|
105
|
+
}
|
|
106
|
+
export interface SimilarityResult {
|
|
107
|
+
score: number;
|
|
108
|
+
confidence: number;
|
|
109
|
+
explanation?: string;
|
|
110
|
+
metric?: string;
|
|
111
|
+
}
|
|
112
|
+
export interface NeighborOptions {
|
|
113
|
+
limit?: number;
|
|
114
|
+
radius?: number;
|
|
115
|
+
minSimilarity?: number;
|
|
116
|
+
includeMetadata?: boolean;
|
|
117
|
+
sortBy?: 'similarity' | 'importance' | 'recency';
|
|
118
|
+
}
|
|
119
|
+
export interface Neighbor {
|
|
120
|
+
id: string;
|
|
121
|
+
similarity: number;
|
|
122
|
+
data?: any;
|
|
123
|
+
metadata?: Record<string, any>;
|
|
124
|
+
distance?: number;
|
|
125
|
+
}
|
|
126
|
+
export interface NeighborsResult {
|
|
127
|
+
neighbors: Neighbor[];
|
|
128
|
+
queryId: string;
|
|
129
|
+
totalFound: number;
|
|
130
|
+
averageSimilarity: number;
|
|
131
|
+
}
|
|
132
|
+
export interface SemanticHierarchy {
|
|
133
|
+
self: {
|
|
134
|
+
id: string;
|
|
135
|
+
vector?: Vector;
|
|
136
|
+
metadata?: any;
|
|
137
|
+
};
|
|
138
|
+
parent?: {
|
|
139
|
+
id: string;
|
|
140
|
+
similarity: number;
|
|
141
|
+
};
|
|
142
|
+
children?: Array<{
|
|
143
|
+
id: string;
|
|
144
|
+
similarity: number;
|
|
145
|
+
}>;
|
|
146
|
+
siblings?: Array<{
|
|
147
|
+
id: string;
|
|
148
|
+
similarity: number;
|
|
149
|
+
}>;
|
|
150
|
+
level?: number;
|
|
151
|
+
depth?: number;
|
|
152
|
+
}
|
|
153
|
+
export interface HierarchyOptions {
|
|
154
|
+
maxDepth?: number;
|
|
155
|
+
minSimilarity?: number;
|
|
156
|
+
includeMetadata?: boolean;
|
|
157
|
+
buildStrategy?: 'similarity' | 'metadata' | 'mixed';
|
|
158
|
+
}
|
|
159
|
+
export interface VisualizationOptions {
|
|
160
|
+
maxNodes?: number;
|
|
161
|
+
dimensions?: 2 | 3;
|
|
162
|
+
algorithm?: 'force' | 'spring' | 'circular' | 'hierarchical';
|
|
163
|
+
includeEdges?: boolean;
|
|
164
|
+
clusterColors?: boolean;
|
|
165
|
+
nodeSize?: 'uniform' | 'importance' | 'connections';
|
|
166
|
+
}
|
|
167
|
+
export interface VisualizationNode {
|
|
168
|
+
id: string;
|
|
169
|
+
x: number;
|
|
170
|
+
y: number;
|
|
171
|
+
z?: number;
|
|
172
|
+
cluster?: string;
|
|
173
|
+
size?: number;
|
|
174
|
+
color?: string;
|
|
175
|
+
metadata?: Record<string, any>;
|
|
176
|
+
}
|
|
177
|
+
export interface VisualizationEdge {
|
|
178
|
+
source: string;
|
|
179
|
+
target: string;
|
|
180
|
+
weight: number;
|
|
181
|
+
color?: string;
|
|
182
|
+
type?: string;
|
|
183
|
+
}
|
|
184
|
+
export interface VisualizationResult {
|
|
185
|
+
nodes: VisualizationNode[];
|
|
186
|
+
edges: VisualizationEdge[];
|
|
187
|
+
clusters?: Array<{
|
|
188
|
+
id: string;
|
|
189
|
+
color: string;
|
|
190
|
+
size: number;
|
|
191
|
+
label?: string;
|
|
192
|
+
}>;
|
|
193
|
+
metadata: {
|
|
194
|
+
algorithm: string;
|
|
195
|
+
dimensions: number;
|
|
196
|
+
totalNodes: number;
|
|
197
|
+
totalEdges: number;
|
|
198
|
+
generatedAt: Date;
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
export interface TimeWindow {
|
|
202
|
+
start: Date;
|
|
203
|
+
end: Date;
|
|
204
|
+
label?: string;
|
|
205
|
+
weight?: number;
|
|
206
|
+
}
|
|
207
|
+
export interface ClusterFeedback {
|
|
208
|
+
clusterId: string;
|
|
209
|
+
action: 'merge' | 'split' | 'relabel' | 'adjust';
|
|
210
|
+
parameters?: Record<string, any>;
|
|
211
|
+
confidence?: number;
|
|
212
|
+
}
|
|
213
|
+
export interface OutlierOptions {
|
|
214
|
+
threshold?: number;
|
|
215
|
+
method?: 'isolation' | 'statistical' | 'cluster-based';
|
|
216
|
+
minNeighbors?: number;
|
|
217
|
+
includeReasons?: boolean;
|
|
218
|
+
}
|
|
219
|
+
export interface Outlier {
|
|
220
|
+
id: string;
|
|
221
|
+
score: number;
|
|
222
|
+
reasons?: string[];
|
|
223
|
+
nearestNeighbors?: Neighbor[];
|
|
224
|
+
metadata?: Record<string, any>;
|
|
225
|
+
}
|
|
226
|
+
export interface PerformanceMetrics {
|
|
227
|
+
executionTime: number;
|
|
228
|
+
memoryUsed: number;
|
|
229
|
+
itemsProcessed: number;
|
|
230
|
+
cacheHits: number;
|
|
231
|
+
cacheMisses: number;
|
|
232
|
+
algorithm: string;
|
|
233
|
+
}
|
|
234
|
+
export interface ClusteringResult<T = SemanticCluster> {
|
|
235
|
+
clusters: T[];
|
|
236
|
+
metrics: PerformanceMetrics;
|
|
237
|
+
metadata: {
|
|
238
|
+
totalItems: number;
|
|
239
|
+
clustersFound: number;
|
|
240
|
+
averageClusterSize: number;
|
|
241
|
+
silhouetteScore?: number;
|
|
242
|
+
timestamp: Date;
|
|
243
|
+
semanticTypes?: number;
|
|
244
|
+
hnswLevel?: number;
|
|
245
|
+
kValue?: number;
|
|
246
|
+
hasConverged?: boolean;
|
|
247
|
+
outlierCount?: number;
|
|
248
|
+
eps?: number;
|
|
249
|
+
minPts?: number;
|
|
250
|
+
averageModularity?: number;
|
|
251
|
+
fusionMethod?: string;
|
|
252
|
+
componentAlgorithms?: string[];
|
|
253
|
+
sampleSize?: number;
|
|
254
|
+
samplingStrategy?: string;
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
export interface StreamingBatch<T = SemanticCluster> {
|
|
258
|
+
clusters: T[];
|
|
259
|
+
batchNumber: number;
|
|
260
|
+
isComplete: boolean;
|
|
261
|
+
progress: {
|
|
262
|
+
processed: number;
|
|
263
|
+
total: number;
|
|
264
|
+
percentage: number;
|
|
265
|
+
};
|
|
266
|
+
metrics: PerformanceMetrics;
|
|
267
|
+
}
|
|
268
|
+
export declare class NeuralAPIError extends Error {
|
|
269
|
+
code: string;
|
|
270
|
+
context?: Record<string, any> | undefined;
|
|
271
|
+
constructor(message: string, code: string, context?: Record<string, any> | undefined);
|
|
272
|
+
}
|
|
273
|
+
export declare class ClusteringError extends NeuralAPIError {
|
|
274
|
+
constructor(message: string, context?: Record<string, any>);
|
|
275
|
+
}
|
|
276
|
+
export declare class SimilarityError extends NeuralAPIError {
|
|
277
|
+
constructor(message: string, context?: Record<string, any>);
|
|
278
|
+
}
|
|
279
|
+
export interface NeuralAPIConfig {
|
|
280
|
+
cacheSize?: number;
|
|
281
|
+
defaultAlgorithm?: string;
|
|
282
|
+
similarityMetric?: 'cosine' | 'euclidean' | 'manhattan';
|
|
283
|
+
performanceTracking?: boolean;
|
|
284
|
+
maxMemoryUsage?: string;
|
|
285
|
+
parallelProcessing?: boolean;
|
|
286
|
+
streamingBatchSize?: number;
|
|
287
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Neural API Type Definitions
|
|
3
|
+
* Comprehensive interfaces for clustering, similarity, and analysis
|
|
4
|
+
*/
|
|
5
|
+
// ===== ERROR TYPES =====
|
|
6
|
+
export class NeuralAPIError extends Error {
|
|
7
|
+
constructor(message, code, context) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.code = code;
|
|
10
|
+
this.context = context;
|
|
11
|
+
this.name = 'NeuralAPIError';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export class ClusteringError extends NeuralAPIError {
|
|
15
|
+
constructor(message, context) {
|
|
16
|
+
super(message, 'CLUSTERING_ERROR', context);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export class SimilarityError extends NeuralAPIError {
|
|
20
|
+
constructor(message, context) {
|
|
21
|
+
super(message, 'SIMILARITY_ERROR', context);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* 🧠⚛️ Pre-installed augmentations that come with every Brainy installation
|
|
5
5
|
* These are the core "sensory organs" of the atomic age brain-in-jar system
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { BrainyInterface } from '../types/brainyDataInterface.js';
|
|
8
8
|
/**
|
|
9
9
|
* Default augmentations that ship with Brainy
|
|
10
10
|
* These are automatically registered on startup
|
|
11
11
|
*/
|
|
12
12
|
export declare class DefaultAugmentationRegistry {
|
|
13
13
|
private brainy;
|
|
14
|
-
constructor(brainy:
|
|
14
|
+
constructor(brainy: BrainyInterface);
|
|
15
15
|
/**
|
|
16
16
|
* Initialize all default augmentations
|
|
17
17
|
* Called during Brainy startup to register core functionality
|
|
@@ -38,4 +38,4 @@ export declare class DefaultAugmentationRegistry {
|
|
|
38
38
|
/**
|
|
39
39
|
* Helper function to initialize default augmentations for any Brainy instance
|
|
40
40
|
*/
|
|
41
|
-
export declare function initializeDefaultAugmentations(brainy:
|
|
41
|
+
export declare function initializeDefaultAugmentations(brainy: BrainyInterface): Promise<DefaultAugmentationRegistry>;
|
|
@@ -30,7 +30,7 @@ export class DefaultAugmentationRegistry {
|
|
|
30
30
|
try {
|
|
31
31
|
// Import the Neural Import augmentation
|
|
32
32
|
const { NeuralImportAugmentation } = await import('../augmentations/neuralImport.js');
|
|
33
|
-
// Note: The actual registration is commented out since
|
|
33
|
+
// Note: The actual registration is commented out since Brainy doesn't have addAugmentation method yet
|
|
34
34
|
// This would create instance with default configuration
|
|
35
35
|
/*
|
|
36
36
|
const neuralImport = new NeuralImportAugmentation(this.brainy as any, {
|
|
@@ -48,7 +48,7 @@ export class DefaultAugmentationRegistry {
|
|
|
48
48
|
})
|
|
49
49
|
}
|
|
50
50
|
*/
|
|
51
|
-
console.log('🧠⚛️ Cortex module loaded (awaiting
|
|
51
|
+
console.log('🧠⚛️ Cortex module loaded (awaiting Brainy augmentation support)');
|
|
52
52
|
}
|
|
53
53
|
catch (error) {
|
|
54
54
|
console.error('❌ Failed to register Cortex:', error instanceof Error ? error.message : String(error));
|
|
@@ -61,11 +61,11 @@ export class DefaultAugmentationRegistry {
|
|
|
61
61
|
async checkCortexHealth() {
|
|
62
62
|
try {
|
|
63
63
|
// Check if Cortex is registered as an augmentation
|
|
64
|
-
// Note: hasAugmentation method doesn't exist yet in
|
|
64
|
+
// Note: hasAugmentation method doesn't exist yet in Brainy
|
|
65
65
|
const hasCortex = false; // this.brainy.hasAugmentation && this.brainy.hasAugmentation('SENSE', 'cortex')
|
|
66
66
|
return {
|
|
67
67
|
available: hasCortex || false,
|
|
68
|
-
status: hasCortex ? 'active' : 'not registered (awaiting
|
|
68
|
+
status: hasCortex ? 'active' : 'not registered (awaiting Brainy support)',
|
|
69
69
|
version: '1.0.0'
|
|
70
70
|
};
|
|
71
71
|
}
|
|
@@ -82,7 +82,7 @@ export class DefaultAugmentationRegistry {
|
|
|
82
82
|
async reinstallCortex() {
|
|
83
83
|
try {
|
|
84
84
|
// Remove existing if present
|
|
85
|
-
// Note: removeAugmentation method doesn't exist yet in
|
|
85
|
+
// Note: removeAugmentation method doesn't exist yet in Brainy
|
|
86
86
|
/*
|
|
87
87
|
if (this.brainy.removeAugmentation) {
|
|
88
88
|
try {
|
|
@@ -75,6 +75,48 @@ export declare abstract class BaseStorageAdapter implements StorageAdapter {
|
|
|
75
75
|
hasMore: boolean;
|
|
76
76
|
nextCursor?: string;
|
|
77
77
|
}>;
|
|
78
|
+
/**
|
|
79
|
+
* Get nouns with pagination (internal implementation)
|
|
80
|
+
* This method should be implemented by storage adapters to support efficient pagination
|
|
81
|
+
* @param options Pagination options
|
|
82
|
+
* @returns Promise that resolves to a paginated result of nouns
|
|
83
|
+
*/
|
|
84
|
+
getNounsWithPagination?(options: {
|
|
85
|
+
limit?: number;
|
|
86
|
+
cursor?: string;
|
|
87
|
+
filter?: {
|
|
88
|
+
nounType?: string | string[];
|
|
89
|
+
service?: string | string[];
|
|
90
|
+
metadata?: Record<string, any>;
|
|
91
|
+
};
|
|
92
|
+
}): Promise<{
|
|
93
|
+
items: any[];
|
|
94
|
+
totalCount?: number;
|
|
95
|
+
hasMore: boolean;
|
|
96
|
+
nextCursor?: string;
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* Get verbs with pagination (internal implementation)
|
|
100
|
+
* This method should be implemented by storage adapters to support efficient pagination
|
|
101
|
+
* @param options Pagination options
|
|
102
|
+
* @returns Promise that resolves to a paginated result of verbs
|
|
103
|
+
*/
|
|
104
|
+
getVerbsWithPagination?(options: {
|
|
105
|
+
limit?: number;
|
|
106
|
+
cursor?: string;
|
|
107
|
+
filter?: {
|
|
108
|
+
verbType?: string | string[];
|
|
109
|
+
sourceId?: string | string[];
|
|
110
|
+
targetId?: string | string[];
|
|
111
|
+
service?: string | string[];
|
|
112
|
+
metadata?: Record<string, any>;
|
|
113
|
+
};
|
|
114
|
+
}): Promise<{
|
|
115
|
+
items: any[];
|
|
116
|
+
totalCount?: number;
|
|
117
|
+
hasMore: boolean;
|
|
118
|
+
nextCursor?: string;
|
|
119
|
+
}>;
|
|
78
120
|
protected statisticsCache: StatisticsData | null;
|
|
79
121
|
protected statisticsBatchUpdateTimerId: NodeJS.Timeout | null;
|
|
80
122
|
protected statisticsModified: boolean;
|
|
@@ -105,7 +105,7 @@ export declare class FileSystemStorage extends BaseStorage {
|
|
|
105
105
|
/**
|
|
106
106
|
* Save noun metadata to storage
|
|
107
107
|
*/
|
|
108
|
-
|
|
108
|
+
protected saveNounMetadata_internal(id: string, metadata: any): Promise<void>;
|
|
109
109
|
/**
|
|
110
110
|
* Get noun metadata from storage
|
|
111
111
|
*/
|
|
@@ -113,7 +113,7 @@ export declare class FileSystemStorage extends BaseStorage {
|
|
|
113
113
|
/**
|
|
114
114
|
* Save verb metadata to storage
|
|
115
115
|
*/
|
|
116
|
-
|
|
116
|
+
protected saveVerbMetadata_internal(id: string, metadata: any): Promise<void>;
|
|
117
117
|
/**
|
|
118
118
|
* Get verb metadata from storage
|
|
119
119
|
*/
|
|
@@ -189,6 +189,26 @@ export declare class FileSystemStorage extends BaseStorage {
|
|
|
189
189
|
* Get verbs by type
|
|
190
190
|
*/
|
|
191
191
|
protected getVerbsByType_internal(type: string): Promise<GraphVerb[]>;
|
|
192
|
+
/**
|
|
193
|
+
* Get verbs with pagination
|
|
194
|
+
* This method reads verb files from the filesystem and returns them with pagination
|
|
195
|
+
*/
|
|
196
|
+
getVerbsWithPagination(options?: {
|
|
197
|
+
limit?: number;
|
|
198
|
+
cursor?: string;
|
|
199
|
+
filter?: {
|
|
200
|
+
verbType?: string | string[];
|
|
201
|
+
sourceId?: string | string[];
|
|
202
|
+
targetId?: string | string[];
|
|
203
|
+
service?: string | string[];
|
|
204
|
+
metadata?: Record<string, any>;
|
|
205
|
+
};
|
|
206
|
+
}): Promise<{
|
|
207
|
+
items: GraphVerb[];
|
|
208
|
+
totalCount?: number;
|
|
209
|
+
hasMore: boolean;
|
|
210
|
+
nextCursor?: string;
|
|
211
|
+
}>;
|
|
192
212
|
/**
|
|
193
213
|
* Delete a verb from storage
|
|
194
214
|
*/
|
|
@@ -227,5 +247,9 @@ export declare class FileSystemStorage extends BaseStorage {
|
|
|
227
247
|
* Get statistics with backward compatibility (dual read)
|
|
228
248
|
*/
|
|
229
249
|
private getStatisticsWithBackwardCompat;
|
|
250
|
+
/**
|
|
251
|
+
* Merge statistics from multiple sources
|
|
252
|
+
*/
|
|
253
|
+
private mergeStatistics;
|
|
230
254
|
}
|
|
231
255
|
export {};
|