@soulcraft/brainy 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -3
- package/README.md +353 -110
- package/bin/brainy.js +340 -62
- package/dist/api/ConfigAPI.d.ts +67 -0
- package/dist/api/ConfigAPI.js +166 -0
- package/dist/api/DataAPI.d.ts +123 -0
- package/dist/api/DataAPI.js +391 -0
- package/dist/api/SecurityAPI.d.ts +50 -0
- package/dist/api/SecurityAPI.js +139 -0
- package/dist/api/UniversalImportAPI.d.ts +134 -0
- package/dist/api/UniversalImportAPI.js +615 -0
- package/dist/augmentationManager.js +12 -7
- package/dist/augmentationPipeline.d.ts +0 -61
- package/dist/augmentationPipeline.js +0 -87
- package/dist/augmentationRegistry.d.ts +1 -1
- package/dist/augmentationRegistry.js +1 -1
- package/dist/augmentations/apiServerAugmentation.d.ts +27 -1
- package/dist/augmentations/apiServerAugmentation.js +290 -9
- package/dist/augmentations/auditLogAugmentation.d.ts +109 -0
- package/dist/augmentations/auditLogAugmentation.js +358 -0
- package/dist/augmentations/batchProcessingAugmentation.d.ts +3 -2
- package/dist/augmentations/batchProcessingAugmentation.js +123 -22
- package/dist/augmentations/brainyAugmentation.d.ts +142 -8
- package/dist/augmentations/brainyAugmentation.js +179 -2
- package/dist/augmentations/cacheAugmentation.d.ts +8 -5
- package/dist/augmentations/cacheAugmentation.js +116 -17
- package/dist/augmentations/conduitAugmentations.d.ts +2 -2
- package/dist/augmentations/conduitAugmentations.js +2 -2
- package/dist/augmentations/configResolver.d.ts +122 -0
- package/dist/augmentations/configResolver.js +440 -0
- package/dist/augmentations/connectionPoolAugmentation.d.ts +3 -1
- package/dist/augmentations/connectionPoolAugmentation.js +37 -12
- package/dist/augmentations/defaultAugmentations.d.ts +14 -10
- package/dist/augmentations/defaultAugmentations.js +16 -11
- package/dist/augmentations/discovery/catalogDiscovery.d.ts +142 -0
- package/dist/augmentations/discovery/catalogDiscovery.js +249 -0
- package/dist/augmentations/discovery/localDiscovery.d.ts +84 -0
- package/dist/augmentations/discovery/localDiscovery.js +246 -0
- package/dist/augmentations/discovery/runtimeLoader.d.ts +97 -0
- package/dist/augmentations/discovery/runtimeLoader.js +337 -0
- package/dist/augmentations/discovery.d.ts +152 -0
- package/dist/augmentations/discovery.js +441 -0
- package/dist/augmentations/display/cache.d.ts +130 -0
- package/dist/augmentations/display/cache.js +319 -0
- package/dist/augmentations/display/fieldPatterns.d.ts +52 -0
- package/dist/augmentations/display/fieldPatterns.js +393 -0
- package/dist/augmentations/display/iconMappings.d.ts +57 -0
- package/dist/augmentations/display/iconMappings.js +68 -0
- package/dist/augmentations/display/intelligentComputation.d.ts +109 -0
- package/dist/augmentations/display/intelligentComputation.js +462 -0
- package/dist/augmentations/display/types.d.ts +203 -0
- package/dist/augmentations/display/types.js +7 -0
- package/dist/augmentations/entityRegistryAugmentation.d.ts +3 -1
- package/dist/augmentations/entityRegistryAugmentation.js +5 -1
- package/dist/augmentations/indexAugmentation.d.ts +5 -3
- package/dist/augmentations/indexAugmentation.js +5 -2
- package/dist/augmentations/intelligentVerbScoringAugmentation.d.ts +24 -7
- package/dist/augmentations/intelligentVerbScoringAugmentation.js +111 -27
- package/dist/augmentations/manifest.d.ts +176 -0
- package/dist/augmentations/manifest.js +8 -0
- package/dist/augmentations/marketplace/AugmentationMarketplace.d.ts +168 -0
- package/dist/augmentations/marketplace/AugmentationMarketplace.js +329 -0
- package/dist/augmentations/marketplace/cli.d.ts +47 -0
- package/dist/augmentations/marketplace/cli.js +265 -0
- package/dist/augmentations/metricsAugmentation.d.ts +3 -3
- package/dist/augmentations/metricsAugmentation.js +2 -2
- package/dist/augmentations/monitoringAugmentation.d.ts +3 -3
- package/dist/augmentations/monitoringAugmentation.js +2 -2
- package/dist/augmentations/neuralImport.d.ts +1 -1
- package/dist/augmentations/neuralImport.js +4 -4
- package/dist/augmentations/rateLimitAugmentation.d.ts +82 -0
- package/dist/augmentations/rateLimitAugmentation.js +321 -0
- package/dist/augmentations/requestDeduplicatorAugmentation.d.ts +2 -2
- package/dist/augmentations/requestDeduplicatorAugmentation.js +1 -1
- package/dist/augmentations/storageAugmentation.d.ts +1 -1
- package/dist/augmentations/storageAugmentation.js +2 -2
- package/dist/augmentations/storageAugmentations.d.ts +37 -8
- package/dist/augmentations/storageAugmentations.js +204 -15
- package/dist/augmentations/synapseAugmentation.d.ts +1 -1
- package/dist/augmentations/synapseAugmentation.js +35 -16
- package/dist/augmentations/typeMatching/brainyTypes.d.ts +83 -0
- package/dist/augmentations/typeMatching/brainyTypes.js +425 -0
- package/dist/augmentations/typeMatching/intelligentTypeMatcher.d.ts +39 -59
- package/dist/augmentations/typeMatching/intelligentTypeMatcher.js +103 -389
- package/dist/augmentations/universalDisplayAugmentation.d.ts +191 -0
- package/dist/augmentations/universalDisplayAugmentation.js +371 -0
- package/dist/brainy-unified.d.ts +106 -0
- package/dist/brainy-unified.js +327 -0
- package/dist/brainy.d.ts +273 -0
- package/dist/brainy.js +1181 -0
- package/dist/brainyData.d.ts +56 -111
- package/dist/brainyData.js +912 -756
- package/dist/brainyDataV3.d.ts +186 -0
- package/dist/brainyDataV3.js +337 -0
- package/dist/browserFramework.d.ts +6 -6
- package/dist/browserFramework.js +11 -8
- package/dist/browserFramework.minimal.d.ts +5 -5
- package/dist/browserFramework.minimal.js +11 -8
- package/dist/config/distributedPresets-new.d.ts +118 -0
- package/dist/config/distributedPresets-new.js +318 -0
- package/dist/config/distributedPresets.d.ts +118 -0
- package/dist/config/distributedPresets.js +318 -0
- package/dist/config/extensibleConfig.d.ts +99 -0
- package/dist/config/extensibleConfig.js +268 -0
- package/dist/config/index.d.ts +17 -0
- package/dist/config/index.js +35 -0
- package/dist/config/modelAutoConfig.d.ts +32 -0
- package/dist/config/modelAutoConfig.js +139 -0
- package/dist/config/modelPrecisionManager.d.ts +42 -0
- package/dist/config/modelPrecisionManager.js +98 -0
- package/dist/config/sharedConfigManager.d.ts +67 -0
- package/dist/config/sharedConfigManager.js +215 -0
- package/dist/config/storageAutoConfig.d.ts +41 -0
- package/dist/config/storageAutoConfig.js +328 -0
- package/dist/config/zeroConfig.d.ts +68 -0
- package/dist/config/zeroConfig.js +301 -0
- package/dist/cortex/backupRestore.d.ts +2 -2
- package/dist/cortex/backupRestore.js +85 -27
- package/dist/cortex/healthCheck.d.ts +2 -2
- package/dist/cortex/neuralImport.d.ts +2 -2
- package/dist/cortex/neuralImport.js +18 -13
- package/dist/cortex/performanceMonitor.d.ts +2 -2
- package/dist/critical/model-guardian.d.ts +4 -0
- package/dist/critical/model-guardian.js +31 -11
- package/dist/demo.d.ts +4 -4
- package/dist/demo.js +7 -7
- package/dist/distributed/cacheSync.d.ts +112 -0
- package/dist/distributed/cacheSync.js +265 -0
- package/dist/distributed/coordinator.d.ts +193 -0
- package/dist/distributed/coordinator.js +548 -0
- package/dist/distributed/httpTransport.d.ts +120 -0
- package/dist/distributed/httpTransport.js +446 -0
- package/dist/distributed/index.d.ts +8 -0
- package/dist/distributed/index.js +5 -0
- package/dist/distributed/networkTransport.d.ts +132 -0
- package/dist/distributed/networkTransport.js +633 -0
- package/dist/distributed/queryPlanner.d.ts +104 -0
- package/dist/distributed/queryPlanner.js +327 -0
- package/dist/distributed/readWriteSeparation.d.ts +134 -0
- package/dist/distributed/readWriteSeparation.js +350 -0
- package/dist/distributed/shardManager.d.ts +114 -0
- package/dist/distributed/shardManager.js +357 -0
- package/dist/distributed/shardMigration.d.ts +110 -0
- package/dist/distributed/shardMigration.js +289 -0
- package/dist/distributed/storageDiscovery.d.ts +160 -0
- package/dist/distributed/storageDiscovery.js +551 -0
- package/dist/embeddings/CachedEmbeddings.d.ts +40 -0
- package/dist/embeddings/CachedEmbeddings.js +146 -0
- package/dist/embeddings/EmbeddingManager.d.ts +102 -0
- package/dist/embeddings/EmbeddingManager.js +291 -0
- package/dist/embeddings/SingletonModelManager.d.ts +95 -0
- package/dist/embeddings/SingletonModelManager.js +220 -0
- package/dist/embeddings/index.d.ts +12 -0
- package/dist/embeddings/index.js +16 -0
- package/dist/embeddings/lightweight-embedder.d.ts +0 -1
- package/dist/embeddings/lightweight-embedder.js +4 -12
- package/dist/embeddings/model-manager.d.ts +11 -0
- package/dist/embeddings/model-manager.js +43 -7
- package/dist/embeddings/universal-memory-manager.d.ts +1 -1
- package/dist/embeddings/universal-memory-manager.js +27 -67
- package/dist/embeddings/worker-embedding.js +4 -8
- package/dist/errors/brainyError.d.ts +5 -1
- package/dist/errors/brainyError.js +12 -0
- package/dist/examples/basicUsage.js +7 -4
- package/dist/graph/graphAdjacencyIndex.d.ts +96 -0
- package/dist/graph/graphAdjacencyIndex.js +288 -0
- package/dist/graph/pathfinding.js +4 -2
- package/dist/hnsw/scaledHNSWSystem.js +11 -2
- package/dist/importManager.js +8 -5
- package/dist/index.d.ts +17 -22
- package/dist/index.js +37 -23
- package/dist/mcp/brainyMCPAdapter.d.ts +4 -4
- package/dist/mcp/brainyMCPAdapter.js +5 -5
- package/dist/mcp/brainyMCPService.d.ts +3 -3
- package/dist/mcp/brainyMCPService.js +3 -11
- package/dist/mcp/mcpAugmentationToolset.js +20 -30
- package/dist/neural/embeddedPatterns.d.ts +1 -1
- package/dist/neural/embeddedPatterns.js +2 -2
- package/dist/neural/entityExtractor.d.ts +65 -0
- package/dist/neural/entityExtractor.js +316 -0
- package/dist/neural/improvedNeuralAPI.d.ts +357 -0
- package/dist/neural/improvedNeuralAPI.js +2628 -0
- package/dist/neural/naturalLanguageProcessor.d.ts +155 -10
- package/dist/neural/naturalLanguageProcessor.js +941 -66
- package/dist/neural/naturalLanguageProcessorStatic.d.ts +2 -2
- package/dist/neural/naturalLanguageProcessorStatic.js +3 -3
- package/dist/neural/neuralAPI.js +8 -2
- package/dist/neural/patternLibrary.d.ts +57 -3
- package/dist/neural/patternLibrary.js +348 -13
- package/dist/neural/staticPatternMatcher.d.ts +2 -2
- package/dist/neural/staticPatternMatcher.js +2 -2
- package/dist/neural/types.d.ts +287 -0
- package/dist/neural/types.js +24 -0
- package/dist/shared/default-augmentations.d.ts +3 -3
- package/dist/shared/default-augmentations.js +5 -5
- package/dist/storage/adapters/baseStorageAdapter.d.ts +42 -0
- package/dist/storage/adapters/fileSystemStorage.d.ts +26 -2
- package/dist/storage/adapters/fileSystemStorage.js +218 -15
- package/dist/storage/adapters/memoryStorage.d.ts +4 -4
- package/dist/storage/adapters/memoryStorage.js +17 -12
- package/dist/storage/adapters/opfsStorage.d.ts +2 -2
- package/dist/storage/adapters/opfsStorage.js +2 -2
- package/dist/storage/adapters/s3CompatibleStorage.d.ts +2 -2
- package/dist/storage/adapters/s3CompatibleStorage.js +2 -2
- package/dist/storage/backwardCompatibility.d.ts +10 -78
- package/dist/storage/backwardCompatibility.js +17 -132
- package/dist/storage/baseStorage.d.ts +18 -2
- package/dist/storage/baseStorage.js +74 -3
- package/dist/storage/cacheManager.js +2 -2
- package/dist/storage/readOnlyOptimizations.js +8 -3
- package/dist/streaming/pipeline.d.ts +154 -0
- package/dist/streaming/pipeline.js +551 -0
- package/dist/triple/TripleIntelligence.d.ts +25 -110
- package/dist/triple/TripleIntelligence.js +4 -574
- package/dist/triple/TripleIntelligenceSystem.d.ts +159 -0
- package/dist/triple/TripleIntelligenceSystem.js +519 -0
- package/dist/types/apiTypes.d.ts +278 -0
- package/dist/types/apiTypes.js +33 -0
- package/dist/types/brainy.types.d.ts +308 -0
- package/dist/types/brainy.types.js +8 -0
- package/dist/types/brainyDataInterface.d.ts +5 -8
- package/dist/types/brainyDataInterface.js +2 -2
- package/dist/types/graphTypes.js +2 -2
- package/dist/utils/brainyTypes.d.ts +217 -0
- package/dist/utils/brainyTypes.js +261 -0
- package/dist/utils/cacheAutoConfig.d.ts +3 -3
- package/dist/utils/embedding.d.ts +9 -4
- package/dist/utils/embedding.js +89 -26
- package/dist/utils/enhancedLogger.d.ts +104 -0
- package/dist/utils/enhancedLogger.js +232 -0
- package/dist/utils/hybridModelManager.d.ts +19 -28
- package/dist/utils/hybridModelManager.js +36 -200
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/intelligentTypeMapper.d.ts +60 -0
- package/dist/utils/intelligentTypeMapper.js +349 -0
- package/dist/utils/metadataIndex.d.ts +118 -1
- package/dist/utils/metadataIndex.js +539 -16
- package/dist/utils/nodeVersionCheck.d.ts +24 -0
- package/dist/utils/nodeVersionCheck.js +65 -0
- package/dist/utils/paramValidation.d.ts +39 -0
- package/dist/utils/paramValidation.js +192 -0
- package/dist/utils/rateLimiter.d.ts +160 -0
- package/dist/utils/rateLimiter.js +271 -0
- package/dist/utils/statistics.d.ts +4 -4
- package/dist/utils/statistics.js +3 -3
- package/dist/utils/structuredLogger.d.ts +146 -0
- package/dist/utils/structuredLogger.js +394 -0
- package/dist/utils/textEncoding.js +2 -1
- package/dist/utils/typeValidation.d.ts +59 -0
- package/dist/utils/typeValidation.js +374 -0
- package/dist/utils/version.js +19 -3
- package/package.json +15 -4
- package/scripts/download-models.cjs +94 -20
- package/dist/augmentations/walAugmentation.d.ts +0 -109
- package/dist/augmentations/walAugmentation.js +0 -516
- package/dist/chat/BrainyChat.d.ts +0 -121
- package/dist/chat/BrainyChat.js +0 -396
- package/dist/chat/ChatCLI.d.ts +0 -61
- package/dist/chat/ChatCLI.js +0 -351
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Universal Display Augmentation - Smart Field Patterns
|
|
3
|
+
*
|
|
4
|
+
* Intelligent field detection patterns for mapping user data to display fields
|
|
5
|
+
* Uses semantic understanding and common naming conventions
|
|
6
|
+
*/
|
|
7
|
+
import { NounType } from '../../types/graphTypes.js';
|
|
8
|
+
/**
|
|
9
|
+
* Universal field patterns that work across all data types
|
|
10
|
+
* Ordered by confidence level (highest first)
|
|
11
|
+
*/
|
|
12
|
+
export const UNIVERSAL_FIELD_PATTERNS = [
|
|
13
|
+
// Title/Name Patterns (Highest Priority)
|
|
14
|
+
{
|
|
15
|
+
fields: ['name', 'title', 'displayName', 'label', 'heading'],
|
|
16
|
+
displayField: 'title',
|
|
17
|
+
confidence: 0.95
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
fields: ['firstName', 'lastName', 'fullName', 'realName'],
|
|
21
|
+
displayField: 'title',
|
|
22
|
+
confidence: 0.9,
|
|
23
|
+
applicableTypes: [NounType.Person, NounType.User],
|
|
24
|
+
transform: (value, context) => {
|
|
25
|
+
const { metadata } = context;
|
|
26
|
+
if (metadata.firstName && metadata.lastName) {
|
|
27
|
+
return `${metadata.firstName} ${metadata.lastName}`.trim();
|
|
28
|
+
}
|
|
29
|
+
return String(value || '');
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
fields: ['companyName', 'organizationName', 'orgName', 'businessName'],
|
|
34
|
+
displayField: 'title',
|
|
35
|
+
confidence: 0.9,
|
|
36
|
+
applicableTypes: [NounType.Organization]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
fields: ['filename', 'fileName', 'documentTitle', 'docName'],
|
|
40
|
+
displayField: 'title',
|
|
41
|
+
confidence: 0.85,
|
|
42
|
+
applicableTypes: [NounType.Document, NounType.File, NounType.Media]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
fields: ['projectName', 'projectTitle', 'initiative'],
|
|
46
|
+
displayField: 'title',
|
|
47
|
+
confidence: 0.9,
|
|
48
|
+
applicableTypes: [NounType.Project]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
fields: ['taskName', 'taskTitle', 'action', 'todo'],
|
|
52
|
+
displayField: 'title',
|
|
53
|
+
confidence: 0.85,
|
|
54
|
+
applicableTypes: [NounType.Task]
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
fields: ['subject', 'topic', 'headline', 'caption'],
|
|
58
|
+
displayField: 'title',
|
|
59
|
+
confidence: 0.8
|
|
60
|
+
},
|
|
61
|
+
// Description Patterns (High Priority)
|
|
62
|
+
{
|
|
63
|
+
fields: ['description', 'summary', 'overview', 'details'],
|
|
64
|
+
displayField: 'description',
|
|
65
|
+
confidence: 0.9
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
fields: ['bio', 'biography', 'profile', 'about'],
|
|
69
|
+
displayField: 'description',
|
|
70
|
+
confidence: 0.85,
|
|
71
|
+
applicableTypes: [NounType.Person, NounType.User]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
fields: ['content', 'text', 'body', 'message'],
|
|
75
|
+
displayField: 'description',
|
|
76
|
+
confidence: 0.8
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
fields: ['abstract', 'excerpt', 'snippet', 'preview'],
|
|
80
|
+
displayField: 'description',
|
|
81
|
+
confidence: 0.75
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
fields: ['notes', 'comments', 'remarks', 'observations'],
|
|
85
|
+
displayField: 'description',
|
|
86
|
+
confidence: 0.7
|
|
87
|
+
},
|
|
88
|
+
// Type Patterns (Medium Priority)
|
|
89
|
+
{
|
|
90
|
+
fields: ['type', 'category', 'classification', 'kind'],
|
|
91
|
+
displayField: 'type',
|
|
92
|
+
confidence: 0.9
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
fields: ['nounType', 'entityType', 'objectType'],
|
|
96
|
+
displayField: 'type',
|
|
97
|
+
confidence: 0.95
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
fields: ['role', 'position', 'jobTitle', 'occupation'],
|
|
101
|
+
displayField: 'type',
|
|
102
|
+
confidence: 0.8,
|
|
103
|
+
applicableTypes: [NounType.Person, NounType.User],
|
|
104
|
+
transform: (value) => String(value || 'Person')
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
fields: ['industry', 'sector', 'domain', 'field'],
|
|
108
|
+
displayField: 'type',
|
|
109
|
+
confidence: 0.7,
|
|
110
|
+
applicableTypes: [NounType.Organization]
|
|
111
|
+
},
|
|
112
|
+
// Tag Patterns (Medium Priority)
|
|
113
|
+
{
|
|
114
|
+
fields: ['tags', 'keywords', 'labels', 'categories'],
|
|
115
|
+
displayField: 'tags',
|
|
116
|
+
confidence: 0.85
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
fields: ['topics', 'subjects', 'themes'],
|
|
120
|
+
displayField: 'tags',
|
|
121
|
+
confidence: 0.8
|
|
122
|
+
}
|
|
123
|
+
];
|
|
124
|
+
/**
|
|
125
|
+
* Type-specific field patterns for enhanced detection
|
|
126
|
+
* Used when we know the specific type of the entity
|
|
127
|
+
*/
|
|
128
|
+
export const TYPE_SPECIFIC_PATTERNS = {
|
|
129
|
+
[NounType.Person]: [
|
|
130
|
+
{
|
|
131
|
+
fields: ['email', 'emailAddress', 'contactEmail'],
|
|
132
|
+
displayField: 'description',
|
|
133
|
+
confidence: 0.7,
|
|
134
|
+
transform: (value, context) => {
|
|
135
|
+
const { metadata } = context;
|
|
136
|
+
const role = metadata.role || metadata.jobTitle || metadata.position;
|
|
137
|
+
const company = metadata.company || metadata.organization || metadata.employer;
|
|
138
|
+
const parts = [];
|
|
139
|
+
if (role)
|
|
140
|
+
parts.push(role);
|
|
141
|
+
if (company)
|
|
142
|
+
parts.push(`at ${company}`);
|
|
143
|
+
if (parts.length === 0 && value)
|
|
144
|
+
parts.push(`Contact: ${value}`);
|
|
145
|
+
return parts.join(' ') || 'Person';
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
fields: ['phone', 'phoneNumber', 'mobile', 'cell'],
|
|
150
|
+
displayField: 'tags',
|
|
151
|
+
confidence: 0.6
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
[NounType.Organization]: [
|
|
155
|
+
{
|
|
156
|
+
fields: ['website', 'url', 'homepage', 'domain'],
|
|
157
|
+
displayField: 'description',
|
|
158
|
+
confidence: 0.7,
|
|
159
|
+
transform: (value, context) => {
|
|
160
|
+
const { metadata } = context;
|
|
161
|
+
const industry = metadata.industry || metadata.sector;
|
|
162
|
+
const location = metadata.location || metadata.city || metadata.country;
|
|
163
|
+
const parts = [];
|
|
164
|
+
if (industry)
|
|
165
|
+
parts.push(industry);
|
|
166
|
+
parts.push('organization');
|
|
167
|
+
if (location)
|
|
168
|
+
parts.push(`in ${location}`);
|
|
169
|
+
return parts.join(' ');
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
fields: ['employees', 'size', 'headcount'],
|
|
174
|
+
displayField: 'tags',
|
|
175
|
+
confidence: 0.6
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
[NounType.Project]: [
|
|
179
|
+
{
|
|
180
|
+
fields: ['status', 'phase', 'stage', 'state'],
|
|
181
|
+
displayField: 'description',
|
|
182
|
+
confidence: 0.8,
|
|
183
|
+
transform: (value, context) => {
|
|
184
|
+
const { metadata } = context;
|
|
185
|
+
const status = String(value || 'active').toLowerCase();
|
|
186
|
+
const budget = metadata.budget || metadata.cost;
|
|
187
|
+
const lead = metadata.lead || metadata.manager || metadata.owner;
|
|
188
|
+
const parts = [];
|
|
189
|
+
parts.push(status.charAt(0).toUpperCase() + status.slice(1));
|
|
190
|
+
if (metadata.description)
|
|
191
|
+
parts.push('project');
|
|
192
|
+
if (lead)
|
|
193
|
+
parts.push(`led by ${lead}`);
|
|
194
|
+
if (budget)
|
|
195
|
+
parts.push(`($${parseInt(String(budget)).toLocaleString()} budget)`);
|
|
196
|
+
return parts.join(' ');
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
[NounType.Document]: [
|
|
201
|
+
{
|
|
202
|
+
fields: ['author', 'creator', 'writer'],
|
|
203
|
+
displayField: 'description',
|
|
204
|
+
confidence: 0.7,
|
|
205
|
+
transform: (value, context) => {
|
|
206
|
+
const { metadata } = context;
|
|
207
|
+
const docType = metadata.type || metadata.category || 'document';
|
|
208
|
+
const date = metadata.date || metadata.created || metadata.published;
|
|
209
|
+
const parts = [];
|
|
210
|
+
if (docType)
|
|
211
|
+
parts.push(docType);
|
|
212
|
+
if (value)
|
|
213
|
+
parts.push(`by ${value}`);
|
|
214
|
+
if (date) {
|
|
215
|
+
const dateStr = new Date(date).toLocaleDateString();
|
|
216
|
+
parts.push(`(${dateStr})`);
|
|
217
|
+
}
|
|
218
|
+
return parts.join(' ');
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
],
|
|
222
|
+
[NounType.Task]: [
|
|
223
|
+
{
|
|
224
|
+
fields: ['priority', 'urgency', 'importance'],
|
|
225
|
+
displayField: 'tags',
|
|
226
|
+
confidence: 0.7
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Get field patterns for a specific entity type
|
|
232
|
+
* @param entityType The type of entity (noun or verb)
|
|
233
|
+
* @param specificType Optional specific noun/verb type
|
|
234
|
+
* @returns Array of applicable field patterns
|
|
235
|
+
*/
|
|
236
|
+
export function getFieldPatterns(entityType, specificType) {
|
|
237
|
+
const patterns = [...UNIVERSAL_FIELD_PATTERNS];
|
|
238
|
+
if (entityType === 'noun' && specificType && TYPE_SPECIFIC_PATTERNS[specificType]) {
|
|
239
|
+
patterns.unshift(...TYPE_SPECIFIC_PATTERNS[specificType]);
|
|
240
|
+
}
|
|
241
|
+
return patterns.sort((a, b) => b.confidence - a.confidence);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Priority fields for different entity types (for AI analysis)
|
|
245
|
+
* Used by the BrainyTypes and neural processing
|
|
246
|
+
*/
|
|
247
|
+
export const TYPE_PRIORITY_FIELDS = {
|
|
248
|
+
[NounType.Person]: [
|
|
249
|
+
'name', 'firstName', 'lastName', 'fullName', 'displayName',
|
|
250
|
+
'email', 'role', 'jobTitle', 'position', 'title',
|
|
251
|
+
'bio', 'description', 'about', 'profile',
|
|
252
|
+
'company', 'organization', 'employer'
|
|
253
|
+
],
|
|
254
|
+
[NounType.Organization]: [
|
|
255
|
+
'name', 'companyName', 'organizationName', 'title',
|
|
256
|
+
'industry', 'sector', 'domain', 'type',
|
|
257
|
+
'description', 'about', 'summary',
|
|
258
|
+
'location', 'city', 'country', 'headquarters',
|
|
259
|
+
'website', 'url'
|
|
260
|
+
],
|
|
261
|
+
[NounType.Project]: [
|
|
262
|
+
'name', 'projectName', 'title', 'projectTitle',
|
|
263
|
+
'description', 'summary', 'overview', 'goal',
|
|
264
|
+
'status', 'phase', 'stage', 'state',
|
|
265
|
+
'lead', 'manager', 'owner', 'team',
|
|
266
|
+
'budget', 'timeline', 'deadline'
|
|
267
|
+
],
|
|
268
|
+
[NounType.Document]: [
|
|
269
|
+
'title', 'filename', 'name', 'subject',
|
|
270
|
+
'content', 'text', 'body', 'summary',
|
|
271
|
+
'author', 'creator', 'writer',
|
|
272
|
+
'type', 'category', 'format',
|
|
273
|
+
'date', 'created', 'published'
|
|
274
|
+
],
|
|
275
|
+
[NounType.Task]: [
|
|
276
|
+
'title', 'name', 'taskName', 'action',
|
|
277
|
+
'description', 'details', 'notes',
|
|
278
|
+
'status', 'state', 'priority',
|
|
279
|
+
'assignee', 'owner', 'responsible',
|
|
280
|
+
'due', 'deadline', 'dueDate'
|
|
281
|
+
],
|
|
282
|
+
[NounType.Event]: [
|
|
283
|
+
'name', 'title', 'eventName',
|
|
284
|
+
'description', 'details', 'summary',
|
|
285
|
+
'startDate', 'endDate', 'date', 'time',
|
|
286
|
+
'location', 'venue', 'address',
|
|
287
|
+
'organizer', 'host', 'creator'
|
|
288
|
+
],
|
|
289
|
+
[NounType.Product]: [
|
|
290
|
+
'name', 'productName', 'title',
|
|
291
|
+
'description', 'summary', 'features',
|
|
292
|
+
'price', 'cost', 'value',
|
|
293
|
+
'category', 'type', 'brand',
|
|
294
|
+
'manufacturer', 'vendor'
|
|
295
|
+
]
|
|
296
|
+
};
|
|
297
|
+
/**
|
|
298
|
+
* Get priority fields for intelligent analysis
|
|
299
|
+
* @param entityType The type of entity
|
|
300
|
+
* @param specificType Optional specific type
|
|
301
|
+
* @returns Array of priority field names
|
|
302
|
+
*/
|
|
303
|
+
export function getPriorityFields(entityType, specificType) {
|
|
304
|
+
if (entityType === 'noun' && specificType && TYPE_PRIORITY_FIELDS[specificType]) {
|
|
305
|
+
return TYPE_PRIORITY_FIELDS[specificType];
|
|
306
|
+
}
|
|
307
|
+
// Default priority fields for any entity
|
|
308
|
+
return [
|
|
309
|
+
'name', 'title', 'label', 'displayName',
|
|
310
|
+
'description', 'summary', 'about', 'details',
|
|
311
|
+
'type', 'category', 'kind', 'classification',
|
|
312
|
+
'tags', 'keywords', 'labels'
|
|
313
|
+
];
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Smart field value extraction with type-aware processing
|
|
317
|
+
* @param data The data object to extract from
|
|
318
|
+
* @param pattern The field pattern to apply
|
|
319
|
+
* @param context The computation context
|
|
320
|
+
* @returns The extracted and processed field value
|
|
321
|
+
*/
|
|
322
|
+
export function extractFieldValue(data, pattern, context) {
|
|
323
|
+
// Find the first matching field
|
|
324
|
+
let value = null;
|
|
325
|
+
let matchedField = null;
|
|
326
|
+
for (const field of pattern.fields) {
|
|
327
|
+
if (data[field] !== undefined && data[field] !== null && data[field] !== '') {
|
|
328
|
+
value = data[field];
|
|
329
|
+
matchedField = field;
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
if (value === null)
|
|
334
|
+
return null;
|
|
335
|
+
// Apply transformation if provided
|
|
336
|
+
if (pattern.transform) {
|
|
337
|
+
try {
|
|
338
|
+
return pattern.transform(value, context);
|
|
339
|
+
}
|
|
340
|
+
catch (error) {
|
|
341
|
+
console.warn(`Field transformation error for ${matchedField}:`, error);
|
|
342
|
+
return String(value);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
// Default processing based on display field type
|
|
346
|
+
switch (pattern.displayField) {
|
|
347
|
+
case 'title':
|
|
348
|
+
case 'description':
|
|
349
|
+
case 'type':
|
|
350
|
+
return String(value);
|
|
351
|
+
case 'tags':
|
|
352
|
+
if (Array.isArray(value))
|
|
353
|
+
return value;
|
|
354
|
+
if (typeof value === 'string') {
|
|
355
|
+
return value.split(/[,;]\s*|\s+/).filter(Boolean);
|
|
356
|
+
}
|
|
357
|
+
return [String(value)];
|
|
358
|
+
default:
|
|
359
|
+
return value;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Calculate confidence score for field detection
|
|
364
|
+
* @param pattern The field pattern
|
|
365
|
+
* @param context The computation context
|
|
366
|
+
* @param value The extracted value
|
|
367
|
+
* @returns Confidence score (0-1)
|
|
368
|
+
*/
|
|
369
|
+
export function calculateFieldConfidence(pattern, context, value) {
|
|
370
|
+
let confidence = pattern.confidence;
|
|
371
|
+
// Boost confidence if type matches
|
|
372
|
+
if (pattern.applicableTypes && context.typeResult) {
|
|
373
|
+
if (pattern.applicableTypes.includes(context.typeResult.type)) {
|
|
374
|
+
confidence = Math.min(1.0, confidence + 0.1);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
// Reduce confidence for empty or very short values
|
|
378
|
+
if (typeof value === 'string') {
|
|
379
|
+
if (value.length < 2) {
|
|
380
|
+
confidence *= 0.5;
|
|
381
|
+
}
|
|
382
|
+
else if (value.length < 5) {
|
|
383
|
+
confidence *= 0.8;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
// Reduce confidence for generic values
|
|
387
|
+
const genericValues = ['unknown', 'n/a', 'null', 'undefined', 'default'];
|
|
388
|
+
if (typeof value === 'string' && genericValues.includes(value.toLowerCase())) {
|
|
389
|
+
confidence *= 0.3;
|
|
390
|
+
}
|
|
391
|
+
return Math.max(0, Math.min(1, confidence));
|
|
392
|
+
}
|
|
393
|
+
//# sourceMappingURL=fieldPatterns.js.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Universal Display Augmentation - Clean Display
|
|
3
|
+
*
|
|
4
|
+
* Simple, clean display without icons - focusing on AI-powered
|
|
5
|
+
* titles, descriptions, and smart formatting that matches
|
|
6
|
+
* Soulcraft's minimal aesthetic
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* No icon mappings - clean, minimal approach
|
|
10
|
+
* The real value is in AI-generated titles and enhanced descriptions,
|
|
11
|
+
* not visual clutter that doesn't align with professional aesthetics
|
|
12
|
+
*/
|
|
13
|
+
export declare const NOUN_TYPE_ICONS: Record<string, string>;
|
|
14
|
+
/**
|
|
15
|
+
* No icon mappings for verbs either - focus on clear relationship descriptions
|
|
16
|
+
* Human-readable relationship text is more valuable than symbolic representations
|
|
17
|
+
*/
|
|
18
|
+
export declare const VERB_TYPE_ICONS: Record<string, string>;
|
|
19
|
+
/**
|
|
20
|
+
* Get icon for a noun type (returns empty string for clean display)
|
|
21
|
+
* @param type The noun type
|
|
22
|
+
* @returns Empty string (no icons)
|
|
23
|
+
*/
|
|
24
|
+
export declare function getNounIcon(type: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Get icon for a verb type (returns empty string for clean display)
|
|
27
|
+
* @param type The verb type
|
|
28
|
+
* @returns Empty string (no icons)
|
|
29
|
+
*/
|
|
30
|
+
export declare function getVerbIcon(type: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Get coverage statistics (for backwards compatibility)
|
|
33
|
+
* @returns Coverage info showing clean approach
|
|
34
|
+
*/
|
|
35
|
+
export declare function getIconCoverage(): {
|
|
36
|
+
nounTypes: {
|
|
37
|
+
total: string;
|
|
38
|
+
covered: string;
|
|
39
|
+
};
|
|
40
|
+
verbTypes: {
|
|
41
|
+
total: string;
|
|
42
|
+
covered: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Check if an icon exists for a type (always false for clean display)
|
|
47
|
+
* @param type The type to check
|
|
48
|
+
* @param entityType Whether it's a noun or verb
|
|
49
|
+
* @returns Always false (no icons)
|
|
50
|
+
*/
|
|
51
|
+
export declare function hasIcon(type: string, entityType?: 'noun' | 'verb'): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Get fallback icon (returns empty string for clean display)
|
|
54
|
+
* @param entityType The entity type
|
|
55
|
+
* @returns Empty string (no fallback icons)
|
|
56
|
+
*/
|
|
57
|
+
export declare function getFallbackIcon(entityType?: 'noun' | 'verb'): string;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Universal Display Augmentation - Clean Display
|
|
3
|
+
*
|
|
4
|
+
* Simple, clean display without icons - focusing on AI-powered
|
|
5
|
+
* titles, descriptions, and smart formatting that matches
|
|
6
|
+
* Soulcraft's minimal aesthetic
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* No icon mappings - clean, minimal approach
|
|
10
|
+
* The real value is in AI-generated titles and enhanced descriptions,
|
|
11
|
+
* not visual clutter that doesn't align with professional aesthetics
|
|
12
|
+
*/
|
|
13
|
+
export const NOUN_TYPE_ICONS = {};
|
|
14
|
+
/**
|
|
15
|
+
* No icon mappings for verbs either - focus on clear relationship descriptions
|
|
16
|
+
* Human-readable relationship text is more valuable than symbolic representations
|
|
17
|
+
*/
|
|
18
|
+
export const VERB_TYPE_ICONS = {};
|
|
19
|
+
/**
|
|
20
|
+
* Get icon for a noun type (returns empty string for clean display)
|
|
21
|
+
* @param type The noun type
|
|
22
|
+
* @returns Empty string (no icons)
|
|
23
|
+
*/
|
|
24
|
+
export function getNounIcon(type) {
|
|
25
|
+
return ''; // Clean, no icons
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get icon for a verb type (returns empty string for clean display)
|
|
29
|
+
* @param type The verb type
|
|
30
|
+
* @returns Empty string (no icons)
|
|
31
|
+
*/
|
|
32
|
+
export function getVerbIcon(type) {
|
|
33
|
+
return ''; // Clean, no icons
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get coverage statistics (for backwards compatibility)
|
|
37
|
+
* @returns Coverage info showing clean approach
|
|
38
|
+
*/
|
|
39
|
+
export function getIconCoverage() {
|
|
40
|
+
return {
|
|
41
|
+
nounTypes: {
|
|
42
|
+
total: 'Clean display - no icons needed',
|
|
43
|
+
covered: 'Focus on AI-powered content'
|
|
44
|
+
},
|
|
45
|
+
verbTypes: {
|
|
46
|
+
total: 'Clean display - no icons needed',
|
|
47
|
+
covered: 'Focus on relationship descriptions'
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Check if an icon exists for a type (always false for clean display)
|
|
53
|
+
* @param type The type to check
|
|
54
|
+
* @param entityType Whether it's a noun or verb
|
|
55
|
+
* @returns Always false (no icons)
|
|
56
|
+
*/
|
|
57
|
+
export function hasIcon(type, entityType = 'noun') {
|
|
58
|
+
return false; // Clean approach - no icons
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get fallback icon (returns empty string for clean display)
|
|
62
|
+
* @param entityType The entity type
|
|
63
|
+
* @returns Empty string (no fallback icons)
|
|
64
|
+
*/
|
|
65
|
+
export function getFallbackIcon(entityType = 'noun') {
|
|
66
|
+
return ''; // Clean, minimal display
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=iconMappings.js.map
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Universal Display Augmentation - Intelligent Computation Engine
|
|
3
|
+
*
|
|
4
|
+
* Leverages existing Brainy AI infrastructure for intelligent field computation:
|
|
5
|
+
* - BrainyTypes for semantic type detection
|
|
6
|
+
* - Neural Import patterns for field analysis
|
|
7
|
+
* - JSON processing utilities for field extraction
|
|
8
|
+
* - Existing NounType/VerbType taxonomy (31+40 types)
|
|
9
|
+
*/
|
|
10
|
+
import type { ComputedDisplayFields, DisplayConfig } from './types.js';
|
|
11
|
+
import type { GraphVerb } from '../../coreTypes.js';
|
|
12
|
+
/**
|
|
13
|
+
* Intelligent field computation engine
|
|
14
|
+
* Coordinates AI-powered analysis with fallback heuristics
|
|
15
|
+
*/
|
|
16
|
+
export declare class IntelligentComputationEngine {
|
|
17
|
+
private typeMatcher;
|
|
18
|
+
protected config: DisplayConfig;
|
|
19
|
+
private initialized;
|
|
20
|
+
constructor(config: DisplayConfig);
|
|
21
|
+
/**
|
|
22
|
+
* Initialize the computation engine with AI components
|
|
23
|
+
*/
|
|
24
|
+
initialize(): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Compute display fields for a noun using AI-first approach
|
|
27
|
+
* @param data The noun data/metadata
|
|
28
|
+
* @param id Optional noun ID
|
|
29
|
+
* @returns Computed display fields
|
|
30
|
+
*/
|
|
31
|
+
computeNounDisplay(data: any, id?: string): Promise<ComputedDisplayFields>;
|
|
32
|
+
/**
|
|
33
|
+
* Compute display fields for a verb using AI-first approach
|
|
34
|
+
* @param verb The verb/relationship data
|
|
35
|
+
* @returns Computed display fields
|
|
36
|
+
*/
|
|
37
|
+
computeVerbDisplay(verb: GraphVerb): Promise<ComputedDisplayFields>;
|
|
38
|
+
/**
|
|
39
|
+
* AI-powered computation using your existing BrainyTypes
|
|
40
|
+
* @param data Entity data/metadata
|
|
41
|
+
* @param entityType Type of entity (noun/verb)
|
|
42
|
+
* @param options Additional options
|
|
43
|
+
* @returns AI-computed display fields
|
|
44
|
+
*/
|
|
45
|
+
private computeWithAI;
|
|
46
|
+
/**
|
|
47
|
+
* AI-powered verb computation using relationship analysis
|
|
48
|
+
* @param verb The verb/relationship
|
|
49
|
+
* @returns AI-computed display fields
|
|
50
|
+
*/
|
|
51
|
+
private computeVerbWithAI;
|
|
52
|
+
/**
|
|
53
|
+
* Heuristic computation when AI is unavailable
|
|
54
|
+
* @param data Entity data
|
|
55
|
+
* @param entityType Type of entity
|
|
56
|
+
* @param options Additional options
|
|
57
|
+
* @returns Heuristically computed display fields
|
|
58
|
+
*/
|
|
59
|
+
private computeWithHeuristics;
|
|
60
|
+
/**
|
|
61
|
+
* Compute intelligent title using AI insights and your field extraction
|
|
62
|
+
* @param context Computation context with AI results
|
|
63
|
+
* @returns Computed title
|
|
64
|
+
*/
|
|
65
|
+
private computeIntelligentTitle;
|
|
66
|
+
/**
|
|
67
|
+
* Compute intelligent description using AI insights and context
|
|
68
|
+
* @param context Computation context
|
|
69
|
+
* @returns Enhanced description
|
|
70
|
+
*/
|
|
71
|
+
private computeIntelligentDescription;
|
|
72
|
+
/**
|
|
73
|
+
* Compute intelligent tags using type analysis
|
|
74
|
+
* @param context Computation context
|
|
75
|
+
* @returns Generated tags array
|
|
76
|
+
*/
|
|
77
|
+
private computeIntelligentTags;
|
|
78
|
+
/**
|
|
79
|
+
* Compute verb title (relationship summary)
|
|
80
|
+
* @param context Verb computation context
|
|
81
|
+
* @returns Verb title
|
|
82
|
+
*/
|
|
83
|
+
private computeVerbTitle;
|
|
84
|
+
/**
|
|
85
|
+
* Create minimal display for error cases
|
|
86
|
+
* @param data Entity data
|
|
87
|
+
* @param entityType Entity type
|
|
88
|
+
* @returns Minimal display fields
|
|
89
|
+
*/
|
|
90
|
+
private createMinimalDisplay;
|
|
91
|
+
private computePersonTitle;
|
|
92
|
+
private computeOrganizationTitle;
|
|
93
|
+
private computeProjectTitle;
|
|
94
|
+
private computeDocumentTitle;
|
|
95
|
+
private extractBestTitle;
|
|
96
|
+
private createContextAwareDescription;
|
|
97
|
+
private extractExplicitTags;
|
|
98
|
+
private generateSemanticTags;
|
|
99
|
+
private getReadableVerbPhrase;
|
|
100
|
+
private computeVerbDescription;
|
|
101
|
+
private computeVerbTags;
|
|
102
|
+
private computeHumanReadableRelationship;
|
|
103
|
+
private detectTypeHeuristically;
|
|
104
|
+
private extractFieldWithPatterns;
|
|
105
|
+
/**
|
|
106
|
+
* Shutdown the computation engine
|
|
107
|
+
*/
|
|
108
|
+
shutdown(): Promise<void>;
|
|
109
|
+
}
|