alternera_plugin_wasm_framework

Copy Markdown View Source

What a pipeline step in a scripting language needs, apart from the language: a WebAssembly runtime, the interface to a language's module, the step's settings, host calls and results, the memory limit, and a test kit. It holds no plugin. A language plugin is a package of its own that ships its interpreter as one .wasm file and delegates its callbacks to Alternera.PluginWasmFramework.Language.

It builds on alternera_plugin_sdk and alternera_plugin_editor and calls nothing of the proxy.

  • PluginWasmFramework.Runtime, Runtime.Wasmex, Runtime.Port: the runtime behaviour and its two implementations, a fresh instance per call: pooled OS processes of the host program in native/alternera_wasm_host/ (Rust, Wasmtime; the default), which mix alternera.wasm_host builds into priv/native/<target>/ and mix alternera.wasm_host --fetch downloads there from the package's release, checked against priv/native/checksums.term (docs/internals.adoc), or wasmex inside the node. ALTERNERA_WASM_RUNTIME=port or =wasmex picks one; unset, a node without the host program falls back to wasmex with a warning (Runtime.resolve/0);
  • PluginWasmFramework.Slots: the node's limit on guests running at once, started by the package's application;
  • PluginWasmFramework.Modules: compiled modules, once per node;
  • PluginWasmFramework.Frame, c_src/alternera_guest.h: the guest interface, version 0, from both sides;
  • PluginWasmFramework.Language: the step every language plugin runs;
  • PluginWasmFramework.HostCalls: the host calls, with secret-store reads marked by the SDK's Provisional.SecretReads;
  • PluginWasmFramework.MemoryLimit: the step's Memory limit setting;
  • PluginWasmFramework.Test: the contract a language plugin keeps.

test/ runs everything against a test guest written in C (test/guest/test_guest.c, built by test/guest/build.sh with wasi-sdk 34.0 into test/fixtures/test_guest.wasm), with no proxy around (mix test), on the port runtime when the host program is built and on wasmex when it is not; ALTERNERA_WASM_RUNTIME=port mix test or =wasmex names the runtime (CI runs both), and the port's own tests skip while the host program is not built. The internals chapter is docs/internals.adoc, included by the repository's docs/internals.adoc.

Licence

Licensed under the Apache License, Version 2.0 (LICENSE, NOTICE). Alternera itself, the proxy this package plugs into, is under the Elastic License 2.0.

The third-party software it bundles (the Rust crates compiled into alternera_wasm_host) is listed with its licences in priv/THIRD_PARTY_NOTICES.txt.