@ai-ecoverse/slicc-kernel 1.48.1 → 1.48.3
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 +9 -6
- package/dist/kernel-worker.js +23 -4
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +9659 -9570
- package/dist/node-process-worker.js.map +4 -4
- package/dist/node.js +33 -6
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +38 -13
- package/dist/process-worker.js.map +3 -3
- package/package.json +4 -4
package/dist/process-worker.js
CHANGED
|
@@ -5552,7 +5552,6 @@ function kernelFiletype(kind) {
|
|
|
5552
5552
|
case "device":
|
|
5553
5553
|
return { filetype: FILETYPE.CHARACTER_DEVICE, seeks: true };
|
|
5554
5554
|
case "socket":
|
|
5555
|
-
case "stream":
|
|
5556
5555
|
return { filetype: FILETYPE.SOCKET_STREAM, seeks: false };
|
|
5557
5556
|
case "file":
|
|
5558
5557
|
return { filetype: FILETYPE.REGULAR_FILE, seeks: true };
|
|
@@ -5589,7 +5588,7 @@ function wrap(table) {
|
|
|
5589
5588
|
}
|
|
5590
5589
|
return out;
|
|
5591
5590
|
}
|
|
5592
|
-
var WasiExit, IDS, NS_PER_MS, AT_SYMLINK_NOFOLLOW2, DEFAULT_UMASK, MONOTONIC_BASE, MAX_READ, SIGPIPE_EXIT, WasiHost;
|
|
5591
|
+
var WasiExit, IDS, NS_PER_MS, AT_SYMLINK_NOFOLLOW2, S_IFIFO, DEFAULT_UMASK, MONOTONIC_BASE, MAX_READ, SIGPIPE_EXIT, WasiHost;
|
|
5593
5592
|
var init_wasi_host = __esm({
|
|
5594
5593
|
"src/process/wasi/wasi-host.ts"() {
|
|
5595
5594
|
"use strict";
|
|
@@ -5610,6 +5609,7 @@ var init_wasi_host = __esm({
|
|
|
5610
5609
|
IDS = ["ruid", "euid", "suid", "rgid", "egid", "sgid"];
|
|
5611
5610
|
NS_PER_MS = 1000000n;
|
|
5612
5611
|
AT_SYMLINK_NOFOLLOW2 = 1;
|
|
5612
|
+
S_IFIFO = 4096;
|
|
5613
5613
|
DEFAULT_UMASK = 18;
|
|
5614
5614
|
MONOTONIC_BASE = BigInt(Math.round(performance.timeOrigin)) * NS_PER_MS;
|
|
5615
5615
|
MAX_READ = 1024 * 1024;
|
|
@@ -5686,7 +5686,12 @@ var init_wasi_host = __esm({
|
|
|
5686
5686
|
const old = this.o.kernel.call({ op: "proc-umask", mask });
|
|
5687
5687
|
mem.view().setUint32(out, old, true);
|
|
5688
5688
|
},
|
|
5689
|
-
fd_mode: (fd, out) =>
|
|
5689
|
+
fd_mode: (fd, out) => {
|
|
5690
|
+
const e = fds.get(fd);
|
|
5691
|
+
const pipe = e.type === "kernel" && fds.kind(fd, e) === "stream";
|
|
5692
|
+
const mode = pipe ? S_IFIFO | 384 : modeOf(this.o.fs.stat(pathOf(fd)));
|
|
5693
|
+
mem.view().setUint32(out, mode, true);
|
|
5694
|
+
},
|
|
5690
5695
|
path_mode: (dirfd, p, l, flags, out) => {
|
|
5691
5696
|
const path = at(dirfd, p, l);
|
|
5692
5697
|
const st = flags & AT_SYMLINK_NOFOLLOW2 ? this.o.fs.lstat(path) : this.o.fs.stat(path);
|
|
@@ -5779,8 +5784,8 @@ var init_wasi_host = __esm({
|
|
|
5779
5784
|
return BigInt(Math.round((performance.now() - this.started) * 1e6)) + 1n;
|
|
5780
5785
|
}
|
|
5781
5786
|
environ() {
|
|
5782
|
-
const
|
|
5783
|
-
const env = { PWD: this.cwd, ...this.o.env, ...
|
|
5787
|
+
const listen2 = this.listening.length > 0 ? { SLICC_LISTEN_FDS: this.listening.join(" ") } : {};
|
|
5788
|
+
const env = { PWD: this.cwd, ...this.o.env, ...listen2 };
|
|
5784
5789
|
return Object.entries(env).map(([k, v]) => `${k}=${v}`);
|
|
5785
5790
|
}
|
|
5786
5791
|
processImports() {
|
|
@@ -9970,6 +9975,11 @@ var init_js_websocket = __esm({
|
|
|
9970
9975
|
});
|
|
9971
9976
|
|
|
9972
9977
|
// src/process/js/js-context.ts
|
|
9978
|
+
function listen(listeners, listener) {
|
|
9979
|
+
const own = (error, promise) => listener(error, promise);
|
|
9980
|
+
listeners.add(own);
|
|
9981
|
+
return () => void listeners.delete(own);
|
|
9982
|
+
}
|
|
9973
9983
|
function identityOf(answer2, fallback) {
|
|
9974
9984
|
const id = answer2;
|
|
9975
9985
|
return {
|
|
@@ -10091,6 +10101,7 @@ function createContext(o) {
|
|
|
10091
10101
|
const terminal = ttyOps(kernel);
|
|
10092
10102
|
const io = { read, send: writeAll, close: (fd) => ctx.close(fd) };
|
|
10093
10103
|
const children = childOps(kernel, io, { env: o.env, cwd: o.cwd, signal: signalNumber });
|
|
10104
|
+
const strays = o.strays ?? { exception: /* @__PURE__ */ new Set(), rejection: /* @__PURE__ */ new Set() };
|
|
10094
10105
|
const ctx = {
|
|
10095
10106
|
argv: o.argv,
|
|
10096
10107
|
env: o.env,
|
|
@@ -10138,7 +10149,9 @@ function createContext(o) {
|
|
|
10138
10149
|
net: netOps(kernel, io),
|
|
10139
10150
|
websocket: websocketOp(kernel),
|
|
10140
10151
|
tty: terminal.tty,
|
|
10141
|
-
exit
|
|
10152
|
+
exit,
|
|
10153
|
+
onUncaught: (listener) => listen(strays.exception, listener),
|
|
10154
|
+
onUnhandledRejection: (listener) => listen(strays.rejection, listener)
|
|
10142
10155
|
};
|
|
10143
10156
|
const drain2 = async () => {
|
|
10144
10157
|
for (; ; ) {
|
|
@@ -10357,19 +10370,19 @@ __export(js_runtime_exports, {
|
|
|
10357
10370
|
runJsProcess: () => runJsProcess,
|
|
10358
10371
|
trapStrays: () => trapStrays
|
|
10359
10372
|
});
|
|
10360
|
-
function trapStrays(scope2,
|
|
10373
|
+
function trapStrays(scope2, stray) {
|
|
10361
10374
|
if (typeof scope2.process?.on === "function") {
|
|
10362
|
-
scope2.process.on("unhandledRejection",
|
|
10363
|
-
scope2.process.on("uncaughtException",
|
|
10375
|
+
scope2.process.on("unhandledRejection", (err, promise) => stray("rejection", err, promise));
|
|
10376
|
+
scope2.process.on("uncaughtException", (err) => stray("exception", err));
|
|
10364
10377
|
return;
|
|
10365
10378
|
}
|
|
10366
10379
|
scope2.addEventListener?.("unhandledrejection", (event) => {
|
|
10367
10380
|
event.preventDefault();
|
|
10368
|
-
|
|
10381
|
+
stray("rejection", event.reason, event.promise);
|
|
10369
10382
|
});
|
|
10370
10383
|
scope2.addEventListener?.("error", (event) => {
|
|
10371
10384
|
event.preventDefault();
|
|
10372
|
-
|
|
10385
|
+
stray("exception", event.error);
|
|
10373
10386
|
});
|
|
10374
10387
|
}
|
|
10375
10388
|
async function settledStrays() {
|
|
@@ -10406,6 +10419,7 @@ async function runJsProcess(init, port2, deps = {}) {
|
|
|
10406
10419
|
waitAsync: deps.waitAsync
|
|
10407
10420
|
});
|
|
10408
10421
|
void kernel.watchStops();
|
|
10422
|
+
const strays = { exception: /* @__PURE__ */ new Set(), rejection: /* @__PURE__ */ new Set() };
|
|
10409
10423
|
const id = identityOf(await kernel.json({ op: "proc-identity" }), init);
|
|
10410
10424
|
kernel.pid = id.pid;
|
|
10411
10425
|
const { ctx, drain: drain2 } = createContext({
|
|
@@ -10416,12 +10430,23 @@ async function runJsProcess(init, port2, deps = {}) {
|
|
|
10416
10430
|
ppid: id.ppid,
|
|
10417
10431
|
cwd: init.cwd,
|
|
10418
10432
|
exit: (status3) => exited(statusOf(status3)),
|
|
10419
|
-
lane: laneOf(init.lane)
|
|
10433
|
+
lane: laneOf(init.lane),
|
|
10434
|
+
strays
|
|
10420
10435
|
});
|
|
10421
10436
|
const say = (text) => ctx.write(2, `${init.argv0}: ${text}
|
|
10422
10437
|
`).catch(() => void 0);
|
|
10423
10438
|
let main;
|
|
10424
|
-
trapStrays(deps.scope ?? globalThis,
|
|
10439
|
+
trapStrays(deps.scope ?? globalThis, (kind, err, promise) => {
|
|
10440
|
+
const listeners = [...strays[kind]];
|
|
10441
|
+
if (listeners.length === 0) return fail(err);
|
|
10442
|
+
for (const listener of listeners) {
|
|
10443
|
+
try {
|
|
10444
|
+
listener(err, promise);
|
|
10445
|
+
} catch (thrown) {
|
|
10446
|
+
fail(thrown);
|
|
10447
|
+
}
|
|
10448
|
+
}
|
|
10449
|
+
});
|
|
10425
10450
|
try {
|
|
10426
10451
|
(deps.lockdown ?? lockdown)();
|
|
10427
10452
|
main = mainOf(await (deps.load ?? importSource)(init.program.glue));
|