@ai-ecoverse/slicc-kernel 1.124.6 → 1.124.8
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 +187 -67
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +52 -19
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +187 -67
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +52 -19
- package/dist/process-worker.js.map +2 -2
- package/dist/types/fs/unlinked.d.ts +15 -1
- package/dist/types/kernel/host.d.ts +2 -1
- 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/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 +1 -1
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.8" : "0.0.0-dev";
|
|
2614
2628
|
OS_RELEASE = "6.0.0-slicc";
|
|
2615
2629
|
}
|
|
2616
2630
|
});
|
|
@@ -3269,11 +3283,14 @@ function useZeroDevices(Fs) {
|
|
|
3269
3283
|
mkdev.call(Fs, path, CHAR_DEVICE, dev);
|
|
3270
3284
|
}
|
|
3271
3285
|
}
|
|
3272
|
-
function namesFifo(fs, path) {
|
|
3286
|
+
function namesFifo(fs, path, flags) {
|
|
3273
3287
|
try {
|
|
3274
3288
|
const { node } = fs.lookupPath?.(path, { follow: true }) ?? { node: { mode: 0 } };
|
|
3275
3289
|
return (node.mode & S_IFMT_BITS) === S_IFIFO_BITS;
|
|
3276
|
-
} catch {
|
|
3290
|
+
} catch (err) {
|
|
3291
|
+
const { errno: errno2, code: code2 } = err ?? {};
|
|
3292
|
+
const errnum = typeof errno2 === "number" ? errno2 : wasiErrno(String(code2));
|
|
3293
|
+
if (REFUSED.has(errnum) && (flags & OWN_ERRORS) === 0) throw err;
|
|
3277
3294
|
return false;
|
|
3278
3295
|
}
|
|
3279
3296
|
}
|
|
@@ -3284,7 +3301,7 @@ function useFifoOpens(Fs, attach) {
|
|
|
3284
3301
|
if (typeof open !== "function" || typeof fs.lookupPath !== "function") return;
|
|
3285
3302
|
fs.open = (path, flags, ...rest2) => {
|
|
3286
3303
|
const truncates = typeof path === "string" && typeof flags === "number" && flags & O_TRUNC2;
|
|
3287
|
-
const kept = truncates && namesFifo(fs, path) ? flags & ~O_TRUNC2 : flags;
|
|
3304
|
+
const kept = truncates && namesFifo(fs, path, flags) ? flags & ~O_TRUNC2 : flags;
|
|
3288
3305
|
return open.call(Fs, path, kept, ...rest2);
|
|
3289
3306
|
};
|
|
3290
3307
|
}
|
|
@@ -3602,7 +3619,7 @@ function linuxDevices(Fs) {
|
|
|
3602
3619
|
}
|
|
3603
3620
|
}
|
|
3604
3621
|
}
|
|
3605
|
-
var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW, EMSCRIPTEN_EPERM, O_PATH2, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY2, MAP_ALIGN, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_TRUNC2, S_IFMT_BITS, S_IFIFO_BITS, O_ACCMODE3, O_CREAT, O_EXCL, field, pinnedRoot, rootKind, NAME, AT_FDCWD, AT_EACCESS, W_ACCESS, X_ACCESS, AT_SYMLINK_FOLLOW, UTS_FIELD, DEVICE_MODES;
|
|
3622
|
+
var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW, EMSCRIPTEN_EPERM, O_PATH2, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY2, MAP_ALIGN, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_TRUNC2, S_IFMT_BITS, S_IFIFO_BITS, REFUSED, OWN_ERRORS, O_ACCMODE3, O_CREAT, O_EXCL, field, pinnedRoot, rootKind, NAME, AT_FDCWD, AT_EACCESS, W_ACCESS, X_ACCESS, AT_SYMLINK_FOLLOW, UTS_FIELD, DEVICE_MODES;
|
|
3606
3623
|
var init_process_fds = __esm({
|
|
3607
3624
|
"src/process/process-fds.ts"() {
|
|
3608
3625
|
"use strict";
|
|
@@ -3664,6 +3681,8 @@ var init_process_fds = __esm({
|
|
|
3664
3681
|
O_TRUNC2 = 512;
|
|
3665
3682
|
S_IFMT_BITS = 61440;
|
|
3666
3683
|
S_IFIFO_BITS = 4096;
|
|
3684
|
+
REFUSED = /* @__PURE__ */ new Set([wasiErrno("EACCES"), wasiErrno("EPERM")]);
|
|
3685
|
+
OWN_ERRORS = 128 | 131072;
|
|
3667
3686
|
O_ACCMODE3 = 3;
|
|
3668
3687
|
O_CREAT = 64;
|
|
3669
3688
|
O_EXCL = 128;
|
|
@@ -4410,18 +4429,28 @@ function orphanContents(stream) {
|
|
|
4410
4429
|
if (live.ranged) return live.ranged.read(0, live.ranged.size());
|
|
4411
4430
|
return live.data?.slice(0, live.len ?? live.data.length) ?? new Uint8Array(0);
|
|
4412
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
|
+
}
|
|
4413
4444
|
function vfsPromoter(Fs, sys, streams2, livePath) {
|
|
4414
4445
|
const promoted = /* @__PURE__ */ new Map();
|
|
4415
4446
|
return (stream) => {
|
|
4416
4447
|
if (stream.sliccKernelFd !== void 0 || !isVfsFile(Fs, stream)) return;
|
|
4448
|
+
const live = stream.stream_ops;
|
|
4417
4449
|
let kfd = promoted.get(stream.shared);
|
|
4418
4450
|
if (kfd === void 0) {
|
|
4451
|
+
live.fsync?.(stream);
|
|
4419
4452
|
const contents = orphanContents(stream);
|
|
4420
|
-
const
|
|
4421
|
-
const version = ranged?.pinnedVersion;
|
|
4422
|
-
const pin = ranged && version !== void 0 ? { version, size: ranged.size() } : void 0;
|
|
4423
|
-
const handle = stream.node.live?.handle;
|
|
4424
|
-
const held2 = { ...pin ? { pin } : {}, ...handle !== void 0 ? { handle } : {} };
|
|
4453
|
+
const held2 = heldOf(stream.node.live);
|
|
4425
4454
|
kfd = sys.openVfs(
|
|
4426
4455
|
livePath(stream),
|
|
4427
4456
|
stream.flags,
|
|
@@ -5693,6 +5722,7 @@ function kernelSys(transport) {
|
|
|
5693
5722
|
...opts?.created ? { created: true } : {},
|
|
5694
5723
|
...opts?.pin ? { pin: opts.pin } : {},
|
|
5695
5724
|
...opts?.handle !== void 0 ? { handle: opts.handle } : {},
|
|
5725
|
+
...opts?.ino !== void 0 ? { ino: opts.ino } : {},
|
|
5696
5726
|
...opts?.fifo ? { fifo: true } : {}
|
|
5697
5727
|
},
|
|
5698
5728
|
`fd-open-vfs ${path}`
|
|
@@ -7350,7 +7380,8 @@ function promoteRequest(fd, f, handed) {
|
|
|
7350
7380
|
...orphan ? { orphan: true } : {},
|
|
7351
7381
|
...!orphan && f.buffer.pin !== void 0 ? { pin: { version: f.buffer.pin, size: f.buffer.size() } } : {},
|
|
7352
7382
|
...!joins && f.buffer.isDirty() ? { dirty: true } : {},
|
|
7353
|
-
...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 } : {}
|
|
7354
7385
|
};
|
|
7355
7386
|
}
|
|
7356
7387
|
var SYNTHETIC_DIRS2, O_NONBLOCK2, O_WRONLY4, O_RDWR4, O_APPEND2, SEALED_PATH2, CLIPBOARD_PATH2, WasiFds, GEN2;
|
|
@@ -8026,7 +8057,9 @@ var init_wasi_fds = __esm({
|
|
|
8026
8057
|
const st = existing?.ranged || !existing ? this.fs.stat(path) : existing;
|
|
8027
8058
|
const ranged = st.ranged ? st.size : void 0;
|
|
8028
8059
|
const asked = (want & 4 ? HOLD_READ : 0) | (want & 2 ? HOLD_WRITE : 0) | (made ? HOLD_CREATED : 0);
|
|
8029
|
-
const handle = this.fs.hold?.(path, true, true, void 0, this.fs.owners ? asked : 0
|
|
8060
|
+
const handle = this.fs.hold?.(path, true, true, void 0, this.fs.owners ? asked : 0, {
|
|
8061
|
+
gen: st.gen
|
|
8062
|
+
});
|
|
8030
8063
|
const io = handle !== void 0 && this.fs.pinned ? this.fs.pinned(handle) : this.fs;
|
|
8031
8064
|
const view = this.fs.changes;
|
|
8032
8065
|
const watch = view && linkedWatch(
|
|
@@ -10964,10 +10997,10 @@ function procfsBridge(fs, tree) {
|
|
|
10964
10997
|
],
|
|
10965
10998
|
() => fs.link(from, to, follow2)
|
|
10966
10999
|
),
|
|
10967
|
-
hold: (p, held2, open, handle, want) => {
|
|
11000
|
+
hold: (p, held2, open, handle, want, seen) => {
|
|
10968
11001
|
if (handle !== void 0 && snapshots.delete(handle)) return void 0;
|
|
10969
11002
|
if (!held2) return fs.hold?.(p, held2, open, handle);
|
|
10970
|
-
return via(p, snapshot, () => fs.hold?.(p, held2, open, void 0, want) ?? late(p));
|
|
11003
|
+
return via(p, snapshot, () => fs.hold?.(p, held2, open, void 0, want, seen) ?? late(p));
|
|
10971
11004
|
},
|
|
10972
11005
|
kept: (handle) => snapshots.has(handle) || fs.kept?.(handle) === true,
|
|
10973
11006
|
pinned: (handle) => {
|