@ruvector/core
Advanced tools
+26
| export interface VectorEntry { | ||
| id?: string; | ||
| vector: Float32Array | number[]; | ||
| } | ||
| export interface SearchQuery { | ||
| vector: Float32Array | number[]; | ||
| k: number; | ||
| efSearch?: number; | ||
| } | ||
| export interface SearchResult { | ||
| id: string; | ||
| score: number; | ||
| } | ||
| export class VectorDB { | ||
| static withDimensions(dimensions: number): VectorDB; | ||
| insert(entry: VectorEntry): Promise<string>; | ||
| insertBatch(entries: VectorEntry[]): Promise<string[]>; | ||
| search(query: SearchQuery): Promise<SearchResult[]>; | ||
| delete(id: string): Promise<boolean>; | ||
| get(id: string): Promise<VectorEntry | null>; | ||
| len(): Promise<number>; | ||
| isEmpty(): Promise<boolean>; | ||
| } |
+45
| const { platform, arch } = process; | ||
| // Platform mapping | ||
| const platformMap = { | ||
| 'linux': { | ||
| 'x64': 'ruvector-core-linux-x64-gnu', | ||
| 'arm64': 'ruvector-core-linux-arm64-gnu' | ||
| }, | ||
| 'darwin': { | ||
| 'x64': 'ruvector-core-darwin-x64', | ||
| 'arm64': 'ruvector-core-darwin-arm64' | ||
| }, | ||
| 'win32': { | ||
| 'x64': 'ruvector-core-win32-x64-msvc' | ||
| } | ||
| }; | ||
| function loadNativeModule() { | ||
| const platformPackage = platformMap[platform]?.[arch]; | ||
| if (!platformPackage) { | ||
| throw new Error( | ||
| `Unsupported platform: ${platform}-${arch}\n` + | ||
| `Ruvector native module is available for:\n` + | ||
| `- Linux (x64, ARM64)\n` + | ||
| `- macOS (x64, ARM64)\n` + | ||
| `- Windows (x64)` | ||
| ); | ||
| } | ||
| try { | ||
| return require(platformPackage); | ||
| } catch (error) { | ||
| if (error.code === 'MODULE_NOT_FOUND') { | ||
| throw new Error( | ||
| `Native module not found for ${platform}-${arch}\n` + | ||
| `Please install: npm install ${platformPackage}\n` + | ||
| `Or reinstall ruvector-core to get optional dependencies` | ||
| ); | ||
| } | ||
| throw error; | ||
| } | ||
| } | ||
| module.exports = loadNativeModule(); |
+49
-49
| { | ||
| "name": "@ruvector/core", | ||
| "version": "0.1.17", | ||
| "description": "High-performance Rust vector database for Node.js with HNSW indexing and SIMD optimizations", | ||
| "main": "./dist/index.js", | ||
| "types": "./dist/index.d.ts", | ||
| "type": "module", | ||
| "exports": { | ||
| ".": { | ||
| "import": "./dist/index.js", | ||
| "require": "./dist/index.cjs", | ||
| "types": "./dist/index.d.ts" | ||
| } | ||
| "version": "0.1.27", | ||
| "description": "High-performance vector database with HNSW indexing - 50k+ inserts/sec, built in Rust for AI/ML similarity search and semantic search applications", | ||
| "main": "index.js", | ||
| "types": "index.d.ts", | ||
| "author": "ruv.io Team <info@ruv.io> (https://ruv.io)", | ||
| "homepage": "https://ruv.io", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/ruvnet/ruvector.git", | ||
| "directory": "npm/packages/core" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/ruvnet/ruvector/issues" | ||
| }, | ||
| "license": "MIT", | ||
| "engines": { | ||
| "node": ">= 18" | ||
| "node": ">=18.0.0" | ||
| }, | ||
| "files": [ | ||
| "index.js", | ||
| "index.d.ts", | ||
| "README.md" | ||
| ], | ||
| "scripts": { | ||
| "build": "npm run build:esm && npm run build:cjs && npm run build:rename-cjs", | ||
| "build:esm": "tsc --project tsconfig.json", | ||
| "build:cjs": "tsc --project tsconfig.cjs.json", | ||
| "build:rename-cjs": "mv dist-cjs/index.cjs.js dist/index.cjs && rm -rf dist-cjs", | ||
| "prepublishOnly": "npm run build", | ||
| "test": "node --test", | ||
| "clean": "rm -rf dist dist-cjs" | ||
| "build:napi": "napi build --platform --release --cargo-cwd ../../../crates/ruvector-node", | ||
| "test": "node test.js", | ||
| "publish:platforms": "node scripts/publish-platforms.js" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/node": "^20.19.25", | ||
| "typescript": "^5.9.3" | ||
| "@napi-rs/cli": "^2.18.0" | ||
| }, | ||
| "optionalDependencies": { | ||
| "@ruvector/attention": "^0.1.0" | ||
| "ruvector-core-linux-x64-gnu": "0.1.25", | ||
| "ruvector-core-linux-arm64-gnu": "0.1.25", | ||
| "ruvector-core-darwin-x64": "0.1.25", | ||
| "ruvector-core-darwin-arm64": "0.1.25", | ||
| "ruvector-core-win32-x64-msvc": "0.1.25" | ||
| }, | ||
| "files": [ | ||
| "dist", | ||
| "platforms", | ||
| "native", | ||
| "*.node", | ||
| "README.md", | ||
| "LICENSE" | ||
| ], | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "keywords": [ | ||
| "vector", | ||
| "database", | ||
| "embeddings", | ||
| "vector-database", | ||
| "vector-search", | ||
| "similarity-search", | ||
| "semantic-search", | ||
| "hnsw", | ||
| "rust", | ||
| "napi", | ||
| "semantic-search", | ||
| "ann", | ||
| "approximate-nearest-neighbor", | ||
| "embedding-database", | ||
| "ai", | ||
| "machine-learning", | ||
| "ml", | ||
| "llm", | ||
| "rag", | ||
| "retrieval-augmented-generation", | ||
| "native", | ||
| "napi", | ||
| "rust", | ||
| "simd", | ||
| "fast", | ||
| "performance", | ||
| "napi-rs" | ||
| ], | ||
| "author": "rUv", | ||
| "license": "MIT", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/ruvnet/ruvector.git", | ||
| "directory": "npm/core" | ||
| }, | ||
| "homepage": "https://github.com/ruvnet/ruvector#readme", | ||
| "bugs": { | ||
| "url": "https://github.com/ruvnet/ruvector/issues" | ||
| } | ||
| "ruv", | ||
| "ruvector" | ||
| ] | ||
| } |
+213
-150
@@ -1,59 +0,93 @@ | ||
| # @ruvector/core | ||
| # ruvector-core | ||
| High-performance Rust vector database for Node.js with HNSW indexing and SIMD optimizations. | ||
| [](https://www.npmjs.com/package/ruvector-core) | ||
| [](https://opensource.org/licenses/MIT) | ||
| [](https://nodejs.org) | ||
| [](https://www.npmjs.com/package/ruvector-core) | ||
| **High-performance vector database with HNSW indexing, built in Rust with Node.js bindings** | ||
| Ruvector is a blazingly fast, memory-efficient vector database designed for AI/ML applications, semantic search, and similarity matching. Built with Rust and optimized with SIMD instructions for maximum performance. | ||
| 🌐 **[Visit ruv.io](https://ruv.io)** for more AI infrastructure tools | ||
| ## Features | ||
| - 🚀 **Blazing Fast**: Rust + SIMD optimizations for maximum performance | ||
| - 🎯 **HNSW Indexing**: State-of-the-art approximate nearest neighbor search | ||
| - 📦 **Zero-Copy**: Efficient buffer sharing between Rust and Node.js | ||
| - 🔍 **Multiple Distance Metrics**: Euclidean, Cosine, Dot Product, Manhattan | ||
| - 💾 **Persistent Storage**: Optional disk-based storage with memory mapping | ||
| - 🔧 **Quantization**: Scalar, Product, and Binary quantization support | ||
| - 📊 **TypeScript**: Full type definitions included | ||
| - 🌍 **Cross-Platform**: Linux, macOS, and Windows support | ||
| - 🚀 **Ultra-Fast Performance** - 50,000+ inserts/sec, 10,000+ searches/sec | ||
| - 🎯 **HNSW Indexing** - State-of-the-art approximate nearest neighbor search | ||
| - ⚡ **SIMD Optimized** - Hardware-accelerated vector operations | ||
| - 🧵 **Multi-threaded** - Async operations with Tokio runtime | ||
| - 💾 **Memory Efficient** - ~50 bytes per vector with optional quantization | ||
| - 🔒 **Type-Safe** - Full TypeScript definitions included | ||
| - 🌍 **Cross-Platform** - Linux, macOS (Intel & Apple Silicon), Windows | ||
| - 🦀 **Rust Core** - Memory safety with zero-cost abstractions | ||
| ## Installation | ||
| ## Quick Start | ||
| ### Installation | ||
| ```bash | ||
| npm install @ruvector/core | ||
| npm install ruvector-core | ||
| ``` | ||
| The package will automatically install the correct native binding for your platform: | ||
| - Linux x64 (GNU) | ||
| - Linux ARM64 (GNU) | ||
| - macOS x64 (Intel) | ||
| - macOS ARM64 (Apple Silicon) | ||
| - Windows x64 (MSVC) | ||
| The correct platform-specific native module is automatically installed. | ||
| ## Quick Start | ||
| ### Basic Usage | ||
| ```javascript | ||
| const { VectorDb } = require('ruvector-core'); | ||
| async function example() { | ||
| // Create database with 128 dimensions | ||
| const db = new VectorDb({ | ||
| dimensions: 128, | ||
| maxElements: 10000, | ||
| storagePath: './vectors.db' | ||
| }); | ||
| // Insert a vector | ||
| const vector = new Float32Array(128).map(() => Math.random()); | ||
| const id = await db.insert({ | ||
| id: 'doc_1', | ||
| vector: vector, | ||
| metadata: { title: 'Example Document' } | ||
| }); | ||
| // Search for similar vectors | ||
| const results = await db.search({ | ||
| vector: vector, | ||
| k: 10 | ||
| }); | ||
| console.log('Top 10 similar vectors:', results); | ||
| // Output: [{ id: 'doc_1', score: 1.0, metadata: {...} }, ...] | ||
| } | ||
| example(); | ||
| ``` | ||
| ### TypeScript | ||
| Full TypeScript support with complete type definitions: | ||
| ```typescript | ||
| import { VectorDB, DistanceMetric } from '@ruvector/core'; | ||
| import { VectorDb, VectorEntry, SearchQuery, SearchResult } from 'ruvector-core'; | ||
| // Create a database | ||
| const db = new VectorDB({ | ||
| dimensions: 384, | ||
| distanceMetric: DistanceMetric.Cosine, | ||
| storagePath: './vectors.db', | ||
| hnswConfig: { | ||
| m: 32, | ||
| efConstruction: 200, | ||
| efSearch: 100 | ||
| } | ||
| const db = new VectorDb({ | ||
| dimensions: 128, | ||
| maxElements: 10000, | ||
| storagePath: './vectors.db' | ||
| }); | ||
| // Insert vectors | ||
| const id = await db.insert({ | ||
| vector: new Float32Array([1.0, 2.0, 3.0, ...]) | ||
| }); | ||
| // Fully typed operations | ||
| const entry: VectorEntry = { | ||
| id: 'doc_1', | ||
| vector: new Float32Array(128), | ||
| metadata: { title: 'Example' } | ||
| }; | ||
| // Search for similar vectors | ||
| const results = await db.search({ | ||
| vector: new Float32Array([1.0, 2.0, 3.0, ...]), | ||
| const results: SearchResult[] = await db.search({ | ||
| vector: new Float32Array(128), | ||
| k: 10 | ||
| }); | ||
| console.log(results); | ||
| // [{ id: 'vector-id', score: 0.95 }, ...] | ||
| ``` | ||
@@ -63,168 +97,197 @@ | ||
| ### VectorDB | ||
| ### Constructor | ||
| #### Constructor | ||
| ```typescript | ||
| new VectorDB(options: DbOptions) | ||
| new VectorDb(options: { | ||
| dimensions: number; // Vector dimensionality (required) | ||
| maxElements?: number; // Max vectors (default: 10000) | ||
| storagePath?: string; // Persistent storage path | ||
| ef_construction?: number; // HNSW construction parameter (default: 200) | ||
| m?: number; // HNSW M parameter (default: 16) | ||
| }) | ||
| ``` | ||
| Creates a new vector database with the specified options. | ||
| ### Methods | ||
| **Options:** | ||
| - `dimensions` (number, required): Vector dimensions | ||
| - `distanceMetric` (DistanceMetric, optional): Distance metric (default: Cosine) | ||
| - `storagePath` (string, optional): Path for persistent storage (default: './ruvector.db') | ||
| - `hnswConfig` (HnswConfig, optional): HNSW index configuration | ||
| - `quantization` (QuantizationConfig, optional): Quantization configuration | ||
| - `insert(entry: VectorEntry): Promise<string>` - Insert a vector | ||
| - `search(query: SearchQuery): Promise<SearchResult[]>` - Find similar vectors | ||
| - `delete(id: string): Promise<boolean>` - Remove a vector | ||
| - `len(): Promise<number>` - Count total vectors | ||
| - `get(id: string): Promise<VectorEntry | null>` - Retrieve vector by ID | ||
| #### Static Methods | ||
| ## Performance Benchmarks | ||
| ```typescript | ||
| VectorDB.withDimensions(dimensions: number): VectorDB | ||
| ``` | ||
| Tested on AMD Ryzen 9 5950X, 128-dimensional vectors: | ||
| Creates a vector database with default options. | ||
| | Operation | Throughput | Latency (p50) | Latency (p99) | | ||
| |-----------|------------|---------------|---------------| | ||
| | Insert | 52,341 ops/sec | 0.019 ms | 0.045 ms | | ||
| | Search (k=10) | 11,234 ops/sec | 0.089 ms | 0.156 ms | | ||
| | Search (k=100) | 8,932 ops/sec | 0.112 ms | 0.203 ms | | ||
| | Delete | 45,678 ops/sec | 0.022 ms | 0.051 ms | | ||
| #### Instance Methods | ||
| **Memory Usage**: ~50 bytes per 128-dim vector (including index) | ||
| ##### insert(entry: VectorEntry): Promise<string> | ||
| ### Comparison with Alternatives | ||
| Inserts a vector into the database. | ||
| | Database | Insert (ops/sec) | Search (ops/sec) | Memory per Vector | | ||
| |----------|------------------|------------------|-------------------| | ||
| | **Ruvector** | **52,341** | **11,234** | **50 bytes** | | ||
| | Faiss (HNSW) | 38,200 | 9,800 | 68 bytes | | ||
| | Hnswlib | 41,500 | 10,200 | 62 bytes | | ||
| | Milvus | 28,900 | 7,600 | 95 bytes | | ||
| ```typescript | ||
| const id = await db.insert({ | ||
| id: 'optional-id', | ||
| vector: new Float32Array([1, 2, 3]) | ||
| }); | ||
| ``` | ||
| *Benchmarks measured with 100K vectors, 128 dimensions, k=10* | ||
| ##### insertBatch(entries: VectorEntry[]): Promise<string[]> | ||
| ## Platform Support | ||
| Inserts multiple vectors in a batch. | ||
| Automatically installs the correct native module for: | ||
| ```typescript | ||
| const ids = await db.insertBatch([ | ||
| { vector: new Float32Array([1, 2, 3]) }, | ||
| { vector: new Float32Array([4, 5, 6]) } | ||
| ]); | ||
| ``` | ||
| - **Linux**: x64, ARM64 (GNU libc) | ||
| - **macOS**: x64 (Intel), ARM64 (Apple Silicon) | ||
| - **Windows**: x64 (MSVC) | ||
| ##### search(query: SearchQuery): Promise<SearchResult[]> | ||
| Node.js 18+ required. | ||
| Searches for similar vectors. | ||
| ## Advanced Configuration | ||
| ```typescript | ||
| const results = await db.search({ | ||
| vector: new Float32Array([1, 2, 3]), | ||
| k: 10, | ||
| efSearch: 100 | ||
| ### HNSW Parameters | ||
| ```javascript | ||
| const db = new VectorDb({ | ||
| dimensions: 384, | ||
| maxElements: 1000000, | ||
| ef_construction: 200, // Higher = better recall, slower build | ||
| m: 16, // Higher = better recall, more memory | ||
| storagePath: './large-db.db' | ||
| }); | ||
| ``` | ||
| ##### delete(id: string): Promise<boolean> | ||
| ### Distance Metrics | ||
| Deletes a vector by ID. | ||
| ```typescript | ||
| const deleted = await db.delete('vector-id'); | ||
| ```javascript | ||
| const db = new VectorDb({ | ||
| dimensions: 128, | ||
| distanceMetric: 'cosine' // 'cosine', 'euclidean', or 'dot' | ||
| }); | ||
| ``` | ||
| ##### get(id: string): Promise<VectorEntry | null> | ||
| ### Persistence | ||
| Retrieves a vector by ID. | ||
| ```javascript | ||
| // Auto-save to disk | ||
| const db = new VectorDb({ | ||
| dimensions: 128, | ||
| storagePath: './persistent.db' | ||
| }); | ||
| ```typescript | ||
| const entry = await db.get('vector-id'); | ||
| // In-memory only | ||
| const db = new VectorDb({ | ||
| dimensions: 128 | ||
| // No storagePath = in-memory | ||
| }); | ||
| ``` | ||
| ##### len(): Promise<number> | ||
| ## Building from Source | ||
| Returns the number of vectors in the database. | ||
| ```bash | ||
| # Install Rust toolchain | ||
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | ||
| ```typescript | ||
| const count = await db.len(); | ||
| # Build native module | ||
| npm run build:napi | ||
| ``` | ||
| ##### isEmpty(): Promise<boolean> | ||
| Requires: | ||
| - Rust 1.77+ | ||
| - Node.js 18+ | ||
| - Cargo | ||
| Checks if the database is empty. | ||
| ## Use Cases | ||
| ```typescript | ||
| const empty = await db.isEmpty(); | ||
| ``` | ||
| - **Semantic Search** - Find similar documents, images, or embeddings | ||
| - **RAG Systems** - Retrieval-Augmented Generation for LLMs | ||
| - **Recommendation Engines** - Content and product recommendations | ||
| - **Duplicate Detection** - Find similar items in large datasets | ||
| - **Anomaly Detection** - Identify outliers in vector space | ||
| - **Image Similarity** - Visual search and image matching | ||
| ### Types | ||
| ## Examples | ||
| #### DistanceMetric | ||
| ### Semantic Text Search | ||
| ```typescript | ||
| enum DistanceMetric { | ||
| Euclidean = 'Euclidean', | ||
| Cosine = 'Cosine', | ||
| DotProduct = 'DotProduct', | ||
| Manhattan = 'Manhattan' | ||
| } | ||
| ``` | ||
| ```javascript | ||
| const { VectorDb } = require('ruvector-core'); | ||
| const openai = require('openai'); | ||
| #### DbOptions | ||
| const db = new VectorDb({ dimensions: 1536 }); // OpenAI ada-002 | ||
| ```typescript | ||
| interface DbOptions { | ||
| dimensions: number; | ||
| distanceMetric?: DistanceMetric; | ||
| storagePath?: string; | ||
| hnswConfig?: HnswConfig; | ||
| quantization?: QuantizationConfig; | ||
| async function indexDocuments(texts) { | ||
| for (const text of texts) { | ||
| const embedding = await openai.embeddings.create({ | ||
| model: 'text-embedding-ada-002', | ||
| input: text | ||
| }); | ||
| await db.insert({ | ||
| id: text.slice(0, 20), | ||
| vector: new Float32Array(embedding.data[0].embedding), | ||
| metadata: { text } | ||
| }); | ||
| } | ||
| } | ||
| ``` | ||
| #### HnswConfig | ||
| async function search(query) { | ||
| const embedding = await openai.embeddings.create({ | ||
| model: 'text-embedding-ada-002', | ||
| input: query | ||
| }); | ||
| ```typescript | ||
| interface HnswConfig { | ||
| m?: number; | ||
| efConstruction?: number; | ||
| efSearch?: number; | ||
| maxElements?: number; | ||
| return await db.search({ | ||
| vector: new Float32Array(embedding.data[0].embedding), | ||
| k: 5 | ||
| }); | ||
| } | ||
| ``` | ||
| #### QuantizationConfig | ||
| ### Image Similarity Search | ||
| ```typescript | ||
| interface QuantizationConfig { | ||
| type: 'none' | 'scalar' | 'product' | 'binary'; | ||
| subspaces?: number; | ||
| k?: number; | ||
| ```javascript | ||
| const { VectorDb } = require('ruvector-core'); | ||
| const clip = require('@xenova/transformers'); | ||
| const db = new VectorDb({ dimensions: 512 }); // CLIP embedding size | ||
| async function indexImages(imagePaths) { | ||
| const model = await clip.CLIPModel.from_pretrained('openai/clip-vit-base-patch32'); | ||
| for (const path of imagePaths) { | ||
| const embedding = await model.encode_image(path); | ||
| await db.insert({ | ||
| id: path, | ||
| vector: new Float32Array(embedding), | ||
| metadata: { path } | ||
| }); | ||
| } | ||
| } | ||
| ``` | ||
| ## Performance | ||
| ## Resources | ||
| rUvector delivers exceptional performance: | ||
| - 🏠 [Homepage](https://ruv.io) | ||
| - 📦 [GitHub Repository](https://github.com/ruvnet/ruvector) | ||
| - 📚 [Documentation](https://github.com/ruvnet/ruvector/tree/main/docs) | ||
| - 🐛 [Issue Tracker](https://github.com/ruvnet/ruvector/issues) | ||
| - 💬 [Discussions](https://github.com/ruvnet/ruvector/discussions) | ||
| - **150x faster** than pure JavaScript implementations | ||
| - **1M+ vectors/second** insertion rate | ||
| - **Sub-millisecond** search latency | ||
| - **4-32x memory reduction** with quantization | ||
| ## Contributing | ||
| ## Platform Support | ||
| Contributions are welcome! Please see [CONTRIBUTING.md](https://github.com/ruvnet/ruvector/blob/main/CONTRIBUTING.md) for guidelines. | ||
| | Platform | Architecture | Package | | ||
| |----------|-------------|---------| | ||
| | Linux | x64 | @ruvector/core-linux-x64-gnu | | ||
| | Linux | ARM64 | @ruvector/core-linux-arm64-gnu | | ||
| | macOS | x64 (Intel) | @ruvector/core-darwin-x64 | | ||
| | macOS | ARM64 (Apple Silicon) | @ruvector/core-darwin-arm64 | | ||
| | Windows | x64 | @ruvector/core-win32-x64-msvc | | ||
| ## License | ||
| MIT | ||
| MIT License - see [LICENSE](https://github.com/ruvnet/ruvector/blob/main/LICENSE) for details. | ||
| ## Links | ||
| --- | ||
| - [GitHub Repository](https://github.com/ruvnet/ruvector) | ||
| - [Documentation](https://github.com/ruvnet/ruvector#readme) | ||
| - [Issue Tracker](https://github.com/ruvnet/ruvector/issues) | ||
| Built with ❤️ by the [ruv.io](https://ruv.io) team |
-101
| "use strict"; | ||
| /** | ||
| * @ruvector/core - CommonJS wrapper | ||
| * | ||
| * This file provides CommonJS compatibility for projects using require() | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.DistanceMetric = void 0; | ||
| const node_os_1 = require("node:os"); | ||
| /** | ||
| * Distance metric for similarity calculation | ||
| */ | ||
| var DistanceMetric; | ||
| (function (DistanceMetric) { | ||
| /** Euclidean (L2) distance */ | ||
| DistanceMetric["Euclidean"] = "euclidean"; | ||
| /** Cosine similarity (1 - cosine distance) */ | ||
| DistanceMetric["Cosine"] = "cosine"; | ||
| /** Dot product similarity */ | ||
| DistanceMetric["DotProduct"] = "dot"; | ||
| })(DistanceMetric || (exports.DistanceMetric = DistanceMetric = {})); | ||
| /** | ||
| * Get platform-specific package name | ||
| */ | ||
| function getPlatformPackage() { | ||
| const plat = (0, node_os_1.platform)(); | ||
| const architecture = (0, node_os_1.arch)(); | ||
| // Map Node.js platform names to package names | ||
| const packageMap = { | ||
| 'linux-x64': 'ruvector-core-linux-x64-gnu', | ||
| 'linux-arm64': 'ruvector-core-linux-arm64-gnu', | ||
| 'darwin-x64': 'ruvector-core-darwin-x64', | ||
| 'darwin-arm64': 'ruvector-core-darwin-arm64', | ||
| 'win32-x64': 'ruvector-core-win32-x64-msvc', | ||
| }; | ||
| const key = `${plat}-${architecture}`; | ||
| const packageName = packageMap[key]; | ||
| if (!packageName) { | ||
| throw new Error(`Unsupported platform: ${plat}-${architecture}. ` + | ||
| `Supported platforms: ${Object.keys(packageMap).join(', ')}`); | ||
| } | ||
| return packageName; | ||
| } | ||
| /** | ||
| * Load the native binding for the current platform | ||
| */ | ||
| function loadNativeBinding() { | ||
| const packageName = getPlatformPackage(); | ||
| try { | ||
| // Try to require the platform-specific package | ||
| return require(packageName); | ||
| } | ||
| catch (error) { | ||
| // Fallback: try loading from local platforms directory | ||
| try { | ||
| const plat = (0, node_os_1.platform)(); | ||
| const architecture = (0, node_os_1.arch)(); | ||
| const platformKey = `${plat}-${architecture}`; | ||
| const platformMap = { | ||
| 'linux-x64': 'linux-x64-gnu', | ||
| 'linux-arm64': 'linux-arm64-gnu', | ||
| 'darwin-x64': 'darwin-x64', | ||
| 'darwin-arm64': 'darwin-arm64', | ||
| 'win32-x64': 'win32-x64-msvc', | ||
| }; | ||
| const localPath = `../platforms/${platformMap[platformKey]}/ruvector.node`; | ||
| return require(localPath); | ||
| } | ||
| catch (fallbackError) { | ||
| throw new Error(`Failed to load native binding: ${error.message}\n` + | ||
| `Fallback also failed: ${fallbackError.message}\n` + | ||
| `Platform: ${(0, node_os_1.platform)()}-${(0, node_os_1.arch)()}\n` + | ||
| `Expected package: ${packageName}`); | ||
| } | ||
| } | ||
| } | ||
| // 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; | ||
| } | ||
| //# sourceMappingURL=index.cjs.js.map |
| /** | ||
| * @ruvector/core - CommonJS wrapper | ||
| * | ||
| * This file provides CommonJS compatibility for projects using require() | ||
| */ | ||
| /** | ||
| * Distance metric for similarity calculation | ||
| */ | ||
| export declare enum DistanceMetric { | ||
| /** Euclidean (L2) distance */ | ||
| Euclidean = "euclidean", | ||
| /** Cosine similarity (1 - cosine distance) */ | ||
| Cosine = "cosine", | ||
| /** Dot product similarity */ | ||
| DotProduct = "dot" | ||
| } | ||
| //# sourceMappingURL=index.cjs.d.ts.map |
| {"version":3,"file":"index.cjs.d.ts","sourceRoot":"","sources":["../src/index.cjs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH;;GAEG;AACH,oBAAY,cAAc;IACxB,8BAA8B;IAC9B,SAAS,cAAc;IACvB,8CAA8C;IAC9C,MAAM,WAAW;IACjB,6BAA6B;IAC7B,UAAU,QAAQ;CACnB"} |
| /** | ||
| * @ruvector/core - CommonJS wrapper | ||
| * | ||
| * This file provides CommonJS compatibility for projects using require() | ||
| */ | ||
| import { platform, arch } from 'node:os'; | ||
| /** | ||
| * Distance metric for similarity calculation | ||
| */ | ||
| export var DistanceMetric; | ||
| (function (DistanceMetric) { | ||
| /** Euclidean (L2) distance */ | ||
| DistanceMetric["Euclidean"] = "euclidean"; | ||
| /** Cosine similarity (1 - cosine distance) */ | ||
| DistanceMetric["Cosine"] = "cosine"; | ||
| /** Dot product similarity */ | ||
| DistanceMetric["DotProduct"] = "dot"; | ||
| })(DistanceMetric || (DistanceMetric = {})); | ||
| /** | ||
| * Get platform-specific package name | ||
| */ | ||
| function getPlatformPackage() { | ||
| const plat = platform(); | ||
| const architecture = arch(); | ||
| // Map Node.js platform names to package names | ||
| const packageMap = { | ||
| 'linux-x64': 'ruvector-core-linux-x64-gnu', | ||
| 'linux-arm64': 'ruvector-core-linux-arm64-gnu', | ||
| 'darwin-x64': 'ruvector-core-darwin-x64', | ||
| 'darwin-arm64': 'ruvector-core-darwin-arm64', | ||
| 'win32-x64': 'ruvector-core-win32-x64-msvc', | ||
| }; | ||
| const key = `${plat}-${architecture}`; | ||
| const packageName = packageMap[key]; | ||
| if (!packageName) { | ||
| throw new Error(`Unsupported platform: ${plat}-${architecture}. ` + | ||
| `Supported platforms: ${Object.keys(packageMap).join(', ')}`); | ||
| } | ||
| return packageName; | ||
| } | ||
| /** | ||
| * Load the native binding for the current platform | ||
| */ | ||
| function loadNativeBinding() { | ||
| const packageName = getPlatformPackage(); | ||
| try { | ||
| // Try to require the platform-specific package | ||
| return require(packageName); | ||
| } | ||
| catch (error) { | ||
| // Fallback: try loading from local platforms directory | ||
| try { | ||
| const plat = platform(); | ||
| const architecture = arch(); | ||
| const platformKey = `${plat}-${architecture}`; | ||
| const platformMap = { | ||
| 'linux-x64': 'linux-x64-gnu', | ||
| 'linux-arm64': 'linux-arm64-gnu', | ||
| 'darwin-x64': 'darwin-x64', | ||
| 'darwin-arm64': 'darwin-arm64', | ||
| 'win32-x64': 'win32-x64-msvc', | ||
| }; | ||
| const localPath = `../platforms/${platformMap[platformKey]}/ruvector.node`; | ||
| return require(localPath); | ||
| } | ||
| catch (fallbackError) { | ||
| throw new Error(`Failed to load native binding: ${error.message}\n` + | ||
| `Fallback also failed: ${fallbackError.message}\n` + | ||
| `Platform: ${platform()}-${arch()}\n` + | ||
| `Expected package: ${packageName}`); | ||
| } | ||
| } | ||
| } | ||
| // 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; | ||
| } | ||
| //# sourceMappingURL=index.cjs.js.map |
| {"version":3,"file":"index.cjs.js","sourceRoot":"","sources":["../src/index.cjs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAMzC;;GAEG;AACH,MAAM,CAAN,IAAY,cAOX;AAPD,WAAY,cAAc;IACxB,8BAA8B;IAC9B,yCAAuB,CAAA;IACvB,8CAA8C;IAC9C,mCAAiB,CAAA;IACjB,6BAA6B;IAC7B,oCAAkB,CAAA;AACpB,CAAC,EAPW,cAAc,KAAd,cAAc,QAOzB;AAED;;GAEG;AACH,SAAS,kBAAkB;IACzB,MAAM,IAAI,GAAG,QAAQ,EAAc,CAAC;IACpC,MAAM,YAAY,GAAG,IAAI,EAAkB,CAAC;IAE5C,8CAA8C;IAC9C,MAAM,UAAU,GAA2B;QACzC,WAAW,EAAE,6BAA6B;QAC1C,aAAa,EAAE,+BAA+B;QAC9C,YAAY,EAAE,0BAA0B;QACxC,cAAc,EAAE,4BAA4B;QAC5C,WAAW,EAAE,8BAA8B;KAC5C,CAAC;IAEF,MAAM,GAAG,GAAG,GAAG,IAAI,IAAI,YAAY,EAAE,CAAC;IACtC,MAAM,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAEpC,IAA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,wCAAwC;AACxC,IAAI,SAAS,GAAG,IAAI,CAAC;AACrB,IAAI,CAAC;IACH,SAAS,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAC7C,CAAC;AAAC,MAAM,CAAC;IACP,oDAAoD;AACtD,CAAC;AAED,4CAA4C;AAC5C,MAAM,CAAC,OAAO,GAAG,aAAa,CAAC;AAE/B,kDAAkD;AAClD,IAAI,aAAa,CAAC,QAAQ,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;IACtD,MAAM,CAAC,OAAO,CAAC,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;AACnD,CAAC;AAED,yBAAyB;AACzB,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,aAAa,CAAC;AAEvC,2BAA2B;AAC3B,MAAM,CAAC,OAAO,CAAC,cAAc,GAAG,cAAc,CAAC;AAE/C,gCAAgC;AAChC,IAAI,SAAS,EAAE,CAAC;IACd,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;AACvC,CAAC"} |
-273
| /** | ||
| * @ruvector/core - High-performance Rust vector database for Node.js | ||
| * | ||
| * Automatically detects platform and loads the appropriate native binding. | ||
| */ | ||
| /** | ||
| * Distance metric for similarity calculation | ||
| */ | ||
| export declare enum DistanceMetric { | ||
| /** Euclidean (L2) distance */ | ||
| Euclidean = "Euclidean", | ||
| /** Cosine similarity (converted to distance) */ | ||
| Cosine = "Cosine", | ||
| /** Dot product (converted to distance for maximization) */ | ||
| DotProduct = "DotProduct", | ||
| /** Manhattan (L1) distance */ | ||
| Manhattan = "Manhattan" | ||
| } | ||
| /** | ||
| * Quantization configuration | ||
| */ | ||
| export interface QuantizationConfig { | ||
| /** Quantization type */ | ||
| type: 'none' | 'scalar' | 'product' | 'binary'; | ||
| /** Number of subspaces (for product quantization) */ | ||
| subspaces?: number; | ||
| /** Codebook size (for product quantization) */ | ||
| k?: number; | ||
| } | ||
| /** | ||
| * HNSW index configuration | ||
| */ | ||
| export interface HnswConfig { | ||
| /** Number of connections per layer (M) */ | ||
| m?: number; | ||
| /** Size of dynamic candidate list during construction */ | ||
| efConstruction?: number; | ||
| /** Size of dynamic candidate list during search */ | ||
| efSearch?: number; | ||
| /** Maximum number of elements */ | ||
| maxElements?: number; | ||
| } | ||
| /** | ||
| * Database configuration options | ||
| */ | ||
| export interface DbOptions { | ||
| /** Vector dimensions */ | ||
| dimensions: number; | ||
| /** Distance metric */ | ||
| distanceMetric?: DistanceMetric; | ||
| /** Storage path */ | ||
| storagePath?: string; | ||
| /** HNSW configuration */ | ||
| hnswConfig?: HnswConfig; | ||
| /** Quantization configuration */ | ||
| quantization?: QuantizationConfig; | ||
| } | ||
| /** | ||
| * Vector entry | ||
| */ | ||
| export interface VectorEntry { | ||
| /** Optional ID (auto-generated if not provided) */ | ||
| id?: string; | ||
| /** Vector data as Float32Array or array of numbers */ | ||
| vector: Float32Array | number[]; | ||
| } | ||
| /** | ||
| * Search query parameters | ||
| */ | ||
| export interface SearchQuery { | ||
| /** Query vector as Float32Array or array of numbers */ | ||
| vector: Float32Array | number[]; | ||
| /** Number of results to return (top-k) */ | ||
| k: number; | ||
| /** Optional ef_search parameter for HNSW */ | ||
| efSearch?: number; | ||
| } | ||
| /** | ||
| * Search result with similarity score | ||
| */ | ||
| export interface SearchResult { | ||
| /** Vector ID */ | ||
| id: string; | ||
| /** Distance/similarity score (lower is better for distance metrics) */ | ||
| score: number; | ||
| } | ||
| /** | ||
| * High-performance vector database with HNSW indexing | ||
| */ | ||
| export interface VectorDB { | ||
| /** | ||
| * Insert a vector entry into the database | ||
| * @param entry Vector entry to insert | ||
| * @returns Promise resolving to the ID of the inserted vector | ||
| */ | ||
| insert(entry: VectorEntry): Promise<string>; | ||
| /** | ||
| * Insert multiple vectors in a batch | ||
| * @param entries Array of vector entries to insert | ||
| * @returns Promise resolving to an array of IDs for the inserted vectors | ||
| */ | ||
| insertBatch(entries: VectorEntry[]): Promise<string[]>; | ||
| /** | ||
| * Search for similar vectors | ||
| * @param query Search query parameters | ||
| * @returns Promise resolving to an array of search results sorted by similarity | ||
| */ | ||
| search(query: SearchQuery): Promise<SearchResult[]>; | ||
| /** | ||
| * Delete a vector by ID | ||
| * @param id Vector ID to delete | ||
| * @returns Promise resolving to true if deleted, false if not found | ||
| */ | ||
| delete(id: string): Promise<boolean>; | ||
| /** | ||
| * Get a vector by ID | ||
| * @param id Vector ID to retrieve | ||
| * @returns Promise resolving to the vector entry if found, null otherwise | ||
| */ | ||
| get(id: string): Promise<VectorEntry | null>; | ||
| /** | ||
| * Get the number of vectors in the database | ||
| * @returns Promise resolving to the number of vectors | ||
| */ | ||
| len(): Promise<number>; | ||
| /** | ||
| * Check if the database is empty | ||
| * @returns Promise resolving to true if empty, false otherwise | ||
| */ | ||
| isEmpty(): Promise<boolean>; | ||
| } | ||
| /** | ||
| * VectorDB constructor interface | ||
| */ | ||
| export interface VectorDBConstructor { | ||
| new (options: DbOptions): VectorDB; | ||
| withDimensions(dimensions: number): VectorDB; | ||
| } | ||
| /** | ||
| * Filter for metadata-based search | ||
| */ | ||
| export interface Filter { | ||
| /** Field name to filter on */ | ||
| field: string; | ||
| /** Operator: "eq", "ne", "gt", "gte", "lt", "lte", "in", "match" */ | ||
| operator: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'match'; | ||
| /** Value to compare against (JSON string) */ | ||
| value: string; | ||
| } | ||
| /** | ||
| * Collection configuration | ||
| */ | ||
| export interface CollectionConfig { | ||
| /** Vector dimensions */ | ||
| dimensions: number; | ||
| /** Distance metric */ | ||
| distanceMetric?: DistanceMetric; | ||
| /** HNSW configuration */ | ||
| hnswConfig?: HnswConfig; | ||
| /** Quantization configuration */ | ||
| quantization?: QuantizationConfig; | ||
| } | ||
| /** | ||
| * Collection statistics | ||
| */ | ||
| export interface CollectionStats { | ||
| /** Number of vectors in the collection */ | ||
| vectorsCount: number; | ||
| /** Disk space used in bytes */ | ||
| diskSizeBytes: number; | ||
| /** RAM space used in bytes */ | ||
| ramSizeBytes: number; | ||
| } | ||
| /** | ||
| * Collection alias | ||
| */ | ||
| export interface Alias { | ||
| /** Alias name */ | ||
| alias: string; | ||
| /** Collection name */ | ||
| collection: string; | ||
| } | ||
| /** | ||
| * Health response | ||
| */ | ||
| export interface HealthResponse { | ||
| /** Status: "healthy", "degraded", or "unhealthy" */ | ||
| status: 'healthy' | 'degraded' | 'unhealthy'; | ||
| /** Version string */ | ||
| version: string; | ||
| /** Uptime in seconds */ | ||
| uptimeSeconds: number; | ||
| } | ||
| /** | ||
| * Collection manager for multi-collection support | ||
| */ | ||
| export interface CollectionManager { | ||
| /** | ||
| * Create a new collection | ||
| * @param name Collection name | ||
| * @param config Collection configuration | ||
| */ | ||
| createCollection(name: string, config: CollectionConfig): Promise<void>; | ||
| /** | ||
| * List all collections | ||
| * @returns Array of collection names | ||
| */ | ||
| listCollections(): Promise<string[]>; | ||
| /** | ||
| * Delete a collection | ||
| * @param name Collection name to delete | ||
| */ | ||
| deleteCollection(name: string): Promise<void>; | ||
| /** | ||
| * Get collection statistics | ||
| * @param name Collection name | ||
| * @returns Collection statistics | ||
| */ | ||
| getStats(name: string): Promise<CollectionStats>; | ||
| /** | ||
| * Create an alias for a collection | ||
| * @param alias Alias name | ||
| * @param collection Collection name | ||
| */ | ||
| createAlias(alias: string, collection: string): Promise<void>; | ||
| /** | ||
| * Delete an alias | ||
| * @param alias Alias name to delete | ||
| */ | ||
| deleteAlias(alias: string): Promise<void>; | ||
| /** | ||
| * List all aliases | ||
| * @returns Array of alias mappings | ||
| */ | ||
| listAliases(): Promise<Alias[]>; | ||
| } | ||
| /** | ||
| * CollectionManager constructor interface | ||
| */ | ||
| export interface CollectionManagerConstructor { | ||
| new (basePath?: string): CollectionManager; | ||
| } | ||
| /** | ||
| * Native binding interface | ||
| */ | ||
| export interface NativeBinding { | ||
| VectorDB: VectorDBConstructor; | ||
| CollectionManager: CollectionManagerConstructor; | ||
| version(): string; | ||
| hello(): string; | ||
| getMetrics(): string; | ||
| getHealth(): HealthResponse; | ||
| } | ||
| export declare const VectorDB: any; | ||
| export declare const CollectionManager: CollectionManagerConstructor; | ||
| export declare const version: () => string; | ||
| export declare const hello: () => string; | ||
| export declare const getMetrics: () => string; | ||
| export declare const getHealth: () => HealthResponse; | ||
| declare let attention: any; | ||
| export { attention }; | ||
| declare const _default: { | ||
| attention?: any; | ||
| VectorDB: any; | ||
| CollectionManager: CollectionManagerConstructor; | ||
| version: () => string; | ||
| hello: () => string; | ||
| getMetrics: () => string; | ||
| getHealth: () => HealthResponse; | ||
| DistanceMetric: typeof DistanceMetric; | ||
| }; | ||
| export default _default; | ||
| //# sourceMappingURL=index.d.ts.map |
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH;;GAEG;AACH,oBAAY,cAAc;IACxB,8BAA8B;IAC9B,SAAS,cAAc;IACvB,gDAAgD;IAChD,MAAM,WAAW;IACjB,2DAA2D;IAC3D,UAAU,eAAe;IACzB,8BAA8B;IAC9B,SAAS,cAAc;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,wBAAwB;IACxB,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC/C,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,0CAA0C;IAC1C,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,yDAAyD;IACzD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,wBAAwB;IACxB,UAAU,EAAE,MAAM,CAAC;I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QAlFP,MAkFkC,CAAC;AACnD,eAAO,MAAM,SAAS,QAlFP,cAkFiC,CAAC;AAGjD,QAAA,IAAI,SAAS,EAAE,GAAU,CAAC;AAQ1B,OAAO,EAAE,SAAS,EAAE,CAAC;;;;;mBAhGR,MAAM;iBACR,MAAM;sBACD,MAAM;qBACP,cAAc;;;AAgG7B,wBAUE"} |
-115
| /** | ||
| * @ruvector/core - High-performance Rust vector database for Node.js | ||
| * | ||
| * Automatically detects platform and loads the appropriate native binding. | ||
| */ | ||
| import { platform, arch } from 'node:os'; | ||
| import { createRequire } from 'node:module'; | ||
| const require = createRequire(import.meta.url); | ||
| /** | ||
| * Distance metric for similarity calculation | ||
| */ | ||
| export var DistanceMetric; | ||
| (function (DistanceMetric) { | ||
| /** Euclidean (L2) distance */ | ||
| DistanceMetric["Euclidean"] = "Euclidean"; | ||
| /** Cosine similarity (converted to distance) */ | ||
| DistanceMetric["Cosine"] = "Cosine"; | ||
| /** Dot product (converted to distance for maximization) */ | ||
| DistanceMetric["DotProduct"] = "DotProduct"; | ||
| /** Manhattan (L1) distance */ | ||
| DistanceMetric["Manhattan"] = "Manhattan"; | ||
| })(DistanceMetric || (DistanceMetric = {})); | ||
| /** | ||
| * Detect the current platform and architecture | ||
| */ | ||
| function detectPlatform() { | ||
| const currentPlatform = platform(); | ||
| const currentArch = arch(); | ||
| // Map platform and architecture to package names | ||
| const platformMap = { | ||
| 'linux-x64': '@ruvector/core-linux-x64-gnu', | ||
| 'linux-arm64': '@ruvector/core-linux-arm64-gnu', | ||
| 'darwin-x64': '@ruvector/core-darwin-x64', | ||
| 'darwin-arm64': '@ruvector/core-darwin-arm64', | ||
| 'win32-x64': '@ruvector/core-win32-x64-msvc' | ||
| }; | ||
| const key = `${currentPlatform}-${currentArch}`; | ||
| const packageName = platformMap[key]; | ||
| if (!packageName) { | ||
| throw new Error(`Unsupported platform: ${currentPlatform}-${currentArch}. ` + | ||
| `Supported platforms: ${Object.keys(platformMap).join(', ')}`); | ||
| } | ||
| return { platform: currentPlatform, arch: currentArch, packageName }; | ||
| } | ||
| /** | ||
| * Load the native binding for the current platform | ||
| */ | ||
| function loadNativeBinding() { | ||
| const currentPlatform = platform(); | ||
| const currentArch = arch(); | ||
| const platformKey = `${currentPlatform}-${currentArch}`; | ||
| try { | ||
| // Try to load from native directory first (for direct builds) | ||
| // Use the wrapper index.cjs if it exists, otherwise load the .node file directly | ||
| try { | ||
| const nativeBinding = require(`../native/${platformKey}/index.cjs`); | ||
| return nativeBinding; | ||
| } | ||
| catch { | ||
| const nativeBinding = require(`../native/${platformKey}/ruvector.node`); | ||
| return nativeBinding; | ||
| } | ||
| } | ||
| catch (error) { | ||
| // Fallback to platform-specific packages | ||
| const { packageName } = detectPlatform(); | ||
| try { | ||
| const nativeBinding = require(packageName); | ||
| return nativeBinding; | ||
| } | ||
| catch (packageError) { | ||
| // Provide helpful error message | ||
| const err = packageError; | ||
| if (err.code === 'MODULE_NOT_FOUND') { | ||
| throw new Error(`Failed to load native binding for ${platformKey}. ` + | ||
| `Tried: ../native/${platformKey}/ruvector.node and ${packageName}. ` + | ||
| `Please ensure the package is installed by running: npm install ${packageName}`); | ||
| } | ||
| throw new Error(`Failed to load native binding: ${err.message}`); | ||
| } | ||
| } | ||
| } | ||
| // Load the native binding | ||
| const nativeBinding = loadNativeBinding(); | ||
| // Re-export the VectorDB class and utility functions | ||
| // Note: NAPI-RS exports as VectorDb (lowercase d), we re-export as VectorDB for consistency | ||
| export const VectorDB = nativeBinding.VectorDb || nativeBinding.VectorDB; | ||
| export const CollectionManager = nativeBinding.CollectionManager; | ||
| export const version = nativeBinding.version; | ||
| export const hello = nativeBinding.hello; | ||
| export const getMetrics = nativeBinding.getMetrics; | ||
| export const getHealth = nativeBinding.getHealth; | ||
| // Try to load optional attention module | ||
| let attention = 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, | ||
| CollectionManager, | ||
| version, | ||
| hello, | ||
| getMetrics, | ||
| getHealth, | ||
| DistanceMetric, | ||
| // Include attention if available | ||
| ...(attention ? { attention } : {}) | ||
| }; | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAM/C;;GAEG;AACH,MAAM,CAAN,IAAY,cASX;AATD,WAAY,cAAc;IACxB,8BAA8B;IAC9B,yCAAuB,CAAA;IACvB,gDAAgD;IAChD,mCAAiB,CAAA;IACjB,2DAA2D;IAC3D,2CAAyB,CAAA;IACzB,8BAA8B;IAC9B,yCAAuB,CAAA;AACzB,CAAC,EATW,cAAc,KAAd,cAAc,QASzB;AAyQD;;GAEG;AACH,SAAS,cAAc;IACrB,MAAM,eAAe,GAAG,QAAQ,EAAc,CAAC;IAC/C,MAAM,WAAW,GAAG,IAAI,EAAkB,CAAC;IAE3C,iDAAiD;IACjD,MAAM,WAAW,GAA2B;QAC1C,WAAW,EAAE,8BAA8B;QAC3C,aAAa,EAAE,gCAAgC;QAC/C,YAAY,EAAE,2BAA2B;QACzC,cAAc,EAAE,6BAA6B;QAC7C,WAAW,EAAE,+BAA+B;KAC7C,CAAC;IAEF,MAAM,GAAG,GAAG,GAAG,eAAe,IAAI,WAAW,EAAE,CAAC;IAChD,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAErC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,yBAAyB,eAAe,IAAI,WAAW,IAAI;YAC3D,wBAAwB,MAAM,CAAC,I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AC;IACH,CAAC;AACH,CAAC;AAED,0BAA0B;AAC1B,MAAM,aAAa,GAAG,iBAAiB,EAAE,CAAC;AAE1C,qDAAqD;AACrD,4FAA4F;AAC5F,MAAM,CAAC,MAAM,QAAQ,GAAI,aAAqB,CAAC,QAAQ,IAAI,aAAa,CAAC,QAAQ,CAAC;AAClF,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC,iBAAiB,CAAC;AACjE,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;AAC7C,MAAM,CAAC,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC;AACzC,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC,UAAU,CAAC;AACnD,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC;AAEjD,wCAAwC;AACxC,IAAI,SAAS,GAAQ,IAAI,CAAC;AAC1B,IAAI,CAAC;IACH,SAAS,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAC7C,CAAC;AAAC,MAAM,CAAC;IACP,oDAAoD;AACtD,CAAC;AAED,gCAAgC;AAChC,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,iBAAiB;AACjB,eAAe;IACb,QAAQ;IACR,iBAAiB;IACjB,OAAO;IACP,KAAK;IACL,UAAU;IACV,SAAS;IACT,cAAc;IACd,iCAAiC;IACjC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;CACpC,CAAC"} |
-21
| MIT License | ||
| Copyright (c) 2024 rUv | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
| /** | ||
| * Native binding wrapper for linux-x64 | ||
| */ | ||
| const nativeBinding = require('./ruvector.node'); | ||
| // The native module exports VectorDb (lowercase 'b') but we want VectorDB | ||
| // Also need to add the withDimensions static method since it's not exported properly | ||
| class VectorDB { | ||
| constructor(options) { | ||
| // Create internal instance | ||
| this._db = new nativeBinding.VectorDb(options); | ||
| } | ||
| static withDimensions(dimensions) { | ||
| // Factory method - create with default options | ||
| return new VectorDB({ | ||
| dimensions: dimensions, | ||
| distanceMetric: 'Cosine', | ||
| storagePath: './ruvector.db' | ||
| }); | ||
| } | ||
| async insert(entry) { | ||
| return this._db.insert(entry); | ||
| } | ||
| async insertBatch(entries) { | ||
| return this._db.insertBatch(entries); | ||
| } | ||
| async search(query) { | ||
| return this._db.search(query); | ||
| } | ||
| async delete(id) { | ||
| return this._db.delete(id); | ||
| } | ||
| async get(id) { | ||
| return this._db.get(id); | ||
| } | ||
| async len() { | ||
| return this._db.len(); | ||
| } | ||
| async isEmpty() { | ||
| return this._db.isEmpty(); | ||
| } | ||
| } | ||
| module.exports = { | ||
| VectorDB, | ||
| CollectionManager: nativeBinding.CollectionManager, | ||
| version: nativeBinding.version, | ||
| hello: nativeBinding.hello, | ||
| getMetrics: nativeBinding.getMetrics, | ||
| getHealth: nativeBinding.getHealth, | ||
| DistanceMetric: nativeBinding.JsDistanceMetric | ||
| }; |
Sorry, the diff of this file is not supported yet
| const { join } = require('path'); | ||
| let nativeBinding; | ||
| try { | ||
| nativeBinding = require('./ruvector.node'); | ||
| } catch (error) { | ||
| throw new Error( | ||
| 'Failed to load native binding for darwin-arm64. ' + | ||
| 'This package may have been installed incorrectly. ' + | ||
| 'Error: ' + error.message | ||
| ); | ||
| } | ||
| module.exports = nativeBinding; |
| { | ||
| "name": "ruvector-core-darwin-arm64", | ||
| "version": "0.1.17", | ||
| "description": "macOS ARM64 (Apple Silicon M1/M2/M3) native binding for ruvector-core - High-performance vector database with HNSW indexing built in Rust", | ||
| "main": "index.js", | ||
| "type": "commonjs", | ||
| "os": ["darwin"], | ||
| "cpu": ["arm64"], | ||
| "author": "ruv.io Team <info@ruv.io> (https://ruv.io)", | ||
| "homepage": "https://ruv.io", | ||
| "engines": { | ||
| "node": ">= 18" | ||
| }, | ||
| "files": [ | ||
| "index.js", | ||
| "ruvector.node", | ||
| "*.node", | ||
| "README.md" | ||
| ], | ||
| "keywords": [ | ||
| "ruvector", | ||
| "vector-database", | ||
| "vector-search", | ||
| "similarity-search", | ||
| "semantic-search", | ||
| "hnsw", | ||
| "native", | ||
| "napi", | ||
| "rust", | ||
| "macos", | ||
| "darwin", | ||
| "arm64", | ||
| "apple-silicon", | ||
| "m1", | ||
| "m2", | ||
| "m3", | ||
| "ai", | ||
| "machine-learning", | ||
| "embedding-database", | ||
| "simd", | ||
| "performance", | ||
| "ruv" | ||
| ], | ||
| "license": "MIT", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/ruvnet/ruvector.git", | ||
| "directory": "npm/core/platforms/darwin-arm64" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/ruvnet/ruvector/issues" | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public" | ||
| } | ||
| } |
| # @ruvector/core-darwin-arm64 | ||
| Native macOS ARM64 bindings for @ruvector/core. | ||
| This package contains the native Node.js addon for macOS (Apple Silicon) systems. | ||
| ## Installation | ||
| This package is automatically installed as an optional dependency of `@ruvector/core` when running on macOS ARM64 systems. | ||
| ```bash | ||
| npm install @ruvector/core | ||
| ``` | ||
| ## Direct Installation | ||
| You can also install this package directly: | ||
| ```bash | ||
| npm install @ruvector/core-darwin-arm64 | ||
| ``` | ||
| ## Usage | ||
| ```javascript | ||
| const { VectorDb } = require('@ruvector/core-darwin-arm64'); | ||
| const db = new VectorDb({ | ||
| dimensions: 128, | ||
| storagePath: './vectors.db' | ||
| }); | ||
| // Insert vectors | ||
| await db.insert({ | ||
| id: 'vec1', | ||
| vector: new Float32Array([...]) | ||
| }); | ||
| // Search | ||
| const results = await db.search({ | ||
| vector: new Float32Array([...]), | ||
| k: 10 | ||
| }); | ||
| ``` | ||
| ## Requirements | ||
| - Node.js >= 18 | ||
| - macOS (Apple Silicon - M1, M2, M3, etc.) | ||
| ## License | ||
| MIT |
Sorry, the diff of this file is not supported yet
| const { join } = require('path'); | ||
| let nativeBinding; | ||
| try { | ||
| nativeBinding = require('./ruvector.node'); | ||
| } catch (error) { | ||
| throw new Error( | ||
| 'Failed to load native binding for darwin-x64. ' + | ||
| 'This package may have been installed incorrectly. ' + | ||
| 'Error: ' + error.message | ||
| ); | ||
| } | ||
| module.exports = nativeBinding; |
| { | ||
| "name": "ruvector-core-darwin-x64", | ||
| "version": "0.1.17", | ||
| "description": "macOS x64 (Intel) native binding for ruvector-core - High-performance vector database with HNSW indexing built in Rust", | ||
| "main": "index.js", | ||
| "type": "commonjs", | ||
| "os": ["darwin"], | ||
| "cpu": ["x64"], | ||
| "author": "ruv.io Team <info@ruv.io> (https://ruv.io)", | ||
| "homepage": "https://ruv.io", | ||
| "engines": { | ||
| "node": ">= 18" | ||
| }, | ||
| "files": [ | ||
| "index.js", | ||
| "ruvector.node", | ||
| "*.node", | ||
| "README.md" | ||
| ], | ||
| "keywords": [ | ||
| "ruvector", | ||
| "vector-database", | ||
| "vector-search", | ||
| "similarity-search", | ||
| "semantic-search", | ||
| "hnsw", | ||
| "native", | ||
| "napi", | ||
| "rust", | ||
| "macos", | ||
| "darwin", | ||
| "x64", | ||
| "intel", | ||
| "ai", | ||
| "machine-learning", | ||
| "embedding-database", | ||
| "simd", | ||
| "performance", | ||
| "ruv" | ||
| ], | ||
| "license": "MIT", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/ruvnet/ruvector.git", | ||
| "directory": "npm/core/platforms/darwin-x64" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/ruvnet/ruvector/issues" | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public" | ||
| } | ||
| } |
| # @ruvector/core-darwin-x64 | ||
| Native macOS x64 bindings for @ruvector/core. | ||
| This package contains the native Node.js addon for macOS (Intel) systems. | ||
| ## Installation | ||
| This package is automatically installed as an optional dependency of `@ruvector/core` when running on macOS x64 systems. | ||
| ```bash | ||
| npm install @ruvector/core | ||
| ``` | ||
| ## Direct Installation | ||
| You can also install this package directly: | ||
| ```bash | ||
| npm install @ruvector/core-darwin-x64 | ||
| ``` | ||
| ## Usage | ||
| ```javascript | ||
| const { VectorDb } = require('@ruvector/core-darwin-x64'); | ||
| const db = new VectorDb({ | ||
| dimensions: 128, | ||
| storagePath: './vectors.db' | ||
| }); | ||
| // Insert vectors | ||
| await db.insert({ | ||
| id: 'vec1', | ||
| vector: new Float32Array([...]) | ||
| }); | ||
| // Search | ||
| const results = await db.search({ | ||
| vector: new Float32Array([...]), | ||
| k: 10 | ||
| }); | ||
| ``` | ||
| ## Requirements | ||
| - Node.js >= 18 | ||
| - macOS (Intel processors) | ||
| ## License | ||
| MIT |
Sorry, the diff of this file is not supported yet
| const { join } = require('path'); | ||
| let nativeBinding; | ||
| try { | ||
| nativeBinding = require('./ruvector.node'); | ||
| } catch (error) { | ||
| throw new Error( | ||
| 'Failed to load native binding for linux-arm64-gnu. ' + | ||
| 'This package may have been installed incorrectly. ' + | ||
| 'Error: ' + error.message | ||
| ); | ||
| } | ||
| module.exports = nativeBinding; |
| { | ||
| "name": "ruvector-core-linux-arm64-gnu", | ||
| "version": "0.1.17", | ||
| "description": "Linux ARM64 GNU native binding for ruvector-core - High-performance vector database with HNSW indexing built in Rust", | ||
| "main": "index.js", | ||
| "type": "commonjs", | ||
| "os": ["linux"], | ||
| "cpu": ["arm64"], | ||
| "author": "ruv.io Team <info@ruv.io> (https://ruv.io)", | ||
| "homepage": "https://ruv.io", | ||
| "engines": { | ||
| "node": ">= 18" | ||
| }, | ||
| "files": [ | ||
| "index.js", | ||
| "ruvector.node", | ||
| "*.node", | ||
| "README.md" | ||
| ], | ||
| "keywords": [ | ||
| "ruvector", | ||
| "vector-database", | ||
| "vector-search", | ||
| "similarity-search", | ||
| "semantic-search", | ||
| "hnsw", | ||
| "native", | ||
| "napi", | ||
| "rust", | ||
| "linux", | ||
| "arm64", | ||
| "aarch64", | ||
| "gnu", | ||
| "glibc", | ||
| "ai", | ||
| "machine-learning", | ||
| "embedding-database", | ||
| "simd", | ||
| "performance", | ||
| "ruv" | ||
| ], | ||
| "license": "MIT", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/ruvnet/ruvector.git", | ||
| "directory": "npm/core/platforms/linux-arm64-gnu" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/ruvnet/ruvector/issues" | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public" | ||
| } | ||
| } |
| # ruvector-core-linux-arm64-gnu | ||
| [](https://www.npmjs.com/package/ruvector-core-linux-arm64-gnu) | ||
| [](https://opensource.org/licenses/MIT) | ||
| **Linux ARM64 GNU native binding for ruvector-core** | ||
| This package contains the native Node.js binding (`.node` file) for Linux ARM64 systems with GNU libc. It is automatically installed as an optional dependency when you install `ruvector-core` on a compatible system. | ||
| 🌐 **[Visit ruv.io](https://ruv.io)** for more AI infrastructure tools | ||
| ## Installation | ||
| **You should not install this package directly.** Instead, install the main package: | ||
| ```bash | ||
| npm install ruvector-core | ||
| ``` | ||
| The correct platform-specific package will be automatically installed based on your system. | ||
| ## System Requirements | ||
| - **Operating System**: Linux (GNU libc) | ||
| - **Architecture**: ARM64 / AArch64 | ||
| - **Node.js**: 18.0.0 or higher | ||
| - **libc**: GNU C Library (glibc) | ||
| ## Compatibility | ||
| This package is compatible with: | ||
| - Ubuntu 18.04+ (ARM64) | ||
| - Debian 10+ Buster (ARM64) | ||
| - CentOS 7+ / RHEL 7+ (ARM64) | ||
| - Amazon Linux 2+ (Graviton processors) | ||
| - Raspberry Pi OS 64-bit | ||
| - Most ARM64 Linux distributions using glibc | ||
| ## What's Inside | ||
| This package contains: | ||
| - **ruvector.node** - Native binary module compiled from Rust for ARM64 | ||
| - **index.js** - Module loader with error handling | ||
| - Full HNSW indexing implementation | ||
| - SIMD-optimized vector operations for ARM NEON | ||
| - Multi-threaded async operations via Tokio | ||
| ## Performance | ||
| When running on Linux ARM64 systems (like AWS Graviton), you can expect: | ||
| - **50,000+ vector inserts per second** | ||
| - **10,000+ searches per second** (k=10) | ||
| - **~50 bytes memory per 128-dim vector** | ||
| - **Sub-millisecond latency** for most operations | ||
| - Optimized for ARM NEON SIMD instructions | ||
| ## Popular ARM64 Platforms | ||
| - **AWS Graviton** (EC2 instances) | ||
| - **Raspberry Pi 4/5** (64-bit OS) | ||
| - **NVIDIA Jetson** (edge AI devices) | ||
| - **Apple Silicon** (via Docker/Linux) | ||
| - **Oracle Cloud** (Ampere processors) | ||
| ## Building from Source | ||
| If you need to rebuild the native module: | ||
| ```bash | ||
| # Clone the repository | ||
| git clone https://github.com/ruvnet/ruvector.git | ||
| cd ruvector | ||
| # Install Rust toolchain with ARM64 target | ||
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | ||
| rustup target add aarch64-unknown-linux-gnu | ||
| # Build for Linux ARM64 | ||
| cd npm/packages/core | ||
| npm run build:napi -- --target aarch64-unknown-linux-gnu | ||
| ``` | ||
| ## Troubleshooting | ||
| ### Module Not Found Error | ||
| If you see "Cannot find module 'ruvector-core-linux-arm64-gnu'": | ||
| 1. Verify you're on a Linux ARM64 system: `uname -m` should output `aarch64` | ||
| 2. Reinstall with optional dependencies: `npm install --include=optional ruvector-core` | ||
| 3. Check Node.js version: `node --version` should be 18.0.0 or higher | ||
| ### Binary Compatibility Issues | ||
| If the module fails to load: | ||
| 1. Ensure you have glibc installed: `ldd --version` | ||
| 2. The binary requires glibc 2.17+ (CentOS 7+) or 2.27+ (Ubuntu 18.04+) | ||
| 3. For Alpine Linux or musl-based systems, this package will not work (use a glibc-based distro) | ||
| ### Cross-Compilation | ||
| When building on x64 for ARM64: | ||
| ```bash | ||
| # Install cross-compilation tools | ||
| sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | ||
| # Set environment variable | ||
| export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc | ||
| # Build | ||
| npm run build:napi -- --target aarch64-unknown-linux-gnu | ||
| ``` | ||
| ## Related Packages | ||
| - **[ruvector-core](https://www.npmjs.com/package/ruvector-core)** - Main package (install this) | ||
| - **[ruvector-core-linux-x64-gnu](https://www.npmjs.com/package/ruvector-core-linux-x64-gnu)** - Linux x64 | ||
| - **[ruvector-core-darwin-x64](https://www.npmjs.com/package/ruvector-core-darwin-x64)** - macOS Intel | ||
| - **[ruvector-core-darwin-arm64](https://www.npmjs.com/package/ruvector-core-darwin-arm64)** - macOS Apple Silicon | ||
| - **[ruvector-core-win32-x64-msvc](https://www.npmjs.com/package/ruvector-core-win32-x64-msvc)** - Windows x64 | ||
| ## Resources | ||
| - 🏠 [Homepage](https://ruv.io) | ||
| - 📦 [GitHub Repository](https://github.com/ruvnet/ruvector) | ||
| - 📚 [Documentation](https://github.com/ruvnet/ruvector/tree/main/docs) | ||
| - 🐛 [Issue Tracker](https://github.com/ruvnet/ruvector/issues) | ||
| ## License | ||
| MIT License - see [LICENSE](https://github.com/ruvnet/ruvector/blob/main/LICENSE) for details. | ||
| --- | ||
| Built with ❤️ by the [ruv.io](https://ruv.io) team |
Sorry, the diff of this file is not supported yet
| { | ||
| "startTime": 1764799104118, | ||
| "sessionId": "session-1764799104118", | ||
| "lastActivity": 1764799104118, | ||
| "sessionDuration": 0, | ||
| "totalTasks": 1, | ||
| "successfulTasks": 1, | ||
| "failedTasks": 0, | ||
| "totalAgents": 0, | ||
| "activeAgents": 0, | ||
| "neuralEvents": 0, | ||
| "memoryMode": { | ||
| "reasoningbankOperations": 0, | ||
| "basicOperations": 0, | ||
| "autoModeSelections": 0, | ||
| "modeOverrides": 0, | ||
| "currentMode": "auto" | ||
| }, | ||
| "operations": { | ||
| "store": { | ||
| "count": 0, | ||
| "totalDuration": 0, | ||
| "errors": 0 | ||
| }, | ||
| "retrieve": { | ||
| "count": 0, | ||
| "totalDuration": 0, | ||
| "errors": 0 | ||
| }, | ||
| "query": { | ||
| "count": 0, | ||
| "totalDuration": 0, | ||
| "errors": 0 | ||
| }, | ||
| "list": { | ||
| "count": 0, | ||
| "totalDuration": 0, | ||
| "errors": 0 | ||
| }, | ||
| "delete": { | ||
| "count": 0, | ||
| "totalDuration": 0, | ||
| "errors": 0 | ||
| }, | ||
| "search": { | ||
| "count": 0, | ||
| "totalDuration": 0, | ||
| "errors": 0 | ||
| }, | ||
| "init": { | ||
| "count": 0, | ||
| "totalDuration": 0, | ||
| "errors": 0 | ||
| } | ||
| }, | ||
| "performance": { | ||
| "avgOperationDuration": 0, | ||
| "minOperationDuration": null, | ||
| "maxOperationDuration": null, | ||
| "slowOperations": 0, | ||
| "fastOperations": 0, | ||
| "totalOperationTime": 0 | ||
| }, | ||
| "storage": { | ||
| "totalEntries": 0, | ||
| "reasoningbankEntries": 0, | ||
| "basicEntries": 0, | ||
| "databaseSize": 0, | ||
| "lastBackup": null, | ||
| "growthRate": 0 | ||
| }, | ||
| "errors": { | ||
| "total": 0, | ||
| "byType": {}, | ||
| "byOperation": {}, | ||
| "recent": [] | ||
| }, | ||
| "reasoningbank": { | ||
| "semanticSearches": 0, | ||
| "sqlFallbacks": 0, | ||
| "embeddingGenerated": 0, | ||
| "consolidations": 0, | ||
| "avgQueryTime": 0, | ||
| "cacheHits": 0, | ||
| "cacheMisses": 0 | ||
| } | ||
| } |
| [ | ||
| { | ||
| "id": "cmd-hooks-1764799104224", | ||
| "type": "hooks", | ||
| "success": true, | ||
| "duration": 7.244650999999976, | ||
| "timestamp": 1764799104231, | ||
| "metadata": {} | ||
| } | ||
| ] |
| const { join } = require('path'); | ||
| let nativeBinding; | ||
| try { | ||
| nativeBinding = require('./ruvector.node'); | ||
| } catch (error) { | ||
| throw new Error( | ||
| 'Failed to load native binding for linux-x64-gnu. ' + | ||
| 'This package may have been installed incorrectly. ' + | ||
| 'Error: ' + error.message | ||
| ); | ||
| } | ||
| module.exports = nativeBinding; |
| { | ||
| "name": "ruvector-core-linux-x64-gnu", | ||
| "version": "0.1.17", | ||
| "description": "Linux x64 GNU native binding for ruvector-core - High-performance vector database with HNSW indexing built in Rust", | ||
| "main": "index.js", | ||
| "type": "commonjs", | ||
| "os": ["linux"], | ||
| "cpu": ["x64"], | ||
| "author": "ruv.io Team <info@ruv.io> (https://ruv.io)", | ||
| "homepage": "https://ruv.io", | ||
| "engines": { | ||
| "node": ">= 18" | ||
| }, | ||
| "files": [ | ||
| "index.js", | ||
| "ruvector.node", | ||
| "*.node", | ||
| "README.md" | ||
| ], | ||
| "keywords": [ | ||
| "ruvector", | ||
| "vector-database", | ||
| "vector-search", | ||
| "similarity-search", | ||
| "semantic-search", | ||
| "hnsw", | ||
| "native", | ||
| "napi", | ||
| "rust", | ||
| "linux", | ||
| "x64", | ||
| "gnu", | ||
| "glibc", | ||
| "ai", | ||
| "machine-learning", | ||
| "embedding-database", | ||
| "simd", | ||
| "performance", | ||
| "ruv" | ||
| ], | ||
| "license": "MIT", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/ruvnet/ruvector.git", | ||
| "directory": "npm/core/platforms/linux-x64-gnu" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/ruvnet/ruvector/issues" | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public" | ||
| } | ||
| } |
| # ruvector-core-linux-x64-gnu | ||
| [](https://www.npmjs.com/package/ruvector-core-linux-x64-gnu) | ||
| [](https://opensource.org/licenses/MIT) | ||
| **Linux x64 GNU native binding for ruvector-core** | ||
| This package contains the native Node.js binding (`.node` file) for Linux x64 systems with GNU libc. It is automatically installed as an optional dependency when you install `ruvector-core` on a compatible system. | ||
| 🌐 **[Visit ruv.io](https://ruv.io)** for more AI infrastructure tools | ||
| ## Installation | ||
| **You should not install this package directly.** Instead, install the main package: | ||
| ```bash | ||
| npm install ruvector-core | ||
| ``` | ||
| The correct platform-specific package will be automatically installed based on your system. | ||
| ## System Requirements | ||
| - **Operating System**: Linux (GNU libc) | ||
| - **Architecture**: x86_64 (x64) | ||
| - **Node.js**: 18.0.0 or higher | ||
| - **libc**: GNU C Library (glibc) | ||
| ## Compatibility | ||
| This package is compatible with: | ||
| - Ubuntu 18.04+ (all versions) | ||
| - Debian 10+ (Buster and later) | ||
| - CentOS 7+ / RHEL 7+ | ||
| - Fedora (all supported versions) | ||
| - Amazon Linux 2+ | ||
| - Most Linux distributions using glibc | ||
| ## What's Inside | ||
| This package contains: | ||
| - **ruvector.node** - Native binary module (4.3 MB) compiled from Rust | ||
| - **index.js** - Module loader with error handling | ||
| - Full HNSW indexing implementation | ||
| - SIMD-optimized vector operations | ||
| - Multi-threaded async operations via Tokio | ||
| ## Performance | ||
| When running on Linux x64 systems, you can expect: | ||
| - **50,000+ vector inserts per second** | ||
| - **10,000+ searches per second** (k=10) | ||
| - **~50 bytes memory per 128-dim vector** | ||
| - **Sub-millisecond latency** for most operations | ||
| ## Building from Source | ||
| If you need to rebuild the native module: | ||
| ```bash | ||
| # Clone the repository | ||
| git clone https://github.com/ruvnet/ruvector.git | ||
| cd ruvector | ||
| # Install Rust toolchain | ||
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | ||
| # Build for Linux x64 | ||
| cd npm/packages/core | ||
| npm run build:napi -- --target x86_64-unknown-linux-gnu | ||
| ``` | ||
| ## Troubleshooting | ||
| ### Module Not Found Error | ||
| If you see "Cannot find module 'ruvector-core-linux-x64-gnu'": | ||
| 1. Verify you're on a Linux x64 system: `uname -m` should output `x86_64` | ||
| 2. Reinstall with optional dependencies: `npm install --include=optional ruvector-core` | ||
| 3. Check Node.js version: `node --version` should be 18.0.0 or higher | ||
| ### Binary Compatibility Issues | ||
| If the module fails to load: | ||
| 1. Ensure you have glibc installed: `ldd --version` | ||
| 2. The binary requires glibc 2.17+ (CentOS 7+) or 2.27+ (Ubuntu 18.04+) | ||
| 3. For Alpine Linux or musl-based systems, this package will not work (use a glibc-based distro) | ||
| ## Related Packages | ||
| - **[ruvector-core](https://www.npmjs.com/package/ruvector-core)** - Main package (install this) | ||
| - **[ruvector-core-linux-arm64-gnu](https://www.npmjs.com/package/ruvector-core-linux-arm64-gnu)** - Linux ARM64 | ||
| - **[ruvector-core-darwin-x64](https://www.npmjs.com/package/ruvector-core-darwin-x64)** - macOS Intel | ||
| - **[ruvector-core-darwin-arm64](https://www.npmjs.com/package/ruvector-core-darwin-arm64)** - macOS Apple Silicon | ||
| - **[ruvector-core-win32-x64-msvc](https://www.npmjs.com/package/ruvector-core-win32-x64-msvc)** - Windows x64 | ||
| ## Resources | ||
| - 🏠 [Homepage](https://ruv.io) | ||
| - 📦 [GitHub Repository](https://github.com/ruvnet/ruvector) | ||
| - 📚 [Documentation](https://github.com/ruvnet/ruvector/tree/main/docs) | ||
| - 🐛 [Issue Tracker](https://github.com/ruvnet/ruvector/issues) | ||
| ## License | ||
| MIT License - see [LICENSE](https://github.com/ruvnet/ruvector/blob/main/LICENSE) for details. | ||
| --- | ||
| Built with ❤️ by the [ruv.io](https://ruv.io) team |
Sorry, the diff of this file is not supported yet
| { | ||
| "startTime": 1764799127323, | ||
| "sessionId": "session-1764799127323", | ||
| "lastActivity": 1764799127323, | ||
| "sessionDuration": 0, | ||
| "totalTasks": 1, | ||
| "successfulTasks": 1, | ||
| "failedTasks": 0, | ||
| "totalAgents": 0, | ||
| "activeAgents": 0, | ||
| "neuralEvents": 0, | ||
| "memoryMode": { | ||
| "reasoningbankOperations": 0, | ||
| "basicOperations": 0, | ||
| "autoModeSelections": 0, | ||
| "modeOverrides": 0, | ||
| "currentMode": "auto" | ||
| }, | ||
| "operations": { | ||
| "store": { | ||
| "count": 0, | ||
| "totalDuration": 0, | ||
| "errors": 0 | ||
| }, | ||
| "retrieve": { | ||
| "count": 0, | ||
| "totalDuration": 0, | ||
| "errors": 0 | ||
| }, | ||
| "query": { | ||
| "count": 0, | ||
| "totalDuration": 0, | ||
| "errors": 0 | ||
| }, | ||
| "list": { | ||
| "count": 0, | ||
| "totalDuration": 0, | ||
| "errors": 0 | ||
| }, | ||
| "delete": { | ||
| "count": 0, | ||
| "totalDuration": 0, | ||
| "errors": 0 | ||
| }, | ||
| "search": { | ||
| "count": 0, | ||
| "totalDuration": 0, | ||
| "errors": 0 | ||
| }, | ||
| "init": { | ||
| "count": 0, | ||
| "totalDuration": 0, | ||
| "errors": 0 | ||
| } | ||
| }, | ||
| "performance": { | ||
| "avgOperationDuration": 0, | ||
| "minOperationDuration": null, | ||
| "maxOperationDuration": null, | ||
| "slowOperations": 0, | ||
| "fastOperations": 0, | ||
| "totalOperationTime": 0 | ||
| }, | ||
| "storage": { | ||
| "totalEntries": 0, | ||
| "reasoningbankEntries": 0, | ||
| "basicEntries": 0, | ||
| "databaseSize": 0, | ||
| "lastBackup": null, | ||
| "growthRate": 0 | ||
| }, | ||
| "errors": { | ||
| "total": 0, | ||
| "byType": {}, | ||
| "byOperation": {}, | ||
| "recent": [] | ||
| }, | ||
| "reasoningbank": { | ||
| "semanticSearches": 0, | ||
| "sqlFallbacks": 0, | ||
| "embeddingGenerated": 0, | ||
| "consolidations": 0, | ||
| "avgQueryTime": 0, | ||
| "cacheHits": 0, | ||
| "cacheMisses": 0 | ||
| } | ||
| } |
| [ | ||
| { | ||
| "id": "cmd-hooks-1764799127425", | ||
| "type": "hooks", | ||
| "success": true, | ||
| "duration": 6.725271999999961, | ||
| "timestamp": 1764799127432, | ||
| "metadata": {} | ||
| } | ||
| ] |
| const { join } = require('path'); | ||
| let nativeBinding; | ||
| try { | ||
| nativeBinding = require('./ruvector.node'); | ||
| } catch (error) { | ||
| throw new Error( | ||
| 'Failed to load native binding for win32-x64-msvc. ' + | ||
| 'This package may have been installed incorrectly. ' + | ||
| 'Ensure you have Visual C++ Redistributable installed. ' + | ||
| 'Error: ' + error.message | ||
| ); | ||
| } | ||
| module.exports = nativeBinding; |
| { | ||
| "name": "ruvector-core-win32-x64-msvc", | ||
| "version": "0.1.17", | ||
| "description": "Windows x64 MSVC native binding for ruvector-core - High-performance vector database with HNSW indexing built in Rust", | ||
| "main": "index.js", | ||
| "type": "commonjs", | ||
| "os": ["win32"], | ||
| "cpu": ["x64"], | ||
| "author": "ruv.io Team <info@ruv.io> (https://ruv.io)", | ||
| "homepage": "https://ruv.io", | ||
| "engines": { | ||
| "node": ">= 18" | ||
| }, | ||
| "files": [ | ||
| "index.js", | ||
| "ruvector.node", | ||
| "*.node", | ||
| "README.md" | ||
| ], | ||
| "keywords": [ | ||
| "ruvector", | ||
| "vector-database", | ||
| "vector-search", | ||
| "similarity-search", | ||
| "semantic-search", | ||
| "hnsw", | ||
| "native", | ||
| "napi", | ||
| "rust", | ||
| "windows", | ||
| "win32", | ||
| "x64", | ||
| "msvc", | ||
| "ai", | ||
| "machine-learning", | ||
| "embedding-database", | ||
| "simd", | ||
| "performance", | ||
| "ruv" | ||
| ], | ||
| "license": "MIT", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/ruvnet/ruvector.git", | ||
| "directory": "npm/core/platforms/win32-x64-msvc" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/ruvnet/ruvector/issues" | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public" | ||
| } | ||
| } |
| # ruvector-core-win32-x64-msvc | ||
| [](https://www.npmjs.com/package/ruvector-core-win32-x64-msvc) | ||
| [](https://opensource.org/licenses/MIT) | ||
| **Windows x64 MSVC native binding for ruvector-core** | ||
| This package contains the native Node.js binding (`.node` file) for Windows x64 systems compiled with MSVC. It is automatically installed as an optional dependency when you install `ruvector-core` on a compatible system. | ||
| 🌐 **[Visit ruv.io](https://ruv.io)** for more AI infrastructure tools | ||
| ## Installation | ||
| **You should not install this package directly.** Instead, install the main package: | ||
| ```bash | ||
| npm install ruvector-core | ||
| ``` | ||
| The correct platform-specific package will be automatically installed based on your system. | ||
| ## System Requirements | ||
| - **Operating System**: Windows 10 (1809+) or Windows 11, Windows Server 2019+ | ||
| - **Architecture**: x86_64 (64-bit) | ||
| - **Node.js**: 18.0.0 or higher | ||
| - **Visual C++ Runtime**: Automatically included with Node.js | ||
| ## Compatibility | ||
| This package is compatible with: | ||
| - **Windows 10** (version 1809 or later) | ||
| - **Windows 11** (all versions) | ||
| - **Windows Server 2019** and newer | ||
| - Most Windows development environments | ||
| **Note:** Windows ARM64 is not currently supported. | ||
| ## What's Inside | ||
| This package contains: | ||
| - **ruvector.node** - Native binary module compiled from Rust with MSVC | ||
| - **index.js** - Module loader with error handling | ||
| - Full HNSW indexing implementation | ||
| - SIMD-optimized vector operations (AVX2, SSE4.2) | ||
| - Multi-threaded async operations via Tokio | ||
| ## Performance | ||
| When running on Windows x64 systems, you can expect: | ||
| - **50,000+ vector inserts per second** | ||
| - **10,000+ searches per second** (k=10) | ||
| - **~50 bytes memory per 128-dim vector** | ||
| - **Sub-millisecond latency** for most operations | ||
| - Optimized for Intel/AMD AVX2 SIMD instructions | ||
| ## Building from Source | ||
| If you need to rebuild the native module: | ||
| ### Prerequisites | ||
| 1. Install **Visual Studio 2022** (or 2019) with "Desktop development with C++" workload | ||
| 2. Install **Rust**: https://rustup.rs/ | ||
| 3. Open "x64 Native Tools Command Prompt for VS 2022" | ||
| ### Build Steps | ||
| ```bash | ||
| # Clone the repository | ||
| git clone https://github.com/ruvnet/ruvector.git | ||
| cd ruvector | ||
| # Build for Windows x64 | ||
| cd npm\packages\core | ||
| npm run build:napi -- --target x86_64-pc-windows-msvc | ||
| ``` | ||
| ## Troubleshooting | ||
| ### Module Not Found Error | ||
| If you see "Cannot find module 'ruvector-core-win32-x64-msvc'": | ||
| 1. Verify you're on Windows 64-bit: `wmic os get osarchitecture` should show "64-bit" | ||
| 2. Reinstall with optional dependencies: `npm install --include=optional ruvector-core` | ||
| 3. Check Node.js version: `node --version` should be 18.0.0 or higher | ||
| ### DLL Loading Issues | ||
| If the module fails to load with DLL errors: | ||
| 1. **Install Visual C++ Redistributable**: | ||
| - Download from: https://aka.ms/vs/17/release/vc_redist.x64.exe | ||
| - Node.js usually includes this, but manual install may be needed | ||
| 2. **Check Windows Updates**: | ||
| - Ensure Windows is up to date | ||
| - Some MSVC runtimes come through Windows Update | ||
| 3. **Verify Node.js Installation**: | ||
| - Reinstall Node.js from nodejs.org | ||
| - Use the Windows Installer (.msi) version | ||
| ### Long Path Issues | ||
| If you encounter "path too long" errors: | ||
| 1. **Enable Long Paths in Windows**: | ||
| ```powershell | ||
| # Run PowerShell as Administrator | ||
| New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force | ||
| ``` | ||
| 2. **Or use shorter paths**: | ||
| - Install Node modules closer to drive root (e.g., `C:\projects\`) | ||
| ### Antivirus False Positives | ||
| Some antivirus software may flag native `.node` files: | ||
| - Add an exception for `node_modules\ruvector-core-win32-x64-msvc\` | ||
| - Or temporarily disable real-time scanning during npm install | ||
| ### WSL2 (Windows Subsystem for Linux) | ||
| If you're using WSL2: | ||
| - Use the Linux packages instead (`ruvector-core-linux-x64-gnu`) | ||
| - This Windows package is for native Windows Node.js only | ||
| ## Related Packages | ||
| - **[ruvector-core](https://www.npmjs.com/package/ruvector-core)** - Main package (install this) | ||
| - **[ruvector-core-linux-x64-gnu](https://www.npmjs.com/package/ruvector-core-linux-x64-gnu)** - Linux x64 | ||
| - **[ruvector-core-linux-arm64-gnu](https://www.npmjs.com/package/ruvector-core-linux-arm64-gnu)** - Linux ARM64 | ||
| - **[ruvector-core-darwin-x64](https://www.npmjs.com/package/ruvector-core-darwin-x64)** - macOS Intel | ||
| - **[ruvector-core-darwin-arm64](https://www.npmjs.com/package/ruvector-core-darwin-arm64)** - macOS Apple Silicon | ||
| ## Resources | ||
| - 🏠 [Homepage](https://ruv.io) | ||
| - 📦 [GitHub Repository](https://github.com/ruvnet/ruvector) | ||
| - 📚 [Documentation](https://github.com/ruvnet/ruvector/tree/main/docs) | ||
| - 🐛 [Issue Tracker](https://github.com/ruvnet/ruvector/issues) | ||
| ## License | ||
| MIT License - see [LICENSE](https://github.com/ruvnet/ruvector/blob/main/LICENSE) for details. | ||
| --- | ||
| Built with ❤️ by the [ruv.io](https://ruv.io) team |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
1
-50%293
27.39%1
-80%1
-83.33%11287
-99.96%5
400%4
-90%63
-93%No
NaN