@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.
@@ -7128,7 +7128,7 @@ function satisfies(version, range2) {
7128
7128
  }
7129
7129
 
7130
7130
  // src/version.ts
7131
- var KERNEL_VERSION = true ? "1.140.4" : "0.0.0-dev";
7131
+ var KERNEL_VERSION = true ? "1.140.6" : "0.0.0-dev";
7132
7132
  var OS_RELEASE = "6.0.0-slicc";
7133
7133
  function procVersion() {
7134
7134
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -7442,7 +7442,7 @@ function winners(tier) {
7442
7442
  }
7443
7443
  return out;
7444
7444
  }
7445
- async function scanCommands(fs, modules, binsFrom = Number.POSITIVE_INFINITY, kernel = KERNEL_VERSION) {
7445
+ async function scanCommands(fs, modules, binsFrom = Number.POSITIVE_INFINITY, kernel = KERNEL_VERSION, refused3) {
7446
7446
  const found = /* @__PURE__ */ new Map();
7447
7447
  const physical = physicalResolver(fs);
7448
7448
  const tiers = (typeof modules === "string" ? [modules] : modules).map(
@@ -7450,6 +7450,7 @@ async function scanCommands(fs, modules, binsFrom = Number.POSITIVE_INFINITY, ke
7450
7450
  );
7451
7451
  for (const [index, roots] of tiers.entries()) {
7452
7452
  const tier = await tierPackages(fs, physical, roots, index >= binsFrom, kernel);
7453
+ if (refused3) refused3.push(...tier.flatMap((entry) => entry.commands.filter((c) => c.refused)));
7453
7454
  for (const [name2, { pkg, command }] of winners(tier)) {
7454
7455
  if (!found.has(name2)) found.set(name2, await withPackagePaths(fs, pkg, command));
7455
7456
  }
@@ -27447,7 +27448,13 @@ function refusing(command) {
27447
27448
  args: [`${command.name}: ${command.refused}`],
27448
27449
  refused: command.refused,
27449
27450
  shows: command.script ?? command.wasm,
27450
- origin: { abi: command.abi, glue: command.glue, wasm: command.wasm }
27451
+ origin: {
27452
+ abi: command.abi,
27453
+ glue: command.glue,
27454
+ wasm: command.wasm,
27455
+ ...command.variants ? { variants: command.variants.map((one) => one.wasm) } : {},
27456
+ ...command.script ? { script: true } : {}
27457
+ }
27451
27458
  };
27452
27459
  }
27453
27460
 
@@ -28416,7 +28423,16 @@ var Launcher = class {
28416
28423
  if (!found) {
28417
28424
  found = this.trustedAppended().then(async (appended2) => {
28418
28425
  const tiers = await this.tiers(scope, appended2);
28419
- return scanCommands(this.scanned, tiers, tiers.length - appended2.length);
28426
+ const refused3 = [];
28427
+ const commands = await scanCommands(
28428
+ this.scanned,
28429
+ tiers,
28430
+ tiers.length - appended2.length,
28431
+ void 0,
28432
+ refused3
28433
+ );
28434
+ this.refusedOf.set(commands, refused3.map(refusing));
28435
+ return commands;
28420
28436
  }).then(
28421
28437
  (commands) => this.refusals(commands).set(SUDO_COMMAND.name, SUDO_COMMAND).set(CRONTAB_COMMAND.name, CRONTAB_COMMAND)
28422
28438
  );
@@ -28424,6 +28440,7 @@ var Launcher = class {
28424
28440
  }
28425
28441
  return found;
28426
28442
  }
28443
+ refusedOf = /* @__PURE__ */ new WeakMap();
28427
28444
  refusals(commands) {
28428
28445
  for (const [name2, command] of commands) {
28429
28446
  if (!command.refused) continue;
@@ -28577,22 +28594,30 @@ var Launcher = class {
28577
28594
  return await this.commandAt(path, scope) ?? await this.refusedAt(path, name2, scope);
28578
28595
  }
28579
28596
  async refusedAt(path, name2, scope) {
28580
- const refused3 = [...(await this.commands(scope)).values()].filter((c) => c.origin);
28581
- if (refused3.length === 0 || !await this.base.exists(path)) return void 0;
28597
+ const refused3 = this.refusedOf.get(await this.commands(scope)) ?? [];
28598
+ if (refused3.length === 0) return void 0;
28599
+ const st = await this.base.stat(path).catch(() => void 0);
28600
+ if (!st?.isFile) return void 0;
28582
28601
  const real = await physicalPathAsync(this.base, path).catch(() => path);
28583
- const at = async (c, which) => {
28584
- const own = c.origin[which];
28585
- return own === path || await physicalPathAsync(this.base, own).catch(() => own) === real;
28586
- };
28602
+ const same3 = async (own) => own === path || await physicalPathAsync(this.base, own).catch(() => own) === real;
28587
28603
  const owners = [];
28588
28604
  for (const c of refused3) {
28589
- if (await at(c, "glue") || await at(c, "wasm")) owners.push(c);
28605
+ const origin = c.origin;
28606
+ for (const own of [origin.glue, origin.wasm, ...origin.variants ?? []]) {
28607
+ if (!await same3(own)) continue;
28608
+ owners.push(c);
28609
+ break;
28610
+ }
28590
28611
  }
28591
- if (owners.length > 0) return owners.find((c) => c.name === name2) ?? owners[0];
28612
+ const stem = name2.replace(/\.wasm$/, "");
28613
+ const named = owners.find((c) => c.name === name2) ?? owners.find((c) => c.name === stem);
28614
+ return named ?? owners[0] ?? await this.refusedCopy(real, name2, refused3);
28615
+ }
28616
+ async refusedCopy(real, name2, refused3) {
28592
28617
  const dir = real.slice(0, real.lastIndexOf("/"));
28593
28618
  for (const c of refused3) {
28594
28619
  const origin = c.origin;
28595
- if (origin.abi !== "emscripten" || c.name !== name2) continue;
28620
+ if (origin.abi !== "emscripten" || origin.script || c.name !== name2) continue;
28596
28621
  const own = await physicalPathAsync(this.base, origin.glue).catch(() => origin.glue);
28597
28622
  if (own.slice(0, own.lastIndexOf("/")) === dir && await this.sameFile(real, own)) return c;
28598
28623
  }