@ai-ecoverse/slicc-kernel 1.62.0 → 1.62.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 +1 -1
- package/dist/kernel-worker.js +79 -4
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +58 -15
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +79 -4
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +58 -15
- package/dist/process-worker.js.map +2 -2
- package/package.json +2 -2
package/dist/node.js
CHANGED
|
@@ -3264,7 +3264,10 @@ var OpfsFs = class {
|
|
|
3264
3264
|
async exists(path) {
|
|
3265
3265
|
return this.locate(path, true).then(
|
|
3266
3266
|
() => true,
|
|
3267
|
-
() =>
|
|
3267
|
+
(err) => {
|
|
3268
|
+
if (missing(err)) return false;
|
|
3269
|
+
throw err;
|
|
3270
|
+
}
|
|
3268
3271
|
);
|
|
3269
3272
|
}
|
|
3270
3273
|
async retrying(path, op, locks) {
|
|
@@ -6740,9 +6743,37 @@ async function holdOp(entry, path, req) {
|
|
|
6740
6743
|
entry.hold?.(path, on, open, void 0, req.handle);
|
|
6741
6744
|
return done;
|
|
6742
6745
|
}
|
|
6746
|
+
var IDENTITY_OPS = /* @__PURE__ */ new Set([
|
|
6747
|
+
"write",
|
|
6748
|
+
"pwrite",
|
|
6749
|
+
"truncate",
|
|
6750
|
+
"chmod",
|
|
6751
|
+
"utimes",
|
|
6752
|
+
"chown",
|
|
6753
|
+
"lchown"
|
|
6754
|
+
]);
|
|
6743
6755
|
async function dispatchSyncFs(req) {
|
|
6744
6756
|
const entry = resolveSyncFsToken(req.token);
|
|
6745
6757
|
if (!entry) return { ok: false, errno: "EACCES", message: "sync-fs: unknown or revoked token" };
|
|
6758
|
+
if (!req.identity || !IDENTITY_OPS.has(req.op)) return dispatchOne(entry, req);
|
|
6759
|
+
const { fs, cwd } = entry;
|
|
6760
|
+
const path = fs.resolvePath(cwd, req.path);
|
|
6761
|
+
const identified = async (held) => {
|
|
6762
|
+
const own = held ? { ...entry, fs: { ...fs, writeFile: held.writeFile } } : entry;
|
|
6763
|
+
const result = await dispatchOne(own, req);
|
|
6764
|
+
if (!result.ok) return result;
|
|
6765
|
+
if (held && !held.direct) return json2(null);
|
|
6766
|
+
const look = req.op === "lchown" ? fs.lstat : fs.stat;
|
|
6767
|
+
const st = await look.call(fs, path).catch(() => void 0);
|
|
6768
|
+
return json2(st ? statJson(st) : null);
|
|
6769
|
+
};
|
|
6770
|
+
try {
|
|
6771
|
+
return await (fs.exclusive ? fs.exclusive(path, identified, req.op !== "lchown") : identified());
|
|
6772
|
+
} catch (err) {
|
|
6773
|
+
return toErrno(err);
|
|
6774
|
+
}
|
|
6775
|
+
}
|
|
6776
|
+
async function dispatchOne(entry, req) {
|
|
6746
6777
|
const { fs, cwd } = entry;
|
|
6747
6778
|
try {
|
|
6748
6779
|
const path = fs.resolvePath(cwd, req.path);
|
|
@@ -10090,7 +10121,9 @@ var VfsNode = class {
|
|
|
10090
10121
|
this.ranged = new AsyncRangedFile(io, this.path, this.pin.size, this.pin.version);
|
|
10091
10122
|
return this.ranged;
|
|
10092
10123
|
}
|
|
10093
|
-
const
|
|
10124
|
+
const at = this.path;
|
|
10125
|
+
const st = io && !this.orphaned ? await this.fs.stat?.(at).catch(() => void 0) : void 0;
|
|
10126
|
+
this.note(at, st);
|
|
10094
10127
|
if (io && st?.ranged) {
|
|
10095
10128
|
this.ranged = new AsyncRangedFile(io, this.path, st.size ?? 0, st.version);
|
|
10096
10129
|
return this.ranged;
|
|
@@ -10150,12 +10183,23 @@ var VfsNode = class {
|
|
|
10150
10183
|
const stat = this.fs.stat?.bind(this.fs);
|
|
10151
10184
|
if (!stat || this.orphaned) return Promise.resolve(void 0);
|
|
10152
10185
|
const parent = this.path.slice(0, this.path.lastIndexOf("/")) || "/";
|
|
10153
|
-
|
|
10186
|
+
const at = this.path;
|
|
10187
|
+
this.cap ??= stat(at).then((st) => {
|
|
10188
|
+
this.note(at, st);
|
|
10189
|
+
return st;
|
|
10190
|
+
}).catch(() => stat(parent)).then(
|
|
10154
10191
|
(st) => st.maxFile,
|
|
10155
10192
|
() => void 0
|
|
10156
10193
|
);
|
|
10157
10194
|
return this.cap;
|
|
10158
10195
|
}
|
|
10196
|
+
seen;
|
|
10197
|
+
note(path, st) {
|
|
10198
|
+
if (st?.ino !== void 0) this.seen = { path, ino: st.ino };
|
|
10199
|
+
}
|
|
10200
|
+
known() {
|
|
10201
|
+
return this.seen?.path === this.path && !this.orphaned ? this.seen.ino : void 0;
|
|
10202
|
+
}
|
|
10159
10203
|
async fits(end) {
|
|
10160
10204
|
const max = await this.limit();
|
|
10161
10205
|
if (max !== void 0 && end > max) throw new KernelError("EFBIG");
|
|
@@ -10469,6 +10513,18 @@ async function refuseReadonly(fs, path, flags, opts = {}) {
|
|
|
10469
10513
|
function keepingOpen(fs, nodes) {
|
|
10470
10514
|
return {
|
|
10471
10515
|
...fs,
|
|
10516
|
+
async exclusive(path, run2, follow2 = true) {
|
|
10517
|
+
const at = fs.resolvePath("/", path);
|
|
10518
|
+
const key = follow2 ? nodes.targetKey(at) : nodes.entryKey(at);
|
|
10519
|
+
const locked = await key.catch(() => at);
|
|
10520
|
+
return nodes.onEntry(
|
|
10521
|
+
locked,
|
|
10522
|
+
() => run2({
|
|
10523
|
+
writeFile: (p, content, owner) => fs.writeFile(p, content, owner),
|
|
10524
|
+
direct: locked === at
|
|
10525
|
+
})
|
|
10526
|
+
);
|
|
10527
|
+
},
|
|
10472
10528
|
async rm(path, options) {
|
|
10473
10529
|
const at = await nodes.entryKey(fs.resolvePath("/", path));
|
|
10474
10530
|
await nodes.unlinking(at);
|
|
@@ -10561,6 +10617,7 @@ function vfsFile(fs, opts, nodes) {
|
|
|
10561
10617
|
size: await node.size(),
|
|
10562
10618
|
...node.orphaned ? { orphan: true } : {}
|
|
10563
10619
|
})),
|
|
10620
|
+
known: () => node.known(),
|
|
10564
10621
|
flush: () => serial(() => node.flush()),
|
|
10565
10622
|
close: () => node.serial(async () => {
|
|
10566
10623
|
try {
|
|
@@ -10955,6 +11012,20 @@ var WasmProcess = class {
|
|
|
10955
11012
|
}
|
|
10956
11013
|
return fd;
|
|
10957
11014
|
}
|
|
11015
|
+
async identified(stat, known) {
|
|
11016
|
+
const first = await stat();
|
|
11017
|
+
if (first.orphan) return first;
|
|
11018
|
+
const ino = known?.();
|
|
11019
|
+
if (ino !== void 0) return { ...first, ino };
|
|
11020
|
+
const { fs } = this.options;
|
|
11021
|
+
const look = async () => {
|
|
11022
|
+
const now = await stat();
|
|
11023
|
+
if (now.path !== first.path || now.orphan) return now;
|
|
11024
|
+
const st = await fs.stat?.(now.path).catch(() => void 0);
|
|
11025
|
+
return st?.ino === void 0 ? now : { ...now, ino: st.ino };
|
|
11026
|
+
};
|
|
11027
|
+
return fs.exclusive ? fs.exclusive(first.path, look) : look();
|
|
11028
|
+
}
|
|
10958
11029
|
newOwner() {
|
|
10959
11030
|
if (!this.options.owners) return void 0;
|
|
10960
11031
|
return { uid: this.cred.euid, gid: this.cred.egid, mode: 438 & ~this.umask };
|
|
@@ -11116,7 +11187,11 @@ var WasmProcess = class {
|
|
|
11116
11187
|
await file.resize(req.size);
|
|
11117
11188
|
return { ok: true, kind: "void" };
|
|
11118
11189
|
case "fd-vfs-stat":
|
|
11119
|
-
return {
|
|
11190
|
+
return {
|
|
11191
|
+
ok: true,
|
|
11192
|
+
kind: "json",
|
|
11193
|
+
json: req.identity ? await this.identified(file.stat.bind(file), file.known?.bind(file)) : await file.stat()
|
|
11194
|
+
};
|
|
11120
11195
|
}
|
|
11121
11196
|
}
|
|
11122
11197
|
keptPath;
|