@ai-ecoverse/slicc-kernel 1.47.0 → 1.47.2
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 +2 -2
- package/dist/kernel-worker.js +4 -2
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +76 -10
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +4 -2
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +76 -10
- package/dist/process-worker.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -225,7 +225,7 @@ The module's default export (or its `main` export) is called with a context and
|
|
|
225
225
|
- `wait(pid)` resolves with `{ status }` once a child ends, or `{ status: 128 + signal, signal }` when a signal ended it, without blocking the program; `kill(pid, signal)` signals any process, by number or as `'SIGTERM'` (the default);
|
|
226
226
|
- `net`: `listen({ port, host, backlog })` and `connect({ host, port, signal })` (`host` defaults to `127.0.0.1`) on the kernel's loopback, the same sockets WASIX programs use, so a JS server is reached by other processes, by the page as `<port>.kernel.localhost` (`loopbackFetch`, `dial`) and by attached clients. A listener has its `port` (as bound, so port `0` picks a free one), `accept({ signal })`, `close()` and `for await` over its connections. A connection has `local` and `remote` addresses, `readable` and `writable` web streams (closing the writable shuts down the sending side, so the peer reads the end), and `close()`. The loopback is IPv4 (`127.0.0.1` by default, or `0.0.0.0`), so an IPv6 host such as `::1` fails with `EADDRNOTAVAIL` for both `listen` and `connect`, and binding and connecting fail as they would for a WASIX program (`EADDRINUSE`, `ECONNREFUSED`, `EADDRNOTAVAIL`). A blocked accept, read or write waits without holding anything in the kernel, so aborting it or closing the socket leaves nothing behind. A write to a connection the peer closed fails with `EPIPE` and no `SIGPIPE`;
|
|
227
227
|
- `websocket(url, { protocols, headers, signal })`, a WebSocket over the kernel's transport (its `websocket`, so `fetchTransport({ webSocket: true })` in a browser), shaped like `WebSocketStream`. It resolves once the socket is open, with `url`, the `protocol` the far end chose (always one the program offered: a transport that hands back a socket with another fails the open with `EPROTO`, while browsers and Node's `WebSocket`, which `fetchTransport()` uses, fail such a handshake themselves without saying why, so the open fails with `ECONNREFUSED`), a `readable` of messages (`string` for text, `Uint8Array` for binary), a `writable` for sending them, `closed` (the `{ code, reason }` of the close, from either side, whether or not the program reads) and `close({ code, reason })`. An `http(s):` URL is taken as `ws(s):`. Sending waits while more than 1 MiB is buffered. A signal aborts the open, and after it the socket. A transport without WebSockets rejects with a `TypeError` whose `cause.code` is `ENOTSUP`, and one that cannot connect with `ECONNREFUSED`;
|
|
228
|
-
- `fetch(input, init)`, the web's `fetch` over the kernel's transport, the one the proxy uses, so the embedder's transport, its WebSocket and proxy settings and the kernel's routes apply. The response body streams as the program reads it. The request body is read whole first, since a transport takes it whole (streaming it is [#238](https://github.com/ai-ecoverse/slicc-kernel/issues/238)), and one larger than the transport's `maxRequestBody` is answered `413`, as through the proxy. A signal aborts the request at any stage. Redirects follow the fetch rules: at most 20, a 301 or 302 after a `POST` and a 303 turn into a `GET` without a body, `Authorization` is dropped across origins, and `redirect: 'manual'` returns the redirect itself. On a transport that follows redirects on its own (`fetchTransport()` in a browser) only `'follow'` works: `'manual'` and `'error'` reject with a `TypeError` whose `cause.code` is `ENOTSUP`, since such a transport never shows the program a redirect. A status the transport chose comes back as a response whose body is the reason. An unreachable host, or no transport at all, rejects with a `TypeError` whose `cause.code` is `ECONNREFUSED` or `ENETUNREACH`, as Node's `fetch` does. The global `fetch` stays withheld;
|
|
228
|
+
- `fetch(input, init)`, the web's `fetch` over the kernel's transport, the one the proxy uses, so the embedder's transport, its WebSocket and proxy settings and the kernel's routes apply. The response body streams as the program reads it. The request body is read whole first, since a transport takes it whole (streaming it is [#238](https://github.com/ai-ecoverse/slicc-kernel/issues/238)), and one larger than the transport's `maxRequestBody` is answered `413`, as through the proxy. A signal aborts the request at any stage. Redirects follow the fetch rules: at most 20, a 301 or 302 after a `POST` and a 303 turn into a `GET` without a body, `Authorization` is dropped across origins, and `redirect: 'manual'` returns the redirect itself. On a transport that follows redirects on its own (`fetchTransport()` in a browser) only `'follow'` works: `'manual'` and `'error'` reject with a `TypeError` whose `cause.code` is `ENOTSUP`, since such a transport never shows the program a redirect. A status the transport chose comes back as a response whose body is the reason. An unreachable host, or no transport at all, rejects with a `TypeError` whose `cause.code` is `ECONNREFUSED` or `ENETUNREACH`, as Node's `fetch` does. A `data:` URL is answered by `fetch` itself, as the fetch standard decodes it (a `GET` only, as in Node), without a transport; any other scheme than `http:` and `https:` rejects with a `TypeError` whose `cause.code` is `EPROTONOSUPPORT`, at the start as for a redirect target. The global `fetch` stays withheld;
|
|
229
229
|
- `tty`, for programs on a terminal: `getAttr(fd)` and `setAttr(fd, termios)` read and set its termios (`{ c_iflag, c_oflag, c_cflag, c_lflag, c_cc }`, Linux values), `setRaw(fd, raw)` switches raw mode on as libuv (and Node's `setRawMode`) does (no echo, no line editing, no `^C` signal, each key read as it comes) and off again to the termios it had before, `size(fd)` answers `{ columns, rows }`, and `foreground(fd)` and `setForeground(fd, pgrp)` get and set the foreground process group, under the same job-control rules as other programs. A window resize arrives as `SIGWINCH` through `signals`. A terminal the program left raw is set back when the program ends, whether it returns, exits or throws (a program killed by a signal cannot do so). On a descriptor that is not a terminal, each call fails with `ENOTTY`;
|
|
230
230
|
- `exit(status)`, which ends the program once its pending writes are done.
|
|
231
231
|
|
|
@@ -495,7 +495,7 @@ OPFS stays authoritative: an entry is consulted only for a path that exists in O
|
|
|
495
495
|
|
|
496
496
|
The database is `slicc-kernel` (or the `metadata` option), schema version 1, with one object store, `entries`, keyed by absolute path (`keyPath: 'path'`) and an index `dir` on the parent directory of symlinks. A record looks like `{ path, mode?, atimeMs?, mtimeMs?, mtimeFor?, ctimeMs?, ino?, link?, dir? }`, where `mtimeFor` is the OPFS `lastModified` an explicit `mtimeMs` belongs to. A future schema bumps the version and migrates in `onupgradeneeded`; an older kernel then closes its connection. The sidecar is keyed by path from the `root` handle, so use a different `metadata` name for each distinct root.
|
|
497
497
|
|
|
498
|
-
Not covered: hard links (they fail with `EMLINK`, as Emscripten reports; OPFS cannot share contents between names) and file ownership. Emscripten's `chown` doesn't pass the owner to filesystem backends, so there is nothing to store,
|
|
498
|
+
Not covered: hard links (they fail with `EMLINK`, as Emscripten reports; OPFS cannot share contents between names) and file ownership. Emscripten's `chown` doesn't pass the owner to filesystem backends, so there is nothing to store. Until owners are stored, an Emscripten process sees every file as owned by its own effective uid and gid (root's 0 by default, a user's own ids when it runs as one, and the new ids after a `setuid`), so owner checks such as git's `safe.directory`, ssh's key checks and gnupg's home directory check pass, as WASIX programs already see through their libc. Emscripten also doesn't enforce permission bits, so a file runs whether or not its exec bit is set; the bits are what `ls`, `stat` and `test` report.
|
|
499
499
|
|
|
500
500
|
Reads retry briefly when a concurrent write has invalidated the OPFS file snapshot (`NotReadableError`).
|
|
501
501
|
|
package/dist/kernel-worker.js
CHANGED
|
@@ -10206,7 +10206,7 @@ function openLane(token, dispatch2) {
|
|
|
10206
10206
|
}
|
|
10207
10207
|
};
|
|
10208
10208
|
}
|
|
10209
|
-
function processInit(opts, sab, umask, lane) {
|
|
10209
|
+
function processInit(opts, sab, umask, cred, lane) {
|
|
10210
10210
|
const base = {
|
|
10211
10211
|
type: WASM_PROCESS_INIT,
|
|
10212
10212
|
pid: opts.shownPid ?? opts.pid,
|
|
@@ -10216,6 +10216,7 @@ function processInit(opts, sab, umask, lane) {
|
|
|
10216
10216
|
cwd: opts.cwd,
|
|
10217
10217
|
sab,
|
|
10218
10218
|
umask,
|
|
10219
|
+
cred,
|
|
10219
10220
|
...opts.ppid !== void 0 ? { ppid: opts.ppid } : {}
|
|
10220
10221
|
};
|
|
10221
10222
|
if (opts.program.abi === "js") {
|
|
@@ -10394,13 +10395,14 @@ function spawnWasmProcess(opts) {
|
|
|
10394
10395
|
env: opts.env,
|
|
10395
10396
|
cwd: opts.cwd,
|
|
10396
10397
|
sab: tsab,
|
|
10398
|
+
cred: copyCred(process.cred),
|
|
10397
10399
|
...opts.ppid !== void 0 ? { ppid: opts.ppid } : {},
|
|
10398
10400
|
thread
|
|
10399
10401
|
};
|
|
10400
10402
|
tw.postMessage(tinit);
|
|
10401
10403
|
};
|
|
10402
10404
|
worker.postMessage(
|
|
10403
|
-
processInit(opts, sab, process.umask, lane?.lane),
|
|
10405
|
+
processInit(opts, sab, process.umask, copyCred(process.cred), lane?.lane),
|
|
10404
10406
|
transferOf(opts, lane?.lane)
|
|
10405
10407
|
);
|
|
10406
10408
|
const signal = (sig) => {
|