@ai-ecoverse/slicc-kernel 1.39.2 → 1.39.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/dist/kernel-worker.js +1 -0
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +26 -7
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +1 -0
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +26 -7
- package/dist/process-worker.js.map +3 -3
- package/package.json +1 -1
package/dist/process-worker.js
CHANGED
|
@@ -2928,6 +2928,7 @@ function createProcessKernel(deps) {
|
|
|
2928
2928
|
if (!stream) return { none: true };
|
|
2929
2929
|
promote?.(stream);
|
|
2930
2930
|
if (stream.sliccKernelFd !== void 0) return { fd: stream.sliccKernelFd };
|
|
2931
|
+
if (((stream.node?.mode ?? 0) & S_IFMT) === S_IFDIR2 && stream.path) return { dir: stream.path };
|
|
2931
2932
|
const device2 = deviceOfStream(stream);
|
|
2932
2933
|
if (device2) return device2;
|
|
2933
2934
|
return n === 0 ? { input: drain(Fs, stream) } : { capture: true };
|
|
@@ -3071,12 +3072,14 @@ function createProcessKernel(deps) {
|
|
|
3071
3072
|
}
|
|
3072
3073
|
};
|
|
3073
3074
|
}
|
|
3074
|
-
var POLLIN2, POLLOUT2, POLLERR2, POLLHUP2, POLLNVAL, SELECT_SLICE_MS, WUNTRACED, WCONTINUED;
|
|
3075
|
+
var S_IFMT, S_IFDIR2, POLLIN2, POLLOUT2, POLLERR2, POLLHUP2, POLLNVAL, SELECT_SLICE_MS, WUNTRACED, WCONTINUED;
|
|
3075
3076
|
var init_process_children = __esm({
|
|
3076
3077
|
"src/process/process-children.ts"() {
|
|
3077
3078
|
"use strict";
|
|
3078
3079
|
init_process_fork();
|
|
3079
3080
|
init_wasi_errno();
|
|
3081
|
+
S_IFMT = 61440;
|
|
3082
|
+
S_IFDIR2 = 16384;
|
|
3080
3083
|
POLLIN2 = 1;
|
|
3081
3084
|
POLLOUT2 = 4;
|
|
3082
3085
|
POLLERR2 = 8;
|
|
@@ -3785,7 +3788,7 @@ function kernelSys(transport) {
|
|
|
3785
3788
|
kind(fd) {
|
|
3786
3789
|
return json(call2({ op: "fd-info", fd }, `fd-info ${fd}`))?.kind;
|
|
3787
3790
|
},
|
|
3788
|
-
|
|
3791
|
+
heldMeta(fd) {
|
|
3789
3792
|
return json(call2({ op: "fd-info", fd }, `fd-info ${fd}`)).meta;
|
|
3790
3793
|
},
|
|
3791
3794
|
size(fd) {
|
|
@@ -3849,9 +3852,15 @@ function wireKernelFd(Fs, streams, entry) {
|
|
|
3849
3852
|
}
|
|
3850
3853
|
function openDevice(Fs, fd, meta) {
|
|
3851
3854
|
const flags = meta.access === "read" ? O_RDONLY : meta.access === "write" ? O_WRONLY3 : O_RDWR3;
|
|
3855
|
+
return openAt(Fs, fd, `/dev/${meta.device}`, flags);
|
|
3856
|
+
}
|
|
3857
|
+
function openHeld(Fs, fd, meta) {
|
|
3858
|
+
return "dir" in meta ? openAt(Fs, fd, meta.dir, O_RDONLY | O_DIRECTORY) : openDevice(Fs, fd, meta);
|
|
3859
|
+
}
|
|
3860
|
+
function openAt(Fs, fd, path, flags) {
|
|
3852
3861
|
let stream;
|
|
3853
3862
|
try {
|
|
3854
|
-
stream = Fs.open(
|
|
3863
|
+
stream = Fs.open(path, flags);
|
|
3855
3864
|
} catch {
|
|
3856
3865
|
return false;
|
|
3857
3866
|
}
|
|
@@ -3866,8 +3875,8 @@ function wireKernelStdio(Fs, streams, sys) {
|
|
|
3866
3875
|
const stream = Fs.getStream(fd);
|
|
3867
3876
|
if (!stream) continue;
|
|
3868
3877
|
const kind = sys?.kind?.(fd);
|
|
3869
|
-
const
|
|
3870
|
-
if (
|
|
3878
|
+
const meta = kind === "device" || kind === "held" ? sys?.heldMeta?.(fd) : void 0;
|
|
3879
|
+
if (meta && openHeld(Fs, fd, meta)) continue;
|
|
3871
3880
|
if (kind && PLACED.has(kind)) {
|
|
3872
3881
|
const { flags } = stream;
|
|
3873
3882
|
Fs.closeStream(fd);
|
|
@@ -4119,7 +4128,7 @@ function runMain(running, init) {
|
|
|
4119
4128
|
return status2;
|
|
4120
4129
|
}
|
|
4121
4130
|
}
|
|
4122
|
-
var FS_OPS, O_RDONLY, O_WRONLY3, O_RDWR3, PLACED, GLUE_TRAILER, evaluateGlue, EVAL_BLOCKED;
|
|
4131
|
+
var FS_OPS, O_RDONLY, O_WRONLY3, O_RDWR3, O_DIRECTORY, PLACED, GLUE_TRAILER, evaluateGlue, EVAL_BLOCKED;
|
|
4123
4132
|
var init_process_runtime = __esm({
|
|
4124
4133
|
"src/process/process-runtime.ts"() {
|
|
4125
4134
|
"use strict";
|
|
@@ -4144,6 +4153,7 @@ var init_process_runtime = __esm({
|
|
|
4144
4153
|
O_RDONLY = 0;
|
|
4145
4154
|
O_WRONLY3 = 1;
|
|
4146
4155
|
O_RDWR3 = 2;
|
|
4156
|
+
O_DIRECTORY = 65536;
|
|
4147
4157
|
PLACED = /* @__PURE__ */ new Set(["stream", "file", "socket"]);
|
|
4148
4158
|
GLUE_TRAILER = [
|
|
4149
4159
|
"if (typeof ENV !== 'undefined') Object.assign(ENV, Module.sliccEnv);",
|
|
@@ -4640,7 +4650,7 @@ var init_wasi_fds = __esm({
|
|
|
4640
4650
|
this.fs = fs;
|
|
4641
4651
|
}
|
|
4642
4652
|
setup(cwd, inherited, root = false) {
|
|
4643
|
-
for (const fd of [0, 1, 2]) this.table.set(fd,
|
|
4653
|
+
for (const fd of [0, 1, 2]) this.table.set(fd, this.stdioEntry(fd));
|
|
4644
4654
|
const preopens = this.preopens(cwd, root);
|
|
4645
4655
|
const top = 3 + preopens.length;
|
|
4646
4656
|
for (const { fd, kind, flags, device: device2 } of inherited) {
|
|
@@ -4727,6 +4737,15 @@ var init_wasi_fds = __esm({
|
|
|
4727
4737
|
const gen = Atomics.add(this.shared, GEN, 1) + 1;
|
|
4728
4738
|
if (gen - 1 === this.seen) this.seen = gen;
|
|
4729
4739
|
}
|
|
4740
|
+
stdioEntry(fd) {
|
|
4741
|
+
let info;
|
|
4742
|
+
try {
|
|
4743
|
+
info = this.kernel.call({ op: "fd-info", fd });
|
|
4744
|
+
} catch {
|
|
4745
|
+
return kernelEntry2();
|
|
4746
|
+
}
|
|
4747
|
+
return info?.meta && "dir" in info.meta ? { type: "dir", path: info.meta.dir } : kernelEntry2();
|
|
4748
|
+
}
|
|
4730
4749
|
fetch(fd) {
|
|
4731
4750
|
let info;
|
|
4732
4751
|
try {
|