@soulcraft/brainy 3.16.0 → 3.18.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 (41) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +5 -6
  3. package/dist/augmentations/defaultAugmentations.d.ts +0 -1
  4. package/dist/augmentations/defaultAugmentations.js +0 -5
  5. package/dist/brainy.d.ts +46 -0
  6. package/dist/brainy.js +53 -0
  7. package/dist/neural/embeddedPatterns.d.ts +1 -1
  8. package/dist/neural/embeddedPatterns.js +1 -1
  9. package/dist/neural/naturalLanguageProcessor.js +0 -1
  10. package/dist/setup.js +0 -1
  11. package/dist/storage/adapters/fileSystemStorage.d.ts +15 -0
  12. package/dist/storage/adapters/fileSystemStorage.js +374 -28
  13. package/dist/unified.js +0 -1
  14. package/dist/vfs/VirtualFileSystem.d.ts +6 -4
  15. package/dist/vfs/VirtualFileSystem.js +44 -21
  16. package/dist/vfs/index.d.ts +0 -5
  17. package/dist/vfs/index.js +0 -6
  18. package/dist/vfs/semantic/ProjectionRegistry.d.ts +84 -0
  19. package/dist/vfs/semantic/ProjectionRegistry.js +118 -0
  20. package/dist/vfs/semantic/ProjectionStrategy.d.ts +69 -0
  21. package/dist/vfs/semantic/ProjectionStrategy.js +40 -0
  22. package/dist/vfs/semantic/SemanticPathParser.d.ts +73 -0
  23. package/dist/vfs/semantic/SemanticPathParser.js +285 -0
  24. package/dist/vfs/semantic/SemanticPathResolver.d.ts +99 -0
  25. package/dist/vfs/semantic/SemanticPathResolver.js +242 -0
  26. package/dist/vfs/semantic/index.d.ts +17 -0
  27. package/dist/vfs/semantic/index.js +18 -0
  28. package/dist/vfs/semantic/projections/AuthorProjection.d.ts +35 -0
  29. package/dist/vfs/semantic/projections/AuthorProjection.js +74 -0
  30. package/dist/vfs/semantic/projections/ConceptProjection.d.ts +42 -0
  31. package/dist/vfs/semantic/projections/ConceptProjection.js +87 -0
  32. package/dist/vfs/semantic/projections/RelationshipProjection.d.ts +41 -0
  33. package/dist/vfs/semantic/projections/RelationshipProjection.js +101 -0
  34. package/dist/vfs/semantic/projections/SimilarityProjection.d.ts +36 -0
  35. package/dist/vfs/semantic/projections/SimilarityProjection.js +77 -0
  36. package/dist/vfs/semantic/projections/TagProjection.d.ts +34 -0
  37. package/dist/vfs/semantic/projections/TagProjection.js +73 -0
  38. package/dist/vfs/semantic/projections/TemporalProjection.d.ts +35 -0
  39. package/dist/vfs/semantic/projections/TemporalProjection.js +89 -0
  40. package/dist/vfs/types.d.ts +1 -8
  41. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [3.17.0](https://github.com/soulcraftlabs/brainy/compare/v3.16.0...v3.17.0) (2025-09-27)
6
+
5
7
  ## [3.15.0](https://github.com/soulcraftlabs/brainy/compare/v3.14.2...v3.15.0) (2025-09-26)
6
8
 
7
9
  ### Bug Fixes
package/README.md CHANGED
@@ -767,13 +767,12 @@ We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
767
767
  - [Next.js Integration](docs/guides/nextjs-integration.md) - **NEW!** React and Next.js examples
768
768
  - [Vue.js Integration](docs/guides/vue-integration.md) - **NEW!** Vue and Nuxt examples
769
769
 
770
- ### Virtual Filesystem & Knowledge Layer 🧠📁
771
- - [VFS Core Documentation](docs/vfs/VFS_CORE.md) - **NEW!** Complete filesystem architecture and API
772
- - [VFS + Knowledge Layer](docs/vfs/VFS_KNOWLEDGE_LAYER.md) - **NEW!** Intelligent knowledge management features
773
- - [Examples & Scenarios](docs/vfs/VFS_EXAMPLES_SCENARIOS.md) - **NEW!** Real-world use cases and code
770
+ ### Virtual Filesystem (Semantic VFS) 🧠📁
771
+ - [VFS Core Documentation](docs/vfs/VFS_CORE.md) - Complete filesystem architecture and API
772
+ - [Semantic VFS Guide](docs/vfs/SEMANTIC_VFS.md) - Multi-dimensional file access (6 semantic dimensions)
773
+ - [Neural Extraction API](docs/vfs/NEURAL_EXTRACTION.md) - AI-powered concept and entity extraction
774
+ - [Examples & Scenarios](docs/vfs/VFS_EXAMPLES_SCENARIOS.md) - Real-world use cases and code
774
775
  - [VFS API Guide](docs/vfs/VFS_API_GUIDE.md) - Complete API reference
775
- - [Knowledge Layer API](docs/vfs/KNOWLEDGE_LAYER_API.md) - Advanced knowledge features
776
- - [Knowledge Layer Overview](docs/KNOWLEDGE_LAYER_OVERVIEW.md) - Non-technical guide
777
776
 
778
777
  ### Core Documentation
779
778
  - [Getting Started Guide](docs/guides/getting-started.md)
@@ -25,7 +25,6 @@ export declare function createDefaultAugmentations(config?: {
25
25
  metrics?: boolean | Record<string, any>;
26
26
  monitoring?: boolean | Record<string, any>;
27
27
  display?: boolean | Record<string, any>;
28
- knowledge?: boolean | Record<string, any>;
29
28
  }): BaseAugmentation[];
30
29
  /**
31
30
  * Get augmentation by name with type safety
@@ -11,7 +11,6 @@ import { CacheAugmentation } from './cacheAugmentation.js';
11
11
  import { MetricsAugmentation } from './metricsAugmentation.js';
12
12
  import { MonitoringAugmentation } from './monitoringAugmentation.js';
13
13
  import { UniversalDisplayAugmentation } from './universalDisplayAugmentation.js';
14
- import { KnowledgeAugmentation } from './KnowledgeAugmentation.js';
15
14
  /**
16
15
  * Create default augmentations for zero-config operation
17
16
  * Returns an array of augmentations to be registered
@@ -45,10 +44,6 @@ export function createDefaultAugmentations(config = {}) {
45
44
  const monitoringConfig = typeof config.monitoring === 'object' ? config.monitoring : {};
46
45
  augmentations.push(new MonitoringAugmentation(monitoringConfig));
47
46
  }
48
- // Knowledge Layer augmentation for VFS intelligence
49
- if (config.knowledge !== false) {
50
- augmentations.push(new KnowledgeAugmentation());
51
- }
52
47
  return augmentations;
53
48
  }
54
49
  /**
package/dist/brainy.d.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  import { Vector } from './coreTypes.js';
8
8
  import { ImprovedNeuralAPI } from './neural/improvedNeuralAPI.js';
9
9
  import { NaturalLanguageProcessor } from './neural/naturalLanguageProcessor.js';
10
+ import { ExtractedEntity } from './neural/entityExtractor.js';
10
11
  import { TripleIntelligenceSystem } from './triple/TripleIntelligenceSystem.js';
11
12
  import { VirtualFileSystem } from './vfs/VirtualFileSystem.js';
12
13
  import { Entity, Relation, Result, AddParams, UpdateParams, RelateParams, FindParams, SimilarParams, GetRelationsParams, AddManyParams, DeleteManyParams, RelateManyParams, BatchResult, BrainyConfig } from './types/brainy.types.js';
@@ -34,6 +35,7 @@ export declare class Brainy<T = any> implements BrainyInterface<T> {
34
35
  private originalConsole?;
35
36
  private _neural?;
36
37
  private _nlp?;
38
+ private _extractor?;
37
39
  private _tripleIntelligence?;
38
40
  private _vfs?;
39
41
  private initialized;
@@ -594,6 +596,50 @@ export declare class Brainy<T = any> implements BrainyInterface<T> {
594
596
  * Natural Language Processing API
595
597
  */
596
598
  nlp(): NaturalLanguageProcessor;
599
+ /**
600
+ * Entity Extraction API - Neural extraction with NounType taxonomy
601
+ *
602
+ * Extracts entities from text using:
603
+ * - Pattern-based candidate detection
604
+ * - Embedding-based type classification
605
+ * - Context-aware confidence scoring
606
+ *
607
+ * @param text - Text to extract entities from
608
+ * @param options - Extraction options
609
+ * @returns Array of extracted entities with types and confidence
610
+ *
611
+ * @example
612
+ * const entities = await brain.extract('John Smith founded Acme Corp in New York')
613
+ * // [
614
+ * // { text: 'John Smith', type: NounType.Person, confidence: 0.95 },
615
+ * // { text: 'Acme Corp', type: NounType.Organization, confidence: 0.92 },
616
+ * // { text: 'New York', type: NounType.Location, confidence: 0.88 }
617
+ * // ]
618
+ */
619
+ extract(text: string, options?: {
620
+ types?: NounType[];
621
+ confidence?: number;
622
+ includeVectors?: boolean;
623
+ neuralMatching?: boolean;
624
+ }): Promise<ExtractedEntity[]>;
625
+ /**
626
+ * Extract concepts from text
627
+ *
628
+ * Simplified interface for concept/topic extraction
629
+ * Returns only concept names as strings for easy metadata population
630
+ *
631
+ * @param text - Text to extract concepts from
632
+ * @param options - Extraction options
633
+ * @returns Array of concept names
634
+ *
635
+ * @example
636
+ * const concepts = await brain.extractConcepts('Using OAuth for authentication')
637
+ * // ['oauth', 'authentication']
638
+ */
639
+ extractConcepts(text: string, options?: {
640
+ confidence?: number;
641
+ limit?: number;
642
+ }): Promise<string[]>;
597
643
  /**
598
644
  * Virtual File System API - Knowledge Operating System
599
645
  */
package/dist/brainy.js CHANGED
@@ -13,6 +13,7 @@ import { AugmentationRegistry } from './augmentations/brainyAugmentation.js';
13
13
  import { createDefaultAugmentations } from './augmentations/defaultAugmentations.js';
14
14
  import { ImprovedNeuralAPI } from './neural/improvedNeuralAPI.js';
15
15
  import { NaturalLanguageProcessor } from './neural/naturalLanguageProcessor.js';
16
+ import { NeuralEntityExtractor } from './neural/entityExtractor.js';
16
17
  import { TripleIntelligenceSystem } from './triple/TripleIntelligenceSystem.js';
17
18
  import { VirtualFileSystem } from './vfs/VirtualFileSystem.js';
18
19
  import { MetadataIndexManager } from './utils/metadataIndex.js';
@@ -1357,6 +1358,58 @@ export class Brainy {
1357
1358
  }
1358
1359
  return this._nlp;
1359
1360
  }
