Plugin Architecture
The PRX plugin system is built on a WASM runtime that provides a secure, portable execution environment for third-party code. This page describes the technical architecture.
Runtime
PRX uses the Wasmtime runtime to execute WASM plugins. Each plugin instance runs in its own WASM store with isolated linear memory.
┌──────────────────────────────┐
│ PRX Host │
│ │
│ ┌────────────────────────┐ │
│ │ WASM Runtime │ │
│ │ ┌──────┐ ┌──────┐ │ │
│ │ │Plugin│ │Plugin│ │ │
│ │ │ A │ │ B │ │ │
│ │ └──┬───┘ └──┬───┘ │ │
│ │ │ │ │ │
│ │ Host Functions API │ │
│ └────────────────────────┘ │
└──────────────────────────────┘Host-Guest Boundary
Plugins communicate with the host through a defined set of host functions. The boundary enforces:
- Type safety -- all function parameters are validated
- Resource limits -- memory and CPU usage are capped
- Permission checks -- each host function call is authorized against the plugin's permission manifest
Memory Model
Each plugin has its own linear memory space (default 64 MB). Data is exchanged between host and guest through shared memory buffers with explicit serialization.
Plugin Lifecycle
- Load -- WASM binary is loaded and validated
- Initialize -- plugin's
init()function is called with configuration - Ready -- plugin registers its capabilities (tools, channels, etc.)
- Execute -- host invokes plugin functions as needed
- Shutdown -- plugin's
shutdown()function is called for cleanup