@ai-ecoverse/slicc-kernel 1.48.1 → 1.48.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 +8 -5
- package/dist/kernel-worker.js +23 -4
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +9653 -9569
- 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 +30 -10
- package/dist/process-worker.js.map +3 -3
- package/package.json +3 -3
package/dist/process-worker.js
CHANGED
|
@@ -5779,8 +5779,8 @@ var init_wasi_host = __esm({
|
|
|
5779
5779
|
return BigInt(Math.round((performance.now() - this.started) * 1e6)) + 1n;
|
|
5780
5780
|
}
|
|
5781
5781
|
environ() {
|
|
5782
|
-
const
|
|
5783
|
-
const env = { PWD: this.cwd, ...this.o.env, ...
|
|
5782
|
+
const listen2 = this.listening.length > 0 ? { SLICC_LISTEN_FDS: this.listening.join(" ") } : {};
|
|
5783
|
+
const env = { PWD: this.cwd, ...this.o.env, ...listen2 };
|
|
5784
5784
|
return Object.entries(env).map(([k, v]) => `${k}=${v}`);
|
|
5785
5785
|
}
|
|
5786
5786
|
processImports() {
|
|
@@ -9970,6 +9970,11 @@ var init_js_websocket = __esm({
|
|
|
9970
9970
|
});
|
|
9971
9971
|
|
|
9972
9972
|
// src/process/js/js-context.ts
|
|
9973
|
+
function listen(listeners, listener) {
|
|
9974
|
+
const own = (error, promise) => listener(error, promise);
|
|
9975
|
+
listeners.add(own);
|
|
9976
|
+
return () => void listeners.delete(own);
|
|
9977
|
+
}
|
|
9973
9978
|
function identityOf(answer2, fallback) {
|
|
9974
9979
|
const id = answer2;
|
|
9975
9980
|
return {
|
|
@@ -10091,6 +10096,7 @@ function createContext(o) {
|
|
|
10091
10096
|
const terminal = ttyOps(kernel);
|
|
10092
10097
|
const io = { read, send: writeAll, close: (fd) => ctx.close(fd) };
|
|
10093
10098
|
const children = childOps(kernel, io, { env: o.env, cwd: o.cwd, signal: signalNumber });
|
|
10099
|
+
const strays = o.strays ?? { exception: /* @__PURE__ */ new Set(), rejection: /* @__PURE__ */ new Set() };
|
|
10094
10100
|
const ctx = {
|
|
10095
10101
|
argv: o.argv,
|
|
10096
10102
|
env: o.env,
|
|
@@ -10138,7 +10144,9 @@ function createContext(o) {
|
|
|
10138
10144
|
net: netOps(kernel, io),
|
|
10139
10145
|
websocket: websocketOp(kernel),
|
|
10140
10146
|
tty: terminal.tty,
|
|
10141
|
-
exit
|
|
10147
|
+
exit,
|
|
10148
|
+
onUncaught: (listener) => listen(strays.exception, listener),
|
|
10149
|
+
onUnhandledRejection: (listener) => listen(strays.rejection, listener)
|
|
10142
10150
|
};
|
|
10143
10151
|
const drain2 = async () => {
|
|
10144
10152
|
for (; ; ) {
|
|
@@ -10357,19 +10365,19 @@ __export(js_runtime_exports, {
|
|
|
10357
10365
|
runJsProcess: () => runJsProcess,
|
|
10358
10366
|
trapStrays: () => trapStrays
|
|
10359
10367
|
});
|
|
10360
|
-
function trapStrays(scope2,
|
|
10368
|
+
function trapStrays(scope2, stray) {
|
|
10361
10369
|
if (typeof scope2.process?.on === "function") {
|
|
10362
|
-
scope2.process.on("unhandledRejection",
|
|
10363
|
-
scope2.process.on("uncaughtException",
|
|
10370
|
+
scope2.process.on("unhandledRejection", (err, promise) => stray("rejection", err, promise));
|
|
10371
|
+
scope2.process.on("uncaughtException", (err) => stray("exception", err));
|
|
10364
10372
|
return;
|
|
10365
10373
|
}
|
|
10366
10374
|
scope2.addEventListener?.("unhandledrejection", (event) => {
|
|
10367
10375
|
event.preventDefault();
|
|
10368
|
-
|
|
10376
|
+
stray("rejection", event.reason, event.promise);
|
|
10369
10377
|
});
|
|
10370
10378
|
scope2.addEventListener?.("error", (event) => {
|
|
10371
10379
|
event.preventDefault();
|
|
10372
|
-
|
|
10380
|
+
stray("exception", event.error);
|
|
10373
10381
|
});
|
|
10374
10382
|
}
|
|
10375
10383
|
async function settledStrays() {
|
|
@@ -10406,6 +10414,7 @@ async function runJsProcess(init, port2, deps = {}) {
|
|
|
10406
10414
|
waitAsync: deps.waitAsync
|
|
10407
10415
|
});
|
|
10408
10416
|
void kernel.watchStops();
|
|
10417
|
+
const strays = { exception: /* @__PURE__ */ new Set(), rejection: /* @__PURE__ */ new Set() };
|
|
10409
10418
|
const id = identityOf(await kernel.json({ op: "proc-identity" }), init);
|
|
10410
10419
|
kernel.pid = id.pid;
|
|
10411
10420
|
const { ctx, drain: drain2 } = createContext({
|
|
@@ -10416,12 +10425,23 @@ async function runJsProcess(init, port2, deps = {}) {
|
|
|
10416
10425
|
ppid: id.ppid,
|
|
10417
10426
|
cwd: init.cwd,
|
|
10418
10427
|
exit: (status3) => exited(statusOf(status3)),
|
|
10419
|
-
lane: laneOf(init.lane)
|
|
10428
|
+
lane: laneOf(init.lane),
|
|
10429
|
+
strays
|
|
10420
10430
|
});
|
|
10421
10431
|
const say = (text) => ctx.write(2, `${init.argv0}: ${text}
|
|
10422
10432
|
`).catch(() => void 0);
|
|
10423
10433
|
let main;
|
|
10424
|
-
trapStrays(deps.scope ?? globalThis,
|
|
10434
|
+
trapStrays(deps.scope ?? globalThis, (kind, err, promise) => {
|
|
10435
|
+
const listeners = [...strays[kind]];
|
|
10436
|
+
if (listeners.length === 0) return fail(err);
|
|
10437
|
+
for (const listener of listeners) {
|
|
10438
|
+
try {
|
|
10439
|
+
listener(err, promise);
|
|
10440
|
+
} catch (thrown) {
|
|
10441
|
+
fail(thrown);
|
|
10442
|
+
}
|
|
10443
|
+
}
|
|
10444
|
+
});
|
|
10425
10445
|
try {
|
|
10426
10446
|
(deps.lockdown ?? lockdown)();
|
|
10427
10447
|
main = mainOf(await (deps.load ?? importSource)(init.program.glue));
|