@ai-ecoverse/slicc-kernel 1.140.4 → 1.140.6

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/dist/node.js CHANGED
@@ -7514,7 +7514,7 @@ function satisfies(version, range2) {
7514
7514
  }
7515
7515
 
7516
7516
  // src/version.ts
7517
- var KERNEL_VERSION = true ? "1.140.4" : "0.0.0-dev";
7517
+ var KERNEL_VERSION = true ? "1.140.6" : "0.0.0-dev";
7518
7518
  var OS_RELEASE = "6.0.0-slicc";
7519
7519
  function procVersion() {
7520
7520
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -7828,7 +7828,7 @@ function winners(tier) {
7828
7828
  }
7829
7829
  return out;
7830
7830
  }
7831
- async function scanCommands(fs, modules, binsFrom = Number.POSITIVE_INFINITY, kernel = KERNEL_VERSION) {
7831
+ async function scanCommands(fs, modules, binsFrom = Number.POSITIVE_INFINITY, kernel = KERNEL_VERSION, refused3) {
7832
7832
  const found = /* @__PURE__ */ new Map();
7833
7833
  const physical = physicalResolver(fs);
7834
7834
  const tiers = (typeof modules === "string" ? [modules] : modules).map(
@@ -7836,6 +7836,7 @@ async function scanCommands(fs, modules, binsFrom = Number.POSITIVE_INFINITY, ke
7836
7836
  );
7837
7837
  for (const [index, roots] of tiers.entries()) {
7838
7838
  const tier = await tierPackages(fs, physical, roots, index >= binsFrom, kernel);
7839
+ if (refused3) refused3.push(...tier.flatMap((entry) => entry.commands.filter((c) => c.refused)));
7839
7840
  for (const [name2, { pkg, command }] of winners(tier)) {
7840
7841
  if (!found.has(name2)) found.set(name2, await withPackagePaths(fs, pkg, command));
7841
7842
  }
@@ -27367,7 +27368,13 @@ function refusing(command) {
27367
27368
  args: [`${command.name}: ${command.refused}`],
27368
27369
  refused: command.refused,
27369
27370
  shows: command.script ?? command.wasm,
27370
- origin: { abi: command.abi, glue: command.glue, wasm: command.wasm }
27371
+ origin: {
27372
+ abi: command.abi,
27373
+ glue: command.glue,
27374
+ wasm: command.wasm,
27375
+ ...command.variants ? { variants: command.variants.map((one) => one.wasm) } : {},
27376
+ ...command.script ? { script: true } : {}
27377
+ }
27371
27378
  };
27372
27379
  }
27373
27380
 
@@ -28332,7 +28339,16 @@ var Launcher = class {
28332
28339
  if (!found) {
28333
28340
  found = this.trustedAppended().then(async (appended2) => {
28334
28341
  const tiers = await this.tiers(scope, appended2);
28335
- return scanCommands(this.scanned, tiers, tiers.length - appended2.length);
28342
+ const refused3 = [];
28343
+ const commands = await scanCommands(
28344
+ this.scanned,
28345
+ tiers,
28346
+ tiers.length - appended2.length,
28347
+ void 0,
28348
+ refused3
28349
+ );
28350
+ this.refusedOf.set(commands, refused3.map(refusing));
28351
+ return commands;
28336
28352
  }).then(
28337
28353
  (commands) => this.refusals(commands).set(SUDO_COMMAND.name, SUDO_COMMAND).set(CRONTAB_COMMAND.name, CRONTAB_COMMAND)
28338
28354
  );
@@ -28340,6 +28356,7 @@ var Launcher = class {
28340
28356
  }
28341
28357
  return found;
28342
28358
  }
28359
+ refusedOf = /* @__PURE__ */ new WeakMap();
28343
28360
  refusals(commands) {
28344
28361
  for (const [name2, command] of commands) {
28345
28362
  if (!command.refused) continue;
@@ -28493,22 +28510,30 @@ var Launcher = class {
28493
28510
  return await this.commandAt(path, scope) ?? await this.refusedAt(path, name2, scope);
28494
28511
  }
28495
28512
  async refusedAt(path, name2, scope) {
28496
- const refused3 = [...(await this.commands(scope)).values()].filter((c) => c.origin);
28497
- if (refused3.length === 0 || !await this.base.exists(path)) return void 0;
28513
+ const refused3 = this.refusedOf.get(await this.commands(scope)) ?? [];
28514
+ if (refused3.length === 0) return void 0;
28515
+ const st = await this.base.stat(path).catch(() => void 0);
28516
+ if (!st?.isFile) return void 0;
28498
28517
  const real = await physicalPathAsync(this.base, path).catch(() => path);
28499
- const at = async (c, which) => {
28500
- const own = c.origin[which];
28501
- return own === path || await physicalPathAsync(this.base, own).catch(() => own) === real;
28502
- };
28518
+ const same2 = async (own) => own === path || await physicalPathAsync(this.base, own).catch(() => own) === real;
28503
28519
  const owners = [];
28504
28520
  for (const c of refused3) {
28505
- if (await at(c, "glue") || await at(c, "wasm")) owners.push(c);
28521
+ const origin = c.origin;
28522
+ for (const own of [origin.glue, origin.wasm, ...origin.variants ?? []]) {
28523
+ if (!await same2(own)) continue;
28524
+ owners.push(c);
28525
+ break;
28526
+ }
28506
28527
  }
28507
- if (owners.length > 0) return owners.find((c) => c.name === name2) ?? owners[0];
28528
+ const stem = name2.replace(/\.wasm$/, "");
28529
+ const named = owners.find((c) => c.name === name2) ?? owners.find((c) => c.name === stem);
28530
+ return named ?? owners[0] ?? await this.refusedCopy(real, name2, refused3);
28531
+ }
28532
+ async refusedCopy(real, name2, refused3) {
28508
28533
  const dir = real.slice(0, real.lastIndexOf("/"));
28509
28534
  for (const c of refused3) {
28510
28535
  const origin = c.origin;
28511
- if (origin.abi !== "emscripten" || c.name !== name2) continue;
28536
+ if (origin.abi !== "emscripten" || origin.script || c.name !== name2) continue;
28512
28537
  const own = await physicalPathAsync(this.base, origin.glue).catch(() => origin.glue);
28513
28538
  if (own.slice(0, own.lastIndexOf("/")) === dir && await this.sameFile(real, own)) return c;
28514
28539
  }