Extension API
Tensormorph plugins are built against a versioned application binary interface, tm-plugin/1, rather than an unversioned or implicit API surface - a plugin declares which ABI version it targets, and Tensormorph can refuse to load a plugin built against an incompatible one instead of failing unpredictably at runtime.
Two execution paths
Plugins run in one of two ways: sandboxed WASM for untrusted or portable plugins, or a signed native path for plugins that need direct CUDA/ROCm access WASM can't provide. Both implement the same core traits - a plugin author targets a trait, not a specific execution path, and the choice of WASM vs. native is a packaging decision, not a rewrite.
The WASM path is the default assumption for a plugin you didn't write yourself - sandboxed execution means a third-party plugin can't do anything beyond what its declared trait implementations allow, regardless of what its code actually contains. The native path exists specifically because some workloads (custom CUDA kernels, for instance) can't run inside a WASM sandbox at all, and requires a signature Tensormorph can verify before granting it broader access.
Core traits
Every plugin implements one or more of three core traits, matching the three extension points documented elsewhere in this section:
| Trait | Extends | See |
|---|---|---|
ModelAdapter | Recognizing a new architecture's structure | Custom Tensor Adapters |
RuntimeProbe | Supplying live runtime data from a new source | Runtime Traces |
TensorMetric | Adding a new computed statistic or shading mode | Visualization API |
A single plugin can implement more than one trait - a plugin adding support for a new serving framework, for instance, might implement both a ModelAdapter (to recognize its checkpoint format) and a RuntimeProbe (to observe it live).
Declarative manifest vs. imperative code
Like VS Code's extension model, a Tensormorph plugin separates what it declares (which traits it implements, which file formats or architectures it claims to handle) from its imperative implementation - Tensormorph reads the manifest to decide whether and when to load a plugin at all, without running any of its code until it's actually needed for a matching format or architecture.
Related resources
- Plugin Development - the practical workflow for building and testing a plugin.
- Custom Tensor Adapters - the
ModelAdaptertrait in depth. - File Format API - registering a new checkpoint format importer.