diff --git a/npm/core/package.json b/npm/core/package.json index 0681bd3b..c45e7594 100644 --- a/npm/core/package.json +++ b/npm/core/package.json @@ -1,6 +1,6 @@ { "name": "@ruvector/core", - "version": "0.1.15", + "version": "0.1.16", "description": "High-performance Rust vector database for Node.js with HNSW indexing and SIMD optimizations", "main": "./dist/index.js", "types": "./dist/index.d.ts", @@ -28,6 +28,9 @@ "@types/node": "^20.19.25", "typescript": "^5.9.3" }, + "optionalDependencies": { + "@ruvector/attention": "^0.1.0" + }, "files": [ "dist", "platforms", diff --git a/npm/core/src/index.cjs.ts b/npm/core/src/index.cjs.ts index 9b1f1502..dd2ce44c 100644 --- a/npm/core/src/index.cjs.ts +++ b/npm/core/src/index.cjs.ts @@ -89,11 +89,29 @@ function loadNativeBinding() { // Load the native module const nativeBinding = loadNativeBinding(); +// Try to load optional attention module +let attention = null; +try { + attention = require('@ruvector/attention'); +} catch { + // Attention module not installed - this is optional +} + // Export everything from the native binding module.exports = nativeBinding; +// Add VectorDB alias (native exports as VectorDb) +if (nativeBinding.VectorDb && !nativeBinding.VectorDB) { + module.exports.VectorDB = nativeBinding.VectorDb; +} + // Also export as default module.exports.default = nativeBinding; // Re-export DistanceMetric module.exports.DistanceMetric = DistanceMetric; + +// Export attention if available +if (attention) { + module.exports.attention = attention; +} diff --git a/npm/core/src/index.ts b/npm/core/src/index.ts index d455b45e..b1b175a3 100644 --- a/npm/core/src/index.ts +++ b/npm/core/src/index.ts @@ -371,6 +371,17 @@ export const hello = nativeBinding.hello; export const getMetrics = nativeBinding.getMetrics; export const getHealth = nativeBinding.getHealth; +// Try to load optional attention module +let attention: any = null; +try { + attention = require('@ruvector/attention'); +} catch { + // Attention module not installed - this is optional +} + +// Export attention if available +export { attention }; + // Default export export default { VectorDB, @@ -379,5 +390,7 @@ export default { hello, getMetrics, getHealth, - DistanceMetric + DistanceMetric, + // Include attention if available + ...(attention ? { attention } : {}) };