fix(ruvllm): Normalize native RuvLlmEngine to RuvLLMEngine

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 <noreply@anthropic.com>
This commit is contained in:
rUv 2025-12-03 23:00:04 +00:00
parent 03fa15e2e6
commit beaee27952
2 changed files with 19 additions and 2 deletions

View file

@ -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",

View file

@ -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