wasm-filters crate), you are writing the exact logic that an Agent will inject into remote Data Nodes.
Because this logic must be completely OS-agnostic and strictly sandboxed, you cannot compile it targeting standard architectures like x86_64 or arm64. It must be compiled to WebAssembly, explicitly targeting the WASI (WebAssembly System Interface) standard.
Setting up the Compiler Target
Ensure your Rust toolchain has the WASI standard library installed.NMP currently targets WASI Preview 1 (
wasm32-wasi). We are actively monitoring wasm32-wasip2 (The Component Model) and will migrate the Wasmtime engine to support strongly-typed complex objects crossing the engine boundary in our next release.Writing a Filter
A typical NMP Filter is standard Rust code, with the caveat that network and threading operations will panic if invoked, due to the Sandboxing constraints on the destination server.src/main.rs
Compilation
To compile your logic into the.wasm injection payload, run Cargo targeting the WASI architecture:
target/wasm32-wasi/release/filter.wasm) is what the nmp-client loads into memory and streams to the peer over the network.