@ai-ecoverse/slicc-kernel 1.195.26 → 1.195.27

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.
@@ -8863,7 +8863,7 @@ var init_version = __esm({
8863
8863
  "src/version.ts"() {
8864
8864
  "use strict";
8865
8865
  init_captured_globals();
8866
- KERNEL_VERSION = true ? "1.195.26" : "0.0.0-dev";
8866
+ KERNEL_VERSION = true ? "1.195.27" : "0.0.0-dev";
8867
8867
  OS_RELEASE = "6.0.0-slicc";
8868
8868
  }
8869
8869
  });
@@ -8862,7 +8862,7 @@ var init_version = __esm({
8862
8862
  "src/version.ts"() {
8863
8863
  "use strict";
8864
8864
  init_captured_globals();
8865
- KERNEL_VERSION = true ? "1.195.26" : "0.0.0-dev";
8865
+ KERNEL_VERSION = true ? "1.195.27" : "0.0.0-dev";
8866
8866
  OS_RELEASE = "6.0.0-slicc";
8867
8867
  }
8868
8868
  });
package/dist/node.js CHANGED
@@ -7643,7 +7643,7 @@ function satisfies(version, range2) {
7643
7643
  }
7644
7644
 
7645
7645
  // src/version.ts
7646
- var KERNEL_VERSION = true ? "1.195.26" : "0.0.0-dev";
7646
+ var KERNEL_VERSION = true ? "1.195.27" : "0.0.0-dev";
7647
7647
  var OS_RELEASE = "6.0.0-slicc";
