@ai-ecoverse/slicc-kernel 1.189.0 → 1.189.1

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.
@@ -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.0" : "0.0.0-dev";
8033
+ KERNEL_VERSION = true ? "1.189.1" : "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.0" : "0.0.0-dev";
8032
+ KERNEL_VERSION = true ? "1.189.1" : "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
- queueMicrotask(() => fail3(err instanceof Error ? err.message : String(err)));
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.0" : "0.0.0-dev";
7196
+ var KERNEL_VERSION = true ? "1.189.1" : "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);
@@ -13279,25 +13311,23 @@ var MountFs = class _MountFs {
13279
13311
  }
13280
13312
  const fh = await this.open(mount, rel2, false);
13281
13313
  const chunk2 = mount.caps.maxIo ?? DEFAULT_IO;
13282
- const chunks2 = [];
13283
- let total = 0;
13314
+ const out = new Gathered(attr2.size);
13284
13315
  try {
13285
13316
  for (; ; ) {
13286
13317
  const bytes = await mount.conn.call({
13287
13318
  op: "read",
13288
13319
  fh,
13289
- offset: total,
13320
+ offset: out.length,
13290
13321
  size: chunk2
13291
13322
  });
13292
13323
  if (bytes.length === 0) break;
13293
- chunks2.push(bytes);
13294
- total += bytes.length;
13295
- if (bytes.length < chunk2 && total >= attr2.size) break;
13324
+ out.add(bytes);
13325
+ if (bytes.length < chunk2 && out.length >= attr2.size) break;
13296
13326
  }
13297
13327
  } finally {
13298
13328
  await mount.conn.call({ op: "release", fh });
13299
13329
  }
13300
- return concat4(chunks2, total);
13330
+ return out.whole;
13301
13331
  }
13302
13332
  async writeFile(path, content, owner, redirects = 0) {
13303
13333
  const real = await this.follow(path, 0, true);
@@ -36270,7 +36300,7 @@ var Launcher = class {
36270
36300
  const foreign = foreignImports(bytes);
36271
36301
  const libc = libcVersionOf(bytes);
36272
36302
  const named = customSectionsOf(bytes, "name").length > 0;
36273
- const compiled = this.compile ? await this.compile(bytes, key) : await WebAssembly.compile(bytes);
36303
+ const compiled = this.compile ? await this.compile(bytes, key, this.sourceOf(path)) : await WebAssembly.compile(bytes);
36274
36304
  if (libc !== void 0) this.libcs.set(compiled, libc);
36275
36305
  return {
36276
36306
  value: { module: compiled, ...memory ? { memory } : {}, foreign, named },
@@ -36382,10 +36412,20 @@ var Launcher = class {
36382
36412
  );
36383
36413
  }
36384
36414
  reread(target, read) {
36415
+ this.forgetCompiled(target.wasm);
36416
+ return read();
36417
+ }
36418
+ forgetCompiled(path) {
36385
36419
  for (const key of this.compiled.keys()) {
36386
- if (key.startsWith(`${target.wasm}:`)) this.compiled.delete(key);
36420
+ if (key.startsWith(`${path}:`) || key.startsWith(`${path}\0`)) this.compiled.delete(key);
36387
36421
  }
36388
- return read();
36422
+ }
36423
+ sourceOf(path) {
36424
+ return {
36425
+ path,
36426
+ read: () => this.base.readFileBuffer(path),
36427
+ stale: () => this.forgetCompiled(path)
36428
+ };
36389
36429
  }
36390
36430
  exeId(target) {
36391
36431
  if (target.abi !== "wasi" || (target.copy ?? target.glue) !== target.wasm) {