@ai-ecoverse/slicc-kernel 1.124.7 → 1.124.9
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 +14 -1
- package/dist/kernel-worker.js +186 -67
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +86 -23
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +186 -67
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +86 -23
- package/dist/process-worker.js.map +3 -3
- package/dist/types/fs/unlinked.d.ts +15 -1
- package/dist/types/kernel/host.d.ts +5 -3
- package/dist/types/kernel/process.d.ts +7 -0
- package/dist/types/kernel/vfs-file.d.ts +3 -1
- package/dist/types/mount/mount-fs.d.ts +1 -0
- package/dist/types/process/kernel-streams.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-dispatch.d.ts +1 -0
- package/dist/types/realm/sync-fs-token-registry.d.ts +2 -1
- package/dist/types/realm/sync-fs-wire.d.ts +5 -1
- package/package.json +2 -2
package/dist/process-worker.js
CHANGED
|
@@ -968,6 +968,7 @@ function parseSyncFsStat(json2) {
|
|
|
968
968
|
...s.ranged === true ? { ranged: true } : {},
|
|
969
969
|
...s.linkable === true ? { linkable: true } : {},
|
|
970
970
|
...typeof s.version === "string" ? { version: s.version } : {},
|
|
971
|
+
...typeof s.gen === "number" ? { gen: s.gen } : {},
|
|
971
972
|
...typeof s.uid === "number" ? { uid: s.uid } : {},
|
|
972
973
|
...typeof s.gid === "number" ? { gid: s.gid } : {}
|
|
973
974
|
};
|
|
@@ -1317,9 +1318,12 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
1317
1318
|
access: (path, mode, kind = "access", nofollow) => {
|
|
1318
1319
|
run({ op: "access", path, mode, arg2: kind, ...nofollow ? { nofollow } : {} }, path);
|
|
1319
1320
|
},
|
|
1320
|
-
hold: (path, held2, open, handle, want = 0) => {
|
|
1321
|
+
hold: (path, held2, open, handle, want = 0, seen = {}) => {
|
|
1321
1322
|
const mode = (held2 ? 1 : 0) | (open ? 2 : 0);
|
|
1322
|
-
if (mode === 3)
|
|
1323
|
+
if (mode === 3) {
|
|
1324
|
+
const at = seen.gen !== void 0 ? { gen: seen.gen } : {};
|
|
1325
|
+
return json2({ op: "hold", path, mode: mode | want, ...at }, path);
|
|
1326
|
+
}
|
|
1323
1327
|
run({ op: "hold", path, mode, ...handle !== void 0 ? { handle } : {} }, path);
|
|
1324
1328
|
return void 0;
|
|
1325
1329
|
},
|
|
@@ -1882,6 +1886,16 @@ function appendThrough(h, stream, bytes) {
|
|
|
1882
1886
|
stream.position = after - body.length;
|
|
1883
1887
|
return true;
|
|
1884
1888
|
}
|
|
1889
|
+
function holdLive(bridge, node, on, want) {
|
|
1890
|
+
const s = node.live;
|
|
1891
|
+
const seen = on && s.stat ? { gen: s.stat.gen } : void 0;
|
|
1892
|
+
return bridge.hold?.(liveNodePath(node), on, true, s.handle, want, seen);
|
|
1893
|
+
}
|
|
1894
|
+
function dropOpen(s) {
|
|
1895
|
+
if (s.openCount === 0) return false;
|
|
1896
|
+
s.openCount -= 1;
|
|
1897
|
+
return true;
|
|
1898
|
+
}
|
|
1885
1899
|
function createStreamOps(h) {
|
|
1886
1900
|
const { Fs, statOf, ensureLoaded, ensureCapacity, flushNode, bridgeOf, rangedOf } = h;
|
|
1887
1901
|
const held2 = (stream, change) => {
|
|
@@ -1899,7 +1913,7 @@ function createStreamOps(h) {
|
|
|
1899
1913
|
const opened2 = (node, on, want = 0) => {
|
|
1900
1914
|
const s = node.live;
|
|
1901
1915
|
try {
|
|
1902
|
-
const handle = bridgeOf(node)
|
|
1916
|
+
const handle = holdLive(bridgeOf(node), node, on, want);
|
|
1903
1917
|
s.handle = on ? handle : void 0;
|
|
1904
1918
|
h.linked.opening(node, on);
|
|
1905
1919
|
if (s.handle === void 0) h.handled.delete(node);
|
|
@@ -1991,7 +2005,7 @@ function createStreamOps(h) {
|
|
|
1991
2005
|
const node = stream.node;
|
|
1992
2006
|
if (!Fs.isFile(node.mode)) return;
|
|
1993
2007
|
const s = node.live;
|
|
1994
|
-
|
|
2008
|
+
if (!dropOpen(s)) return;
|
|
1995
2009
|
if (s.openCount > 0) {
|
|
1996
2010
|
held2(stream, -1);
|
|
1997
2011
|
return;
|
|
@@ -2005,7 +2019,7 @@ function createStreamOps(h) {
|
|
|
2005
2019
|
s.len = 0;
|
|
2006
2020
|
s.loaded = false;
|
|
2007
2021
|
held2(stream, -1);
|
|
2008
|
-
opened2(node, false);
|
|
2022
|
+
if (s.handle !== void 0) opened2(node, false);
|
|
2009
2023
|
}
|
|
2010
2024
|
},
|
|
2011
2025
|
read(stream, buffer, offset, length, position) {
|
|
@@ -2610,7 +2624,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
2610
2624
|
var init_version = __esm({
|
|
2611
2625
|
"src/version.ts"() {
|
|
2612
2626
|
"use strict";
|
|
2613
|
-
KERNEL_VERSION = true ? "1.124.
|
|
2627
|
+
KERNEL_VERSION = true ? "1.124.9" : "0.0.0-dev";
|
|
2614
2628
|
OS_RELEASE = "6.0.0-slicc";
|
|
2615
2629
|
}
|
|
2616
2630
|
});
|
|
@@ -4415,18 +4429,28 @@ function orphanContents(stream) {
|
|
|
4415
4429
|
if (live.ranged) return live.ranged.read(0, live.ranged.size());
|
|
4416
4430
|
return live.data?.slice(0, live.len ?? live.data.length) ?? new Uint8Array(0);
|
|
4417
4431
|
}
|
|
4432
|
+
function heldOf(live) {
|
|
4433
|
+
const ranged = live?.ranged;
|
|
4434
|
+
const version = ranged?.pinnedVersion;
|
|
4435
|
+
const pin = ranged && version !== void 0 ? { version, size: ranged.size() } : void 0;
|
|
4436
|
+
const handle = live?.handle;
|
|
4437
|
+
const ino = live?.stat?.ino;
|
|
4438
|
+
return {
|
|
4439
|
+
...pin ? { pin } : {},
|
|
4440
|
+
...handle !== void 0 ? { handle } : {},
|
|
4441
|
+
...handle !== void 0 && ino !== void 0 ? { ino } : {}
|
|
4442
|
+
};
|
|
4443
|
+
}
|
|
4418
4444
|
function vfsPromoter(Fs, sys, streams2, livePath) {
|
|
4419
4445
|
const promoted = /* @__PURE__ */ new Map();
|
|
4420
4446
|
return (stream) => {
|
|
4421
4447
|
if (stream.sliccKernelFd !== void 0 || !isVfsFile(Fs, stream)) return;
|
|
4448
|
+
const live = stream.stream_ops;
|
|
4422
4449
|
let kfd = promoted.get(stream.shared);
|
|
4423
4450
|
if (kfd === void 0) {
|
|
4451
|
+
live.fsync?.(stream);
|
|
4424
4452
|
const contents = orphanContents(stream);
|
|
4425
|
-
const
|
|
4426
|
-
const version = ranged?.pinnedVersion;
|
|
4427
|
-
const pin = ranged && version !== void 0 ? { version, size: ranged.size() } : void 0;
|
|
4428
|
-
const handle = stream.node.live?.handle;
|
|
4429
|
-
const held2 = { ...pin ? { pin } : {}, ...handle !== void 0 ? { handle } : {} };
|
|
4453
|
+
const held2 = heldOf(stream.node.live);
|
|
4430
4454
|
kfd = sys.openVfs(
|
|
4431
4455
|
livePath(stream),
|
|
4432
4456
|
stream.flags,
|
|
@@ -5698,6 +5722,7 @@ function kernelSys(transport) {
|
|
|
5698
5722
|
...opts?.created ? { created: true } : {},
|
|
5699
5723
|
...opts?.pin ? { pin: opts.pin } : {},
|
|
5700
5724
|
...opts?.handle !== void 0 ? { handle: opts.handle } : {},
|
|
5725
|
+
...opts?.ino !== void 0 ? { ino: opts.ino } : {},
|
|
5701
5726
|
...opts?.fifo ? { fifo: true } : {}
|
|
5702
5727
|
},
|
|
5703
5728
|
`fd-open-vfs ${path}`
|
|
@@ -7355,7 +7380,8 @@ function promoteRequest(fd, f, handed) {
|
|
|
7355
7380
|
...orphan ? { orphan: true } : {},
|
|
7356
7381
|
...!orphan && f.buffer.pin !== void 0 ? { pin: { version: f.buffer.pin, size: f.buffer.size() } } : {},
|
|
7357
7382
|
...!joins && f.buffer.isDirty() ? { dirty: true } : {},
|
|
7358
|
-
...f.buffer.handle !== void 0 ? { handle: f.buffer.handle } : {}
|
|
7383
|
+
...f.buffer.handle !== void 0 ? { handle: f.buffer.handle } : {},
|
|
7384
|
+
...f.buffer.handle !== void 0 && f.ino !== void 0 ? { ino: f.ino } : {}
|
|
7359
7385
|
};
|
|
7360
7386
|
}
|
|
7361
7387
|
var SYNTHETIC_DIRS2, O_NONBLOCK2, O_WRONLY4, O_RDWR4, O_APPEND2, SEALED_PATH2, CLIPBOARD_PATH2, WasiFds, GEN2;
|
|
@@ -7957,6 +7983,9 @@ var init_wasi_fds = __esm({
|
|
|
7957
7983
|
const alias = stdioAlias(path);
|
|
7958
7984
|
if (alias !== void 0) return this.reopen(alias);
|
|
7959
7985
|
const exclusive = (oflags & OFLAGS.CREAT) !== 0 && (oflags & OFLAGS.EXCL) !== 0;
|
|
7986
|
+
if (exclusive && this.shared && !(oflags & OFLAGS.DIRECTORY) && this.madeAtOnce(path, mode)) {
|
|
7987
|
+
return this.kernelFile(path, void 0, oflags, rights, fdflags, mode, true);
|
|
7988
|
+
}
|
|
7960
7989
|
if (exclusive && this.isLink(path)) throw new WasiError("EEXIST");
|
|
7961
7990
|
const s = this.statOrMissing(path);
|
|
7962
7991
|
if (exclusive && s) throw new WasiError("EEXIST");
|
|
@@ -8031,7 +8060,9 @@ var init_wasi_fds = __esm({
|
|
|
8031
8060
|
const st = existing?.ranged || !existing ? this.fs.stat(path) : existing;
|
|
8032
8061
|
const ranged = st.ranged ? st.size : void 0;
|
|
8033
8062
|
const asked = (want & 4 ? HOLD_READ : 0) | (want & 2 ? HOLD_WRITE : 0) | (made ? HOLD_CREATED : 0);
|
|
8034
|
-
const handle = this.fs.hold?.(path, true, true, void 0, this.fs.owners ? asked : 0
|
|
8063
|
+
const handle = this.fs.hold?.(path, true, true, void 0, this.fs.owners ? asked : 0, {
|
|
8064
|
+
gen: st.gen
|
|
8065
|
+
});
|
|
8035
8066
|
const io = handle !== void 0 && this.fs.pinned ? this.fs.pinned(handle) : this.fs;
|
|
8036
8067
|
const view = this.fs.changes;
|
|
8037
8068
|
const watch = view && linkedWatch(
|
|
@@ -8054,11 +8085,11 @@ var init_wasi_fds = __esm({
|
|
|
8054
8085
|
if (id !== void 0) this.know(buffer, id);
|
|
8055
8086
|
return buffer;
|
|
8056
8087
|
}
|
|
8057
|
-
kernelFile(path, existing, oflags, rights, fdflags, mode) {
|
|
8088
|
+
kernelFile(path, existing, oflags, rights, fdflags, mode, created = false) {
|
|
8058
8089
|
const { readable: readable3, writable: writable2 } = openAccess(existing, oflags, rights);
|
|
8059
8090
|
const append = (fdflags & FDFLAGS.APPEND) !== 0;
|
|
8060
8091
|
const flags = (writable2 ? readable3 ? O_RDWR4 : O_WRONLY4 : 0) | (append ? O_APPEND2 : 0);
|
|
8061
|
-
const made = !existing && this.createNew(path, oflags, mode);
|
|
8092
|
+
const made = created || !existing && this.createNew(path, oflags, mode);
|
|
8062
8093
|
const truncate = made || (oflags & OFLAGS.TRUNC) !== 0;
|
|
8063
8094
|
const fd = this.kernel.sys.openVfs(path, flags, 0, {
|
|
8064
8095
|
...truncate ? { truncate } : {},
|
|
@@ -8093,6 +8124,16 @@ var init_wasi_fds = __esm({
|
|
|
8093
8124
|
}
|
|
8094
8125
|
}
|
|
8095
8126
|
}
|
|
8127
|
+
madeAtOnce(path, mode) {
|
|
8128
|
+
if (!this.fs.create) return false;
|
|
8129
|
+
try {
|
|
8130
|
+
this.fs.create(path, mode, true);
|
|
8131
|
+
return true;
|
|
8132
|
+
} catch (err) {
|
|
8133
|
+
if (err.code === "EEXIST") throw err;
|
|
8134
|
+
return false;
|
|
8135
|
+
}
|
|
8136
|
+
}
|
|
8096
8137
|
createNew(path, oflags, mode) {
|
|
8097
8138
|
if (!this.fs.create) {
|
|
8098
8139
|
this.fs.writeFile(path, new Uint8Array(0));
|
|
@@ -10851,15 +10892,37 @@ function frozen(bytes) {
|
|
|
10851
10892
|
truncate: refuse2
|
|
10852
10893
|
};
|
|
10853
10894
|
}
|
|
10854
|
-
function
|
|
10855
|
-
const
|
|
10856
|
-
|
|
10895
|
+
function physicalProc(fs) {
|
|
10896
|
+
const view = fs.changes;
|
|
10897
|
+
let seen;
|
|
10898
|
+
return () => {
|
|
10899
|
+
if (seen && view && !view.foreign()) {
|
|
10900
|
+
const proc = view.changedSince(seen.gen, "/proc");
|
|
10901
|
+
if (!proc.changed && !view.changedSince(seen.gen, "/").changed) {
|
|
10902
|
+
seen.gen = proc.now;
|
|
10903
|
+
return seen.physical;
|
|
10904
|
+
}
|
|
10905
|
+
}
|
|
10906
|
+
const gen = view?.now();
|
|
10907
|
+
let physical2;
|
|
10857
10908
|
try {
|
|
10858
|
-
|
|
10859
|
-
|
|
10860
|
-
|
|
10909
|
+
fs.stat("/proc");
|
|
10910
|
+
physical2 = true;
|
|
10911
|
+
} catch (err) {
|
|
10912
|
+
const code2 = err.code;
|
|
10913
|
+
if (code2 !== "ENOENT" && code2 !== "ENOTDIR") {
|
|
10914
|
+
seen = void 0;
|
|
10915
|
+
return false;
|
|
10916
|
+
}
|
|
10917
|
+
physical2 = false;
|
|
10861
10918
|
}
|
|
10919
|
+
seen = gen === void 0 ? void 0 : { gen, physical: physical2 };
|
|
10920
|
+
return physical2;
|
|
10862
10921
|
};
|
|
10922
|
+
}
|
|
10923
|
+
function procfsBridge(fs, tree) {
|
|
10924
|
+
const toProc = (path, follow2) => procPath(fs, path, follow2);
|
|
10925
|
+
const shadowing = physicalProc(fs);
|
|
10863
10926
|
const via = (p, proc, own, follow2 = true) => {
|
|
10864
10927
|
if (inProc(p)) return proc(p);
|
|
10865
10928
|
if (shadowing()) {
|
|
@@ -10969,10 +11032,10 @@ function procfsBridge(fs, tree) {
|
|
|
10969
11032
|
],
|
|
10970
11033
|
() => fs.link(from, to, follow2)
|
|
10971
11034
|
),
|
|
10972
|
-
hold: (p, held2, open, handle, want) => {
|
|
11035
|
+
hold: (p, held2, open, handle, want, seen) => {
|
|
10973
11036
|
if (handle !== void 0 && snapshots.delete(handle)) return void 0;
|
|
10974
11037
|
if (!held2) return fs.hold?.(p, held2, open, handle);
|
|
10975
|
-
return via(p, snapshot, () => fs.hold?.(p, held2, open, void 0, want) ?? late(p));
|
|
11038
|
+
return via(p, snapshot, () => fs.hold?.(p, held2, open, void 0, want, seen) ?? late(p));
|
|
10976
11039
|
},
|
|
10977
11040
|
kept: (handle) => snapshots.has(handle) || fs.kept?.(handle) === true,
|
|
10978
11041
|
pinned: (handle) => {
|