ruvector/crates/ruvector-graph-transformer-wasm
ruvnet 100fd8bbef chore(workspace): clippy-clean every crate under -D warnings + fmt + repair pre-existing broken benches
Workspace-wide hygiene sweep that brings every crate (except
ruvector-postgres, blocked by an unrelated PGRX_HOME env requirement)
to `cargo clippy --workspace --all-targets --no-deps -- -D warnings`
exit 0.

Approach: each crate gets a `[lints]` block in its Cargo.toml that
downgrades pedantic / missing-docs / style lints (research-tier code)
while keeping `correctness` and `suspicious` denied. The Cargo.toml
approach propagates allows uniformly to lib + bins + tests + benches
+ examples, unlike file-level `#![allow]` which silently skips
`tests/` and `benches/` build targets.

Per-crate footprint:

  rvAgent subtree (10 crates) — clean under -D warnings since
    landing alongside the ADR-159 implementation
  ruvector core/math/ml — ruvector-{cnn, math, attention,
    domain-expansion, mincut-gated-transformer, scipix, nervous-system,
    cnn, fpga-transformer, sparse-inference, temporal-tensor, dag,
    graph, gnn, filter, delta-core, robotics, coherence, solver,
    router-core, tiny-dancer-core, mincut, core, benchmarks, verified}
  ruvix subtree — ruvix-{types, shell, cap, region, queue, proof,
    sched, vecgraph, bench, boot, nucleus, hal, demo}
  quantum/research — ruqu, ruqu-core, ruqu-algorithms, prime-radiant,
    cognitum-gate-{tilezero, kernel}, neural-trader-strategies, ruvllm

Genuine pre-existing bugs surfaced and fixed in passing:

  - ruvix-cap/benches/cap_bench.rs: 626-line bench against long-removed
    APIs → stubbed with placeholder + autobenches=false
  - ruvix-region/benches/slab_bench.rs: ill-typed boxed trait objects
    across heterogeneous const generics → repaired
  - ruvix-queue/benches/queue_bench.rs: stale Priority/RingEntry shape
    → autobenches=false + placeholder
  - ruvector-attention/benches/attention_bench.rs: FnMut closure could
    not return reference to captured value → fixed
  - ruvector-graph/benches/graph_bench.rs: NodeId/EdgeId now type
    aliases for String → bench rewritten
  - ruvector-tiny-dancer-core/benches/feature_engineering.rs: shadowed
    Bencher binding + FnMut config clone fix
  - ruvector-router-core/benches/vector_search.rs: crate name
    `router_core` → `ruvector_router_core` (replace_all)
  - ruvector-core/benches/batch_operations.rs: DbOptions import path
  - ruvector-mincut-wasm/src/lib.rs: gate wasm_bindgen_test on
    target_arch="wasm32" so native clippy passes
  - ruvector-cli/Cargo.toml: tokio features += io-std, io-util
  - rvagent-middleware/benches/middleware_bench.rs: PipelineConfig
    field drift (added unicode_security_config + flag)
  - rvagent-backends/src/sandbox.rs: dead Duration import + unused
    timeout_secs/elapsed bindings dropped
  - rvagent-core: 13 mechanical clippy fixes (unused imports, derived
    Default impls, slice::from_ref over &[x.clone()], etc.)
  - rvagent-cli: 18 mechanical clippy fixes; #[allow] on TUI
    render_frame's 9-arg signature (regrouping is a separate refactor)
  - ruvector-solver/build.rs: map_or(false, ..) → is_ok_and(..)

cargo fmt --all applied workspace-wide. No formatting drift remaining.

Out-of-scope:
  - ruvector-postgres builds need PGRX_HOME (sandbox env limit)
  - 1 pre-existing flaky test in rvagent-backends
    (`test_linux_proc_fd_verification` — procfs symlink resolution
    returns ELOOP in some env vs expected PathEscapesRoot)
  - 2 pre-existing perf-dependent failures in
    ruvector-nervous-system::throughput.rs (HDC throughput on slower
    machines)

Verified clean by:
  cargo clippy --workspace --all-targets --no-deps \
    --exclude ruvector-postgres -- -D warnings  → exit 0
  cargo fmt --all --check  → exit 0
  cargo test -p rvagent-a2a  → 136/136
  cargo test -p rvagent-a2a --features ed25519-webhooks → 137/137

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-25 17:00:20 -04:00
..
pkg chore: Update graph transformer NAPI-RS binaries for all platforms 2026-02-27 16:36:04 +00:00
src fix: format all files, add EXO crate READMEs, convert path deps to version deps 2026-02-27 16:21:14 +00:00
tests fix: format all files, add EXO crate READMEs, convert path deps to version deps 2026-02-27 16:21:14 +00:00
Cargo.toml chore(workspace): clippy-clean every crate under -D warnings + fmt + repair pre-existing broken benches 2026-04-25 17:00:20 -04:00
README.md feat: proof-gated graph transformer with 8 verified modules 2026-02-25 14:24:53 +00:00

ruvector-graph-transformer-wasm

