@ai-ecoverse/slicc-bios 1.74.0 → 1.74.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -5,8 +5,10 @@ A slim loader for [SLICC](https://github.com/ai-ecoverse/slicc), from the boot-p
|
|
|
5
5
|
The page shows six boot steps as they run:
|
|
6
6
|
|
|
7
7
|
1. **Acquire OPFS** – open the origin private file system and ask for persistent storage.
|
|
8
|
-
2. **Create installer worker** – start `installer.js`, a shared worker that does all of the BIOS's OPFS writes and is shared by every tab. On a shared origin it first disarms SLICC 6's service worker, which would otherwise answer every npm download (see [SLICC 6's proxy worker](#slicc-6s-proxy-worker)).
|
|
8
|
+
2. **Create installer worker** – start `installer.js`, a shared worker that does all of the BIOS's OPFS writes and is shared by every tab. On a shared origin it first disarms SLICC 6's service worker, which would otherwise answer every npm download (see [SLICC 6's proxy worker](#slicc-6s-proxy-worker)). The installer has 30 s to answer. One that an earlier client started (connection #2 or later) can be stuck, so it also says how it reaches the network: it fetches modern-tar from jsDelivr (10 s at most) and checks who answered, and it lists the calls it is running, with how long each has been quiet. The BIOS replaces it when a service worker answered (`a service worker answered its downloads`), nothing answered (`its downloads got no answer in 10 s`), or a packages run has had no progress and no download data for 2 minutes (`its packages run made no progress for 121 s at node_modules/pako`, naming the packages it was writing). Replacing means the `reset` call: the old installer ends every other call it runs with `the installer stopped: seven's BIOS replaced it: <why>`, which releases their Web Locks, and closes itself; the BIOS then connects again until a new installer answers (10 tries). The step reads `connection #3: <why>, starting a new installer`, then `connection #1, replaced the installer (<why>)`. An installer that can't reach npm at all (offline) isn't replaced.
|
|
9
9
|
3. **Install packages from npm into OPFS** – the installer reads [`src/packages/package-lock.json`](src/packages/package-lock.json), the lockfile the BIOS ships with. It pins only what UI boot and the agent install need (Lars, 2026-10-21): slicc-kernel, slicc-spectrum, slicc-browsers (the guard's catalog), slicc-capture and slicc-audio (the page's capture and audio), slicc-devices (the page's serial ports, with esptool-js and the pako and atob-lite it depends on, for `esptool`), wasi-pnpm, bash, coreutils, findutils, the TLS engine (the kernel's HTTPS) and fnox (the agent's secrets). Every other tool comes after boot, at npm's `latest` (see [Seven's tools](#sevens-tools)). It skips packages that name an `os` or `cpu` (native binaries such as esbuild's, which can't run in a browser). For every other locked package it downloads the tarball from `registry.npmjs.org` and checks its `integrity`, then unpacks it with the built-in `DecompressionStream` and [`modern-tar`](https://github.com/ayuhito/modern-tar) into OPFS at its lockfile path (`node_modules/…`), dropping `.` segments from entry names and skipping any entry with `..`. A package that is already there is rewritten in place, never emptied first: every file is overwritten whole (an OPFS write commits on close), the entry points come last: a command's wasm (and its variants), then its glue or script with `bin`, `main` and `exports` targets, then `package.json`, and only then do the files the new version no longer has go, so a running kernel or another tab never finds the package missing. Each package's overwrite, sweep and hashes run inside the installed kernel's `replacing()` (`@ai-ecoverse/slicc-kernel/meta`, kernel 1.168.0 and later, loaded once per run like `writeMetadata` below). It holds the package directory's Web Lock `slicc-kernel-replacing:v1:slicc-kernel:/<path>` until the package is written and the running kernels have been told to drop what they cached of it, and every kernel loads a program's files under that lock. So an exec that starts meanwhile waits, then loads the new version whole, never the new wasm with the old glue ([#663](https://github.com/ai-ecoverse/slicc-bios/issues/663)). A kernel without `replacing()` gets its packages written as before. While it unpacks, it hashes every file (SHA-256) and records the hashes in IndexedDB (see [Integrity](#integrity)). It also keeps each file's mode from the tarball, owned by root: once a package's files are in, it hands their paths and modes to the kernel's `writeMetadata` (`@ai-ecoverse/slicc-kernel/meta`, read from the installed kernel), in one batch per run, so an executable outside `bin/`, such as pnpm's `shims/i`, stays executable when the kernel checks modes. The seed's files are recorded as root's `0644`. A kernel without `/meta` skips this. A package installed before the kernel had `/meta` gets its modes once, on the first run with it: the installer fetches its tarball again, checks its integrity, reads the modes from the headers without unpacking, and marks the receipt (`modes: true`). A package installed or replaced later is marked when it's stamped. It also records a receipt in `var/lib/bios/`. A package whose recorded integrity matches the lockfile's and whose files are still there isn't downloaded again, so pinning a new version replaces just that package. Replacing a package keeps its nested `node_modules`, and packages the lockfile no longer lists are deleted along with their receipts and hashes. A package without recorded hashes is downloaded again, even with a receipt, so the first boot after integrity checks arrived downloads the base set once. Last, the installer copies the deployment's `package.json` and `pnpm-lock.yaml` to the OPFS root for pnpm, and the lockfile once more to `var/lib/slicc/pnpm-lock.yaml`, which records what is installed (see [Updates](#updates)).
|
|
10
|
+
|
|
11
|
+
The step says what it waits for. The run takes the Web Lock `slicc-packages`; when another run holds it, the step reads `waiting 30 s for another install of the packages (held by another seven tab)`, or `(held by this installer's other run, 612 s in, at node_modules/pako)`, updated every 30 s, with how many more wait. Then it reads `reading the lockfile`, `downloading <path>` as each package starts, and `3/15 <path>` as each one is in. Its network waits are bounded: a download gets two 30 s windows without data, modern-tar's and the integrity ledger's imports 60 s each, and the `tools.json` fetch 30 s. Whatever else stalls a run (an OPFS write, a kernel's `replacing()` lock) is what the 2-minute check at **Create installer worker** catches. Every boot step that reports nothing for 15 s adds `, nothing new for 15 s` to its last line, once every 15 s, so a stalled boot names the step and the line it stalled at.
|
|
10
12
|
4. **Add UI page to OPFS** – the installer copies `src/seed/` to `os/` in OPFS and records each file's hash. This is a stand-in until the UI ships as a downloadable asset.
|
|
11
13
|
5. **Intercept same-origin requests** – `sw.js`, a module service worker, answers in-scope requests from OPFS and passes everything else to the network (see [What the service worker serves](#what-the-service-worker-serves)). The code it serves from OPFS carries `Cross-Origin-Opener-Policy: same-origin`, `Cross-Origin-Embedder-Policy: require-corp` and `Cross-Origin-Resource-Policy: same-origin`, so the UI page and the workers it starts are cross-origin isolated. Scripts it serves get their bare imports resolved (see [Modules](#modules)).
|
|
12
14
|
|
|
@@ -109,8 +111,12 @@ A SLICC 6 tab registers `/llm-proxy-sw.js` at scope `/`, over seven's `sw.js` wh
|
|
|
109
111
|
- **Found:** the page's controller or the active worker of the registration at `/` is the origin's `/llm-proxy-sw.js`. Otherwise the step does nothing more, and its output stays `connection #N`.
|
|
110
112
|
- **Disarmed:** the BIOS asks Chrome for six's newest worker (`registration.update()`) and waits up to 10 s for it to activate. It then posts `{ type: 'slicc-six-disarm' }` with a `MessagePort` to every six worker it found and waits 3 s for `{ type: 'slicc-six-disarmed' }`. A six worker that answers stops answering fetches for every client it controls, an installer a six tab started included (ai-ecoverse/slicc, `ui/llm-proxy-sw-disarm.ts`). It also stays disarmed when it starts after seven has set `__Host-slicc-six-retired`. The step reads `connection #N, SLICC 6's service worker disarmed`.
|
|
111
113
|
- **Unregistered:** a six worker from before the disarm message doesn't answer. The BIOS unregisters six's registration, unless seven's worker is installing or waiting in it, so an installer that starts now starts without a worker. The step reads `connection #N, SLICC 6's service worker unregistered`, or `… still answers` when even that failed.
|
|
112
|
-
- **The installer's check:** an installer that's already running under
|
|
113
|
-
- **
|
|
114
|
+
- **The installer's check:** an installer that's already running under a six worker keeps it. A response a service worker made itself reads as `basic` even for another origin, where the network's reads as `cors`. So the installer refuses a cross-origin download that reads as `basic` or `default`, and its check at **Create installer worker** finds such an installer, or one whose downloads a six worker never answers (six's extension delegate has no timeout), and the BIOS replaces it with one started after the disarm. A download that still comes from a service worker fails with `404 <url> came from a service worker, not the network: close every tab of <origin> and open seven again`, rather than npm's URL and a 404.
|
|
115
|
+
- **A six worker that never answers** keeps the fetch events it got, and Chromium doesn't activate seven's `sw.js` over it until they end (Chromium's 5-minute fetch timeout). The installer is replaced and the packages go in, but `/os/` goes back through the BIOS until then. slicc's own worker passes seven's requests through (ai-ecoverse/slicc#4285, `llm-proxy-sw.ts`), so it never holds one.
|
|
116
|
+
- **The diagnostics:** the first log line reads `boot (repeat visit)` only when seven's own `sw.js` controls the page. Under another worker it reads `boot (under /llm-proxy-sw.js)`. The diagnostics drawer, and **Copy diagnostics**, also list, refreshed every 5 s:
|
|
117
|
+
- `workers`: every registration's scope, script and state, and the page's controller (`/ /llm-proxy-sw.js activated, controller /llm-proxy-sw.js`);
|
|
118
|
+
- `locks`: the origin's Web Locks, held and waiting, without the per-tab and per-client ones whose names carry a UUID (`held slicc-packages; waiting slicc-packages`);
|
|
119
|
+
- `six`: whether OPFS has six's `/slicc-fs`, the `slicc-os.six` marker, the retired cookie, and whether a six tab holds `slicc-six-kernel` or `slicc-tray-leader-active`, or `none` when none of them is there.
|
|
114
120
|
- **Tests:** `six-proxy.test.mjs`, with an old and a new six worker from `fake-six.mjs`.
|
|
115
121
|
|
|
116
122
|
### Integrity
|
|
@@ -743,7 +749,7 @@ A running install updates itself from the deployment it was booted from, package
|
|
|
743
749
|
2. **Install.** It writes the deployment's `package.json` and `pnpm-lock.yaml` to the OPFS root and runs `pnpm install --frozen-lockfile --trust-lockfile` there in the page's kernel. [`@ai-ecoverse/wasi-pnpm`](https://www.npmjs.com/package/@ai-ecoverse/wasi-pnpm) is one of the bootstrap packages, so pnpm is always installed. pnpm's hoisted, copying layout keeps `node_modules/` exactly where the BIOS puts it, and it only rewrites packages whose locked version changed. Its store lives in OPFS under `/home/.local/share/pnpm/`. Only when pnpm succeeds does the updater write the lockfile to `var/lib/slicc/pnpm-lock.yaml`, so an update that fails or is cut short by closing the tab is tried again by the next check.
|
|
744
750
|
3. **Switch over.** Packages are updated in place. pnpm swaps a changed package in with two renames (the old directory aside, the staged one onto its name). From slicc-kernel 1.168.1 on, the kernel holds the package's `slicc-kernel-replacing` lock from the first rename until the second, the lock the installer takes too (boot step 3, at the top), so an exec that starts meanwhile waits and then runs the new version whole ([#663](https://github.com/ai-ecoverse/slicc-bios/issues/663)). A program reads its wasm and glue when it starts, so running processes, the interactive `bash` included, keep the code they started with, and every process started afterwards gets the new version. The page itself keeps the kernel and terminals it loaded. The changed rows of [Install / Update](#install--update) say *Ready to apply*, list what changed and offer **Reload**, which navigates to the BIOS with a view transition. The BIOS then picks up a new `sw.js` and seed, finds every package current (its receipt, or pnpm's `.modules.yaml` and the installed version, match), and goes back to `os/`. Files in OPFS, `/home` included, are not touched.
|
|
745
751
|
|
|
746
|
-
Both the BIOS installer and the updater take the Web Lock `slicc-packages`, so tabs never install at the same time.
|
|
752
|
+
Both the BIOS installer and the updater take the Web Lock `slicc-packages`, so tabs never install at the same time. The updater's `pnpm install` is bounded like a tools round: it waits at most 15 minutes for the pnpm store, and is stopped when it writes nothing for 3 minutes, or after 15 minutes in all, so a tab never holds the lock for good.
|
|
747
753
|
|
|
748
754
|
Decisions, from [#11](https://github.com/ai-ecoverse/slicc-bios/issues/11):
|
|
749
755
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-bios",
|
|
3
|
-
"version": "1.74.
|
|
3
|
+
"version": "1.74.1",
|
|
4
4
|
"description": "Slim loader that boots SLICC into OPFS and serves the UI from there",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"fake-indexeddb": "6.2.7",
|
|
63
63
|
"lefthook": "2.2.2",
|
|
64
64
|
"modern-tar": "0.8.6",
|
|
65
|
-
"monocart-coverage-reports": "3.2.
|
|
65
|
+
"monocart-coverage-reports": "3.2.1",
|
|
66
66
|
"playwright-core": "1.65.0",
|
|
67
67
|
"puppeteer-core": "25.16.0",
|
|
68
68
|
"semantic-release": "25.0.9",
|
|
69
|
-
"ws": "8.22.
|
|
69
|
+
"ws": "8.22.2"
|
|
70
70
|
}
|
|
71
71
|
}
|