mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-25 15:03:46 +00:00
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>
|
||
|---|---|---|
| .. | ||
| npm | ||
| src | ||
| build.rs | ||
| Cargo.toml | ||
| index.d.ts | ||
| index.js | ||
| package.json | ||
| README.md | ||
@ruvector/graph-transformer
Node.js bindings for RuVector Graph Transformer — proof-gated graph attention, verified training, and 8 specialized graph layers via NAPI-RS.
Use graph transformers from JavaScript and TypeScript with native Rust performance. Every graph operation — adding nodes, computing attention, training weights — produces a formal proof receipt proving it was done correctly. The heavy computation runs in compiled Rust via NAPI-RS, so you get sub-millisecond proof verification without leaving the Node.js ecosystem.
Install
npm install @ruvector/graph-transformer
Prebuilt binaries are provided for:
| Platform | Architecture | Package |
|---|---|---|
| Linux | x64 (glibc) | @ruvector/graph-transformer-linux-x64-gnu |
| Linux | x64 (musl) | @ruvector/graph-transformer-linux-x64-musl |
| Linux | ARM64 (glibc) | @ruvector/graph-transformer-linux-arm64-gnu |
| macOS | x64 (Intel) | @ruvector/graph-transformer-darwin-x64 |
| macOS | ARM64 (Apple Silicon) | @ruvector/graph-transformer-darwin-arm64 |
| Windows | x64 | @ruvector/graph-transformer-win32-x64-msvc |
Quick Start
const { GraphTransformer } = require('@ruvector/graph-transformer');
const gt = new GraphTransformer();
console.log(gt.version()); // "2.0.4"
// Proof-gated mutation
const gate = gt.createProofGate(128);
console.log(gate.dimension); // 128
// Prove dimension equality
const proof = gt.proveDimension(128, 128);
console.log(proof.verified); // true
// Create attestation (82-byte proof receipt)
const attestation = gt.createAttestation(proof.proof_id);
console.log(attestation.length); // 82
API Reference
Proof-Gated Operations
// Create a proof gate for a dimension
const gate = gt.createProofGate(dim);
// Prove two dimensions are equal
const proof = gt.proveDimension(expected, actual);
// Create 82-byte attestation for embedding in RVF witness chains
const bytes = gt.createAttestation(proofId);
// Verify attestation from bytes
const valid = gt.verifyAttestation(bytes);
// Compose a pipeline of type-checked stages
const composed = gt.composeProofs([
{ name: 'embed', input_type_id: 1, output_type_id: 2 },
{ name: 'align', input_type_id: 2, output_type_id: 3 },
]);
Sublinear Attention
// O(n log n) graph attention via PPR sparsification
const result = gt.sublinearAttention(
[1.0, 0.5, -0.3], // query vector
[[1, 2], [0, 2], [0, 1]], // adjacency list
3, // dimension
2 // top-k
);
console.log(result.top_k_indices, result.sparsity_ratio);
// Raw PPR scores
const scores = gt.pprScores(0, [[1], [0, 2], [1]], 0.15);
Physics-Informed Layers
// Symplectic leapfrog step (energy-conserving)
const state = gt.hamiltonianStep([1.0, 0.0], [0.0, 1.0], 0.01);
console.log(state.energy);
// With graph interactions
const state2 = gt.hamiltonianStepGraph(
[1.0, 0.0], [0.0, 1.0],
[{ src: 0, tgt: 1 }], 0.01
);
console.log(state2.energy_conserved); // true
Biological Layers
// Spiking neural attention (event-driven)
const output = gt.spikingAttention(
[0.5, 1.5, 0.3], // membrane potentials
[[1], [0, 2], [1]], // adjacency
1.0 // firing threshold
);
// Hebbian weight update (Hebb's rule)
const weights = gt.hebbianUpdate(
[1.0, 0.0], // pre-synaptic
[0.0, 1.0], // post-synaptic
[0, 0, 0, 0], // current weights (flattened)
0.1 // learning rate
);
// Full spiking step over feature matrix
const result = gt.spikingStep(
[[0.8, 0.6], [0.1, 0.2]], // n x dim features
[0, 0.5, 0.3, 0] // flat adjacency (n x n)
);
Verified Training
// Single verified SGD step with proof receipt
const result = gt.verifiedStep(
[1.0, 2.0], // weights
[0.1, 0.2], // gradients
0.01 // learning rate
);
console.log(result.proof_id, result.loss_before, result.loss_after);
// Full training step with features and targets
const step = gt.verifiedTrainingStep(
[1.0, 2.0], // features
[0.5, 1.0], // targets
[0.5, 0.5] // weights
);
console.log(step.certificate_id, step.loss);
Manifold Operations
// Product manifold distance (mixed curvatures)
const d = gt.productManifoldDistance(
[1, 0, 0, 1], // point a
[0, 1, 1, 0], // point b
[0.0, -1.0] // curvatures (Euclidean, Hyperbolic)
);
// Product manifold attention
const result = gt.productManifoldAttention(
[1.0, 0.5, -0.3, 0.8],
[{ src: 0, tgt: 1 }]
);
Temporal-Causal Attention
// Causal attention (no future information leakage)
const scores = gt.causalAttention(
[1.0, 0.0], // query
[[1.0, 0.0], [0.0, 1.0], [0.5, 0.5]], // keys
[1.0, 2.0, 3.0] // timestamps
);
// Causal attention over graph
const output = gt.causalAttentionGraph(
[1.0, 0.5, 0.8], // node features
[1.0, 2.0, 3.0], // timestamps
[{ src: 0, tgt: 1 }, { src: 1, tgt: 2 }]
);
// Granger causality extraction
const dag = gt.grangerExtract(flatHistory, 3, 20);
console.log(dag.edges); // [{ source, target, f_statistic, is_causal }]
Economic / Game-Theoretic
// Nash equilibrium attention
const result = gt.gameTheoreticAttention(
[1.0, 0.5, 0.8], // utility values
[{ src: 0, tgt: 1 }, { src: 1, tgt: 2 }]
);
console.log(result.allocations, result.nash_gap, result.converged);
Stats & Control
// Aggregate statistics
const stats = gt.stats();
console.log(stats.proofs_verified, stats.attestations_created);
// Reset all internal state
gt.reset();
Building from Source
# Install NAPI-RS CLI
npm install -g @napi-rs/cli
# Build native module
cd crates/ruvector-graph-transformer-node
napi build --platform --release
# Run tests
cargo test -p ruvector-graph-transformer-node
Related Packages
| Package | Description |
|---|---|
ruvector-graph-transformer |
Core Rust crate |
ruvector-graph-transformer-wasm |
WASM bindings for browsers |
@ruvector/gnn |
Base GNN operations |
@ruvector/attention |
46 attention mechanisms |
License
MIT