@ai-ecoverse/slicc-bios 2.7.4 → 2.8.0
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
CHANGED
|
@@ -538,11 +538,17 @@ Programs ask seven's page for what only a page can do through the kernel's `/dev
|
|
|
538
538
|
- **The switch:** "Public previews" in Settings, on by default and kept in `slicc-os.switches` like the capture switches. Off refuses `serve.publish` with `EACCES`, `public previews are off in seven's settings`, before the prompt and again after it, and turning it off revokes every live preview this seven serves.
|
|
539
539
|
- **The chip:** while a preview is live, every tab shows "Serving publicly", the root (or `port <n>`) and who asked, with **Stop**, which revokes it.
|
|
540
540
|
- **Minting:** the page posts `{ servedRoot: "/srv/serve/<32 hex>", entryPath: "<servedRoot>/<entry or index.html>", allowLive }` to the hub's `POST /api/tray/<trayId>/preview` with the controller token. The served root is only a name the hub compares: a fresh one per publish, never a path in seven's file system. Without `entry`, a visit to `index.html` goes to the port as `/`, and the URL the hub mints loses its trailing `index.html`, as on a host.
|
|
541
|
+
- **`serve.snapshot`** (`serve --ttl`, [slicc-serve#4](https://github.com/ai-ecoverse/slicc-serve/issues/4), `src/seed/snapshot.js`): a snapshot that stays up without seven, uploaded through the page. The header is `{"kind":"serve.snapshot","root","entry"?,"ttlMs","files","bytes"}` (`ttlMs` 60 000 to 30 days, at most 1,000 files and 50 MiB), and the body is each file as a JSON line `{"path","type","size"}` (at most 4 KiB) followed by exactly `size` bytes, at most 25 MiB each. Paths follow the hub's rules (no leading `/`, no empty, `.` or `..` segment, no segment starting with `.` but `.well-known`, no `\`, `:` or NUL); `type` is a plain media type.
|
|
542
|
+
- **Before the body:** the same switch, the same refusals and the same gesture check as `serve.publish`, with "Publish a snapshot of /home/site (2 files, 1.8 KiB) at a public URL for 7 days?" (dismissed texts `the request to publish the snapshot was dismissed`, `nobody answered the request to publish the snapshot within 60 s`).
|
|
543
|
+
- **Upload:** the page mints `{servedRoot, entryPath, allowLive: false, ttlMs}` with the controller token, keeps the hub's `uploadToken` in memory only, reads the body file by file and `PUT`s each to `…/preview/<token>/file?path=<path>` with the upload token and its `Content-Type`, four at a time, reporting `uploaded 12 of 40 files` through `request.progress`, then `POST`s `…/finalize`. On `*.sliccy.ai` both go through sliccy-ai's same-origin proxy ([sliccy-ai#162](https://github.com/ai-ecoverse/sliccy-ai/pull/162)).
|
|
544
|
+
- **The reply:** one line `{"url","previewToken","trayId"?,"expiresAt","files","bytes"}` (`expiresAt` is the finalize time plus `ttlMs`, in ms since the epoch).
|
|
545
|
+
- **Failures** answer at once, without reading the rest of the body, and stop whatever was minted on the hub. A body that breaks the rules, or whose files and bytes don't add up to exactly `files` and `bytes`, is `EIO`, `bad snapshot body: <what>`. A refusal the hub answered is the reply line of `serve.publish` with `"during": "mint"`, `"upload"` (and its `"path"`) or `"finalize"`. A hub that can't be reached is `EIO`. A program that goes away first aborts the request, and a snapshot not yet finalized is stopped.
|
|
546
|
+
- **Kept:** a finalized snapshot outlives the page, so seven keeps `{previewToken, url, root?, entry?, since, expiresAt, uid, trayId, files, bytes}` in `localStorage` (`slicc-os.snapshots`, out of every program's reach) until it expires or is stopped, and the boot sweep leaves persistent previews alone.
|
|
541
547
|
- **Whose:** each preview keeps the uid of the process that published it.
|
|
542
|
-
- **`serve.list`:** one JSON line per
|
|
543
|
-
- **`serve.stop`** (`{"kind":"serve.stop","previewToken":"…"}`, an empty reply): ends
|
|
548
|
+
- **`serve.list`:** one JSON line per preview of the caller's uid (every one for root): a live one as `{previewToken, url, root?, port, entry?, since}`, a snapshot as `{previewToken, url, root?, entry?, since, mode: "persistent", expiresAt}` (times in ms since the epoch), and an empty reply when there are none.
|
|
549
|
+
- **`serve.stop`** (`{"kind":"serve.stop","previewToken":"…"}`, an empty reply): ends a live preview's `serve.publish` reply with `stopped with serve --stop`, or forgets a kept snapshot, and revokes it on the hub (`POST …/preview/stop`). A token seven doesn't hold is revoked on the tray all the same. One the hub doesn't know either, and a held preview of another uid for a caller who isn't root, is `ENOENT`, `the tray hub has no such preview`.
|
|
544
550
|
- **Refusals:** no tray hub (a seven off `*.sliccy.ai` without `slicc-os.tray-hub`) is `ENOTSUP`, `seven publishes previews only through its tray hub, and it has none here`; a tab that doesn't run the kernel (another seven tab of the same browser) is `ENOTSUP`, `seven publishes only from the tab that runs its kernel; run serve in that tab's terminal`; a tray not connected yet, a hub that can't be reached and a bad `port` or `entry` (`invalid port`, `invalid entry`) are `EIO` with the reason. The kinds' policies are `{}`: the kernel admits a process of the session's own uid, so a cone's agent publishes in its own session, and `sudo -u cone` in root's terminal is refused before the page sees it. A remote follower's shell has no page hook, so `serve` there is `ENOTSUP` before the page sees it.
|
|
545
|
-
- **Tests:** `test/integration/previews.test.mjs` publishes `httptest` on a fake tray hub from a raw `/dev/embedder` request, checks the mint, the chip, `serve.list`, a visit, a 404 from the server, a path outside the served root (403) and a root nobody serves (404), then ends a preview every way (the program killed, the chip's Stop, the hub's revoke, `serve.stop`, the switch, a reload) and checks each one is revoked with its `stopped` line, that a cone's session lists none of root's previews and can't stop one, and that a hub's 429 comes back as the reply's `error` line, while an orphan on the tray is revoked at boot and a persistent preview isn't. `test/integration/previews-serve.test.mjs` installs `serve` from the catalog, runs `serve --local` and publishes its port: text, a 300 000-byte binary file in seven chunks, ranges (a window, a suffix, an unsatisfiable one), a 404, a 25 MiB+1 file refused with 413 and an 8 MiB window of it.
|
|
551
|
+
- **Tests:** `test/integration/previews.test.mjs` publishes `httptest` on a fake tray hub from a raw `/dev/embedder` request, checks the mint, the chip, `serve.list`, a visit, a 404 from the server, a path outside the served root (403) and a root nobody serves (404), then ends a preview every way (the program killed, the chip's Stop, the hub's revoke, `serve.stop`, the switch, a reload) and checks each one is revoked with its `stopped` line, that a cone's session lists none of root's previews and can't stop one, and that a hub's 429 comes back as the reply's `error` line, while an orphan on the tray is revoked at boot and a persistent preview isn't. `test/integration/previews-serve.test.mjs` installs `serve` from the catalog, runs `serve --local` and publishes its port: text, a 300 000-byte binary file in seven chunks, ranges (a window, a suffix, an unsatisfiable one), a 404, a 25 MiB+1 file refused with 413 and an 8 MiB window of it. `test/integration/previews-snapshot.test.mjs` sends `serve.snapshot` bodies from the terminal to a fake tray hub: three files (a 70 000-byte binary among them) uploaded with the upload token and their types and finalized, the reply, `serve.list` before and after a reload that doesn't revoke it, an upload the hub refuses (`during: "upload"` with its path, then stopped), a body that announces fewer bytes than it carries (`EIO`, stopped), a mint refused with `PREVIEW_LIMIT`, the switch off, and `serve.stop`, after which the hub no longer serves it and `localStorage` keeps nothing.
|
|
546
552
|
- Kinds seven doesn't list (`open.file`, `open.download`, `open.reveal`, `clipboard.read`) are `ENOTSUP` before the page sees them.
|
|
547
553
|
|
|
548
554
|
### Composer recording
|
|
@@ -801,7 +807,7 @@ seven can also join a tailnet, with a patched build of Tailscale's wasm client (
|
|
|
801
807
|
- **Each request:** `{ reqId, servedRoot, vfsPath, asText, range? }`. A `vfsPath` outside `servedRoot` (six's `isPathWithinServedRoot`: not absolute, a `.` or `..` segment, `%2e` in any case, or a served root of `/`) is `403`. A served root this seven doesn't serve is `404` `this preview is no longer served`. Otherwise the page sends `GET <path>` with the visitor's `Range` and `accept-encoding: identity` to the port through `kernel.loopbackFetch`; `<path>` is `vfsPath` without the served root, and `/` for the default entry. Same-origin redirects (to `<port>.kernel.localhost`, `127.0.0.1:<port>` or `localhost:<port>`) are followed up to 5 times, and the whole answer has 25 s.
|
|
802
808
|
- **The answer:** `preview.response` chunks of 64 KiB (`reqId`, `ok`, `mime`, `chunkIndex`, `totalChunks`, `content`, `encoding`, `status`, `size`, `range`), with the server's `Content-Type` (by the file name when it sends none). A `200` is UTF-8 when the hub asked for text and the bytes are UTF-8, base64 otherwise, and is refused with `413` `preview file exceeds 25 MiB limit` once it declares or sends more than 25 MiB. A `206` is always base64, carries `size` and `range` from its `Content-Range`, and is cut to 8 MiB, which the visitor's next range continues; an empty one is `416` with the size. A `416` keeps the size from `Content-Range: bytes */<size>`. Any other status is `ok: false` with the first 4 KiB of the body as `reason`, a port that doesn't answer `502` `nothing answers on kernel port <port>: …`, and one that hangs `504`.
|
|
803
809
|
- **Revoked and replayed:** `preview.revoked` ends that preview's `serve.publish` request (`revoked by the tray hub`), and `preview.state` (which the hub replays on every connect) is kept with the preview. A preview is live only while its request is, and a reload ends every kernel process, so at every `leader.connected`, at boot and after a reconnect, the page lists the tray's previews (`GET /api/tray/<trayId>/previews`) and revokes each live one under `/srv/serve/` that it doesn't serve, as slicc-serve's relay does after each connect. Persistent (`--ttl`) previews stay.
|
|
804
|
-
- **Routes:** mint, stop and list go to the hub with the controller token, through the sliccy-ai worker's same-origin proxy on `*.sliccy.ai` like the other tray routes.
|
|
810
|
+
- **Routes:** mint, stop and list go to the hub with the controller token, and a snapshot's uploads and finalize with its upload token, through the sliccy-ai worker's same-origin proxy on `*.sliccy.ai` like the other tray routes.
|
|
805
811
|
- **The tray:** its capabilities are kept in `localStorage` (`slicc-os.tray`), so the join URL survives reloads. A hub that forgot the tray gets a new one. The leader socket pings every 30 s and reconnects with backoff. Elsewhere (`localhost`, tests) the tray starts only when `localStorage['slicc-os.tray-hub']` names a hub.
|
|
806
812
|
- **Kernel side:** the kernel gets one uplink and one route table, the union of what the active exits offer, pushed with `kernel.setRoutes`.
|
|
807
813
|
- **Choosing an exit:** for each destination, an exit that claims it (a tailnet address or MagicDNS name) wins. Otherwise the default exit takes it: the one that offers a default route, for example Tailscale with an exit node. Otherwise HTTP stays on the picked transport, and raw connections are `ENETUNREACH`.
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"private": true,
|
|
4
4
|
"description": "SLICC's agent, which the UI installs with pnpm in the background into /opt/agent in OPFS",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@ai-ecoverse/slicc-agent": "8.1.
|
|
6
|
+
"@ai-ecoverse/slicc-agent": "8.1.8",
|
|
7
7
|
"@ai-ecoverse/slicc-kernel": "1.191.4"
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -14,16 +14,16 @@ importers:
|
|
|
14
14
|
.:
|
|
15
15
|
dependencies:
|
|
16
16
|
'@ai-ecoverse/slicc-agent':
|
|
17
|
-
specifier: 8.1.
|
|
18
|
-
version: 8.1.
|
|
17
|
+
specifier: 8.1.8
|
|
18
|
+
version: 8.1.8(@ai-ecoverse/slicc-kernel@1.191.4)(@aws-sdk/credential-provider-node@3.972.84)(@smithy/signature-v4@5.7.4)
|
|
19
19
|
'@ai-ecoverse/slicc-kernel':
|
|
20
20
|
specifier: 1.191.4
|
|
21
21
|
version: 1.191.4
|
|
22
22
|
|
|
23
23
|
packages:
|
|
24
24
|
|
|
25
|
-
'@ai-ecoverse/slicc-agent@8.1.
|
|
26
|
-
resolution: {integrity: sha512-
|
|
25
|
+
'@ai-ecoverse/slicc-agent@8.1.8':
|
|
26
|
+
resolution: {integrity: sha512-U5/KTUWEh9WjD22zTKMPDHsnF/HHUMGmQow2eKb49i1GhJ6vRLNiTEOYqkgnRmMqOW7L6z2mPVUPKK72+W3dwQ==}
|
|
27
27
|
engines: {node: '>=24'}
|
|
28
28
|
peerDependencies:
|
|
29
29
|
'@ai-ecoverse/slicc-kernel': '>=1.172.2 <2'
|
|
@@ -343,7 +343,7 @@ packages:
|
|
|
343
343
|
|
|
344
344
|
snapshots:
|
|
345
345
|
|
|
346
|
-
'@ai-ecoverse/slicc-agent@8.1.
|
|
346
|
+
'@ai-ecoverse/slicc-agent@8.1.8(@ai-ecoverse/slicc-kernel@1.191.4)(@aws-sdk/credential-provider-node@3.972.84)(@smithy/signature-v4@5.7.4)':
|
|
347
347
|
dependencies:
|
|
348
348
|
'@ai-ecoverse/slicc-kernel': 1.191.4
|
|
349
349
|
'@aws-sdk/middleware-websocket': 3.972.54
|