@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
package/dist/process-worker.js
CHANGED
|
@@ -2914,7 +2914,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
2914
2914
|
var init_version = __esm({
|
|
2915
2915
|
"src/version.ts"() {
|
|
2916
2916
|
"use strict";
|
|
2917
|
-
KERNEL_VERSION = true ? "1.
|
|
2917
|
+
KERNEL_VERSION = true ? "1.146.1" : "0.0.0-dev";
|
|
2918
2918
|
OS_RELEASE = "6.0.0-slicc";
|
|
2919
2919
|
}
|
|
2920
2920
|
});
|
|
@@ -16543,7 +16543,7 @@ function port(n) {
|
|
|
16543
16543
|
if (!Number.isInteger(n) || n < 0 || n > 65535) throw new JsCallError("EINVAL", `port ${n}`);
|
|
16544
16544
|
return n;
|
|
16545
16545
|
}
|
|
16546
|
-
function netOps(kernel, io) {
|
|
16546
|
+
function netOps(kernel, io, sync) {
|
|
16547
16547
|
const name2 = async (fd, peer) => addressOf(await kernel.json({ op: "sock-name", fd, peer }));
|
|
16548
16548
|
const connection = async (fd) => {
|
|
16549
16549
|
const [local3, remote] = [await name2(fd, false), await name2(fd, true)];
|
|
@@ -16658,14 +16658,29 @@ function netOps(kernel, io) {
|
|
|
16658
16658
|
});
|
|
16659
16659
|
return [...r.ok && r.kind === "json" ? r.json : []];
|
|
16660
16660
|
};
|
|
16661
|
+
const inetAt = (options) => ({
|
|
16662
|
+
family: "inet",
|
|
16663
|
+
host: options.host ?? "127.0.0.1",
|
|
16664
|
+
port: port(options.port ?? 0)
|
|
16665
|
+
});
|
|
16666
|
+
const listenSync = (options = {}) => {
|
|
16667
|
+
const lane = sync;
|
|
16668
|
+
const addr = inetAt(options);
|
|
16669
|
+
const fd = lane.json({ op: "sock-open", domain: "inet" });
|
|
16670
|
+
try {
|
|
16671
|
+
lane.call({ op: "sock-bind", fd, addr });
|
|
16672
|
+
lane.call({ op: "sock-listen", fd, backlog: options.backlog ?? 128 });
|
|
16673
|
+
return listener(fd, addressOf(lane.json({ op: "sock-name", fd, peer: false })));
|
|
16674
|
+
} catch (err) {
|
|
16675
|
+
lane.raw({ op: "fd-close", fd });
|
|
16676
|
+
throw err;
|
|
16677
|
+
}
|
|
16678
|
+
};
|
|
16661
16679
|
return {
|
|
16680
|
+
sync: { listen: listenSync },
|
|
16662
16681
|
resolve: lookup2,
|
|
16663
16682
|
listen: (options = {}) => opened2(async (fd) => {
|
|
16664
|
-
const addr =
|
|
16665
|
-
family: "inet",
|
|
16666
|
-
host: options.host ?? "127.0.0.1",
|
|
16667
|
-
port: port(options.port ?? 0)
|
|
16668
|
-
};
|
|
16683
|
+
const addr = inetAt(options);
|
|
16669
16684
|
await kernel.call({ op: "sock-bind", fd, addr });
|
|
16670
16685
|
await kernel.call({ op: "sock-listen", fd, backlog: options.backlog ?? 128 });
|
|
16671
16686
|
return listener(fd, await name2(fd, false));
|
|
@@ -18106,6 +18121,14 @@ async function vfsOpen(kernel, abs, options, statOf, io, whole) {
|
|
|
18106
18121
|
handles.set(fd, handle.invalidate);
|
|
18107
18122
|
return handle.file;
|
|
18108
18123
|
}
|
|
18124
|
+
function setcredOn(syncKernel) {
|
|
18125
|
+
return (change) => {
|
|
18126
|
+
if (typeof change !== "object" || change === null || Array.isArray(change)) {
|
|
18127
|
+
throw new JsCallError("EINVAL", "setcred");
|
|
18128
|
+
}
|
|
18129
|
+
return syncKernel.json({ op: "proc-setcred", change: { ...change } });
|
|
18130
|
+
};
|
|
18131
|
+
}
|
|
18109
18132
|
function watchingSyncOps(kernel, syncKernel, shared) {
|
|
18110
18133
|
const ops = syncOps(syncKernel, shared);
|
|
18111
18134
|
const watch = (path, options, listener) => {
|
|
@@ -18250,6 +18273,7 @@ function createContext(o) {
|
|
|
18250
18273
|
run: (options) => runSync(syncKernel, { env: o.env, cwd: o.cwd, resolve, signal: signalNumber }, options),
|
|
18251
18274
|
spawn: (options) => spawnSync(options),
|
|
18252
18275
|
wasi: { create: wasi.create },
|
|
18276
|
+
net: { listen: (options) => syncNet.listen(options) },
|
|
18253
18277
|
exit: (status2 = 0) => {
|
|
18254
18278
|
exiting ??= status2 & 255;
|
|
18255
18279
|
wasi.closeAll();
|
|
@@ -18258,16 +18282,12 @@ function createContext(o) {
|
|
|
18258
18282
|
kill: killer({ self: o.pid, kernel, syncKernel, lane, writes, modes: terminal.modes }),
|
|
18259
18283
|
cred: () => syncKernel.json({ op: "proc-cred" }),
|
|
18260
18284
|
umask: (mask) => syncKernel.json(umaskRequest(mask)),
|
|
18261
|
-
setcred(
|
|
18262
|
-
if (typeof change !== "object" || change === null || Array.isArray(change)) {
|
|
18263
|
-
throw new JsCallError("EINVAL", "setcred");
|
|
18264
|
-
}
|
|
18265
|
-
return syncKernel.json({ op: "proc-setcred", change: { ...change } });
|
|
18266
|
-
}
|
|
18285
|
+
setcred: setcredOn(syncKernel)
|
|
18267
18286
|
};
|
|
18268
18287
|
const io = { read: read2, send: writeAll, close: (fd) => ctx.close(fd) };
|
|
18269
18288
|
const defaults = { env: o.env, cwd: o.cwd, signal: signalNumber };
|
|
18270
18289
|
const { spawnSync, ...children } = childOps(kernel, io, defaults, syncKernel);
|
|
18290
|
+
const { sync: syncNet, ...net } = netOps(kernel, io, syncKernel);
|
|
18271
18291
|
const strays = o.strays ?? { exception: /* @__PURE__ */ new Set(), rejection: /* @__PURE__ */ new Set() };
|
|
18272
18292
|
const ctx = {
|
|
18273
18293
|
kernel: KERNEL_INFO,
|
|
@@ -18315,7 +18335,7 @@ function createContext(o) {
|
|
|
18315
18335
|
}),
|
|
18316
18336
|
crontab: async (call2) => await kernel.json({ ...call2, op: "proc-crontab" }),
|
|
18317
18337
|
...children,
|
|
18318
|
-
net
|
|
18338
|
+
net,
|
|
18319
18339
|
websocket: websocketOp(kernel),
|
|
18320
18340
|
tty: terminal.tty,
|
|
18321
18341
|
exit,
|