From beaee279522fc78a4ea19626fa1b3f22ace67302 Mon Sep 17 00:00:00 2001 From: rUv Date: Wed, 3 Dec 2025 23:00:04 +0000 Subject: [PATCH] fix(ruvllm): Normalize native RuvLlmEngine to RuvLLMEngine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The native module exports RuvLlmEngine (camelCase) but the JS wrapper expected RuvLLMEngine (ALL_CAPS acronym). This caused isNativeLoaded() to return false even though native module was available. Fix: Add normalization layer in native.ts to handle both naming conventions, mapping RuvLlmEngine -> RuvLLMEngine. Bump version to 0.2.2 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- npm/packages/ruvllm/package.json | 2 +- npm/packages/ruvllm/src/native.ts | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/npm/packages/ruvllm/package.json b/npm/packages/ruvllm/package.json index e28846bba..4f9cccbd4 100644 --- a/npm/packages/ruvllm/package.json +++ b/npm/packages/ruvllm/package.json @@ -1,6 +1,6 @@ { "name": "@ruvector/ruvllm", - "version": "0.2.1", + "version": "0.2.2", "description": "Self-learning LLM orchestration with SONA adaptive learning, HNSW memory, FastGRNN routing, and SIMD inference", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", diff --git a/npm/packages/ruvllm/src/native.ts b/npm/packages/ruvllm/src/native.ts index b9a1a42f0..c92acfcf1 100644 --- a/npm/packages/ruvllm/src/native.ts +++ b/npm/packages/ruvllm/src/native.ts @@ -10,12 +10,22 @@ import { join } from 'path'; let nativeModule: NativeRuvLLM | null = null; interface NativeRuvLLM { + // Native exports RuvLlmEngine (camelCase), we normalize to RuvLLMEngine RuvLLMEngine: new (config?: NativeConfig) => NativeEngine; SimdOperations: new () => NativeSimdOps; version: () => string; hasSimdSupport: () => boolean; } +// Raw native module interface (actual export names) +interface RawNativeModule { + RuvLlmEngine?: new (config?: NativeConfig) => NativeEngine; + RuvLLMEngine?: new (config?: NativeConfig) => NativeEngine; + SimdOperations: new () => NativeSimdOps; + version: () => string; + hasSimdSupport: () => boolean; +} + interface NativeConfig { embedding_dim?: number; router_hidden_dim?: number; @@ -131,7 +141,14 @@ function loadNativeModule(): NativeRuvLLM | null { for (const attempt of attempts) { try { - nativeModule = attempt() as NativeRuvLLM; + const raw = attempt() as RawNativeModule; + // Normalize: native exports RuvLlmEngine, we expose as RuvLLMEngine + nativeModule = { + RuvLLMEngine: raw.RuvLLMEngine ?? raw.RuvLlmEngine!, + SimdOperations: raw.SimdOperations, + version: raw.version, + hasSimdSupport: raw.hasSimdSupport, + }; return nativeModule; } catch { // Continue to next attempt