@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
|
@@ -8030,7 +8030,7 @@ var init_version = __esm({
|
|
|
8030
8030
|
"src/version.ts"() {
|
|
8031
8031
|
"use strict";
|
|
8032
8032
|
init_captured_globals();
|
|
8033
|
-
KERNEL_VERSION = true ? "1.189.
|
|
8033
|
+
KERNEL_VERSION = true ? "1.189.2" : "0.0.0-dev";
|
|
8034
8034
|
OS_RELEASE = "6.0.0-slicc";
|
|
8035
8035
|
}
|
|
8036
8036
|
});
|
|
@@ -8029,7 +8029,7 @@ var init_version = __esm({
|
|
|
8029
8029
|
"src/version.ts"() {
|
|
8030
8030
|
"use strict";
|
|
8031
8031
|
init_captured_globals();
|
|
8032
|
-
KERNEL_VERSION = true ? "1.189.
|
|
8032
|
+
KERNEL_VERSION = true ? "1.189.2" : "0.0.0-dev";
|
|
8033
8033
|
OS_RELEASE = "6.0.0-slicc";
|
|
8034
8034
|
}
|
|
8035
8035
|
});
|
package/dist/node.js
CHANGED
|
@@ -4362,7 +4362,10 @@ function remoteWorker(open, options = {}) {
|
|
|
4362
4362
|
opened2 = await open(wire);
|
|
4363
4363
|
} catch (err) {
|
|
4364
4364
|
kernel.end();
|
|
4365
|
-
|
|
4365
|
+
const status = err?.exitStatus;
|
|
4366
|
+
const message3 = err instanceof Error ? err.message : String(err);
|
|
4367
|
+
if (typeof status === "number") refuse2(message3, status);
|
|
4368
|
+
else queueMicrotask(() => fail3(message3));
|
|
4366
4369
|
return;
|
|
4367
4370
|
}
|
|
4368
4371
|
if (ended) {
|
|
@@ -7190,7 +7193,7 @@ function satisfies(version, range2) {
|
|
|
7190
7193
|
}
|
|
7191
7194
|
|
|
7192
7195
|
// src/version.ts
|
|
7193
|
-
var KERNEL_VERSION = true ? "1.189.
|
|
7196
|
+
var KERNEL_VERSION = true ? "1.189.2" : "0.0.0-dev";
|
|
7194
7197
|
var OS_RELEASE = "6.0.0-slicc";
|
|
7195
7198
|
function procVersion() {
|
|
7196
7199
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -12787,6 +12790,35 @@ function statOf2(attr2, path, mount) {
|
|
|
12787
12790
|
} : {}
|
|
12788
12791
|
};
|
|
12789
12792
|
}
|
|
12793
|
+
var Gathered = class {
|
|
12794
|
+
bytes = new Uint8Array(0);
|
|
12795
|
+
owned = false;
|
|
12796
|
+
size;
|
|
12797
|
+
length = 0;
|
|
12798
|
+
constructor(size) {
|
|
12799
|
+
this.size = size;
|
|
12800
|
+
}
|
|
12801
|
+
add(chunk2) {
|
|
12802
|
+
const need2 = this.length + chunk2.length;
|
|
12803
|
+
if (this.length === 0) {
|
|
12804
|
+
this.bytes = chunk2;
|
|
12805
|
+
} else {
|
|
12806
|
+
if (!this.owned || this.bytes.length < need2) {
|
|
12807
|
+
const grown = new Uint8Array(
|
|
12808
|
+
Math.max(this.size, need2, this.owned ? this.bytes.length * 2 : 0)
|
|
12809
|
+
);
|
|
12810
|
+
grown.set(this.bytes.subarray(0, this.length));
|
|
12811
|
+
this.bytes = grown;
|
|
12812
|
+
this.owned = true;
|
|
12813
|
+
}
|
|
12814
|
+
this.bytes.set(chunk2, this.length);
|
|
12815
|
+
}
|
|
12816
|
+
this.length = need2;
|
|
12817
|
+
}
|
|
12818
|
+
get whole() {
|
|
12819
|
+
return this.length === this.bytes.length ? this.bytes : this.bytes.subarray(0, this.length);
|
|
12820
|
+
}
|
|
12821
|
+
};
|
|
12790
12822
|
function concat4(chunks2, total) {
|
|
12791
12823
|
if (chunks2.length === 1 && chunks2[0]?.length === total) return chunks2[0];
|
|
12792
12824
|
const out = new Uint8Array(total);
|
|
@@ -12863,6 +12895,10 @@ var MountTable = class {
|
|
|
12863
12895
|
for (const mount of this.mounts.values()) if (within5(mount.target, path)) return true;
|
|
12864
12896
|
return false;
|
|
12865
12897
|
}
|
|
12898
|
+
readOnlyAt(path) {
|
|
12899
|
+
const found = this.locate(path);
|
|
12900
|
+
return found !== void 0 && readonly(found.mount);
|
|
12901
|
+
}
|
|
12866
12902
|
locate(path) {
|
|
12867
12903
|
let best;
|
|
12868
12904
|
for (const mount of this.mounts.values()) {
|
|
@@ -13279,25 +13315,23 @@ var MountFs = class _MountFs {
|
|
|
13279
13315
|
}
|
|
13280
13316
|
const fh = await this.open(mount, rel2, false);
|
|
13281
13317
|
const chunk2 = mount.caps.maxIo ?? DEFAULT_IO;
|
|
13282
|
-
const
|
|
13283
|
-
let total = 0;
|
|
13318
|
+
const out = new Gathered(attr2.size);
|
|
13284
13319
|
try {
|
|
13285
13320
|
for (; ; ) {
|
|
13286
13321
|
const bytes = await mount.conn.call({
|
|
13287
13322
|
op: "read",
|
|
13288
13323
|
fh,
|
|
13289
|
-
offset:
|
|
13324
|
+
offset: out.length,
|
|
13290
13325
|
size: chunk2
|
|
13291
13326
|
});
|
|
13292
13327
|
if (bytes.length === 0) break;
|
|
13293
|
-
|
|
13294
|
-
|
|
13295
|
-
if (bytes.length < chunk2 && total >= attr2.size) break;
|
|
13328
|
+
out.add(bytes);
|
|
13329
|
+
if (bytes.length < chunk2 && out.length >= attr2.size) break;
|
|
13296
13330
|
}
|
|
13297
13331
|
} finally {
|
|
13298
13332
|
await mount.conn.call({ op: "release", fh });
|
|
13299
13333
|
}
|
|
13300
|
-
return
|
|
13334
|
+
return out.whole;
|
|
13301
13335
|
}
|
|
13302
13336
|
async writeFile(path, content, owner, redirects = 0) {
|
|
13303
13337
|
const real = await this.follow(path, 0, true);
|
|
@@ -35274,6 +35308,8 @@ var Launcher = class {
|
|
|
35274
35308
|
tagBases = /* @__PURE__ */ new Map();
|
|
35275
35309
|
links = /* @__PURE__ */ new Map();
|
|
35276
35310
|
freshModules = new FreshModules();
|
|
35311
|
+
imagePaths = /* @__PURE__ */ new WeakMap();
|
|
35312
|
+
imageHolds = /* @__PURE__ */ new Map();
|
|
35277
35313
|
granted = /* @__PURE__ */ new Map();
|
|
35278
35314
|
users;
|
|
35279
35315
|
sudoer;
|
|
@@ -36263,20 +36299,23 @@ var Launcher = class {
|
|
|
36263
36299
|
const pin = await this.pinOf(path, caller);
|
|
36264
36300
|
const sum = Object.values(pin)[0];
|
|
36265
36301
|
const key = sum === void 0 ? await this.cacheKey(path, asked) : `${path}:sha256:${sum}`;
|
|
36266
|
-
|
|
36302
|
+
const loaded = this.cached(this.compiled, key, async () => {
|
|
36267
36303
|
const { bytes: read, key: readKey } = await this.keyed(path, caller, asked);
|
|
36268
36304
|
const bytes = sum === void 0 ? read : await this.pinnedBytes(pin, read);
|
|
36269
36305
|
const memory = importedMemory(bytes);
|
|
36270
36306
|
const foreign = foreignImports(bytes);
|
|
36271
36307
|
const libc = libcVersionOf(bytes);
|
|
36272
36308
|
const named = customSectionsOf(bytes, "name").length > 0;
|
|
36273
|
-
const compiled = this.compile ? await this.compile(bytes, key) : await WebAssembly.compile(bytes);
|
|
36309
|
+
const compiled = this.compile ? await this.compile(bytes, key, this.sourceOf(path)) : await WebAssembly.compile(bytes);
|
|
36274
36310
|
if (libc !== void 0) this.libcs.set(compiled, libc);
|
|
36275
36311
|
return {
|
|
36276
36312
|
value: { module: compiled, ...memory ? { memory } : {}, foreign, named },
|
|
36277
36313
|
key: sum === void 0 ? readKey : key
|
|
36278
36314
|
};
|
|
36279
36315
|
});
|
|
36316
|
+
const value2 = await loaded;
|
|
36317
|
+
this.imagePaths.set(value2.module, path);
|
|
36318
|
+
return value2;
|
|
36280
36319
|
}
|
|
36281
36320
|
async checkedSources(planned, caller) {
|
|
36282
36321
|
const { target } = planned;
|
|
@@ -36382,10 +36421,52 @@ var Launcher = class {
|
|
|
36382
36421
|
);
|
|
36383
36422
|
}
|
|
36384
36423
|
reread(target, read) {
|
|
36424
|
+
this.forgetCompiled(target.wasm);
|
|
36425
|
+
return read();
|
|
36426
|
+
}
|
|
36427
|
+
forgetCompiled(path) {
|
|
36385
36428
|
for (const key of this.compiled.keys()) {
|
|
36386
|
-
if (key.startsWith(`${
|
|
36429
|
+
if (key.startsWith(`${path}:`) || key.startsWith(`${path}\0`)) this.compiled.delete(key);
|
|
36387
36430
|
}
|
|
36388
|
-
|
|
36431
|
+
}
|
|
36432
|
+
sourceOf(path) {
|
|
36433
|
+
return {
|
|
36434
|
+
path,
|
|
36435
|
+
read: () => this.base.readFileBuffer(path),
|
|
36436
|
+
stale: () => this.forgetCompiled(path),
|
|
36437
|
+
kept: () => this.keptCopies(path).map((at) => ({ path: at, read: () => this.base.readFileBuffer(at) }))
|
|
36438
|
+
};
|
|
36439
|
+
}
|
|
36440
|
+
keptCopies(path) {
|
|
36441
|
+
const out = /* @__PURE__ */ new Set();
|
|
36442
|
+
for (const hold of this.imageHolds.get(path) ?? []) {
|
|
36443
|
+
for (const key of hold.holds.held()) out.add(hold.holds.keptAt(key)?.hidden ?? key);
|
|
36444
|
+
}
|
|
36445
|
+
out.delete(path);
|
|
36446
|
+
return [...out];
|
|
36447
|
+
}
|
|
36448
|
+
holdImage(program) {
|
|
36449
|
+
const module = program.abi === "js" ? void 0 : program.module;
|
|
36450
|
+
const path = this.compile && module ? this.imagePaths.get(module) : void 0;
|
|
36451
|
+
if (!module || path === void 0 || this.mounts.readOnlyAt(path)) return (status) => status;
|
|
36452
|
+
const holds3 = this.imageHolds.get(path) ?? /* @__PURE__ */ new Set();
|
|
36453
|
+
this.imageHolds.set(path, holds3);
|
|
36454
|
+
let hold = [...holds3].find((known) => known.module === module);
|
|
36455
|
+
if (!hold) {
|
|
36456
|
+
hold = { module, holds: new HeldPaths(), users: 0 };
|
|
36457
|
+
hold.holds.hold(path, true, true);
|
|
36458
|
+
holds3.add(hold);
|
|
36459
|
+
this.held.add(hold.holds);
|
|
36460
|
+
}
|
|
36461
|
+
const mine = hold;
|
|
36462
|
+
mine.users++;
|
|
36463
|
+
return (status) => {
|
|
36464
|
+
if (--mine.users > 0) return status;
|
|
36465
|
+
holds3.delete(mine);
|
|
36466
|
+
if (holds3.size === 0 && this.imageHolds.get(path) === holds3) this.imageHolds.delete(path);
|
|
36467
|
+
this.held.delete(mine.holds);
|
|
36468
|
+
return status;
|
|
36469
|
+
};
|
|
36389
36470
|
}
|
|
36390
36471
|
exeId(target) {
|
|
36391
36472
|
if (target.abi !== "wasi" || (target.copy ?? target.glue) !== target.wasm) {
|
|
@@ -36796,7 +36877,7 @@ var Launcher = class {
|
|
|
36796
36877
|
handle.onState(
|
|
36797
36878
|
(state) => state === "stopped" ? this.stopped.add(pid) : this.stopped.delete(pid)
|
|
36798
36879
|
);
|
|
36799
|
-
void handle.exited.then((status) => {
|
|
36880
|
+
void handle.exited.then(this.holdImage(req.program)).then((status) => {
|
|
36800
36881
|
this.traceEnded(pid, handle, status);
|
|
36801
36882
|
this.cwds.release(this.cwdSlots.get(pid));
|
|
36802
36883
|
this.cwdSlots.delete(pid);
|