feat(plugins): enforce runtime limits and add echo plugin example

This commit is contained in:
xj
2026-02-21 22:20:53 -08:00
committed by argenis de la rosa
parent 6091553d12
commit 9b0aa53adf
6 changed files with 190 additions and 12 deletions
+40
View File
@@ -0,0 +1,40 @@
# Echo Plugin Example
This folder contains a minimal plugin manifest and a WAT template matching the current host ABI.
Files:
- `echo.plugin.toml` - plugin declaration loaded by ZeroClaw
- `echo.wat` - sample WASM text source
## Build
Convert WAT to WASM with `wat2wasm`:
```bash
wat2wasm examples/plugins/echo/echo.wat -o examples/plugins/echo/echo.wasm
```
## Enable in config
```toml
[plugins]
enabled = true
dirs = ["examples/plugins/echo"]
hot_reload = true
```
## ABI exports required
- `memory`
- `alloc(i32) -> i32`
- `dealloc(i32, i32)`
- `zeroclaw_tool_execute(i32, i32) -> i64`
- `zeroclaw_provider_chat(i32, i32) -> i64`
The `i64` return packs output pointer/length:
- high 32 bits: pointer
- low 32 bits: length
Input/output payloads are UTF-8 JSON.
Note: this example intentionally keeps logic minimal and is not production-safe.