ruvector-wasm-v0.1.31

EvolvingLMMs-Lab/Aero-1ruvector-wasm-v0.1.31Jun 15, 2026by ruvnet

AI Summary

Restores the functional `RuvectorWasmAdapter` package and fixes critical bugs in the raw WASM build. Version 0.1.30 was published without the necessary WASM files; this release includes the built web assets, the adapter, and corrects three specific behaviors regarding index type, scoring logic, and metadata handling.

Key Highlights

  • Restores functional package with built WASM files and JS bindings.
  • Ships the `RuvectorWasmAdapter` (`@ruvector/wasm/adapter`).
  • Corrects HNSW availability, now exposing `indexType` instead of assuming O(log n).
  • Fixes scoring to return `similarity` (higher is better) instead of raw cosine distance.
  • Fixes metadata round-trip issue to preserve document metadata.

Breaking Changes

  • Changed return value of `score` from raw distance (lower is better) to similarity (higher is better).
  • HNSW index is now correctly exposed as inactive (`flat`), correcting the assumption of O(log n) performance.
  • Metadata now properly round-trips with search/get results (previously returned empty objects).

New Features

  • RuvectorWasmAdapter for easier WASM interaction.
  • similarity property in search results (higher is better).
  • distance property preserved for raw values.
  • indexType property to check index status.
  • In-process metadata sidecar for search and get operations.

Full Release Notes

## @ruvector/wasm 0.1.31

Ships the **RuvectorWasmAdapter** (`@ruvector/wasm/adapter`) from #568 and restores a **functional published package** — 0.1.30 had shipped with only `package.json` (empty `pkg/`); 0.1.31 includes the built web `pkg/` (WASM + JS bindings) plus the adapter.

### The adapter corrects three behaviours of the raw WASM build
1. **HNSW not active** — the wasm32 target compiles without the `hnsw` feature and falls back to a flat (brute-force) index. The adapter surfaces this via `indexType` / `WASM_HNSW_AVAILABLE` instead of letting callers assume O(log n).
2. **`score` was a cosine distance** (lower is better), contradicting the `.d.ts`. The adapter exposes a real `similarity = 1 - distance` (per-metric) so "higher is better" holds, with the raw `distance` preserved.
3. **Metadata did not round-trip** — `search`/`get` returned `{}`. The adapter keeps an in-process metadata sidecar keyed by id and re-attaches it on the way out.

### Usage
```js
import { RuvectorWasmAdapter } from '@ruvector/wasm/adapter';
const index = await RuvectorWasmAdapter.create({ dimensions: 384, metric: 'cosine' });
index.insert({ id: 'doc_1', vector: embedding, metadata: { title: 'My Document' } });
const results = index.search({ vector: query, k: 10 });
// results[i].similarity (higher better), .distance (raw), .metadata (round-trips), index.indexType ('flat')
```

- Tarball: 13 files, 381 kB unpacked · npm: https://www.npmjs.com/package/@ruvector/wasm
- Adapter validated by 7 Node tests (all 3 findings + filter/batch/delete). PR #568.