# bext-plugin-wasm

**WASM plugin runtime for bext — wasmtime-based sandboxed host for untrusted plugin code.**

Part of the [bext](https://github.com/bext-stack/bext) stack.

```toml
[dependencies]
bext-plugin-wasm = "0.2"
```

## What this crate is

`bext-plugin-wasm` is one of three sandbox hosts for
[`bext-plugin-api`](https://crates.io/crates/bext-plugin-api). It runs
plugins compiled to WebAssembly inside a wasmtime sandbox, with fuel budgets
for CPU limits, memory caps, and a set of curated host functions.

## Features

- **wasmtime** runtime, memory-safe, no JIT escape.
- **Fuel budgets** — bound per-request CPU time in instruction counts.
- **Host functions** — KV store, durable queue, HTTP fetch (behind feature flag), signing, hashing.
- **Module caching** — compile once per plugin, reuse across requests.

## Feature flags

```toml
[dependencies]
bext-plugin-wasm = { version = "0.2", features = ["wasmtime-runtime", "http-client"] }
```

- `wasmtime-runtime` — enable the full wasmtime engine (default off, because
  wasmtime is a heavy dep)
- `http-client` — enable the `http-fetch` host function (ureq-based)

## License

MIT.

## See also

- [github.com/bext-stack/bext](https://github.com/bext-stack/bext) — the bext meta repo
- [Full ecosystem](https://github.com/bext-stack/bext#ecosystem-at-a-glance) — all bext crates at a glance
