@ai-ecoverse/slicc-kernel 1.191.4 → 1.192.0

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
@@ -2180,9 +2180,9 @@ var EmbedderChannel = class {
2180
2180
  }
2181
2181
  set caller(caller) {
2182
2182
  this.current = caller;
2183
- const held = this.held;
2183
+ const held2 = this.held;
2184
2184
  this.held = [];
2185
- for (const line of held) this.tell(line);
2185
+ for (const line of held2) this.tell(line);
2186
2186
  }
2187
2187
  tell(line) {
2188
2188
  if (!this.current.progress(line) && this.held.length < HELD_MAX) this.held.push(line);
@@ -3995,7 +3995,7 @@ var KernelSide = class {
3995
3995
  const {
3996
3996
  sab: _sab,
3997
3997
  changes: _changes,
3998
- held,
3998
+ held: held2,
3999
3999
  program,
4000
4000
  signals: _signals,
4001
4001
  thread,
@@ -4004,17 +4004,17 @@ var KernelSide = class {
4004
4004
  const { memory: _memory, ids: _ids, modules: _modules, blocked: blocked2, tid, arg } = thread;
4005
4005
  return {
4006
4006
  ...rest2,
4007
- ...this.shared(program, held, image),
4007
+ ...this.shared(program, held2, image),
4008
4008
  thread: { tid, arg, ...blocked2 ? { blocked: blocked2 } : {} }
4009
4009
  };
4010
4010
  }
4011
- shared(program, held, image) {
4011
+ shared(program, held2, image) {
4012
4012
  const { module: _module, ...shown2 } = program;
4013
4013
  const changes = initial(this.changes);
4014
4014
  const cwds = initial(this.cwds);
4015
4015
  return {
4016
4016
  program: { ...shown2, image },
4017
- ...held ? { held: { slot: held.slot, seen: held.seen, dead: held.dead } } : {},
4017
+ ...held2 ? { held: { slot: held2.slot, seen: held2.seen, dead: held2.dead } } : {},
4018
4018
  ...Number.isFinite(this.max) ? { maxMessageBytes: this.max } : {},
4019
4019
  mirror: {
4020
4020
  seq: 0,
@@ -4029,7 +4029,7 @@ var KernelSide = class {
4029
4029
  };
4030
4030
  }
4031
4031
  wire(init, image) {
4032
- const { sab: _sab, changes: _changes, held, program, fork, ...rest2 } = init;
4032
+ const { sab: _sab, changes: _changes, held: held2, program, fork, ...rest2 } = init;
4033
4033
  const memory = fork?.memory;
4034
4034
  let forkWire;
4035
4035
  if (fork && memory && memory.byteLength > this.max) {
@@ -4037,7 +4037,7 @@ var KernelSide = class {
4037
4037
  } else if (fork) forkWire = fork;
4038
4038
  return {
4039
4039
  ...rest2,
4040
- ...this.shared(program, held, image),
4040
+ ...this.shared(program, held2, image),
4041
4041
  ...forkWire ? { fork: forkWire } : {}
4042
4042
  };
4043
4043
  }
@@ -4627,6 +4627,56 @@ function fresh(bytes, start2 = 0, end = bytes.length) {
4627
4627
  // src/ports.ts
4628
4628
  var messageChannel = () => new MessageChannel();
4629
4629
 
4630
+ // src/cdp/held.ts
4631
+ function heldConnection(send2, close) {
4632
+ const queued = [];
4633
+ let ended;
4634
+ let onmessage = null;
4635
+ let onclose = null;
4636
+ let draining = false;
4637
+ const drain2 = () => {
4638
+ if (draining) return;
4639
+ draining = true;
4640
+ queueMicrotask(() => {
4641
+ draining = false;
4642
+ while (onmessage && queued.length > 0) onmessage(queued.shift());
4643
+ if (!onclose || !ended) return;
4644
+ const { reason } = ended;
4645
+ ended = void 0;
4646
+ onclose(reason);
4647
+ });
4648
+ };
4649
+ const conn = {
4650
+ send: send2,
4651
+ close,
4652
+ get onmessage() {
4653
+ return onmessage;
4654
+ },
4655
+ set onmessage(next3) {
4656
+ onmessage = next3;
4657
+ if (next3) drain2();
4658
+ },
4659
+ get onclose() {
4660
+ return onclose;
4661
+ },
4662
+ set onclose(next3) {
4663
+ onclose = next3;
4664
+ if (next3) drain2();
4665
+ }
4666
+ };
4667
+ return {
4668
+ conn,
4669
+ message(message3) {
4670
+ if (onmessage && queued.length === 0) onmessage(message3);
4671
+ else queued.push(message3);
4672
+ },
4673
+ end(reason) {
4674
+ ended = { reason };
4675
+ drain2();
4676
+ }
4677
+ };
4678
+ }
4679
+
4630
4680
  // src/cdp/port.ts
4631
4681
  function serveCdpPort(port, hook, request, onDone) {
4632
4682
  let conn;
@@ -4653,11 +4703,11 @@ function serveCdpPort(port, hook, request, onDone) {
4653
4703
  (opened2) => {
4654
4704
  conn = opened2;
4655
4705
  if (done4) return opened2.close();
4706
+ port.postMessage({ open: true });
4656
4707
  opened2.onmessage = (m) => {
4657
4708
  if (!done4) port.postMessage({ m });
4658
4709
  };
4659
4710
  opened2.onclose = (reason) => finish(reason ?? null);
4660
- port.postMessage({ open: true });
4661
4711
  },
4662
4712
  (e) => {
4663
4713
  if (done4) return;
@@ -4675,22 +4725,20 @@ function portCdpHook(ask, gone, ports = messageChannel) {
4675
4725
  return (request) => new Promise((resolve2, reject) => {
4676
4726
  const { port1, port2 } = ports();
4677
4727
  let closed = false;
4678
- const conn = {
4679
- send: (m) => {
4728
+ const held2 = heldConnection(
4729
+ (m) => {
4680
4730
  if (!closed) port1.postMessage({ m });
4681
4731
  },
4682
- onmessage: null,
4683
- onclose: null,
4684
- close: () => {
4732
+ () => {
4685
4733
  if (closed) return;
4686
4734
  closed = true;
4687
4735
  port1.postMessage({ close: true });
4688
4736
  port1.close();
4689
4737
  }
4690
- };
4738
+ );
4691
4739
  port1.addEventListener("message", ({ data }) => {
4692
- if ("m" in data) conn.onmessage?.(data.m);
4693
- else if ("open" in data) resolve2(conn);
4740
+ if ("m" in data) held2.message(data.m);
4741
+ else if ("open" in data) resolve2(held2.conn);
4694
4742
  else if ("error" in data) {
4695
4743
  closed = true;
4696
4744
  port1.close();
@@ -4698,17 +4746,20 @@ function portCdpHook(ask, gone, ports = messageChannel) {
4698
4746
  } else if (!closed) {
4699
4747
  closed = true;
4700
4748
  port1.close();
4701
- conn.onclose?.(data.close ?? void 0);
4749
+ reject(new Error(data.close ?? "the CDP host closed"));
4750
+ held2.end(data.close ?? void 0);
4702
4751
  }
4703
4752
  });
4704
- port1.start();
4705
- void gone?.then(() => {
4753
+ const lost = (reason) => {
4706
4754
  if (closed) return;
4707
4755
  closed = true;
4708
4756
  port1.close();
4709
- reject(new Error("the CDP host is gone"));
4710
- conn.onclose?.("the CDP host is gone");
4711
- });
4757
+ reject(new Error(reason));
4758
+ held2.end(reason);
4759
+ };
4760
+ port1.addEventListener("close", () => lost("the CDP host closed its port"));
4761
+ port1.start();
4762
+ void gone?.then(() => lost("the CDP host is gone"));
4712
4763
  ask(request, port2);
4713
4764
  });
4714
4765
  }
@@ -7048,7 +7099,7 @@ var CdpHosts = class {
7048
7099
  if (!entry) throw new HttpError(503, NO_CDP_HOST);
7049
7100
  let conn;
7050
7101
  try {
7051
- conn = await entry.hook(hookRequest(request));
7102
+ conn = held(await entry.hook(hookRequest(request)));
7052
7103
  } catch (e) {
7053
7104
  throw new HttpError(502, `CDP host: ${e instanceof Error ? e.message : String(e)}`);
7054
7105
  }
@@ -7068,6 +7119,15 @@ var CdpHosts = class {
7068
7119
  for (const entry of [this.embedder, ...this.clients]) if (entry) closeAll(entry);
7069
7120
  }
7070
7121
  };
7122
+ function held(host) {
7123
+ const { conn, message: message3, end } = heldConnection(
7124
+ (m) => host.send(m),
7125
+ () => host.close()
7126
+ );
7127
+ host.onmessage = message3;
7128
+ host.onclose = end;
7129
+ return conn;
7130
+ }
7071
7131
  function hookRequest({ runtime, stamp }) {
7072
7132
  return {
7073
7133
  ...runtime ? { runtime } : {},
@@ -7232,7 +7292,7 @@ function satisfies(version, range2) {
7232
7292
  }
7233
7293
 
7234
7294
  // src/version.ts
7235
- var KERNEL_VERSION = true ? "1.191.4" : "0.0.0-dev";
7295
+ var KERNEL_VERSION = true ? "1.192.0" : "0.0.0-dev";
7236
7296
  var OS_RELEASE = "6.0.0-slicc";
7237
7297
  function procVersion() {
7238
7298
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -8588,15 +8648,15 @@ var UnlinkedKeeper = class {
8588
8648
  pinned2.commit();
8589
8649
  }
8590
8650
  heldWithin(target) {
8591
- const held = /* @__PURE__ */ new Map();
8651
+ const held2 = /* @__PURE__ */ new Map();
8592
8652
  for (const holder of this.holders) {
8593
8653
  if (holder.owns(target)) continue;
8594
8654
  for (const path of holder.held()) {
8595
8655
  if (!within2(path, target) || holder.isKept(path)) continue;
8596
- held.set(path, [...held.get(path) ?? [], holder]);
8656
+ held2.set(path, [...held2.get(path) ?? [], holder]);
8597
8657
  }
8598
8658
  }
8599
- return held;
8659
+ return held2;
8600
8660
  }
8601
8661
  async pin(target, gated = () => void 0, sealed = () => void 0) {
8602
8662
  const paths = [];
@@ -8619,18 +8679,18 @@ var UnlinkedKeeper = class {
8619
8679
  };
8620
8680
  await take();
8621
8681
  gated();
8622
- const held = /* @__PURE__ */ new Map();
8682
+ const held2 = /* @__PURE__ */ new Map();
8623
8683
  const hidden = /* @__PURE__ */ new Map();
8624
8684
  const moved2 = [];
8625
8685
  try {
8626
8686
  for (; ; ) {
8627
8687
  await take();
8628
8688
  const now = this.heldWithin(target);
8629
- const next3 = paths.filter((path) => now.has(path) && !held.has(path));
8689
+ const next3 = paths.filter((path) => now.has(path) && !held2.has(path));
8630
8690
  if (next3.length === 0) break;
8631
8691
  for (const path of next3) {
8632
8692
  const holders = now.get(path);
8633
- held.set(path, holders);
8693
+ held2.set(path, holders);
8634
8694
  for (const holder of holders) moved2.push(holder.moving?.(path) ?? (() => void 0));
8635
8695
  const at = await this.keepAside(path);
8636
8696
  if (at === void 0) continue;
@@ -8654,7 +8714,7 @@ var UnlinkedKeeper = class {
8654
8714
  };
8655
8715
  const files = /* @__PURE__ */ new Map();
8656
8716
  for (const [path, at] of hidden) {
8657
- const holders = held.get(path);
8717
+ const holders = held2.get(path);
8658
8718
  const file = this.keptFile(at, { refs: holders.length + 1 });
8659
8719
  files.set(path, file);
8660
8720
  for (const holder of holders) holder.keep(path, file);
@@ -8668,7 +8728,7 @@ var UnlinkedKeeper = class {
8668
8728
  },
8669
8729
  rollback: async () => {
8670
8730
  for (const [path, file] of files) {
8671
- for (const holder of held.get(path)) holder.unkeep(path, file);
8731
+ for (const holder of held2.get(path)) holder.unkeep(path, file);
8672
8732
  await this.serial(async () => {
8673
8733
  await Promise.allSettled([this.fs.rename(file.hidden, path)]);
8674
8734
  this.unlinkedName(file.hidden);
@@ -8701,10 +8761,10 @@ var UnlinkedKeeper = class {
8701
8761
  const none = { whole: false, undoing: (op) => op() };
8702
8762
  const peers = this.peers;
8703
8763
  if (!peers?.shared() || this.rootOf(target) !== "/") return none;
8704
- const held = peers.heldWithin(target).filter((holder) => holder.instance !== void 0);
8705
- if (held.length === 0 || !await valid2()) return none;
8764
+ const held2 = peers.heldWithin(target).filter((holder) => holder.instance !== void 0);
8765
+ if (held2.length === 0 || !await valid2()) return none;
8706
8766
  const tabs = /* @__PURE__ */ new Map();
8707
- for (const holder of held) tabs.set(holder.tab, [...tabs.get(holder.tab) ?? [], holder]);
8767
+ for (const holder of held2) tabs.set(holder.tab, [...tabs.get(holder.tab) ?? [], holder]);
8708
8768
  const asked = [...tabs].map(([tab, holders]) => {
8709
8769
  const paths = holders.map((holder) => holder.path);
8710
8770
  return { tab, holders, paths };
@@ -8941,7 +9001,7 @@ var UnlinkedKeeper = class {
8941
9001
  const dir = dirOf(root);
8942
9002
  const names2 = await this.fs.readdir(dir).catch(() => void 0);
8943
9003
  if (!names2) return;
8944
- const held = query && new Set(((await query()).held ?? []).map((lock) => lock.name));
9004
+ const held2 = query && new Set(((await query()).held ?? []).map((lock) => lock.name));
8945
9005
  for (const name2 of names2) {
8946
9006
  const id2 = name2.slice(0, name2.lastIndexOf("."));
8947
9007
  const at = id2.indexOf("~");
@@ -8954,7 +9014,7 @@ var UnlinkedKeeper = class {
8954
9014
  );
8955
9015
  continue;
8956
9016
  }
8957
- const dead = id2 !== this.instance && (at < 0 ? held !== void 0 && !held.has(lockName(id2)) : owner?.alive(id2.slice(0, at)) === false);
9017
+ const dead = id2 !== this.instance && (at < 0 ? held2 !== void 0 && !held2.has(lockName(id2)) : owner?.alive(id2.slice(0, at)) === false);
8958
9018
  if (dead) await this.fs.rm(`${dir}/${name2}`, { recursive: true }).catch(() => void 0);
8959
9019
  }
8960
9020
  await this.tidy(dir);
@@ -10939,11 +10999,11 @@ var ProtectedFs = class {
10939
10999
  async exclusive(path, run2, follow2) {
10940
11000
  return fs.exclusive(
10941
11001
  path,
10942
- (held) => run2({
10943
- ...held,
11002
+ (held2) => run2({
11003
+ ...held2,
10944
11004
  writeFile: async (...args) => {
10945
11005
  await check(args[0], true);
10946
- return held.writeFile(...args);
11006
+ return held2.writeFile(...args);
10947
11007
  }
10948
11008
  }),
10949
11009
  follow2
@@ -11410,11 +11470,11 @@ var TextBusy = class {
11410
11470
  return exclusive.call(
11411
11471
  fs,
11412
11472
  path,
11413
- (held) => run2({
11414
- ...held,
11473
+ (held2) => run2({
11474
+ ...held2,
11415
11475
  writeFile: async (at, content, owner) => {
11416
11476
  await check(at);
11417
- return held.writeFile(at, content, owner);
11477
+ return held2.writeFile(at, content, owner);
11418
11478
  }
11419
11479
  }),
11420
11480
  follow2
@@ -12475,27 +12535,27 @@ var CwdTable = class {
12475
12535
  return slot2;
12476
12536
  }
12477
12537
  share(slot2) {
12478
- const held = slot2 === void 0 ? void 0 : this.held.get(slot2);
12479
- if (!held) return UNTRACKED;
12480
- held.refs++;
12538
+ const held2 = slot2 === void 0 ? void 0 : this.held.get(slot2);
12539
+ if (!held2) return UNTRACKED;
12540
+ held2.refs++;
12481
12541
  return slot2;
12482
12542
  }
12483
12543
  release(slot2) {
12484
- const held = slot2 === void 0 ? void 0 : this.held.get(slot2);
12485
- if (!held || --held.refs > 0) return;
12544
+ const held2 = slot2 === void 0 ? void 0 : this.held.get(slot2);
12545
+ if (!held2 || --held2.refs > 0) return;
12486
12546
  this.held.delete(slot2);
12487
12547
  Atomics.add(this.view, slot2, 1);
12488
12548
  this.free.push(slot2);
12489
12549
  }
12490
12550
  stateOf(slot2) {
12491
- const held = this.held.get(slot2);
12492
- return { seen: held?.verified ?? Atomics.load(this.view, slot2), dead: held?.dead === true };
12551
+ const held2 = this.held.get(slot2);
12552
+ return { seen: held2?.verified ?? Atomics.load(this.view, slot2), dead: held2?.dead === true };
12493
12553
  }
12494
12554
  touched(paths, trees = []) {
12495
12555
  if (this.held.size === 0) return;
12496
- for (const [slot2, held] of this.held) {
12497
- if (held.dead) continue;
12498
- if (paths.some((p) => under4(held.path, p)) || trees.some((t) => under4(held.path, t))) {
12556
+ for (const [slot2, held2] of this.held) {
12557
+ if (held2.dead) continue;
12558
+ if (paths.some((p) => under4(held2.path, p)) || trees.some((t) => under4(held2.path, t))) {
12499
12559
  Atomics.add(this.view, slot2, 1);
12500
12560
  }
12501
12561
  }
@@ -12503,14 +12563,14 @@ var CwdTable = class {
12503
12563
  async check(slot2) {
12504
12564
  this.checks++;
12505
12565
  const gen = Atomics.load(this.view, slot2);
12506
- const held = this.held.get(slot2);
12507
- if (!held) return { gen, alive: true };
12508
- if (!held.dead) {
12509
- const ino = await this.inodeOf(held.path).catch(() => null);
12510
- held.dead = ino === null || held.ino !== void 0 && ino !== held.ino;
12511
- held.verified = gen;
12566
+ const held2 = this.held.get(slot2);
12567
+ if (!held2) return { gen, alive: true };
12568
+ if (!held2.dead) {
12569
+ const ino = await this.inodeOf(held2.path).catch(() => null);
12570
+ held2.dead = ino === null || held2.ino !== void 0 && ino !== held2.ino;
12571
+ held2.verified = gen;
12512
12572
  }
12513
- return { gen, alive: !held.dead };
12573
+ return { gen, alive: !held2.dead };
12514
12574
  }
12515
12575
  };
12516
12576
  function heldInit(o) {
@@ -12776,8 +12836,8 @@ var HeldSet = class extends Set {
12776
12836
  return removed;
12777
12837
  }
12778
12838
  };
12779
- function heldUnder(held, target) {
12780
- for (const paths of held) for (const path of paths.keys()) if (within6(path, target)) return true;
12839
+ function heldUnder(held2, target) {
12840
+ for (const paths of held2) for (const path of paths.keys()) if (within6(path, target)) return true;
12781
12841
  return false;
12782
12842
  }
12783
12843
  var HeldPaths = class extends Map {
@@ -14279,8 +14339,8 @@ function nothing() {
14279
14339
  return false;
14280
14340
  }
14281
14341
  function heldPaths(arg) {
14282
- const held = JSON.parse(arg ?? "[]");
14283
- return Array.isArray(held) ? held.filter((path) => typeof path === "string") : [];
14342
+ const held2 = JSON.parse(arg ?? "[]");
14343
+ return Array.isArray(held2) ? held2.filter((path) => typeof path === "string") : [];
14284
14344
  }
14285
14345
  async function usageAt(entry, path) {
14286
14346
  if (!entry.statfs) return void 0;
@@ -14843,11 +14903,11 @@ async function dispatchSyncFs(req) {
14843
14903
  return devsOf(entry, req, await dispatchOne(entry, req));
14844
14904
  const { fs, cwd } = entry;
14845
14905
  const path = fs.resolvePath(cwd, req.path);
14846
- const identified = async (held) => {
14847
- const own = held ? { ...entry, fs: { ...fs, writeFile: held.writeFile } } : entry;
14906
+ const identified = async (held2) => {
14907
+ const own = held2 ? { ...entry, fs: { ...fs, writeFile: held2.writeFile } } : entry;
14848
14908
  const result = await dispatchOne(own, req);
14849
14909
  if (!result.ok) return result;
14850
- if (held && !held.direct) return json2(null);
14910
+ if (held2 && !held2.direct) return json2(null);
14851
14911
  const look = req.op === "lchown" ? fs.lstat : fs.stat;
14852
14912
  const st = await look.call(fs, path).catch(() => void 0);
14853
14913
  return json2(st ? statJson(st) : null);
@@ -14994,8 +15054,8 @@ async function dispatchPath(entry, req) {
14994
15054
  if (device) return { ok: false, errno: device, message: `${path}: a device entry stays` };
14995
15055
  const made2 = await newDevName(entry, path, req);
14996
15056
  if (made2) return made2;
14997
- const held = await byHandle(entry, path, req);
14998
- if (held) return held;
15057
+ const held2 = await byHandle(entry, path, req);
15058
+ if (held2) return held2;
14999
15059
  if (req.op === "access") return await accessOp(entry, path, req);
15000
15060
  if (req.op === "hold") return await holdOp(entry, path, req);
15001
15061
  const resolved2 = await guardAndResolve(entry, path, req);
@@ -20362,10 +20422,10 @@ async function recordLock2(req, ctx) {
20362
20422
  const range2 = lockRange(req.start, req.len);
20363
20423
  const key = await fileKey(target, req.kind, req.op === "lk-set" && req.fd !== void 0);
20364
20424
  if (req.op === "lk-get") {
20365
- const held = await locks.holder(key, owner, { key, kind: req.kind, ...range2 });
20366
- if (!held) return json3(null);
20367
- const len = held.end === Number.POSITIVE_INFINITY ? 0 : held.end - held.start;
20368
- return json3({ kind: held.kind, pid: held.owner, start: held.start, len });
20425
+ const held2 = await locks.holder(key, owner, { key, kind: req.kind, ...range2 });
20426
+ if (!held2) return json3(null);
20427
+ const len = held2.end === Number.POSITIVE_INFINITY ? 0 : held2.end - held2.start;
20428
+ return json3({ kind: held2.kind, pid: held2.owner, start: held2.start, len });
20369
20429
  }
20370
20430
  const granted2 = req.kind !== "unlock";
20371
20431
  const shared2 = locks.shared?.() === true;
@@ -24703,8 +24763,8 @@ var TlsContext = class {
24703
24763
  var TLS_CONTEXTS_MAX = 64;
24704
24764
  async function contextSecure(proc, cert) {
24705
24765
  if (!cert) throw new KernelError("EINVAL", "ERR_INVALID_ARG_VALUE: a context needs cert and key");
24706
- const held = proc.fds.numbers().filter((fd) => proc.fds.get(fd).file instanceof TlsContext);
24707
- if (held.length >= TLS_CONTEXTS_MAX) {
24766
+ const held2 = proc.fds.numbers().filter((fd) => proc.fds.get(fd).file instanceof TlsContext);
24767
+ if (held2.length >= TLS_CONTEXTS_MAX) {
24708
24768
  wipe(certBytes(cert));
24709
24769
  throw new KernelError("EMFILE", `at most ${TLS_CONTEXTS_MAX} tls contexts per process`);
24710
24770
  }
@@ -24723,14 +24783,14 @@ function contextAt(fds, fd) {
24723
24783
  const open = fds.get(fd);
24724
24784
  const file = open.file;
24725
24785
  if (!(file instanceof TlsContext)) throw new KernelError("EBADF", "not a tls context");
24726
- const held = open.retain();
24786
+ const held2 = open.retain();
24727
24787
  let released2 = false;
24728
24788
  return {
24729
24789
  leaf: file.leaf,
24730
24790
  done: () => {
24731
24791
  if (released2) return;
24732
24792
  released2 = true;
24733
- void held.release();
24793
+ void held2.release();
24734
24794
  }
24735
24795
  };
24736
24796
  }
@@ -25955,8 +26015,8 @@ var VfsNodes = class {
25955
26015
  createExclusive(path, owner) {
25956
26016
  return this.onEntry(path, async () => {
25957
26017
  const node = this.byPath.get(path);
25958
- const held = node ? await node.serial(async () => node.holds()) : false;
25959
- if (held) throw fsError("EEXIST", path);
26018
+ const held2 = node ? await node.serial(async () => node.holds()) : false;
26019
+ if (held2) throw fsError("EEXIST", path);
25960
26020
  const exclusive = this.fs.createExclusive;
25961
26021
  if (exclusive) return exclusive.call(this.fs, path, owner);
25962
26022
  if (await present3(this.fs, path)) throw fsError("EEXIST", path);
@@ -26188,8 +26248,8 @@ var VfsNodes = class {
26188
26248
  for (const [p, node] of this.byPath) if (within8(p, path)) await node.serial(() => node.flush());
26189
26249
  }
26190
26250
  async unlinking(path) {
26191
- for (const [held, node] of [...this.byPath]) {
26192
- if (!within8(held, path)) continue;
26251
+ for (const [held2, node] of [...this.byPath]) {
26252
+ if (!within8(held2, path)) continue;
26193
26253
  await node.serial(async () => {
26194
26254
  await Promise.all([this.keepsOnDisk || node.keep(), node.limit()]);
26195
26255
  });
@@ -26203,9 +26263,9 @@ var VfsNodes = class {
26203
26263
  }
26204
26264
  }
26205
26265
  unlinked(path) {
26206
- for (const [held, node] of [...this.byPath]) {
26207
- if (!within8(held, path) || this.byPath.get(held) !== node) continue;
26208
- if (!this.dropName(held, node)) this.orphan(node);
26266
+ for (const [held2, node] of [...this.byPath]) {
26267
+ if (!within8(held2, path) || this.byPath.get(held2) !== node) continue;
26268
+ if (!this.dropName(held2, node)) this.orphan(node);
26209
26269
  }
26210
26270
  }
26211
26271
  renamed(from, to) {
@@ -26271,8 +26331,8 @@ async function aliasOf(fs, nodes, at) {
26271
26331
  return nodes.holdingId(`${st.dev ?? 0}:${st.ino}`);
26272
26332
  }
26273
26333
  async function heldAt(fs, nodes, at) {
26274
- const held = nodes.holding(at);
26275
- if (held || !nodes.holdsAny() || nodes.plainAt(at)) return held;
26334
+ const held2 = nodes.holding(at);
26335
+ if (held2 || !nodes.holdsAny() || nodes.plainAt(at)) return held2;
26276
26336
  const shape = nodes.shape;
26277
26337
  const found = await aliasOf(fs, nodes, at);
26278
26338
  if (!found) nodes.notePlain(at, shape);
@@ -26282,21 +26342,21 @@ function heldIo(fs, nodes, changed2) {
26282
26342
  const ranged2 = rangedOps(fs);
26283
26343
  const node = (path) => heldAt(fs, nodes, fs.resolvePath("/", path));
26284
26344
  const write = async (path, op, fallback) => {
26285
- const held = await node(path);
26286
- if (!held) return fallback();
26287
- const out = await held.byName(async () => {
26288
- const done4 = await op(held);
26289
- await held.flush();
26345
+ const held2 = await node(path);
26346
+ if (!held2) return fallback();
26347
+ const out = await held2.byName(async () => {
26348
+ const done4 = await op(held2);
26349
+ await held2.flush();
26290
26350
  return done4;
26291
26351
  });
26292
26352
  changed2(fs.resolvePath("/", path));
26293
- if (held.path !== fs.resolvePath("/", path)) changed2(held.path);
26353
+ if (held2.path !== fs.resolvePath("/", path)) changed2(held2.path);
26294
26354
  return out;
26295
26355
  };
26296
26356
  return {
26297
26357
  append: (path, bytes) => write(
26298
26358
  path,
26299
- (held) => held.append(bytes),
26359
+ (held2) => held2.append(bytes),
26300
26360
  async () => {
26301
26361
  const end = await fs.append?.(path, bytes, { alone: true }).catch((err) => {
26302
26362
  if (!positional(err)) throw err;
@@ -26316,32 +26376,32 @@ function heldIo(fs, nodes, changed2) {
26316
26376
  ),
26317
26377
  async stat(path) {
26318
26378
  const st = await fs.stat(path);
26319
- const held = st.isFile ? await node(path) : void 0;
26320
- return held ? { ...st, size: await held.byName(() => held.size()) } : st;
26379
+ const held2 = st.isFile ? await node(path) : void 0;
26380
+ return held2 ? { ...st, size: await held2.byName(() => held2.size()) } : st;
26321
26381
  },
26322
26382
  async lstat(path) {
26323
26383
  const st = await fs.lstat(path);
26324
- const held = st.isFile && !st.isSymbolicLink ? await node(path) : void 0;
26325
- return held ? { ...st, size: await held.byName(() => held.size()) } : st;
26384
+ const held2 = st.isFile && !st.isSymbolicLink ? await node(path) : void 0;
26385
+ return held2 ? { ...st, size: await held2.byName(() => held2.size()) } : st;
26326
26386
  },
26327
26387
  async readFileBuffer(path) {
26328
- const held = await node(path);
26329
- if (!held) return fs.readFileBuffer(path);
26330
- return held.byName(async () => held.pread(await held.size(), 0));
26388
+ const held2 = await node(path);
26389
+ if (!held2) return fs.readFileBuffer(path);
26390
+ return held2.byName(async () => held2.pread(await held2.size(), 0));
26331
26391
  },
26332
26392
  ...ranged2 ? {
26333
26393
  pread: async (path, at, n, version) => {
26334
- const held = await node(path);
26335
- return held ? held.byName(() => held.pread(n, at)) : ranged2.pread(path, at, n, version);
26394
+ const held2 = await node(path);
26395
+ return held2 ? held2.byName(() => held2.pread(n, at)) : ranged2.pread(path, at, n, version);
26336
26396
  },
26337
26397
  pwrite: (path, at, bytes, transfer, options) => write(
26338
26398
  path,
26339
- async (held) => void await held.pwrite(bytes, at),
26399
+ async (held2) => void await held2.pwrite(bytes, at),
26340
26400
  () => ranged2.pwrite(path, at, bytes, transfer, options)
26341
26401
  ),
26342
26402
  truncate: (path, size) => write(
26343
26403
  path,
26344
- (held) => held.truncate(size),
26404
+ (held2) => held2.truncate(size),
26345
26405
  () => ranged2.truncate(path, size)
26346
26406
  )
26347
26407
  } : {}
@@ -26382,15 +26442,15 @@ function keepingOpen(fs, nodes, changed2 = () => {
26382
26442
  },
26383
26443
  writeFile: async (path, content, owner) => {
26384
26444
  const at = fs.resolvePath("/", path);
26385
- const held = await heldAt(fs, nodes, at);
26386
- if (!held) return nodes.onEntry(at, () => fs.writeFile(path, content, owner));
26445
+ const held2 = await heldAt(fs, nodes, at);
26446
+ if (!held2) return nodes.onEntry(at, () => fs.writeFile(path, content, owner));
26387
26447
  const bytes = typeof content === "string" ? new TextEncoder().encode(content) : content;
26388
- return held.byName(async () => {
26389
- await held.truncate(0);
26390
- await held.pwrite(bytes, 0);
26391
- await held.flush();
26448
+ return held2.byName(async () => {
26449
+ await held2.truncate(0);
26450
+ await held2.pwrite(bytes, 0);
26451
+ await held2.flush();
26392
26452
  changed2(at);
26393
- if (held.path !== at) changed2(held.path);
26453
+ if (held2.path !== at) changed2(held2.path);
26394
26454
  });
26395
26455
  },
26396
26456
  createExclusive: async (path, owner) => nodes.createExclusive(await nodes.entryKey(fs.resolvePath("/", path)), owner),
@@ -28675,12 +28735,12 @@ var Dying = class {
28675
28735
  };
28676
28736
  function killThread(thread, caught, sig) {
28677
28737
  if (!thread) return false;
28678
- const held = (Atomics.load(thread.header, SAB_I_BLOCKED) & sigbit(sig)) !== 0;
28679
- if (!held && (caught & sigbit(sig)) === 0) return false;
28738
+ const held2 = (Atomics.load(thread.header, SAB_I_BLOCKED) & sigbit(sig)) !== 0;
28739
+ if (!held2 && (caught & sigbit(sig)) === 0) return false;
28680
28740
  Atomics.or(thread.header, SAB_I_SIGNALS, sigbit(sig));
28681
28741
  Atomics.notify(thread.header, SAB_I_SIGNALS);
28682
28742
  headerNotified(thread.header, SAB_I_SIGNALS, sigbit(sig));
28683
- if (held) return true;
28743
+ if (held2) return true;
28684
28744
  const blocked2 = thread.interrupt;
28685
28745
  thread.interrupt = new AbortController();
28686
28746
  blocked2.abort();
@@ -29426,8 +29486,8 @@ var RemoteWatch = class {
29426
29486
  if (!this.locks) return;
29427
29487
  const prefix = `${this.name}:`;
29428
29488
  const mine = this.lockOf(this.tab);
29429
- const held = ((await this.locks.query()).held ?? []).map((lock) => lock.name ?? "");
29430
- if (!held.some((name2) => name2.startsWith(prefix) && name2 !== mine) || this.peers.size > 0)
29489
+ const held2 = ((await this.locks.query()).held ?? []).map((lock) => lock.name ?? "");
29490
+ if (!held2.some((name2) => name2.startsWith(prefix) && name2 !== mine) || this.peers.size > 0)
29431
29491
  return;
29432
29492
  await new Promise((resolve2) => {
29433
29493
  const timer = setTimeout(resolve2, ANNOUNCE_WAIT_MS);
@@ -29461,8 +29521,8 @@ var RemoteWatch = class {
29461
29521
  const prefix = `${this.name}:`;
29462
29522
  const began = performance.now();
29463
29523
  for (; ; ) {
29464
- const held = ((await this.locks.query()).held ?? []).map((lock) => lock.name ?? "");
29465
- const silent = held.some(
29524
+ const held2 = ((await this.locks.query()).held ?? []).map((lock) => lock.name ?? "");
29525
+ const silent = held2.some(
29466
29526
  (name2) => name2.startsWith(prefix) && name2 !== this.lockOf(this.tab) && !this.peers.has(name2.slice(prefix.length))
29467
29527
  );
29468
29528
  if (!silent) return true;
@@ -29512,8 +29572,8 @@ var RemoteWatch = class {
29512
29572
  if (!this.locks || this.mourned.has(peer)) return;
29513
29573
  this.mourned.add(peer);
29514
29574
  const name2 = this.lockOf(peer);
29515
- const { held = [], pending = [] } = await this.locks.query();
29516
- if (![...held, ...pending].some((lock) => lock.name === name2)) {
29575
+ const { held: held2 = [], pending = [] } = await this.locks.query();
29576
+ if (![...held2, ...pending].some((lock) => lock.name === name2)) {
29517
29577
  this.mourned.delete(peer);
29518
29578
  const live2 = this.peers.has(peer) || this.flushes.has(peer);
29519
29579
  if (tries > 1 && live2) {
@@ -29594,10 +29654,10 @@ var RemoteWatch = class {
29594
29654
  const from = tab;
29595
29655
  const { add, drop } = holds3;
29596
29656
  if (holds3?.instance !== void 0) this.instances.set(from, holds3.instance);
29597
- const held = this.peerHolds.get(from) ?? /* @__PURE__ */ new Map();
29598
- for (const path of drop) held.delete(path);
29599
- for (const [path, fid] of add) held.set(path, fid);
29600
- if (held.size > 0) this.peerHolds.set(from, held);
29657
+ const held2 = this.peerHolds.get(from) ?? /* @__PURE__ */ new Map();
29658
+ for (const path of drop) held2.delete(path);
29659
+ for (const [path, fid] of add) held2.set(path, fid);
29660
+ if (held2.size > 0) this.peerHolds.set(from, held2);
29601
29661
  else this.peerHolds.delete(from);
29602
29662
  this.holdsChanged?.();
29603
29663
  this.channel.postMessage({ ack: seq2, from: this.tab, to: from });
@@ -29646,8 +29706,8 @@ var RemoteWatch = class {
29646
29706
  }
29647
29707
  heldWithin(target) {
29648
29708
  const out = [];
29649
- for (const [tab, held] of this.peerHolds) {
29650
- for (const [path, fid] of held) {
29709
+ for (const [tab, held2] of this.peerHolds) {
29710
+ for (const [path, fid] of held2) {
29651
29711
  if (path !== target && !path.startsWith(`${target}/`)) continue;
29652
29712
  out.push({ tab, path, fid, instance: this.instances.get(tab) });
29653
29713
  }
@@ -29671,18 +29731,18 @@ var RemoteWatch = class {
29671
29731
  }
29672
29732
  peerHeld(path) {
29673
29733
  const out = [];
29674
- for (const [tab, held] of this.peerHolds)
29675
- if (held.has(path)) out.push({ tab, fid: held.get(path) });
29734
+ for (const [tab, held2] of this.peerHolds)
29735
+ if (held2.has(path)) out.push({ tab, fid: held2.get(path) });
29676
29736
  return out;
29677
29737
  }
29678
29738
  peerHeldPaths() {
29679
29739
  const out = /* @__PURE__ */ new Set();
29680
- for (const held of this.peerHolds.values()) for (const path of held.keys()) out.add(path);
29740
+ for (const held2 of this.peerHolds.values()) for (const path of held2.keys()) out.add(path);
29681
29741
  return [...out].sort();
29682
29742
  }
29683
29743
  holdCounts() {
29684
29744
  let peers = 0;
29685
- for (const held of this.peerHolds.values()) peers += held.size;
29745
+ for (const held2 of this.peerHolds.values()) peers += held2.size;
29686
29746
  return { mine: this.myHolds.size, peers, sent: this.holdsSent };
29687
29747
  }
29688
29748
  acked(seq2, from) {
@@ -29697,10 +29757,10 @@ var RemoteWatch = class {
29697
29757
  }
29698
29758
  async prune() {
29699
29759
  if (!this.locks) return;
29700
- const held = new Set(((await this.locks.query()).held ?? []).map((lock) => lock.name));
29760
+ const held2 = new Set(((await this.locks.query()).held ?? []).map((lock) => lock.name));
29701
29761
  let left = false;
29702
29762
  for (const tab of /* @__PURE__ */ new Set([...this.others.keys(), ...this.peers, ...this.peerHolds.keys()])) {
29703
- if (!held.has(this.lockOf(tab))) {
29763
+ if (!held2.has(this.lockOf(tab))) {
29704
29764
  if (this.peers.delete(tab)) left = true;
29705
29765
  this.others.delete(tab);
29706
29766
  if (this.peerHolds.delete(tab)) this.holdsChanged?.();
@@ -29930,9 +29990,9 @@ var LockService = class {
29930
29990
  case "set":
29931
29991
  return t.set(ask.key, this.ownerFor(from, ask.owner), ask.kind, ask.start, ask.end);
29932
29992
  case "holder": {
29933
- const held = t.holder(ask.key, this.ownerFor(from, ask.owner), ask);
29934
- if (!held) return void 0;
29935
- return { ...held, owner: this.ownerOf.get(held.owner)?.owner ?? held.owner };
29993
+ const held2 = t.holder(ask.key, this.ownerFor(from, ask.owner), ask);
29994
+ if (!held2) return void 0;
29995
+ return { ...held2, owner: this.ownerOf.get(held2.owner)?.owner ?? held2.owner };
29936
29996
  }
29937
29997
  case "wait":
29938
29998
  return this.blockFor(
@@ -29976,15 +30036,15 @@ var LockService = class {
29976
30036
  this.pruner.unref?.();
29977
30037
  }
29978
30038
  async prune() {
29979
- const held = new Set(((await this.locks.query()).held ?? []).map((l) => l.name));
30039
+ const held2 = new Set(((await this.locks.query()).held ?? []).map((l) => l.name));
29980
30040
  for (const [id2, { kernel, owner }] of [...this.ownerOf]) {
29981
- if (held.has(this.aliveOf(kernel))) continue;
30041
+ if (held2.has(this.aliveOf(kernel))) continue;
29982
30042
  this.table.release(id2);
29983
30043
  this.ownerOf.delete(id2);
29984
30044
  this.owners.delete(`${kernel}:${owner}`);
29985
30045
  }
29986
30046
  for (const [name2, token] of [...this.tokens]) {
29987
- if (held.has(this.aliveOf(name2.slice(0, name2.lastIndexOf(":"))))) continue;
30047
+ if (held2.has(this.aliveOf(name2.slice(0, name2.lastIndexOf(":"))))) continue;
29988
30048
  this.table.flocks.drop(token);
29989
30049
  this.tokens.delete(name2);
29990
30050
  }
@@ -30000,11 +30060,11 @@ var LockService = class {
30000
30060
  for (const [id2, p] of this.pending)
30001
30061
  this.channel.postMessage({ id: id2, from: this.kernel, ask: p.ask });
30002
30062
  }
30003
- adopt(from, held) {
30004
- for (const [key, locks] of held.records)
30063
+ adopt(from, held2) {
30064
+ for (const [key, locks] of held2.records)
30005
30065
  for (const l of locks)
30006
30066
  this.table.set(key, this.ownerFor(from, l.owner), l.kind, l.start, l.end);
30007
- for (const [key, owner, kind] of held.flocks)
30067
+ for (const [key, owner, kind] of held2.flocks)
30008
30068
  this.table.flocks.set(key, this.tokenFor(from, owner), kind);
30009
30069
  }
30010
30070
  flockIdOf(owner) {
@@ -30403,23 +30463,23 @@ function bodiless(hop) {
30403
30463
  }
30404
30464
  function replayingHops(inner, heldMs = HELD_MS) {
30405
30465
  if (!inner.traits.redirectHops || inner.traits.manualRedirects) return inner;
30406
- const held = /* @__PURE__ */ new Map();
30466
+ const held2 = /* @__PURE__ */ new Map();
30407
30467
  const drop = (key) => {
30408
- const entry = held.get(key);
30468
+ const entry = held2.get(key);
30409
30469
  if (!entry) return;
30410
- held.delete(key);
30470
+ held2.delete(key);
30411
30471
  clearTimeout(entry.timer);
30412
30472
  void entry.final.cancel().catch(() => void 0);
30413
30473
  };
30414
30474
  const keyOf3 = (owner, method, url) => `${owner} ${method} ${url}`;
30415
30475
  const hold = (key, chain2) => {
30416
30476
  drop(key);
30417
- const mine = [...held.keys()].filter((k) => held.get(k)?.owner === chain2.owner);
30477
+ const mine = [...held2.keys()].filter((k) => held2.get(k)?.owner === chain2.owner);
30418
30478
  if (mine.length >= HELD_PER_OWNER) drop(mine[0]);
30419
- if (held.size >= HELD_MAX2) drop(held.keys().next().value);
30479
+ if (held2.size >= HELD_MAX2) drop(held2.keys().next().value);
30420
30480
  const timer = setTimeout(() => drop(key), heldMs);
30421
30481
  timer.unref?.();
30422
- held.set(key, { ...chain2, timer });
30482
+ held2.set(key, { ...chain2, timer });
30423
30483
  };
30424
30484
  const replay = (chain2) => {
30425
30485
  const [hop, ...rest2] = chain2.hops;
@@ -30448,9 +30508,9 @@ function replayingHops(inner, heldMs = HELD_MS) {
30448
30508
  const [caller] = rest2;
30449
30509
  const owner = caller ?? KERNEL;
30450
30510
  const key = keyOf3(owner, request.method, request.url);
30451
- const waiting = held.get(key);
30511
+ const waiting = held2.get(key);
30452
30512
  if (waiting && waiting.fingerprint === fingerprint(request.headers)) {
30453
- held.delete(key);
30513
+ held2.delete(key);
30454
30514
  clearTimeout(waiting.timer);
30455
30515
  return replay(waiting);
30456
30516
  }
@@ -30758,10 +30818,10 @@ var RenameLog = class {
30758
30818
  }
30759
30819
  return void 0;
30760
30820
  }
30761
- since(seen, held) {
30821
+ since(seen, held2) {
30762
30822
  const now = this.entries.at(-1)?.seq ?? seen;
30763
30823
  const renames = [];
30764
- let paths = [...held];
30824
+ let paths = [...held2];
30765
30825
  for (const { seq: seq2, from, to } of this.entries) {
30766
30826
  if (seq2 <= seen || !paths.some((path) => within9(path, from))) continue;
30767
30827
  renames.push([from, to]);
@@ -30806,11 +30866,11 @@ var PackageLocks = class {
30806
30866
  const { locks } = this;
30807
30867
  if (!locks) return Promise.resolve(() => {
30808
30868
  });
30809
- const { promise: held, resolve: release } = Promise.withResolvers();
30869
+ const { promise: held2, resolve: release } = Promise.withResolvers();
30810
30870
  return new Promise((granted2, failed5) => {
30811
30871
  locks.request(replacingLock(this.metadata, root), { mode: "exclusive" }, () => {
30812
30872
  granted2(() => release());
30813
- return held;
30873
+ return held2;
30814
30874
  }).catch(failed5);
30815
30875
  });
30816
30876
  }
@@ -31480,14 +31540,14 @@ var OpfsFs = class {
31480
31540
  return void 0;
31481
31541
  }
31482
31542
  heldUnder = () => [];
31483
- heldBy(held) {
31484
- this.heldUnder = held;
31543
+ heldBy(held2) {
31544
+ this.heldUnder = held2;
31485
31545
  }
31486
31546
  async pinHeld(dir) {
31487
- const held = this.heldUnder(dir);
31488
- if (held.length === 0) return;
31489
- const known = await this.meta.get(held);
31490
- const bare = held.filter((_, i) => known[i]?.ino === void 0);
31547
+ const held2 = this.heldUnder(dir);
31548
+ if (held2.length === 0) return;
31549
+ const known = await this.meta.get(held2);
31550
+ const bare = held2.filter((_, i) => known[i]?.ino === void 0);
31491
31551
  for (const p of bare) {
31492
31552
  await this.meta.update(p, (entry) => ({ ...occupied(entry), path: p, ino: inodeOf(p) }));
31493
31553
  }
@@ -32927,8 +32987,8 @@ var OpfsFs = class {
32927
32987
  }
32928
32988
  }
32929
32989
  async renamingElsewhere() {
32930
- const { held = [] } = await this.locks.query();
32931
- return held.some(({ name: name2 }) => this.renameHere(name2) && !this.ownLocks.has(name2));
32990
+ const { held: held2 = [] } = await this.locks.query();
32991
+ return held2.some(({ name: name2 }) => this.renameHere(name2) && !this.ownLocks.has(name2));
32932
32992
  }
32933
32993
  lookForRenames() {
32934
32994
  const locks = this.locks;
@@ -32938,8 +32998,8 @@ var OpfsFs = class {
32938
32998
  for (; ; ) {
32939
32999
  const asked = performance.now();
32940
33000
  this.queries++;
32941
- const { held = [] } = await locks.query();
32942
- const unknown = () => held.some(
33001
+ const { held: held2 = [] } = await locks.query();
33002
+ const unknown = () => held2.some(
32943
33003
  ({ name: name2 }) => this.renameHere(name2) && !this.ownLocks.has(name2) && !this.peerMoves.has(name2)
32944
33004
  );
32945
33005
  if (unknown()) await this.learnRenames();
@@ -33120,13 +33180,13 @@ var OpfsFs = class {
33120
33180
  }
33121
33181
  async finishRenames(orphaned = false) {
33122
33182
  const locks = this.locks;
33123
- const held = /* @__PURE__ */ new Set();
33183
+ const held2 = /* @__PURE__ */ new Set();
33124
33184
  if (orphaned && locks) {
33125
33185
  const { held: h = [], pending = [] } = await locks.query();
33126
- for (const lock of [...h, ...pending]) held.add(lock.name);
33186
+ for (const lock of [...h, ...pending]) held2.add(lock.name);
33127
33187
  }
33128
33188
  const intents = (await this.meta.under(RENAMES2)).filter(
33129
- (entry) => entry.rename !== void 0 && (!orphaned || locks !== void 0 && entry.rename.lock !== void 0 && !held.has(entry.rename.lock))
33189
+ (entry) => entry.rename !== void 0 && (!orphaned || locks !== void 0 && entry.rename.lock !== void 0 && !held2.has(entry.rename.lock))
33130
33190
  ).sort(
33131
33191
  (a, b) => a.rename.at - b.rename.at
33132
33192
  );
@@ -36848,34 +36908,34 @@ var Launcher = class {
36848
36908
  known.users++;
36849
36909
  return known.made;
36850
36910
  }
36851
- const held = {
36911
+ const held2 = {
36852
36912
  made: (this.moduleUrl ?? dataModuleUrl)(source),
36853
36913
  users: 1,
36854
36914
  evicted: false
36855
36915
  };
36856
- this.moduleUrls.set(source, held);
36857
- this.urlsInUse.set(held.made.url, held);
36916
+ this.moduleUrls.set(source, held2);
36917
+ this.urlsInUse.set(held2.made.url, held2);
36858
36918
  for (const [old, entry] of this.moduleUrls) {
36859
36919
  if (this.moduleUrls.size <= MODULE_URLS) break;
36860
36920
  this.moduleUrls.delete(old);
36861
36921
  entry.evicted = true;
36862
36922
  this.releaseUrl(entry);
36863
36923
  }
36864
- return held.made;
36924
+ return held2.made;
36865
36925
  }
36866
36926
  heldUrl(program) {
36867
- const held = program.abi === "js" && program.url ? this.urlsInUse.get(program.url) : void 0;
36868
- if (!held) return () => {
36927
+ const held2 = program.abi === "js" && program.url ? this.urlsInUse.get(program.url) : void 0;
36928
+ if (!held2) return () => {
36869
36929
  };
36870
36930
  return () => {
36871
- held.users--;
36872
- this.releaseUrl(held);
36931
+ held2.users--;
36932
+ this.releaseUrl(held2);
36873
36933
  };
36874
36934
  }
36875
- releaseUrl(held) {
36876
- if (!held.evicted || held.users > 0) return;
36877
- if (this.urlsInUse.get(held.made.url) === held) this.urlsInUse.delete(held.made.url);
36878
- held.made.revoke();
36935
+ releaseUrl(held2) {
36936
+ if (!held2.evicted || held2.users > 0) return;
36937
+ if (this.urlsInUse.get(held2.made.url) === held2) this.urlsInUse.delete(held2.made.url);
36938
+ held2.made.revoke();
36879
36939
  }
36880
36940
  async names(path) {
36881
36941
  const beside = `${path}.names`;
@@ -36962,10 +37022,10 @@ var Launcher = class {
36962
37022
  }
36963
37023
  const mine = hold;
36964
37024
  mine.users++;
36965
- let held = true;
37025
+ let held2 = true;
36966
37026
  return () => {
36967
- if (!held) return;
36968
- held = false;
37027
+ if (!held2) return;
37028
+ held2 = false;
36969
37029
  if (--mine.users > 0) return;
36970
37030
  holds3.delete(mine);
36971
37031
  if (holds3.size === 0 && this.imageHolds.get(path) === holds3) this.imageHolds.delete(path);
@@ -37128,16 +37188,16 @@ var Launcher = class {
37128
37188
  let roots = this.packageRoots(planned);
37129
37189
  let stale = false;
37130
37190
  for (; ; ) {
37131
- const held = roots;
37132
- const done4 = await this.packageLocks.loading(held, async (waited) => {
37191
+ const held2 = roots;
37192
+ const done4 = await this.packageLocks.loading(held2, async (waited) => {
37133
37193
  if (!waited && !stale) return { value: await load(planned) };
37134
- this.rootFs.refresh?.(held);
37194
+ this.rootFs.refresh?.(held2);
37135
37195
  this.resetCatalogs();
37136
37196
  if (replan) planned = await replan() ?? planned;
37137
37197
  await recheck?.(planned);
37138
37198
  const now = this.packageRoots(planned);
37139
- if (now.every((root) => held.includes(root))) return { value: await load(planned) };
37140
- roots = [.../* @__PURE__ */ new Set([...held, ...now])].sort();
37199
+ if (now.every((root) => held2.includes(root))) return { value: await load(planned) };
37200
+ roots = [.../* @__PURE__ */ new Set([...held2, ...now])].sort();
37141
37201
  stale = true;
37142
37202
  return void 0;
37143
37203
  });
@@ -37345,7 +37405,7 @@ var Launcher = class {
37345
37405
  unlinkGate: stack.unlinked.gate,
37346
37406
  replacements: stack.unlinked,
37347
37407
  statfs: (path) => this.mounts.statfs(path),
37348
- renames: (since2, held) => this.renameLog.since(since2, held),
37408
+ renames: (since2, held2) => this.renameLog.since(since2, held2),
37349
37409
  fileId: (path) => this.locks.shared?.() === true ? this.rootFileId(path) : void 0,
37350
37410
  announceHold: (path, fid, created4) => this.locks.shared?.() === true && this.mounts.locate(path) === void 0 ? this.rootFs.announceHolds?.([[path, fid]], [], !created4) : void 0,
37351
37411
  renameSeq: (from, to) => this.renameLog.seqOf(from, to),
@@ -37538,17 +37598,17 @@ var Launcher = class {
37538
37598
  const tags = this.tagsOf(pid);
37539
37599
  const cred = this.credOf(pid);
37540
37600
  if (!this.traces.wants(tags, cred)) return;
37541
- const held = this.traceHeld.get(pid);
37542
- if (held) held.events.push({ tags, cred: copyCred(cred), draft: build() });
37601
+ const held2 = this.traceHeld.get(pid);
37602
+ if (held2) held2.events.push({ tags, cred: copyCred(cred), draft: build() });
37543
37603
  else this.traces.publish(tags, cred, build());
37544
37604
  }
37545
37605
  traceAdmitted(pid, fit) {
37546
- const held = this.traceHeld.get(pid);
37547
- if (!held) return;
37606
+ const held2 = this.traceHeld.get(pid);
37607
+ if (!held2) return;
37548
37608
  this.traceHeld.delete(pid);
37549
37609
  if (!fit) return;
37550
- if (held.replaces !== void 0) this.replacedImages.add(held.replaces);
37551
- for (const { tags, cred, draft } of held.events) this.traces.publish(tags, cred, draft);
37610
+ if (held2.replaces !== void 0) this.replacedImages.add(held2.replaces);
37611
+ for (const { tags, cred, draft } of held2.events) this.traces.publish(tags, cred, draft);
37552
37612
  }
37553
37613
  chainTimes(pid) {
37554
37614
  let utime = 0;
@@ -38513,10 +38573,10 @@ var Launcher = class {
38513
38573
  }
38514
38574
  announceHeld() {
38515
38575
  const nodes = [...this.openFiles].flatMap((open) => open.heldIds());
38516
- const held = [...this.held.heldIds(), ...nodes].filter(
38576
+ const held2 = [...this.held.heldIds(), ...nodes].filter(
38517
38577
  ([path]) => this.mounts.locate(path) === void 0 && !path.startsWith(`/${UNLINKED_DIR}/`)
38518
38578
  );
38519
- return held.length === 0 ? void 0 : this.rootFs.announceHolds?.(held, [], false);
38579
+ return held2.length === 0 ? void 0 : this.rootFs.announceHolds?.(held2, [], false);
38520
38580
  }
38521
38581
  rootFileId(path) {
38522
38582
  return this.mounts.locate(path) === void 0 ? this.rootFs.bindId?.(path) : void 0;
@@ -41226,13 +41286,13 @@ async function holdLock(locks) {
41226
41286
  } };
41227
41287
  const name2 = `slicc-kernel-client:${crypto.randomUUID()}`;
41228
41288
  const granted2 = Promise.withResolvers();
41229
- const held = Promise.withResolvers();
41289
+ const held2 = Promise.withResolvers();
41230
41290
  void locks.request(name2, () => {
41231
41291
  granted2.resolve();
41232
- return held.promise;
41292
+ return held2.promise;
41233
41293
  });
41234
41294
  await granted2.promise;
41235
- return { name: name2, release: () => held.resolve() };
41295
+ return { name: name2, release: () => held2.resolve() };
41236
41296
  }
41237
41297
  function concat8(chunks2) {
41238
41298
  const out = new Uint8Array(chunks2.reduce((n, c) => n + c.length, 0));