@ai-ecoverse/slicc-kernel 1.39.2 → 1.40.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 +5 -3
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +45 -16
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +221 -36
- package/dist/node-process-worker.js.map +4 -4
- package/dist/node.js +45 -16
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +221 -36
- package/dist/process-worker.js.map +4 -4
- package/package.json +1 -1
package/dist/node.js
CHANGED
|
@@ -3664,18 +3664,19 @@ async function withPackagePaths(fs, pkg, command) {
|
|
|
3664
3664
|
}
|
|
3665
3665
|
async function packages(fs, modules) {
|
|
3666
3666
|
const names = await fs.readdir(modules).catch(() => []);
|
|
3667
|
-
const
|
|
3667
|
+
const packageNames = [];
|
|
3668
3668
|
for (const name2 of names) {
|
|
3669
3669
|
if (name2.startsWith(".")) continue;
|
|
3670
3670
|
if (!name2.startsWith("@")) {
|
|
3671
|
-
|
|
3671
|
+
packageNames.push(name2);
|
|
3672
3672
|
continue;
|
|
3673
3673
|
}
|
|
3674
3674
|
for (const inner of await fs.readdir(`${modules}/${name2}`).catch(() => [])) {
|
|
3675
|
-
|
|
3675
|
+
packageNames.push(`${name2}/${inner}`);
|
|
3676
3676
|
}
|
|
3677
3677
|
}
|
|
3678
|
-
|
|
3678
|
+
packageNames.sort();
|
|
3679
|
+
return packageNames.map((name2) => `${modules}/${name2}`);
|
|
3679
3680
|
}
|
|
3680
3681
|
async function pnpmGlobalRoots(fs, home) {
|
|
3681
3682
|
const roots = [];
|
|
@@ -3734,8 +3735,10 @@ async function scanFilesystems(fs, modules) {
|
|
|
3734
3735
|
return found;
|
|
3735
3736
|
}
|
|
3736
3737
|
var SUFFIX = /^\.[A-Za-z0-9_+-][A-Za-z0-9._+-]*$/;
|
|
3737
|
-
async function scanBinfmts(fs, modules) {
|
|
3738
|
+
async function scanBinfmts(fs, modules, warn = () => {
|
|
3739
|
+
}) {
|
|
3738
3740
|
const found = /* @__PURE__ */ new Map();
|
|
3741
|
+
const owners = /* @__PURE__ */ new Map();
|
|
3739
3742
|
for (const pkg of await packagesIn(fs, modules)) {
|
|
3740
3743
|
let manifest;
|
|
3741
3744
|
try {
|
|
@@ -3747,7 +3750,15 @@ async function scanBinfmts(fs, modules) {
|
|
|
3747
3750
|
if (!declared || typeof declared !== "object") continue;
|
|
3748
3751
|
for (const [suffix, command] of Object.entries(declared)) {
|
|
3749
3752
|
if (!SUFFIX.test(suffix) || typeof command !== "string" || !NAME.test(command)) continue;
|
|
3750
|
-
|
|
3753
|
+
const owner = owners.get(suffix);
|
|
3754
|
+
if (owner === void 0) {
|
|
3755
|
+
found.set(suffix, command);
|
|
3756
|
+
owners.set(suffix, pkg);
|
|
3757
|
+
} else if (found.get(suffix) !== command) {
|
|
3758
|
+
warn(
|
|
3759
|
+
`binfmt ${suffix}: ${owner} maps it to ${found.get(suffix)}, so ${pkg}'s ${command} is ignored`
|
|
3760
|
+
);
|
|
3761
|
+
}
|
|
3751
3762
|
}
|
|
3752
3763
|
}
|
|
3753
3764
|
return found;
|
|
@@ -4074,6 +4085,7 @@ var ChildTable = class {
|
|
|
4074
4085
|
if ("fd" in slot) return this.parentFds.get(slot.fd).retain();
|
|
4075
4086
|
if ("input" in slot) return bytesSource(slot.input);
|
|
4076
4087
|
if ("device" in slot) return deviceFile(slot.device, slot.access);
|
|
4088
|
+
if ("dir" in slot) return heldFile({ dir: slot.dir });
|
|
4077
4089
|
if ("capture" in slot) {
|
|
4078
4090
|
const chunks2 = [];
|
|
4079
4091
|
captured.set(n, chunks2);
|
|
@@ -5457,6 +5469,7 @@ var AsyncOps = class {
|
|
|
5457
5469
|
next = 1;
|
|
5458
5470
|
results = /* @__PURE__ */ new Map();
|
|
5459
5471
|
ready = [];
|
|
5472
|
+
running = /* @__PURE__ */ new Map();
|
|
5460
5473
|
waiters = /* @__PURE__ */ new Set();
|
|
5461
5474
|
closed = false;
|
|
5462
5475
|
run;
|
|
@@ -5467,7 +5480,9 @@ var AsyncOps = class {
|
|
|
5467
5480
|
}
|
|
5468
5481
|
submit(req) {
|
|
5469
5482
|
const id = this.hold();
|
|
5470
|
-
|
|
5483
|
+
const running = new AbortController();
|
|
5484
|
+
this.running.set(id, running);
|
|
5485
|
+
this.run(req, running.signal).then(
|
|
5471
5486
|
(result) => this.complete(id, result),
|
|
5472
5487
|
(err) => this.complete(id, { ok: false, errno: "EIO", message: String(err) })
|
|
5473
5488
|
);
|
|
@@ -5487,10 +5502,15 @@ var AsyncOps = class {
|
|
|
5487
5502
|
if (!this.results.has(id)) throw new KernelError("EINVAL");
|
|
5488
5503
|
const result = this.results.get(id);
|
|
5489
5504
|
if (!result) throw new KernelError("EAGAIN");
|
|
5490
|
-
this.
|
|
5505
|
+
this.forget(id);
|
|
5491
5506
|
return result;
|
|
5492
5507
|
}
|
|
5493
5508
|
cancel(id) {
|
|
5509
|
+
this.running.get(id)?.abort();
|
|
5510
|
+
this.forget(id);
|
|
5511
|
+
}
|
|
5512
|
+
forget(id) {
|
|
5513
|
+
this.running.delete(id);
|
|
5494
5514
|
this.results.delete(id);
|
|
5495
5515
|
const at = this.ready.indexOf(id);
|
|
5496
5516
|
if (at >= 0) this.ready.splice(at, 1);
|
|
@@ -5536,6 +5556,7 @@ var AsyncOps = class {
|
|
|
5536
5556
|
});
|
|
5537
5557
|
}
|
|
5538
5558
|
complete(id, result) {
|
|
5559
|
+
this.running.delete(id);
|
|
5539
5560
|
if (!this.results.has(id)) return;
|
|
5540
5561
|
this.results.set(id, result);
|
|
5541
5562
|
this.ready.push(id);
|
|
@@ -8694,13 +8715,13 @@ var WasmProcess = class {
|
|
|
8694
8715
|
this.wake?.();
|
|
8695
8716
|
for (const listener of this.stateListeners) listener("continued", SIG.CONT);
|
|
8696
8717
|
}
|
|
8697
|
-
async syscall(req) {
|
|
8718
|
+
async syscall(req, cancelled) {
|
|
8698
8719
|
this.options.onSyscall?.(req);
|
|
8699
8720
|
for (; ; ) {
|
|
8700
8721
|
await this.resumed;
|
|
8701
8722
|
if (this.dying) return DYING;
|
|
8702
8723
|
const stops = this.stops;
|
|
8703
|
-
const result = await this.dispatch(req);
|
|
8724
|
+
const result = await this.dispatch(req, cancelled);
|
|
8704
8725
|
if (this.dying) return DYING;
|
|
8705
8726
|
const restart = !result.ok && result.errno === "EINTR" && this.stops !== stops;
|
|
8706
8727
|
if (restart && !this.options.hasPending?.()) continue;
|
|
@@ -8719,9 +8740,9 @@ var WasmProcess = class {
|
|
|
8719
8740
|
this.interrupt.abort();
|
|
8720
8741
|
this.wake?.();
|
|
8721
8742
|
}
|
|
8722
|
-
async dispatch(req) {
|
|
8743
|
+
async dispatch(req, cancelled) {
|
|
8723
8744
|
try {
|
|
8724
|
-
if (isFdSyscall(req)) return await this.fdSyscall(req);
|
|
8745
|
+
if (isFdSyscall(req)) return await this.fdSyscall(req, cancelled);
|
|
8725
8746
|
if (isTtySyscall(req)) return this.ttySyscall(req);
|
|
8726
8747
|
if (isJobSyscall(req)) return this.jobSyscall(req);
|
|
8727
8748
|
if (isSocketSyscall(req)) return await this.socketSyscall(req);
|
|
@@ -8822,7 +8843,7 @@ var WasmProcess = class {
|
|
|
8822
8843
|
this.nodes
|
|
8823
8844
|
);
|
|
8824
8845
|
}
|
|
8825
|
-
async fdSyscall(req) {
|
|
8846
|
+
async fdSyscall(req, cancelled) {
|
|
8826
8847
|
if (isVfsSyscall(req)) return this.vfsSyscall(req);
|
|
8827
8848
|
switch (req.op) {
|
|
8828
8849
|
case "fd-read":
|
|
@@ -8893,7 +8914,8 @@ var WasmProcess = class {
|
|
|
8893
8914
|
return { ok: true, kind: "json", json: this.options.jobs?.terminalNames() ?? [] };
|
|
8894
8915
|
case "fd-select": {
|
|
8895
8916
|
const { read, write, timeoutMs } = req;
|
|
8896
|
-
const
|
|
8917
|
+
const blocking = this.blockingSignal();
|
|
8918
|
+
const signal = cancelled ? AbortSignal.any([blocking, cancelled]) : blocking;
|
|
8897
8919
|
const selected = await selectFds(this.fds, read, write, timeoutMs, signal);
|
|
8898
8920
|
return { ok: true, kind: "json", json: selected };
|
|
8899
8921
|
}
|
|
@@ -9172,7 +9194,7 @@ var WasmProcess = class {
|
|
|
9172
9194
|
alarm;
|
|
9173
9195
|
dlLog = [];
|
|
9174
9196
|
asyncOps = new AsyncOps(
|
|
9175
|
-
(req) => this.syscall(req),
|
|
9197
|
+
(req, cancelled) => this.syscall(req, cancelled),
|
|
9176
9198
|
() => this.options.onAsync?.()
|
|
9177
9199
|
);
|
|
9178
9200
|
alarmEvery;
|
|
@@ -11018,6 +11040,7 @@ var Launcher = class {
|
|
|
11018
11040
|
env;
|
|
11019
11041
|
catalog;
|
|
11020
11042
|
binfmts;
|
|
11043
|
+
warned = /* @__PURE__ */ new Set();
|
|
11021
11044
|
compiled = /* @__PURE__ */ new Map();
|
|
11022
11045
|
processes = /* @__PURE__ */ new Map();
|
|
11023
11046
|
zombies = /* @__PURE__ */ new Set();
|
|
@@ -11124,7 +11147,13 @@ var Launcher = class {
|
|
|
11124
11147
|
return this.catalog;
|
|
11125
11148
|
}
|
|
11126
11149
|
interpreters() {
|
|
11127
|
-
this.binfmts ??= this.roots().then(
|
|
11150
|
+
this.binfmts ??= this.roots().then(
|
|
11151
|
+
(roots) => scanBinfmts(this.base, roots, (message2) => {
|
|
11152
|
+
if (this.warned.has(message2)) return;
|
|
11153
|
+
this.warned.add(message2);
|
|
11154
|
+
console.warn(message2);
|
|
11155
|
+
})
|
|
11156
|
+
);
|
|
11128
11157
|
return this.binfmts;
|
|
11129
11158
|
}
|
|
11130
11159
|
async roots() {
|