Building Binaries
WASM command packages (type: "wasm-commands") ship compiled .wasm binaries that run inside the VM as guest commands. The binaries are build artifacts and are not checked into git, so to add or change a command you build it from source in the secure-exec registry.
Where it lives
Section titled “Where it lives”Command source and packages live under registry/ in secure-exec:
registry/native/crates/: the Rust source for the WASM commands.registry/native/c/: the C source for the WASM commands.registry/software/<name>/: the npm package for each command set (@agentos-software/<name>). It containsdist/(the TypeScript descriptor) andwasm/(the compiled binaries it exposes viacommandDir).
Build everything from registry/:
make build # build all WASM binaries + the TypeScript packagesmake copy-wasm # copy binaries into each package's wasm/ directorymake testcopy-wasm maps each compiled command into registry/software/<name>/wasm/, which is the commandDir the package exposes. The two toolchains build independently:
Most commands are Rust. The source lives in registry/native/crates/ and compiles for wasm32-wasip1 with the pinned nightly toolchain from rust-toolchain.toml (the build vendors and patches std for WASI). Build just the Rust commands:
make build-wasm-rust # runs: cd native && make wasmC-based commands (e.g. sqlite3, unzip, wget, zip) live in registry/native/c/ and compile with a wasi-sdk clang toolchain. Build just the C commands:
make build-wasm-c # runs: cd native/c && make programs && make installAdd a new command package
Section titled “Add a new command package”- Add the command source under
registry/native/crates/(Rust) orregistry/native/c/(C). - Create
registry/software/<name>/as an@agentos-software/<name>npm package that exports a descriptor with itscommandDir. - Add a copy rule to the
copy-wasmtarget mapping the built binary intoregistry/software/<name>/wasm/. - If it belongs in a meta-package (e.g.
commonorbuild-essential), add it there. - Verify with
make copy-wasm && make build && make test.
Let an agent build it
Section titled “Let an agent build it”This is a mechanical, well-scoped task, so you can hand it to a coding agent. A prompt like:
Add a WASM command package for `<command>` to the secure-exec registry:- put the Rust source under registry/native/crates/ (or C under registry/native/c/),- create registry/software/<command>/ as an @agentos-software/<command> npm package that exports a commandDir descriptor,- add a copy-wasm rule mapping the built binary into its wasm/ directory,then run `make copy-wasm && make build && make test` and fix any failures.Using the registry
Section titled “Using the registry”Install a published package and pass it to software. Registry WASM packages expose a commandDir, so you pass them directly (no defineSoftware() wrapper):
import { agentOS, setup } from "@rivet-dev/agentos";import coreutils from "@agentos-software/coreutils";import ripgrep from "@agentos-software/ripgrep";
const vm = agentOS({ software: [coreutils, ripgrep] });
export const registry = setup({ use: { vm } });registry.start();Meta-packages bundle a full set, e.g. @agentos-software/common (coreutils, sed, grep, gawk, findutils, diffutils, tar, gzip). Run the commands from the client; see Processes & Shell. Browse the full catalog on the Registry, and see how packages map onto the wasm-commands descriptor in Software Definition.