@soulcraft/brainy 0.55.0 → 0.56.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.
Files changed (125) hide show
  1. package/README.md +172 -730
  2. package/bin/cortex.js +592 -0
  3. package/dist/augmentations/memoryAugmentations.d.ts.map +1 -1
  4. package/dist/augmentations/neuralImportSense.d.ts +196 -0
  5. package/dist/augmentations/neuralImportSense.js +747 -0
  6. package/dist/augmentations/neuralImportSense.js.map +1 -0
  7. package/dist/brainyData.d.ts.map +1 -1
  8. package/dist/brainyData.js +12 -0
  9. package/dist/brainyData.js.map +1 -1
  10. package/dist/chat/brainyChat.d.ts +42 -0
  11. package/dist/chat/brainyChat.js +340 -0
  12. package/dist/chat/brainyChat.js.map +1 -0
  13. package/dist/connectors/interfaces/IConnector.d.ts +143 -0
  14. package/dist/connectors/interfaces/IConnector.js +8 -0
  15. package/dist/connectors/interfaces/IConnector.js.map +1 -0
  16. package/dist/coreTypes.d.ts.map +1 -1
  17. package/dist/cortex/backupRestore.d.ts +85 -0
  18. package/dist/cortex/backupRestore.js +326 -0
  19. package/dist/cortex/backupRestore.js.map +1 -0
  20. package/dist/cortex/cortex.d.ts +249 -0
  21. package/dist/cortex/cortex.js +2304 -0
  22. package/dist/cortex/cortex.js.map +1 -0
  23. package/dist/cortex/healthCheck.d.ts +85 -0
  24. package/dist/cortex/healthCheck.js +546 -0
  25. package/dist/cortex/healthCheck.js.map +1 -0
  26. package/dist/cortex/licensingSystem.d.ts +126 -0
  27. package/dist/cortex/licensingSystem.js +474 -0
  28. package/dist/cortex/licensingSystem.js.map +1 -0
  29. package/dist/cortex/neuralImport.d.ts +145 -0
  30. package/dist/cortex/neuralImport.js +620 -0
  31. package/dist/cortex/neuralImport.js.map +1 -0
  32. package/dist/cortex/performanceMonitor.d.ts +150 -0
  33. package/dist/cortex/performanceMonitor.js +371 -0
  34. package/dist/cortex/performanceMonitor.js.map +1 -0
  35. package/dist/cortex/serviceIntegration.d.ts +156 -0
  36. package/dist/cortex/serviceIntegration.js +384 -0
  37. package/dist/cortex/serviceIntegration.js.map +1 -0
  38. package/dist/cortex/webhookManager.d.ts +39 -0
  39. package/dist/cortex/webhookManager.js +326 -0
  40. package/dist/cortex/webhookManager.js.map +1 -0
  41. package/dist/hnsw/hnswIndex.d.ts.map +1 -1
  42. package/dist/hnsw/hnswIndexOptimized.d.ts.map +1 -1
  43. package/dist/index.d.ts +4 -0
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +5 -0
  46. package/dist/index.js.map +1 -1
  47. package/dist/patched-platform-node.d.ts +17 -0
  48. package/dist/patched-platform-node.d.ts.map +1 -0
  49. package/dist/shared/default-augmentations.d.ts +41 -0
  50. package/dist/shared/default-augmentations.js +112 -0
  51. package/dist/shared/default-augmentations.js.map +1 -0
  52. package/dist/storage/adapters/baseStorageAdapter.d.ts.map +1 -1
  53. package/dist/storage/adapters/fileSystemStorage.d.ts +14 -0
  54. package/dist/storage/adapters/fileSystemStorage.d.ts.map +1 -1
  55. package/dist/storage/adapters/fileSystemStorage.js +68 -0
  56. package/dist/storage/adapters/fileSystemStorage.js.map +1 -1
  57. package/dist/storage/adapters/memoryStorage.d.ts +13 -0
  58. package/dist/storage/adapters/memoryStorage.d.ts.map +1 -1
  59. package/dist/storage/adapters/memoryStorage.js +19 -0
  60. package/dist/storage/adapters/memoryStorage.js.map +1 -1
  61. package/dist/storage/adapters/opfsStorage.d.ts.map +1 -1
  62. package/dist/storage/adapters/s3CompatibleStorage.d.ts.map +1 -1
  63. package/dist/storage/baseStorage.d.ts.map +1 -1
  64. package/dist/storage/storageFactory.d.ts.map +1 -1
  65. package/dist/testing/prettyReporter.d.ts +23 -0
  66. package/dist/testing/prettyReporter.d.ts.map +1 -0
  67. package/dist/testing/prettySummaryReporter.d.ts +22 -0
  68. package/dist/testing/prettySummaryReporter.d.ts.map +1 -0
  69. package/dist/types/augmentations.d.ts +48 -1
  70. package/dist/unified.min.js +12511 -0
  71. package/dist/unified.min.js.map +1 -0
  72. package/dist/utils/embedding.d.ts.map +1 -1
  73. package/dist/utils/embedding.js +1 -0
  74. package/dist/utils/embedding.js.map +1 -1
  75. package/dist/utils/index.d.ts.map +1 -1
  76. package/dist/utils/tensorflowUtils.d.ts +17 -0
  77. package/dist/utils/tensorflowUtils.d.ts.map +1 -0
  78. package/dist/webhooks/webhookSystem.d.ts +114 -0
  79. package/dist/webhooks/webhookSystem.js +321 -0
  80. package/dist/webhooks/webhookSystem.js.map +1 -0
  81. package/package.json +11 -1
  82. package/dist/browserFramework.d.ts.map +0 -1
  83. package/dist/cortex/cli.d.ts +0 -8
  84. package/dist/cortex/cli.js +0 -207
  85. package/dist/cortex/cli.js.map +0 -1
  86. package/dist/cortex/commands/index.d.ts +0 -79
  87. package/dist/cortex/commands/index.js +0 -614
  88. package/dist/cortex/commands/index.js.map +0 -1
  89. package/dist/cortex/config.d.ts +0 -112
  90. package/dist/cortex/config.js +0 -312
  91. package/dist/cortex/config.js.map +0 -1
  92. package/dist/demo.d.ts.map +0 -1
  93. package/dist/distributed/configManager.d.ts.map +0 -1
  94. package/dist/distributed/domainDetector.d.ts.map +0 -1
  95. package/dist/distributed/hashPartitioner.d.ts.map +0 -1
  96. package/dist/distributed/healthMonitor.d.ts.map +0 -1
  97. package/dist/distributed/index.d.ts.map +0 -1
  98. package/dist/distributed/operationalModes.d.ts.map +0 -1
  99. package/dist/hnsw/distributedSearch.d.ts.map +0 -1
  100. package/dist/hnsw/optimizedHNSWIndex.d.ts.map +0 -1
  101. package/dist/hnsw/partitionedHNSWIndex.d.ts.map +0 -1
  102. package/dist/hnsw/scaledHNSWSystem.d.ts.map +0 -1
  103. package/dist/storage/adapters/batchS3Operations.d.ts.map +0 -1
  104. package/dist/storage/adapters/optimizedS3Search.d.ts.map +0 -1
  105. package/dist/storage/cacheManager.d.ts.map +0 -1
  106. package/dist/storage/enhancedCacheManager.d.ts.map +0 -1
  107. package/dist/storage/readOnlyOptimizations.d.ts.map +0 -1
  108. package/dist/types/distributedTypes.d.ts.map +0 -1
  109. package/dist/types/paginationTypes.d.ts.map +0 -1
  110. package/dist/types/tensorflowTypes.js +0 -6
  111. package/dist/types/tensorflowTypes.js.map +0 -1
  112. package/dist/utils/autoConfiguration.d.ts.map +0 -1
  113. package/dist/utils/cacheAutoConfig.d.ts.map +0 -1
  114. package/dist/utils/crypto.d.ts.map +0 -1
  115. package/dist/utils/fieldNameTracking.d.ts.map +0 -1
  116. package/dist/utils/jsonProcessing.d.ts.map +0 -1
  117. package/dist/utils/logger.d.ts.map +0 -1
  118. package/dist/utils/robustModelLoader.d.ts +0 -112
  119. package/dist/utils/robustModelLoader.d.ts.map +0 -1
  120. package/dist/utils/robustModelLoader.js +0 -624
  121. package/dist/utils/robustModelLoader.js.map +0 -1
  122. package/dist/utils/searchCache.d.ts.map +0 -1
  123. package/dist/utils/statisticsCollector.d.ts.map +0 -1
  124. package/dist/utils/typeUtils.d.ts.map +0 -1
  125. package/dist/utils/version.d.ts.map +0 -1
