@soulcraft/brainy 0.62.2 → 0.63.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.
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Neural Import Augmentation - AI-Powered Data Understanding
3
+ *
4
+ * 🧠 Built-in AI augmentation for intelligent data processing
5
+ * ⚛️ Always free, always included, always enabled
6
+ *
7
+ * This is the default AI-powered augmentation that comes with every Brainy installation.
8
+ * It provides intelligent data understanding, entity detection, and relationship analysis.
9
+ */
10
+ import { ISenseAugmentation, AugmentationResponse } from '../types/augmentations.js';
11
+ import { BrainyData } from '../brainyData.js';
12
+ export interface NeuralAnalysisResult {
13
+ detectedEntities: DetectedEntity[];
14
+ detectedRelationships: DetectedRelationship[];
15
+ confidence: number;
16
+ insights: NeuralInsight[];
17
+ }
18
+ export interface DetectedEntity {
19
+ originalData: any;
20
+ nounType: string;
21
+ confidence: number;
22
+ suggestedId: string;
23
+ reasoning: string;
24
+ alternativeTypes: Array<{
25
+ type: string;
26
+ confidence: number;
27
+ }>;
28
+ }
29
+ export interface DetectedRelationship {
30
+ sourceId: string;
31
+ targetId: string;
32
+ verbType: string;
33
+ confidence: number;
34
+ weight: number;
35
+ reasoning: string;
36
+ context: string;
37
+ metadata?: Record<string, any>;
38
+ }
39
+ export interface NeuralInsight {
40
+ type: 'hierarchy' | 'cluster' | 'pattern' | 'anomaly' | 'opportunity';
41
+ description: string;
42
+ confidence: number;
43
+ affectedEntities: string[];
44
+ recommendation?: string;
45
+ }
46
+ export interface NeuralImportConfig {
47
+ confidenceThreshold: number;
48
+ enableWeights: boolean;
49
+ skipDuplicates: boolean;
50
+ categoryFilter?: string[];
51
+ }
52
+ /**
53
+ * Neural Import SENSE Augmentation - The Brain's Perceptual System
54
+ */
55
+ export declare class NeuralImportAugmentation implements ISenseAugmentation {
56
+ readonly name: string;
57
+ readonly description: string;
58
+ enabled: boolean;
59
+ private brainy;
60
+ private config;
61
+ constructor(brainy: BrainyData, config?: Partial<NeuralImportConfig>);
62
+ initialize(): Promise<void>;
63
+ shutDown(): Promise<void>;
64
+ getStatus(): Promise<'active' | 'inactive' | 'error'>;
65
+ /**
66
+ * Process raw data into structured nouns and verbs using neural analysis
67
+ */
68
+ processRawData(rawData: Buffer | string, dataType: string, options?: Record<string, unknown>): Promise<AugmentationResponse<{
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
+ }>>;
79
+ /**
80
+ * Listen to real-time data feeds and process them
81
+ */
82
+ listenToFeed(feedUrl: string, callback: (data: {
83
+ nouns: string[];
84
+ verbs: string[];
85
+ confidence?: number;
86
+ }) => void): Promise<void>;
87
+ /**
88
+ * Analyze data structure without processing (preview mode)
89
+ */
90
+ analyzeStructure(rawData: Buffer | string, dataType: string, options?: Record<string, unknown>): Promise<AugmentationResponse<{
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>;
124
+ /**
125
+ * Parse raw data based on type
126
+ */
127
+ private parseRawData;
128
+ /**
129
+ * Basic CSV parser
130
+ */
131
+ private parseCSV;
132
+ /**
133
+ * Perform neural analysis on parsed data
134
+ */
135
+ private performNeuralAnalysis;
136
+ /**
137
+ * Neural Entity Detection - The Core AI Engine
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
158
+ */
159
+ private detectRelationshipsWithNeuralAnalysis;
160
+ /**
161
+ * Calculate relationship confidence
162
+ */
163
+ private calculateRelationshipConfidence;
164
+ /**
165
+ * Calculate relationship weight/strength
166
+ */
167
+ private calculateRelationshipWeight;
168
+ /**
169
+ * Generate Neural Insights - The Intelligence Layer
170
+ */
171
+ private generateNeuralInsights;
172
+ /**
173
+ * Helper methods for the neural system
174
+ */
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
+ private storeNeuralAnalysis;
188
+ private getDataTypeFromPath;
189
+ private generateRelationshipReasoning;
190
+ private extractRelationshipMetadata;
191
+ /**
192
+ * Assess data quality metrics
193
+ */
194
+ private assessDataQuality;
195
+ /**
196
+ * Generate recommendations based on analysis
197
+ */
198
+ private generateRecommendations;
199
+ }