Create a Rust WASM Extension for Nyno
You can build Nyno compatible WASM extensions with Rust by using the plugin_sdk which is included in our core project folder.
Prerequisites:
rustup install 1.92.0
rustup default 1.92.0
rustup target add wasm32-unknown-unknown
Rust Code
Example extensions/your-extension/src/lib.rs:
use rmpv::Value;
use plugin_sdk::{NynoPlugin, export_plugin};
#[derive(Default)]
pub struct NynoPrimes;
impl NynoPlugin for NynoPrimes {
fn run(&self, args: Value, context: &mut Value) -> i32 {
// Get limit from args[0]
let limit = match args {
Value::Array(v) if !v.is_empty() => v[0].as_i64().unwrap_or(0),
_ => 0,
};
if limit < 2 {
if let Value::Map(map) = context {
map.push((
Value::String("prev_error".into()),
Value::String("invalid input".into()),
));
}
return 1;
}
let mut primes = Vec::new();
for n in 2..=limit {
let mut prime = true;
for i in 2..=((n as f64).sqrt() as i64) {
if n % i == 0 {
prime = false;
break;
}
}
if prime {
primes.push(Value::Integer(n.into()));
}
}
if let Value::Map(map) = context {
map.push((
Value::String("prev".into()),
Value::Array(primes),
));
}
0
}
}
export_plugin!(NynoPrimes);
Dependencies
Example Cargo.toml:
[package]
name = "example_plugin"
version = "0.1.0"
edition = "2024"
[lib]
name = "plugin2"
crate-type = ["cdylib"]
[dependencies]
plugin_sdk = { path = "../plugin_sdk" }
serde = { version = "1", features = ["derive"] }
rmpv = { version = "1", features = ["with-serde"] }
rmp-serde = "1"
Build Script
cargo build --release --target wasm32-unknown-unknown
Deployment
- Make sure your wasm file is placed in the root of your extension folder like:
extensions/your-extension/command.wasm - Optionally: also add a template.yaml file, so your extension shows up in the GUI builder.
Got it — here’s a tighter version focused only on GUI compatibility / loading:
Making an Extension Appear in the GUI
For an extension to be detected and loaded in the GUI (search/loader), it must include a minimal set of correctly named files.
If any of these are missing or misnamed, the extension will not show up at all.
Required Files
template.yml (mandatory)
-
This file is what makes the extension discoverable by the GUI.
-
Must be named exactly:
template.yml- Use hyphens (
-), not underscores (_)
- Use hyphens (
Example:
- step: ai-mistral-embeddings
args:
- '${prev}'
label.txt (optional)
-
Defines the name shown in the GUI.
-
Must start with a colored circle emoji to indicate category:
- 🟢 Common / easy
- 🔵 More advanced
- 🟣 Rare / highly specific
Example:
🔵 Generate 1024-dimension vector from text for search
Icon (optional: pick one)
You must include one of:
icon.webp→ custom icon oremoji.txt→ contains exactly one emoji
Example Directory Structure
your-extension/
├── command.wasm
├── template.yml
├── label.txt
└── (icon.webp OR emoji.txt)