@soulcraft/brainy 1.4.0 → 2.0.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 +188 -0
- package/LICENSE +2 -2
- package/README.md +201 -596
- package/bin/brainy-interactive.js +564 -0
- package/bin/brainy-ts.js +18 -0
- package/bin/brainy.js +672 -81
- package/dist/augmentationPipeline.d.ts +48 -220
- package/dist/augmentationPipeline.js +60 -508
- package/dist/augmentationRegistry.d.ts +22 -31
- package/dist/augmentationRegistry.js +28 -79
- package/dist/augmentations/apiServerAugmentation.d.ts +108 -0
- package/dist/augmentations/apiServerAugmentation.js +502 -0
- package/dist/augmentations/batchProcessingAugmentation.d.ts +95 -0
- package/dist/augmentations/batchProcessingAugmentation.js +567 -0
- package/dist/augmentations/brainyAugmentation.d.ts +153 -0
- package/dist/augmentations/brainyAugmentation.js +145 -0
- package/dist/augmentations/cacheAugmentation.d.ts +105 -0
- package/dist/augmentations/cacheAugmentation.js +238 -0
- package/dist/augmentations/conduitAugmentations.d.ts +54 -156
- package/dist/augmentations/conduitAugmentations.js +156 -1082
- package/dist/augmentations/connectionPoolAugmentation.d.ts +62 -0
- package/dist/augmentations/connectionPoolAugmentation.js +316 -0
- package/dist/augmentations/defaultAugmentations.d.ts +53 -0
- package/dist/augmentations/defaultAugmentations.js +88 -0
- package/dist/augmentations/entityRegistryAugmentation.d.ts +126 -0
- package/dist/augmentations/entityRegistryAugmentation.js +386 -0
- package/dist/augmentations/indexAugmentation.d.ts +117 -0
- package/dist/augmentations/indexAugmentation.js +284 -0
- package/dist/augmentations/intelligentVerbScoringAugmentation.d.ts +152 -0
- package/dist/augmentations/intelligentVerbScoringAugmentation.js +554 -0
- package/dist/augmentations/metricsAugmentation.d.ts +202 -0
- package/dist/augmentations/metricsAugmentation.js +291 -0
- package/dist/augmentations/monitoringAugmentation.d.ts +94 -0
- package/dist/augmentations/monitoringAugmentation.js +227 -0
- package/dist/augmentations/neuralImport.d.ts +50 -117
- package/dist/augmentations/neuralImport.js +255 -629
- package/dist/augmentations/requestDeduplicatorAugmentation.d.ts +52 -0
- package/dist/augmentations/requestDeduplicatorAugmentation.js +162 -0
- package/dist/augmentations/serverSearchAugmentations.d.ts +43 -22
- package/dist/augmentations/serverSearchAugmentations.js +125 -72
- package/dist/augmentations/storageAugmentation.d.ts +54 -0
- package/dist/augmentations/storageAugmentation.js +93 -0
- package/dist/augmentations/storageAugmentations.d.ts +96 -0
- package/dist/augmentations/storageAugmentations.js +182 -0
- package/dist/augmentations/synapseAugmentation.d.ts +156 -0
- package/dist/augmentations/synapseAugmentation.js +312 -0
- package/dist/augmentations/walAugmentation.d.ts +108 -0
- package/dist/augmentations/walAugmentation.js +515 -0
- package/dist/brainyData.d.ts +404 -130
- package/dist/brainyData.js +1336 -855
- package/dist/chat/BrainyChat.d.ts +16 -8
- package/dist/chat/BrainyChat.js +60 -32
- package/dist/chat/ChatCLI.d.ts +1 -1
- package/dist/chat/ChatCLI.js +6 -6
- package/dist/cli/catalog.d.ts +3 -3
- package/dist/cli/catalog.js +116 -70
- package/dist/cli/commands/core.d.ts +61 -0
- package/dist/cli/commands/core.js +348 -0
- package/dist/cli/commands/neural.d.ts +25 -0
- package/dist/cli/commands/neural.js +508 -0
- package/dist/cli/commands/utility.d.ts +37 -0
- package/dist/cli/commands/utility.js +276 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.js +167 -0
- package/dist/cli/interactive.d.ts +164 -0
- package/dist/cli/interactive.js +542 -0
- package/dist/cortex/neuralImport.js +5 -5
- package/dist/critical/model-guardian.js +11 -4
- package/dist/embeddings/lightweight-embedder.d.ts +23 -0
- package/dist/embeddings/lightweight-embedder.js +136 -0
- package/dist/embeddings/universal-memory-manager.d.ts +38 -0
- package/dist/embeddings/universal-memory-manager.js +206 -0
- package/dist/embeddings/worker-embedding.d.ts +7 -0
- package/dist/embeddings/worker-embedding.js +77 -0
- package/dist/embeddings/worker-manager.d.ts +28 -0
- package/dist/embeddings/worker-manager.js +162 -0
- package/dist/examples/basicUsage.js +7 -7
- package/dist/graph/pathfinding.d.ts +78 -0
- package/dist/graph/pathfinding.js +393 -0
- package/dist/hnsw/hnswIndex.d.ts +13 -0
- package/dist/hnsw/hnswIndex.js +35 -0
- package/dist/hnsw/hnswIndexOptimized.d.ts +1 -0
- package/dist/hnsw/hnswIndexOptimized.js +3 -0
- package/dist/index.d.ts +9 -11
- package/dist/index.js +21 -11
- package/dist/indices/fieldIndex.d.ts +76 -0
- package/dist/indices/fieldIndex.js +357 -0
- package/dist/mcp/brainyMCPAdapter.js +3 -2
- package/dist/mcp/mcpAugmentationToolset.js +11 -17
- package/dist/neural/embeddedPatterns.d.ts +41 -0
- package/dist/neural/embeddedPatterns.js +4044 -0
- package/dist/neural/naturalLanguageProcessor.d.ts +94 -0
- package/dist/neural/naturalLanguageProcessor.js +317 -0
- package/dist/neural/naturalLanguageProcessorStatic.d.ts +64 -0
- package/dist/neural/naturalLanguageProcessorStatic.js +151 -0
- package/dist/neural/neuralAPI.d.ts +255 -0
- package/dist/neural/neuralAPI.js +612 -0
- package/dist/neural/patternLibrary.d.ts +101 -0
- package/dist/neural/patternLibrary.js +313 -0
- package/dist/neural/patterns.d.ts +27 -0
- package/dist/neural/patterns.js +68 -0
- package/dist/neural/staticPatternMatcher.d.ts +35 -0
- package/dist/neural/staticPatternMatcher.js +153 -0
- package/dist/scripts/precomputePatternEmbeddings.d.ts +19 -0
- package/dist/scripts/precomputePatternEmbeddings.js +100 -0
- package/dist/storage/adapters/fileSystemStorage.d.ts +5 -0
- package/dist/storage/adapters/fileSystemStorage.js +20 -0
- package/dist/storage/adapters/s3CompatibleStorage.d.ts +5 -0
- package/dist/storage/adapters/s3CompatibleStorage.js +16 -0
- package/dist/storage/enhancedClearOperations.d.ts +83 -0
- package/dist/storage/enhancedClearOperations.js +345 -0
- package/dist/storage/storageFactory.js +31 -27
- package/dist/triple/TripleIntelligence.d.ts +134 -0
- package/dist/triple/TripleIntelligence.js +548 -0
- package/dist/types/augmentations.d.ts +45 -344
- package/dist/types/augmentations.js +5 -2
- package/dist/types/brainyDataInterface.d.ts +20 -10
- package/dist/types/graphTypes.d.ts +46 -0
- package/dist/types/graphTypes.js +16 -2
- package/dist/utils/BoundedRegistry.d.ts +29 -0
- package/dist/utils/BoundedRegistry.js +54 -0
- package/dist/utils/embedding.js +20 -3
- package/dist/utils/hybridModelManager.js +10 -5
- package/dist/utils/metadataFilter.d.ts +33 -19
- package/dist/utils/metadataFilter.js +58 -23
- package/dist/utils/metadataIndex.d.ts +37 -6
- package/dist/utils/metadataIndex.js +427 -64
- package/dist/utils/requestDeduplicator.d.ts +10 -0
- package/dist/utils/requestDeduplicator.js +24 -0
- package/dist/utils/unifiedCache.d.ts +103 -0
- package/dist/utils/unifiedCache.js +311 -0
- package/package.json +43 -128
- package/scripts/ensure-models.js +108 -0
- package/scripts/prepare-models.js +387 -0
- package/OFFLINE_MODELS.md +0 -56
- package/dist/intelligence/neuralEngine.d.ts +0 -207
- package/dist/intelligence/neuralEngine.js +0 -706
- package/dist/utils/modelLoader.d.ts +0 -32
- package/dist/utils/modelLoader.js +0 -219
- package/dist/utils/modelManager.d.ts +0 -77
- package/dist/utils/modelManager.js +0 -219
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Neural Detection Engine - Shared AI Intelligence Infrastructure
|
|
3
|
-
*
|
|
4
|
-
* 🧠 Consolidates all neural analysis capabilities for consistent intelligence across Brainy
|
|
5
|
-
* ⚛️ Replaces basic heuristics with sophisticated semantic analysis
|
|
6
|
-
*
|
|
7
|
-
* This engine provides the core AI capabilities that power:
|
|
8
|
-
* - Smart entity type detection
|
|
9
|
-
* - Intelligent relationship inference
|
|
10
|
-
* - Data quality assessment
|
|
11
|
-
* - Impact analysis for operations
|
|
12
|
-
* - Pattern recognition and insights
|
|
13
|
-
*/
|
|
14
|
-
import { BrainyData } from '../brainyData.js';
|
|
15
|
-
import { NounType, VerbType } from '../types/graphTypes.js';
|
|
16
|
-
export interface EntityAnalysis {
|
|
17
|
-
detectedType: NounType;
|
|
18
|
-
confidence: number;
|
|
19
|
-
reasoning: string;
|
|
20
|
-
alternativeTypes: Array<{
|
|
21
|
-
type: NounType;
|
|
22
|
-
confidence: number;
|
|
23
|
-
}>;
|
|
24
|
-
suggestedId?: string;
|
|
25
|
-
qualityScore: number;
|
|
26
|
-
}
|
|
27
|
-
export interface RelationshipAnalysis {
|
|
28
|
-
verbType: VerbType;
|
|
29
|
-
confidence: number;
|
|
30
|
-
weight: number;
|
|
31
|
-
reasoning: string;
|
|
32
|
-
context: string;
|
|
33
|
-
metadata?: Record<string, any>;
|
|
34
|
-
}
|
|
35
|
-
export interface DeleteAnalysis {
|
|
36
|
-
strategy: 'soft-delete' | 'hard-delete' | 'cascade-delete' | 'soft-delete-preserve';
|
|
37
|
-
impactedEntities: string[];
|
|
38
|
-
orphanedRelationships: string[];
|
|
39
|
-
riskLevel: 'low' | 'medium' | 'high';
|
|
40
|
-
recommendation: string;
|
|
41
|
-
preserveData: boolean;
|
|
42
|
-
}
|
|
43
|
-
export interface DataInsights {
|
|
44
|
-
entityDistribution: Record<string, number>;
|
|
45
|
-
relationshipPatterns: Array<{
|
|
46
|
-
pattern: string;
|
|
47
|
-
frequency: number;
|
|
48
|
-
}>;
|
|
49
|
-
hierarchies: Array<{
|
|
50
|
-
type: string;
|
|
51
|
-
levels: number;
|
|
52
|
-
entities: string[];
|
|
53
|
-
}>;
|
|
54
|
-
clusters: Array<{
|
|
55
|
-
type: string;
|
|
56
|
-
size: number;
|
|
57
|
-
entities: string[];
|
|
58
|
-
}>;
|
|
59
|
-
anomalies: Array<{
|
|
60
|
-
type: string;
|
|
61
|
-
description: string;
|
|
62
|
-
entities: string[];
|
|
63
|
-
}>;
|
|
64
|
-
qualityMetrics: QualityAssessment;
|
|
65
|
-
}
|
|
66
|
-
export interface QualityAssessment {
|
|
67
|
-
completeness: number;
|
|
68
|
-
consistency: number;
|
|
69
|
-
accuracy: number;
|
|
70
|
-
richness: number;
|
|
71
|
-
recommendations: string[];
|
|
72
|
-
}
|
|
73
|
-
export interface DetectionOptions {
|
|
74
|
-
confidenceThreshold?: number;
|
|
75
|
-
includeAlternatives?: boolean;
|
|
76
|
-
generateReasoning?: boolean;
|
|
77
|
-
enableCaching?: boolean;
|
|
78
|
-
}
|
|
79
|
-
export interface ImpactOptions {
|
|
80
|
-
analyzeCascade?: boolean;
|
|
81
|
-
checkOrphans?: boolean;
|
|
82
|
-
riskAssessment?: boolean;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Neural Detection Engine - The Brainy AI Brain
|
|
86
|
-
*/
|
|
87
|
-
export declare class NeuralDetectionEngine {
|
|
88
|
-
private brainy;
|
|
89
|
-
private analysisCache;
|
|
90
|
-
private config;
|
|
91
|
-
constructor(brainy: BrainyData, config?: Partial<typeof NeuralDetectionEngine.prototype.config>);
|
|
92
|
-
/**
|
|
93
|
-
* Detect Entity Type - Replaces basic detectNounType() with neural analysis
|
|
94
|
-
*/
|
|
95
|
-
detectEntityType(data: any, options?: DetectionOptions): Promise<EntityAnalysis>;
|
|
96
|
-
/**
|
|
97
|
-
* Detect Relationship Types - Intelligent relationship inference
|
|
98
|
-
*/
|
|
99
|
-
detectRelationshipTypes(sourceData: any, targetData: any, options?: DetectionOptions): Promise<RelationshipAnalysis[]>;
|
|
100
|
-
/**
|
|
101
|
-
* Analyze Delete Impact - Intelligent cascade and orphan analysis
|
|
102
|
-
*/
|
|
103
|
-
analyzeDeleteImpact(nounId: string, options?: ImpactOptions): Promise<DeleteAnalysis>;
|
|
104
|
-
/**
|
|
105
|
-
* Generate Data Insights - Pattern recognition and analysis
|
|
106
|
-
*/
|
|
107
|
-
generateDataInsights(entities: any[], relationships: any[]): Promise<DataInsights>;
|
|
108
|
-
/**
|
|
109
|
-
* Assess Data Quality
|
|
110
|
-
*/
|
|
111
|
-
assessDataQuality(data: any[]): Promise<QualityAssessment>;
|
|
112
|
-
/**
|
|
113
|
-
* Calculate entity type confidence using multi-factor analysis
|
|
114
|
-
*/
|
|
115
|
-
private calculateEntityTypeConfidence;
|
|
116
|
-
/**
|
|
117
|
-
* Field-based confidence calculation
|
|
118
|
-
*/
|
|
119
|
-
private calculateFieldBasedConfidence;
|
|
120
|
-
/**
|
|
121
|
-
* Pattern-based confidence calculation
|
|
122
|
-
*/
|
|
123
|
-
private calculatePatternBasedConfidence;
|
|
124
|
-
/**
|
|
125
|
-
* Generate reasoning for entity type selection
|
|
126
|
-
*/
|
|
127
|
-
private generateEntityReasoning;
|
|
128
|
-
/**
|
|
129
|
-
* Calculate relationship confidence
|
|
130
|
-
*/
|
|
131
|
-
private calculateRelationshipConfidence;
|
|
132
|
-
/**
|
|
133
|
-
* Calculate relationship weight/strength
|
|
134
|
-
*/
|
|
135
|
-
private calculateRelationshipWeight;
|
|
136
|
-
/**
|
|
137
|
-
* Calculate type compatibility for relationships
|
|
138
|
-
*/
|
|
139
|
-
private calculateTypeCompatibility;
|
|
140
|
-
/**
|
|
141
|
-
* Generate relationship reasoning
|
|
142
|
-
*/
|
|
143
|
-
private generateRelationshipReasoning;
|
|
144
|
-
/**
|
|
145
|
-
* Extract main text from data object
|
|
146
|
-
*/
|
|
147
|
-
private extractMainText;
|
|
148
|
-
/**
|
|
149
|
-
* Extract relationship context
|
|
150
|
-
*/
|
|
151
|
-
private extractRelationshipContext;
|
|
152
|
-
/**
|
|
153
|
-
* Generate smart ID for entities
|
|
154
|
-
*/
|
|
155
|
-
private generateSmartId;
|
|
156
|
-
/**
|
|
157
|
-
* Assess entity quality
|
|
158
|
-
*/
|
|
159
|
-
private assessEntityQuality;
|
|
160
|
-
/**
|
|
161
|
-
* Basic type detection fallback
|
|
162
|
-
*/
|
|
163
|
-
private basicTypeDetection;
|
|
164
|
-
/**
|
|
165
|
-
* Check if relationship is critical for cascade analysis
|
|
166
|
-
*/
|
|
167
|
-
private isRelationshipCritical;
|
|
168
|
-
/**
|
|
169
|
-
* Get verb specificity score
|
|
170
|
-
*/
|
|
171
|
-
private getVerbSpecificity;
|
|
172
|
-
/**
|
|
173
|
-
* Get relevant fields for entity type
|
|
174
|
-
*/
|
|
175
|
-
private getRelevantFields;
|
|
176
|
-
/**
|
|
177
|
-
* Get matched patterns for entity type
|
|
178
|
-
*/
|
|
179
|
-
private getMatchedPatterns;
|
|
180
|
-
/**
|
|
181
|
-
* Detect hierarchies in relationships
|
|
182
|
-
*/
|
|
183
|
-
private detectHierarchies;
|
|
184
|
-
/**
|
|
185
|
-
* Detect clusters in entities
|
|
186
|
-
*/
|
|
187
|
-
private detectClusters;
|
|
188
|
-
/**
|
|
189
|
-
* Extract relationship metadata
|
|
190
|
-
*/
|
|
191
|
-
private extractRelationshipMetadata;
|
|
192
|
-
/**
|
|
193
|
-
* Generate cache key
|
|
194
|
-
*/
|
|
195
|
-
private generateCacheKey;
|
|
196
|
-
/**
|
|
197
|
-
* Clear analysis cache
|
|
198
|
-
*/
|
|
199
|
-
clearCache(): void;
|
|
200
|
-
/**
|
|
201
|
-
* Get cache statistics
|
|
202
|
-
*/
|
|
203
|
-
getCacheStats(): {
|
|
204
|
-
size: number;
|
|
205
|
-
keys: string[];
|
|
206
|
-
};
|
|
207
|
-
}
|