@ai-ecoverse/slicc-kernel 1.93.0 → 1.93.2

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
@@ -10500,7 +10500,7 @@ function mountTable(mounts = []) {
10500
10500
  }
10501
10501
 
10502
10502
  // src/version.ts
10503
- var KERNEL_VERSION = true ? "1.93.0" : "0.0.0-dev";
10503
+ var KERNEL_VERSION = true ? "1.93.2" : "0.0.0-dev";
10504
10504
  var OS_RELEASE = "6.0.0-slicc";
10505
10505
  function procVersion() {
10506
10506
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -14073,6 +14073,7 @@ var WasmProcess = class {
14073
14073
  this.nodes = options.nodes ?? new VfsNodes(options.fs);
14074
14074
  if (!options.nodes) options.openFiles?.add(this.nodes);
14075
14075
  this.children.onChildState = () => this.signal(SIG.CHLD);
14076
+ this.seedDl(options.dl);
14076
14077
  this.children.onReap = (pid2) => {
14077
14078
  this.deathSignals.delete(pid2);
14078
14079
  options.onReap?.(pid2);
@@ -14907,7 +14908,7 @@ var WasmProcess = class {
14907
14908
  switch (req.op) {
14908
14909
  case "proc-fork":
14909
14910
  this.refuseIfPending(req.restart);
14910
- return { ok: true, kind: "json", json: await this.children.fork(req.state) };
14911
+ return { ok: true, kind: "json", json: await this.children.fork(this.withDl(req.state)) };
14911
14912
  case "proc-spawn":
14912
14913
  this.refuseIfPending(req.restart);
14913
14914
  return { ok: true, kind: "json", json: await this.spawn(req) };
@@ -15050,6 +15051,20 @@ var WasmProcess = class {
15050
15051
  free: [],
15051
15052
  live: /* @__PURE__ */ new Set()
15052
15053
  };
15054
+ withDl(state) {
15055
+ if (this.dlLog.length === 0) return state;
15056
+ const { next: next2, handle, free, live } = this.closures;
15057
+ const dl = { log: [...this.dlLog], next: next2, handle, free: [...free], live: [...live] };
15058
+ return { ...state, dl };
15059
+ }
15060
+ seedDl(dl) {
15061
+ if (!dl) return;
15062
+ this.dlLog.push(...dl.log);
15063
+ this.closures.next = dl.next;
15064
+ this.closures.handle = dl.handle;
15065
+ this.closures.free.push(...dl.free);
15066
+ for (const index of dl.live) this.closures.live.add(index);
15067
+ }
15053
15068
  allocateClosure(floor) {
15054
15069
  const index = this.closures.free.pop() ?? Math.max(floor, this.closures.next);
15055
15070
  this.closures.next = Math.max(this.closures.next, index + 1);
@@ -15359,6 +15374,7 @@ function processOptions(opts, header4, hooks, created3) {
15359
15374
  ...opts.settling ? { settling: opts.settling } : {},
15360
15375
  spawner: opts.spawner,
15361
15376
  forker: opts.forker,
15377
+ ...opts.fork?.dl ? { dl: opts.fork.dl } : {},
15362
15378
  fs: opts.fs,
15363
15379
  kill: opts.kill,
15364
15380
  ...opts.writesBack ? { writesBack: opts.writesBack } : {},
@@ -19047,6 +19063,9 @@ var Launcher = class {
19047
19063
  hostname;
19048
19064
  watchers = new FsWatchers();
19049
19065
  pnpmHome;
19066
+ pnpmChain;
19067
+ pnpmMade;
19068
+ pnpmEpoch = 0;
19050
19069
  mounts;
19051
19070
  createDriverWorker;
19052
19071
  media;
@@ -19097,7 +19116,10 @@ var Launcher = class {
19097
19116
  this.mounts = new MountTable({
19098
19117
  open: (type, spec) => this.driver(type, spec),
19099
19118
  busy: (target) => [...this.openFiles].some((nodes) => nodes.holds(target)) || heldUnder(this.held, target),
19100
- changed: this.watchers.changed.bind(this.watchers),
19119
+ changed: (...paths) => {
19120
+ if (paths.some((path) => this.pnpmChain.has(path))) this.pnpmStale();
19121
+ this.watchers.changed(...paths);
19122
+ },
19101
19123
  owners: this.owners
19102
19124
  });
19103
19125
  this.mounted = this.mounts.wrap(options.fs);
@@ -19110,6 +19132,7 @@ var Launcher = class {
19110
19132
  this.fstabRetries = options.fstabRetries ?? FSTAB_RETRIES;
19111
19133
  this.processMounts = options.processMounts ?? true;
19112
19134
  this.pnpmHome = options.env?.PNPM_HOME ?? SYSTEM_PNPM_HOME;
19135
+ this.pnpmChain = new Set(chain(normalizePath(this.pnpmHome)));
19113
19136
  this.modulesDir = options.modules ?? "/node_modules";
19114
19137
  this.appended = appendedRoots(options.commands);
19115
19138
  this.cdp = new CdpHosts(options.cdp);
@@ -19361,8 +19384,17 @@ var Launcher = class {
19361
19384
  }
19362
19385
  if (interpreter(head) !== "node") return void 0;
19363
19386
  const wasm = modulePath(glue);
19364
- if (!await this.base.exists(wasm)) return void 0;
19365
- return { abi: "emscripten", glue, wasm, argv0: baseName(argv0 || file), ...asked };
19387
+ if (await this.base.exists(wasm)) {
19388
+ return { abi: "emscripten", glue, wasm, argv0: baseName(argv0 || file), ...asked };
19389
+ }
19390
+ const owner = await this.glueOwner(glue, baseName(file), scope);
19391
+ return owner && { ...targetOf(owner), ...asked };
19392
+ }
19393
+ async glueOwner(glue, name2, scope) {
19394
+ const owners = [...(await this.commands(scope)).values()].filter(
19395
+ (c) => c.abi === "emscripten" && !c.script && c.glue === glue
19396
+ );
19397
+ return owners.find((c) => c.name === name2) ?? owners[0];
19366
19398
  }
19367
19399
  async head(path) {
19368
19400
  try {
@@ -19716,6 +19748,7 @@ var Launcher = class {
19716
19748
  delete env[TICKET_ENV];
19717
19749
  env.HOSTNAME = this.hostname;
19718
19750
  let program;
19751
+ await this.pnpmReady();
19719
19752
  try {
19720
19753
  const caller = { pid: req.ppid ?? 0, uid: req.cred.euid, tag: req.tag };
19721
19754
  if (this.integrity) await this.checkedSources(planned, caller);
@@ -20360,8 +20393,7 @@ var Launcher = class {
20360
20393
  this.fs
20361
20394
  );
20362
20395
  void this.unlinked.sweep(entry.target);
20363
- if (this.pnpmHome.startsWith(`${entry.target.replace(/\/$/, "")}/`))
20364
- await this.provisionPnpmHome();
20396
+ this.pnpmStale();
20365
20397
  return entry;
20366
20398
  }
20367
20399
  async ownTmp() {
@@ -20409,8 +20441,18 @@ var Launcher = class {
20409
20441
  if (path === "/") return path;
20410
20442
  return joinName(await realDir(this.base, parentOf(path)), baseName(path));
20411
20443
  }
20412
- async provisionPnpmHome() {
20413
- await this.base.mkdir(this.pnpmHome, { recursive: true }).catch(() => void 0);
20444
+ pnpmReady() {
20445
+ if (this.pnpmMade !== void 0) return this.pnpmMade;
20446
+ const epoch = this.pnpmEpoch;
20447
+ const made2 = this.base.mkdir(this.pnpmHome, { recursive: true }).then(() => this.owners ? this.stampLayout() : void 0).catch(() => {
20448
+ if (this.pnpmEpoch === epoch) this.pnpmMade = void 0;
20449
+ });
20450
+ this.pnpmMade = made2;
20451
+ return made2;
20452
+ }
20453
+ pnpmStale() {
20454
+ this.pnpmEpoch++;
20455
+ this.pnpmMade = void 0;
20414
20456
  }
20415
20457
  mountedBy(spec, cred) {
20416
20458
  if (!this.owners || cred.euid === 0 && cred.egid === 0) return spec;
@@ -20444,6 +20486,7 @@ var Launcher = class {
20444
20486
  umount(target, detach = false) {
20445
20487
  const at = normalizePath(target);
20446
20488
  this.mounts.umount(at, detach);
20489
+ this.pnpmStale();
20447
20490
  if (!detach) return;
20448
20491
  for (const nodes of this.openFiles) nodes.revoke(at);
20449
20492
  for (const holds of this.held) holds.revoke(at);
@@ -20509,7 +20552,7 @@ var Launcher = class {
20509
20552
  await this.resolvePrefixes();
20510
20553
  for (const dir of SHARED_DIRS) await this.base.mkdir(dir, { recursive: true });
20511
20554
  if (this.owners) await this.ownTmp();
20512
- await this.provisionPnpmHome();
20555
+ await this.pnpmReady();
20513
20556
  await this.users.ensure();
20514
20557
  if (this.owners) await this.stampLayout();
20515
20558
  if (this.owners) await this.sudoer.provision();