Expand description
ECS-safe host bindings for Fusabi plugins
This module provides host bindings that allow Fusabi-powered plugins to interact with Scarab’s ECS (Bevy) architecture without direct World access. All interactions go through message passing and the plugin host system.
§Architecture
Plugins communicate via PluginAction events which are processed by the client’s
plugin host system. This provides:
- Safety: No direct ECS/World mutation from plugin code
- Sandboxing: Per-plugin capability flags and quotas
- Rate limiting: Protection against runaway plugins
§Example (Fusabi Script)
module MyPlugin
open Scarab.Host
[<OnLoad>]
let onLoad (ctx: PluginContext) =
// Register a focusable region
Host.registerFocusable ctx {
X = 10us
Y = 5us
Width = 20us
Height = 1us
Label = "Click me"
Action = OpenUrl "https://example.com"
}
// Enter hint mode
Host.enterHintMode ctx§Safety Constraints
All host bindings enforce safety constraints:
| Constraint | Default | Description |
|---|---|---|
max_focusables | 50 | Max focusables per plugin |
max_overlays | 10 | Max overlays per plugin |
max_status_items | 5 | Max status bar items per plugin |
rate_limit | 10/sec | Actions per second |
bounds_check | enabled | Coordinate validation |
See HostBindingLimits for configuration.
Structs§
- Host
Binding Limits - Configuration limits for host bindings
- Host
Bindings - ECS-safe host bindings for Fusabi plugins
- Plugin
Rate Limiter - Rate limiter state for a single plugin
- Resource
Counter - Resource counter for tracking plugin resource usage
- Resource
Usage - Current resource usage snapshot
Enums§
Constants§
- DEFAULT_
MAX_ FOCUSABLES - Default maximum focusables per plugin
- DEFAULT_
MAX_ OVERLAYS - Default maximum overlays per plugin
- DEFAULT_
MAX_ STATUS_ ITEMS - Default maximum status items per plugin
- DEFAULT_
RATE_ LIMIT - Default rate limit (actions per second)