Expand description
WASM plugin runtime for Shaperail (M19).
Provides sandboxed execution of WebAssembly plugins as controller hooks. Plugins receive a JSON context and return a modified JSON context.
§Plugin Interface
WASM modules must export:
alloc(size: i32) -> i32— allocatesizebytes, return pointerdealloc(ptr: i32, size: i32)— free previously allocated memorybefore_hook(ptr: i32, len: i32) -> i64— process context, return(ptr << 32) | len
Optionally:
after_hook(ptr: i32, len: i32) -> i64— same interface, called after DB operation
§Sandboxing
By default, plugins have NO access to:
- Host filesystem
- Network
- Environment variables
- System clock
This is enforced by creating WASM instances without WASI capabilities.
Structs§
- Plugin
Context - JSON context passed to WASM plugins, matching the controller
Contextshape. - Plugin
Result - Result returned from a WASM plugin hook.
- Plugin
User - Minimal user info passed to WASM plugins.
- Sandbox
Config - Configuration for plugin sandboxing.
- Wasm
Runtime - Runtime for executing WASM plugins with sandboxing.