@ai-ecoverse/slicc-kernel 1.154.1 → 1.154.2
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 +126 -10
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +126 -10
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +1 -1
- package/dist/types/fs/opfs.d.ts +3 -0
- package/dist/types/kernel/vfs-file.d.ts +5 -0
- package/package.json +1 -1
|
@@ -7245,7 +7245,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
7245
7245
|
var init_version = __esm({
|
|
7246
7246
|
"src/version.ts"() {
|
|
7247
7247
|
"use strict";
|
|
7248
|
-
KERNEL_VERSION = true ? "1.154.
|
|
7248
|
+
KERNEL_VERSION = true ? "1.154.2" : "0.0.0-dev";
|
|
7249
7249
|
OS_RELEASE = "6.0.0-slicc";
|
|
7250
7250
|
}
|
|
7251
7251
|
});
|
package/dist/node.js
CHANGED
|
@@ -3562,7 +3562,7 @@ function satisfies(version, range2) {
|
|
|
3562
3562
|
}
|
|
3563
3563
|
|
|
3564
3564
|
// src/version.ts
|
|
3565
|
-
var KERNEL_VERSION = true ? "1.154.
|
|
3565
|
+
var KERNEL_VERSION = true ? "1.154.2" : "0.0.0-dev";
|
|
3566
3566
|
var OS_RELEASE = "6.0.0-slicc";
|
|
3567
3567
|
function procVersion() {
|
|
3568
3568
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -6410,6 +6410,7 @@ function withCommandDirs(fs, names2, userDir = async () => void 0, owners = fals
|
|
|
6410
6410
|
...fs.chown ? { chown: fs.chown.bind(fs) } : {},
|
|
6411
6411
|
...fs.createExclusive ? { createExclusive: fs.createExclusive.bind(fs) } : {},
|
|
6412
6412
|
...fs.copyFile ? { copyFile: fs.copyFile.bind(fs) } : {},
|
|
6413
|
+
...fs.append ? { append: fs.append.bind(fs) } : {},
|
|
6413
6414
|
...fs.ancestry ? { ancestry: fs.ancestry.bind(fs) } : {},
|
|
6414
6415
|
...fs.hasOwner ? { hasOwner: fs.hasOwner.bind(fs) } : {},
|
|
6415
6416
|
chmod: (path, mode) => fs.chmod(path, mode),
|
|
@@ -6646,6 +6647,15 @@ var FreshModules = class {
|
|
|
6646
6647
|
if (fresh3) this.fresh.set(normalizePath(to), fresh3);
|
|
6647
6648
|
}
|
|
6648
6649
|
};
|
|
6650
|
+
const { append } = fs;
|
|
6651
|
+
if (append) {
|
|
6652
|
+
overrides.append = async (path, bytes) => {
|
|
6653
|
+
const fresh3 = this.fresh.has(normalizePath(path));
|
|
6654
|
+
const end = await append.call(fs, path, bytes);
|
|
6655
|
+
if (fresh3 && end - bytes.length < MAGIC.length) await decide(path);
|
|
6656
|
+
return end;
|
|
6657
|
+
};
|
|
6658
|
+
}
|
|
6649
6659
|
const ranged2 = rangedOps(fs);
|
|
6650
6660
|
if (ranged2) {
|
|
6651
6661
|
overrides.pwrite = async (path, at, bytes, transfer, options) => {
|
|
@@ -6844,6 +6854,12 @@ var ProtectedFs = class {
|
|
|
6844
6854
|
return fs.pwrite?.(...args);
|
|
6845
6855
|
}
|
|
6846
6856
|
} : {},
|
|
6857
|
+
...fs.append ? {
|
|
6858
|
+
async append(path, bytes) {
|
|
6859
|
+
await check(path, true);
|
|
6860
|
+
return fs.append.call(fs, path, bytes);
|
|
6861
|
+
}
|
|
6862
|
+
} : {},
|
|
6847
6863
|
...fs.truncate ? {
|
|
6848
6864
|
async truncate(path, size) {
|
|
6849
6865
|
await check(path, true);
|
|
@@ -7425,6 +7441,19 @@ var FsWatchers = class {
|
|
|
7425
7441
|
"change"
|
|
7426
7442
|
)
|
|
7427
7443
|
};
|
|
7444
|
+
const { append } = fs;
|
|
7445
|
+
if (append) {
|
|
7446
|
+
overrides.append = async (path, bytes) => {
|
|
7447
|
+
let end = 0;
|
|
7448
|
+
await content(
|
|
7449
|
+
async (_path) => {
|
|
7450
|
+
end = await append.call(fs, path, bytes);
|
|
7451
|
+
},
|
|
7452
|
+
() => ["change"]
|
|
7453
|
+
)(path);
|
|
7454
|
+
return end;
|
|
7455
|
+
};
|
|
7456
|
+
}
|
|
7428
7457
|
const ranged2 = rangedOps(fs);
|
|
7429
7458
|
if (ranged2) {
|
|
7430
7459
|
overrides.pwrite = content(ranged2.pwrite, () => ["change"]);
|
|
@@ -9291,6 +9320,7 @@ var RELINKED = [
|
|
|
9291
9320
|
["writeFile", [0]],
|
|
9292
9321
|
["pread", [0]],
|
|
9293
9322
|
["pwrite", [0]],
|
|
9323
|
+
["append", [0]],
|
|
9294
9324
|
["truncate", [0]],
|
|
9295
9325
|
["lstat", [0]],
|
|
9296
9326
|
["stat", [0]],
|
|
@@ -9596,6 +9626,19 @@ var MountFs = class _MountFs {
|
|
|
9596
9626
|
);
|
|
9597
9627
|
}
|
|
9598
9628
|
}
|
|
9629
|
+
async append(path, bytes, redirects = 0) {
|
|
9630
|
+
const real = await this.follow(path, 0, true);
|
|
9631
|
+
const { append } = this.base;
|
|
9632
|
+
if (!this.at(real) && append) {
|
|
9633
|
+
return this.based(
|
|
9634
|
+
[real],
|
|
9635
|
+
redirects,
|
|
9636
|
+
() => append.call(this.base, real, bytes),
|
|
9637
|
+
([to], n) => this.append(to, bytes, n)
|
|
9638
|
+
);
|
|
9639
|
+
}
|
|
9640
|
+
throw errnoError("ENOTSUP", `${real}: appended by position on a mount`);
|
|
9641
|
+
}
|
|
9599
9642
|
async pwrite(path, offset, bytes, transfer = false, options, redirects = 0) {
|
|
9600
9643
|
const real = await this.follow(path, 0, true);
|
|
9601
9644
|
const found = this.at(real);
|
|
@@ -19400,6 +19443,7 @@ var O_ACCMODE = 3;
|
|
|
19400
19443
|
var O_WRONLY = 1;
|
|
19401
19444
|
var O_RDWR = 2;
|
|
19402
19445
|
var O_APPEND = 1024;
|
|
19446
|
+
var POSITIONAL_MS = 100;
|
|
19403
19447
|
var SEEK_SET = 0;
|
|
19404
19448
|
var SEEK_CUR = 1;
|
|
19405
19449
|
var SEEK_END = 2;
|
|
@@ -19595,6 +19639,34 @@ var VfsNode = class {
|
|
|
19595
19639
|
if (this.ranged) this.ranged.path = path;
|
|
19596
19640
|
this.cap = void 0;
|
|
19597
19641
|
}
|
|
19642
|
+
async append(bytes) {
|
|
19643
|
+
const { append } = this.fs;
|
|
19644
|
+
const recently = performance.now() - this.positionalAt < POSITIONAL_MS;
|
|
19645
|
+
if (!append || this.orphaned || this.revoked || bytes.length === 0 || recently) {
|
|
19646
|
+
const at = await this.size();
|
|
19647
|
+
return at + await this.pwrite(bytes, at);
|
|
19648
|
+
}
|
|
19649
|
+
await this.settled();
|
|
19650
|
+
await this.fits(await this.size() + bytes.length);
|
|
19651
|
+
await this.flush();
|
|
19652
|
+
const end = await this.followed(() => append.call(this.fs, this.path, bytes)).catch(
|
|
19653
|
+
(err) => {
|
|
19654
|
+
if (!positional(err)) throw err;
|
|
19655
|
+
return void 0;
|
|
19656
|
+
}
|
|
19657
|
+
);
|
|
19658
|
+
if (end === void 0) {
|
|
19659
|
+
this.positionalAt = performance.now();
|
|
19660
|
+
const at = await this.size();
|
|
19661
|
+
return at + await this.pwrite(bytes, at);
|
|
19662
|
+
}
|
|
19663
|
+
this.reread();
|
|
19664
|
+
return end;
|
|
19665
|
+
}
|
|
19666
|
+
positionalAt = Number.NEGATIVE_INFINITY;
|
|
19667
|
+
shared() {
|
|
19668
|
+
this.positionalAt = Number.NEGATIVE_INFINITY;
|
|
19669
|
+
}
|
|
19598
19670
|
async pwrite(bytes, at) {
|
|
19599
19671
|
if (bytes.length === 0) return 0;
|
|
19600
19672
|
await this.settled();
|
|
@@ -19683,6 +19755,9 @@ var VfsNode = class {
|
|
|
19683
19755
|
this.writeBackCost = performance.now() - started;
|
|
19684
19756
|
}
|
|
19685
19757
|
};
|
|
19758
|
+
function positional(err) {
|
|
19759
|
+
return err?.code === "ENOTSUP";
|
|
19760
|
+
}
|
|
19686
19761
|
var VfsNodes = class {
|
|
19687
19762
|
byPath = /* @__PURE__ */ new Map();
|
|
19688
19763
|
kept = /* @__PURE__ */ new Map();
|
|
@@ -19787,6 +19862,9 @@ var VfsNodes = class {
|
|
|
19787
19862
|
if (node.path === path) node.renamedTo(others[0]);
|
|
19788
19863
|
return true;
|
|
19789
19864
|
}
|
|
19865
|
+
shared() {
|
|
19866
|
+
for (const node of new Set(this.byPath.values())) node.shared();
|
|
19867
|
+
}
|
|
19790
19868
|
holdsAny() {
|
|
19791
19869
|
return this.byPath.size > 0;
|
|
19792
19870
|
}
|
|
@@ -20039,12 +20117,13 @@ function heldIo(fs, nodes, changed) {
|
|
|
20039
20117
|
return {
|
|
20040
20118
|
append: (path, bytes) => write(
|
|
20041
20119
|
path,
|
|
20042
|
-
|
|
20043
|
-
const at = await held.size();
|
|
20044
|
-
await held.pwrite(bytes, at);
|
|
20045
|
-
return at + bytes.length;
|
|
20046
|
-
},
|
|
20120
|
+
(held) => held.append(bytes),
|
|
20047
20121
|
async () => {
|
|
20122
|
+
const end = await fs.append?.(path, bytes).catch((err) => {
|
|
20123
|
+
if (!positional(err)) throw err;
|
|
20124
|
+
return void 0;
|
|
20125
|
+
});
|
|
20126
|
+
if (end !== void 0) return end;
|
|
20048
20127
|
const at = (await fs.stat(path)).size;
|
|
20049
20128
|
if (ranged2) await ranged2.pwrite(path, at, bytes, true);
|
|
20050
20129
|
else {
|
|
@@ -20193,8 +20272,8 @@ function vfsFile(fs, opts, nodes) {
|
|
|
20193
20272
|
return out;
|
|
20194
20273
|
}) : void 0,
|
|
20195
20274
|
write: writable2 ? (bytes) => serial(async () => {
|
|
20196
|
-
if (opts.flags & O_APPEND) offset = await node.
|
|
20197
|
-
offset += await node.pwrite(bytes, offset);
|
|
20275
|
+
if (opts.flags & O_APPEND) offset = await node.append(bytes);
|
|
20276
|
+
else offset += await node.pwrite(bytes, offset);
|
|
20198
20277
|
return bytes.length;
|
|
20199
20278
|
}) : void 0,
|
|
20200
20279
|
seek: (to, whence) => serial(async () => {
|
|
@@ -24812,6 +24891,7 @@ var OpfsFs = class {
|
|
|
24812
24891
|
mounts = {};
|
|
24813
24892
|
locks;
|
|
24814
24893
|
lockPrefix;
|
|
24894
|
+
appendPrefix;
|
|
24815
24895
|
rootName;
|
|
24816
24896
|
renamePrefix;
|
|
24817
24897
|
constructor(root, meta = new MemoryMeta(), channel, options = {}) {
|
|
@@ -24820,6 +24900,7 @@ var OpfsFs = class {
|
|
|
24820
24900
|
this.ranged = options.ranged === true;
|
|
24821
24901
|
this.locks = options.locks === void 0 ? lockManager() : options.locks ?? void 0;
|
|
24822
24902
|
this.lockPrefix = `slicc-excl:${channel ?? ""}:`;
|
|
24903
|
+
this.appendPrefix = `slicc-append:${escapeRoot(channel ?? "")}:`;
|
|
24823
24904
|
this.rootName = channel;
|
|
24824
24905
|
this.renamePrefix = `${RENAME_LOCK}${escapeRoot(channel ?? "")}:`;
|
|
24825
24906
|
this.channel = channel === void 0 ? void 0 : new BroadcastChannel(channel);
|
|
@@ -25713,11 +25794,43 @@ var OpfsFs = class {
|
|
|
25713
25794
|
if (this.renamesInFlight()) await this.writeWaits(at);
|
|
25714
25795
|
this.fileWrites.set(at, (this.fileWrites.get(at) ?? 0) + 1);
|
|
25715
25796
|
try {
|
|
25716
|
-
await this.truncated(path, size);
|
|
25797
|
+
await this.ending(path, () => this.truncated(path, size));
|
|
25798
|
+
} finally {
|
|
25799
|
+
this.writeEnded(at);
|
|
25800
|
+
}
|
|
25801
|
+
}
|
|
25802
|
+
async append(path, bytes) {
|
|
25803
|
+
if (!this.locks || !this.remote || !this.shared()) {
|
|
25804
|
+
throw fsError("ENOTSUP", `${path}: appended by position while no other tab shares the root`);
|
|
25805
|
+
}
|
|
25806
|
+
const at = normalizePath(path);
|
|
25807
|
+
if (this.renamesInFlight()) await this.writeWaits(at);
|
|
25808
|
+
this.fileWrites.set(at, (this.fileWrites.get(at) ?? 0) + 1);
|
|
25809
|
+
try {
|
|
25810
|
+
const found = await this.locate(path, true);
|
|
25811
|
+
if (found.handle?.kind !== "file") throw fsError(found.handle ? "EISDIR" : "ENOENT", path);
|
|
25812
|
+
this.refuse(found.path);
|
|
25813
|
+
const [entry] = await this.meta.get([found.path]);
|
|
25814
|
+
if (entry?.fifo || entry?.socket) throw fsError("ENXIO", path);
|
|
25815
|
+
const handle = found.handle;
|
|
25816
|
+
return await this.ending(found.path, async () => {
|
|
25817
|
+
const end = (await this.io(handle.getFile())).size;
|
|
25818
|
+
await this.writeAt(handle, found.path, path, end, bytes);
|
|
25819
|
+
return end + bytes.length;
|
|
25820
|
+
});
|
|
25717
25821
|
} finally {
|
|
25718
25822
|
this.writeEnded(at);
|
|
25719
25823
|
}
|
|
25720
25824
|
}
|
|
25825
|
+
async ending(path, op) {
|
|
25826
|
+
if (!this.locks || !this.remote || !this.shared()) return op();
|
|
25827
|
+
const physical = (await this.locate(path, true)).path;
|
|
25828
|
+
let result;
|
|
25829
|
+
await this.locks.request(`${this.appendPrefix}${physical}`, async () => {
|
|
25830
|
+
result = await op();
|
|
25831
|
+
});
|
|
25832
|
+
return result;
|
|
25833
|
+
}
|
|
25721
25834
|
async truncated(path, size) {
|
|
25722
25835
|
const handle = await this.existing(path, true);
|
|
25723
25836
|
await this.refuseNode(path, (await this.io(handle.getFile())).size === 0);
|
|
@@ -31684,7 +31797,10 @@ var Launcher = class {
|
|
|
31684
31797
|
peers.watch((crowded) => {
|
|
31685
31798
|
this.changes.flush();
|
|
31686
31799
|
this.changes.foreign(crowded);
|
|
31687
|
-
if (crowded)
|
|
31800
|
+
if (crowded) {
|
|
31801
|
+
void this.held?.bindIds((path) => this.rootFileId(path));
|
|
31802
|
+
for (const nodes of this.openFiles) nodes.shared();
|
|
31803
|
+
}
|
|
31688
31804
|
});
|
|
31689
31805
|
return {
|
|
31690
31806
|
...peers,
|