@ai-ecoverse/slicc-kernel 1.98.0 → 1.98.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/README.md +2 -2
- package/dist/kernel-worker.js +155 -35
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +87 -20
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +155 -35
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +87 -20
- package/dist/process-worker.js.map +2 -2
- package/package.json +2 -2
|
@@ -433,11 +433,46 @@ var init_pages = __esm({
|
|
|
433
433
|
});
|
|
434
434
|
|
|
435
435
|
// src/fs/ranged.ts
|
|
436
|
-
|
|
436
|
+
function linkedWatch(watch, st) {
|
|
437
|
+
if ((st.nlink ?? 1) < 2) return watch;
|
|
438
|
+
watch.linked = true;
|
|
439
|
+
watch.sig = signatureOf(st);
|
|
440
|
+
return watch;
|
|
441
|
+
}
|
|
442
|
+
function viaAlias(watch, seen, path) {
|
|
443
|
+
if (watch.resolved === void 0) {
|
|
444
|
+
let real;
|
|
445
|
+
try {
|
|
446
|
+
real = watch.real?.();
|
|
447
|
+
} catch {
|
|
448
|
+
}
|
|
449
|
+
watch.resolved = real && real !== path ? real : null;
|
|
450
|
+
}
|
|
451
|
+
return watch.resolved !== null && watch.view.changedSince(seen, watch.resolved).changed;
|
|
452
|
+
}
|
|
453
|
+
function viaLink(watch, path) {
|
|
454
|
+
if (!watch.linked) return false;
|
|
455
|
+
let sig;
|
|
456
|
+
try {
|
|
457
|
+
sig = signatureOf(watch.stat(path));
|
|
458
|
+
} catch {
|
|
459
|
+
return false;
|
|
460
|
+
}
|
|
461
|
+
if (sig === watch.sig) return false;
|
|
462
|
+
watch.sig = sig;
|
|
463
|
+
return true;
|
|
464
|
+
}
|
|
465
|
+
function watchedChange(watch, seen, path) {
|
|
466
|
+
const said = watch.view.changedSince(seen, path);
|
|
467
|
+
if (said.changed || said.now === seen) return said;
|
|
468
|
+
return { now: said.now, changed: viaAlias(watch, seen, path) || viaLink(watch, path) };
|
|
469
|
+
}
|
|
470
|
+
var signatureOf, RangedFile;
|
|
437
471
|
var init_ranged = __esm({
|
|
438
472
|
"src/fs/ranged.ts"() {
|
|
439
473
|
"use strict";
|
|
440
474
|
init_pages();
|
|
475
|
+
signatureOf = (st) => `${st.version ?? ""}:${st.size}:${st.mtimeMs ?? ""}`;
|
|
441
476
|
RangedFile = class {
|
|
442
477
|
pages;
|
|
443
478
|
io;
|
|
@@ -457,7 +492,7 @@ var init_ranged = __esm({
|
|
|
457
492
|
fresh() {
|
|
458
493
|
const watch = this.watch;
|
|
459
494
|
if (!watch || this.pinned) return;
|
|
460
|
-
const { now, changed: changed2 } = watch
|
|
495
|
+
const { now, changed: changed2 } = watchedChange(watch, this.seen, this.path);
|
|
461
496
|
this.seen = now;
|
|
462
497
|
if (!changed2) return;
|
|
463
498
|
let st;
|
|
@@ -568,6 +603,28 @@ function physical(fs, path) {
|
|
|
568
603
|
}
|
|
569
604
|
return `/${done.join("/")}`;
|
|
570
605
|
}
|
|
606
|
+
function realOf(fs, path) {
|
|
607
|
+
let done = [];
|
|
608
|
+
let todo = path.split("/").filter((part) => part !== "" && part !== ".");
|
|
609
|
+
let hops = 0;
|
|
610
|
+
while (todo.length > 0) {
|
|
611
|
+
const part = todo.shift();
|
|
612
|
+
if (part === "..") {
|
|
613
|
+
done.pop();
|
|
614
|
+
continue;
|
|
615
|
+
}
|
|
616
|
+
const at = `/${[...done, part].join("/")}`;
|
|
617
|
+
if (!fs.lstat(at).isSymbolicLink) {
|
|
618
|
+
done.push(part);
|
|
619
|
+
continue;
|
|
620
|
+
}
|
|
621
|
+
if (++hops > MAX_LINKS) throw new WasiError("ELOOP");
|
|
622
|
+
const target = fs.readlink(at);
|
|
623
|
+
if (target.startsWith("/")) done = [];
|
|
624
|
+
todo = [...target.split("/").filter((p) => p !== "" && p !== "."), ...todo];
|
|
625
|
+
}
|
|
626
|
+
return `/${done.join("/")}`;
|
|
627
|
+
}
|
|
571
628
|
function resolveUnder(dir, path) {
|
|
572
629
|
return normalize(path.startsWith("/") ? path : `${dir}/${path}`);
|
|
573
630
|
}
|
|
@@ -786,8 +843,8 @@ var init_wasi_files = __esm({
|
|
|
786
843
|
}
|
|
787
844
|
load() {
|
|
788
845
|
const view = this.watch?.view;
|
|
789
|
-
if (this.data && view && !this.dirty) {
|
|
790
|
-
const { now, changed: changed2 } =
|
|
846
|
+
if (this.data && view && this.watch && !this.dirty) {
|
|
847
|
+
const { now, changed: changed2 } = watchedChange(this.watch, this.seen, this.path);
|
|
791
848
|
this.seen = now;
|
|
792
849
|
if (changed2) this.data = void 0;
|
|
793
850
|
}
|
|
@@ -1606,6 +1663,7 @@ var SYNTHETIC_DIRS, O_NONBLOCK, O_WRONLY, O_RDWR, O_APPEND, SEALED_PATH, CLIPBOA
|
|
|
1606
1663
|
var init_wasi_fds = __esm({
|
|
1607
1664
|
"src/process/wasi/wasi-fds.ts"() {
|
|
1608
1665
|
"use strict";
|
|
1666
|
+
init_ranged();
|
|
1609
1667
|
init_fd_table();
|
|
1610
1668
|
init_sync_fs_wire();
|
|
1611
1669
|
init_wasi_abi();
|
|
@@ -2216,15 +2274,19 @@ var init_wasi_fds = __esm({
|
|
|
2216
2274
|
const handle = this.fs.hold?.(path, true, true, void 0, this.fs.owners ? asked : 0);
|
|
2217
2275
|
const io = handle !== void 0 && this.fs.pinned ? this.fs.pinned(handle) : this.fs;
|
|
2218
2276
|
const view = this.fs.changes;
|
|
2219
|
-
const watch = view &&
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2277
|
+
const watch = view && linkedWatch(
|
|
2278
|
+
{
|
|
2279
|
+
view,
|
|
2280
|
+
ino: st.ino,
|
|
2281
|
+
seen,
|
|
2282
|
+
stat: (at) => {
|
|
2283
|
+
this.fs.invalidate?.();
|
|
2284
|
+
return this.fs.stat(at);
|
|
2285
|
+
},
|
|
2286
|
+
real: () => realOf(this.fs, path)
|
|
2287
|
+
},
|
|
2288
|
+
st
|
|
2289
|
+
);
|
|
2228
2290
|
const buffer = new FileBuffer(io, path, empty, st.maxFile, ranged, st.version, watch);
|
|
2229
2291
|
buffer.handle = handle;
|
|
2230
2292
|
this.buffers.set(path, buffer);
|
|
@@ -4529,7 +4591,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
4529
4591
|
var init_version = __esm({
|
|
4530
4592
|
"src/version.ts"() {
|
|
4531
4593
|
"use strict";
|
|
4532
|
-
KERNEL_VERSION = true ? "1.98.
|
|
4594
|
+
KERNEL_VERSION = true ? "1.98.2" : "0.0.0-dev";
|
|
4533
4595
|
OS_RELEASE = "6.0.0-slicc";
|
|
4534
4596
|
}
|
|
4535
4597
|
});
|
|
@@ -6473,7 +6535,8 @@ function toMs(v) {
|
|
|
6473
6535
|
}
|
|
6474
6536
|
function needsLoad(s, view, path) {
|
|
6475
6537
|
if (s.loaded && view && !s.dirty) {
|
|
6476
|
-
const {
|
|
6538
|
+
const watch = s.watch ?? { view, stat: () => ({ size: s.len }) };
|
|
6539
|
+
const { now, changed: changed2 } = watchedChange(watch, s.seen ?? 0, path());
|
|
6477
6540
|
s.seen = now;
|
|
6478
6541
|
if (changed2) {
|
|
6479
6542
|
s.loaded = false;
|
|
@@ -6484,11 +6547,15 @@ function needsLoad(s, view, path) {
|
|
|
6484
6547
|
s.seen = view?.now();
|
|
6485
6548
|
return true;
|
|
6486
6549
|
}
|
|
6550
|
+
function loadedWatch(bridge, call2, path, st) {
|
|
6551
|
+
const view = bridge.changes;
|
|
6552
|
+
return view && linkedWatch({ view, stat: () => call2(() => bridge.stat(path())) }, st);
|
|
6553
|
+
}
|
|
6487
6554
|
function rangedFileOf(bridge, call2, path, io) {
|
|
6488
6555
|
const seen = bridge.changes?.now();
|
|
6489
6556
|
const stat = () => call2(() => bridge.stat(path()));
|
|
6490
6557
|
const st = stat();
|
|
6491
|
-
const watch = bridge.changes && { view: bridge.changes, ino: st.ino, seen, stat };
|
|
6558
|
+
const watch = bridge.changes && linkedWatch({ view: bridge.changes, ino: st.ino, seen, stat }, st);
|
|
6492
6559
|
return new RangedFile(io, path(), st.size, st.version, watch);
|
|
6493
6560
|
}
|
|
6494
6561
|
function unlessIo(op) {
|
|
@@ -6648,10 +6715,10 @@ function createHelpers(Fs, ops) {
|
|
|
6648
6715
|
function ensureLoaded(node) {
|
|
6649
6716
|
const s = node.live;
|
|
6650
6717
|
if (!needsLoad(s, bridgeOf(node).changes, () => liveNodePath(linked.holder(node)))) return;
|
|
6651
|
-
const
|
|
6652
|
-
|
|
6653
|
-
s
|
|
6654
|
-
s.
|
|
6718
|
+
const path = () => liveNodePath(linked.holder(node));
|
|
6719
|
+
const bytes = call2(() => fileIo(node).readFile(path()));
|
|
6720
|
+
Object.assign(s, { data: bytes, len: bytes.length, loaded: true });
|
|
6721
|
+
s.watch = loadedWatch(bridgeOf(node), call2, path, s.stat ?? { size: bytes.length });
|
|
6655
6722
|
}
|
|
6656
6723
|
function rangedOf(node) {
|
|
6657
6724
|
const s = node.live;
|