Updating Superfluid
Superfluid updates itself with superfluid self update, and superfluid serve says once a day when a newer release is out. Releases are kept side by side, so an update never overwrites the copy that is running and the version it replaced stays for going back.
superfluid self check # is a newer release out? superfluid self update # install the newest release that fits this machine superfluid self update --dry-run # say what it would do superfluid self list # the versions here, which is current, which was replaced superfluid self use 0.1.3 # go back to a version that is still here
Where releases live
The install script unpacks a release under $SUPERFLUID_HOME/versions/<version>/ (~/.superfluid/versions) and links superfluid, superfluid-workerd and superfluid-noded in $SUPERFLUID_PREFIX/bin (~/.local/bin) to it through a current link:
~/.local/bin/superfluid -> ~/.superfluid/versions/current/bin/superfluid ~/.local/bin/superfluid-0.1.3 -> ~/.superfluid/versions/0.1.3/bin/superfluid ~/.superfluid/versions/current -> 0.1.4 ~/.superfluid/versions/0.1.4/ bin/ libexec/superfluid/ compat.json ~/.superfluid/versions/0.1.3/
The install script places the release it downloaded with that release's own superfluid self install, which proves it the way an update does; a release that is refused stops the script, and nothing is copied in its place. Only a release from before self install existed is copied into ~/.local/bin the old way.
Each version finds its workers beside its own real executable, so a server started from 0.1.3 keeps spawning 0.1.3's workers after 0.1.4 became current. The superfluid-<version> names run a specific copy.
On Windows
Versions are kept the same way, under %USERPROFILE%\.superfluid\versions. An ordinary Windows user may make no symbolic link, so the two links are something else there:
%LOCALAPPDATA%\Programs\superfluid\bin\superfluid.exe a launcher %LOCALAPPDATA%\Programs\superfluid\bin\superfluid-versions the path of the versions folder %USERPROFILE%\.superfluid\versions\current a file that holds "0.2.1" %USERPROFILE%\.superfluid\versions\0.2.1\ bin\ libexec\superfluid\ compat.json %USERPROFILE%\.superfluid\versions\0.2.0\
The launcher is a small program the release carries (libexec\superfluid\superfluid-shim.exe), copied under each command's name. It reads which version is current and runs that version's program of its own name with the same arguments, console and exit status; Ctrl+C and Ctrl+Break go to the program, and ending the launcher ends it. self update and self use change the current file, so they place nothing on PATH unless a release brings a different launcher. There is no superfluid-<version> name: versions\<version>\bin\superfluid.exe runs a specific copy.
What an update does
- Reads the release listing and picks the newest release for this platform. With a baseRT engine here (an installed
basertruntime, orBASERT_LIB), the release must declare the engine's ABI number, which releases carry in an asset name; with llama.cpp or MLX only, the newest release fits.--version <v>names one instead. - Downloads the tarball and its
.sha256into a staging directory and checks the digest, then unpacks with the same rules as a runtime install (no member may land outside the tree). - Runs the new copy's
--versionandruntimes --json: it must start, find its workers, and, when an engine is in use, report thebasertruntime ready. A copy that fails is removed and the current version is untouched. - Makes it current by replacing the
currentlink in one step, and remembers the version it replaced. - Removes older versions. Kept: current, the one it replaced, any version with a
keepfile inside its directory, and any version a running Superfluid process started from. A version that cannot be removed is said and left for the next update; the update itself has succeeded.
A running server keeps the version it started with; its next start uses the new one. A server started by superfluid launch is stopped with superfluid stop. One update, install or switch runs at a time: a second waits for the first and then decides on what it left. An installed version is never written to: a release placed again over a working copy is kept as it is, and only a copy that is proved first replaces one that no longer works.
After an update, the runtime installs under $SUPERFLUID_HOME/runtimes still carry the worker copied in when they were installed. A newer daemon that does not speak that worker's protocol says so in superfluid runtimes, and superfluid runtime repair <id> installs the runtime again with the new worker.
The daily check
After the server is up, superfluid serve reads the release listing at most once a day, with a five-second limit, and prints one line when a release newer than the running one fits here. A server that stays up looks again every hour, so it learns of a release published later, or one past its hold-off, when the day is up:
superfluid 0.1.4 is available (this is 0.1.3): `superfluid self update` installs it; SUPERFLUID_NO_UPDATE_CHECK=1 silences this
A release is announced a few days after it is published, so early reports land first; self update installs it as soon as it is out. The check is skipped with --offline or SUPERFLUID_NO_UPDATE_CHECK=1, and it never delays serving. What it learned is in $SUPERFLUID_HOME/update-check.json and in superfluid self list.
Other ways Superfluid was installed
self update only touches a Superfluid under versions/. A copy the install script placed before versions existed (real files in ~/.local/bin) is kept under versions/ as the version it is by its first self update, so self use can go back to it, and the files in ~/.local/bin become links; its workers in ~/.local/libexec/superfluid stay while a server still runs from that copy. A Superfluid from Homebrew or npm carries an installed-by file naming its package manager, and self update leaves the copy to that manager: for Homebrew, a global npm, pipx, uv and cargo install it runs the manager's own update (brew upgrade superfluid, npm install --global @basecompute/superfluid@latest, pipx upgrade superfluid-cli, uv tool upgrade superfluid-cli, cargo install superfluid), asking first; --yes runs it without asking and is needed without a terminal. The command is built from the manager's name, with the manager's binary found from the copy's own path (the brew of its Cellar, the npm of its global folder, told that folder's prefix); the file's own text is only shown. A pinned formula, another user's Homebrew, an npm folder that needs root, a project's npm dependency and pip in an environment (a lock file or the system may own it) are named, not run, and nothing runs while a server runs from the copy, checked again once the question is answered. On Windows every manager is named and none run: Windows lets nothing replace a program that is running, and self update would be running from the copy. The command named is the one for that copy: npm's says the folder the copy is in (--prefix), since npm may be set to another, and pip's starts with the Python of the copy's environment. A path with a space in it is quoted as PowerShell reads it. --version is the manager's to choose. The daily check's line names the same command. A source build is updated the way it was built.
The Superfluid basert installs for basert serve is basert's (an installed-by file says basert, or basert's .release stamp for a copy it placed before writing one): self update hands over to basert superfluid install (the process becomes basert, which refuses while anything runs from the copy), which installs the newest release that serves basert's engine, rather than moving the copy under ~/.superfluid and checking it against an engine that is not basert's; --version is refused, as basert picks the release.
SUPERFLUID_RELEASES names another release listing, a URL or a file in GitHub's releases JSON shape, for a mirror.