ruvector/npm/packages
ruvnet 3de3235acc fix(ruvector-cli): real demo + binding-drift fixes for v0.2.25 (#400, #402)
Follow-up to #403. Addresses the runtime-side issues from #400 (`ruvector
demo` modes) and #402 §A/§B (VectorDB CRUD + GNN/attention typed-array
errors) that needed binding-surface investigation.

## Changes

### `VectorDBWrapper`: normalize distance metric (§A root cause)

`@ruvector/core`'s `JsDistanceMetric` enum is PascalCase
(`Euclidean | Cosine | DotProduct | Manhattan`), but every CLI call site
passes lowercase shorthand (`'cosine'`, `'euclidean'`, `'dot'`). The
native binding rejects lowercase with:

  value `"cosine"` does not match any variant of enum `JsDistanceMetric`
  on JsDbOptions.distanceMetric

Add a `normalizeMetric()` helper in `src/index.ts` that maps both casing
*and* common aliases (`l2`, `dot`, `dotproduct`, `innerproduct`, `l1`)
to the enum variant. Also accept `metric` as a constructor alias for
`distanceMetric` so the CLI's existing `{metric: ...}` shape works
without changing every call site.

### `demo --basic`: realign with current `VectorDb` API (§A surface)

Old code:

  db.insert('vec1', [1.0, 0.0, 0.0, 0.0], { label: 'x-axis' });
  const r = db.search([0.8, 0.6, 0, 0], 3);

Current `VectorDBWrapper` (and the underlying `@ruvector/core` binding)
takes a single object:

  await db.insert({ id: 'vec1', vector: new Float32Array([...]),
                    metadata: { label: 'x-axis' } });
  const r = await db.search({ vector: new Float32Array([...]), k: 3 });

Updated all four insert calls + the search call accordingly. Verified
locally — vec4 (closest to [0.8, 0.6]) is correctly returned first.

### `demo --gnn`: Float32Array + binding-bug surfaceability

Two issues:

1. CLI passed plain `number[]`; binding requires `Float32Array`. Fixed.

2. `@ruvector/gnn-linux-x64-gnu@0.1.25` has a published-binding
   regression where every method (`differentiableSearch`,
   `RuvectorLayer.forward`, `TensorCompress.compress`) throws
   `Given napi value is not an array` regardless of input shape —
   verified with both `Array<Float32Array>` and `number[][]`. This is
   a binary-side bug, not fixable from the CLI.

Added `reportGnnBindingError()` helper that detects the error pattern
and surfaces a pointer at #402 so users don't waste time debugging
their own install. Wired it into all three GNN command error handlers
(`gnn layer --test`, `gnn compress`, `gnn search`) and the demo.

Also fixed `result.attention_weights` → `result.weights` (the wrapper
shape; `attention_weights` was the older binding shape) with a fallback
that handles both.

### `demo --graph`: real round-trip via `GraphDatabase`

Was a stub printing "Full graph demo coming soon". `@ruvector/graph-node`
exposes a `GraphDatabase` class with `createNode({ id, embedding,
properties })`, `createEdge({ from, to, description, embedding,
confidence })`, and `stats()` — all async. Implemented a tiny
Alice -[:KNOWS]-> Bob round-trip using the actual API surface.

### `demo --benchmark`: real inline benchmark (with workaround)

Was redirecting to `npx ruvector benchmark`. Implemented an inline
1000-vector / 100-query mini-benchmark. Pinned to `dim=4` because
`ruvector-core-linux-x64-gnu@0.1.29` has a regression where the
`dimensions` constructor arg is ignored — every `VectorDb` instance
reports `expected 4` regardless of what's passed (verified by
constructing fresh instances with various dims). Tracked at #402.
Once that binding is rebuilt, `dim` can scale up.

### `attention compute`: align with current `compute()` surface (§B)

The CLI's old switch invoked `attn.forward([query], keys, values)`,
but every current `@ruvector/attention` class exposes `compute(query,
keys, values)` instead — `forward` doesn't exist. Also the query
must be a flat `Float32Array`, not `[query]` matrix.

Reproduces the user's `Failed to convert napi value Undefined into
rust type u32` and `Get TypedArray info failed` errors directly.

Replaced all five branches (`dot | multi-head | flash | hyperbolic |
linear`) with the correct `compute()` invocation + Float32Array
conversion. Verified locally:

  $ node bin/cli.js attention compute -q "[1,0,0,0]" -k keys.json -t dot
  ✔ Attention computed (dot)
  Output: [0.6225, 0.3775, 0, 0...]

### `gnn layer --test` / `gnn compress` / `gnn search`: typed-array conversion

All three commands previously passed plain `number[]` where the binding
needs `Float32Array`. Converted at the call sites + added the
`reportGnnBindingError` hook so users see the upstream pointer when
they hit the binding-side regression.

## Verification

```
$ node bin/cli.js demo --basic
  Searching for nearest to [0.8, 0.6, 0, 0]:
    1. vec4 (score: 0.0101)  ✓ correct nearest
    2. vec1 (score: 0.2000)
    3. vec2 (score: 0.4000)
  Demo complete!

$ node bin/cli.js demo --gnn
  GNN demo failed: Given napi value is not an array
  Note: this is a known regression in the @ruvector/gnn native binding…
    https://github.com/ruvnet/ruvector/issues/402

$ node bin/cli.js demo --graph
  ✓ GraphDatabase instance created
  ✓ Created nodes: Alice (alice), Bob (bob)
  ✓ Created edge Alice -[:KNOWS]-> Bob (uuid)
  Graph demo complete!

$ node bin/cli.js demo --benchmark
  ✓ Inserted 1000 vectors in 126ms (0.13ms/vec)
  ✓ 100× top-10 search in 51ms (0.51ms/query)

$ node bin/cli.js attention compute -q "[1,0,0,0]" -k keys.json -t dot
  ✔ Attention computed (dot)

$ npm run verify-dist
  verify-dist: 13 dist path(s) present.
```

Version bumped 0.2.24 → 0.2.25.

## Out of scope (binding-side rebuilds needed)

- `@ruvector/gnn` published bindings throw on every call (binding bug).
- `@ruvector/core` published bindings ignore `dimensions` constructor
  arg (binding bug).

Both need a rebuild from current source — the Rust source in this repo
shows correct independent state, but the published `.node` files have
the regression. Rebuild and republish are tracked separately.
2026-04-27 08:42:34 -04:00
..
acorn-wasm feat(wasm): publish @ruvector/rabitq-wasm and @ruvector/acorn-wasm to npm (#394) 2026-04-26 23:10:39 -04:00
agentic-integration feat(training): RuvLTRA v2.4 Ecosystem Edition - 100% routing accuracy (#123) 2026-01-20 20:08:30 -05:00
agentic-synth chore: update npm build artifacts for ruvbot, cognitum-gate-wasm, ospipe, raft, replication, ruvector-wasm-unified, ruvllm, rvf, and other packages 2026-02-23 16:07:05 +00:00
agentic-synth-examples chore: update npm build artifacts for ruvbot, cognitum-gate-wasm, ospipe, raft, replication, ruvector-wasm-unified, ruvllm, rvf, and other packages 2026-02-23 16:07:05 +00:00
burst-scaling feat(training): RuvLTRA v2.4 Ecosystem Edition - 100% routing accuracy (#123) 2026-01-20 20:08:30 -05:00
cli feat(training): RuvLTRA v2.4 Ecosystem Edition - 100% routing accuracy (#123) 2026-01-20 20:08:30 -05:00
cloud-run chore: update npm build artifacts for ruvbot, cognitum-gate-wasm, ospipe, raft, replication, ruvector-wasm-unified, ruvllm, rvf, and other packages 2026-02-23 16:07:05 +00:00
cognitum-gate-wasm chore: update npm build artifacts for ruvbot, cognitum-gate-wasm, ospipe, raft, replication, ruvector-wasm-unified, ruvllm, rvf, and other packages 2026-02-23 16:07:05 +00:00
core chore(npm): patch bump packages for security overrides (#346) 2026-04-20 14:14:43 -04:00
diskann docs: add DiskANN usage, API reference, and platform table to README 2026-04-06 18:04:06 -04:00
graph-data-generator chore: update npm build artifacts for ruvbot, cognitum-gate-wasm, ospipe, raft, replication, ruvector-wasm-unified, ruvllm, rvf, and other packages 2026-02-23 16:07:05 +00:00
graph-node chore(npm): patch bump packages for security overrides (#346) 2026-04-20 14:14:43 -04:00
graph-wasm chore(npm): patch bump packages for security overrides (#346) 2026-04-20 14:14:43 -04:00
node chore(npm): patch bump packages for security overrides (#346) 2026-04-20 14:14:43 -04:00
ospipe chore: update npm build artifacts for ruvbot, cognitum-gate-wasm, ospipe, raft, replication, ruvector-wasm-unified, ruvllm, rvf, and other packages 2026-02-23 16:07:05 +00:00
ospipe-wasm feat(ospipe): RuVector-enhanced personal AI memory for Screenpipe (#163) 2026-02-12 22:45:25 -05:00
pi-brain feat(sse): decouple SSE to mcp.pi.ruv.io proxy + Claude Code source research 2026-04-02 23:39:56 +00:00
postgres-cli chore: bump @ruvector/postgres-cli to 0.2.7 2026-02-15 06:25:23 +00:00
rabitq-wasm feat(wasm): publish @ruvector/rabitq-wasm and @ruvector/acorn-wasm to npm (#394) 2026-04-26 23:10:39 -04:00
raft chore: update npm build artifacts for ruvbot, cognitum-gate-wasm, ospipe, raft, replication, ruvector-wasm-unified, ruvllm, rvf, and other packages 2026-02-23 16:07:05 +00:00
replication chore: update npm build artifacts for ruvbot, cognitum-gate-wasm, ospipe, raft, replication, ruvector-wasm-unified, ruvllm, rvf, and other packages 2026-02-23 16:07:05 +00:00
router chore(router): bump to 0.1.30 for clean publish with aligned deps 2026-04-06 16:36:48 -04:00
router-darwin-arm64 chore(router): bump to 0.1.30 for clean publish with aligned deps 2026-04-06 16:36:48 -04:00
router-darwin-x64 chore(router): bump to 0.1.30 for clean publish with aligned deps 2026-04-06 16:36:48 -04:00
router-linux-arm64-gnu chore(router): bump to 0.1.30 for clean publish with aligned deps 2026-04-06 16:36:48 -04:00
router-linux-x64-gnu chore(router): bump to 0.1.30 for clean publish with aligned deps 2026-04-06 16:36:48 -04:00
router-win32-x64-msvc chore(router): bump to 0.1.30 for clean publish with aligned deps 2026-04-06 16:36:48 -04:00
rudag fix(esm): add .js extensions to dist module specifiers for Node.js ESM compatibility 2026-04-10 16:39:45 +00:00
ruqu-wasm chore(ruqu): bump to v2.0.5 with updated READMEs 2026-02-12 18:44:22 +00:00
ruvbot chore: update npm build artifacts for ruvbot, cognitum-gate-wasm, ospipe, raft, replication, ruvector-wasm-unified, ruvllm, rvf, and other packages 2026-02-23 16:07:05 +00:00
ruvector fix(ruvector-cli): real demo + binding-drift fixes for v0.2.25 (#400, #402) 2026-04-27 08:42:34 -04:00
ruvector-cnn feat(ruvector-cnn): CNN contrastive learning + SIMD optimization fixes (#252) 2026-03-11 17:41:53 -04:00
ruvector-extensions feat(training): RuvLTRA v2.4 Ecosystem Edition - 100% routing accuracy (#123) 2026-01-20 20:08:30 -05:00
ruvector-wasm chore(npm): patch bump packages for security overrides (#346) 2026-04-20 14:14:43 -04:00
ruvector-wasm-unified chore: update npm build artifacts for ruvbot, cognitum-gate-wasm, ospipe, raft, replication, ruvector-wasm-unified, ruvllm, rvf, and other packages 2026-02-23 16:07:05 +00:00
ruvllm Fix CLI dimension field mismatch + add TurboQuant to README (#309) 2026-03-27 17:44:26 -04:00
ruvllm-cli chore: update npm build artifacts for ruvbot, cognitum-gate-wasm, ospipe, raft, replication, ruvector-wasm-unified, ruvllm, rvf, and other packages 2026-02-23 16:07:05 +00:00
ruvllm-darwin-arm64 feat(training): RuvLTRA v2.4 Ecosystem Edition - 100% routing accuracy (#123) 2026-01-20 20:08:30 -05:00
ruvllm-darwin-x64 feat(training): RuvLTRA v2.4 Ecosystem Edition - 100% routing accuracy (#123) 2026-01-20 20:08:30 -05:00
ruvllm-linux-arm64-gnu feat(training): RuvLTRA v2.4 Ecosystem Edition - 100% routing accuracy (#123) 2026-01-20 20:08:30 -05:00
ruvllm-linux-x64-gnu feat(training): RuvLTRA v2.4 Ecosystem Edition - 100% routing accuracy (#123) 2026-01-20 20:08:30 -05:00
ruvllm-wasm chore: update npm build artifacts for ruvbot, cognitum-gate-wasm, ospipe, raft, replication, ruvector-wasm-unified, ruvllm, rvf, and other packages 2026-02-23 16:07:05 +00:00
ruvllm-win32-x64-msvc feat(training): RuvLTRA v2.4 Ecosystem Edition - 100% routing accuracy (#123) 2026-01-20 20:08:30 -05:00
rvdna perf(rvdna): optimize hot paths and add real-data integration tests 2026-02-22 15:44:33 +00:00
rvf chore: update npm build artifacts for ruvbot, cognitum-gate-wasm, ospipe, raft, replication, ruvector-wasm-unified, ruvllm, rvf, and other packages 2026-02-23 16:07:05 +00:00
rvf-mcp-server docs: update READMEs with self-booting instructions, bump npm versions 2026-02-16 14:43:04 +00:00
rvf-node chore: Update RVF NAPI-RS binaries for all platforms 2026-04-21 20:31:20 +00:00
rvf-solver chore: update npm build artifacts for ruvbot, cognitum-gate-wasm, ospipe, raft, replication, ruvector-wasm-unified, ruvllm, rvf, and other packages 2026-02-23 16:07:05 +00:00
rvf-wasm fix(rvf-solver): add WASM binary, fix CJS loader, and correct field mapping 2026-02-17 02:05:37 +00:00
rvlite chore: bump and publish npm packages (ruvector 0.1.99, rvlite 0.2.4, rvf 0.1.3) 2026-02-15 06:19:48 +00:00
scipix feat(npm): add @ruvector/raft, @ruvector/replication, @ruvector/scipix packages (#129) 2026-01-21 22:58:14 -05:00
sona chore(npm): patch bump packages for security overrides (#346) 2026-04-20 14:14:43 -04:00
spiking-neural feat(training): RuvLTRA v2.4 Ecosystem Edition - 100% routing accuracy (#123) 2026-01-20 20:08:30 -05:00
tiny-dancer feat(rvf): RuVector Format — Universal Cognitive Container SDK (#166) 2026-02-14 13:14:49 -05:00
tiny-dancer-darwin-arm64 feat: Add platform-specific npm packages for multi-platform support 2025-11-27 15:25:00 +00:00
tiny-dancer-darwin-x64 feat: Add platform-specific npm packages for multi-platform support 2025-11-27 15:25:00 +00:00
tiny-dancer-linux-arm64-gnu feat(rvf): RuVector Format — Universal Cognitive Container SDK (#166) 2026-02-14 13:14:49 -05:00
tiny-dancer-linux-x64-gnu feat: Add platform-specific npm packages for multi-platform support 2025-11-27 15:25:00 +00:00
tiny-dancer-win32-x64-msvc feat: Add platform-specific npm packages for multi-platform support 2025-11-27 15:25:00 +00:00