Skip to main content

Crate homecore_plugins

Crate homecore_plugins 

Source
Expand description

HOMECORE-PLUGINS — WASM integration plugin system.

Implements ADR-128 P1 scaffold: manifest parsing, the HomeCorePlugin async trait, the PluginRuntime abstraction, and the PluginRegistry.

§What’s here (P1)

  • manifestPluginManifest: superset of HA manifest.json; serde round-trip + required-field validation.
  • pluginHomeCorePlugin async trait, PluginId newtype.
  • runtimePluginRuntime trait + InProcessRuntime (native Rust, first-party plugins compiled into the binary).
  • registryPluginRegistry<R>: load / unload / list plugins.
  • errorPluginError typed error enum.

§Runtime scope

  • WasmtimeRuntime (--features wasmtime) provides the Cranelift sandbox.
  • Native Rust plugins are compiled into the server; arbitrary native dynamic libraries are not loaded.
  • The host ABI is deliberately narrow and resource-bounded.

§Now enforced (ADR-162)

  • Ed25519 signature + SHA-256 integrity verification (P4) — see verify: the plugin load path hashes the real .wasm bytes, checks the manifest wasm_module_hash, verifies wasm_module_sig against publisher_key, and enforces a verify::PluginPolicy allowlist.
  • Permission / authority isolation (P5) — see permissions: a plugin’s hc_state_set writes are gated against the entity domains/ globs it declared in homecore_permissions.

§Feature flags

FeatureDefaultDescription
wasmtimeoffWasmtime Cranelift JIT runtime (P2)

Re-exports§

pub use error::PluginError;
pub use discovery::discover_plugins;
pub use discovery::DiscoveredPlugin;
pub use discovery::DiscoveryLimits;
pub use host_abi::ConfigEntryJson;
pub use host_abi::StateChangedEventJson;
pub use manifest::IotClass;
pub use manifest::IntegrationType;
pub use manifest::PluginManifest;
pub use permissions::PermissionSet;
pub use plugin::HomeCorePlugin;
pub use plugin::PluginId;
pub use registry::PluginRegistry;
pub use runtime::InProcessRuntime;
pub use runtime::LoadedPlugin;
pub use runtime::PluginRuntime;
pub use verify::verify_module;
pub use verify::PluginPolicy;

Modules§

discovery
Secure filesystem discovery for packaged WASM plugins.
error
PluginError — typed error enum for the homecore-plugins crate.
host_abi
Host ABI — the public on-the-wire memory format between the HOMECORE host and every WASM plugin.
manifest
Plugin manifest — superset of HA’s manifest.json.
permissions
Plugin authority / capability isolation (ADR-162, P5).
plugin
HomeCorePlugin trait + PluginId newtype.
registry
PluginRegistry — load, unload, and list HOMECORE plugins.
runtime
PluginRuntime trait + InProcessRuntime (P1).
verify
Plugin signature & integrity verification (ADR-162, P4).