@ai-ecoverse/slicc-kernel 1.165.1 → 1.165.3
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/index.js.map +1 -1
- package/dist/kernel-worker.js +38 -5
- package/dist/kernel-worker.js.map +3 -3
- package/dist/meta.js.map +2 -2
- package/dist/node-driver-worker.js +16 -1
- package/dist/node-driver-worker.js.map +2 -2
- package/dist/node-process-worker.js +82 -4
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +38 -5
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +66 -3
- package/dist/process-worker.js.map +2 -2
- package/dist/types/fs/changes.d.ts +2 -0
- package/dist/types/fs/opfs.d.ts +1 -0
- package/dist/types/fs/pages.d.ts +1 -0
- package/dist/types/fs/ranged.d.ts +1 -0
- package/dist/types/fs/remote.d.ts +1 -0
- package/dist/types/fs/types.d.ts +1 -0
- package/dist/types/process/wasi/wasi-files.d.ts +3 -0
- package/package.json +2 -2
package/dist/kernel-worker.js
CHANGED
|
@@ -365,7 +365,12 @@ var SHARED_TTL_MS = 100;
|
|
|
365
365
|
var DIRTY = RING + RING_SIZE * SLOT;
|
|
366
366
|
var FOREIGN = DIRTY + 1;
|
|
367
367
|
var RENAMES = FOREIGN + 1;
|
|
368
|
-
var
|
|
368
|
+
var HELD = RENAMES + 1;
|
|
369
|
+
var HELD_SLOTS = 1024;
|
|
370
|
+
var CHANGES_BYTES = (HELD + HELD_SLOTS) * 4;
|
|
371
|
+
function heldSlot(path) {
|
|
372
|
+
return HELD + (changeHash(normal(path)) & HELD_SLOTS - 1);
|
|
373
|
+
}
|
|
369
374
|
function changeHash(path) {
|
|
370
375
|
let h = 2166136261;
|
|
371
376
|
for (let i = 0; i < path.length; i++) {
|
|
@@ -399,6 +404,13 @@ var FileChanges = class {
|
|
|
399
404
|
flush() {
|
|
400
405
|
Atomics.add(this.view, GEN, RING_SIZE + 1);
|
|
401
406
|
}
|
|
407
|
+
peerHeld(paths) {
|
|
408
|
+
const on = new Set(paths.map(heldSlot));
|
|
409
|
+
for (const slot2 of on) Atomics.store(this.view, slot2, 1);
|
|
410
|
+
for (let slot2 = HELD; slot2 < HELD + HELD_SLOTS; slot2++) {
|
|
411
|
+
if (!on.has(slot2)) Atomics.store(this.view, slot2, 0);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
402
414
|
renamed() {
|
|
403
415
|
const seq2 = Atomics.add(this.view, RENAMES, 1) + 1 | 0;
|
|
404
416
|
Atomics.notify(this.view, RENAMES);
|
|
@@ -428,6 +440,9 @@ var ChangeView = class {
|
|
|
428
440
|
foreign() {
|
|
429
441
|
return this.view.length > FOREIGN && Atomics.load(this.view, FOREIGN) === 1;
|
|
430
442
|
}
|
|
443
|
+
peerHeld(path) {
|
|
444
|
+
return this.view.length > HELD && Atomics.load(this.view, heldSlot(path)) === 1;
|
|
445
|
+
}
|
|
431
446
|
renames() {
|
|
432
447
|
return this.view.length > RENAMES ? Atomics.load(this.view, RENAMES) : 0;
|
|
433
448
|
}
|
|
@@ -1021,6 +1036,7 @@ var RemoteWatch = class {
|
|
|
1021
1036
|
quiet;
|
|
1022
1037
|
crowd;
|
|
1023
1038
|
gone;
|
|
1039
|
+
holdsChanged;
|
|
1024
1040
|
renaming;
|
|
1025
1041
|
renamed;
|
|
1026
1042
|
ackers = /* @__PURE__ */ new Set();
|
|
@@ -1155,7 +1171,7 @@ var RemoteWatch = class {
|
|
|
1155
1171
|
void this.locks.request(name2, async () => {
|
|
1156
1172
|
this.mourned.delete(peer);
|
|
1157
1173
|
this.others.delete(peer);
|
|
1158
|
-
this.peerHolds.delete(peer);
|
|
1174
|
+
if (this.peerHolds.delete(peer)) this.holdsChanged?.();
|
|
1159
1175
|
this.keeps?.left(peer);
|
|
1160
1176
|
this.peers.delete(peer);
|
|
1161
1177
|
this.ackers.delete(peer);
|
|
@@ -1230,6 +1246,7 @@ var RemoteWatch = class {
|
|
|
1230
1246
|
for (const [path, fid] of add) held.set(path, fid);
|
|
1231
1247
|
if (held.size > 0) this.peerHolds.set(from, held);
|
|
1232
1248
|
else this.peerHolds.delete(from);
|
|
1249
|
+
this.holdsChanged?.();
|
|
1233
1250
|
this.channel.postMessage({ ack: seq2, from: this.tab, to: from });
|
|
1234
1251
|
}
|
|
1235
1252
|
hold(add, drop, wait2) {
|
|
@@ -1332,7 +1349,7 @@ var RemoteWatch = class {
|
|
|
1332
1349
|
if (!held.has(this.lockOf(tab))) {
|
|
1333
1350
|
if (this.peers.delete(tab)) left = true;
|
|
1334
1351
|
this.others.delete(tab);
|
|
1335
|
-
this.peerHolds.delete(tab);
|
|
1352
|
+
if (this.peerHolds.delete(tab)) this.holdsChanged?.();
|
|
1336
1353
|
this.keeps?.left(tab);
|
|
1337
1354
|
this.ackers.delete(tab);
|
|
1338
1355
|
this.holders.delete(tab);
|
|
@@ -1807,6 +1824,10 @@ var OpfsFs = class {
|
|
|
1807
1824
|
announceHolds(add, drop, wait2) {
|
|
1808
1825
|
return this.remote?.hold(add, drop, wait2) ?? Promise.resolve();
|
|
1809
1826
|
}
|
|
1827
|
+
peerHolds(listener) {
|
|
1828
|
+
const remote = this.remote;
|
|
1829
|
+
if (remote) remote.holdsChanged = () => listener(remote.peerHeldPaths());
|
|
1830
|
+
}
|
|
1810
1831
|
holdCounts() {
|
|
1811
1832
|
const remote = this.remote;
|
|
1812
1833
|
return remote && { ...remote.holdCounts(), held: remote.peerHeldPaths() };
|
|
@@ -2540,7 +2561,7 @@ var OpfsFs = class {
|
|
|
2540
2561
|
const at = normalizePath(path);
|
|
2541
2562
|
const movedAway = this.renamesInFlight() ? await this.writeWaits(at) : false;
|
|
2542
2563
|
const ended = this.writeStarted(at);
|
|
2543
|
-
|
|
2564
|
+
const write = async () => {
|
|
2544
2565
|
const [kept, target, existed] = await this.keptFor(path);
|
|
2545
2566
|
if (kept) {
|
|
2546
2567
|
try {
|
|
@@ -2556,6 +2577,9 @@ var OpfsFs = class {
|
|
|
2556
2577
|
!existed && !movedAway && options?.create !== false
|
|
2557
2578
|
);
|
|
2558
2579
|
await this.writeAt(handle, target, path, offset, bytes);
|
|
2580
|
+
};
|
|
2581
|
+
try {
|
|
2582
|
+
await (this.remote?.peerHeld(at).length ? this.ending(path, write) : write());
|
|
2559
2583
|
} finally {
|
|
2560
2584
|
ended();
|
|
2561
2585
|
}
|
|
@@ -8440,7 +8464,7 @@ function satisfies(version, range2) {
|
|
|
8440
8464
|
}
|
|
8441
8465
|
|
|
8442
8466
|
// src/version.ts
|
|
8443
|
-
var KERNEL_VERSION = true ? "1.165.
|
|
8467
|
+
var KERNEL_VERSION = true ? "1.165.3" : "0.0.0-dev";
|
|
8444
8468
|
var OS_RELEASE = "6.0.0-slicc";
|
|
8445
8469
|
function procVersion() {
|
|
8446
8470
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -15965,6 +15989,14 @@ var Pages = class {
|
|
|
15965
15989
|
pin() {
|
|
15966
15990
|
this.pinned = true;
|
|
15967
15991
|
}
|
|
15992
|
+
landed(at, length2) {
|
|
15993
|
+
const end = at + length2;
|
|
15994
|
+
for (let page = Math.floor(at / PAGE); page * PAGE < end; page++) {
|
|
15995
|
+
if (this.pages.has(page) && !this.dirty.has(page)) this.drop(page);
|
|
15996
|
+
}
|
|
15997
|
+
this.length = Math.max(this.length, end);
|
|
15998
|
+
this.stored = Math.max(this.stored, end);
|
|
15999
|
+
}
|
|
15968
16000
|
reset(size) {
|
|
15969
16001
|
if (this.pinned) return;
|
|
15970
16002
|
for (const page of [...this.pages.keys()]) if (!this.dirty.has(page)) this.drop(page);
|
|
@@ -33528,6 +33560,7 @@ var Launcher = class {
|
|
|
33528
33560
|
return this.mounts.locate(path) === void 0 ? this.rootFs.bindId?.(path) : void 0;
|
|
33529
33561
|
}
|
|
33530
33562
|
flushingPeers(fs) {
|
|
33563
|
+
fs.peerHolds?.((paths) => this.changes.peerHeld(paths));
|
|
33531
33564
|
const peers = fs.peers?.();
|
|
33532
33565
|
if (!peers) return void 0;
|
|
33533
33566
|
peers.watch((crowded) => {
|