Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-attention.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
- host: ubuntu-22.04
target: aarch64-unknown-linux-gnu
platform: linux-arm64-gnu
- host: macos-14
- host: macos-15
target: x86_64-apple-darwin
platform: darwin-x64
- host: macos-14
- host: macos-15
target: aarch64-apple-darwin
platform: darwin-arm64
- host: windows-2022
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-gnn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- host: macos-15-intel
target: x86_64-apple-darwin
platform: darwin-x64
- host: macos-14
- host: macos-15
target: aarch64-apple-darwin
platform: darwin-arm64
- host: windows-2022
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-graph-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ jobs:
- host: ubuntu-22.04
target: aarch64-unknown-linux-gnu
platform: linux-arm64-gnu
- host: macos-14
- host: macos-15
target: x86_64-apple-darwin
platform: darwin-x64
- host: macos-14
- host: macos-15
target: aarch64-apple-darwin
platform: darwin-arm64
- host: windows-2022
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ jobs:
target: aarch64-unknown-linux-gnu
build: npm run build:napi -- --target aarch64-unknown-linux-gnu
platform: linux-arm64-gnu
- host: macos-14
- host: macos-15
target: x86_64-apple-darwin
build: npm run build:napi -- --target x86_64-apple-darwin
platform: darwin-x64
- host: macos-14
- host: macos-15
target: aarch64-apple-darwin
build: npm run build:napi -- --target aarch64-apple-darwin
platform: darwin-arm64
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-rvf-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
- host: ubuntu-22.04
target: aarch64-unknown-linux-gnu
platform: linux-arm64-gnu
- host: macos-14
- host: macos-15
target: x86_64-apple-darwin
platform: darwin-x64
- host: macos-14
- host: macos-15
target: aarch64-apple-darwin
platform: darwin-arm64
- host: windows-2022
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/publish-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ on:
required: false
type: boolean
default: false
publish_wasm:
description: 'Also publish @ruvector/math-wasm and @ruvector/attention-wasm (skip for a native-only patch release)'
required: false
type: boolean
default: true

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -72,11 +77,11 @@ jobs:
target: aarch64-unknown-linux-gnu
platform: linux-arm64-gnu
node_file: attention.linux-arm64-gnu.node
- host: macos-14
- host: macos-15
target: x86_64-apple-darwin
platform: darwin-x64
node_file: attention.darwin-x64.node
- host: macos-14
- host: macos-15
target: aarch64-apple-darwin
platform: darwin-arm64
node_file: attention.darwin-arm64.node
Expand Down Expand Up @@ -300,6 +305,7 @@ jobs:

# --- Publish WASM packages ---
- name: Publish @ruvector/math-wasm to npm
if: ${{ inputs.publish_wasm != false }}
run: |
set -euo pipefail
cd artifacts/wasm-ruvector-math-wasm
Expand All @@ -310,6 +316,7 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish @ruvector/attention-wasm to npm
if: ${{ inputs.publish_wasm != false }}
run: |
set -euo pipefail
cd artifacts/wasm-ruvector-attention-wasm
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-rvf-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jobs:
ext: ''
cross: true
- target: x86_64-apple-darwin
os: macos-14
os: macos-15
name: rvf-darwin-x64
ext: ''
- target: aarch64-apple-darwin
os: macos-14
os: macos-15
name: rvf-darwin-arm64
ext: ''
- target: x86_64-pc-windows-msvc
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/sona-napi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ jobs:
node-file: sona.linux-arm64-gnu.node
# macOS x64 — cross-compiled on Apple Silicon (macos-13 Intel runners are retired;
# jobs requesting that label queue forever)
- os: macos-14
- os: macos-15
target: x86_64-apple-darwin
node-file: sona.darwin-x64.node
# macOS ARM64
- os: macos-14
- os: macos-15
target: aarch64-apple-darwin
node-file: sona.darwin-arm64.node
# Windows x64
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:

# Build universal macOS binary
universal-macos:
runs-on: macos-14
runs-on: macos-15
name: Universal macOS
needs: build

Expand Down Expand Up @@ -309,7 +309,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/sona-v')
strategy:
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
os: [ubuntu-latest, macos-15, windows-latest]

steps:
- name: Setup Node.js
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/ruvector-attention-node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ruvector-attention-node"
version.workspace = true
version = "2.3.1"
edition.workspace = true
authors.workspace = true
license.workspace = true
Expand All @@ -11,7 +11,7 @@ description = "Node.js bindings for ruvector-attention"
crate-type = ["cdylib"]

