@ai-ecoverse/slicc-kernel 1.196.24 → 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 +2 -2
- package/dist/async-process.js +1 -1
- package/dist/cloudflare-sources.js +1 -1
- package/dist/cloudflare.js +127 -14
- package/dist/cloudflare.js.map +3 -3
- package/dist/kernel-worker.js +127 -14
- 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 +127 -14
- 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
|
|
@@ -20693,9 +20693,7 @@ ${SCRIPT_HELP}
|
|
|
20693
20693
|
return DONE;
|
|
20694
20694
|
}
|
|
20695
20695
|
if (parsed3.nonInteractive) return failed2("EPERM", "sudo: a password is required");
|
|
20696
|
-
const cwd = await this.canonical(dir, s.caller.cred);
|
|
20697
|
-
if (cwd === void 0)
|
|
20698
|
-
return failed2("EACCES", `sudo: cannot run in ${dir}: it isn't a directory you can enter`);
|
|
20696
|
+
const cwd = await this.canonical(dir, s.caller.cred) ?? "";
|
|
20699
20697
|
return this.pendingFor(s.caller.cred.ruid, async () => {
|
|
20700
20698
|
const answer2 = await this.ask(s, { argv: [], path: "", cwd, bound: {}, validate: true });
|
|
20701
20699
|
if ("error" in answer2) return answer2;
|
|
@@ -33280,6 +33278,9 @@ var PrivatePaths = class {
|
|
|
33280
33278
|
}
|
|
33281
33279
|
return false;
|
|
33282
33280
|
}
|
|
33281
|
+
get openSession() {
|
|
33282
|
+
return this.bound;
|
|
33283
|
+
}
|
|
33283
33284
|
bind(path) {
|
|
33284
33285
|
if (this.shifted) return;
|
|
33285
33286
|
this.names.clear();
|
|
@@ -33356,7 +33357,14 @@ var PrivateRename = class {
|
|
|
33356
33357
|
moved(from, to) {
|
|
33357
33358
|
for (const op of this.active) op.moved(from, to);
|
|
33358
33359
|
}
|
|
33359
|
-
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) {
|
|
33360
33368
|
const draining = /* @__PURE__ */ new Set();
|
|
33361
33369
|
await this.wait(() => {
|
|
33362
33370
|
if (this.blocked(op)) return false;
|
|
@@ -33365,7 +33373,7 @@ var PrivateRename = class {
|
|
|
33365
33373
|
return true;
|
|
33366
33374
|
}, ADMISSION_MS);
|
|
33367
33375
|
try {
|
|
33368
|
-
await this.
|
|
33376
|
+
await this.drain(op, native);
|
|
33369
33377
|
return await run2();
|
|
33370
33378
|
} finally {
|
|
33371
33379
|
this.barriers.delete(op);
|
|
@@ -33415,6 +33423,7 @@ var LISTINGS = /* @__PURE__ */ new Set(["readdir", "readdirStat"]);
|
|
|
33415
33423
|
var REMOVALS2 = /* @__PURE__ */ new Set(["rm", "rename"]);
|
|
33416
33424
|
var RETRY = /* @__PURE__ */ Symbol("retry");
|
|
33417
33425
|
var PRIVATE_COPY = /* @__PURE__ */ Symbol("private-copy");
|
|
33426
|
+
var PRIVATE_NATIVE = /* @__PURE__ */ Symbol("private-native");
|
|
33418
33427
|
var ACK_SAMPLES = 4096;
|
|
33419
33428
|
var INTENT_POLL_MS = 5;
|
|
33420
33429
|
function needsCopy(handle, swap) {
|
|
@@ -34827,6 +34836,9 @@ var OpfsFs = class {
|
|
|
34827
34836
|
const name2 = baseOf4(link2.path);
|
|
34828
34837
|
if (!children3.has(name2)) children3.set(name2, link2);
|
|
34829
34838
|
}
|
|
34839
|
+
for (const backup of this.hiddenBackups) {
|
|
34840
|
+
if (parentOf11(backup) === found.path) children3.delete(baseOf4(backup));
|
|
34841
|
+
}
|
|
34830
34842
|
return [found.path, [...children3].sort(([a], [b]) => a < b ? -1 : 1)];
|
|
34831
34843
|
}
|
|
34832
34844
|
async readdir(path) {
|
|
@@ -35496,6 +35508,7 @@ var OpfsFs = class {
|
|
|
35496
35508
|
await gate.enter(op);
|
|
35497
35509
|
const leave = () => gate.leave(op);
|
|
35498
35510
|
let sessionOwnsAdmission = false;
|
|
35511
|
+
let native = false;
|
|
35499
35512
|
try {
|
|
35500
35513
|
if (name2 === "writeSession") {
|
|
35501
35514
|
const session = await inner.apply(inside2, args);
|
|
@@ -35507,21 +35520,50 @@ var OpfsFs = class {
|
|
|
35507
35520
|
try {
|
|
35508
35521
|
return await inner.apply(inside2, args);
|
|
35509
35522
|
} catch (err) {
|
|
35510
|
-
|
|
35523
|
+
native = err === PRIVATE_NATIVE;
|
|
35524
|
+
if (!native && err !== PRIVATE_COPY) throw err;
|
|
35511
35525
|
}
|
|
35512
35526
|
} finally {
|
|
35513
35527
|
if (!sessionOwnsAdmission) leave();
|
|
35514
35528
|
}
|
|
35515
|
-
const exclusive = view(inside2, {
|
|
35516
|
-
|
|
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
|
+
});
|
|
35517
35540
|
}
|
|
35518
35541
|
privateCopyReady = false;
|
|
35542
|
+
beforePrivateCopy;
|
|
35519
35543
|
usePrivateCopy(handle, staging) {
|
|
35520
35544
|
if (!this.privateRename) return false;
|
|
35521
35545
|
if (this.privateCopyReady) return true;
|
|
35546
|
+
if (staging && movable(handle)) throw PRIVATE_NATIVE;
|
|
35522
35547
|
if (staging || !movable(handle)) throw PRIVATE_COPY;
|
|
35523
35548
|
return false;
|
|
35524
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
|
+
}
|
|
35525
35567
|
async privateCopy(source, parent, to, target, owner) {
|
|
35526
35568
|
const handle = source.handle;
|
|
35527
35569
|
const dir = parent.handle;
|
|
@@ -35529,6 +35571,18 @@ var OpfsFs = class {
|
|
|
35529
35571
|
const copies = /* @__PURE__ */ new Map();
|
|
35530
35572
|
const [entry] = await this.meta.get([source.path]);
|
|
35531
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?.();
|
|
35532
35586
|
const intent = await this.intend({ from: source.path, to, root, privateCopy: true });
|
|
35533
35587
|
try {
|
|
35534
35588
|
await this.duplicate(handle, dir, name2, copies, "");
|
|
@@ -35547,7 +35601,24 @@ var OpfsFs = class {
|
|
|
35547
35601
|
}
|
|
35548
35602
|
await this.commitPrivateCopy(source.path, to, root, intent, copies);
|
|
35549
35603
|
}
|
|
35550
|
-
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) {
|
|
35551
35622
|
const { ino, ...owner } = root;
|
|
35552
35623
|
const entries = await this.meta.get([from, to]);
|
|
35553
35624
|
if (!entries[0]?.vacated || entries[1]?.ino !== ino) {
|
|
@@ -35559,11 +35630,15 @@ var OpfsFs = class {
|
|
|
35559
35630
|
);
|
|
35560
35631
|
}
|
|
35561
35632
|
this.movePending(from, to);
|
|
35562
|
-
await this.removePhysical(from, true);
|
|
35563
|
-
await this.meta.update(intent, () => void 0);
|
|
35633
|
+
if (!emptyBackup) await this.removePhysical(from, true);
|
|
35564
35634
|
await this.restamp(to, copies);
|
|
35565
35635
|
this.changed(from, to);
|
|
35566
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);
|
|
35567
35642
|
}
|
|
35568
35643
|
async duplicate(handle, parent, name2, copies, rest2) {
|
|
35569
35644
|
if (handle.kind === "file") return this.copyBytes(handle, parent, name2, { copies }, rest2);
|
|
@@ -35572,11 +35647,13 @@ var OpfsFs = class {
|
|
|
35572
35647
|
for await (const child2 of handle.values())
|
|
35573
35648
|
await this.duplicate(child2, dir, child2.name, copies, rest2 + "/" + child2.name);
|
|
35574
35649
|
}
|
|
35650
|
+
hiddenBackups = /* @__PURE__ */ new Set();
|
|
35575
35651
|
renamingDirs = /* @__PURE__ */ new Set();
|
|
35576
35652
|
intents = 0;
|
|
35577
35653
|
async intend(rename, at = `${RENAMES2}/${crypto.randomUUID()}`) {
|
|
35578
35654
|
const record4 = { ...rename, at: Date.now() * 1e3 + this.intents++ % 1e3 };
|
|
35579
35655
|
await this.meta.update(at, () => ({ path: at, rename: record4 }));
|
|
35656
|
+
if (rename.emptyBackup) this.hiddenBackups.add(rename.emptyBackup);
|
|
35580
35657
|
return at;
|
|
35581
35658
|
}
|
|
35582
35659
|
async rollBack(from, to, intents) {
|
|
@@ -35623,16 +35700,50 @@ var OpfsFs = class {
|
|
|
35623
35700
|
}
|
|
35624
35701
|
return intents.length;
|
|
35625
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
|
+
}
|
|
35626
35724
|
async finishRename(entry) {
|
|
35627
35725
|
const [current] = await this.meta.under(entry.path);
|
|
35628
35726
|
if (current?.rename === void 0) return;
|
|
35629
|
-
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);
|
|
35630
35730
|
const { promise, resolve: resolve2 } = Promise.withResolvers();
|
|
35631
35731
|
const barrier = { from, to, done: promise };
|
|
35632
35732
|
this.renamingDirs.add(barrier);
|
|
35633
35733
|
this.forget(from);
|
|
35634
35734
|
this.forget(to);
|
|
35635
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
|
+
}
|
|
35636
35747
|
const left = await this.real(from);
|
|
35637
35748
|
if (current.rename.privateCopy) {
|
|
35638
35749
|
if (left) {
|
|
@@ -36017,7 +36128,9 @@ var OpfsFs = class {
|
|
|
36017
36128
|
let removed = 0;
|
|
36018
36129
|
const entries = await this.meta.all();
|
|
36019
36130
|
const carried = new Set(entries.filter((e) => !e.vacated).map((e) => e.ino));
|
|
36020
|
-
const checked = entries.filter(
|
|
36131
|
+
const checked = entries.filter(
|
|
36132
|
+
(e) => !e.rename && !(e.vacated && carried.has(inodeOf(e.path)))
|
|
36133
|
+
);
|
|
36021
36134
|
const real2 = await this.present(
|
|
36022
36135
|
checked.flatMap((e) => e.link === void 0 ? [e.path] : [e.path, parentOf11(e.path)])
|
|
36023
36136
|
);
|