Reload extension file snapshots without Git

This commit is contained in:
2026-11-12 12:22:01 +00:00
parent a46d67e4ff
commit b4b2fbe33e
28 changed files with 1690 additions and 1886 deletions
+11 -15
View File
@@ -34,7 +34,7 @@ nix develop -c nu userland/bundle.nu
It builds the world commands and creates `target/userland/bundle` by default.
It snapshots committed source, not uncommitted edits.
The source archive includes the complete `config/`, `skills/`, and `extensions/` directories.
The bundle contains plain source files. `sausage init` creates their repository and its first commit on `main`.
The bundle contains plain source files. `sausage init` copies them without a Git repository or first commit.
The world copier preserves symlinks, including dangling links in the source tree.
A fresh development world needs no manual source copy.
The bundle includes `/bin/web.wasm` and an enabled `/etc/systemd/system/web.service`.
@@ -192,25 +192,21 @@ and [`models`](../extensions/models/README.md).
## Change extensions
The world checkout is `/src/sausage`. The loader follows its **`main`** branch, not the host checkout's `v3` branch.
Each extension lives at `extensions/NAME/server.ts` inside that checkout.
Commit extension edits to `main` with world git. A saved, uncommitted edit does not reload an extension.
Use `--no-gpg-sign` for commits.
The platform source is `/src/sausage`. Each extension lives at `extensions/NAME/server.ts`.
Save extension edits directly. No Git commit or restart is required.
The VFS watcher waits for a short quiet period, then hashes the extension files.
Unchanged contents do not reload.
The loader imports a detached snapshot under `/run/sausage/extensions/COMMIT`.
The loader copies the files under `/run/sausage/extensions/HASH`.
It validates the entire candidate before it replaces the live registry.
A broken candidate leaves the previous good commit active.
A broken candidate leaves the previous good set active.
An active tool call retains its implementation. The next call uses the new implementation.
Read `/proc/extensions` through the agent's file tools to inspect `current`, `good`, and `error`.
To restore the last good branch ref, ask the agent to execute:
```sh
extensions-revert
```
The command preserves editable files. It changes `refs/heads/main`, which triggers the normal reload.
At startup, the loader tries the tip and then the last good commit before it resumes work.
Use `undo` to restore earlier files. The normal file watch reloads them.
At startup, the loader hashes the current files, including edits made while the host was offline.
If they fail, it loads the last good copy from `host/harness.sqlite` and shows the error.
The fallback does not change editable files.
Source: [`extensions`](../extensions/README.md) and [`extensions.ts`](../host/js/extensions.ts).