@ai-ecoverse/slicc-kernel 1.162.1 → 1.163.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.
@@ -2453,8 +2453,8 @@ var init_async_sab = __esm({
2453
2453
  });
2454
2454
 
2455
2455
  // src/process/js/js-kernel.ts
2456
- function devOf(found) {
2457
- const dev = found?.dev;
2456
+ function devOf(found2) {
2457
+ const dev = found2?.dev;
2458
2458
  return typeof dev === "string" ? dev : void 0;
2459
2459
  }
2460
2460
  function umaskRequest(mask) {
@@ -3247,16 +3247,16 @@ function baseOf(file, whence) {
3247
3247
  if (whence === SEEK_END) return file.size();
3248
3248
  throw new WasiError("EINVAL");
3249
3249
  }
3250
- function writeHolder(view, at, found) {
3251
- if (!found) {
3250
+ function writeHolder(view, at, found2) {
3251
+ if (!found2) {
3252
3252
  view.setInt16(at, F_UNLCK, true);
3253
3253
  return;
3254
3254
  }
3255
- view.setInt16(at, found.kind === "read" ? F_RDLCK : F_WRLCK, true);
3255
+ view.setInt16(at, found2.kind === "read" ? F_RDLCK : F_WRLCK, true);
3256
3256
  view.setInt16(at + 2, SEEK_SET, true);
3257
- view.setBigInt64(at + 8, capturedBigInt(found.start), true);
3258
- view.setBigInt64(at + 16, capturedBigInt(found.len), true);
3259
- view.setInt32(at + 24, found.pid, true);
3257
+ view.setBigInt64(at + 8, capturedBigInt(found2.start), true);
3258
+ view.setBigInt64(at + 16, capturedBigInt(found2.len), true);
3259
+ view.setInt32(at + 24, found2.pid, true);
3260
3260
  }
3261
3261
  function lockImports(host) {
3262
3262
  return {
@@ -3389,9 +3389,9 @@ var init_wasi_cred = __esm({
3389
3389
  }
3390
3390
  return this.cred;
3391
3391
  }
3392
- change(apply3) {
3392
+ change(apply4) {
3393
3393
  const seen = this.gen();
3394
- const cred = apply3();
3394
+ const cred = apply4();
3395
3395
  if (!this.shared) {
3396
3396
  this.cred = cred;
3397
3397
  return cred;
@@ -4710,11 +4710,11 @@ function pollOneoff(deps, inPtr, outPtr, nsubs, neventsPtr) {
4710
4710
  if (nsubs === 0) return E.INVAL;
4711
4711
  const { mem } = deps;
4712
4712
  const subs = readSubscriptions(mem, inPtr, nsubs, deps.now);
4713
- const found = classify(deps.fds, subs);
4714
- const { events, read: read2, write: write2 } = found;
4713
+ const found2 = classify(deps.fds, subs);
4714
+ const { events, read: read2, write: write2 } = found2;
4715
4715
  const entered = deps.entered === true && deps.interruptWakes !== true;
4716
4716
  const waits = read2.length > 0 || write2.length > 0 || events.length === 0;
4717
- const interrupted = waits && waitEvents(deps, subs, found, entered);
4717
+ const interrupted = waits && waitEvents(deps, subs, found2, entered);
4718
4718
  const after = capturedperformance.now();
4719
4719
  if (entered && events.length === 0 && !subs.some((s) => s.deadline <= after)) return E.INTR;
4720
4720
  for (const s of subs) {
@@ -4737,7 +4737,7 @@ var init_wasi_poll = __esm({
4737
4737
  });
4738
4738
 
4739
4739
  // src/process/wasi/wasi-sigmask.ts
4740
- var UNBLOCKABLE, LIBC_UNBLOCKABLE, FOREVER, NS_PER_MS2, POLL_MS, SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK, kernelBits, libcBits, apply2, WasiSigmask;
4740
+ var UNBLOCKABLE, LIBC_UNBLOCKABLE, FOREVER, NS_PER_MS2, POLL_MS, SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK, kernelBits, libcBits, apply3, WasiSigmask;
4741
4741
  var init_wasi_sigmask = __esm({
4742
4742
  "src/process/wasi/wasi-sigmask.ts"() {
4743
4743
  "use strict";
@@ -4755,7 +4755,7 @@ var init_wasi_sigmask = __esm({
4755
4755
  SIG_SETMASK = 2;
4756
4756
  kernelBits = (lo) => lo << 1 & ~UNBLOCKABLE;
4757
4757
  libcBits = (bits) => bits >>> 1 & ~LIBC_UNBLOCKABLE;
4758
- apply2 = (how, mask, set) => {
4758
+ apply3 = (how, mask, set) => {
4759
4759
  if (how === SIG_BLOCK) return mask | set;
4760
4760
  if (how === SIG_UNBLOCK) return mask & ~set;
4761
4761
  return set;
@@ -4781,8 +4781,8 @@ var init_wasi_sigmask = __esm({
4781
4781
  set(how, setLo, setHi, old) {
4782
4782
  if (how !== SIG_BLOCK && how !== SIG_UNBLOCK && how !== SIG_SETMASK) return E.INVAL;
4783
4783
  old(this.lo >>> 0, this.hi >>> 0);
4784
- this.lo = apply2(how, this.lo, setLo | 0) & ~LIBC_UNBLOCKABLE;
4785
- this.hi = apply2(how, this.hi, setHi | 0);
4784
+ this.lo = apply3(how, this.lo, setLo | 0) & ~LIBC_UNBLOCKABLE;
4785
+ this.hi = apply3(how, this.hi, setHi | 0);
4786
4786
  const now = kernelBits(this.lo);
4787
4787
  storeBlocked(this.header, [now, this.hi]);
4788
4788
  if ((capturedAtomics.load(this.header, SAB_I_SIGNALS) & ~now) !== 0) this.deliver();
@@ -5400,8 +5400,8 @@ function wasixSocketImports(host, preview1) {
5400
5400
  sock_set_opt_time: (fd) => void socket(fd),
5401
5401
  sock_send_file: () => E.NOSYS,
5402
5402
  resolve: (name2, len, _port, addrs, naddrs, out) => {
5403
- const found = call3({ op: "sock-resolve", name: mem.string(name2, len), family: 0 });
5404
- const ips = found.map(ipBytes).filter((ip) => ip !== void 0);
5403
+ const found2 = call3({ op: "sock-resolve", name: mem.string(name2, len), family: 0 });
5404
+ const ips = found2.map(ipBytes).filter((ip) => ip !== void 0);
5405
5405
  if (ips.length === 0) throw new WasiError("ENOENT");
5406
5406
  if (naddrs < 1) throw new WasiError("EINVAL");
5407
5407
  const view = mem.view();
@@ -7365,7 +7365,7 @@ var init_version = __esm({
7365
7365
  "src/version.ts"() {
7366
7366
  "use strict";
7367
7367
  init_captured_globals();
7368
- KERNEL_VERSION = true ? "1.162.1" : "0.0.0-dev";
7368
+ KERNEL_VERSION = true ? "1.163.0" : "0.0.0-dev";
7369
7369
  OS_RELEASE = "6.0.0-slicc";
7370
7370
  }
7371
7371
  });
@@ -8305,8 +8305,8 @@ async function secureCall(call3, what = "connect") {
8305
8305
  }
8306
8306
  }
8307
8307
  function errnoName(errno2) {
8308
- const found = capturedObject.entries(E).find(([, n]) => n === errno2);
8309
- return found ? `E${found[0]}` : "EIO";
8308
+ const found2 = capturedObject.entries(E).find(([, n]) => n === errno2);
8309
+ return found2 ? `E${found2[0]}` : "EIO";
8310
8310
  }
8311
8311
  function addressOf(addr) {
8312
8312
  const inet = addr;
@@ -10148,16 +10148,16 @@ function readFlock(view, at, base) {
10148
10148
  const start2 = base(view.getInt16(at + 2, true)) + capturedNumber(view.getBigInt64(at + 8, true));
10149
10149
  return { kind, start: start2, len: capturedNumber(view.getBigInt64(at + 16, true)) };
10150
10150
  }
10151
- function writeHolder2(view, at, found) {
10152
- if (!found) {
10151
+ function writeHolder2(view, at, found2) {
10152
+ if (!found2) {
10153
10153
  view.setInt16(at, F_UNLCK2, true);
10154
10154
  return;
10155
10155
  }
10156
- view.setInt16(at, found.kind === "read" ? F_RDLCK2 : F_WRLCK2, true);
10156
+ view.setInt16(at, found2.kind === "read" ? F_RDLCK2 : F_WRLCK2, true);
10157
10157
  view.setInt16(at + 2, 0, true);
10158
- view.setBigInt64(at + 8, capturedBigInt(found.start), true);
10159
- view.setBigInt64(at + 16, capturedBigInt(found.len), true);
10160
- view.setInt32(at + 24, found.pid, true);
10158
+ view.setBigInt64(at + 8, capturedBigInt(found2.start), true);
10159
+ view.setBigInt64(at + 16, capturedBigInt(found2.len), true);
10160
+ view.setInt32(at + 24, found2.pid, true);
10161
10161
  }
10162
10162
  function refused2(kind, flags) {
10163
10163
  const access = flags & O_ACCMODE2;
@@ -10457,8 +10457,8 @@ function pathOpensLinks(Fs) {
10457
10457
  function importKey(namespace, name2, glue) {
10458
10458
  const own2 = glue?.[name2];
10459
10459
  if (typeof own2 === "function") {
10460
- const found = capturedObject.keys(namespace).find((k) => namespace[k] === own2);
10461
- if (found !== void 0) return found;
10460
+ const found2 = capturedObject.keys(namespace).find((k) => namespace[k] === own2);
10461
+ if (found2 !== void 0) return found2;
10462
10462
  }
10463
10463
  const literal = LITERALS[name2];
10464
10464
  return typeof namespace[literal] === "function" ? literal : void 0;
@@ -10566,8 +10566,8 @@ function namespaces(imports) {
10566
10566
  }
10567
10567
  function keyOf(namespace, name2, glue) {
10568
10568
  const own2 = glue?.[name2];
10569
- const found = typeof own2 === "function" ? capturedObject.keys(namespace).find((k) => namespace[k] === own2) : void 0;
10570
- return found ?? (typeof namespace[name2] === "function" ? name2 : void 0);
10569
+ const found2 = typeof own2 === "function" ? capturedObject.keys(namespace).find((k) => namespace[k] === own2) : void 0;
10570
+ return found2 ?? (typeof namespace[name2] === "function" ? name2 : void 0);
10571
10571
  }
10572
10572
  function syncFsync(imports, fs, glue) {
10573
10573
  for (const namespace of namespaces(imports)) {
@@ -10688,8 +10688,8 @@ function wasmMemory(instance, imports) {
10688
10688
  const exported = capturedObject.values(instance.exports).find(isMemory);
10689
10689
  if (exported) return exported;
10690
10690
  for (const namespace of capturedObject.values(imports)) {
10691
- const found = capturedObject.values(namespace ?? {}).find(isMemory);
10692
- if (found) return found;
10691
+ const found2 = capturedObject.values(namespace ?? {}).find(isMemory);
10692
+ if (found2) return found2;
10693
10693
  }
10694
10694
  return void 0;
10695
10695
  }
@@ -11426,7 +11426,7 @@ function attr(node) {
11426
11426
  function withPidFiles(names, extra) {
11427
11427
  return [...new capturedSet([...names, ...PID_FILES, ...extra])];
11428
11428
  }
11429
- function exeNodes(fresh, info, error, self) {
11429
+ function exeNodes(fresh, info, error, self2) {
11430
11430
  return {
11431
11431
  exeLink: (parent, target, own2 = false) => {
11432
11432
  const of = info(target, own2);
@@ -11434,7 +11434,7 @@ function exeNodes(fresh, info, error, self) {
11434
11434
  if (!of || exe === void 0) throw error();
11435
11435
  const link = fresh(parent, "exe", LINK_MODE2);
11436
11436
  link.node_ops.readlink = () => {
11437
- if (!mayTrace(info(self, true), of)) throw error(EACCES);
11437
+ if (!mayTrace(info(self2, true), of)) throw error(EACCES);
11438
11438
  return exe;
11439
11439
  };
11440
11440
  return link;
@@ -11447,10 +11447,10 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
11447
11447
  const procList = sys.procList?.bind(sys);
11448
11448
  if (!lookupPath || !createNode || !hashRemoveNode || !procList) return;
11449
11449
  let proc;
11450
- let self;
11450
+ let self2;
11451
11451
  try {
11452
11452
  proc = lookupPath.call(Fs, "/proc", { follow: true }).node;
11453
- self = lookupPath.call(Fs, "/proc/self", { follow: true }).node;
11453
+ self2 = lookupPath.call(Fs, "/proc/self", { follow: true }).node;
11454
11454
  } catch {
11455
11455
  return;
11456
11456
  }
@@ -11522,12 +11522,12 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
11522
11522
  };
11523
11523
  const scans = new capturedMap();
11524
11524
  const listed2 = (target) => {
11525
- let found = false;
11525
+ let found2 = false;
11526
11526
  for (const [stream, pids] of scans) {
11527
11527
  if (Fs.streams && Fs.streams[stream.fd ?? -1] !== stream) scans.delete(stream);
11528
- else found ||= pids.has(target);
11528
+ else found2 ||= pids.has(target);
11529
11529
  }
11530
- return found;
11530
+ return found2;
11531
11531
  };
11532
11532
  const procOps2 = proc.node_ops;
11533
11533
  const lookup2 = procOps2.lookup?.bind(procOps2);
@@ -11589,16 +11589,16 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
11589
11589
  dirOps.close?.(stream);
11590
11590
  }
11591
11591
  };
11592
- hashRemoveNode.call(Fs, self);
11592
+ hashRemoveNode.call(Fs, self2);
11593
11593
  const link = fresh(proc, "self", LINK_MODE2);
11594
11594
  const shownPid = () => capturedString(find2(procList().processes, pid, true)?.pid ?? pid);
11595
11595
  link.node_ops.readlink = shownPid;
11596
11596
  const procLookup = proc.node_ops.lookup;
11597
- proc.node_ops.lookup = (parent, name2) => name2 === "self" ? link : name2 === shownPid() ? self : procLookup(parent, name2);
11598
- const selfOps = self.node_ops;
11597
+ proc.node_ops.lookup = (parent, name2) => name2 === "self" ? link : name2 === shownPid() ? self2 : procLookup(parent, name2);
11598
+ const selfOps = self2.node_ops;
11599
11599
  const selfLookup = selfOps.lookup?.bind(selfOps);
11600
11600
  const selfReaddir = selfOps.readdir?.bind(selfOps);
11601
- self.node_ops = {
11601
+ self2.node_ops = {
11602
11602
  ...selfOps,
11603
11603
  lookup: (parent, name2) => {
11604
11604
  if (name2 === "exe") return exe.exeLink(parent, pid, true);
@@ -11715,9 +11715,9 @@ function failed3(err) {
11715
11715
  const code2 = err?.code;
11716
11716
  return { refused: typeof code2 === "string" ? code2 : "ENOENT" };
11717
11717
  }
11718
- function refusalOf(found) {
11719
- if (found === true) return void 0;
11720
- return found === false ? { refused: "ENOTDIR" } : found;
11718
+ function refusalOf(found2) {
11719
+ if (found2 === true) return void 0;
11720
+ return found2 === false ? { refused: "ENOTDIR" } : found2;
11721
11721
  }
11722
11722
  function throughLink(target, done, todo) {
11723
11723
  const parts = target.split("/").filter((part) => part !== "");
@@ -12695,9 +12695,9 @@ function syncPathOps(kernel, resolve2, statOf, open, clean) {
12695
12695
  exists(path) {
12696
12696
  const abs = resolve2(path);
12697
12697
  if (inDev(abs)) return devSync(kernel, devExists(abs));
12698
- const found = kernel.json({ op: "exists", path: abs, devs: true });
12699
- if (found === true) return true;
12700
- const devPath = devOf(found);
12698
+ const found2 = kernel.json({ op: "exists", path: abs, devs: true });
12699
+ if (found2 === true) return true;
12700
+ const devPath = devOf(found2);
12701
12701
  return devPath ? devSync(kernel, devExists(devPath)) : false;
12702
12702
  },
12703
12703
  readdir(path) {
@@ -14111,8 +14111,8 @@ function anySelect(Fs, transport, read2, write2, timeoutMs2) {
14111
14111
  for (; ; ) {
14112
14112
  const local3 = ownReady(Fs, read2.filter(own2), write2.filter(own2));
14113
14113
  const pending = local3.read.length > 0 || local3.write.length > 0;
14114
- const slice = pending ? 0 : capturedMath.min(SELECT_SLICE_MS, capturedMath.max(0, deadline - capturedDate.now()));
14115
- const got = kernelSelect(Fs, transport, kernelRead, kernelWrite, slice);
14114
+ const slice2 = pending ? 0 : capturedMath.min(SELECT_SLICE_MS, capturedMath.max(0, deadline - capturedDate.now()));
14115
+ const got = kernelSelect(Fs, transport, kernelRead, kernelWrite, slice2);
14116
14116
  if (typeof got === "number") return got;
14117
14117
  const ready = { read: [...local3.read, ...got.read], write: [...local3.write, ...got.write] };
14118
14118
  if (ready.read.length > 0 || ready.write.length > 0 || capturedDate.now() >= deadline) {
@@ -15914,8 +15914,8 @@ function resolvePath(cwd, path) {
15914
15914
  function killer(d) {
15915
15915
  return (pid, signal = "SIGTERM") => {
15916
15916
  const sig = signal === 0 ? 0 : signalNumber(signal);
15917
- const self = sig !== 0 && includesSelf(d.syncKernel, d.self, pid);
15918
- if (!self || d.kernel.disposition(sig) !== "terminate") {
15917
+ const self2 = sig !== 0 && includesSelf(d.syncKernel, d.self, pid);
15918
+ if (!self2 || d.kernel.disposition(sig) !== "terminate") {
15919
15919
  d.syncKernel.call({ op: "proc-kill", pid, sig });
15920
15920
  return;
15921
15921
  }
@@ -15930,8 +15930,8 @@ function killer(d) {
15930
15930
  });
15931
15931
  };
15932
15932
  }
15933
- function includesSelf(kernel, self, pid) {
15934
- if (pid === self || pid === 0) return true;
15933
+ function includesSelf(kernel, self2, pid) {
15934
+ if (pid === self2 || pid === 0) return true;
15935
15935
  if (pid > 0 || pid === -1) return false;
15936
15936
  return kernel.json({ op: "proc-getpgid", pid: 0 }) === -pid;
15937
15937
  }
@@ -16183,9 +16183,11 @@ function measured(measure) {
16183
16183
  return out;
16184
16184
  }
16185
16185
  function realmOps(o) {
16186
+ const hook = o.stackFormatter;
16186
16187
  return {
16187
16188
  runScript: scriptRunner(o.runScript),
16188
- promiseState: (promise) => o.promiseState?.(promise)
16189
+ promiseState: (promise) => o.promiseState?.(promise),
16190
+ ...hook ? { setStackFormatter: (fn) => hook(fn) } : {}
16189
16191
  };
16190
16192
  }
16191
16193
  function scriptRunner(run) {
@@ -16485,9 +16487,9 @@ function pathOps(kernel, resolve2, statOf, open, clean) {
16485
16487
  async exists(path) {
16486
16488
  const abs = resolve2(path);
16487
16489
  if (inDev(abs)) return devAsync(kernel, devExists(abs));
16488
- const found = await kernel.json({ op: "exists", path: abs, devs: true });
16489
- if (found === true) return true;
16490
- const devPath = devOf(found);
16490
+ const found2 = await kernel.json({ op: "exists", path: abs, devs: true });
16491
+ if (found2 === true) return true;
16492
+ const devPath = devOf(found2);
16491
16493
  return devPath ? devAsync(kernel, devExists(devPath)) : false;
16492
16494
  },
16493
16495
  async readdir(path) {
@@ -16780,6 +16782,7 @@ async function runJs(init, port3, deps, thread) {
16780
16782
  runScript: deps.runScript,
16781
16783
  modulePath: modulePathOf(init.program),
16782
16784
  promiseState: deps.promiseState,
16785
+ stackFormatter: deps.stackFormatter,
16783
16786
  ...thread?.owned ? { owned: thread.owned } : {},
16784
16787
  held: init.held,
16785
16788
  failed: () => failedWith
@@ -16908,8 +16911,8 @@ var init_dylink = __esm({
16908
16911
  // src/process/wasi/wasi-module.ts
16909
16912
  function libcVersion(module) {
16910
16913
  for (const section2 of capturedWebAssembly.Module.customSections(module, "slicc.libc")) {
16911
- const found = LIBC_MARK.exec(new capturedTextDecoder().decode(section2));
16912
- if (found) return capturedNumber(found[1]);
16914
+ const found2 = LIBC_MARK.exec(new capturedTextDecoder().decode(section2));
16915
+ if (found2) return capturedNumber(found2[1]);
16913
16916
  }
16914
16917
  return void 0;
16915
16918
  }
@@ -17979,9 +17982,9 @@ var init_wasix_linker = __esm({
17979
17982
  }
17980
17983
  }
17981
17984
  symbol(handle, name2) {
17982
- const found = handle === 0 ? this.find(name2) : this.findIn(this.module(handle), name2, new capturedSet());
17983
- if (!found) throw new DlError(`undefined symbol: ${name2}`);
17984
- const [owner, value2] = found;
17985
+ const found2 = handle === 0 ? this.find(name2) : this.findIn(this.module(handle), name2, new capturedSet());
17986
+ if (!found2) throw new DlError(`undefined symbol: ${name2}`);
17987
+ const [owner, value2] = found2;
17985
17988
  if (typeof value2 === "function") return this.slot(value2, owner, name2);
17986
17989
  if (value2 instanceof capturedWebAssembly.Global) return this.baseOf(owner) + value2.value;
17987
17990
  throw new DlError(`${name2} is neither a function nor data`);
@@ -18212,14 +18215,14 @@ var init_wasix_linker = __esm({
18212
18215
  };
18213
18216
  }
18214
18217
  addressOrNull(name2) {
18215
- const found = this.find(name2);
18216
- if (!found || !(found[1] instanceof capturedWebAssembly.Global)) return 0;
18217
- return this.baseOf(found[0]) + found[1].value;
18218
+ const found2 = this.find(name2);
18219
+ if (!found2 || !(found2[1] instanceof capturedWebAssembly.Global)) return 0;
18220
+ return this.baseOf(found2[0]) + found2[1].value;
18218
18221
  }
18219
18222
  slotOrNull(name2) {
18220
- const found = this.find(name2);
18221
- if (!found || typeof found[1] !== "function") return 0;
18222
- return this.slot(found[1], found[0], name2);
18223
+ const found2 = this.find(name2);
18224
+ if (!found2 || typeof found2[1] !== "function") return 0;
18225
+ return this.slot(found2[1], found2[0], name2);
18223
18226
  }
18224
18227
  find(name2) {
18225
18228
  const inMain = this.main?.exports[name2];
@@ -18236,8 +18239,8 @@ var init_wasix_linker = __esm({
18236
18239
  const v = m.instance.exports[name2];
18237
18240
  if (v !== void 0) return [m.handle, v];
18238
18241
  for (const h of m.needed) {
18239
- const found = this.findIn(this.module(h), name2, seen);
18240
- if (found) return found;
18242
+ const found2 = this.findIn(this.module(h), name2, seen);
18243
+ if (found2) return found2;
18241
18244
  }
18242
18245
  return void 0;
18243
18246
  }
@@ -18288,8 +18291,8 @@ var init_wasix_linker = __esm({
18288
18291
  function futexWait(view, index3, expected, ms, interrupted) {
18289
18292
  const deadline = capturedperformance.now() + ms;
18290
18293
  for (; ; ) {
18291
- const slice = interrupted ? capturedMath.min(FUTEX_SLICE_MS, ms) : ms;
18292
- if (capturedAtomics.wait(view, index3, expected, slice) !== "timed-out") return true;
18294
+ const slice2 = interrupted ? capturedMath.min(FUTEX_SLICE_MS, ms) : ms;
18295
+ if (capturedAtomics.wait(view, index3, expected, slice2) !== "timed-out") return true;
18293
18296
  if (interrupted?.()) return true;
18294
18297
  ms = deadline - capturedperformance.now();
18295
18298
  if (ms <= 0) return false;
@@ -18766,8 +18769,8 @@ function mainModule(lines) {
18766
18769
  function nameFrame(line, module, name2) {
18767
18770
  const m = UNNAMED_FRAME.exec(line);
18768
18771
  if (!m || m[3] !== module) return line;
18769
- const found = name2(capturedNumber(m[4]));
18770
- return found === void 0 ? line : `${m[1]}${found} (${m[2]})`;
18772
+ const found2 = name2(capturedNumber(m[4]));
18773
+ return found2 === void 0 ? line : `${m[1]}${found2} (${m[2]})`;
18771
18774
  }
18772
18775
  function definedFunctions(bytes) {
18773
18776
  let at = 8;
@@ -19326,11 +19329,11 @@ ${frames.join("\n")}` : head;
19326
19329
  }
19327
19330
  function trapReport(e, init, host, where) {
19328
19331
  const warned = [];
19329
- const message2 = trapMessage(e, init.env, where, programNames(host, init.program, warned));
19332
+ const message2 = trapMessage(e, init.env, where, programNames2(host, init.program, warned));
19330
19333
  return [...warned, message2].join(`
19331
19334
  ${init.argv0}: `);
19332
19335
  }
19333
- function programNames(host, program, warned) {
19336
+ function programNames2(host, program, warned) {
19334
19337
  const path = program.names;
19335
19338
  if (path === void 0) return void 0;
19336
19339
  const read2 = (p) => host.o.fs.readFile(p);
@@ -19582,18 +19585,151 @@ var init_wasi_runtime = __esm({
19582
19585
 
19583
19586
  // src/node-process-worker.ts
19584
19587
  init_captured_globals();
19585
- import { createRequire, enableCompileCache, flushCompileCache } from "node:module";
19588
+ import { createRequire as createRequire2, enableCompileCache, flushCompileCache } from "node:module";
19586
19589
  import { parentPort, workerData } from "node:worker_threads";
19587
19590
 
19588
19591
  // src/node-lockdown.ts
19589
19592
  init_captured_globals();
19590
- init_lockdown();
19591
19593
  import { AsyncLocalStorage } from "node:async_hooks";
19594
+ import { createHash } from "node:crypto";
19592
19595
  import { isBuiltin, registerHooks } from "node:module";
19593
19596
  import { resolve, sep } from "node:path";
19594
19597
  import { types } from "node:util";
19595
19598
  import { getHeapStatistics } from "node:v8";
19596
19599
  import { runInThisContext } from "node:vm";
19600
+
19601
+ // src/node-stack.ts
19602
+ init_captured_globals();
19603
+ import { createRequire } from "node:module";
19604
+ var apply = capturedReflect.apply;
19605
+ var push = capturedArray.prototype.push;
19606
+ var startsWith = capturedString.prototype.startsWith;
19607
+ var slice = capturedString.prototype.slice;
19608
+ var lastIndexOf = capturedString.prototype.lastIndexOf;
19609
+ var indexOf = capturedString.prototype.indexOf;
19610
+ var setHas = capturedSet.prototype.has;
19611
+ var setAdd = capturedSet.prototype.add;
19612
+ function internals() {
19613
+ try {
19614
+ const load = createRequire(import.meta.url);
19615
+ const errors = load("internal/errors");
19616
+ const set = errors.setInternalPrepareStackTrace;
19617
+ let fallback = errors.defaultPrepareStackTrace;
19618
+ if (capturedprocess.sourceMapsEnabled) {
19619
+ fallback = load("internal/source_map/prepare_stack_trace").prepareStackTraceWithSourceMaps;
19620
+ }
19621
+ if (typeof set !== "function" || typeof fallback !== "function") return void 0;
19622
+ return {
19623
+ setInternalPrepareStackTrace: set,
19624
+ fallback
19625
+ };
19626
+ } catch {
19627
+ return void 0;
19628
+ }
19629
+ }
19630
+ function ownSite() {
19631
+ const saved = capturedObject.getOwnPropertyDescriptor(capturedError, "prepareStackTrace");
19632
+ try {
19633
+ capturedObject.defineProperty(capturedError, "prepareStackTrace", {
19634
+ value: (_, sites) => sites[0],
19635
+ configurable: true,
19636
+ writable: true
19637
+ });
19638
+ return new capturedError().stack;
19639
+ } finally {
19640
+ delete capturedError.prepareStackTrace;
19641
+ capturedObject.defineProperties(capturedError, saved ? { prepareStackTrace: saved } : {});
19642
+ }
19643
+ }
19644
+ var self = ownSite();
19645
+ var proto = capturedObject.getPrototypeOf(self);
19646
+ var fileOf = proto.getFileName;
19647
+ var hashOf = proto.getScriptHash;
19648
+ var isEval = proto.isEval;
19649
+ var originOf = proto.getEvalOrigin;
19650
+ var ownHash = apply(hashOf, self, []);
19651
+ var programHashes = new capturedSet();
19652
+ var programNames = new capturedSet();
19653
+ function programScript(name2, hash) {
19654
+ apply(setAdd, programNames, [name2]);
19655
+ apply(setAdd, programHashes, [hash]);
19656
+ }
19657
+ function programName(name2) {
19658
+ return apply(startsWith, name2, ["data:"]) === true || apply(setHas, programNames, [name2]) === true;
19659
+ }
19660
+ function rootOrigin(origin) {
19661
+ let at = origin;
19662
+ while (apply(startsWith, at, ["eval at "]) === true) {
19663
+ const open = apply(indexOf, at, [" ("]);
19664
+ if (open < 0) return "";
19665
+ let depth = 1;
19666
+ let i = open + 2;
19667
+ for (; i < at.length && depth > 0; i++) {
19668
+ const c = at[i];
19669
+ if (c === "(") depth++;
19670
+ else if (c === ")") depth--;
19671
+ }
19672
+ if (depth !== 0) return "";
19673
+ at = apply(slice, at, [open + 2, i - 1]);
19674
+ }
19675
+ let end = at.length;
19676
+ for (let n = 0; n < 2; n++) {
19677
+ const colon = apply(lastIndexOf, at, [":", end - 1]);
19678
+ if (colon <= 0) break;
19679
+ end = colon;
19680
+ }
19681
+ return apply(slice, at, [0, end]);
19682
+ }
19683
+ function keptFrame(site) {
19684
+ const hash = apply(hashOf, site, []);
19685
+ if (hash === ownHash) return false;
19686
+ if (apply(isEval, site, []) === true) {
19687
+ const origin = apply(originOf, site, []);
19688
+ return typeof origin === "string" && programName(rootOrigin(origin));
19689
+ }
19690
+ const file = apply(fileOf, site, []);
19691
+ if (typeof file !== "string") return true;
19692
+ if (apply(setHas, programHashes, [hash]) === true) return true;
19693
+ return apply(startsWith, file, ["node:"]) === true || programName(file);
19694
+ }
19695
+ function keptFrames(trace) {
19696
+ const out = [];
19697
+ for (let i = 0; i < trace.length; i++) {
19698
+ const site = trace[i];
19699
+ if (keptFrame(site)) apply(push, out, [site]);
19700
+ }
19701
+ return out;
19702
+ }
19703
+ var formatter = null;
19704
+ var formatting = false;
19705
+ function stackDispatcher(fallback) {
19706
+ return (error, trace) => {
19707
+ const fn = formatter;
19708
+ if (fn === null || formatting) return apply(fallback, void 0, [error, trace]);
19709
+ formatting = true;
19710
+ try {
19711
+ const out = apply(fn, void 0, [error, keptFrames(trace)]);
19712
+ if (typeof out === "string") return out;
19713
+ } catch {
19714
+ } finally {
19715
+ formatting = false;
19716
+ }
19717
+ return apply(fallback, void 0, [error, trace]);
19718
+ };
19719
+ }
19720
+ var found = internals();
19721
+ if (found) found.setInternalPrepareStackTrace(stackDispatcher(found.fallback));
19722
+ var nodeStackFormatter = found ? (fn) => {
19723
+ if (fn !== null && typeof fn !== "function") {
19724
+ throw new capturedTypeError("setStackFormatter needs a function or null");
19725
+ }
19726
+ const previous = formatter;
19727
+ formatter = fn;
19728
+ return previous;
19729
+ } : void 0;
19730
+
19731
+ // src/node-lockdown.ts
19732
+ init_lockdown();
19597
19733
  var NODE_GLOBALS = ["localStorage", "sessionStorage"];
19598
19734
  var NODE_SLOTS = [
19599
19735
  "require",
@@ -19628,6 +19764,11 @@ var SOURCE_MODULE = "slicc-module:";
19628
19764
  var sources = new capturedMap();
19629
19765
  function moduleSource(url, source) {
19630
19766
  sources.set(url, source);
19767
+ programScript(url, url.slice(SOURCE_MODULE.length));
19768
+ }
19769
+ var sha256 = createHash;
19770
+ function sourceHash(source) {
19771
+ return sha256("sha256").update(source).digest("hex");
19631
19772
  }
19632
19773
  function refuseModules() {
19633
19774
  registerHooks({
@@ -19713,6 +19854,7 @@ function nodeRunScript(source, filename) {
19713
19854
  const options = blank(null);
19714
19855
  options.filename = filename;
19715
19856
  options.displayErrors = false;
19857
+ programScript(filename, sourceHash(source));
19716
19858
  return freeze({ value: runHere(source, options), completion: true });
19717
19859
  }
19718
19860
  var isPromise = types.isPromise;
@@ -19852,7 +19994,7 @@ function internal(list, name2) {
19852
19994
  function probe(promise, group, key) {
19853
19995
  const promiseId = idOf(key, promise, group);
19854
19996
  if (promiseId === void 0) return void 0;
19855
- const found = own(
19997
+ const found2 = own(
19856
19998
  post("Runtime.getProperties", {
19857
19999
  objectId: promiseId,
19858
20000
  ownProperties: true,
@@ -19860,9 +20002,9 @@ function probe(promise, group, key) {
19860
20002
  }),
19861
20003
  "internalProperties"
19862
20004
  );
19863
- const state = own(internal(found, "[[PromiseState]]"), "value");
20005
+ const state = own(internal(found2, "[[PromiseState]]"), "value");
19864
20006
  if (state === "pending") return seal({ state, value: void 0 });
19865
- const result = internal(found, "[[PromiseResult]]");
20007
+ const result = internal(found2, "[[PromiseResult]]");
19866
20008
  const resultId = own(result, "objectId");
19867
20009
  if (typeof resultId !== "string") return seal({ state, value: primitive(result) });
19868
20010
  const holder = nothing(null);
@@ -19899,7 +20041,7 @@ function nodePromiseState(promise) {
19899
20041
  }
19900
20042
  }
19901
20043
  var Storage = AsyncLocalStorage;
19902
- var apply = capturedReflect.apply;
20044
+ var apply2 = capturedReflect.apply;
19903
20045
  var freeze = capturedObject.freeze;
19904
20046
  var blank = capturedObject.create;
19905
20047
  function nodeAsyncContext() {
@@ -19910,7 +20052,7 @@ function nodeAsyncContext() {
19910
20052
  const api = blank(null);
19911
20053
  api.run = freeze((store, fn, ...args) => {
19912
20054
  if (typeof fn !== "function") throw new capturedTypeError("asyncContext.run needs a function");
19913
- return run(store, () => apply(fn, void 0, args));
20055
+ return run(store, () => apply2(fn, void 0, args));
19914
20056
  });
19915
20057
  api.getStore = freeze(() => getStore());
19916
20058
  api.enterWith = freeze((store) => enterWith(store));
@@ -19990,7 +20132,7 @@ function processEntry(port3, run = runWasmProcess, wasi = loadWasi, js = loadJs,
19990
20132
  init_process_runtime();
19991
20133
  init_wasi_runtime();
19992
20134
  var scope = capturedGlobalThis;
19993
- scope.require ??= createRequire(import.meta.url);
20135
+ scope.require ??= createRequire2(import.meta.url);
19994
20136
  scope.__filename ??= new capturedURL(import.meta.url).pathname;
19995
20137
  scope.__dirname ??= new capturedURL(".", import.meta.url).pathname;
19996
20138
  var data = workerData;
@@ -20018,6 +20160,7 @@ var onMessage = processEntry(
20018
20160
  runScript: nodeRunScript,
20019
20161
  moduleSource,
20020
20162
  promiseState: nodePromiseState,
20163
+ stackFormatter: nodeStackFormatter,
20021
20164
  imported
20022
20165
  }),
20023
20166
  runJsThread: (init, at) => runJsThread(init, at, {
@@ -20028,6 +20171,7 @@ var onMessage = processEntry(
20028
20171
  runScript: nodeRunScript,
20029
20172
  moduleSource,
20030
20173
  promiseState: nodePromiseState,
20174
+ stackFormatter: nodeStackFormatter,
20031
20175
  imported
20032
20176
  })
20033
20177
  }),