@ai-ecoverse/slicc-kernel 1.178.2 → 1.178.3

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.
@@ -7518,7 +7518,7 @@ var init_version = __esm({
7518
7518
  "src/version.ts"() {
7519
7519
  "use strict";
7520
7520
  init_captured_globals();
7521
- KERNEL_VERSION = true ? "1.178.2" : "0.0.0-dev";
7521
+ KERNEL_VERSION = true ? "1.178.3" : "0.0.0-dev";
7522
7522
  OS_RELEASE = "6.0.0-slicc";
7523
7523
  }
7524
7524
  });
@@ -7517,7 +7517,7 @@ var init_version = __esm({
7517
7517
  "src/version.ts"() {
7518
7518
  "use strict";
7519
7519
  init_captured_globals();
7520
- KERNEL_VERSION = true ? "1.178.2" : "0.0.0-dev";
7520
+ KERNEL_VERSION = true ? "1.178.3" : "0.0.0-dev";
7521
7521
  OS_RELEASE = "6.0.0-slicc";
7522
7522
  }
7523
7523
  });
package/dist/node.js CHANGED
@@ -3709,7 +3709,7 @@ function satisfies(version, range2) {
3709
3709
  }
3710
3710
 
3711
3711
  // src/version.ts
3712
- var KERNEL_VERSION = true ? "1.178.2" : "0.0.0-dev";
3712
+ var KERNEL_VERSION = true ? "1.178.3" : "0.0.0-dev";
3713
3713
  var OS_RELEASE = "6.0.0-slicc";
3714
3714
  function procVersion() {
3715
3715
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -12773,11 +12773,11 @@ function systemFile(name2, listing, now, memory) {
12773
12773
  listing.processes.reduce((sum2, p) => sum2 + p.memory, 0)
12774
12774
  );
12775
12775
  }
