Morphir extension development reference
Morphir extensions provide frontends, backends, validators, and transforms through MEP JSON-RPC. The supported runtime kinds are process and wasm. WASM guests run through Extism and do not use WIT or the WebAssembly Component Model.
The host bounds each WASM guest to 256 MiB of linear memory, a 30-second and 100-million-instruction call budget, and 64 MiB MEP requests and responses. Discovery and invocation are isolated from Tokio runtime workers.
The extension and Avro release work is available for contributor testing but has not produced a public release.
SDK boundary
Implement Extension to report a stable identity and typed capabilities. A backend also implements Backend and receives the exact GenerateRequest { ir, options } operation. It returns diagnostics and artifacts with path, content, and binary fields.
Portable protocol types and extension traits compile for native and WASM targets. The Extism PDK, guest exports, and imported host functions compile only for wasm32. Keep domain logic in native Rust and use a thin guest adapter for the MEP dispatcher.
The in-tree morphir-avro-extension crate is the reference implementation.
Build and test
From the repository root:
cargo test -p morphir-extension-sdk
cargo test -p morphir-avro-extension
cargo build --release -p morphir-avro-extension --target wasm32-unknown-unknown
To create and validate the local Avro release bundle:
mise run extension:artifact:avro
This task creates a local bundle only. It does not create an index, tag, or public release.
Install for local testing
The CLI installs an extension ID from a controlled schema-versioned index. It does not install a raw WASM file, archive, URL, or directory.
morphir extension install --index <INDEX> <NAME>
morphir extension list
Use MORPHIR_HOME when a test needs isolated catalog, lock, and store state. The CLI has no --global install mode.
Release manifests in the index use the strict JSON string "schemaVersion": "1.0". Declaring frontend or backend in capabilities requires the matching metadata object. Installation writes separate extension lock and catalog formats, each with its own current "1.0" schema version. Each reader accepts supported minors of its current major from its minimum through its current minor, and rejects future minors and other majors. These distribution schema versions do not identify a Morphir IR version.
See the root repository’s Avro generation guide for a tested build, local index, install, and generation sequence.