@ai-ecoverse/slicc-kernel 1.145.1 → 1.146.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 +1 -1
- package/dist/kernel-worker.js +4 -1
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +34 -14
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +4 -1
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +34 -14
- package/dist/process-worker.js.map +2 -2
- package/dist/types/kernel/vfs-file.d.ts +1 -0
- package/dist/types/process/js/js-net.d.ts +7 -1
- package/dist/types/process/js/js-sync.d.ts +3 -1
- package/package.json +5 -5
|
@@ -6800,7 +6800,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
6800
6800
|
var init_version = __esm({
|
|
6801
6801
|
"src/version.ts"() {
|
|
6802
6802
|
"use strict";
|
|
6803
|
-
KERNEL_VERSION = true ? "1.
|
|
6803
|
+
KERNEL_VERSION = true ? "1.146.1" : "0.0.0-dev";
|
|
6804
6804
|
OS_RELEASE = "6.0.0-slicc";
|
|
6805
6805
|
}
|
|
6806
6806
|
});
|
|
@@ -7715,7 +7715,7 @@ function port(n) {
|
|
|
7715
7715
|
if (!Number.isInteger(n) || n < 0 || n > 65535) throw new JsCallError("EINVAL", `port ${n}`);
|
|
7716
7716
|
return n;
|
|
7717
7717
|
}
|
|
7718
|
-
function netOps(kernel, io) {
|
|
7718
|
+
function netOps(kernel, io, sync) {
|
|
7719
7719
|
const name2 = async (fd, peer) => addressOf(await kernel.json({ op: "sock-name", fd, peer }));
|
|
7720
7720
|
const connection = async (fd) => {
|
|
7721
7721
|
const [local3, remote] = [await name2(fd, false), await name2(fd, true)];
|
|
@@ -7830,14 +7830,29 @@ function netOps(kernel, io) {
|
|
|
7830
7830
|
});
|
|
7831
7831
|
return [...r.ok && r.kind === "json" ? r.json : []];
|
|
7832
7832
|
};
|
|
7833
|
+
const inetAt = (options) => ({
|
|
7834
|
+
family: "inet",
|
|
7835
|
+
host: options.host ?? "127.0.0.1",
|
|
7836
|
+
port: port(options.port ?? 0)
|
|
7837
|
+
});
|
|
7838
|
+
const listenSync = (options = {}) => {
|
|
7839
|
+
const lane = sync;
|
|
7840
|
+
const addr = inetAt(options);
|
|
7841
|
+
const fd = lane.json({ op: "sock-open", domain: "inet" });
|
|
7842
|
+
try {
|
|
7843
|
+
lane.call({ op: "sock-bind", fd, addr });
|
|
7844
|
+
lane.call({ op: "sock-listen", fd, backlog: options.backlog ?? 128 });
|
|
7845
|
+
return listener(fd, addressOf(lane.json({ op: "sock-name", fd, peer: false })));
|
|
7846
|
+
} catch (err) {
|
|
7847
|
+
lane.raw({ op: "fd-close", fd });
|
|
7848
|
+
throw err;
|
|
7849
|
+
}
|
|
7850
|
+
};
|
|
7833
7851
|
return {
|
|
7852
|
+
sync: { listen: listenSync },
|
|
7834
7853
|
resolve: lookup2,
|
|
7835
7854
|
listen: (options = {}) => opened2(async (fd) => {
|
|
7836
|
-
const addr =
|
|
7837
|
-
family: "inet",
|
|
7838
|
-
host: options.host ?? "127.0.0.1",
|
|
7839
|
-
port: port(options.port ?? 0)
|
|
7840
|
-
};
|
|
7855
|
+
const addr = inetAt(options);
|
|
7841
7856
|
await kernel.call({ op: "sock-bind", fd, addr });
|
|
7842
7857
|
await kernel.call({ op: "sock-listen", fd, backlog: options.backlog ?? 128 });
|
|
7843
7858
|
return listener(fd, await name2(fd, false));
|
|
@@ -15393,6 +15408,14 @@ async function vfsOpen(kernel, abs, options, statOf, io, whole) {
|
|
|
15393
15408
|
handles.set(fd, handle.invalidate);
|
|
15394
15409
|
return handle.file;
|
|
15395
15410
|
}
|
|
15411
|
+
function setcredOn(syncKernel) {
|
|
15412
|
+
return (change) => {
|
|
15413
|
+
if (typeof change !== "object" || change === null || Array.isArray(change)) {
|
|
15414
|
+
throw new JsCallError("EINVAL", "setcred");
|
|
15415
|
+
}
|
|
15416
|
+
return syncKernel.json({ op: "proc-setcred", change: { ...change } });
|
|
15417
|
+
};
|
|
15418
|
+
}
|
|
15396
15419
|
function watchingSyncOps(kernel, syncKernel, shared) {
|
|
15397
15420
|
const ops = syncOps(syncKernel, shared);
|
|
15398
15421
|
const watch = (path, options, listener) => {
|
|
@@ -15537,6 +15560,7 @@ function createContext(o) {
|
|
|
15537
15560
|
run: (options) => runSync(syncKernel, { env: o.env, cwd: o.cwd, resolve: resolve2, signal: signalNumber }, options),
|
|
15538
15561
|
spawn: (options) => spawnSync(options),
|
|
15539
15562
|
wasi: { create: wasi.create },
|
|
15563
|
+
net: { listen: (options) => syncNet.listen(options) },
|
|
15540
15564
|
exit: (status2 = 0) => {
|
|
15541
15565
|
exiting ??= status2 & 255;
|
|
15542
15566
|
wasi.closeAll();
|
|
@@ -15545,16 +15569,12 @@ function createContext(o) {
|
|
|
15545
15569
|
kill: killer({ self: o.pid, kernel, syncKernel, lane, writes, modes: terminal.modes }),
|
|
15546
15570
|
cred: () => syncKernel.json({ op: "proc-cred" }),
|
|
15547
15571
|
umask: (mask) => syncKernel.json(umaskRequest(mask)),
|
|
15548
|
-
setcred(
|
|
15549
|
-
if (typeof change !== "object" || change === null || Array.isArray(change)) {
|
|
15550
|
-
throw new JsCallError("EINVAL", "setcred");
|
|
15551
|
-
}
|
|
15552
|
-
return syncKernel.json({ op: "proc-setcred", change: { ...change } });
|
|
15553
|
-
}
|
|
15572
|
+
setcred: setcredOn(syncKernel)
|
|
15554
15573
|
};
|
|
15555
15574
|
const io = { read: read2, send: writeAll, close: (fd) => ctx.close(fd) };
|
|
15556
15575
|
const defaults = { env: o.env, cwd: o.cwd, signal: signalNumber };
|
|
15557
15576
|
const { spawnSync, ...children } = childOps(kernel, io, defaults, syncKernel);
|
|
15577
|
+
const { sync: syncNet, ...net } = netOps(kernel, io, syncKernel);
|
|
15558
15578
|
const strays = o.strays ?? { exception: /* @__PURE__ */ new Set(), rejection: /* @__PURE__ */ new Set() };
|
|
15559
15579
|
const ctx = {
|
|
15560
15580
|
kernel: KERNEL_INFO,
|
|
@@ -15602,7 +15622,7 @@ function createContext(o) {
|
|
|
15602
15622
|
}),
|
|
15603
15623
|
crontab: async (call2) => await kernel.json({ ...call2, op: "proc-crontab" }),
|
|
15604
15624
|
...children,
|
|
15605
|
-
net
|
|
15625
|
+
net,
|
|
15606
15626
|
websocket: websocketOp(kernel),
|
|
15607
15627
|
tty: terminal.tty,
|
|
15608
15628
|
exit,
|