1361
+ /**
1362
+ * Entity Extraction API - Neural extraction with NounType taxonomy
1363
+ *
1364
+ * Extracts entities from text using:
1365
+ * - Pattern-based candidate detection
1366
+ * - Embedding-based type classification
1367
+ * - Context-aware confidence scoring
1368
+ *
1369
+ * @param text - Text to extract entities from
1370
+ * @param options - Extraction options
1371
+ * @returns Array of extracted entities with types and confidence
1372
+ *
1373
+ * @example
1374
+ * const entities = await brain.extract('John Smith founded Acme Corp in New York')
1375
+ * // [
1376
+ * // { text: 'John Smith', type: NounType.Person, confidence: 0.95 },
1377
+ * // { text: 'Acme Corp', type: NounType.Organization, confidence: 0.92 },
1378
+ * // { text: 'New York', type: NounType.Location, confidence: 0.88 }
1379
+ * // ]
1380
+ */
1381
+ async extract(text, options) {
1382
+ if (!this._extractor) {
1383
+ this._extractor = new NeuralEntityExtractor(this);
1384
+ }
1385
+ return await this._extractor.extract(text, options);
1386
+ }
1387
+ /**
1388
+ * Extract concepts from text
1389
+ *
1390
+ * Simplified interface for concept/topic extraction
1391
+ * Returns only concept names as strings for easy metadata population
1392
+ *
1393
+ * @param text - Text to extract concepts from
1394
+ * @param options - Extraction options
1395
+ * @returns Array of concept names
1396
+ *
1397
+ * @example
1398
+ * const concepts = await brain.extractConcepts('Using OAuth for authentication')
1399
+ * // ['oauth', 'authentication']
1400
+ */
1401
+ async extractConcepts(text, options) {
1402
+ const entities = await this.extract(text, {
1403
+ types: [NounType.Concept, NounType.Topic],
1404
+ confidence: options?.confidence || 0.7,
1405
+ neuralMatching: true
1406
+ });
1407
+ // Deduplicate and normalize
1408
+ const conceptSet = new Set(entities.map(e => e.text.toLowerCase()));
1409
+ const concepts = Array.from(conceptSet);
1410
+ // Apply limit if specified
1411
+ return options?.limit ? concepts.slice(0, options.limit) : concepts;
1412
+ }
1360
1413
  /**
1361
1414
  * Virtual File System API - Knowledge Operating System
1362
1415
  */