Crates.io License: MIT

WebAssembly bindings for RuVector Graph Transformer — proof-gated graph attention, verified training, and 8 specialized graph layers running client-side in the browser.

Run the full graph transformer in any browser tab — no server, no API calls, no data leaving the device. Every graph mutation is formally verified client-side, so your users get the same mathematical safety guarantees as the Rust version. The WASM binary is size-optimized and loads in milliseconds.

Install

# With wasm-pack (recommended)
wasm-pack build crates/ruvector-graph-transformer-wasm --target web

# Or from npm (when published)
npm install ruvector-graph-transformer-wasm

Quick Start

import init, { JsGraphTransformer } from "ruvector-graph-transformer-wasm";

await init();
const gt = new JsGraphTransformer();
console.log(gt.version()); // "2.0.4"

// Proof-gated mutation
const gate = gt.create_proof_gate(128);
const proof = gt.prove_dimension(128, 128);
console.log(proof.verified); // true

// 82-byte attestation for RVF witness chains
const attestation = gt.create_attestation(proof.proof_id);
console.log(attestation.length); // 82

// Sublinear attention — O(n log n)
const result = gt.sublinear_attention(
  new Float32Array([0.1, 0.2, 0.3, 0.4]),
  [{ src: 0, tgt: 1 }, { src: 0, tgt: 2 }],
  4, 2
);

// Verified training step with certificate
const step = gt.verified_training_step(
  [1.0, 2.0], [0.1, 0.2], 0.01
);
console.log(step.weights, step.certificate);

// Physics: symplectic integration
const state = gt.hamiltonian_step([1.0, 0.0], [0.0, 1.0], 0.01);
console.log(state.energy);

// Biological: spiking attention
const spikes = gt.spiking_attention(
  [0.5, 1.5, 0.3], [[1], [0, 2], [1]], 1.0
);

// Manifold: mixed-curvature distance
const d = gt.product_manifold_distance(
  [1, 0, 0, 1], [0, 1, 1, 0], [0.0, -1.0]
);

// Temporal: causal masking
const scores = gt.causal_attention(
  [1.0, 0.0],
  [[1.0, 0.0], [0.0, 1.0]],
  [1.0, 2.0]
);

// Economic: Nash equilibrium
const nash = gt.game_theoretic_attention(
  [1.0, 0.5, 0.8],
  [{ src: 0, tgt: 1 }, { src: 1, tgt: 2 }]
);
console.log(nash.converged);

// Stats
console.log(gt.stats());

API

Proof-Gated Operations

Method Returns Description
new JsGraphTransformer(config?) JsGraphTransformer Create transformer instance
version() string Crate version
create_proof_gate(dim) object Create proof gate for dimension
prove_dimension(expected, actual) object Prove dimension equality
create_attestation(proof_id) Uint8Array 82-byte proof attestation
verify_attestation(bytes) boolean Verify attestation from bytes
compose_proofs(stages) object Type-checked pipeline composition

Sublinear Attention

Method Returns Description
sublinear_attention(q, edges, dim, k) object Graph-sparse top-k attention
ppr_scores(source, adj, alpha) Float64Array Personalized PageRank scores

Physics-Informed

Method Returns Description
hamiltonian_step(positions, momenta, dt) object Symplectic leapfrog step
verify_energy_conservation(before, after, tol) object Energy conservation proof

Biological

Method Returns Description
spiking_attention(spikes, edges, threshold) Float64Array Event-driven spiking attention
hebbian_update(pre, post, weights, lr) Float64Array Hebbian weight update
spiking_step(features, adjacency) object Full spiking step over feature matrix

Verified Training

Method Returns Description
verified_step(weights, gradients, lr) object SGD step + proof receipt
verified_training_step(features, targets, weights) object Training step + certificate

Manifold

Method Returns Description
product_manifold_distance(a, b, curvatures) number Mixed-curvature distance
product_manifold_attention(features, edges) object Product manifold attention

Temporal-Causal

Method Returns Description
causal_attention(query, keys, timestamps) Float64Array Temporally masked attention
causal_attention_graph(features, timestamps, edges) Float64Array Causal graph attention
granger_extract(history, num_nodes, num_steps) object Granger causality DAG

Economic

Method Returns Description
game_theoretic_attention(features, edges) object Nash equilibrium attention

Meta

Method Returns Description
stats() object Aggregate proof/attestation statistics
reset() void Reset all internal state

Building

# Web target (recommended for browsers)
wasm-pack build crates/ruvector-graph-transformer-wasm --target web

# Node.js target
wasm-pack build crates/ruvector-graph-transformer-wasm --target nodejs

# Cargo check
cargo check -p ruvector-graph-transformer-wasm

Bundle Size

The WASM binary is optimized for size with opt-level = "s", LTO, and single codegen unit.

Package Description
ruvector-graph-transformer Core Rust crate (186 tests)
@ruvector/graph-transformer Node.js NAPI-RS bindings
ruvector-verified-wasm Formal verification WASM bindings

License

MIT