@ai-ecoverse/slicc-kernel 1.39.3 → 1.40.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 +5 -3
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +44 -16
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +190 -28
- package/dist/node-process-worker.js.map +4 -4
- package/dist/node.js +44 -16
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +190 -28
- 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;
|
|
@@ -5458,6 +5469,7 @@ var AsyncOps = class {
|
|
|
5458
5469
|
next = 1;
|
|
5459
5470
|
results = /* @__PURE__ */ new Map();
|
|
5460
5471
|
ready = [];
|
|
5472
|
+
running = /* @__PURE__ */ new Map();
|
|
5461
5473
|
waiters = /* @__PURE__ */ new Set();
|
|
5462
5474
|
closed = false;
|
|
5463
5475
|
run;
|
|
@@ -5468,7 +5480,9 @@ var AsyncOps = class {
|
|
|
5468
5480
|
}
|
|
5469
5481
|
submit(req) {
|
|
5470
5482
|
const id = this.hold();
|
|
5471
|
-
|
|
5483
|
+
const running = new AbortController();
|
|
5484
|
+
this.running.set(id, running);
|
|
5485
|
+
this.run(req, running.signal).then(
|
|
5472
5486
|
(result) => this.complete(id, result),
|
|
5473
5487
|
(err) => this.complete(id, { ok: false, errno: "EIO", message: String(err) })
|
|
5474
5488
|
);
|
|
@@ -5488,10 +5502,15 @@ var AsyncOps = class {
|
|
|
5488
5502
|
if (!this.results.has(id)) throw new KernelError("EINVAL");
|
|
5489
5503
|
const result = this.results.get(id);
|
|
5490
5504
|
if (!result) throw new KernelError("EAGAIN");
|
|
5491
|
-
this.
|
|
5505
|
+
this.forget(id);
|
|
5492
5506
|
return result;
|
|
5493
5507
|
}
|
|
5494
5508
|
cancel(id) {
|
|
5509
|
+
this.running.get(id)?.abort();
|
|
5510
|
+
this.forget(id);
|
|
5511
|
+
}
|
|
5512
|
+
forget(id) {
|
|
5513
|
+
this.running.delete(id);
|
|
5495
5514
|
this.results.delete(id);
|
|
5496
5515
|
const at = this.ready.indexOf(id);
|
|
5497
5516
|
if (at >= 0) this.ready.splice(at, 1);
|
|
@@ -5537,6 +5556,7 @@ var AsyncOps = class {
|
|
|
5537
5556
|
});
|
|
5538
5557
|
}
|
|
5539
5558
|
complete(id, result) {
|
|
5559
|
+
this.running.delete(id);
|
|
5540
5560
|
if (!this.results.has(id)) return;
|
|
5541
5561
|
this.results.set(id, result);
|
|
5542
5562
|
this.ready.push(id);
|
|
@@ -8695,13 +8715,13 @@ var WasmProcess = class {
|
|
|
8695
8715
|
this.wake?.();
|
|
8696
8716
|
for (const listener of this.stateListeners) listener("continued", SIG.CONT);
|
|
8697
8717
|
}
|
|
8698
|
-
async syscall(req) {
|
|
8718
|
+
async syscall(req, cancelled) {
|
|
8699
8719
|
this.options.onSyscall?.(req);
|
|
8700
8720
|
for (; ; ) {
|
|
8701
8721
|
await this.resumed;
|
|
8702
8722
|
if (this.dying) return DYING;
|
|
8703
8723
|
const stops = this.stops;
|
|
8704
|
-
const result = await this.dispatch(req);
|
|
8724
|
+
const result = await this.dispatch(req, cancelled);
|
|
8705
8725
|
if (this.dying) return DYING;
|
|
8706
8726
|
const restart = !result.ok && result.errno === "EINTR" && this.stops !== stops;
|
|
8707
8727
|
if (restart && !this.options.hasPending?.()) continue;
|
|
@@ -8720,9 +8740,9 @@ var WasmProcess = class {
|
|
|
8720
8740
|
this.interrupt.abort();
|
|
8721
8741
|
this.wake?.();
|
|
8722
8742
|
}
|
|
8723
|
-
async dispatch(req) {
|
|
8743
|
+
async dispatch(req, cancelled) {
|
|
8724
8744
|
try {
|
|
8725
|
-
if (isFdSyscall(req)) return await this.fdSyscall(req);
|
|
8745
|
+
if (isFdSyscall(req)) return await this.fdSyscall(req, cancelled);
|
|
8726
8746
|
if (isTtySyscall(req)) return this.ttySyscall(req);
|
|
8727
8747
|
if (isJobSyscall(req)) return this.jobSyscall(req);
|
|
8728
8748
|
if (isSocketSyscall(req)) return await this.socketSyscall(req);
|
|
@@ -8823,7 +8843,7 @@ var WasmProcess = class {
|
|
|
8823
8843
|
this.nodes
|
|
8824
8844
|
);
|
|
8825
8845
|
}
|
|
8826
|
-
async fdSyscall(req) {
|
|
8846
|
+
async fdSyscall(req, cancelled) {
|
|
8827
8847
|
if (isVfsSyscall(req)) return this.vfsSyscall(req);
|
|
8828
8848
|
switch (req.op) {
|
|
8829
8849
|
case "fd-read":
|
|
@@ -8894,7 +8914,8 @@ var WasmProcess = class {
|
|
|
8894
8914
|
return { ok: true, kind: "json", json: this.options.jobs?.terminalNames() ?? [] };
|
|
8895
8915
|
case "fd-select": {
|
|
8896
8916
|
const { read, write, timeoutMs } = req;
|
|
8897
|
-
const
|
|
8917
|
+
const blocking = this.blockingSignal();
|
|
8918
|
+
const signal = cancelled ? AbortSignal.any([blocking, cancelled]) : blocking;
|
|
8898
8919
|
const selected = await selectFds(this.fds, read, write, timeoutMs, signal);
|
|
8899
8920
|
return { ok: true, kind: "json", json: selected };
|
|
8900
8921
|
}
|
|
@@ -9173,7 +9194,7 @@ var WasmProcess = class {
|
|
|
9173
9194
|
alarm;
|
|
9174
9195
|
dlLog = [];
|
|
9175
9196
|
asyncOps = new AsyncOps(
|
|
9176
|
-
(req) => this.syscall(req),
|
|
9197
|
+
(req, cancelled) => this.syscall(req, cancelled),
|
|
9177
9198
|
() => this.options.onAsync?.()
|
|
9178
9199
|
);
|
|
9179
9200
|
alarmEvery;
|
|
@@ -11019,6 +11040,7 @@ var Launcher = class {
|
|
|
11019
11040
|
env;
|
|
11020
11041
|
catalog;
|
|
11021
11042
|
binfmts;
|
|
11043
|
+
warned = /* @__PURE__ */ new Set();
|
|
11022
11044
|
compiled = /* @__PURE__ */ new Map();
|
|
11023
11045
|
processes = /* @__PURE__ */ new Map();
|
|
11024
11046
|
zombies = /* @__PURE__ */ new Set();
|
|
@@ -11125,7 +11147,13 @@ var Launcher = class {
|
|
|
11125
11147
|
return this.catalog;
|
|
11126
11148
|
}
|
|
11127
11149
|
interpreters() {
|
|
11128
|
-
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
|
+
);
|
|
11129
11157
|
return this.binfmts;
|
|
11130
11158
|
}
|
|
11131
11159
|
async roots() {
|