@ai-ecoverse/slicc-kernel 1.140.0 → 1.140.2
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 -2
- package/dist/kernel-worker.js +92 -34
- package/dist/kernel-worker.js.map +3 -3
- package/dist/meta.js +5 -3
- package/dist/meta.js.map +2 -2
- package/dist/node-process-worker.js +86 -12
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +87 -31
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +86 -12
- package/dist/process-worker.js.map +3 -3
- package/dist/types/fs/meta.d.ts +3 -3
- 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 +4 -4
package/dist/node.js
CHANGED
|
@@ -3740,8 +3740,9 @@ var MemoryMeta = class {
|
|
|
3740
3740
|
this.entries.set(to, moved(root(carried.find((entry) => entry.path === from)), to));
|
|
3741
3741
|
if (left) this.entries.set(from, left);
|
|
3742
3742
|
}
|
|
3743
|
-
async remove(paths) {
|
|
3743
|
+
async remove(paths, left) {
|
|
3744
3744
|
for (const path of paths) this.entries.deleteTree(path);
|
|
3745
|
+
if (left) this.entries.set(left.path, left);
|
|
3745
3746
|
}
|
|
3746
3747
|
absent(path) {
|
|
3747
3748
|
return !this.entries.has(path);
|
|
@@ -5590,10 +5591,10 @@ var OpfsFs = class {
|
|
|
5590
5591
|
return;
|
|
5591
5592
|
}
|
|
5592
5593
|
}
|
|
5593
|
-
await this.meta.remove(
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5594
|
+
await this.meta.remove(
|
|
5595
|
+
[found.path],
|
|
5596
|
+
found.handle?.kind === "directory" ? vacatedAt(found.path) : void 0
|
|
5597
|
+
);
|
|
5597
5598
|
this.touch(Date.now(), parentOf4(found.path));
|
|
5598
5599
|
}
|
|
5599
5600
|
links() {
|
|
@@ -7513,7 +7514,7 @@ function satisfies(version, range2) {
|
|
|
7513
7514
|
}
|
|
7514
7515
|
|
|
7515
7516
|
// src/version.ts
|
|
7516
|
-
var KERNEL_VERSION = true ? "1.140.
|
|
7517
|
+
var KERNEL_VERSION = true ? "1.140.2" : "0.0.0-dev";
|
|
7517
7518
|
var OS_RELEASE = "6.0.0-slicc";
|
|
7518
7519
|
function procVersion() {
|
|
7519
7520
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -9818,6 +9819,9 @@ function devCreation(path, cred) {
|
|
|
9818
9819
|
// src/fs/etc-files.ts
|
|
9819
9820
|
var HOSTNAME_PATH = "/etc/hostname";
|
|
9820
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);
|
|
9821
9825
|
function missing4(err) {
|
|
9822
9826
|
return err?.code === "ENOENT";
|
|
9823
9827
|
}
|
|
@@ -9838,21 +9842,53 @@ function statOf(path, bytes) {
|
|
|
9838
9842
|
gid: 0
|
|
9839
9843
|
};
|
|
9840
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
|
+
}
|
|
9841
9873
|
function withEtcFiles(fs, files) {
|
|
9842
9874
|
const bytesOf4 = (path) => {
|
|
9843
9875
|
const text = files.get(path)?.();
|
|
9844
9876
|
return text === void 0 ? void 0 : new TextEncoder().encode(text);
|
|
9845
9877
|
};
|
|
9846
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;
|
|
9847
9881
|
const fallback = (path, make) => async (err) => {
|
|
9848
|
-
const
|
|
9849
|
-
|
|
9850
|
-
|
|
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);
|
|
9851
9886
|
};
|
|
9852
9887
|
const ranged2 = rangedOps(fs);
|
|
9888
|
+
const materialize = materializer(fs, listedAbsent);
|
|
9853
9889
|
const own = {
|
|
9854
|
-
stat: (path) => fs.stat(path).catch(fallback(path, (b) => statOf(
|
|
9855
|
-
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))),
|
|
9856
9892
|
exists: async (path) => await fs.exists(path) || files.has(path) && await absent2(path),
|
|
9857
9893
|
...fs.createExclusive ? {
|
|
9858
9894
|
createExclusive: async (path, owner) => {
|
|
@@ -9865,9 +9901,23 @@ function withEtcFiles(fs, files) {
|
|
|
9865
9901
|
}
|
|
9866
9902
|
} : {},
|
|
9867
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
|
+
} : {},
|
|
9868
9910
|
readFileBuffer: (path) => fs.readFileBuffer(path).catch(fallback(path, (b) => b)),
|
|
9869
9911
|
...ranged2 ? {
|
|
9870
|
-
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
|
+
}
|
|
9871
9921
|
} : {}
|
|
9872
9922
|
};
|
|
9873
9923
|
return new Proxy(fs, {
|
|
@@ -10000,7 +10050,7 @@ var FreshModules = class {
|
|
|
10000
10050
|
};
|
|
10001
10051
|
|
|
10002
10052
|
// src/fs/physical-path.ts
|
|
10003
|
-
var
|
|
10053
|
+
var MAX_HOPS3 = 40;
|
|
10004
10054
|
function start(path) {
|
|
10005
10055
|
return { done: [], todo: path.split("/").filter((p) => p !== ""), hops: 0 };
|
|
10006
10056
|
}
|
|
@@ -10025,7 +10075,7 @@ function rest(walk2, part) {
|
|
|
10025
10075
|
return lexical(`/${[...walk2.done, part, ...walk2.todo].join("/")}`);
|
|
10026
10076
|
}
|
|
10027
10077
|
function follow(walk2, target) {
|
|
10028
|
-
if (++walk2.hops >
|
|
10078
|
+
if (++walk2.hops > MAX_HOPS3) return false;
|
|
10029
10079
|
if (target.startsWith("/")) walk2.done.length = 0;
|
|
10030
10080
|
walk2.todo = [...target.split("/").filter((p) => p !== ""), ...walk2.todo];
|
|
10031
10081
|
return true;
|
|
@@ -10048,13 +10098,13 @@ async function physicalPathAsync(fs, path) {
|
|
|
10048
10098
|
|
|
10049
10099
|
// src/fs/watch.ts
|
|
10050
10100
|
var WATCH_NOTES_LIMIT = 1e3;
|
|
10051
|
-
var
|
|
10101
|
+
var baseOf3 = (path) => path.slice(path.lastIndexOf("/") + 1);
|
|
10052
10102
|
var WATCH_BATCH_LIMIT = 1e3;
|
|
10053
10103
|
var under3 = (path, dir) => dir === "/" || path.startsWith(`${dir}/`);
|
|
10054
|
-
var
|
|
10104
|
+
var parentOf7 = (path) => path.slice(0, path.lastIndexOf("/")) || "/";
|
|
10055
10105
|
function touches(watcher, changed) {
|
|
10056
10106
|
return watcher.paths.some(
|
|
10057
|
-
(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)
|
|
10058
10108
|
);
|
|
10059
10109
|
}
|
|
10060
10110
|
var REALS_KEPT = 4096;
|
|
@@ -10078,11 +10128,11 @@ function route(watch, type, path) {
|
|
|
10078
10128
|
}
|
|
10079
10129
|
function routed(watch, root, type, path) {
|
|
10080
10130
|
if (path === root || type === "rename" && root !== "/" && under3(root, path)) {
|
|
10081
|
-
noted(watch, { type, filename:
|
|
10131
|
+
noted(watch, { type, filename: baseOf3(root) });
|
|
10082
10132
|
if (type === "rename") noted(watch, { ended: true });
|
|
10083
10133
|
return true;
|
|
10084
10134
|
}
|
|
10085
|
-
if (
|
|
10135
|
+
if (parentOf7(path) === root) noted(watch, { type, filename: baseOf3(path) });
|
|
10086
10136
|
else if (watch.recursive && under3(path, root)) {
|
|
10087
10137
|
noted(watch, { type, filename: path.slice(root === "/" ? 1 : root.length + 1) });
|
|
10088
10138
|
} else return false;
|
|
@@ -10158,7 +10208,7 @@ var FsWatchers = class {
|
|
|
10158
10208
|
covers(path) {
|
|
10159
10209
|
for (const watch of this.typed) {
|
|
10160
10210
|
for (const root of watch.roots) {
|
|
10161
|
-
if (path === root ||
|
|
10211
|
+
if (path === root || parentOf7(path) === root || watch.recursive && under3(path, root))
|
|
10162
10212
|
return true;
|
|
10163
10213
|
}
|
|
10164
10214
|
}
|
|
@@ -11327,7 +11377,7 @@ var HeldPaths = class extends Map {
|
|
|
11327
11377
|
return this.revoked.has(path);
|
|
11328
11378
|
}
|
|
11329
11379
|
};
|
|
11330
|
-
var
|
|
11380
|
+
var parentOf8 = (path) => path.slice(0, path.lastIndexOf("/")) || "/";
|
|
11331
11381
|
var readonly = (mount) => mount.caps.readonly === true || mount.options.ro !== void 0;
|
|
11332
11382
|
function inodeless(mount, attr2) {
|
|
11333
11383
|
if (attr2.ino !== void 0) return false;
|
|
@@ -11627,7 +11677,7 @@ var MountTable = class {
|
|
|
11627
11677
|
for (const [key, cached] of [...mount.attrs])
|
|
11628
11678
|
if (within6(key, path) || linked2(cached.value)) mount.attrs.delete(key);
|
|
11629
11679
|
mount.lists.delete(path);
|
|
11630
|
-
mount.lists.delete(
|
|
11680
|
+
mount.lists.delete(parentOf8(path));
|
|
11631
11681
|
for (const [key, cached] of [...mount.lists])
|
|
11632
11682
|
if (within6(key, path) || cached.value.some((e) => linked2(e.attr))) mount.lists.delete(key);
|
|
11633
11683
|
}
|
|
@@ -11747,7 +11797,7 @@ var MountFs = class _MountFs {
|
|
|
11747
11797
|
const real = normalizePath(path);
|
|
11748
11798
|
if (this.at(real)) return real;
|
|
11749
11799
|
try {
|
|
11750
|
-
await this.base.stat(
|
|
11800
|
+
await this.base.stat(parentOf8(real));
|
|
11751
11801
|
return real;
|
|
11752
11802
|
} catch (err) {
|
|
11753
11803
|
const moved2 = redirectOf(err);
|
|
@@ -11789,7 +11839,7 @@ var MountFs = class _MountFs {
|
|
|
11789
11839
|
if (this.rejectLinks) throw errnoError("ELOOP", path);
|
|
11790
11840
|
if (hops >= MAX_LINKS7) throw errnoError("ELOOP", path);
|
|
11791
11841
|
const target = await found.mount.conn.call({ op: "readlink", path: found.rel });
|
|
11792
|
-
return this.follow(this.base.resolvePath(
|
|
11842
|
+
return this.follow(this.base.resolvePath(parentOf8(real), target), hops + 1, create);
|
|
11793
11843
|
}
|
|
11794
11844
|
async open(mount, rel2, write, owner) {
|
|
11795
11845
|
return await mount.conn.call({
|
|
@@ -11805,8 +11855,8 @@ var MountFs = class _MountFs {
|
|
|
11805
11855
|
async driverOwner(found, real, owner, directory) {
|
|
11806
11856
|
const { mount, rel: rel2 } = found;
|
|
11807
11857
|
if (!owner || !mount.owners || !mount.caps.owners) return void 0;
|
|
11808
|
-
const dir =
|
|
11809
|
-
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);
|
|
11810
11860
|
const setgid = (above.mode & S_ISGID4) !== 0;
|
|
11811
11861
|
let mode = owner.mode;
|
|
11812
11862
|
if (directory && setgid) mode = (mode ?? 493) | S_ISGID4;
|
|
@@ -12312,7 +12362,7 @@ var MountFs = class _MountFs {
|
|
|
12312
12362
|
}
|
|
12313
12363
|
async named(path) {
|
|
12314
12364
|
const at = normalizePath(path);
|
|
12315
|
-
return joinName(await realDir(this,
|
|
12365
|
+
return joinName(await realDir(this, parentOf8(at)), at.slice(at.lastIndexOf("/") + 1));
|
|
12316
12366
|
}
|
|
12317
12367
|
async link(source, target, follow2 = false) {
|
|
12318
12368
|
const from = follow2 ? await realTarget(this, normalizePath(source)) : await this.named(source);
|
|
@@ -14198,6 +14248,12 @@ var ProcTree = class {
|
|
|
14198
14248
|
if (node.kind !== "dir") throw syncError("ENOTDIR", path);
|
|
14199
14249
|
return node.names();
|
|
14200
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
|
+
}
|
|
14201
14257
|
readlink(path) {
|
|
14202
14258
|
const node = this.find(path, false);
|
|
14203
14259
|
if (node.kind !== "link") throw syncError("EINVAL", path);
|
|
@@ -14213,7 +14269,7 @@ var ProcTree = class {
|
|
|
14213
14269
|
}
|
|
14214
14270
|
}
|
|
14215
14271
|
};
|
|
14216
|
-
var
|
|
14272
|
+
var MAX_HOPS4 = 40;
|
|
14217
14273
|
function* procWalk(path, follow2) {
|
|
14218
14274
|
let done4 = [];
|
|
14219
14275
|
let todo = path.split("/").filter((part) => part !== "");
|
|
@@ -14232,7 +14288,7 @@ function* procWalk(path, follow2) {
|
|
|
14232
14288
|
if (!follow2 && todo.length === 0) return void 0;
|
|
14233
14289
|
const target = yield { at, check: todo.find((next3) => next3 !== ".") === ".." };
|
|
14234
14290
|
if (typeof target === "string") {
|
|
14235
|
-
if (++hops >
|
|
14291
|
+
if (++hops > MAX_HOPS4) return void 0;
|
|
14236
14292
|
[done4, todo] = throughLink(target, done4, todo);
|
|
14237
14293
|
} else {
|
|
14238
14294
|
broken ??= refusalOf(target);
|
|
@@ -21732,7 +21788,7 @@ function isWatchSyscall(req) {
|
|
|
21732
21788
|
return WATCHING.has(req.op);
|
|
21733
21789
|
}
|
|
21734
21790
|
var WATCHES_MAX = 8192;
|
|
21735
|
-
var
|
|
21791
|
+
var parentOf9 = (path) => path.slice(0, path.lastIndexOf("/")) || "/";
|
|
21736
21792
|
function visibleTo2(watch, root, visible) {
|
|
21737
21793
|
return {
|
|
21738
21794
|
close: () => watch.close(),
|
|
@@ -21742,7 +21798,7 @@ function visibleTo2(watch, root, visible) {
|
|
|
21742
21798
|
const shown = await Promise.all(
|
|
21743
21799
|
notes.map(async (note) => {
|
|
21744
21800
|
if (!("filename" in note) || !note.filename.includes("/")) return true;
|
|
21745
|
-
const dir =
|
|
21801
|
+
const dir = parentOf9(`${root === "/" ? "" : root}/${note.filename}`);
|
|
21746
21802
|
if (!seen.has(dir)) seen.set(dir, visible(dir));
|
|
21747
21803
|
return seen.get(dir);
|
|
21748
21804
|
})
|