[dependencies]
ruvector-attention = { version = "2.0", path = "../ruvector-attention", default-features = false }
ruvector-attention = { version = "2.3.1", path = "../ruvector-attention", default-features = false }
napi = { version = "2", default-features = false, features = ["napi9", "async", "serde-json"] }
napi-derive = "2"
serde = { version = "1.0", features = ["derive"] }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ruvector/attention-darwin-arm64",
"version": "0.1.1",
"version": "2.2.3",
"os": [
"darwin"
],
Expand Down
4 changes: 2 additions & 2 deletions crates/ruvector-attention-node/npm/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ruvector/attention-darwin-x64",
"version": "0.1.4",
"version": "2.2.3",
"os": [
"darwin"
],
Expand All @@ -16,4 +16,4 @@
"node": ">= 10"
},
"repository": "https://github.com/ruvnet/ruvector"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ruvector/attention-linux-arm64-gnu",
"version": "0.1.1",
"version": "2.2.3",
"os": [
"linux"
],
Expand Down
4 changes: 2 additions & 2 deletions crates/ruvector-attention-node/npm/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ruvector/attention-linux-x64-gnu",
"version": "0.1.4",
"version": "2.2.3",
"os": [
"linux"
],
Expand All @@ -19,4 +19,4 @@
"glibc"
],
"repository": "https://github.com/ruvnet/ruvector"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ruvector/attention-linux-x64-musl",
"version": "0.1.0",
"version": "2.2.3",
"os": [
"linux"
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ruvector/attention-win32-arm64-msvc",
"version": "0.1.0",
"version": "2.2.3",
"os": [
"win32"
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ruvector/attention-win32-x64-msvc",
"version": "0.1.4",
"version": "2.2.3",
"os": [
"win32"
],
Expand All @@ -16,4 +16,4 @@
"node": ">= 10"
},
"repository": "https://github.com/ruvnet/ruvector"
}
}
14 changes: 7 additions & 7 deletions crates/ruvector-attention-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ruvector/attention",
"version": "0.1.4",
"version": "2.2.3",
"description": "High-performance attention mechanisms for Node.js",
"main": "index.js",
"types": "index.d.ts",
Expand Down Expand Up @@ -53,13 +53,13 @@
"access": "public"
},
"optionalDependencies": {
"@ruvector/attention-win32-x64-msvc": "0.1.4",
"@ruvector/attention-darwin-x64": "0.1.4",
"@ruvector/attention-darwin-arm64": "0.1.4",
"@ruvector/attention-linux-x64-gnu": "0.1.4",
"@ruvector/attention-linux-arm64-gnu": "0.1.4"
"@ruvector/attention-win32-x64-msvc": "2.2.3",
"@ruvector/attention-darwin-x64": "2.2.3",
"@ruvector/attention-darwin-arm64": "2.2.3",
"@ruvector/attention-linux-x64-gnu": "2.2.3",
"@ruvector/attention-linux-arm64-gnu": "2.2.3"
},
"devDependencies": {
"@napi-rs/cli": "^2.18.0"
}
}
}
24 changes: 13 additions & 11 deletions crates/ruvector-attention-node/src/async_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,31 +368,33 @@ impl StreamProcessor {
/// # Arguments
/// * `dim` - Embedding dimension
/// * `max_buffer_size` - Maximum number of items to buffer
#[napi(constructor)]
pub fn new(dim: u32, max_buffer_size: u32) -> Self {
Self {
dim: dim as usize,
#[napi(constructor, catch_unwind)]
pub fn new(dim: u32, max_buffer_size: u32) -> Result<Self> {
Ok(Self {
dim: crate::validate::dim("dim", dim)?,
buffer: Vec::new(),
max_buffer_size: max_buffer_size as usize,
}
})
}

/// Add a vector to the buffer
#[napi]
pub fn push(&mut self, vector: Float32Array) -> bool {
#[napi(catch_unwind)]
pub fn push(&mut self, vector: Float32Array) -> Result<bool> {
crate::validate::len("vector", vector.as_ref(), self.dim)?;
if self.buffer.len() >= self.max_buffer_size {
return false;
return Ok(false);
}
self.buffer.push(vector.to_vec());
true
Ok(true)
}

/// Process buffered vectors with attention against a query
#[napi]
#[napi(catch_unwind)]
pub fn process(&self, query: Float32Array) -> Result<Float32Array> {
if self.buffer.is_empty() {
return Err(Error::from_reason("Buffer is empty"));
}
crate::validate::len("query", query.as_ref(), self.dim)?;

let attention = ScaledDotProductAttention::new(self.dim);
let query_slice = query.as_ref();
Expand All @@ -407,7 +409,7 @@ impl StreamProcessor {
}

/// Clear the buffer
#[napi]
#[napi(catch_unwind)]
pub fn clear(&mut self) {
self.buffer.clear();
}
Expand Down
Loading
Loading