Files
ruvnet--RuView/v2/crates/homecore-plugin-example/Cargo.toml
T
ruv 424721fa16 feat(homecore-plugins/p2): Wasmtime runtime + example WASM plugin (resolves ADR-128 Q2)
- Implements WasmtimeRuntime in v2/crates/homecore-plugins/src/wasmtime_runtime.rs
  with a Wasmtime 25 Cranelift JIT engine. Registers 4 host imports via Linker:
  hc_state_get, hc_state_set, hc_state_subscribe, hc_log. Each plugin gets an
  isolated Store<PluginStoreData> holding a HomeCore handle + subscription list.

- Adds host_abi.rs documenting the JSON-over-linear-memory wire format (public
  ABI spec for plugin authors). Max buffer 64 KiB. ConfigEntryJson and
  StateChangedEventJson are the canonical wire types.

- Creates v2/crates/homecore-plugin-example/ (wasm32-unknown-unknown, excluded
  from workspace per wifi-densepose-wasm-edge pattern). The plugin monitors
  sensor.test_temp and sets binary_sensor.test_alert on/off at 25/20 thresholds.

- Adds tests/integration.rs with 3 tests: compiled .wasm end-to-end round-trip,
  WAT-based fallback (always runs), and linker smoke test. All 15 tests pass
  (12 unit + 3 integration) under --features wasmtime.

- ADR-128 Q2 resolved: Wasmtime is the chosen runtime for P2. WASM3 stays as
  future fallback under --features wasm3 for constrained hardware (ADR-128 §8).

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-05-25 19:04:31 -04:00

40 lines
1.3 KiB
TOML

# homecore-plugin-example — example WASM plugin proving the ADR-128 host ABI.
#
# This crate targets wasm32-unknown-unknown and compiles to a `.wasm` binary
# that is loaded by the `homecore-plugins` integration test. It is NOT a
# workspace member (excluded below) because wasm32 targets cannot participate
# in a mixed host/device workspace `cargo test --workspace`.
#
# Build with:
# rustup target add wasm32-unknown-unknown
# cargo build --target wasm32-unknown-unknown --release -p homecore-plugin-example
#
# The compiled binary lands at:
# target/wasm32-unknown-unknown/release/homecore_plugin_example.wasm
[package]
name = "homecore-plugin-example"
version = "0.1.0-alpha.0"
edition = "2021"
license = "MIT"
authors = ["rUv <ruv@ruv.net>", "HOMECORE Contributors"]
description = "Example WASM plugin for HOMECORE — proves the ADR-128 P2 host ABI (guest side)"
repository = "https://github.com/ruvnet/RuView"
# Compile as a dynamic library so the WASM host can `Module::new` the bytes.
[lib]
name = "homecore_plugin_example"
crate-type = ["cdylib"]
path = "src/lib.rs"
[dependencies]
# No external dependencies — the plugin uses only std + manual JSON parsing.
# Real plugins would pull in serde/serde_json for complex payloads.
[profile.release]
# Minimise binary size for WASM.
opt-level = "s"
lto = true
codegen-units = 1
panic = "abort"