@@ -0,0 +1,620 @@
1
+ /**
2
+ * Neural Import - Atomic Age AI-Powered Data Understanding System
3
+ *
4
+ * 🧠 Leveraging the brain-in-jar to understand and automatically structure data
5
+ * ⚛️ Complete with confidence scoring and relationship weight calculation
6
+ */
7
+ import { NounType, VerbType } from '../types/graphTypes.js';
8
+ import * as fs from 'fs/promises';
9
+ import * as path from 'path';
10
+ // @ts-ignore
11
+ import chalk from 'chalk';
12
+ // @ts-ignore
13
+ import ora from 'ora';
14
+ // @ts-ignore
15
+ import boxen from 'boxen';
16
+ // @ts-ignore
17
+ import Table from 'cli-table3';
18
+ // @ts-ignore
19
+ import prompts from 'prompts';
20
+ /**
21
+ * Neural Import Engine - The Brain Behind the Analysis
22
+ */
23
+ export class NeuralImport {
24
+ constructor(brainy) {
25
+ this.colors = {
26
+ primary: chalk.hex('#3A5F4A'),
27
+ success: chalk.hex('#2D4A3A'),
28
+ warning: chalk.hex('#D67441'),
29
+ error: chalk.hex('#B85C35'),
30
+ info: chalk.hex('#4A6B5A'),
31
+ dim: chalk.hex('#8A9B8A'),
32
+ highlight: chalk.hex('#E88B5A'),
33
+ accent: chalk.hex('#F5E6D3'),
34
+ brain: chalk.hex('#E88B5A')
35
+ };
36
+ this.emojis = {
37
+ brain: '🧠',
38
+ atom: '⚛️',
39
+ lab: '🔬',
40
+ data: '🎛️',
41
+ magic: '⚡',
42
+ check: '✅',
43
+ warning: '⚠️',
44
+ sparkle: '✨',
45
+ rocket: '🚀',
46
+ gear: '⚙️'
47
+ };
48
+ this.brainy = brainy;
49
+ }
50
+ /**
51
+ * Main Neural Import Function - The Master Controller
52
+ */
53
+ async neuralImport(filePath, options = {}) {
54
+ const opts = {
55
+ confidenceThreshold: 0.7,
56
+ autoApply: false,
57
+ enableWeights: true,
58
+ previewOnly: false,
59
+ validateOnly: false,
60
+ skipDuplicates: true,
61
+ ...options
62
+ };
63
+ console.log(boxen(`${this.emojis.brain} ${this.colors.brain('NEURAL IMPORT INITIATED')} ${this.emojis.atom}\n\n` +
64
+ `${this.colors.accent('◆')} ${this.colors.dim('Activating atomic age AI analysis')}\n` +
65
+ `${this.colors.accent('◆')} ${this.colors.dim('File:')} ${this.colors.highlight(filePath)}\n` +
66
+ `${this.colors.accent('◆')} ${this.colors.dim('Confidence Threshold:')} ${this.colors.highlight(opts.confidenceThreshold.toString())}`, { padding: 1, borderStyle: 'round', borderColor: '#E88B5A' }));
67
+ const spinner = ora(`${this.emojis.brain} Initializing neural analysis...`).start();
68
+ try {
69
+ // Phase 1: Data Parsing
70
+ spinner.text = `${this.emojis.lab} Parsing data structure...`;
71
+ const rawData = await this.parseFile(filePath);
72
+ // Phase 2: Neural Entity Detection
73
+ spinner.text = `${this.emojis.atom} Analyzing ${Object.keys(NounType).length} entity types...`;
74
+ const detectedEntities = await this.detectEntitiesWithNeuralAnalysis(rawData, opts);
75
+ // Phase 3: Neural Relationship Detection
76
+ spinner.text = `${this.emojis.data} Testing ${Object.keys(VerbType).length} relationship patterns...`;
77
+ const detectedRelationships = await this.detectRelationshipsWithNeuralAnalysis(detectedEntities, rawData, opts);
78
+ // Phase 4: Neural Insights Generation
79
+ spinner.text = `${this.emojis.magic} Computing neural insights...`;
80
+ const insights = await this.generateNeuralInsights(detectedEntities, detectedRelationships);
81
+ // Phase 5: Confidence Scoring
82
+ const overallConfidence = this.calculateOverallConfidence(detectedEntities, detectedRelationships);
83
+ spinner.stop();
84
+ const result = {
85
+ detectedEntities,
86
+ detectedRelationships,
87
+ confidence: overallConfidence,
88
+ insights,
89
+ preview: await this.generatePreview(detectedEntities, detectedRelationships)
90
+ };
91
+ // Display results
92
+ await this.displayNeuralAnalysisResults(result, opts);
93
+ // Handle execution based on options
94
+ if (opts.previewOnly || opts.validateOnly) {
95
+ return result;
96
+ }
97
+ if (!opts.autoApply) {
98
+ const shouldExecute = await this.confirmNeuralImport(result);
99
+ if (!shouldExecute) {
100
+ console.log(this.colors.dim('Neural import cancelled'));
101
+ return result;
102
+ }
103
+ }
104
+ // Execute the import
105
+ await this.executeNeuralImport(result, opts);
106
+ return result;
107
+ }
108
+ catch (error) {
109
+ spinner.fail('Neural analysis failed');
110
+ throw error;
111
+ }
112
+ }
113
+ /**
114
+ * Parse file based on extension
115
+ */
116
+ async parseFile(filePath) {
117
+ const ext = path.extname(filePath).toLowerCase();
118
+ const content = await fs.readFile(filePath, 'utf8');
119
+ switch (ext) {
120
+ case '.json':
121
+ const jsonData = JSON.parse(content);
122
+ return Array.isArray(jsonData) ? jsonData : [jsonData];
123
+ case '.csv':
124
+ return this.parseCSV(content);
125
+ case '.yaml':
126
+ case '.yml':
127
+ // For now, basic YAML support - in full implementation would use yaml parser
128
+ return JSON.parse(content); // Placeholder
129
+ default:
130
+ throw new Error(`Unsupported file format: ${ext}`);
131
+ }
132
+ }
133
+ /**
134
+ * Basic CSV parser
135
+ */
136
+ parseCSV(content) {
137
+ const lines = content.split('\n').filter(line => line.trim());
138
+ if (lines.length < 2)
139
+ return [];
140
+ const headers = lines[0].split(',').map(h => h.trim().replace(/"/g, ''));
141
+ const data = [];
142
+ for (let i = 1; i < lines.length; i++) {
143
+ const values = lines[i].split(',').map(v => v.trim().replace(/"/g, ''));
144
+ const row = {};
145
+ headers.forEach((header, index) => {
146
+ row[header] = values[index] || '';
147
+ });
148
+ data.push(row);
149
+ }
150
+ return data;
151
+ }
152
+ /**
153
+ * Neural Entity Detection - The Core AI Engine
154
+ */
155
+ async detectEntitiesWithNeuralAnalysis(rawData, options) {
156
+ const entities = [];
157
+ const nounTypes = Object.values(NounType);
158
+ for (const [index, dataItem] of rawData.entries()) {
159
+ const mainText = this.extractMainText(dataItem);
160
+ const detections = [];
161
+ // Test against all noun types using semantic similarity
162
+ for (const nounType of nounTypes) {
163
+ const confidence = await this.calculateEntityTypeConfidence(mainText, dataItem, nounType);
164
+ if (confidence >= options.confidenceThreshold - 0.2) { // Allow slightly lower for alternatives
165
+ const reasoning = await this.generateEntityReasoning(mainText, dataItem, nounType);
166
+ detections.push({ type: nounType, confidence, reasoning });
167
+ }
168
+ }
169
+ if (detections.length > 0) {
170
+ // Sort by confidence
171
+ detections.sort((a, b) => b.confidence - a.confidence);
172
+ const primaryType = detections[0];
173
+ const alternatives = detections.slice(1, 3); // Top 2 alternatives
174
+ entities.push({
175
+ originalData: dataItem,
176
+ nounType: primaryType.type,
177
+ confidence: primaryType.confidence,
178
+ suggestedId: this.generateSmartId(dataItem, primaryType.type, index),
179
+ reasoning: primaryType.reasoning,
180
+ alternativeTypes: alternatives
181
+ });
182
+ }
183
+ }
184
+ return entities;
185
+ }
186
+ /**
187
+ * Calculate entity type confidence using AI
188
+ */
189
+ async calculateEntityTypeConfidence(text, data, nounType) {
190
+ // Base semantic similarity using search instead of similarity method
191
+ const searchResults = await this.brainy.search(text + ' ' + nounType, 1);
192
+ const textSimilarity = searchResults.length > 0 ? searchResults[0].score : 0.5;
193
+ // Field-based confidence boost
194
+ const fieldBoost = this.calculateFieldBasedConfidence(data, nounType);
195
+ // Pattern-based confidence boost
196
+ const patternBoost = this.calculatePatternBasedConfidence(text, data, nounType);
197
+ // Combine confidences with weights
198
+ const combined = (textSimilarity * 0.5) + (fieldBoost * 0.3) + (patternBoost * 0.2);
199
+ return Math.min(combined, 1.0);
200
+ }
201
+ /**
202
+ * Field-based confidence calculation
203
+ */
204
+ calculateFieldBasedConfidence(data, nounType) {
205
+ const fields = Object.keys(data);
206
+ let boost = 0;
207
+ // Field patterns that boost confidence for specific noun types
208
+ const fieldPatterns = {
209
+ [NounType.Person]: ['name', 'email', 'phone', 'age', 'firstname', 'lastname', 'employee'],
210
+ [NounType.Organization]: ['company', 'organization', 'corp', 'inc', 'ltd', 'department', 'team'],
211
+ [NounType.Project]: ['project', 'task', 'deadline', 'status', 'milestone', 'deliverable'],
212
+ [NounType.Location]: ['address', 'city', 'country', 'state', 'zip', 'location', 'coordinates'],
213
+ [NounType.Product]: ['product', 'price', 'sku', 'inventory', 'category', 'brand'],
214
+ [NounType.Event]: ['date', 'time', 'venue', 'event', 'meeting', 'conference', 'schedule']
215
+ };
216
+ const relevantPatterns = fieldPatterns[nounType] || [];
217
+ for (const field of fields) {
218
+ for (const pattern of relevantPatterns) {
219
+ if (field.toLowerCase().includes(pattern)) {
220
+ boost += 0.1;
221
+ }
222
+ }
223
+ }
224
+ return Math.min(boost, 0.5);
225
+ }
226
+ /**
227
+ * Pattern-based confidence calculation
228
+ */
229
+ calculatePatternBasedConfidence(text, data, nounType) {
230
+ let boost = 0;
231
+ // Content patterns that indicate entity types
232
+ const patterns = {
233
+ [NounType.Person]: [
234
+ /@.*\.com/i, // Email pattern
235
+ /\b[A-Z][a-z]+ [A-Z][a-z]+\b/, // Name pattern
236
+ /Mr\.|Mrs\.|Dr\.|Prof\./i // Title pattern
237
+ ],
238
+ [NounType.Organization]: [
239
+ /\bInc\.|Corp\.|LLC\.|Ltd\./i, // Corporate suffixes
240
+ /Company|Corporation|Enterprise/i
241
+ ],
242
+ [NounType.Location]: [
243
+ /\b\d{5}(-\d{4})?\b/, // ZIP code
244
+ /Street|Ave|Road|Blvd/i
245
+ ]
246
+ };
247
+ const relevantPatterns = patterns[nounType] || [];
248
+ for (const pattern of relevantPatterns) {
249
+ if (pattern.test(text)) {
250
+ boost += 0.15;
251
+ }
252
+ }
253
+ return Math.min(boost, 0.3);
254
+ }
255
+ /**
256
+ * Generate reasoning for entity type selection
257
+ */
258
+ async generateEntityReasoning(text, data, nounType) {
259
+ const reasons = [];
260
+ // Semantic similarity reason using search
261
+ const searchResults = await this.brainy.search(text + ' ' + nounType, 1);
262
+ const similarity = searchResults.length > 0 ? searchResults[0].score : 0.5;
263
+ if (similarity > 0.7) {
264
+ reasons.push(`High semantic similarity (${(similarity * 100).toFixed(1)}%)`);
265
+ }
266
+ // Field-based reasons
267
+ const relevantFields = this.getRelevantFields(data, nounType);
268
+ if (relevantFields.length > 0) {
269
+ reasons.push(`Contains ${nounType}-specific fields: ${relevantFields.join(', ')}`);
270
+ }
271
+ // Pattern-based reasons
272
+ const matchedPatterns = this.getMatchedPatterns(text, data, nounType);
273
+ if (matchedPatterns.length > 0) {
274
+ reasons.push(`Matches ${nounType} patterns: ${matchedPatterns.join(', ')}`);
275
+ }
276
+ return reasons.length > 0 ? reasons.join('; ') : 'General semantic match';
277
+ }
278
+ /**
279
+ * Neural Relationship Detection
280
+ */
281
+ async detectRelationshipsWithNeuralAnalysis(entities, rawData, options) {
282
+ const relationships = [];
283
+ const verbTypes = Object.values(VerbType);
284
+ // For each pair of entities, test relationship possibilities
285
+ for (let i = 0; i < entities.length; i++) {
286
+ for (let j = i + 1; j < entities.length; j++) {
287
+ const sourceEntity = entities[i];
288
+ const targetEntity = entities[j];
289
+ // Extract context for relationship detection
290
+ const context = this.extractRelationshipContext(sourceEntity.originalData, targetEntity.originalData, rawData);
291
+ // Test all verb types
292
+ for (const verbType of verbTypes) {
293
+ const confidence = await this.calculateRelationshipConfidence(sourceEntity, targetEntity, verbType, context);
294
+ if (confidence >= options.confidenceThreshold - 0.1) { // Slightly lower threshold for relationships
295
+ const weight = options.enableWeights ?
296
+ this.calculateRelationshipWeight(sourceEntity, targetEntity, verbType, context) :
297
+ 0.5;
298
+ const reasoning = await this.generateRelationshipReasoning(sourceEntity, targetEntity, verbType, context);
299
+ relationships.push({
300
+ sourceId: sourceEntity.suggestedId,
301
+ targetId: targetEntity.suggestedId,
302
+ verbType,
303
+ confidence,
304
+ weight,
305
+ reasoning,
306
+ context,
307
+ metadata: this.extractRelationshipMetadata(sourceEntity.originalData, targetEntity.originalData, verbType)
308
+ });
309
+ }
310
+ }
311
+ }
312
+ }
313
+ // Sort by confidence and remove duplicates/conflicts
314
+ return this.pruneRelationships(relationships);
315
+ }
316
+ /**
317
+ * Calculate relationship confidence
318
+ */
319
+ async calculateRelationshipConfidence(source, target, verbType, context) {
320
+ // Semantic similarity between entities and verb type using search
321
+ const relationshipText = `${this.extractMainText(source.originalData)} ${verbType} ${this.extractMainText(target.originalData)}`;
322
+ const directResults = await this.brainy.search(relationshipText, 1);
323
+ const directSimilarity = directResults.length > 0 ? directResults[0].score : 0.5;
324
+ // Context-based similarity using search
325
+ const contextResults = await this.brainy.search(context + ' ' + verbType, 1);
326
+ const contextSimilarity = contextResults.length > 0 ? contextResults[0].score : 0.5;
327
+ // Entity type compatibility
328
+ const typeCompatibility = this.calculateTypeCompatibility(source.nounType, target.nounType, verbType);
329
+ // Combine with weights
330
+ return (directSimilarity * 0.4) + (contextSimilarity * 0.4) + (typeCompatibility * 0.2);
331
+ }
332
+ /**
333
+ * Calculate relationship weight/strength
334
+ */
335
+ calculateRelationshipWeight(source, target, verbType, context) {
336
+ let weight = 0.5; // Base weight
337
+ // Context richness (more descriptive = stronger)
338
+ const contextWords = context.split(' ').length;
339
+ weight += Math.min(contextWords / 20, 0.2);
340
+ // Entity importance (higher confidence entities = stronger relationships)
341
+ const avgEntityConfidence = (source.confidence + target.confidence) / 2;
342
+ weight += avgEntityConfidence * 0.2;
343
+ // Verb type specificity (more specific verbs = stronger)
344
+ const verbSpecificity = this.getVerbSpecificity(verbType);
345
+ weight += verbSpecificity * 0.1;
346
+ return Math.min(weight, 1.0);
347
+ }
348
+ /**
349
+ * Generate Neural Insights - The Intelligence Layer
350
+ */
351
+ async generateNeuralInsights(entities, relationships) {
352
+ const insights = [];
353
+ // Detect hierarchies
354
+ const hierarchies = this.detectHierarchies(relationships);
355
+ hierarchies.forEach(hierarchy => {
356
+ insights.push({
357
+ type: 'hierarchy',
358
+ description: `Detected ${hierarchy.type} hierarchy with ${hierarchy.levels} levels`,
359
+ confidence: hierarchy.confidence,
360
+ affectedEntities: hierarchy.entities,
361
+ recommendation: `Consider visualizing the ${hierarchy.type} structure`
362
+ });
363
+ });
364
+ // Detect clusters
365
+ const clusters = this.detectClusters(entities, relationships);
366
+ clusters.forEach(cluster => {
367
+ insights.push({
368
+ type: 'cluster',
369
+ description: `Found cluster of ${cluster.size} ${cluster.primaryType} entities`,
370
+ confidence: cluster.confidence,
371
+ affectedEntities: cluster.entities,
372
+ recommendation: `These ${cluster.primaryType}s might form a natural grouping`
373
+ });
374
+ });
375
+ // Detect patterns
376
+ const patterns = this.detectPatterns(relationships);
377
+ patterns.forEach(pattern => {
378
+ insights.push({
379
+ type: 'pattern',
380
+ description: `Common relationship pattern: ${pattern.description}`,
381
+ confidence: pattern.confidence,
382
+ affectedEntities: pattern.entities,
383
+ recommendation: pattern.recommendation
384
+ });
385
+ });
386
+ return insights;
387
+ }
388
+ /**
389
+ * Display Neural Analysis Results
390
+ */
391
+ async displayNeuralAnalysisResults(result, options) {
392
+ // Entity summary
393
+ const entityTable = new Table({
394
+ head: [this.colors.brain('Entity Type'), this.colors.brain('Count'), this.colors.brain('Avg Confidence')],
395
+ colWidths: [20, 10, 15]
396
+ });
397
+ const entitySummary = this.summarizeEntities(result.detectedEntities);
398
+ Object.entries(entitySummary).forEach(([type, stats]) => {
399
+ entityTable.push([
400
+ this.colors.highlight(type),
401
+ this.colors.primary(stats.count.toString()),
402
+ this.colors.success(`${(stats.avgConfidence * 100).toFixed(1)}%`)
403
+ ]);
404
+ });
405
+ // Relationship summary
406
+ const relationshipTable = new Table({
407
+ head: [this.colors.brain('Relationship Type'), this.colors.brain('Count'), this.colors.brain('Avg Weight'), this.colors.brain('Avg Confidence')],
408
+ colWidths: [20, 10, 12, 15]
409
+ });
410
+ const relationshipSummary = this.summarizeRelationships(result.detectedRelationships);
411
+ Object.entries(relationshipSummary).forEach(([type, stats]) => {
412
+ relationshipTable.push([
413
+ this.colors.highlight(type),
414
+ this.colors.primary(stats.count.toString()),
415
+ this.colors.warning(`${stats.avgWeight.toFixed(2)}`),
416
+ this.colors.success(`${(stats.avgConfidence * 100).toFixed(1)}%`)
417
+ ]);
418
+ });
419
+ console.log(boxen(`${this.emojis.atom} ${this.colors.brain('NEURAL CLASSIFICATION RESULTS')}\n\n` +
420
+ entityTable.toString(), { padding: 1, borderStyle: 'round', borderColor: '#D67441' }));
421
+ console.log(boxen(`${this.emojis.data} ${this.colors.brain('NEURAL RELATIONSHIP MAPPING')}\n\n` +
422
+ relationshipTable.toString(), { padding: 1, borderStyle: 'round', borderColor: '#D67441' }));
423
+ // Display insights
424
+ if (result.insights.length > 0) {
425
+ const insightsText = result.insights.map(insight => `${this.colors.accent('◆')} ${insight.description} (${(insight.confidence * 100).toFixed(1)}% confidence)`).join('\n');
426
+ console.log(boxen(`${this.emojis.magic} ${this.colors.brain('NEURAL INSIGHTS')}\n\n` +
427
+ insightsText, { padding: 1, borderStyle: 'round', borderColor: '#E88B5A' }));
428
+ }
429
+ }
430
+ /**
431
+ * Helper methods for the neural system
432
+ */
433
+ extractMainText(data) {
434
+ // Extract the most relevant text from a data object
435
+ const textFields = ['name', 'title', 'description', 'content', 'text', 'label'];
436
+ for (const field of textFields) {
437
+ if (data[field] && typeof data[field] === 'string') {
438
+ return data[field];
439
+ }
440
+ }
441
+ // Fallback: concatenate all string values
442
+ return Object.values(data)
443
+ .filter(v => typeof v === 'string')
444
+ .join(' ')
445
+ .substring(0, 200); // Limit length
446
+ }
447
+ generateSmartId(data, nounType, index) {
448
+ const mainText = this.extractMainText(data);
449
+ const cleanText = mainText.toLowerCase().replace(/[^a-z0-9]/g, '_').substring(0, 20);
450
+ return `${nounType}_${cleanText}_${index}`;
451
+ }
452
+ extractRelationshipContext(source, target, allData) {
453
+ // Extract context for relationship detection
454
+ return [
455
+ this.extractMainText(source),
456
+ this.extractMainText(target),
457
+ // Add more contextual information
458
+ ].join(' ');
459
+ }
460
+ calculateTypeCompatibility(sourceType, targetType, verbType) {
461
+ // Define type compatibility matrix for relationships
462
+ const compatibilityMatrix = {
463
+ [NounType.Person]: {
464
+ [NounType.Organization]: [VerbType.MemberOf, VerbType.WorksWith],
465
+ [NounType.Project]: [VerbType.WorksWith, VerbType.Creates],
466
+ [NounType.Person]: [VerbType.WorksWith, VerbType.Mentors, VerbType.ReportsTo]
467
+ }
468
+ // Add more compatibility rules
469
+ };
470
+ const sourceCompatibility = compatibilityMatrix[sourceType];
471
+ if (sourceCompatibility && sourceCompatibility[targetType]) {
472
+ return sourceCompatibility[targetType].includes(verbType) ? 1.0 : 0.3;
473
+ }
474
+ return 0.5; // Default compatibility
475
+ }
476
+ getVerbSpecificity(verbType) {
477
+ // More specific verbs get higher scores
478
+ const specificityScores = {
479
+ [VerbType.RelatedTo]: 0.1, // Very generic
480
+ [VerbType.WorksWith]: 0.7, // Specific
481
+ [VerbType.Mentors]: 0.9, // Very specific
482
+ [VerbType.ReportsTo]: 0.9, // Very specific
483
+ [VerbType.Supervises]: 0.9 // Very specific
484
+ };
485
+ return specificityScores[verbType] || 0.5;
486
+ }
487
+ getRelevantFields(data, nounType) {
488
+ // Implementation for finding relevant fields
489
+ return [];
490
+ }
491
+ getMatchedPatterns(text, data, nounType) {
492
+ // Implementation for finding matched patterns
493
+ return [];
494
+ }
495
+ pruneRelationships(relationships) {
496
+ // Remove duplicates and low-confidence relationships
497
+ return relationships
498
+ .sort((a, b) => b.confidence - a.confidence)
499
+ .slice(0, 1000); // Limit to top 1000 relationships
500
+ }
501
+ detectHierarchies(relationships) {
502
+ // Detect hierarchical structures
503
+ return [];
504
+ }
505
+ detectClusters(entities, relationships) {
506
+ // Detect entity clusters
507
+ return [];
508
+ }
509
+ detectPatterns(relationships) {
510
+ // Detect relationship patterns
511
+ return [];
512
+ }
513
+ summarizeEntities(entities) {
514
+ const summary = {};
515
+ entities.forEach(entity => {
516
+ if (!summary[entity.nounType]) {
517
+ summary[entity.nounType] = { count: 0, totalConfidence: 0 };
518
+ }
519
+ summary[entity.nounType].count++;
520
+ summary[entity.nounType].totalConfidence += entity.confidence;
521
+ });
522
+ Object.keys(summary).forEach(type => {
523
+ summary[type].avgConfidence = summary[type].totalConfidence / summary[type].count;
524
+ });
525
+ return summary;
526
+ }
527
+ summarizeRelationships(relationships) {
528
+ const summary = {};
529
+ relationships.forEach(rel => {
530
+ if (!summary[rel.verbType]) {
531
+ summary[rel.verbType] = { count: 0, totalWeight: 0, totalConfidence: 0 };
532
+ }
533
+ summary[rel.verbType].count++;
534
+ summary[rel.verbType].totalWeight += rel.weight;
535
+ summary[rel.verbType].totalConfidence += rel.confidence;
536
+ });
537
+ Object.keys(summary).forEach(type => {
538
+ const stats = summary[type];
539
+ stats.avgWeight = stats.totalWeight / stats.count;
540
+ stats.avgConfidence = stats.totalConfidence / stats.count;
541
+ });
542
+ return summary;
543
+ }
544
+ calculateOverallConfidence(entities, relationships) {
545
+ const entityConfidence = entities.reduce((sum, e) => sum + e.confidence, 0) / entities.length;
546
+ const relationshipConfidence = relationships.reduce((sum, r) => sum + r.confidence, 0) / relationships.length;
547
+ return (entityConfidence + relationshipConfidence) / 2;
548
+ }
549
+ async generatePreview(entities, relationships) {
550
+ return entities.slice(0, 5).map(entity => ({
551
+ id: entity.suggestedId,
552
+ nounType: entity.nounType,
553
+ data: entity.originalData,
554
+ relationships: relationships
555
+ .filter(r => r.sourceId === entity.suggestedId)
556
+ .slice(0, 3)
557
+ .map(r => ({
558
+ target: r.targetId,
559
+ verbType: r.verbType,
560
+ weight: r.weight,
561
+ confidence: r.confidence
562
+ }))
563
+ }));
564
+ }
565
+ async confirmNeuralImport(result) {
566
+ const { confirm } = await prompts({
567
+ type: 'confirm',
568
+ name: 'confirm',
569
+ message: `${this.emojis.rocket} Execute neural import?`,
570
+ initial: true
571
+ });
572
+ return confirm;
573
+ }
574
+ async executeNeuralImport(result, options) {
575
+ const spinner = ora(`${this.emojis.gear} Executing neural import...`).start();
576
+ try {
577
+ // Add entities to Brainy
578
+ for (const entity of result.detectedEntities) {
579
+ await this.brainy.add(this.extractMainText(entity.originalData), {
580
+ ...entity.originalData,
581
+ nounType: entity.nounType,
582
+ confidence: entity.confidence,
583
+ id: entity.suggestedId
584
+ });
585
+ }
586
+ // Add relationships to Brainy
587
+ for (const relationship of result.detectedRelationships) {
588
+ await this.brainy.addVerb(relationship.sourceId, relationship.targetId, undefined, // no custom vector
589
+ {
590
+ type: relationship.verbType,
591
+ weight: relationship.weight,
592
+ metadata: {
593
+ confidence: relationship.confidence,
594
+ context: relationship.context,
595
+ ...relationship.metadata
596
+ }
597
+ });
598
+ }
599
+ spinner.succeed(this.colors.success(`${this.emojis.check} Neural import complete! ` +
600
+ `${result.detectedEntities.length} entities and ` +
601
+ `${result.detectedRelationships.length} relationships imported.`));
602
+ }
603
+ catch (error) {
604
+ spinner.fail('Neural import failed');
605
+ throw error;
606
+ }
607
+ }
608
+ async generateRelationshipReasoning(source, target, verbType, context) {
609
+ return `Neural analysis detected ${verbType} relationship based on semantic context`;
610
+ }
611
+ extractRelationshipMetadata(sourceData, targetData, verbType) {
612
+ return {
613
+ sourceType: typeof sourceData,
614
+ targetType: typeof targetData,
615
+ detectedBy: 'neural-import',
616
+ timestamp: new Date().toISOString()
617
+ };
618
+ }
619
+ }
620
+ //# sourceMappingURL=neuralImport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"neuralImport.js","sourceRoot":"","sources":["../../src/cortex/neuralImport.ts"],"names":[],"mappings":"AA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