@ai-ecoverse/slicc-kernel 1.159.6 → 1.160.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 +2 -0
- package/dist/kernel-worker.js +29 -3
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +45 -22
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +29 -3
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +45 -22
- package/dist/process-worker.js.map +2 -2
- package/dist/types/process/js/js-context.d.ts +4 -0
- package/dist/types/process/js/js-kernel.d.ts +3 -0
- package/dist/types/realm/sync-fs-wire.d.ts +2 -0
- package/package.json +2 -2
|
@@ -1633,7 +1633,13 @@ function decodeSabResult(status2, payload) {
|
|
|
1633
1633
|
const parsed = capturedJSON.parse(decoder.decode(payload));
|
|
1634
1634
|
const errno2 = typeof parsed.errno === "string" && /^E[A-Z]+$|^EAI_[A-Z]+$/.test(parsed.errno) ? parsed.errno : "EIO";
|
|
1635
1635
|
const message2 = capturedString(parsed.message ?? errno2);
|
|
1636
|
-
return
|
|
1636
|
+
return {
|
|
1637
|
+
ok: false,
|
|
1638
|
+
errno: errno2,
|
|
1639
|
+
message: message2,
|
|
1640
|
+
...parsed.direct === true ? { direct: true } : {},
|
|
1641
|
+
...typeof parsed.dev === "string" ? { dev: parsed.dev } : {}
|
|
1642
|
+
};
|
|
1637
1643
|
} catch {
|
|
1638
1644
|
return { ok: false, errno: "EIO", message: "sync-sab: malformed errno payload" };
|
|
1639
1645
|
}
|
|
@@ -2447,6 +2453,10 @@ var init_async_sab = __esm({
|
|
|
2447
2453
|
});
|
|
2448
2454
|
|
|
2449
2455
|
// src/process/js/js-kernel.ts
|
|
2456
|
+
function devOf(found) {
|
|
2457
|
+
const dev = found?.dev;
|
|
2458
|
+
return typeof dev === "string" ? dev : void 0;
|
|
2459
|
+
}
|
|
2450
2460
|
function umaskRequest(mask) {
|
|
2451
2461
|
if (mask === void 0) return { op: "proc-umask" };
|
|
2452
2462
|
if (!capturedNumber.isInteger(mask) || mask < 0 || mask > 511) {
|
|
@@ -2463,11 +2473,13 @@ function modeOf(mode) {
|
|
|
2463
2473
|
function callError(result, op) {
|
|
2464
2474
|
const { errno: errno2, message: message2 } = result;
|
|
2465
2475
|
const detailed = typeof message2 === "string" && message2 !== errno2 && DETAILED.has(op);
|
|
2466
|
-
|
|
2476
|
+
const err = new JsCallError(
|
|
2467
2477
|
errno2,
|
|
2468
2478
|
detailed ? `${op}: ${message2}` : op,
|
|
2469
2479
|
detailed ? message2 : void 0
|
|
2470
2480
|
);
|
|
2481
|
+
err.dev = result.dev;
|
|
2482
|
+
return err;
|
|
2471
2483
|
}
|
|
2472
2484
|
function untilAborted(work, signal) {
|
|
2473
2485
|
if (!signal) return work;
|
|
@@ -2496,6 +2508,7 @@ var init_js_kernel = __esm({
|
|
|
2496
2508
|
JsCallError = class extends capturedError {
|
|
2497
2509
|
code;
|
|
2498
2510
|
detail;
|
|
2511
|
+
dev;
|
|
2499
2512
|
constructor(code2, what, detail) {
|
|
2500
2513
|
super(`${what}: ${code2}`);
|
|
2501
2514
|
this.name = "JsCallError";
|
|
@@ -7352,7 +7365,7 @@ var init_version = __esm({
|
|
|
7352
7365
|
"src/version.ts"() {
|
|
7353
7366
|
"use strict";
|
|
7354
7367
|
init_captured_globals();
|
|
7355
|
-
KERNEL_VERSION = true ? "1.
|
|
7368
|
+
KERNEL_VERSION = true ? "1.160.1" : "0.0.0-dev";
|
|
7356
7369
|
OS_RELEASE = "6.0.0-slicc";
|
|
7357
7370
|
}
|
|
7358
7371
|
});
|
|
@@ -12518,12 +12531,12 @@ function syncOps(kernel, shared) {
|
|
|
12518
12531
|
if (inDev(abs)) return devSync(kernel, devStat(abs, op === "stat"));
|
|
12519
12532
|
try {
|
|
12520
12533
|
if (!clean()) kernel.call({ op: "fd-path-flush", path: abs });
|
|
12521
|
-
const s = parseSyncFsStat(kernel.json({ op, path: abs }));
|
|
12534
|
+
const s = parseSyncFsStat(kernel.json({ op, path: abs, devs: true }));
|
|
12522
12535
|
if (!s) throw new JsCallError("EIO", op);
|
|
12523
12536
|
return s;
|
|
12524
12537
|
} catch (err) {
|
|
12525
12538
|
if (!(err instanceof JsCallError) || err.code !== "ENOENT") throw err;
|
|
12526
|
-
const devPath =
|
|
12539
|
+
const devPath = err.dev;
|
|
12527
12540
|
if (!devPath) throw err;
|
|
12528
12541
|
return devSync(kernel, devStat(devPath, op === "stat"));
|
|
12529
12542
|
}
|
|
@@ -12594,7 +12607,7 @@ function syncOps(kernel, shared) {
|
|
|
12594
12607
|
},
|
|
12595
12608
|
pipe: () => kernel.json({ op: "fd-pipe" }),
|
|
12596
12609
|
open: procOpenSync(open, kernel, { resolve: resolve2, pid: shared.pid }),
|
|
12597
|
-
fs: procFsSync(syncPathOps(kernel, resolve2, statOf, open,
|
|
12610
|
+
fs: procFsSync(syncPathOps(kernel, resolve2, statOf, open, clean), kernel, {
|
|
12598
12611
|
resolve: resolve2,
|
|
12599
12612
|
pid: shared.pid
|
|
12600
12613
|
})
|
|
@@ -12671,15 +12684,16 @@ function syncFile(kernel, fd, path, append, forget) {
|
|
|
12671
12684
|
}
|
|
12672
12685
|
};
|
|
12673
12686
|
}
|
|
12674
|
-
function syncPathOps(kernel, resolve2, statOf, open,
|
|
12687
|
+
function syncPathOps(kernel, resolve2, statOf, open, clean) {
|
|
12675
12688
|
return {
|
|
12676
12689
|
stat: (path) => statOf("stat", path),
|
|
12677
12690
|
lstat: (path) => statOf("lstat", path),
|
|
12678
12691
|
exists(path) {
|
|
12679
12692
|
const abs = resolve2(path);
|
|
12680
12693
|
if (inDev(abs)) return devSync(kernel, devExists(abs));
|
|
12681
|
-
|
|
12682
|
-
|
|
12694
|
+
const found = kernel.json({ op: "exists", path: abs, devs: true });
|
|
12695
|
+
if (found === true) return true;
|
|
12696
|
+
const devPath = devOf(found);
|
|
12683
12697
|
return devPath ? devSync(kernel, devExists(devPath)) : false;
|
|
12684
12698
|
},
|
|
12685
12699
|
readdir(path) {
|
|
@@ -12721,10 +12735,10 @@ function syncPathOps(kernel, resolve2, statOf, open, tryDev, clean) {
|
|
|
12721
12735
|
if (inDev(abs)) return readWholeSync(open(abs));
|
|
12722
12736
|
try {
|
|
12723
12737
|
if (!clean()) kernel.call({ op: "fd-path-flush", path: abs });
|
|
12724
|
-
return kernel.bytes({ op: "read", path: abs });
|
|
12738
|
+
return kernel.bytes({ op: "read", path: abs, devs: true });
|
|
12725
12739
|
} catch (err) {
|
|
12726
12740
|
if (!(err instanceof JsCallError) || err.code !== "ENOENT") throw err;
|
|
12727
|
-
const devPath =
|
|
12741
|
+
const devPath = err.dev;
|
|
12728
12742
|
if (!devPath) throw err;
|
|
12729
12743
|
return readWholeSync(open(devPath));
|
|
12730
12744
|
}
|
|
@@ -15992,15 +16006,15 @@ async function resolveDevAsync(kernel, abs) {
|
|
|
15992
16006
|
return void 0;
|
|
15993
16007
|
}
|
|
15994
16008
|
}
|
|
15995
|
-
async function vfsStat(kernel, abs, op,
|
|
16009
|
+
async function vfsStat(kernel, abs, op, clean) {
|
|
15996
16010
|
try {
|
|
15997
16011
|
if (!clean()) await kernel.call({ op: "fd-path-flush", path: abs });
|
|
15998
|
-
const s = parseSyncFsStat(await kernel.json({ op, path: abs }));
|
|
16012
|
+
const s = parseSyncFsStat(await kernel.json({ op, path: abs, devs: true }));
|
|
15999
16013
|
if (!s) throw new JsCallError("EIO", op);
|
|
16000
16014
|
return s;
|
|
16001
16015
|
} catch (err) {
|
|
16002
16016
|
if (!(err instanceof JsCallError) || err.code !== "ENOENT") throw err;
|
|
16003
|
-
const devPath =
|
|
16017
|
+
const devPath = err.dev;
|
|
16004
16018
|
if (!devPath) throw err;
|
|
16005
16019
|
return devAsync(kernel, devStat(devPath, op === "stat"));
|
|
16006
16020
|
}
|
|
@@ -16179,9 +16193,12 @@ function scriptRunner(run) {
|
|
|
16179
16193
|
};
|
|
16180
16194
|
}
|
|
16181
16195
|
function hostExtras(o) {
|
|
16196
|
+
const path = o.modulePath;
|
|
16197
|
+
const module = path === void 0 ? {} : { module: capturedObject.freeze({ path }) };
|
|
16182
16198
|
return {
|
|
16183
16199
|
memory: () => measured(o.memory),
|
|
16184
|
-
...o.asyncContext ? { asyncContext: o.asyncContext() } : {}
|
|
16200
|
+
...o.asyncContext ? { asyncContext: o.asyncContext() } : {},
|
|
16201
|
+
...module
|
|
16185
16202
|
};
|
|
16186
16203
|
}
|
|
16187
16204
|
function cleanOf(sab) {
|
|
@@ -16226,7 +16243,7 @@ function createContext(o) {
|
|
|
16226
16243
|
const statOf = async (op, path) => {
|
|
16227
16244
|
const abs = resolve2(path);
|
|
16228
16245
|
if (inDev(abs)) return devAsync(kernel, devStat(abs, op === "stat"));
|
|
16229
|
-
return vfsStat(kernel, abs, op,
|
|
16246
|
+
return vfsStat(kernel, abs, op, clean);
|
|
16230
16247
|
};
|
|
16231
16248
|
const devIo = { infos, handles, read: read2, write: writeAll };
|
|
16232
16249
|
const open = async (path, options = {}, whole = false) => {
|
|
@@ -16241,7 +16258,7 @@ function createContext(o) {
|
|
|
16241
16258
|
return openDev(kernel, devPath, options, devIo);
|
|
16242
16259
|
}
|
|
16243
16260
|
};
|
|
16244
|
-
const fs = procFsAsync(pathOps(kernel, resolve2, statOf, open,
|
|
16261
|
+
const fs = procFsAsync(pathOps(kernel, resolve2, statOf, open, clean), kernel, {
|
|
16245
16262
|
resolve: resolve2,
|
|
16246
16263
|
pid: o.pid
|
|
16247
16264
|
});
|
|
@@ -16457,15 +16474,16 @@ async function sendSome(kernel, fd, body, signal) {
|
|
|
16457
16474
|
await kernel.blocking({ op: "fd-select", read: [], write: [fd], timeoutMs: -1 }, signal);
|
|
16458
16475
|
}
|
|
16459
16476
|
}
|
|
16460
|
-
function pathOps(kernel, resolve2, statOf, open,
|
|
16477
|
+
function pathOps(kernel, resolve2, statOf, open, clean) {
|
|
16461
16478
|
return {
|
|
16462
16479
|
stat: (path) => statOf("stat", path),
|
|
16463
16480
|
lstat: (path) => statOf("lstat", path),
|
|
16464
16481
|
async exists(path) {
|
|
16465
16482
|
const abs = resolve2(path);
|
|
16466
16483
|
if (inDev(abs)) return devAsync(kernel, devExists(abs));
|
|
16467
|
-
|
|
16468
|
-
|
|
16484
|
+
const found = await kernel.json({ op: "exists", path: abs, devs: true });
|
|
16485
|
+
if (found === true) return true;
|
|
16486
|
+
const devPath = devOf(found);
|
|
16469
16487
|
return devPath ? devAsync(kernel, devExists(devPath)) : false;
|
|
16470
16488
|
},
|
|
16471
16489
|
async readdir(path) {
|
|
@@ -16509,10 +16527,10 @@ function pathOps(kernel, resolve2, statOf, open, tryDev, clean) {
|
|
|
16509
16527
|
if (inDev(abs)) return readWhole(await open(abs));
|
|
16510
16528
|
try {
|
|
16511
16529
|
if (!clean()) await kernel.call({ op: "fd-path-flush", path: abs });
|
|
16512
|
-
return await kernel.bytes({ op: "read", path: abs });
|
|
16530
|
+
return await kernel.bytes({ op: "read", path: abs, devs: true });
|
|
16513
16531
|
} catch (err) {
|
|
16514
16532
|
if (!(err instanceof JsCallError) || err.code !== "ENOENT") throw err;
|
|
16515
|
-
const devPath =
|
|
16533
|
+
const devPath = err.dev;
|
|
16516
16534
|
if (!devPath) throw err;
|
|
16517
16535
|
return readWhole(await open(devPath));
|
|
16518
16536
|
}
|
|
@@ -16756,6 +16774,7 @@ async function runJs(init, port3, deps, thread) {
|
|
|
16756
16774
|
memory: deps.memory,
|
|
16757
16775
|
asyncContext: deps.asyncContext,
|
|
16758
16776
|
runScript: deps.runScript,
|
|
16777
|
+
modulePath: modulePathOf(init.program),
|
|
16759
16778
|
promiseState: deps.promiseState,
|
|
16760
16779
|
...thread?.owned ? { owned: thread.owned } : {},
|
|
16761
16780
|
held: init.held,
|
|
@@ -16801,6 +16820,10 @@ async function runJs(init, port3, deps, thread) {
|
|
|
16801
16820
|
if (exitedWith !== void 0) return exitedWith;
|
|
16802
16821
|
return status2;
|
|
16803
16822
|
}
|
|
16823
|
+
function modulePathOf(program) {
|
|
16824
|
+
if (program.glue !== "") return void 0;
|
|
16825
|
+
return program.path;
|
|
16826
|
+
}
|
|
16804
16827
|
var NOT_RUNNABLE;
|
|
16805
16828
|
var init_js_runtime = __esm({
|
|
16806
16829
|
"src/process/js/js-runtime.ts"() {
|