@soulcraft/brainy 1.5.0 → 2.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 +188 -0
- package/LICENSE +2 -2
- package/README.md +200 -595
- 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 +1331 -853
- 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 +40 -125
- 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
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Monitoring Augmentation - Optional Health & Performance Monitoring
|
|
3
|
+
*
|
|
4
|
+
* Replaces the hardcoded HealthMonitor in BrainyData with an optional augmentation.
|
|
5
|
+
* Provides health checks, performance monitoring, and distributed system tracking.
|
|
6
|
+
*
|
|
7
|
+
* Zero-config: Automatically enabled for distributed deployments
|
|
8
|
+
* Can be disabled or customized via augmentation registry
|
|
9
|
+
*/
|
|
10
|
+
import { BaseAugmentation } from './brainyAugmentation.js';
|
|
11
|
+
import { HealthMonitor } from '../distributed/healthMonitor.js';
|
|
12
|
+
import { DistributedConfigManager as ConfigManager } from '../distributed/configManager.js';
|
|
13
|
+
/**
|
|
14
|
+
* MonitoringAugmentation - Makes health monitoring optional and pluggable
|
|
15
|
+
*
|
|
16
|
+
* Features:
|
|
17
|
+
* - Health status tracking
|
|
18
|
+
* - Performance monitoring
|
|
19
|
+
* - Error rate tracking
|
|
20
|
+
* - Distributed system health
|
|
21
|
+
* - Zero-config with smart defaults
|
|
22
|
+
*/
|
|
23
|
+
export class MonitoringAugmentation extends BaseAugmentation {
|
|
24
|
+
constructor(config = {}) {
|
|
25
|
+
super();
|
|
26
|
+
this.name = 'monitoring';
|
|
27
|
+
this.timing = 'after';
|
|
28
|
+
this.operations = ['search', 'add', 'delete', 'all'];
|
|
29
|
+
this.priority = 30; // Low priority, observability layer
|
|
30
|
+
this.healthMonitor = null;
|
|
31
|
+
this.configManager = null;
|
|
32
|
+
this.requestStartTimes = new Map();
|
|
33
|
+
this.config = {
|
|
34
|
+
enabled: true,
|
|
35
|
+
healthCheckInterval: 30000, // 30 seconds
|
|
36
|
+
metricsInterval: 60000, // 1 minute
|
|
37
|
+
trackLatency: true,
|
|
38
|
+
trackErrors: true,
|
|
39
|
+
trackCacheMetrics: true,
|
|
40
|
+
exposeHealthEndpoint: true,
|
|
41
|
+
...config
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
async onInitialize() {
|
|
45
|
+
if (!this.config.enabled) {
|
|
46
|
+
this.log('Monitoring augmentation disabled by configuration');
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
// Initialize config manager and health monitor (requires storage)
|
|
50
|
+
if (this.context?.storage) {
|
|
51
|
+
this.configManager = new ConfigManager(this.context.storage);
|
|
52
|
+
this.healthMonitor = new HealthMonitor(this.configManager);
|
|
53
|
+
this.healthMonitor.start();
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
this.log('Storage not available - health monitoring disabled', 'warn');
|
|
57
|
+
}
|
|
58
|
+
this.log('Monitoring augmentation initialized');
|
|
59
|
+
}
|
|
60
|
+
async onShutdown() {
|
|
61
|
+
if (this.healthMonitor) {
|
|
62
|
+
this.healthMonitor.stop();
|
|
63
|
+
this.healthMonitor = null;
|
|
64
|
+
}
|
|
65
|
+
this.configManager = null;
|
|
66
|
+
this.requestStartTimes.clear();
|
|
67
|
+
this.log('Monitoring augmentation shut down');
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Execute augmentation - track health metrics
|
|
71
|
+
*/
|
|
72
|
+
async execute(operation, params, next) {
|
|
73
|
+
// If monitoring disabled, just pass through
|
|
74
|
+
if (!this.healthMonitor || !this.config.enabled) {
|
|
75
|
+
return next();
|
|
76
|
+
}
|
|
77
|
+
// Generate request ID for tracking
|
|
78
|
+
const requestId = `${operation}-${Date.now()}-${Math.random()}`;
|
|
79
|
+
// Track request start time
|
|
80
|
+
if (this.config.trackLatency) {
|
|
81
|
+
this.requestStartTimes.set(requestId, Date.now());
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
// Execute operation
|
|
85
|
+
const result = await next();
|
|
86
|
+
// Track successful operation
|
|
87
|
+
if (this.config.trackLatency) {
|
|
88
|
+
const startTime = this.requestStartTimes.get(requestId);
|
|
89
|
+
if (startTime) {
|
|
90
|
+
const latency = Date.now() - startTime;
|
|
91
|
+
this.healthMonitor.recordRequest(latency, false);
|
|
92
|
+
this.requestStartTimes.delete(requestId);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Update vector count for 'add' operations
|
|
96
|
+
if (operation === 'add' && this.context?.brain) {
|
|
97
|
+
try {
|
|
98
|
+
const count = await this.context.brain.getNounCount();
|
|
99
|
+
this.healthMonitor.updateVectorCount(count);
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
// Ignore count update errors
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// Track cache metrics for search operations
|
|
106
|
+
if (operation === 'search' && this.config.trackCacheMetrics) {
|
|
107
|
+
// Check if result came from cache (would be set by cache augmentation)
|
|
108
|
+
const fromCache = params._fromCache || false;
|
|
109
|
+
this.healthMonitor.recordCacheAccess(fromCache);
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
// Track error
|
|
115
|
+
if (this.config.trackErrors) {
|
|
116
|
+
const startTime = this.requestStartTimes.get(requestId);
|
|
117
|
+
if (startTime) {
|
|
118
|
+
const latency = Date.now() - startTime;
|
|
119
|
+
this.healthMonitor.recordRequest(latency, true);
|
|
120
|
+
this.requestStartTimes.delete(requestId);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
this.healthMonitor.recordRequest(0, true);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
throw error;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get health status
|
|
131
|
+
*/
|
|
132
|
+
getHealthStatus() {
|
|
133
|
+
if (!this.healthMonitor) {
|
|
134
|
+
return {
|
|
135
|
+
status: 'disabled',
|
|
136
|
+
enabled: false,
|
|
137
|
+
uptime: 0,
|
|
138
|
+
vectorCount: 0,
|
|
139
|
+
requestRate: 0,
|
|
140
|
+
errorRate: 0,
|
|
141
|
+
cacheHitRate: 0
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
status: 'healthy',
|
|
146
|
+
enabled: true,
|
|
147
|
+
...this.healthMonitor.getHealthEndpointData()
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Get health endpoint data (for API exposure)
|
|
152
|
+
*/
|
|
153
|
+
getHealthEndpointData() {
|
|
154
|
+
if (!this.healthMonitor) {
|
|
155
|
+
return {
|
|
156
|
+
status: 'disabled',
|
|
157
|
+
timestamp: new Date().toISOString()
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
return this.healthMonitor.getHealthEndpointData();
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Update vector count manually
|
|
164
|
+
*/
|
|
165
|
+
updateVectorCount(count) {
|
|
166
|
+
if (this.healthMonitor) {
|
|
167
|
+
this.healthMonitor.updateVectorCount(count);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Record custom health metric
|
|
172
|
+
*/
|
|
173
|
+
recordCustomMetric(name, value) {
|
|
174
|
+
if (this.healthMonitor) {
|
|
175
|
+
// Health monitor could be extended to track custom metrics
|
|
176
|
+
this.log(`Custom metric recorded: ${name}=${value}`, 'info');
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Check if system is healthy
|
|
181
|
+
*/
|
|
182
|
+
isHealthy() {
|
|
183
|
+
if (!this.healthMonitor)
|
|
184
|
+
return true; // If disabled, assume healthy
|
|
185
|
+
const data = this.healthMonitor.getHealthEndpointData();
|
|
186
|
+
// Define health criteria
|
|
187
|
+
const errorRateThreshold = 0.05; // 5% error rate
|
|
188
|
+
const minUptime = 60000; // 1 minute
|
|
189
|
+
return (data.errorRate < errorRateThreshold &&
|
|
190
|
+
data.uptime > minUptime);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Get uptime in milliseconds
|
|
194
|
+
*/
|
|
195
|
+
getUptime() {
|
|
196
|
+
if (!this.healthMonitor)
|
|
197
|
+
return 0;
|
|
198
|
+
const data = this.healthMonitor.getHealthEndpointData();
|
|
199
|
+
return data.uptime || 0;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Force health check
|
|
203
|
+
*/
|
|
204
|
+
async checkHealth() {
|
|
205
|
+
if (!this.healthMonitor)
|
|
206
|
+
return true;
|
|
207
|
+
// Perform active health check
|
|
208
|
+
try {
|
|
209
|
+
// Could ping storage, check memory, etc.
|
|
210
|
+
if (this.context?.storage) {
|
|
211
|
+
await this.context.storage.getStatistics?.();
|
|
212
|
+
}
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
this.log('Health check failed', 'warn');
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Factory function for zero-config monitoring augmentation
|
|
223
|
+
*/
|
|
224
|
+
export function createMonitoringAugmentation(config) {
|
|
225
|
+
return new MonitoringAugmentation(config);
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=monitoringAugmentation.js.map
|
|
@@ -4,11 +4,9 @@
|
|
|
4
4
|
* 🧠 Built-in AI augmentation for intelligent data processing
|
|
5
5
|
* ⚛️ Always free, always included, always enabled
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* It provides intelligent data understanding, entity detection, and relationship analysis.
|
|
7
|
+
* Now using the unified BrainyAugmentation interface!
|
|
9
8
|
*/
|
|
10
|
-
import {
|
|
11
|
-
import { BrainyData } from '../brainyData.js';
|
|
9
|
+
import { BaseAugmentation } from './brainyAugmentation.js';
|
|
12
10
|
export interface NeuralAnalysisResult {
|
|
13
11
|
detectedEntities: DetectedEntity[];
|
|
14
12
|
detectedRelationships: DetectedRelationship[];
|
|
@@ -48,85 +46,40 @@ export interface NeuralImportConfig {
|
|
|
48
46
|
enableWeights: boolean;
|
|
49
47
|
skipDuplicates: boolean;
|
|
50
48
|
categoryFilter?: string[];
|
|
49
|
+
dataType?: string;
|
|
51
50
|
}
|
|
52
51
|
/**
|
|
53
|
-
* Neural Import
|
|
52
|
+
* Neural Import Augmentation - Unified Implementation
|
|
53
|
+
* Processes data with AI before storage operations
|
|
54
54
|
*/
|
|
55
|
-
export declare class NeuralImportAugmentation
|
|
56
|
-
readonly name
|
|
57
|
-
readonly
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
export declare class NeuralImportAugmentation extends BaseAugmentation {
|
|
56
|
+
readonly name = "neural-import";
|
|
57
|
+
readonly timing: "before";
|
|
58
|
+
operations: ("add" | "addNoun" | "addVerb" | "all")[];
|
|
59
|
+
readonly priority = 80;
|
|
60
60
|
private config;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
private analysisCache;
|
|
62
|
+
constructor(config?: Partial<NeuralImportConfig>);
|
|
63
|
+
protected onInitialize(): Promise<void>;
|
|
64
|
+
protected onShutdown(): Promise<void>;
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
66
|
+
* Execute augmentation - process data with AI before storage
|
|
67
67
|
*/
|
|
68
|
-
|
|
69
|
-
nouns: string[];
|
|
70
|
-
verbs: string[];
|
|
71
|
-
confidence?: number;
|
|
72
|
-
insights?: Array<{
|
|
73
|
-
type: string;
|
|
74
|
-
description: string;
|
|
75
|
-
confidence: number;
|
|
76
|
-
}>;
|
|
77
|
-
metadata?: Record<string, unknown>;
|
|
78
|
-
}>>;
|
|
68
|
+
execute<T = any>(operation: string, params: any, next: () => Promise<T>): Promise<T>;
|
|
79
69
|
/**
|
|
80
|
-
*
|
|
70
|
+
* Extract raw data from operation params
|
|
81
71
|
*/
|
|
82
|
-
|
|
83
|
-
nouns: string[];
|
|
84
|
-
verbs: string[];
|
|
85
|
-
confidence?: number;
|
|
86
|
-
}) => void): Promise<void>;
|
|
72
|
+
private extractRawData;
|
|
87
73
|
/**
|
|
88
|
-
*
|
|
74
|
+
* Get the full neural analysis result (for external use)
|
|
89
75
|
*/
|
|
90
|
-
|
|
91
|
-
entityTypes: Array<{
|
|
92
|
-
type: string;
|
|
93
|
-
count: number;
|
|
94
|
-
confidence: number;
|
|
95
|
-
}>;
|
|
96
|
-
relationshipTypes: Array<{
|
|
97
|
-
type: string;
|
|
98
|
-
count: number;
|
|
99
|
-
confidence: number;
|
|
100
|
-
}>;
|
|
101
|
-
dataQuality: {
|
|
102
|
-
completeness: number;
|
|
103
|
-
consistency: number;
|
|
104
|
-
accuracy: number;
|
|
105
|
-
};
|
|
106
|
-
recommendations: string[];
|
|
107
|
-
}>>;
|
|
108
|
-
/**
|
|
109
|
-
* Validate data compatibility with current knowledge base
|
|
110
|
-
*/
|
|
111
|
-
validateCompatibility(rawData: Buffer | string, dataType: string): Promise<AugmentationResponse<{
|
|
112
|
-
compatible: boolean;
|
|
113
|
-
issues: Array<{
|
|
114
|
-
type: string;
|
|
115
|
-
description: string;
|
|
116
|
-
severity: 'low' | 'medium' | 'high';
|
|
117
|
-
}>;
|
|
118
|
-
suggestions: string[];
|
|
119
|
-
}>>;
|
|
120
|
-
/**
|
|
121
|
-
* Get the full neural analysis result (custom method for Cortex integration)
|
|
122
|
-
*/
|
|
123
|
-
getNeuralAnalysis(rawData: Buffer | string, dataType: string): Promise<NeuralAnalysisResult>;
|
|
76
|
+
getNeuralAnalysis(rawData: Buffer | string, dataType?: string): Promise<NeuralAnalysisResult>;
|
|
124
77
|
/**
|
|
125
78
|
* Parse raw data based on type
|
|
126
79
|
*/
|
|
127
80
|
private parseRawData;
|
|
128
81
|
/**
|
|
129
|
-
*
|
|
82
|
+
* Parse CSV data
|
|
130
83
|
*/
|
|
131
84
|
private parseCSV;
|
|
132
85
|
/**
|
|
@@ -134,66 +87,46 @@ export declare class NeuralImportAugmentation implements ISenseAugmentation {
|
|
|
134
87
|
*/
|
|
135
88
|
private performNeuralAnalysis;
|
|
136
89
|
/**
|
|
137
|
-
*
|
|
138
|
-
*/
|
|
139
|
-
private detectEntitiesWithNeuralAnalysis;
|
|
140
|
-
/**
|
|
141
|
-
* Calculate entity type confidence using AI
|
|
142
|
-
*/
|
|
143
|
-
private calculateEntityTypeConfidence;
|
|
144
|
-
/**
|
|
145
|
-
* Field-based confidence calculation
|
|
146
|
-
*/
|
|
147
|
-
private calculateFieldBasedConfidence;
|
|
148
|
-
/**
|
|
149
|
-
* Pattern-based confidence calculation
|
|
150
|
-
*/
|
|
151
|
-
private calculatePatternBasedConfidence;
|
|
152
|
-
/**
|
|
153
|
-
* Generate reasoning for entity type selection
|
|
154
|
-
*/
|
|
155
|
-
private generateEntityReasoning;
|
|
156
|
-
/**
|
|
157
|
-
* Neural Relationship Detection
|
|
90
|
+
* Infer noun type from object structure
|
|
158
91
|
*/
|
|
159
|
-
private
|
|
92
|
+
private inferNounType;
|
|
160
93
|
/**
|
|
161
|
-
*
|
|
94
|
+
* Detect relationships from object references
|
|
162
95
|
*/
|
|
163
|
-
private
|
|
96
|
+
private detectRelationships;
|
|
164
97
|
/**
|
|
165
|
-
*
|
|
98
|
+
* Infer verb type from field name
|
|
166
99
|
*/
|
|
167
|
-
private
|
|
100
|
+
private inferVerbType;
|
|
168
101
|
/**
|
|
169
|
-
*
|
|
102
|
+
* Group entities by type
|
|
170
103
|
*/
|
|
171
|
-
private
|
|
104
|
+
private groupByType;
|
|
172
105
|
/**
|
|
173
|
-
*
|
|
106
|
+
* Store neural analysis results
|
|
174
107
|
*/
|
|
175
|
-
private extractMainText;
|
|
176
|
-
private generateSmartId;
|
|
177
|
-
private extractRelationshipContext;
|
|
178
|
-
private calculateTypeCompatibility;
|
|
179
|
-
private getVerbSpecificity;
|
|
180
|
-
private getRelevantFields;
|
|
181
|
-
private getMatchedPatterns;
|
|
182
|
-
private pruneRelationships;
|
|
183
|
-
private detectHierarchies;
|
|
184
|
-
private detectClusters;
|
|
185
|
-
private detectPatterns;
|
|
186
|
-
private calculateOverallConfidence;
|
|
187
108
|
private storeNeuralAnalysis;
|
|
188
|
-
private getDataTypeFromPath;
|
|
189
|
-
private generateRelationshipReasoning;
|
|
190
|
-
private extractRelationshipMetadata;
|
|
191
109
|
/**
|
|
192
|
-
*
|
|
110
|
+
* Helper to get data type from file path
|
|
193
111
|
*/
|
|
194
|
-
private
|
|
112
|
+
private getDataTypeFromPath;
|
|
195
113
|
/**
|
|
196
|
-
*
|
|
197
|
-
|
|
198
|
-
|
|
114
|
+
* PUBLIC API: Process raw data (for external use, like Synapses)
|
|
115
|
+
* This maintains compatibility with code that wants to use Neural Import directly
|
|
116
|
+
*/
|
|
117
|
+
processRawData(rawData: Buffer | string, dataType: string, options?: Record<string, unknown>): Promise<{
|
|
118
|
+
success: boolean;
|
|
119
|
+
data: {
|
|
120
|
+
nouns: string[];
|
|
121
|
+
verbs: string[];
|
|
122
|
+
confidence?: number;
|
|
123
|
+
insights?: Array<{
|
|
124
|
+
type: string;
|
|
125
|
+
description: string;
|
|
126
|
+
confidence: number;
|
|
127
|
+
}>;
|
|
128
|
+
metadata?: Record<string, unknown>;
|
|
129
|
+
};
|
|
130
|
+
error?: string;
|
|
131
|
+
}>;
|
|
199
132
|
}
|