@soulcraft/brainy 0.63.0 → 1.0.0-rc.2
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/README.md +296 -95
- package/bin/brainy.js +1121 -1409
- package/dist/brainyData.d.ts +185 -44
- package/dist/brainyData.js +727 -40
- package/dist/chat/BrainyChat.js +5 -11
- package/dist/cortex/neuralImport.js +1 -3
- package/dist/index.d.ts +3 -4
- package/dist/index.js +5 -6
- package/dist/pipeline.d.ts +15 -271
- package/dist/pipeline.js +25 -586
- package/package.json +3 -1
- package/dist/augmentations/cortexSense.d.ts +0 -196
- package/dist/augmentations/cortexSense.js +0 -747
- package/dist/chat/brainyChat.d.ts +0 -42
- package/dist/chat/brainyChat.js +0 -340
- package/dist/cortex/cliWrapper.d.ts +0 -32
- package/dist/cortex/cliWrapper.js +0 -209
- package/dist/cortex/cortex-legacy.d.ts +0 -269
- package/dist/cortex/cortex-legacy.js +0 -2523
- package/dist/cortex/cortex.d.ts +0 -264
- package/dist/cortex/cortex.js +0 -2463
- package/dist/cortex/serviceIntegration.d.ts +0 -156
- package/dist/cortex/serviceIntegration.js +0 -384
- package/dist/sequentialPipeline.d.ts +0 -113
- package/dist/sequentialPipeline.js +0 -417
- package/dist/utils/modelLoader.d.ts +0 -12
- package/dist/utils/modelLoader.js +0 -88
package/dist/brainyData.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { HNSWIndexOptimized, HNSWOptimizedConfig } from './hnsw/hnswIndexOptimiz
|
|
|
7
7
|
import { DistanceFunction, GraphVerb, EmbeddingFunction, HNSWConfig, SearchResult, SearchCursor, PaginatedSearchResult, StorageAdapter, Vector, VectorDocument } from './coreTypes.js';
|
|
8
8
|
import { MetadataIndexManager, MetadataIndexConfig } from './utils/metadataIndex.js';
|
|
9
9
|
import { NounType, VerbType } from './types/graphTypes.js';
|
|
10
|
-
import { WebSocketConnection } from './types/augmentations.js';
|
|
10
|
+
import { WebSocketConnection, IAugmentation } from './types/augmentations.js';
|
|
11
11
|
import { BrainyDataInterface } from './types/brainyDataInterface.js';
|
|
12
12
|
import { DistributedConfig } from './types/distributedTypes.js';
|
|
13
13
|
import { SearchCacheConfig } from './utils/searchCache.js';
|
|
@@ -532,34 +532,31 @@ export declare class BrainyData<T = any> implements BrainyDataInterface<T> {
|
|
|
532
532
|
*/
|
|
533
533
|
connectToRemoteServer(serverUrl: string, protocols?: string | string[]): Promise<WebSocketConnection>;
|
|
534
534
|
/**
|
|
535
|
-
* Add data to the database
|
|
536
|
-
*
|
|
537
|
-
* 🔒 Safe by default: Only stores your data literally without AI processing
|
|
538
|
-
* 🧠 AI processing: Set { process: true } or use addSmart() for Neural Import
|
|
535
|
+
* Add data to the database with intelligent processing
|
|
539
536
|
*
|
|
540
537
|
* @param vectorOrData Vector or data to add
|
|
541
538
|
* @param metadata Optional metadata to associate with the data
|
|
542
|
-
* @param options Additional options
|
|
539
|
+
* @param options Additional options for processing
|
|
543
540
|
* @returns The ID of the added data
|
|
544
541
|
*
|
|
545
542
|
* @example
|
|
546
|
-
* //
|
|
547
|
-
* await brainy.add("
|
|
543
|
+
* // Auto mode - intelligently decides processing
|
|
544
|
+
* await brainy.add("Customer feedback: Great product!")
|
|
548
545
|
*
|
|
549
546
|
* @example
|
|
550
|
-
* //
|
|
551
|
-
* await brainy.add("
|
|
547
|
+
* // Explicit literal mode for sensitive data
|
|
548
|
+
* await brainy.add("API_KEY=secret123", null, { process: 'literal' })
|
|
552
549
|
*
|
|
553
550
|
* @example
|
|
554
|
-
* //
|
|
555
|
-
* await brainy.
|
|
551
|
+
* // Force neural processing
|
|
552
|
+
* await brainy.add("John works at Acme Corp", null, { process: 'neural' })
|
|
556
553
|
*/
|
|
557
554
|
add(vectorOrData: Vector | any, metadata?: T, options?: {
|
|
558
555
|
forceEmbed?: boolean;
|
|
559
556
|
addToRemote?: boolean;
|
|
560
557
|
id?: string;
|
|
561
558
|
service?: string;
|
|
562
|
-
process?:
|
|
559
|
+
process?: 'auto' | 'literal' | 'neural';
|
|
563
560
|
}): Promise<string>;
|
|
564
561
|
/**
|
|
565
562
|
* Add a text item to the database with automatic embedding
|
|
@@ -782,6 +779,9 @@ export declare class BrainyData<T = any> implements BrainyDataInterface<T> {
|
|
|
782
779
|
*/
|
|
783
780
|
delete(id: string, options?: {
|
|
784
781
|
service?: string;
|
|
782
|
+
soft?: boolean;
|
|
783
|
+
cascade?: boolean;
|
|
784
|
+
force?: boolean;
|
|
785
785
|
}): Promise<boolean>;
|
|
786
786
|
/**
|
|
787
787
|
* Update metadata for a vector
|
|
@@ -824,17 +824,7 @@ export declare class BrainyData<T = any> implements BrainyDataInterface<T> {
|
|
|
824
824
|
*
|
|
825
825
|
* @throws Error if source or target nouns don't exist and autoCreateMissingNouns is false or auto-creation fails
|
|
826
826
|
*/
|
|
827
|
-
|
|
828
|
-
type?: string;
|
|
829
|
-
weight?: number;
|
|
830
|
-
metadata?: any;
|
|
831
|
-
forceEmbed?: boolean;
|
|
832
|
-
id?: string;
|
|
833
|
-
autoCreateMissingNouns?: boolean;
|
|
834
|
-
missingNounMetadata?: any;
|
|
835
|
-
service?: string;
|
|
836
|
-
writeOnlyMode?: boolean;
|
|
837
|
-
}): Promise<string>;
|
|
827
|
+
private _addVerbInternal;
|
|
838
828
|
/**
|
|
839
829
|
* Get a verb by ID
|
|
840
830
|
* This is a direct storage operation that works in write-only mode when allowDirectReads is enabled
|
|
@@ -946,25 +936,10 @@ export declare class BrainyData<T = any> implements BrainyDataInterface<T> {
|
|
|
946
936
|
*/
|
|
947
937
|
private adaptCacheConfiguration;
|
|
948
938
|
/**
|
|
949
|
-
*
|
|
950
|
-
*
|
|
951
|
-
* 🧠 This method automatically enables Neural Import and other AI augmentations
|
|
952
|
-
* for intelligent data understanding, entity detection, and relationship analysis.
|
|
953
|
-
*
|
|
954
|
-
* Use this when you want AI to understand and process your data.
|
|
955
|
-
* Use regular add() when you want literal storage only.
|
|
956
|
-
*
|
|
957
|
-
* @param vectorOrData The data to add (any format)
|
|
958
|
-
* @param metadata Optional metadata to associate with the data
|
|
959
|
-
* @param options Additional options (process defaults to true)
|
|
960
|
-
* @returns The ID of the added data
|
|
939
|
+
* @deprecated Use add() instead - it's smart by default now
|
|
940
|
+
* @hidden
|
|
961
941
|
*/
|
|
962
|
-
addSmart(vectorOrData: Vector | any, metadata?: T, options?:
|
|
963
|
-
forceEmbed?: boolean;
|
|
964
|
-
addToRemote?: boolean;
|
|
965
|
-
id?: string;
|
|
966
|
-
service?: string;
|
|
967
|
-
}): Promise<string>;
|
|
942
|
+
addSmart(vectorOrData: Vector | any, metadata?: T, options?: any): Promise<string>;
|
|
968
943
|
/**
|
|
969
944
|
* Get the number of nouns in the database (excluding verbs)
|
|
970
945
|
* This is used for statistics reporting to match the expected behavior in tests
|
|
@@ -1345,7 +1320,7 @@ export declare class BrainyData<T = any> implements BrainyDataInterface<T> {
|
|
|
1345
1320
|
*/
|
|
1346
1321
|
loadEnvironment(): Promise<void>;
|
|
1347
1322
|
/**
|
|
1348
|
-
* Set a configuration value
|
|
1323
|
+
* Set a configuration value with optional encryption
|
|
1349
1324
|
* @param key Configuration key
|
|
1350
1325
|
* @param value Configuration value
|
|
1351
1326
|
* @param options Options including encryption
|
|
@@ -1354,11 +1329,132 @@ export declare class BrainyData<T = any> implements BrainyDataInterface<T> {
|
|
|
1354
1329
|
encrypt?: boolean;
|
|
1355
1330
|
}): Promise<void>;
|
|
1356
1331
|
/**
|
|
1357
|
-
* Get a configuration value
|
|
1332
|
+
* Get a configuration value with automatic decryption
|
|
1358
1333
|
* @param key Configuration key
|
|
1359
1334
|
* @returns Configuration value or undefined
|
|
1360
1335
|
*/
|
|
1361
1336
|
getConfig(key: string): Promise<any>;
|
|
1337
|
+
/**
|
|
1338
|
+
* Encrypt data using universal crypto utilities
|
|
1339
|
+
*/
|
|
1340
|
+
encryptData(data: string): Promise<string>;
|
|
1341
|
+
/**
|
|
1342
|
+
* Decrypt data using universal crypto utilities
|
|
1343
|
+
*/
|
|
1344
|
+
decryptData(encryptedData: string): Promise<string>;
|
|
1345
|
+
/**
|
|
1346
|
+
* Neural Import - Smart bulk data import with semantic type detection
|
|
1347
|
+
* Uses transformer embeddings to automatically detect and classify data types
|
|
1348
|
+
* @param data Array of data items or single item to import
|
|
1349
|
+
* @param options Import options including type hints and processing mode
|
|
1350
|
+
* @returns Array of created IDs
|
|
1351
|
+
*/
|
|
1352
|
+
import(data: any[] | any, options?: {
|
|
1353
|
+
typeHint?: NounType;
|
|
1354
|
+
autoDetect?: boolean;
|
|
1355
|
+
batchSize?: number;
|
|
1356
|
+
process?: 'auto' | 'guided' | 'explicit' | 'literal';
|
|
1357
|
+
}): Promise<string[]>;
|
|
1358
|
+
/**
|
|
1359
|
+
* Add Noun - Explicit noun creation with strongly-typed NounType
|
|
1360
|
+
* For when you know exactly what type of noun you're creating
|
|
1361
|
+
* @param data The noun data
|
|
1362
|
+
* @param nounType The explicit noun type from NounType enum
|
|
1363
|
+
* @param metadata Additional metadata
|
|
1364
|
+
* @returns Created noun ID
|
|
1365
|
+
*/
|
|
1366
|
+
addNoun(data: any, nounType: NounType, metadata?: any): Promise<string>;
|
|
1367
|
+
/**
|
|
1368
|
+
* Add Verb - Unified relationship creation between nouns
|
|
1369
|
+
* Creates typed relationships with proper vector embeddings from metadata
|
|
1370
|
+
* @param sourceId Source noun ID
|
|
1371
|
+
* @param targetId Target noun ID
|
|
1372
|
+
* @param verbType Relationship type from VerbType enum
|
|
1373
|
+
* @param metadata Additional metadata for the relationship (will be embedded for searchability)
|
|
1374
|
+
* @param weight Relationship weight/strength (0-1, default: 0.5)
|
|
1375
|
+
* @returns Created verb ID
|
|
1376
|
+
*/
|
|
1377
|
+
addVerb(sourceId: string, targetId: string, verbType: VerbType, metadata?: any, weight?: number): Promise<string>;
|
|
1378
|
+
/**
|
|
1379
|
+
* Auto-detect whether to use neural processing for data
|
|
1380
|
+
* @private
|
|
1381
|
+
*/
|
|
1382
|
+
private shouldAutoProcessNeurally;
|
|
1383
|
+
/**
|
|
1384
|
+
* Detect noun type using semantic analysis
|
|
1385
|
+
* @private
|
|
1386
|
+
*/
|
|
1387
|
+
private detectNounType;
|
|
1388
|
+
/**
|
|
1389
|
+
* Get Noun with Connected Verbs - Retrieve noun and all its relationships
|
|
1390
|
+
* Provides complete traversal view of a noun and its connections using existing searchVerbs
|
|
1391
|
+
* @param nounId The noun ID to retrieve
|
|
1392
|
+
* @param options Traversal options
|
|
1393
|
+
* @returns Noun data with connected verbs and related nouns
|
|
1394
|
+
*/
|
|
1395
|
+
getNounWithVerbs(nounId: string, options?: {
|
|
1396
|
+
includeIncoming?: boolean;
|
|
1397
|
+
includeOutgoing?: boolean;
|
|
1398
|
+
verbLimit?: number;
|
|
1399
|
+
verbTypes?: string[];
|
|
1400
|
+
}): Promise<{
|
|
1401
|
+
noun: {
|
|
1402
|
+
id: string;
|
|
1403
|
+
data: any;
|
|
1404
|
+
metadata: any;
|
|
1405
|
+
nounType?: NounType;
|
|
1406
|
+
};
|
|
1407
|
+
incomingVerbs: any[];
|
|
1408
|
+
outgoingVerbs: any[];
|
|
1409
|
+
totalConnections: number;
|
|
1410
|
+
} | null>;
|
|
1411
|
+
/**
|
|
1412
|
+
* Update - Smart noun update with automatic index synchronization
|
|
1413
|
+
* Updates both data and metadata while maintaining search index integrity
|
|
1414
|
+
* @param id The noun ID to update
|
|
1415
|
+
* @param data New data (optional - if not provided, only metadata is updated)
|
|
1416
|
+
* @param metadata New metadata (merged with existing)
|
|
1417
|
+
* @param options Update options
|
|
1418
|
+
* @returns Success boolean
|
|
1419
|
+
*/
|
|
1420
|
+
update(id: string, data?: any, metadata?: any, options?: {
|
|
1421
|
+
merge?: boolean;
|
|
1422
|
+
reindex?: boolean;
|
|
1423
|
+
cascade?: boolean;
|
|
1424
|
+
}): Promise<boolean>;
|
|
1425
|
+
/**
|
|
1426
|
+
* Preload Transformer Model - Essential for container deployments
|
|
1427
|
+
* Downloads and caches models during initialization to avoid runtime delays
|
|
1428
|
+
* @param options Preload options
|
|
1429
|
+
* @returns Success boolean and model info
|
|
1430
|
+
*/
|
|
1431
|
+
static preloadModel(options?: {
|
|
1432
|
+
model?: string;
|
|
1433
|
+
cacheDir?: string;
|
|
1434
|
+
device?: string;
|
|
1435
|
+
force?: boolean;
|
|
1436
|
+
}): Promise<{
|
|
1437
|
+
success: boolean;
|
|
1438
|
+
modelPath: string;
|
|
1439
|
+
modelSize: number;
|
|
1440
|
+
device: string;
|
|
1441
|
+
}>;
|
|
1442
|
+
/**
|
|
1443
|
+
* Warmup - Initialize BrainyData with preloaded models (container-optimized)
|
|
1444
|
+
* For production deployments where models should be ready immediately
|
|
1445
|
+
* @param config BrainyData configuration
|
|
1446
|
+
* @param options Warmup options
|
|
1447
|
+
*/
|
|
1448
|
+
static warmup(config?: BrainyDataConfig, options?: {
|
|
1449
|
+
preloadModel?: boolean;
|
|
1450
|
+
modelOptions?: Parameters<typeof BrainyData.preloadModel>[0];
|
|
1451
|
+
testEmbedding?: boolean;
|
|
1452
|
+
}): Promise<BrainyData>;
|
|
1453
|
+
/**
|
|
1454
|
+
* Get model size for deployment info
|
|
1455
|
+
* @private
|
|
1456
|
+
*/
|
|
1457
|
+
private static getModelSize;
|
|
1362
1458
|
/**
|
|
1363
1459
|
* Coordinate storage migration across distributed services
|
|
1364
1460
|
* @param options Migration options
|
|
@@ -1378,6 +1474,51 @@ export declare class BrainyData<T = any> implements BrainyDataInterface<T> {
|
|
|
1378
1474
|
* Exposed for Cortex reindex command
|
|
1379
1475
|
*/
|
|
1380
1476
|
rebuildMetadataIndex(): Promise<void>;
|
|
1477
|
+
/**
|
|
1478
|
+
* UNIFIED API METHOD #8: Augment - Complete augmentation management
|
|
1479
|
+
* Register, enable, disable, list, and manage augmentations
|
|
1480
|
+
*
|
|
1481
|
+
* @param action The action to perform or augmentation to register
|
|
1482
|
+
* @param options Additional options for the action
|
|
1483
|
+
* @returns Various return types based on action
|
|
1484
|
+
*/
|
|
1485
|
+
augment(action: IAugmentation | 'list' | 'enable' | 'disable' | 'unregister' | 'enable-type' | 'disable-type', options?: string | {
|
|
1486
|
+
name?: string;
|
|
1487
|
+
type?: string;
|
|
1488
|
+
}): this | any;
|
|
1489
|
+
/**
|
|
1490
|
+
* UNIFIED API METHOD #9: Export - Extract your data in various formats
|
|
1491
|
+
* Export your brain's knowledge for backup, migration, or integration
|
|
1492
|
+
*
|
|
1493
|
+
* @param options Export configuration
|
|
1494
|
+
* @returns The exported data in the specified format
|
|
1495
|
+
*/
|
|
1496
|
+
export(options?: {
|
|
1497
|
+
format?: 'json' | 'csv' | 'graph' | 'embeddings';
|
|
1498
|
+
includeVectors?: boolean;
|
|
1499
|
+
includeMetadata?: boolean;
|
|
1500
|
+
includeRelationships?: boolean;
|
|
1501
|
+
filter?: any;
|
|
1502
|
+
limit?: number;
|
|
1503
|
+
}): Promise<any>;
|
|
1504
|
+
/**
|
|
1505
|
+
* Helper: Convert data to CSV format
|
|
1506
|
+
* @private
|
|
1507
|
+
*/
|
|
1508
|
+
private convertToCSV;
|
|
1509
|
+
/**
|
|
1510
|
+
* Helper: Convert data to graph format
|
|
1511
|
+
* @private
|
|
1512
|
+
*/
|
|
1513
|
+
private convertToGraphFormat;
|
|
1514
|
+
/**
|
|
1515
|
+
* Unregister an augmentation by name
|
|
1516
|
+
* Remove augmentations from the pipeline
|
|
1517
|
+
*
|
|
1518
|
+
* @param name The name of the augmentation to unregister
|
|
1519
|
+
* @returns The BrainyData instance for chaining
|
|
1520
|
+
*/
|
|
1521
|
+
unregister(name: string): this;
|
|
1381
1522
|
/**
|
|
1382
1523
|
* Enable an augmentation by name
|
|
1383
1524
|
* Universal control for built-in, community, and premium augmentations
|