@ai-ecoverse/slicc-kernel 1.140.0 → 1.140.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 +2 -2
- package/dist/kernel-worker.js +92 -34
- package/dist/kernel-worker.js.map +3 -3
- package/dist/meta.js +5 -3
- package/dist/meta.js.map +2 -2
- package/dist/node-process-worker.js +86 -12
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +87 -31
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +86 -12
- package/dist/process-worker.js.map +3 -3
- package/dist/types/fs/meta.d.ts +3 -3
- package/dist/types/process/wasi/wasi-fds.d.ts +1 -0
- package/dist/types/process/wasi/wasi-procfs.d.ts +1 -0
- package/dist/types/realm/sync-fs-wire.d.ts +1 -0
- package/package.json +4 -4
package/dist/process-worker.js
CHANGED
|
@@ -2775,7 +2775,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
2775
2775
|
var init_version = __esm({
|
|
2776
2776
|
"src/version.ts"() {
|
|
2777
2777
|
"use strict";
|
|
2778
|
-
KERNEL_VERSION = true ? "1.140.
|
|
2778
|
+
KERNEL_VERSION = true ? "1.140.2" : "0.0.0-dev";
|
|
2779
2779
|
OS_RELEASE = "6.0.0-slicc";
|
|
2780
2780
|
}
|
|
2781
2781
|
});
|
|
@@ -9307,6 +9307,8 @@ var init_wasi_fds = __esm({
|
|
|
9307
9307
|
if (kernelDevice !== void 0) return kernelDevice;
|
|
9308
9308
|
const alias = stdioAlias(path);
|
|
9309
9309
|
if (alias !== void 0) return this.reopen(alias);
|
|
9310
|
+
const outside = this.escaped(path, oflags, rights);
|
|
9311
|
+
if (outside !== void 0) return this.open(outside, oflags, rights, fdflags, mode);
|
|
9310
9312
|
if (exclusive && !(oflags & OFLAGS.DIRECTORY) && this.madeAtOnce(path, mode)) {
|
|
9311
9313
|
return this.regular(path, void 0, oflags, rights, fdflags, mode, true);
|
|
9312
9314
|
}
|
|
@@ -9325,6 +9327,12 @@ var init_wasi_fds = __esm({
|
|
|
9325
9327
|
refuseWrite(s, oflags, rights);
|
|
9326
9328
|
return this.regular(path, s, oflags, rights, fdflags, mode);
|
|
9327
9329
|
}
|
|
9330
|
+
escaped(path, oflags, rights) {
|
|
9331
|
+
const outside = this.fs.escape?.(path);
|
|
9332
|
+
if (outside === void 0) return void 0;
|
|
9333
|
+
refuseWrite({ readonly: true }, oflags | (oflags & OFLAGS.CREAT ? OFLAGS.TRUNC : 0), rights);
|
|
9334
|
+
return outside;
|
|
9335
|
+
}
|
|
9328
9336
|
regular(path, s, oflags, rights, fdflags, mode, created = false) {
|
|
9329
9337
|
if (s?.isFifo) return this.kernelFifo(path, s, oflags, rights, fdflags);
|
|
9330
9338
|
if (s?.isSocket) throw new WasiError("ENXIO");
|
|
@@ -12396,10 +12404,12 @@ function directMiss(err, path) {
|
|
|
12396
12404
|
if (err?.direct !== true) return false;
|
|
12397
12405
|
return !path.split("/").some((part) => part === "." || part === "..");
|
|
12398
12406
|
}
|
|
12399
|
-
function
|
|
12400
|
-
|
|
12401
|
-
|
|
12402
|
-
|
|
12407
|
+
function routing(tree, toProc, shadowing) {
|
|
12408
|
+
return (p, inner, own, follow3 = true, outside) => {
|
|
12409
|
+
const proc = (q) => {
|
|
12410
|
+
const target = outside ? tree.escape(q) : void 0;
|
|
12411
|
+
return target === void 0 ? inner(q) : outside(target);
|
|
12412
|
+
};
|
|
12403
12413
|
if (inProc(p)) return proc(p);
|
|
12404
12414
|
if (shadowing()) {
|
|
12405
12415
|
const real = toProc(p, follow3);
|
|
@@ -12414,6 +12424,11 @@ function procfsBridge(fs, tree) {
|
|
|
12414
12424
|
return proc(real);
|
|
12415
12425
|
}
|
|
12416
12426
|
};
|
|
12427
|
+
}
|
|
12428
|
+
function procfsBridge(fs, tree) {
|
|
12429
|
+
const toProc = (path, follow3) => procPath(fs, path, follow3);
|
|
12430
|
+
const shadowing = physicalProc(fs);
|
|
12431
|
+
const via = routing(tree, toProc, shadowing);
|
|
12417
12432
|
const readOnly2 = (paths, run) => {
|
|
12418
12433
|
const physical2 = shadowing();
|
|
12419
12434
|
for (const [p, follow3] of paths) {
|
|
@@ -12436,12 +12451,16 @@ function procfsBridge(fs, tree) {
|
|
|
12436
12451
|
readFile: (p) => via(
|
|
12437
12452
|
p,
|
|
12438
12453
|
(q) => tree.read(q),
|
|
12439
|
-
() => fs.readFile(p)
|
|
12454
|
+
() => fs.readFile(p),
|
|
12455
|
+
true,
|
|
12456
|
+
(t) => fs.readFile(t)
|
|
12440
12457
|
),
|
|
12441
12458
|
stat: (p) => via(
|
|
12442
12459
|
p,
|
|
12443
12460
|
(q) => tree.stat(q),
|
|
12444
|
-
() => fs.stat(p)
|
|
12461
|
+
() => fs.stat(p),
|
|
12462
|
+
true,
|
|
12463
|
+
(t) => fs.stat(t)
|
|
12445
12464
|
),
|
|
12446
12465
|
lstat: (p) => via(
|
|
12447
12466
|
p,
|
|
@@ -12520,6 +12539,7 @@ function procfsBridge(fs, tree) {
|
|
|
12520
12539
|
return via(p, snapshot, () => fs.hold?.(p, held2, open, void 0, want, seen) ?? late(p));
|
|
12521
12540
|
},
|
|
12522
12541
|
kept: (handle) => snapshots.has(handle) || fs.kept?.(handle) === true,
|
|
12542
|
+
escape: (p) => inProc(p) ? tree.escape(p) : void 0,
|
|
12523
12543
|
pinned: (handle) => {
|
|
12524
12544
|
const bytes = snapshots.get(handle);
|
|
12525
12545
|
return bytes ? frozen(bytes) : fs.pinned?.(handle) ?? fs;
|
|
@@ -12700,6 +12720,12 @@ var init_wasi_procfs = __esm({
|
|
|
12700
12720
|
if (node.kind !== "dir") throw syncError("ENOTDIR", path);
|
|
12701
12721
|
return node.names();
|
|
12702
12722
|
}
|
|
12723
|
+
escape(path) {
|
|
12724
|
+
const node = this.node(this.parts(path, true));
|
|
12725
|
+
if (node?.kind !== "link" || !node.target.startsWith("/")) return void 0;
|
|
12726
|
+
if (node.denied) throw syncError("EACCES", path);
|
|
12727
|
+
return node.target;
|
|
12728
|
+
}
|
|
12703
12729
|
readlink(path) {
|
|
12704
12730
|
const node = this.find(path, false);
|
|
12705
12731
|
if (node.kind !== "link") throw syncError("EINVAL", path);
|
|
@@ -14538,7 +14564,29 @@ function nameFrame(line, module, name2) {
|
|
|
14538
14564
|
const found = name2(Number(m[4]));
|
|
14539
14565
|
return found === void 0 ? line : `${m[1]}${found} (${m[2]})`;
|
|
14540
14566
|
}
|
|
14541
|
-
function
|
|
14567
|
+
function definedFunctions(bytes) {
|
|
14568
|
+
let at = 8;
|
|
14569
|
+
const leb = () => {
|
|
14570
|
+
let value2 = 0;
|
|
14571
|
+
let shift = 0;
|
|
14572
|
+
let byte;
|
|
14573
|
+
do {
|
|
14574
|
+
if (at >= bytes.length) throw new RangeError("truncated module");
|
|
14575
|
+
byte = bytes[at++];
|
|
14576
|
+
value2 += (byte & 127) * 2 ** shift;
|
|
14577
|
+
shift += 7;
|
|
14578
|
+
} while (byte & 128);
|
|
14579
|
+
return value2;
|
|
14580
|
+
};
|
|
14581
|
+
while (at < bytes.length) {
|
|
14582
|
+
const id = bytes[at++];
|
|
14583
|
+
const size = leb();
|
|
14584
|
+
if (id === 3) return leb();
|
|
14585
|
+
at += size;
|
|
14586
|
+
}
|
|
14587
|
+
return 0;
|
|
14588
|
+
}
|
|
14589
|
+
function sidecarNames(read2, path, fit) {
|
|
14542
14590
|
let names;
|
|
14543
14591
|
return (index3) => {
|
|
14544
14592
|
if (!names) {
|
|
@@ -14547,6 +14595,20 @@ function sidecarNames(read2, path) {
|
|
|
14547
14595
|
} catch {
|
|
14548
14596
|
names = /* @__PURE__ */ new Map();
|
|
14549
14597
|
}
|
|
14598
|
+
let want = names.size;
|
|
14599
|
+
try {
|
|
14600
|
+
if (fit) want = fit.functions();
|
|
14601
|
+
} catch {
|
|
14602
|
+
fit?.warn(`${path} can't be checked against the module, so the frames show raw indices`);
|
|
14603
|
+
names = /* @__PURE__ */ new Map();
|
|
14604
|
+
return void 0;
|
|
14605
|
+
}
|
|
14606
|
+
if (fit && names.size !== want) {
|
|
14607
|
+
fit.warn(
|
|
14608
|
+
`${path} names ${names.size} functions, but the module has ${want}: it doesn't fit, so the frames show raw indices`
|
|
14609
|
+
);
|
|
14610
|
+
names = /* @__PURE__ */ new Map();
|
|
14611
|
+
}
|
|
14550
14612
|
}
|
|
14551
14613
|
return names.get(index3);
|
|
14552
14614
|
};
|
|
@@ -15037,7 +15099,7 @@ async function runWasiProcess(init, port2) {
|
|
|
15037
15099
|
if (e instanceof WasiExit) return e.code;
|
|
15038
15100
|
if (!(e instanceof WebAssembly.RuntimeError)) throw e;
|
|
15039
15101
|
try {
|
|
15040
|
-
say(
|
|
15102
|
+
say(trapReport(e, init, host, ""));
|
|
15041
15103
|
} catch {
|
|
15042
15104
|
throw new Error(`${init.argv0}: wasm trap: ${e.message}`);
|
|
15043
15105
|
}
|
|
@@ -15056,9 +15118,21 @@ function trapMessage(e, env, where = "", name2) {
|
|
|
15056
15118
|
return frames.length ? `${head}
|
|
15057
15119
|
${frames.join("\n")}` : head;
|
|
15058
15120
|
}
|
|
15059
|
-
function
|
|
15121
|
+
function trapReport(e, init, host, where) {
|
|
15122
|
+
const warned = [];
|
|
15123
|
+
const message2 = trapMessage(e, init.env, where, programNames(host, init.program, warned));
|
|
15124
|
+
return [...warned, message2].join(`
|
|
15125
|
+
${init.argv0}: `);
|
|
15126
|
+
}
|
|
15127
|
+
function programNames(host, program, warned) {
|
|
15060
15128
|
const path = program.names;
|
|
15061
|
-
|
|
15129
|
+
if (path === void 0) return void 0;
|
|
15130
|
+
const read2 = (p) => host.o.fs.readFile(p);
|
|
15131
|
+
const imported = WebAssembly.Module.imports(program.module).filter((i) => i.kind === "function");
|
|
15132
|
+
return sidecarNames(read2, path, {
|
|
15133
|
+
functions: () => imported.length + definedFunctions(read2(program.path)),
|
|
15134
|
+
warn: (line) => warned.push(line)
|
|
15135
|
+
});
|
|
15062
15136
|
}
|
|
15063
15137
|
async function programImports(program, host, transport, tid) {
|
|
15064
15138
|
if (program.imports === void 0) return void 0;
|
|
@@ -15139,7 +15213,7 @@ async function runWasiThread(init, port2) {
|
|
|
15139
15213
|
}
|
|
15140
15214
|
if (e instanceof WebAssembly.RuntimeError) {
|
|
15141
15215
|
try {
|
|
15142
|
-
say(
|
|
15216
|
+
say(trapReport(e, init, host, ` in thread ${thread.tid}`));
|
|
15143
15217
|
} catch {
|
|
15144
15218
|
}
|
|
15145
15219
|
port2.postMessage({ type: WASM_PROCESS_EXIT, code: TRAPPED });
|