@ai-ecoverse/slicc-kernel 1.152.0 → 1.152.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/dist/index.js.map +1 -1
- package/dist/kernel-worker.js +67 -26
- package/dist/kernel-worker.js.map +3 -3
- package/dist/meta.js.map +2 -2
- package/dist/node-process-worker.js +28 -2
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +67 -26
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +28 -2
- package/dist/process-worker.js.map +2 -2
- package/dist/types/fs/opfs.d.ts +4 -2
- package/dist/types/fs/types.d.ts +5 -1
- package/dist/types/kernel/host.d.ts +1 -0
- package/dist/types/kernel/proc-info.d.ts +1 -0
- package/dist/types/launcher.d.ts +1 -0
- package/dist/types/mount/mount-fs.d.ts +4 -1
- package/dist/types/process/wasi/wasi-fds.d.ts +2 -1
- package/dist/types/process/wasi/wasi-files.d.ts +3 -0
- package/dist/types/realm/sync-fs-token-registry.d.ts +3 -1
- package/package.json +1 -1
package/dist/node.js
CHANGED
|
@@ -3365,7 +3365,7 @@ function satisfies(version, range2) {
|
|
|
3365
3365
|
}
|
|
3366
3366
|
|
|
3367
3367
|
// src/version.ts
|
|
3368
|
-
var KERNEL_VERSION = true ? "1.152.
|
|
3368
|
+
var KERNEL_VERSION = true ? "1.152.1" : "0.0.0-dev";
|
|
3369
3369
|
var OS_RELEASE = "6.0.0-slicc";
|
|
3370
3370
|
function procVersion() {
|
|
3371
3371
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -6324,9 +6324,9 @@ function withEtcFiles(fs, files) {
|
|
|
6324
6324
|
readFileBuffer: (path) => fs.readFileBuffer(path).catch(fallback(path, (b) => b)),
|
|
6325
6325
|
...ranged2 ? {
|
|
6326
6326
|
pread: (path, offset, length2, version) => ranged2.pread(path, offset, length2, version).catch(fallback(path, (b) => b.slice(offset, offset + length2))),
|
|
6327
|
-
pwrite: async (path, offset, bytes, transfer) => {
|
|
6327
|
+
pwrite: async (path, offset, bytes, transfer, options) => {
|
|
6328
6328
|
if (files.has(path)) await materialize(path);
|
|
6329
|
-
return ranged2.pwrite(path, offset, bytes, transfer);
|
|
6329
|
+
return ranged2.pwrite(path, offset, bytes, transfer, options);
|
|
6330
6330
|
},
|
|
6331
6331
|
truncate: async (path, size) => {
|
|
6332
6332
|
if (files.has(path)) await materialize(path);
|
|
@@ -6435,10 +6435,10 @@ var FreshModules = class {
|
|
|
6435
6435
|
};
|
|
6436
6436
|
const ranged2 = rangedOps(fs);
|
|
6437
6437
|
if (ranged2) {
|
|
6438
|
-
overrides.pwrite = async (path, at, bytes, transfer) => {
|
|
6438
|
+
overrides.pwrite = async (path, at, bytes, transfer, options) => {
|
|
6439
6439
|
const touches3 = at < MAGIC.length && this.fresh.has(normalizePath(path));
|
|
6440
6440
|
const first = at === 0 && bytes.length >= MAGIC.length ? bytes.slice(0, MAGIC.length) : void 0;
|
|
6441
|
-
await ranged2.pwrite(path, at, bytes, transfer);
|
|
6441
|
+
await ranged2.pwrite(path, at, bytes, transfer, options);
|
|
6442
6442
|
if (touches3) await decide(path, first);
|
|
6443
6443
|
};
|
|
6444
6444
|
overrides.truncate = async (path, size) => {
|
|
@@ -8119,6 +8119,9 @@ var HeldSet = class extends Set {
|
|
|
8119
8119
|
if (over !== void 0) holds2.doubt(over);
|
|
8120
8120
|
}
|
|
8121
8121
|
}
|
|
8122
|
+
async bindIds(id2) {
|
|
8123
|
+
for (const holds2 of [...this]) await holds2.bindIds(id2);
|
|
8124
|
+
}
|
|
8122
8125
|
delete(holds2) {
|
|
8123
8126
|
const removed = super.delete(holds2);
|
|
8124
8127
|
for (const path of /* @__PURE__ */ new Set([...holds2.keys(), ...holds2.opens.keys()])) this.idle(path);
|
|
@@ -8172,8 +8175,17 @@ var HeldPaths = class extends Map {
|
|
|
8172
8175
|
}
|
|
8173
8176
|
boundIno(handle) {
|
|
8174
8177
|
const doubt = this.doubted.get(handle);
|
|
8175
|
-
const
|
|
8176
|
-
return doubt === void 0 ||
|
|
8178
|
+
const bound3 = this.bound.get(handle);
|
|
8179
|
+
return doubt === void 0 || bound3 === void 0 ? void 0 : { ...bound3, doubt };
|
|
8180
|
+
}
|
|
8181
|
+
async bindIds(id2) {
|
|
8182
|
+
for (const [handle, bound3] of [...this.bound]) {
|
|
8183
|
+
const key = this.handles.get(handle);
|
|
8184
|
+
if (bound3.fid !== void 0 || key === void 0) continue;
|
|
8185
|
+
const fid = await id2(key)?.catch(() => void 0);
|
|
8186
|
+
if (fid !== void 0 && this.bound.get(handle) === bound3)
|
|
8187
|
+
this.bound.set(handle, { ...bound3, fid });
|
|
8188
|
+
}
|
|
8177
8189
|
}
|
|
8178
8190
|
trust(handle, doubt) {
|
|
8179
8191
|
if (this.doubted.get(handle) === doubt) this.doubted.delete(handle);
|
|
@@ -8214,14 +8226,15 @@ var HeldPaths = class extends Map {
|
|
|
8214
8226
|
for (const file of [...this.uses.keys()]) this.letGo(file, true);
|
|
8215
8227
|
this.keptHandles.clear();
|
|
8216
8228
|
}
|
|
8217
|
-
hold(path, on, open = false, real, handle, ino) {
|
|
8229
|
+
hold(path, on, open = false, real, handle, ino, fid) {
|
|
8218
8230
|
if (open) {
|
|
8219
8231
|
const made2 = this.holdOpen(path, on, real, handle);
|
|
8220
8232
|
if (handle !== void 0) {
|
|
8221
8233
|
this.bound.delete(handle);
|
|
8222
8234
|
this.doubted.delete(handle);
|
|
8223
8235
|
}
|
|
8224
|
-
if (made2 !== void 0 && ino !== void 0)
|
|
8236
|
+
if (made2 !== void 0 && ino !== void 0)
|
|
8237
|
+
this.bound.set(made2, fid === void 0 ? { ino } : { ino, fid });
|
|
8225
8238
|
return made2;
|
|
8226
8239
|
}
|
|
8227
8240
|
this.holdWrite(path, on);
|
|
@@ -8957,7 +8970,7 @@ var MountFs = class _MountFs {
|
|
|
8957
8970
|
);
|
|
8958
8971
|
}
|
|
8959
8972
|
}
|
|
8960
|
-
async pwrite(path, offset, bytes, transfer = false, redirects = 0) {
|
|
8973
|
+
async pwrite(path, offset, bytes, transfer = false, options, redirects = 0) {
|
|
8961
8974
|
const real = await this.follow(path, 0, true);
|
|
8962
8975
|
const found = this.at(real);
|
|
8963
8976
|
const { pwrite } = this.base;
|
|
@@ -8965,8 +8978,8 @@ var MountFs = class _MountFs {
|
|
|
8965
8978
|
return this.based(
|
|
8966
8979
|
[real],
|
|
8967
8980
|
redirects,
|
|
8968
|
-
() => pwrite.call(this.base, real, offset, bytes),
|
|
8969
|
-
([to], n) => this.pwrite(to, offset, bytes, transfer, n)
|
|
8981
|
+
() => pwrite.call(this.base, real, offset, bytes, false, options),
|
|
8982
|
+
([to], n) => this.pwrite(to, offset, bytes, transfer, options, n)
|
|
8970
8983
|
);
|
|
8971
8984
|
}
|
|
8972
8985
|
if (!found)
|
|
@@ -8990,7 +9003,7 @@ var MountFs = class _MountFs {
|
|
|
8990
9003
|
op: "open",
|
|
8991
9004
|
path: rel2,
|
|
8992
9005
|
write: true,
|
|
8993
|
-
create:
|
|
9006
|
+
create: options?.create !== false,
|
|
8994
9007
|
truncate: false,
|
|
8995
9008
|
exclusive: false
|
|
8996
9009
|
});
|
|
@@ -9758,7 +9771,7 @@ async function run(entry, path, req) {
|
|
|
9758
9771
|
case "truncate":
|
|
9759
9772
|
return ranged(fs, path, req);
|
|
9760
9773
|
case "append":
|
|
9761
|
-
return json2(await appended(fs, path, req.body ?? new Uint8Array(0)));
|
|
9774
|
+
return json2(await appended(fs, path, req.body ?? new Uint8Array(0), req.handle));
|
|
9762
9775
|
default:
|
|
9763
9776
|
return { ok: false, errno: "EINVAL", message: `sync-fs: unknown op '${req.op}'` };
|
|
9764
9777
|
}
|
|
@@ -9902,13 +9915,17 @@ async function holdOp(entry, path, req) {
|
|
|
9902
9915
|
await entry.source?.open(path, real);
|
|
9903
9916
|
await stillThere(entry, path, req);
|
|
9904
9917
|
if (req.nofollow && !await ownEntry(entry, path, real ?? path)) continue;
|
|
9918
|
+
const fid = req.ino === void 0 ? void 0 : await idOf(entry, real ?? path);
|
|
9905
9919
|
if (!r || !r.missed(path) && !r.changedSince(path, gen) && !r.inFlight?.(path))
|
|
9906
|
-
return json2(entry.hold?.(path, on, open, real, void 0, req.ino) ?? null);
|
|
9920
|
+
return json2(entry.hold?.(path, on, open, real, void 0, req.ino, fid) ?? null);
|
|
9907
9921
|
}
|
|
9908
9922
|
}
|
|
9909
9923
|
entry.hold?.(path, on, open, void 0, req.handle);
|
|
9910
9924
|
return done;
|
|
9911
9925
|
}
|
|
9926
|
+
async function idOf(entry, path) {
|
|
9927
|
+
return await entry.fileId?.(path)?.catch(() => void 0) ?? void 0;
|
|
9928
|
+
}
|
|
9912
9929
|
async function ownEntry(entry, path, real) {
|
|
9913
9930
|
const own = await entry.fs.realpath?.(path, false).catch((err) => {
|
|
9914
9931
|
if (err.code !== "ENOENT") throw err;
|
|
@@ -10003,14 +10020,14 @@ async function createExclusive(fs, path, owner) {
|
|
|
10003
10020
|
await fs.writeFile(path, new Uint8Array(0), owner);
|
|
10004
10021
|
}
|
|
10005
10022
|
var appending = /* @__PURE__ */ new Map();
|
|
10006
|
-
async function appended(fs, path, body) {
|
|
10023
|
+
async function appended(fs, path, body, handle) {
|
|
10007
10024
|
const key = await fs.realpath?.(path, true).catch(() => void 0) ?? path;
|
|
10008
10025
|
const before = appending.get(key) ?? Promise.resolve();
|
|
10009
10026
|
const run2 = before.then(async () => {
|
|
10010
10027
|
if (fs.append) return fs.append(path, body);
|
|
10011
10028
|
const size = (await fs.stat(path)).size;
|
|
10012
10029
|
const ops = rangedOps(fs);
|
|
10013
|
-
if (ops) await ops.pwrite(path, size, body, true);
|
|
10030
|
+
if (ops) await ops.pwrite(path, size, body, true, noCreate(handle));
|
|
10014
10031
|
else {
|
|
10015
10032
|
const whole = new Uint8Array(size + body.length);
|
|
10016
10033
|
whole.set(await fs.readFileBuffer(path));
|
|
@@ -10026,6 +10043,9 @@ async function appended(fs, path, body) {
|
|
|
10026
10043
|
});
|
|
10027
10044
|
return run2;
|
|
10028
10045
|
}
|
|
10046
|
+
function noCreate(handle) {
|
|
10047
|
+
return handle === void 0 ? void 0 : { create: false };
|
|
10048
|
+
}
|
|
10029
10049
|
async function ranged(fs, path, req) {
|
|
10030
10050
|
const ops = rangedOps(fs);
|
|
10031
10051
|
if (!ops) throw syncError("ENOSYS", path);
|
|
@@ -10036,7 +10056,8 @@ async function ranged(fs, path, req) {
|
|
|
10036
10056
|
kind: "bytes",
|
|
10037
10057
|
bytes: await ops.pread(path, offset, req.length ?? 0, req.version)
|
|
10038
10058
|
};
|
|
10039
|
-
if (req.op === "pwrite")
|
|
10059
|
+
if (req.op === "pwrite")
|
|
10060
|
+
await ops.pwrite(path, offset, req.body ?? new Uint8Array(0), true, noCreate(req.handle));
|
|
10040
10061
|
else await ops.truncate(path, req.length ?? 0);
|
|
10041
10062
|
return done;
|
|
10042
10063
|
}
|
|
@@ -10066,7 +10087,10 @@ async function bound(entry, path, handle) {
|
|
|
10066
10087
|
const bound3 = entry.boundIno?.(handle);
|
|
10067
10088
|
if (bound3 === void 0) return;
|
|
10068
10089
|
const now = await entry.fs.stat(path).catch(() => void 0);
|
|
10069
|
-
if (now
|
|
10090
|
+
if (now === void 0 && bound3.fid !== void 0 && !await entry.fs.lstat(path).catch(() => void 0))
|
|
10091
|
+
throw syncError("ENOENT", path);
|
|
10092
|
+
const same2 = bound3.fid === void 0 ? now?.ino === bound3.ino : now?.fid === bound3.fid || await idOf(entry, path) === bound3.fid;
|
|
10093
|
+
if (same2) {
|
|
10070
10094
|
entry.trust?.(handle, bound3.doubt);
|
|
10071
10095
|
return;
|
|
10072
10096
|
}
|
|
@@ -10880,6 +10904,8 @@ var SYS_TREE = {
|
|
|
10880
10904
|
slicc_rename_ack_busy: (listing) => `${listing.renameAcks?.busy ?? 0}
|
|
10881
10905
|
`,
|
|
10882
10906
|
slicc_stale_fds: (listing) => `${listing.staleFds ?? 0}
|
|
10907
|
+
`,
|
|
10908
|
+
slicc_file_ids: (listing) => `${listing.fileIds ?? 0}
|
|
10883
10909
|
`,
|
|
10884
10910
|
slicc_rename_acks: (listing) => {
|
|
10885
10911
|
const samples = [...listing.renameAcks?.ackMs ?? []].sort((a, b) => a - b);
|
|
@@ -19387,10 +19413,10 @@ function heldIo(fs, nodes, changed) {
|
|
|
19387
19413
|
const held = await node(path);
|
|
19388
19414
|
return held ? held.byName(() => held.pread(n, at)) : ranged2.pread(path, at, n, version);
|
|
19389
19415
|
},
|
|
19390
|
-
pwrite: (path, at, bytes, transfer) => write(
|
|
19416
|
+
pwrite: (path, at, bytes, transfer, options) => write(
|
|
19391
19417
|
path,
|
|
19392
19418
|
async (held) => void await held.pwrite(bytes, at),
|
|
19393
|
-
() => ranged2.pwrite(path, at, bytes, transfer)
|
|
19419
|
+
() => ranged2.pwrite(path, at, bytes, transfer, options)
|
|
19394
19420
|
),
|
|
19395
19421
|
truncate: (path, size) => write(
|
|
19396
19422
|
path,
|
|
@@ -21675,8 +21701,9 @@ function holdingToken(opts, holds2, caller) {
|
|
|
21675
21701
|
cwd: opts.cwd,
|
|
21676
21702
|
...opts.statfs ? { statfs: opts.statfs } : {},
|
|
21677
21703
|
...opts.renames ? { renames: opts.renames } : {},
|
|
21704
|
+
...opts.fileId ? { fileId: opts.fileId } : {},
|
|
21678
21705
|
...opts.renameSeq ? { renameSeq: opts.renameSeq } : {},
|
|
21679
|
-
hold: (path, on, open, real, handle, ino) => holds2.hold(path, on, open, real, handle, ino),
|
|
21706
|
+
hold: (path, on, open, real, handle, ino, fid) => holds2.hold(path, on, open, real, handle, ino, fid),
|
|
21680
21707
|
boundIno: holds2.boundIno.bind(holds2),
|
|
21681
21708
|
trust: holds2.trust.bind(holds2),
|
|
21682
21709
|
keptFor: (handle) => holds2.keptFor(handle),
|
|
@@ -24095,9 +24122,10 @@ var OpfsFs = class {
|
|
|
24095
24122
|
}
|
|
24096
24123
|
async fileId(path) {
|
|
24097
24124
|
const found = await this.locate(path, true);
|
|
24098
|
-
const [entry] = await this.meta.get([found.path]);
|
|
24125
|
+
const [entry] = await (this.meta.fresh ?? this.meta.get).call(this.meta, [found.path]);
|
|
24099
24126
|
if (entry?.fid !== void 0) return entry.fid;
|
|
24100
24127
|
const fid = crypto.randomUUID();
|
|
24128
|
+
this.idWrites++;
|
|
24101
24129
|
await this.meta.update(found.path, (now) => ({
|
|
24102
24130
|
...occupied(now),
|
|
24103
24131
|
path: found.path,
|
|
@@ -24368,6 +24396,10 @@ var OpfsFs = class {
|
|
|
24368
24396
|
opfsCalls() {
|
|
24369
24397
|
return this.calls;
|
|
24370
24398
|
}
|
|
24399
|
+
idWrites = 0;
|
|
24400
|
+
fileIdWrites() {
|
|
24401
|
+
return this.idWrites;
|
|
24402
|
+
}
|
|
24371
24403
|
opfsOps() {
|
|
24372
24404
|
return this.calls + this.others;
|
|
24373
24405
|
}
|
|
@@ -24827,7 +24859,7 @@ var OpfsFs = class {
|
|
|
24827
24859
|
return new Uint8Array(await file.slice(offset, offset + length2).arrayBuffer());
|
|
24828
24860
|
});
|
|
24829
24861
|
}
|
|
24830
|
-
async pwrite(path, offset, bytes) {
|
|
24862
|
+
async pwrite(path, offset, bytes, _transfer, options) {
|
|
24831
24863
|
const at = normalizePath(path);
|
|
24832
24864
|
const movedAway = this.renamesInFlight() ? await this.writeWaits(at) : false;
|
|
24833
24865
|
this.fileWrites.set(at, (this.fileWrites.get(at) ?? 0) + 1);
|
|
@@ -24842,7 +24874,10 @@ var OpfsFs = class {
|
|
|
24842
24874
|
this.files.delete(target);
|
|
24843
24875
|
}
|
|
24844
24876
|
}
|
|
24845
|
-
const [handle] = await this.fileFor(
|
|
24877
|
+
const [handle] = await this.fileFor(
|
|
24878
|
+
path,
|
|
24879
|
+
!existed && !movedAway && options?.create !== false
|
|
24880
|
+
);
|
|
24846
24881
|
await this.writeAt(handle, target, path, offset, bytes);
|
|
24847
24882
|
} finally {
|
|
24848
24883
|
this.writeEnded(at);
|
|
@@ -29974,7 +30009,8 @@ var Launcher = class {
|
|
|
29974
30009
|
opfsOps: this.rootFs.opfsOps?.() ?? 0,
|
|
29975
30010
|
cwdChecks: this.cwds.checks,
|
|
29976
30011
|
renameAcks: this.rootFs.renameWaits?.(),
|
|
29977
|
-
staleFds: staleFdCount()
|
|
30012
|
+
staleFds: staleFdCount(),
|
|
30013
|
+
fileIds: this.rootFs.fileIdWrites?.() ?? 0
|
|
29978
30014
|
}),
|
|
29979
30015
|
sudo: (call, signal) => this.sudo(pid, call, signal),
|
|
29980
30016
|
crontab: (call) => this.crontab(pid, call),
|
|
@@ -29985,6 +30021,7 @@ var Launcher = class {
|
|
|
29985
30021
|
replacements: stack.unlinked,
|
|
29986
30022
|
statfs: (path) => this.mounts.statfs(path),
|
|
29987
30023
|
renames: (since2, held) => this.renameLog.since(since2, held),
|
|
30024
|
+
fileId: (path) => this.locks.shared?.() === true ? this.rootFileId(path) : void 0,
|
|
29988
30025
|
renameSeq: (from, to) => this.renameLog.seqOf(from, to),
|
|
29989
30026
|
mounts: () => this.mounts.list(),
|
|
29990
30027
|
mount: (call, signal) => this.processMount(pid, call, signal),
|
|
@@ -30864,12 +30901,16 @@ var Launcher = class {
|
|
|
30864
30901
|
this.writers ??= this.writerStack();
|
|
30865
30902
|
return this.writers;
|
|
30866
30903
|
}
|
|
30904
|
+
rootFileId(path) {
|
|
30905
|
+
return this.mounts.locate(path) === void 0 ? this.rootFs.fileId?.(path) : void 0;
|
|
30906
|
+
}
|
|
30867
30907
|
flushingPeers(fs) {
|
|
30868
30908
|
const peers = fs.peers?.();
|
|
30869
30909
|
if (!peers) return void 0;
|
|
30870
30910
|
peers.watch((crowded) => {
|
|
30871
30911
|
this.changes.flush();
|
|
30872
30912
|
this.changes.foreign(crowded);
|
|
30913
|
+
if (crowded) void this.held?.bindIds((path) => this.rootFileId(path));
|
|
30873
30914
|
});
|
|
30874
30915
|
return {
|
|
30875
30916
|
...peers,
|