fix: correct Node.js version references from 24 to 22 in comments and code

Fixed confusing messaging where comments mentioned Node 24 while actual requirement is Node 22:

- environment.ts: Fixed areWorkerThreadsAvailableSync() to check for >= 22 instead of >= 24
- workerUtils.ts: Updated comments to reference Node.js 22 LTS instead of 24
- embedding.ts: Updated ONNX threading comment to reference Node.js 22 LTS

Why Node 22 not Node 24:
- ONNX Runtime has stability issues in Node 24 (V8 HandleScope crashes)
- Node 22 LTS provides maximum stability with our embedding model
- These stale Node 24 references were causing user confusion

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
David Snelling 2025-10-20 11:43:31 -07:00
parent fcf710c398
commit 22513ffcb4
3 changed files with 5 additions and 5 deletions

View file

@ -14,7 +14,7 @@ import { pipeline, env } from '@huggingface/transformers'
if (typeof process !== 'undefined' && process.env) {
process.env.ORT_DISABLE_MEMORY_ARENA = '1'
process.env.ORT_DISABLE_MEMORY_PATTERN = '1'
// Force single-threaded operation for maximum stability (Node.js 24 compatibility)
// Force single-threaded operation for maximum stability (Node.js 22 LTS)
process.env.ORT_INTRA_OP_NUM_THREADS = '1' // Single thread for operators
process.env.ORT_INTER_OP_NUM_THREADS = '1' // Single thread for sessions
process.env.ORT_NUM_THREADS = '1' // Additional safety override

View file

@ -66,8 +66,8 @@ export async function areWorkerThreadsAvailable(): Promise<boolean> {
export function areWorkerThreadsAvailableSync(): boolean {
if (!isNode()) return false
// In Node.js 24.4.0+, worker_threads is always available
return parseInt(process.versions.node.split('.')[0]) >= 24
// In Node.js 22+, worker_threads is always available
return parseInt(process.versions.node.split('.')[0]) >= 22
}
/**

View file

@ -1,6 +1,6 @@
/**
* Utility functions for executing functions in Worker Threads (Node.js) or Web Workers (Browser)
* This implementation leverages Node.js 24's improved Worker Threads API for better performance
* This implementation leverages Node.js 22's stable Worker Threads API for maximum reliability
*/
import { isBrowser, isNode } from './environment.js'
@ -82,7 +82,7 @@ export function executeInThread<T>(fnString: string, args: any): Promise<T> {
/**
* Execute a function in a Node.js Worker Thread
* Optimized for Node.js 24 with improved Worker Threads performance
* Optimized for Node.js 22 LTS with stable Worker Threads performance
*/
function executeInNodeWorker<T>(fnString: string, args: any): Promise<T> {
return new Promise<T>((resolve, reject) => {