@soulcraft/brainy 2.9.0 β 2.10.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 +2 -0
- package/README.md +61 -18
- package/dist/brainyData.d.ts +4 -1
- package/dist/brainyData.js +94 -38
- 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 +16 -0
- package/dist/config/index.js +33 -0
- package/dist/config/modelAutoConfig.d.ts +32 -0
- package/dist/config/modelAutoConfig.js +193 -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/index.d.ts +1 -0
- package/dist/index.js +16 -0
- package/dist/utils/embedding.js +10 -9
- package/dist/utils/nodeVersionCheck.d.ts +24 -0
- package/dist/utils/nodeVersionCheck.js +65 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -11,6 +11,22 @@
|
|
|
11
11
|
// Export main BrainyData class and related types
|
|
12
12
|
import { BrainyData } from './brainyData.js';
|
|
13
13
|
export { BrainyData };
|
|
14
|
+
// Export zero-configuration types and enums
|
|
15
|
+
export {
|
|
16
|
+
// Preset names
|
|
17
|
+
PresetName,
|
|
18
|
+
// Model configuration
|
|
19
|
+
ModelPrecision,
|
|
20
|
+
// Storage configuration
|
|
21
|
+
StorageOption,
|
|
22
|
+
// Feature configuration
|
|
23
|
+
FeatureSet,
|
|
24
|
+
// Distributed roles
|
|
25
|
+
DistributedRole,
|
|
26
|
+
// Categories
|
|
27
|
+
PresetCategory, registerStorageAugmentation, registerPresetAugmentation,
|
|
28
|
+
// Preset utilities
|
|
29
|
+
getPreset, isValidPreset, getPresetsByCategory, getAllPresetNames, getPresetDescription } from './config/index.js';
|
|
14
30
|
// Export Cortex (the orchestrator)
|
|
15
31
|
export { Cortex, cortex } from './cortex.js';
|
|
16
32
|
// Export Neural Import (AI data understanding)
|
package/dist/utils/embedding.js
CHANGED
|
@@ -13,9 +13,10 @@ import { pipeline, env } from '@huggingface/transformers';
|
|
|
13
13
|
if (typeof process !== 'undefined' && process.env) {
|
|
14
14
|
process.env.ORT_DISABLE_MEMORY_ARENA = '1';
|
|
15
15
|
process.env.ORT_DISABLE_MEMORY_PATTERN = '1';
|
|
16
|
-
//
|
|
17
|
-
process.env.ORT_INTRA_OP_NUM_THREADS = '
|
|
18
|
-
process.env.ORT_INTER_OP_NUM_THREADS = '
|
|
16
|
+
// Force single-threaded operation for maximum stability (Node.js 24 compatibility)
|
|
17
|
+
process.env.ORT_INTRA_OP_NUM_THREADS = '1'; // Single thread for operators
|
|
18
|
+
process.env.ORT_INTER_OP_NUM_THREADS = '1'; // Single thread for sessions
|
|
19
|
+
process.env.ORT_NUM_THREADS = '1'; // Additional safety override
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
22
|
* Detect the best available GPU device for the current environment
|
|
@@ -79,7 +80,7 @@ export class TransformerEmbedding {
|
|
|
79
80
|
localFilesOnly = options.localFilesOnly;
|
|
80
81
|
}
|
|
81
82
|
else if (process.env.BRAINY_ALLOW_REMOTE_MODELS === 'false') {
|
|
82
|
-
// 2. Environment variable explicitly disables remote models
|
|
83
|
+
// 2. Environment variable explicitly disables remote models (legacy support)
|
|
83
84
|
localFilesOnly = true;
|
|
84
85
|
}
|
|
85
86
|
else if (process.env.NODE_ENV === 'development') {
|
|
@@ -259,9 +260,9 @@ export class TransformerEmbedding {
|
|
|
259
260
|
session_options: {
|
|
260
261
|
enableCpuMemArena: false, // Disable pre-allocated memory arena
|
|
261
262
|
enableMemPattern: false, // Disable memory pattern optimization
|
|
262
|
-
interOpNumThreads:
|
|
263
|
-
intraOpNumThreads:
|
|
264
|
-
graphOptimizationLevel: '
|
|
263
|
+
interOpNumThreads: 1, // Force single thread for V8 stability
|
|
264
|
+
intraOpNumThreads: 1, // Force single thread for V8 stability
|
|
265
|
+
graphOptimizationLevel: 'disabled' // Disable threading optimizations
|
|
265
266
|
}
|
|
266
267
|
};
|
|
267
268
|
// Add device configuration for GPU acceleration
|
|
@@ -311,8 +312,8 @@ export class TransformerEmbedding {
|
|
|
311
312
|
// Both local and remote failed - throw comprehensive error
|
|
312
313
|
const errorMsg = `Failed to load embedding model "${this.options.model}". ` +
|
|
313
314
|
`Local models not found and remote download failed. ` +
|
|
314
|
-
`To fix: 1)
|
|
315
|
-
`2)
|
|
315
|
+
`To fix: 1) Run "npm run download-models", ` +
|
|
316
|
+
`2) Check your internet connection, or ` +
|
|
316
317
|
`3) Use a custom embedding function.`;
|
|
317
318
|
throw new Error(errorMsg);
|
|
318
319
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js Version Compatibility Check
|
|
3
|
+
*
|
|
4
|
+
* Brainy requires Node.js 22.x LTS for maximum stability with ONNX Runtime.
|
|
5
|
+
* This prevents V8 HandleScope locking issues in worker threads.
|
|
6
|
+
*/
|
|
7
|
+
export interface VersionInfo {
|
|
8
|
+
current: string;
|
|
9
|
+
major: number;
|
|
10
|
+
isSupported: boolean;
|
|
11
|
+
recommendation: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Check if the current Node.js version is supported
|
|
15
|
+
*/
|
|
16
|
+
export declare function checkNodeVersion(): VersionInfo;
|
|
17
|
+
/**
|
|
18
|
+
* Enforce Node.js version requirement with helpful error messaging
|
|
19
|
+
*/
|
|
20
|
+
export declare function enforceNodeVersion(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Soft warning for version issues (non-blocking)
|
|
23
|
+
*/
|
|
24
|
+
export declare function warnNodeVersion(): boolean;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js Version Compatibility Check
|
|
3
|
+
*
|
|
4
|
+
* Brainy requires Node.js 22.x LTS for maximum stability with ONNX Runtime.
|
|
5
|
+
* This prevents V8 HandleScope locking issues in worker threads.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Check if the current Node.js version is supported
|
|
9
|
+
*/
|
|
10
|
+
export function checkNodeVersion() {
|
|
11
|
+
const nodeVersion = process.version;
|
|
12
|
+
const majorVersion = parseInt(nodeVersion.split('.')[0].substring(1));
|
|
13
|
+
const versionInfo = {
|
|
14
|
+
current: nodeVersion,
|
|
15
|
+
major: majorVersion,
|
|
16
|
+
isSupported: majorVersion === 22,
|
|
17
|
+
recommendation: 'Node.js 22.x LTS'
|
|
18
|
+
};
|
|
19
|
+
return versionInfo;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Enforce Node.js version requirement with helpful error messaging
|
|
23
|
+
*/
|
|
24
|
+
export function enforceNodeVersion() {
|
|
25
|
+
const versionInfo = checkNodeVersion();
|
|
26
|
+
if (!versionInfo.isSupported) {
|
|
27
|
+
const errorMessage = [
|
|
28
|
+
'π¨ BRAINY COMPATIBILITY ERROR',
|
|
29
|
+
'β'.repeat(50),
|
|
30
|
+
`β Current Node.js: ${versionInfo.current}`,
|
|
31
|
+
`β
Required: ${versionInfo.recommendation}`,
|
|
32
|
+
'',
|
|
33
|
+
'π‘ Quick Fix:',
|
|
34
|
+
' nvm install 22 && nvm use 22',
|
|
35
|
+
' npm install',
|
|
36
|
+
'',
|
|
37
|
+
'π Why Node.js 22?',
|
|
38
|
+
' β’ Maximum ONNX Runtime stability',
|
|
39
|
+
' β’ Prevents V8 threading crashes',
|
|
40
|
+
' β’ Optimal zero-config performance',
|
|
41
|
+
'',
|
|
42
|
+
'π More info: https://github.com/soulcraftlabs/brainy#node-version',
|
|
43
|
+
'β'.repeat(50)
|
|
44
|
+
].join('\n');
|
|
45
|
+
throw new Error(errorMessage);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Soft warning for version issues (non-blocking)
|
|
50
|
+
*/
|
|
51
|
+
export function warnNodeVersion() {
|
|
52
|
+
const versionInfo = checkNodeVersion();
|
|
53
|
+
if (!versionInfo.isSupported) {
|
|
54
|
+
console.warn([
|
|
55
|
+
'β οΈ BRAINY VERSION WARNING',
|
|
56
|
+
` Current: ${versionInfo.current}`,
|
|
57
|
+
` Recommended: ${versionInfo.recommendation}`,
|
|
58
|
+
' Consider upgrading for best stability',
|
|
59
|
+
''
|
|
60
|
+
].join('\n'));
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=nodeVersionCheck.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soulcraft/brainy",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.1",
|
|
4
4
|
"description": "Universal Knowledge Protocolβ’ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. 31 nouns Γ 40 verbs for infinite expressiveness.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
|
-
"node": "
|
|
58
|
+
"node": "22.x"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "npm run build:patterns:if-needed && tsc",
|