@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
package/dist/process-worker.js
CHANGED
|
@@ -634,11 +634,46 @@ var init_pages = __esm({
|
|
|
634
634
|
});
|
|
635
635
|
|
|
636
636
|
// src/fs/ranged.ts
|
|
637
|
-
|
|
637
|
+
function linkedWatch(watch, st) {
|
|
638
|
+
if ((st.nlink ?? 1) < 2) return watch;
|
|
639
|
+
watch.linked = true;
|
|
640
|
+
watch.sig = signatureOf(st);
|
|
641
|
+
return watch;
|
|
642
|
+
}
|
|
643
|
+
function viaAlias(watch, seen, path) {
|
|
644
|
+
if (watch.resolved === void 0) {
|
|
645
|
+
let real;
|
|
646
|
+
try {
|
|
647
|
+
real = watch.real?.();
|
|
648
|
+
} catch {
|
|
649
|
+
}
|
|
650
|
+
watch.resolved = real && real !== path ? real : null;
|
|
651
|
+
}
|
|
652
|
+
return watch.resolved !== null && watch.view.changedSince(seen, watch.resolved).changed;
|
|
653
|
+
}
|
|
654
|
+
function viaLink(watch, path) {
|
|
655
|
+
if (!watch.linked) return false;
|
|
656
|
+
let sig;
|
|
657
|
+
try {
|
|
658
|
+
sig = signatureOf(watch.stat(path));
|
|
659
|
+
} catch {
|
|
660
|
+
return false;
|
|
661
|
+
}
|
|
662
|
+
if (sig === watch.sig) return false;
|
|
663
|
+
watch.sig = sig;
|
|
664
|
+
return true;
|
|
665
|
+
}
|
|
666
|
+
function watchedChange(watch, seen, path) {
|
|
667
|
+
const said = watch.view.changedSince(seen, path);
|
|
668
|
+
if (said.changed || said.now === seen) return said;
|
|
669
|
+
return { now: said.now, changed: viaAlias(watch, seen, path) || viaLink(watch, path) };
|
|
670
|
+
}
|
|
671
|
+
var signatureOf, RangedFile;
|
|
638
672
|
var init_ranged = __esm({
|
|
639
673
|
"src/fs/ranged.ts"() {
|
|
640
674
|
"use strict";
|
|
641
675
|
init_pages();
|
|
676
|
+
signatureOf = (st) => `${st.version ?? ""}:${st.size}:${st.mtimeMs ?? ""}`;
|
|
642
677
|
RangedFile = class {
|
|
643
678
|
pages;
|
|
644
679
|
io;
|
|
@@ -658,7 +693,7 @@ var init_ranged = __esm({
|
|
|
658
693
|
fresh() {
|
|
659
694
|
const watch = this.watch;
|
|
660
695
|
if (!watch || this.pinned) return;
|
|
661
|
-
const { now, changed: changed2 } = watch
|
|
696
|
+
const { now, changed: changed2 } = watchedChange(watch, this.seen, this.path);
|
|
662
697
|
this.seen = now;
|
|
663
698
|
if (!changed2) return;
|
|
664
699
|
let st;
|
|
@@ -1288,7 +1323,8 @@ function toMs(v) {
|
|
|
1288
1323
|
}
|
|
1289
1324
|
function needsLoad(s, view, path) {
|
|
1290
1325
|
if (s.loaded && view && !s.dirty) {
|
|
1291
|
-
const {
|
|
1326
|
+
const watch = s.watch ?? { view, stat: () => ({ size: s.len }) };
|
|
1327
|
+
const { now, changed: changed2 } = watchedChange(watch, s.seen ?? 0, path());
|
|
1292
1328
|
s.seen = now;
|
|
1293
1329
|
if (changed2) {
|
|
1294
1330
|
s.loaded = false;
|
|
@@ -1299,11 +1335,15 @@ function needsLoad(s, view, path) {
|
|
|
1299
1335
|
s.seen = view?.now();
|
|
1300
1336
|
return true;
|
|
1301
1337
|
}
|
|
1338
|
+
function loadedWatch(bridge, call2, path, st) {
|
|
1339
|
+
const view = bridge.changes;
|
|
1340
|
+
return view && linkedWatch({ view, stat: () => call2(() => bridge.stat(path())) }, st);
|
|
1341
|
+
}
|
|
1302
1342
|
function rangedFileOf(bridge, call2, path, io) {
|
|
1303
1343
|
const seen = bridge.changes?.now();
|
|
1304
1344
|
const stat = () => call2(() => bridge.stat(path()));
|
|
1305
1345
|
const st = stat();
|
|
1306
|
-
const watch = bridge.changes && { view: bridge.changes, ino: st.ino, seen, stat };
|
|
1346
|
+
const watch = bridge.changes && linkedWatch({ view: bridge.changes, ino: st.ino, seen, stat }, st);
|
|
1307
1347
|
return new RangedFile(io, path(), st.size, st.version, watch);
|
|
1308
1348
|
}
|
|
1309
1349
|
function unlessIo(op) {
|
|
@@ -1463,10 +1503,10 @@ function createHelpers(Fs, ops) {
|
|
|
1463
1503
|
function ensureLoaded(node) {
|
|
1464
1504
|
const s = node.live;
|
|
1465
1505
|
if (!needsLoad(s, bridgeOf(node).changes, () => liveNodePath(linked.holder(node)))) return;
|
|
1466
|
-
const
|
|
1467
|
-
|
|
1468
|
-
s
|
|
1469
|
-
s.
|
|
1506
|
+
const path = () => liveNodePath(linked.holder(node));
|
|
1507
|
+
const bytes = call2(() => fileIo(node).readFile(path()));
|
|
1508
|
+
Object.assign(s, { data: bytes, len: bytes.length, loaded: true });
|
|
1509
|
+
s.watch = loadedWatch(bridgeOf(node), call2, path, s.stat ?? { size: bytes.length });
|
|
1470
1510
|
}
|
|
1471
1511
|
function rangedOf(node) {
|
|
1472
1512
|
const s = node.live;
|
|
@@ -2414,7 +2454,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
2414
2454
|
var init_version = __esm({
|
|
2415
2455
|
"src/version.ts"() {
|
|
2416
2456
|
"use strict";
|
|
2417
|
-
KERNEL_VERSION = true ? "1.98.
|
|
2457
|
+
KERNEL_VERSION = true ? "1.98.2" : "0.0.0-dev";
|
|
2418
2458
|
OS_RELEASE = "6.0.0-slicc";
|
|
2419
2459
|
}
|
|
2420
2460
|
});
|
|
@@ -6101,6 +6141,28 @@ function physical(fs, path) {
|
|
|
6101
6141
|
}
|
|
6102
6142
|
return `/${done.join("/")}`;
|
|
6103
6143
|
}
|
|
6144
|
+
function realOf(fs, path) {
|
|
6145
|
+
let done = [];
|
|
6146
|
+
let todo = path.split("/").filter((part) => part !== "" && part !== ".");
|
|
6147
|
+
let hops = 0;
|
|
6148
|
+
while (todo.length > 0) {
|
|
6149
|
+
const part = todo.shift();
|
|
6150
|
+
if (part === "..") {
|
|
6151
|
+
done.pop();
|
|
6152
|
+
continue;
|
|
6153
|
+
}
|
|
6154
|
+
const at = `/${[...done, part].join("/")}`;
|
|
6155
|
+
if (!fs.lstat(at).isSymbolicLink) {
|
|
6156
|
+
done.push(part);
|
|
6157
|
+
continue;
|
|
6158
|
+
}
|
|
6159
|
+
if (++hops > MAX_LINKS) throw new WasiError("ELOOP");
|
|
6160
|
+
const target = fs.readlink(at);
|
|
6161
|
+
if (target.startsWith("/")) done = [];
|
|
6162
|
+
todo = [...target.split("/").filter((p) => p !== "" && p !== "."), ...todo];
|
|
6163
|
+
}
|
|
6164
|
+
return `/${done.join("/")}`;
|
|
6165
|
+
}
|
|
6104
6166
|
function resolveUnder(dir, path) {
|
|
6105
6167
|
return normalize(path.startsWith("/") ? path : `${dir}/${path}`);
|
|
6106
6168
|
}
|
|
@@ -6319,8 +6381,8 @@ var init_wasi_files = __esm({
|
|
|
6319
6381
|
}
|
|
6320
6382
|
load() {
|
|
6321
6383
|
const view = this.watch?.view;
|
|
6322
|
-
if (this.data && view && !this.dirty) {
|
|
6323
|
-
const { now, changed: changed2 } =
|
|
6384
|
+
if (this.data && view && this.watch && !this.dirty) {
|
|
6385
|
+
const { now, changed: changed2 } = watchedChange(this.watch, this.seen, this.path);
|
|
6324
6386
|
this.seen = now;
|
|
6325
6387
|
if (changed2) this.data = void 0;
|
|
6326
6388
|
}
|
|
@@ -6690,6 +6752,7 @@ var SYNTHETIC_DIRS2, O_NONBLOCK2, O_WRONLY5, O_RDWR4, O_APPEND2, SEALED_PATH2, C
|
|
|
6690
6752
|
var init_wasi_fds = __esm({
|
|
6691
6753
|
"src/process/wasi/wasi-fds.ts"() {
|
|
6692
6754
|
"use strict";
|
|
6755
|
+
init_ranged();
|
|
6693
6756
|
init_fd_table();
|
|
6694
6757
|
init_sync_fs_wire();
|
|
6695
6758
|
init_wasi_abi();
|
|
@@ -7300,15 +7363,19 @@ var init_wasi_fds = __esm({
|
|
|
7300
7363
|
const handle = this.fs.hold?.(path, true, true, void 0, this.fs.owners ? asked : 0);
|
|
7301
7364
|
const io = handle !== void 0 && this.fs.pinned ? this.fs.pinned(handle) : this.fs;
|
|
7302
7365
|
const view = this.fs.changes;
|
|
7303
|
-
const watch = view &&
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7366
|
+
const watch = view && linkedWatch(
|
|
7367
|
+
{
|
|
7368
|
+
view,
|
|
7369
|
+
ino: st.ino,
|
|
7370
|
+
seen,
|
|
7371
|
+
stat: (at) => {
|
|
7372
|
+
this.fs.invalidate?.();
|
|
7373
|
+
return this.fs.stat(at);
|
|
7374
|
+
},
|
|
7375
|
+
real: () => realOf(this.fs, path)
|
|
7376
|
+
},
|
|
7377
|
+
st
|
|
7378
|
+
);
|
|
7312
7379
|
const buffer = new FileBuffer(io, path, empty, st.maxFile, ranged, st.version, watch);
|
|
7313
7380
|
buffer.handle = handle;
|
|
7314
7381
|
this.buffers.set(path, buffer);
|