@ai-ecoverse/slicc-kernel 1.140.1 → 1.140.3
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 +3 -3
- package/dist/index.js.map +1 -1
- package/dist/kernel-worker.js +86 -28
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +39 -10
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +86 -28
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +39 -10
- package/dist/process-worker.js.map +2 -2
- package/dist/testing.js.map +1 -1
- package/dist/types/kernel/host.d.ts +1 -0
- package/dist/types/kernel/net/loopback-names.d.ts +4 -0
- package/dist/types/kernel/protocol.d.ts +1 -0
- 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 +3 -3
package/dist/node.js
CHANGED
|
@@ -7514,7 +7514,7 @@ function satisfies(version, range2) {
|
|
|
7514
7514
|
}
|
|
7515
7515
|
|
|
7516
7516
|
// src/version.ts
|
|
7517
|
-
var KERNEL_VERSION = true ? "1.140.
|
|
7517
|
+
var KERNEL_VERSION = true ? "1.140.3" : "0.0.0-dev";
|
|
7518
7518
|
var OS_RELEASE = "6.0.0-slicc";
|
|
7519
7519
|
function procVersion() {
|
|
7520
7520
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -9819,6 +9819,9 @@ function devCreation(path, cred) {
|
|
|
9819
9819
|
// src/fs/etc-files.ts
|
|
9820
9820
|
var HOSTNAME_PATH = "/etc/hostname";
|
|
9821
9821
|
var S_IFREG3 = 32768;
|
|
9822
|
+
var MAX_HOPS2 = 40;
|
|
9823
|
+
var parentOf6 = (path) => path.slice(0, path.lastIndexOf("/")) || "/";
|
|
9824
|
+
var baseOf2 = (path) => path.slice(path.lastIndexOf("/") + 1);
|
|
9822
9825
|
function missing4(err) {
|
|
9823
9826
|
return err?.code === "ENOENT";
|
|
9824
9827
|
}
|
|
@@ -9839,21 +9842,53 @@ function statOf(path, bytes) {
|
|
|
9839
9842
|
gid: 0
|
|
9840
9843
|
};
|
|
9841
9844
|
}
|
|
9845
|
+
function linkFollower(fs, files) {
|
|
9846
|
+
const bases = new Set([...files.keys()].map(baseOf2));
|
|
9847
|
+
const linkOf2 = (path) => fs.readlink(path).then(
|
|
9848
|
+
(link2) => link2,
|
|
9849
|
+
() => void 0
|
|
9850
|
+
);
|
|
9851
|
+
const viaParent = async (path) => {
|
|
9852
|
+
if (!bases.has(baseOf2(path)) || !fs.realpath) return path;
|
|
9853
|
+
const parent = parentOf6(path);
|
|
9854
|
+
const dir = await fs.realpath(parent, true).catch(() => parent);
|
|
9855
|
+
return fs.resolvePath(dir, baseOf2(path));
|
|
9856
|
+
};
|
|
9857
|
+
return async (path) => {
|
|
9858
|
+
let current = path;
|
|
9859
|
+
for (let hop = 0; hop < MAX_HOPS2 && !files.has(current); hop++) {
|
|
9860
|
+
const link2 = await linkOf2(current);
|
|
9861
|
+
if (link2 === void 0) return viaParent(current);
|
|
9862
|
+
current = fs.resolvePath(parentOf6(current), link2);
|
|
9863
|
+
}
|
|
9864
|
+
return current;
|
|
9865
|
+
};
|
|
9866
|
+
}
|
|
9867
|
+
function materializer(fs, listedAbsent) {
|
|
9868
|
+
return async (path) => {
|
|
9869
|
+
const bytes = await listedAbsent(path);
|
|
9870
|
+
if (bytes !== void 0) await fs.writeFile(path, bytes);
|
|
9871
|
+
};
|
|
9872
|
+
}
|
|
9842
9873
|
function withEtcFiles(fs, files) {
|
|
9843
9874
|
const bytesOf4 = (path) => {
|
|
9844
9875
|
const text = files.get(path)?.();
|
|
9845
9876
|
return text === void 0 ? void 0 : new TextEncoder().encode(text);
|
|
9846
9877
|
};
|
|
9847
9878
|
const absent2 = (path) => fs.lstat(path).then(() => false, missing4);
|
|
9879
|
+
const follow2 = linkFollower(fs, files);
|
|
9880
|
+
const listedAbsent = async (path) => files.has(path) && await absent2(path) ? bytesOf4(path) : void 0;
|
|
9848
9881
|
const fallback = (path, make) => async (err) => {
|
|
9849
|
-
const
|
|
9850
|
-
|
|
9851
|
-
|
|
9882
|
+
const at = missing4(err) ? await follow2(path) : void 0;
|
|
9883
|
+
const bytes = at === void 0 ? void 0 : await listedAbsent(at);
|
|
9884
|
+
if (bytes === void 0 || at === void 0) throw err;
|
|
9885
|
+
return make(bytes, at);
|
|
9852
9886
|
};
|
|
9853
9887
|
const ranged2 = rangedOps(fs);
|
|
9888
|
+
const materialize = materializer(fs, listedAbsent);
|
|
9854
9889
|
const own = {
|
|
9855
|
-
stat: (path) => fs.stat(path).catch(fallback(path, (b) => statOf(
|
|
9856
|
-
lstat: (path) => fs.lstat(path).catch(fallback(path, (b) => statOf(
|
|
9890
|
+
stat: (path) => fs.stat(path).catch(fallback(path, (b, at) => statOf(at, b))),
|
|
9891
|
+
lstat: (path) => fs.lstat(path).catch(fallback(path, (b, at) => statOf(at, b))),
|
|
9857
9892
|
exists: async (path) => await fs.exists(path) || files.has(path) && await absent2(path),
|
|
9858
9893
|
...fs.createExclusive ? {
|
|
9859
9894
|
createExclusive: async (path, owner) => {
|
|
@@ -9866,9 +9901,23 @@ function withEtcFiles(fs, files) {
|
|
|
9866
9901
|
}
|
|
9867
9902
|
} : {},
|
|
9868
9903
|
readFile: (path) => fs.readFile(path).catch(fallback(path, (b) => new TextDecoder().decode(b))),
|
|
9904
|
+
...fs.append ? {
|
|
9905
|
+
append: async (path, bytes) => {
|
|
9906
|
+
if (files.has(path)) await materialize(path);
|
|
9907
|
+
return fs.append.call(fs, path, bytes);
|
|
9908
|
+
}
|
|
9909
|
+
} : {},
|
|
9869
9910
|
readFileBuffer: (path) => fs.readFileBuffer(path).catch(fallback(path, (b) => b)),
|
|
9870
9911
|
...ranged2 ? {
|
|
9871
|
-
pread: (path, offset, length2, version) => ranged2.pread(path, offset, length2, version).catch(fallback(path, (b) => b.slice(offset, offset + length2)))
|
|
9912
|
+
pread: (path, offset, length2, version) => ranged2.pread(path, offset, length2, version).catch(fallback(path, (b) => b.slice(offset, offset + length2))),
|
|
9913
|
+
pwrite: async (path, offset, bytes, transfer) => {
|
|
9914
|
+
if (files.has(path)) await materialize(path);
|
|
9915
|
+
return ranged2.pwrite(path, offset, bytes, transfer);
|
|
9916
|
+
},
|
|
9917
|
+
truncate: async (path, size) => {
|
|
9918
|
+
if (files.has(path)) await materialize(path);
|
|
9919
|
+
return ranged2.truncate(path, size);
|
|
9920
|
+
}
|
|
9872
9921
|
} : {}
|
|
9873
9922
|
};
|
|
9874
9923
|
return new Proxy(fs, {
|
|
@@ -10001,7 +10050,7 @@ var FreshModules = class {
|
|
|
10001
10050
|
};
|
|
10002
10051
|
|
|
10003
10052
|
// src/fs/physical-path.ts
|
|
10004
|
-
var
|
|
10053
|
+
var MAX_HOPS3 = 40;
|
|
10005
10054
|
function start(path) {
|
|
10006
10055
|
return { done: [], todo: path.split("/").filter((p) => p !== ""), hops: 0 };
|
|
10007
10056
|
}
|
|
@@ -10026,7 +10075,7 @@ function rest(walk2, part) {
|
|
|
10026
10075
|
return lexical(`/${[...walk2.done, part, ...walk2.todo].join("/")}`);
|
|
10027
10076
|
}
|
|
10028
10077
|
function follow(walk2, target) {
|
|
10029
|
-
if (++walk2.hops >
|
|
10078
|
+
if (++walk2.hops > MAX_HOPS3) return false;
|
|
10030
10079
|
if (target.startsWith("/")) walk2.done.length = 0;
|
|
10031
10080
|
walk2.todo = [...target.split("/").filter((p) => p !== ""), ...walk2.todo];
|
|
10032
10081
|
return true;
|
|
@@ -10049,13 +10098,13 @@ async function physicalPathAsync(fs, path) {
|
|
|
10049
10098
|
|
|
10050
10099
|
// src/fs/watch.ts
|
|
10051
10100
|
var WATCH_NOTES_LIMIT = 1e3;
|
|
10052
|
-
var
|
|
10101
|
+
var baseOf3 = (path) => path.slice(path.lastIndexOf("/") + 1);
|
|
10053
10102
|
var WATCH_BATCH_LIMIT = 1e3;
|
|
10054
10103
|
var under3 = (path, dir) => dir === "/" || path.startsWith(`${dir}/`);
|
|
10055
|
-
var
|
|
10104
|
+
var parentOf7 = (path) => path.slice(0, path.lastIndexOf("/")) || "/";
|
|
10056
10105
|
function touches(watcher, changed) {
|
|
10057
10106
|
return watcher.paths.some(
|
|
10058
|
-
(watched) => changed === watched || under3(watched, changed) || (watcher.recursive ? under3(changed, watched) :
|
|
10107
|
+
(watched) => changed === watched || under3(watched, changed) || (watcher.recursive ? under3(changed, watched) : parentOf7(changed) === watched)
|
|
10059
10108
|
);
|
|
10060
10109
|
}
|
|
10061
10110
|
var REALS_KEPT = 4096;
|
|
@@ -10079,11 +10128,11 @@ function route(watch, type, path) {
|
|
|
10079
10128
|
}
|
|
10080
10129
|
function routed(watch, root, type, path) {
|
|
10081
10130
|
if (path === root || type === "rename" && root !== "/" && under3(root, path)) {
|
|
10082
|
-
noted(watch, { type, filename:
|
|
10131
|
+
noted(watch, { type, filename: baseOf3(root) });
|
|
10083
10132
|
if (type === "rename") noted(watch, { ended: true });
|
|
10084
10133
|
return true;
|
|
10085
10134
|
}
|
|
10086
|
-
if (
|
|
10135
|
+
if (parentOf7(path) === root) noted(watch, { type, filename: baseOf3(path) });
|
|
10087
10136
|
else if (watch.recursive && under3(path, root)) {
|
|
10088
10137
|
noted(watch, { type, filename: path.slice(root === "/" ? 1 : root.length + 1) });
|
|
10089
10138
|
} else return false;
|
|
@@ -10159,7 +10208,7 @@ var FsWatchers = class {
|
|
|
10159
10208
|
covers(path) {
|
|
10160
10209
|
for (const watch of this.typed) {
|
|
10161
10210
|
for (const root of watch.roots) {
|
|
10162
|
-
if (path === root ||
|
|
10211
|
+
if (path === root || parentOf7(path) === root || watch.recursive && under3(path, root))
|
|
10163
10212
|
return true;
|
|
10164
10213
|
}
|
|
10165
10214
|
}
|
|
@@ -11328,7 +11377,7 @@ var HeldPaths = class extends Map {
|
|
|
11328
11377
|
return this.revoked.has(path);
|
|
11329
11378
|
}
|
|
11330
11379
|
};
|
|
11331
|
-
var
|
|
11380
|
+
var parentOf8 = (path) => path.slice(0, path.lastIndexOf("/")) || "/";
|
|
11332
11381
|
var readonly = (mount) => mount.caps.readonly === true || mount.options.ro !== void 0;
|
|
11333
11382
|
function inodeless(mount, attr2) {
|
|
11334
11383
|
if (attr2.ino !== void 0) return false;
|
|
@@ -11628,7 +11677,7 @@ var MountTable = class {
|
|
|
11628
11677
|
for (const [key, cached] of [...mount.attrs])
|
|
11629
11678
|
if (within6(key, path) || linked2(cached.value)) mount.attrs.delete(key);
|
|
11630
11679
|
mount.lists.delete(path);
|
|
11631
|
-
mount.lists.delete(
|
|
11680
|
+
mount.lists.delete(parentOf8(path));
|
|
11632
11681
|
for (const [key, cached] of [...mount.lists])
|
|
11633
11682
|
if (within6(key, path) || cached.value.some((e) => linked2(e.attr))) mount.lists.delete(key);
|
|
11634
11683
|
}
|
|
@@ -11748,7 +11797,7 @@ var MountFs = class _MountFs {
|
|
|
11748
11797
|
const real = normalizePath(path);
|
|
11749
11798
|
if (this.at(real)) return real;
|
|
11750
11799
|
try {
|
|
11751
|
-
await this.base.stat(
|
|
11800
|
+
await this.base.stat(parentOf8(real));
|
|
11752
11801
|
return real;
|
|
11753
11802
|
} catch (err) {
|
|
11754
11803
|
const moved2 = redirectOf(err);
|
|
@@ -11790,7 +11839,7 @@ var MountFs = class _MountFs {
|
|
|
11790
11839
|
if (this.rejectLinks) throw errnoError("ELOOP", path);
|
|
11791
11840
|
if (hops >= MAX_LINKS7) throw errnoError("ELOOP", path);
|
|
11792
11841
|
const target = await found.mount.conn.call({ op: "readlink", path: found.rel });
|
|
11793
|
-
return this.follow(this.base.resolvePath(
|
|
11842
|
+
return this.follow(this.base.resolvePath(parentOf8(real), target), hops + 1, create);
|
|
11794
11843
|
}
|
|
11795
11844
|
async open(mount, rel2, write, owner) {
|
|
11796
11845
|
return await mount.conn.call({
|
|
@@ -11806,8 +11855,8 @@ var MountFs = class _MountFs {
|
|
|
11806
11855
|
async driverOwner(found, real, owner, directory) {
|
|
11807
11856
|
const { mount, rel: rel2 } = found;
|
|
11808
11857
|
if (!owner || !mount.owners || !mount.caps.owners) return void 0;
|
|
11809
|
-
const dir =
|
|
11810
|
-
const above = statOf2(await this.table.getattr(mount, dir,
|
|
11858
|
+
const dir = parentOf8(real);
|
|
11859
|
+
const above = statOf2(await this.table.getattr(mount, dir, parentOf8(rel2)), dir, mount);
|
|
11811
11860
|
const setgid = (above.mode & S_ISGID4) !== 0;
|
|
11812
11861
|
let mode = owner.mode;
|
|
11813
11862
|
if (directory && setgid) mode = (mode ?? 493) | S_ISGID4;
|
|
@@ -12313,7 +12362,7 @@ var MountFs = class _MountFs {
|
|
|
12313
12362
|
}
|
|
12314
12363
|
async named(path) {
|
|
12315
12364
|
const at = normalizePath(path);
|
|
12316
|
-
return joinName(await realDir(this,
|
|
12365
|
+
return joinName(await realDir(this, parentOf8(at)), at.slice(at.lastIndexOf("/") + 1));
|
|
12317
12366
|
}
|
|
12318
12367
|
async link(source, target, follow2 = false) {
|
|
12319
12368
|
const from = follow2 ? await realTarget(this, normalizePath(source)) : await this.named(source);
|
|
@@ -14199,6 +14248,12 @@ var ProcTree = class {
|
|
|
14199
14248
|
if (node.kind !== "dir") throw syncError("ENOTDIR", path);
|
|
14200
14249
|
return node.names();
|
|
14201
14250
|
}
|
|
14251
|
+
escape(path) {
|
|
14252
|
+
const node = this.node(this.parts(path, true));
|
|
14253
|
+
if (node?.kind !== "link" || !node.target.startsWith("/")) return void 0;
|
|
14254
|
+
if (node.denied) throw syncError("EACCES", path);
|
|
14255
|
+
return node.target;
|
|
14256
|
+
}
|
|
14202
14257
|
readlink(path) {
|
|
14203
14258
|
const node = this.find(path, false);
|
|
14204
14259
|
if (node.kind !== "link") throw syncError("EINVAL", path);
|
|
@@ -14214,7 +14269,7 @@ var ProcTree = class {
|
|
|
14214
14269
|
}
|
|
14215
14270
|
}
|
|
14216
14271
|
};
|
|
14217
|
-
var
|
|
14272
|
+
var MAX_HOPS4 = 40;
|
|
14218
14273
|
function* procWalk(path, follow2) {
|
|
14219
14274
|
let done4 = [];
|
|
14220
14275
|
let todo = path.split("/").filter((part) => part !== "");
|
|
@@ -14233,7 +14288,7 @@ function* procWalk(path, follow2) {
|
|
|
14233
14288
|
if (!follow2 && todo.length === 0) return void 0;
|
|
14234
14289
|
const target = yield { at, check: todo.find((next3) => next3 !== ".") === ".." };
|
|
14235
14290
|
if (typeof target === "string") {
|
|
14236
|
-
if (++hops >
|
|
14291
|
+
if (++hops > MAX_HOPS4) return void 0;
|
|
14237
14292
|
[done4, todo] = throughLink(target, done4, todo);
|
|
14238
14293
|
} else {
|
|
14239
14294
|
broken ??= refusalOf(target);
|
|
@@ -21733,7 +21788,7 @@ function isWatchSyscall(req) {
|
|
|
21733
21788
|
return WATCHING.has(req.op);
|
|
21734
21789
|
}
|
|
21735
21790
|
var WATCHES_MAX = 8192;
|
|
21736
|
-
var
|
|
21791
|
+
var parentOf9 = (path) => path.slice(0, path.lastIndexOf("/")) || "/";
|
|
21737
21792
|
function visibleTo2(watch, root, visible) {
|
|
21738
21793
|
return {
|
|
21739
21794
|
close: () => watch.close(),
|
|
@@ -21743,7 +21798,7 @@ function visibleTo2(watch, root, visible) {
|
|
|
21743
21798
|
const shown = await Promise.all(
|
|
21744
21799
|
notes.map(async (note) => {
|
|
21745
21800
|
if (!("filename" in note) || !note.filename.includes("/")) return true;
|
|
21746
|
-
const dir =
|
|
21801
|
+
const dir = parentOf9(`${root === "/" ? "" : root}/${note.filename}`);
|
|
21747
21802
|
if (!seen.has(dir)) seen.set(dir, visible(dir));
|
|
21748
21803
|
return seen.get(dir);
|
|
21749
21804
|
})
|
|
@@ -23783,6 +23838,7 @@ function processInit(opts, sab, umask, cred, lane) {
|
|
|
23783
23838
|
args: opts.args,
|
|
23784
23839
|
env: opts.env,
|
|
23785
23840
|
cwd: opts.cwd,
|
|
23841
|
+
hostname: opts.hostname,
|
|
23786
23842
|
sab,
|
|
23787
23843
|
umask,
|
|
23788
23844
|
cred,
|
|
@@ -28109,6 +28165,7 @@ var Launcher = class {
|
|
|
28109
28165
|
this.hostname = hostname;
|
|
28110
28166
|
this.env = {
|
|
28111
28167
|
...networkEnv(hostname),
|
|
28168
|
+
HOSTNAME: hostname,
|
|
28112
28169
|
SLICC_CDP_URL: this.cdp.url,
|
|
28113
28170
|
...this.facades.env(),
|
|
28114
28171
|
...options.env
|
|
@@ -28935,7 +28992,7 @@ var Launcher = class {
|
|
|
28935
28992
|
const env = { ...expandDefaults(asked.target.env, seen), ...req.env };
|
|
28936
28993
|
for (const key of asked.target.unset ?? []) delete env[key];
|
|
28937
28994
|
delete env[TICKET_ENV];
|
|
28938
|
-
env.HOSTNAME = this.hostname;
|
|
28995
|
+
if (asked.target.abi === "wasi") env.HOSTNAME = this.hostname;
|
|
28939
28996
|
const planned = chosen(asked, env);
|
|
28940
28997
|
const { target, args } = planned;
|
|
28941
28998
|
let program;
|
|
@@ -29089,6 +29146,7 @@ var Launcher = class {
|
|
|
29089
29146
|
...this.dac ? { dac: this.dac } : {},
|
|
29090
29147
|
program: req.program,
|
|
29091
29148
|
changes: this.changes.sab,
|
|
29149
|
+
hostname: this.hostname,
|
|
29092
29150
|
...this.heldFor(pid, cwdSlot),
|
|
29093
29151
|
argv0: req.argv0,
|
|
29094
29152
|
args: req.args,
|
|
@@ -29943,7 +30001,7 @@ var Launcher = class {
|
|
|
29943
30001
|
}
|
|
29944
30002
|
environment(cwd, extra, account, login2 = false) {
|
|
29945
30003
|
const env = {
|
|
29946
|
-
...login2 ? networkEnv(this.hostname) : this.env,
|
|
30004
|
+
...login2 ? { ...networkEnv(this.hostname), HOSTNAME: this.hostname } : this.env,
|
|
29947
30005
|
...userEnv(account, this.pnpmHome),
|
|
29948
30006
|
PWD: cwd,
|
|
29949
30007
|
...extra
|