Publishing
Release layout, the add-on library, versioning and updates.
Interface 0.6 is the current source contract, not a released Niles version. Interface 0.5 and frozen 0.1–0.4 remain supported.
niles plugin checkand installing, updating and rolling back from GitHub releases are built (Niles 0.2.0), as described here. The add-on library (Browse) and install counts are built (Niles 0.5.0).
A plugin is published as a GitHub release on a public repo. Anyone with
the repo's URL can install it, and once the repo has the topic niles-addon
people also find it in the app, under Add-ons → Browse (see the add-on
library).
Release layout
The release Niles installs is the repo's latest release: not a draft, not
marked pre-release. (Somebody can install another by pasting its address,
https://github.com/you/your-repo/releases/tag/v0.2.0.) Its assets must
include:
| Asset | Required | What it is |
|---|---|---|
niles-integration.toml | yes | The manifest, at most 64 KiB. Its version is the release tag, with or without a v. |
integration.wasm | yes | The component, at most 64 MiB. |
logo.svg | if the manifest names one | The logo, at most 32 KiB. The asset is found by the file name of the manifest's logo, so logo = "assets/logo.svg" is the asset logo.svg. |
niles-installed | to be listed | A few bytes, at most 1 KiB, any content. Niles downloads it once per house after a fresh install, so its download count is your number of installs. |
Each cap holds whatever GitHub reports as the asset's size: a download is cut off at it.
Other assets are ignored by the install. The release notes (the release's body) are shown to the household when they are offered the update, so write them for people: what changed for them, not the commit log.
Several add-ons in one repo
One repo can hold several add-ons, each released on its own. Tag each
add-on's releases with its id from the manifest, a -v and the version:
weather-v0.2.0, pool-v1.0.0. The assets are the same as above, one
add-on's per release.
The address of one of them is owner/repo/<id>, such as
you/your-addons/weather. Niles installs that add-on's newest release
tagged weather-v, not GitHub's latest release, which may be another
add-on's. A release URL with such a tag works too:
https://github.com/you/your-addons/releases/tag/weather-v0.2.0. The
manifest's id must be the name in the address, and its version the
version in the tag, or the preview refuses the release.
Updates follow the same tags. Each add-on is offered only its own newer releases. Niles looks through the repo's newest 100 releases, so an add-on whose latest release is older than that isn't found.
A repo of one add-on keeps tagging v0.2.0. Niles reads a tag like
weather-v0.2.0 as a release of the add-on weather, so don't use that
form there.
In the release workflow, push tags like weather-v*, check the tag against
<id>-v<version>, and build the add-on the tag names.
niles plugin check --listing you/your-addons/weather checks one add-on's
newest release.
The workflow
The template has two
workflows. ci.yml runs fmt, clippy, the build and niles plugin check (with
the published Niles image) on every pull request and push to main.
release.yml builds and publishes on a version tag:
name: release
# Push a tag like v0.2.0 and this builds the add-on and publishes a GitHub
# release with what an install downloads: niles-integration.toml,
# integration.wasm, the logo the manifest names, and niles-installed,
# whose download count is the add-on's number of installs.
on:
push:
tags: ["v*"]
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
release:
runs-on: ubuntu-latest
env:
TAG: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v7
- name: The tag matches the manifest's version
id: manifest
run: |
read -r version logo < <(python3 -c '
import tomllib
m = tomllib.load(open("niles-integration.toml", "rb"))
print(m["version"], m.get("logo", ""))
')
if [ "v$version" != "$TAG" ]; then
echo "Tag $TAG but niles-integration.toml says version $version" >&2
exit 1
fi
echo "logo=$logo" >> "$GITHUB_OUTPUT"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-wasip2
- uses: Swatinem/rust-cache@v2
- name: Build
run: ./build.sh
- name: niles plugin check
run: |
docker pull --quiet ghcr.io/marknygaard/niles:latest
docker run --rm -v "$PWD:/addon:ro" ghcr.io/marknygaard/niles:latest plugin check /addon
# An asset is named after its file, so a logo at assets/logo.svg is
# the asset logo.svg, which is where an install looks for it.
- name: Publish the release
env:
GH_TOKEN: ${{ github.token }}
LOGO: ${{ steps.manifest.outputs.logo }}
run: |
printf '1' > "$RUNNER_TEMP/niles-installed"
files=(niles-integration.toml integration.wasm "$RUNNER_TEMP/niles-installed")
if [ -n "$LOGO" ]; then
files+=("$LOGO")
fi
gh release create "$TAG" "${files[@]}" --title "$TAG" --generate-notesniles plugin check --listing you/your-repo checks a published release as
the add-on library's listing check does.
For JavaScript, Python or Go, replace the toolchain step and ./build.sh with
jco componentize, componentize-py or tinygo build, and keep the rest.
Versioning your plugin
Semver, judged by what the household sees:
- Patch (0.1.0 → 0.1.1): fixes. Same tools, devices, settings and permissions.
- Minor (0.1.1 → 0.2.0): new tools, devices, settings or surfaces; new permissions.
- Major (0.2.0 → 1.0.0): anything that breaks what the household built on it: a device renamed or removed (their rules name it), a setting renamed (its value is lost), a tool renamed.
Never rename a device id lightly: rules, scenes and the app refer to it. Never
change the plugin's id: that is a different plugin to Niles, installed beside
the old one, with none of its settings, secrets or storage.
How updates reach people
- Niles asks each installed plugin's repo for its releases every 6 hours, first 2 minutes after it starts, and when someone presses Check for updates on its panel.
- The newest release whose tag is a higher semver version than the installed one shows as Update available, with its version, release notes and the change in permissions (what is added, what is removed). A pre-release is offered only to someone already on a pre-release, so mark betas as pre-releases on GitHub. Nothing updates by itself.
- Updating downloads the release and runs the same checks as an install, and the household sees the difference before they confirm. New required settings put the plugin in "Not set up" until they are filled in.
- The previous version is kept. If the new one traps, times out or will not
load within 10 minutes of the update, Niles puts the previous one back by
itself and says so on the panel;
initreturning an error does not count, since that is your plugin saying what is wrong. The household can also roll back by hand, once.
Storage and settings carry across updates. If your stored data's shape
changes, read the old shape too, or keep a version number in storage and
migrate in init.
The add-on library
The app lists what other people published under Add-ons → Browse, from
one file the registry repo (MarkNygaard/niles-addons) builds from GitHub's
public data. You don't upload anything; your repo's releases are the truth.
Being found
Give the repo the topic niles-addon, under the repo's About → Topics, or
with gh repo edit --add-topic niles-addon. The library picks it up within
six hours, as Unreviewed. In a repo of several add-ons, it lists each
add-on its releases are tagged for.
Getting listed
Open a pull request on MarkNygaard/niles-addons adding your repo to
addons.toml:
[[addon]]
repo = "you/your-repo"For one add-on of a repo that holds several, name it too:
[[addon]]
repo = "you/your-addons"
addon = "weather"The check runs niles plugin check --listing you/your-repo on your latest
release (everything an install checks, plus niles-installed), and puts the
permissions your add-on asks for in its summary. Mark reads them and merges;
then it is Listed.
Listed means it passed the checks and someone read what it asks for. It isn't an audit of your code, later releases aren't reviewed again, and every household still approves its permissions on install.
Install counts
The library shows your installs: GitHub's download count of niles-installed,
summed over your releases. In a repo of several add-ons, each add-on's count
is summed over its own releases. Stars belong to the repo, so its add-ons
share them, and Browse says so. A preview, an update or installing the same
add-on again doesn't count, and nothing about the household is sent. It's a
total, not active installs: removals aren't counted. Without
niles-installed the library shows your component's downloads instead,
labelled as downloads, which counts previews and updates.
Leaving the library
Remove the topic, or open a pull request removing your entry. An add-on taken off the list keeps working where it's installed, and its panel says it is no longer listed.
Pinning: why a release cannot change under people
When somebody previews an install or an update, Niles downloads your assets, computes their sha256 and holds them for 15 minutes. Where GitHub reports a digest for an asset, the two must agree. Installing takes exactly those bytes, checked against the sha256 the preview showed, and keeps them in Niles's own database; nothing is downloaded again, at install or at any restart after. Replacing an asset on an existing release changes nothing for anyone who installed it; publish a new release instead.
Which Niles versions you support
interface = "0.3"in the manifest and the WIT your component was built with say which interface you target, and they must agree: Niles reads the version your component's imports carry, and refuses a component built for 0.3 under a manifest that says 0.2, or the reverse. A Niles that runs 0.2 runs any0.2.xcomponent; patch versions of the interface only add.min_nilesis the oldest Niles your plugin needs:"0.3.0"for interface 0.3, and later when you use a function or UI node added after that. For interfaces 0.4 and 0.5, setmin_niles = "0.5.0"for WebSocket and speech-stream support.
Interface versions
| Interface | Niles | What changed |
|---|---|---|
| 0.6 | Not released | Source contract adds tracked notify.request and notify.status; release and minimum Niles version are not yet published. |
| 0.5 | 0.5.0 | Speech streams: the speech-stream interface for bounded, room-bound commentary. |
| 0.4 | 0.5.0 | WebSockets: the websocket interface and the on-websocket-message and on-websocket-status exports. Frozen at 0.4.0; supported beside 0.5. |
| 0.3 | 0.3.0 | Accounts and webhooks: the secrets and inbound interfaces, the exports authorize-url, on-callback and on-webhook, and the callback and webhook permissions. Nothing 0.2.1 had changed. |
| 0.2.1 | 0.2.1 | config.time-zone and devices.set-room-light. Any device class may report-action. Nothing 0.2.0 had changed. |
| 0.2.0 | 0.2.0 | The mqtt interface and the exports on-mqtt-message and on-mqtt-status. Nothing else. |
| 0.1 | 0.2.0 | The first. |
How a patch version stays compatible, both ways:
- Patch versions only add functions or interfaces. Nothing a component
already imports changes: no record, variant or signature. The WIT's
package version says the patch (
niles:integration@0.2.1); the manifest'sinterfacesays only"0.2". - A component built against an older patch runs unchanged. It imports
niles:integration/devices@0.2.0; Niles definesdevices@0.2.1, and the WebAssembly linker (wasmtime's) treats versions that differ only in the patch of a0.xas the same interface, so it links. The types are then checked function by function, for the functions the component imports only, and those have not changed. Niles's tests load a component built against 0.2.0 (relay.wasm) to hold it to that. - A component built against a newer patch needs a Niles that has it.
Built against 0.2.1 and calling
config.time-zone, it fails to load on a Niles that only has 0.2.0, naming the function it is missing. Raisemin_nilesto the first Niles with the patch, so the household is told before they install it rather than after.
Niles runs plugins built for the previous interfaces beside the current one
for at least six months, and their panel says "Built for an older Niles".
Moving a plugin from 0.2 to 0.3 takes a copy of the new
WIT, interface = "0.3",
min_niles = "0.3.0", and the three new exports, answering nothing if you
connect no account and have no webhook:
fn authorize_url(_callback_url: String, _state: String) -> Result<String, String> {
Err("This add-on connects no accounts.".into())
}
fn on_callback(_: String, _: Vec<(String, String)>, _: Option<String>) -> Result<String, String> {
Err("This add-on connects no accounts.".into())
}
fn on_webhook(_request: InboundRequest) -> InboundResponse {
InboundResponse { status: 404, content_type: None, body: Vec::new() }
}From 0.1, add the two MQTT exports as well, empty if you use no MQTT:
fn on_mqtt_message(_conn: u32, _topic: String, _payload: Vec<u8>) {}
fn on_mqtt_status(_conn: u32, _status: ConnectionStatus) {}Interface 0.4 is kept, frozen, as
niles-integration-0.4.wit.
The older interfaces are kept, frozen, as
niles-integration-0.2.wit and
niles-integration-0.1.wit.
Private repos, and GitHub's limit
Not yet. Installing from a private repo needs a GitHub token in Niles, which is planned but not specified. Without a token GitHub allows 60 API requests an hour from one address: a preview takes one or two, an update check one per plugin. Browsing the library takes none of them. When the limit is reached Niles says so, with the time it resets.