Skip to main content

Module host_bindings

Module host_bindings 

Source
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:

ConstraintDefaultDescription
max_focusables50Max focusables per plugin
max_overlays10Max overlays per plugin
max_status_items5Max status bar items per plugin
rate_limit10/secActions per second
bounds_checkenabledCoordinate validation

See HostBindingLimits for configuration.

Structs§

HostBindingLimits
Configuration limits for host bindings
HostBindings
ECS-safe host bindings for Fusabi plugins
PluginRateLimiter
Rate limiter state for a single plugin
ResourceCounter
Resource counter for tracking plugin resource usage
ResourceUsage
Current resource usage snapshot

Enums§

NavKeymap
Navigation keymap configuration
NavStyle
Navigation style configuration

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)