@ai-ecoverse/slicc-kernel 1.146.4 → 1.146.6
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 +79 -16
- 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 +79 -16
- 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/kernel/process.d.ts +2 -0
- package/dist/types/process/kernel-streams.d.ts +1 -0
- package/package.json +3 -3
package/dist/kernel-worker.js
CHANGED
|
@@ -1376,6 +1376,28 @@ function prefixes(path) {
|
|
|
1376
1376
|
function within2(path, root) {
|
|
1377
1377
|
return path === root || path.startsWith(`${root}/`);
|
|
1378
1378
|
}
|
|
1379
|
+
var unstored = () => Object.assign(new Error("the file system kept fewer bytes than were written"), {
|
|
1380
|
+
code: "ENOSPC"
|
|
1381
|
+
});
|
|
1382
|
+
var CHECKED_BYTES = 16 * 1024 * 1024;
|
|
1383
|
+
var Extent = class {
|
|
1384
|
+
floor = 0;
|
|
1385
|
+
exact;
|
|
1386
|
+
wrote(end) {
|
|
1387
|
+
this.floor = Math.max(this.floor, end);
|
|
1388
|
+
if (this.exact !== void 0) this.exact = Math.max(this.exact, end);
|
|
1389
|
+
}
|
|
1390
|
+
cut(size) {
|
|
1391
|
+
this.exact = size;
|
|
1392
|
+
this.floor = Math.min(this.floor, size);
|
|
1393
|
+
}
|
|
1394
|
+
big() {
|
|
1395
|
+
return Math.max(this.floor, this.exact ?? 0) >= CHECKED_BYTES;
|
|
1396
|
+
}
|
|
1397
|
+
check(size) {
|
|
1398
|
+
if (size < this.floor || this.exact !== void 0 && size < this.exact) throw unstored();
|
|
1399
|
+
}
|
|
1400
|
+
};
|
|
1379
1401
|
var LOCKED = /* @__PURE__ */ new Set(["NotReadableError", "NoModificationAllowedError", "InvalidStateError"]);
|
|
1380
1402
|
var SYNC_BACKOFF_MS = [5, 10, 20, 40, 80];
|
|
1381
1403
|
async function openSync(handle) {
|
|
@@ -1401,14 +1423,22 @@ function writeAll(access2, at, bytes) {
|
|
|
1401
1423
|
}
|
|
1402
1424
|
}
|
|
1403
1425
|
async function positioned(handle, op) {
|
|
1426
|
+
const extent = new Extent();
|
|
1404
1427
|
const access2 = await openSync(handle);
|
|
1405
1428
|
if (access2) {
|
|
1406
1429
|
try {
|
|
1407
1430
|
op({
|
|
1408
|
-
write: (at, bytes) =>
|
|
1409
|
-
|
|
1431
|
+
write: (at, bytes) => {
|
|
1432
|
+
writeAll(access2, at, bytes);
|
|
1433
|
+
extent.wrote(at + bytes.length);
|
|
1434
|
+
},
|
|
1435
|
+
truncate: (n) => {
|
|
1436
|
+
access2.truncate(n);
|
|
1437
|
+
extent.cut(n);
|
|
1438
|
+
}
|
|
1410
1439
|
});
|
|
1411
1440
|
access2.flush();
|
|
1441
|
+
if (access2.getSize) extent.check(access2.getSize());
|
|
1412
1442
|
} finally {
|
|
1413
1443
|
access2.close();
|
|
1414
1444
|
}
|
|
@@ -1417,14 +1447,25 @@ async function positioned(handle, op) {
|
|
|
1417
1447
|
const writable2 = await handle.createWritable({ keepExistingData: true });
|
|
1418
1448
|
try {
|
|
1419
1449
|
await op({
|
|
1420
|
-
write: (at, bytes) =>
|
|
1421
|
-
|
|
1450
|
+
write: async (at, bytes) => {
|
|
1451
|
+
await writable2.write({
|
|
1452
|
+
type: "write",
|
|
1453
|
+
position: at,
|
|
1454
|
+
data: bytes
|
|
1455
|
+
});
|
|
1456
|
+
extent.wrote(at + bytes.length);
|
|
1457
|
+
},
|
|
1458
|
+
truncate: async (n) => {
|
|
1459
|
+
await writable2.truncate(n);
|
|
1460
|
+
extent.cut(n);
|
|
1461
|
+
}
|
|
1422
1462
|
});
|
|
1423
1463
|
} catch (err) {
|
|
1424
1464
|
await writable2.abort();
|
|
1425
1465
|
throw err;
|
|
1426
1466
|
}
|
|
1427
1467
|
await writable2.close();
|
|
1468
|
+
if (extent.big()) extent.check((await handle.getFile()).size);
|
|
1428
1469
|
}
|
|
1429
1470
|
function syncAccessHandles(scope = globalThis) {
|
|
1430
1471
|
const handle = scope.FileSystemFileHandle;
|
|
@@ -2403,6 +2444,11 @@ var OpfsFs = class {
|
|
|
2403
2444
|
writable2 = await this.io(file.createWritable());
|
|
2404
2445
|
await writable2.write(content);
|
|
2405
2446
|
await writable2.close();
|
|
2447
|
+
if (typeof content !== "string" && content.length >= CHECKED_BYTES) {
|
|
2448
|
+
const extent = new Extent();
|
|
2449
|
+
extent.cut(content.length);
|
|
2450
|
+
extent.check((await file.getFile()).size);
|
|
2451
|
+
}
|
|
2406
2452
|
} catch (err) {
|
|
2407
2453
|
await writable2?.abort().catch(() => void 0);
|
|
2408
2454
|
throw translate(err, path, "commit", false);
|
|
@@ -7728,7 +7774,7 @@ function satisfies(version, range2) {
|
|
|
7728
7774
|
}
|
|
7729
7775
|
|
|
7730
7776
|
// src/version.ts
|
|
7731
|
-
var KERNEL_VERSION = true ? "1.146.
|
|
7777
|
+
var KERNEL_VERSION = true ? "1.146.6" : "0.0.0-dev";
|
|
7732
7778
|
var OS_RELEASE = "6.0.0-slicc";
|
|
7733
7779
|
function procVersion() {
|
|
7734
7780
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -23831,15 +23877,7 @@ var WasmProcess = class {
|
|
|
23831
23877
|
}
|
|
23832
23878
|
});
|
|
23833
23879
|
} else {
|
|
23834
|
-
await this.
|
|
23835
|
-
() => this.openPath(req, marked),
|
|
23836
|
-
async (at) => {
|
|
23837
|
-
await this.stillOpen(at, req.handle);
|
|
23838
|
-
return nodes.identify(at);
|
|
23839
|
-
},
|
|
23840
|
-
(id2, at) => this.fds.installAt(fd, this.openVfsFile({ ...open2, path: at }, id2, fs)),
|
|
23841
|
-
{ at: path, gen }
|
|
23842
|
-
);
|
|
23880
|
+
await this.openExisting(req, marked, fd, open2, fs, { at: path, gen });
|
|
23843
23881
|
}
|
|
23844
23882
|
if (req.existing && !await present3(fs, path, true)) {
|
|
23845
23883
|
throw new KernelError("ENOENT");
|
|
@@ -23899,7 +23937,22 @@ var WasmProcess = class {
|
|
|
23899
23937
|
const inherited2 = req.orphan || req.contents !== void 0 || req.handle !== void 0;
|
|
23900
23938
|
if (guard2?.links === void 0 || !noLinks || inherited2 || req.pin !== void 0)
|
|
23901
23939
|
return void 0;
|
|
23902
|
-
|
|
23940
|
+
const follow2 = !req.exclusive && req.nofollow !== true;
|
|
23941
|
+
return (await walk(guard2.fs, this.cred, req.path, follow2, guard2.links)).path;
|
|
23942
|
+
}
|
|
23943
|
+
async openExisting(req, marked, fd, open2, fs, first) {
|
|
23944
|
+
const nodes = this.nodes;
|
|
23945
|
+
const own = unfollowed(req);
|
|
23946
|
+
await this.unmissed(
|
|
23947
|
+
this.openPath.bind(this, req, marked),
|
|
23948
|
+
async (at) => {
|
|
23949
|
+
if (own) await notLink(this.options.fs, at);
|
|
23950
|
+
await this.stillOpen(at, req.handle);
|
|
23951
|
+
return nodes.identify(at);
|
|
23952
|
+
},
|
|
23953
|
+
(id2, at) => this.fds.installAt(fd, this.openVfsFile({ ...open2, path: at }, id2, fs)),
|
|
23954
|
+
first
|
|
23955
|
+
);
|
|
23903
23956
|
}
|
|
23904
23957
|
async openPath(req, marked) {
|
|
23905
23958
|
const nodes = this.nodes;
|
|
@@ -23907,6 +23960,7 @@ var WasmProcess = class {
|
|
|
23907
23960
|
if (req.exclusive) return nodes.entryKey(marked ?? req.path);
|
|
23908
23961
|
if (marked !== void 0) return marked;
|
|
23909
23962
|
if (req.create) return nodes.targetKey(req.path);
|
|
23963
|
+
if (unfollowed(req)) return nodes.entryKey(req.path);
|
|
23910
23964
|
return this.keptOr(await nodes.targetKey(req.path), req.handle);
|
|
23911
23965
|
}
|
|
23912
23966
|
async mayOpen(req) {
|
|
@@ -24202,7 +24256,9 @@ var WasmProcess = class {
|
|
|
24202
24256
|
given = void 0;
|
|
24203
24257
|
await r?.settled(at);
|
|
24204
24258
|
const found = await look(at);
|
|
24205
|
-
if (!r || !r.missed(at) && !r.changedSince(at, gen)
|
|
24259
|
+
if (!r || !r.missed(at) && !r.changedSince(at, gen) && !r.inFlight?.(at)) {
|
|
24260
|
+
return make(found, at);
|
|
24261
|
+
}
|
|
24206
24262
|
}
|
|
24207
24263
|
}
|
|
24208
24264
|
async stillOpen(at, handle) {
|
|
@@ -24730,6 +24786,13 @@ var WasmProcess = class {
|
|
|
24730
24786
|
await this.options.http?.closeAll();
|
|
24731
24787
|
}
|
|
24732
24788
|
};
|
|
24789
|
+
function unfollowed(req) {
|
|
24790
|
+
return req.nofollow === true && req.handle === void 0;
|
|
24791
|
+
}
|
|
24792
|
+
async function notLink(fs, path) {
|
|
24793
|
+
const st = await fs.lstat?.(path);
|
|
24794
|
+
if (st?.isSymbolicLink) throw new KernelError("ELOOP");
|
|
24795
|
+
}
|
|
24733
24796
|
|
|
24734
24797
|
// src/kernel/protocol.ts
|
|
24735
24798
|
var WASM_PROCESS_INIT = "wasm-process-init";
|