@ai-ecoverse/slicc-kernel 1.196.25 → 1.196.26
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/async-process.js +1 -1
- package/dist/cloudflare-sources.js +1 -1
- package/dist/cloudflare.js +126 -11
- package/dist/cloudflare.js.map +3 -3
- package/dist/kernel-worker.js +126 -11
- package/dist/kernel-worker.js.map +3 -3
- package/dist/meta.js.map +2 -2
- package/dist/node-process-worker.cjs +1 -1
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +126 -11
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +1 -1
- package/dist/types/fs/meta.d.ts +2 -0
- package/dist/types/fs/opfs.d.ts +8 -0
- package/dist/types/fs/private-rename.d.ts +3 -1
- package/package.json +1 -1
package/dist/cloudflare.js
CHANGED
|
@@ -5241,7 +5241,7 @@ function satisfies(version, range2) {
|
|
|
5241
5241
|
}
|
|
5242
5242
|
|
|
5243
5243
|
// src/version.ts
|
|
5244
|
-
var KERNEL_VERSION = true ? "1.196.
|
|
5244
|
+
var KERNEL_VERSION = true ? "1.196.26" : "0.0.0-dev";
|
|
5245
5245
|
var OS_RELEASE = "6.0.0-slicc";
|
|
5246
5246
|
function procVersion() {
|
|
5247
5247
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -33278,6 +33278,9 @@ var PrivatePaths = class {
|
|
|
33278
33278
|
}
|
|
33279
33279
|
return false;
|
|
33280
33280
|
}
|
|
33281
|
+
get openSession() {
|
|
33282
|
+
return this.bound;
|
|
33283
|
+
}
|
|
33281
33284
|
bind(path) {
|
|
33282
33285
|
if (this.shifted) return;
|
|
33283
33286
|
this.names.clear();
|
|
@@ -33354,7 +33357,14 @@ var PrivateRename = class {
|
|
|
33354
33357
|
moved(from, to) {
|
|
33355
33358
|
for (const op of this.active) op.moved(from, to);
|
|
33356
33359
|
}
|
|
33357
|
-
async
|
|
33360
|
+
async drain(op, native) {
|
|
33361
|
+
const draining = this.barriers.get(op);
|
|
33362
|
+
await this.wait(
|
|
33363
|
+
() => ![...draining].some((active) => this.active.has(active) && !(native && active.openSession)),
|
|
33364
|
+
DRAIN_MS
|
|
33365
|
+
);
|
|
33366
|
+
}
|
|
33367
|
+
async exclusive(op, run2, native = false) {
|
|
33358
33368
|
const draining = /* @__PURE__ */ new Set();
|
|
33359
33369
|
await this.wait(() => {
|
|
33360
33370
|
if (this.blocked(op)) return false;
|
|
@@ -33363,7 +33373,7 @@ var PrivateRename = class {
|
|
|
33363
33373
|
return true;
|
|
33364
33374
|
}, ADMISSION_MS);
|
|
33365
33375
|
try {
|
|
33366
|
-
await this.
|
|
33376
|
+
await this.drain(op, native);
|
|
33367
33377
|
return await run2();
|
|
33368
33378
|
} finally {
|
|
33369
33379
|
this.barriers.delete(op);
|
|
@@ -33413,6 +33423,7 @@ var LISTINGS = /* @__PURE__ */ new Set(["readdir", "readdirStat"]);
|
|
|
33413
33423
|
var REMOVALS2 = /* @__PURE__ */ new Set(["rm", "rename"]);
|
|
33414
33424
|
var RETRY = /* @__PURE__ */ Symbol("retry");
|
|
33415
33425
|
var PRIVATE_COPY = /* @__PURE__ */ Symbol("private-copy");
|
|
33426
|
+
var PRIVATE_NATIVE = /* @__PURE__ */ Symbol("private-native");
|
|
33416
33427
|
var ACK_SAMPLES = 4096;
|
|
33417
33428
|
var INTENT_POLL_MS = 5;
|
|
33418
33429
|
function needsCopy(handle, swap) {
|
|
@@ -34825,6 +34836,9 @@ var OpfsFs = class {
|
|
|
34825
34836
|
const name2 = baseOf4(link2.path);
|
|
34826
34837
|
if (!children3.has(name2)) children3.set(name2, link2);
|
|
34827
34838
|
}
|
|
34839
|
+
for (const backup of this.hiddenBackups) {
|
|
34840
|
+
if (parentOf11(backup) === found.path) children3.delete(baseOf4(backup));
|
|
34841
|
+
}
|
|
34828
34842
|
return [found.path, [...children3].sort(([a], [b]) => a < b ? -1 : 1)];
|
|
34829
34843
|
}
|
|
34830
34844
|
async readdir(path) {
|
|
@@ -35494,6 +35508,7 @@ var OpfsFs = class {
|
|
|
35494
35508
|
await gate.enter(op);
|
|
35495
35509
|
const leave = () => gate.leave(op);
|
|
35496
35510
|
let sessionOwnsAdmission = false;
|
|
35511
|
+
let native = false;
|
|
35497
35512
|
try {
|
|
35498
35513
|
if (name2 === "writeSession") {
|
|
35499
35514
|
const session = await inner.apply(inside2, args);
|
|
@@ -35505,21 +35520,50 @@ var OpfsFs = class {
|
|
|
35505
35520
|
try {
|
|
35506
35521
|
return await inner.apply(inside2, args);
|
|
35507
35522
|
} catch (err) {
|
|
35508
|
-
|
|
35523
|
+
native = err === PRIVATE_NATIVE;
|
|
35524
|
+
if (!native && err !== PRIVATE_COPY) throw err;
|
|
35509
35525
|
}
|
|
35510
35526
|
} finally {
|
|
35511
35527
|
if (!sessionOwnsAdmission) leave();
|
|
35512
35528
|
}
|
|
35513
|
-
const exclusive = view(inside2, {
|
|
35514
|
-
|
|
35529
|
+
const exclusive = view(inside2, {
|
|
35530
|
+
privateCopyReady: true,
|
|
35531
|
+
beforePrivateCopy: () => gate.drain(op, false)
|
|
35532
|
+
});
|
|
35533
|
+
return gate.exclusive(op, () => inner.apply(exclusive, args), native);
|
|
35534
|
+
}
|
|
35535
|
+
swapEntry(path) {
|
|
35536
|
+
return this.exactly(() => this.handle(path)).catch((err) => {
|
|
35537
|
+
if (!missing5(err)) throw err;
|
|
35538
|
+
return void 0;
|
|
35539
|
+
});
|
|
35515
35540
|
}
|
|
35516
35541
|
privateCopyReady = false;
|
|
35542
|
+
beforePrivateCopy;
|
|
35517
35543
|
usePrivateCopy(handle, staging) {
|
|
35518
35544
|
if (!this.privateRename) return false;
|
|
35519
35545
|
if (this.privateCopyReady) return true;
|
|
35546
|
+
if (staging && movable(handle)) throw PRIVATE_NATIVE;
|
|
35520
35547
|
if (staging || !movable(handle)) throw PRIVATE_COPY;
|
|
35521
35548
|
return false;
|
|
35522
35549
|
}
|
|
35550
|
+
async swapNative(source, parent, name2, target, emptyBackup, intent) {
|
|
35551
|
+
let staged2 = false;
|
|
35552
|
+
const reset = async () => {
|
|
35553
|
+
if (staged2 && !await this.moved(target, parent, name2, false)) throw fsError("EIO", name2);
|
|
35554
|
+
await this.dropSwapIntent(intent, emptyBackup);
|
|
35555
|
+
};
|
|
35556
|
+
try {
|
|
35557
|
+
staged2 = await this.moved(target, parent, baseOf4(emptyBackup), false);
|
|
35558
|
+
if (staged2) this.forget(resolvePath(parentOf11(emptyBackup), name2));
|
|
35559
|
+
if (staged2 && await this.moved(source.handle, parent, name2, false)) return true;
|
|
35560
|
+
} catch (err) {
|
|
35561
|
+
await reset();
|
|
35562
|
+
throw err;
|
|
35563
|
+
}
|
|
35564
|
+
await reset();
|
|
35565
|
+
return false;
|
|
35566
|
+
}
|
|
35523
35567
|
async privateCopy(source, parent, to, target, owner) {
|
|
35524
35568
|
const handle = source.handle;
|
|
35525
35569
|
const dir = parent.handle;
|
|
@@ -35527,6 +35571,18 @@ var OpfsFs = class {
|
|
|
35527
35571
|
const copies = /* @__PURE__ */ new Map();
|
|
35528
35572
|
const [entry] = await this.meta.get([source.path]);
|
|
35529
35573
|
const root = { ino: occupied(entry).ino ?? inodeOf(source.path), ...owner };
|
|
35574
|
+
if (target?.kind === "directory" && movable(target) && movable(handle)) {
|
|
35575
|
+
const backup = ".slicc-empty-" + crypto.randomUUID();
|
|
35576
|
+
const emptyBackup = resolvePath(parent.path, backup);
|
|
35577
|
+
const intent2 = await this.intend({ from: source.path, to, root, emptyBackup });
|
|
35578
|
+
if (await this.swapNative(source, dir, name2, target, emptyBackup, intent2)) {
|
|
35579
|
+
this.forget(source.path);
|
|
35580
|
+
this.forget(to);
|
|
35581
|
+
await this.commitPrivateCopy(source.path, to, root, intent2, copies, emptyBackup);
|
|
35582
|
+
return;
|
|
35583
|
+
}
|
|
35584
|
+
}
|
|
35585
|
+
await this.beforePrivateCopy?.();
|
|
35530
35586
|
const intent = await this.intend({ from: source.path, to, root, privateCopy: true });
|
|
35531
35587
|
try {
|
|
35532
35588
|
await this.duplicate(handle, dir, name2, copies, "");
|
|
@@ -35545,7 +35601,24 @@ var OpfsFs = class {
|
|
|
35545
35601
|
}
|
|
35546
35602
|
await this.commitPrivateCopy(source.path, to, root, intent, copies);
|
|
35547
35603
|
}
|
|
35548
|
-
async
|
|
35604
|
+
async dropSwapIntent(intent, backup) {
|
|
35605
|
+
await this.meta.update(intent, () => void 0);
|
|
35606
|
+
this.hiddenBackups.delete(backup);
|
|
35607
|
+
}
|
|
35608
|
+
async cleanSwapIntent(intent, backup) {
|
|
35609
|
+
try {
|
|
35610
|
+
await this.clearPrivateBackup(backup);
|
|
35611
|
+
} catch {
|
|
35612
|
+
return;
|
|
35613
|
+
}
|
|
35614
|
+
await this.dropSwapIntent(intent, backup);
|
|
35615
|
+
}
|
|
35616
|
+
async clearPrivateBackup(backup) {
|
|
35617
|
+
await this.removePhysical(backup, false).catch((err) => {
|
|
35618
|
+
if (!missing5(err)) throw err;
|
|
35619
|
+
});
|
|
35620
|
+
}
|
|
35621
|
+
async commitPrivateCopy(from, to, root, intent, copies, emptyBackup) {
|
|
35549
35622
|
const { ino, ...owner } = root;
|
|
35550
35623
|
const entries = await this.meta.get([from, to]);
|
|
35551
35624
|
if (!entries[0]?.vacated || entries[1]?.ino !== ino) {
|
|
@@ -35557,11 +35630,15 @@ var OpfsFs = class {
|
|
|
35557
35630
|
);
|
|
35558
35631
|
}
|
|
35559
35632
|
this.movePending(from, to);
|
|
35560
|
-
await this.removePhysical(from, true);
|
|
35561
|
-
await this.meta.update(intent, () => void 0);
|
|
35633
|
+
if (!emptyBackup) await this.removePhysical(from, true);
|
|
35562
35634
|
await this.restamp(to, copies);
|
|
35563
35635
|
this.changed(from, to);
|
|
35564
35636
|
this.touch(Date.now(), parentOf11(from), parentOf11(to));
|
|
35637
|
+
if (emptyBackup) {
|
|
35638
|
+
await this.intend({ from, to, root, emptyBackup, cleanupOnly: true }, intent);
|
|
35639
|
+
return this.cleanSwapIntent(intent, emptyBackup);
|
|
35640
|
+
}
|
|
35641
|
+
await this.meta.update(intent, () => void 0);
|
|
35565
35642
|
}
|
|
35566
35643
|
async duplicate(handle, parent, name2, copies, rest2) {
|
|
35567
35644
|
if (handle.kind === "file") return this.copyBytes(handle, parent, name2, { copies }, rest2);
|
|
@@ -35570,11 +35647,13 @@ var OpfsFs = class {
|
|
|
35570
35647
|
for await (const child2 of handle.values())
|
|
35571
35648
|
await this.duplicate(child2, dir, child2.name, copies, rest2 + "/" + child2.name);
|
|
35572
35649
|
}
|
|
35650
|
+
hiddenBackups = /* @__PURE__ */ new Set();
|
|
35573
35651
|
renamingDirs = /* @__PURE__ */ new Set();
|
|
35574
35652
|
intents = 0;
|
|
35575
35653
|
async intend(rename, at = `${RENAMES2}/${crypto.randomUUID()}`) {
|
|
35576
35654
|
const record4 = { ...rename, at: Date.now() * 1e3 + this.intents++ % 1e3 };
|
|
35577
35655
|
await this.meta.update(at, () => ({ path: at, rename: record4 }));
|
|
35656
|
+
if (rename.emptyBackup) this.hiddenBackups.add(rename.emptyBackup);
|
|
35578
35657
|
return at;
|
|
35579
35658
|
}
|
|
35580
35659
|
async rollBack(from, to, intents) {
|
|
@@ -35621,16 +35700,50 @@ var OpfsFs = class {
|
|
|
35621
35700
|
}
|
|
35622
35701
|
return intents.length;
|
|
35623
35702
|
}
|
|
35703
|
+
async finishPrivateSwap(intent, from, to, root, backup, left) {
|
|
35704
|
+
const [src, dest] = await this.meta.get([from, to]);
|
|
35705
|
+
if (dest?.ino === root.ino && (src?.vacated || src?.ino !== root.ino)) {
|
|
35706
|
+
await this.intend({ from, to, root, emptyBackup: backup, cleanupOnly: true }, intent);
|
|
35707
|
+
return this.cleanSwapIntent(intent, backup);
|
|
35708
|
+
}
|
|
35709
|
+
if (!left) {
|
|
35710
|
+
if ((await this.swapEntry(to))?.kind !== "directory") throw fsError("EIO", to);
|
|
35711
|
+
return this.commitPrivateCopy(from, to, root, intent, /* @__PURE__ */ new Map(), backup);
|
|
35712
|
+
}
|
|
35713
|
+
const staged2 = await this.swapEntry(backup);
|
|
35714
|
+
if (staged2) {
|
|
35715
|
+
if (await this.swapEntry(to)) {
|
|
35716
|
+
await this.intend({ from, to, root, emptyBackup: backup, cleanupOnly: true }, intent);
|
|
35717
|
+
return this.cleanSwapIntent(intent, backup);
|
|
35718
|
+
}
|
|
35719
|
+
const dir = await this.dir(parentOf11(to));
|
|
35720
|
+
if (!await this.moved(staged2, dir, baseOf4(to), false)) throw fsError("EIO", to);
|
|
35721
|
+
}
|
|
35722
|
+
await this.dropSwapIntent(intent, backup);
|
|
35723
|
+
}
|
|
35624
35724
|
async finishRename(entry) {
|
|
35625
35725
|
const [current] = await this.meta.under(entry.path);
|
|
35626
35726
|
if (current?.rename === void 0) return;
|
|
35627
|
-
const { from, to, replace, root } = current.rename;
|
|
35727
|
+
const { from, to, replace, root, emptyBackup, cleanupOnly } = current.rename;
|
|
35728
|
+
if (emptyBackup) this.hiddenBackups.add(emptyBackup);
|
|
35729
|
+
if (emptyBackup && cleanupOnly) return this.cleanSwapIntent(entry.path, emptyBackup);
|
|
35628
35730
|
const { promise, resolve: resolve2 } = Promise.withResolvers();
|
|
35629
35731
|
const barrier = { from, to, done: promise };
|
|
35630
35732
|
this.renamingDirs.add(barrier);
|
|
35631
35733
|
this.forget(from);
|
|
35632
35734
|
this.forget(to);
|
|
35633
35735
|
try {
|
|
35736
|
+
if (current.rename.emptyBackup && root) {
|
|
35737
|
+
await this.finishPrivateSwap(
|
|
35738
|
+
entry.path,
|
|
35739
|
+
from,
|
|
35740
|
+
to,
|
|
35741
|
+
root,
|
|
35742
|
+
current.rename.emptyBackup,
|
|
35743
|
+
!!await this.swapEntry(from)
|
|
35744
|
+
);
|
|
35745
|
+
return;
|
|
35746
|
+
}
|
|
35634
35747
|
const left = await this.real(from);
|
|
35635
35748
|
if (current.rename.privateCopy) {
|
|
35636
35749
|
if (left) {
|
|
@@ -36015,7 +36128,9 @@ var OpfsFs = class {
|
|
|
36015
36128
|
let removed = 0;
|
|
36016
36129
|
const entries = await this.meta.all();
|
|
36017
36130
|
const carried = new Set(entries.filter((e) => !e.vacated).map((e) => e.ino));
|
|
36018
|
-
const checked = entries.filter(
|
|
36131
|
+
const checked = entries.filter(
|
|
36132
|
+
(e) => !e.rename && !(e.vacated && carried.has(inodeOf(e.path)))
|
|
36133
|
+
);
|
|
36019
36134
|
const real2 = await this.present(
|
|
36020
36135
|
checked.flatMap((e) => e.link === void 0 ? [e.path] : [e.path, parentOf11(e.path)])
|
|
36021
36136
|
);
|