@ai-ecoverse/slicc-kernel 1.146.4 → 1.146.7
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/kernel-worker.js +97 -23
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +4 -2
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +97 -23
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +4 -2
- package/dist/process-worker.js.map +2 -2
- package/dist/types/fs/opfs.d.ts +1 -0
- package/dist/types/kernel/process.d.ts +2 -0
- package/dist/types/process/kernel-streams.d.ts +1 -0
- package/package.json +3 -3
package/dist/node.js
CHANGED
|
@@ -3305,7 +3305,7 @@ function satisfies(version, range2) {
|
|
|
3305
3305
|
}
|
|
3306
3306
|
|
|
3307
3307
|
// src/version.ts
|
|
3308
|
-
var KERNEL_VERSION = true ? "1.146.
|
|
3308
|
+
var KERNEL_VERSION = true ? "1.146.7" : "0.0.0-dev";
|
|
3309
3309
|
var OS_RELEASE = "6.0.0-slicc";
|
|
3310
3310
|
function procVersion() {
|
|
3311
3311
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -19829,15 +19829,7 @@ var WasmProcess = class {
|
|
|
19829
19829
|
}
|
|
19830
19830
|
});
|
|
19831
19831
|
} else {
|
|
19832
|
-
await this.
|
|
19833
|
-
() => this.openPath(req, marked),
|
|
19834
|
-
async (at) => {
|
|
19835
|
-
await this.stillOpen(at, req.handle);
|
|
19836
|
-
return nodes.identify(at);
|
|
19837
|
-
},
|
|
19838
|
-
(id2, at) => this.fds.installAt(fd, this.openVfsFile({ ...open, path: at }, id2, fs)),
|
|
19839
|
-
{ at: path, gen }
|
|
19840
|
-
);
|
|
19832
|
+
await this.openExisting(req, marked, fd, open, fs, { at: path, gen });
|
|
19841
19833
|
}
|
|
19842
19834
|
if (req.existing && !await present3(fs, path, true)) {
|
|
19843
19835
|
throw new KernelError("ENOENT");
|
|
@@ -19897,7 +19889,22 @@ var WasmProcess = class {
|
|
|
19897
19889
|
const inherited2 = req.orphan || req.contents !== void 0 || req.handle !== void 0;
|
|
19898
19890
|
if (guard2?.links === void 0 || !noLinks || inherited2 || req.pin !== void 0)
|
|
19899
19891
|
return void 0;
|
|
19900
|
-
|
|
19892
|
+
const follow2 = !req.exclusive && req.nofollow !== true;
|
|
19893
|
+
return (await walk(guard2.fs, this.cred, req.path, follow2, guard2.links)).path;
|
|
19894
|
+
}
|
|
19895
|
+
async openExisting(req, marked, fd, open, fs, first) {
|
|
19896
|
+
const nodes = this.nodes;
|
|
19897
|
+
const own = unfollowed(req);
|
|
19898
|
+
await this.unmissed(
|
|
19899
|
+
this.openPath.bind(this, req, marked),
|
|
19900
|
+
async (at) => {
|
|
19901
|
+
if (own) await notLink(this.options.fs, at);
|
|
19902
|
+
await this.stillOpen(at, req.handle);
|
|
19903
|
+
return nodes.identify(at);
|
|
19904
|
+
},
|
|
19905
|
+
(id2, at) => this.fds.installAt(fd, this.openVfsFile({ ...open, path: at }, id2, fs)),
|
|
19906
|
+
first
|
|
19907
|
+
);
|
|
19901
19908
|
}
|
|
19902
19909
|
async openPath(req, marked) {
|
|
19903
19910
|
const nodes = this.nodes;
|
|
@@ -19905,6 +19912,7 @@ var WasmProcess = class {
|
|
|
19905
19912
|
if (req.exclusive) return nodes.entryKey(marked ?? req.path);
|
|
19906
19913
|
if (marked !== void 0) return marked;
|
|
19907
19914
|
if (req.create) return nodes.targetKey(req.path);
|
|
19915
|
+
if (unfollowed(req)) return nodes.entryKey(req.path);
|
|
19908
19916
|
return this.keptOr(await nodes.targetKey(req.path), req.handle);
|
|
19909
19917
|
}
|
|
19910
19918
|
async mayOpen(req) {
|
|
@@ -20200,7 +20208,9 @@ var WasmProcess = class {
|
|
|
20200
20208
|
given = void 0;
|
|
20201
20209
|
await r?.settled(at);
|
|
20202
20210
|
const found = await look(at);
|
|
20203
|
-
if (!r || !r.missed(at) && !r.changedSince(at, gen)
|
|
20211
|
+
if (!r || !r.missed(at) && !r.changedSince(at, gen) && !r.inFlight?.(at)) {
|
|
20212
|
+
return make(found, at);
|
|
20213
|
+
}
|
|
20204
20214
|
}
|
|
20205
20215
|
}
|
|
20206
20216
|
async stillOpen(at, handle) {
|
|
@@ -20728,6 +20738,13 @@ var WasmProcess = class {
|
|
|
20728
20738
|
await this.options.http?.closeAll();
|
|
20729
20739
|
}
|
|
20730
20740
|
};
|
|
20741
|
+
function unfollowed(req) {
|
|
20742
|
+
return req.nofollow === true && req.handle === void 0;
|
|
20743
|
+
}
|
|
20744
|
+
async function notLink(fs, path) {
|
|
20745
|
+
const st = await fs.lstat?.(path);
|
|
20746
|
+
if (st?.isSymbolicLink) throw new KernelError("ELOOP");
|
|
20747
|
+
}
|
|
20731
20748
|
|
|
20732
20749
|
// src/kernel/protocol.ts
|
|
20733
20750
|
var WASM_PROCESS_INIT = "wasm-process-init";
|
|
@@ -23359,6 +23376,28 @@ function prefixes(path) {
|
|
|
23359
23376
|
function within9(path, root) {
|
|
23360
23377
|
return path === root || path.startsWith(`${root}/`);
|
|
23361
23378
|
}
|
|
23379
|
+
var unstored = () => Object.assign(new Error("the file system kept fewer bytes than were written"), {
|
|
23380
|
+
code: "ENOSPC"
|
|
23381
|
+
});
|
|
23382
|
+
var CHECKED_BYTES = 16 * 1024 * 1024;
|
|
23383
|
+
var Extent = class {
|
|
23384
|
+
floor = 0;
|
|
23385
|
+
exact;
|
|
23386
|
+
wrote(end) {
|
|
23387
|
+
this.floor = Math.max(this.floor, end);
|
|
23388
|
+
if (this.exact !== void 0) this.exact = Math.max(this.exact, end);
|
|
23389
|
+
}
|
|
23390
|
+
cut(size) {
|
|
23391
|
+
this.exact = size;
|
|
23392
|
+
this.floor = Math.min(this.floor, size);
|
|
23393
|
+
}
|
|
23394
|
+
big() {
|
|
23395
|
+
return Math.max(this.floor, this.exact ?? 0) >= CHECKED_BYTES;
|
|
23396
|
+
}
|
|
23397
|
+
check(size) {
|
|
23398
|
+
if (size < this.floor || this.exact !== void 0 && size < this.exact) throw unstored();
|
|
23399
|
+
}
|
|
23400
|
+
};
|
|
23362
23401
|
var LOCKED = /* @__PURE__ */ new Set(["NotReadableError", "NoModificationAllowedError", "InvalidStateError"]);
|
|
23363
23402
|
var SYNC_BACKOFF_MS = [5, 10, 20, 40, 80];
|
|
23364
23403
|
async function openSync(handle) {
|
|
@@ -23384,14 +23423,22 @@ function writeAll5(access2, at, bytes) {
|
|
|
23384
23423
|
}
|
|
23385
23424
|
}
|
|
23386
23425
|
async function positioned(handle, op) {
|
|
23426
|
+
const extent = new Extent();
|
|
23387
23427
|
const access2 = await openSync(handle);
|
|
23388
23428
|
if (access2) {
|
|
23389
23429
|
try {
|
|
23390
23430
|
op({
|
|
23391
|
-
write: (at, bytes) =>
|
|
23392
|
-
|
|
23431
|
+
write: (at, bytes) => {
|
|
23432
|
+
writeAll5(access2, at, bytes);
|
|
23433
|
+
extent.wrote(at + bytes.length);
|
|
23434
|
+
},
|
|
23435
|
+
truncate: (n) => {
|
|
23436
|
+
access2.truncate(n);
|
|
23437
|
+
extent.cut(n);
|
|
23438
|
+
}
|
|
23393
23439
|
});
|
|
23394
23440
|
access2.flush();
|
|
23441
|
+
if (access2.getSize) extent.check(access2.getSize());
|
|
23395
23442
|
} finally {
|
|
23396
23443
|
access2.close();
|
|
23397
23444
|
}
|
|
@@ -23400,14 +23447,25 @@ async function positioned(handle, op) {
|
|
|
23400
23447
|
const writable2 = await handle.createWritable({ keepExistingData: true });
|
|
23401
23448
|
try {
|
|
23402
23449
|
await op({
|
|
23403
|
-
write: (at, bytes) =>
|
|
23404
|
-
|
|
23450
|
+
write: async (at, bytes) => {
|
|
23451
|
+
await writable2.write({
|
|
23452
|
+
type: "write",
|
|
23453
|
+
position: at,
|
|
23454
|
+
data: bytes
|
|
23455
|
+
});
|
|
23456
|
+
extent.wrote(at + bytes.length);
|
|
23457
|
+
},
|
|
23458
|
+
truncate: async (n) => {
|
|
23459
|
+
await writable2.truncate(n);
|
|
23460
|
+
extent.cut(n);
|
|
23461
|
+
}
|
|
23405
23462
|
});
|
|
23406
23463
|
} catch (err) {
|
|
23407
23464
|
await writable2.abort();
|
|
23408
23465
|
throw err;
|
|
23409
23466
|
}
|
|
23410
23467
|
await writable2.close();
|
|
23468
|
+
if (extent.big()) extent.check((await handle.getFile()).size);
|
|
23411
23469
|
}
|
|
23412
23470
|
function isHandle(child) {
|
|
23413
23471
|
return "kind" in child;
|
|
@@ -24382,6 +24440,11 @@ var OpfsFs = class {
|
|
|
24382
24440
|
writable2 = await this.io(file.createWritable());
|
|
24383
24441
|
await writable2.write(content);
|
|
24384
24442
|
await writable2.close();
|
|
24443
|
+
if (typeof content !== "string" && content.length >= CHECKED_BYTES) {
|
|
24444
|
+
const extent = new Extent();
|
|
24445
|
+
extent.cut(content.length);
|
|
24446
|
+
extent.check((await file.getFile()).size);
|
|
24447
|
+
}
|
|
24385
24448
|
} catch (err) {
|
|
24386
24449
|
await writable2?.abort().catch(() => void 0);
|
|
24387
24450
|
throw translate(err, path, "commit", false);
|
|
@@ -25154,13 +25217,7 @@ var OpfsFs = class {
|
|
|
25154
25217
|
}
|
|
25155
25218
|
}
|
|
25156
25219
|
async place(handle, dir, name2, copies) {
|
|
25157
|
-
|
|
25158
|
-
if (move) this.others++;
|
|
25159
|
-
const moved2 = await move?.call(handle, dir, name2).then(
|
|
25160
|
-
() => true,
|
|
25161
|
-
() => false
|
|
25162
|
-
);
|
|
25163
|
-
if (moved2) return true;
|
|
25220
|
+
if (await this.moved(handle, dir, name2)) return true;
|
|
25164
25221
|
const before = this.fileMoves;
|
|
25165
25222
|
try {
|
|
25166
25223
|
await this.copy(handle, dir, name2, copies);
|
|
@@ -25173,6 +25230,23 @@ var OpfsFs = class {
|
|
|
25173
25230
|
return false;
|
|
25174
25231
|
}
|
|
25175
25232
|
fileMoves = 0;
|
|
25233
|
+
async moved(handle, dir, name2) {
|
|
25234
|
+
const move = handle.move;
|
|
25235
|
+
if (!move) return false;
|
|
25236
|
+
for (let attempt = 0; ; attempt++) {
|
|
25237
|
+
this.others++;
|
|
25238
|
+
const failed3 = await move.call(handle, dir, name2).then(
|
|
25239
|
+
() => void 0,
|
|
25240
|
+
(err) => ({ err })
|
|
25241
|
+
);
|
|
25242
|
+
if (!failed3) return true;
|
|
25243
|
+
const error = failed3.err?.name;
|
|
25244
|
+
if (handle.kind !== "file" || !LOCKED.has(error)) return false;
|
|
25245
|
+
const delay = SYNC_BACKOFF_MS[attempt];
|
|
25246
|
+
if (delay === void 0) throw fsError("EBUSY", name2);
|
|
25247
|
+
await new Promise((resolve2) => setTimeout(resolve2, delay));
|
|
25248
|
+
}
|
|
25249
|
+
}
|
|
25176
25250
|
async copy(handle, dir, name2, copies, rest2 = "") {
|
|
25177
25251
|
if (handle.kind === "file" && movable(handle)) {
|
|
25178
25252
|
this.others++;
|