@ai-ecoverse/slicc-kernel 1.146.6 → 1.147.0

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.
@@ -7157,7 +7157,7 @@ var KERNEL_VERSION, OS_RELEASE;
7157
7157
  var init_version = __esm({
7158
7158
  "src/version.ts"() {
7159
7159
  "use strict";
7160
- KERNEL_VERSION = true ? "1.146.6" : "0.0.0-dev";
7160
+ KERNEL_VERSION = true ? "1.147.0" : "0.0.0-dev";
7161
7161
  OS_RELEASE = "6.0.0-slicc";
7162
7162
  }
7163
7163
  });
package/dist/node.js CHANGED
@@ -3305,7 +3305,7 @@ function satisfies(version, range2) {
3305
3305
  }
3306
3306
 
3307
3307
  // src/version.ts
3308
- var KERNEL_VERSION = true ? "1.146.6" : "0.0.0-dev";
3308
+ var KERNEL_VERSION = true ? "1.147.0" : "0.0.0-dev";
3309
3309
  var OS_RELEASE = "6.0.0-slicc";
3310
3310
  function procVersion() {
3311
3311
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -25217,13 +25217,7 @@ var OpfsFs = class {
25217
25217
  }
25218
25218
  }
25219
25219
  async place(handle, dir, name2, copies) {
25220
- const move = handle.move;
25221
- if (move) this.others++;
25222
- const moved2 = await move?.call(handle, dir, name2).then(
25223
- () => true,
25224
- () => false
25225
- );
25226
- if (moved2) return true;
25220
+ if (await this.moved(handle, dir, name2)) return true;
25227
25221
  const before = this.fileMoves;
25228
25222
  try {
25229
25223
  await this.copy(handle, dir, name2, copies);
@@ -25236,6 +25230,23 @@ var OpfsFs = class {
25236
25230
  return false;
25237
25231
  }
25238
25232
  fileMoves = 0;
25233
+ async moved(handle, dir, name2) {
25234
+ const move = handle.move;
25235
+ if (!move) return false;
25236
+ for (let attempt = 0; ; attempt++) {
25237
+ this.others++;
25238
+ const failed3 = await move.call(handle, dir, name2).then(
25239
+ () => void 0,
25240
+ (err) => ({ err })
25241
+ );
25242
+ if (!failed3) return true;
25243
+ const error = failed3.err?.name;
25244
+ if (handle.kind !== "file" || !LOCKED.has(error)) return false;
25245
+ const delay = SYNC_BACKOFF_MS[attempt];
25246
+ if (delay === void 0) throw fsError("EBUSY", name2);
25247
+ await new Promise((resolve2) => setTimeout(resolve2, delay));
25248
+ }
25249
+ }
25239
25250
  async copy(handle, dir, name2, copies, rest2 = "") {
25240
25251
  if (handle.kind === "file" && movable(handle)) {
25241
25252
  this.others++;
@@ -27865,6 +27876,8 @@ function linksOf2(req) {
27865
27876
  return req.links === void 0 ? {} : { links: req.links };
27866
27877
  }
27867
27878
  var COMMAND2 = /^\/(?:usr\/)?bin\/([^/]+)$/;
27879
+ var SHIM_MARKER = /^\/\/ pnpm-wasm-shim=(\{.*\})$/gm;
27880
+ var SHIM_MAX = 64 * 1024;
27868
27881
  var PACKAGE_ROOT = /^(.*\/node_modules\/(?:@[^/]+\/)?[^/]+)\//;
27869
27882
  var ENV_REFERENCE = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
27870
27883
  var WASM_MAGIC = [0, 97, 115, 109];
@@ -28556,7 +28569,10 @@ var Launcher = class {
28556
28569
  return { abi: "emscripten", glue, wasm, argv0: baseName2(argv0 || file), ...asked };
28557
28570
  }
28558
28571
  const owner = await this.glueOwner(glue, baseName2(file), scope);
28559
- if (!owner) return void 0;
28572
+ if (!owner) {
28573
+ const shim = await this.shimOwner(glue, baseName2(file), scope);
28574
+ return shim && { ...targetOf(shim), ...asked, shim: glue };
28575
+ }
28560
28576
  return { ...targetOf(owner), ...asked, ...owner.glue === glue ? {} : { copy: glue } };
28561
28577
  }
28562
28578
  async ownOrRefused(path, name2, scope) {
@@ -28592,6 +28608,43 @@ var Launcher = class {
28592
28608
  }
28593
28609
  return void 0;
28594
28610
  }
28611
+ async shimOwner(script, name2, scope) {
28612
+ const command = (await this.commands(scope)).get(name2);
28613
+ if (!command || command.script || command.origin?.script) return void 0;
28614
+ const target = await this.shimTarget(script);
28615
+ if (target === void 0) return void 0;
28616
+ const pkg = await this.installedPackage(await physicalPathAsync(this.base, target), scope);
28617
+ if (!pkg) return void 0;
28618
+ const glue = command.origin?.glue ?? command.glue;
28619
+ const own = await physicalPathAsync(this.base, glue).catch(() => void 0);
28620
+ return own?.startsWith(`${pkg}/`) ? command : void 0;
28621
+ }
28622
+ async shimTarget(script) {
28623
+ const st = await this.base.stat(script).catch(() => void 0);
28624
+ if (!st?.isFile || st.size > SHIM_MAX) return void 0;
28625
+ const text = await this.base.readFile(script).catch(() => "");
28626
+ const marker = [...text.matchAll(SHIM_MARKER)].at(-1)?.[1];
28627
+ if (marker === void 0) return void 0;
28628
+ let target;
28629
+ try {
28630
+ target = JSON.parse(marker).target;
28631
+ } catch {
28632
+ return void 0;
28633
+ }
28634
+ if (typeof target !== "string" || target === "") return void 0;
28635
+ const dir = await physicalPathAsync(this.base, script.slice(0, script.lastIndexOf("/")) || "/");
28636
+ return this.fs.resolvePath(dir, target);
28637
+ }
28638
+ async installedPackage(real, scope) {
28639
+ for (const root of await this.roots(scope)) {
28640
+ const top = await physicalPathAsync(this.base, root).catch(() => void 0);
28641
+ if (!top || !real.startsWith(`${top}/`)) continue;
28642
+ const [first = "", second] = real.slice(top.length + 1).split("/");
28643
+ const pkg = first.startsWith("@") && second ? `${top}/${first}/${second}` : `${top}/${first}`;
28644
+ if (pkg !== real && await this.base.exists(`${pkg}/package.json`)) return pkg;
28645
+ }
28646
+ return void 0;
28647
+ }
28595
28648
  async glueOwner(glue, name2, scope) {
28596
28649
  const commands = [...(await this.commands(scope)).values()];
28597
28650
  const owners = commands.filter((c) => c.abi === "emscripten" && !c.script && c.glue === glue);
@@ -28687,7 +28740,10 @@ var Launcher = class {
28687
28740
  const found = await this.resolve(file, argv[0] ?? file, cwd, scope);
28688
28741
  const named = typeof argv0 === "string" && found && !found.fixed;
28689
28742
  const direct = named ? { ...found, argv0 } : found;
28690
- if (direct) return { target: direct, args: [...direct.prefix ?? [], ...argv.slice(1)] };
28743
+ if (direct) {
28744
+ const shim = direct.shim ? { sources: [direct.shim], asked: direct.asked ? { [direct.shim]: direct.asked } : {} } : {};
28745
+ return { target: direct, args: [...direct.prefix ?? [], ...argv.slice(1)], ...shim };
28746
+ }
28691
28747
  if (catalogOnly && !await this.scriptCommand(file, cwd, scope)) return void 0;
28692
28748
  const script = await this.interpreted(file, argv, cwd, scope);
28693
28749
  return script && { ...script, script: true };