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 serde_json::{Value, json};
use plugin_sdk::{NynoPlugin, export_plugin};
#[derive(Default)]
pub struct NynoIf;
impl NynoPlugin for NynoIf {
fn run(&self, args: Vec<Value>, context: &mut Value) -> i32 {
let set_name = context.get("set_context").and_then(|v| v.as_str()).unwrap_or("prev").to_string();
let result = if args.len() >= 3 {
let left = args[0].as_f64().unwrap_or(0.0);
let cond = args[1].as_str().unwrap_or("");
let right = args[2].as_f64().unwrap_or(0.0);
match cond {
"lower than" => left < right,
"higher than" => left > right,
"equal to" => (left - right).abs() < 1e-9,
_ => false,
}
} else {
false
};
context[set_name] = json!(result);
// Return 0 (left next node) or 1 (right next node)
if result { 1 } else { 0 }
}
}
export_plugin!(NynoIf);
Dependencies
Example Cargo.toml:
[package]
name = "example_plugin2"
version = "0.1.0"
edition = "2024"
[lib]
name = "plugin2"
crate-type = ["cdylib"]
[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
plugin_sdk = { path = "../../plugin_sdk" }
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)