@ai-ecoverse/slicc-kernel 1.73.2 → 1.74.0
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 +3 -3
- package/dist/kernel-worker.js +73 -12
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +35 -6
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +73 -12
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +249 -220
- package/dist/process-worker.js.map +4 -4
- package/package.json +2 -2
|
@@ -4002,6 +4002,7 @@ function childOps(kernel, io, defaults) {
|
|
|
4002
4002
|
const spawn = async (o) => {
|
|
4003
4003
|
const [file] = o.argv;
|
|
4004
4004
|
if (file === void 0) throw new JsCallError("EINVAL", "spawn");
|
|
4005
|
+
const group = groupOf(o, "spawn");
|
|
4005
4006
|
const mine = [];
|
|
4006
4007
|
const theirs = [];
|
|
4007
4008
|
try {
|
|
@@ -4012,7 +4013,8 @@ function childOps(kernel, io, defaults) {
|
|
|
4012
4013
|
argv: [...o.argv],
|
|
4013
4014
|
env: { ...o.env ?? defaults.env },
|
|
4014
4015
|
cwd: o.cwd ?? defaults.cwd,
|
|
4015
|
-
stdio
|
|
4016
|
+
stdio,
|
|
4017
|
+
...group
|
|
4016
4018
|
});
|
|
4017
4019
|
return childOf(pid, mine);
|
|
4018
4020
|
} catch (err) {
|
|
@@ -4024,6 +4026,15 @@ function childOps(kernel, io, defaults) {
|
|
|
4024
4026
|
};
|
|
4025
4027
|
return { spawn, wait: wait2, kill };
|
|
4026
4028
|
}
|
|
4029
|
+
function groupOf(o, call2) {
|
|
4030
|
+
const { pgid, session } = o;
|
|
4031
|
+
const valid = pgid === void 0 || Number.isInteger(pgid) && pgid >= 0;
|
|
4032
|
+
if (!valid || session !== void 0 && typeof session !== "boolean") {
|
|
4033
|
+
throw new JsCallError("EINVAL", call2);
|
|
4034
|
+
}
|
|
4035
|
+
if (session && pgid !== void 0) throw new JsCallError("EINVAL", call2);
|
|
4036
|
+
return session ? { session: true } : pgid !== void 0 ? { pgid } : {};
|
|
4037
|
+
}
|
|
4027
4038
|
async function closeAll(io, fds) {
|
|
4028
4039
|
for (const fd of fds) if (fd !== void 0) await io.close(fd).catch(() => void 0);
|
|
4029
4040
|
}
|
|
@@ -5080,6 +5091,7 @@ function decodeRun(bytes, stdout, stderr) {
|
|
|
5080
5091
|
function runSync(kernel, d, o) {
|
|
5081
5092
|
const [file] = o.argv;
|
|
5082
5093
|
if (file === void 0) throw new JsCallError("EINVAL", "run");
|
|
5094
|
+
const group = groupOf(o, "run");
|
|
5083
5095
|
const stdout = stdioOf(o.stdout);
|
|
5084
5096
|
const stderr = stderrOf(o.stderr);
|
|
5085
5097
|
const input = typeof o.input === "string" ? encoder2.encode(o.input) : o.input;
|
|
@@ -5091,6 +5103,7 @@ function runSync(kernel, d, o) {
|
|
|
5091
5103
|
argv: [...o.argv],
|
|
5092
5104
|
env: { ...o.env ?? d.env },
|
|
5093
5105
|
cwd: o.cwd === void 0 ? d.cwd : d.resolve(o.cwd),
|
|
5106
|
+
...group,
|
|
5094
5107
|
stdin: stdioOf(o.stdin),
|
|
5095
5108
|
...input ? { input } : {},
|
|
5096
5109
|
stdout,
|
|
@@ -5106,6 +5119,7 @@ var encoder2, STDIO4;
|
|
|
5106
5119
|
var init_js_run = __esm({
|
|
5107
5120
|
"src/process/js/js-run.ts"() {
|
|
5108
5121
|
"use strict";
|
|
5122
|
+
init_js_children();
|
|
5109
5123
|
init_js_kernel();
|
|
5110
5124
|
encoder2 = new TextEncoder();
|
|
5111
5125
|
STDIO4 = /* @__PURE__ */ new Set(["pipe", "ignore", "inherit"]);
|
|
@@ -5150,6 +5164,9 @@ var init_cpu_clock = __esm({
|
|
|
5150
5164
|
});
|
|
5151
5165
|
|
|
5152
5166
|
// src/realm/sync-sab-bridge.ts
|
|
5167
|
+
function syncCallCount() {
|
|
5168
|
+
return calls;
|
|
5169
|
+
}
|
|
5153
5170
|
function createSyncSabTransport(sab, port3, deps = {}) {
|
|
5154
5171
|
const views = sabViews(sab);
|
|
5155
5172
|
const { header, window } = views;
|
|
@@ -5171,6 +5188,7 @@ function createSyncSabTransport(sab, port3, deps = {}) {
|
|
|
5171
5188
|
call(req, timeoutMs, label, transfer = []) {
|
|
5172
5189
|
if (deps.memory) publishMemory(sab, deps.memory());
|
|
5173
5190
|
const id = ++seq;
|
|
5191
|
+
calls += Number(!PATH_OPS.has(req.op));
|
|
5174
5192
|
const deadline = now() + timeoutMs;
|
|
5175
5193
|
let out = null;
|
|
5176
5194
|
let status2 = 0;
|
|
@@ -5354,12 +5372,15 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
5354
5372
|
statfs: (path = "/") => parseSyncFsUsage(json2({ op: "statfs", path }, path))
|
|
5355
5373
|
};
|
|
5356
5374
|
}
|
|
5375
|
+
var PATH_OPS, calls;
|
|
5357
5376
|
var init_sync_sab_bridge = __esm({
|
|
5358
5377
|
"src/realm/sync-sab-bridge.ts"() {
|
|
5359
5378
|
"use strict";
|
|
5360
5379
|
init_cpu_clock();
|
|
5361
5380
|
init_sync_fs_wire();
|
|
5362
5381
|
init_sync_sab_wire();
|
|
5382
|
+
PATH_OPS = new Set(SYNC_FS_OPS);
|
|
5383
|
+
calls = 0;
|
|
5363
5384
|
}
|
|
5364
5385
|
});
|
|
5365
5386
|
|
|
@@ -6508,6 +6529,9 @@ function refusal(err) {
|
|
|
6508
6529
|
const code2 = err?.code;
|
|
6509
6530
|
return code2 === "EACCES" || code2 === "EPERM";
|
|
6510
6531
|
}
|
|
6532
|
+
function cachedStat(s, dir) {
|
|
6533
|
+
return s.stat !== void 0 && (!dir || s.statAt === syncCallCount());
|
|
6534
|
+
}
|
|
6511
6535
|
function linkedStates(bridgeOf) {
|
|
6512
6536
|
const opens = /* @__PURE__ */ new Map();
|
|
6513
6537
|
const byId = /* @__PURE__ */ new Map();
|
|
@@ -6590,7 +6614,8 @@ function createHelpers(Fs, ops) {
|
|
|
6590
6614
|
}
|
|
6591
6615
|
}
|
|
6592
6616
|
function freshState(stat) {
|
|
6593
|
-
|
|
6617
|
+
const statAt = syncCallCount();
|
|
6618
|
+
return { ...stat ? { stat, statAt } : {}, len: 0, loaded: false, dirty: false, openCount: 0 };
|
|
6594
6619
|
}
|
|
6595
6620
|
function makeNode(parent, name2, st) {
|
|
6596
6621
|
const node = Fs.createNode(parent, name2, modeFromStat(st), 0);
|
|
@@ -6604,9 +6629,9 @@ function createHelpers(Fs, ops) {
|
|
|
6604
6629
|
const size = node.live.ranged?.size() ?? node.live.len;
|
|
6605
6630
|
return { ...node.live.stat, size };
|
|
6606
6631
|
}
|
|
6607
|
-
if (!node.live.
|
|
6632
|
+
if (!cachedStat(node.live, Fs.isDir(node.mode))) {
|
|
6608
6633
|
const st = call2(() => bridgeOf(node).lstat(liveNodePath(linked.holder(node))));
|
|
6609
|
-
node.live
|
|
6634
|
+
Object.assign(node.live, { stat: st, statAt: syncCallCount() });
|
|
6610
6635
|
node.mode = modeFromStat(st);
|
|
6611
6636
|
}
|
|
6612
6637
|
return node.live.stat;
|
|
@@ -6755,8 +6780,9 @@ function createNodeOps(h) {
|
|
|
6755
6780
|
flushNode(node);
|
|
6756
6781
|
metadataCall(() => bridgeOf(node).utimes(path, atime, mtime, now));
|
|
6757
6782
|
};
|
|
6783
|
+
const stamped = typeof Fs.doSetAttr !== "function";
|
|
6758
6784
|
const timesOf = (node, attr2) => {
|
|
6759
|
-
const mtime = toMs(attr2.mtime) ?? attr2.timestamp;
|
|
6785
|
+
const mtime = toMs(attr2.mtime) ?? (stamped ? attr2.timestamp : void 0);
|
|
6760
6786
|
const atime = toMs(attr2.atime);
|
|
6761
6787
|
if (mtime !== void 0 && attr2.atime !== null) return [atime ?? mtime, mtime];
|
|
6762
6788
|
if (atime === void 0 && mtime === void 0) return void 0;
|
|
@@ -6765,8 +6791,10 @@ function createNodeOps(h) {
|
|
|
6765
6791
|
};
|
|
6766
6792
|
return {
|
|
6767
6793
|
getattr(node) {
|
|
6768
|
-
const st = statOf(node);
|
|
6769
6794
|
const owned = bridgeOf(node).owners === true;
|
|
6795
|
+
if (owned && Fs.isLink(node.mode) && statOf(node).uid === void 0)
|
|
6796
|
+
node.live.stat = void 0;
|
|
6797
|
+
const st = statOf(node);
|
|
6770
6798
|
const s = node.live;
|
|
6771
6799
|
const size = Fs.isDir(node.mode) ? 4096 : s.ranged?.size() ?? (s.loaded ? s.len : st.size);
|
|
6772
6800
|
const mtime = new Date(st.mtimeMs ?? 0);
|
|
@@ -7293,6 +7321,7 @@ var init_live_vfs_fs = __esm({
|
|
|
7293
7321
|
init_types();
|
|
7294
7322
|
init_wasi_errno();
|
|
7295
7323
|
init_sync_fs_wire();
|
|
7324
|
+
init_sync_sab_bridge();
|
|
7296
7325
|
S_IFDIR = 16384;
|
|
7297
7326
|
S_IFREG = 32768;
|
|
7298
7327
|
S_IFLNK = 40960;
|