Expand description
WASM Plugin Runtime Module
Provides WebAssembly-based plugin execution for MoFA:
- Sandboxed plugin execution
- Host function interface for plugins
- Memory-safe communication between host and guest
- Resource limits and security controls
- Async plugin execution support
§Architecture
┌─────────────────────────────────────────────────────────────┐
│ Host (MoFA) │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ WasmPluginRuntime │ │
│ │ ┌────────────┐ ┌────────────┐ ┌────────────┐ │ │
│ │ │ Engine │ │ Linker │ │ Store │ │ │
│ │ └────────────┘ └────────────┘ └────────────┘ │ │
│ └──────────────────────────────────────────────────────┘ │
│ │ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ Host Functions │ │
│ │ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │ │
│ │ │ log │ │ get_ │ │ send_ │ │ call_ │ │ │
│ │ │ │ │ config │ │ message│ │ tool │ │ │
│ │ └────────┘ └────────┘ └────────┘ └────────┘ │ │
│ └──────────────────────────────────────────────────────┘ │
│ │ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ WASM Sandbox │ │
│ │ ┌─────────────────────────────────────────────┐ │ │
│ │ │ Plugin Instance │ │ │
│ │ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │ │
│ │ │ │ Memory │ │ Exports │ │ Imports │ │ │ │
│ │ │ └─────────┘ └─────────┘ └─────────┘ │ │ │
│ │ └─────────────────────────────────────────────┘ │ │
│ └──────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘Re-exports§
pub use runtime::CompiledModule;pub use runtime::ModuleCache;pub use runtime::RuntimeConfig;pub use runtime::RuntimeStats;pub use runtime::WasmRuntime;
Modules§
- runtime
- WASM Runtime Core
Structs§
- Execution
Config - Execution configuration
- Guest
Ptr - Guest pointer type (32-bit address in WASM linear memory)
- Guest
Slice - Guest slice (pointer + length)
- Host
Context - Host context provided to plugins
- Loaded
Plugin - Loaded plugin information
- Memory
Allocator - Memory allocator for managing guest memory
- Memory
Config - Memory configuration
- Memory
Region - Memory region descriptor
- Plugin
Export - Plugin export definition
- Plugin
Handle - Plugin handle for external reference
- Plugin
Instance - Plugin instance wrapping wasmtime Instance
- Plugin
Manifest - Plugin manifest describing the plugin
- Plugin
Metrics - Plugin execution metrics
- Plugin
Registry - Plugin registry for tracking loaded plugins
- Resource
Limits - Resource limits for WASM execution
- Shared
Memory Buffer - Shared memory buffer for inter-module communication
- Wasm
Memory - WASM memory abstraction
- Wasm
Plugin - WASM Plugin
- Wasm
Plugin Config - WASM plugin configuration
- Wasm
Plugin Manager - WASM Plugin Manager
Enums§
- LogLevel
- Log level for plugin logging
- Message
Direction - Message direction
- Plugin
Capability - Plugin capabilities
- Plugin
Event - Plugin event
- Wasm
Error - WASM runtime errors
- Wasm
Plugin State - WASM plugin state
- Wasm
Type - WASM type definitions
- Wasm
Value - WASM value types
Traits§
- Host
Functions - Host functions interface that plugins can call
Type Aliases§
- Host
Callback - Host callback for custom functions
- Wasm
Result - WASM result type