7648
7648
  function procVersion() {
7649
7649
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -8052,12 +8052,12 @@ function binfmtEntry(pkg, key, value2) {
8052
8052
  return { name: key, pkg, command: value2, preserveArgv0: false };
8053
8053
  }
8054
8054
  async function scanBinfmts(fs, modules, warn = () => {
8055
- }) {
8055
+ }, readManifest = (path) => fs.readFile(path)) {
8056
8056
  const found = /* @__PURE__ */ new Map();
8057
8057
  for (const pkg of await packagesIn(fs, modules)) {
8058
8058
  let manifest;
8059
8059
  try {
8060
- manifest = JSON.parse(await fs.readFile(`${pkg}/package.json`));
8060
+ manifest = JSON.parse(await readManifest(`${pkg}/package.json`));
8061
8061
  } catch {
8062
8062
  continue;
8063
8063
  }
@@ -18516,6 +18516,9 @@ var SealedBroker = class {
18516
18516
 
18517
18517
  // src/sudo-files.ts
18518
18518
  var HEADER_BYTES = 256;
18519
+ async function fingerprint(bytes) {
18520
+ return { head: new Uint8Array(bytes.subarray(0, HEADER_BYTES)), hash: await sha2562(bytes) };
18521
+ }
18519
18522
  var SudoReads = class {
18520
18523
  access;
18521
18524
  reads = /* @__PURE__ */ new Map();
@@ -18529,18 +18532,26 @@ var SudoReads = class {
18529
18532
  bytes(real) {
18530
18533
  let read = this.reads.get(real);
18531
18534
  if (!read) {
18532
- const saved = this.snapshots.get(real);
18533
- read = (saved ? Promise.resolve(saved) : this.access.read(real)).then(
18534
- async (data) => ({
18535
- head: new Uint8Array(data.subarray(0, HEADER_BYTES)),
18536
- hash: await sha2562(data)
18537
- }),
18538
- () => void 0
18539
- );
18535
+ read = this.raw(real).then(fingerprint, () => void 0);
18540
18536
  this.reads.set(real, read);
18541
18537
  }
18542
18538
  return read;
18543
18539
  }
18540
+ raw(real) {
18541
+ const saved = this.snapshots.get(real);
18542
+ return saved ? Promise.resolve(saved) : this.access.read(real);
18543
+ }
18544
+ async manifest(path, verify) {
18545
+ const real = await this.access.real(path);
18546
+ this.saw(path, real);
18547
+ const bytes = new Uint8Array(await this.raw(real));
18548
+ await verify(real, bytes);
18549
+ const read = await fingerprint(bytes);
18550
+ const earlier = this.reads.get(real);
18551
+ const consistent = !earlier || (await earlier)?.hash === read.hash;
18552
+ this.reads.set(real, Promise.resolve(consistent ? read : void 0));
18553
+ return new TextDecoder().decode(bytes);
18554
+ }
18544
18555
  saw(path, real) {
18545
18556
  const seen = this.names.get(path);
18546
18557
  this.names.set(path, seen === void 0 || seen === real ? real : "");
@@ -31417,7 +31428,7 @@ function header3(headers, name2) {
31417
31428
  const values = headers.filter(([n]) => n.toLowerCase() === name2).map(([, v]) => v);
31418
31429
  return values.length > 0 ? values.join(", ") : void 0;
31419
31430
  }
31420
- function fingerprint(headers) {
31431
+ function fingerprint2(headers) {
31421
31432
  const fields2 = MATCHED.map((name2) => header3(headers, name2) ?? "");
31422
31433
  return JSON.stringify([...fields2, header3(headers, "authorization") !== void 0]);
31423
31434
  }
@@ -31488,7 +31499,7 @@ function replayingHops(inner, heldMs = HELD_MS) {
31488
31499
  const owner = caller ?? KERNEL;
31489
31500
  const key = keyOf3(owner, request2.method, request2.url);
31490
31501
  const waiting = held2.get(key);
31491
- if (waiting && waiting.fingerprint === fingerprint(request2.headers)) {
31502
+ if (waiting && waiting.fingerprint === fingerprint2(request2.headers)) {
31492
31503
  held2.delete(key);
31493
31504
  clearTimeout(waiting.timer);
31494
31505
  return replay(waiting);
@@ -31499,7 +31510,7 @@ function replayingHops(inner, heldMs = HELD_MS) {
31499
31510
  return replay({
31500
31511
  owner,
31501
31512
  method: request2.method,
31502
- fingerprint: fingerprint(request2.headers),
31513
+ fingerprint: fingerprint2(request2.headers),
31503
31514
  hops: response.redirects,
31504
31515
  final: response
31505
31516
  });
@@ -37310,21 +37321,31 @@ var Launcher = class {
37310
37321
  const roots = await Promise.all(homes.map((home) => pnpmGlobalRoots(this.base, home)));
37311
37322
  return new Set(roots.flat());
37312
37323
  }
37313
- interpreters(scope = "") {
37324
+ interpreters(scope = "", reads) {
37314
37325
  if (this.leaseImage) return Promise.resolve([]);
37326
+ if (reads) return this.scanInterpreters(scope, reads);
37315
37327
  let found = this.binfmts.get(scope);
37316
37328
  if (!found) {
37317
- found = this.roots(scope).then(
37318
- (roots) => scanBinfmts(this.scanned, roots, (message3) => {
37319
- if (this.warned.has(message3)) return;
37320
- this.warned.add(message3);
37321
- console.warn(message3);
37322
- })
37323
- );
37329
+ found = this.scanInterpreters(scope);
37324
37330
  this.binfmts.set(scope, found);
37325
37331
  }
37326
37332
  return found;
37327
37333
  }
37334
+ async scanInterpreters(scope, reads) {
37335
+ const read = reads && ((path) => reads.manifest(path, async (real, bytes) => {
37336
+ await this.integrity?.checkSnapshot(path, real, bytes, KERNEL_CALLER);
37337
+ }));
37338
+ return scanBinfmts(
37339
+ this.scanned,
37340
+ await this.roots(scope),
37341
+ (message3) => {
37342
+ if (this.warned.has(message3)) return;
37343
+ this.warned.add(message3);
37344
+ console.warn(message3);
37345
+ },
37346
+ read
37347
+ );
37348
+ }
37328
37349
  async tiers(scope = "", appended2) {
37329
37350
  const system = [
37330
37351
  [this.modulesDir],
@@ -37597,15 +37618,15 @@ var Launcher = class {
37597
37618
  if (!reader || !this.dac) return true;
37598
37619
  return (await access(this.fs, reader, path, R_OK)).denied === void 0;
37599
37620
  }
37600
- async binfmtOf(path, head, scope, reader) {
37621
+ async binfmtOf(path, head, scope, reader, reads) {
37601
37622
  const shown2 = await this.mayRead(reader, path) ? head : void 0;
37602
- return binfmtFor(await this.interpreters(scope), path, shown2);
37623
+ return binfmtFor(await this.interpreters(scope, reads), path, shown2);
37603
37624
  }
37604
37625
  async interpreterWords(head, script, who) {
37605
37626
  const bang = shebang(head);
37606
37627
  if (bang) return { words: bang, kept: [], binfmts: [] };
37607
37628
  if (isWasm(head)) return void 0;
37608
- const binfmt = await this.binfmtOf(script, head, who.scope, who.reader);
37629
+ const binfmt = await this.binfmtOf(script, head, who.scope, who.reader, who.reads);
37609
37630
  if (!binfmt) return void 0;
37610
37631
  const kept = binfmt.preserveArgv0 ? [who.argv0 ?? who.argv[0]] : [];
37611
37632
  return { words: [binfmt.command], kept, binfmts: [`${binfmt.pkg}/package.json`] };