12776
- const live = listing.processes.filter((p) => p.state !== "Z");
12776
+ const live2 = listing.processes.filter((p) => p.state !== "Z");
12777
12777
  if (name2 === "loadavg") {
12778
12778
  const last = Math.max(0, ...listing.processes.map((p) => p.pid));
12779
12779
  const [one, five, fifteen] = (listing.load ?? [0, 0, 0]).map((n) => n.toFixed(2));
12780
- return `${one} ${five} ${fifteen} 1/${live.length} ${last}
12780
+ return `${one} ${five} ${fifteen} 1/${live2.length} ${last}
12781
12781
  `;
12782
12782
  }
12783
12783
  const sum = (key) => listing.cpu?.[key] ?? listing.processes.reduce((n, p) => n + (p[key] ?? 0), 0);
@@ -15266,30 +15266,49 @@ function timestampKey(owner, type) {
15266
15266
  }
15267
15267
  return parent ? JSON.stringify(["ppid", parent.pid, parent.started]) : void 0;
15268
15268
  }
15269
+ function boundKey(bound3) {
15270
+ return JSON.stringify(
15271
+ Object.keys(bound3).sort().map((path) => [path, bound3[path]])
15272
+ );
15273
+ }
15274
+ function writable2(bound3) {
15275
+ return bound3 !== void 0 && Object.keys(bound3).length > 0;
15276
+ }
15277
+ function live(stamp, policy, now) {
15278
+ return stamp.at <= now && (policy.minutes < 0 || now - stamp.at < policy.minutes * MINUTE_MS2);
15279
+ }
15269
15280
  var Timestamps = class {
15270
15281
  users = /* @__PURE__ */ new Map();
15271
15282
  now;
15272
15283
  constructor(now) {
15273
15284
  this.now = now;
15274
15285
  }
15275
- current(owner, policy) {
15286
+ current(owner, policy, bound3) {
15276
15287
  if (policy.minutes === 0) return false;
15277
15288
  const key = timestampKey(owner, policy.type);
15278
- const at = key === void 0 ? void 0 : this.users.get(owner.uid)?.get(key);
15279
- if (at === void 0) return false;
15289
+ const stamp = key === void 0 ? void 0 : this.users.get(owner.uid)?.get(key);
15290
+ if (stamp === void 0) return false;
15280
15291
  const now = this.now();
15281
- return at <= now && (policy.minutes < 0 || now - at < policy.minutes * MINUTE_MS2);
15292
+ if (!live(stamp, policy, now)) {
15293
+ this.drop(owner.uid, key);
15294
+ return false;
15295
+ }
15296
+ if (!writable2(bound3)) return true;
15297
+ return stamp.covered.has(boundKey(bound3));
15282
15298
  }
15283
- stamp(owner, policy) {
15299
+ stamp(owner, policy, bound3) {
15284
15300
  const key = policy.minutes === 0 ? void 0 : timestampKey(owner, policy.type);
15285
15301
  if (key === void 0) return false;
15286
15302
  const now = this.now();
15287
15303
  const records = this.users.get(owner.uid) ?? /* @__PURE__ */ new Map();
15288
15304
  this.users.set(owner.uid, records);
15305
+ const prior = records.get(key);
15306
+ const covered = prior !== void 0 && live(prior, policy, now) ? prior.covered : /* @__PURE__ */ new Set();
15307
+ if (writable2(bound3)) covered.add(boundKey(bound3));
15289
15308
  records.delete(key);
15290
- records.set(key, now);
15291
- for (const [old, at] of records) {
15292
- const stale = policy.minutes > 0 && (at > now || now - at >= policy.minutes * MINUTE_MS2);
15309
+ records.set(key, { at: now, covered });
15310
+ for (const [old, stamp] of records) {
15311
+ const stale = policy.minutes > 0 && !live(stamp, policy, now);
15293
15312
  if (stale || records.size > TIMESTAMPS_MAX) records.delete(old);
15294
15313
  }
15295
15314
  return true;
@@ -15303,6 +15322,11 @@ var Timestamps = class {
15303
15322
  remove(uid) {
15304
15323
  this.users.delete(uid);
15305
15324
  }
15325
+ drop(uid, key) {
15326
+ const records = this.users.get(uid);
15327
+ records?.delete(key);
15328
+ if (records?.size === 0) this.users.delete(uid);
15329
+ }
15306
15330
  };
15307
15331
 
15308
15332
  // src/sudoers.ts
@@ -16309,12 +16333,12 @@ function usable(parsed2) {
16309
16333
  function policyOf(settings) {
16310
16334
  return { type: settings.timestampType, minutes: settings.timestampTimeout };
16311
16335
  }
16312
- function described(rule, writable2) {
16336
+ function described(rule, writable3) {
16313
16337
  const cmnd = rule.cmnd === "*" ? "ALL" : commandText(rule.cmnd);
16314
16338
  const cwd = rule.cwd === void 0 ? "" : `CWD=${quoteWord(rule.cwd)} `;
16315
16339
  const stdin = rule.stdin === void 0 ? "" : "STDIN=none ";
16316
16340
  const sums = Object.entries(rule.sha256 ?? {}).map(([path, hex4]) => `SHA256=${quoteWord(path)}:${hex4} `).join("");
16317
- const flag = writable2 ? " # user-writable command" : "";
16341
+ const flag = writable3 ? " # user-writable command" : "";
16318
16342
  return ` (${rule.target}) ${cwd}${stdin}${sums}${rule.nopasswd ? "NOPASSWD: " : ""}${cmnd}${flag}`;
16319
16343
  }
16320
16344
  var Sudo = class {
@@ -16607,8 +16631,8 @@ var Sudo = class {
16607
16631
  `sudo: ${self.name} is not allowed to run ${quoted} as ${target.name}`
16608
16632
  );
16609
16633
  }
16610
- if (!parsed2.reset && this.timestamps.current(s.owner, s.policy)) {
16611
- this.timestamps.stamp(s.owner, s.policy);
16634
+ if (!parsed2.reset && this.timestamps.current(s.owner, s.policy, bound3)) {
16635
+ this.timestamps.stamp(s.owner, s.policy, bound3);
16612
16636
  this.logged(s, cwd, argv);
16613
16637
  return grant();
16614
16638
  }
@@ -16623,7 +16647,7 @@ var Sudo = class {
16623
16647
  if (!now) return failed2("ENOENT", `sudo: ${word}: command not found`);
16624
16648
  const shown2 = recordable(cwd, [...parsed2.command, ...Object.keys(bound3)]);
16625
16649
  const result = answer2.answer === "once" ? grant() : await this.always(self, target, { cwd, argv, bound: bound3 }, now, shown2, grant);
16626
- if (!("error" in result)) this.stamped(s, answer2);
16650
+ if (!("error" in result)) this.stamped(s, answer2, bound3);
16627
16651
  return result;
16628
16652
  });
16629
16653
  }
@@ -16657,8 +16681,8 @@ var Sudo = class {
16657
16681
  this.pending.delete(uid);
16658
16682
  }
16659
16683
  }
16660
- stamped(s, answer2) {
16661
- if (answer2.person && !s.parsed.reset) this.timestamps.stamp(s.owner, s.policy);
16684
+ stamped(s, answer2, bound3 = {}) {
16685
+ if (answer2.person && !s.parsed.reset) this.timestamps.stamp(s.owner, s.policy, bound3);
16662
16686
  }
16663
16687
  logged(s, cwd, argv) {
16664
16688
  const { caller, self, target, owner, policy } = s;
@@ -22858,18 +22882,18 @@ var VfsNodes = class {
22858
22882
  if (id2 !== void 0) this.know(node, id2);
22859
22883
  return node;
22860
22884
  }
22861
- open(path, pin, writable2 = false, id2, ino) {
22885
+ open(path, pin, writable3 = false, id2, ino) {
22862
22886
  const found = this.named(path, id2);
22863
22887
  const same2 = !found || ino === void 0 || found.ino === void 0 || found.ino === ino;
22864
22888
  if (found && !same2) this.orphan(found);
22865
22889
  const node = (same2 ? found : void 0) ?? this.create(path, id2, new VfsNode(this.fs, path, void 0, false, false, pin));
22866
22890
  node.ino ??= ino;
22867
22891
  node.opens++;
22868
- if (writable2) node.writers++;
22892
+ if (writable3) node.writers++;
22869
22893
  if (node.opens === 1) this.opened?.(node);
22870
22894
  return node;
22871
22895
  }
22872
- adopt(path, contents2, dirty, writable2 = false, id2) {
22896
+ adopt(path, contents2, dirty, writable3 = false, id2) {
22873
22897
  let node = this.named(path, id2);
22874
22898
  if (!node) {
22875
22899
  node = this.create(path, id2, new VfsNode(this.fs, path, contents2, false, dirty));
@@ -22877,7 +22901,7 @@ var VfsNodes = class {
22877
22901
  node.replace(contents2);
22878
22902
  }
22879
22903
  node.opens++;
22880
- if (writable2) node.writers++;
22904
+ if (writable3) node.writers++;
22881
22905
  if (node.opens === 1) this.opened?.(node);
22882
22906
  return node;
22883
22907
  }
@@ -22890,11 +22914,11 @@ var VfsNodes = class {
22890
22914
  if (node.writers > 0 && within7(path, prefix)) return true;
22891
22915
  return false;
22892
22916
  }
22893
- closed(node, writable2 = false) {
22917
+ closed(node, writable3 = false) {
22894
22918
  node.opens--;
22895
- if (writable2) node.writers--;
22919
+ if (writable3) node.writers--;
22896
22920
  if (node.opens > 0) {
22897
- if (writable2 && node.writers === 0) this.onClosed?.(node.path);
22921
+ if (writable3 && node.writers === 0) this.onClosed?.(node.path);
22898
22922
  return;
22899
22923
  }
22900
22924
  this.forget(node);
@@ -23213,8 +23237,8 @@ function keepingOpen(fs, nodes, changed = () => {
23213
23237
  function vfsFile(fs, opts, nodes) {
23214
23238
  const access2 = opts.flags & O_ACCMODE;
23215
23239
  const readable2 = access2 !== O_WRONLY;
23216
- const writable2 = access2 === O_WRONLY || access2 === O_RDWR;
23217
- const node = !nodes || opts.orphan ? new VfsNode(fs, opts.path, opts.contents, opts.orphan === true, opts.dirty === true) : opts.contents !== void 0 ? nodes.adopt(opts.path, opts.contents, opts.dirty === true, writable2, opts.id) : nodes.open(opts.path, opts.pin, writable2, opts.id, opts.ino);
23240
+ const writable3 = access2 === O_WRONLY || access2 === O_RDWR;
23241
+ const node = !nodes || opts.orphan ? new VfsNode(fs, opts.path, opts.contents, opts.orphan === true, opts.dirty === true) : opts.contents !== void 0 ? nodes.adopt(opts.path, opts.contents, opts.dirty === true, writable3, opts.id) : nodes.open(opts.path, opts.pin, writable3, opts.id, opts.ino);
23218
23242
  let openError;
23219
23243
  const atOpen = (op) => {
23220
23244
  void node.serial(op).catch((err) => {
@@ -23241,7 +23265,7 @@ function vfsFile(fs, opts, nodes) {
23241
23265
  offset += out.length;
23242
23266
  return out;
23243
23267
  }) : void 0,
23244
- write: writable2 ? (bytes) => serial(async () => {
23268
+ write: writable3 ? (bytes) => serial(async () => {
23245
23269
  if (opts.flags & O_APPEND) offset = await node.append(bytes);
23246
23270
  else offset += await node.pwrite(bytes, offset);
23247
23271
  return bytes.length;
@@ -23260,11 +23284,11 @@ function vfsFile(fs, opts, nodes) {
23260
23284
  return node.pread(max, at);
23261
23285
  }),
23262
23286
  pwrite: (bytes, at) => serial(() => {
23263
- if (!writable2) throw new KernelError("EBADF");
23287
+ if (!writable3) throw new KernelError("EBADF");
23264
23288
  return node.pwrite(bytes, at);
23265
23289
  }),
23266
23290
  resize: (size) => serial(() => {
23267
- if (!writable2) throw new KernelError("EBADF");
23291
+ if (!writable3) throw new KernelError("EBADF");
23268
23292
  return node.truncate(size);
23269
23293
  }),
23270
23294
  stat: () => serial(async () => ({
@@ -23280,7 +23304,7 @@ function vfsFile(fs, opts, nodes) {
23280
23304
  takeOpenError();
23281
23305
  await node.flush();
23282
23306
  } finally {
23283
- nodes?.closed(node, writable2);
23307
+ nodes?.closed(node, writable3);
23284
23308
  }
23285
23309
  })
23286
23310
  });
@@ -25009,8 +25033,8 @@ var WasmProcess = class {
25009
25033
  };
25010
25034
  withDl(state) {
25011
25035
  if (this.dlLog.length === 0) return state;
25012
- const { next: next3, handle, free, live } = this.closures;
25013
- const dl = { log: [...this.dlLog], next: next3, handle, free: [...free], live: [...live] };
25036
+ const { next: next3, handle, free, live: live2 } = this.closures;
25037
+ const dl = { log: [...this.dlLog], next: next3, handle, free: [...free], live: [...live2] };
25014
25038
  return { ...state, dl };
25015
25039
  }
25016
25040
  seedDl(dl) {
@@ -26228,8 +26252,8 @@ var RemoteWatch = class {
26228
26252
  const { held = [], pending = [] } = await this.locks.query();
26229
26253
  if (![...held, ...pending].some((lock) => lock.name === name2)) {
26230
26254
  this.mourned.delete(peer);
26231
- const live = this.peers.has(peer) || this.flushes.has(peer);
26232
- if (tries > 1 && live) {
26255
+ const live2 = this.peers.has(peer) || this.flushes.has(peer);
26256
+ if (tries > 1 && live2) {
26233
26257
  setTimeout(() => void this.mourn(peer, tries - 1), MOURN_RETRY_MS);
26234
26258
  } else this.flushedAt(peer);
26235
26259
  return;
@@ -28437,11 +28461,11 @@ async function positioned(handle, op) {
28437
28461
  }
28438
28462
  return;
28439
28463
  }
28440
- const writable2 = await handle.createWritable({ keepExistingData: true });
28464
+ const writable3 = await handle.createWritable({ keepExistingData: true });
28441
28465
  try {
28442
28466
  await op({
28443
28467
  write: async (at, bytes) => {
28444
- await writable2.write({
28468
+ await writable3.write({
28445
28469
  type: "write",
28446
28470
  position: at,
28447
28471
  data: bytes
@@ -28449,15 +28473,15 @@ async function positioned(handle, op) {
28449
28473
  extent.wrote(at + bytes.length);
28450
28474
  },
28451
28475
  truncate: async (n) => {
28452
- await writable2.truncate(n);
28476
+ await writable3.truncate(n);
28453
28477
  extent.cut(n);
28454
28478
  }
28455
28479
  });
28456
28480
  } catch (err) {
28457
- await writable2.abort();
28481
+ await writable3.abort();
28458
28482
  throw err;
28459
28483
  }
28460
- await writable2.close();
28484
+ await writable3.close();
28461
28485
  if (extent.big()) extent.check((await handle.getFile()).size);
28462
28486
  }
28463
28487
  function isHandle(child) {
@@ -29539,21 +29563,21 @@ var OpfsFs = class {
29539
29563
  }
29540
29564
  async writeSession(path, truncate) {
29541
29565
  const [handle, , target] = await this.fileFor(path);
29542
- const writable2 = await this.retrying(
29566
+ const writable3 = await this.retrying(
29543
29567
  path,
29544
29568
  () => this.io(handle.createWritable({ keepExistingData: !truncate })),
29545
29569
  true
29546
29570
  );
29547
29571
  return {
29548
- write: (at, bytes) => writable2.write({ type: "write", position: at, data: bytes }).catch((err) => {
29572
+ write: (at, bytes) => writable3.write({ type: "write", position: at, data: bytes }).catch((err) => {
29549
29573
  throw translate(err, path, "write", false);
29550
29574
  }),
29551
- truncate: (size) => writable2.truncate(size).catch((err) => {
29575
+ truncate: (size) => writable3.truncate(size).catch((err) => {
29552
29576
  throw translate(err, path, "write", false);
29553
29577
  }),
29554
29578
  close: async () => {
29555
29579
  this.wrote(handle);
29556
- await writable2.close().catch((err) => {
29580
+ await writable3.close().catch((err) => {
29557
29581
  this.wrote(handle);
29558
29582
  throw translate(err, path, "commit", false);
29559
29583
  });
@@ -29605,19 +29629,19 @@ var OpfsFs = class {
29605
29629
  const [file, existed, target] = await this.fileFor(path, owner?.existing !== true);
29606
29630
  if (!existed) await this.stampNew(target, owner, false);
29607
29631
  if (!existed && content.length === 0) return;
29608
- let writable2;
29632
+ let writable3;
29609
29633
  this.wrote(file);
29610
29634
  try {
29611
- writable2 = await this.io(file.createWritable());
29612
- await writable2.write(content);
29613
- await writable2.close();
29635
+ writable3 = await this.io(file.createWritable());
29636
+ await writable3.write(content);
29637
+ await writable3.close();
29614
29638
  if (typeof content !== "string" && content.length >= CHECKED_BYTES) {
29615
29639
  const extent = new Extent();
29616
29640
  extent.cut(content.length);
29617
29641
  extent.check((await file.getFile()).size);
29618
29642
  }
29619
29643
  } catch (err) {
29620
- await writable2?.abort().catch(() => void 0);
29644
+ await writable3?.abort().catch(() => void 0);
29621
29645
  throw translate(err, path, "commit", false);
29622
29646
  } finally {
29623
29647
  this.wrote(file);
@@ -30342,7 +30366,7 @@ var OpfsFs = class {
30342
30366
  created4 = true;
30343
30367
  }
30344
30368
  let target = destination;
30345
- let writable2;
30369
+ let writable3;
30346
30370
  let handle;
30347
30371
  try {
30348
30372
  const kept = created4 ? this.files.get(destination) : void 0;
@@ -30361,11 +30385,11 @@ var OpfsFs = class {
30361
30385
  if (entry?.fifo || entry?.socket) throw fsError("ENXIO", to);
30362
30386
  }
30363
30387
  this.wrote(handle);
30364
- writable2 = await handle.createWritable();
30365
- await writable2.write(file);
30366
- await writable2.close();
30388
+ writable3 = await handle.createWritable();
30389
+ await writable3.write(file);
30390
+ await writable3.close();
30367
30391
  } catch (err) {
30368
- await writable2?.abort().catch(() => void 0);
30392
+ await writable3?.abort().catch(() => void 0);
30369
30393
  if (created4) await this.rm(target, { file: true }).catch(() => void 0);
30370
30394
  throw translate(err, to, "commit", false);
30371
30395
  } finally {
@@ -30454,10 +30478,10 @@ var OpfsFs = class {
30454
30478
  }
30455
30479
  if (handle.kind === "file") {
30456
30480
  const made2 = await this.io(dir.getFileHandle(name2, { create: true }));
30457
- const writable2 = await this.io(made2.createWritable());
30481
+ const writable3 = await this.io(made2.createWritable());
30458
30482
  const file = await this.io(handle.getFile());
30459
- await writable2.write(file);
30460
- await writable2.close();
30483
+ await writable3.write(file);
30484
+ await writable3.close();
30461
30485
  copies?.set(rest2, { before: copies.get(rest2)?.before ?? file.lastModified, made: made2 });
30462
30486
  return;
30463
30487
  }
@@ -31169,7 +31193,7 @@ function hostfsHandlers(current, againMs = RESTORE_AGAIN_MS) {
31169
31193
  if (remote.client.token === remote.token && !remote.client.gone) return remote;
31170
31194
  throw fsError2("ESTALE", "the folder was granted again, so this open file is gone");
31171
31195
  };
31172
- const live = (fh) => {
31196
+ const live2 = (fh) => {
31173
31197
  const remote = handles.get(fh);
31174
31198
  if (!remote) throw fsError2("EBADF", `handle ${fh}`);
31175
31199
  return fresh3(remote);
@@ -31188,7 +31212,7 @@ function hostfsHandlers(current, againMs = RESTORE_AGAIN_MS) {
31188
31212
  }, againMs);
31189
31213
  timer.unref?.();
31190
31214
  });
31191
- async function writable2(client, path, flags2) {
31215
+ async function writable3(client, path, flags2) {
31192
31216
  const { ifMatch: _, ...asked } = flags2;
31193
31217
  const opening2 = () => client.call("open", { path: rel(path), ...asked });
31194
31218
  try {
@@ -31219,7 +31243,7 @@ function hostfsHandlers(current, againMs = RESTORE_AGAIN_MS) {
31219
31243
  async open(path, flags2) {
31220
31244
  const client = current();
31221
31245
  const token = client.token;
31222
- const { opened: opened2, restore } = await writable2(client, path, flags2);
31246
+ const { opened: opened2, restore } = await writable3(client, path, flags2);
31223
31247
  if (flags2.ifMatch !== void 0 && opened2.attr?.etag !== flags2.ifMatch) {
31224
31248
  await client.call("release", { fh: opened2.fh }, true);
31225
31249
  throw fsError2("ESTALE", `${path} changed on the host while it was being read`);
@@ -31234,7 +31258,7 @@ function hostfsHandlers(current, againMs = RESTORE_AGAIN_MS) {
31234
31258
  return nextFh;
31235
31259
  },
31236
31260
  async read(fh, offset, size) {
31237
- const remote = live(fh);
31261
+ const remote = live2(fh);
31238
31262
  return remote.client.read(
31239
31263
  remote.fh,
31240
31264
  offset,
@@ -31243,7 +31267,7 @@ function hostfsHandlers(current, againMs = RESTORE_AGAIN_MS) {
31243
31267
  );
31244
31268
  },
31245
31269
  async write(fh, offset, bytes) {
31246
- const remote = live(fh);
31270
+ const remote = live2(fh);
31247
31271
  const most = remote.client.maxIo;
31248
31272
  for (let at = 0; at < bytes.length; at += most) {
31249
31273
  await remote.client.write(remote.fh, offset + at, bytes.subarray(at, at + most));
@@ -37250,7 +37274,7 @@ function dialStream(port, onClose) {
37250
37274
  else finish(errorWithCode(data.error));
37251
37275
  });
37252
37276
  port.start?.();
37253
- const writable2 = new WritableStream({
37277
+ const writable3 = new WritableStream({
37254
37278
  write(chunk2) {
37255
37279
  if (closed) throw errorWithCode("EPIPE: the connection is closed");
37256
37280
  const copy = fresh(chunk2);
@@ -37269,7 +37293,7 @@ function dialStream(port, onClose) {
37269
37293
  shut();
37270
37294
  finish(error);
37271
37295
  };
37272
- return { readable: readable2, writable: writable2, close, fail: fail3 };
37296
+ return { readable: readable2, writable: writable3, close, fail: fail3 };
37273
37297
  }
37274
37298
 
37275
37299
  // src/client/loopback-fetch.ts
@@ -37695,10 +37719,10 @@ function endedOf(done4, signal) {
37695
37719
  async function runOn(channel, argv, opts) {
37696
37720
  const { onStdout, onStderr, ...rest2 } = opts;
37697
37721
  const chunks2 = { 1: [], 2: [] };
37698
- const live = { 1: new TextDecoder(), 2: new TextDecoder() };
37722
+ const live2 = { 1: new TextDecoder(), 2: new TextDecoder() };
37699
37723
  const tee = (fd, on) => (bytes) => {
37700
37724
  chunks2[fd].push(bytes);
37701
- on?.(live[fd].decode(bytes, { stream: true }));
37725
+ on?.(live2[fd].decode(bytes, { stream: true }));
37702
37726
  };
37703
37727
  const child = await spawnOn(channel, argv, {
37704
37728
  ...rest2,
@@ -37913,7 +37937,7 @@ var TERMINATED = "the kernel is terminated";
37913
37937
  var EXIT_GRACE_MS = 50;
37914
37938
  var WARM_IDLE_MS = 3e4;
37915
37939
  var MAX_WARM_WORKERS = 64;
37916
- function warmPool(make, live, idleMs = WARM_IDLE_MS, size = 1) {
37940
+ function warmPool(make, live2, idleMs = WARM_IDLE_MS, size = 1) {
37917
37941
  const spares = [];
37918
37942
  let idle2;
37919
37943
  let closed = false;
@@ -37923,7 +37947,7 @@ function warmPool(make, live, idleMs = WARM_IDLE_MS, size = 1) {
37923
37947
  spares.splice(at, 1);
37924
37948
  if (spares.length > 0) return;
37925
37949
  clearTimeout(idle2);
37926
- live.delete(kill);
37950
+ live2.delete(kill);
37927
37951
  };
37928
37952
  const kill = () => {
37929
37953
  for (const worker of [...spares]) {
@@ -37944,7 +37968,7 @@ function warmPool(make, live, idleMs = WARM_IDLE_MS, size = 1) {
37944
37968
  worker.once("error", () => drop(worker));
37945
37969
  worker.once("exit", () => drop(worker));
37946
37970
  spares.push(worker);
37947
- live.add(kill);
37971
+ live2.add(kill);
37948
37972
  }
37949
37973
  clearTimeout(idle2);
37950
37974
  idle2 = setTimeout(kill, idleMs);
@@ -38017,12 +38041,12 @@ function sourceModule(source) {
38017
38041
  return { url, source, revoke: () => {
38018
38042
  } };
38019
38043
  }
38020
- function warmPoolOf(options, file, workerData, live) {
38044
+ function warmPoolOf(options, file, workerData, live2) {
38021
38045
  const size = sparesOf(options);
38022
38046
  if (size === 0) return void 0;
38023
- return warmPool(() => processWorker(file, workerData, true), live, WARM_IDLE_MS, size);
38047
+ return warmPool(() => processWorker(file, workerData, true), live2, WARM_IDLE_MS, size);
38024
38048
  }
38025
- function nodeWorker(file, live, closed, workerData, take, internals = false) {
38049
+ function nodeWorker(file, live2, closed, workerData, take, internals = false) {
38026
38050
  const errors = /* @__PURE__ */ new Set();
38027
38051
  const messages = /* @__PURE__ */ new Map();
38028
38052
  const fail3 = (message3) => {
@@ -38039,9 +38063,9 @@ function nodeWorker(file, live, closed, workerData, take, internals = false) {
38039
38063
  void worker.terminate();
38040
38064
  fail3(TERMINATED);
38041
38065
  };
38042
- live.add(kill);
38066
+ live2.add(kill);
38043
38067
  worker.once("exit", (code) => {
38044
- live.delete(kill);
38068
+ live2.delete(kill);
38045
38069
  setTimeout(() => {
38046
38070
  if (!ending) fail3(`the process worker exited with ${code}`);
38047
38071
  }, EXIT_GRACE_MS);
@@ -38198,23 +38222,23 @@ async function createNodeKernel(options = {}) {
38198
38222
  const root = options.root ?? memoryRoot();
38199
38223
  const fs = new OpfsFs(root, void 0, void 0, { ranged: isMemoryRoot(root) });
38200
38224
  await fs.reconcile();
38201
- const live = /* @__PURE__ */ new Set();
38225
+ const live2 = /* @__PURE__ */ new Set();
38202
38226
  const pending = /* @__PURE__ */ new Set();
38203
38227
  const clients = /* @__PURE__ */ new Set();
38204
38228
  let terminated = false;
38205
38229
  const file = options.worker ?? new URL("./node-process-worker.cjs", import.meta.url);
38206
38230
  const cache = cacheDirOf(options.compileCache);
38207
38231
  const workerData = cacheData(cache);
38208
- const warm = warmPoolOf(options, file, workerData, live);
38232
+ const warm = warmPoolOf(options, file, workerData, live2);
38209
38233
  const transport = options.network?.transport;
38210
38234
  const launcher = new Launcher({
38211
38235
  fs,
38212
38236
  moduleUrl: sourceModule,
38213
38237
  unlinkOwner: pidOwner(process),
38214
- createWorker: () => nodeWorker(file, live, terminated, workerData, warm ? () => warm.take() : void 0, true),
38238
+ createWorker: () => nodeWorker(file, live2, terminated, workerData, warm ? () => warm.take() : void 0, true),
38215
38239
  createDriverWorker: () => nodeWorker(
38216
38240
  options.driverWorker ?? new URL("./node-driver-worker.js", import.meta.url),
38217
- live,
38241
+ live2,
38218
38242
  terminated
38219
38243
  ),
38220
38244
  ...options.modules ? { modules: options.modules } : {},
@@ -38345,7 +38369,7 @@ async function createNodeKernel(options = {}) {
38345
38369
  warm?.close();
38346
38370
  for (const client of [...clients]) client.detach();
38347
38371
  for (const reject of [...pending]) reject(new Error(TERMINATED));
38348
- for (const kill of [...live]) kill();
38372
+ for (const kill of [...live2]) kill();
38349
38373
  launcher.cdp.close();
38350
38374
  launcher.endFills();
38351
38375
  launcher.unmountAll();