@soulcraft/brainy 3.8.1 → 3.8.3

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.
@@ -3,8 +3,6 @@
3
3
  * Complete rewrite to eliminate TensorFlow.js and use ONNX-based models
4
4
  */
5
5
  import { isBrowser } from './environment.js';
6
- import { join } from 'node:path';
7
- import { existsSync } from 'node:fs';
8
6
  // @ts-ignore - Transformers.js is now the primary embedding library
9
7
  import { pipeline, env } from '@huggingface/transformers';
10
8
  // CRITICAL: Disable ONNX memory arena to prevent 4-8GB allocation
@@ -281,15 +279,23 @@ export class TransformerEmbedding {
281
279
  }
282
280
  try {
283
281
  // For Q8 models, we need to explicitly specify the model file
284
- if (actualType === 'q8') {
285
- // Check if quantized model exists
286
- const modelPath = join(cacheDir, this.options.model, 'onnx', 'model_quantized.onnx');
287
- if (existsSync(modelPath)) {
288
- this.logger('log', '✅ Q8 model found locally');
282
+ if (actualType === 'q8' && !isBrowser()) {
283
+ try {
284
+ // Check if quantized model exists (Node.js only)
285
+ const { join } = await import('node:path');
286
+ const { existsSync } = await import('node:fs');
287
+ const modelPath = join(cacheDir, this.options.model, 'onnx', 'model_quantized.onnx');
288
+ if (existsSync(modelPath)) {
289
+ this.logger('log', '✅ Q8 model found locally');
290
+ }
291
+ else {
292
+ this.logger('warn', '⚠️ Q8 model not found');
293
+ actualType = 'q8'; // Always Q8
294
+ }
289
295
  }
290
- else {
291
- this.logger('warn', '⚠️ Q8 model not found');
292
- actualType = 'q8'; // Always Q8
296
+ catch (error) {
297
+ // Skip model path check in browser or if imports fail
298
+ this.logger('log', '🌐 Skipping local model check in browser environment');
293
299
  }
294
300
  }
295
301
  this.extractor = await pipeline('feature-extraction', this.options.model, pipelineOptions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soulcraft/brainy",
3
- "version": "3.8.1",
3
+ "version": "3.8.3",
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",
@@ -44,7 +44,12 @@
44
44
  "browser": {
45
45
  "./dist/distributed": false,
46
46
  "./dist/cli": false,
47
- "./dist/scripts": false
47
+ "./dist/scripts": false,
48
+ "./dist/cortex": false,
49
+ "./dist/cortex/neuralImport.js": false,
50
+ "./dist/cortex/performanceMonitor.js": false,
51
+ "./dist/cortex/healthCheck.js": false,
52
+ "./dist/cortex/backupRestore.js": false
48
53
  },
49
54
  "engines": {
50
55
  "node": "22.x"