@ai-ecoverse/slicc-bios 2.9.4 → 2.10.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 CHANGED
@@ -89,7 +89,7 @@ Seven can share its origin with another app: on `www.sliccy.ai` the BIOS is `/7/
89
89
  - **Pages find the BIOS** through `os/site.js`: the folder of the service worker that controls them (`navigator.serviceWorker.controller.scriptURL`), or the origin's root when none does. The deployed lockfiles (`packages/…`), `certs.json`, the installer worker and every Reload that goes through the BIOS use it. `home()` is the BIOS without its trailing slash, and the base of follow (`#follow=`) and guest seat (`#seat=`) links.
90
90
  - **The other app's routes stay its own.** A request for a path with no OPFS file goes to the network, so six's page, its scripts and its relay at `/auth/callback`, which isn't aliased there, still load. An OPFS file is still served sandboxed, and a script request for one still gets a 403. The UI links `manifest.json`, which the service worker redirects to the BIOS's folder, so six's `/manifest.json` stays six's.
91
91
  - **Production:** `www.sliccy.ai` is production like `seven.sliccy.ai` (`PRODUCTION_HOSTS` in `os/site.js`), for kernel users and the vault.
92
- - **Sign-in** goes through six's relay page itself (see Adobe sign-in), and **the tray hub** through the BIOS's folder (see Remote devices).
92
+ - **Sign-in** goes through six's relay page itself (see Adobe sign-in), **the tray hub** through the BIOS's folder (see Remote devices), and so does **the serve hub** (`/7/api/serve/*`, see Public previews).
93
93
 
94
94
  #### Moving SLICC 6 into seven
95
95
 
@@ -531,36 +531,48 @@ Programs ask seven's page for what only a page can do through the kernel's `/dev
531
531
  - **No click:** `midi.request` gets no seven prompt and no click item: its prompt in `plugged()` answers `null`, since Chrome's MIDI permission prompt needs no user activation, so the module sends `waiting for the browser's MIDI permission prompt in seven's tab` and calls `navigator.requestMIDIAccess` (`{ sysex: true }` with `--sysex`) at once, for a typed command and an agent's alike. A blocked or dismissed prompt refuses with `MIDI access was refused in the browser` (`EACCES`). No other `midi.*` kind asks.
532
532
  - **The indicator:** while a port is open, the live list shows "MIDI port open", the handle with its name (`midi2 (IAC Driver Bus 1)`) and who opened it, with **Close**, which closes the port in seven and ends a `midi receive` on it. The chip goes when the port closes, however it closes: `midi close`, Close, the switch, unplugging, or the end of a `midi receive` that opened it (^C or `--count`).
533
533
  - **The switch:** "MIDI devices" sits after Bluetooth devices, on by default and kept in the same `slicc-os.switches`. Off refuses every `midi.*` kind with `MIDI devices are off in seven's settings` (`EACCES`), and turning it off closes every open port, clears what a timed `midi send` scheduled and hasn't played (`MIDIOutput.clear()`), ends every `midi receive` with that error and refuses a request still waiting on the browser's prompt or an open still in flight.
