@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/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)
@@ -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
- // Also limit ONNX thread count for more predictable memory usage
17
- process.env.ORT_INTRA_OP_NUM_THREADS = '2';
18
- process.env.ORT_INTER_OP_NUM_THREADS = '2';
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: 2, // Limit thread count
263
- intraOpNumThreads: 2, // Limit parallelism
264
- graphOptimizationLevel: 'all'
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) Set BRAINY_ALLOW_REMOTE_MODELS=true, ` +
315
- `2) Run "npm run download-models", or ` +
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.9.0",
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": ">=22.0.0"
58
+ "node": "22.x"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "npm run build:patterns:if-needed && tsc",