K

Distributing devices

The two lives of a device, and what a bundle really is.

A device exists in one of two states, and the difference explains everything about how it's shared.

Draft and bundle

A draft is a device you're building: a folder of source in your library that Msh compiles. Save a file and it recompiles and swaps in live, knob values intact. That fast loop is what makes a draft feel like an instrument you're tuning, not a program you're rebuilding. A draft is yours, mutable, and tied to its source.

A bundle is a published device: a single .msh-device file. Its DSP is already compiled to wasm, its UI is already built, and none of it changes. This is the thing you share. A recipient runs it without your source, without a compiler, on any machine.

The same device passes from one to the other when you export. Drafting is for building; the bundle is for shipping.

What's in a bundle

A .msh-device is a sealed package holding the compiled DSP wasm, the compiled UI tree (canvases inlined), the device's assets/, and a screenshot of its tile. The wasm bytes carry a hash, so whoever loads the bundle can confirm they're running exactly the device you built, byte for byte.

Source is optional. Export with source and your index.ts / ui.ts / paint.ts ride along, so a recipient can read the device or fork it into a draft of their own. Export without it and they get a device that runs but can't be opened up.

Why a bundle doesn't hot-reload

A draft hot-reloads because Msh owns its source and can recompile it. A bundle has no source to recompile against, by design: it ships its finished wasm and runs that. A published device is immutable. The bytes you shipped are the bytes everyone runs, which is what makes loading someone else's device predictable and safe.

To change a published device, the author starts from the draft again, edits, and exports a new version.

The library

Every device available to you lives in your library, which the Shelf reads. It holds three kinds: the factory devices that ship with Msh, the user devices you've authored or exported, and downloads you've imported from elsewhere. Factory devices are read-only; your own and your downloads you can remove. Adding a device to a graph reads its bundle; browsing the Shelf reads only a small listing per device, so a large library stays cheap to scroll.

For the step-by-step, see the share guide.