@ai-ecoverse/slicc-kernel 1.56.0 → 1.56.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 +3 -1
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +46 -8
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +35 -5
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +46 -8
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +35 -5
- package/dist/process-worker.js.map +3 -3
- package/package.json +1 -1
package/dist/node.js
CHANGED
|
@@ -2542,12 +2542,34 @@ var OpfsFs = class {
|
|
|
2542
2542
|
const link2 = await this.linkAlong(current);
|
|
2543
2543
|
if (!link2) throw err;
|
|
2544
2544
|
if (link2.path === current && !follow2) return { path: current, link: link2 };
|
|
2545
|
-
const
|
|
2546
|
-
current =
|
|
2545
|
+
const target = `${link2.link}${current.slice(link2.path.length)}`;
|
|
2546
|
+
current = target.split("/").includes("..") ? await this.physical(parentOf2(link2.path), target, hops + 1) : resolvePath(parentOf2(link2.path), target);
|
|
2547
2547
|
}
|
|
2548
2548
|
}
|
|
2549
2549
|
throw fsError("ELOOP", path);
|
|
2550
2550
|
}
|
|
2551
|
+
async physical(base, path, used) {
|
|
2552
|
+
let done4 = [];
|
|
2553
|
+
let todo = (path.startsWith("/") ? path : `${base}/${path}`).split("/").filter((p) => p !== "" && p !== ".");
|
|
2554
|
+
for (let hops = used; todo.length > 0; ) {
|
|
2555
|
+
const part = todo.shift();
|
|
2556
|
+
if (part === "..") done4.pop();
|
|
2557
|
+
else if (!todo.includes("..")) done4.push(part);
|
|
2558
|
+
else {
|
|
2559
|
+
const at = `/${[...done4, part].join("/")}`;
|
|
2560
|
+
const st = await this.lstat(at);
|
|
2561
|
+
if (!st.isSymbolicLink && !st.isDirectory) throw fsError("ENOTDIR", at);
|
|
2562
|
+
if (!st.isSymbolicLink) done4.push(part);
|
|
2563
|
+
else if (++hops > MAX_LINKS2) throw fsError("ELOOP", path);
|
|
2564
|
+
else {
|
|
2565
|
+
const link2 = await this.readlink(at);
|
|
2566
|
+
if (link2.startsWith("/")) done4 = [];
|
|
2567
|
+
todo = [...link2.split("/").filter((p) => p !== "" && p !== "."), ...todo];
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
return `/${done4.join("/")}`;
|
|
2572
|
+
}
|
|
2551
2573
|
mode(path, directory, meta) {
|
|
2552
2574
|
const fallback = directory || EXECUTABLE.test(path) ? 493 : 420;
|
|
2553
2575
|
return (directory ? S_IFDIR : S_IFREG) | (meta?.mode ?? fallback);
|
|
@@ -9386,6 +9408,11 @@ var MAX_LINKS5 = 40;
|
|
|
9386
9408
|
function parentOf6(path) {
|
|
9387
9409
|
return path.slice(0, path.lastIndexOf("/")) || "/";
|
|
9388
9410
|
}
|
|
9411
|
+
async function mustBeDir(fs, path) {
|
|
9412
|
+
if (!fs.lstat) return;
|
|
9413
|
+
const st = await fs.lstat(path);
|
|
9414
|
+
if (st.isDirectory !== true) throw fsError("ENOTDIR", path);
|
|
9415
|
+
}
|
|
9389
9416
|
async function linkOf(fs, path) {
|
|
9390
9417
|
return fs.readlink?.(path).catch(() => void 0);
|
|
9391
9418
|
}
|
|
@@ -9402,6 +9429,7 @@ async function realDir(fs, dir, budget = { hops: 0 }) {
|
|
|
9402
9429
|
const next2 = at === "/" ? `/${part}` : `${at}/${part}`;
|
|
9403
9430
|
const link2 = await linkOf(fs, next2);
|
|
9404
9431
|
if (link2 === void 0) {
|
|
9432
|
+
if (queue.find((p) => p !== ".") === "..") await mustBeDir(fs, next2);
|
|
9405
9433
|
at = next2;
|
|
9406
9434
|
continue;
|
|
9407
9435
|
}
|
|
@@ -11660,7 +11688,7 @@ var HostfsClient = class {
|
|
|
11660
11688
|
false,
|
|
11661
11689
|
true
|
|
11662
11690
|
);
|
|
11663
|
-
|
|
11691
|
+
return response.json().catch(() => null);
|
|
11664
11692
|
}
|
|
11665
11693
|
async read(fh, offset, size, ifMatch) {
|
|
11666
11694
|
const response = await this.send(
|
|
@@ -11716,7 +11744,8 @@ var HostfsClient = class {
|
|
|
11716
11744
|
}
|
|
11717
11745
|
}
|
|
11718
11746
|
};
|
|
11719
|
-
|
|
11747
|
+
var RESTORE_AGAIN_MS = 3e4;
|
|
11748
|
+
function hostfsHandlers(current, againMs = RESTORE_AGAIN_MS) {
|
|
11720
11749
|
const handles = /* @__PURE__ */ new Map();
|
|
11721
11750
|
let nextFh = 0;
|
|
11722
11751
|
const fresh = (remote) => {
|
|
@@ -11729,10 +11758,18 @@ function hostfsHandlers(current) {
|
|
|
11729
11758
|
return fresh(remote);
|
|
11730
11759
|
};
|
|
11731
11760
|
const call = (op, body = {}) => current().call(op, body);
|
|
11732
|
-
const
|
|
11761
|
+
const same = (was, mode, seen) => seen?.mode === (mode | 128) && (was.ino !== void 0 && seen.ino !== void 0 ? seen.ino === was.ino : seen.size === was.size && seen.mtime === was.mtime);
|
|
11762
|
+
const settle = (client, { was, ...restore }) => client.call("setattr", restore).catch((err) => {
|
|
11733
11763
|
if (!client.gone || !client.cleanup) throw err;
|
|
11734
11764
|
void client.cleanup("setattr", restore).catch(() => {
|
|
11735
11765
|
});
|
|
11766
|
+
const timer = setTimeout(async () => {
|
|
11767
|
+
const seen = await client.cleanup?.("stat", { path: restore.path }).catch(() => null);
|
|
11768
|
+
if (same(was, restore.mode, seen))
|
|
11769
|
+
void client.cleanup?.("setattr", restore).catch(() => {
|
|
11770
|
+
});
|
|
11771
|
+
}, againMs);
|
|
11772
|
+
timer.unref?.();
|
|
11736
11773
|
});
|
|
11737
11774
|
async function writable(client, path, flags) {
|
|
11738
11775
|
const { ifMatch: _, ...asked } = flags;
|
|
@@ -11741,9 +11778,10 @@ function hostfsHandlers(current) {
|
|
|
11741
11778
|
return { opened: await opening(), restore: void 0 };
|
|
11742
11779
|
} catch (err) {
|
|
11743
11780
|
if (!flags.write || codeOf4(err) !== "EACCES") throw err;
|
|
11744
|
-
const
|
|
11781
|
+
const was = await client.call("stat", { path: rel(path) });
|
|
11782
|
+
const mode = was.mode ?? 0;
|
|
11745
11783
|
if (mode & 128) throw err;
|
|
11746
|
-
const restore = { path: rel(path), mode };
|
|
11784
|
+
const restore = { path: rel(path), mode, was };
|
|
11747
11785
|
const opened2 = await client.call("setattr", { path: rel(path), mode: mode | 128 }).then(opening).catch(async (again) => {
|
|
11748
11786
|
await settle(client, restore).catch(() => {
|
|
11749
11787
|
});
|
|
@@ -11964,7 +12002,7 @@ function timed(transport, ms) {
|
|
|
11964
12002
|
});
|
|
11965
12003
|
const cleanup = async (op, body, skip) => {
|
|
11966
12004
|
await Promise.allSettled([...inflight].filter((work) => work !== skip));
|
|
11967
|
-
await transport.cleanup?.(op, body);
|
|
12005
|
+
return await transport.cleanup?.(op, body);
|
|
11968
12006
|
};
|
|
11969
12007
|
const release = (opened2) => {
|
|
11970
12008
|
const fh = opened2?.fh;
|