@ai-ecoverse/slicc-kernel 1.189.0 → 1.189.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 -1
- package/dist/async-process.js +1 -1
- package/dist/cloudflare-sources.js +1 -1
- package/dist/cloudflare.js +198 -39
- package/dist/cloudflare.js.map +3 -3
- package/dist/kernel-worker.js +91 -13
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.cjs +1 -1
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +95 -14
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +1 -1
- package/dist/types/cloudflare/images.d.ts +19 -5
- package/dist/types/cloudflare/sqlite-store.d.ts +2 -0
- package/dist/types/launcher.d.ts +16 -1
- package/dist/types/mount/mount-fs.d.ts +1 -0
- package/package.json +1 -1
package/dist/kernel-worker.js
CHANGED
|
@@ -9071,7 +9071,7 @@ function satisfies(version, range2) {
|
|
|
9071
9071
|
}
|
|
9072
9072
|
|
|
9073
9073
|
// src/version.ts
|
|
9074
|
-
var KERNEL_VERSION = true ? "1.189.
|
|
9074
|
+
var KERNEL_VERSION = true ? "1.189.2" : "0.0.0-dev";
|
|
9075
9075
|
var OS_RELEASE = "6.0.0-slicc";
|
|
9076
9076
|
function procVersion() {
|
|
9077
9077
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -15535,6 +15535,35 @@ function statOf2(attr2, path, mount) {
|
|
|
15535
15535
|
} : {}
|
|
15536
15536
|
};
|
|
15537
15537
|
}
|
|
15538
|
+
var Gathered = class {
|
|
15539
|
+
bytes = new Uint8Array(0);
|
|
15540
|
+
owned = false;
|
|
15541
|
+
size;
|
|
15542
|
+
length = 0;
|
|
15543
|
+
constructor(size) {
|
|
15544
|
+
this.size = size;
|
|
15545
|
+
}
|
|
15546
|
+
add(chunk2) {
|
|
15547
|
+
const need2 = this.length + chunk2.length;
|
|
15548
|
+
if (this.length === 0) {
|
|
15549
|
+
this.bytes = chunk2;
|
|
15550
|
+
} else {
|
|
15551
|
+
if (!this.owned || this.bytes.length < need2) {
|
|
15552
|
+
const grown = new Uint8Array(
|
|
15553
|
+
Math.max(this.size, need2, this.owned ? this.bytes.length * 2 : 0)
|
|
15554
|
+
);
|
|
15555
|
+
grown.set(this.bytes.subarray(0, this.length));
|
|
15556
|
+
this.bytes = grown;
|
|
15557
|
+
this.owned = true;
|
|
15558
|
+
}
|
|
15559
|
+
this.bytes.set(chunk2, this.length);
|
|
15560
|
+
}
|
|
15561
|
+
this.length = need2;
|
|
15562
|
+
}
|
|
15563
|
+
get whole() {
|
|
15564
|
+
return this.length === this.bytes.length ? this.bytes : this.bytes.subarray(0, this.length);
|
|
15565
|
+
}
|
|
15566
|
+
};
|
|
15538
15567
|
function concat4(chunks, total) {
|
|
15539
15568
|
if (chunks.length === 1 && chunks[0]?.length === total) return chunks[0];
|
|
15540
15569
|
const out = new Uint8Array(total);
|
|
@@ -15611,6 +15640,10 @@ var MountTable = class {
|
|
|
15611
15640
|
for (const mount of this.mounts.values()) if (within7(mount.target, path)) return true;
|
|
15612
15641
|
return false;
|
|
15613
15642
|
}
|
|
15643
|
+
readOnlyAt(path) {
|
|
15644
|
+
const found = this.locate(path);
|
|
15645
|
+
return found !== void 0 && readonly(found.mount);
|
|
15646
|
+
}
|
|
15614
15647
|
locate(path) {
|
|
15615
15648
|
let best;
|
|
15616
15649
|
for (const mount of this.mounts.values()) {
|
|
@@ -16027,25 +16060,23 @@ var MountFs = class _MountFs {
|
|
|
16027
16060
|
}
|
|
16028
16061
|
const fh = await this.open(mount, rel2, false);
|
|
16029
16062
|
const chunk2 = mount.caps.maxIo ?? DEFAULT_IO;
|
|
16030
|
-
const
|
|
16031
|
-
let total = 0;
|
|
16063
|
+
const out = new Gathered(attr2.size);
|
|
16032
16064
|
try {
|
|
16033
16065
|
for (; ; ) {
|
|
16034
16066
|
const bytes = await mount.conn.call({
|
|
16035
16067
|
op: "read",
|
|
16036
16068
|
fh,
|
|
16037
|
-
offset:
|
|
16069
|
+
offset: out.length,
|
|
16038
16070
|
size: chunk2
|
|
16039
16071
|
});
|
|
16040
16072
|
if (bytes.length === 0) break;
|
|
16041
|
-
|
|
16042
|
-
|
|
16043
|
-
if (bytes.length < chunk2 && total >= attr2.size) break;
|
|
16073
|
+
out.add(bytes);
|
|
16074
|
+
if (bytes.length < chunk2 && out.length >= attr2.size) break;
|
|
16044
16075
|
}
|
|
16045
16076
|
} finally {
|
|
16046
16077
|
await mount.conn.call({ op: "release", fh });
|
|
16047
16078
|
}
|
|
16048
|
-
return
|
|
16079
|
+
return out.whole;
|
|
16049
16080
|
}
|
|
16050
16081
|
async writeFile(path, content, owner, redirects = 0) {
|
|
16051
16082
|
const real = await this.follow(path, 0, true);
|
|
@@ -35397,6 +35428,8 @@ var Launcher = class {
|
|
|
35397
35428
|
tagBases = /* @__PURE__ */ new Map();
|
|
35398
35429
|
links = /* @__PURE__ */ new Map();
|
|
35399
35430
|
freshModules = new FreshModules();
|
|
35431
|
+
imagePaths = /* @__PURE__ */ new WeakMap();
|
|
35432
|
+
imageHolds = /* @__PURE__ */ new Map();
|
|
35400
35433
|
granted = /* @__PURE__ */ new Map();
|
|
35401
35434
|
users;
|
|
35402
35435
|
sudoer;
|
|
@@ -36386,20 +36419,23 @@ var Launcher = class {
|
|
|
36386
36419
|
const pin = await this.pinOf(path, caller);
|
|
36387
36420
|
const sum = Object.values(pin)[0];
|
|
36388
36421
|
const key = sum === void 0 ? await this.cacheKey(path, asked) : `${path}:sha256:${sum}`;
|
|
36389
|
-
|
|
36422
|
+
const loaded = this.cached(this.compiled, key, async () => {
|
|
36390
36423
|
const { bytes: read, key: readKey } = await this.keyed(path, caller, asked);
|
|
36391
36424
|
const bytes = sum === void 0 ? read : await this.pinnedBytes(pin, read);
|
|
36392
36425
|
const memory = importedMemory(bytes);
|
|
36393
36426
|
const foreign = foreignImports(bytes);
|
|
36394
36427
|
const libc = libcVersionOf(bytes);
|
|
36395
36428
|
const named = customSectionsOf(bytes, "name").length > 0;
|
|
36396
|
-
const compiled = this.compile ? await this.compile(bytes, key) : await WebAssembly.compile(bytes);
|
|
36429
|
+
const compiled = this.compile ? await this.compile(bytes, key, this.sourceOf(path)) : await WebAssembly.compile(bytes);
|
|
36397
36430
|
if (libc !== void 0) this.libcs.set(compiled, libc);
|
|
36398
36431
|
return {
|
|
36399
36432
|
value: { module: compiled, ...memory ? { memory } : {}, foreign, named },
|
|
36400
36433
|
key: sum === void 0 ? readKey : key
|
|
36401
36434
|
};
|
|
36402
36435
|
});
|
|
36436
|
+
const value2 = await loaded;
|
|
36437
|
+
this.imagePaths.set(value2.module, path);
|
|
36438
|
+
return value2;
|
|
36403
36439
|
}
|
|
36404
36440
|
async checkedSources(planned, caller) {
|
|
36405
36441
|
const { target } = planned;
|
|
@@ -36505,10 +36541,52 @@ var Launcher = class {
|
|
|
36505
36541
|
);
|
|
36506
36542
|
}
|
|
36507
36543
|
reread(target, read) {
|
|
36544
|
+
this.forgetCompiled(target.wasm);
|
|
36545
|
+
return read();
|
|
36546
|
+
}
|
|
36547
|
+
forgetCompiled(path) {
|
|
36508
36548
|
for (const key of this.compiled.keys()) {
|
|
36509
|
-
if (key.startsWith(`${
|
|
36549
|
+
if (key.startsWith(`${path}:`) || key.startsWith(`${path}\0`)) this.compiled.delete(key);
|
|
36510
36550
|
}
|
|
36511
|
-
|
|
36551
|
+
}
|
|
36552
|
+
sourceOf(path) {
|
|
36553
|
+
return {
|
|
36554
|
+
path,
|
|
36555
|
+
read: () => this.base.readFileBuffer(path),
|
|
36556
|
+
stale: () => this.forgetCompiled(path),
|
|
36557
|
+
kept: () => this.keptCopies(path).map((at) => ({ path: at, read: () => this.base.readFileBuffer(at) }))
|
|
36558
|
+
};
|
|
36559
|
+
}
|
|
36560
|
+
keptCopies(path) {
|
|
36561
|
+
const out = /* @__PURE__ */ new Set();
|
|
36562
|
+
for (const hold of this.imageHolds.get(path) ?? []) {
|
|
36563
|
+
for (const key of hold.holds.held()) out.add(hold.holds.keptAt(key)?.hidden ?? key);
|
|
36564
|
+
}
|
|
36565
|
+
out.delete(path);
|
|
36566
|
+
return [...out];
|
|
36567
|
+
}
|
|
36568
|
+
holdImage(program) {
|
|
36569
|
+
const module = program.abi === "js" ? void 0 : program.module;
|
|
36570
|
+
const path = this.compile && module ? this.imagePaths.get(module) : void 0;
|
|
36571
|
+
if (!module || path === void 0 || this.mounts.readOnlyAt(path)) return (status) => status;
|
|
36572
|
+
const holds3 = this.imageHolds.get(path) ?? /* @__PURE__ */ new Set();
|
|
36573
|
+
this.imageHolds.set(path, holds3);
|
|
36574
|
+
let hold = [...holds3].find((known) => known.module === module);
|
|
36575
|
+
if (!hold) {
|
|
36576
|
+
hold = { module, holds: new HeldPaths(), users: 0 };
|
|
36577
|
+
hold.holds.hold(path, true, true);
|
|
36578
|
+
holds3.add(hold);
|
|
36579
|
+
this.held.add(hold.holds);
|
|
36580
|
+
}
|
|
36581
|
+
const mine = hold;
|
|
36582
|
+
mine.users++;
|
|
36583
|
+
return (status) => {
|
|
36584
|
+
if (--mine.users > 0) return status;
|
|
36585
|
+
holds3.delete(mine);
|
|
36586
|
+
if (holds3.size === 0 && this.imageHolds.get(path) === holds3) this.imageHolds.delete(path);
|
|
36587
|
+
this.held.delete(mine.holds);
|
|
36588
|
+
return status;
|
|
36589
|
+
};
|
|
36512
36590
|
}
|
|
36513
36591
|
exeId(target) {
|
|
36514
36592
|
if (target.abi !== "wasi" || (target.copy ?? target.glue) !== target.wasm) {
|
|
@@ -36919,7 +36997,7 @@ var Launcher = class {
|
|
|
36919
36997
|
handle.onState(
|
|
36920
36998
|
(state) => state === "stopped" ? this.stopped.add(pid) : this.stopped.delete(pid)
|
|
36921
36999
|
);
|
|
36922
|
-
void handle.exited.then((status) => {
|
|
37000
|
+
void handle.exited.then(this.holdImage(req.program)).then((status) => {
|
|
36923
37001
|
this.traceEnded(pid, handle, status);
|
|
36924
37002
|
this.cwds.release(this.cwdSlots.get(pid));
|
|
36925
37003
|
this.cwdSlots.delete(pid);
|