@@ -2,7 +2,7 @@
2
2
  * 🧠 BRAINY EMBEDDED PATTERNS
3
3
  *
4
4
  * AUTO-GENERATED - DO NOT EDIT
5
- * Generated: 2025-09-15T16:41:42.483Z
5
+ * Generated: 2025-09-29T17:05:30.153Z
6
6
  * Patterns: 220
7
7
  * Coverage: 94-98% of all queries
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * 🧠 BRAINY EMBEDDED PATTERNS
3
3
  *
4
4
  * AUTO-GENERATED - DO NOT EDIT
5
- * Generated: 2025-09-15T16:41:42.483Z
5
+ * Generated: 2025-09-29T17:05:30.153Z
6
6
  * Patterns: 220
7
7
  * Coverage: 94-98% of all queries
8
8
  *
@@ -1015,7 +1015,6 @@ export class NaturalLanguageProcessor {
1015
1015
  confidence
1016
1016
  };
1017
1017
  if (options?.includeMetadata) {
1018
- ;
1019
1018
  entity.metadata = {
1020
1019
  pattern: pattern.source,
1021
1020
  contextBefore: text.substring(Math.max(0, match.index - 20), match.index),
package/dist/setup.js CHANGED
@@ -34,7 +34,6 @@ if (globalObj) {
34
34
  globalObj.TextDecoder = TextDecoder;
35
35
  }
36
36
  // Create special global constructors for library compatibility
37
- ;
38
37
  globalObj.__TextEncoder__ = TextEncoder;
39
38
  globalObj.__TextDecoder__ = TextDecoder;
40
39
  }
@@ -288,6 +288,21 @@ export declare class FileSystemStorage extends BaseStorage {
288
288
  * Consistent across all entity types
289
289
  */
290
290
  private getShardedPath;
291
+ /**
292
+ * Get all JSON files from a sharded directory structure
293
+ * Properly traverses sharded subdirectories based on current sharding depth
294
+ */
295
+ private getAllShardedFiles;
296
+ /**
297
+ * Production-scale streaming pagination for very large datasets
298
+ * Avoids loading all filenames into memory
299
+ */
300
+ private getVerbsWithPaginationStreaming;
301
+ /**
302
+ * Stream through sharded files without loading all names into memory
303
+ * Production-scale implementation for millions of files
304
+ */
305
+ private streamShardedFiles;
291
306
  /**
292
307
  * Check if a file exists (handles both sharded and non-sharded)
293
308
  */