@ai-ecoverse/slicc-kernel 1.167.1 → 1.167.3
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 +1 -1
- package/dist/kernel-worker.js +91 -25
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.cjs +34 -12
- package/dist/node-process-worker.cjs.map +3 -3
- package/dist/node-process-worker.js +34 -12
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +91 -25
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +34 -12
- package/dist/process-worker.js.map +3 -3
- package/dist/types/fs/ranged.d.ts +1 -0
- package/dist/types/kernel/vfs-file.d.ts +6 -0
- package/dist/types/launcher.d.ts +3 -0
- package/dist/types/process/wasi/wasi-files.d.ts +3 -0
- package/dist/types/realm/sync-fs-wire.d.ts +1 -0
- package/package.json +10 -4
package/dist/node.js
CHANGED
|
@@ -3684,7 +3684,7 @@ function satisfies(version, range2) {
|
|
|
3684
3684
|
}
|
|
3685
3685
|
|
|
3686
3686
|
// src/version.ts
|
|
3687
|
-
var KERNEL_VERSION = true ? "1.167.
|
|
3687
|
+
var KERNEL_VERSION = true ? "1.167.3" : "0.0.0-dev";
|
|
3688
3688
|
var OS_RELEASE = "6.0.0-slicc";
|
|
3689
3689
|
function procVersion() {
|
|
3690
3690
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -11064,7 +11064,7 @@ async function heldOpen(entry, path, real, req, fid) {
|
|
|
11064
11064
|
const handle = entry.hold?.(path, true, true, real, void 0, req.ino, fid);
|
|
11065
11065
|
if (handle === void 0) return null;
|
|
11066
11066
|
await entry.announceHold?.(real ?? path, fid, ((req.mode ?? 0) & HOLD_CREATED) !== 0);
|
|
11067
|
-
return handle;
|
|
11067
|
+
return real !== void 0 && real !== path ? { handle, real } : handle;
|
|
11068
11068
|
}
|
|
11069
11069
|
async function idOf(entry, path) {
|
|
11070
11070
|
return await entry.fileId?.(path)?.catch(() => void 0) ?? void 0;
|
|
@@ -12025,6 +12025,10 @@ var AsyncRangedFile = class {
|
|
|
12025
12025
|
truncate(size) {
|
|
12026
12026
|
this.pages.truncate(size);
|
|
12027
12027
|
}
|
|
12028
|
+
wrote(at, length2) {
|
|
12029
|
+
this.pages.landed(at, length2);
|
|
12030
|
+
this.version = void 0;
|
|
12031
|
+
}
|
|
12028
12032
|
async flush() {
|
|
12029
12033
|
if (this.pinned || !this.pages.changed) return;
|
|
12030
12034
|
const plan = this.pages.plan();
|
|
@@ -20150,6 +20154,7 @@ var VfsNode = class {
|
|
|
20150
20154
|
ino;
|
|
20151
20155
|
onDirty;
|
|
20152
20156
|
onDirtyState;
|
|
20157
|
+
crowded;
|
|
20153
20158
|
counted = false;
|
|
20154
20159
|
recount() {
|
|
20155
20160
|
if (!this.onDirtyState) return;
|
|
@@ -20267,9 +20272,48 @@ var VfsNode = class {
|
|
|
20267
20272
|
if (!this.dirty) this.data = void 0;
|
|
20268
20273
|
}
|
|
20269
20274
|
async size() {
|
|
20275
|
+
if (this.peerHeld()) {
|
|
20276
|
+
const known = await this.exact();
|
|
20277
|
+
if (known !== void 0) return known;
|
|
20278
|
+
}
|
|
20270
20279
|
const ranged2 = await this.prepare();
|
|
20271
20280
|
return ranged2 ? ranged2.size() : this.length;
|
|
20272
20281
|
}
|
|
20282
|
+
peered = false;
|
|
20283
|
+
peerHeld() {
|
|
20284
|
+
if (this.orphaned || this.revoked || this.pin) return false;
|
|
20285
|
+
if (this.crowded?.(this.path) === true) this.peered = true;
|
|
20286
|
+
return this.peered;
|
|
20287
|
+
}
|
|
20288
|
+
async exact() {
|
|
20289
|
+
await this.flush();
|
|
20290
|
+
const { stat } = this.fs;
|
|
20291
|
+
const io = rangedOps(this.fs);
|
|
20292
|
+
if (!stat || !io) return void 0;
|
|
20293
|
+
const st = await this.followed(() => stat.call(this.fs, this.path));
|
|
20294
|
+
this.peered = this.crowded?.(this.path) === true;
|
|
20295
|
+
const size = st.size ?? 0;
|
|
20296
|
+
if (this.ranged) {
|
|
20297
|
+
if (size !== this.ranged.size()) {
|
|
20298
|
+
this.ranged = new AsyncRangedFile(io, this.path, size, st.version);
|
|
20299
|
+
}
|
|
20300
|
+
return void 0;
|
|
20301
|
+
}
|
|
20302
|
+
if (this.data && size !== this.length) this.data = void 0;
|
|
20303
|
+
return this.data ? void 0 : size;
|
|
20304
|
+
}
|
|
20305
|
+
landed(at, bytes) {
|
|
20306
|
+
if (this.ranged) {
|
|
20307
|
+
this.ranged.wrote(at, bytes.length);
|
|
20308
|
+
return;
|
|
20309
|
+
}
|
|
20310
|
+
if (!this.data) return;
|
|
20311
|
+
const end = at + bytes.length;
|
|
20312
|
+
const buf = this.ensure(end);
|
|
20313
|
+
if (at > this.length) buf.fill(0, this.length, at);
|
|
20314
|
+
buf.set(bytes, at);
|
|
20315
|
+
this.length = Math.max(this.length, end);
|
|
20316
|
+
}
|
|
20273
20317
|
async pread(max, at) {
|
|
20274
20318
|
const ranged2 = await this.prepare();
|
|
20275
20319
|
if (ranged2) return this.followed(() => ranged2.read(at, max));
|
|
@@ -20341,6 +20385,13 @@ var VfsNode = class {
|
|
|
20341
20385
|
if (bytes.length === 0) return 0;
|
|
20342
20386
|
await this.settled();
|
|
20343
20387
|
await this.fits(at + bytes.length);
|
|
20388
|
+
const io = this.peerHeld() ? rangedOps(this.fs) : void 0;
|
|
20389
|
+
if (io && at + bytes.length > await this.size()) {
|
|
20390
|
+
const copy = bytes.slice();
|
|
20391
|
+
await this.followed(() => io.pwrite(this.path, at, copy, true));
|
|
20392
|
+
this.landed(at, bytes);
|
|
20393
|
+
return bytes.length;
|
|
20394
|
+
}
|
|
20344
20395
|
const ranged2 = await this.prepare();
|
|
20345
20396
|
if (ranged2) {
|
|
20346
20397
|
await this.followed(() => ranged2.write(at, bytes));
|
|
@@ -20437,6 +20488,7 @@ var VfsNodes = class {
|
|
|
20437
20488
|
movedAway;
|
|
20438
20489
|
opened;
|
|
20439
20490
|
dirtied;
|
|
20491
|
+
crowded;
|
|
20440
20492
|
fs;
|
|
20441
20493
|
entries;
|
|
20442
20494
|
onClosed;
|
|
@@ -20582,6 +20634,7 @@ var VfsNodes = class {
|
|
|
20582
20634
|
this.reshaped();
|
|
20583
20635
|
node.onDirty = () => this.changed?.(node.path);
|
|
20584
20636
|
node.onDirtyState = (on) => this.dirtied?.(on ? 1 : -1);
|
|
20637
|
+
node.crowded = (at) => this.crowded?.(at) === true;
|
|
20585
20638
|
node.recount();
|
|
20586
20639
|
this.byPath.set(path, node);
|
|
20587
20640
|
if (id2 !== void 0) this.know(node, id2);
|
|
@@ -30595,6 +30648,7 @@ var Launcher = class {
|
|
|
30595
30648
|
hostname;
|
|
30596
30649
|
watchers = new FsWatchers();
|
|
30597
30650
|
changes = new FileChanges();
|
|
30651
|
+
peerHeldPaths = /* @__PURE__ */ new Set();
|
|
30598
30652
|
renameLog = new RenameLog(this.changes);
|
|
30599
30653
|
cwds = new CwdTable(async (path) => {
|
|
30600
30654
|
const { dev, ino } = await this.base.stat(path);
|
|
@@ -32808,7 +32862,7 @@ var Launcher = class {
|
|
|
32808
32862
|
kept: async (tab, items, paths) => {
|
|
32809
32863
|
for (const { path, hidden, fid } of items) {
|
|
32810
32864
|
if (hidden !== void 0 && sharedKept(hidden)) await this.adoptShared(path, hidden, fid);
|
|
32811
|
-
else this.adoptKept(path, hidden, fid, ours);
|
|
32865
|
+
else await this.adoptKept(path, hidden, fid, ours);
|
|
32812
32866
|
}
|
|
32813
32867
|
await open(tab, paths);
|
|
32814
32868
|
},
|
|
@@ -32818,14 +32872,33 @@ var Launcher = class {
|
|
|
32818
32872
|
}
|
|
32819
32873
|
};
|
|
32820
32874
|
}
|
|
32821
|
-
async
|
|
32822
|
-
|
|
32823
|
-
|
|
32824
|
-
|
|
32825
|
-
|
|
32875
|
+
async keptIds(hidden, fid) {
|
|
32876
|
+
if (fid !== void 0) return [fid];
|
|
32877
|
+
const st = await this.rootFs.lstat(hidden).catch(() => void 0);
|
|
32878
|
+
return st?.fid === void 0 ? [void 0] : [void 0, st.fid];
|
|
32879
|
+
}
|
|
32880
|
+
boundTo(path, hidden, fids) {
|
|
32881
|
+
const keeping = [...this.held].map(
|
|
32882
|
+
(holds2) => [
|
|
32883
|
+
holds2,
|
|
32884
|
+
fids.flatMap((fid) => [...holds2.boundAt(path, fid), ...holds2.boundAt(hidden, fid)])
|
|
32885
|
+
]
|
|
32886
|
+
).filter(([, ids]) => ids.length > 0);
|
|
32826
32887
|
const nodes = [...this.openFiles].filter(
|
|
32827
32888
|
(open) => [path, hidden].some((at) => open.holdsAt(at))
|
|
32828
32889
|
);
|
|
32890
|
+
const keep2 = (file) => {
|
|
32891
|
+
const kept = nodes.filter(
|
|
32892
|
+
(open) => fids.some((fid) => open.keepBound([hidden, path], fid, file))
|
|
32893
|
+
).length;
|
|
32894
|
+
for (let i = kept; i < nodes.length; i++) file.release();
|
|
32895
|
+
for (const [holds2, ids] of keeping) holds2.keepBound(ids, path, file);
|
|
32896
|
+
void this.rootFs.announceHolds?.([], [path, hidden], false);
|
|
32897
|
+
};
|
|
32898
|
+
return { keeping, nodes, keep: keep2 };
|
|
32899
|
+
}
|
|
32900
|
+
async adoptShared(path, hidden, fid) {
|
|
32901
|
+
const { keeping, nodes, keep: keep2 } = this.boundTo(path, hidden, await this.keptIds(hidden, fid));
|
|
32829
32902
|
const refs = keeping.length + nodes.length;
|
|
32830
32903
|
if (refs === 0) {
|
|
32831
32904
|
this.held.doubt([path]);
|
|
@@ -32840,33 +32913,22 @@ var Launcher = class {
|
|
|
32840
32913
|
this.held.doubt([path]);
|
|
32841
32914
|
return;
|
|
32842
32915
|
}
|
|
32843
|
-
|
|
32844
|
-
for (let i = kept; i < nodes.length; i++) file.release();
|
|
32845
|
-
for (const [holds2, ids] of keeping) holds2.keepBound(ids, path, file);
|
|
32846
|
-
void this.rootFs.announceHolds?.([], [path, hidden], false);
|
|
32916
|
+
keep2(file);
|
|
32847
32917
|
}
|
|
32848
|
-
adoptKept(path, hidden, fid, ours) {
|
|
32918
|
+
async adoptKept(path, hidden, fid, ours) {
|
|
32849
32919
|
if (hidden === void 0 || !ours(hidden)) {
|
|
32850
32920
|
this.held.doubt([path]);
|
|
32851
32921
|
return;
|
|
32852
32922
|
}
|
|
32853
|
-
const
|
|
32854
|
-
(holds2) => [holds2, [...holds2.boundAt(path, fid), ...holds2.boundAt(hidden, fid)]]
|
|
32855
|
-
);
|
|
32856
|
-
const keeping = bound3.filter(([, ids]) => ids.length > 0);
|
|
32857
|
-
const nodes = [...this.openFiles].filter(
|
|
32858
|
-
(open) => [path, hidden].some((at) => open.holdsAt(at))
|
|
32859
|
-
);
|
|
32923
|
+
const { keeping, nodes, keep: keep2 } = this.boundTo(path, hidden, await this.keptIds(hidden, fid));
|
|
32860
32924
|
const file = this.unlinked.adopt(hidden, Math.max(keeping.length + nodes.length, 1));
|
|
32861
|
-
const kept = nodes.filter((open) => open.keepBound([hidden, path], fid, file)).length;
|
|
32862
|
-
for (let i = kept; i < nodes.length; i++) file.release();
|
|
32863
32925
|
if (keeping.length === 0 && nodes.length === 0) file.release();
|
|
32864
|
-
|
|
32865
|
-
void this.rootFs.announceHolds?.([], [path, hidden], false);
|
|
32926
|
+
keep2(file);
|
|
32866
32927
|
}
|
|
32867
32928
|
openNodes(fs, entries) {
|
|
32868
32929
|
const nodes = new VfsNodes(fs, (path) => this.released(path), entries);
|
|
32869
32930
|
nodes.opened = (node) => this.nodeOpened(node);
|
|
32931
|
+
nodes.crowded = (path) => this.peerHeldPaths.has(path);
|
|
32870
32932
|
return nodes;
|
|
32871
32933
|
}
|
|
32872
32934
|
nodeOpened(node) {
|
|
@@ -32888,13 +32950,17 @@ var Launcher = class {
|
|
|
32888
32950
|
return this.mounts.locate(path) === void 0 ? this.rootFs.bindId?.(path) : void 0;
|
|
32889
32951
|
}
|
|
32890
32952
|
flushingPeers(fs) {
|
|
32891
|
-
fs.peerHolds?.((paths) =>
|
|
32953
|
+
fs.peerHolds?.((paths) => {
|
|
32954
|
+
this.peerHeldPaths = new Set(paths);
|
|
32955
|
+
this.changes.peerHeld(paths);
|
|
32956
|
+
});
|
|
32892
32957
|
const peers = fs.peers?.();
|
|
32893
32958
|
if (!peers) return void 0;
|
|
32894
32959
|
peers.watch((crowded) => {
|
|
32895
32960
|
this.changes.flush();
|
|
32896
32961
|
this.changes.foreign(crowded);
|
|
32897
32962
|
if (crowded) {
|
|
32963
|
+
void this.announceHeld();
|
|
32898
32964
|
void this.held.bindIds((path) => this.rootFileId(path)).then(
|
|
32899
32965
|
() => Promise.all([...this.openFiles].map((open) => open.bindIds((p) => this.rootFileId(p))))
|
|
32900
32966
|
).then(() => this.announceHeld());
|