534
- - **Public previews** (`serve` and `scserve` from the catalog's [`@ai-ecoverse/slicc-serve`](https://github.com/ai-ecoverse/slicc-serve), [slicc-serve#6](https://github.com/ai-ecoverse/slicc-serve/issues/6); `src/seed/serve.js`): `serve` runs its static server on the kernel's loopback, or names a kernel server with `--port`, and asks the page to publish that port at a public capability URL through this seven's tray (see [Remote devices](#network)). The page then answers the tray hub's `preview.request` by fetching from the port (see [Kernel servers](#kernel-servers)). Nothing is uploaded: visitors get the files while the program that asked keeps its request open.
535
- - **`serve.publish`** (`{"kind":"serve.publish","port":8400,"root":"~/site","entry":"docs/a.html","allowLive":true}`, no body): `port` is the kernel port (1 to 65535), `root` only names it in the prompt and the chip, `entry` is a path inside it (no leading `/`, no empty, `.` or `..` segment; `\` counts as `/`), and `allowLive` (default `true`) goes to the hub as it is; slicc-serve's README has [the contract](https://github.com/ai-ecoverse/slicc-serve#the-embedder-contract). The reply's first line is `{"url","previewToken","trayId"}`, and the reply stays open. When the program closes it, or a signal or its exit does, seven revokes the preview on the hub and writes nothing more. When seven ends it, it writes one more line, `{"stopped": <reason>}`, then ends the reply: `stopped in seven` (the chip's Stop), `stopped with serve --stop`, `revoked by the tray hub` (its `preview.revoked`), `public previews were switched off` (the switch below) or `seven lost its tray` (the tray seven leads now isn't the one it minted on).
536
- - **A refusal the hub answered:** a mint whose status isn't 2xx (through the same-origin proxy, its `x-tray-status`) is the reply, not an errno, so `serve` can tell sign-in (exit 3) and limits (exit 4) from other failures: one line `{"error", "status", "code"?, "retryAfter"?, "signIn"?, "active"?, "limit"?}` and the end. `error` is the hub's, else `the tray hub answered <status>`; `code` is the hub's, and so are `active` and `limit` (the live previews in use and allowed, with `LIVE_PREVIEW_LIMIT`); `retryAfter` is its `Retry-After`; `signIn` is the hub's `signIn`, else a `Link` with `rel="login"`, else a redirect's target. A hub seven can't reach at all is `EIO` with the reason.
534
+ - **Public previews** (`serve` and `scserve` from the catalog's [`@ai-ecoverse/slicc-serve`](https://github.com/ai-ecoverse/slicc-serve), [slicc-serve#6](https://github.com/ai-ecoverse/slicc-serve/issues/6); `src/seed/serve.js`, `src/seed/serve-hub.js` and `src/seed/serve-http.js`): `serve` runs its static server on the kernel's loopback, or names a kernel server with `--port`, and asks the page to publish that port at a public capability URL on `*.sliccy.now` through sliccy-ai's serve hub ([the hub's spec](https://github.com/ai-ecoverse/sliccy-ai#previews-on-sliccynow-the-serve-hub), [sliccy-ai#167](https://github.com/ai-ecoverse/sliccy-ai/issues/167)). Serving needs no tray. The page then answers every visitor request the hub relays by speaking HTTP to the port (see The serve hub below). Nothing is uploaded: visitors get the files while the program that asked keeps its request open.
535
+ - **`serve.publish`** (`{"kind":"serve.publish","port":8400,"root":"~/site","entry":"docs/a.html"}`, no body): `port` is the kernel port (1 to 65535), `root` only names it in the prompt and the chip, and `entry` is a path inside it (no leading `/`, no empty, `.` or `..` segment; `\` counts as `/`; a query is kept). An `allowLive` that older `serve` builds still send is accepted and ignored. slicc-serve's README has [the contract](https://github.com/ai-ecoverse/slicc-serve#the-embedder-contract). The reply's first line is `{"url","previewToken"}`, with the hub's `url` as it is, and the reply stays open. When the program closes it, or a signal or its exit does, seven stops the preview on the hub and writes nothing more. When seven ends it, it writes one more line, `{"stopped": <reason>}`, then ends the reply: `stopped in seven` (the chip's Stop), `stopped with serve --stop`, `revoked by the serve hub` (its `preview.revoked`), `public previews were switched off` (the switch below) or `seven lost its serve host` (the hub deleted the host, or another tab of the same browser took over its socket).
536
+ - **A refusal the hub answered:** a mint whose status isn't 2xx is the reply, not an errno, so `serve` can tell sign-in (exit 3) and limits (exit 4) from other failures should the hub ever gate publishing: one line `{"error", "status", "code"?, "retryAfter"?, "signIn"?}` and the end. `error` and `code` are the hub's (`error` is `the serve hub answered <status>` without one); `retryAfter` is its `Retry-After`; `signIn` is the hub's `signIn`, else a `Link` with `rel="login"`. A hub seven can't reach at all is `EIO` with the reason.
537
537
  - **The prompt:** the same gesture check as `open.url`: a request typed in a terminal of an active tab goes ahead; any other, the agent's always, waits for "Publish ~/site at a public URL?" (or "the server on port 5173" without a root; "<asker> asks seven to publish ~/site at a public URL. Anyone with the link can open it while it is served.", **Publish** and Cancel). The dismissed texts are `the request to publish was dismissed` and `nobody answered the request to publish within 60 s`.
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
- - **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.
540
+ - **Minting:** the page posts `{ entry: "/<entry>", tag: "/srv/serve/<32 hex>" }` (`entry` is `/` without one) to the hub's `POST …/previews` (below). The tag is only a name the hub lists back: a fresh one per publish, never a path in seven's file system.
541
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
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).
543
+ - **Upload:** the page mints `{ entry, tag, ttlMs }` like a live preview, reads the body file by file and `PUT`s each to `…/previews/<token>/files/<path>` (each segment percent-encoded) with the host's bearer and its `Content-Type`, four at a time, reporting `uploaded 12 of 40 files` through `request.progress`, then `POST`s `…/finalize`. The hub needs the entry's file (`index.html` without an entry) and keeps the snapshot for `ttlMs` from the finalize.
544
+ - **The reply:** one line `{"url","previewToken","expiresAt","files","bytes"}` (`expiresAt` is the finalize time plus `ttlMs`, in ms since the epoch).
545
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 before the page has written its reply aborts the request, and the snapshot is stopped on the hub, even when its finalize was in flight and succeeds (#1801); once the reply is written, the snapshot stays, since `serve` may have read it.
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.
546
+ - **Kept:** a finalized snapshot outlives the page, so seven keeps `{previewToken, url, root?, entry?, since, expiresAt, uid, files, bytes}` in `localStorage` (`slicc-os.snapshots`, out of every program's reach) until it expires or is stopped, and the sweep leaves snapshots alone.
547
+ - **The serve hub:** the page is a publisher of sliccy-ai's serve hub with a host of its own.
548
+ - **Where:** on `*.sliccy.ai` the hub is the page's own origin, `<BIOS folder>/api/serve/…` (`/7/api/serve/…` on `www.sliccy.ai`), so no CORS is involved; elsewhere (`localhost`, tests) it is the origin `localStorage['slicc-os.serve-hub']` names, and without one there is none.
549
+ - **The host:** the first call creates one (`POST …/api/serve/host`, 201 `{hostId, secret}`), which seven keeps in `localStorage` (`slicc-os.serve-host`, out of every program's reach). Every other call carries `Authorization: Bearer <secret>`. A `404 HOST_NOT_FOUND` or `410 HOST_GONE` makes a new host and tries again once.
550
+ - **Calls:** `POST …/previews` mints, `GET …/previews` lists, `DELETE …/previews/<token>` stops, and snapshots `PUT …/files/<path>` and `POST …/finalize` (above).
551
+ - **The socket:** `serve.publish` opens `…/api/serve/host/<hostId>/ws` with the subprotocols `slicc-serve.v1` and `bearer.<secret>` and mints once the hub's `hello` arrives. It pings every 30 s and reconnects after 1, 2, 5, 10, then every 30 s. A socket that closes before `hello` while `serve.publish` waits for it makes the page list its previews, so a host the hub forgot is replaced and the hub's refusal reaches the request. Close 4000 (another socket took the host, which only another tab of the same browser does) ends every live preview with `seven lost its serve host` and stops reconnecting until the next `serve.publish`; 4001 (the host was deleted) ends them the same way and forgets the host. After each `hello`, a live preview minted on another host ends the same way.
552
+ - **Leftovers:** a live preview stays minted while the page is away (its visitors get 502), so at boot in the tab that runs the kernel (when it has a host), and after each `hello`, the page lists the host's previews and stops each live one whose `tag` is under `/srv/serve/` and that it doesn't serve (neither its token nor its tag is one of seven's, a mint still in flight included). Snapshots stay.
553
+ - **Visitor requests:** `http.request {id, previewToken, method, url, path, headers, body}` that is malformed (a method that isn't a token, a path that doesn't start with `/` or holds a space or control character, headers that aren't `[name, value]` pairs, a `Content-Length` that isn't a number) is `400`; `CONNECT` and `TRACE` are `405`; one for a preview seven doesn't serve (never minted, or ended) is `404` `this preview is no longer served`; and one past 16 open streams of that preview, or 64 in all, is `503` with `Retry-After: 1`. None of these dials anything. Otherwise the page dials the preview's own port with `kernel.dial` (nothing in the message chooses the port or the host) and speaks HTTP/1.1 itself: `kernel.loopbackFetch` builds a browser `Request` and `Response`, which drop `Cookie` and `Set-Cookie`. It sends the method and `path` as they came, `Host: 127.0.0.1:<port>`, the visitor's headers but the hop-by-hop ones, `host`, `expect`, `content-length` and `x-forwarded-*`, then `X-Forwarded-Host` with the host of the URL the hub minted (never the visitor's), `X-Forwarded-Proto: https` and `Connection: close`. A body goes as its binary frames arrive: with the visitor's `Content-Length` exactly that many bytes and nothing after them (so no second request reaches the port on that connection), and chunked without one. Each frame is acknowledged with `http.ack` once the port has taken it.
554
+ - **The answer:** `http.response {id, status, headers, body}` with the port's status and headers as it sent them (repeats kept, `Set-Cookie` included) but the hop-by-hop ones (and `Content-Length` next to a chunked body); a `Location` on the port (`http://127.0.0.1:<port>`, `http://localhost:<port>` or `http://<port>.kernel.localhost`) becomes its path, query and fragment, so a redirect stays on the preview. `1xx` answers are skipped. The body (none for `HEAD`, `204` and `304`; chunked, counted, or until the port closes) follows in binary frames of a 4-byte big-endian id and at most 64 KiB, at most 1 MiB unacknowledged, then `http.response.end`. So `Range`, conditional requests, streams and bodies of any size are the port's own. Nothing answering on the port is `502` `nothing answers on kernel port <port>: …`; a port that fails before its head is `502` with the reason, and after it `http.cancel` with the reason. An `http.cancel` from the hub, the socket closing, or the preview ending closes the connection to the port.
555
+ - **Bounds** (`LIMITS` in `os/serve-http.js`): the port's head must come within 25 s, else `504` `kernel port <port> didn't answer within 25 s`. After it, a stream is cancelled when for 25 s neither the port sends anything nor the hub acknowledges anything (`kernel port <port> sent nothing for 25 s`), which closes the connection to the port. A stream that keeps moving has no size or duration limit: a large download or a server-sent event stream runs as long as the visitor reads it, while seven holds at most the 1 MiB ack window of it at a time; an idle event stream ends after 25 s and `EventSource` reconnects. The stream caps above bound how many there are.
556
+ - **The bridge** goes over the same socket: `bridge.connected`, `bridge.disconnected`, `bridge.cdp.response`, `bridge.emit` and `preview.state` from the hub; `bridge.cdp.request`, `bridge.close` and `preview.state.update` to it.
547
557
  - **Whose:** each preview keeps the uid of the process that published it.
548
558
  - **`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 once the hub has revoked it (a stop that fails keeps it, so it can be stopped again), 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`.
550
- - **The bridge** (`serve --bridge`, [slicc-serve#5](https://github.com/ai-ecoverse/slicc-serve/issues/5), `src/seed/bridge.js` and `src/seed/bridge-cdp.js`; slicc-serve's README has [the contract](https://github.com/ai-ecoverse/slicc-serve#the-bridge-in-seven)): `serve.publish` with `"bridge": true`, `maxTabs` (an integer from 1 to 100, default 20, else `EIO` `invalid maxTabs`) and `quiet` makes every tab a visitor opens on the preview a CDP target of seven, `preview:<token>:<connId>`, and hands the page's `window.slicc.emit(name, detail)` to the agent. The hub does the rest as it did for SLICC 6: it injects its bootstrap into the preview's HTML, holds one `/__slicc/bridge` socket per visitor tab (at most `maxTabs`), and relays between those sockets and seven's leader socket.
551
- - **The mint** adds `bridge: true`, `maxTabs`, `quiet` and `webhookId: "serve-<16 hex>"`, a fresh name per preview; the reply's first line adds `"webhook"`. The prompt says so: "Publish ~/app at a public URL, and let the agent drive the tabs of whoever opens it?".
552
- - **The webhook:** slicc-agent delivers a webhook only to a name it has an entry for, so seven writes `/root/.slicc/webhooks/serve-<16 hex>.json` (`{"target":"cone","message":"An event from a visitor's tab on the bridged preview <url> (serve --bridge)"}`) through the kernel when it mints, removes it when the preview ends, and, each time it writes one, removes every other `serve-<16 hex>.json` there that it holds no preview for (left over from before a reload). Emits arrive as `webhook.event` with that `webhookId` and the headers `x-slicc-preview-conn` and `x-slicc-preview-token`. Seven takes one only when the connection is a live tab of that preview token, seven still holds that preview, and the `webhookId` is that preview's; any other is dropped (one from a connection seven doesn't hold with `serve: dropped an emit for <webhook> from a connection seven doesn't hold`), and so is any `serve-<16 hex>` webhook after the preview ends or of a preview it never held. It records the emit and delivers it as a webhook lick with the body `{"name","detail"}`: `name` without control characters (C0, DEL, C1, as spaces) and cut to 200 characters, and a `detail` over 16 KiB as JSON (the hub's own emit limit) or one that can't be written as JSON replaced by at most 4,096 characters of its JSON (or `null`) with `"truncated": true`. The first tab of a preview that isn't `quiet` is delivered the same way, with `x-slicc-preview-lifecycle: connected` and the body `{"origin","userAgent","connectedAt"}` (normalised as below), and seven sends `preview.state.update {previewToken, announced: true}`; the hub's `preview.state` restores `quiet` and `announced`. A delivery the agent turns down (it has no entry for the name) is logged as `serve: the agent has no webhook <name>, so it dropped the delivery`, one it can't take (no agent running) as `serve: the webhook <name>: <why>`. Webhook payloads come from strangers' browsers, and the agent treats a webhook lick as data.
559
+ - **`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 once the hub has stopped it (a stop that fails keeps it, so it can be stopped again), and stops it on the hub (`DELETE …/previews/<token>`). A token seven doesn't hold is stopped on the hub all the same. One the hub doesn't know either (`404`), and a held preview of another uid for a caller who isn't root, is `ENOENT`, `the serve hub has no such preview`. A kept snapshot minted on the tray hub before seven moved to the serve hub (its entry has a `trayId`) is unknown to the serve hub, so its stop is `EIO`, `the snapshot <token> lives on the tray hub, which seven no longer publishes through, so it ends only at its expiry`, and seven keeps listing it until then.
560
+ - **The bridge** (`serve --bridge`, [slicc-serve#5](https://github.com/ai-ecoverse/slicc-serve/issues/5), `src/seed/bridge.js` and `src/seed/bridge-cdp.js`; slicc-serve's README has [the contract](https://github.com/ai-ecoverse/slicc-serve#the-bridge-in-seven)): `serve.publish` with `"bridge": true`, `maxTabs` (an integer from 1 to 100, default 20, else `EIO` `invalid maxTabs`) and `quiet` makes every tab a visitor opens on the preview a CDP target of seven, `preview:<token>:<connId>`, and hands the page's `window.slicc.emit(name, detail)` to the agent. The hub does the rest as SLICC 6's did: it injects its bootstrap into the preview's HTML, holds one `/__slicc/bridge` socket per visitor tab (at most `maxTabs`), and relays between those sockets and the page's socket to the hub.
561
+ - **The mint** adds `bridge: true`, `maxTabs` and `quiet`. Seven names the agent's webhook for the preview itself, `serve-<16 hex>`, a fresh name per preview, and the reply's first line adds `"webhook"`. The prompt says so: "Publish ~/app at a public URL, and let the agent drive the tabs of whoever opens it?".
562
+ - **The webhook:** slicc-agent delivers a webhook only to a name it has an entry for, so seven writes `/root/.slicc/webhooks/serve-<16 hex>.json` (`{"target":"cone","message":"An event from a visitor's tab on the bridged preview <url> (serve --bridge)"}`) through the kernel when it mints, removes it when the preview ends, and, each time it writes one, removes every other `serve-<16 hex>.json` there that it holds no preview for (left over from before a reload). Emits arrive on the hub socket as `bridge.emit {previewToken, connId, name, detail, at}`. Seven takes one only when `connId` is a live tab of that preview token and seven still holds that preview; any other is dropped with `serve: dropped an emit from a connection seven doesn't hold`, a beacon's (`connId` `null`, an emit has to come from a live tab) included. A `serve-<16 hex>` `webhook.event` that comes through the tray is dropped too: those names take only the bridge's emits. It records the emit and delivers it to the preview's webhook as a webhook lick, with the headers `x-slicc-preview-conn` and `x-slicc-preview-token` and the body `{"name","detail"}`: `name` without control characters (C0, DEL, C1, as spaces) and cut to 200 characters, and a `detail` over 16 KiB as JSON (the hub's own emit limit) or one that can't be written as JSON replaced by at most 4,096 characters of its JSON (or `null`) with `"truncated": true`. The first tab of a preview that isn't `quiet` is delivered the same way, with `x-slicc-preview-lifecycle: connected` and the body `{"origin","userAgent","connectedAt"}` (normalised as below), and seven sends `preview.state.update {previewToken, announced: true}`; the hub's `preview.state` restores `quiet` and `announced`. A delivery the agent turns down (it has no entry for the name) is logged as `serve: the agent has no webhook <name>, so it dropped the delivery`, one it can't take (no agent running) as `serve: the webhook <name>: <why>`. Webhook payloads come from strangers' browsers, and the agent treats a webhook lick as data.
553
563
  - **Targets:** for each `bridge.connected` of a preview it holds (one for an unknown preview token opens nothing), seven adds a `page` target `preview:<token>:<connId>` in the browser context `preview`, with the URL and origin seven minted: the preview's URL, and its origin as the frame's `securityOrigin` and the main context's origin. Then it asks the tab for its `location.href` and `document.title` (one `Runtime.evaluate`) and takes the URL only when it is at most 2,048 characters on the preview's own origin, and the title with control characters (C0, DEL, C1) replaced by spaces and cut to 200 characters (`Target.targetInfoChanged`).
554
- - **Visitor-claimed data:** what a visitor's tab or the hub's `bridge.connected` reports (the page's URL and title, the connection's `origin` and `userAgent`, `connectedAt`, emits, every CDP answer) comes from a stranger's browser. Seven bounds it where it enters: the claimed `origin` becomes a parseable `http:`/`https:` origin or `about:invalid`, `userAgent` loses its control characters and is cut to 512 characters, `connectedAt` to 64. None of it is an input to a protected-origin decision about seven's real targets: a visitor target never gets seven's, the vault's or a privileged scheme's origin or URL, so a claim can't lower the protection of anything, and at most the guard cuts that visitor's own session. Agents and programs must treat `preview:` targets (browser context `preview`) as untrusted pages of strangers. `bridge.disconnected`, the preview's end and, 3 s after a leader reconnect, a tab the hub didn't replay (`bridge.connected` with `replay: true`, which restores a tab without a record or an announcement) drop it.
564
+ - **Visitor-claimed data:** what a visitor's tab or the hub's `bridge.connected` reports (the page's URL and title, the connection's `origin` and `userAgent`, `connectedAt`, emits, every CDP answer) comes from a stranger's browser. Seven bounds it where it enters: the claimed `origin` becomes a parseable `http:`/`https:` origin or `about:invalid`, `userAgent` loses its control characters and is cut to 512 characters, `connectedAt` to 64. None of it is an input to a protected-origin decision about seven's real targets: a visitor target never gets seven's, the vault's or a privileged scheme's origin or URL, so a claim can't lower the protection of anything, and at most the guard cuts that visitor's own session. Agents and programs must treat `preview:` targets (browser context `preview`) as untrusted pages of strangers. `bridge.disconnected`, the preview's end and, 3 s after the page's socket to the hub reconnects, a tab the hub didn't replay (`bridge.connected` with `replay: true`, which restores a tab without a record or an announcement) drop it.
555
565
  - **The CDP side** is slicc-serve's host relay (`crates/serve-hub/src/bridge.rs` and `remote.rs`, [slicc-serve#32](https://github.com/ai-ecoverse/slicc-serve/pull/32)): the `Target` domain with flat sessions (`getTargets`, `setDiscoverTargets`, `setAutoAttach`, `attachToTarget`, `detachFromTarget`, `closeTarget` as `bridge.close`, `getTargetInfo`; `createTarget`, `createBrowserContext` and `Browser.close` are `-32000`, `a preview bridge can't open or close the visitor's browser`), the same synthetic session methods (`Page.getFrameTree`, `Page.createIsolatedWorld` and `Runtime.enable`'s main context from the tab, `{}` for `Input.dispatchMouseEvent`, `Input.dispatchKeyEvent` and `Input.insertText` so that playwright-cli's in-page fallback acts exactly once), and every `Runtime.evaluate`, `Runtime.callFunctionOn`, `Runtime.getProperties`, `DOM.describeNode` and `DOM.resolveNode` sent to the tab as one `Runtime.evaluate` against a registry the page keeps (`globalThis[Symbol.for('seven.bridge')]`), so an object handle names the object itself and never runs its expression again. A `callFunctionOn` function is compiled with indirect `eval`, so it runs at the page's global scope and sees none of the bridge's own names; `Runtime.getProperties` lists a handle's own string-keyed properties from their descriptors (getters and setters as functions, never run; `accessorPropertiesOnly` honoured); a `DOM.resolveNode` handle joins its `objectGroup` like an evaluated one. Handles are `7.<context>.<n>`, the shape of Chrome's object ids, so the guard knows their context; a navigation drops them. `Page.navigate` answers with the frame and sends `Page.frameNavigated`, a new context and `Page.loadEventFired`. Everything else goes to the tab as `bridge.cdp.request`; an answer for a connection seven doesn't know is dropped, a tab that doesn't answer within 30 s is `-32000`, `the visitor's tab didn't answer within 30 s`, a tab that goes is `-32000`, `the visitor's tab is gone`, and an answer over 25 MiB as JSON is `-32000`, `the visitor's answer is over 25 MiB, so seven refused it`. An answer is taken only from the connection the request went to. For the guard, seven also answers `Page.getNavigationHistory` (the tab's one entry) and `DOM.disable`.
556
566
  - **The `preview` route:** the guard's route `preview` has the DevTools port's semantics on purpose. The extension route's special cases (synthetic auto-attach, the private frame list, tab targets) and the link route's (URLs cut by the link guard, its `stockSetup`) describe a real Chrome behind seven, and a visitor tab is neither: it is a page in a stranger's browser that answers only what the bootstrap answers, so the guard applies its general rules. It refuses before the visitor sees them `Target.sendMessageToTarget`, an attach without `flatten`, init scripts with code, `Emulation` and `Network` overrides, interception, a navigation to a protected URL and the `Debugger` domains (no debugger floor for the route), answers cookies with none, and `Browser.getVersion` says `slicc: { route: "preview" }`.
557
567
  - **Through the guard:** the kernel's CDP hook (`browserHook` in `os/cdp.js`) gives every connection without `--runtime`, while seven holds a bridged preview, the bridge's targets in a guard of their own (`guardProtected` with the route `preview`, which the guard treats like the DevTools port: neither the extension's nor a link's), joined to the guarded browser it would have picked (`joined` in `os/bridge.js`: `Target.getTargets` lists both, `setDiscoverTargets` and `setAutoAttach` go to both, a `preview:` target or a session the bridge attached goes to the bridge, everything else to the browser). With no browser to drive, the connection has the bridge's targets alone; a browser that fails for another reason (an extension that needs an update, a DevTools port that closed) is logged as `cdp: only the bridged preview's tabs, no browser: <why>`. So kernel `playwright-cli` sees visitor tabs next to the browser's, a connection seven wouldn't hand a browser (a linked device without Browser control) doesn't get them either, and nothing reaches a visitor tab past the guard. Visitor tabs belong to strangers' browsers: they are never in the Browser panel's tabs, and seven never moves one anywhere.
558
568
  - **Lifecycle records:** the last 500, in memory, of the previews seven published with the bridge: `{at, event: "connected"|"disconnected"|"emit", previewToken, connId, announced, origin?, userAgent?, connectedAt?, reason?, name?, detail?}`, with `name` cut to 200 characters and `detail` as JSON cut to 1,000. Each is also a further line of that preview's held `serve.publish` reply, which a `--foreground` `serve` prints. A stopped preview's records stay until truncated.
559
569
  - **`serve.logs`** (`{"kind":"serve.logs","previewToken"?}`): one JSON line per record, oldest first, of that preview or of every one the caller may see (its own uid's; root sees all). A token seven never bridged, or another uid's for a caller who isn't root, is `ENOENT`, `seven holds no preview <token>`. **`serve.truncate`** (same options) clears them, re-arms the first-visit announcement of each matching preview still held (`preview.state.update {announced: false}`) and answers `{"cleared","rearmed"}`.
560
- - **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`, `entry`, `maxTabs` or `previewToken` (`invalid port`, `invalid entry`, `invalid maxTabs`, `invalid previewToken`) 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.
561
- - **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 whose boot sweep revokes an orphan and not the snapshot, 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`, a program killed while the hub holds its finalize (the finalize is released once the program is gone from `ps`; the snapshot is stopped and not kept), the switch off, a `serve.stop` the hub fails (non-zero, and `serve.list` still shows the snapshot), and a second `serve.stop`, after which the hub no longer serves it and `localStorage` keeps nothing.
562
- - **Bridge trust tests:** `test/integration/bridge-trust.test.mjs` (node only) has one row per check that a visitor or the hub's messages can't pass: an unknown token on `bridge.connected`, an emit without the right token, webhook or live connection, one from a lingering tab whose preview is gone, an emit name with control characters, a `serve-<16 hex>` webhook seven holds no preview for, an oversize or deeply nested emit, an answer from another visitor's connection, an answer over 25 MiB, another visitor's object handle, a forged `preview:<token>:<conn>`, `Target.createTarget`, a duplicate `bridge.connected`, a replay, a tab the hub didn't replay after a relink, a replay under another token, a claimed URL, origin, user agent or title, a getter run by `Runtime.getProperties` (and only accessors listed with `accessorPropertiesOnly`), a resolved node's handle that its group's release keeps (or another group's drops), and a called function that sees the bridge's own names. A mutant whose text isn't in the source fails its run instead of passing it. Each row runs again against a mutant of the code with its check removed (applied at import by a module hook), and that run must fail. Two more run the bridge through the guard on the `preview` route: what it refuses before the visitor sees it, and a visitor claiming a protected origin and URL next to a real browser (the fixture of the guard tests), whose real targets keep their decisions.
563
- - **Bridge tests:** `test/integration/serve-bridge.test.mjs` publishes a `serve --local` server with the bridge on a fake tray hub that serves the preview with SLICC 6's own bootstrap (`@ai-ecoverse/cherry`'s `preview-bridge.js`, a devDependency) and relays the `bridge.*` messages like the real hub. A visitor tab in the same Chrome opens it; seven's terminal checks the mint, the webhook entry, the `connected` and `emit` lines of the held reply, the `preview.state.update`s and the first-visit delivery, and kernel `playwright-cli` lists the target, evaluates, snapshots, clicks the button exactly once (no `Input.*` reaches the tab), takes a screenshot and sees the tab go when it closes; then `serve.logs`, `serve.truncate`, `serve.stop` (the webhook entry goes, the records stay) and `ENOENT` for an unknown token. A second test drives a quiet preview's tab next to a browser through the fake extension: `tab-list` shows the real tab and the visitor target, and `tab-select` and `eval` go over the bridge.
570
+ - **Refusals:** no serve hub (a seven off `*.sliccy.ai` without `slicc-os.serve-hub`) is `ENOTSUP`, `seven publishes previews only through the serve 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 socket to the hub that isn't up within 15 s (`seven isn’t connected to the serve hub yet; try again in a moment`), a hub that can't be reached and a bad `port`, `entry`, `maxTabs` or `previewToken` (`invalid port`, `invalid entry`, `invalid maxTabs`, `invalid previewToken`) 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.
571
+ - **Tests:** `test/integration/fake-serve-hub.mjs` is a serve hub with the hub's API, its socket protocol (flow control included), its labels as `<label>.localhost:<port>` and the bridge's injection and visitor sockets. `test/integration/previews.test.mjs` publishes `httptest` on it from a raw `/dev/embedder` request, checks the boot sweep (an orphan stopped, a snapshot and a preview of another tag kept), the mint, the chip, `serve.list`, a visit, a 404 from the server, a 300 000-byte POST echoed whole, a chunked event stream and a preview seven doesn't serve (404), then ends a preview every way (the program killed, the chip's Stop, the hub's revoke, `serve.stop`, a deleted host, which also gets the page a new one, the switch, a reload) and checks each one is stopped 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 refusal comes back as the reply's `error` line; a seven without a hub refuses with `ENOTSUP`. `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, the server's own ranges (a window, a suffix, an unsatisfiable one), a 404 and a 25 MiB+1 file that comes through whole. `test/integration/previews-snapshot.test.mjs` sends `serve.snapshot` bodies from the terminal: three files (a 70 000-byte binary among them) uploaded with the host's bearer and their types and finalized, the reply, `serve.list` before and after a reload whose boot sweep stops an orphan and not the snapshot, an upload the hub refuses (`during: "upload"` with its path, then stopped), a body that announces fewer bytes than it carries (`EIO`, stopped), a refused mint, a program killed while the hub holds its finalize (the finalize is released once the program is gone from `ps`; the snapshot is stopped and not kept), the switch off, a `serve.stop` the hub fails (non-zero, and `serve.list` still shows the snapshot), and a second `serve.stop`, after which the hub no longer serves it and `localStorage` keeps no snapshot. A second test keeps a snapshot minted on the tray hub (its entry has a `trayId`) and checks that `serve.stop` fails with the message that it lives on the tray hub and that `serve.list` still shows it.
572
+ - **Bridge trust tests:** `test/integration/bridge-trust.test.mjs` (node only) has one row per check that a visitor or the hub's messages can't pass: an unknown token on `bridge.connected`, an emit without the right token or a live connection (a beacon's included), one from a lingering tab whose preview is gone, an emit name with control characters, a `serve-<16 hex>` `webhook.event` through the tray, an oversize or deeply nested emit, an answer from another visitor's connection, an answer over 25 MiB, another visitor's object handle, a forged `preview:<token>:<conn>`, `Target.createTarget`, a duplicate `bridge.connected`, a replay, a tab the hub didn't replay after a relink, a replay under another token, a claimed URL, origin, user agent or title, a getter run by `Runtime.getProperties` (and only accessors listed with `accessorPropertiesOnly`), a resolved node's handle that its group's release keeps (or another group's drops), and a called function that sees the bridge's own names. A mutant whose text isn't in the source fails its run instead of passing it. Each row runs again against a mutant of the code with its check removed (applied at import by a module hook), and that run must fail. Two more run the bridge through the guard on the `preview` route: what it refuses before the visitor sees it, and a visitor claiming a protected origin and URL next to a real browser (the fixture of the guard tests), whose real targets keep their decisions.
573
+ - **Relay tests:** `test/integration/previews-relay.test.mjs` publishes `relay-fixture` (`test/integration/fixtures/relay-fixture/`, a kernel JS server that echoes what it gets and answers silently, stalls, drips, redirects and sends large bodies on cue) on the fake serve hub and checks through visits and the hub's socket: the visitor's `Cookie`, both `Set-Cookie` lines, the method, query and body, `Host`, `X-Forwarded-Host` from the minted host even when the request names another, a redirect on the port made a path and one elsewhere kept; `400` for a malformed request, `405` for `CONNECT` and `TRACE` and `404` for a preview seven doesn't serve, none of them dialing; a body cut at its `Content-Length` with nothing after it reaching the port; sixteen silent streams answered `504` after 25 s and their connections closed, a seventeenth refused with `503` without a dial, a stream idle for 25 s cut and its connection closed, one that sends for 35 s kept whole; a 70 MiB answer to a visitor that pauses reading, with at most 1 MiB unacknowledged; and a preview's stream ended when the preview ends.
574
+ - **Relay trust tests:** `test/integration/serve-trust.test.mjs` (node only) has one row per bound of the relay, each run again against a mutant without its check, which must fail: a message's own `port` or `host` never reaches the dial, a token seven doesn't hold dials nothing, a head that doesn't come is `504` with the connection closed, a stalled body is cancelled while one that keeps sending past 120 s stays and arrives whole, the stream caps answer `503` without a dial, an answer of 65 MiB streams through with at most the 1 MiB window in flight, a body longer than its `Content-Length` goes on only up to it, `CONNECT` and `TRACE` are `405`, `X-Forwarded-Host` is the minted host, and unpublishing closes the preview's streams.
575
+ - **Bridge tests:** `test/integration/serve-bridge.test.mjs` publishes a `serve --local` server with the bridge on the fake serve hub, which serves the preview with SLICC 6's own bootstrap (`@ai-ecoverse/cherry`'s `preview-bridge.js`, a devDependency) and relays the `bridge.*` messages and emits like the real hub. A visitor tab in the same Chrome opens it; seven's terminal checks the mint, the webhook entry, the `connected` and `emit` lines of the held reply, the `preview.state.update`s and the first-visit delivery, and kernel `playwright-cli` lists the target, evaluates, snapshots, clicks the button exactly once (no `Input.*` reaches the tab), takes a screenshot and sees the tab go when it closes; then `serve.logs`, `serve.truncate`, `serve.stop` (the webhook entry goes, the records stay) and `ENOENT` for an unknown token. A second test drives a quiet preview's tab next to a browser through the fake extension: `tab-list` shows the real tab and the visitor target, and `tab-select` and `eval` go over the bridge.
564
576
  - Kinds seven doesn't list (`open.file`, `open.download`, `open.reveal`, `clipboard.read`) are `ENOTSUP` before the page sees them.
565
577
 
566
578
  ### Composer recording
@@ -654,7 +666,7 @@ A browser extension's frame inside an ordinary page, such as a password manager'
654
666
 
655
667
  - **Known limit:** slicc-extension 7.12.0 and later expose `sliccExtension.frames(tabId)`, and seven hands it to the guard, so an ordinary page with a cross-site iframe is placed and stays drivable. An older extension (7.10.0 and 7.11.x, which seven still supports) has no `frames()`, so the guard can't place the cross-site child and fails closed: the page stays locked for paint, DOM, CSS, accessibility and input, while Runtime reads still work. Once the cross-site frame is gone, the page is drivable again. `guard-paint-extension-frameless.test.mjs` asserts that limit. Extensions before 7.15.0 lock a page with an error iframe on the extension route the same way: they report the failed frame only as `kind: 'error'`, without `errorProtected`, so the guard keeps the lock. From 7.15.0 only protected error frames lock: an error entry with `errorProtected: false` counts as ordinary and the page is placed, while `true`, missing or anything else keeps the lock, and a protected frame next to it revokes the page. `guard-extension-error-frame.test.mjs` keeps the lock row for the older fake (`OLDER_FAKE`, 7.12.2) and the place and lock rows for the fake at the current extension version (`CURRENT_EXTENSION`). The shared vectors gate `C8.iframe-error` on that capability (`errorFrameClass`, slicc-browsers 1.27.3): the DevTools and link paths declare it and run the row, and the extension path declares it when the fake states 7.15.0 or later (`sendsErrorProtected`), so C8.iframe-error runs there with both variants while a protected error iframe stays locked.
656
668
 
657
- **Sign-in tabs are held for life (#754).** A sign-in popup shows its token or code in its URL and on the IdP's pages, and the guard cannot scrub a page's own content. The owner holds it before sign-in starts. A held tab and its descendants are not listed, attached, auto-attached or reported to a program on any origin until they close. bios's own tests and real-Chrome rows check the hold; the shared `C7.sign-in-hold` vectors of slicc-browsers can't measure it until the sign-in hooks (slicc-browsers#318) ship, so the guard-set harness declares `signInHold` false until then, and #1641 sets it true with the hooks.
669
+ **Sign-in tabs are held for life (#754).** A sign-in popup shows its token or code in its URL and on the IdP's pages, and the guard cannot scrub a page's own content. The owner holds it before sign-in starts. A held tab and its descendants are not listed, attached, auto-attached or reported to a program on any origin until they close. bios's own tests and real-Chrome rows check the hold, and the shared `C7.sign-in-hold` vectors run through the guard-set harness with `signInHold` declared on the DevTools and extension paths. The harness declares `signInHold` false on link (`not-supported:signInHold`): production holds a linked sign-in through a baseline (`askBase` → open → `askHold` with `based: true`), and the shared vectors' ask hook opens the popup first with no baseline step, so that path cannot answer the hold faithfully until slicc-browsers offers a prepare / baseline hook.
658
670
  - **Seven's own sign-in:** the popup opens on `about:blank#slicc-sign-in-<nonce>`. bios asks the owner over the `slicc-held` BroadcastChannel to hold it. The owner finds that target by its marker URL on each browser host (slicc-extension, a DevTools port, and a `seven: true` browser from a CLI linked on this computer), holds it, and only then is the popup sent to the IdP. slicc-cli's link guard shows seven's own popup to bios as plain `about:blank`, without the marker, so on a linked browser the owner goes by a baseline instead. Before it opens the popup, the sign-in asks the owner for a baseline (`{ type: 'base', marker }`). The owner lists every linked browser and keeps the ids it saw for that marker. Only then does it answer `based`, and only then does the sign-in open the popup. Its hold ask then says `based: true` and `expect: 1`, the number of popups the sign-in opened. On each linked browser, the owner holds, as soon as it sees them, every page on `about:blank` that one of seven's or the vault's pages opened and that wasn't in the baseline. Every listing it takes starts after `window.open` has returned. It answers `held` only when two listings in a row show the same new pages, the number of new pages it has seen in all equals `expect`, and all of them are held. If it sees more new pages than that, such as a blank another seven page opened at the same moment, it can't tell which one is the sign-in. It keeps them all held and answers `unheld`, so the sign-in stops before the IdP, and trying again works. If it sees fewer by the end of the hold's 5 s, it answers `unheld` too. `held` means the owner holds as many new pages as the sign-in opened, not that the popup is one of them: a blank another seven page opened, listed alone in two listings in a row while the popup isn't listed yet, gets `held` too. So when a linked browser took part in the ask, a `held` answer also puts the sign-in in flight, as a linked flight. The flight rule for it applies only on linked browsers: while a linked flight is on, the watcher and the sweep on a linked browser, and a program's guard on the link route, hold for life every page that one of seven's or the vault's pages opened, cross-origin pages included, as soon as they see it. A program's guard on slicc-extension and a DevTools port honours a `none` flight, as the watcher and sweep there do, but a linked flight changes nothing on those hosts, so a tab seven opens there, noopener included, stays listed and drivable as before, and their sign-in tabs are held by the marker. So the popup is held on whatever page it is first seen on: the authorize URL, a landing page IMS redirected to before anything listed it, or the login page. That doesn't depend on its URL naming seven's client id or callback, and its later pages (login, MFA, consent) stay held. The other page's blank that got the answer stays held as well: a hold is never released (#754), and the opener rules hold a protected `about:blank` anyway. A protected `about:blank` page that was already open, such as a leftover vault, MCP or sprinkle popup, is no longer taken for the sign-in, and the sign-in's hold doesn't take it. The owner takes one baseline at a time: the next sign-in's baseline waits until the previous sign-in's hold is answered, or 5 s after its baseline when no hold came, so an overlapping sign-in's baseline already lists the earlier popup. The sign-in fails closed in each of these cases: no `based` answer within 6 s while bios sees a host; a linked browser the owner couldn't list at the baseline, or one that wasn't there then; a baseline that was lost or expired; no new protected `about:blank` within the 5 s. Each says it couldn't keep the window out of reach. The marker hosts (slicc-extension, a DevTools port) still go by the marker, as before, and ignore the baseline. A hold ask without `based`, such as the agent's MCP OAuth and device-code popups, still holds every protected `about:blank` page on a linked browser, as before. The sweep, the watcher and the guard then treat a held tab on a linked browser as on the other hosts: it isn't listed, attached or read on any later page until it closes. The owner answers `held` once it has held the tab on every listed host, `none` when no host is listed, and `unheld` otherwise, including when a listed host can't be opened. On `unheld`, on `none` while bios sees a host, or on no answer within 6 s while a host is connected, the sign-in stops before the IdP and says so; it never goes on unheld. On `none`, the sign-in goes on in flight too, as before: that flight counts on every host, for the watcher and the sweep. A flight is kept per marker in `localStorage` (`slicc-os.sign-in-flight`, so a reload keeps it) for at most 11 minutes, with whether it is linked. An older bios's plain number still counts on every host; an entry that doesn't say whether it is linked counts as linked. The reverse doesn't hold: an older bios still running in another seven tab can't read the new entries and sees no flight, which only matters while tabs of both versions are open during an update. Seven's sign-in ends its own flight when it ends (its token, an error, Cancel or the timeout), so one sign-in ending doesn't end another's, in this tab or another. Before any program gets a browser connection, the owner sweeps every host: it holds sign-in tabs still on `about:blank`, and while a sign-in is in flight, every page a protected page opened. So a host that connects in the middle of a sign-in never sees its tab.
659
671
  - **Sign-in pages by their URL:** a page whose URL names seven's callback (`www.sliccy.ai/auth/callback`) or a client id seven signs in with is protected, also when the URL is percent-encoded up to five times or nested in another URL. On the link route, slicc-cli's link guard has already cut a protected URL inside another URL down to its origin, so `redirect_uri=https%3A%2F%2Fwww.sliccy.ai%2Fauth%2Fcallback` reaches bios as `redirect_uri=https://www.sliccy.ai`. On that route only, `https://www.sliccy.ai` or `www.sliccy.ai` on its own inside a URL (followed by `?`, `&`, `#`, `;`, a space or the end) counts as seven's callback too, so such a sign-in page stays hidden without the hold. A page there that only links to seven's home page is hidden too, and other `sliccy.ai` addresses aren't affected. On every route (a DevTools port, the link route and slicc-extension), a URL whose `redirect_uri` parameter names seven's bare origin `https://www.sliccy.ai`, with or without a trailing slash or a path, plain or percent-encoded up to five times, counts as seven's callback too (#1638), which also hides any other page whose URL carries such a `redirect_uri`, for example a link back to seven on another site. Such a URL only hides a page while the page is on it, also one that seven or the vault opened: once it leaves, it is listed again, unless a flight rule above held it.
660
672
  - **Puppeteer and a held tab:** over the DevTools port and the link, Chrome attaches a held tab's `tab` target before the guard knows which page it holds. When the guard cuts that tab's session on the browser session (its page is held or protected, on the tab's first command or later, or the tab's own address is protected at its attach), it reports `Target.detachedFromTarget` if the client saw it attach and `Target.targetDestroyed` in every case, once, so Puppeteer's connect, which waits for every tab it saw attach to get a page or go away, finishes while a sign-in is held.
@@ -815,11 +827,7 @@ seven can also join a tailnet, with a patched build of Tailscale's wasm client (
815
827
  - **Revoking:** the hub's `biscotto.revoked` (sent for a revoke from anywhere) and this page's own `revoke(id)` close every link of the seat at once; the agent ends the seat's Chord links and leaves nothing behind, and the hub refuses its token from then on (`INVALID_JOIN_CAPABILITY`). Seven doesn't rely on the hub for that: both also put the seat's id in a local deny list (`localStorage['slicc-os.revoked-seats']`, id → until), kept until the seat's own expiry, or 7 days when seven doesn't know it, and a join on a denied seat is refused with `UNTRUSTED` ("this guest seat was revoked") even if the hub let it through. When the hub's stop fails, `revoke` rejects with "Seven refuses this guest from now on, but the tray hub didn’t revoke the link: …", and the tab shows a warning notice (`guest-seat-stop:<id>`) with **Try again**, which retries the stop and goes once the hub takes it. The deny list stays either way.
816
828
  - **The guest's page:** opening the seat link boots the BIOS as usual (the base set and `/opt/agent` go into that browser's OPFS), then the BIOS goes straight to `os/join.html` for a `#seat` (and `os/start.js` sends one there too), a page that opts into the cross-document view transition inline, like `index.html`. That page is `<slicc-chat>` alone inside `.swc-theme` and `<sp-theme system="spectrum-two">`, with spectrum's stylesheet (`@ai-ecoverse/slicc-spectrum/swc.css`, spectrum ≥ 1.86.0: the pinned `@adobe/spectrum-wc` stylesheet with its tokens inlined), following the system's light or dark. It takes the seat URL from the fragment, removes it from the address bar and keeps it in `sessionStorage` (`slicc-os.seat`) for reloads of that tab only, installs `/opt/agent` like a follower, and dials the hub as `slicc-seven/1` with a fresh certificate each time, so a guest is never a device. It opens `pi`, calls slicc-agent's `connectGuest`, and shows `createAgentModel(guest)`, whose `seat` puts the chat in guest mode (with the assistant messages' `model` left out, since a guest gets no model list and the chat would show the raw id): the host's messages read "From the host", and the guest's messages wait for the seat's review. A dropped link reconnects. A revoked or expired seat, a refused port (`EACCES`) or another agent version (`EVERSION`) ends it: the page drops the chat, forgets the seat and says why ("This guest link isn’t valid any more.").
817
829
  - **Tests:** `test/integration/follow-guests.test.mjs` invites a guest from a real owner's Network panel against the fake hub, joins from a second browser, delivers an approved guest message, checks that a guest can't stop, abort, steer or reconfigure the cone (its message lands as a follow-up after the owner's run, never in it), can't reach sudo decisions, `connectAgent` or any other stream kind, that a follower sees the seat, and that Revoke closes the link at once and the link is refused after.
818
- - **Public previews** (see [Public previews](#requests-from-programs-devembedder)): the tray tab is the leader the hub asks for every visit to a live preview, as SLICC 6's page was (`preview-request-handler.ts`), and slicc-serve's host relay is (`crates/serve-hub/src/relay.rs`). `os/tray.js` hands `preview.request`, `preview.revoked` and `preview.state` to `os/serve.js`, and `bridge.connected`, `bridge.disconnected`, `bridge.cdp.response` and every `serve-<16 hex>` `webhook.event` to its bridge (see [the bridge](#requests-from-programs-devembedder)), which answer in the tab that runs the kernel:
819
- - **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.
820
- - **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`.
821
- - **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.
822
- - **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.
830
+ - **Public previews** don't go through the tray: the page publishes on sliccy-ai's serve hub with a host of its own (see [Public previews](#requests-from-programs-devembedder)). A `serve-<16 hex>` `webhook.event` that comes through the tray is dropped.
823
831
  - **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.
824
832
  - **Kernel side:** the kernel gets one uplink and one route table, the union of what the active exits offer, pushed with `kernel.setRoutes`.
825
833
  - **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`.
@@ -861,7 +869,7 @@ A server running inside the kernel (vite, `python -m http.server`, impeccable `l
861
869
  - The headers take longer than 30 s: `504` `sw: no answer from kernel port <port> for <path> in 30 s`.
862
870
  - After the headers, the 30 s applies to each chunk, not to the whole response. A stream that stays silent for 30 s is ended and its socket closed. `EventSource` reconnects by itself, so a server should send a comment line as a heartbeat. Chrome may also stop the service worker during a long stream, and `EventSource` reconnects then too.
863
871
 
864
- - **Publishing one.** `serve DIR` and `serve --port <n>` publish a kernel server at a public URL (see [Public previews](#requests-from-programs-devembedder)). The tray relay reaches it with the same `kernel.loopbackFetch`, GET only and without the query string, which the hub doesn't carry.
872
+ - **Publishing one.** `serve DIR` and `serve --port <n>` publish a kernel server at a public URL (see [Public previews](#requests-from-programs-devembedder)). The serve hub's relay reaches it over `kernel.dial` with every method, the query string and the request's headers and body.
865
873
 
866
874
  What doesn't work through the service worker:
867
875
 
@@ -953,6 +961,7 @@ No test calls a real model. Every test serves an empty `packages/agent/` project
953
961
 
954
962
  - **Pull requests:** after lint, the pipeline's `deploy` job publishes a `bb/**` branch's preview (see [Hosting](#hosting)); the tests and reviewers get its URL as `STAGING_URL`.
955
963
  - **Pull requests and the merge queue:** lint, then every `test/integration/*.test.mjs` split by the last runs' JUnit timings over 12 pool shards (`ci / integration`), then on a pull request the Claude and Codex reviews (`ci / review`) with this repository's `review-prompt`. The shared guard vectors run as one file per path (devtools, extension, link), target group (`seven`, `vault`, `vault-x`, `apex` and the rest, `test/integration/guard-groups.mjs`) and detach variant (`lagging` or the others), 30 files of 2 to about 12 minutes, so the split can balance them. Each path's guard gets the route bios's browser hook gives it: none (`devtools`) over the DevTools port, the linked browser's own route for the link, and `{ kind: 'extension', version }` with the per-browser tab records and the extension's `frames()` for the extension. The run fails before any row if `Browser.getVersion` through the guard doesn't answer `slicc.route` equal to the path, and prints that answer as `GUARD-ROUTE`, and next to it `GUARD-FRAMES hook <path> {route, frames, version}`: the route, whether the guard got a `frames()` hook, and the extension version the page states. Every other test that builds a guard over an extension or linked transport passes the route the browser hook would, through `guardRoute` in `test/integration/guard-route.mjs` in Node or the page's own extension or linked browser route in the page, and `guard-route.test.mjs` fails when one doesn't. The fake extension states the version the real-extension tests run (`CURRENT_EXTENSION` in `test/integration/real-extension.mjs`), which also puts the Debugger route (7.12.0 and later) under test, and answers `frames()` with the contract of ai-ecoverse/slicc-extension's `extension/cdp.js` (`frames()` and `frameReply()`): a version 2 reply with each frame's `kind`, and, only when every frame is ordinary, `rootFrameId`, the frame ids, the local frames and the cross-process owners (`frameId`, `backendNodeId`); an unsettled or failed list is refused with `slicc: refused: unsettled frame list`. Stating 7.15.0 or later it sends `errorProtected` on each error frame, computed from the failed URL as the extension does (`false` only for a plain `http(s)` address that isn't protected and has no `redirect_uri=`, `client_id=` or `/auth/callback` marker after up to 8 percent-decodes), and an error frame marked `false` counts as ordinary; then the extension route declares `errorFrameClass`, so C8.iframe-error runs there. Stating an older version (`OLDER_FAKE`, 7.12.2, the contract from v7.12.0 to v7.14.3) it refuses a list with an error frame, as those releases do, and `guard-extension-error-frame.test.mjs` keeps the lock row for it. `test/integration/fake-extension-frames.mjs` builds it from a separate browser-level connection, the way the extension's service worker reads outside the page's CDP stream. One difference: the real extension is called with a numeric tab id (`extension.frames(Number(targetId))` in `cdp.js`), while the fake's targets are Chrome target ids, so the harness passes the target id as it is. The frames-less limit row runs a fake at `MIN_EXTENSION_VERSION` (7.10.0) without `frames()`. The slicc CLI tests use `node_modules/.bin/slicc` (or `SLICC_CLI`).
964
+ - **Guard-set capabilities:** `test/integration/guard-set.mjs` hands the runner each path's capabilities (`PATHS`), and a row that needs one a path lacks is skipped as `not-supported:<capability>`, which the shared set counts as complete; a skip for a missing observer, a missing row, a failure or an incomplete row fails it. The extension path is bios's extension hook (`extensionConnection`) over a raw browser-level Chrome socket that stands in for `chrome.debugger`; it keeps `autoAttach` for the popup, tab, cross-site iframe and worker rows it passes, and `syntheticAutoAttach` for the `.synthetic` tab rows. The DevTools and extension paths declare `signInHold` (#1574 holds sign-in popups and hides callback-only authorize tabs on each) and `browserSession`, so the `C7.sign-in-hold.*` rows run there; the link path declares `signInHold` false, so those rows stay `not-supported:signInHold` as on main until the shared vectors can offer a baseline step before the popup opens. The guarded client's `signInHold.ask({ marker, hostLabel })` hook calls `askHold(marker)` in seven's page on bios's origin (`src/seed/held.js`), the hold decision a real sign-in reaches, and returns the owner's answer (`held`, `unheld` or `none`); a real sign-in also takes a baseline first (`askBase` → open → `askHold` with `based`), which only matters where the listing hides the marker (link). A `BroadcastChannel` doesn't cross origins, so the fixture's seven page can't ask bios itself. Only the DevTools path declares `jsonList`: its guarded `jsonList()` is the listing the kernel's `9222` facade serves as `/json/list` on that route (a fresh guarded connection to the DevTools host, `Target.getTargets`, mapped to `id`, `type`, `title` and `url`). When that listing is unreachable the leg is incomplete, not excluded. Extension and link leave `jsonList` undeclared, so an unavailable listing is not-supported and excluded. The unguarded observer's `jsonList()` reads Chrome's own `/json/list` on every path. The `ordinary-popup` and `ordinary-authorize` rows check that ordinary popups and authorize pages stay listed and drivable. The `.page` rows (`C3.protected-parent-iframes.page`, `C3.protected-parent-srcdoc.page`, `C3.ordinary-parent-iframes.page`) need `iframeAutoAttach`, auto-attach of non-tab iframe targets under a page session. The DevTools and link paths declare it and run them. The extension path declares it false and skips them as `not-supported:iframeAutoAttach`: the hook emulates tab auto-attach only, and `chrome.debugger` attaches no cross-site iframes or workers (see "Auto-attach through slicc-extension" above), so the grandchild, which is its own iframe target, can't be reached there. The `.page` security rows meet the content lock above as a refused top-session `Runtime.enable` or attach; the vectors count a `slicc: refused:` top-session reply as protection unless the inline ordinary-nest check shows the guard over-blocks an ordinary nest too. The skips the paths keep are real gaps: `siteIsolationOff` (CI's Chrome keeps site isolation), `secureOrigin` (the fixture serves plain HTTP, so no service workers), `closeProtected` (the guard refuses `Target.closeTarget` on a protected tab), `syntheticAutoAttach` on the DevTools and link paths (they forward Chrome's own auto-attach), `inboundDelay` on the link path (the `C8.protected-bfcache-restore` rows run on the DevTools and extension paths), `extensionFrame` off the link path and `chromeUrlsAttach` on the extension path. `not-applicable:no-ordinary-same-site-origin` has no ordinary origin same-site with a protected target, since every `sliccy.ai` host is protected, and plain `not-applicable` is the vectors' own target and scope rules.
956
965
  - **`main`:** semantic-release publishes the npm package (see [The npm package](#the-npm-package)). When it releases, the pipeline's `after-release` publishes that version to seven, in the `production` environment (see [Hosting](#hosting)).
957
966
 
958
967
  Require `ci / integration` and `ci / review`. There is no retry: a flaky test fails the run. The separate `vault drift` workflow is not required.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-bios",
3
- "version": "2.9.4",
3
+ "version": "2.10.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",
@@ -59,7 +59,7 @@
59
59
  "@ai-ecoverse/slicc-vault": "1.30.1",
60
60
  "@biomejs/biome": "2.6.7",
61
61
  "aws4fetch": "1.0.20",
62
- "es-module-lexer": "3.0.4",
62
+ "es-module-lexer": "3.0.5",
63
63
  "fake-indexeddb": "6.2.8",
64
64
  "lefthook": "2.2.2",
65
65
  "modern-tar": "0.8.6",
@@ -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.2.1",
6
+ "@ai-ecoverse/slicc-agent": "8.2.2",
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.2.1
18
- version: 8.2.1(@ai-ecoverse/slicc-kernel@1.191.4)(@aws-sdk/credential-provider-node@3.972.84)(@smithy/signature-v4@5.7.4)
17
+ specifier: 8.2.2
18
+ version: 8.2.2(@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.2.1':
26
- resolution: {integrity: sha512-MMVPwXeMVDJN30m1h5IXPdNizOpyD0NneQn/mQTmPUD1Ps2i7SMjYduUgZILogm7mlB4ekdhr85XuE48QGK3UA==}
25
+ '@ai-ecoverse/slicc-agent@8.2.2':
26
+ resolution: {integrity: sha512-0nfA/PZy/P3Bggk69VQY9mky0qxn9OEJQuvyRqhm6sf7BO3tmX838deAsmczqaXU3mcOyTprxDsex0uL6OgClw==}
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.2.1(@ai-ecoverse/slicc-kernel@1.191.4)(@aws-sdk/credential-provider-node@3.972.84)(@smithy/signature-v4@5.7.4)':
346
+ '@ai-ecoverse/slicc-agent@8.2.2(@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