@ai-ecoverse/slicc-kernel 1.62.0 → 1.62.1
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 +75 -3
- 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 +75 -3
- 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 +1 -1
package/dist/process-worker.js
CHANGED
|
@@ -1640,7 +1640,10 @@ function errnoError(code2, path) {
|
|
|
1640
1640
|
}
|
|
1641
1641
|
function createSyncFsSabBridge(transport, opts = {}) {
|
|
1642
1642
|
const timeoutMs = opts.timeoutMs ?? SYNC_FS_REQUEST_TIMEOUT_MS;
|
|
1643
|
+
let identity = {};
|
|
1644
|
+
let last = null;
|
|
1643
1645
|
function run(req, path, transfer) {
|
|
1646
|
+
last = null;
|
|
1644
1647
|
const result = transport.call(req, timeoutMs, `sync-sab bridge, '${path}'`, transfer);
|
|
1645
1648
|
if (!result.ok) throw errnoError(result.errno, path);
|
|
1646
1649
|
return result;
|
|
@@ -1655,20 +1658,24 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
1655
1658
|
if (r.ok && r.kind === "json") return r.json;
|
|
1656
1659
|
throw errnoError("EIO", path);
|
|
1657
1660
|
}
|
|
1661
|
+
const changing = (req, path, transfer) => {
|
|
1662
|
+
const r = run({ ...req, ...identity }, path, transfer);
|
|
1663
|
+
if (r.ok && r.kind === "json") last = parseSyncFsStat(r.json);
|
|
1664
|
+
};
|
|
1658
1665
|
const io = (id) => ({
|
|
1659
1666
|
readFile: (path) => bytes({ op: "read", path, ...id }, path),
|
|
1660
1667
|
writeFile: (path, data, open) => {
|
|
1661
|
-
|
|
1668
|
+
changing({ op: "write", path, body: data, ...open ? { mode: 1 } : {}, ...id }, path);
|
|
1662
1669
|
},
|
|
1663
1670
|
pread: (path, offset, length, version) => bytes({ op: "pread", path, offset, length, ...version ? { version } : {}, ...id }, path),
|
|
1664
1671
|
pwrite: (path, offset, body, transfer) => {
|
|
1665
1672
|
const whole = body.byteOffset === 0 && body.byteLength === body.buffer.byteLength;
|
|
1666
1673
|
const owned = transfer && whole && body.buffer instanceof ArrayBuffer;
|
|
1667
1674
|
const transferred = owned ? [body.buffer] : [];
|
|
1668
|
-
|
|
1675
|
+
changing({ op: "pwrite", path, offset, body, ...id }, path, transferred);
|
|
1669
1676
|
},
|
|
1670
1677
|
truncate: (path, length) => {
|
|
1671
|
-
|
|
1678
|
+
changing({ op: "truncate", path, length, ...id }, path);
|
|
1672
1679
|
}
|
|
1673
1680
|
});
|
|
1674
1681
|
return {
|
|
@@ -1740,11 +1747,15 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
1740
1747
|
return target;
|
|
1741
1748
|
},
|
|
1742
1749
|
chmod: (path, mode) => {
|
|
1743
|
-
|
|
1750
|
+
changing({ op: "chmod", path, mode }, path);
|
|
1744
1751
|
},
|
|
1745
1752
|
utimes: (path, atimeMs, mtimeMs) => {
|
|
1746
|
-
|
|
1753
|
+
changing({ op: "utimes", path, atimeMs, mtimeMs }, path);
|
|
1754
|
+
},
|
|
1755
|
+
identify: () => {
|
|
1756
|
+
identity = { identity: true };
|
|
1747
1757
|
},
|
|
1758
|
+
identified: () => last,
|
|
1748
1759
|
lutimes: (path, atimeMs, mtimeMs) => {
|
|
1749
1760
|
run({ op: "lutimes", path, atimeMs, mtimeMs }, path);
|
|
1750
1761
|
},
|
|
@@ -1753,7 +1764,7 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
1753
1764
|
},
|
|
1754
1765
|
chown: (path, uid, gid, follow2) => {
|
|
1755
1766
|
const ids = { ...uid !== void 0 ? { uid } : {}, ...gid !== void 0 ? { gid } : {} };
|
|
1756
|
-
|
|
1767
|
+
changing({ op: follow2 ? "chown" : "lchown", path, ...ids }, path);
|
|
1757
1768
|
},
|
|
1758
1769
|
...opts.owners ? { owners: true } : {},
|
|
1759
1770
|
hold: (path, held, open, handle) => {
|
|
@@ -4722,7 +4733,26 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
4722
4733
|
cache.mutated(paths);
|
|
4723
4734
|
}
|
|
4724
4735
|
};
|
|
4736
|
+
let exact = false;
|
|
4737
|
+
const threaded = () => {
|
|
4738
|
+
if (blind || shared === void 0 || !bridge.identify) return;
|
|
4739
|
+
exact = true;
|
|
4740
|
+
bridge.identify();
|
|
4741
|
+
};
|
|
4742
|
+
const identified = (p, op, also) => {
|
|
4743
|
+
const before = cache.generation();
|
|
4744
|
+
try {
|
|
4745
|
+
return op();
|
|
4746
|
+
} finally {
|
|
4747
|
+
const st = bridge.identified?.() ?? null;
|
|
4748
|
+
if (!st) cache.mutated([]);
|
|
4749
|
+
else if (cache.mutated([p, ...also], st.ino) === before + 1 + also.length && !st.isSymbolicLink) {
|
|
4750
|
+
cache.put(stats, p, st);
|
|
4751
|
+
}
|
|
4752
|
+
}
|
|
4753
|
+
};
|
|
4725
4754
|
const rewriting = (p, op, ...also) => {
|
|
4755
|
+
if (exact) return identified(p, op, also);
|
|
4726
4756
|
const ino = cache.inoOf(p, () => bridge.stat(p));
|
|
4727
4757
|
try {
|
|
4728
4758
|
return op();
|
|
@@ -4781,7 +4811,8 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
4781
4811
|
} : {},
|
|
4782
4812
|
...bridge.owners ? { owners: true } : {},
|
|
4783
4813
|
invalidate,
|
|
4784
|
-
touched
|
|
4814
|
+
touched,
|
|
4815
|
+
threaded
|
|
4785
4816
|
};
|
|
4786
4817
|
}
|
|
4787
4818
|
function pinnedIo2(bridge, handle, rewriting) {
|
|
@@ -5030,11 +5061,15 @@ var init_wasi_files = __esm({
|
|
|
5030
5061
|
}
|
|
5031
5062
|
mutated(paths, ino = 0) {
|
|
5032
5063
|
this.clear();
|
|
5033
|
-
if (!this.shared) return;
|
|
5064
|
+
if (!this.shared) return 0;
|
|
5034
5065
|
const key = ino % 4294967296 | 0;
|
|
5035
5066
|
for (const [i, hash] of (paths.length > 0 ? paths.map(pathHash) : [0]).entries()) {
|
|
5036
5067
|
this.seen = this.publish(this.shared, hash, i === 0 ? key : 0);
|
|
5037
5068
|
}
|
|
5069
|
+
return this.seen;
|
|
5070
|
+
}
|
|
5071
|
+
generation() {
|
|
5072
|
+
return this.shared ? Atomics.load(this.shared, FS_GEN) : 0;
|
|
5038
5073
|
}
|
|
5039
5074
|
inoOf(path, look) {
|
|
5040
5075
|
if (!this.shared) return 0;
|
|
@@ -5265,6 +5300,7 @@ var init_wasi_fds = __esm({
|
|
|
5265
5300
|
this.cloexec.clear();
|
|
5266
5301
|
}
|
|
5267
5302
|
this.shared = ids;
|
|
5303
|
+
this.fs.threaded?.();
|
|
5268
5304
|
this.seen = Atomics.load(ids, GEN);
|
|
5269
5305
|
}
|
|
5270
5306
|
sync() {
|
|
@@ -5589,6 +5625,14 @@ var init_wasi_fds = __esm({
|
|
|
5589
5625
|
this.detach(buffer, linked);
|
|
5590
5626
|
this.buffers.delete(path);
|
|
5591
5627
|
}
|
|
5628
|
+
openedIno(fd) {
|
|
5629
|
+
try {
|
|
5630
|
+
return this.kernel.call({ op: "fd-vfs-stat", fd, identity: true }).ino;
|
|
5631
|
+
} catch (err) {
|
|
5632
|
+
this.kernel.sys.close(fd);
|
|
5633
|
+
throw err;
|
|
5634
|
+
}
|
|
5635
|
+
}
|
|
5592
5636
|
inoOf(path) {
|
|
5593
5637
|
try {
|
|
5594
5638
|
return this.fs.stat(path).ino;
|
|
@@ -5682,10 +5726,10 @@ var init_wasi_fds = __esm({
|
|
|
5682
5726
|
if (e.path !== void 0 || this.learned.has(e)) return;
|
|
5683
5727
|
this.learned.add(e);
|
|
5684
5728
|
try {
|
|
5685
|
-
const vfs = this.kernel.call({ op: "fd-vfs-stat", fd });
|
|
5729
|
+
const vfs = this.kernel.call({ op: "fd-vfs-stat", fd, identity: true });
|
|
5686
5730
|
if (vfs.orphan || vfs.path === void 0) return;
|
|
5687
5731
|
e.path = vfs.path;
|
|
5688
|
-
e.ino = this.inoOf(vfs.path);
|
|
5732
|
+
e.ino = vfs.ino ?? this.inoOf(vfs.path);
|
|
5689
5733
|
} catch {
|
|
5690
5734
|
}
|
|
5691
5735
|
}
|
|
@@ -5723,9 +5767,8 @@ var init_wasi_fds = __esm({
|
|
|
5723
5767
|
const made = !existing && this.createNew(path, oflags);
|
|
5724
5768
|
const truncate = made || (oflags & OFLAGS.TRUNC) !== 0;
|
|
5725
5769
|
const fd = this.kernel.sys.openVfs(path, flags, 0, truncate ? { truncate } : {});
|
|
5726
|
-
const
|
|
5727
|
-
if (truncate) this.fs.touched?.(path,
|
|
5728
|
-
const ino = existing ? was : this.inoOf(path);
|
|
5770
|
+
const ino = writable2 ? this.openedIno(fd) ?? this.inoOf(path) : void 0;
|
|
5771
|
+
if (truncate) this.fs.touched?.(path, ino);
|
|
5729
5772
|
this.table.set(fd, { type: "kernel", kind: "file", nonblock: false, append, path, ino });
|
|
5730
5773
|
if (append) this.publishFlags(fd, { nonblock: false, append });
|
|
5731
5774
|
this.bump();
|
|
@@ -6618,9 +6661,9 @@ var init_wasi_host = __esm({
|
|
|
6618
6661
|
this.unnamed.add(e);
|
|
6619
6662
|
let path;
|
|
6620
6663
|
try {
|
|
6621
|
-
const st = this.
|
|
6664
|
+
const st = this.o.kernel.call({ op: "fd-vfs-stat", fd, identity: true });
|
|
6622
6665
|
path = st.orphan ? void 0 : st.path;
|
|
6623
|
-
if (path !== void 0) e.ino = this.o.fs.stat(path).ino;
|
|
6666
|
+
if (path !== void 0) e.ino = st.ino ?? this.o.fs.stat(path).ino;
|
|
6624
6667
|
} catch {
|
|
6625
6668
|
return;
|
|
6626
6669
|
}
|