Expand description
Per-plugin rhai::Engine factory.
Builds a Rhai engine configured for the framework’s sandbox model:
- Eval disabled at the symbol level so scripts cannot smuggle in dynamic code generation.
- Module resolver replaced with a deny-all stub so
importalways fails. Modules can only be made available through host-registered Rhai packages (none are exposed in v1). - Resource limits wired from the effective
CapabilitySet:Capability::FuelPerCall(N)→Engine::set_max_operations(N);Capability::MemoryBytes(N)→ conservative caps on string / array / map sizes (full memory accounting is M10’s broader work). - Capability-gated host fns registered conditionally — fns whose
required_capabilityis not in the effective set are simply not registered, and the script fails at parse-resolution withErrorFunctionNotFound. This is the in-host analogue of CM’s linker-absence guarantee (proposal §10.2).
Constants§
- DEFAULT_
MAX_ CALL_ LEVELS - Default maximum recursion depth for Rhai scripts. Overridable by
scripts via the loader’s per-plugin engine configuration; future:
expose a
Capability::MaxCallLevels(N)so plugins can request more. - DEFAULT_
MAX_ OPERATIONS - Default Rhai operation-limit floor applied to every engine.
Functions§
- build_
engine - Build a Rhai engine pre-configured for a single plugin’s effective capability set.