@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/kernel-worker.js
CHANGED
|
@@ -5063,18 +5063,19 @@ async function withPackagePaths(fs, pkg, command) {
|
|
|
5063
5063
|
}
|
|
5064
5064
|
async function packages(fs, modules) {
|
|
5065
5065
|
const names = await fs.readdir(modules).catch(() => []);
|
|
5066
|
-
const
|
|
5066
|
+
const packageNames = [];
|
|
5067
5067
|
for (const name2 of names) {
|
|
5068
5068
|
if (name2.startsWith(".")) continue;
|
|
5069
5069
|
if (!name2.startsWith("@")) {
|
|
5070
|
-
|
|
5070
|
+
packageNames.push(name2);
|
|
5071
5071
|
continue;
|
|
5072
5072
|
}
|
|
5073
5073
|
for (const inner of await fs.readdir(`${modules}/${name2}`).catch(() => [])) {
|
|
5074
|
-
|
|
5074
|
+
packageNames.push(`${name2}/${inner}`);
|
|
5075
5075
|
}
|
|
5076
5076
|
}
|
|
5077
|
-
|
|
5077
|
+
packageNames.sort();
|
|
5078
|
+
return packageNames.map((name2) => `${modules}/${name2}`);
|
|
5078
5079
|
}
|
|
5079
5080
|
async function pnpmGlobalRoots(fs, home) {
|
|
5080
5081
|
const roots = [];
|
|
@@ -5133,8 +5134,10 @@ async function scanFilesystems(fs, modules) {
|
|
|
5133
5134
|
return found;
|
|
5134
5135
|
}
|
|
5135
5136
|
var SUFFIX = /^\.[A-Za-z0-9_+-][A-Za-z0-9._+-]*$/;
|
|
5136
|
-
async function scanBinfmts(fs, modules) {
|
|
5137
|
+
async function scanBinfmts(fs, modules, warn = () => {
|
|
5138
|
+
}) {
|
|
5137
5139
|
const found = /* @__PURE__ */ new Map();
|
|
5140
|
+
const owners = /* @__PURE__ */ new Map();
|
|
5138
5141
|
for (const pkg of await packagesIn(fs, modules)) {
|
|
5139
5142
|
let manifest;
|
|
5140
5143
|
try {
|
|
@@ -5146,7 +5149,15 @@ async function scanBinfmts(fs, modules) {
|
|
|
5146
5149
|
if (!declared || typeof declared !== "object") continue;
|
|
5147
5150
|
for (const [suffix, command] of Object.entries(declared)) {
|
|
5148
5151
|
if (!SUFFIX.test(suffix) || typeof command !== "string" || !NAME.test(command)) continue;
|
|
5149
|
-
|
|
5152
|
+
const owner = owners.get(suffix);
|
|
5153
|
+
if (owner === void 0) {
|
|
5154
|
+
found.set(suffix, command);
|
|
5155
|
+
owners.set(suffix, pkg);
|
|
5156
|
+
} else if (found.get(suffix) !== command) {
|
|
5157
|
+
warn(
|
|
5158
|
+
`binfmt ${suffix}: ${owner} maps it to ${found.get(suffix)}, so ${pkg}'s ${command} is ignored`
|
|
5159
|
+
);
|
|
5160
|
+
}
|
|
5150
5161
|
}
|
|
5151
5162
|
}
|
|
5152
5163
|
return found;
|
|
@@ -7048,6 +7059,7 @@ var AsyncOps = class {
|
|
|
7048
7059
|
next = 1;
|
|
7049
7060
|
results = /* @__PURE__ */ new Map();
|
|
7050
7061
|
ready = [];
|
|
7062
|
+
running = /* @__PURE__ */ new Map();
|
|
7051
7063
|
waiters = /* @__PURE__ */ new Set();
|
|
7052
7064
|
closed = false;
|
|
7053
7065
|
run;
|
|
@@ -7058,7 +7070,9 @@ var AsyncOps = class {
|
|
|
7058
7070
|
}
|
|
7059
7071
|
submit(req) {
|
|
7060
7072
|
const id = this.hold();
|
|
7061
|
-
|
|
7073
|
+
const running = new AbortController();
|
|
7074
|
+
this.running.set(id, running);
|
|
7075
|
+
this.run(req, running.signal).then(
|
|
7062
7076
|
(result) => this.complete(id, result),
|
|
7063
7077
|
(err) => this.complete(id, { ok: false, errno: "EIO", message: String(err) })
|
|
7064
7078
|
);
|
|
@@ -7078,10 +7092,15 @@ var AsyncOps = class {
|
|
|
7078
7092
|
if (!this.results.has(id)) throw new KernelError("EINVAL");
|
|
7079
7093
|
const result = this.results.get(id);
|
|
7080
7094
|
if (!result) throw new KernelError("EAGAIN");
|
|
7081
|
-
this.
|
|
7095
|
+
this.forget(id);
|
|
7082
7096
|
return result;
|
|
7083
7097
|
}
|
|
7084
7098
|
cancel(id) {
|
|
7099
|
+
this.running.get(id)?.abort();
|
|
7100
|
+
this.forget(id);
|
|
7101
|
+
}
|
|
7102
|
+
forget(id) {
|
|
7103
|
+
this.running.delete(id);
|
|
7085
7104
|
this.results.delete(id);
|
|
7086
7105
|
const at = this.ready.indexOf(id);
|
|
7087
7106
|
if (at >= 0) this.ready.splice(at, 1);
|
|
@@ -7127,6 +7146,7 @@ var AsyncOps = class {
|
|
|
7127
7146
|
});
|
|
7128
7147
|
}
|
|
7129
7148
|
complete(id, result) {
|
|
7149
|
+
this.running.delete(id);
|
|
7130
7150
|
if (!this.results.has(id)) return;
|
|
7131
7151
|
this.results.set(id, result);
|
|
7132
7152
|
this.ready.push(id);
|
|
@@ -8940,13 +8960,13 @@ var WasmProcess = class {
|
|
|
8940
8960
|
this.wake?.();
|
|
8941
8961
|
for (const listener of this.stateListeners) listener("continued", SIG.CONT);
|
|
8942
8962
|
}
|
|
8943
|
-
async syscall(req) {
|
|
8963
|
+
async syscall(req, cancelled) {
|
|
8944
8964
|
this.options.onSyscall?.(req);
|
|
8945
8965
|
for (; ; ) {
|
|
8946
8966
|
await this.resumed;
|
|
8947
8967
|
if (this.dying) return DYING;
|
|
8948
8968
|
const stops = this.stops;
|
|
8949
|
-
const result = await this.dispatch(req);
|
|
8969
|
+
const result = await this.dispatch(req, cancelled);
|
|
8950
8970
|
if (this.dying) return DYING;
|
|
8951
8971
|
const restart = !result.ok && result.errno === "EINTR" && this.stops !== stops;
|
|
8952
8972
|
if (restart && !this.options.hasPending?.()) continue;
|
|
@@ -8965,9 +8985,9 @@ var WasmProcess = class {
|
|
|
8965
8985
|
this.interrupt.abort();
|
|
8966
8986
|
this.wake?.();
|
|
8967
8987
|
}
|
|
8968
|
-
async dispatch(req) {
|
|
8988
|
+
async dispatch(req, cancelled) {
|
|
8969
8989
|
try {
|
|
8970
|
-
if (isFdSyscall(req)) return await this.fdSyscall(req);
|
|
8990
|
+
if (isFdSyscall(req)) return await this.fdSyscall(req, cancelled);
|
|
8971
8991
|
if (isTtySyscall(req)) return this.ttySyscall(req);
|
|
8972
8992
|
if (isJobSyscall(req)) return this.jobSyscall(req);
|
|
8973
8993
|
if (isSocketSyscall(req)) return await this.socketSyscall(req);
|
|
@@ -9068,7 +9088,7 @@ var WasmProcess = class {
|
|
|
9068
9088
|
this.nodes
|
|
9069
9089
|
);
|
|
9070
9090
|
}
|
|
9071
|
-
async fdSyscall(req) {
|
|
9091
|
+
async fdSyscall(req, cancelled) {
|
|
9072
9092
|
if (isVfsSyscall(req)) return this.vfsSyscall(req);
|
|
9073
9093
|
switch (req.op) {
|
|
9074
9094
|
case "fd-read":
|
|
@@ -9139,7 +9159,8 @@ var WasmProcess = class {
|
|
|
9139
9159
|
return { ok: true, kind: "json", json: this.options.jobs?.terminalNames() ?? [] };
|
|
9140
9160
|
case "fd-select": {
|
|
9141
9161
|
const { read, write, timeoutMs } = req;
|
|
9142
|
-
const
|
|
9162
|
+
const blocking = this.blockingSignal();
|
|
9163
|
+
const signal = cancelled ? AbortSignal.any([blocking, cancelled]) : blocking;
|
|
9143
9164
|
const selected = await selectFds(this.fds, read, write, timeoutMs, signal);
|
|
9144
9165
|
return { ok: true, kind: "json", json: selected };
|
|
9145
9166
|
}
|
|
@@ -9418,7 +9439,7 @@ var WasmProcess = class {
|
|
|
9418
9439
|
alarm;
|
|
9419
9440
|
dlLog = [];
|
|
9420
9441
|
asyncOps = new AsyncOps(
|
|
9421
|
-
(req) => this.syscall(req),
|
|
9442
|
+
(req, cancelled) => this.syscall(req, cancelled),
|
|
9422
9443
|
() => this.options.onAsync?.()
|
|
9423
9444
|
);
|
|
9424
9445
|
alarmEvery;
|
|
@@ -11255,6 +11276,7 @@ var Launcher = class {
|
|
|
11255
11276
|
env;
|
|
11256
11277
|
catalog;
|
|
11257
11278
|
binfmts;
|
|
11279
|
+
warned = /* @__PURE__ */ new Set();
|
|
11258
11280
|
compiled = /* @__PURE__ */ new Map();
|
|
11259
11281
|
processes = /* @__PURE__ */ new Map();
|
|
11260
11282
|
zombies = /* @__PURE__ */ new Set();
|
|
@@ -11361,7 +11383,13 @@ var Launcher = class {
|
|
|
11361
11383
|
return this.catalog;
|
|
11362
11384
|
}
|
|
11363
11385
|
interpreters() {
|
|
11364
|
-
this.binfmts ??= this.roots().then(
|
|
11386
|
+
this.binfmts ??= this.roots().then(
|
|
11387
|
+
(roots) => scanBinfmts(this.base, roots, (message2) => {
|
|
11388
|
+
if (this.warned.has(message2)) return;
|
|
11389
|
+
this.warned.add(message2);
|
|
11390
|
+
console.warn(message2);
|
|
11391
|
+
})
|
|
11392
|
+
);
|
|
11365
11393
|
return this.binfmts;
|
|
11366
11394
|
}
|
|
11367
11395
|
async roots() {
|