What is a WASM capability in Traverse?
A WASM capability is a unit of business logic compiled to WebAssembly, governed by a contract that specifies exactly how it can be called, where it can run, and what it guarantees.
The key word is "governed." Any function can be compiled to WASM. What makes a Traverse capability different is that its contract is machine-readable and actively enforced at runtime. The runtime will not execute a capability if the contract conditions are not met.
What a capability contains
Every capability is two things bound together: a WASM binary and a contract.
The WASM binary is the logic. It takes structured inputs, does something deterministic, and produces structured outputs. It runs in a sandboxed WASM environment with no filesystem access and no network access by default. Those constraints are declared in the contract and enforced by the runtime.
The contract defines:
- Inputs schema — what fields are required, their types, and their valid ranges
- Outputs schema — what the capability returns and its structure
- Preconditions — what must be true about the inputs before execution proceeds
- Postconditions — what the output is guaranteed to satisfy after execution
- Placement targets — which environments the capability supports (browser, edge, local, cloud)
- Constraints — sandbox rules such as no-network, no-filesystem, or memory limits
Determinism is the point
A WASM binary is deterministic. Give it the same inputs and it produces the same output every time, regardless of the host machine or environment. This is not true of a microservice or a serverless function, which depend on network calls, environment variables, databases, and other external state.
For business logic, determinism matters. A pricing capability that behaves differently in the browser than in the cloud is a bug. Traverse makes that class of bug structurally impossible.
How it differs from a microservice
A microservice is environment-specific. It runs in one place, it is deployed to infrastructure, and calling it means making a network request. Moving it to a different environment requires redeployment and often significant changes to infrastructure configuration.
A Traverse capability runs wherever the runtime runs. No redeployment for each environment. No network request to your own logic. The same .wasm file loaded by the browser adapter runs locally, and the same file will run on an edge node or cloud function when those adapters are available.
The expedition example
The expedition planning demo ships with 6 capabilities: destination validation, equipment planning, weather assessment, route calculation, cost estimation, and safety review. Each is a separate WASM module with its own contract. They are composed into a workflow by the runtime. You can inspect all of them with cargo run -p traverse-cli -- bundle inspect.